@superdurable/connector-box 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 +4 -1
- package/dex-connector.json +897 -24
- package/dist/chunk-7RYWT7W3.js +1653 -0
- package/dist/connection-BIbBd41p.d.ts +509 -0
- package/dist/index.d.ts +902 -5
- package/dist/index.js +1165 -29
- package/dist/mock.d.ts +293 -3
- package/dist/mock.js +275 -1
- package/package.json +4 -4
- package/dist/chunk-C3MMWLYU.js +0 -315
- package/dist/connection-DfqaRnkX.d.ts +0 -124
package/dist/chunk-C3MMWLYU.js
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
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
|
-
"maxDownloadBytes": z.number().int().optional(),
|
|
9
|
-
"uploadBaseUrl": z.string().optional(),
|
|
10
|
-
"maxUploadBytes": z.number().int().optional()
|
|
11
|
-
});
|
|
12
|
-
var CredentialMaterialError = class extends TypeError {
|
|
13
|
-
constructor(message) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = "CredentialMaterialError";
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
19
|
-
"project credential decoding failed",
|
|
20
|
-
"shared project credential decoding failed",
|
|
21
|
-
"project credential decoding failed: this connector version does not support shared credentials"
|
|
22
|
-
]);
|
|
23
|
-
function isCredentialMaterialError(error) {
|
|
24
|
-
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
25
|
-
}
|
|
26
|
-
function decodeCredentials(value) {
|
|
27
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
28
|
-
const fields = value;
|
|
29
|
-
const allowed = /* @__PURE__ */ new Set(["access_token", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
30
|
-
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
31
|
-
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new CredentialMaterialError("credential access_token has an invalid type");
|
|
32
|
-
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new CredentialMaterialError("credential oauth_client_id has an invalid type");
|
|
33
|
-
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new CredentialMaterialError("credential oauth_client_secret has an invalid type");
|
|
34
|
-
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new CredentialMaterialError("credential refresh_token has an invalid type");
|
|
35
|
-
const credentials = {};
|
|
36
|
-
if (!fields["oauth_client_id"]) throw new CredentialMaterialError("credential oauth_client_id is required");
|
|
37
|
-
credentials.oauthClientId = fields["oauth_client_id"] ?? "";
|
|
38
|
-
if (!fields["oauth_client_secret"]) throw new CredentialMaterialError("credential oauth_client_secret is required");
|
|
39
|
-
credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"] ?? "");
|
|
40
|
-
if (!fields["access_token"]) throw new CredentialMaterialError("credential access_token is required");
|
|
41
|
-
credentials.accessToken = new SecretString(fields["access_token"] ?? "");
|
|
42
|
-
if (!fields["refresh_token"]) throw new CredentialMaterialError("credential refresh_token is required");
|
|
43
|
-
credentials.refreshToken = new SecretString(fields["refresh_token"] ?? "");
|
|
44
|
-
return credentials;
|
|
45
|
-
}
|
|
46
|
-
function decodeSharedCredentials(value) {
|
|
47
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
48
|
-
const fields = value;
|
|
49
|
-
const allowed = /* @__PURE__ */ new Set(["access_token", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
50
|
-
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
51
|
-
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new CredentialMaterialError("credential access_token has an invalid type");
|
|
52
|
-
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new CredentialMaterialError("credential oauth_client_id has an invalid type");
|
|
53
|
-
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new CredentialMaterialError("credential oauth_client_secret has an invalid type");
|
|
54
|
-
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new CredentialMaterialError("credential refresh_token has an invalid type");
|
|
55
|
-
const credentials = {};
|
|
56
|
-
if (!fields["oauth_client_id"]) throw new CredentialMaterialError("credential oauth_client_id is required");
|
|
57
|
-
credentials.oauthClientId = fields["oauth_client_id"] ?? "";
|
|
58
|
-
credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"] ?? "");
|
|
59
|
-
if (!fields["access_token"]) throw new CredentialMaterialError("credential access_token is required");
|
|
60
|
-
credentials.accessToken = new SecretString(fields["access_token"] ?? "");
|
|
61
|
-
credentials.refreshToken = new SecretString(fields["refresh_token"] ?? "");
|
|
62
|
-
return credentials;
|
|
63
|
-
}
|
|
64
|
-
var DownloadFileInputSchema = z.strictObject({
|
|
65
|
-
"fileId": z.string()
|
|
66
|
-
});
|
|
67
|
-
var DownloadedFileSchema = z.strictObject({
|
|
68
|
-
"fileId": z.string(),
|
|
69
|
-
"contentBase64": z.string(),
|
|
70
|
-
"contentBytes": z.number().int()
|
|
71
|
-
});
|
|
72
|
-
var UploadFileInputSchema = z.strictObject({
|
|
73
|
-
"fileId": z.string(),
|
|
74
|
-
"contentBase64": z.string()
|
|
75
|
-
});
|
|
76
|
-
var UploadedFileSchema = z.strictObject({
|
|
77
|
-
"fileId": z.string(),
|
|
78
|
-
"name": z.string(),
|
|
79
|
-
"sha1": z.string()
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// src/generated/definitions.ts
|
|
83
|
-
var ConnectorID = "box";
|
|
84
|
-
var ProviderID = "box";
|
|
85
|
-
var DownloadFileBranch = {
|
|
86
|
-
Downloaded: "downloaded",
|
|
87
|
-
NotFound: "notFound",
|
|
88
|
-
TooLarge: "tooLarge",
|
|
89
|
-
ProviderRejected: "providerRejected",
|
|
90
|
-
InvalidResponse: "invalidResponse",
|
|
91
|
-
Defect: "defect"
|
|
92
|
-
};
|
|
93
|
-
var DownloadFileBranchDownloaded = DownloadFileBranch.Downloaded;
|
|
94
|
-
var DownloadFileBranchNotFound = DownloadFileBranch.NotFound;
|
|
95
|
-
var DownloadFileBranchTooLarge = DownloadFileBranch.TooLarge;
|
|
96
|
-
var DownloadFileBranchProviderRejected = DownloadFileBranch.ProviderRejected;
|
|
97
|
-
var DownloadFileBranchInvalidResponse = DownloadFileBranch.InvalidResponse;
|
|
98
|
-
var DownloadFileBranchDefect = DownloadFileBranch.Defect;
|
|
99
|
-
var DownloadFileDefinition = {
|
|
100
|
-
operation: { connectorId: ConnectorID, operationId: "downloadFile" },
|
|
101
|
-
branches: [
|
|
102
|
-
{ id: "downloaded", description: "Box returned the selected file content." },
|
|
103
|
-
{ id: "notFound", description: "Box did not find this file or the user lacks access.", optional: true },
|
|
104
|
-
{ id: "tooLarge", description: "The file exceeds the configured download limit.", optional: true },
|
|
105
|
-
{ id: "providerRejected", description: "Box conclusively rejected the download.", optional: true },
|
|
106
|
-
{ id: "invalidResponse", description: "Box returned an invalid or oversized response.", optional: true },
|
|
107
|
-
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
108
|
-
],
|
|
109
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
110
|
-
};
|
|
111
|
-
var DownloadFileMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
112
|
-
var UploadFileBranch = {
|
|
113
|
-
Uploaded: "uploaded",
|
|
114
|
-
NotFound: "notFound",
|
|
115
|
-
ProviderRejected: "providerRejected",
|
|
116
|
-
InvalidResponse: "invalidResponse",
|
|
117
|
-
Defect: "defect"
|
|
118
|
-
};
|
|
119
|
-
var UploadFileBranchUploaded = UploadFileBranch.Uploaded;
|
|
120
|
-
var UploadFileBranchNotFound = UploadFileBranch.NotFound;
|
|
121
|
-
var UploadFileBranchProviderRejected = UploadFileBranch.ProviderRejected;
|
|
122
|
-
var UploadFileBranchInvalidResponse = UploadFileBranch.InvalidResponse;
|
|
123
|
-
var UploadFileBranchDefect = UploadFileBranch.Defect;
|
|
124
|
-
var UploadFileDefinition = {
|
|
125
|
-
operation: { connectorId: ConnectorID, operationId: "uploadFile" },
|
|
126
|
-
branches: [
|
|
127
|
-
{ id: "uploaded", description: "The existing Box file now has the requested content." },
|
|
128
|
-
{ id: "notFound", description: "Box did not find the file or the user lacks access.", optional: true },
|
|
129
|
-
{ id: "providerRejected", description: "Box conclusively rejected the replacement.", optional: true },
|
|
130
|
-
{ id: "invalidResponse", description: "Retained for compatibility and no longer selected: malformed or oversized file metadata now retries.", optional: true },
|
|
131
|
-
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
132
|
-
],
|
|
133
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
134
|
-
};
|
|
135
|
-
var UploadFileMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
136
|
-
|
|
137
|
-
// src/generated/connection.ts
|
|
138
|
-
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
139
|
-
import { newRefreshingCredentialProvider } from "@superdurable/connectors-sdk/projectconfig";
|
|
140
|
-
var Connection = class {
|
|
141
|
-
/** Stable provider and connection name. */
|
|
142
|
-
reference;
|
|
143
|
-
/** Bound provider operations. */
|
|
144
|
-
operations;
|
|
145
|
-
/** Validate a reference and bind operations. */
|
|
146
|
-
constructor(reference, operations) {
|
|
147
|
-
this.reference = ConnectionRefSchema.parse(reference);
|
|
148
|
-
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
149
|
-
if (!operations) throw new TypeError("connector operations are required");
|
|
150
|
-
this.operations = operations;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
function newConnection(client, reference) {
|
|
154
|
-
if (!client) throw new TypeError("connector client is required");
|
|
155
|
-
return new Connection(reference, client);
|
|
156
|
-
}
|
|
157
|
-
function newConnectionWithOperations(operations, reference) {
|
|
158
|
-
return new Connection(reference, operations);
|
|
159
|
-
}
|
|
160
|
-
function newProjectCredentialProvider(project, connectionName, decode, encode, decodeShared) {
|
|
161
|
-
return newRefreshingCredentialProvider(project.connections, { connectorId: ConnectorID, connectionName }, decode, encode, decodeShared);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// src/generated/mock.ts
|
|
165
|
-
import { branchCase, retryCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
166
|
-
var emptyDownloadFileInput = DownloadFileInputSchema.parse({
|
|
167
|
-
"fileId": ""
|
|
168
|
-
});
|
|
169
|
-
var emptyDownloadedFile = DownloadedFileSchema.parse({
|
|
170
|
-
"fileId": "",
|
|
171
|
-
"contentBase64": "",
|
|
172
|
-
"contentBytes": 0
|
|
173
|
-
});
|
|
174
|
-
var emptyUploadFileInput = UploadFileInputSchema.parse({
|
|
175
|
-
"fileId": "",
|
|
176
|
-
"contentBase64": ""
|
|
177
|
-
});
|
|
178
|
-
var emptyUploadedFile = UploadedFileSchema.parse({
|
|
179
|
-
"fileId": "",
|
|
180
|
-
"name": "",
|
|
181
|
-
"sha1": ""
|
|
182
|
-
});
|
|
183
|
-
function downloadFileDownloaded(value, failure) {
|
|
184
|
-
return branchCase("downloaded", value, failure);
|
|
185
|
-
}
|
|
186
|
-
function downloadFileNotFound(value, failure) {
|
|
187
|
-
return branchCase("notFound", value, failure);
|
|
188
|
-
}
|
|
189
|
-
function downloadFileTooLarge(value, failure) {
|
|
190
|
-
return branchCase("tooLarge", value, failure);
|
|
191
|
-
}
|
|
192
|
-
function downloadFileProviderRejected(value, failure) {
|
|
193
|
-
return branchCase("providerRejected", value, failure);
|
|
194
|
-
}
|
|
195
|
-
function downloadFileInvalidResponse(value, failure) {
|
|
196
|
-
return branchCase("invalidResponse", value, failure);
|
|
197
|
-
}
|
|
198
|
-
function downloadFileDefect(value, failure) {
|
|
199
|
-
return branchCase("defect", value, failure);
|
|
200
|
-
}
|
|
201
|
-
function downloadFileRetry(failure, retryAfterMs = 0) {
|
|
202
|
-
return retryCase(failure, retryAfterMs);
|
|
203
|
-
}
|
|
204
|
-
function downloadFileDownloadedDefault() {
|
|
205
|
-
const value = DownloadedFileSchema.parse({ "contentBase64": "SGVsbG8=", "contentBytes": 5, "fileId": "12345" });
|
|
206
|
-
return branchCase("downloaded", value);
|
|
207
|
-
}
|
|
208
|
-
function downloadFileDefault() {
|
|
209
|
-
return downloadFileDownloadedDefault();
|
|
210
|
-
}
|
|
211
|
-
function uploadFileUploaded(value, failure) {
|
|
212
|
-
return branchCase("uploaded", value, failure);
|
|
213
|
-
}
|
|
214
|
-
function uploadFileNotFound(value, failure) {
|
|
215
|
-
return branchCase("notFound", value, failure);
|
|
216
|
-
}
|
|
217
|
-
function uploadFileProviderRejected(value, failure) {
|
|
218
|
-
return branchCase("providerRejected", value, failure);
|
|
219
|
-
}
|
|
220
|
-
function uploadFileInvalidResponse(value, failure) {
|
|
221
|
-
return branchCase("invalidResponse", value, failure);
|
|
222
|
-
}
|
|
223
|
-
function uploadFileDefect(value, failure) {
|
|
224
|
-
return branchCase("defect", value, failure);
|
|
225
|
-
}
|
|
226
|
-
function uploadFileRetry(failure, retryAfterMs = 0) {
|
|
227
|
-
return retryCase(failure, retryAfterMs);
|
|
228
|
-
}
|
|
229
|
-
function uploadFileUploadedDefault() {
|
|
230
|
-
const value = UploadedFileSchema.parse({ "fileId": "12345", "name": "example.txt", "sha1": "F7FF9E8B7BB2E09B70935A5D785E0CC5D9D0ABF0" });
|
|
231
|
-
return branchCase("uploaded", value);
|
|
232
|
-
}
|
|
233
|
-
function uploadFileDefault() {
|
|
234
|
-
return uploadFileUploadedDefault();
|
|
235
|
-
}
|
|
236
|
-
var GeneratedMock = class {
|
|
237
|
-
#downloadFile;
|
|
238
|
-
#uploadFile;
|
|
239
|
-
#connection;
|
|
240
|
-
constructor(connectionName) {
|
|
241
|
-
this.#downloadFile = newQuery(DownloadFileDefinition).default(downloadFileDefault());
|
|
242
|
-
this.#uploadFile = newMutation(UploadFileDefinition).default(uploadFileDefault());
|
|
243
|
-
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
244
|
-
}
|
|
245
|
-
connection() {
|
|
246
|
-
return this.#connection;
|
|
247
|
-
}
|
|
248
|
-
downloadFile() {
|
|
249
|
-
return this.#downloadFile;
|
|
250
|
-
}
|
|
251
|
-
uploadFile() {
|
|
252
|
-
return this.#uploadFile;
|
|
253
|
-
}
|
|
254
|
-
assertNoFailures() {
|
|
255
|
-
this.#downloadFile.assertNoFailures();
|
|
256
|
-
this.#uploadFile.assertNoFailures();
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
export {
|
|
261
|
-
ConfigSchema,
|
|
262
|
-
CredentialMaterialError,
|
|
263
|
-
isCredentialMaterialError,
|
|
264
|
-
decodeCredentials,
|
|
265
|
-
decodeSharedCredentials,
|
|
266
|
-
DownloadFileInputSchema,
|
|
267
|
-
DownloadedFileSchema,
|
|
268
|
-
UploadFileInputSchema,
|
|
269
|
-
UploadedFileSchema,
|
|
270
|
-
ConnectorID,
|
|
271
|
-
ProviderID,
|
|
272
|
-
DownloadFileBranch,
|
|
273
|
-
DownloadFileBranchDownloaded,
|
|
274
|
-
DownloadFileBranchNotFound,
|
|
275
|
-
DownloadFileBranchTooLarge,
|
|
276
|
-
DownloadFileBranchProviderRejected,
|
|
277
|
-
DownloadFileBranchInvalidResponse,
|
|
278
|
-
DownloadFileBranchDefect,
|
|
279
|
-
DownloadFileDefinition,
|
|
280
|
-
DownloadFileMetadata,
|
|
281
|
-
UploadFileBranch,
|
|
282
|
-
UploadFileBranchUploaded,
|
|
283
|
-
UploadFileBranchNotFound,
|
|
284
|
-
UploadFileBranchProviderRejected,
|
|
285
|
-
UploadFileBranchInvalidResponse,
|
|
286
|
-
UploadFileBranchDefect,
|
|
287
|
-
UploadFileDefinition,
|
|
288
|
-
UploadFileMetadata,
|
|
289
|
-
Connection,
|
|
290
|
-
newConnection,
|
|
291
|
-
newConnectionWithOperations,
|
|
292
|
-
newProjectCredentialProvider,
|
|
293
|
-
emptyDownloadFileInput,
|
|
294
|
-
emptyDownloadedFile,
|
|
295
|
-
emptyUploadFileInput,
|
|
296
|
-
emptyUploadedFile,
|
|
297
|
-
downloadFileDownloaded,
|
|
298
|
-
downloadFileNotFound,
|
|
299
|
-
downloadFileTooLarge,
|
|
300
|
-
downloadFileProviderRejected,
|
|
301
|
-
downloadFileInvalidResponse,
|
|
302
|
-
downloadFileDefect,
|
|
303
|
-
downloadFileRetry,
|
|
304
|
-
downloadFileDownloadedDefault,
|
|
305
|
-
downloadFileDefault,
|
|
306
|
-
uploadFileUploaded,
|
|
307
|
-
uploadFileNotFound,
|
|
308
|
-
uploadFileProviderRejected,
|
|
309
|
-
uploadFileInvalidResponse,
|
|
310
|
-
uploadFileDefect,
|
|
311
|
-
uploadFileRetry,
|
|
312
|
-
uploadFileUploadedDefault,
|
|
313
|
-
uploadFileDefault,
|
|
314
|
-
GeneratedMock
|
|
315
|
-
};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { SecretString, RefreshingCredentialProvider, Query, Mutation, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
-
interface Config {
|
|
6
|
-
/** Box API root. Blank uses the displayed public endpoint; override only for an approved compatible gateway or local provider test. */
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
/** Positive duration for one provider request in Go units such as 15s or 1m. Blank uses the displayed default; increase for slow network paths. Runtime value in milliseconds. */
|
|
9
|
-
timeoutMs?: number;
|
|
10
|
-
/** Positive maximum provider error response size in bytes. Blank uses the displayed default; increase only for an approved gateway. */
|
|
11
|
-
maxResponseBytes?: number;
|
|
12
|
-
/** Positive maximum downloaded file content in bytes. Blank uses the displayed default; increase only for bounded files the Flow can safely persist. */
|
|
13
|
-
maxDownloadBytes?: number;
|
|
14
|
-
/** Box upload API root. Blank uses the displayed public endpoint; override only for an approved compatible gateway or local provider test. */
|
|
15
|
-
uploadBaseUrl?: string;
|
|
16
|
-
/** Positive maximum decoded upload size in bytes, at most 52428800. Blank uses the displayed default; increase only for bounded files the Flow can safely carry. */
|
|
17
|
-
maxUploadBytes?: number;
|
|
18
|
-
}
|
|
19
|
-
/** Runtime schema for manifest configuration. */
|
|
20
|
-
declare const ConfigSchema: z.ZodObject<{
|
|
21
|
-
baseUrl: z.ZodOptional<z.ZodString>;
|
|
22
|
-
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
23
|
-
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
24
|
-
maxDownloadBytes: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
uploadBaseUrl: z.ZodOptional<z.ZodString>;
|
|
26
|
-
maxUploadBytes: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
/** Private connector credentials resolved by the host. */
|
|
29
|
-
interface Credentials {
|
|
30
|
-
/** Secret access token returned after Box consent and refreshed by Dex. Never enter it manually; blank requires authorization. */
|
|
31
|
-
accessToken: SecretString;
|
|
32
|
-
/** Non-secret Client ID from https://app.box.com/developers/console > select the OAuth 2.0 Platform App > Configuration > OAuth 2.0 Credentials. Blank prevents authorization or refresh. */
|
|
33
|
-
oauthClientId: string;
|
|
34
|
-
/** Secret Client Secret from https://app.box.com/developers/console > select the OAuth 2.0 Platform App > Configuration > OAuth 2.0 Credentials. Store only here; blank prevents authorization or refresh. */
|
|
35
|
-
oauthClientSecret: SecretString;
|
|
36
|
-
/** Secret single-use refresh token returned after Box consent. Dex replaces it on every refresh; blank requires reauthorization. */
|
|
37
|
-
refreshToken: SecretString;
|
|
38
|
-
}
|
|
39
|
-
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
40
|
-
declare class CredentialMaterialError extends TypeError {
|
|
41
|
-
constructor(message: string);
|
|
42
|
-
}
|
|
43
|
-
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
44
|
-
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
45
|
-
/** Decode private credential fields for the connector. */
|
|
46
|
-
declare function decodeCredentials(value: unknown): Credentials;
|
|
47
|
-
/** Decode shared credential fields for the connector. */
|
|
48
|
-
declare function decodeSharedCredentials(value: unknown): Credentials;
|
|
49
|
-
/** Host-owned source of private connector credentials. */
|
|
50
|
-
type CredentialSource = RefreshingCredentialProvider<Credentials>;
|
|
51
|
-
/** DownloadFileInput selects one Box file by its numeric ID. */
|
|
52
|
-
interface DownloadFileInput {
|
|
53
|
-
/** FileID appears in Box Web's /files/<ID> URL. */
|
|
54
|
-
"fileId": string;
|
|
55
|
-
}
|
|
56
|
-
/** DownloadedFile contains bounded Base64 content and its Box file ID. */
|
|
57
|
-
interface DownloadedFile {
|
|
58
|
-
/** FileID is the Box file ID requested by the Flow. */
|
|
59
|
-
"fileId": string;
|
|
60
|
-
/** ContentBase64 is the downloaded byte sequence encoded as Base64. */
|
|
61
|
-
"contentBase64": string;
|
|
62
|
-
/** ContentBytes is the number of decoded bytes in ContentBase64. */
|
|
63
|
-
"contentBytes": number;
|
|
64
|
-
}
|
|
65
|
-
/** UploadFileInput replaces an existing Box file's current content. */
|
|
66
|
-
interface UploadFileInput {
|
|
67
|
-
/** FileID appears in Box Web's /files/<ID> URL. */
|
|
68
|
-
"fileId": string;
|
|
69
|
-
/** ContentBase64 holds the complete replacement bytes. */
|
|
70
|
-
"contentBase64": string;
|
|
71
|
-
}
|
|
72
|
-
/** UploadedFile identifies the file with the requested current content. */
|
|
73
|
-
interface UploadedFile {
|
|
74
|
-
/** FileID is the existing Box file ID. */
|
|
75
|
-
"fileId": string;
|
|
76
|
-
/** Name is the existing Box file name, preserved during replacement. */
|
|
77
|
-
"name": string;
|
|
78
|
-
/** SHA1 is Box's hexadecimal digest of current content. */
|
|
79
|
-
"sha1": string;
|
|
80
|
-
}
|
|
81
|
-
/** Runtime validator for DownloadFileInput. */
|
|
82
|
-
declare const DownloadFileInputSchema: z.ZodObject<{
|
|
83
|
-
fileId: z.ZodString;
|
|
84
|
-
}, z.core.$strict>;
|
|
85
|
-
/** Runtime validator for DownloadedFile. */
|
|
86
|
-
declare const DownloadedFileSchema: z.ZodObject<{
|
|
87
|
-
fileId: z.ZodString;
|
|
88
|
-
contentBase64: z.ZodString;
|
|
89
|
-
contentBytes: z.ZodNumber;
|
|
90
|
-
}, z.core.$strict>;
|
|
91
|
-
/** Runtime validator for UploadFileInput. */
|
|
92
|
-
declare const UploadFileInputSchema: z.ZodObject<{
|
|
93
|
-
fileId: z.ZodString;
|
|
94
|
-
contentBase64: z.ZodString;
|
|
95
|
-
}, z.core.$strict>;
|
|
96
|
-
/** Runtime validator for UploadedFile. */
|
|
97
|
-
declare const UploadedFileSchema: z.ZodObject<{
|
|
98
|
-
fileId: z.ZodString;
|
|
99
|
-
name: z.ZodString;
|
|
100
|
-
sha1: z.ZodString;
|
|
101
|
-
}, z.core.$strict>;
|
|
102
|
-
|
|
103
|
-
/** Typed operations supplied by a client or mock. */
|
|
104
|
-
interface Operations {
|
|
105
|
-
/** Invoke downloadFile through this connection. */
|
|
106
|
-
downloadFile(): Query<DownloadFileInput, DownloadedFile>;
|
|
107
|
-
/** Invoke uploadFile through this connection. */
|
|
108
|
-
uploadFile(): Mutation<UploadFileInput, UploadedFile>;
|
|
109
|
-
}
|
|
110
|
-
/** Named connector connection kept outside Flow state. */
|
|
111
|
-
declare class Connection<BoundOperations = Operations> {
|
|
112
|
-
/** Stable provider and connection name. */
|
|
113
|
-
readonly reference: ConnectionRef;
|
|
114
|
-
/** Bound provider operations. */
|
|
115
|
-
readonly operations: BoundOperations;
|
|
116
|
-
/** Validate a reference and bind operations. */
|
|
117
|
-
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
118
|
-
}
|
|
119
|
-
/** Bind a client to a named connection. */
|
|
120
|
-
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
121
|
-
/** Bind scripted operations to a named connection. */
|
|
122
|
-
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
123
|
-
|
|
124
|
-
export { type Config as C, type DownloadFileInput as D, type Operations as O, type UploadFileInput as U, type DownloadedFile as a, type UploadedFile as b, type Credentials as c, Connection as d, ConfigSchema as e, CredentialMaterialError as f, type CredentialSource as g, DownloadFileInputSchema as h, DownloadedFileSchema as i, UploadFileInputSchema as j, UploadedFileSchema as k, decodeCredentials as l, decodeSharedCredentials as m, isCredentialMaterialError as n, newConnection as o, newConnectionWithOperations as p };
|