import { ExportRecordResult, ExportSchema, ExportableItem } from "../types.js"; import { AirtableBases, AirtableExportConfig, AirtableFieldType, AirtableTables, AirtableTarget } from "./types.js"; //#region src/shared/datasources/export/airtable/handler.d.ts /** Airtable caps record write/delete operations at 10 records per request. */ declare const AIRTABLE_BATCH_SIZE = 10; type AirtableFieldDefinition = { name: string; type: AirtableFieldType; options?: Record; }; /** * Convert a value coming from the item data based on the Airtable field type. * Values are already typed (JSON), unlike form submissions which are all strings. */ declare function convertValueForAirtableField(value: unknown, fieldType: AirtableFieldType): unknown; /** * Build the Airtable `fields` payload for one item: apply the configured * property → field name mapping, then coerce each value to the remote field type. * Properties with no matching Airtable field are dropped (the remote table may * legitimately hold fewer columns than the datasource). */ declare function mapItemToFields(data: Record, config: Pick): Record; /** * Build the Airtable field list from a datasource JSON Schema, honouring the * `metadata.order` of the properties when present. */ declare function buildAirtableFields(schema: ExportSchema): AirtableFieldDefinition[]; /** List the bases the token gives access to. */ declare function fetchAirtableBases(accessToken: string): Promise; /** List the tables of a base, with their fields (used to map an existing table). */ declare function fetchAirtableTables(accessToken: string, baseId: string): Promise; /** Create a table in `baseId` mirroring the datasource schema. */ declare function createAirtableTable({ accessToken, baseId, name, schema }: { accessToken: string; baseId: string; name: string; schema: ExportSchema; }): Promise; /** * Add to the remote table the fields present in the datasource schema but missing * on the Airtable side. Fields removed from the datasource are left untouched. * Returns the refreshed target (with the up-to-date field list). */ declare function syncAirtableTableFields({ accessToken, baseId, tableId, schema, fieldMapping }: { accessToken: string; baseId: string; tableId: string; schema: ExportSchema; fieldMapping?: Record; }): Promise; /** * Create or update the remote records for a batch of items. Items carrying an * `externalRecordId` are PATCHed, the others are POSTed. Airtable fails a whole batch * atomically, so a failed update batch is retried without the records it reported as * deleted; those are recreated instead. */ declare function upsertAirtableRecords({ accessToken, config, items }: { accessToken: string; config: AirtableExportConfig; items: ExportableItem[]; }): Promise; /** Delete remote records (items soft-deleted in Upstart). */ declare function deleteAirtableRecords({ accessToken, config, recordIds }: { accessToken: string; config: Pick; recordIds: string[]; }): Promise; //#endregion export { AIRTABLE_BATCH_SIZE, buildAirtableFields, convertValueForAirtableField, createAirtableTable, deleteAirtableRecords, fetchAirtableBases, fetchAirtableTables, mapItemToFields, syncAirtableTableFields, upsertAirtableRecords }; //# sourceMappingURL=handler.d.ts.map