Add Airtable emulator - #192
Open
sahil-shubham wants to merge 9 commits into
Open
Conversation
Contributor
|
@sahil-shubham is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Airtable emulator
Adds a stateful Airtable Data API emulator (
@emulators/airtable, port 4014) — a drop-in for the REST API used by the official Airtable.js and pyairtable SDKs, not a mock.Airtable is the first schema-defined service in the project: bases, tables, fields, and views are user data, and the Data API validates records against them. The package carries a small schema registry (kept inside the package, not in
core) and validates generic record blobs against it.Records
GET /v0/:baseId/:tableIdOrName— list (filterByFormula,sort,fields,view,pageSize,maxRecords,offset,cellFormat,returnFieldsByFieldId)POST /v0/:baseId/:tableIdOrName/listRecords— body-based list for long formulasGET /v0/:baseId/:tableIdOrName/:recordId— get onePOST /v0/:baseId/:tableIdOrName— create single{fields}or batch{records}(up to 10, withtypecast)PATCH /v0/:baseId/:tableIdOrName— batch update, or upsert viaperformUpsert.fieldsToMergeOnPUT /v0/:baseId/:tableIdOrName— batch replacePATCH/PUT /v0/:baseId/:tableIdOrName/:recordId— update (merge) or replace oneDELETE /v0/:baseId/:tableIdOrName/:recordIdandDELETE /v0/:baseId/:tableIdOrName?records[]=...— delete one or batchTables and fields are addressable by id or name.
filterByFormulais a real recursive-descent parser + evaluator over the record's cells, covering the common subset (AND/OR/NOT/IF, comparisons,LOWER/FIND/SEARCH,RECORD_ID,BLANK,IS_AFTER/IS_SAME/DATEADD/TODAY,{Field}refs) with Airtable's loose coercion. It references fields by name (a{fldXXX}id token errors, matching Airtable); computed fields filter on their stored value. Unsupported functions returnINVALID_FILTER_BY_FORMULA.Record comments
GET/POST/DELETE /v0/:baseId/:tableIdOrName/:recordId/comments— threaded,offset-paginated, with author identity and@[usrXXX]mention parsing.Meta and inspector
GET /v0/meta/whoami,GET /v0/meta/bases,GET /v0/meta/bases/:baseId/tablesGET /— tabbed inspector (bases, tables, records, identity) via the sharedui.tsdesign system.Auth, seeding, error envelopes
Auth is relaxed by default so any bearer token works. Seeding takes an explicit schema, or infers fields from records when none are declared; base/table/field ids pass through verbatim. Error responses match the live API, including the two shapes Airtable uses (object form
{"error":{"type","message"}}and the bare-string{"error":"NOT_FOUND"}for unknown base/record).Testing
vitestconformance: a dedicatedfilterByFormulamatrix plus records/comments/meta/error-envelope coverage (55 tests). Verified end to end over real HTTP via the CLI.Not included (deferred)
Webhooks, attachment uploads, and Meta write endpoints are not implemented;
filterByFormulais a documented subset; computed fields are stored, not recomputed; view filters are seeded rather than discovered (the public schema API does not expose them); per-base rate limiting is not emulated.Notes
AGENTS.md: README, docs site, agent skill, andemulate.config.example.yaml.sync-versions --checkpasses (the new package matches the current0.9.0).