@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
44 lines • 3.49 kB
TypeScript
import { AirtableAccessor } from '../../accessor/airtable.ts';
import { AirtableConfig } from '../../core/airtable/config.ts';
import type { DeltaHook } from '../../events/index.ts';
import type { ByteSource } from '../../io/types.ts';
import type { DirListing, FileStat, PathSpec } from '../../types.ts';
import { BaseVFS } from '../base.ts';
import type { RedactedSchema } from '../secrets.ts';
import type { ConfigState, Handed } from '../types.ts';
export declare const VFS_MD = "```text\n{prefix}\n bases/\n <base-name>__<base-id>/\n base.json # base id, name, permission, tables\n <table-name>__<table-id>/\n table.json # typed fields (with options), views\n records.jsonl # one record per line\n views/\n <view-name>__<view-id>.jsonl # records the view shows, in order\n```\n\n- `ls` a directory first to find exact names: the name part of a segment\n is sanitized, the id after the last `__` is exact.\n- A `records.jsonl` line is a normalized record: `record_id`,\n `created_time` and `fields`, keyed by field name with values as\n Airtable returns them. `table.json` gives each field's type.\n- Airtable omits empty cells, so a missing key means empty, a `false`\n checkbox included. A link field is a list of record ids; an attachment\n URL expires two hours after it was read.\n- `records.jsonl` lists in the API's own order; a view file applies the\n view's filter and sort.\n- A file over `max_read_records` records stops with `File too large`\n after that many, while `head -n N` fetches just N records.\n- The `airtable` CLI, if installed, reaches what a file cannot:\n server-side filters (`airtable record list --formula` or `--view`), one\n record by id (`airtable record get`) and comments\n (`airtable comment list`).\n\n```sh\nhead -n 20 {prefix}/bases/<base>/<table>/records.jsonl | jq .fields\n```";
/**
* Airtable bases as directories, tables as records.jsonl files. Records are
* live data another client may edit at any moment, so reads are never served
* from the file cache; the schema listings still ride the index for its TTL.
* The transport is plain fetch, so one class serves node and the browser.
*/
export declare class AirtableVFS extends BaseVFS {
readonly name: string;
readonly cachesReads: boolean;
readonly sizesAlwaysKnown: boolean;
readonly supportsSnapshot: boolean;
vfsMd: string;
readonly accessor: AirtableAccessor;
readonly handed: {
readonly readdir: readonly ["entry"];
readonly read: readonly ["entry", "parent"];
readonly stat: readonly ["entry"];
readonly linesContaining: readonly ["entry"];
readonly firstLines: readonly ["entry", "parent"];
};
private readonly config;
constructor(config: AirtableConfig, options?: {
fetchFn?: typeof fetch;
});
readdir(path: PathSpec, handed?: Handed): Promise<FileStat[] | DirListing>;
read(path: PathSpec, handed?: Handed): Promise<ByteSource>;
stat(path: PathSpec, handed?: Handed): Promise<FileStat>;
linesContaining(path: PathSpec, text: string, _opts: {
ignoreCase: boolean;
}, handed?: Handed): Promise<ByteSource | null>;
firstLines(path: PathSpec, n: number, handed?: Handed): Promise<Uint8Array | null>;
deltaHook(): DeltaHook;
getState(): ConfigState<RedactedSchema<typeof AirtableConfig>>;
}
//# sourceMappingURL=airtable.d.ts.map