@superdurable/connector-dropbox 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +6 -2
- package/dex-connector.json +290 -0
- package/dist/chunk-SWXGPJ62.js +551 -0
- package/dist/connection-CufXPwNo.d.ts +196 -0
- package/dist/index.d.ts +340 -0
- package/dist/index.js +679 -0
- package/dist/mock.d.ts +117 -0
- package/dist/mock.js +104 -0
- package/package.json +62 -4
|
@@ -0,0 +1,551 @@
|
|
|
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
|
+
"contentBaseUrl": z.string().optional(),
|
|
7
|
+
"timeoutMs": z.number().int().optional(),
|
|
8
|
+
"maxResponseBytes": z.number().int().optional(),
|
|
9
|
+
"maxDownloadBytes": z.number().int().optional(),
|
|
10
|
+
"maxUploadBytes": z.number().int().optional()
|
|
11
|
+
});
|
|
12
|
+
function decodeCredentials(value) {
|
|
13
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
14
|
+
const fields = value;
|
|
15
|
+
const allowed = /* @__PURE__ */ new Set(["access_token", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
16
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
17
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
18
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
|
|
19
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
|
|
20
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
|
|
21
|
+
const credentials = {};
|
|
22
|
+
if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
|
|
23
|
+
credentials.oauthClientId = fields["oauth_client_id"] ?? "";
|
|
24
|
+
if (!fields["oauth_client_secret"]) throw new TypeError("credential oauth_client_secret is required");
|
|
25
|
+
credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"] ?? "");
|
|
26
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
27
|
+
credentials.accessToken = new SecretString(fields["access_token"] ?? "");
|
|
28
|
+
if (!fields["refresh_token"]) throw new TypeError("credential refresh_token is required");
|
|
29
|
+
credentials.refreshToken = new SecretString(fields["refresh_token"] ?? "");
|
|
30
|
+
return credentials;
|
|
31
|
+
}
|
|
32
|
+
function decodeSharedCredentials(value) {
|
|
33
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
34
|
+
const fields = value;
|
|
35
|
+
const allowed = /* @__PURE__ */ new Set(["access_token", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
36
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
37
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
38
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
|
|
39
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
|
|
40
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
|
|
41
|
+
const credentials = {};
|
|
42
|
+
if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
|
|
43
|
+
credentials.oauthClientId = fields["oauth_client_id"] ?? "";
|
|
44
|
+
credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"] ?? "");
|
|
45
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
46
|
+
credentials.accessToken = new SecretString(fields["access_token"] ?? "");
|
|
47
|
+
credentials.refreshToken = new SecretString(fields["refresh_token"] ?? "");
|
|
48
|
+
return credentials;
|
|
49
|
+
}
|
|
50
|
+
var ListFolderInputSchema = z.strictObject({
|
|
51
|
+
"path": z.string().optional(),
|
|
52
|
+
"limit": z.number().int()
|
|
53
|
+
});
|
|
54
|
+
var EntryMetadataSchema = z.strictObject({
|
|
55
|
+
"id": z.string(),
|
|
56
|
+
"name": z.string(),
|
|
57
|
+
"pathDisplay": z.string(),
|
|
58
|
+
"kind": z.string()
|
|
59
|
+
});
|
|
60
|
+
var FolderPageSchema = z.strictObject({
|
|
61
|
+
"entries": z.array(EntryMetadataSchema).nullable(),
|
|
62
|
+
"cursor": z.string(),
|
|
63
|
+
"hasMore": z.boolean()
|
|
64
|
+
});
|
|
65
|
+
var GetMetadataInputSchema = z.strictObject({
|
|
66
|
+
"path": z.string()
|
|
67
|
+
});
|
|
68
|
+
var ContinueFolderInputSchema = z.strictObject({
|
|
69
|
+
"cursor": z.string()
|
|
70
|
+
});
|
|
71
|
+
var DownloadFileInputSchema = z.strictObject({
|
|
72
|
+
"path": z.string()
|
|
73
|
+
});
|
|
74
|
+
var DownloadedFileSchema = z.strictObject({
|
|
75
|
+
"file": EntryMetadataSchema,
|
|
76
|
+
"contentBase64": z.string(),
|
|
77
|
+
"contentBytes": z.number().int()
|
|
78
|
+
});
|
|
79
|
+
var UploadFileInputSchema = z.strictObject({
|
|
80
|
+
"path": z.string(),
|
|
81
|
+
"contentBase64": z.string()
|
|
82
|
+
});
|
|
83
|
+
var UploadedFileSchema = z.strictObject({
|
|
84
|
+
"file": EntryMetadataSchema
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// src/generated/definitions.ts
|
|
88
|
+
var ConnectorID = "dropbox";
|
|
89
|
+
var ProviderID = "dropbox";
|
|
90
|
+
var ListFolderBranch = {
|
|
91
|
+
Listed: "listed",
|
|
92
|
+
NotFound: "notFound",
|
|
93
|
+
ProviderRejected: "providerRejected",
|
|
94
|
+
InvalidResponse: "invalidResponse",
|
|
95
|
+
Defect: "defect"
|
|
96
|
+
};
|
|
97
|
+
var ListFolderBranchListed = ListFolderBranch.Listed;
|
|
98
|
+
var ListFolderBranchNotFound = ListFolderBranch.NotFound;
|
|
99
|
+
var ListFolderBranchProviderRejected = ListFolderBranch.ProviderRejected;
|
|
100
|
+
var ListFolderBranchInvalidResponse = ListFolderBranch.InvalidResponse;
|
|
101
|
+
var ListFolderBranchDefect = ListFolderBranch.Defect;
|
|
102
|
+
var ListFolderDefinition = {
|
|
103
|
+
operation: { connectorId: ConnectorID, operationId: "listFolder" },
|
|
104
|
+
branches: [
|
|
105
|
+
{ id: "listed", description: "Dropbox returned a folder page." },
|
|
106
|
+
{ id: "notFound", description: "Dropbox did not find this folder.", optional: true },
|
|
107
|
+
{ id: "providerRejected", description: "Dropbox conclusively rejected the request.", optional: true },
|
|
108
|
+
{ id: "invalidResponse", description: "Dropbox returned malformed or oversized JSON.", optional: true },
|
|
109
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
110
|
+
],
|
|
111
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
112
|
+
};
|
|
113
|
+
var ListFolderMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
114
|
+
var GetMetadataBranch = {
|
|
115
|
+
Found: "found",
|
|
116
|
+
NotFound: "notFound",
|
|
117
|
+
ProviderRejected: "providerRejected",
|
|
118
|
+
InvalidResponse: "invalidResponse",
|
|
119
|
+
Defect: "defect"
|
|
120
|
+
};
|
|
121
|
+
var GetMetadataBranchFound = GetMetadataBranch.Found;
|
|
122
|
+
var GetMetadataBranchNotFound = GetMetadataBranch.NotFound;
|
|
123
|
+
var GetMetadataBranchProviderRejected = GetMetadataBranch.ProviderRejected;
|
|
124
|
+
var GetMetadataBranchInvalidResponse = GetMetadataBranch.InvalidResponse;
|
|
125
|
+
var GetMetadataBranchDefect = GetMetadataBranch.Defect;
|
|
126
|
+
var GetMetadataDefinition = {
|
|
127
|
+
operation: { connectorId: ConnectorID, operationId: "getMetadata" },
|
|
128
|
+
branches: [
|
|
129
|
+
{ id: "found", description: "Dropbox returned the selected entry." },
|
|
130
|
+
{ id: "notFound", description: "Dropbox did not find this path or ID.", optional: true },
|
|
131
|
+
{ id: "providerRejected", description: "Dropbox conclusively rejected the request.", optional: true },
|
|
132
|
+
{ id: "invalidResponse", description: "Dropbox returned malformed or oversized JSON.", optional: true },
|
|
133
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
134
|
+
],
|
|
135
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
136
|
+
};
|
|
137
|
+
var GetMetadataMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
138
|
+
var ContinueFolderBranch = {
|
|
139
|
+
Listed: "listed",
|
|
140
|
+
CursorExpired: "cursorExpired",
|
|
141
|
+
ProviderRejected: "providerRejected",
|
|
142
|
+
InvalidResponse: "invalidResponse",
|
|
143
|
+
Defect: "defect"
|
|
144
|
+
};
|
|
145
|
+
var ContinueFolderBranchListed = ContinueFolderBranch.Listed;
|
|
146
|
+
var ContinueFolderBranchCursorExpired = ContinueFolderBranch.CursorExpired;
|
|
147
|
+
var ContinueFolderBranchProviderRejected = ContinueFolderBranch.ProviderRejected;
|
|
148
|
+
var ContinueFolderBranchInvalidResponse = ContinueFolderBranch.InvalidResponse;
|
|
149
|
+
var ContinueFolderBranchDefect = ContinueFolderBranch.Defect;
|
|
150
|
+
var ContinueFolderDefinition = {
|
|
151
|
+
operation: { connectorId: ConnectorID, operationId: "continueFolder" },
|
|
152
|
+
branches: [
|
|
153
|
+
{ id: "listed", description: "Dropbox returned another folder page or change set." },
|
|
154
|
+
{ id: "cursorExpired", description: "Dropbox requires a new listFolder call to reset this cursor.", optional: true },
|
|
155
|
+
{ id: "providerRejected", description: "Dropbox conclusively rejected the request.", optional: true },
|
|
156
|
+
{ id: "invalidResponse", description: "Dropbox returned malformed or oversized JSON.", optional: true },
|
|
157
|
+
{ id: "defect", description: "Local cursor or connection credentials are invalid.", optional: true }
|
|
158
|
+
],
|
|
159
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
160
|
+
};
|
|
161
|
+
var ContinueFolderMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
162
|
+
var DownloadFileBranch = {
|
|
163
|
+
Downloaded: "downloaded",
|
|
164
|
+
NotFound: "notFound",
|
|
165
|
+
TooLarge: "tooLarge",
|
|
166
|
+
ProviderRejected: "providerRejected",
|
|
167
|
+
InvalidResponse: "invalidResponse",
|
|
168
|
+
Defect: "defect"
|
|
169
|
+
};
|
|
170
|
+
var DownloadFileBranchDownloaded = DownloadFileBranch.Downloaded;
|
|
171
|
+
var DownloadFileBranchNotFound = DownloadFileBranch.NotFound;
|
|
172
|
+
var DownloadFileBranchTooLarge = DownloadFileBranch.TooLarge;
|
|
173
|
+
var DownloadFileBranchProviderRejected = DownloadFileBranch.ProviderRejected;
|
|
174
|
+
var DownloadFileBranchInvalidResponse = DownloadFileBranch.InvalidResponse;
|
|
175
|
+
var DownloadFileBranchDefect = DownloadFileBranch.Defect;
|
|
176
|
+
var DownloadFileDefinition = {
|
|
177
|
+
operation: { connectorId: ConnectorID, operationId: "downloadFile" },
|
|
178
|
+
branches: [
|
|
179
|
+
{ id: "downloaded", description: "Dropbox returned the selected file content." },
|
|
180
|
+
{ id: "notFound", description: "Dropbox did not find this file.", optional: true },
|
|
181
|
+
{ id: "tooLarge", description: "The file exceeds the configured download limit.", optional: true },
|
|
182
|
+
{ id: "providerRejected", description: "Dropbox conclusively rejected the request.", optional: true },
|
|
183
|
+
{ id: "invalidResponse", description: "Dropbox returned missing or malformed file metadata.", optional: true },
|
|
184
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
185
|
+
],
|
|
186
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
187
|
+
};
|
|
188
|
+
var DownloadFileMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
189
|
+
var UploadFileBranch = {
|
|
190
|
+
Uploaded: "uploaded",
|
|
191
|
+
ProviderRejected: "providerRejected",
|
|
192
|
+
InvalidResponse: "invalidResponse",
|
|
193
|
+
Defect: "defect"
|
|
194
|
+
};
|
|
195
|
+
var UploadFileBranchUploaded = UploadFileBranch.Uploaded;
|
|
196
|
+
var UploadFileBranchProviderRejected = UploadFileBranch.ProviderRejected;
|
|
197
|
+
var UploadFileBranchInvalidResponse = UploadFileBranch.InvalidResponse;
|
|
198
|
+
var UploadFileBranchDefect = UploadFileBranch.Defect;
|
|
199
|
+
var UploadFileDefinition = {
|
|
200
|
+
operation: { connectorId: ConnectorID, operationId: "uploadFile" },
|
|
201
|
+
branches: [
|
|
202
|
+
{ id: "uploaded", description: "Dropbox stored the replacement file content." },
|
|
203
|
+
{ id: "providerRejected", description: "Dropbox conclusively rejected the upload.", optional: true },
|
|
204
|
+
{ id: "invalidResponse", description: "Dropbox returned malformed or oversized upload metadata.", optional: true },
|
|
205
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
206
|
+
],
|
|
207
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
208
|
+
};
|
|
209
|
+
var UploadFileMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
210
|
+
|
|
211
|
+
// src/generated/connection.ts
|
|
212
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
213
|
+
import { newRefreshingCredentialProvider } from "@superdurable/connectors-sdk/projectconfig";
|
|
214
|
+
var Connection = class {
|
|
215
|
+
/** Stable provider and connection name. */
|
|
216
|
+
reference;
|
|
217
|
+
/** Bound provider operations. */
|
|
218
|
+
operations;
|
|
219
|
+
/** Validate a reference and bind operations. */
|
|
220
|
+
constructor(reference, operations) {
|
|
221
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
222
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
223
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
224
|
+
this.operations = operations;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
function newConnection(client, reference) {
|
|
228
|
+
if (!client) throw new TypeError("connector client is required");
|
|
229
|
+
return new Connection(reference, client);
|
|
230
|
+
}
|
|
231
|
+
function newConnectionWithOperations(operations, reference) {
|
|
232
|
+
return new Connection(reference, operations);
|
|
233
|
+
}
|
|
234
|
+
function newProjectCredentialProvider(project, connectionName, decode, encode, decodeShared) {
|
|
235
|
+
return newRefreshingCredentialProvider(project.connections, { connectorId: ConnectorID, connectionName }, decode, encode, decodeShared);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/generated/mock.ts
|
|
239
|
+
import { branchCase, retryCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
240
|
+
var emptyListFolderInput = ListFolderInputSchema.parse({
|
|
241
|
+
"limit": 0
|
|
242
|
+
});
|
|
243
|
+
var emptyEntryMetadata = EntryMetadataSchema.parse({
|
|
244
|
+
"id": "",
|
|
245
|
+
"name": "",
|
|
246
|
+
"pathDisplay": "",
|
|
247
|
+
"kind": ""
|
|
248
|
+
});
|
|
249
|
+
var emptyFolderPage = FolderPageSchema.parse({
|
|
250
|
+
"entries": [],
|
|
251
|
+
"cursor": "",
|
|
252
|
+
"hasMore": false
|
|
253
|
+
});
|
|
254
|
+
var emptyGetMetadataInput = GetMetadataInputSchema.parse({
|
|
255
|
+
"path": ""
|
|
256
|
+
});
|
|
257
|
+
var emptyContinueFolderInput = ContinueFolderInputSchema.parse({
|
|
258
|
+
"cursor": ""
|
|
259
|
+
});
|
|
260
|
+
var emptyDownloadFileInput = DownloadFileInputSchema.parse({
|
|
261
|
+
"path": ""
|
|
262
|
+
});
|
|
263
|
+
var emptyDownloadedFile = DownloadedFileSchema.parse({
|
|
264
|
+
"file": emptyEntryMetadata,
|
|
265
|
+
"contentBase64": "",
|
|
266
|
+
"contentBytes": 0
|
|
267
|
+
});
|
|
268
|
+
var emptyUploadFileInput = UploadFileInputSchema.parse({
|
|
269
|
+
"path": "",
|
|
270
|
+
"contentBase64": ""
|
|
271
|
+
});
|
|
272
|
+
var emptyUploadedFile = UploadedFileSchema.parse({
|
|
273
|
+
"file": emptyEntryMetadata
|
|
274
|
+
});
|
|
275
|
+
function listFolderListed(value, failure) {
|
|
276
|
+
return branchCase("listed", value, failure);
|
|
277
|
+
}
|
|
278
|
+
function listFolderNotFound(value, failure) {
|
|
279
|
+
return branchCase("notFound", value, failure);
|
|
280
|
+
}
|
|
281
|
+
function listFolderProviderRejected(value, failure) {
|
|
282
|
+
return branchCase("providerRejected", value, failure);
|
|
283
|
+
}
|
|
284
|
+
function listFolderInvalidResponse(value, failure) {
|
|
285
|
+
return branchCase("invalidResponse", value, failure);
|
|
286
|
+
}
|
|
287
|
+
function listFolderDefect(value, failure) {
|
|
288
|
+
return branchCase("defect", value, failure);
|
|
289
|
+
}
|
|
290
|
+
function listFolderRetry(failure, retryAfterMs = 0) {
|
|
291
|
+
return retryCase(failure, retryAfterMs);
|
|
292
|
+
}
|
|
293
|
+
function listFolderListedDefault() {
|
|
294
|
+
const value = FolderPageSchema.parse({ "cursor": "example-cursor", "entries": [{ "id": "id:example", "kind": "file", "name": "example.txt", "pathDisplay": "/example.txt" }], "hasMore": false });
|
|
295
|
+
return branchCase("listed", value);
|
|
296
|
+
}
|
|
297
|
+
function listFolderDefault() {
|
|
298
|
+
return listFolderListedDefault();
|
|
299
|
+
}
|
|
300
|
+
function getMetadataFound(value, failure) {
|
|
301
|
+
return branchCase("found", value, failure);
|
|
302
|
+
}
|
|
303
|
+
function getMetadataNotFound(value, failure) {
|
|
304
|
+
return branchCase("notFound", value, failure);
|
|
305
|
+
}
|
|
306
|
+
function getMetadataProviderRejected(value, failure) {
|
|
307
|
+
return branchCase("providerRejected", value, failure);
|
|
308
|
+
}
|
|
309
|
+
function getMetadataInvalidResponse(value, failure) {
|
|
310
|
+
return branchCase("invalidResponse", value, failure);
|
|
311
|
+
}
|
|
312
|
+
function getMetadataDefect(value, failure) {
|
|
313
|
+
return branchCase("defect", value, failure);
|
|
314
|
+
}
|
|
315
|
+
function getMetadataRetry(failure, retryAfterMs = 0) {
|
|
316
|
+
return retryCase(failure, retryAfterMs);
|
|
317
|
+
}
|
|
318
|
+
function getMetadataFoundDefault() {
|
|
319
|
+
const value = EntryMetadataSchema.parse({ "id": "id:example", "kind": "file", "name": "example.txt", "pathDisplay": "/example.txt" });
|
|
320
|
+
return branchCase("found", value);
|
|
321
|
+
}
|
|
322
|
+
function getMetadataDefault() {
|
|
323
|
+
return getMetadataFoundDefault();
|
|
324
|
+
}
|
|
325
|
+
function continueFolderListed(value, failure) {
|
|
326
|
+
return branchCase("listed", value, failure);
|
|
327
|
+
}
|
|
328
|
+
function continueFolderCursorExpired(value, failure) {
|
|
329
|
+
return branchCase("cursorExpired", value, failure);
|
|
330
|
+
}
|
|
331
|
+
function continueFolderProviderRejected(value, failure) {
|
|
332
|
+
return branchCase("providerRejected", value, failure);
|
|
333
|
+
}
|
|
334
|
+
function continueFolderInvalidResponse(value, failure) {
|
|
335
|
+
return branchCase("invalidResponse", value, failure);
|
|
336
|
+
}
|
|
337
|
+
function continueFolderDefect(value, failure) {
|
|
338
|
+
return branchCase("defect", value, failure);
|
|
339
|
+
}
|
|
340
|
+
function continueFolderRetry(failure, retryAfterMs = 0) {
|
|
341
|
+
return retryCase(failure, retryAfterMs);
|
|
342
|
+
}
|
|
343
|
+
function continueFolderListedDefault() {
|
|
344
|
+
const value = FolderPageSchema.parse({ "cursor": "example-cursor-2", "entries": [{ "id": "id:continued", "kind": "file", "name": "continued.txt", "pathDisplay": "/continued.txt" }], "hasMore": false });
|
|
345
|
+
return branchCase("listed", value);
|
|
346
|
+
}
|
|
347
|
+
function continueFolderDefault() {
|
|
348
|
+
return continueFolderListedDefault();
|
|
349
|
+
}
|
|
350
|
+
function downloadFileDownloaded(value, failure) {
|
|
351
|
+
return branchCase("downloaded", value, failure);
|
|
352
|
+
}
|
|
353
|
+
function downloadFileNotFound(value, failure) {
|
|
354
|
+
return branchCase("notFound", value, failure);
|
|
355
|
+
}
|
|
356
|
+
function downloadFileTooLarge(value, failure) {
|
|
357
|
+
return branchCase("tooLarge", value, failure);
|
|
358
|
+
}
|
|
359
|
+
function downloadFileProviderRejected(value, failure) {
|
|
360
|
+
return branchCase("providerRejected", value, failure);
|
|
361
|
+
}
|
|
362
|
+
function downloadFileInvalidResponse(value, failure) {
|
|
363
|
+
return branchCase("invalidResponse", value, failure);
|
|
364
|
+
}
|
|
365
|
+
function downloadFileDefect(value, failure) {
|
|
366
|
+
return branchCase("defect", value, failure);
|
|
367
|
+
}
|
|
368
|
+
function downloadFileRetry(failure, retryAfterMs = 0) {
|
|
369
|
+
return retryCase(failure, retryAfterMs);
|
|
370
|
+
}
|
|
371
|
+
function downloadFileDownloadedDefault() {
|
|
372
|
+
const value = DownloadedFileSchema.parse({ "contentBase64": "SGVsbG8=", "contentBytes": 5, "file": { "id": "id:example", "kind": "file", "name": "example.txt", "pathDisplay": "/example.txt" } });
|
|
373
|
+
return branchCase("downloaded", value);
|
|
374
|
+
}
|
|
375
|
+
function downloadFileDefault() {
|
|
376
|
+
return downloadFileDownloadedDefault();
|
|
377
|
+
}
|
|
378
|
+
function uploadFileUploaded(value, failure) {
|
|
379
|
+
return branchCase("uploaded", value, failure);
|
|
380
|
+
}
|
|
381
|
+
function uploadFileProviderRejected(value, failure) {
|
|
382
|
+
return branchCase("providerRejected", value, failure);
|
|
383
|
+
}
|
|
384
|
+
function uploadFileInvalidResponse(value, failure) {
|
|
385
|
+
return branchCase("invalidResponse", value, failure);
|
|
386
|
+
}
|
|
387
|
+
function uploadFileDefect(value, failure) {
|
|
388
|
+
return branchCase("defect", value, failure);
|
|
389
|
+
}
|
|
390
|
+
function uploadFileRetry(failure, retryAfterMs = 0) {
|
|
391
|
+
return retryCase(failure, retryAfterMs);
|
|
392
|
+
}
|
|
393
|
+
function uploadFileUploadedDefault() {
|
|
394
|
+
const value = UploadedFileSchema.parse({ "file": { "id": "id:example", "kind": "file", "name": "example.txt", "pathDisplay": "/example.txt" } });
|
|
395
|
+
return branchCase("uploaded", value);
|
|
396
|
+
}
|
|
397
|
+
function uploadFileDefault() {
|
|
398
|
+
return uploadFileUploadedDefault();
|
|
399
|
+
}
|
|
400
|
+
var GeneratedMock = class {
|
|
401
|
+
#listFolder;
|
|
402
|
+
#getMetadata;
|
|
403
|
+
#continueFolder;
|
|
404
|
+
#downloadFile;
|
|
405
|
+
#uploadFile;
|
|
406
|
+
#connection;
|
|
407
|
+
constructor(connectionName) {
|
|
408
|
+
this.#listFolder = newQuery(ListFolderDefinition).default(listFolderDefault());
|
|
409
|
+
this.#getMetadata = newQuery(GetMetadataDefinition).default(getMetadataDefault());
|
|
410
|
+
this.#continueFolder = newQuery(ContinueFolderDefinition).default(continueFolderDefault());
|
|
411
|
+
this.#downloadFile = newQuery(DownloadFileDefinition).default(downloadFileDefault());
|
|
412
|
+
this.#uploadFile = newMutation(UploadFileDefinition).default(uploadFileDefault());
|
|
413
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
414
|
+
}
|
|
415
|
+
connection() {
|
|
416
|
+
return this.#connection;
|
|
417
|
+
}
|
|
418
|
+
listFolder() {
|
|
419
|
+
return this.#listFolder;
|
|
420
|
+
}
|
|
421
|
+
getMetadata() {
|
|
422
|
+
return this.#getMetadata;
|
|
423
|
+
}
|
|
424
|
+
continueFolder() {
|
|
425
|
+
return this.#continueFolder;
|
|
426
|
+
}
|
|
427
|
+
downloadFile() {
|
|
428
|
+
return this.#downloadFile;
|
|
429
|
+
}
|
|
430
|
+
uploadFile() {
|
|
431
|
+
return this.#uploadFile;
|
|
432
|
+
}
|
|
433
|
+
assertNoFailures() {
|
|
434
|
+
this.#listFolder.assertNoFailures();
|
|
435
|
+
this.#getMetadata.assertNoFailures();
|
|
436
|
+
this.#continueFolder.assertNoFailures();
|
|
437
|
+
this.#downloadFile.assertNoFailures();
|
|
438
|
+
this.#uploadFile.assertNoFailures();
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export {
|
|
443
|
+
ConfigSchema,
|
|
444
|
+
decodeCredentials,
|
|
445
|
+
decodeSharedCredentials,
|
|
446
|
+
ListFolderInputSchema,
|
|
447
|
+
EntryMetadataSchema,
|
|
448
|
+
FolderPageSchema,
|
|
449
|
+
GetMetadataInputSchema,
|
|
450
|
+
ContinueFolderInputSchema,
|
|
451
|
+
DownloadFileInputSchema,
|
|
452
|
+
DownloadedFileSchema,
|
|
453
|
+
UploadFileInputSchema,
|
|
454
|
+
UploadedFileSchema,
|
|
455
|
+
ConnectorID,
|
|
456
|
+
ProviderID,
|
|
457
|
+
ListFolderBranch,
|
|
458
|
+
ListFolderBranchListed,
|
|
459
|
+
ListFolderBranchNotFound,
|
|
460
|
+
ListFolderBranchProviderRejected,
|
|
461
|
+
ListFolderBranchInvalidResponse,
|
|
462
|
+
ListFolderBranchDefect,
|
|
463
|
+
ListFolderDefinition,
|
|
464
|
+
ListFolderMetadata,
|
|
465
|
+
GetMetadataBranch,
|
|
466
|
+
GetMetadataBranchFound,
|
|
467
|
+
GetMetadataBranchNotFound,
|
|
468
|
+
GetMetadataBranchProviderRejected,
|
|
469
|
+
GetMetadataBranchInvalidResponse,
|
|
470
|
+
GetMetadataBranchDefect,
|
|
471
|
+
GetMetadataDefinition,
|
|
472
|
+
GetMetadataMetadata,
|
|
473
|
+
ContinueFolderBranch,
|
|
474
|
+
ContinueFolderBranchListed,
|
|
475
|
+
ContinueFolderBranchCursorExpired,
|
|
476
|
+
ContinueFolderBranchProviderRejected,
|
|
477
|
+
ContinueFolderBranchInvalidResponse,
|
|
478
|
+
ContinueFolderBranchDefect,
|
|
479
|
+
ContinueFolderDefinition,
|
|
480
|
+
ContinueFolderMetadata,
|
|
481
|
+
DownloadFileBranch,
|
|
482
|
+
DownloadFileBranchDownloaded,
|
|
483
|
+
DownloadFileBranchNotFound,
|
|
484
|
+
DownloadFileBranchTooLarge,
|
|
485
|
+
DownloadFileBranchProviderRejected,
|
|
486
|
+
DownloadFileBranchInvalidResponse,
|
|
487
|
+
DownloadFileBranchDefect,
|
|
488
|
+
DownloadFileDefinition,
|
|
489
|
+
DownloadFileMetadata,
|
|
490
|
+
UploadFileBranch,
|
|
491
|
+
UploadFileBranchUploaded,
|
|
492
|
+
UploadFileBranchProviderRejected,
|
|
493
|
+
UploadFileBranchInvalidResponse,
|
|
494
|
+
UploadFileBranchDefect,
|
|
495
|
+
UploadFileDefinition,
|
|
496
|
+
UploadFileMetadata,
|
|
497
|
+
Connection,
|
|
498
|
+
newConnection,
|
|
499
|
+
newConnectionWithOperations,
|
|
500
|
+
newProjectCredentialProvider,
|
|
501
|
+
emptyListFolderInput,
|
|
502
|
+
emptyEntryMetadata,
|
|
503
|
+
emptyFolderPage,
|
|
504
|
+
emptyGetMetadataInput,
|
|
505
|
+
emptyContinueFolderInput,
|
|
506
|
+
emptyDownloadFileInput,
|
|
507
|
+
emptyDownloadedFile,
|
|
508
|
+
emptyUploadFileInput,
|
|
509
|
+
emptyUploadedFile,
|
|
510
|
+
listFolderListed,
|
|
511
|
+
listFolderNotFound,
|
|
512
|
+
listFolderProviderRejected,
|
|
513
|
+
listFolderInvalidResponse,
|
|
514
|
+
listFolderDefect,
|
|
515
|
+
listFolderRetry,
|
|
516
|
+
listFolderListedDefault,
|
|
517
|
+
listFolderDefault,
|
|
518
|
+
getMetadataFound,
|
|
519
|
+
getMetadataNotFound,
|
|
520
|
+
getMetadataProviderRejected,
|
|
521
|
+
getMetadataInvalidResponse,
|
|
522
|
+
getMetadataDefect,
|
|
523
|
+
getMetadataRetry,
|
|
524
|
+
getMetadataFoundDefault,
|
|
525
|
+
getMetadataDefault,
|
|
526
|
+
continueFolderListed,
|
|
527
|
+
continueFolderCursorExpired,
|
|
528
|
+
continueFolderProviderRejected,
|
|
529
|
+
continueFolderInvalidResponse,
|
|
530
|
+
continueFolderDefect,
|
|
531
|
+
continueFolderRetry,
|
|
532
|
+
continueFolderListedDefault,
|
|
533
|
+
continueFolderDefault,
|
|
534
|
+
downloadFileDownloaded,
|
|
535
|
+
downloadFileNotFound,
|
|
536
|
+
downloadFileTooLarge,
|
|
537
|
+
downloadFileProviderRejected,
|
|
538
|
+
downloadFileInvalidResponse,
|
|
539
|
+
downloadFileDefect,
|
|
540
|
+
downloadFileRetry,
|
|
541
|
+
downloadFileDownloadedDefault,
|
|
542
|
+
downloadFileDefault,
|
|
543
|
+
uploadFileUploaded,
|
|
544
|
+
uploadFileProviderRejected,
|
|
545
|
+
uploadFileInvalidResponse,
|
|
546
|
+
uploadFileDefect,
|
|
547
|
+
uploadFileRetry,
|
|
548
|
+
uploadFileUploadedDefault,
|
|
549
|
+
uploadFileDefault,
|
|
550
|
+
GeneratedMock
|
|
551
|
+
};
|