@superdurable/connector-airtable 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -8
- package/dex-connector.json +278 -6
- package/dist/{chunk-T4RPDDJS.js → chunk-RBINH2QY.js} +46 -4
- package/dist/{connection-C93OyKtn.d.ts → connection-D9d1yIrY.d.ts} +13 -5
- package/dist/index.d.ts +197 -15
- package/dist/index.js +750 -5
- package/dist/mock.d.ts +1 -1
- package/dist/mock.js +1 -1
- package/package.json +8 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { G as GetRecordInput, R as Record, C as Connection, L as ListRecordsInput, a as RecordPage, U as UpdateRecordsInput, b as UpdatedRecords, c as UpsertRecordsInput, d as UpsertedRecords,
|
|
2
|
-
export { g as ConfigSchema, h as CredentialSource, F as FieldEqualityFilter, i as FieldEqualityFilterSchema, j as GetRecordInputSchema, k as ListRecordsInputSchema, l as RecordPageSchema, m as RecordSchema, n as RecordSort, o as RecordSortSchema, p as RecordUpdate, q as RecordUpdateSchema, r as RecordUpsert, s as RecordUpsertSchema, t as UpdateRecordsInputSchema, u as UpdatedRecordsSchema, v as UpsertRecordsInputSchema, w as UpsertedRecordsSchema, x as
|
|
1
|
+
import { G as GetRecordInput, R as Record$1, C as Connection, L as ListRecordsInput, a as RecordPage, U as UpdateRecordsInput, b as UpdatedRecords, c as UpsertRecordsInput, d as UpsertedRecords, e as Config, f as Credentials, O as Operations } from './connection-D9d1yIrY.js';
|
|
2
|
+
export { g as ConfigSchema, h as CredentialSource, F as FieldEqualityFilter, i as FieldEqualityFilterSchema, j as GetRecordInputSchema, k as ListRecordsInputSchema, l as RecordPageSchema, m as RecordSchema, n as RecordSort, o as RecordSortSchema, p as RecordUpdate, q as RecordUpdateSchema, r as RecordUpsert, s as RecordUpsertSchema, t as UpdateRecordsInputSchema, u as UpdatedRecordsSchema, v as UpsertRecordsInputSchema, w as UpsertedRecordsSchema, x as decodeCredentials, y as newConnection, z as newConnectionWithOperations } from './connection-D9d1yIrY.js';
|
|
3
3
|
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
4
|
-
import { QueryDefinition, MutationDefinition, QueryStepConfig, Query, QueryResult, MutationStepConfig, Mutation, MutationResult, QueryStep, MutationStep, Call, QueryAttempt, MutationAttempt, CredentialProvider, ReceiptDraft, Failure } from '@superdurable/connectors-sdk';
|
|
4
|
+
import { QueryDefinition, MutationDefinition, QueryStepConfig, Query, QueryResult, MutationStepConfig, Mutation, MutationResult, QueryStep, MutationStep, Call, QueryAttempt, MutationAttempt, TriggerLogger, CredentialProvider, ReceiptDraft, Failure, TriggerTarget, ConnectorConfigurationUI, TriggerDefinition, TriggerBindingDefinition, TriggerRunner } from '@superdurable/connectors-sdk';
|
|
5
5
|
import { StepTarget } from '@superdurable/dex';
|
|
6
6
|
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
7
7
|
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
8
|
-
import '
|
|
8
|
+
import { CursorStore, RequestLimiter, Runner } from '@superdurable/connectors-sdk/pollingtrigger';
|
|
9
|
+
import { z } from 'zod';
|
|
9
10
|
|
|
10
11
|
/** Stable connector identity. */
|
|
11
12
|
declare const ConnectorID = "airtable";
|
|
@@ -135,7 +136,7 @@ interface ListRecordsStepConfig<StepInput, OperationInput = ListRecordsInput, Op
|
|
|
135
136
|
/** Build the listRecords Step from a named connection. */
|
|
136
137
|
declare function newListRecordsStep<StepInput, OperationInput = ListRecordsInput, OperationOutput = RecordPage>(configuration: ListRecordsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
137
138
|
/** Configuration for the getRecord connector Step. */
|
|
138
|
-
interface GetRecordStepConfig<StepInput, OperationInput = GetRecordInput, OperationOutput = Record> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
139
|
+
interface GetRecordStepConfig<StepInput, OperationInput = GetRecordInput, OperationOutput = Record$1> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
139
140
|
/** Named connection supplying this operation. */
|
|
140
141
|
connection: Connection<{
|
|
141
142
|
getRecord(): Query<OperationInput, OperationOutput>;
|
|
@@ -154,7 +155,7 @@ interface GetRecordStepConfig<StepInput, OperationInput = GetRecordInput, Operat
|
|
|
154
155
|
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
155
156
|
}
|
|
156
157
|
/** Build the getRecord Step from a named connection. */
|
|
157
|
-
declare function newGetRecordStep<StepInput, OperationInput = GetRecordInput, OperationOutput = Record>(configuration: GetRecordStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
158
|
+
declare function newGetRecordStep<StepInput, OperationInput = GetRecordInput, OperationOutput = Record$1>(configuration: GetRecordStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
158
159
|
/** Configuration for the upsertRecords connector Step. */
|
|
159
160
|
interface UpsertRecordsStepConfig<StepInput, OperationInput = UpsertRecordsInput, OperationOutput = UpsertedRecords> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
160
161
|
/** Named connection supplying this operation. */
|
|
@@ -196,9 +197,6 @@ interface UpdateRecordsStepConfig<StepInput, OperationInput = UpdateRecordsInput
|
|
|
196
197
|
/** Build the updateRecords Step from a named connection. */
|
|
197
198
|
declare function newUpdateRecordsStep<StepInput, OperationInput = UpdateRecordsInput, OperationOutput = UpdatedRecords>(configuration: UpdateRecordsStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
198
199
|
|
|
199
|
-
/** Open one static Airtable connection declared in a Dex project. */
|
|
200
|
-
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
201
|
-
|
|
202
200
|
/** Query one bounded Airtable record page. */
|
|
203
201
|
declare class ListRecordsOperation implements Query<ListRecordsInput, RecordPage> {
|
|
204
202
|
private readonly client;
|
|
@@ -208,18 +206,18 @@ declare class ListRecordsOperation implements Query<ListRecordsInput, RecordPage
|
|
|
208
206
|
invoke(call: Call, input: ListRecordsInput): Promise<QueryAttempt<RecordPage>>;
|
|
209
207
|
}
|
|
210
208
|
/** Query one Airtable record by ID. */
|
|
211
|
-
declare class GetRecordOperation implements Query<GetRecordInput, Record> {
|
|
209
|
+
declare class GetRecordOperation implements Query<GetRecordInput, Record$1> {
|
|
212
210
|
private readonly client;
|
|
213
211
|
/** Bind one authenticated client. */ constructor(client: AirtableClient);
|
|
214
212
|
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
215
213
|
/** Validate, send, and classify one record read. */
|
|
216
|
-
invoke(call: Call, input: GetRecordInput): Promise<QueryAttempt<Record>>;
|
|
214
|
+
invoke(call: Call, input: GetRecordInput): Promise<QueryAttempt<Record$1>>;
|
|
217
215
|
}
|
|
218
216
|
/** Mutation that replaces records by stable merge fields. */
|
|
219
217
|
declare class UpsertRecordsOperation implements Mutation<UpsertRecordsInput, UpsertedRecords> {
|
|
220
218
|
private readonly client;
|
|
221
219
|
/** Bind one authenticated client. */ constructor(client: AirtableClient);
|
|
222
|
-
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.
|
|
220
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
223
221
|
/** Reuse the Dex Call ID; Airtable does not accept an idempotency header. */ idempotencyKey(callId: string): string;
|
|
224
222
|
/** Validate and send one repeat-safe merge-field upsert. */
|
|
225
223
|
invoke(call: Call, input: UpsertRecordsInput): Promise<MutationAttempt<UpsertedRecords>>;
|
|
@@ -228,7 +226,7 @@ declare class UpsertRecordsOperation implements Mutation<UpsertRecordsInput, Ups
|
|
|
228
226
|
declare class UpdateRecordsOperation implements Mutation<UpdateRecordsInput, UpdatedRecords> {
|
|
229
227
|
private readonly client;
|
|
230
228
|
/** Bind one authenticated client. */ constructor(client: AirtableClient);
|
|
231
|
-
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.
|
|
229
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
232
230
|
/** Reuse the Dex Call ID; absolute replacement makes retries safe. */ idempotencyKey(callId: string): string;
|
|
233
231
|
/** Validate and send one repeat-safe update by record ID. */
|
|
234
232
|
invoke(call: Call, input: UpdateRecordsInput): Promise<MutationAttempt<UpdatedRecords>>;
|
|
@@ -242,6 +240,13 @@ interface AirtableClientOptions {
|
|
|
242
240
|
send?: AirtableRequestSender;
|
|
243
241
|
/** Clock used for receipts, pacing, and Retry-After dates. */
|
|
244
242
|
now?: () => Date;
|
|
243
|
+
/**
|
|
244
|
+
* Receives the recordChanged Trigger runners' records: seeded and committed cursors, failed polls, cursor
|
|
245
|
+
* resets, delivery outcomes, and the durable inboxes newProjectRecordChangedTriggerRunner opens. Records
|
|
246
|
+
* carry the connector, connection, Trigger, and binding, never record fields, field names, or the token.
|
|
247
|
+
* Omitted uses the SDK's default Trigger logger; operation Steps do not log.
|
|
248
|
+
*/
|
|
249
|
+
logger?: TriggerLogger;
|
|
245
250
|
}
|
|
246
251
|
/** One unsuccessful provider exchange. */
|
|
247
252
|
interface ExchangeFailure {
|
|
@@ -260,8 +265,15 @@ type ExchangeResult = {
|
|
|
260
265
|
} | {
|
|
261
266
|
outcome: ExchangeFailure;
|
|
262
267
|
};
|
|
263
|
-
/**
|
|
268
|
+
/**
|
|
269
|
+
* Validated Airtable API client with per-base pacing and live credential resolution, shared by the operation
|
|
270
|
+
* Steps and the recordChanged Trigger. The constructor throws TypeError for an invalid endpoint, a
|
|
271
|
+
* non-positive maxResponseBytes, a pollIntervalMs under 1000, or a pollPageSize outside 1 to 100.
|
|
272
|
+
*/
|
|
264
273
|
declare class AirtableClient {
|
|
274
|
+
/** Delay between recordChanged polls of one binding, in milliseconds; at least 1000, 30000 by default. */ readonly pollIntervalMs: number;
|
|
275
|
+
/** Records one recordChanged poll request reads, 1 to 100, 100 by default. */ readonly pollPageSize: number;
|
|
276
|
+
/** The recordChanged Trigger logger from AirtableClientOptions, or undefined for the SDK default. */ readonly triggerLogger: TriggerLogger | undefined;
|
|
265
277
|
private readonly endpoint;
|
|
266
278
|
private readonly maxResponseBytes;
|
|
267
279
|
private readonly credentials;
|
|
@@ -287,4 +299,174 @@ declare class AirtableClient {
|
|
|
287
299
|
private failure;
|
|
288
300
|
}
|
|
289
301
|
|
|
290
|
-
|
|
302
|
+
/**
|
|
303
|
+
* Open one static Airtable connection declared in a Dex project. options supply the recordChanged Trigger
|
|
304
|
+
* logger and test dependencies.
|
|
305
|
+
*/
|
|
306
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: AirtableClientOptions): Connection<Operations>;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Selects the table and Last modified time field a recordChanged binding polls. Dex Web saves it from the
|
|
310
|
+
* basePicker, tablePicker, and lastModifiedTimeFieldPicker units; the names are shown in Dex Web only, so a
|
|
311
|
+
* renamed base, table, or field keeps working. Field names match the Go connector.
|
|
312
|
+
*/
|
|
313
|
+
interface RecordChangedTriggerConfiguration {
|
|
314
|
+
/** The base ID, such as appXXXXXXXXXXXXXX. Required. */ baseId: string;
|
|
315
|
+
/** The base name the picker showed; informational. */ baseName?: string;
|
|
316
|
+
/** The table ID, such as tblXXXXXXXXXXXXXX. Required. */ tableId: string;
|
|
317
|
+
/** The table name the picker showed; informational. */ tableName?: string;
|
|
318
|
+
/**
|
|
319
|
+
* The field ID, such as fldXXXXXXXXXXXXXX, of a Last modified time field of the table whose value includes
|
|
320
|
+
* a time of day. Required. The field's own setting decides which edits count as a change.
|
|
321
|
+
*/
|
|
322
|
+
fieldId: string;
|
|
323
|
+
/** The field name the picker showed; informational. */ fieldName?: string;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* One record created or changed after the last processed change of the polled table. Field names and values
|
|
327
|
+
* match the Go connector's JSON, so Go, Python, and TypeScript replicas share one inbox.
|
|
328
|
+
*/
|
|
329
|
+
interface RecordChangedEvent {
|
|
330
|
+
/** The polled base ID. */ baseId: string;
|
|
331
|
+
/** The polled table ID. */ tableId: string;
|
|
332
|
+
/** The record's Last modified time value when the poll read it, as Go's RFC 3339 UTC text with up to nanoseconds. */ lastModifiedTime: string;
|
|
333
|
+
/** Whether the record's createdTime is within one second of lastModifiedTime: created and not edited since. */ isCreatedRecord: boolean;
|
|
334
|
+
/** The record as Airtable returned it, with fields keyed by field name. */ record: Record$1;
|
|
335
|
+
}
|
|
336
|
+
/** Decodes a saved binding configuration strictly, as Go does: unknown fields are refused, null is blank. */
|
|
337
|
+
declare const RecordChangedTriggerConfigurationSchema: z.ZodPipe<z.ZodObject<{
|
|
338
|
+
baseId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string | null | undefined>>;
|
|
339
|
+
baseName: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
|
|
340
|
+
tableId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string | null | undefined>>;
|
|
341
|
+
tableName: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
|
|
342
|
+
fieldId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string | null | undefined>>;
|
|
343
|
+
fieldName: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
|
|
344
|
+
}, z.core.$strict>, z.ZodTransform<RecordChangedTriggerConfiguration, {
|
|
345
|
+
baseId: string;
|
|
346
|
+
baseName: string | undefined;
|
|
347
|
+
tableId: string;
|
|
348
|
+
tableName: string | undefined;
|
|
349
|
+
fieldId: string;
|
|
350
|
+
fieldName: string | undefined;
|
|
351
|
+
}>>;
|
|
352
|
+
/** Decodes a stored RecordChangedEvent as Go's json.Unmarshal does: unknown fields are ignored. */
|
|
353
|
+
declare const RecordChangedEventSchema: z.ZodPipe<z.ZodObject<{
|
|
354
|
+
baseId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string | null | undefined>>;
|
|
355
|
+
tableId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string | null | undefined>>;
|
|
356
|
+
lastModifiedTime: z.ZodString;
|
|
357
|
+
isCreatedRecord: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean, boolean | null | undefined>>;
|
|
358
|
+
record: z.ZodObject<{
|
|
359
|
+
id: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string | null | undefined>>;
|
|
360
|
+
createdTime: z.ZodString;
|
|
361
|
+
fields: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown> | null, Record<string, unknown> | null | undefined>>;
|
|
362
|
+
}, z.core.$strip>;
|
|
363
|
+
}, z.core.$strip>, z.ZodTransform<RecordChangedEvent, {
|
|
364
|
+
baseId: string;
|
|
365
|
+
tableId: string;
|
|
366
|
+
lastModifiedTime: string;
|
|
367
|
+
isCreatedRecord: boolean;
|
|
368
|
+
record: {
|
|
369
|
+
id: string;
|
|
370
|
+
createdTime: string;
|
|
371
|
+
fields: Record<string, unknown> | null;
|
|
372
|
+
};
|
|
373
|
+
}>>;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* The recordChanged poll Trigger: each record of one picked table that is created or changed after the last
|
|
377
|
+
* processed change, as reported by a picked Last modified time field, on the Connector SDK's durable poll
|
|
378
|
+
* Trigger kit at parity with the Go connector. Cursor documents and event IDs match Go's byte for byte, so
|
|
379
|
+
* Go, Python, and TypeScript replicas share them. newProjectRecordChangedTriggerRunner is the durable path.
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
/** The base picker UI unit, which saves a base ID and name. */ declare const UIUnitBasePicker = "basePicker";
|
|
383
|
+
/** Base picker output port: the base ID. */ declare const UIBasePickerPortBaseID = "baseId";
|
|
384
|
+
/** Base picker output port: the base name. */ declare const UIBasePickerPortBaseName = "baseName";
|
|
385
|
+
/** The table picker UI unit, which saves a table ID and name. */ declare const UIUnitTablePicker = "tablePicker";
|
|
386
|
+
/** Table picker port: the base ID it lists tables of. */ declare const UITablePickerPortBaseID = "baseId";
|
|
387
|
+
/** Table picker output port: the table ID. */ declare const UITablePickerPortTableID = "tableId";
|
|
388
|
+
/** Table picker output port: the table name. */ declare const UITablePickerPortTableName = "tableName";
|
|
389
|
+
/** The UI unit that lists a table's Last modified time fields with a time of day. */ declare const UIUnitLastModifiedTimeFieldPicker = "lastModifiedTimeFieldPicker";
|
|
390
|
+
/** Field picker port: the base ID. */ declare const UILastModifiedTimeFieldPickerPortBaseID = "baseId";
|
|
391
|
+
/** Field picker port: the table ID. */ declare const UILastModifiedTimeFieldPickerPortTableID = "tableId";
|
|
392
|
+
/** Field picker output port: the field ID. */ declare const UILastModifiedTimeFieldPickerPortFieldID = "fieldId";
|
|
393
|
+
/** Field picker output port: the field name. */ declare const UILastModifiedTimeFieldPickerPortFieldName = "fieldName";
|
|
394
|
+
/** Manifest definition of recordChanged. */
|
|
395
|
+
declare const RecordChangedTriggerDefinition: TriggerDefinition;
|
|
396
|
+
/** One static application binding of recordChanged. */
|
|
397
|
+
interface RecordChangedTriggerBindingConfig {
|
|
398
|
+
/** Static connection name. */ connectionName: string;
|
|
399
|
+
/** Static binding name. */ bindingName: string;
|
|
400
|
+
/** Connector Studio configuration units, such as the base, table, and Last modified time field pickers. */ configurationUI?: ConnectorConfigurationUI;
|
|
401
|
+
}
|
|
402
|
+
/** Declare a static recordChanged binding for Flow Definition tooling and Dex Web. */
|
|
403
|
+
declare function defineRecordChangedTriggerBinding(config: RecordChangedTriggerBindingConfig): TriggerBindingDefinition;
|
|
404
|
+
/** Require the base, table, and Last modified time field IDs; throws TypeError naming the first invalid one. */
|
|
405
|
+
declare function validateRecordChangedTriggerConfiguration(configuration: RecordChangedTriggerConfiguration): void;
|
|
406
|
+
/** Decode a replayed recordChanged payload from a project Trigger inbox written by Go, Python, or TypeScript. */
|
|
407
|
+
declare function decodeRecordChangedEventPayload(_payloadJSON: string, payloadBytes: Uint8Array): RecordChangedEvent;
|
|
408
|
+
/** Binds one recordChanged binding's configuration and cursor to its application target. */
|
|
409
|
+
interface RecordChangedTriggerRoute {
|
|
410
|
+
/** Names the configured Trigger binding; it is unique within one runner. */ bindingName: string;
|
|
411
|
+
/** Selects the polled table and its Last modified time field. */ configuration: RecordChangedTriggerConfiguration;
|
|
412
|
+
/**
|
|
413
|
+
* Persists the binding's last processed change, normally LoadedProject.pollCursorStore. Use
|
|
414
|
+
* newMemoryCursorStore only when changes made while the process is stopped may be skipped.
|
|
415
|
+
*/
|
|
416
|
+
cursor: CursorStore;
|
|
417
|
+
/**
|
|
418
|
+
* Receives each changed record. A target from newDurableTriggerTarget records it before the cursor moves
|
|
419
|
+
* past it; any other target consumes it first.
|
|
420
|
+
*/
|
|
421
|
+
target: TriggerTarget<RecordChangedEvent>;
|
|
422
|
+
}
|
|
423
|
+
/** Configures every recordChanged binding of one Airtable connection. */
|
|
424
|
+
interface RecordChangedTriggerRunnerConfig {
|
|
425
|
+
/** A connection from newConnection with an AirtableClient, or newProjectConnection; its pollInterval and pollPageSize apply. */ connection: Connection;
|
|
426
|
+
/** Polled in this order whenever several are due; at least one is required. */ routes: readonly RecordChangedTriggerRoute[];
|
|
427
|
+
/** Optionally paces every poll request, for example to share Airtable's 50 requests per second per token. */ requestLimiter?: RequestLimiter;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Validate every route and build one poll runner for the connection; it sends and reads nothing. run replays
|
|
431
|
+
* each durable target; each binding then reads the base schema to find the Last modified time field's
|
|
432
|
+
* current name and seeds its cursor at the table's most recent change, so existing records never start
|
|
433
|
+
* Flows. Later polls list up to pollPageSize records modified since the cursor, oldest change first, and
|
|
434
|
+
* deliver each before the cursor commits. The cursor stores the latest delivered modification time and the
|
|
435
|
+
* records delivered in the five seconds before it, so a change that becomes visible slightly late is still
|
|
436
|
+
* delivered and a record is delivered once per change; a long scan resumes from its stored Airtable offset.
|
|
437
|
+
* A failed poll backs off up to five minutes, and HTTP 429 pauses every binding of the connection for at
|
|
438
|
+
* least Airtable's 30 seconds. Delivery is at least once, and each event ID is a pure function of the record
|
|
439
|
+
* ID and its modification time. Records go to the client's logger option. Throws TypeError for a connection
|
|
440
|
+
* without an AirtableClient, no routes, a blank or repeated binding name, a missing cursor or target, or an
|
|
441
|
+
* invalid configuration.
|
|
442
|
+
*/
|
|
443
|
+
declare function newRecordChangedTriggerRunner(config: RecordChangedTriggerRunnerConfig): Runner;
|
|
444
|
+
/** Binds one recordChanged binding saved in the project configuration to its target. */
|
|
445
|
+
interface ProjectRecordChangedTriggerRoute {
|
|
446
|
+
/** Names the binding whose base, table, and field Dex Web saved. */ bindingName: string;
|
|
447
|
+
/** Receives each changed record after the binding's durable project inbox records it, usually newDexFlowTriggerTarget. */ target: TriggerTarget<RecordChangedEvent>;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Open connectionName from the loaded project, load each route's saved binding configuration, and build a
|
|
451
|
+
* durable runner: each binding's cursor lives in project storage beside its Trigger inbox, and every change
|
|
452
|
+
* is recorded in that inbox before the cursor commits past it, so a restarted or replaced replica neither
|
|
453
|
+
* misses nor replays a change. options.logger also applies to the inboxes. Under dexcli dev the poll cursor
|
|
454
|
+
* stays in process memory; hosted project storage keeps it. Throws for a missing target, a binding without a
|
|
455
|
+
* saved configuration, or an invalid configuration.
|
|
456
|
+
*/
|
|
457
|
+
declare function newProjectRecordChangedTriggerRunner(project: LoadedProject, connectionName: string, routes: readonly ProjectRecordChangedTriggerRoute[], options?: AirtableClientOptions): Runner;
|
|
458
|
+
/** One recordChanged Trigger with its cursor in memory. */
|
|
459
|
+
interface RecordChangedTriggerConfig {
|
|
460
|
+
/** A connection from newConnection with an AirtableClient, or newProjectConnection. */ connection: Connection;
|
|
461
|
+
/** Static binding name. */ bindingName: string;
|
|
462
|
+
/** Selects the polled table and field. */ configuration: RecordChangedTriggerConfiguration;
|
|
463
|
+
/** Receives each changed record. */ target: TriggerTarget<RecordChangedEvent>;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Create one recordChanged binding's TriggerRunner with its cursor in process memory, so a restart seeds
|
|
467
|
+
* again and changes made while the process is stopped are not delivered; use it for tests and
|
|
468
|
+
* demonstrations, and newProjectRecordChangedTriggerRunner otherwise. Throws as newRecordChangedTriggerRunner does.
|
|
469
|
+
*/
|
|
470
|
+
declare function newRecordChangedTrigger(config: RecordChangedTriggerConfig): TriggerRunner;
|
|
471
|
+
|
|
472
|
+
export { AirtableClient, type AirtableClientOptions, type AirtableRequestSender, Config, Connection, ConnectorID, Credentials, GetRecordBranch, GetRecordBranchDefect, GetRecordBranchFound, GetRecordBranchInvalidResponse, GetRecordBranchNotFound, GetRecordBranchProviderRejected, GetRecordDefinition, GetRecordInput, GetRecordMetadata, GetRecordOperation, type GetRecordStepConfig, ListRecordsBranch, ListRecordsBranchDefect, ListRecordsBranchInvalidResponse, ListRecordsBranchListed, ListRecordsBranchOffsetExpired, ListRecordsBranchProviderRejected, ListRecordsDefinition, ListRecordsInput, ListRecordsMetadata, ListRecordsOperation, type ListRecordsStepConfig, type ProjectRecordChangedTriggerRoute, ProviderID, Record$1 as Record, type RecordChangedEvent, RecordChangedEventSchema, type RecordChangedTriggerBindingConfig, type RecordChangedTriggerConfig, type RecordChangedTriggerConfiguration, RecordChangedTriggerConfigurationSchema, RecordChangedTriggerDefinition, type RecordChangedTriggerRoute, type RecordChangedTriggerRunnerConfig, RecordPage, UIBasePickerPortBaseID, UIBasePickerPortBaseName, UILastModifiedTimeFieldPickerPortBaseID, UILastModifiedTimeFieldPickerPortFieldID, UILastModifiedTimeFieldPickerPortFieldName, UILastModifiedTimeFieldPickerPortTableID, UITablePickerPortBaseID, UITablePickerPortTableID, UITablePickerPortTableName, UIUnitBasePicker, UIUnitLastModifiedTimeFieldPicker, UIUnitTablePicker, UpdateRecordsBranch, UpdateRecordsBranchDefect, UpdateRecordsBranchInvalidResponse, UpdateRecordsBranchNotFound, UpdateRecordsBranchProviderRejected, UpdateRecordsBranchUpdated, UpdateRecordsDefinition, UpdateRecordsInput, UpdateRecordsMetadata, UpdateRecordsOperation, type UpdateRecordsStepConfig, UpdatedRecords, UpsertRecordsBranch, UpsertRecordsBranchDefect, UpsertRecordsBranchInvalidResponse, UpsertRecordsBranchProviderRejected, UpsertRecordsBranchUpserted, UpsertRecordsDefinition, UpsertRecordsInput, UpsertRecordsMetadata, UpsertRecordsOperation, type UpsertRecordsStepConfig, UpsertedRecords, decodeRecordChangedEventPayload, defineRecordChangedTriggerBinding, newGetRecordStep, newListRecordsStep, newProjectConnection, newProjectRecordChangedTriggerRunner, newRecordChangedTrigger, newRecordChangedTriggerRunner, newUpdateRecordsStep, newUpsertRecordsStep, validateRecordChangedTriggerConfiguration };
|