@superdurable/connector-airtable 0.2.0 → 0.3.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/dist/index.js CHANGED
@@ -2,6 +2,25 @@ import {
2
2
  ConfigSchema,
3
3
  Connection,
4
4
  ConnectorID,
5
+ CreateRecordBranch,
6
+ CreateRecordBranchCreated,
7
+ CreateRecordBranchDefect,
8
+ CreateRecordBranchProviderRejected,
9
+ CreateRecordBranchUncertain,
10
+ CreateRecordDefinition,
11
+ CreateRecordInputSchema,
12
+ CreateRecordMetadata,
13
+ CredentialMaterialError,
14
+ DeleteRecordBranch,
15
+ DeleteRecordBranchAlreadyAbsent,
16
+ DeleteRecordBranchDefect,
17
+ DeleteRecordBranchDeleted,
18
+ DeleteRecordBranchInvalidResponse,
19
+ DeleteRecordBranchProviderRejected,
20
+ DeleteRecordDefinition,
21
+ DeleteRecordInputSchema,
22
+ DeleteRecordMetadata,
23
+ DeletedRecordSchema,
5
24
  FieldEqualityFilterSchema,
6
25
  GetRecordBranch,
7
26
  GetRecordBranchDefect,
@@ -47,13 +66,35 @@ import {
47
66
  UpsertRecordsMetadata,
48
67
  UpsertedRecordsSchema,
49
68
  decodeCredentials,
69
+ isCredentialMaterialError,
50
70
  newConnection,
51
71
  newConnectionWithOperations,
52
72
  newProjectConnection
53
- } from "./chunk-RBINH2QY.js";
73
+ } from "./chunk-JBLBIUXW.js";
54
74
 
55
75
  // src/generated/steps.ts
56
76
  import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
77
+ function newCreateRecordStep(configuration) {
78
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
79
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
80
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createRecord(), connection: connection.reference, branches: [
81
+ goToBranch("created", created),
82
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
83
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
84
+ ...defect ? [goToBranch("defect", defect)] : []
85
+ ] });
86
+ }
87
+ function newDeleteRecordStep(configuration) {
88
+ const { connection, connectionName, deleted, alreadyAbsent, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
89
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
90
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteRecord(), connection: connection.reference, branches: [
91
+ goToBranch("deleted", deleted),
92
+ ...alreadyAbsent ? [goToBranch("alreadyAbsent", alreadyAbsent)] : [],
93
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
94
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
95
+ ...defect ? [goToBranch("defect", defect)] : []
96
+ ] });
97
+ }
57
98
  function newListRecordsStep(configuration) {
58
99
  const { connection, connectionName, listed, offsetExpired, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
59
100
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
@@ -77,7 +118,7 @@ function newGetRecordStep(configuration) {
77
118
  ] });
78
119
  }
