@superdurable/connector-airtable 0.2.1 → 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/README.md +12 -2
- package/dex-connector.json +133 -2
- package/dist/{chunk-XPD7RWH6.js → chunk-JBLBIUXW.js} +86 -6
- package/dist/{connection-D07xrUMb.d.ts → connection-CKiWXbm0.d.ts} +69 -20
- package/dist/index.d.ts +126 -5
- package/dist/index.js +217 -10
- package/dist/mock.d.ts +47 -5
- package/dist/mock.js +112 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Airtable TypeScript connector
|
|
2
2
|
|
|
3
|
-
`@superdurable/connector-airtable` supplies `listRecords`, `getRecord`,
|
|
4
|
-
`upsertRecords`, and `updateRecords` for Dex TypeScript Flows, and the
|
|
3
|
+
`@superdurable/connector-airtable` supplies `createRecord`, `listRecords`, `getRecord`,
|
|
4
|
+
`upsertRecords`, `deleteRecord`, and `updateRecords` for Dex TypeScript Flows, and the
|
|
5
5
|
`recordChanged` poll Trigger at parity with the Go module. The operation
|
|
6
6
|
specific Step factories, model validators, connection contracts, and mocks are
|
|
7
7
|
generated from [`connector.yaml`](../connector.yaml) and the Go model types.
|
|
@@ -113,3 +113,13 @@ the Go fetcher scenarios and compares every cursor token and event ID with
|
|
|
113
113
|
digests the Go fetcher produced for the same scenarios. The 33 shared provider scenarios compare
|
|
114
114
|
requests, outputs, branches, retries, and stable mutation keys with Go.
|
|
115
115
|
No live Airtable token, base, picker, or provider call was verified.
|
|
116
|
+
|
|
117
|
+
## Delete one record
|
|
118
|
+
|
|
119
|
+
The [record deletion example](examples/delete-record/) uses the static `airtable-record-cleanup` connection. Select a disposable record in a base where the token has `data.records:write`. A confirmed deletion returns its record ID. A provider-confirmed absence on the first attempt selects `alreadyAbsent`.
|
|
120
|
+
|
|
121
|
+
## Create one record
|
|
122
|
+
|
|
123
|
+
The [record creation example](examples/create-record/) appends the supplied fields to a selected table. Airtable accepts no idempotency key. The Step reads back a previously confirmed record ID before resending. The default cap is three possibly effective sends. An unconfirmed write at the cap selects `uncertain`.
|
|
124
|
+
|
|
125
|
+
When upgrading a custom operation binding from v0.2.1, supply both creation and deletion operations to `newConnectionWithOperations`. The standard client and generated mocks bind both automatically.
|
package/dex-connector.json
CHANGED
|
@@ -1,12 +1,143 @@
|
|
|
1
1
|
{
|
|
2
2
|
"connectorId": "airtable",
|
|
3
|
-
"releaseTag": "connectors/airtable/go/v0.
|
|
3
|
+
"releaseTag": "connectors/airtable/go/v0.25.1",
|
|
4
4
|
"package": {
|
|
5
5
|
"ecosystem": "npm",
|
|
6
6
|
"name": "@superdurable/connector-airtable",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.3.0"
|
|
8
8
|
},
|
|
9
9
|
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newCreateRecordStep",
|
|
12
|
+
"kind": "mutation",
|
|
13
|
+
"operationId": "createRecord",
|
|
14
|
+
"inputType": "CreateRecordInput",
|
|
15
|
+
"description": "Append one record to a table without requiring a merge field; a repeated unknown outcome can create a duplicate.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "created",
|
|
25
|
+
"field": "created",
|
|
26
|
+
"optional": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "providerRejected",
|
|
30
|
+
"field": "providerRejected",
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "uncertain",
|
|
35
|
+
"field": "uncertain",
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "defect",
|
|
40
|
+
"field": "defect",
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"inputSchema": {
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"description": "CreateRecordInput appends one record to an Airtable table. An unknown result may be resent up to MaxSends and can produce duplicates.",
|
|
47
|
+
"properties": {
|
|
48
|
+
"baseId": {
|
|
49
|
+
"description": "BaseID is the Airtable base ID.",
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"fields": {
|
|
53
|
+
"additionalProperties": {},
|
|
54
|
+
"description": "Fields maps names or IDs to typed cell values.",
|
|
55
|
+
"type": [
|
|
56
|
+
"object",
|
|
57
|
+
"null"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"tableIdOrName": {
|
|
61
|
+
"description": "TableIDOrName identifies the table, preferably by stable ID.",
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"typecast": {
|
|
65
|
+
"description": "Typecast enables Airtable's best-effort conversion of text values.",
|
|
66
|
+
"type": "boolean"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": [
|
|
70
|
+
"baseId",
|
|
71
|
+
"fields",
|
|
72
|
+
"tableIdOrName"
|
|
73
|
+
],
|
|
74
|
+
"type": "object"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "newDeleteRecordStep",
|
|
79
|
+
"kind": "mutation",
|
|
80
|
+
"operationId": "deleteRecord",
|
|
81
|
+
"inputType": "DeleteRecordInput",
|
|
82
|
+
"description": "Delete one record by ID; an already absent record meets the requested final state.",
|
|
83
|
+
"fields": {
|
|
84
|
+
"stepType": "stepType",
|
|
85
|
+
"annotations": "annotations",
|
|
86
|
+
"connectionName": "connectionName",
|
|
87
|
+
"resultAttribute": "resultAttribute"
|
|
88
|
+
},
|
|
89
|
+
"branches": [
|
|
90
|
+
{
|
|
91
|
+
"id": "deleted",
|
|
92
|
+
"field": "deleted",
|
|
93
|
+
"optional": false
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "alreadyAbsent",
|
|
97
|
+
"field": "alreadyAbsent",
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "providerRejected",
|
|
102
|
+
"field": "providerRejected",
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "invalidResponse",
|
|
107
|
+
"field": "invalidResponse",
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "defect",
|
|
112
|
+
"field": "defect",
|
|
113
|
+
"optional": true
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"inputSchema": {
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"description": "DeleteRecordInput identifies the record whose absence is requested.",
|
|
119
|
+
"properties": {
|
|
120
|
+
"baseId": {
|
|
121
|
+
"description": "BaseID is the Airtable base ID.",
|
|
122
|
+
"type": "string"
|
|
123
|
+
},
|
|
124
|
+
"recordId": {
|
|
125
|
+
"description": "RecordID is the Airtable record ID.",
|
|
126
|
+
"type": "string"
|
|
127
|
+
},
|
|
128
|
+
"tableIdOrName": {
|
|
129
|
+
"description": "TableIDOrName identifies the table, preferably by stable ID.",
|
|
130
|
+
"type": "string"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": [
|
|
134
|
+
"baseId",
|
|
135
|
+
"recordId",
|
|
136
|
+
"tableIdOrName"
|
|
137
|
+
],
|
|
138
|
+
"type": "object"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
10
141
|
{
|
|
11
142
|
"name": "newListRecordsStep",
|
|
12
143
|
"kind": "query",
|
|
@@ -55,6 +55,25 @@ function decodeCredentials(value) {
|
|
|
55
55
|
credentials.personalAccessToken = new SecretString(fields["personal_access_token"] ?? "");
|
|
56
56
|
return credentials;
|
|
57
57
|
}
|
|
58
|
+
var CreateRecordInputSchema = z.strictObject({
|
|
59
|
+
"baseId": z.string(),
|
|
60
|
+
"tableIdOrName": z.string(),
|
|
61
|
+
"fields": z.record(z.string(), z.unknown().nullable()).nullable(),
|
|
62
|
+
"typecast": z.boolean().optional()
|
|
63
|
+
});
|
|
64
|
+
var RecordSchema = z.strictObject({
|
|
65
|
+
"id": z.string(),
|
|
66
|
+
"createdTime": GoTimeJSONSchema,
|
|
67
|
+
"fields": z.record(z.string(), z.unknown().nullable()).nullable()
|
|
68
|
+
});
|
|
69
|
+
var DeleteRecordInputSchema = z.strictObject({
|
|
70
|
+
"baseId": z.string(),
|
|
71
|
+
"tableIdOrName": z.string(),
|
|
72
|
+
"recordId": z.string()
|
|
73
|
+
});
|
|
74
|
+
var DeletedRecordSchema = z.strictObject({
|
|
75
|
+
"recordId": z.string()
|
|
76
|
+
});
|
|
58
77
|
var FieldEqualityFilterSchema = z.strictObject({
|
|
59
78
|
"field": z.string(),
|
|
60
79
|
"text": z.string().optional(),
|
|
@@ -76,11 +95,6 @@ var ListRecordsInputSchema = z.strictObject({
|
|
|
76
95
|
"pageSize": z.number().int().optional(),
|
|
77
96
|
"offset": z.string().optional()
|
|
78
97
|
});
|
|
79
|
-
var RecordSchema = z.strictObject({
|
|
80
|
-
"id": z.string(),
|
|
81
|
-
"createdTime": GoTimeJSONSchema,
|
|
82
|
-
"fields": z.record(z.string(), z.unknown().nullable()).nullable()
|
|
83
|
-
});
|
|
84
98
|
var RecordPageSchema = z.strictObject({
|
|
85
99
|
"records": z.array(RecordSchema).nullable(),
|
|
86
100
|
"offset": z.string().optional(),
|
|
@@ -125,6 +139,54 @@ var UpdatedRecordsSchema = z.strictObject({
|
|
|
125
139
|
// src/generated/definitions.ts
|
|
126
140
|
var ConnectorID = "airtable";
|
|
127
141
|
var ProviderID = "airtable";
|
|
142
|
+
var CreateRecordBranch = {
|
|
143
|
+
Created: "created",
|
|
144
|
+
ProviderRejected: "providerRejected",
|
|
145
|
+
Uncertain: "uncertain",
|
|
146
|
+
Defect: "defect"
|
|
147
|
+
};
|
|
148
|
+
var CreateRecordBranchCreated = CreateRecordBranch.Created;
|
|
149
|
+
var CreateRecordBranchProviderRejected = CreateRecordBranch.ProviderRejected;
|
|
150
|
+
var CreateRecordBranchUncertain = CreateRecordBranch.Uncertain;
|
|
151
|
+
var CreateRecordBranchDefect = CreateRecordBranch.Defect;
|
|
152
|
+
var CreateRecordDefinition = {
|
|
153
|
+
operation: { connectorId: ConnectorID, operationId: "createRecord" },
|
|
154
|
+
branches: [
|
|
155
|
+
{ id: "created", description: "Airtable created and returned the record." },
|
|
156
|
+
{ id: "providerRejected", description: "Airtable conclusively rejected the create request.", optional: true },
|
|
157
|
+
{ id: "uncertain", description: "A previous create may have succeeded but cannot be confirmed after the send cap.", optional: true },
|
|
158
|
+
{ id: "defect", description: "Local input or connector configuration is invalid.", optional: true }
|
|
159
|
+
],
|
|
160
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
|
|
161
|
+
repeatOnUnknown: "limited",
|
|
162
|
+
maxSends: 3
|
|
163
|
+
};
|
|
164
|
+
var CreateRecordMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
165
|
+
var DeleteRecordBranch = {
|
|
166
|
+
Deleted: "deleted",
|
|
167
|
+
AlreadyAbsent: "alreadyAbsent",
|
|
168
|
+
ProviderRejected: "providerRejected",
|
|
169
|
+
InvalidResponse: "invalidResponse",
|
|
170
|
+
Defect: "defect"
|
|
171
|
+
};
|
|
172
|
+
var DeleteRecordBranchDeleted = DeleteRecordBranch.Deleted;
|
|
173
|
+
var DeleteRecordBranchAlreadyAbsent = DeleteRecordBranch.AlreadyAbsent;
|
|
174
|
+
var DeleteRecordBranchProviderRejected = DeleteRecordBranch.ProviderRejected;
|
|
175
|
+
var DeleteRecordBranchInvalidResponse = DeleteRecordBranch.InvalidResponse;
|
|
176
|
+
var DeleteRecordBranchDefect = DeleteRecordBranch.Defect;
|
|
177
|
+
var DeleteRecordDefinition = {
|
|
178
|
+
operation: { connectorId: ConnectorID, operationId: "deleteRecord" },
|
|
179
|
+
branches: [
|
|
180
|
+
{ id: "deleted", description: "Airtable deleted the record." },
|
|
181
|
+
{ id: "alreadyAbsent", description: "The record was already absent.", optional: true },
|
|
182
|
+
{ id: "providerRejected", description: "Airtable conclusively rejected the delete request.", optional: true },
|
|
183
|
+
{ id: "invalidResponse", description: "Airtable returned an invalid delete response.", optional: true },
|
|
184
|
+
{ id: "defect", description: "Local input or connector configuration is invalid.", optional: true }
|
|
185
|
+
],
|
|
186
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
|
|
187
|
+
repeatOnUnknown: "safe"
|
|
188
|
+
};
|
|
189
|
+
var DeleteRecordMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
128
190
|
var ListRecordsBranch = {
|
|
129
191
|
Listed: "listed",
|
|
130
192
|
OffsetExpired: "offsetExpired",
|
|
@@ -256,10 +318,13 @@ export {
|
|
|
256
318
|
CredentialMaterialError,
|
|
257
319
|
isCredentialMaterialError,
|
|
258
320
|
decodeCredentials,
|
|
321
|
+
CreateRecordInputSchema,
|
|
322
|
+
RecordSchema,
|
|
323
|
+
DeleteRecordInputSchema,
|
|
324
|
+
DeletedRecordSchema,
|
|
259
325
|
FieldEqualityFilterSchema,
|
|
260
326
|
RecordSortSchema,
|
|
261
327
|
ListRecordsInputSchema,
|
|
262
|
-
RecordSchema,
|
|
263
328
|
RecordPageSchema,
|
|
264
329
|
GetRecordInputSchema,
|
|
265
330
|
RecordUpsertSchema,
|
|
@@ -270,6 +335,21 @@ export {
|
|
|
270
335
|
UpdatedRecordsSchema,
|
|
271
336
|
ConnectorID,
|
|
272
337
|
ProviderID,
|
|
338
|
+
CreateRecordBranch,
|
|
339
|
+
CreateRecordBranchCreated,
|
|
340
|
+
CreateRecordBranchProviderRejected,
|
|
341
|
+
CreateRecordBranchUncertain,
|
|
342
|
+
CreateRecordBranchDefect,
|
|
343
|
+
CreateRecordDefinition,
|
|
344
|
+
CreateRecordMetadata,
|
|
345
|
+
DeleteRecordBranch,
|
|
346
|
+
DeleteRecordBranchDeleted,
|
|
347
|
+
DeleteRecordBranchAlreadyAbsent,
|
|
348
|
+
DeleteRecordBranchProviderRejected,
|
|
349
|
+
DeleteRecordBranchInvalidResponse,
|
|
350
|
+
DeleteRecordBranchDefect,
|
|
351
|
+
DeleteRecordDefinition,
|
|
352
|
+
DeleteRecordMetadata,
|
|
273
353
|
ListRecordsBranch,
|
|
274
354
|
ListRecordsBranchListed,
|
|
275
355
|
ListRecordsBranchOffsetExpired,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SecretString, CredentialProvider,
|
|
1
|
+
import { SecretString, CredentialProvider, Mutation, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/** Connector configuration; omitted fields use manifest defaults. */
|
|
@@ -34,6 +34,46 @@ declare function isCredentialMaterialError(error: unknown): boolean;
|
|
|
34
34
|
declare function decodeCredentials(value: unknown): Credentials;
|
|
35
35
|
/** Host-owned source of private connector credentials. */
|
|
36
36
|
type CredentialSource = CredentialProvider<Credentials>;
|
|
37
|
+
/** CreateRecordInput appends one record to an Airtable table.
|
|
38
|
+
* An unknown result may be resent up to MaxSends and can produce duplicates. */
|
|
39
|
+
interface CreateRecordInput {
|
|
40
|
+
/** BaseID is the Airtable base ID. */
|
|
41
|
+
"baseId": string;
|
|
42
|
+
/** TableIDOrName identifies the table, preferably by stable ID. */
|
|
43
|
+
"tableIdOrName": string;
|
|
44
|
+
/** Fields maps names or IDs to typed cell values. */
|
|
45
|
+
"fields": {
|
|
46
|
+
[key: string]: unknown | null;
|
|
47
|
+
} | null;
|
|
48
|
+
/** Typecast enables Airtable's best-effort conversion of text values. */
|
|
49
|
+
"typecast"?: boolean | undefined;
|
|
50
|
+
}
|
|
51
|
+
/** Record is one Airtable record as Airtable returned it. */
|
|
52
|
+
interface Record {
|
|
53
|
+
/** ID is the record ID, such as recXXXXXXXXXXXXXX. */
|
|
54
|
+
"id": string;
|
|
55
|
+
/** CreatedTime is when Airtable created the record, in UTC. */
|
|
56
|
+
"createdTime": string;
|
|
57
|
+
/** Fields maps each non-empty field, by field name, to its cell value.
|
|
58
|
+
* Airtable omits empty fields, so a missing key means the field is empty. */
|
|
59
|
+
"fields": {
|
|
60
|
+
[key: string]: unknown | null;
|
|
61
|
+
} | null;
|
|
62
|
+
}
|
|
63
|
+
/** DeleteRecordInput identifies the record whose absence is requested. */
|
|
64
|
+
interface DeleteRecordInput {
|
|
65
|
+
/** BaseID is the Airtable base ID. */
|
|
66
|
+
"baseId": string;
|
|
67
|
+
/** TableIDOrName identifies the table, preferably by stable ID. */
|
|
68
|
+
"tableIdOrName": string;
|
|
69
|
+
/** RecordID is the Airtable record ID. */
|
|
70
|
+
"recordId": string;
|
|
71
|
+
}
|
|
72
|
+
/** DeletedRecord confirms which record was removed. */
|
|
73
|
+
interface DeletedRecord {
|
|
74
|
+
/** RecordID is the requested record ID. */
|
|
75
|
+
"recordId": string;
|
|
76
|
+
}
|
|
37
77
|
/** FieldEqualityFilter matches records whose field equals one typed value.
|
|
38
78
|
* Exactly one of Text, Number, and Checkbox is set; prefer the constructors
|
|
39
79
|
* TextFieldEquals, NumberFieldEquals, and CheckboxFieldEquals.
|
|
@@ -93,18 +133,6 @@ interface ListRecordsInput {
|
|
|
93
133
|
/** Offset continues a listing from the previous page's Offset; blank starts at the first page. */
|
|
94
134
|
"offset"?: string | undefined;
|
|
95
135
|
}
|
|
96
|
-
/** Record is one Airtable record as Airtable returned it. */
|
|
97
|
-
interface Record {
|
|
98
|
-
/** ID is the record ID, such as recXXXXXXXXXXXXXX. */
|
|
99
|
-
"id": string;
|
|
100
|
-
/** CreatedTime is when Airtable created the record, in UTC. */
|
|
101
|
-
"createdTime": string;
|
|
102
|
-
/** Fields maps each non-empty field, by field name, to its cell value.
|
|
103
|
-
* Airtable omits empty fields, so a missing key means the field is empty. */
|
|
104
|
-
"fields": {
|
|
105
|
-
[key: string]: unknown | null;
|
|
106
|
-
} | null;
|
|
107
|
-
}
|
|
108
136
|
/** RecordPage is one page of listed records. */
|
|
109
137
|
interface RecordPage {
|
|
110
138
|
/** Records holds at most the requested page size of records; an empty page is an empty list. */
|
|
@@ -202,6 +230,29 @@ interface UpdatedRecords {
|
|
|
202
230
|
* attachment, such as attachmentsFailedUploading; empty when nothing failed. */
|
|
203
231
|
"partialSuccessReasons"?: Array<string> | undefined;
|
|
204
232
|
}
|
|
233
|
+
/** Runtime validator for CreateRecordInput. */
|
|
234
|
+
declare const CreateRecordInputSchema: z.ZodObject<{
|
|
235
|
+
baseId: z.ZodString;
|
|
236
|
+
tableIdOrName: z.ZodString;
|
|
237
|
+
fields: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodUnknown>>>;
|
|
238
|
+
typecast: z.ZodOptional<z.ZodBoolean>;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
/** Runtime validator for Record. */
|
|
241
|
+
declare const RecordSchema: z.ZodObject<{
|
|
242
|
+
id: z.ZodString;
|
|
243
|
+
createdTime: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
244
|
+
fields: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodUnknown>>>;
|
|
245
|
+
}, z.core.$strict>;
|
|
246
|
+
/** Runtime validator for DeleteRecordInput. */
|
|
247
|
+
declare const DeleteRecordInputSchema: z.ZodObject<{
|
|
248
|
+
baseId: z.ZodString;
|
|
249
|
+
tableIdOrName: z.ZodString;
|
|
250
|
+
recordId: z.ZodString;
|
|
251
|
+
}, z.core.$strict>;
|
|
252
|
+
/** Runtime validator for DeletedRecord. */
|
|
253
|
+
declare const DeletedRecordSchema: z.ZodObject<{
|
|
254
|
+
recordId: z.ZodString;
|
|
255
|
+
}, z.core.$strict>;
|
|
205
256
|
/** Runtime validator for FieldEqualityFilter. */
|
|
206
257
|
declare const FieldEqualityFilterSchema: z.ZodObject<{
|
|
207
258
|
field: z.ZodString;
|
|
@@ -234,12 +285,6 @@ declare const ListRecordsInputSchema: z.ZodObject<{
|
|
|
234
285
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
235
286
|
offset: z.ZodOptional<z.ZodString>;
|
|
236
287
|
}, z.core.$strict>;
|
|
237
|
-
/** Runtime validator for Record. */
|
|
238
|
-
declare const RecordSchema: z.ZodObject<{
|
|
239
|
-
id: z.ZodString;
|
|
240
|
-
createdTime: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
241
|
-
fields: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodUnknown>>>;
|
|
242
|
-
}, z.core.$strict>;
|
|
243
288
|
/** Runtime validator for RecordPage. */
|
|
244
289
|
declare const RecordPageSchema: z.ZodObject<{
|
|
245
290
|
records: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
@@ -308,6 +353,10 @@ declare const UpdatedRecordsSchema: z.ZodObject<{
|
|
|
308
353
|
|
|
309
354
|
/** Typed operations supplied by a client or mock. */
|
|
310
355
|
interface Operations {
|
|
356
|
+
/** Invoke createRecord through this connection. */
|
|
357
|
+
createRecord(): Mutation<CreateRecordInput, Record>;
|
|
358
|
+
/** Invoke deleteRecord through this connection. */
|
|
359
|
+
deleteRecord(): Mutation<DeleteRecordInput, DeletedRecord>;
|
|
311
360
|
/** Invoke listRecords through this connection. */
|
|
312
361
|
listRecords(): Query<ListRecordsInput, RecordPage>;
|
|
313
362
|
/** Invoke getRecord through this connection. */
|
|
@@ -331,4 +380,4 @@ declare function newConnection(client: Operations, reference: ConnectionRef): Co
|
|
|
331
380
|
/** Bind scripted operations to a named connection. */
|
|
332
381
|
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
333
382
|
|
|
334
|
-
export {
|
|
383
|
+
export { UpdatedRecordsSchema as A, UpsertRecordsInputSchema as B, type CreateRecordInput as C, type DeleteRecordInput as D, UpsertedRecordsSchema as E, type FieldEqualityFilter as F, type GetRecordInput as G, decodeCredentials as H, isCredentialMaterialError as I, newConnection as J, newConnectionWithOperations as K, type ListRecordsInput as L, type Operations as O, type Record as R, type UpdateRecordsInput as U, Connection as a, type DeletedRecord as b, type RecordPage as c, type UpdatedRecords as d, type UpsertRecordsInput as e, type UpsertedRecords as f, type Config as g, type Credentials as h, ConfigSchema as i, CreateRecordInputSchema as j, CredentialMaterialError as k, type CredentialSource as l, DeleteRecordInputSchema as m, DeletedRecordSchema as n, FieldEqualityFilterSchema as o, GetRecordInputSchema as p, ListRecordsInputSchema as q, RecordPageSchema as r, RecordSchema as s, type RecordSort as t, RecordSortSchema as u, type RecordUpdate as v, RecordUpdateSchema as w, type RecordUpsert as x, RecordUpsertSchema as y, UpdateRecordsInputSchema as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { C as CreateRecordInput, R as Record$1, a as Connection, D as DeleteRecordInput, b as DeletedRecord, G as GetRecordInput, L as ListRecordsInput, c as RecordPage, U as UpdateRecordsInput, d as UpdatedRecords, e as UpsertRecordsInput, f as UpsertedRecords, g as Config, h as Credentials, O as Operations } from './connection-CKiWXbm0.js';
|
|
2
|
+
export { i as ConfigSchema, j as CreateRecordInputSchema, k as CredentialMaterialError, l as CredentialSource, m as DeleteRecordInputSchema, n as DeletedRecordSchema, F as FieldEqualityFilter, o as FieldEqualityFilterSchema, p as GetRecordInputSchema, q as ListRecordsInputSchema, r as RecordPageSchema, s as RecordSchema, t as RecordSort, u as RecordSortSchema, v as RecordUpdate, w as RecordUpdateSchema, x as RecordUpsert, y as RecordUpsertSchema, z as UpdateRecordsInputSchema, A as UpdatedRecordsSchema, B as UpsertRecordsInputSchema, E as UpsertedRecordsSchema, H as decodeCredentials, I as isCredentialMaterialError, J as newConnection, K as newConnectionWithOperations } from './connection-CKiWXbm0.js';
|
|
3
3
|
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
4
|
-
import { QueryDefinition,
|
|
4
|
+
import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, 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';
|
|
@@ -12,6 +12,55 @@ import { z } from 'zod';
|
|
|
12
12
|
declare const ConnectorID = "airtable";
|
|
13
13
|
/** Provider identity for named connections. */
|
|
14
14
|
declare const ProviderID = "airtable";
|
|
15
|
+
/** Branch IDs for createRecord. */
|
|
16
|
+
declare const CreateRecordBranch: {
|
|
17
|
+
readonly Created: "created";
|
|
18
|
+
readonly ProviderRejected: "providerRejected";
|
|
19
|
+
readonly Uncertain: "uncertain";
|
|
20
|
+
readonly Defect: "defect";
|
|
21
|
+
};
|
|
22
|
+
/** Airtable created and returned the record. */
|
|
23
|
+
declare const CreateRecordBranchCreated: "created";
|
|
24
|
+
/** Airtable conclusively rejected the create request. */
|
|
25
|
+
declare const CreateRecordBranchProviderRejected: "providerRejected";
|
|
26
|
+
/** A previous create may have succeeded but cannot be confirmed after the send cap. */
|
|
27
|
+
declare const CreateRecordBranchUncertain: "uncertain";
|
|
28
|
+
/** Local input or connector configuration is invalid. */
|
|
29
|
+
declare const CreateRecordBranchDefect: "defect";
|
|
30
|
+
/** Manifest definition for createRecord. */
|
|
31
|
+
declare const CreateRecordDefinition: MutationDefinition;
|
|
32
|
+
/** Manifest metadata for createRecord. */
|
|
33
|
+
declare const CreateRecordMetadata: {
|
|
34
|
+
readonly kind: "mutation";
|
|
35
|
+
readonly idempotency: "required";
|
|
36
|
+
readonly authorization: "required";
|
|
37
|
+
};
|
|
38
|
+
/** Branch IDs for deleteRecord. */
|
|
39
|
+
declare const DeleteRecordBranch: {
|
|
40
|
+
readonly Deleted: "deleted";
|
|
41
|
+
readonly AlreadyAbsent: "alreadyAbsent";
|
|
42
|
+
readonly ProviderRejected: "providerRejected";
|
|
43
|
+
readonly InvalidResponse: "invalidResponse";
|
|
44
|
+
readonly Defect: "defect";
|
|
45
|
+
};
|
|
46
|
+
/** Airtable deleted the record. */
|
|
47
|
+
declare const DeleteRecordBranchDeleted: "deleted";
|
|
48
|
+
/** The record was already absent. */
|
|
49
|
+
declare const DeleteRecordBranchAlreadyAbsent: "alreadyAbsent";
|
|
50
|
+
/** Airtable conclusively rejected the delete request. */
|
|
51
|
+
declare const DeleteRecordBranchProviderRejected: "providerRejected";
|
|
52
|
+
/** Airtable returned an invalid delete response. */
|
|
53
|
+
declare const DeleteRecordBranchInvalidResponse: "invalidResponse";
|
|
54
|
+
/** Local input or connector configuration is invalid. */
|
|
55
|
+
declare const DeleteRecordBranchDefect: "defect";
|
|
56
|
+
/** Manifest definition for deleteRecord. */
|
|
57
|
+
declare const DeleteRecordDefinition: MutationDefinition;
|
|
58
|
+
/** Manifest metadata for deleteRecord. */
|
|
59
|
+
declare const DeleteRecordMetadata: {
|
|
60
|
+
readonly kind: "mutation";
|
|
61
|
+
readonly idempotency: "required";
|
|
62
|
+
readonly authorization: "required";
|
|
63
|
+
};
|
|
15
64
|
/** Branch IDs for listRecords. */
|
|
16
65
|
declare const ListRecordsBranch: {
|
|
17
66
|
readonly Listed: "listed";
|
|
@@ -114,6 +163,48 @@ declare const UpdateRecordsMetadata: {
|
|
|
114
163
|
readonly authorization: "required";
|
|
115
164
|
};
|
|
116
165
|
|
|
166
|
+
/** Configuration for the createRecord connector Step. */
|
|
167
|
+
interface CreateRecordStepConfig<StepInput, OperationInput = CreateRecordInput, OperationOutput = Record$1> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
168
|
+
/** Named connection supplying this operation. */
|
|
169
|
+
connection: Connection<{
|
|
170
|
+
createRecord(): Mutation<OperationInput, OperationOutput>;
|
|
171
|
+
}>;
|
|
172
|
+
/** Name matching the bound connection. */
|
|
173
|
+
connectionName: string;
|
|
174
|
+
/** Airtable created and returned the record. */
|
|
175
|
+
created: StepTarget<MutationResult<OperationOutput>>;
|
|
176
|
+
/** Airtable conclusively rejected the create request. */
|
|
177
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
178
|
+
/** A previous create may have succeeded but cannot be confirmed after the send cap. */
|
|
179
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
180
|
+
/** Local input or connector configuration is invalid. */
|
|
181
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
182
|
+
}
|
|
183
|
+
/** Build the createRecord Step from a named connection. */
|
|
184
|
+
declare function newCreateRecordStep<StepInput, OperationInput = CreateRecordInput, OperationOutput = Record$1>(configuration: CreateRecordStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
185
|
+
/** Configuration for the deleteRecord connector Step. */
|
|
186
|
+
interface DeleteRecordStepConfig<StepInput, OperationInput = DeleteRecordInput, OperationOutput = DeletedRecord> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
187
|
+
/** Named connection supplying this operation. */
|
|
188
|
+
connection: Connection<{
|
|
189
|
+
deleteRecord(): Mutation<OperationInput, OperationOutput>;
|
|
190
|
+
}>;
|
|
191
|
+
/** Name matching the bound connection. */
|
|
192
|
+
connectionName: string;
|
|
193
|
+
/** Airtable deleted the record. */
|
|
194
|
+
deleted: StepTarget<MutationResult<OperationOutput>>;
|
|
195
|
+
/** The record was already absent. */
|
|
196
|
+
alreadyAbsent?: StepTarget<MutationResult<OperationOutput>>;
|
|
197
|
+
/** Airtable conclusively rejected the delete request. */
|
|
198
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
199
|
+
/** Airtable returned an invalid delete response. */
|
|
200
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
201
|
+
/** Local input or connector configuration is invalid. */
|
|
202
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
203
|
+
/** Accepted for compatibility; ignored because the operation is safe to repeat. */
|
|
204
|
+
maxSends?: number;
|
|
205
|
+
}
|
|
206
|
+
/** Build the deleteRecord Step from a named connection. */
|
|
207
|
+
declare function newDeleteRecordStep<StepInput, OperationInput = DeleteRecordInput, OperationOutput = DeletedRecord>(configuration: DeleteRecordStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
117
208
|
/** Configuration for the listRecords connector Step. */
|
|
118
209
|
interface ListRecordsStepConfig<StepInput, OperationInput = ListRecordsInput, OperationOutput = RecordPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
119
210
|
/** Named connection supplying this operation. */
|
|
@@ -217,6 +308,30 @@ declare class GetRecordOperation implements Query<GetRecordInput, Record$1> {
|
|
|
217
308
|
/** Validate, send, and classify one record read. */
|
|
218
309
|
invoke(call: Call, input: GetRecordInput): Promise<QueryAttempt<Record$1>>;
|
|
219
310
|
}
|
|
311
|
+
/** Append a record with bounded resends and recovery by the last confirmed record ID. */
|
|
312
|
+
declare class CreateRecordOperation implements Mutation<CreateRecordInput, Record$1> {
|
|
313
|
+
private readonly client;
|
|
314
|
+
/** Bind the authenticated Airtable client. */
|
|
315
|
+
constructor(client: AirtableClient);
|
|
316
|
+
/** Return the manifest definition. */
|
|
317
|
+
definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
318
|
+
/** Correlate repeated sends with a single durable call ID. */
|
|
319
|
+
idempotencyKey(callId: string): string;
|
|
320
|
+
/** Read back a saved record before considering another POST. */
|
|
321
|
+
invoke(call: Call, input: CreateRecordInput): Promise<MutationAttempt<Record$1>>;
|
|
322
|
+
}
|
|
323
|
+
/** Delete a single Airtable record by its stable ID. */
|
|
324
|
+
declare class DeleteRecordOperation implements Mutation<DeleteRecordInput, DeletedRecord> {
|
|
325
|
+
private readonly client;
|
|
326
|
+
/** Bind the authenticated client. */
|
|
327
|
+
constructor(client: AirtableClient);
|
|
328
|
+
/** Return the manifest definition. */
|
|
329
|
+
definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
330
|
+
/** Correlate repeated requests with the Dex call ID. */
|
|
331
|
+
idempotencyKey(callId: string): string;
|
|
332
|
+
/** Delete the record and validate the returned confirmation. */
|
|
333
|
+
invoke(call: Call, input: DeleteRecordInput): Promise<MutationAttempt<DeletedRecord>>;
|
|
334
|
+
}
|
|
220
335
|
/** Mutation that replaces records by stable merge fields. */
|
|
221
336
|
declare class UpsertRecordsOperation implements Mutation<UpsertRecordsInput, UpsertedRecords> {
|
|
222
337
|
private readonly client;
|
|
@@ -264,6 +379,8 @@ interface ExchangeFailure {
|
|
|
264
379
|
receipt: ReceiptDraft;
|
|
265
380
|
/** HTTP status of the provider answer, or undefined when no status arrived. */
|
|
266
381
|
status?: number;
|
|
382
|
+
/** Whether Airtable supplied a recognized error type. */
|
|
383
|
+
hasProviderError?: boolean;
|
|
267
384
|
}
|
|
268
385
|
/** Successful bounded response or classified failure. */
|
|
269
386
|
type ExchangeResult = {
|
|
@@ -294,12 +411,16 @@ declare class AirtableClient {
|
|
|
294
411
|
getRecord(): GetRecordOperation;
|
|
295
412
|
/** Bind the upsert mutation. */
|
|
296
413
|
upsertRecords(): UpsertRecordsOperation;
|
|
414
|
+
/** Bind the limited-repeat creation mutation. */
|
|
415
|
+
createRecord(): CreateRecordOperation;
|
|
416
|
+
/** Bind the repeat-safe deletion mutation. */
|
|
417
|
+
deleteRecord(): DeleteRecordOperation;
|
|
297
418
|
/** Bind the update mutation. */
|
|
298
419
|
updateRecords(): UpdateRecordsOperation;
|
|
299
420
|
/** Produce one safe receipt after an exchange. */
|
|
300
421
|
receipt(call: Call, objectId: string): ReceiptDraft;
|
|
301
422
|
/** Resolve credentials, pace one base, send a bounded request, and classify non-2xx responses. */
|
|
302
|
-
exchange(call: Call, operation: string, baseId: string, objectId: string, method: string, path: string, body?: unknown): Promise<ExchangeResult>;
|
|
423
|
+
exchange(call: Call, operation: string, baseId: string, objectId: string, method: string, path: string, body?: unknown, signal?: AbortSignal): Promise<ExchangeResult>;
|
|
303
424
|
private reserveRequestSlot;
|
|
304
425
|
private classifyResponse;
|
|
305
426
|
private failure;
|
|
@@ -475,4 +596,4 @@ interface RecordChangedTriggerConfig {
|
|
|
475
596
|
*/
|
|
476
597
|
declare function newRecordChangedTrigger(config: RecordChangedTriggerConfig): TriggerRunner;
|
|
477
598
|
|
|
478
|
-
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 };
|
|
599
|
+
export { AirtableClient, type AirtableClientOptions, type AirtableRequestSender, Config, Connection, ConnectorID, CreateRecordBranch, CreateRecordBranchCreated, CreateRecordBranchDefect, CreateRecordBranchProviderRejected, CreateRecordBranchUncertain, CreateRecordDefinition, CreateRecordInput, CreateRecordMetadata, CreateRecordOperation, type CreateRecordStepConfig, Credentials, DeleteRecordBranch, DeleteRecordBranchAlreadyAbsent, DeleteRecordBranchDefect, DeleteRecordBranchDeleted, DeleteRecordBranchInvalidResponse, DeleteRecordBranchProviderRejected, DeleteRecordDefinition, DeleteRecordInput, DeleteRecordMetadata, DeleteRecordOperation, type DeleteRecordStepConfig, DeletedRecord, 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, newCreateRecordStep, newDeleteRecordStep, newGetRecordStep, newListRecordsStep, newProjectConnection, newProjectRecordChangedTriggerRunner, newRecordChangedTrigger, newRecordChangedTriggerRunner, newUpdateRecordsStep, newUpsertRecordsStep, validateRecordChangedTriggerConfiguration };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +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,
|
|
5
13
|
CredentialMaterialError,
|
|
14
|
+
DeleteRecordBranch,
|
|
15
|
+
DeleteRecordBranchAlreadyAbsent,
|
|
16
|
+
DeleteRecordBranchDefect,
|
|
17
|
+
DeleteRecordBranchDeleted,
|
|
18
|
+
DeleteRecordBranchInvalidResponse,
|
|
19
|
+
DeleteRecordBranchProviderRejected,
|
|
20
|
+
DeleteRecordDefinition,
|
|
21
|
+
DeleteRecordInputSchema,
|
|
22
|
+
DeleteRecordMetadata,
|
|
23
|
+
DeletedRecordSchema,
|
|
6
24
|
FieldEqualityFilterSchema,
|
|
7
25
|
GetRecordBranch,
|
|
8
26
|
GetRecordBranchDefect,
|
|
@@ -52,10 +70,31 @@ import {
|
|
|
52
70
|
newConnection,
|
|
53
71
|
newConnectionWithOperations,
|
|
54
72
|
newProjectConnection
|
|
55
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-JBLBIUXW.js";
|
|
56
74
|
|
|
57
75
|
// src/generated/steps.ts
|
|
58
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
|
+
}
|
|
59
98
|
function newListRecordsStep(configuration) {
|
|
60
99
|
const { connection, connectionName, listed, offsetExpired, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
61
100
|
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
@@ -105,12 +144,13 @@ import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
|
|
|
105
144
|
import { z } from "zod";
|
|
106
145
|
|
|
107
146
|
// src/client.ts
|
|
108
|
-
import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
147
|
+
import { ProviderTransportError, BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
109
148
|
import { ReauthorizationRequiredError, SecretString } from "@superdurable/connectors-sdk";
|
|
110
149
|
import { ConnectionNotSelectedError, CredentialBrokerRejectedError, ObjectNotFoundError } from "@superdurable/connectors-sdk/projectconfig";
|
|
111
150
|
|
|
112
151
|
// src/operations.ts
|
|
113
|
-
import {
|
|
152
|
+
import { Fence, CheckpointError, InsufficientTimeError } from "@superdurable/connectors-sdk/singledispatch";
|
|
153
|
+
import { newMutationUncertain, newMutationBranch, newMutationRetry, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
114
154
|
var baseIdPattern = /^app[0-9A-Za-z]{14}$/;
|
|
115
155
|
var recordIdPattern = /^rec[0-9A-Za-z]{14}$/;
|
|
116
156
|
var zeroTime = "0001-01-01T00:00:00Z";
|
|
@@ -181,6 +221,143 @@ var GetRecordOperation = class {
|
|
|
181
221
|
}
|
|
182
222
|
}
|
|
183
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
|
+
};
|
|
184
361
|
var UpsertRecordsOperation = class {
|
|
185
362
|
/** Bind one authenticated client. */
|
|
186
363
|
constructor(client) {
|
|
@@ -251,7 +428,7 @@ var UpdateRecordsOperation = class {
|
|
|
251
428
|
if (!Array.isArray(body.records) || body.records.length !== input.records?.length) throw new Error("invalid update response");
|
|
252
429
|
const records = body.records.map(decodeRecord);
|
|
253
430
|
const requestedIds = new Set(input.records.map((record) => record.id));
|
|
254
|
-
if (records.some((record) => !requestedIds.
|
|
431
|
+
if (records.some((record) => !requestedIds.delete(record.id))) throw new Error("unexpected updated record");
|
|
255
432
|
const partialSuccessReasons = decodePartialSuccessReasons(body.details);
|
|
256
433
|
return newMutationBranch("updated", { records, ...partialSuccessReasons.length ? { partialSuccessReasons } : {} }, this.client.receipt(call, objectId));
|
|
257
434
|
} catch (error) {
|
|
@@ -466,6 +643,14 @@ var AirtableClient = class {
|
|
|
466
643
|
upsertRecords() {
|
|
467
644
|
return new UpsertRecordsOperation(this);
|
|
468
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
|
+
}
|
|
469
654
|
/** Bind the update mutation. */
|
|
470
655
|
updateRecords() {
|
|
471
656
|
return new UpdateRecordsOperation(this);
|
|
@@ -481,19 +666,19 @@ var AirtableClient = class {
|
|
|
481
666
|
};
|
|
482
667
|
}
|
|
483
668
|
/** Resolve credentials, pace one base, send a bounded request, and classify non-2xx responses. */
|
|
484
|
-
async exchange(call, operation, baseId, objectId, method, path, body) {
|
|
669
|
+
async exchange(call, operation, baseId, objectId, method, path, body, signal = call.context.cancellationSignal) {
|
|
485
670
|
const slot = this.reserveRequestSlot(baseId);
|
|
486
671
|
if (slot > 2e3) return { outcome: this.failure("retry", operation, "RATE_LIMIT", "Airtable requests to this base are paced to its rate limit", {}, slot) };
|
|
487
672
|
if (slot > 0) {
|
|
488
673
|
try {
|
|
489
|
-
await waitForSlot(slot,
|
|
674
|
+
await waitForSlot(slot, signal);
|
|
490
675
|
} catch {
|
|
491
676
|
return { outcome: this.failure("retry", operation, "AVAILABILITY", "the Step ended while waiting for an Airtable request slot") };
|
|
492
677
|
}
|
|
493
678
|
}
|
|
494
679
|
let credentials;
|
|
495
680
|
try {
|
|
496
|
-
credentials = await this.credentials.resolve(call,
|
|
681
|
+
credentials = await this.credentials.resolve(call, signal);
|
|
497
682
|
} catch (error) {
|
|
498
683
|
if (error instanceof ReauthorizationRequiredError) return { outcome: this.failure("rejected", operation, "AUTHENTICATION", "the Airtable connection must be authorized again") };
|
|
499
684
|
if (isTerminalCredentialError(error)) return { outcome: this.failure("defect", operation, "AUTHENTICATION", "Airtable connection credentials are unavailable") };
|
|
@@ -518,14 +703,14 @@ var AirtableClient = class {
|
|
|
518
703
|
maxResponseBytes: this.maxResponseBytes,
|
|
519
704
|
addressPolicy: this.endpoint === defaultEndpoint ? "publicHTTPS" : "privateNetworkHTTP",
|
|
520
705
|
timeoutMs: requestTimeoutMs,
|
|
521
|
-
signal
|
|
706
|
+
signal
|
|
522
707
|
});
|
|
523
708
|
} catch (error) {
|
|
524
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 } : {} } };
|
|
525
|
-
return { outcome: this.failure("retry", operation, "TRANSPORT", "Airtable did not return a complete response", receipt) };
|
|
710
|
+
return { outcome: this.failure("retry", operation, "TRANSPORT", "Airtable did not return a complete response", error instanceof ProviderTransportError && error.isProvablyNotSent ? {} : receipt) };
|
|
526
711
|
}
|
|
527
712
|
if (response.status >= 200 && response.status < 300) return { response };
|
|
528
|
-
return { outcome: { ...this.classifyResponse(operation, baseId, response, receipt), status: response.status } };
|
|
713
|
+
return { outcome: { ...this.classifyResponse(operation, baseId, response, receipt), status: response.status, hasProviderError: Boolean(readErrorType(response.body)) } };
|
|
529
714
|
}
|
|
530
715
|
reserveRequestSlot(baseId) {
|
|
531
716
|
const now = this.now().getTime();
|
|
@@ -1315,7 +1500,27 @@ export {
|
|
|
1315
1500
|
ConfigSchema,
|
|
1316
1501
|
Connection,
|
|
1317
1502
|
ConnectorID,
|
|
1503
|
+
CreateRecordBranch,
|
|
1504
|
+
CreateRecordBranchCreated,
|
|
1505
|
+
CreateRecordBranchDefect,
|
|
1506
|
+
CreateRecordBranchProviderRejected,
|
|
1507
|
+
CreateRecordBranchUncertain,
|
|
1508
|
+
CreateRecordDefinition,
|
|
1509
|
+
CreateRecordInputSchema,
|
|
1510
|
+
CreateRecordMetadata,
|
|
1511
|
+
CreateRecordOperation,
|
|
1318
1512
|
CredentialMaterialError,
|
|
1513
|
+
DeleteRecordBranch,
|
|
1514
|
+
DeleteRecordBranchAlreadyAbsent,
|
|
1515
|
+
DeleteRecordBranchDefect,
|
|
1516
|
+
DeleteRecordBranchDeleted,
|
|
1517
|
+
DeleteRecordBranchInvalidResponse,
|
|
1518
|
+
DeleteRecordBranchProviderRejected,
|
|
1519
|
+
DeleteRecordDefinition,
|
|
1520
|
+
DeleteRecordInputSchema,
|
|
1521
|
+
DeleteRecordMetadata,
|
|
1522
|
+
DeleteRecordOperation,
|
|
1523
|
+
DeletedRecordSchema,
|
|
1319
1524
|
FieldEqualityFilterSchema,
|
|
1320
1525
|
GetRecordBranch,
|
|
1321
1526
|
GetRecordBranchDefect,
|
|
@@ -1385,6 +1590,8 @@ export {
|
|
|
1385
1590
|
isCredentialMaterialError,
|
|
1386
1591
|
newConnection,
|
|
1387
1592
|
newConnectionWithOperations,
|
|
1593
|
+
newCreateRecordStep,
|
|
1594
|
+
newDeleteRecordStep,
|
|
1388
1595
|
newGetRecordStep,
|
|
1389
1596
|
newListRecordsStep,
|
|
1390
1597
|
newProjectConnection2 as newProjectConnection,
|
package/dist/mock.d.ts
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MockMutation, MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
2
|
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
-
import { O as Operations,
|
|
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 };
|
package/dist/mock.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectorID,
|
|
3
|
+
CreateRecordDefinition,
|
|
4
|
+
CreateRecordInputSchema,
|
|
5
|
+
DeleteRecordDefinition,
|
|
6
|
+
DeleteRecordInputSchema,
|
|
7
|
+
DeletedRecordSchema,
|
|
3
8
|
FieldEqualityFilterSchema,
|
|
4
9
|
GetRecordDefinition,
|
|
5
10
|
GetRecordInputSchema,
|
|
@@ -18,10 +23,28 @@ import {
|
|
|
18
23
|
UpsertRecordsInputSchema,
|
|
19
24
|
UpsertedRecordsSchema,
|
|
20
25
|
newConnectionWithOperations
|
|
21
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-JBLBIUXW.js";
|
|
22
27
|
|
|
23
28
|
// src/generated/mock.ts
|
|
24
|
-
import { branchCase, retryCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
29
|
+
import { branchCase, retryCase, uncertainCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
30
|
+
var emptyCreateRecordInput = CreateRecordInputSchema.parse({
|
|
31
|
+
"baseId": "",
|
|
32
|
+
"tableIdOrName": "",
|
|
33
|
+
"fields": {}
|
|
34
|
+
});
|
|
35
|
+
var emptyRecord = RecordSchema.parse({
|
|
36
|
+
"id": "",
|
|
37
|
+
"createdTime": "0001-01-01T00:00:00Z",
|
|
38
|
+
"fields": {}
|
|
39
|
+
});
|
|
40
|
+
var emptyDeleteRecordInput = DeleteRecordInputSchema.parse({
|
|
41
|
+
"baseId": "",
|
|
42
|
+
"tableIdOrName": "",
|
|
43
|
+
"recordId": ""
|
|
44
|
+
});
|
|
45
|
+
var emptyDeletedRecord = DeletedRecordSchema.parse({
|
|
46
|
+
"recordId": ""
|
|
47
|
+
});
|
|
25
48
|
var emptyFieldEqualityFilter = FieldEqualityFilterSchema.parse({
|
|
26
49
|
"field": ""
|
|
27
50
|
});
|
|
@@ -32,11 +55,6 @@ var emptyListRecordsInput = ListRecordsInputSchema.parse({
|
|
|
32
55
|
"baseId": "",
|
|
33
56
|
"tableIdOrName": ""
|
|
34
57
|
});
|
|
35
|
-
var emptyRecord = RecordSchema.parse({
|
|
36
|
-
"id": "",
|
|
37
|
-
"createdTime": "0001-01-01T00:00:00Z",
|
|
38
|
-
"fields": {}
|
|
39
|
-
});
|
|
40
58
|
var emptyRecordPage = RecordPageSchema.parse({
|
|
41
59
|
"records": []
|
|
42
60
|
});
|
|
@@ -71,6 +89,61 @@ var emptyUpdateRecordsInput = UpdateRecordsInputSchema.parse({
|
|
|
71
89
|
var emptyUpdatedRecords = UpdatedRecordsSchema.parse({
|
|
72
90
|
"records": []
|
|
73
91
|
});
|
|
92
|
+
function createRecordCreated(value, failure) {
|
|
93
|
+
return branchCase("created", value, failure);
|
|
94
|
+
}
|
|
95
|
+
function createRecordProviderRejected(value, failure) {
|
|
96
|
+
return branchCase("providerRejected", value, failure);
|
|
97
|
+
}
|
|
98
|
+
function createRecordDefect(value, failure) {
|
|
99
|
+
return branchCase("defect", value, failure);
|
|
100
|
+
}
|
|
101
|
+
function createRecordRetry(failure, retryAfterMs = 0) {
|
|
102
|
+
return retryCase(failure, retryAfterMs);
|
|
103
|
+
}
|
|
104
|
+
function createRecordUncertain(value, failure) {
|
|
105
|
+
return uncertainCase(value, failure);
|
|
106
|
+
}
|
|
107
|
+
function createRecordCreatedReviewRecord() {
|
|
108
|
+
const value = RecordSchema.parse({ "createdTime": "2026-11-16T09:00:00Z", "fields": { "Case ID": "case-created" }, "id": "recReviewCreated1" });
|
|
109
|
+
return branchCase("created", value);
|
|
110
|
+
}
|
|
111
|
+
function createRecordDefault() {
|
|
112
|
+
return createRecordCreatedReviewRecord();
|
|
113
|
+
}
|
|
114
|
+
function createRecordCreateDenied() {
|
|
115
|
+
const value = emptyRecord;
|
|
116
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "createRecord", message: "Airtable denied the record create." });
|
|
117
|
+
}
|
|
118
|
+
function deleteRecordDeleted(value, failure) {
|
|
119
|
+
return branchCase("deleted", value, failure);
|
|
120
|
+
}
|
|
121
|
+
function deleteRecordAlreadyAbsent(value, failure) {
|
|
122
|
+
return branchCase("alreadyAbsent", value, failure);
|
|
123
|
+
}
|
|
124
|
+
function deleteRecordProviderRejected(value, failure) {
|
|
125
|
+
return branchCase("providerRejected", value, failure);
|
|
126
|
+
}
|
|
127
|
+
function deleteRecordInvalidResponse(value, failure) {
|
|
128
|
+
return branchCase("invalidResponse", value, failure);
|
|
129
|
+
}
|
|
130
|
+
function deleteRecordDefect(value, failure) {
|
|
131
|
+
return branchCase("defect", value, failure);
|
|
132
|
+
}
|
|
133
|
+
function deleteRecordRetry(failure, retryAfterMs = 0) {
|
|
134
|
+
return retryCase(failure, retryAfterMs);
|
|
135
|
+
}
|
|
136
|
+
function deleteRecordDeletedReviewRecord() {
|
|
137
|
+
const value = DeletedRecordSchema.parse({ "recordId": "recReviewCreated1" });
|
|
138
|
+
return branchCase("deleted", value);
|
|
139
|
+
}
|
|
140
|
+
function deleteRecordDefault() {
|
|
141
|
+
return deleteRecordDeletedReviewRecord();
|
|
142
|
+
}
|
|
143
|
+
function deleteRecordMissingReviewRecord() {
|
|
144
|
+
const value = emptyDeletedRecord;
|
|
145
|
+
return branchCase("alreadyAbsent", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "deleteRecord", message: "Airtable found no such record." });
|
|
146
|
+
}
|
|
74
147
|
function listRecordsListed(value, failure) {
|
|
75
148
|
return branchCase("listed", value, failure);
|
|
76
149
|
}
|
|
@@ -197,12 +270,16 @@ function updateRecordsPolicyStampDenied() {
|
|
|
197
270
|
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "updateRecords", message: "Airtable denied the policy update." });
|
|
198
271
|
}
|
|
199
272
|
var GeneratedMock = class {
|
|
273
|
+
#createRecord;
|
|
274
|
+
#deleteRecord;
|
|
200
275
|
#listRecords;
|
|
201
276
|
#getRecord;
|
|
202
277
|
#upsertRecords;
|
|
203
278
|
#updateRecords;
|
|
204
279
|
#connection;
|
|
205
280
|
constructor(connectionName) {
|
|
281
|
+
this.#createRecord = newMutation(CreateRecordDefinition).default(createRecordDefault());
|
|
282
|
+
this.#deleteRecord = newMutation(DeleteRecordDefinition).default(deleteRecordDefault());
|
|
206
283
|
this.#listRecords = newQuery(ListRecordsDefinition).default(listRecordsDefault());
|
|
207
284
|
this.#getRecord = newQuery(GetRecordDefinition).default(getRecordDefault());
|
|
208
285
|
this.#upsertRecords = newMutation(UpsertRecordsDefinition).default(upsertRecordsDefault());
|
|
@@ -212,6 +289,12 @@ var GeneratedMock = class {
|
|
|
212
289
|
connection() {
|
|
213
290
|
return this.#connection;
|
|
214
291
|
}
|
|
292
|
+
createRecord() {
|
|
293
|
+
return this.#createRecord;
|
|
294
|
+
}
|
|
295
|
+
deleteRecord() {
|
|
296
|
+
return this.#deleteRecord;
|
|
297
|
+
}
|
|
215
298
|
listRecords() {
|
|
216
299
|
return this.#listRecords;
|
|
217
300
|
}
|
|
@@ -225,6 +308,8 @@ var GeneratedMock = class {
|
|
|
225
308
|
return this.#updateRecords;
|
|
226
309
|
}
|
|
227
310
|
assertNoFailures() {
|
|
311
|
+
this.#createRecord.assertNoFailures();
|
|
312
|
+
this.#deleteRecord.assertNoFailures();
|
|
228
313
|
this.#listRecords.assertNoFailures();
|
|
229
314
|
this.#getRecord.assertNoFailures();
|
|
230
315
|
this.#upsertRecords.assertNoFailures();
|
|
@@ -233,6 +318,26 @@ var GeneratedMock = class {
|
|
|
233
318
|
};
|
|
234
319
|
export {
|
|
235
320
|
GeneratedMock,
|
|
321
|
+
createRecordCreateDenied,
|
|
322
|
+
createRecordCreated,
|
|
323
|
+
createRecordCreatedReviewRecord,
|
|
324
|
+
createRecordDefault,
|
|
325
|
+
createRecordDefect,
|
|
326
|
+
createRecordProviderRejected,
|
|
327
|
+
createRecordRetry,
|
|
328
|
+
createRecordUncertain,
|
|
329
|
+
deleteRecordAlreadyAbsent,
|
|
330
|
+
deleteRecordDefault,
|
|
331
|
+
deleteRecordDefect,
|
|
332
|
+
deleteRecordDeleted,
|
|
333
|
+
deleteRecordDeletedReviewRecord,
|
|
334
|
+
deleteRecordInvalidResponse,
|
|
335
|
+
deleteRecordMissingReviewRecord,
|
|
336
|
+
deleteRecordProviderRejected,
|
|
337
|
+
deleteRecordRetry,
|
|
338
|
+
emptyCreateRecordInput,
|
|
339
|
+
emptyDeleteRecordInput,
|
|
340
|
+
emptyDeletedRecord,
|
|
236
341
|
emptyFieldEqualityFilter,
|
|
237
342
|
emptyGetRecordInput,
|
|
238
343
|
emptyListRecordsInput,
|