import type { FieldSet, Table as AirtableSdkTable, Record as AirtableSdkRecord, AirtableOptions } from 'airtable'; import { type QueryParams } from 'airtable/lib/query_params'; import { type Item, type Table } from './mapping/typeUtils'; export type AirtableRecord = Omit, '_table'> & { _table: AirtableTsTable; }; export type AirtableTsTable = AirtableSdkTable
& { fields: { id: string; name: string; type: string; }[]; tsDefinition: Table; __brand?: T; }; type AirtableTsSpecificOptions = { /** The Airtable base schema is used to determine the appropriate type mapper for the field type (for example converting a number to a string representing a date is different to converting a number to a singleLineText). For performance reasons, airtable-ts caches base schemas so we don't refetch it for every request. Note that we always still do validation against the expected type at runtime so the library is always type-safe. @default 120_000 */ baseSchemaCacheDurationMs?: number; /** * How to handle validation failures when reading from Airtable. 'error' throws (default). 'warning' sets failing fields to * type-appropriate default values and optionally calls `onWarning`. */ readValidation?: 'error' | 'warning'; /** Callback for validation failures when `readValidation` is set to 'warning' */ onWarning?: ((warning: unknown) => void | Promise) | undefined; }; export type AirtableTsOptions = AirtableOptions & AirtableTsSpecificOptions; export type CompleteAirtableTsOptions = AirtableTsOptions & Required>; export type ScanParams = Omit, 'fields' | 'cellFormat' | 'method' | 'returnFieldsByFieldId' | 'pageSize' | 'offset'>; export {};