79
120
  function newUpsertRecordsStep(configuration) {
80
- const { connection, connectionName, upserted, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
121
+ const { connection, connectionName, upserted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
81
122
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
82
123
  return newMutationStep({ ...stepConfiguration, operation: connection.operations.upsertRecords(), connection: connection.reference, branches: [
83
124
  goToBranch("upserted", upserted),
@@ -87,7 +128,7 @@ function newUpsertRecordsStep(configuration) {
87
128
  ] });
88
129
  }
89
130
  function newUpdateRecordsStep(configuration) {
90
- const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
131
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
91
132
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
92
133
  return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateRecords(), connection: connection.reference, branches: [
93
134
  goToBranch("updated", updated),
@@ -103,11 +144,13 @@ import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
103
144
  import { z } from "zod";
104
145
 
105
146
  // src/client.ts
106
- import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
147
+ import { ProviderTransportError, BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
107
148
  import { ReauthorizationRequiredError, SecretString } from "@superdurable/connectors-sdk";
149
+ import { ConnectionNotSelectedError, CredentialBrokerRejectedError, ObjectNotFoundError } from "@superdurable/connectors-sdk/projectconfig";
108
150
 
109
151
  // src/operations.ts
110
- import { newMutationBranch, newMutationRetry, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
152
+ import { Fence, CheckpointError, InsufficientTimeError } from "@superdurable/connectors-sdk/singledispatch";
153
+ import { newMutationUncertain, newMutationBranch, newMutationRetry, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
111
154
  var baseIdPattern = /^app[0-9A-Za-z]{14}$/;
112
155
  var recordIdPattern = /^rec[0-9A-Za-z]{14}$/;
113
156
  var zeroTime = "0001-01-01T00:00:00Z";
@@ -178,6 +221,143 @@ var GetRecordOperation = class {
178
221
  }
179
222
  }
180
223
  };
224
+ var CreateRecordOperation = class {
225
+ /** Bind the authenticated Airtable client. */
226
+ constructor(client) {
227
+ this.client = client;
228
+ }
229
+ client;
230
+ /** Return the manifest definition. */
231
+ definition() {
232
+ return CreateRecordDefinition;
233
+ }
234
+ /** Correlate repeated sends with a single durable call ID. */
235
+ idempotencyKey(callId) {
236
+ return callId;
237
+ }
238
+ /** Read back a saved record before considering another POST. */
239
+ async invoke(call, input) {
240
+ const operation = "createRecord";
241
+ try {
242
+ validateBaseAndTable(input.baseId, input.tableIdOrName);
243
+ validateWrittenFields("record", input.fields ?? null);
244
+ } catch (error) {
245
+ return mutationDefect(operation, zeroRecord, error);
246
+ }
247
+ const cap = call.maxSendsOverride ?? CreateRecordDefinition.maxSends ?? 3;
248
+ const failure = (kind, message) => ({ kind, provider: "airtable", operation, message });
249
+ const unavailable = failure("AVAILABILITY", "Airtable create checkpoint is unavailable");
250
+ let fence;
251
+ try {
252
+ fence = new Fence(call, CreateRecordDefinition.stepDefaults.executeMethodTimeoutMs ?? 3e4, { maxSends: cap });
253
+ } catch {
254
+ return newMutationBranch("defect", zeroRecord, {}, failure("LOCAL_DEFECT", "Invalid create checkpoint"));
255
+ }
256
+ const decision = fence.decide();
257
+ const prior = decision.priorSendUpperBound;
258
+ if (decision.kind === "failClosed" || prior === void 0) return newMutationRetry(unavailable);
259
+ const saved = decision.marker?.providerId;
260
+ const path = recordPath(input);
261
+ if (saved) {
262
+ const read = await this.client.exchange(call, operation, input.baseId, saved, "GET", path + "/" + encodeURIComponent(saved));
263
+ if ("outcome" in read) {
264
+ if (read.outcome.disposition !== "notFound") return newMutationRetry(read.outcome.failure, read.outcome.retryAfterMs);
265
+ } else {
266
+ try {
267
+ const record = decodeRecord(decodeObject(read.response.body));
268
+ if (record.id !== saved) throw new Error("Mismatched record ID");
269
+ return newMutationBranch("created", record, this.client.receipt(call, saved));
270
+ } catch {
271
+ return newMutationRetry(failure("PROTOCOL", "Invalid Airtable create read-back"));
272
+ }
273
+ }
274
+ }
275
+ if (decision.kind === "readBackRequired") return newMutationUncertain(zeroRecord, failure("TRANSPORT", "An earlier Airtable create may have succeeded"), this.client.receipt(call, saved ?? ""));
276
+ const body = { fields: input.fields, ...input.typecast ? { typecast: true } : {} };
277
+ let unknownFailure;
278
+ let receipt = this.client.receipt(call, "");
279
+ try {
280
+ const result = await fence.dispatch((signal) => this.client.exchange(call, operation, input.baseId, "", "POST", path, body, signal));
281
+ if ("outcome" in result) {
282
+ const outcome = result.outcome;
283
+ unknownFailure = outcome.failure;
284
+ receipt = outcome.receipt;
285
+ const canRetry = outcome.disposition === "retry" && (outcome.failure.kind === "RATE_LIMIT" || outcome.status === 503 || !receipt.callId);
286
+ const defect = prior === 0 && outcome.disposition === "defect" && !receipt.callId;
287
+ const refused = prior === 0 && outcome.hasProviderError && definiteRefusalStatuses.has(outcome.status ?? 0);
288
+ if (canRetry || defect || refused) {
289
+ try {
290
+ await fence.recordCanResend();
291
+ } catch {
292
+ return newMutationRetry(unavailable);
293
+ }
294
+ if (canRetry) return newMutationRetry(outcome.failure, outcome.retryAfterMs);
295
+ return newMutationBranch(defect ? "defect" : "providerRejected", zeroRecord, receipt, outcome.failure);
296
+ }
297
+ } else {
298
+ try {
299
+ const record = decodeRecord(decodeObject(result.response.body));
300
+ try {
301
+ await fence.recordProviderId(record.id);
302
+ } catch {
303
+ }
304
+ return newMutationBranch("created", record, this.client.receipt(call, record.id));
305
+ } catch {
306
+ unknownFailure = failure("PROTOCOL", "Airtable create response was invalid");
307
+ }
308
+ }
309
+ } catch (error) {
310
+ if (error instanceof InsufficientTimeError || error instanceof CheckpointError) return newMutationRetry(unavailable);
311
+ unknownFailure = failure("TRANSPORT", "Airtable did not return a complete response");
312
+ }
313
+ return prior + 1 >= cap ? newMutationUncertain(zeroRecord, unknownFailure, receipt) : newMutationRetry(unknownFailure);
314
+ }
315
+ };
316
+ var DeleteRecordOperation = class {
317
+ /** Bind the authenticated client. */
318
+ constructor(client) {
319
+ this.client = client;
320
+ }
321
+ client;
322
+ /** Return the manifest definition. */
323
+ definition() {
324
+ return DeleteRecordDefinition;
325
+ }
326
+ /** Correlate repeated requests with the Dex call ID. */
327
+ idempotencyKey(callId) {
328
+ return callId;
329
+ }
330
+ /** Delete the record and validate the returned confirmation. */
331
+ async invoke(call, input) {
332
+ const operation = "deleteRecord";
333
+ const empty = { recordId: "" };
334
+ try {
335
+ validateBaseAndTable(input.baseId, input.tableIdOrName);
336
+ if (!recordIdPattern.test(input.recordId)) throw new Error("recordId must be an Airtable record ID");
337
+ } catch (error) {
338
+ return mutationDefect(operation, empty, error);
339
+ }
340
+ const path = `${recordPath(input)}/${encodeURIComponent(input.recordId)}`;
341
+ const result = await this.client.exchange(call, operation, input.baseId, input.recordId, "DELETE", path);
342
+ const deleted = { recordId: input.recordId };
343
+ if ("outcome" in result) {
344
+ const outcome = result.outcome;
345
+ const repeated = call.context.attempt > 1;
346
+ if (outcome.disposition === "notFound" && outcome.hasProviderError && !repeated) {
347
+ return newMutationBranch("alreadyAbsent", deleted, outcome.receipt, outcome.failure);
348
+ }
349
+ if (outcome.status !== void 0 && (repeated || !outcome.hasProviderError) || repeated && outcome.disposition === "defect") return newMutationRetry(outcome.failure, outcome.retryAfterMs);
350
+ return mutationOutcome(outcome, empty, "providerRejected");
351
+ }
352
+ try {
353
+ const confirmation = decodeObject(result.response.body);
354
+ if (confirmation.id !== input.recordId || confirmation.deleted !== true) throw new Error("Airtable returned an invalid deletion confirmation");
355
+ } catch (error) {
356
+ return unusableAnswerRetry(operation, error);
357
+ }
358
+ return newMutationBranch("deleted", deleted, this.client.receipt(call, input.recordId));
359
+ }
360
+ };
181
361
  var UpsertRecordsOperation = class {
182
362
  /** Bind one authenticated client. */
183
363
  constructor(client) {
@@ -213,8 +393,8 @@ var UpsertRecordsOperation = class {
213
393
  if ([...createdRecordIds, ...updatedRecordIds].some((id) => !writtenIds.has(id)) || createdRecordIds.some((id) => updatedRecordIds.includes(id))) throw new Error("invalid upsert IDs");
214
394
  const partialSuccessReasons = decodePartialSuccessReasons(body.details);
215
395
  return newMutationBranch("upserted", { records, createdRecordIds, updatedRecordIds, ...partialSuccessReasons.length ? { partialSuccessReasons } : {} }, this.client.receipt(call, objectId));
216
- } catch {
217
- return mutationFailure("upsertRecords", "invalidResponse", "PROTOCOL", zeroUpserted, this.client.receipt(call, objectId));
396
+ } catch (error) {
397
+ return unusableAnswerRetry("upsertRecords", error);
218
398
  }
219
399
  }
220
400
  };
@@ -248,11 +428,11 @@ var UpdateRecordsOperation = class {
248
428
  if (!Array.isArray(body.records) || body.records.length !== input.records?.length) throw new Error("invalid update response");
249
429
  const records = body.records.map(decodeRecord);
250
430
  const requestedIds = new Set(input.records.map((record) => record.id));
251
- if (records.some((record) => !requestedIds.has(record.id))) throw new Error("unexpected updated record");
431
+ if (records.some((record) => !requestedIds.delete(record.id))) throw new Error("unexpected updated record");
252
432
  const partialSuccessReasons = decodePartialSuccessReasons(body.details);
253
433
  return newMutationBranch("updated", { records, ...partialSuccessReasons.length ? { partialSuccessReasons } : {} }, this.client.receipt(call, objectId));
254
- } catch {
255
- return mutationFailure("updateRecords", "invalidResponse", "PROTOCOL", zeroUpdated, this.client.receipt(call, objectId));
434
+ } catch (error) {
435
+ return unusableAnswerRetry("updateRecords", error);
256
436
  }
257
437
  }
258
438
  };
@@ -261,8 +441,10 @@ function queryOutcome(outcome, zero, rejectedBranch, notFoundBranch = rejectedBr
261
441
  const branch = outcome.disposition === "notFound" ? notFoundBranch : outcome.disposition === "offsetExpired" ? "offsetExpired" : outcome.disposition === "rejected" ? rejectedBranch : outcome.disposition;
262
442
  return newQueryBranch(branch, zero, outcome.receipt, outcome.failure);
263
443
  }
444
+ var definiteRefusalStatuses = /* @__PURE__ */ new Set([400, 401, 403, 404, 411, 413, 414, 415, 422]);
264
445
  function mutationOutcome(outcome, zero, rejectedBranch, notFoundBranch = rejectedBranch) {
265
- if (outcome.disposition === "retry") return newMutationRetry(outcome.failure, outcome.retryAfterMs);
446
+ const isUnknownStatus = outcome.status !== void 0 && (outcome.status < 200 || outcome.status >= 300) && !definiteRefusalStatuses.has(outcome.status);
447
+ if (outcome.disposition === "retry" || outcome.disposition === "invalidResponse" || isUnknownStatus) return newMutationRetry(outcome.failure, outcome.retryAfterMs);
266
448
  const branch = outcome.disposition === "notFound" ? notFoundBranch : outcome.disposition === "rejected" || outcome.disposition === "offsetExpired" ? rejectedBranch : outcome.disposition;
267
449
  return newMutationBranch(branch, zero, outcome.receipt, outcome.failure);
268
450
  }
@@ -275,6 +457,9 @@ function mutationDefect(operation, zero, error) {
275
457
  function queryFailure(operation, branch, kind, zero, receipt, error) {
276
458
  return newQueryBranch(branch, zero, receipt, { kind, provider: "airtable", operation, message: error instanceof Error ? error.message : "Airtable response is invalid" });
277
459
  }
460
+ function unusableAnswerRetry(operation, error) {
461
+ return newMutationRetry({ kind: "PROTOCOL", provider: "airtable", operation, message: error instanceof Error ? error.message : "Airtable response is invalid" });
462
+ }
278
463
  function mutationFailure(operation, branch, kind, zero, receipt, error) {
279
464
  return newMutationBranch(branch, zero, receipt, { kind, provider: "airtable", operation, message: error instanceof Error ? error.message : "Airtable response is invalid" });
280
465
  }
@@ -458,6 +643,14 @@ var AirtableClient = class {
458
643
  upsertRecords() {
459
644
  return new UpsertRecordsOperation(this);
460
645
  }
646
+ /** Bind the limited-repeat creation mutation. */
647
+ createRecord() {
648
+ return new CreateRecordOperation(this);
649
+ }
650
+ /** Bind the repeat-safe deletion mutation. */
651
+ deleteRecord() {
652
+ return new DeleteRecordOperation(this);
653
+ }
461
654
  /** Bind the update mutation. */
462
655
  updateRecords() {
463
656
  return new UpdateRecordsOperation(this);
@@ -473,26 +666,26 @@ var AirtableClient = class {
473
666
  };
474
667
  }
475
668
  /** Resolve credentials, pace one base, send a bounded request, and classify non-2xx responses. */
476
- async exchange(call, operation, baseId, objectId, method, path, body) {
669
+ async exchange(call, operation, baseId, objectId, method, path, body, signal = call.context.cancellationSignal) {
477
670
  const slot = this.reserveRequestSlot(baseId);
478
671
  if (slot > 2e3) return { outcome: this.failure("retry", operation, "RATE_LIMIT", "Airtable requests to this base are paced to its rate limit", {}, slot) };
479
672
  if (slot > 0) {
480
673
  try {
481
- await waitForSlot(slot, call.context.cancellationSignal);
674
+ await waitForSlot(slot, signal);
482
675
  } catch {
483
676
  return { outcome: this.failure("retry", operation, "AVAILABILITY", "the Step ended while waiting for an Airtable request slot") };
484
677
  }
485
678
  }
486
- let token;
679
+ let credentials;
487
680
  try {
488
- const credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
489
- if (!(credentials.personalAccessToken instanceof SecretString)) throw new TypeError("invalid Airtable token");
490
- token = credentials.personalAccessToken.reveal();
491
- if (!isHeaderSafeCredential(token)) throw new TypeError("invalid Airtable token");
681
+ credentials = await this.credentials.resolve(call, signal);
492
682
  } catch (error) {
493
683
  if (error instanceof ReauthorizationRequiredError) return { outcome: this.failure("rejected", operation, "AUTHENTICATION", "the Airtable connection must be authorized again") };
494
- return { outcome: this.failure("defect", operation, "AUTHENTICATION", "Airtable connection credentials are unavailable") };
684
+ if (isTerminalCredentialError(error)) return { outcome: this.failure("defect", operation, "AUTHENTICATION", "Airtable connection credentials are unavailable") };
685
+ return { outcome: this.failure("retry", operation, "AVAILABILITY", "Airtable connection credentials are temporarily unavailable") };
495
686
  }
687
+ const token = credentials.personalAccessToken instanceof SecretString ? credentials.personalAccessToken.reveal() : "";
688
+ if (!token || !isHeaderSafeCredential(token)) return { outcome: this.failure("defect", operation, "AUTHENTICATION", "Airtable connection credentials are unavailable") };
496
689
  let encoded;
497
690
  try {
498
691
  if (body !== void 0) encoded = Buffer.from(JSON.stringify(body), "utf8");
@@ -510,14 +703,14 @@ var AirtableClient = class {
510
703
  maxResponseBytes: this.maxResponseBytes,
511
704
  addressPolicy: this.endpoint === defaultEndpoint ? "publicHTTPS" : "privateNetworkHTTP",
512
705
  timeoutMs: requestTimeoutMs,
513
- signal: call.context.cancellationSignal
706
+ signal
514
707
  });
515
708
  } catch (error) {
516
- if (error instanceof BodyTooLargeError) return { outcome: this.failure("invalidResponse", operation, "RESPONSE_TOO_LARGE", "Airtable response exceeds the configured size limit", receipt) };
517
- return { outcome: this.failure("retry", operation, "TRANSPORT", "Airtable did not return a complete response", receipt) };
709
+ if (error instanceof BodyTooLargeError) return { outcome: { ...this.failure("invalidResponse", operation, "RESPONSE_TOO_LARGE", "Airtable response exceeds the configured size limit", receipt), ...error.status !== void 0 ? { status: error.status } : {} } };
710
+ return { outcome: this.failure("retry", operation, "TRANSPORT", "Airtable did not return a complete response", error instanceof ProviderTransportError && error.isProvablyNotSent ? {} : receipt) };
518
711
  }
519
712
  if (response.status >= 200 && response.status < 300) return { response };
520
- return { outcome: this.classifyResponse(operation, baseId, response, receipt) };
713
+ return { outcome: { ...this.classifyResponse(operation, baseId, response, receipt), status: response.status, hasProviderError: Boolean(readErrorType(response.body)) } };
521
714
  }
522
715
  reserveRequestSlot(baseId) {
523
716
  const now = this.now().getTime();
@@ -547,6 +740,9 @@ var AirtableClient = class {
547
740
  return { disposition, failure: { kind, provider: "airtable", operation, message }, receipt, retryAfterMs };
548
741
  }
549
742
  };
743
+ function isTerminalCredentialError(error) {
744
+ return error instanceof ReauthorizationRequiredError || error instanceof ObjectNotFoundError || error instanceof ConnectionNotSelectedError || error instanceof CredentialBrokerRejectedError || isCredentialMaterialError(error);
745
+ }
550
746
  function header(response, name) {
551
747
  const value = response.headers[name];
552
748
  return Array.isArray(value) ? value[0] ?? "" : value ?? "";
@@ -609,7 +805,7 @@ import {
609
805
  } from "@superdurable/connectors-sdk";
610
806
  import { newBindingPoller, newBindingTriggerSource, newMemoryCursorStore, newRunner } from "@superdurable/connectors-sdk/pollingtrigger";
611
807
  import {
612
- ObjectNotFoundError,
808
+ ObjectNotFoundError as ObjectNotFoundError2,
613
809
  decodeTriggerConfiguration,
614
810
  newDurableTriggerTarget,
615
811
  parseTriggerPayloadJSON
@@ -1261,7 +1457,7 @@ function newProjectRecordChangedTriggerRunner(project, connectionName, routes, o
1261
1457
  try {
1262
1458
  configuration = decodeTriggerConfiguration(project.configuration, key, RecordChangedTriggerConfigurationSchema);
1263
1459
  } catch (error) {
1264
- if (error instanceof ObjectNotFoundError) throw new TypeError(`Airtable recordChanged binding ${name} has no saved configuration; pick the base, table, and field in Dex Web and restart`, { cause: error });
1460
+ if (error instanceof ObjectNotFoundError2) throw new TypeError(`Airtable recordChanged binding ${name} has no saved configuration; pick the base, table, and field in Dex Web and restart`, { cause: error });
1265
1461
  throw new TypeError(`Airtable recordChanged binding ${name} configuration: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
1266
1462
  }
1267
1463
  const target = newDurableTriggerTarget(project.triggerInbox(key), key, route.target, { ...options.logger ? { logger: options.logger } : {}, decodePayload: decodeRecordChangedEventPayload });
@@ -1304,6 +1500,27 @@ export {
1304
1500
  ConfigSchema,
1305
1501
  Connection,
1306
1502
  ConnectorID,
1503
+ CreateRecordBranch,
1504
+ CreateRecordBranchCreated,
1505
+ CreateRecordBranchDefect,
1506
+ CreateRecordBranchProviderRejected,
1507
+ CreateRecordBranchUncertain,
1508
+ CreateRecordDefinition,
1509
+ CreateRecordInputSchema,
1510
+ CreateRecordMetadata,
1511
+ CreateRecordOperation,
1512
+ CredentialMaterialError,
1513
+ DeleteRecordBranch,
1514
+ DeleteRecordBranchAlreadyAbsent,
1515
+ DeleteRecordBranchDefect,
1516
+ DeleteRecordBranchDeleted,
1517
+ DeleteRecordBranchInvalidResponse,
1518
+ DeleteRecordBranchProviderRejected,
1519
+ DeleteRecordDefinition,
1520
+ DeleteRecordInputSchema,
1521
+ DeleteRecordMetadata,
1522
+ DeleteRecordOperation,
1523
+ DeletedRecordSchema,
1307
1524
  FieldEqualityFilterSchema,
1308
1525
  GetRecordBranch,
1309
1526
  GetRecordBranchDefect,
@@ -1370,8 +1587,11 @@ export {
1370
1587
  decodeCredentials,
1371
1588
  decodeRecordChangedEventPayload,
1372
1589
  defineRecordChangedTriggerBinding,
1590
+ isCredentialMaterialError,
1373
1591
  newConnection,
1374
1592
  newConnectionWithOperations,
1593
+ newCreateRecordStep,
1594
+ newDeleteRecordStep,
1375
1595
  newGetRecordStep,
1376
1596
  newListRecordsStep,
1377
1597
  newProjectConnection2 as newProjectConnection,
package/dist/mock.d.ts CHANGED
@@ -1,16 +1,22 @@
1
- import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
1
+ import { MockMutation, MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
2
2
  import { Failure } from '@superdurable/connectors-sdk';
3
- import { O as Operations, C as Connection, L as ListRecordsInput, a as RecordPage, G as GetRecordInput, R as Record, c as UpsertRecordsInput, d as UpsertedRecords, U as UpdateRecordsInput, b as UpdatedRecords, F as FieldEqualityFilter, n as RecordSort, p as RecordUpdate, r as RecordUpsert } from './connection-D9d1yIrY.js';
3
+ import { O as Operations, a as Connection, C as CreateRecordInput, R as Record, D as DeleteRecordInput, b as DeletedRecord, L as ListRecordsInput, c as RecordPage, G as GetRecordInput, e as UpsertRecordsInput, f as UpsertedRecords, U as UpdateRecordsInput, d as UpdatedRecords, F as FieldEqualityFilter, t as RecordSort, v as RecordUpdate, x as RecordUpsert } from './connection-CKiWXbm0.js';
4
4
  import 'zod';
5
5
 
6
+ /** Go zero value for CreateRecordInput in scripted cases. */
7
+ declare const emptyCreateRecordInput: CreateRecordInput;
8
+ /** Go zero value for Record in scripted cases. */
9
+ declare const emptyRecord: Record;
10
+ /** Go zero value for DeleteRecordInput in scripted cases. */
11
+ declare const emptyDeleteRecordInput: DeleteRecordInput;
12
+ /** Go zero value for DeletedRecord in scripted cases. */
13
+ declare const emptyDeletedRecord: DeletedRecord;
6
14
  /** Go zero value for FieldEqualityFilter in scripted cases. */
7
15
  declare const emptyFieldEqualityFilter: FieldEqualityFilter;
8
16
  /** Go zero value for RecordSort in scripted cases. */
9
17
  declare const emptyRecordSort: RecordSort;
10
18
  /** Go zero value for ListRecordsInput in scripted cases. */
11
19
  declare const emptyListRecordsInput: ListRecordsInput;
12
- /** Go zero value for Record in scripted cases. */
13
- declare const emptyRecord: Record;
14
20
  /** Go zero value for RecordPage in scripted cases. */
15
21
  declare const emptyRecordPage: RecordPage;
16
22
  /** Go zero value for GetRecordInput in scripted cases. */
@@ -27,6 +33,40 @@ declare const emptyRecordUpdate: RecordUpdate;
27
33
  declare const emptyUpdateRecordsInput: UpdateRecordsInput;
28
34
  /** Go zero value for UpdatedRecords in scripted cases. */
29
35
  declare const emptyUpdatedRecords: UpdatedRecords;
36
+ /** Script the created branch. */
37
+ declare function createRecordCreated(value: Record, failure?: Failure): Case<Record>;
38
+ /** Script the providerRejected branch. */
39
+ declare function createRecordProviderRejected(value: Record, failure?: Failure): Case<Record>;
40
+ /** Script the defect branch. */
41
+ declare function createRecordDefect(value: Record, failure?: Failure): Case<Record>;
42
+ /** Script a safe retry of createRecord. */
43
+ declare function createRecordRetry(failure: Failure, retryAfterMs?: number): Case<Record>;
44
+ /** Script an uncertain createRecord attempt. */
45
+ declare function createRecordUncertain(value: Record, failure: Failure): Case<Record>;
46
+ /** Manifest scenario createdReviewRecord for createRecord. */
47
+ declare function createRecordCreatedReviewRecord(): Case<Record>;
48
+ /** Default createRecord scenario. */
49
+ declare function createRecordDefault(): Case<Record>;
50
+ /** Manifest scenario createDenied for createRecord. */
51
+ declare function createRecordCreateDenied(): Case<Record>;
52
+ /** Script the deleted branch. */
53
+ declare function deleteRecordDeleted(value: DeletedRecord, failure?: Failure): Case<DeletedRecord>;
54
+ /** Script the alreadyAbsent branch. */
55
+ declare function deleteRecordAlreadyAbsent(value: DeletedRecord, failure?: Failure): Case<DeletedRecord>;
56
+ /** Script the providerRejected branch. */
57
+ declare function deleteRecordProviderRejected(value: DeletedRecord, failure?: Failure): Case<DeletedRecord>;
58
+ /** Script the invalidResponse branch. */
59
+ declare function deleteRecordInvalidResponse(value: DeletedRecord, failure?: Failure): Case<DeletedRecord>;
60
+ /** Script the defect branch. */
61
+ declare function deleteRecordDefect(value: DeletedRecord, failure?: Failure): Case<DeletedRecord>;
62
+ /** Script a safe retry of deleteRecord. */
63
+ declare function deleteRecordRetry(failure: Failure, retryAfterMs?: number): Case<DeletedRecord>;
64
+ /** Manifest scenario deletedReviewRecord for deleteRecord. */
65
+ declare function deleteRecordDeletedReviewRecord(): Case<DeletedRecord>;
66
+ /** Default deleteRecord scenario. */
67
+ declare function deleteRecordDefault(): Case<DeletedRecord>;
68
+ /** Manifest scenario missingReviewRecord for deleteRecord. */
69
+ declare function deleteRecordMissingReviewRecord(): Case<DeletedRecord>;
30
70
  /** Script the listed branch. */
31
71
  declare function listRecordsListed(value: RecordPage, failure?: Failure): Case<RecordPage>;
32
72
  /** Script the offsetExpired branch. */
@@ -108,6 +148,8 @@ declare class GeneratedMock implements Operations {
108
148
  #private;
109
149
  constructor(connectionName: string);
110
150
  connection(): Connection;
151
+ createRecord(): MockMutation<CreateRecordInput, Record>;
152
+ deleteRecord(): MockMutation<DeleteRecordInput, DeletedRecord>;
111
153
  listRecords(): MockQuery<ListRecordsInput, RecordPage>;
112
154
  getRecord(): MockQuery<GetRecordInput, Record>;
113
155
  upsertRecords(): MockMutation<UpsertRecordsInput, UpsertedRecords>;
@@ -115,4 +157,4 @@ declare class GeneratedMock implements Operations {
115
157
  assertNoFailures(): void;
116
158
  }
117
159
 
118
- export { GeneratedMock, emptyFieldEqualityFilter, emptyGetRecordInput, emptyListRecordsInput, emptyRecord, emptyRecordPage, emptyRecordSort, emptyRecordUpdate, emptyRecordUpsert, emptyUpdateRecordsInput, emptyUpdatedRecords, emptyUpsertRecordsInput, emptyUpsertedRecords, getRecordApprovedDecisionLog, getRecordDecisionReadDenied, getRecordDefault, getRecordDefect, getRecordFound, getRecordInvalidResponse, getRecordMissingDecisionLog, getRecordNotFound, getRecordProviderRejected, getRecordRetry, listRecordsDefault, listRecordsDefect, listRecordsExpiredPolicyOffset, listRecordsInvalidResponse, listRecordsListed, listRecordsOffsetExpired, listRecordsPolicyListDenied, listRecordsProviderRejected, listRecordsRetry, listRecordsStandardRefundPolicy, updateRecordsDefault, updateRecordsDefect, updateRecordsInvalidResponse, updateRecordsMissingPolicyStamp, updateRecordsNotFound, updateRecordsPolicyStampDenied, updateRecordsProviderRejected, updateRecordsRetry, updateRecordsStampedStandardPolicy, updateRecordsUpdated, upsertRecordsDecisionUpsertDenied, upsertRecordsDefault, upsertRecordsDefect, upsertRecordsInvalidResponse, upsertRecordsLoggedApprovedRefund, upsertRecordsProviderRejected, upsertRecordsRetry, upsertRecordsUpserted };
160
+ export { GeneratedMock, createRecordCreateDenied, createRecordCreated, createRecordCreatedReviewRecord, createRecordDefault, createRecordDefect, createRecordProviderRejected, createRecordRetry, createRecordUncertain, deleteRecordAlreadyAbsent, deleteRecordDefault, deleteRecordDefect, deleteRecordDeleted, deleteRecordDeletedReviewRecord, deleteRecordInvalidResponse, deleteRecordMissingReviewRecord, deleteRecordProviderRejected, deleteRecordRetry, emptyCreateRecordInput, emptyDeleteRecordInput, emptyDeletedRecord, emptyFieldEqualityFilter, emptyGetRecordInput, emptyListRecordsInput, emptyRecord, emptyRecordPage, emptyRecordSort, emptyRecordUpdate, emptyRecordUpsert, emptyUpdateRecordsInput, emptyUpdatedRecords, emptyUpsertRecordsInput, emptyUpsertedRecords, getRecordApprovedDecisionLog, getRecordDecisionReadDenied, getRecordDefault, getRecordDefect, getRecordFound, getRecordInvalidResponse, getRecordMissingDecisionLog, getRecordNotFound, getRecordProviderRejected, getRecordRetry, listRecordsDefault, listRecordsDefect, listRecordsExpiredPolicyOffset, listRecordsInvalidResponse, listRecordsListed, listRecordsOffsetExpired, listRecordsPolicyListDenied, listRecordsProviderRejected, listRecordsRetry, listRecordsStandardRefundPolicy, updateRecordsDefault, updateRecordsDefect, updateRecordsInvalidResponse, updateRecordsMissingPolicyStamp, updateRecordsNotFound, updateRecordsPolicyStampDenied, updateRecordsProviderRejected, updateRecordsRetry, updateRecordsStampedStandardPolicy, updateRecordsUpdated, upsertRecordsDecisionUpsertDenied, upsertRecordsDefault, upsertRecordsDefect, upsertRecordsInvalidResponse, upsertRecordsLoggedApprovedRefund, upsertRecordsProviderRejected, upsertRecordsRetry, upsertRecordsUpserted };