@superdurable/connector-coda 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -3
- package/dex-connector.json +351 -4
- package/dist/chunk-KSTUDMMZ.js +373 -0
- package/dist/connection-CYkN7IqB.d.ts +260 -0
- package/dist/index.d.ts +309 -7
- package/dist/index.js +376 -17
- package/dist/mock.d.ts +107 -2
- package/dist/mock.js +259 -2
- package/package.json +3 -2
- package/dist/chunk-ZY4WUCOW.js +0 -132
- package/dist/connection-Bh8uZ-8W.d.ts +0 -99
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var ConfigSchema = z.object({
|
|
5
|
+
"baseUrl": z.string().optional(),
|
|
6
|
+
"timeoutMs": z.number().int().optional(),
|
|
7
|
+
"maxResponseBytes": z.number().int().optional()
|
|
8
|
+
});
|
|
9
|
+
var CredentialMaterialError = class extends TypeError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "CredentialMaterialError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
16
|
+
"project credential decoding failed",
|
|
17
|
+
"shared project credential decoding failed",
|
|
18
|
+
"project credential decoding failed: this connector version does not support shared credentials"
|
|
19
|
+
]);
|
|
20
|
+
function isCredentialMaterialError(error) {
|
|
21
|
+
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
22
|
+
}
|
|
23
|
+
function decodeCredentials(value) {
|
|
24
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
25
|
+
const fields = value;
|
|
26
|
+
const allowed = /* @__PURE__ */ new Set(["api_token"]);
|
|
27
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
28
|
+
if (fields["api_token"] != null && !(typeof fields["api_token"] === "string")) throw new CredentialMaterialError("credential api_token has an invalid type");
|
|
29
|
+
const credentials = {};
|
|
30
|
+
if (!fields["api_token"]) throw new CredentialMaterialError("credential api_token is required");
|
|
31
|
+
credentials.apiToken = new SecretString(fields["api_token"] ?? "");
|
|
32
|
+
return credentials;
|
|
33
|
+
}
|
|
34
|
+
var ListRowsInputSchema = z.strictObject({
|
|
35
|
+
"docId": z.string(),
|
|
36
|
+
"tableId": z.string(),
|
|
37
|
+
"limit": z.number().int().optional(),
|
|
38
|
+
"pageToken": z.string().optional()
|
|
39
|
+
});
|
|
40
|
+
var ListRowsOutputSchema = z.strictObject({
|
|
41
|
+
"data": z.unknown().nullable()
|
|
42
|
+
});
|
|
43
|
+
var GetRowInputSchema = z.strictObject({
|
|
44
|
+
"docId": z.string(),
|
|
45
|
+
"tableId": z.string(),
|
|
46
|
+
"rowId": z.string()
|
|
47
|
+
});
|
|
48
|
+
var GetRowOutputSchema = z.strictObject({
|
|
49
|
+
"data": z.unknown().nullable()
|
|
50
|
+
});
|
|
51
|
+
var ListDocsInputSchema = z.strictObject({
|
|
52
|
+
"limit": z.number().int().optional(),
|
|
53
|
+
"pageToken": z.string().optional()
|
|
54
|
+
});
|
|
55
|
+
var DocSchema = z.strictObject({
|
|
56
|
+
"id": z.string(),
|
|
57
|
+
"name": z.string()
|
|
58
|
+
});
|
|
59
|
+
var DocsPageSchema = z.strictObject({
|
|
60
|
+
"items": z.array(DocSchema).nullable(),
|
|
61
|
+
"nextPageToken": z.string()
|
|
62
|
+
});
|
|
63
|
+
var GetDocInputSchema = z.strictObject({
|
|
64
|
+
"docId": z.string()
|
|
65
|
+
});
|
|
66
|
+
var ListTablesInputSchema = z.strictObject({
|
|
67
|
+
"docId": z.string(),
|
|
68
|
+
"limit": z.number().int().optional(),
|
|
69
|
+
"pageToken": z.string().optional()
|
|
70
|
+
});
|
|
71
|
+
var TableSchema = z.strictObject({
|
|
72
|
+
"id": z.string(),
|
|
73
|
+
"name": z.string()
|
|
74
|
+
});
|
|
75
|
+
var TablesPageSchema = z.strictObject({
|
|
76
|
+
"items": z.array(TableSchema).nullable(),
|
|
77
|
+
"nextPageToken": z.string()
|
|
78
|
+
});
|
|
79
|
+
var GetTableInputSchema = z.strictObject({
|
|
80
|
+
"docId": z.string(),
|
|
81
|
+
"tableId": z.string()
|
|
82
|
+
});
|
|
83
|
+
var ListColumnsInputSchema = z.strictObject({
|
|
84
|
+
"docId": z.string(),
|
|
85
|
+
"tableId": z.string(),
|
|
86
|
+
"limit": z.number().int().optional(),
|
|
87
|
+
"pageToken": z.string().optional()
|
|
88
|
+
});
|
|
89
|
+
var ColumnSchema = z.strictObject({
|
|
90
|
+
"id": z.string(),
|
|
91
|
+
"name": z.string()
|
|
92
|
+
});
|
|
93
|
+
var ColumnsPageSchema = z.strictObject({
|
|
94
|
+
"items": z.array(ColumnSchema).nullable(),
|
|
95
|
+
"nextPageToken": z.string()
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// src/generated/definitions.ts
|
|
99
|
+
var ConnectorID = "coda";
|
|
100
|
+
var ProviderID = "coda";
|
|
101
|
+
var ListRowsBranch = {
|
|
102
|
+
Listed: "listed",
|
|
103
|
+
ProviderRejected: "providerRejected",
|
|
104
|
+
InvalidResponse: "invalidResponse",
|
|
105
|
+
Defect: "defect"
|
|
106
|
+
};
|
|
107
|
+
var ListRowsBranchListed = ListRowsBranch.Listed;
|
|
108
|
+
var ListRowsBranchProviderRejected = ListRowsBranch.ProviderRejected;
|
|
109
|
+
var ListRowsBranchInvalidResponse = ListRowsBranch.InvalidResponse;
|
|
110
|
+
var ListRowsBranchDefect = ListRowsBranch.Defect;
|
|
111
|
+
var ListRowsDefinition = {
|
|
112
|
+
operation: { connectorId: ConnectorID, operationId: "listRows" },
|
|
113
|
+
branches: [
|
|
114
|
+
{ id: "listed", description: "List one page of rows in a Coda table." },
|
|
115
|
+
{ id: "providerRejected", description: "The provider conclusively rejected the request or credentials.", optional: true },
|
|
116
|
+
{ id: "invalidResponse", description: "The provider returned malformed or oversized JSON.", optional: true },
|
|
117
|
+
{ id: "defect", description: "Local input, configuration, or credentials are invalid.", optional: true }
|
|
118
|
+
],
|
|
119
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
120
|
+
};
|
|
121
|
+
var ListRowsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
122
|
+
var GetRowBranch = {
|
|
123
|
+
Found: "found",
|
|
124
|
+
NotFound: "notFound",
|
|
125
|
+
ProviderRejected: "providerRejected",
|
|
126
|
+
InvalidResponse: "invalidResponse",
|
|
127
|
+
Defect: "defect"
|
|
128
|
+
};
|
|
129
|
+
var GetRowBranchFound = GetRowBranch.Found;
|
|
130
|
+
var GetRowBranchNotFound = GetRowBranch.NotFound;
|
|
131
|
+
var GetRowBranchProviderRejected = GetRowBranch.ProviderRejected;
|
|
132
|
+
var GetRowBranchInvalidResponse = GetRowBranch.InvalidResponse;
|
|
133
|
+
var GetRowBranchDefect = GetRowBranch.Defect;
|
|
134
|
+
var GetRowDefinition = {
|
|
135
|
+
operation: { connectorId: ConnectorID, operationId: "getRow" },
|
|
136
|
+
branches: [
|
|
137
|
+
{ id: "found", description: "Get one row in a Coda table." },
|
|
138
|
+
{ id: "notFound", description: "The requested provider resource does not exist or is not visible.", optional: true },
|
|
139
|
+
{ id: "providerRejected", description: "The provider conclusively rejected the request or credentials.", optional: true },
|
|
140
|
+
{ id: "invalidResponse", description: "The provider returned malformed or oversized JSON.", optional: true },
|
|
141
|
+
{ id: "defect", description: "Local input, configuration, or credentials are invalid.", optional: true }
|
|
142
|
+
],
|
|
143
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
144
|
+
};
|
|
145
|
+
var GetRowMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
146
|
+
var ListDocsBranch = {
|
|
147
|
+
Listed: "listed",
|
|
148
|
+
ProviderRejected: "providerRejected",
|
|
149
|
+
InvalidResponse: "invalidResponse",
|
|
150
|
+
Defect: "defect"
|
|
151
|
+
};
|
|
152
|
+
var ListDocsBranchListed = ListDocsBranch.Listed;
|
|
153
|
+
var ListDocsBranchProviderRejected = ListDocsBranch.ProviderRejected;
|
|
154
|
+
var ListDocsBranchInvalidResponse = ListDocsBranch.InvalidResponse;
|
|
155
|
+
var ListDocsBranchDefect = ListDocsBranch.Defect;
|
|
156
|
+
var ListDocsDefinition = {
|
|
157
|
+
operation: { connectorId: ConnectorID, operationId: "listDocs" },
|
|
158
|
+
branches: [
|
|
159
|
+
{ id: "listed", description: "Coda returned the doc page." },
|
|
160
|
+
{ id: "providerRejected", description: "Coda conclusively rejected the read.", optional: true },
|
|
161
|
+
{ id: "invalidResponse", description: "Coda returned malformed or oversized JSON.", optional: true },
|
|
162
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
163
|
+
],
|
|
164
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
165
|
+
};
|
|
166
|
+
var ListDocsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
167
|
+
var GetDocBranch = {
|
|
168
|
+
Found: "found",
|
|
169
|
+
NotFound: "notFound",
|
|
170
|
+
ProviderRejected: "providerRejected",
|
|
171
|
+
InvalidResponse: "invalidResponse",
|
|
172
|
+
Defect: "defect"
|
|
173
|
+
};
|
|
174
|
+
var GetDocBranchFound = GetDocBranch.Found;
|
|
175
|
+
var GetDocBranchNotFound = GetDocBranch.NotFound;
|
|
176
|
+
var GetDocBranchProviderRejected = GetDocBranch.ProviderRejected;
|
|
177
|
+
var GetDocBranchInvalidResponse = GetDocBranch.InvalidResponse;
|
|
178
|
+
var GetDocBranchDefect = GetDocBranch.Defect;
|
|
179
|
+
var GetDocDefinition = {
|
|
180
|
+
operation: { connectorId: ConnectorID, operationId: "getDoc" },
|
|
181
|
+
branches: [
|
|
182
|
+
{ id: "found", description: "Coda returned the doc." },
|
|
183
|
+
{ id: "notFound", description: "The doc does not exist or is inaccessible.", optional: true },
|
|
184
|
+
{ id: "providerRejected", description: "Coda conclusively rejected the read.", optional: true },
|
|
185
|
+
{ id: "invalidResponse", description: "Coda returned malformed or oversized JSON.", optional: true },
|
|
186
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
187
|
+
],
|
|
188
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
189
|
+
};
|
|
190
|
+
var GetDocMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
191
|
+
var ListTablesBranch = {
|
|
192
|
+
Listed: "listed",
|
|
193
|
+
NotFound: "notFound",
|
|
194
|
+
ProviderRejected: "providerRejected",
|
|
195
|
+
InvalidResponse: "invalidResponse",
|
|
196
|
+
Defect: "defect"
|
|
197
|
+
};
|
|
198
|
+
var ListTablesBranchListed = ListTablesBranch.Listed;
|
|
199
|
+
var ListTablesBranchNotFound = ListTablesBranch.NotFound;
|
|
200
|
+
var ListTablesBranchProviderRejected = ListTablesBranch.ProviderRejected;
|
|
201
|
+
var ListTablesBranchInvalidResponse = ListTablesBranch.InvalidResponse;
|
|
202
|
+
var ListTablesBranchDefect = ListTablesBranch.Defect;
|
|
203
|
+
var ListTablesDefinition = {
|
|
204
|
+
operation: { connectorId: ConnectorID, operationId: "listTables" },
|
|
205
|
+
branches: [
|
|
206
|
+
{ id: "listed", description: "Coda returned the table page." },
|
|
207
|
+
{ id: "notFound", description: "The doc does not exist or is inaccessible.", optional: true },
|
|
208
|
+
{ id: "providerRejected", description: "Coda conclusively rejected the read.", optional: true },
|
|
209
|
+
{ id: "invalidResponse", description: "Coda returned malformed or oversized JSON.", optional: true },
|
|
210
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
211
|
+
],
|
|
212
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
213
|
+
};
|
|
214
|
+
var ListTablesMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
215
|
+
var GetTableBranch = {
|
|
216
|
+
Found: "found",
|
|
217
|
+
NotFound: "notFound",
|
|
218
|
+
ProviderRejected: "providerRejected",
|
|
219
|
+
InvalidResponse: "invalidResponse",
|
|
220
|
+
Defect: "defect"
|
|
221
|
+
};
|
|
222
|
+
var GetTableBranchFound = GetTableBranch.Found;
|
|
223
|
+
var GetTableBranchNotFound = GetTableBranch.NotFound;
|
|
224
|
+
var GetTableBranchProviderRejected = GetTableBranch.ProviderRejected;
|
|
225
|
+
var GetTableBranchInvalidResponse = GetTableBranch.InvalidResponse;
|
|
226
|
+
var GetTableBranchDefect = GetTableBranch.Defect;
|
|
227
|
+
var GetTableDefinition = {
|
|
228
|
+
operation: { connectorId: ConnectorID, operationId: "getTable" },
|
|
229
|
+
branches: [
|
|
230
|
+
{ id: "found", description: "Coda returned the table." },
|
|
231
|
+
{ id: "notFound", description: "The table does not exist or is inaccessible.", optional: true },
|
|
232
|
+
{ id: "providerRejected", description: "Coda conclusively rejected the read.", optional: true },
|
|
233
|
+
{ id: "invalidResponse", description: "Coda returned malformed or oversized JSON.", optional: true },
|
|
234
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
235
|
+
],
|
|
236
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
237
|
+
};
|
|
238
|
+
var GetTableMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
239
|
+
var ListColumnsBranch = {
|
|
240
|
+
Listed: "listed",
|
|
241
|
+
NotFound: "notFound",
|
|
242
|
+
ProviderRejected: "providerRejected",
|
|
243
|
+
InvalidResponse: "invalidResponse",
|
|
244
|
+
Defect: "defect"
|
|
245
|
+
};
|
|
246
|
+
var ListColumnsBranchListed = ListColumnsBranch.Listed;
|
|
247
|
+
var ListColumnsBranchNotFound = ListColumnsBranch.NotFound;
|
|
248
|
+
var ListColumnsBranchProviderRejected = ListColumnsBranch.ProviderRejected;
|
|
249
|
+
var ListColumnsBranchInvalidResponse = ListColumnsBranch.InvalidResponse;
|
|
250
|
+
var ListColumnsBranchDefect = ListColumnsBranch.Defect;
|
|
251
|
+
var ListColumnsDefinition = {
|
|
252
|
+
operation: { connectorId: ConnectorID, operationId: "listColumns" },
|
|
253
|
+
branches: [
|
|
254
|
+
{ id: "listed", description: "Coda returned the column page." },
|
|
255
|
+
{ id: "notFound", description: "The table does not exist or is inaccessible.", optional: true },
|
|
256
|
+
{ id: "providerRejected", description: "Coda conclusively rejected the read.", optional: true },
|
|
257
|
+
{ id: "invalidResponse", description: "Coda returned malformed or oversized JSON.", optional: true },
|
|
258
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
259
|
+
],
|
|
260
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
261
|
+
};
|
|
262
|
+
var ListColumnsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
263
|
+
|
|
264
|
+
// src/generated/connection.ts
|
|
265
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
266
|
+
var Connection = class {
|
|
267
|
+
/** Stable provider and connection name. */
|
|
268
|
+
reference;
|
|
269
|
+
/** Bound provider operations. */
|
|
270
|
+
operations;
|
|
271
|
+
/** Validate a reference and bind operations. */
|
|
272
|
+
constructor(reference, operations) {
|
|
273
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
274
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
275
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
276
|
+
this.operations = operations;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
function newConnection(client, reference) {
|
|
280
|
+
if (!client) throw new TypeError("connector client is required");
|
|
281
|
+
return new Connection(reference, client);
|
|
282
|
+
}
|
|
283
|
+
function newConnectionWithOperations(operations, reference) {
|
|
284
|
+
return new Connection(reference, operations);
|
|
285
|
+
}
|
|
286
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
287
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
288
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
289
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
290
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
291
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export {
|
|
295
|
+
ConfigSchema,
|
|
296
|
+
CredentialMaterialError,
|
|
297
|
+
isCredentialMaterialError,
|
|
298
|
+
decodeCredentials,
|
|
299
|
+
ListRowsInputSchema,
|
|
300
|
+
ListRowsOutputSchema,
|
|
301
|
+
GetRowInputSchema,
|
|
302
|
+
GetRowOutputSchema,
|
|
303
|
+
ListDocsInputSchema,
|
|
304
|
+
DocSchema,
|
|
305
|
+
DocsPageSchema,
|
|
306
|
+
GetDocInputSchema,
|
|
307
|
+
ListTablesInputSchema,
|
|
308
|
+
TableSchema,
|
|
309
|
+
TablesPageSchema,
|
|
310
|
+
GetTableInputSchema,
|
|
311
|
+
ListColumnsInputSchema,
|
|
312
|
+
ColumnSchema,
|
|
313
|
+
ColumnsPageSchema,
|
|
314
|
+
ConnectorID,
|
|
315
|
+
ProviderID,
|
|
316
|
+
ListRowsBranch,
|
|
317
|
+
ListRowsBranchListed,
|
|
318
|
+
ListRowsBranchProviderRejected,
|
|
319
|
+
ListRowsBranchInvalidResponse,
|
|
320
|
+
ListRowsBranchDefect,
|
|
321
|
+
ListRowsDefinition,
|
|
322
|
+
ListRowsMetadata,
|
|
323
|
+
GetRowBranch,
|
|
324
|
+
GetRowBranchFound,
|
|
325
|
+
GetRowBranchNotFound,
|
|
326
|
+
GetRowBranchProviderRejected,
|
|
327
|
+
GetRowBranchInvalidResponse,
|
|
328
|
+
GetRowBranchDefect,
|
|
329
|
+
GetRowDefinition,
|
|
330
|
+
GetRowMetadata,
|
|
331
|
+
ListDocsBranch,
|
|
332
|
+
ListDocsBranchListed,
|
|
333
|
+
ListDocsBranchProviderRejected,
|
|
334
|
+
ListDocsBranchInvalidResponse,
|
|
335
|
+
ListDocsBranchDefect,
|
|
336
|
+
ListDocsDefinition,
|
|
337
|
+
ListDocsMetadata,
|
|
338
|
+
GetDocBranch,
|
|
339
|
+
GetDocBranchFound,
|
|
340
|
+
GetDocBranchNotFound,
|
|
341
|
+
GetDocBranchProviderRejected,
|
|
342
|
+
GetDocBranchInvalidResponse,
|
|
343
|
+
GetDocBranchDefect,
|
|
344
|
+
GetDocDefinition,
|
|
345
|
+
GetDocMetadata,
|
|
346
|
+
ListTablesBranch,
|
|
347
|
+
ListTablesBranchListed,
|
|
348
|
+
ListTablesBranchNotFound,
|
|
349
|
+
ListTablesBranchProviderRejected,
|
|
350
|
+
ListTablesBranchInvalidResponse,
|
|
351
|
+
ListTablesBranchDefect,
|
|
352
|
+
ListTablesDefinition,
|
|
353
|
+
ListTablesMetadata,
|
|
354
|
+
GetTableBranch,
|
|
355
|
+
GetTableBranchFound,
|
|
356
|
+
GetTableBranchNotFound,
|
|
357
|
+
GetTableBranchProviderRejected,
|
|
358
|
+
GetTableBranchInvalidResponse,
|
|
359
|
+
GetTableBranchDefect,
|
|
360
|
+
GetTableDefinition,
|
|
361
|
+
GetTableMetadata,
|
|
362
|
+
ListColumnsBranch,
|
|
363
|
+
ListColumnsBranchListed,
|
|
364
|
+
ListColumnsBranchNotFound,
|
|
365
|
+
ListColumnsBranchProviderRejected,
|
|
366
|
+
ListColumnsBranchInvalidResponse,
|
|
367
|
+
ListColumnsBranchDefect,
|
|
368
|
+
ListColumnsDefinition,
|
|
369
|
+
ListColumnsMetadata,
|
|
370
|
+
Connection,
|
|
371
|
+
newConnectionWithOperations,
|
|
372
|
+
newProjectConnection
|
|
373
|
+
};
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { SecretString, CredentialProvider, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** Provider REST base URL; leave blank for the displayed public endpoint. Override only for a compatible gateway or loopback test server. */
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
/** Maximum time for one HTTP request as a positive Go duration such as 15s or 1m; blank uses the displayed default. Runtime value in milliseconds. */
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
/** Maximum response body size in bytes; enter a positive integer to raise the safety limit for large pages. Blank uses the displayed default. */
|
|
11
|
+
maxResponseBytes?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Runtime schema for manifest configuration. */
|
|
14
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
15
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
16
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
/** Private connector credentials resolved by the host. */
|
|
20
|
+
interface Credentials {
|
|
21
|
+
/** Secret Coda credential. Start at https://docs.superhuman.com/account and follow the authorization guide to create or find it; paste the token exactly, without Bearer. Blank prevents calls. It is sent only in a request header. */
|
|
22
|
+
apiToken: SecretString;
|
|
23
|
+
}
|
|
24
|
+
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
25
|
+
declare class CredentialMaterialError extends TypeError {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
29
|
+
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
30
|
+
/** Decode private credential fields for the connector. */
|
|
31
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
32
|
+
/** Host-owned source of private connector credentials. */
|
|
33
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
34
|
+
/** ListRowsInput selects a Coda table page. */
|
|
35
|
+
interface ListRowsInput {
|
|
36
|
+
/** DocID is the ID from the document URL. */
|
|
37
|
+
"docId": string;
|
|
38
|
+
/** TableID is the stable table ID, such as grid-abc. */
|
|
39
|
+
"tableId": string;
|
|
40
|
+
/** Limit caps rows at 500; zero uses Coda's default. */
|
|
41
|
+
"limit"?: number | undefined;
|
|
42
|
+
/** PageToken is the opaque nextPageToken from a prior page. */
|
|
43
|
+
"pageToken"?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** ListRowsOutput preserves the Coda row page. */
|
|
46
|
+
interface ListRowsOutput {
|
|
47
|
+
/** Data contains items and a possible nextPageToken. */
|
|
48
|
+
"data": unknown | null;
|
|
49
|
+
}
|
|
50
|
+
/** GetRowInput selects one Coda row. */
|
|
51
|
+
interface GetRowInput {
|
|
52
|
+
/** DocID is the document ID. */
|
|
53
|
+
"docId": string;
|
|
54
|
+
/** TableID is the stable table ID. */
|
|
55
|
+
"tableId": string;
|
|
56
|
+
/** RowID is the stable row ID, such as i-abc. */
|
|
57
|
+
"rowId": string;
|
|
58
|
+
}
|
|
59
|
+
/** GetRowOutput preserves one Coda row. */
|
|
60
|
+
interface GetRowOutput {
|
|
61
|
+
/** Data is the row JSON object. */
|
|
62
|
+
"data": unknown | null;
|
|
63
|
+
}
|
|
64
|
+
/** ListDocsInput selects one page of accessible documents. */
|
|
65
|
+
interface ListDocsInput {
|
|
66
|
+
/** Limit caps returned docs at 500; zero uses the provider default. */
|
|
67
|
+
"limit"?: number | undefined;
|
|
68
|
+
/** PageToken is the opaque token from a prior page. */
|
|
69
|
+
"pageToken"?: string | undefined;
|
|
70
|
+
}
|
|
71
|
+
/** Doc identifies one Coda document. */
|
|
72
|
+
interface Doc {
|
|
73
|
+
/** ID is the stable document identifier. */
|
|
74
|
+
"id": string;
|
|
75
|
+
/** Name is the document's display name. */
|
|
76
|
+
"name": string;
|
|
77
|
+
}
|
|
78
|
+
/** DocsPage contains one bounded doc page. */
|
|
79
|
+
interface DocsPage {
|
|
80
|
+
/** Items are the returned docs. */
|
|
81
|
+
"items": Array<Doc> | null;
|
|
82
|
+
/** NextPageToken requests the following page; blank means no more pages. */
|
|
83
|
+
"nextPageToken": string;
|
|
84
|
+
}
|
|
85
|
+
/** GetDocInput identifies one accessible document. */
|
|
86
|
+
interface GetDocInput {
|
|
87
|
+
/** DocID is the document identifier from its URL. */
|
|
88
|
+
"docId": string;
|
|
89
|
+
}
|
|
90
|
+
/** ListTablesInput selects one table page within a doc. */
|
|
91
|
+
interface ListTablesInput {
|
|
92
|
+
/** DocID identifies the parent doc. */
|
|
93
|
+
"docId": string;
|
|
94
|
+
/** Limit caps returned tables at 500; zero uses the provider default. */
|
|
95
|
+
"limit"?: number | undefined;
|
|
96
|
+
/** PageToken is the opaque token from a prior page. */
|
|
97
|
+
"pageToken"?: string | undefined;
|
|
98
|
+
}
|
|
99
|
+
/** Table identifies a Coda table or view. */
|
|
100
|
+
interface Table {
|
|
101
|
+
/** ID is the stable table identifier. */
|
|
102
|
+
"id": string;
|
|
103
|
+
/** Name is the table's display name. */
|
|
104
|
+
"name": string;
|
|
105
|
+
}
|
|
106
|
+
/** TablesPage contains one bounded table page. */
|
|
107
|
+
interface TablesPage {
|
|
108
|
+
/** Items are the returned tables and views. */
|
|
109
|
+
"items": Array<Table> | null;
|
|
110
|
+
/** NextPageToken requests the following page; blank means no more pages. */
|
|
111
|
+
"nextPageToken": string;
|
|
112
|
+
}
|
|
113
|
+
/** GetTableInput identifies one table or view. */
|
|
114
|
+
interface GetTableInput {
|
|
115
|
+
/** DocID identifies the parent doc. */
|
|
116
|
+
"docId": string;
|
|
117
|
+
/** TableID identifies the table or view. */
|
|
118
|
+
"tableId": string;
|
|
119
|
+
}
|
|
120
|
+
/** ListColumnsInput selects one column page within a table. */
|
|
121
|
+
interface ListColumnsInput {
|
|
122
|
+
/** DocID identifies the parent doc. */
|
|
123
|
+
"docId": string;
|
|
124
|
+
/** TableID identifies the parent table. */
|
|
125
|
+
"tableId": string;
|
|
126
|
+
/** Limit caps returned columns at 500; zero uses the provider default. */
|
|
127
|
+
"limit"?: number | undefined;
|
|
128
|
+
/** PageToken is the opaque token from a prior page. */
|
|
129
|
+
"pageToken"?: string | undefined;
|
|
130
|
+
}
|
|
131
|
+
/** Column identifies a Coda table column. */
|
|
132
|
+
interface Column {
|
|
133
|
+
/** ID is the stable column identifier. */
|
|
134
|
+
"id": string;
|
|
135
|
+
/** Name is the column's display name. */
|
|
136
|
+
"name": string;
|
|
137
|
+
}
|
|
138
|
+
/** ColumnsPage contains one bounded column page. */
|
|
139
|
+
interface ColumnsPage {
|
|
140
|
+
/** Items are the returned columns. */
|
|
141
|
+
"items": Array<Column> | null;
|
|
142
|
+
/** NextPageToken requests the following page; blank means no more pages. */
|
|
143
|
+
"nextPageToken": string;
|
|
144
|
+
}
|
|
145
|
+
/** Runtime validator for ListRowsInput. */
|
|
146
|
+
declare const ListRowsInputSchema: z.ZodObject<{
|
|
147
|
+
docId: z.ZodString;
|
|
148
|
+
tableId: z.ZodString;
|
|
149
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
/** Runtime validator for ListRowsOutput. */
|
|
153
|
+
declare const ListRowsOutputSchema: z.ZodObject<{
|
|
154
|
+
data: z.ZodNullable<z.ZodUnknown>;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
/** Runtime validator for GetRowInput. */
|
|
157
|
+
declare const GetRowInputSchema: z.ZodObject<{
|
|
158
|
+
docId: z.ZodString;
|
|
159
|
+
tableId: z.ZodString;
|
|
160
|
+
rowId: z.ZodString;
|
|
161
|
+
}, z.core.$strict>;
|
|
162
|
+
/** Runtime validator for GetRowOutput. */
|
|
163
|
+
declare const GetRowOutputSchema: z.ZodObject<{
|
|
164
|
+
data: z.ZodNullable<z.ZodUnknown>;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
/** Runtime validator for ListDocsInput. */
|
|
167
|
+
declare const ListDocsInputSchema: z.ZodObject<{
|
|
168
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
/** Runtime validator for Doc. */
|
|
172
|
+
declare const DocSchema: z.ZodObject<{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
name: z.ZodString;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
/** Runtime validator for DocsPage. */
|
|
177
|
+
declare const DocsPageSchema: z.ZodObject<{
|
|
178
|
+
items: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
179
|
+
id: z.ZodString;
|
|
180
|
+
name: z.ZodString;
|
|
181
|
+
}, z.core.$strict>>>;
|
|
182
|
+
nextPageToken: z.ZodString;
|
|
183
|
+
}, z.core.$strict>;
|
|
184
|
+
/** Runtime validator for GetDocInput. */
|
|
185
|
+
declare const GetDocInputSchema: z.ZodObject<{
|
|
186
|
+
docId: z.ZodString;
|
|
187
|
+
}, z.core.$strict>;
|
|
188
|
+
/** Runtime validator for ListTablesInput. */
|
|
189
|
+
declare const ListTablesInputSchema: z.ZodObject<{
|
|
190
|
+
docId: z.ZodString;
|
|
191
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, z.core.$strict>;
|
|
194
|
+
/** Runtime validator for Table. */
|
|
195
|
+
declare const TableSchema: z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
name: z.ZodString;
|
|
198
|
+
}, z.core.$strict>;
|
|
199
|
+
/** Runtime validator for TablesPage. */
|
|
200
|
+
declare const TablesPageSchema: z.ZodObject<{
|
|
201
|
+
items: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
202
|
+
id: z.ZodString;
|
|
203
|
+
name: z.ZodString;
|
|
204
|
+
}, z.core.$strict>>>;
|
|
205
|
+
nextPageToken: z.ZodString;
|
|
206
|
+
}, z.core.$strict>;
|
|
207
|
+
/** Runtime validator for GetTableInput. */
|
|
208
|
+
declare const GetTableInputSchema: z.ZodObject<{
|
|
209
|
+
docId: z.ZodString;
|
|
210
|
+
tableId: z.ZodString;
|
|
211
|
+
}, z.core.$strict>;
|
|
212
|
+
/** Runtime validator for ListColumnsInput. */
|
|
213
|
+
declare const ListColumnsInputSchema: z.ZodObject<{
|
|
214
|
+
docId: z.ZodString;
|
|
215
|
+
tableId: z.ZodString;
|
|
216
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
218
|
+
}, z.core.$strict>;
|
|
219
|
+
/** Runtime validator for Column. */
|
|
220
|
+
declare const ColumnSchema: z.ZodObject<{
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
name: z.ZodString;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
/** Runtime validator for ColumnsPage. */
|
|
225
|
+
declare const ColumnsPageSchema: z.ZodObject<{
|
|
226
|
+
items: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
name: z.ZodString;
|
|
229
|
+
}, z.core.$strict>>>;
|
|
230
|
+
nextPageToken: z.ZodString;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
|
|
233
|
+
/** Typed operations supplied by a client or mock. */
|
|
234
|
+
interface Operations {
|
|
235
|
+
/** Invoke listRows through this connection. */
|
|
236
|
+
listRows(): Query<ListRowsInput, ListRowsOutput>;
|
|
237
|
+
/** Invoke getRow through this connection. */
|
|
238
|
+
getRow(): Query<GetRowInput, GetRowOutput>;
|
|
239
|
+
/** Invoke listDocs through this connection. */
|
|
240
|
+
listDocs(): Query<ListDocsInput, DocsPage>;
|
|
241
|
+
/** Invoke getDoc through this connection. */
|
|
242
|
+
getDoc(): Query<GetDocInput, Doc>;
|
|
243
|
+
/** Invoke listTables through this connection. */
|
|
244
|
+
listTables(): Query<ListTablesInput, TablesPage>;
|
|
245
|
+
/** Invoke getTable through this connection. */
|
|
246
|
+
getTable(): Query<GetTableInput, Table>;
|
|
247
|
+
/** Invoke listColumns through this connection. */
|
|
248
|
+
listColumns(): Query<ListColumnsInput, ColumnsPage>;
|
|
249
|
+
}
|
|
250
|
+
/** Named connector connection kept outside Flow state. */
|
|
251
|
+
declare class Connection<BoundOperations = Operations> {
|
|
252
|
+
/** Stable provider and connection name. */
|
|
253
|
+
readonly reference: ConnectionRef;
|
|
254
|
+
/** Bound provider operations. */
|
|
255
|
+
readonly operations: BoundOperations;
|
|
256
|
+
/** Validate a reference and bind operations. */
|
|
257
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export { ListRowsInputSchema as A, ListRowsOutputSchema as B, Connection as C, type Doc as D, ListTablesInputSchema as E, TableSchema as F, type GetDocInput as G, TablesPageSchema as H, decodeCredentials as I, isCredentialMaterialError as J, type ListColumnsInput as L, type Operations as O, type Table as T, type GetRowInput as a, type GetRowOutput as b, type GetTableInput as c, type ColumnsPage as d, type ListDocsInput as e, type DocsPage as f, type ListRowsInput as g, type ListRowsOutput as h, type ListTablesInput as i, type TablesPage as j, type Config as k, type Credentials as l, type Column as m, ColumnSchema as n, ColumnsPageSchema as o, ConfigSchema as p, CredentialMaterialError as q, type CredentialSource as r, DocSchema as s, DocsPageSchema as t, GetDocInputSchema as u, GetRowInputSchema as v, GetRowOutputSchema as w, GetTableInputSchema as x, ListColumnsInputSchema as y, ListDocsInputSchema as z };
|