@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
74 lines • 4.16 kB
TypeScript
import type { AirtableAccessor } from '../../accessor/airtable.ts';
import { type RetryPolicy } from '../api/client.ts';
import { type PageShape } from '../api/paginate.ts';
import { type Row } from './normalize.ts';
export declare const BASES: PageShape;
export declare const RECORDS: PageShape;
export declare const COMMENTS: PageShape;
export declare const RETRY: RetryPolicy;
export declare const WRITE_RETRY: RetryPolicy;
/** Every base the token reaches, narrowed to the configured `baseIds`. */
export declare function listBases(accessor: AirtableAccessor): Promise<Row[]>;
/** A base's schema: its tables with their fields and views. */
export declare function listTables(accessor: AirtableAccessor, baseId: string): Promise<Row[]>;
/**
* A table's records in the API's order, or a view's. Without a view
* Airtable calls the order arbitrary; it is the order the table hands out,
* stable between calls, and the only one a `maxRecords` prefix agrees with.
* The table and the view are named by id or by name; `formula` is
* `filterByFormula`, listing only the records it is true for; `maxRecords`
* stops after that many records, both on the wire and in the collector.
*/
/** A base's webhooks, each with `cursorForNextPayload`. Mirrors Python `list_webhooks`. */
export declare function listWebhooks(accessor: AirtableAccessor, baseId: string): Promise<Row[]>;
/**
* One page of a webhook's payloads from `cursor` (null for the oldest Airtable
* still keeps): `payloads`, the `cursor` after them, and `mightHaveMore`.
* Mirrors Python `webhook_payloads`.
*/
export declare function webhookPayloads(accessor: AirtableAccessor, baseId: string, webhookId: string, cursor: number | null): Promise<Row>;
export declare function listRecords(accessor: AirtableAccessor, baseId: string, tableId: string, options?: {
view?: string;
formula?: string;
maxRecords?: number;
}): Promise<Row[]>;
/**
* A table's records as `listRecords` lists them, one page at a time, the
* next page fetched only when the caller pulls it. Mirrors Python's
* `record_pages`.
*/
export declare function recordPages(accessor: AirtableAccessor, baseId: string, tableId: string, options?: {
view?: string;
maxRecords?: number;
}): AsyncGenerator<Row[], void>;
/** One record by id; the table is named by id or by name. */
export declare function getRecord(accessor: AirtableAccessor, baseId: string, tableId: string, recordId: string): Promise<Row>;
/**
* Create records ten to a request, yielding each request's records. Each
* entry is a new record's cell map, keyed by field name; `typecast` lets
* Airtable convert string values to the field types. A request that fails
* throws after every earlier one landed, so the caller holds exactly what
* was written.
*/
export declare function createRecords(accessor: AirtableAccessor, baseId: string, tableId: string, cells: readonly Row[], options?: {
typecast?: boolean;
}): AsyncGenerator<Row[]>;
/**
* Patch records ten to a request, yielding each request's records. A
* PATCH, never a PUT: a cell the update leaves out keeps its value. Each
* entry is a record id and the cells to change, keyed by field name.
*/
export declare function updateRecords(accessor: AirtableAccessor, baseId: string, tableId: string, updates: readonly (readonly [string, Row])[], options?: {
typecast?: boolean;
}): AsyncGenerator<Row[]>;
/**
* Delete records ten to a request, yielding each request's answer. The ids
* ride the query string as `records[]`, which is the only place the
* endpoint reads them from.
*/
export declare function deleteRecords(accessor: AirtableAccessor, baseId: string, tableId: string, recordIds: readonly string[]): AsyncGenerator<Row[]>;
/** A record's comments in the API's order, newest first. */
export declare function listComments(accessor: AirtableAccessor, baseId: string, tableId: string, recordId: string): Promise<Row[]>;
/** Comment on a record as the token's user. */
export declare function createComment(accessor: AirtableAccessor, baseId: string, tableId: string, recordId: string, text: string): Promise<Row>;
//# sourceMappingURL=client.d.ts.map