@superdurable/connector-amazon-s3 0.1.2 → 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.
@@ -0,0 +1,755 @@
1
+ // src/generated/models.ts
2
+ import { z } from "zod";
3
+ import { SecretString } from "@superdurable/connectors-sdk";
4
+ var nativeJSON = JSON;
5
+ var signedIntegerToken = /^-?(?:0|[1-9][0-9]*)$/;
6
+ var minimumSignedInteger = -(1n << 63n);
7
+ var maximumSignedInteger = (1n << 63n) - 1n;
8
+ function decodeSignedInteger(value) {
9
+ if (typeof value === "number" && Number.isSafeInteger(value)) return value === 0 ? 0 : value;
10
+ if (!nativeJSON.isRawJSON(value) || value.rawJSON.length > 20 || !signedIntegerToken.test(value.rawJSON)) {
11
+ throw new TypeError("expected a signed 64-bit integer");
12
+ }
13
+ const integer = BigInt(value.rawJSON);
14
+ if (integer < minimumSignedInteger || integer > maximumSignedInteger) throw new RangeError("signed 64-bit integer out of range");
15
+ const number = Number(integer);
16
+ return Number.isSafeInteger(number) ? number : value;
17
+ }
18
+ var signedIntegerSchema = z.unknown().transform((value, context) => {
19
+ try {
20
+ return decodeSignedInteger(value);
21
+ } catch {
22
+ context.addIssue({ code: "custom", message: "expected a signed 64-bit integer" });
23
+ return z.NEVER;
24
+ }
25
+ });
26
+ function parseJSONNumberTokens(text) {
27
+ return JSON.parse(text, (_key, value, context) => typeof value === "number" && context?.source !== void 0 ? nativeJSON.rawJSON(context.source) : value);
28
+ }
29
+ function parseExactIntegerJSON(text) {
30
+ return JSON.parse(text, (_key, field, context) => typeof field === "number" && !Number.isSafeInteger(field) && context?.source && signedIntegerToken.test(context.source) ? nativeJSON.rawJSON(context.source) : field);
31
+ }
32
+ function exactIntegerJSONCodec(decode) {
33
+ return {
34
+ typeName: "json",
35
+ wireKind: "json",
36
+ encode(value) {
37
+ const data = JSON.stringify(value, (_key, field) => {
38
+ if (typeof field === "number" && Number.isInteger(field) && !Number.isSafeInteger(field)) {
39
+ throw new RangeError("use a raw JSON token for integers outside the safe number range");
40
+ }
41
+ return field;
42
+ });
43
+ if (data === void 0) throw new TypeError("value cannot be encoded as JSON");
44
+ return { kind: "json", data };
45
+ },
46
+ decode(wire) {
47
+ if (wire.kind !== "json" || typeof wire.data !== "string") throw new TypeError("expected Dex JSON wire data");
48
+ const value = parseExactIntegerJSON(wire.data);
49
+ return decode ? decode(value) : value;
50
+ }
51
+ };
52
+ }
53
+ var goTimeJSONPattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{1,2}):(\d{2}):(\d{2})(?:[.,](\d+))?(Z|([+-])(\d{2}):(\d{2}))$/;
54
+ function isGoTimeJSON(value) {
55
+ const match = goTimeJSONPattern.exec(value);
56
+ if (!match) return false;
57
+ const [, yearText, monthText, dayText, hourText, minuteText, secondText, , zone, , zoneHourText, zoneMinuteText] = match;
58
+ const year = Number(yearText);
59
+ const month = Number(monthText);
60
+ const day = Number(dayText);
61
+ const isLeap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
62
+ const monthDays = [31, isLeap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
63
+ return month >= 1 && month <= 12 && day >= 1 && day <= monthDays[month - 1] && Number(hourText) <= 23 && Number(minuteText) <= 59 && Number(secondText) <= 59 && (zone === "Z" || Number(zoneHourText) <= 24 && Number(zoneMinuteText) <= 60);
64
+ }
65
+ function canonicalGoTimeJSON(value) {
66
+ const match = goTimeJSONPattern.exec(value);
67
+ const [, year, month, day, hour, minute, second, fraction, zone, sign, zoneHour, zoneMinute] = match;
68
+ const clock = year + "-" + month + "-" + day + "T" + hour.padStart(2, "0") + ":" + minute + ":" + second;
69
+ const digits = (fraction ?? "").slice(0, 9).replace(/0+$/, "");
70
+ const offsetMinutes = zone === "Z" ? 0 : (Number(zoneHour) * 60 + Number(zoneMinute)) * (sign === "+" ? 1 : -1);
71
+ if (Math.abs(offsetMinutes) >= 1440) return value;
72
+ const offset = offsetMinutes === 0 ? "Z" : (offsetMinutes > 0 ? "+" : "-") + String(Math.floor(Math.abs(offsetMinutes) / 60)).padStart(2, "0") + ":" + String(Math.abs(offsetMinutes) % 60).padStart(2, "0");
73
+ return clock + (digits ? "." + digits : "") + offset;
74
+ }
75
+ var GoTimeJSONSchema = z.string().refine(isGoTimeJSON, "invalid Go time.Time JSON timestamp").transform(canonicalGoTimeJSON);
76
+ var ConfigSchema = z.object({
77
+ "region": z.string().optional(),
78
+ "endpoint": z.string().optional(),
79
+ "addressingStyle": z.string().optional(),
80
+ "defaultBucket": z.string().optional(),
81
+ "listPageSize": z.number().int().optional(),
82
+ "maxResponseBytes": z.number().int().optional(),
83
+ "maxTextBytes": z.number().int().optional(),
84
+ "maxUploadBytes": z.number().int().optional()
85
+ });
86
+ var CredentialMaterialError = class extends TypeError {
87
+ constructor(message) {
88
+ super(message);
89
+ this.name = "CredentialMaterialError";
90
+ }
91
+ };
92
+ var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
93
+ "project credential decoding failed",
94
+ "shared project credential decoding failed",
95
+ "project credential decoding failed: this connector version does not support shared credentials"
96
+ ]);
97
+ function isCredentialMaterialError(error) {
98
+ return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
99
+ }
100
+ function decodeCredentials(value) {
101
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
102
+ const fields = value;
103
+ const allowed = /* @__PURE__ */ new Set(["access_key_id", "secret_access_key", "session_token"]);
104
+ if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
105
+ if (fields["access_key_id"] != null && !(typeof fields["access_key_id"] === "string")) throw new CredentialMaterialError("credential access_key_id has an invalid type");
106
+ if (fields["secret_access_key"] != null && !(typeof fields["secret_access_key"] === "string")) throw new CredentialMaterialError("credential secret_access_key has an invalid type");
107
+ if (fields["session_token"] != null && !(typeof fields["session_token"] === "string")) throw new CredentialMaterialError("credential session_token has an invalid type");
108
+ const credentials = {};
109
+ if (!fields["access_key_id"]) throw new CredentialMaterialError("credential access_key_id is required");
110
+ credentials.accessKeyId = new SecretString(fields["access_key_id"] ?? "");
111
+ if (!fields["secret_access_key"]) throw new CredentialMaterialError("credential secret_access_key is required");
112
+ credentials.secretAccessKey = new SecretString(fields["secret_access_key"] ?? "");
113
+ credentials.sessionToken = new SecretString(fields["session_token"] ?? "");
114
+ return credentials;
115
+ }
116
+ var ListBucketsInputSchema = z.strictObject({
117
+ "prefix": z.string().optional(),
118
+ "continuationToken": z.string().optional(),
119
+ "maxBuckets": z.number().int().optional()
120
+ });
121
+ var BucketSummarySchema = z.strictObject({
122
+ "name": z.string(),
123
+ "creationDate": GoTimeJSONSchema,
124
+ "region": z.string().optional()
125
+ });
126
+ var ListBucketsOutputSchema = z.strictObject({
127
+ "buckets": z.array(BucketSummarySchema).nullable(),
128
+ "nextContinuationToken": z.string().optional()
129
+ });
130
+ var CreateBucketInputSchema = z.strictObject({
131
+ "bucket": z.string()
132
+ });
133
+ var CreatedBucketSchema = z.strictObject({
134
+ "bucket": z.string(),
135
+ "region": z.string()
136
+ });
137
+ var DeleteBucketInputSchema = z.strictObject({
138
+ "bucket": z.string().optional()
139
+ });
140
+ var DeletedBucketSchema = z.strictObject({
141
+ "bucket": z.string()
142
+ });
143
+ var CreateFolderInputSchema = z.strictObject({
144
+ "bucket": z.string().optional(),
145
+ "prefix": z.string()
146
+ });
147
+ var CreatedFolderSchema = z.strictObject({
148
+ "bucket": z.string(),
149
+ "prefix": z.string()
150
+ });
151
+ var DeleteFolderInputSchema = z.strictObject({
152
+ "bucket": z.string().optional(),
153
+ "prefix": z.string()
154
+ });
155
+ var DeletedFolderSchema = z.strictObject({
156
+ "bucket": z.string(),
157
+ "prefix": z.string()
158
+ });
159
+ var ListFoldersInputSchema = z.strictObject({
160
+ "bucket": z.string().optional(),
161
+ "parentPrefix": z.string().optional(),
162
+ "continuationToken": z.string().optional(),
163
+ "maxKeys": z.number().int().optional()
164
+ });
165
+ var ListFoldersOutputSchema = z.strictObject({
166
+ "bucket": z.string(),
167
+ "parentPrefix": z.string().optional(),
168
+ "folders": z.array(z.string()).optional(),
169
+ "nextContinuationToken": z.string().optional(),
170
+ "isTruncated": z.boolean()
171
+ });
172
+ var ListObjectsInputSchema = z.strictObject({
173
+ "bucket": z.string().optional(),
174
+ "prefix": z.string().optional(),
175
+ "delimiter": z.string().optional(),
176
+ "startAfter": z.string().optional(),
177
+ "continuationToken": z.string().optional(),
178
+ "maxKeys": z.number().int().optional()
179
+ });
180
+ var ObjectSummarySchema = z.strictObject({
181
+ "key": z.string(),
182
+ "sizeBytes": z.number().int(),
183
+ "eTag": z.string().optional(),
184
+ "lastModified": GoTimeJSONSchema.optional(),
185
+ "storageClass": z.string().optional()
186
+ });
187
+ var ListObjectsOutputSchema = z.strictObject({
188
+ "bucket": z.string(),
189
+ "prefix": z.string().optional(),
190
+ "delimiter": z.string().optional(),
191
+ "objects": z.array(ObjectSummarySchema).optional(),
192
+ "commonPrefixes": z.array(z.string()).optional(),
193
+ "isTruncated": z.boolean(),
194
+ "nextContinuationToken": z.string().optional()
195
+ });
196
+ var HeadObjectInputSchema = z.strictObject({
197
+ "bucket": z.string().optional(),
198
+ "key": z.string()
199
+ });
200
+ var ObjectMetadataSchema = z.strictObject({
201
+ "bucket": z.string(),
202
+ "key": z.string(),
203
+ "sizeBytes": z.number().int(),
204
+ "eTag": z.string().optional(),
205
+ "contentType": z.string().optional(),
206
+ "contentEncoding": z.string().optional(),
207
+ "contentLanguage": z.string().optional(),
208
+ "contentDisposition": z.string().optional(),
209
+ "cacheControl": z.string().optional(),
210
+ "lastModified": GoTimeJSONSchema.optional(),
211
+ "versionId": z.string().optional(),
212
+ "storageClass": z.string().optional(),
213
+ "serverSideEncryption": z.string().optional(),
214
+ "metadata": z.record(z.string(), z.string()).optional(),
215
+ "missingMetadataCount": z.number().int().optional()
216
+ });
217
+ var GetObjectTextInputSchema = z.strictObject({
218
+ "bucket": z.string().optional(),
219
+ "key": z.string()
220
+ });
221
+ var ObjectTextSchema = z.strictObject({
222
+ "bucket": z.string(),
223
+ "key": z.string(),
224
+ "contentType": z.string().optional(),
225
+ "eTag": z.string().optional(),
226
+ "versionId": z.string().optional(),
227
+ "lastModified": GoTimeJSONSchema.optional(),
228
+ "sizeBytes": z.number().int(),
229
+ "text": z.string().optional()
230
+ });
231
+ var GetObjectBytesInputSchema = z.strictObject({
232
+ "bucket": z.string().optional(),
233
+ "key": z.string()
234
+ });
235
+ var ObjectBytesSchema = z.strictObject({
236
+ "bucket": z.string(),
237
+ "key": z.string(),
238
+ "contentType": z.string().optional(),
239
+ "eTag": z.string().optional(),
240
+ "versionId": z.string().optional(),
241
+ "lastModified": GoTimeJSONSchema.optional(),
242
+ "sizeBytes": signedIntegerSchema,
243
+ "bytes": z.base64().optional()
244
+ });
245
+ var PutObjectInputSchema = z.strictObject({
246
+ "bucket": z.string().optional(),
247
+ "key": z.string(),
248
+ "contentType": z.string(),
249
+ "textContent": z.string().optional(),
250
+ "byteContent": z.base64().optional(),
251
+ "metadata": z.record(z.string(), z.string()).optional(),
252
+ "isCreateOnly": z.boolean().optional()
253
+ });
254
+ var StoredObjectSchema = z.strictObject({
255
+ "bucket": z.string(),
256
+ "key": z.string(),
257
+ "eTag": z.string().optional(),
258
+ "versionId": z.string().optional(),
259
+ "sizeBytes": z.number().int(),
260
+ "contentType": z.string().optional(),
261
+ "lastModified": GoTimeJSONSchema.optional(),
262
+ "isFromEarlierAttempt": z.boolean().optional()
263
+ });
264
+ var CopyObjectInputSchema = z.strictObject({
265
+ "sourceBucket": z.string().optional(),
266
+ "sourceKey": z.string(),
267
+ "destinationBucket": z.string().optional(),
268
+ "destinationKey": z.string(),
269
+ "contentType": z.string(),
270
+ "sourceETag": z.string().optional(),
271
+ "metadata": z.record(z.string(), z.string()).optional()
272
+ });
273
+ var CopiedObjectSchema = z.strictObject({
274
+ "sourceBucket": z.string(),
275
+ "sourceKey": z.string(),
276
+ "destinationBucket": z.string(),
277
+ "destinationKey": z.string(),
278
+ "eTag": z.string().optional(),
279
+ "versionId": z.string().optional(),
280
+ "isFromEarlierAttempt": z.boolean().optional()
281
+ });
282
+ var DeleteObjectInputSchema = z.strictObject({
283
+ "bucket": z.string().optional(),
284
+ "key": z.string()
285
+ });
286
+ var DeletedObjectSchema = z.strictObject({
287
+ "bucket": z.string(),
288
+ "key": z.string()
289
+ });
290
+
291
+ // src/generated/definitions.ts
292
+ var ConnectorID = "amazon-s3";
293
+ var ProviderID = "amazon-s3";
294
+ var ListBucketsBranch = {
295
+ Listed: "listed",
296
+ ProviderRejected: "providerRejected",
297
+ InvalidResponse: "invalidResponse",
298
+ Defect: "defect"
299
+ };
300
+ var ListBucketsBranchListed = ListBucketsBranch.Listed;
301
+ var ListBucketsBranchProviderRejected = ListBucketsBranch.ProviderRejected;
302
+ var ListBucketsBranchInvalidResponse = ListBucketsBranch.InvalidResponse;
303
+ var ListBucketsBranchDefect = ListBucketsBranch.Defect;
304
+ var ListBucketsDefinition = {
305
+ operation: { connectorId: ConnectorID, operationId: "listBuckets" },
306
+ branches: [
307
+ { id: "listed", description: "S3 returned a page of buckets." },
308
+ { id: "providerRejected", description: "S3 conclusively rejected the bucket list.", optional: true },
309
+ { id: "invalidResponse", description: "S3 returned an invalid or oversized bucket list.", optional: true },
310
+ { id: "defect", description: "Local input or configuration is invalid.", optional: true }
311
+ ],
312
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
313
+ };
314
+ var ListBucketsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
315
+ var CreateBucketBranch = {
316
+ Created: "created",
317
+ ProviderRejected: "providerRejected",
318
+ Defect: "defect",
319
+ Uncertain: "uncertain"
320
+ };
321
+ var CreateBucketBranchCreated = CreateBucketBranch.Created;
322
+ var CreateBucketBranchProviderRejected = CreateBucketBranch.ProviderRejected;
323
+ var CreateBucketBranchDefect = CreateBucketBranch.Defect;
324
+ var CreateBucketBranchUncertain = CreateBucketBranch.Uncertain;
325
+ var CreateBucketDefinition = {
326
+ operation: { connectorId: ConnectorID, operationId: "createBucket" },
327
+ branches: [
328
+ { id: "created", description: "S3 accepted creation or a previous attempt was confirmed." },
329
+ { id: "providerRejected", description: "S3 refused the bucket name or permission.", optional: true },
330
+ { id: "defect", description: "The bucket name or connection is invalid.", optional: true },
331
+ { id: "uncertain", description: "Bucket creation may have succeeded but the capped sends could not confirm it.", optional: true }
332
+ ],
333
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
334
+ repeatOnUnknown: "limited",
335
+ maxSends: 3
336
+ };
337
+ var CreateBucketMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
338
+ var DeleteBucketBranch = {
339
+ Deleted: "deleted",
340
+ ProviderRejected: "providerRejected",
341
+ Defect: "defect"
342
+ };
343
+ var DeleteBucketBranchDeleted = DeleteBucketBranch.Deleted;
344
+ var DeleteBucketBranchProviderRejected = DeleteBucketBranch.ProviderRejected;
345
+ var DeleteBucketBranchDefect = DeleteBucketBranch.Defect;
346
+ var DeleteBucketDefinition = {
347
+ operation: { connectorId: ConnectorID, operationId: "deleteBucket" },
348
+ branches: [
349
+ { id: "deleted", description: "The empty bucket is absent." },
350
+ { id: "providerRejected", description: "S3 refused deletion, including when the bucket is not empty.", optional: true },
351
+ { id: "defect", description: "The bucket name or connection is invalid.", optional: true }
352
+ ],
353
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
354
+ repeatOnUnknown: "safe"
355
+ };
356
+ var DeleteBucketMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
357
+ var CreateFolderBranch = {
358
+ Created: "created",
359
+ ProviderRejected: "providerRejected",
360
+ Defect: "defect"
361
+ };
362
+ var CreateFolderBranchCreated = CreateFolderBranch.Created;
363
+ var CreateFolderBranchProviderRejected = CreateFolderBranch.ProviderRejected;
364
+ var CreateFolderBranchDefect = CreateFolderBranch.Defect;
365
+ var CreateFolderDefinition = {
366
+ operation: { connectorId: ConnectorID, operationId: "createFolder" },
367
+ branches: [
368
+ { id: "created", description: "The folder marker was stored." },
369
+ { id: "providerRejected", description: "S3 conclusively refused the marker write.", optional: true },
370
+ { id: "defect", description: "The bucket or folder prefix is invalid.", optional: true }
371
+ ],
372
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
373
+ repeatOnUnknown: "safe"
374
+ };
375
+ var CreateFolderMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
376
+ var DeleteFolderBranch = {
377
+ Deleted: "deleted",
378
+ ProviderRejected: "providerRejected",
379
+ InvalidResponse: "invalidResponse",
380
+ Defect: "defect"
381
+ };
382
+ var DeleteFolderBranchDeleted = DeleteFolderBranch.Deleted;
383
+ var DeleteFolderBranchProviderRejected = DeleteFolderBranch.ProviderRejected;
384
+ var DeleteFolderBranchInvalidResponse = DeleteFolderBranch.InvalidResponse;
385
+ var DeleteFolderBranchDefect = DeleteFolderBranch.Defect;
386
+ var DeleteFolderDefinition = {
387
+ operation: { connectorId: ConnectorID, operationId: "deleteFolder" },
388
+ branches: [
389
+ { id: "deleted", description: "No current object remains under the prefix." },
390
+ { id: "providerRejected", description: "S3 conclusively refused a list or delete.", optional: true },
391
+ { id: "invalidResponse", description: "S3 returned an invalid or oversized list page.", optional: true },
392
+ { id: "defect", description: "The bucket or folder prefix is invalid.", optional: true }
393
+ ],
394
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
395
+ repeatOnUnknown: "safe"
396
+ };
397
+ var DeleteFolderMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
398
+ var ListFoldersBranch = {
399
+ Listed: "listed",
400
+ NotFound: "notFound",
401
+ ProviderRejected: "providerRejected",
402
+ InvalidResponse: "invalidResponse",
403
+ Defect: "defect"
404
+ };
405
+ var ListFoldersBranchListed = ListFoldersBranch.Listed;
406
+ var ListFoldersBranchNotFound = ListFoldersBranch.NotFound;
407
+ var ListFoldersBranchProviderRejected = ListFoldersBranch.ProviderRejected;
408
+ var ListFoldersBranchInvalidResponse = ListFoldersBranch.InvalidResponse;
409
+ var ListFoldersBranchDefect = ListFoldersBranch.Defect;
410
+ var ListFoldersDefinition = {
411
+ operation: { connectorId: ConnectorID, operationId: "listFolders" },
412
+ branches: [
413
+ { id: "listed", description: "One or more child folders or another page exists." },
414
+ { id: "notFound", description: "No child folder matched and no page remains.", optional: true },
415
+ { id: "providerRejected", description: "S3 conclusively refused the listing.", optional: true },
416
+ { id: "invalidResponse", description: "S3 returned an invalid or oversized page.", optional: true },
417
+ { id: "defect", description: "The bucket or prefix is invalid.", optional: true }
418
+ ],
419
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
420
+ };
421
+ var ListFoldersMetadata = { kind: "query", idempotency: "none", authorization: "required" };
422
+ var ListObjectsBranch = {
423
+ Found: "found",
424
+ NotFound: "notFound",
425
+ ProviderRejected: "providerRejected",
426
+ InvalidResponse: "invalidResponse",
427
+ Defect: "defect"
428
+ };
429
+ var ListObjectsBranchFound = ListObjectsBranch.Found;
430
+ var ListObjectsBranchNotFound = ListObjectsBranch.NotFound;
431
+ var ListObjectsBranchProviderRejected = ListObjectsBranch.ProviderRejected;
432
+ var ListObjectsBranchInvalidResponse = ListObjectsBranch.InvalidResponse;
433
+ var ListObjectsBranchDefect = ListObjectsBranch.Defect;
434
+ var ListObjectsDefinition = {
435
+ operation: { connectorId: ConnectorID, operationId: "listObjects" },
436
+ branches: [
437
+ { id: "found", description: "The page holds objects or common prefixes, or more pages remain." },
438
+ { id: "notFound", description: "No object matched the prefix and no further page remains.", optional: true },
439
+ { id: "providerRejected", description: "The store conclusively rejected the list, such as a missing bucket, a wrong Region, invalid credentials, or missing s3:ListBucket permission.", optional: true },
440
+ { id: "invalidResponse", description: "The store returned an invalid or oversized list page.", optional: true },
441
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
442
+ ],
443
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
444
+ };
445
+ var ListObjectsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
446
+ var HeadObjectBranch = {
447
+ Found: "found",
448
+ NotFound: "notFound",
449
+ ProviderRejected: "providerRejected",
450
+ InvalidResponse: "invalidResponse",
451
+ Defect: "defect"
452
+ };
453
+ var HeadObjectBranchFound = HeadObjectBranch.Found;
454
+ var HeadObjectBranchNotFound = HeadObjectBranch.NotFound;
455
+ var HeadObjectBranchProviderRejected = HeadObjectBranch.ProviderRejected;
456
+ var HeadObjectBranchInvalidResponse = HeadObjectBranch.InvalidResponse;
457
+ var HeadObjectBranchDefect = HeadObjectBranch.Defect;
458
+ var HeadObjectDefinition = {
459
+ operation: { connectorId: ConnectorID, operationId: "headObject" },
460
+ branches: [
461
+ { id: "found", description: "The store returned the object's metadata." },
462
+ { id: "notFound", description: "The object, or its bucket, does not exist; a HEAD response cannot say which.", optional: true },
463
+ { id: "providerRejected", description: "The store conclusively rejected the read, such as a wrong Region, invalid credentials, or missing s3:GetObject permission.", optional: true },
464
+ { id: "invalidResponse", description: "The store returned metadata without a valid size or modification time.", optional: true },
465
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
466
+ ],
467
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
468
+ };
469
+ var HeadObjectMetadata = { kind: "query", idempotency: "none", authorization: "required" };
470
+ var GetObjectTextBranch = {
471
+ Read: "read",
472
+ NotFound: "notFound",
473
+ UnsupportedContent: "unsupportedContent",
474
+ TooLarge: "tooLarge",
475
+ ProviderRejected: "providerRejected",
476
+ InvalidResponse: "invalidResponse",
477
+ Defect: "defect"
478
+ };
479
+ var GetObjectTextBranchRead = GetObjectTextBranch.Read;
480
+ var GetObjectTextBranchNotFound = GetObjectTextBranch.NotFound;
481
+ var GetObjectTextBranchUnsupportedContent = GetObjectTextBranch.UnsupportedContent;
482
+ var GetObjectTextBranchTooLarge = GetObjectTextBranch.TooLarge;
483
+ var GetObjectTextBranchProviderRejected = GetObjectTextBranch.ProviderRejected;
484
+ var GetObjectTextBranchInvalidResponse = GetObjectTextBranch.InvalidResponse;
485
+ var GetObjectTextBranchDefect = GetObjectTextBranch.Defect;
486
+ var GetObjectTextDefinition = {
487
+ operation: { connectorId: ConnectorID, operationId: "getObjectText" },
488
+ branches: [
489
+ { id: "read", description: "The object's complete text was read within maxTextBytes." },
490
+ { id: "notFound", description: "The object does not exist.", optional: true },
491
+ { id: "unsupportedContent", description: "The object's content type is not text, its content is encoded such as gzip, or its bytes are not valid UTF-8 text.", optional: true },
492
+ { id: "tooLarge", description: "The object is larger than maxTextBytes.", optional: true },
493
+ { id: "providerRejected", description: "The store conclusively rejected the read, such as a missing bucket, a wrong Region, invalid credentials, or missing s3:GetObject permission.", optional: true },
494
+ { id: "invalidResponse", description: "The store returned a response without a valid size or with content that contains the connection's credentials.", optional: true },
495
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
496
+ ],
497
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
498
+ };
499
+ var GetObjectTextMetadata = { kind: "query", idempotency: "none", authorization: "required" };
500
+ var GetObjectBytesBranch = {
501
+ Read: "read",
502
+ NotFound: "notFound",
503
+ TooLarge: "tooLarge",
504
+ InvalidResponse: "invalidResponse",
505
+ ProviderRejected: "providerRejected",
506
+ Defect: "defect"
507
+ };
508
+ var GetObjectBytesBranchRead = GetObjectBytesBranch.Read;
509
+ var GetObjectBytesBranchNotFound = GetObjectBytesBranch.NotFound;
510
+ var GetObjectBytesBranchTooLarge = GetObjectBytesBranch.TooLarge;
511
+ var GetObjectBytesBranchInvalidResponse = GetObjectBytesBranch.InvalidResponse;
512
+ var GetObjectBytesBranchProviderRejected = GetObjectBytesBranch.ProviderRejected;
513
+ var GetObjectBytesBranchDefect = GetObjectBytesBranch.Defect;
514
+ var GetObjectBytesDefinition = {
515
+ operation: { connectorId: ConnectorID, operationId: "getObjectBytes" },
516
+ branches: [
517
+ { id: "read", description: "The complete object fits maxResponseBytes." },
518
+ { id: "notFound", description: "The object does not exist.", optional: true },
519
+ { id: "tooLarge", description: "The object exceeds maxResponseBytes.", optional: true },
520
+ { id: "invalidResponse", description: "S3 returned incomplete or secret-bearing bytes.", optional: true },
521
+ { id: "providerRejected", description: "S3 conclusively refused the read.", optional: true },
522
+ { id: "defect", description: "The object location or connection is invalid.", optional: true }
523
+ ],
524
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
525
+ };
526
+ var GetObjectBytesMetadata = { kind: "query", idempotency: "none", authorization: "required" };
527
+ var PutObjectBranch = {
528
+ Stored: "stored",
529
+ AlreadyExists: "alreadyExists",
530
+ ProviderRejected: "providerRejected",
531
+ Defect: "defect"
532
+ };
533
+ var PutObjectBranchStored = PutObjectBranch.Stored;
534
+ var PutObjectBranchAlreadyExists = PutObjectBranch.AlreadyExists;
535
+ var PutObjectBranchProviderRejected = PutObjectBranch.ProviderRejected;
536
+ var PutObjectBranchDefect = PutObjectBranch.Defect;
537
+ var PutObjectDefinition = {
538
+ operation: { connectorId: ConnectorID, operationId: "putObject" },
539
+ branches: [
540
+ { id: "stored", description: "The store holds the object this Step execution wrote." },
541
+ { id: "alreadyExists", description: "Create-only mode found an object at the key that this Step execution did not write; nothing was written.", optional: true },
542
+ { id: "providerRejected", description: "The store conclusively rejected the write, such as a missing bucket, a wrong Region, invalid credentials, missing s3:PutObject permission, or a store that does not support create-only writes.", optional: true },
543
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
544
+ ],
545
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
546
+ repeatOnUnknown: "safe"
547
+ };
548
+ var PutObjectMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
549
+ var CopyObjectBranch = {
550
+ Copied: "copied",
551
+ ProviderRejected: "providerRejected",
552
+ Defect: "defect",
553
+ Uncertain: "uncertain"
554
+ };
555
+ var CopyObjectBranchCopied = CopyObjectBranch.Copied;
556
+ var CopyObjectBranchProviderRejected = CopyObjectBranch.ProviderRejected;
557
+ var CopyObjectBranchDefect = CopyObjectBranch.Defect;
558
+ var CopyObjectBranchUncertain = CopyObjectBranch.Uncertain;
559
+ var CopyObjectDefinition = {
560
+ operation: { connectorId: ConnectorID, operationId: "copyObject" },
561
+ branches: [
562
+ { id: "copied", description: "S3 accepted the copy or read-back confirmed an earlier send." },
563
+ { id: "providerRejected", description: "S3 conclusively refused the source or destination.", optional: true },
564
+ { id: "defect", description: "The object locations or copy metadata are invalid.", optional: true },
565
+ { id: "uncertain", description: "The copy may have succeeded but read-back could not confirm it after the send cap.", optional: true }
566
+ ],
567
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
568
+ repeatOnUnknown: "limited",
569
+ maxSends: 3
570
+ };
571
+ var CopyObjectMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
572
+ var DeleteObjectBranch = {
573
+ Deleted: "deleted",
574
+ ProviderRejected: "providerRejected",
575
+ Defect: "defect"
576
+ };
577
+ var DeleteObjectBranchDeleted = DeleteObjectBranch.Deleted;
578
+ var DeleteObjectBranchProviderRejected = DeleteObjectBranch.ProviderRejected;
579
+ var DeleteObjectBranchDefect = DeleteObjectBranch.Defect;
580
+ var DeleteObjectDefinition = {
581
+ operation: { connectorId: ConnectorID, operationId: "deleteObject" },
582
+ branches: [
583
+ { id: "deleted", description: "S3 accepted the deletion." },
584
+ { id: "providerRejected", description: "S3 conclusively rejected the deletion.", optional: true },
585
+ { id: "defect", description: "The object key or connection is invalid.", optional: true }
586
+ ],
587
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
588
+ repeatOnUnknown: "safe"
589
+ };
590
+ var DeleteObjectMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
591
+
592
+ // src/generated/connection.ts
593
+ import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
594
+ var Connection = class {
595
+ /** Stable provider and connection name. */
596
+ reference;
597
+ /** Bound provider operations. */
598
+ operations;
599
+ /** Validate a reference and bind operations. */
600
+ constructor(reference, operations) {
601
+ this.reference = ConnectionRefSchema.parse(reference);
602
+ if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
603
+ if (!operations) throw new TypeError("connector operations are required");
604
+ this.operations = operations;
605
+ }
606
+ };
607
+ function newConnection(client, reference) {
608
+ if (!client) throw new TypeError("connector client is required");
609
+ return new Connection(reference, client);
610
+ }
611
+ function newConnectionWithOperations(operations, reference) {
612
+ return new Connection(reference, operations);
613
+ }
614
+ var ConnectionNameProvider = "amazon-s3";
615
+
616
+ export {
617
+ decodeSignedInteger,
618
+ parseJSONNumberTokens,
619
+ parseExactIntegerJSON,
620
+ exactIntegerJSONCodec,
621
+ ConfigSchema,
622
+ CredentialMaterialError,
623
+ isCredentialMaterialError,
624
+ decodeCredentials,
625
+ ListBucketsInputSchema,
626
+ BucketSummarySchema,
627
+ ListBucketsOutputSchema,
628
+ CreateBucketInputSchema,
629
+ CreatedBucketSchema,
630
+ DeleteBucketInputSchema,
631
+ DeletedBucketSchema,
632
+ CreateFolderInputSchema,
633
+ CreatedFolderSchema,
634
+ DeleteFolderInputSchema,
635
+ DeletedFolderSchema,
636
+ ListFoldersInputSchema,
637
+ ListFoldersOutputSchema,
638
+ ListObjectsInputSchema,
639
+ ObjectSummarySchema,
640
+ ListObjectsOutputSchema,
641
+ HeadObjectInputSchema,
642
+ ObjectMetadataSchema,
643
+ GetObjectTextInputSchema,
644
+ ObjectTextSchema,
645
+ GetObjectBytesInputSchema,
646
+ ObjectBytesSchema,
647
+ PutObjectInputSchema,
648
+ StoredObjectSchema,
649
+ CopyObjectInputSchema,
650
+ CopiedObjectSchema,
651
+ DeleteObjectInputSchema,
652
+ DeletedObjectSchema,
653
+ ConnectorID,
654
+ ProviderID,
655
+ ListBucketsBranch,
656
+ ListBucketsBranchListed,
657
+ ListBucketsBranchProviderRejected,
658
+ ListBucketsBranchInvalidResponse,
659
+ ListBucketsBranchDefect,
660
+ ListBucketsDefinition,
661
+ ListBucketsMetadata,
662
+ CreateBucketBranch,
663
+ CreateBucketBranchCreated,
664
+ CreateBucketBranchProviderRejected,
665
+ CreateBucketBranchDefect,
666
+ CreateBucketBranchUncertain,
667
+ CreateBucketDefinition,
668
+ CreateBucketMetadata,
669
+ DeleteBucketBranch,
670
+ DeleteBucketBranchDeleted,
671
+ DeleteBucketBranchProviderRejected,
672
+ DeleteBucketBranchDefect,
673
+ DeleteBucketDefinition,
674
+ DeleteBucketMetadata,
675
+ CreateFolderBranch,
676
+ CreateFolderBranchCreated,
677
+ CreateFolderBranchProviderRejected,
678
+ CreateFolderBranchDefect,
679
+ CreateFolderDefinition,
680
+ CreateFolderMetadata,
681
+ DeleteFolderBranch,
682
+ DeleteFolderBranchDeleted,
683
+ DeleteFolderBranchProviderRejected,
684
+ DeleteFolderBranchInvalidResponse,
685
+ DeleteFolderBranchDefect,
686
+ DeleteFolderDefinition,
687
+ DeleteFolderMetadata,
688
+ ListFoldersBranch,
689
+ ListFoldersBranchListed,
690
+ ListFoldersBranchNotFound,
691
+ ListFoldersBranchProviderRejected,
692
+ ListFoldersBranchInvalidResponse,
693
+ ListFoldersBranchDefect,
694
+ ListFoldersDefinition,
695
+ ListFoldersMetadata,
696
+ ListObjectsBranch,
697
+ ListObjectsBranchFound,
698
+ ListObjectsBranchNotFound,
699
+ ListObjectsBranchProviderRejected,
700
+ ListObjectsBranchInvalidResponse,
701
+ ListObjectsBranchDefect,
702
+ ListObjectsDefinition,
703
+ ListObjectsMetadata,
704
+ HeadObjectBranch,
705
+ HeadObjectBranchFound,
706
+ HeadObjectBranchNotFound,
707
+ HeadObjectBranchProviderRejected,
708
+ HeadObjectBranchInvalidResponse,
709
+ HeadObjectBranchDefect,
710
+ HeadObjectDefinition,
711
+ HeadObjectMetadata,
712
+ GetObjectTextBranch,
713
+ GetObjectTextBranchRead,
714
+ GetObjectTextBranchNotFound,
715
+ GetObjectTextBranchUnsupportedContent,
716
+ GetObjectTextBranchTooLarge,
717
+ GetObjectTextBranchProviderRejected,
718
+ GetObjectTextBranchInvalidResponse,
719
+ GetObjectTextBranchDefect,
720
+ GetObjectTextDefinition,
721
+ GetObjectTextMetadata,
722
+ GetObjectBytesBranch,
723
+ GetObjectBytesBranchRead,
724
+ GetObjectBytesBranchNotFound,
725
+ GetObjectBytesBranchTooLarge,
726
+ GetObjectBytesBranchInvalidResponse,
727
+ GetObjectBytesBranchProviderRejected,
728
+ GetObjectBytesBranchDefect,
729
+ GetObjectBytesDefinition,
730
+ GetObjectBytesMetadata,
731
+ PutObjectBranch,
732
+ PutObjectBranchStored,
733
+ PutObjectBranchAlreadyExists,
734
+ PutObjectBranchProviderRejected,
735
+ PutObjectBranchDefect,
736
+ PutObjectDefinition,
737
+ PutObjectMetadata,
738
+ CopyObjectBranch,
739
+ CopyObjectBranchCopied,
740
+ CopyObjectBranchProviderRejected,
741
+ CopyObjectBranchDefect,
742
+ CopyObjectBranchUncertain,
743
+ CopyObjectDefinition,
744
+ CopyObjectMetadata,
745
+ DeleteObjectBranch,
746
+ DeleteObjectBranchDeleted,
747
+ DeleteObjectBranchProviderRejected,
748
+ DeleteObjectBranchDefect,
749
+ DeleteObjectDefinition,
750
+ DeleteObjectMetadata,
751
+ Connection,
752
+ newConnection,
753
+ newConnectionWithOperations,
754
+ ConnectionNameProvider
755
+ };