@prismatic-io/components-aws-s3 0.0.0-stage → 0.0.1

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,3941 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ let _prismatic_io_spectral = require("@prismatic-io/spectral");
24
+ let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
25
+ let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
26
+ let _aws_sdk_client_sns = require("@aws-sdk/client-sns");
27
+ let _aws_sdk_client_sts = require("@aws-sdk/client-sts");
28
+ let node_crypto = require("node:crypto");
29
+ let node_querystring = require("node:querystring");
30
+ node_querystring = __toESM(node_querystring);
31
+ let _aws_sdk_s3_request_presigner = require("@aws-sdk/s3-request-presigner");
32
+ let node_stream = require("node:stream");
33
+ let _aws_sdk_lib_storage = require("@aws-sdk/lib-storage");
34
+ let uuid = require("uuid");
35
+ //#region ../../packages/aws-utils/dist/connection/assumeRole.js
36
+ var __awaiter$3 = function(thisArg, _arguments, P, generator) {
37
+ function adopt(value) {
38
+ return value instanceof P ? value : new P(function(resolve) {
39
+ resolve(value);
40
+ });
41
+ }
42
+ return new (P || (P = Promise))(function(resolve, reject) {
43
+ function fulfilled(value) {
44
+ try {
45
+ step(generator.next(value));
46
+ } catch (e) {
47
+ reject(e);
48
+ }
49
+ }
50
+ function rejected(value) {
51
+ try {
52
+ step(generator["throw"](value));
53
+ } catch (e) {
54
+ reject(e);
55
+ }
56
+ }
57
+ function step(result) {
58
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
59
+ }
60
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
61
+ });
62
+ };
63
+ const assumeRole = (region, accessKeyId, secretAccessKey, roleArn, externalId) => __awaiter$3(void 0, void 0, void 0, function* () {
64
+ const { Credentials: { AccessKeyId, SecretAccessKey, SessionToken } } = yield new _aws_sdk_client_sts.STSClient(Object.assign(Object.assign({}, region.length > 0 && { region }), { credentials: {
65
+ accessKeyId,
66
+ secretAccessKey
67
+ } })).send(new _aws_sdk_client_sts.AssumeRoleCommand({
68
+ RoleArn: _prismatic_io_spectral.util.types.toString(roleArn),
69
+ RoleSessionName: "integration-session",
70
+ ExternalId: externalId
71
+ }));
72
+ return {
73
+ accessKeyId: AccessKeyId,
74
+ secretAccessKey: SecretAccessKey,
75
+ sessionToken: SessionToken
76
+ };
77
+ });
78
+ //#endregion
79
+ //#region ../../packages/aws-utils/dist/connection/assumeRoleConnection.js
80
+ const assumeRoleConnection = {
81
+ key: "awsAssumeRole",
82
+ display: {
83
+ label: "AWS Role ARN",
84
+ description: "Connect to AWS using an assumed role"
85
+ },
86
+ inputs: {
87
+ roleARN: {
88
+ label: "Role ARN",
89
+ placeholder: "arn:aws:iam::OtherAccount-ID:role/assumed-role-name",
90
+ type: "string",
91
+ required: true,
92
+ shown: true,
93
+ comments: "An AWS IAM Role ARN",
94
+ example: "arn:aws:iam::OtherAccount-ID:role/assumed-role-name"
95
+ },
96
+ accessKeyId: {
97
+ label: "Access Key ID",
98
+ placeholder: "Access Key ID",
99
+ type: "string",
100
+ required: true,
101
+ shown: true,
102
+ comments: "An AWS IAM Access Key ID",
103
+ example: "AKIAIOSFODNN7EXAMPLE"
104
+ },
105
+ secretAccessKey: {
106
+ label: "Secret Access Key",
107
+ placeholder: "Secret Access Key",
108
+ type: "password",
109
+ required: true,
110
+ shown: true,
111
+ comments: "An AWS IAM Secret Access Key",
112
+ example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
113
+ },
114
+ externalId: {
115
+ label: "External ID",
116
+ placeholder: "shared-common-secret",
117
+ type: "string",
118
+ required: false,
119
+ shown: true,
120
+ comments: "Provides enhanced security measures to the connection. Optional, but recommended. Please check [AWS docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html#id_roles_third-party_external-id) for more information.",
121
+ example: "shared-common-secret"
122
+ }
123
+ }
124
+ };
125
+ //#endregion
126
+ //#region ../../packages/aws-utils/dist/helpers/misc.js
127
+ const toTrimmedString = (value) => _prismatic_io_spectral.util.types.toString(value).trim();
128
+ const toOptionalString = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
129
+ //#endregion
130
+ //#region ../../packages/aws-utils/dist/helpers/getCredentials.js
131
+ const getCredentials = (connection) => {
132
+ return {
133
+ accessKeyId: toTrimmedString(connection.fields.accessKeyId),
134
+ secretAccessKey: toTrimmedString(connection.fields.secretAccessKey)
135
+ };
136
+ };
137
+ //#endregion
138
+ //#region ../../packages/aws-utils/dist/helpers/validateConnection.js
139
+ const validateConnection = (connection, validConnectionKeys) => {
140
+ if (![assumeRoleConnection.key, ...validConnectionKeys].includes(connection.key)) throw new _prismatic_io_spectral.ConnectionError(connection, `Unsupported connection method ${connection.key}.`);
141
+ };
142
+ //#endregion
143
+ //#region ../../packages/aws-utils/dist/client/getClientParams.js
144
+ var __awaiter$2 = function(thisArg, _arguments, P, generator) {
145
+ function adopt(value) {
146
+ return value instanceof P ? value : new P(function(resolve) {
147
+ resolve(value);
148
+ });
149
+ }
150
+ return new (P || (P = Promise))(function(resolve, reject) {
151
+ function fulfilled(value) {
152
+ try {
153
+ step(generator.next(value));
154
+ } catch (e) {
155
+ reject(e);
156
+ }
157
+ }
158
+ function rejected(value) {
159
+ try {
160
+ step(generator["throw"](value));
161
+ } catch (e) {
162
+ reject(e);
163
+ }
164
+ }
165
+ function step(result) {
166
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
167
+ }
168
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
169
+ });
170
+ };
171
+ const getClientParams = (_a) => __awaiter$2(void 0, [_a], void 0, function* ({ awsRegion, awsConnection, validConnectionKeys, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) {
172
+ var _b;
173
+ let shouldAssumeRole = false;
174
+ if (awsConnection) {
175
+ validateConnection(awsConnection, validConnectionKeys);
176
+ if (dynamicAccessKeyId || dynamicSecretAccessKey) throw new Error("Please specify either a connection or dynamic access key and secret inputs.");
177
+ shouldAssumeRole = awsConnection.key === assumeRoleConnection.key;
178
+ }
179
+ if (!awsConnection && (!dynamicAccessKeyId || !dynamicSecretAccessKey)) throw new Error("You must specify either a connection input or dynamic access key and secret inputs.");
180
+ const { accessKeyId, secretAccessKey } = awsConnection ? getCredentials(awsConnection) : {
181
+ accessKeyId: dynamicAccessKeyId,
182
+ secretAccessKey: dynamicSecretAccessKey
183
+ };
184
+ const credentials = shouldAssumeRole ? yield assumeRole(awsRegion, accessKeyId, secretAccessKey, toTrimmedString(awsConnection.fields.roleARN), toOptionalString((_b = awsConnection.fields) === null || _b === void 0 ? void 0 : _b.externalId)) : {
185
+ accessKeyId,
186
+ secretAccessKey,
187
+ sessionToken: dynamicSessionToken
188
+ };
189
+ return {
190
+ region: awsRegion.length > 0 ? awsRegion : void 0,
191
+ credentials
192
+ };
193
+ });
194
+ //#endregion
195
+ //#region ../../packages/aws-utils/dist/data/awsRegions.js
196
+ const awsRegions = [
197
+ "af-south-1",
198
+ "ap-east-1",
199
+ "ap-east-2",
200
+ "ap-northeast-1",
201
+ "ap-northeast-2",
202
+ "ap-northeast-3",
203
+ "ap-south-1",
204
+ "ap-south-2",
205
+ "ap-southeast-1",
206
+ "ap-southeast-2",
207
+ "ap-southeast-3",
208
+ "ap-southeast-4",
209
+ "ap-southeast-5",
210
+ "ap-southeast-6",
211
+ "ap-southeast-7",
212
+ "ca-central-1",
213
+ "ca-west-1",
214
+ "eu-central-1",
215
+ "eu-central-2",
216
+ "eu-north-1",
217
+ "eu-south-1",
218
+ "eu-south-2",
219
+ "eu-west-1",
220
+ "eu-west-2",
221
+ "eu-west-3",
222
+ "il-central-1",
223
+ "me-central-1",
224
+ "me-south-1",
225
+ "mx-central-1",
226
+ "sa-east-1",
227
+ "us-east-1",
228
+ "us-east-2",
229
+ "us-gov-east-1",
230
+ "us-gov-west-1",
231
+ "us-west-1",
232
+ "us-west-2"
233
+ ];
234
+ //#endregion
235
+ //#region ../../packages/aws-utils/dist/dataSources/selectRegion.js
236
+ var __awaiter$1 = function(thisArg, _arguments, P, generator) {
237
+ function adopt(value) {
238
+ return value instanceof P ? value : new P(function(resolve) {
239
+ resolve(value);
240
+ });
241
+ }
242
+ return new (P || (P = Promise))(function(resolve, reject) {
243
+ function fulfilled(value) {
244
+ try {
245
+ step(generator.next(value));
246
+ } catch (e) {
247
+ reject(e);
248
+ }
249
+ }
250
+ function rejected(value) {
251
+ try {
252
+ step(generator["throw"](value));
253
+ } catch (e) {
254
+ reject(e);
255
+ }
256
+ }
257
+ function step(result) {
258
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
259
+ }
260
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
261
+ });
262
+ };
263
+ const selectRegion = (0, _prismatic_io_spectral.dataSource)({
264
+ display: {
265
+ label: "Select AWS Region",
266
+ description: "Select an AWS region"
267
+ },
268
+ dataSourceType: "picklist",
269
+ perform: () => __awaiter$1(void 0, void 0, void 0, function* () {
270
+ return Promise.resolve({ result: awsRegions.map((region) => ({
271
+ label: region,
272
+ key: region
273
+ })) });
274
+ }),
275
+ inputs: {}
276
+ });
277
+ //#endregion
278
+ //#region ../../packages/aws-utils/dist/inputs/awsRegion.js
279
+ const awsRegion = (0, _prismatic_io_spectral.input)({
280
+ label: "AWS Region",
281
+ placeholder: "AWS Region",
282
+ type: "string",
283
+ required: false,
284
+ comments: "AWS provides services in multiple regions, like us-west-2 or eu-west-1.",
285
+ example: "us-east-1",
286
+ dataSource: "selectRegion",
287
+ clean: _prismatic_io_spectral.util.types.toString
288
+ });
289
+ (0, _prismatic_io_spectral.input)({
290
+ label: "Connection",
291
+ type: "connection",
292
+ required: false
293
+ });
294
+ const dynamicAccessAllInputs = {
295
+ dynamicAccessKeyId: (0, _prismatic_io_spectral.input)({
296
+ label: "Dynamic Access Key ID",
297
+ type: "string",
298
+ required: false,
299
+ clean: _prismatic_io_spectral.util.types.toString,
300
+ comments: "Use this input to authenticate with AWS if you are using a dynamically-generated access key. Otherwise, use the connection to enter a static access key ID."
301
+ }),
302
+ dynamicSecretAccessKey: (0, _prismatic_io_spectral.input)({
303
+ label: "Dynamic Secret Access Key",
304
+ type: "password",
305
+ required: false,
306
+ clean: _prismatic_io_spectral.util.types.toString,
307
+ comments: "Use this input to authenticate with AWS if you are using a dynamically-generated secret access key. Otherwise, use the connection to enter a static secret access key."
308
+ }),
309
+ dynamicSessionToken: (0, _prismatic_io_spectral.input)({
310
+ label: "Dynamic Session Token",
311
+ type: "password",
312
+ required: false,
313
+ clean: (value) => _prismatic_io_spectral.util.types.toString(value) || void 0,
314
+ comments: "Use this input to authenticate with AWS if you are using a OPTIONAL dynamically-generated session token."
315
+ })
316
+ };
317
+ //#endregion
318
+ //#region src/connections/accessKeySecretPair.ts
319
+ const accessKeySecretPair = (0, _prismatic_io_spectral.connection)({
320
+ key: "apiKeySecret",
321
+ display: {
322
+ label: "AWS S3 Access Key and Secret",
323
+ description: "Authenticates requests to AWS S3 using an API Key and Secret."
324
+ },
325
+ inputs: {
326
+ accessKeyId: {
327
+ label: "Access Key ID",
328
+ placeholder: "Enter AWS IAM Access Key ID",
329
+ type: "string",
330
+ required: true,
331
+ shown: true,
332
+ comments: "AWS IAM Access Key ID used for programmatic access. Create access keys in the [AWS IAM Console](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) under Security Credentials.",
333
+ example: "AKIAIOSFODNN7EXAMPLE"
334
+ },
335
+ secretAccessKey: {
336
+ label: "Secret Access Key",
337
+ placeholder: "Enter AWS IAM Secret Access Key",
338
+ type: "password",
339
+ required: true,
340
+ shown: true,
341
+ comments: "AWS IAM Secret Access Key paired with the Access Key ID. <strong>Important:</strong> This value is only shown once when created in the [AWS IAM Console](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html).",
342
+ example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
343
+ }
344
+ }
345
+ });
346
+ //#endregion
347
+ //#region src/connections/index.ts
348
+ var connections_default = [accessKeySecretPair, assumeRoleConnection];
349
+ //#endregion
350
+ //#region src/client.ts
351
+ const throwConnectionError = (connection, error) => {
352
+ throw new _prismatic_io_spectral.ConnectionError(connection, `Invalid AWS Credentials have been configured. This is sometimes caused by missing characters from a copy/paste. Original AWS error message: ${error.message}`);
353
+ };
354
+ const createS3Client = async ({ awsRegion, awsConnection, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken, debug, logger }) => {
355
+ const { region, credentials } = await getClientParams({
356
+ awsRegion,
357
+ awsConnection,
358
+ validConnectionKeys: [accessKeySecretPair.key],
359
+ dynamicAccessKeyId,
360
+ dynamicSecretAccessKey,
361
+ dynamicSessionToken
362
+ });
363
+ try {
364
+ return new _aws_sdk_client_s3.S3Client({
365
+ region,
366
+ credentials,
367
+ logger: debug ? logger : void 0
368
+ });
369
+ } catch (error) {
370
+ throwConnectionError(awsConnection, error);
371
+ }
372
+ };
373
+ const createSNSClient = async ({ awsRegion, awsConnection, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken, logger, debug }) => {
374
+ const { region, credentials } = await getClientParams({
375
+ awsRegion,
376
+ awsConnection,
377
+ validConnectionKeys: [accessKeySecretPair.key],
378
+ dynamicAccessKeyId,
379
+ dynamicSecretAccessKey,
380
+ dynamicSessionToken
381
+ });
382
+ try {
383
+ return new _aws_sdk_client_sns.SNSClient({
384
+ region,
385
+ credentials,
386
+ logger: debug ? logger : void 0
387
+ });
388
+ } catch (error) {
389
+ throwConnectionError(awsConnection, error);
390
+ }
391
+ };
392
+ //#endregion
393
+ //#region src/examplePayloads/bucketNotifications.ts
394
+ const putBucketNotificationConfigurationExamplePayload = { data: { $metadata: {
395
+ httpStatusCode: 200,
396
+ requestId: "3G6FNXP71KGVQ",
397
+ extendedRequestId: "epeRYyT9tl3QOMTMck4AG+NqmGa5fRKv5nME7gRl8KMxfnCAKWZzKbWVKp4ED7RaZIGvVcS=",
398
+ cfId: null,
399
+ attempts: 1,
400
+ totalRetryDelay: 0
401
+ } } };
402
+ const getBucketNotificationConfigurationExamplePayload = { data: {
403
+ $metadata: {
404
+ httpStatusCode: 200,
405
+ requestId: "2KMYXFM4GHPES",
406
+ extendedRequestId: "dLu9EloFaZ2UeACk5l4IovjfHXHTkM7kFLdThrbIJIjn05dgO7bdU3TUJ7/8DzZvcQ==",
407
+ cfId: null,
408
+ attempts: 1,
409
+ totalRetryDelay: 0
410
+ },
411
+ LambdaFunctionConfigurations: [{
412
+ Id: "Lambda",
413
+ LambdaFunctionArn: "arn:aws:lambda:us-east-2:1234:function:Function",
414
+ Events: ["s3:ObjectRemoved:*"]
415
+ }],
416
+ QueueConfigurations: [{
417
+ Id: "Queue",
418
+ QueueArn: "arn:aws:sqs:us-east-2:1234:Queue",
419
+ Events: ["s3:ObjectCreated:*"]
420
+ }],
421
+ TopicConfigurations: [{
422
+ Id: "Topic",
423
+ TopicArn: "arn:aws:sns:us-east-2:1234:Topic",
424
+ Events: ["s3:ObjectRestore:*"]
425
+ }]
426
+ } };
427
+ //#endregion
428
+ //#region src/examplePayloads/buckets.ts
429
+ const headBucketExamplePayload = { data: { $metadata: {
430
+ httpStatusCode: 200,
431
+ requestId: "A6R8PTRGRVGVB123",
432
+ extendedRequestId: "O1lqC0pMNa1+juScFrJbqgtJDQgkqvkcWDvLPfmcZBQNbxe+Bl4JE0WeIuswg/123456==",
433
+ cfId: null,
434
+ attempts: 1,
435
+ totalRetryDelay: 0
436
+ } } };
437
+ const deleteBucketExamplePayload = { data: { $metadata: {
438
+ httpStatusCode: 204,
439
+ requestId: "CBD415E7",
440
+ extendedRequestId: "WXvHrStedS7jFJZVw0Pt1LH3K3Nn99XFGuyELkK7UQANs3IOHs9GsR=",
441
+ cfId: null,
442
+ attempts: 1,
443
+ totalRetryDelay: 0
444
+ } } };
445
+ const listBucketsExamplePayload = { data: [{
446
+ Name: "bucket-1",
447
+ CreationDate: /* @__PURE__ */ new Date("2024-03-08T23:30:22.000Z")
448
+ }] };
449
+ const getBucketLocationExamplePayload = { data: "us-east-1" };
450
+ //#endregion
451
+ //#region src/examplePayloads/dataSources.ts
452
+ const selectBucketExamplePayload = { result: [{
453
+ label: "bucket-1",
454
+ key: "bucket-1"
455
+ }] };
456
+ //#endregion
457
+ //#region src/examplePayloads/misc.ts
458
+ const getCurrentAccountExamplePayload = { data: {
459
+ $metadata: {
460
+ httpStatusCode: 200,
461
+ requestId: "b81eb768-e79a-52a1-9be8-e90175212345",
462
+ extendedRequestId: null,
463
+ cfId: null,
464
+ attempts: 1,
465
+ totalRetryDelay: 0
466
+ },
467
+ Account: "123456789012",
468
+ Arn: "arn:aws:iam::123456789012:user/Alice",
469
+ UserId: "AIDACKCEVSQ6C2EXAMPLE"
470
+ } };
471
+ //#endregion
472
+ //#region src/examplePayloads/multipartUploads.ts
473
+ const listMultipartUploadsExamplePayload = { data: {
474
+ $metadata: {
475
+ httpStatusCode: 200,
476
+ requestId: "MSB2RAFETTBCQ123",
477
+ extendedRequestId: "Ax6cjVx4lugZGOI+yo3dApqbvrtLD3U",
478
+ cfId: null,
479
+ attempts: 1,
480
+ totalRetryDelay: 0
481
+ },
482
+ Bucket: "some-bucket",
483
+ IsTruncated: false,
484
+ KeyMarker: "",
485
+ MaxUploads: 1e3,
486
+ NextKeyMarker: "file.txt",
487
+ NextUploadIdMarker: "itQ2Dw8eMZ01dGiwRIj2dwDqpx",
488
+ UploadIdMarker: "",
489
+ Uploads: [{
490
+ UploadId: "hbZQmDNtym9xtdh8XwgT7Ys..FkRWJfV0MUgmNWg",
491
+ Key: "new_file.txt",
492
+ Initiated: /* @__PURE__ */ new Date("2024-01-25T16:06:31.000Z"),
493
+ StorageClass: "STANDARD",
494
+ Owner: { ID: "0edc4b00d" },
495
+ Initiator: { ID: "0edc4b00d" }
496
+ }]
497
+ } };
498
+ const generatePresignedForMultiparUploadsExamplePayload = { data: [{
499
+ url: "https://my-bucket.s3.us-east-2.amazonaws.com/my-file.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256...",
500
+ partNumber: 1
501
+ }] };
502
+ const createMultipartUploadExamplePayload = { data: {
503
+ $metadata: {
504
+ httpStatusCode: 200,
505
+ requestId: "J4Q9AY99DPMR1234",
506
+ extendedRequestId: "P59zKeH2C4Jz3VAC1I+12345Gty4d4gyl9JYQmc4udM6bCB6w/MEg8AKKWUuBH1x0EU2dufwkw=",
507
+ cfId: null,
508
+ attempts: 1,
509
+ totalRetryDelay: 0
510
+ },
511
+ ServerSideEncryption: "AES256",
512
+ Bucket: "bucket-name",
513
+ Key: "file.txt",
514
+ UploadId: "9DWJzLdFIcK05G2Yq.TNhJbCU57dDZyIRlO_tHcdFgYqWQgtu6XdASs7h.DJlcWk2M9vmEx72gXcS8q5SBu_12345ccg-"
515
+ } };
516
+ const abortMultipartUploadExamplePayload = { data: { $metadata: {
517
+ httpStatusCode: 204,
518
+ requestId: "DZ1ZJB3H2JB1234",
519
+ extendedRequestId: "0D9BDVoAGoHqu3dIW4WHmaO4kkiWecrbf0yLRMe/JmUfX7N/12345=",
520
+ cfId: null,
521
+ attempts: 1,
522
+ totalRetryDelay: 0
523
+ } } };
524
+ const uploadPartExamplePayload = { data: {
525
+ $metadata: {
526
+ httpStatusCode: 200,
527
+ requestId: "3Z9FSV3QYRYCK123",
528
+ extendedRequestId: "nhNCxtYGnVN+nxfdPaCPgAc23cJw2rphbIU1Z5ZUEmUDXIvF+Ra3eUXv2MNdOoWTIKXEym12345=",
529
+ cfId: null,
530
+ attempts: 1,
531
+ totalRetryDelay: 0
532
+ },
533
+ ServerSideEncryption: "AES256",
534
+ ETag: "\"266b7131485849fcefe583dcce071234\"",
535
+ part: {
536
+ ETag: "\"266b7131485849fcefe583dcce071234\"",
537
+ PartNumber: 1
538
+ }
539
+ } };
540
+ const listPartsExamplePayload = { data: {
541
+ $metadata: {
542
+ httpStatusCode: 200,
543
+ requestId: "3Z9CNHKT01WVE123",
544
+ extendedRequestId: "AYcUJyiexeUBBf5Uynsj4m1PojM18tHSxlyKMWzjM+123456=",
545
+ cfId: null,
546
+ attempts: 1,
547
+ totalRetryDelay: 0
548
+ },
549
+ Bucket: "bucket-name",
550
+ Initiator: { ID: "0edc4b00d1bfae1ebe33617c5cfe04e17b6f1fb9c5c2c55796123456" },
551
+ IsTruncated: false,
552
+ Key: "image.jpg",
553
+ MaxParts: 1e3,
554
+ NextPartNumberMarker: "1",
555
+ Owner: { ID: "0edc4b00d1bfae1ebe33617c5cfe04e17b6f1fb9c5c2c55796123456" },
556
+ PartNumberMarker: "0",
557
+ Parts: [{
558
+ PartNumber: 1,
559
+ LastModified: /* @__PURE__ */ new Date("2024-03-11T23:47:51.000Z"),
560
+ ETag: "\"266b7131485849fcefe583dcce071234\"",
561
+ Size: 65338
562
+ }],
563
+ StorageClass: "STANDARD",
564
+ UploadId: "iHtFwRT6d6IAPwGTlT6tO1iBApulQGCA2sG7yn_BzUKItrnLrWykCbDheQBJrb1MUGHgGfihOY07XfnCeU2CWCZM0kD6VbyC46MJ4123456-"
565
+ } };
566
+ const completeMultipartUploadExamplePayload = { data: {
567
+ $metadata: {
568
+ httpStatusCode: 200,
569
+ requestId: "GD4Y1XMZ6MFV1234",
570
+ extendedRequestId: "Ego8CAUdYnt2THhZmBLnbfmTPY0HR8zA9rEMkSg+OB0t/uldGkuBlI6UF9X+123456=",
571
+ cfId: null,
572
+ attempts: 1,
573
+ totalRetryDelay: 0
574
+ },
575
+ ServerSideEncryption: "AES256",
576
+ Bucket: "bucket-name",
577
+ ETag: "\"d96cf49f8c439501eb19c4728712345-1\"",
578
+ Key: "image.jpg",
579
+ Location: "https://bucketname.s3.us-east-2.amazonaws.com/image.jpg"
580
+ } };
581
+ //#endregion
582
+ //#region src/examplePayloads/objectLock.ts
583
+ const putObjectLockConfigurationExamplePayload = { data: { $metadata: {
584
+ httpStatusCode: 200,
585
+ requestId: "HRTN",
586
+ extendedRequestId: "n2j6gnXOgOKm+PomoHrLsbOhatc7LMw1Su",
587
+ cfId: null,
588
+ attempts: 1,
589
+ totalRetryDelay: 0
590
+ } } };
591
+ const getObjectLockConfigurationExamplePayload = { data: {
592
+ $metadata: {
593
+ httpStatusCode: 200,
594
+ requestId: "J58R459KF4NH",
595
+ extendedRequestId: "YLfHsBUyeXU06tYjF7ZLX7f7JhBL1FFZhA/UZKUr4WNTy0OHDOjYN=",
596
+ cfId: null,
597
+ attempts: 1,
598
+ totalRetryDelay: 0
599
+ },
600
+ ObjectLockConfiguration: {
601
+ ObjectLockEnabled: "Enabled",
602
+ Rule: { DefaultRetention: {
603
+ Mode: "GOVERNANCE",
604
+ Years: 2
605
+ } }
606
+ }
607
+ } };
608
+ const putObjectRetentionExamplePayload = { data: { $metadata: {
609
+ httpStatusCode: 200,
610
+ requestId: "9GKTJZDRMJCGMNY6",
611
+ extendedRequestId: "NKjiPDGEYKYtH7sHPWKSVpy9y9NtjbXzeJ7whq75y62jiH9JLuZOpMLCBiYyc+/hOlnOTCaTpWo=",
612
+ cfId: null,
613
+ attempts: 1,
614
+ totalRetryDelay: 0
615
+ } } };
616
+ const getObjectRetentionExamplePayload = { data: {
617
+ $metadata: {
618
+ httpStatusCode: 200,
619
+ requestId: "88W3KJSMC9E",
620
+ extendedRequestId: "aJ3Rpb+v2F6Fqy47J6fWoPPCqe+LC8UX8vo5x3KK/YhN/=",
621
+ cfId: null,
622
+ attempts: 1,
623
+ totalRetryDelay: 0
624
+ },
625
+ Retention: {
626
+ Mode: "COMPLIANCE",
627
+ RetainUntilDate: /* @__PURE__ */ new Date("2024-08-25T20:00:00.000Z")
628
+ }
629
+ } };
630
+ //#endregion
631
+ //#region src/examplePayloads/objects.ts
632
+ const headObjectExamplePayload = { data: {
633
+ $metadata: {
634
+ httpStatusCode: 200,
635
+ requestId: "2GNCNQ9QYJF91H2H3",
636
+ extendedRequestId: "20td2yhMFyFEFYm7Wh+P+qr8DDva152du5KA+JFU7ZRuHWLFZZxdLCOVfnMF41K2BYQ/12345=",
637
+ cfId: null,
638
+ attempts: 1,
639
+ totalRetryDelay: 0
640
+ },
641
+ AcceptRanges: "bytes",
642
+ LastModified: /* @__PURE__ */ new Date("2021-08-25T20:00:00.000Z"),
643
+ ContentLength: 65338,
644
+ ETag: "\"266b7131485849fcefe583dcce654321\"",
645
+ VersionId: "0Ec_RdbYOEQ1Un2HllBJbGG758RS3UuZ",
646
+ ContentType: "image/jpeg",
647
+ ServerSideEncryption: "AES256",
648
+ Metadata: {}
649
+ } };
650
+ const deleteObjectsExamplePayload = { data: {
651
+ $metadata: {
652
+ httpStatusCode: 200,
653
+ requestId: "FAQAVT",
654
+ extendedRequestId: "T/nk6UtPuVs11K6ji59C8phr==",
655
+ cfId: null,
656
+ attempts: 1,
657
+ totalRetryDelay: 0
658
+ },
659
+ Deleted: [{ Key: "file.csv" }, { Key: "audio.mp3" }]
660
+ } };
661
+ const getObjectAttributesExamplePayload = { data: {
662
+ $metadata: {
663
+ httpStatusCode: 200,
664
+ requestId: "0AJN29JBC3D5BNB6",
665
+ extendedRequestId: "sVW4/xKq7DkMI8kgvbJUNWbzzZ9H6GKqyVocDm3uE4y7dZ6GmZcFrIC9MPGDjSNXMMn8CtLO8Vy0SxOcNOwl2A==",
666
+ cfId: null,
667
+ attempts: 1,
668
+ totalRetryDelay: 0
669
+ },
670
+ LastModified: /* @__PURE__ */ new Date("2024-03-08T22:20:41.000Z"),
671
+ VersionId: "0Ec_RdbYOEQ1Un2HllBJbGG758RS3UuZ",
672
+ ObjectSize: 515400
673
+ } };
674
+ const copyObjectExamplePayload = { data: {
675
+ $metadata: {
676
+ httpStatusCode: 200,
677
+ requestId: "C4KXHZ9F2QQEM123",
678
+ extendedRequestId: "8pTnwvKfHXQyoNr3xJ2mZcVbLdE9qASgWx4RfUo6hP1cB0iYkMz5T7uV+123456=",
679
+ cfId: null,
680
+ attempts: 1,
681
+ totalRetryDelay: 0
682
+ },
683
+ CopyObjectResult: {
684
+ ETag: "\"9a0364b9e99bb480dd25e1f0284c8555\"",
685
+ LastModified: /* @__PURE__ */ new Date("2024-03-11T23:47:51.000Z")
686
+ }
687
+ } };
688
+ const deleteObjectExamplePayload = { data: {
689
+ $metadata: {
690
+ httpStatusCode: 204,
691
+ requestId: "FAQAVT3H2JB1234",
692
+ extendedRequestId: "0D9BDVoAGoHqu3dIW4WHmaO4kkiWecrbf0yLRMe/JmUfX7N/12345=",
693
+ cfId: null,
694
+ attempts: 1,
695
+ totalRetryDelay: 0
696
+ },
697
+ DeleteMarker: true,
698
+ VersionId: "3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo",
699
+ RequestCharged: "requester"
700
+ } };
701
+ const getObjectExamplePayload = {
702
+ data: Buffer.from("Example File Contents"),
703
+ contentType: "application/octet"
704
+ };
705
+ const listObjectsExamplePayload = { data: [
706
+ "invoices/2024-01-15.pdf",
707
+ "images/logo.png",
708
+ "backups/database-dump.sql"
709
+ ] };
710
+ const putObjectExamplePayload = { data: {
711
+ $metadata: {
712
+ httpStatusCode: 200,
713
+ requestId: "R8N3F7QZ9KXWM123",
714
+ extendedRequestId: "P59zKeH2C4Jz3VAC1I+12345Gty4d4gyl9JYQmc4udM6bCB6w/MEg8AKKWUuBH1x0EU2dufwkw=",
715
+ cfId: null,
716
+ attempts: 1,
717
+ totalRetryDelay: 0
718
+ },
719
+ ETag: "\"9a0364b9e99bb480dd25e1f0284c8555\"",
720
+ VersionId: "3sL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo"
721
+ } };
722
+ const generatePresignedUrlExamplePayload = { data: "https://my-bucket.s3.us-east-2.amazonaws.com/my-file.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256..." };
723
+ //#endregion
724
+ //#region src/examplePayloads/sns.ts
725
+ const createTopicExamplePayload = { data: {
726
+ $metadata: {
727
+ httpStatusCode: 200,
728
+ requestId: "a91d4b8e-c6c5-52f3-9b45-3e6d3f8a1234",
729
+ extendedRequestId: null,
730
+ cfId: null,
731
+ attempts: 1,
732
+ totalRetryDelay: 0
733
+ },
734
+ TopicArn: "arn:aws:sns:us-east-2:123456789012:MyTopic"
735
+ } };
736
+ const subscribeToTopicExamplePayload = { data: {
737
+ $metadata: {
738
+ httpStatusCode: 200,
739
+ requestId: "c72f9a3d-1b6e-54a2-8d7f-5a1b2c3d4e5f",
740
+ extendedRequestId: null,
741
+ cfId: null,
742
+ attempts: 1,
743
+ totalRetryDelay: 0
744
+ },
745
+ SubscriptionArn: "arn:aws:sns:us-east-2:123456789012:MyTopic:8a21d249-4bcd-4f7e-9abc-b1a2c3d4e5f6"
746
+ } };
747
+ const updateTopicPolicyExamplePayload = { data: { $metadata: {
748
+ httpStatusCode: 200,
749
+ requestId: "b81eb768-e79a-52a1-9be8-e90175212345",
750
+ extendedRequestId: null,
751
+ cfId: null,
752
+ attempts: 1,
753
+ totalRetryDelay: 0
754
+ } } };
755
+ const bucketEventTriggerConfigurationExamplePayload = { data: { $metadata: {
756
+ httpStatusCode: 200,
757
+ requestId: "73B4K590MABCMWV",
758
+ extendedRequestId: "AHYlhdFxyrlbc3otaMb/gcjlmDEY+UT3xt7Vz6ZQ8F4B1234GZQSGN7D6yDV7mEC+U/1xU0pKc=",
759
+ cfId: null,
760
+ attempts: 1,
761
+ totalRetryDelay: 0
762
+ } } };
763
+ const unsubscribeFromTopicExamplePayload = { data: { $metadata: {
764
+ httpStatusCode: 200,
765
+ requestId: "059f8a07-f312-5e3b-9b7c-d46e66ee8a58",
766
+ extendedRequestId: null,
767
+ cfId: null,
768
+ attempts: 1,
769
+ totalRetryDelay: 0
770
+ } } };
771
+ //#endregion
772
+ //#region src/examplePayloads/triggers.ts
773
+ const exampleTriggerPayloadBase = {
774
+ queryParameters: {},
775
+ rawBody: { data: null },
776
+ pathFragment: "",
777
+ webhookUrls: {},
778
+ webhookApiKeys: {},
779
+ invokeUrl: "",
780
+ executionId: "RXhhbXBsZUV4ZWN1dGlvblJlc3VsdElk",
781
+ customer: {
782
+ id: "testCustomerId",
783
+ name: "Test Customer",
784
+ externalId: "testExternalId"
785
+ },
786
+ instance: {
787
+ id: "testInstanceId",
788
+ name: "Test Instance"
789
+ },
790
+ user: {
791
+ id: "testUserId",
792
+ email: "user@example.com",
793
+ name: "Test User",
794
+ externalId: "testUserExternalId"
795
+ },
796
+ integration: {
797
+ id: "testIntegrationId",
798
+ name: "Test Integration",
799
+ versionSequenceId: "1",
800
+ externalVersion: ""
801
+ },
802
+ flow: {
803
+ id: "testFlowId",
804
+ name: "Test Flow",
805
+ stableId: "testFlowStableId"
806
+ },
807
+ startedAt: "2024-01-15T00:00:00.000Z",
808
+ globalDebug: false
809
+ };
810
+ const snsS3NotificationWebhookExamplePayload = {
811
+ branch: "Notification",
812
+ payload: {
813
+ ...exampleTriggerPayloadBase,
814
+ headers: {
815
+ "x-amz-sns-message-type": "Notification",
816
+ "x-amz-sns-message-id": "22b80b92-fdea-4c2c-8f9d-bdfb0c7bf324",
817
+ "x-amz-sns-topic-arn": "arn:aws:sns:us-west-2:123456789012:MyTopic",
818
+ "x-amz-sns-subscription-arn": "arn:aws:sns:us-west-2:123456789012:MyTopic:c9135db0-26c4-47ec-8998-413945fb5a96",
819
+ "Content-Type": "text/plain; charset=UTF-8",
820
+ "User-Agent": "Amazon Simple Notification Service Agent"
821
+ },
822
+ body: { data: {
823
+ Type: "Notification",
824
+ MessageId: "22b80b92-fdea-4c2c-8f9d-bdfb0c7bf324",
825
+ TopicArn: "arn:aws:sns:us-west-2:123456789012:MyTopic",
826
+ Subject: "Amazon S3 Notification",
827
+ Message: JSON.stringify({ Records: [{
828
+ eventVersion: "2.6",
829
+ eventSource: "aws:s3",
830
+ awsRegion: "us-west-2",
831
+ eventTime: "2024-01-15T00:00:00.000Z",
832
+ eventName: "ObjectCreated:Put",
833
+ userIdentity: { principalId: "AIDAJDPLRKLG7UEXAMPLE" },
834
+ requestParameters: { sourceIPAddress: "172.16.0.1" },
835
+ responseElements: {
836
+ "x-amz-request-id": "C3D13FE58DE4C810",
837
+ "x-amz-id-2": "FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD"
838
+ },
839
+ s3: {
840
+ s3SchemaVersion: "1.0",
841
+ configurationId: "testConfigRule",
842
+ bucket: {
843
+ name: "amzn-s3-demo-bucket",
844
+ ownerIdentity: { principalId: "A3NL1KOZZKExample" },
845
+ arn: "arn:aws:s3:::amzn-s3-demo-bucket"
846
+ },
847
+ object: {
848
+ key: "HappyFace.jpg",
849
+ size: 1024,
850
+ eTag: "d41d8cd98f00b204e9800998ecf8427e",
851
+ versionId: "096fKKXTRTtl3on89fVO.nfljtsv6qko",
852
+ sequencer: "0055AED6DCD90281E5"
853
+ }
854
+ }
855
+ }] }),
856
+ Timestamp: "2024-01-15T00:00:01.000Z",
857
+ SignatureVersion: "1",
858
+ Signature: "EXAMPLEw6JRN...",
859
+ SigningCertURL: "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
860
+ UnsubscribeURL: "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:123456789012:MyTopic:c9135db0-26c4-47ec-8998-413945fb5a96"
861
+ } }
862
+ }
863
+ };
864
+ const pollChangesFilesTriggerExamplePayload = {
865
+ payload: {
866
+ ...exampleTriggerPayloadBase,
867
+ headers: {},
868
+ body: { data: ["invoices/2024-01-15.pdf", "images/logo.png"] }
869
+ },
870
+ polledNoChanges: false
871
+ };
872
+ const pollNewBucketsTriggerExamplePayload = {
873
+ payload: {
874
+ ...exampleTriggerPayloadBase,
875
+ headers: {},
876
+ body: { data: [{
877
+ Name: "bucket-1",
878
+ CreationDate: "2024-03-08T23:30:22.000Z"
879
+ }] }
880
+ },
881
+ polledNoChanges: false
882
+ };
883
+ //#endregion
884
+ //#region src/examplePayloads/uploadStreams.ts
885
+ const createUploadStreamExamplePayload = { data: "711B632B-C025-4E26-9E34-525822E3C0ED" };
886
+ const writeUploadStreamExamplePayload = { data: null };
887
+ const closeUploadStreamExamplePayload = { data: null };
888
+ //#endregion
889
+ //#region src/constants.ts
890
+ const INPUT_EVENT_TYPES_MODEL = [
891
+ {
892
+ label: "s3:ObjectCreated:*",
893
+ value: "s3:ObjectCreated:*"
894
+ },
895
+ {
896
+ label: "s3:ObjectCreated:Put",
897
+ value: "s3:ObjectCreated:Put"
898
+ },
899
+ {
900
+ label: "s3:ObjectCreated:Post",
901
+ value: "s3:ObjectCreated:Post"
902
+ },
903
+ {
904
+ label: "s3:ObjectCreated:Copy",
905
+ value: "s3:ObjectCreated:Copy"
906
+ },
907
+ {
908
+ label: "s3:ObjectCreated:CompleteMultipartUpload",
909
+ value: "s3:ObjectCreated:CompleteMultipartUpload"
910
+ },
911
+ {
912
+ label: "s3:ObjectRemoved:*",
913
+ value: "s3:ObjectRemoved:*"
914
+ },
915
+ {
916
+ label: "s3:ObjectRemoved:Delete",
917
+ value: "s3:ObjectRemoved:Delete"
918
+ },
919
+ {
920
+ label: "s3:ObjectRemoved:DeleteMarkerCreated",
921
+ value: "s3:ObjectRemoved:DeleteMarkerCreated"
922
+ },
923
+ {
924
+ label: "s3:ObjectRestore:*",
925
+ value: "s3:ObjectRestore:*"
926
+ },
927
+ {
928
+ label: "s3:ObjectRestore:Post",
929
+ value: "s3:ObjectRestore:Post"
930
+ },
931
+ {
932
+ label: "s3:ObjectRestore:Completed",
933
+ value: "s3:ObjectRestore:Completed"
934
+ },
935
+ {
936
+ label: "s3:ObjectRestore:Delete",
937
+ value: "s3:ObjectRestore:Delete"
938
+ },
939
+ {
940
+ label: "s3:ReducedRedundancyLostObject",
941
+ value: "s3:ReducedRedundancyLostObject"
942
+ },
943
+ {
944
+ label: "s3:Replication:*",
945
+ value: "s3:Replication:*"
946
+ },
947
+ {
948
+ label: "s3:Replication:OperationFailedReplication",
949
+ value: "s3:Replication:OperationFailedReplication"
950
+ },
951
+ {
952
+ label: "s3:Replication:OperationMissedThreshold",
953
+ value: "s3:Replication:OperationMissedThreshold"
954
+ },
955
+ {
956
+ label: "s3:Replication:OperationReplicatedAfterThreshold",
957
+ value: "s3:Replication:OperationReplicatedAfterThreshold"
958
+ },
959
+ {
960
+ label: "s3:Replication:OperationNotTracked",
961
+ value: "s3:Replication:OperationNotTracked"
962
+ },
963
+ {
964
+ label: "s3:LifecycleExpiration:*",
965
+ value: "s3:LifecycleExpiration:*"
966
+ },
967
+ {
968
+ label: "s3:LifecycleExpiration:Delete",
969
+ value: "s3:LifecycleExpiration:Delete"
970
+ },
971
+ {
972
+ label: "s3:LifecycleExpiration:DeleteMarkerCreated",
973
+ value: "s3:LifecycleExpiration:DeleteMarkerCreated"
974
+ },
975
+ {
976
+ label: "s3:LifecycleTransition",
977
+ value: "s3:LifecycleTransition"
978
+ },
979
+ {
980
+ label: "s3:IntelligentTiering",
981
+ value: "s3:IntelligentTiering"
982
+ },
983
+ {
984
+ label: "s3:ObjectTagging:*",
985
+ value: "s3:ObjectTagging:*"
986
+ },
987
+ {
988
+ label: "s3:ObjectTagging:Put",
989
+ value: "s3:ObjectTagging:Put"
990
+ },
991
+ {
992
+ label: "s3:ObjectTagging:Delete",
993
+ value: "s3:ObjectTagging:Delete"
994
+ },
995
+ {
996
+ label: "s3:ObjectAcl:Put",
997
+ value: "s3:ObjectAcl:Put"
998
+ }
999
+ ];
1000
+ const TOPIC_CONFIGURATIONS_EXAMPLE = [{
1001
+ Id: "topic-1",
1002
+ TopicArn: "arn:aws:sns:us-west-2:123456789012:mytopic",
1003
+ Events: ["s3:ObjectCreated:*"],
1004
+ Filter: { Key: { FilterRules: [{
1005
+ Name: "prefix",
1006
+ Value: "images/"
1007
+ }] } }
1008
+ }];
1009
+ const QUEUE_CONFIGURATIONS_EXAMPLE = [{
1010
+ Id: "queue-1",
1011
+ QueueArn: "arn:aws:sqs:us-west-2:123456789012:myqueue",
1012
+ Events: ["s3:ObjectCreated:*"],
1013
+ Filter: { Key: { FilterRules: [{
1014
+ Name: "prefix",
1015
+ Value: "images/"
1016
+ }] } }
1017
+ }];
1018
+ const LAMBDA_FUNCTION_CONFIGURATIONS_EXAMPLE = [{
1019
+ Id: "lambda-1",
1020
+ LambdaFunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:my-function",
1021
+ Events: ["s3:ObjectCreated:*"],
1022
+ Filter: { Key: { FilterRules: [{
1023
+ Name: "prefix",
1024
+ Value: "images/"
1025
+ }] } }
1026
+ }];
1027
+ const EVENT_BRIDGE_CONFIGURATION_EXAMPLE = {
1028
+ Id: "event-bridge-1",
1029
+ EventBridgeArn: "arn:aws:eventbridge:us-west-2:123456789012:myeventbridge",
1030
+ Events: ["s3:ObjectCreated:*"],
1031
+ Filter: { Key: { FilterRules: [{
1032
+ Name: "prefix",
1033
+ Value: "images/"
1034
+ }] } }
1035
+ };
1036
+ const OBJECT_ATTRIBUTES = [
1037
+ "ETag",
1038
+ "Checksum",
1039
+ "ObjectParts",
1040
+ "StorageClass",
1041
+ "ObjectSize"
1042
+ ];
1043
+ const LIST_OBJECTS_V2_MAX_KEYS = 1e3;
1044
+ const LIST_BUCKETS_MAX_BUCKETS = 1e4;
1045
+ const LOOK_BACK_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
1046
+ //#endregion
1047
+ //#region src/utils/bucketNotifications.ts
1048
+ const parseConfigurationValue = (value) => {
1049
+ if (value === void 0 || value === null || value === "") return void 0;
1050
+ return typeof value === "string" ? JSON.parse(value) : value;
1051
+ };
1052
+ const parseConfigurationArray = (value, label, example) => {
1053
+ const parsed = parseConfigurationValue(value);
1054
+ if (parsed === void 0) return void 0;
1055
+ if (!Array.isArray(parsed)) throw new Error(`${label} must be an array with the following structure: ${JSON.stringify(example)}`);
1056
+ return parsed;
1057
+ };
1058
+ const getTopicConfigurations = (topicConfigurations) => parseConfigurationArray(topicConfigurations, "Topic configurations", TOPIC_CONFIGURATIONS_EXAMPLE);
1059
+ const getQueueConfigurations = (queueConfigurations) => parseConfigurationArray(queueConfigurations, "Queue configurations", QUEUE_CONFIGURATIONS_EXAMPLE);
1060
+ const getLambdaFunctionConfigurations = (lambdaFunctionConfigurations) => parseConfigurationArray(lambdaFunctionConfigurations, "Lambda function configurations", LAMBDA_FUNCTION_CONFIGURATIONS_EXAMPLE);
1061
+ const getEventBridgeConfiguration = (eventBridgeConfiguration) => parseConfigurationValue(eventBridgeConfiguration);
1062
+ const getBucketNotificationConfiguration$1 = async (s3Client, bucket, bucketOwnerAccountid, removeMetadata = true) => {
1063
+ const getBucketNotificationConfigurationCommand = new _aws_sdk_client_s3.GetBucketNotificationConfigurationCommand({
1064
+ Bucket: bucket,
1065
+ ExpectedBucketOwner: bucketOwnerAccountid
1066
+ });
1067
+ const getBucketNotificationConfigurationCommandOutput = await s3Client.send(getBucketNotificationConfigurationCommand);
1068
+ if (removeMetadata) getBucketNotificationConfigurationCommandOutput.$metadata = void 0;
1069
+ return getBucketNotificationConfigurationCommandOutput;
1070
+ };
1071
+ const putBucketNotificationConfiguration$1 = async (s3Client, bucket, notificationConfiguration) => {
1072
+ const putBucketNotificationConfigurationCommand = new _aws_sdk_client_s3.PutBucketNotificationConfigurationCommand({
1073
+ Bucket: bucket,
1074
+ NotificationConfiguration: notificationConfiguration,
1075
+ SkipDestinationValidation: true
1076
+ });
1077
+ return await s3Client.send(putBucketNotificationConfigurationCommand);
1078
+ };
1079
+ const processTopicConfiguration = async (s3Client, bucket, bucketOwnerAccountid, eventNotificationName, topicConfiguration) => {
1080
+ const notificationConfiguration = await getBucketNotificationConfiguration$1(s3Client, bucket, bucketOwnerAccountid);
1081
+ if (!("TopicConfigurations" in notificationConfiguration)) notificationConfiguration.TopicConfigurations = [];
1082
+ let existingTopicConfigurationIndex = -1;
1083
+ notificationConfiguration.TopicConfigurations.find((topicConfiguration, index) => {
1084
+ const topicConfigurationIdEqualsEventNotificationName = topicConfiguration.Id === eventNotificationName;
1085
+ if (topicConfigurationIdEqualsEventNotificationName) existingTopicConfigurationIndex = index;
1086
+ return topicConfigurationIdEqualsEventNotificationName;
1087
+ });
1088
+ if (existingTopicConfigurationIndex === -1) notificationConfiguration.TopicConfigurations.push(topicConfiguration);
1089
+ else notificationConfiguration.TopicConfigurations[existingTopicConfigurationIndex] = topicConfiguration;
1090
+ return await putBucketNotificationConfiguration$1(s3Client, bucket, notificationConfiguration);
1091
+ };
1092
+ //#endregion
1093
+ //#region src/utils/buckets.ts
1094
+ const listAllBuckets = async (s3) => {
1095
+ const buckets = [];
1096
+ let continuationToken;
1097
+ do {
1098
+ const response = await s3.send(new _aws_sdk_client_s3.ListBucketsCommand({
1099
+ MaxBuckets: LIST_BUCKETS_MAX_BUCKETS,
1100
+ ContinuationToken: continuationToken
1101
+ }));
1102
+ buckets.push(...response.Buckets ?? []);
1103
+ continuationToken = response.ContinuationToken;
1104
+ } while (continuationToken);
1105
+ return buckets;
1106
+ };
1107
+ //#endregion
1108
+ //#region src/utils/clean.ts
1109
+ const cleanString = (value) => {
1110
+ const str = _prismatic_io_spectral.util.types.toString(value).trim();
1111
+ return str ? str : void 0;
1112
+ };
1113
+ const toPositiveInt = (value, fallback) => {
1114
+ const str = cleanString(value);
1115
+ if (str === void 0) return fallback;
1116
+ if (!/^\d+$/.test(str) || Number(str) < 1) throw new Error(`"${str}" must be a whole number greater than 0.`);
1117
+ return Number(str);
1118
+ };
1119
+ const toOptionalInt = (value) => cleanString(value) === void 0 ? void 0 : _prismatic_io_spectral.util.types.toInt(value) || void 0;
1120
+ const toTrimmedStringArray = (value) => value.map((item) => _prismatic_io_spectral.util.types.toString(item).trim());
1121
+ const toObjectCannedACL = (value) => _prismatic_io_spectral.util.types.toString(value);
1122
+ const toObjectLockRetentionMode = (value) => _prismatic_io_spectral.util.types.toString(value);
1123
+ const toBufferFromData = (value) => _prismatic_io_spectral.util.types.isBufferDataPayload(value) ? value.data : value;
1124
+ const toKeyValuePairList = (value) => value;
1125
+ const toPartList = (value) => value;
1126
+ const getObjectIdentifiers = (objectKeys) => {
1127
+ if (Array.isArray(objectKeys)) return objectKeys.map((key) => ({ Key: key }));
1128
+ return [];
1129
+ };
1130
+ const getObjectAttributes$1 = (attributes) => {
1131
+ if (Array.isArray(attributes)) {
1132
+ if (attributes.length === 0) throw new Error("Object Attributes must contain at least one attribute");
1133
+ return attributes;
1134
+ }
1135
+ };
1136
+ const lookBackDateClean = (value) => {
1137
+ const raw = cleanString(value);
1138
+ if (raw === void 0) return "";
1139
+ const match = typeof value === "string" ? raw.match(LOOK_BACK_DATE_PATTERN) : null;
1140
+ if (!match) throw new Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${raw}`);
1141
+ const [, yearStr, monthStr, dayStr] = match;
1142
+ const year = Number(yearStr);
1143
+ const month = Number(monthStr);
1144
+ const day = Number(dayStr);
1145
+ const parsed = new Date(Date.UTC(year, month - 1, day));
1146
+ if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) throw new Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${raw}`);
1147
+ if (parsed.getTime() > Date.now()) throw new Error(`Look-back Date cannot be a future date. Received: ${raw}`);
1148
+ return parsed.toISOString();
1149
+ };
1150
+ //#endregion
1151
+ //#region src/utils/polling.ts
1152
+ const objectMapper = (object, key) => {
1153
+ return {
1154
+ ...object,
1155
+ [key]: new Date(object[key]).toISOString()
1156
+ };
1157
+ };
1158
+ const floorToSecond = (timestamp) => (/* @__PURE__ */ new Date(Math.floor(Date.parse(timestamp) / 1e3) * 1e3)).toISOString();
1159
+ const readLastPolledAt = (context, now, lookBackDate) => {
1160
+ const pollState = context.polling.getState();
1161
+ const since = pollState.lastPolledAt || lookBackDate || now;
1162
+ const inclusive = !pollState.lastPolledAt && Boolean(lookBackDate);
1163
+ context.logger.debug(`Polled for changes from: ${since} to ${now}`);
1164
+ if (context.debug.enabled) context.logger.debug(`Polling state: ${JSON.stringify(pollState)}`);
1165
+ return {
1166
+ since,
1167
+ inclusive
1168
+ };
1169
+ };
1170
+ const resolveFileListingWindow = (state, incoming, isBatching, lookBackDate, now) => {
1171
+ const inFlight = isBatching ? incoming ?? state.cursor : void 0;
1172
+ if (inFlight) return inFlight;
1173
+ const windowEnd = floorToSecond(now);
1174
+ return {
1175
+ windowStart: state.lastPolledAt || lookBackDate || windowEnd,
1176
+ windowEnd
1177
+ };
1178
+ };
1179
+ const listObjectsInWindow = async (s3, bucket, { windowStart, windowEnd, startAfter }, singlePage) => {
1180
+ const keys = [];
1181
+ let resumeAfter = startAfter;
1182
+ do {
1183
+ const response = await s3.send(new _aws_sdk_client_s3.ListObjectsV2Command({
1184
+ Bucket: bucket,
1185
+ MaxKeys: LIST_OBJECTS_V2_MAX_KEYS,
1186
+ StartAfter: resumeAfter
1187
+ }));
1188
+ const contents = response.Contents ?? [];
1189
+ for (const object of contents) {
1190
+ const { Key, LastModified } = objectMapper(object, "LastModified");
1191
+ if (Key !== void 0 && LastModified >= windowStart && LastModified < windowEnd) keys.push(Key);
1192
+ }
1193
+ resumeAfter = response.IsTruncated ? contents[contents.length - 1]?.Key : void 0;
1194
+ } while (resumeAfter && !singlePage);
1195
+ return {
1196
+ keys,
1197
+ startAfter: resumeAfter
1198
+ };
1199
+ };
1200
+ const listBucketsCreatedSince = async (s3, since, inclusive = false) => {
1201
+ return (await listAllBuckets(s3)).map((bucket) => objectMapper(bucket, "CreationDate")).filter(({ CreationDate }) => inclusive ? CreationDate >= since : CreationDate > since);
1202
+ };
1203
+ const resolvePolledFileChanges = (data) => (data ?? []).map((record) => ({
1204
+ changeType: "changed",
1205
+ record
1206
+ }));
1207
+ const resolvePolledBucketChanges = (data) => (data ?? []).map((record) => ({
1208
+ changeType: "created",
1209
+ record
1210
+ }));
1211
+ //#endregion
1212
+ //#region src/utils/snsMessages.ts
1213
+ const SNS_HOSTNAME = /^sns\.[a-z0-9-]+\.amazonaws\.com(\.cn)?$/;
1214
+ const SIGNED_FIELDS = {
1215
+ Notification: [
1216
+ "Message",
1217
+ "MessageId",
1218
+ "Subject",
1219
+ "Timestamp",
1220
+ "TopicArn",
1221
+ "Type"
1222
+ ],
1223
+ SubscriptionConfirmation: [
1224
+ "Message",
1225
+ "MessageId",
1226
+ "SubscribeURL",
1227
+ "Timestamp",
1228
+ "Token",
1229
+ "TopicArn",
1230
+ "Type"
1231
+ ],
1232
+ UnsubscribeConfirmation: [
1233
+ "Message",
1234
+ "MessageId",
1235
+ "SubscribeURL",
1236
+ "Timestamp",
1237
+ "Token",
1238
+ "TopicArn",
1239
+ "Type"
1240
+ ]
1241
+ };
1242
+ const SIGNATURE_ALGORITHMS = {
1243
+ "1": "sha1",
1244
+ "2": "sha256"
1245
+ };
1246
+ const assertSnsUrl = (value, field) => {
1247
+ let url;
1248
+ try {
1249
+ url = new URL(String(value));
1250
+ } catch {
1251
+ url = void 0;
1252
+ }
1253
+ if (url?.protocol !== "https:" || !SNS_HOSTNAME.test(url.hostname)) throw new Error(`${field} must be an HTTPS URL on an Amazon SNS domain.`);
1254
+ return url;
1255
+ };
1256
+ const downloadCertificate = async (certificateUrl) => {
1257
+ const { data } = await (0, _prismatic_io_spectral_http.createClient)({
1258
+ baseUrl: certificateUrl,
1259
+ responseType: "text"
1260
+ }).get("");
1261
+ return data;
1262
+ };
1263
+ const verifySnsMessageSignature = async (message, fetchCertificate = downloadCertificate) => {
1264
+ const algorithm = SIGNATURE_ALGORITHMS[message.SignatureVersion];
1265
+ if (!algorithm) throw new Error(`Unsupported Amazon SNS SignatureVersion "${message.SignatureVersion}".`);
1266
+ const certificate = await fetchCertificate(assertSnsUrl(message.SigningCertURL, "SigningCertURL").href);
1267
+ if (!(typeof message.Signature === "string" && message.Signature.length > 0 && (0, node_crypto.verify)(algorithm, Buffer.from(buildSnsStringToSign(message)), certificate, Buffer.from(message.Signature, "base64")))) throw new Error("Amazon SNS message signature is invalid; the message was rejected.");
1268
+ };
1269
+ const buildSnsStringToSign = (message) => (SIGNED_FIELDS[message.Type] ?? []).filter((field) => message[field] !== void 0).map((field) => `${field}\n${message[field]}\n`).join("");
1270
+ //#endregion
1271
+ //#region src/utils/tags.ts
1272
+ const encodeTags = (tags) => node_querystring.default.encode(_prismatic_io_spectral.util.types.keyValPairListToObject(tags || []));
1273
+ //#endregion
1274
+ //#region src/utils/uploadStreams.ts
1275
+ const getUploadStream = (executionState, uploadId) => {
1276
+ const uploadStream = executionState[uploadId];
1277
+ if (!uploadStream) throw new Error(`Upload stream "${uploadId}" was not found. Upload streams exist only within the execution that created them; use the ID returned by Create Upload Stream in the same execution.`);
1278
+ return uploadStream;
1279
+ };
1280
+ //#endregion
1281
+ //#region src/inputs/common.ts
1282
+ const objectKey = (0, _prismatic_io_spectral.input)({
1283
+ label: "Object Key",
1284
+ placeholder: "Enter object key",
1285
+ type: "string",
1286
+ required: true,
1287
+ comments: "An object in S3 is a file that is saved in a 'bucket'. This represents the object's key (file path). Do not include a leading /.",
1288
+ example: "path/to/file.txt",
1289
+ clean: _prismatic_io_spectral.util.types.toString
1290
+ });
1291
+ const fileContents = (0, _prismatic_io_spectral.input)({
1292
+ label: "File Contents",
1293
+ placeholder: "Output data from previous step or string content",
1294
+ type: "data",
1295
+ required: true,
1296
+ comments: "The contents to write to the object. Accepts text strings or binary data (images, PDFs, etc.) from previous steps.",
1297
+ example: "My File Contents",
1298
+ clean: _prismatic_io_spectral.util.types.toData
1299
+ });
1300
+ const bucket = (0, _prismatic_io_spectral.input)({
1301
+ label: "Bucket Name",
1302
+ placeholder: "Enter bucket name",
1303
+ type: "string",
1304
+ required: true,
1305
+ comments: "An Amazon S3 'bucket' is a container where files are stored. Buckets can be created from within the AWS console. Bucket names contain only letters, numbers, and dashes.",
1306
+ example: "my-s3-bucket-abc123",
1307
+ dataSource: "selectBucket",
1308
+ clean: _prismatic_io_spectral.util.types.toString
1309
+ });
1310
+ const tagging = (0, _prismatic_io_spectral.input)({
1311
+ label: "Object Tags",
1312
+ placeholder: "Enter tag value",
1313
+ type: "string",
1314
+ collection: "keyvaluelist",
1315
+ required: false,
1316
+ comments: "Key-value pairs to tag the object for filtering and organization. For more information, see [S3 Object Tagging](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html).",
1317
+ example: "Environment, Production",
1318
+ clean: toKeyValuePairList
1319
+ });
1320
+ const accessKeyInput = (0, _prismatic_io_spectral.input)({
1321
+ label: "Connection",
1322
+ type: "connection",
1323
+ required: false,
1324
+ comments: "The AWS S3 connection to use for authentication. Access keys provide programmatic access to AWS resources. [Learn more](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)."
1325
+ });
1326
+ const acl = (0, _prismatic_io_spectral.input)({
1327
+ label: "ACL Permissions",
1328
+ comments: "Canned ACL permissions to apply to the object. For more information, see [S3 Canned ACLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl).",
1329
+ type: "string",
1330
+ model: [
1331
+ {
1332
+ label: "BUCKET DEFAULT",
1333
+ value: ""
1334
+ },
1335
+ {
1336
+ label: "authenticated-read",
1337
+ value: "authenticated-read"
1338
+ },
1339
+ {
1340
+ label: "aws-exec-read",
1341
+ value: "aws-exec-read"
1342
+ },
1343
+ {
1344
+ label: "bucket-owner-full-control",
1345
+ value: "bucket-owner-full-control"
1346
+ },
1347
+ {
1348
+ label: "bucket-owner-read",
1349
+ value: "bucket-owner-read"
1350
+ },
1351
+ {
1352
+ label: "private",
1353
+ value: "private"
1354
+ },
1355
+ {
1356
+ label: "public-read",
1357
+ value: "public-read"
1358
+ },
1359
+ {
1360
+ label: "public-read-write",
1361
+ value: "public-read-write"
1362
+ }
1363
+ ],
1364
+ default: "",
1365
+ clean: toObjectCannedACL
1366
+ });
1367
+ const expirationSeconds = (0, _prismatic_io_spectral.input)({
1368
+ label: "Expiration Seconds",
1369
+ type: "string",
1370
+ required: true,
1371
+ default: "3600",
1372
+ placeholder: "Enter seconds (e.g., 3600 for 1 hour)",
1373
+ comments: "Number of seconds until the presigned URL expires. Default is 3600 (1 hour).",
1374
+ clean: _prismatic_io_spectral.util.types.toInt
1375
+ });
1376
+ const versionId = (0, _prismatic_io_spectral.input)({
1377
+ label: "Version ID",
1378
+ type: "string",
1379
+ required: false,
1380
+ placeholder: "Enter version ID",
1381
+ example: "AMn71WZYnWqbvfy0unBOdtaBC.DRiN_r",
1382
+ comments: "The version ID of the object to apply the retention configuration to.",
1383
+ clean: cleanString
1384
+ });
1385
+ //#endregion
1386
+ //#region src/inputs/bucketNotifications.ts
1387
+ const topicConfigurations = (0, _prismatic_io_spectral.input)({
1388
+ label: "Topic Configurations",
1389
+ type: "code",
1390
+ language: "json",
1391
+ placeholder: "Enter topic configurations JSON",
1392
+ required: false,
1393
+ default: JSON.stringify(TOPIC_CONFIGURATIONS_EXAMPLE, null, 2),
1394
+ example: JSON.stringify(TOPIC_CONFIGURATIONS_EXAMPLE, null, 2),
1395
+ comments: "List of SNS topic configurations for bucket event notifications. For more information, see [S3 Event Notifications](https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html).",
1396
+ clean: getTopicConfigurations
1397
+ });
1398
+ const queueConfigurations = (0, _prismatic_io_spectral.input)({
1399
+ label: "Queue Configurations",
1400
+ type: "code",
1401
+ language: "json",
1402
+ placeholder: "Enter queue configurations JSON",
1403
+ required: false,
1404
+ default: JSON.stringify(QUEUE_CONFIGURATIONS_EXAMPLE, null, 2),
1405
+ example: JSON.stringify(QUEUE_CONFIGURATIONS_EXAMPLE, null, 2),
1406
+ comments: "List of SQS queue configurations for bucket event notifications. For more information, see [S3 Event Notifications](https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html).",
1407
+ clean: getQueueConfigurations
1408
+ });
1409
+ const lambdaFunctionConfigurations = (0, _prismatic_io_spectral.input)({
1410
+ label: "Lambda Function Configurations",
1411
+ type: "code",
1412
+ language: "json",
1413
+ placeholder: "Enter Lambda function configurations JSON",
1414
+ required: false,
1415
+ default: JSON.stringify(LAMBDA_FUNCTION_CONFIGURATIONS_EXAMPLE, null, 2),
1416
+ example: JSON.stringify(LAMBDA_FUNCTION_CONFIGURATIONS_EXAMPLE, null, 2),
1417
+ comments: "List of Lambda function configurations for bucket event notifications. For more information, see [S3 Event Notifications](https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html).",
1418
+ clean: getLambdaFunctionConfigurations
1419
+ });
1420
+ const eventBridgeConfiguration = (0, _prismatic_io_spectral.input)({
1421
+ label: "EventBridge Configuration",
1422
+ type: "code",
1423
+ language: "json",
1424
+ placeholder: "Enter EventBridge configuration JSON",
1425
+ required: false,
1426
+ default: JSON.stringify(EVENT_BRIDGE_CONFIGURATION_EXAMPLE, null, 2),
1427
+ example: JSON.stringify(EVENT_BRIDGE_CONFIGURATION_EXAMPLE, null, 2),
1428
+ comments: "EventBridge configuration for bucket event notifications. For more information, see [Using EventBridge with S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html).",
1429
+ clean: getEventBridgeConfiguration
1430
+ });
1431
+ const getBucketNotificationConfigurationInputs = {
1432
+ accessKey: accessKeyInput,
1433
+ ...dynamicAccessAllInputs,
1434
+ bucket,
1435
+ awsRegion
1436
+ };
1437
+ const putBucketNotificationConfigurationInputs = {
1438
+ accessKey: accessKeyInput,
1439
+ ...dynamicAccessAllInputs,
1440
+ bucket,
1441
+ topicConfigurations,
1442
+ queueConfigurations,
1443
+ lambdaFunctionConfigurations,
1444
+ eventBridgeConfiguration,
1445
+ awsRegion
1446
+ };
1447
+ //#endregion
1448
+ //#region src/inputs/buckets.ts
1449
+ const deleteBucketInputs = {
1450
+ accessKey: accessKeyInput,
1451
+ ...dynamicAccessAllInputs,
1452
+ bucket,
1453
+ awsRegion
1454
+ };
1455
+ const getBucketLocationInputs = {
1456
+ accessKey: accessKeyInput,
1457
+ ...dynamicAccessAllInputs,
1458
+ bucket
1459
+ };
1460
+ const headBucketInputs = {
1461
+ accessKey: accessKeyInput,
1462
+ ...dynamicAccessAllInputs,
1463
+ bucket,
1464
+ awsRegion
1465
+ };
1466
+ const listBucketsInputs = {
1467
+ accessKey: accessKeyInput,
1468
+ ...dynamicAccessAllInputs,
1469
+ awsRegion
1470
+ };
1471
+ //#endregion
1472
+ //#region src/inputs/dataSources.ts
1473
+ const selectBucketInputs = {
1474
+ accessKey: accessKeyInput,
1475
+ ...dynamicAccessAllInputs
1476
+ };
1477
+ //#endregion
1478
+ //#region src/inputs/misc.ts
1479
+ const getCurrentAccountInputs = {
1480
+ accessKey: accessKeyInput,
1481
+ ...dynamicAccessAllInputs
1482
+ };
1483
+ //#endregion
1484
+ //#region src/inputs/multipartUploads.ts
1485
+ const urlsToGenerate = (0, _prismatic_io_spectral.input)({
1486
+ label: "URLs to Generate",
1487
+ type: "string",
1488
+ required: true,
1489
+ default: "5",
1490
+ placeholder: "Enter number of URLs",
1491
+ example: "10",
1492
+ comments: "The number of presigned URLs to generate for multipart uploads.",
1493
+ clean: (value) => toPositiveInt(value, 5)
1494
+ });
1495
+ const uploadId = (0, _prismatic_io_spectral.input)({
1496
+ label: "Upload ID",
1497
+ type: "string",
1498
+ required: true,
1499
+ comments: "The unique identifier for the multipart upload, returned by 'Create Multipart Upload' action.",
1500
+ clean: _prismatic_io_spectral.util.types.toString,
1501
+ example: "xadcOB_7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg",
1502
+ placeholder: "Enter multipart upload ID"
1503
+ });
1504
+ const fileChunk = (0, _prismatic_io_spectral.input)({
1505
+ label: "File Chunk",
1506
+ type: "data",
1507
+ required: true,
1508
+ comments: "The binary data chunk to upload as part of a multipart upload. Reference output from a previous step.",
1509
+ placeholder: "Select file chunk data",
1510
+ clean: toBufferFromData
1511
+ });
1512
+ const partNumber = (0, _prismatic_io_spectral.input)({
1513
+ label: "Part Number",
1514
+ type: "string",
1515
+ required: true,
1516
+ comments: "The part number for this chunk in the multipart upload sequence (1-10,000).",
1517
+ placeholder: "Enter part number (1-10,000)",
1518
+ example: "1",
1519
+ clean: _prismatic_io_spectral.util.types.toInt
1520
+ });
1521
+ const parts = (0, _prismatic_io_spectral.input)({
1522
+ label: "Parts",
1523
+ type: "data",
1524
+ comments: "The list of uploaded parts to complete the multipart upload. Reference the 'Parts' field from the 'List Parts' action output.",
1525
+ placeholder: "Select parts data from List Parts action",
1526
+ required: true,
1527
+ clean: toPartList
1528
+ });
1529
+ const abortMultipartUploadInputs = {
1530
+ accessKey: accessKeyInput,
1531
+ ...dynamicAccessAllInputs,
1532
+ bucket,
1533
+ objectKey,
1534
+ uploadId,
1535
+ awsRegion
1536
+ };
1537
+ const completeMultipartUploadInputs = {
1538
+ accessKey: accessKeyInput,
1539
+ ...dynamicAccessAllInputs,
1540
+ bucket,
1541
+ objectKey,
1542
+ uploadId,
1543
+ parts,
1544
+ awsRegion
1545
+ };
1546
+ const createMultipartUploadInputs = {
1547
+ accessKey: accessKeyInput,
1548
+ ...dynamicAccessAllInputs,
1549
+ bucket,
1550
+ objectKey,
1551
+ tagging,
1552
+ acl,
1553
+ awsRegion
1554
+ };
1555
+ const generatePresignedForMultiparUploadsInputs = {
1556
+ accessKey: accessKeyInput,
1557
+ ...dynamicAccessAllInputs,
1558
+ bucket,
1559
+ objectKey,
1560
+ urlsToGenerate,
1561
+ uploadId,
1562
+ expirationSeconds,
1563
+ awsRegion
1564
+ };
1565
+ const listMultipartUploadsInputs = {
1566
+ accessKey: accessKeyInput,
1567
+ ...dynamicAccessAllInputs,
1568
+ bucket,
1569
+ awsRegion
1570
+ };
1571
+ const listPartsInputs = {
1572
+ accessKey: accessKeyInput,
1573
+ ...dynamicAccessAllInputs,
1574
+ bucket,
1575
+ objectKey,
1576
+ uploadId,
1577
+ awsRegion
1578
+ };
1579
+ const uploadPartInputs = {
1580
+ accessKey: accessKeyInput,
1581
+ ...dynamicAccessAllInputs,
1582
+ bucket,
1583
+ objectKey,
1584
+ uploadId,
1585
+ partNumber,
1586
+ fileChunk,
1587
+ awsRegion
1588
+ };
1589
+ //#endregion
1590
+ //#region src/inputs/objectLock.ts
1591
+ const defaultRetentionDays = (0, _prismatic_io_spectral.input)({
1592
+ label: "Default Retention Days",
1593
+ type: "string",
1594
+ required: false,
1595
+ placeholder: "Enter retention days",
1596
+ example: "90",
1597
+ comments: "Number of days for the default retention period. Mutually exclusive with Default Retention Years.",
1598
+ clean: _prismatic_io_spectral.util.types.toInt
1599
+ });
1600
+ const defaultRetentionYears = (0, _prismatic_io_spectral.input)({
1601
+ label: "Default Retention Years",
1602
+ type: "string",
1603
+ required: false,
1604
+ placeholder: "Enter retention years",
1605
+ example: "7",
1606
+ comments: "Number of years for the default retention period. Mutually exclusive with Default Retention Days.",
1607
+ clean: _prismatic_io_spectral.util.types.toInt
1608
+ });
1609
+ const defaultRetentionMode = (0, _prismatic_io_spectral.input)({
1610
+ label: "Default Retention Mode",
1611
+ type: "string",
1612
+ required: false,
1613
+ comments: "Object Lock retention mode for new objects. Must be used with either Default Retention Days or Years. For more information, see [S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html).",
1614
+ placeholder: "Select retention mode",
1615
+ model: [
1616
+ {
1617
+ label: "Unset",
1618
+ value: ""
1619
+ },
1620
+ {
1621
+ label: "Governance",
1622
+ value: "GOVERNANCE"
1623
+ },
1624
+ {
1625
+ label: "Compliance",
1626
+ value: "COMPLIANCE"
1627
+ }
1628
+ ],
1629
+ clean: toObjectLockRetentionMode
1630
+ });
1631
+ const retainUntilDate = (0, _prismatic_io_spectral.input)({
1632
+ label: "Retain Until Date",
1633
+ type: "string",
1634
+ placeholder: "Enter date (YYYY-MM-DDTHH:MM:SSZ)",
1635
+ example: "2025-12-31T23:59:59.000Z",
1636
+ required: false,
1637
+ comments: "The date and time when Object Retention expires. Required when using Retention Mode. Must be in ISO 8601 format.",
1638
+ clean: _prismatic_io_spectral.util.types.toString
1639
+ });
1640
+ const getObjectLockConfigurationInputs = {
1641
+ accessKey: accessKeyInput,
1642
+ ...dynamicAccessAllInputs,
1643
+ bucket,
1644
+ awsRegion
1645
+ };
1646
+ const getObjectRetentionInputs = {
1647
+ accessKey: accessKeyInput,
1648
+ ...dynamicAccessAllInputs,
1649
+ bucket,
1650
+ objectKey,
1651
+ versionId: {
1652
+ ...versionId,
1653
+ comments: "The version ID for the object whose retention settings to retrieve."
1654
+ },
1655
+ awsRegion
1656
+ };
1657
+ const putObjectLockConfigurationInputs = {
1658
+ accessKey: accessKeyInput,
1659
+ ...dynamicAccessAllInputs,
1660
+ bucket,
1661
+ defaultRetentionMode,
1662
+ defaultRetentionDays,
1663
+ defaultRetentionYears,
1664
+ awsRegion
1665
+ };
1666
+ const putObjectRetentionInputs = {
1667
+ accessKey: accessKeyInput,
1668
+ ...dynamicAccessAllInputs,
1669
+ bucket,
1670
+ objectKey,
1671
+ retentionMode: {
1672
+ ...defaultRetentionMode,
1673
+ label: "Retention Mode",
1674
+ comments: "Retention mode for the specified object. Required when Retain Until Date is set."
1675
+ },
1676
+ retainUntilDate,
1677
+ versionId,
1678
+ awsRegion
1679
+ };
1680
+ //#endregion
1681
+ //#region src/inputs/objects.ts
1682
+ const objectKeys = (0, _prismatic_io_spectral.input)({
1683
+ label: "Object Keys",
1684
+ placeholder: "Enter object keys",
1685
+ type: "string",
1686
+ collection: "valuelist",
1687
+ required: true,
1688
+ comments: "A list of object keys to delete. These are the file paths of the objects to delete. Do not include a leading /.",
1689
+ example: "path/to/file1.txt",
1690
+ clean: getObjectIdentifiers
1691
+ });
1692
+ const sourceKey = (0, _prismatic_io_spectral.input)({
1693
+ label: "Source Key",
1694
+ placeholder: "Enter source object key",
1695
+ type: "string",
1696
+ required: true,
1697
+ comments: "The source object's key (file path) to copy from. Do not include a leading /.",
1698
+ example: "backups/2024/database-backup.sql",
1699
+ clean: _prismatic_io_spectral.util.types.toString
1700
+ });
1701
+ const destinationKey = (0, _prismatic_io_spectral.input)({
1702
+ label: "Destination Key",
1703
+ placeholder: "Enter destination object key",
1704
+ type: "string",
1705
+ required: true,
1706
+ comments: "The destination object's key (file path) to copy to. Do not include a leading /.",
1707
+ example: "archive/2024/database-backup.sql",
1708
+ clean: _prismatic_io_spectral.util.types.toString
1709
+ });
1710
+ const sourceBucket = (0, _prismatic_io_spectral.input)({
1711
+ label: "Source Bucket Name",
1712
+ placeholder: "Enter source bucket name",
1713
+ type: "string",
1714
+ required: true,
1715
+ comments: "The source bucket containing the object to copy. For same-bucket copies, use the same name for both source and destination buckets.",
1716
+ example: "my-company-data-prod",
1717
+ clean: _prismatic_io_spectral.util.types.toString
1718
+ });
1719
+ const destinationBucket = (0, _prismatic_io_spectral.input)({
1720
+ label: "Destination Bucket Name",
1721
+ placeholder: "Enter destination bucket name",
1722
+ type: "string",
1723
+ required: true,
1724
+ comments: "The destination bucket where the object will be copied. For same-bucket copies, use the same name for both source and destination buckets.",
1725
+ example: "my-company-archive",
1726
+ clean: _prismatic_io_spectral.util.types.toString
1727
+ });
1728
+ const prefix = (0, _prismatic_io_spectral.input)({
1729
+ label: "Prefix",
1730
+ placeholder: "Enter prefix",
1731
+ type: "string",
1732
+ required: false,
1733
+ default: "",
1734
+ comments: "List only objects prefixed with this string. For example, to list only files in a directory called 'unprocessed', enter 'unprocessed/'. If this is left blank, all files in the selected bucket will be listed.",
1735
+ example: "path/to/files/",
1736
+ clean: _prismatic_io_spectral.util.types.toString
1737
+ });
1738
+ const pagination = (0, _prismatic_io_spectral.structuredObjectInput)({
1739
+ label: "Pagination",
1740
+ required: false,
1741
+ comments: "Cursor and page-size controls for paging through results.",
1742
+ inputs: {
1743
+ maxKeys: (0, _prismatic_io_spectral.input)({
1744
+ label: "Max Keys",
1745
+ type: "string",
1746
+ required: false,
1747
+ comments: "Maximum number of objects to return (1-1000). Defaults to 1000 if not specified.",
1748
+ example: "1000",
1749
+ placeholder: "Enter max keys (1-1000)",
1750
+ clean: toOptionalInt
1751
+ }),
1752
+ continuationToken: (0, _prismatic_io_spectral.input)({
1753
+ label: "Continuation Token",
1754
+ type: "string",
1755
+ required: false,
1756
+ comments: "Pagination token returned by a previous request to retrieve the next page of results.",
1757
+ example: "lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E",
1758
+ placeholder: "Enter continuation token",
1759
+ clean: cleanString
1760
+ })
1761
+ }
1762
+ });
1763
+ const actionType = (0, _prismatic_io_spectral.input)({
1764
+ label: "Action Type",
1765
+ type: "string",
1766
+ comments: "Specifies whether the presigned URL will allow download or upload operations.",
1767
+ clean: _prismatic_io_spectral.util.types.toString,
1768
+ required: true,
1769
+ default: "download",
1770
+ placeholder: "Select action type",
1771
+ model: [{
1772
+ label: "Download",
1773
+ value: "download"
1774
+ }, {
1775
+ label: "Upload",
1776
+ value: "upload"
1777
+ }]
1778
+ });
1779
+ const objectAttributes = (0, _prismatic_io_spectral.input)({
1780
+ label: "Object Attributes",
1781
+ type: "string",
1782
+ collection: "valuelist",
1783
+ required: true,
1784
+ model: OBJECT_ATTRIBUTES.map((attribute) => ({
1785
+ label: attribute,
1786
+ value: attribute
1787
+ })),
1788
+ comments: "The object attributes to return in the response. Unspecified attributes are not returned.",
1789
+ placeholder: "Select object attributes",
1790
+ clean: getObjectAttributes$1
1791
+ });
1792
+ const includeMetadata = (0, _prismatic_io_spectral.input)({
1793
+ label: "Include Metadata",
1794
+ type: "boolean",
1795
+ required: true,
1796
+ default: "false",
1797
+ comments: "When true, returns full object metadata and pagination information instead of just object keys.",
1798
+ clean: _prismatic_io_spectral.util.types.toBool
1799
+ });
1800
+ const copyObjectInputs = {
1801
+ accessKey: accessKeyInput,
1802
+ ...dynamicAccessAllInputs,
1803
+ sourceBucket,
1804
+ destinationBucket,
1805
+ sourceKey,
1806
+ destinationKey,
1807
+ acl,
1808
+ awsRegion
1809
+ };
1810
+ const deleteObjectInputs = {
1811
+ accessKey: accessKeyInput,
1812
+ ...dynamicAccessAllInputs,
1813
+ bucket,
1814
+ objectKey,
1815
+ awsRegion
1816
+ };
1817
+ const deleteObjectsInputs = {
1818
+ accessKey: accessKeyInput,
1819
+ ...dynamicAccessAllInputs,
1820
+ bucket,
1821
+ objectKeys,
1822
+ awsRegion
1823
+ };
1824
+ const generatePresignedUrlInputs = {
1825
+ accessKey: accessKeyInput,
1826
+ ...dynamicAccessAllInputs,
1827
+ bucket,
1828
+ objectKey,
1829
+ actionType,
1830
+ expirationSeconds,
1831
+ awsRegion
1832
+ };
1833
+ const getObjectInputs = {
1834
+ accessKey: accessKeyInput,
1835
+ ...dynamicAccessAllInputs,
1836
+ bucket,
1837
+ objectKey,
1838
+ versionId: {
1839
+ ...versionId,
1840
+ comments: "The version ID of the object to retrieve. When omitted, the current version is returned."
1841
+ },
1842
+ awsRegion
1843
+ };
1844
+ const getObjectAttributesInputs = {
1845
+ accessKey: accessKeyInput,
1846
+ ...dynamicAccessAllInputs,
1847
+ bucket,
1848
+ objectKey,
1849
+ objectAttributes,
1850
+ versionId: {
1851
+ ...versionId,
1852
+ comments: "The version ID for the object whose metadata to retrieve."
1853
+ },
1854
+ awsRegion
1855
+ };
1856
+ const headObjectInputs = {
1857
+ accessKey: accessKeyInput,
1858
+ ...dynamicAccessAllInputs,
1859
+ bucket,
1860
+ objectKey,
1861
+ versionId: {
1862
+ ...versionId,
1863
+ comments: "The version ID of the object whose metadata to retrieve."
1864
+ },
1865
+ awsRegion
1866
+ };
1867
+ const listObjectsInputs = {
1868
+ accessKey: accessKeyInput,
1869
+ ...dynamicAccessAllInputs,
1870
+ bucket,
1871
+ includeMetadata,
1872
+ pagination,
1873
+ prefix,
1874
+ awsRegion
1875
+ };
1876
+ const putObjectInputs = {
1877
+ accessKey: accessKeyInput,
1878
+ ...dynamicAccessAllInputs,
1879
+ bucket,
1880
+ fileContents,
1881
+ objectKey,
1882
+ tagging,
1883
+ acl,
1884
+ awsRegion
1885
+ };
1886
+ //#endregion
1887
+ //#region src/inputs/sns.ts
1888
+ const name = (0, _prismatic_io_spectral.input)({
1889
+ label: "Name",
1890
+ type: "string",
1891
+ required: true,
1892
+ example: "ProductionNotifications",
1893
+ placeholder: "Enter topic name",
1894
+ comments: "The name of the SNS topic to create.",
1895
+ clean: _prismatic_io_spectral.util.types.toString
1896
+ });
1897
+ const snsTopicArn = (0, _prismatic_io_spectral.input)({
1898
+ label: "SNS Topic ARN",
1899
+ type: "string",
1900
+ required: true,
1901
+ example: "arn:aws:sns:us-east-1:123456789012:S3EventNotifications",
1902
+ placeholder: "Enter SNS topic ARN",
1903
+ comments: "The Amazon Resource Name (ARN) of the SNS topic. For more information, see [Getting started with Amazon SNS](https://docs.aws.amazon.com/sns/latest/dg/sns-getting-started.html).",
1904
+ clean: _prismatic_io_spectral.util.types.toString
1905
+ });
1906
+ const bucketOwnerAccountid = (0, _prismatic_io_spectral.input)({
1907
+ label: "Bucket Owner Account ID",
1908
+ type: "string",
1909
+ required: true,
1910
+ example: "123456789012",
1911
+ placeholder: "Enter 12-digit AWS account ID",
1912
+ comments: "The 12-digit AWS Account ID of the bucket owner. Find this in the AWS Console account settings or use the 'Get Current Account' action.",
1913
+ clean: _prismatic_io_spectral.util.types.toString
1914
+ });
1915
+ const endpoint = (0, _prismatic_io_spectral.input)({
1916
+ label: "Webhook Endpoint",
1917
+ type: "string",
1918
+ required: true,
1919
+ example: "https://hooks.example.com/trigger/SW5zdGFuY2VGbG93Q29uZmlnOjhiNGY0ZTRkLWIyODMtNDE4Yy04YmZhLTg1NGI11234567890==",
1920
+ placeholder: "Enter webhook URL",
1921
+ comments: "The HTTPS endpoint URL that will receive S3 event notifications.",
1922
+ clean: _prismatic_io_spectral.util.types.toString
1923
+ });
1924
+ const subscriptionArn = (0, _prismatic_io_spectral.input)({
1925
+ label: "Subscription ARN",
1926
+ type: "string",
1927
+ required: true,
1928
+ example: "arn:aws:sns:us-east-2:123456789012:MyTopic:a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890",
1929
+ placeholder: "Enter subscription ARN",
1930
+ comments: "The Amazon Resource Name (ARN) of the SNS topic subscription.",
1931
+ clean: _prismatic_io_spectral.util.types.toString
1932
+ });
1933
+ const eventsList = (0, _prismatic_io_spectral.input)({
1934
+ label: "Event Types",
1935
+ comments: "S3 event types that will trigger notifications. For more information, see [S3 Event Notification Types](https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-event-types-and-destinations.html).",
1936
+ type: "string",
1937
+ collection: "valuelist",
1938
+ model: INPUT_EVENT_TYPES_MODEL,
1939
+ example: "s3:ObjectCreated:*",
1940
+ placeholder: "Select event types",
1941
+ required: true,
1942
+ clean: toTrimmedStringArray
1943
+ });
1944
+ const eventNotificationName = (0, _prismatic_io_spectral.input)({
1945
+ label: "Event Notification Name",
1946
+ type: "string",
1947
+ required: true,
1948
+ example: "S3ObjectCreatedAlert",
1949
+ placeholder: "Enter event notification name",
1950
+ comments: "A unique name for the event notification configuration.",
1951
+ clean: _prismatic_io_spectral.util.types.toString
1952
+ });
1953
+ const bucketEventTriggerConfigurationInputs = {
1954
+ awsConnection: accessKeyInput,
1955
+ ...dynamicAccessAllInputs,
1956
+ snsTopicArn,
1957
+ eventsList,
1958
+ bucket,
1959
+ eventNotificationName,
1960
+ bucketOwnerAccountid,
1961
+ awsRegion
1962
+ };
1963
+ const createTopicInputs = {
1964
+ awsConnection: accessKeyInput,
1965
+ ...dynamicAccessAllInputs,
1966
+ name,
1967
+ awsRegion
1968
+ };
1969
+ const subscribeToTopicInputs = {
1970
+ awsConnection: accessKeyInput,
1971
+ ...dynamicAccessAllInputs,
1972
+ snsTopicArn,
1973
+ endpoint,
1974
+ awsRegion
1975
+ };
1976
+ const unsubscribeFromTopicInputs = {
1977
+ awsConnection: accessKeyInput,
1978
+ ...dynamicAccessAllInputs,
1979
+ subscriptionArn,
1980
+ awsRegion
1981
+ };
1982
+ const updateTopicPolicyInputs = {
1983
+ awsConnection: accessKeyInput,
1984
+ ...dynamicAccessAllInputs,
1985
+ bucket,
1986
+ snsTopicArn,
1987
+ bucketOwnerAccountid,
1988
+ awsRegion
1989
+ };
1990
+ //#endregion
1991
+ //#region src/inputs/triggers.ts
1992
+ const filesLookBackDate = (0, _prismatic_io_spectral.input)({
1993
+ label: "Look-back Date",
1994
+ placeholder: "Enter look-back date (YYYY-MM-DD)",
1995
+ type: "string",
1996
+ required: false,
1997
+ comments: "The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each file modified on or after this date once.",
1998
+ example: "2026-01-01",
1999
+ clean: lookBackDateClean
2000
+ });
2001
+ const bucketsLookBackDate = (0, _prismatic_io_spectral.input)({
2002
+ label: "Look-back Date",
2003
+ placeholder: "Enter look-back date (YYYY-MM-DD)",
2004
+ type: "string",
2005
+ required: false,
2006
+ comments: "The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each bucket created on or after this date once.",
2007
+ example: "2026-01-01",
2008
+ clean: lookBackDateClean
2009
+ });
2010
+ const pollChangesFilesTriggerInputs = {
2011
+ accessKey: accessKeyInput,
2012
+ ...dynamicAccessAllInputs,
2013
+ bucket,
2014
+ lookBackDate: filesLookBackDate,
2015
+ awsRegion
2016
+ };
2017
+ const pollNewBucketsTriggerInputs = {
2018
+ accessKey: accessKeyInput,
2019
+ ...dynamicAccessAllInputs,
2020
+ lookBackDate: bucketsLookBackDate,
2021
+ awsRegion
2022
+ };
2023
+ const snsS3NotificationWebhookInputs = { expectedTopicArn: (0, _prismatic_io_spectral.input)({
2024
+ label: "Topic ARN",
2025
+ placeholder: "Enter the expected Amazon SNS Topic ARN",
2026
+ type: "string",
2027
+ required: false,
2028
+ comments: "The Amazon SNS Topic ARN this webhook should accept messages from. When set, a validly signed message from any other topic is rejected, including a subscription confirmation, so a foreign subscription is never confirmed. Leave empty to accept a validly signed message from any topic.",
2029
+ example: "arn:aws:sns:us-west-2:123456789012:MyTopic",
2030
+ clean: cleanString
2031
+ }) };
2032
+ //#endregion
2033
+ //#region src/inputs/uploadStreams.ts
2034
+ const uploadIdInput = (0, _prismatic_io_spectral.input)({
2035
+ label: "Upload Stream ID",
2036
+ type: "string",
2037
+ required: true,
2038
+ placeholder: "Enter upload stream ID",
2039
+ comments: "The ID of the upload stream to write to. Generate this with the 'Create Stream' action.",
2040
+ clean: _prismatic_io_spectral.util.types.toString
2041
+ });
2042
+ const closeUploadStreamInputs = { uploadId: uploadIdInput };
2043
+ const createUploadStreamInputs = {
2044
+ accessKey: accessKeyInput,
2045
+ ...dynamicAccessAllInputs,
2046
+ objectKey,
2047
+ bucket,
2048
+ tagging,
2049
+ acl,
2050
+ awsRegion
2051
+ };
2052
+ const writeUploadStreamInputs = {
2053
+ uploadId: uploadIdInput,
2054
+ fileContents
2055
+ };
2056
+ //#endregion
2057
+ //#region src/outputSchemas/bucketNotifications.ts
2058
+ const notificationFilterSchema = {
2059
+ type: "object",
2060
+ properties: { Key: {
2061
+ type: "object",
2062
+ properties: { FilterRules: {
2063
+ type: "array",
2064
+ items: {
2065
+ type: "object",
2066
+ properties: {
2067
+ Name: { type: "string" },
2068
+ Value: { type: "string" }
2069
+ },
2070
+ required: []
2071
+ }
2072
+ } },
2073
+ required: []
2074
+ } },
2075
+ required: []
2076
+ };
2077
+ const eventsSchema = {
2078
+ type: "array",
2079
+ items: { type: "string" }
2080
+ };
2081
+ const getBucketNotificationConfigurationOutputSchema = {
2082
+ type: "object",
2083
+ properties: {
2084
+ TopicConfigurations: {
2085
+ type: "array",
2086
+ items: {
2087
+ type: "object",
2088
+ properties: {
2089
+ Id: { type: "string" },
2090
+ TopicArn: { type: "string" },
2091
+ Events: eventsSchema,
2092
+ Filter: notificationFilterSchema
2093
+ },
2094
+ required: ["TopicArn", "Events"]
2095
+ }
2096
+ },
2097
+ QueueConfigurations: {
2098
+ type: "array",
2099
+ items: {
2100
+ type: "object",
2101
+ properties: {
2102
+ Id: { type: "string" },
2103
+ QueueArn: { type: "string" },
2104
+ Events: eventsSchema,
2105
+ Filter: notificationFilterSchema
2106
+ },
2107
+ required: ["QueueArn", "Events"]
2108
+ }
2109
+ },
2110
+ LambdaFunctionConfigurations: {
2111
+ type: "array",
2112
+ items: {
2113
+ type: "object",
2114
+ properties: {
2115
+ Id: { type: "string" },
2116
+ LambdaFunctionArn: { type: "string" },
2117
+ Events: eventsSchema,
2118
+ Filter: notificationFilterSchema
2119
+ },
2120
+ required: ["LambdaFunctionArn", "Events"]
2121
+ }
2122
+ },
2123
+ EventBridgeConfiguration: { type: "object" }
2124
+ },
2125
+ required: []
2126
+ };
2127
+ //#endregion
2128
+ //#region src/outputSchemas/shared.ts
2129
+ const dateTimeSchema = {
2130
+ type: "string",
2131
+ format: "date-time"
2132
+ };
2133
+ const requestChargedSchema = {
2134
+ type: "string",
2135
+ enum: ["requester"]
2136
+ };
2137
+ const checksumTypeSchema = {
2138
+ type: "string",
2139
+ enum: ["COMPOSITE", "FULL_OBJECT"]
2140
+ };
2141
+ const retentionModeSchema = {
2142
+ type: "string",
2143
+ enum: ["GOVERNANCE", "COMPLIANCE"]
2144
+ };
2145
+ const checksumValueProperties = {
2146
+ ChecksumCRC32: { type: "string" },
2147
+ ChecksumCRC32C: { type: "string" },
2148
+ ChecksumCRC64NVME: { type: "string" },
2149
+ ChecksumSHA1: { type: "string" },
2150
+ ChecksumSHA256: { type: "string" },
2151
+ ChecksumSHA512: { type: "string" },
2152
+ ChecksumMD5: { type: "string" },
2153
+ ChecksumXXHASH64: { type: "string" },
2154
+ ChecksumXXHASH3: { type: "string" },
2155
+ ChecksumXXHASH128: { type: "string" }
2156
+ };
2157
+ const serverSideEncryptionProperties = {
2158
+ ServerSideEncryption: { type: "string" },
2159
+ SSECustomerAlgorithm: { type: "string" },
2160
+ SSECustomerKeyMD5: { type: "string" },
2161
+ SSEKMSKeyId: { type: "string" },
2162
+ BucketKeyEnabled: { type: "boolean" }
2163
+ };
2164
+ const ownerSchema = {
2165
+ type: "object",
2166
+ properties: {
2167
+ DisplayName: { type: "string" },
2168
+ ID: { type: "string" }
2169
+ },
2170
+ required: []
2171
+ };
2172
+ const initiatorSchema = {
2173
+ type: "object",
2174
+ properties: {
2175
+ ID: { type: "string" },
2176
+ DisplayName: { type: "string" }
2177
+ },
2178
+ required: []
2179
+ };
2180
+ const commonPrefixSchema = {
2181
+ type: "object",
2182
+ properties: { Prefix: { type: "string" } },
2183
+ required: []
2184
+ };
2185
+ //#endregion
2186
+ //#region src/outputSchemas/buckets.ts
2187
+ const getBucketLocationOutputSchema = { type: "string" };
2188
+ const listBucketsOutputSchema = {
2189
+ type: ["array", "null"],
2190
+ items: {
2191
+ type: "object",
2192
+ properties: {
2193
+ Name: { type: "string" },
2194
+ CreationDate: dateTimeSchema,
2195
+ BucketRegion: { type: "string" },
2196
+ BucketArn: { type: "string" }
2197
+ },
2198
+ required: []
2199
+ }
2200
+ };
2201
+ const headBucketOutputSchema = {
2202
+ type: "object",
2203
+ properties: {
2204
+ BucketArn: { type: "string" },
2205
+ BucketLocationType: { type: "string" },
2206
+ BucketLocationName: { type: "string" },
2207
+ BucketRegion: { type: "string" },
2208
+ AccessPointAlias: { type: "boolean" }
2209
+ },
2210
+ required: []
2211
+ };
2212
+ //#endregion
2213
+ //#region src/outputSchemas/misc.ts
2214
+ const getCurrentAccountOutputSchema = {
2215
+ type: "object",
2216
+ properties: {
2217
+ UserId: { type: "string" },
2218
+ Account: { type: "string" },
2219
+ Arn: { type: "string" }
2220
+ },
2221
+ required: []
2222
+ };
2223
+ //#endregion
2224
+ //#region src/outputSchemas/multipartUploads.ts
2225
+ const createMultipartUploadOutputSchema = {
2226
+ type: "object",
2227
+ properties: {
2228
+ AbortDate: dateTimeSchema,
2229
+ AbortRuleId: { type: "string" },
2230
+ Bucket: { type: "string" },
2231
+ Key: { type: "string" },
2232
+ UploadId: { type: "string" },
2233
+ ...serverSideEncryptionProperties,
2234
+ SSEKMSEncryptionContext: { type: "string" },
2235
+ RequestCharged: requestChargedSchema,
2236
+ ChecksumAlgorithm: { type: "string" },
2237
+ ChecksumType: checksumTypeSchema
2238
+ },
2239
+ required: []
2240
+ };
2241
+ const uploadPartOutputSchema = {
2242
+ type: "object",
2243
+ properties: {
2244
+ ETag: { type: "string" },
2245
+ ...checksumValueProperties,
2246
+ ...serverSideEncryptionProperties,
2247
+ RequestCharged: requestChargedSchema,
2248
+ part: {
2249
+ type: "object",
2250
+ properties: {
2251
+ ETag: { type: "string" },
2252
+ PartNumber: { type: "number" }
2253
+ },
2254
+ required: ["PartNumber"]
2255
+ }
2256
+ },
2257
+ required: []
2258
+ };
2259
+ const generatePresignedForMultiparUploadsOutputSchema = {
2260
+ type: "array",
2261
+ items: {
2262
+ type: "object",
2263
+ properties: {
2264
+ url: {
2265
+ type: "string",
2266
+ format: "uri"
2267
+ },
2268
+ partNumber: { type: "number" }
2269
+ },
2270
+ required: ["url", "partNumber"]
2271
+ }
2272
+ };
2273
+ const completeMultipartUploadOutputSchema = {
2274
+ type: "object",
2275
+ properties: {
2276
+ Location: { type: "string" },
2277
+ Bucket: { type: "string" },
2278
+ Key: { type: "string" },
2279
+ Expiration: { type: "string" },
2280
+ ETag: { type: "string" },
2281
+ ...checksumValueProperties,
2282
+ ChecksumType: checksumTypeSchema,
2283
+ ServerSideEncryption: { type: "string" },
2284
+ VersionId: { type: "string" },
2285
+ SSEKMSKeyId: { type: "string" },
2286
+ BucketKeyEnabled: { type: "boolean" },
2287
+ RequestCharged: requestChargedSchema
2288
+ },
2289
+ required: []
2290
+ };
2291
+ const listPartsOutputSchema = {
2292
+ type: "object",
2293
+ properties: {
2294
+ AbortDate: dateTimeSchema,
2295
+ AbortRuleId: { type: "string" },
2296
+ Bucket: { type: "string" },
2297
+ Key: { type: "string" },
2298
+ UploadId: { type: "string" },
2299
+ PartNumberMarker: { type: "string" },
2300
+ NextPartNumberMarker: { type: "string" },
2301
+ MaxParts: { type: "number" },
2302
+ IsTruncated: { type: "boolean" },
2303
+ Parts: {
2304
+ type: "array",
2305
+ items: {
2306
+ type: "object",
2307
+ properties: {
2308
+ PartNumber: { type: "number" },
2309
+ LastModified: dateTimeSchema,
2310
+ ETag: { type: "string" },
2311
+ Size: { type: "number" },
2312
+ ...checksumValueProperties
2313
+ },
2314
+ required: []
2315
+ }
2316
+ },
2317
+ Initiator: initiatorSchema,
2318
+ Owner: ownerSchema,
2319
+ StorageClass: { type: "string" },
2320
+ RequestCharged: requestChargedSchema,
2321
+ ChecksumAlgorithm: { type: "string" },
2322
+ ChecksumType: checksumTypeSchema
2323
+ },
2324
+ required: []
2325
+ };
2326
+ const listMultipartUploadsOutputSchema = {
2327
+ type: "object",
2328
+ properties: {
2329
+ Bucket: { type: "string" },
2330
+ KeyMarker: { type: "string" },
2331
+ UploadIdMarker: { type: "string" },
2332
+ NextKeyMarker: { type: "string" },
2333
+ Prefix: { type: "string" },
2334
+ Delimiter: { type: "string" },
2335
+ NextUploadIdMarker: { type: "string" },
2336
+ MaxUploads: { type: "number" },
2337
+ IsTruncated: { type: "boolean" },
2338
+ Uploads: {
2339
+ type: "array",
2340
+ items: {
2341
+ type: "object",
2342
+ properties: {
2343
+ UploadId: { type: "string" },
2344
+ Key: { type: "string" },
2345
+ Initiated: dateTimeSchema,
2346
+ StorageClass: { type: "string" },
2347
+ Owner: ownerSchema,
2348
+ Initiator: initiatorSchema,
2349
+ ChecksumAlgorithm: { type: "string" },
2350
+ ChecksumType: checksumTypeSchema
2351
+ },
2352
+ required: []
2353
+ }
2354
+ },
2355
+ CommonPrefixes: {
2356
+ type: "array",
2357
+ items: commonPrefixSchema
2358
+ },
2359
+ EncodingType: {
2360
+ type: "string",
2361
+ enum: ["url"]
2362
+ },
2363
+ RequestCharged: requestChargedSchema
2364
+ },
2365
+ required: []
2366
+ };
2367
+ const abortMultipartUploadOutputSchema = {
2368
+ type: "object",
2369
+ properties: { RequestCharged: requestChargedSchema },
2370
+ required: []
2371
+ };
2372
+ //#endregion
2373
+ //#region src/outputSchemas/objectLock.ts
2374
+ const getObjectLockConfigurationOutputSchema = {
2375
+ type: "object",
2376
+ properties: { ObjectLockConfiguration: {
2377
+ type: "object",
2378
+ properties: {
2379
+ ObjectLockEnabled: {
2380
+ type: "string",
2381
+ enum: ["Enabled"]
2382
+ },
2383
+ Rule: {
2384
+ type: "object",
2385
+ properties: { DefaultRetention: {
2386
+ type: "object",
2387
+ properties: {
2388
+ Mode: retentionModeSchema,
2389
+ Days: { type: "number" },
2390
+ Years: { type: "number" }
2391
+ },
2392
+ required: []
2393
+ } },
2394
+ required: []
2395
+ }
2396
+ },
2397
+ required: []
2398
+ } },
2399
+ required: ["ObjectLockConfiguration"]
2400
+ };
2401
+ const getObjectRetentionOutputSchema = {
2402
+ type: "object",
2403
+ properties: { Retention: {
2404
+ type: "object",
2405
+ properties: {
2406
+ Mode: retentionModeSchema,
2407
+ RetainUntilDate: dateTimeSchema
2408
+ },
2409
+ required: []
2410
+ } },
2411
+ required: ["Retention"]
2412
+ };
2413
+ const putObjectLockConfigurationOutputSchema = {
2414
+ type: "object",
2415
+ properties: { RequestCharged: requestChargedSchema },
2416
+ required: []
2417
+ };
2418
+ const putObjectRetentionOutputSchema = {
2419
+ type: "object",
2420
+ properties: { RequestCharged: requestChargedSchema },
2421
+ required: []
2422
+ };
2423
+ //#endregion
2424
+ //#region src/outputSchemas/objects.ts
2425
+ const generatePresignedUrlOutputSchema = {
2426
+ type: "string",
2427
+ format: "uri"
2428
+ };
2429
+ const copyObjectOutputSchema = {
2430
+ type: "object",
2431
+ properties: {
2432
+ CopyObjectResult: {
2433
+ type: "object",
2434
+ properties: {
2435
+ ETag: { type: "string" },
2436
+ LastModified: dateTimeSchema,
2437
+ ChecksumType: checksumTypeSchema,
2438
+ ...checksumValueProperties
2439
+ },
2440
+ required: []
2441
+ },
2442
+ Expiration: { type: "string" },
2443
+ CopySourceVersionId: { type: "string" },
2444
+ VersionId: { type: "string" },
2445
+ ...serverSideEncryptionProperties,
2446
+ SSEKMSEncryptionContext: { type: "string" },
2447
+ RequestCharged: requestChargedSchema
2448
+ },
2449
+ required: ["CopyObjectResult"]
2450
+ };
2451
+ const putObjectOutputSchema = {
2452
+ type: "object",
2453
+ properties: {
2454
+ Expiration: { type: "string" },
2455
+ ETag: { type: "string" },
2456
+ ...checksumValueProperties,
2457
+ ChecksumType: checksumTypeSchema,
2458
+ VersionId: { type: "string" },
2459
+ ...serverSideEncryptionProperties,
2460
+ SSEKMSEncryptionContext: { type: "string" },
2461
+ Size: { type: "number" },
2462
+ RequestCharged: requestChargedSchema
2463
+ },
2464
+ required: []
2465
+ };
2466
+ const headObjectOutputSchema = {
2467
+ type: "object",
2468
+ properties: {
2469
+ DeleteMarker: { type: "boolean" },
2470
+ AcceptRanges: { type: "string" },
2471
+ Expiration: { type: "string" },
2472
+ Restore: { type: "string" },
2473
+ ArchiveStatus: { type: "string" },
2474
+ LastModified: dateTimeSchema,
2475
+ ContentLength: { type: "number" },
2476
+ ...checksumValueProperties,
2477
+ ChecksumType: checksumTypeSchema,
2478
+ ETag: { type: "string" },
2479
+ MissingMeta: { type: "number" },
2480
+ VersionId: { type: "string" },
2481
+ CacheControl: { type: "string" },
2482
+ ContentDisposition: { type: "string" },
2483
+ ContentEncoding: { type: "string" },
2484
+ ContentLanguage: { type: "string" },
2485
+ ContentType: { type: "string" },
2486
+ ContentRange: { type: "string" },
2487
+ Expires: dateTimeSchema,
2488
+ ExpiresString: { type: "string" },
2489
+ WebsiteRedirectLocation: { type: "string" },
2490
+ ...serverSideEncryptionProperties,
2491
+ Metadata: {
2492
+ type: "object",
2493
+ additionalProperties: { type: "string" }
2494
+ },
2495
+ StorageClass: { type: "string" },
2496
+ RequestCharged: requestChargedSchema,
2497
+ ReplicationStatus: { type: "string" },
2498
+ PartsCount: { type: "number" },
2499
+ TagCount: { type: "number" },
2500
+ ObjectLockMode: retentionModeSchema,
2501
+ ObjectLockRetainUntilDate: dateTimeSchema,
2502
+ ObjectLockLegalHoldStatus: {
2503
+ type: "string",
2504
+ enum: ["ON", "OFF"]
2505
+ }
2506
+ },
2507
+ required: []
2508
+ };
2509
+ const deleteObjectOutputSchema = {
2510
+ type: "object",
2511
+ properties: {
2512
+ DeleteMarker: { type: "boolean" },
2513
+ VersionId: { type: "string" },
2514
+ RequestCharged: requestChargedSchema
2515
+ },
2516
+ required: []
2517
+ };
2518
+ const deleteObjectsOutputSchema = {
2519
+ type: "object",
2520
+ properties: {
2521
+ Deleted: {
2522
+ type: "array",
2523
+ items: {
2524
+ type: "object",
2525
+ properties: {
2526
+ Key: { type: "string" },
2527
+ VersionId: { type: "string" },
2528
+ DeleteMarker: { type: "boolean" },
2529
+ DeleteMarkerVersionId: { type: "string" }
2530
+ },
2531
+ required: []
2532
+ }
2533
+ },
2534
+ Errors: {
2535
+ type: "array",
2536
+ items: {
2537
+ type: "object",
2538
+ properties: {
2539
+ Key: { type: "string" },
2540
+ VersionId: { type: "string" },
2541
+ Code: { type: "string" },
2542
+ Message: { type: "string" }
2543
+ },
2544
+ required: []
2545
+ }
2546
+ },
2547
+ RequestCharged: requestChargedSchema
2548
+ },
2549
+ required: []
2550
+ };
2551
+ const listObjectsOutputSchema = {
2552
+ type: ["array", "object"],
2553
+ items: { type: "string" },
2554
+ properties: {
2555
+ IsTruncated: { type: "boolean" },
2556
+ Contents: {
2557
+ type: "array",
2558
+ items: {
2559
+ type: "object",
2560
+ properties: {
2561
+ Key: { type: "string" },
2562
+ LastModified: dateTimeSchema,
2563
+ ETag: { type: "string" },
2564
+ ChecksumAlgorithm: {
2565
+ type: "array",
2566
+ items: { type: "string" }
2567
+ },
2568
+ ChecksumType: checksumTypeSchema,
2569
+ Size: { type: "number" },
2570
+ StorageClass: { type: "string" },
2571
+ Owner: ownerSchema,
2572
+ RestoreStatus: {
2573
+ type: "object",
2574
+ properties: {
2575
+ IsRestoreInProgress: { type: "boolean" },
2576
+ RestoreExpiryDate: dateTimeSchema
2577
+ },
2578
+ required: []
2579
+ }
2580
+ },
2581
+ required: []
2582
+ }
2583
+ },
2584
+ Name: { type: "string" },
2585
+ Prefix: { type: "string" },
2586
+ Delimiter: { type: "string" },
2587
+ MaxKeys: { type: "number" },
2588
+ CommonPrefixes: {
2589
+ type: "array",
2590
+ items: commonPrefixSchema
2591
+ },
2592
+ EncodingType: {
2593
+ type: "string",
2594
+ enum: ["url"]
2595
+ },
2596
+ KeyCount: { type: "number" },
2597
+ ContinuationToken: { type: "string" },
2598
+ NextContinuationToken: { type: "string" },
2599
+ StartAfter: { type: "string" },
2600
+ RequestCharged: requestChargedSchema
2601
+ },
2602
+ required: [],
2603
+ additionalProperties: true
2604
+ };
2605
+ const getObjectAttributesOutputSchema = {
2606
+ type: "object",
2607
+ properties: {
2608
+ DeleteMarker: { type: "boolean" },
2609
+ LastModified: dateTimeSchema,
2610
+ VersionId: { type: "string" },
2611
+ RequestCharged: requestChargedSchema,
2612
+ ETag: { type: "string" },
2613
+ Checksum: {
2614
+ type: "object",
2615
+ properties: {
2616
+ ...checksumValueProperties,
2617
+ ChecksumType: checksumTypeSchema
2618
+ },
2619
+ required: []
2620
+ },
2621
+ ObjectParts: {
2622
+ type: "object",
2623
+ properties: {
2624
+ TotalPartsCount: { type: "number" },
2625
+ PartNumberMarker: { type: "string" },
2626
+ NextPartNumberMarker: { type: "string" },
2627
+ MaxParts: { type: "number" },
2628
+ IsTruncated: { type: "boolean" },
2629
+ Parts: {
2630
+ type: "array",
2631
+ items: {
2632
+ type: "object",
2633
+ properties: {
2634
+ PartNumber: { type: "number" },
2635
+ Size: { type: "number" },
2636
+ ...checksumValueProperties
2637
+ },
2638
+ required: []
2639
+ }
2640
+ }
2641
+ },
2642
+ required: []
2643
+ },
2644
+ StorageClass: { type: "string" },
2645
+ ObjectSize: { type: "number" }
2646
+ },
2647
+ required: [],
2648
+ additionalProperties: true
2649
+ };
2650
+ //#endregion
2651
+ //#region src/outputSchemas/sns.ts
2652
+ const createTopicOutputSchema = {
2653
+ type: "object",
2654
+ properties: { TopicArn: { type: "string" } },
2655
+ required: []
2656
+ };
2657
+ const subscribeToTopicOutputSchema = {
2658
+ type: "object",
2659
+ properties: { SubscriptionArn: { type: "string" } },
2660
+ required: []
2661
+ };
2662
+ //#endregion
2663
+ //#region src/outputSchemas/uploadStreams.ts
2664
+ const createUploadStreamOutputSchema = {
2665
+ type: "string",
2666
+ format: "uuid"
2667
+ };
2668
+ const writeUploadStreamOutputSchema = { type: "null" };
2669
+ const closeUploadStreamOutputSchema = { type: "null" };
2670
+ //#endregion
2671
+ //#region src/actions/bucketNotifications/index.ts
2672
+ var bucketNotifications_default = {
2673
+ getBucketNotificationConfiguration: (0, _prismatic_io_spectral.action)({
2674
+ display: {
2675
+ label: "Get Bucket Notification Configuration",
2676
+ description: "Returns the notification configuration of a bucket"
2677
+ },
2678
+ performSafety: "safe",
2679
+ perform: async (context, { awsRegion, accessKey, bucket, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2680
+ return { data: await getBucketNotificationConfiguration$1(await createS3Client({
2681
+ awsConnection: accessKey,
2682
+ awsRegion,
2683
+ dynamicAccessKeyId,
2684
+ dynamicSecretAccessKey,
2685
+ dynamicSessionToken,
2686
+ logger: context.logger,
2687
+ debug: context.debug.enabled
2688
+ }), bucket, void 0, false) };
2689
+ },
2690
+ inputs: getBucketNotificationConfigurationInputs,
2691
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2692
+ type: "actionOutput",
2693
+ schema: getBucketNotificationConfigurationOutputSchema
2694
+ }),
2695
+ examplePayload: getBucketNotificationConfigurationExamplePayload
2696
+ }),
2697
+ putBucketNotificationConfiguration: (0, _prismatic_io_spectral.action)({
2698
+ display: {
2699
+ label: "Put Bucket Notification Configuration",
2700
+ description: "Replace an existing bucket notification configuration with a new one"
2701
+ },
2702
+ performSafety: "notAllowed",
2703
+ perform: async (context, { awsRegion, accessKey, bucket, topicConfigurations, queueConfigurations, lambdaFunctionConfigurations, eventBridgeConfiguration, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2704
+ return { data: await putBucketNotificationConfiguration$1(await createS3Client({
2705
+ awsConnection: accessKey,
2706
+ awsRegion,
2707
+ dynamicAccessKeyId,
2708
+ dynamicSecretAccessKey,
2709
+ dynamicSessionToken,
2710
+ logger: context.logger,
2711
+ debug: context.debug.enabled
2712
+ }), bucket, {
2713
+ TopicConfigurations: topicConfigurations,
2714
+ QueueConfigurations: queueConfigurations,
2715
+ LambdaFunctionConfigurations: lambdaFunctionConfigurations,
2716
+ EventBridgeConfiguration: eventBridgeConfiguration
2717
+ }) };
2718
+ },
2719
+ inputs: putBucketNotificationConfigurationInputs,
2720
+ examplePerform: async () => putBucketNotificationConfigurationExamplePayload,
2721
+ examplePayload: putBucketNotificationConfigurationExamplePayload
2722
+ })
2723
+ };
2724
+ //#endregion
2725
+ //#region src/actions/buckets/index.ts
2726
+ var buckets_default = {
2727
+ deleteBucket: (0, _prismatic_io_spectral.action)({
2728
+ display: {
2729
+ label: "Delete Bucket",
2730
+ description: "Deletes the S3 bucket. All objects in the bucket must be deleted before the bucket itself can be deleted"
2731
+ },
2732
+ performSafety: "notAllowed",
2733
+ perform: async (context, { awsRegion, accessKey, bucket, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2734
+ const s3 = await createS3Client({
2735
+ awsConnection: accessKey,
2736
+ awsRegion,
2737
+ dynamicAccessKeyId,
2738
+ dynamicSecretAccessKey,
2739
+ dynamicSessionToken,
2740
+ logger: context.logger,
2741
+ debug: context.debug.enabled
2742
+ });
2743
+ const command = new _aws_sdk_client_s3.DeleteBucketCommand({ Bucket: bucket });
2744
+ return { data: await s3.send(command) };
2745
+ },
2746
+ inputs: deleteBucketInputs,
2747
+ examplePerform: async () => deleteBucketExamplePayload,
2748
+ examplePayload: deleteBucketExamplePayload
2749
+ }),
2750
+ getBucketLocation: (0, _prismatic_io_spectral.action)({
2751
+ display: {
2752
+ label: "Get Bucket Location",
2753
+ description: "Get the location (AWS region) of a bucket by name"
2754
+ },
2755
+ performSafety: "safe",
2756
+ perform: async (context, { accessKey, bucket, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2757
+ const s3 = await createS3Client({
2758
+ awsConnection: accessKey,
2759
+ awsRegion: "",
2760
+ dynamicAccessKeyId,
2761
+ dynamicSecretAccessKey,
2762
+ dynamicSessionToken,
2763
+ logger: context.logger,
2764
+ debug: context.debug.enabled
2765
+ });
2766
+ const command = new _aws_sdk_client_s3.GetBucketLocationCommand({ Bucket: bucket });
2767
+ return { data: (await s3.send(command)).LocationConstraint || "us-east-1" };
2768
+ },
2769
+ inputs: getBucketLocationInputs,
2770
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2771
+ type: "actionOutput",
2772
+ schema: getBucketLocationOutputSchema
2773
+ }),
2774
+ examplePayload: getBucketLocationExamplePayload
2775
+ }),
2776
+ headBucket: (0, _prismatic_io_spectral.action)({
2777
+ display: {
2778
+ label: "Head Bucket",
2779
+ description: "Determine if a bucket exists and whether the connection has permission to access it."
2780
+ },
2781
+ performSafety: "safe",
2782
+ perform: async (context, { awsRegion, accessKey, bucket, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2783
+ const s3 = await createS3Client({
2784
+ awsConnection: accessKey,
2785
+ awsRegion,
2786
+ dynamicAccessKeyId,
2787
+ dynamicSecretAccessKey,
2788
+ dynamicSessionToken,
2789
+ logger: context.logger,
2790
+ debug: context.debug.enabled
2791
+ });
2792
+ const command = new _aws_sdk_client_s3.HeadBucketCommand({ Bucket: bucket });
2793
+ return { data: await s3.send(command) };
2794
+ },
2795
+ inputs: headBucketInputs,
2796
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2797
+ type: "actionOutput",
2798
+ schema: headBucketOutputSchema
2799
+ }),
2800
+ examplePayload: headBucketExamplePayload
2801
+ }),
2802
+ listBuckets: (0, _prismatic_io_spectral.action)({
2803
+ display: {
2804
+ label: "List Buckets",
2805
+ description: "List all buckets in an AWS account"
2806
+ },
2807
+ performSafety: "safe",
2808
+ perform: async (context, { awsRegion, accessKey, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2809
+ return { data: await listAllBuckets(await createS3Client({
2810
+ awsConnection: accessKey,
2811
+ awsRegion,
2812
+ dynamicAccessKeyId,
2813
+ dynamicSecretAccessKey,
2814
+ dynamicSessionToken,
2815
+ logger: context.logger,
2816
+ debug: context.debug.enabled
2817
+ })) };
2818
+ },
2819
+ inputs: listBucketsInputs,
2820
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2821
+ type: "actionOutput",
2822
+ schema: listBucketsOutputSchema
2823
+ }),
2824
+ examplePayload: listBucketsExamplePayload
2825
+ })
2826
+ };
2827
+ //#endregion
2828
+ //#region src/actions/misc/index.ts
2829
+ var misc_default = { getCurrentAccount: (0, _prismatic_io_spectral.action)({
2830
+ display: {
2831
+ label: "Get Current Account",
2832
+ description: "Get the current AWS account"
2833
+ },
2834
+ performSafety: "safe",
2835
+ perform: async (context, { accessKey, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2836
+ const sts = new _aws_sdk_client_sts.STSClient({ credentials: (await createS3Client({
2837
+ awsConnection: accessKey,
2838
+ awsRegion: "",
2839
+ dynamicAccessKeyId,
2840
+ dynamicSecretAccessKey,
2841
+ dynamicSessionToken,
2842
+ logger: context.logger,
2843
+ debug: context.debug.enabled
2844
+ })).config.credentials });
2845
+ const command = new _aws_sdk_client_sts.GetCallerIdentityCommand({});
2846
+ return { data: await sts.send(command) };
2847
+ },
2848
+ inputs: getCurrentAccountInputs,
2849
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2850
+ type: "actionOutput",
2851
+ schema: getCurrentAccountOutputSchema
2852
+ }),
2853
+ examplePayload: getCurrentAccountExamplePayload
2854
+ }) };
2855
+ //#endregion
2856
+ //#region src/actions/multipartUploads/index.ts
2857
+ var multipartUploads_default = {
2858
+ abortMultipartUpload: (0, _prismatic_io_spectral.action)({
2859
+ display: {
2860
+ label: "Abort Multipart Upload",
2861
+ description: "Abort a multipart upload"
2862
+ },
2863
+ performSafety: "notAllowed",
2864
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, uploadId, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2865
+ const s3 = await createS3Client({
2866
+ awsConnection: accessKey,
2867
+ awsRegion,
2868
+ dynamicAccessKeyId,
2869
+ dynamicSecretAccessKey,
2870
+ dynamicSessionToken,
2871
+ logger: context.logger,
2872
+ debug: context.debug.enabled
2873
+ });
2874
+ const command = new _aws_sdk_client_s3.AbortMultipartUploadCommand({
2875
+ Bucket: bucket,
2876
+ Key: objectKey,
2877
+ UploadId: uploadId
2878
+ });
2879
+ return { data: await s3.send(command) };
2880
+ },
2881
+ inputs: abortMultipartUploadInputs,
2882
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2883
+ type: "actionOutput",
2884
+ schema: abortMultipartUploadOutputSchema
2885
+ }),
2886
+ examplePerform: async () => abortMultipartUploadExamplePayload,
2887
+ examplePayload: abortMultipartUploadExamplePayload
2888
+ }),
2889
+ completeMultipartUpload: (0, _prismatic_io_spectral.action)({
2890
+ display: {
2891
+ label: "Complete Multipart Upload",
2892
+ description: "Complete a multipart upload"
2893
+ },
2894
+ performSafety: "notAllowed",
2895
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, uploadId, parts, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2896
+ const s3 = await createS3Client({
2897
+ awsConnection: accessKey,
2898
+ awsRegion,
2899
+ dynamicAccessKeyId,
2900
+ dynamicSecretAccessKey,
2901
+ dynamicSessionToken,
2902
+ logger: context.logger,
2903
+ debug: context.debug.enabled
2904
+ });
2905
+ const command = new _aws_sdk_client_s3.CompleteMultipartUploadCommand({
2906
+ Bucket: bucket,
2907
+ Key: objectKey,
2908
+ UploadId: uploadId,
2909
+ MultipartUpload: { Parts: parts }
2910
+ });
2911
+ return { data: await s3.send(command) };
2912
+ },
2913
+ inputs: completeMultipartUploadInputs,
2914
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2915
+ type: "actionOutput",
2916
+ schema: completeMultipartUploadOutputSchema
2917
+ }),
2918
+ examplePerform: async () => completeMultipartUploadExamplePayload,
2919
+ examplePayload: completeMultipartUploadExamplePayload
2920
+ }),
2921
+ createMultipartUpload: (0, _prismatic_io_spectral.action)({
2922
+ display: {
2923
+ label: "Create Multipart Upload",
2924
+ description: "Create a multipart upload"
2925
+ },
2926
+ performSafety: "notAllowed",
2927
+ perform: async (context, { acl, awsRegion, accessKey, bucket, objectKey, tagging, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2928
+ const s3 = await createS3Client({
2929
+ awsConnection: accessKey,
2930
+ awsRegion,
2931
+ dynamicAccessKeyId,
2932
+ dynamicSecretAccessKey,
2933
+ dynamicSessionToken,
2934
+ logger: context.logger,
2935
+ debug: context.debug.enabled
2936
+ });
2937
+ const command = new _aws_sdk_client_s3.CreateMultipartUploadCommand({
2938
+ ACL: acl || null,
2939
+ Bucket: bucket,
2940
+ Key: objectKey,
2941
+ Tagging: encodeTags(tagging)
2942
+ });
2943
+ return { data: await s3.send(command) };
2944
+ },
2945
+ inputs: createMultipartUploadInputs,
2946
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2947
+ type: "actionOutput",
2948
+ schema: createMultipartUploadOutputSchema
2949
+ }),
2950
+ examplePerform: async () => createMultipartUploadExamplePayload,
2951
+ examplePayload: createMultipartUploadExamplePayload
2952
+ }),
2953
+ generatePresignedForMultiparUploads: (0, _prismatic_io_spectral.action)({
2954
+ display: {
2955
+ label: "Generate Presigned URL for Multipart Uploads",
2956
+ description: "Generate presigned URLs for uploading the parts of a multipart upload to S3."
2957
+ },
2958
+ inputs: generatePresignedForMultiparUploadsInputs,
2959
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2960
+ type: "actionOutput",
2961
+ schema: generatePresignedForMultiparUploadsOutputSchema
2962
+ }),
2963
+ performSafety: "notAllowed",
2964
+ perform: async (context, params) => {
2965
+ const s3 = await createS3Client({
2966
+ awsConnection: params.accessKey,
2967
+ awsRegion: params.awsRegion,
2968
+ dynamicAccessKeyId: params.dynamicAccessKeyId,
2969
+ dynamicSecretAccessKey: params.dynamicSecretAccessKey,
2970
+ dynamicSessionToken: params.dynamicSessionToken,
2971
+ logger: context.logger,
2972
+ debug: context.debug.enabled
2973
+ });
2974
+ const urlArray = [];
2975
+ for (let i = 1; i <= params.urlsToGenerate; i++) {
2976
+ const command = new _aws_sdk_client_s3.UploadPartCommand({
2977
+ Bucket: params.bucket,
2978
+ Key: params.objectKey,
2979
+ PartNumber: i,
2980
+ UploadId: params.uploadId
2981
+ });
2982
+ urlArray.push((0, _aws_sdk_s3_request_presigner.getSignedUrl)(s3, command, { expiresIn: params.expirationSeconds }));
2983
+ }
2984
+ return { data: (await Promise.all(urlArray)).map((value, index) => ({
2985
+ url: value,
2986
+ partNumber: index + 1
2987
+ })) };
2988
+ },
2989
+ examplePerform: async () => generatePresignedForMultiparUploadsExamplePayload,
2990
+ examplePayload: generatePresignedForMultiparUploadsExamplePayload
2991
+ }),
2992
+ listMultipartUploads: (0, _prismatic_io_spectral.action)({
2993
+ display: {
2994
+ label: "List Multipart Uploads",
2995
+ description: "Lists in-progress multipart uploads in a bucket"
2996
+ },
2997
+ performSafety: "safe",
2998
+ perform: async (context, { awsRegion, accessKey, bucket, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
2999
+ const s3 = await createS3Client({
3000
+ awsConnection: accessKey,
3001
+ awsRegion,
3002
+ dynamicAccessKeyId,
3003
+ dynamicSecretAccessKey,
3004
+ dynamicSessionToken,
3005
+ logger: context.logger,
3006
+ debug: context.debug.enabled
3007
+ });
3008
+ const command = new _aws_sdk_client_s3.ListMultipartUploadsCommand({ Bucket: bucket });
3009
+ return { data: await s3.send(command) };
3010
+ },
3011
+ inputs: listMultipartUploadsInputs,
3012
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3013
+ type: "actionOutput",
3014
+ schema: listMultipartUploadsOutputSchema
3015
+ }),
3016
+ examplePayload: listMultipartUploadsExamplePayload
3017
+ }),
3018
+ listParts: (0, _prismatic_io_spectral.action)({
3019
+ display: {
3020
+ label: "List Parts",
3021
+ description: "List parts of a multipart upload"
3022
+ },
3023
+ performSafety: "safe",
3024
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, uploadId, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3025
+ const s3 = await createS3Client({
3026
+ awsConnection: accessKey,
3027
+ awsRegion,
3028
+ dynamicAccessKeyId,
3029
+ dynamicSecretAccessKey,
3030
+ dynamicSessionToken,
3031
+ logger: context.logger,
3032
+ debug: context.debug.enabled
3033
+ });
3034
+ const command = new _aws_sdk_client_s3.ListPartsCommand({
3035
+ Bucket: bucket,
3036
+ Key: objectKey,
3037
+ UploadId: uploadId
3038
+ });
3039
+ return { data: await s3.send(command) };
3040
+ },
3041
+ inputs: listPartsInputs,
3042
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3043
+ type: "actionOutput",
3044
+ schema: listPartsOutputSchema
3045
+ }),
3046
+ examplePayload: listPartsExamplePayload
3047
+ }),
3048
+ uploadPart: (0, _prismatic_io_spectral.action)({
3049
+ display: {
3050
+ label: "Upload Part",
3051
+ description: "Upload a chunk of a multipart file upload"
3052
+ },
3053
+ performSafety: "notAllowed",
3054
+ perform: async (context, { awsRegion, accessKey, bucket, fileChunk, objectKey, uploadId, partNumber, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3055
+ const s3 = await createS3Client({
3056
+ awsConnection: accessKey,
3057
+ awsRegion,
3058
+ dynamicAccessKeyId,
3059
+ dynamicSecretAccessKey,
3060
+ dynamicSessionToken,
3061
+ logger: context.logger,
3062
+ debug: context.debug.enabled
3063
+ });
3064
+ const command = new _aws_sdk_client_s3.UploadPartCommand({
3065
+ Bucket: bucket,
3066
+ Key: objectKey,
3067
+ PartNumber: partNumber,
3068
+ UploadId: uploadId,
3069
+ Body: fileChunk
3070
+ });
3071
+ const result = await s3.send(command);
3072
+ return { data: {
3073
+ ...result,
3074
+ part: {
3075
+ ETag: result.ETag,
3076
+ PartNumber: partNumber
3077
+ }
3078
+ } };
3079
+ },
3080
+ inputs: uploadPartInputs,
3081
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3082
+ type: "actionOutput",
3083
+ schema: uploadPartOutputSchema
3084
+ }),
3085
+ examplePerform: async () => uploadPartExamplePayload,
3086
+ examplePayload: uploadPartExamplePayload
3087
+ })
3088
+ };
3089
+ //#endregion
3090
+ //#region src/actions/objectLock/index.ts
3091
+ var objectLock_default = {
3092
+ getObjectLockConfiguration: (0, _prismatic_io_spectral.action)({
3093
+ display: {
3094
+ label: "Get Object Lock Configuration",
3095
+ description: "Gets the Object Lock configuration for a bucket"
3096
+ },
3097
+ performSafety: "safe",
3098
+ perform: async (context, { awsRegion, accessKey, bucket, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3099
+ const s3 = await createS3Client({
3100
+ awsConnection: accessKey,
3101
+ awsRegion,
3102
+ dynamicAccessKeyId,
3103
+ dynamicSecretAccessKey,
3104
+ dynamicSessionToken,
3105
+ logger: context.logger,
3106
+ debug: context.debug.enabled
3107
+ });
3108
+ const command = new _aws_sdk_client_s3.GetObjectLockConfigurationCommand({ Bucket: bucket });
3109
+ return { data: await s3.send(command) };
3110
+ },
3111
+ inputs: getObjectLockConfigurationInputs,
3112
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3113
+ type: "actionOutput",
3114
+ schema: getObjectLockConfigurationOutputSchema
3115
+ }),
3116
+ examplePayload: getObjectLockConfigurationExamplePayload
3117
+ }),
3118
+ getObjectRetention: (0, _prismatic_io_spectral.action)({
3119
+ display: {
3120
+ label: "Get Object Retention",
3121
+ description: "Retrieves an object's retention settings"
3122
+ },
3123
+ performSafety: "safe",
3124
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, versionId, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3125
+ const s3 = await createS3Client({
3126
+ awsConnection: accessKey,
3127
+ awsRegion,
3128
+ dynamicAccessKeyId,
3129
+ dynamicSecretAccessKey,
3130
+ dynamicSessionToken,
3131
+ logger: context.logger,
3132
+ debug: context.debug.enabled
3133
+ });
3134
+ const command = new _aws_sdk_client_s3.GetObjectRetentionCommand({
3135
+ Bucket: bucket,
3136
+ Key: objectKey,
3137
+ VersionId: versionId
3138
+ });
3139
+ return { data: await s3.send(command) };
3140
+ },
3141
+ inputs: getObjectRetentionInputs,
3142
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3143
+ type: "actionOutput",
3144
+ schema: getObjectRetentionOutputSchema
3145
+ }),
3146
+ examplePayload: getObjectRetentionExamplePayload
3147
+ }),
3148
+ putObjectLockConfiguration: (0, _prismatic_io_spectral.action)({
3149
+ display: {
3150
+ label: "Put Object Lock Configuration",
3151
+ description: "Places an Object Lock configuration on the specified bucket"
3152
+ },
3153
+ performSafety: "notAllowed",
3154
+ perform: async (context, { awsRegion, accessKey, bucket, defaultRetentionDays, defaultRetentionMode, defaultRetentionYears, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3155
+ const s3 = await createS3Client({
3156
+ awsConnection: accessKey,
3157
+ awsRegion,
3158
+ dynamicAccessKeyId,
3159
+ dynamicSecretAccessKey,
3160
+ dynamicSessionToken,
3161
+ logger: context.logger,
3162
+ debug: context.debug.enabled
3163
+ });
3164
+ const defaultRetentionDaysPresent = defaultRetentionDays > 0;
3165
+ const defaultRetentionYearsPresent = defaultRetentionYears > 0;
3166
+ const defaultRetentionModePresent = defaultRetentionMode.length > 0;
3167
+ if (defaultRetentionDaysPresent && defaultRetentionYearsPresent) throw new Error("You cannot specify both Default Retention Years and Default Retention Days. Please specify one or the other.");
3168
+ if (defaultRetentionModePresent && !defaultRetentionDaysPresent && !defaultRetentionYearsPresent) throw new Error("You must specify either Default Retention Years or Default Retention Days.");
3169
+ if (!defaultRetentionModePresent && (defaultRetentionDaysPresent || defaultRetentionYearsPresent)) throw new Error("You must specify a Default Retention Mode.");
3170
+ const command = new _aws_sdk_client_s3.PutObjectLockConfigurationCommand({
3171
+ ObjectLockConfiguration: {
3172
+ ObjectLockEnabled: "Enabled",
3173
+ Rule: defaultRetentionModePresent ? { DefaultRetention: {
3174
+ Days: defaultRetentionDaysPresent ? defaultRetentionDays : void 0,
3175
+ Mode: defaultRetentionMode,
3176
+ Years: defaultRetentionYearsPresent ? defaultRetentionYears : void 0
3177
+ } } : void 0
3178
+ },
3179
+ Bucket: bucket
3180
+ });
3181
+ return { data: await s3.send(command) };
3182
+ },
3183
+ inputs: putObjectLockConfigurationInputs,
3184
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3185
+ type: "actionOutput",
3186
+ schema: putObjectLockConfigurationOutputSchema
3187
+ }),
3188
+ examplePerform: async () => putObjectLockConfigurationExamplePayload,
3189
+ examplePayload: putObjectLockConfigurationExamplePayload
3190
+ }),
3191
+ putObjectRetention: (0, _prismatic_io_spectral.action)({
3192
+ display: {
3193
+ label: "Put Object Retention",
3194
+ description: "Places an Object Retention configuration on an object"
3195
+ },
3196
+ performSafety: "notAllowed",
3197
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, retentionMode, retainUntilDate, versionId, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3198
+ const s3 = await createS3Client({
3199
+ awsConnection: accessKey,
3200
+ awsRegion,
3201
+ dynamicAccessKeyId,
3202
+ dynamicSecretAccessKey,
3203
+ dynamicSessionToken,
3204
+ logger: context.logger,
3205
+ debug: context.debug.enabled
3206
+ });
3207
+ const retentionModePresent = retentionMode.length > 0;
3208
+ const retainUntilDatePresent = retainUntilDate.length > 0;
3209
+ if (retentionModePresent && !retainUntilDatePresent || !retentionModePresent && retainUntilDatePresent) throw new Error("Both Retention Mode and Retain Until Date must be set when either is set.");
3210
+ const command = new _aws_sdk_client_s3.PutObjectRetentionCommand({
3211
+ Bucket: bucket,
3212
+ Key: objectKey,
3213
+ Retention: retentionModePresent ? {
3214
+ Mode: retentionMode,
3215
+ RetainUntilDate: new Date(retainUntilDate)
3216
+ } : {},
3217
+ VersionId: versionId
3218
+ });
3219
+ return { data: await s3.send(command) };
3220
+ },
3221
+ inputs: putObjectRetentionInputs,
3222
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3223
+ type: "actionOutput",
3224
+ schema: putObjectRetentionOutputSchema
3225
+ }),
3226
+ examplePerform: async () => putObjectRetentionExamplePayload,
3227
+ examplePayload: putObjectRetentionExamplePayload
3228
+ })
3229
+ };
3230
+ //#endregion
3231
+ //#region src/actions/objects/index.ts
3232
+ var objects_default = {
3233
+ copyObject: (0, _prismatic_io_spectral.action)({
3234
+ display: {
3235
+ label: "Copy Object",
3236
+ description: "Copy an object in S3 from one location to another"
3237
+ },
3238
+ performSafety: "notAllowed",
3239
+ perform: async (context, { acl, awsRegion, accessKey, sourceBucket, destinationBucket, sourceKey, destinationKey, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3240
+ const s3 = await createS3Client({
3241
+ awsConnection: accessKey,
3242
+ awsRegion,
3243
+ dynamicAccessKeyId,
3244
+ dynamicSecretAccessKey,
3245
+ dynamicSessionToken,
3246
+ logger: context.logger,
3247
+ debug: context.debug.enabled
3248
+ });
3249
+ const command = new _aws_sdk_client_s3.CopyObjectCommand({
3250
+ ACL: acl || null,
3251
+ Bucket: destinationBucket,
3252
+ CopySource: `${sourceBucket}/${sourceKey}`,
3253
+ Key: destinationKey
3254
+ });
3255
+ return { data: await s3.send(command) };
3256
+ },
3257
+ inputs: copyObjectInputs,
3258
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3259
+ type: "actionOutput",
3260
+ schema: copyObjectOutputSchema
3261
+ }),
3262
+ examplePerform: async () => copyObjectExamplePayload,
3263
+ examplePayload: copyObjectExamplePayload
3264
+ }),
3265
+ deleteObject: (0, _prismatic_io_spectral.action)({
3266
+ display: {
3267
+ label: "Delete Object",
3268
+ description: "Delete an Object within an S3 Bucket"
3269
+ },
3270
+ performSafety: "notAllowed",
3271
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3272
+ const s3 = await createS3Client({
3273
+ awsConnection: accessKey,
3274
+ awsRegion,
3275
+ dynamicAccessKeyId,
3276
+ dynamicSecretAccessKey,
3277
+ dynamicSessionToken,
3278
+ logger: context.logger,
3279
+ debug: context.debug.enabled
3280
+ });
3281
+ const command = new _aws_sdk_client_s3.DeleteObjectCommand({
3282
+ Bucket: bucket,
3283
+ Key: objectKey
3284
+ });
3285
+ return { data: await s3.send(command) };
3286
+ },
3287
+ inputs: deleteObjectInputs,
3288
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3289
+ type: "actionOutput",
3290
+ schema: deleteObjectOutputSchema
3291
+ }),
3292
+ examplePerform: async () => deleteObjectExamplePayload,
3293
+ examplePayload: deleteObjectExamplePayload
3294
+ }),
3295
+ deleteObjects: (0, _prismatic_io_spectral.action)({
3296
+ display: {
3297
+ label: "Delete Objects",
3298
+ description: "Delete multiple objects from a bucket"
3299
+ },
3300
+ performSafety: "notAllowed",
3301
+ perform: async (context, { awsRegion, accessKey, bucket, objectKeys, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3302
+ const s3 = await createS3Client({
3303
+ awsConnection: accessKey,
3304
+ awsRegion,
3305
+ dynamicAccessKeyId,
3306
+ dynamicSecretAccessKey,
3307
+ dynamicSessionToken,
3308
+ logger: context.logger,
3309
+ debug: context.debug.enabled
3310
+ });
3311
+ const command = new _aws_sdk_client_s3.DeleteObjectsCommand({
3312
+ Bucket: bucket,
3313
+ Delete: { Objects: objectKeys }
3314
+ });
3315
+ return { data: await s3.send(command) };
3316
+ },
3317
+ inputs: deleteObjectsInputs,
3318
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3319
+ type: "actionOutput",
3320
+ schema: deleteObjectsOutputSchema
3321
+ }),
3322
+ examplePerform: async () => deleteObjectsExamplePayload,
3323
+ examplePayload: deleteObjectsExamplePayload
3324
+ }),
3325
+ generatePresignedUrl: (0, _prismatic_io_spectral.action)({
3326
+ display: {
3327
+ label: "Generate Presigned URL",
3328
+ description: "Generate a presigned URL that can be used to upload or download an object in S3"
3329
+ },
3330
+ inputs: generatePresignedUrlInputs,
3331
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3332
+ type: "actionOutput",
3333
+ schema: generatePresignedUrlOutputSchema
3334
+ }),
3335
+ performSafety: "notAllowed",
3336
+ perform: async (context, params) => {
3337
+ return { data: await (0, _aws_sdk_s3_request_presigner.getSignedUrl)(await createS3Client({
3338
+ awsConnection: params.accessKey,
3339
+ awsRegion: params.awsRegion,
3340
+ dynamicAccessKeyId: params.dynamicAccessKeyId,
3341
+ dynamicSecretAccessKey: params.dynamicSecretAccessKey,
3342
+ dynamicSessionToken: params.dynamicSessionToken,
3343
+ logger: context.logger,
3344
+ debug: context.debug.enabled
3345
+ }), params.actionType === "download" ? new _aws_sdk_client_s3.GetObjectCommand({
3346
+ Bucket: params.bucket,
3347
+ Key: params.objectKey
3348
+ }) : new _aws_sdk_client_s3.PutObjectCommand({
3349
+ Bucket: params.bucket,
3350
+ Key: params.objectKey
3351
+ }), { expiresIn: params.expirationSeconds }) };
3352
+ },
3353
+ examplePerform: async () => generatePresignedUrlExamplePayload,
3354
+ examplePayload: generatePresignedUrlExamplePayload
3355
+ }),
3356
+ getObject: (0, _prismatic_io_spectral.action)({
3357
+ display: {
3358
+ label: "Get Object",
3359
+ description: "Get the contents of an object"
3360
+ },
3361
+ performSafety: "notAllowed",
3362
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, versionId, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3363
+ const s3 = await createS3Client({
3364
+ awsConnection: accessKey,
3365
+ awsRegion,
3366
+ dynamicAccessKeyId,
3367
+ dynamicSecretAccessKey,
3368
+ dynamicSessionToken,
3369
+ logger: context.logger,
3370
+ debug: context.debug.enabled
3371
+ });
3372
+ const command = new _aws_sdk_client_s3.GetObjectCommand({
3373
+ Bucket: bucket,
3374
+ Key: objectKey,
3375
+ VersionId: versionId
3376
+ });
3377
+ const response = await s3.send(command);
3378
+ const objectBodyAsArray = await response.Body.transformToByteArray();
3379
+ return {
3380
+ data: Buffer.from(objectBodyAsArray),
3381
+ contentType: response.ContentType
3382
+ };
3383
+ },
3384
+ inputs: getObjectInputs,
3385
+ examplePerform: async () => getObjectExamplePayload,
3386
+ examplePayload: getObjectExamplePayload
3387
+ }),
3388
+ getObjectAttributes: (0, _prismatic_io_spectral.action)({
3389
+ display: {
3390
+ label: "Get Object Attributes",
3391
+ description: "Retrieves all the metadata from an object without returning the object itself"
3392
+ },
3393
+ performSafety: "safe",
3394
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, versionId, objectAttributes, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3395
+ const s3 = await createS3Client({
3396
+ awsConnection: accessKey,
3397
+ awsRegion,
3398
+ dynamicAccessKeyId,
3399
+ dynamicSecretAccessKey,
3400
+ dynamicSessionToken,
3401
+ logger: context.logger,
3402
+ debug: context.debug.enabled
3403
+ });
3404
+ const command = new _aws_sdk_client_s3.GetObjectAttributesCommand({
3405
+ Bucket: bucket,
3406
+ Key: objectKey,
3407
+ ObjectAttributes: objectAttributes,
3408
+ VersionId: versionId
3409
+ });
3410
+ return { data: await s3.send(command) };
3411
+ },
3412
+ inputs: getObjectAttributesInputs,
3413
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3414
+ type: "actionOutput",
3415
+ schema: getObjectAttributesOutputSchema
3416
+ }),
3417
+ examplePayload: getObjectAttributesExamplePayload
3418
+ }),
3419
+ headObject: (0, _prismatic_io_spectral.action)({
3420
+ display: {
3421
+ label: "Head Object",
3422
+ description: "Retrieve metadata from an object without returning the object itself"
3423
+ },
3424
+ performSafety: "safe",
3425
+ perform: async (context, { awsRegion, accessKey, bucket, objectKey, versionId, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3426
+ const s3 = await createS3Client({
3427
+ awsConnection: accessKey,
3428
+ awsRegion,
3429
+ dynamicAccessKeyId,
3430
+ dynamicSecretAccessKey,
3431
+ dynamicSessionToken,
3432
+ logger: context.logger,
3433
+ debug: context.debug.enabled
3434
+ });
3435
+ const command = new _aws_sdk_client_s3.HeadObjectCommand({
3436
+ Bucket: bucket,
3437
+ Key: objectKey,
3438
+ VersionId: versionId
3439
+ });
3440
+ return { data: await s3.send(command) };
3441
+ },
3442
+ inputs: headObjectInputs,
3443
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3444
+ type: "actionOutput",
3445
+ schema: headObjectOutputSchema
3446
+ }),
3447
+ examplePayload: headObjectExamplePayload
3448
+ }),
3449
+ listObjects: (0, _prismatic_io_spectral.action)({
3450
+ display: {
3451
+ label: "List Objects",
3452
+ description: "List Objects in a Bucket"
3453
+ },
3454
+ performSafety: "safe",
3455
+ perform: async (context, params) => {
3456
+ const s3 = await createS3Client({
3457
+ awsConnection: params.accessKey,
3458
+ awsRegion: params.awsRegion,
3459
+ dynamicAccessKeyId: params.dynamicAccessKeyId,
3460
+ dynamicSecretAccessKey: params.dynamicSecretAccessKey,
3461
+ dynamicSessionToken: params.dynamicSessionToken,
3462
+ logger: context.logger,
3463
+ debug: context.debug.enabled
3464
+ });
3465
+ const command = new _aws_sdk_client_s3.ListObjectsV2Command({
3466
+ Bucket: params.bucket,
3467
+ Prefix: params.prefix,
3468
+ MaxKeys: params.pagination.maxKeys,
3469
+ ContinuationToken: params.pagination.continuationToken
3470
+ });
3471
+ const response = await s3.send(command);
3472
+ return { data: params.includeMetadata ? response : (response.Contents || []).map(({ Key }) => Key) };
3473
+ },
3474
+ inputs: listObjectsInputs,
3475
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3476
+ type: "actionOutput",
3477
+ schema: listObjectsOutputSchema
3478
+ }),
3479
+ examplePayload: listObjectsExamplePayload
3480
+ }),
3481
+ putObject: (0, _prismatic_io_spectral.action)({
3482
+ display: {
3483
+ label: "Put Object",
3484
+ description: "Write an object to S3"
3485
+ },
3486
+ performSafety: "notAllowed",
3487
+ perform: async (context, { acl, awsRegion, accessKey, bucket, fileContents, objectKey, tagging, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3488
+ const s3 = await createS3Client({
3489
+ awsConnection: accessKey,
3490
+ awsRegion,
3491
+ dynamicAccessKeyId,
3492
+ dynamicSecretAccessKey,
3493
+ dynamicSessionToken,
3494
+ logger: context.logger,
3495
+ debug: context.debug.enabled
3496
+ });
3497
+ const { data, contentType } = fileContents;
3498
+ const command = new _aws_sdk_client_s3.PutObjectCommand({
3499
+ ACL: acl || null,
3500
+ Bucket: bucket,
3501
+ Key: objectKey,
3502
+ Body: data,
3503
+ ContentType: contentType,
3504
+ Tagging: encodeTags(tagging)
3505
+ });
3506
+ return { data: await s3.send(command) };
3507
+ },
3508
+ inputs: putObjectInputs,
3509
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3510
+ type: "actionOutput",
3511
+ schema: putObjectOutputSchema
3512
+ }),
3513
+ examplePerform: async () => putObjectExamplePayload,
3514
+ examplePayload: putObjectExamplePayload
3515
+ })
3516
+ };
3517
+ //#endregion
3518
+ //#region src/actions/sns/index.ts
3519
+ var sns_default = {
3520
+ bucketEventTriggerConfiguration: (0, _prismatic_io_spectral.action)({
3521
+ display: {
3522
+ label: "Add Bucket SNS Event Notification",
3523
+ description: "Add events to send notifications to SNS Topic"
3524
+ },
3525
+ performSafety: "notAllowed",
3526
+ perform: async (_context, { awsRegion, awsConnection, snsTopicArn, eventsList, bucket, eventNotificationName, bucketOwnerAccountid, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3527
+ return { data: await processTopicConfiguration(await createS3Client({
3528
+ awsConnection,
3529
+ awsRegion,
3530
+ dynamicAccessKeyId,
3531
+ dynamicSecretAccessKey,
3532
+ dynamicSessionToken
3533
+ }), bucket, bucketOwnerAccountid, eventNotificationName, {
3534
+ Id: eventNotificationName,
3535
+ TopicArn: snsTopicArn,
3536
+ Events: eventsList
3537
+ }) };
3538
+ },
3539
+ inputs: bucketEventTriggerConfigurationInputs,
3540
+ examplePerform: async () => bucketEventTriggerConfigurationExamplePayload,
3541
+ examplePayload: bucketEventTriggerConfigurationExamplePayload
3542
+ }),
3543
+ createTopic: (0, _prismatic_io_spectral.action)({
3544
+ display: {
3545
+ label: "Create SNS Topic for S3 Event Notification",
3546
+ description: "Create an Amazon SNS Topic to be used with S3 Event Notifications"
3547
+ },
3548
+ performSafety: "notAllowed",
3549
+ perform: async (_context, { awsConnection, awsRegion, name, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3550
+ const sns = await createSNSClient({
3551
+ awsConnection,
3552
+ awsRegion,
3553
+ dynamicAccessKeyId,
3554
+ dynamicSecretAccessKey,
3555
+ dynamicSessionToken
3556
+ });
3557
+ const command = new _aws_sdk_client_sns.CreateTopicCommand({
3558
+ Name: name,
3559
+ Attributes: { FifoTopic: "false" }
3560
+ });
3561
+ return { data: await sns.send(command) };
3562
+ },
3563
+ inputs: createTopicInputs,
3564
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3565
+ type: "actionOutput",
3566
+ schema: createTopicOutputSchema
3567
+ }),
3568
+ examplePerform: async () => createTopicExamplePayload,
3569
+ examplePayload: createTopicExamplePayload
3570
+ }),
3571
+ subscribeToTopic: (0, _prismatic_io_spectral.action)({
3572
+ display: {
3573
+ label: "Subscribe to SNS Topic",
3574
+ description: "Subscribe to an Amazon SNS Topic for S3 Event Notifications"
3575
+ },
3576
+ performSafety: "notAllowed",
3577
+ perform: async (_context, { awsRegion, awsConnection, snsTopicArn, endpoint, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3578
+ const sns = await createSNSClient({
3579
+ awsConnection,
3580
+ awsRegion,
3581
+ dynamicAccessKeyId,
3582
+ dynamicSecretAccessKey,
3583
+ dynamicSessionToken
3584
+ });
3585
+ const subscribeCommand = new _aws_sdk_client_sns.SubscribeCommand({
3586
+ Protocol: "https",
3587
+ TopicArn: snsTopicArn,
3588
+ Endpoint: endpoint
3589
+ });
3590
+ return { data: await sns.send(subscribeCommand) };
3591
+ },
3592
+ inputs: subscribeToTopicInputs,
3593
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3594
+ type: "actionOutput",
3595
+ schema: subscribeToTopicOutputSchema
3596
+ }),
3597
+ examplePerform: async () => subscribeToTopicExamplePayload,
3598
+ examplePayload: subscribeToTopicExamplePayload
3599
+ }),
3600
+ unsubscribeFromTopic: (0, _prismatic_io_spectral.action)({
3601
+ display: {
3602
+ label: "Unsubscribe from SNS Topic",
3603
+ description: "Unsubscribe from an Amazon SNS Topic for S3 Event Notifications"
3604
+ },
3605
+ performSafety: "notAllowed",
3606
+ perform: async (_context, { awsConnection, awsRegion, subscriptionArn, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3607
+ const sns = await createSNSClient({
3608
+ awsConnection,
3609
+ awsRegion,
3610
+ dynamicAccessKeyId,
3611
+ dynamicSecretAccessKey,
3612
+ dynamicSessionToken
3613
+ });
3614
+ const command = new _aws_sdk_client_sns.UnsubscribeCommand({ SubscriptionArn: subscriptionArn });
3615
+ return { data: await sns.send(command) };
3616
+ },
3617
+ inputs: unsubscribeFromTopicInputs,
3618
+ examplePerform: async () => unsubscribeFromTopicExamplePayload,
3619
+ examplePayload: unsubscribeFromTopicExamplePayload
3620
+ }),
3621
+ updateTopicPolicy: (0, _prismatic_io_spectral.action)({
3622
+ display: {
3623
+ label: "Update SNS Topic Policy for S3 Event Notification",
3624
+ description: "Update an Amazon SNS Topic Policy to grant S3 permission to publish"
3625
+ },
3626
+ performSafety: "notAllowed",
3627
+ perform: async (_context, { awsConnection, awsRegion, snsTopicArn, bucketOwnerAccountid, bucket, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3628
+ const sns = await createSNSClient({
3629
+ awsConnection,
3630
+ awsRegion,
3631
+ dynamicAccessKeyId,
3632
+ dynamicSecretAccessKey,
3633
+ dynamicSessionToken
3634
+ });
3635
+ const policy = {
3636
+ Version: "2012-10-17",
3637
+ Id: "allow-s3-to-publish",
3638
+ Statement: [{
3639
+ Sid: "allow-s3-to-publish",
3640
+ Effect: "Allow",
3641
+ Principal: { Service: "s3.amazonaws.com" },
3642
+ Action: ["SNS:Publish"],
3643
+ Resource: snsTopicArn,
3644
+ Condition: {
3645
+ ArnLike: { "aws:SourceArn": `arn:aws:s3:*:*:${bucket}` },
3646
+ StringEquals: { "aws:SourceAccount": bucketOwnerAccountid }
3647
+ }
3648
+ }]
3649
+ };
3650
+ const command = new _aws_sdk_client_sns.SetTopicAttributesCommand({
3651
+ TopicArn: snsTopicArn,
3652
+ AttributeName: "Policy",
3653
+ AttributeValue: JSON.stringify(policy)
3654
+ });
3655
+ return { data: await sns.send(command) };
3656
+ },
3657
+ inputs: updateTopicPolicyInputs,
3658
+ examplePerform: async () => updateTopicPolicyExamplePayload,
3659
+ examplePayload: updateTopicPolicyExamplePayload
3660
+ })
3661
+ };
3662
+ //#endregion
3663
+ //#region src/actions/uploadStreams/index.ts
3664
+ var uploadStreams_default = {
3665
+ closeUploadStream: (0, _prismatic_io_spectral.action)({
3666
+ display: {
3667
+ label: "Close Upload Stream",
3668
+ description: "Close an upload stream"
3669
+ },
3670
+ inputs: closeUploadStreamInputs,
3671
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3672
+ type: "actionOutput",
3673
+ schema: closeUploadStreamOutputSchema
3674
+ }),
3675
+ performSafety: "notAllowed",
3676
+ perform: async ({ executionState }, params) => {
3677
+ const { uploadFinisher, fileStream } = getUploadStream(executionState, params.uploadId);
3678
+ fileStream.end();
3679
+ await uploadFinisher;
3680
+ return { data: null };
3681
+ },
3682
+ examplePerform: async () => closeUploadStreamExamplePayload,
3683
+ examplePayload: closeUploadStreamExamplePayload
3684
+ }),
3685
+ createUploadStream: (0, _prismatic_io_spectral.action)({
3686
+ display: {
3687
+ label: "Create Upload Stream",
3688
+ description: "Create an upload stream to S3"
3689
+ },
3690
+ inputs: createUploadStreamInputs,
3691
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3692
+ type: "actionOutput",
3693
+ schema: createUploadStreamOutputSchema
3694
+ }),
3695
+ performSafety: "notAllowed",
3696
+ perform: async ({ executionState }, params) => {
3697
+ const s3 = await createS3Client({
3698
+ awsConnection: params.accessKey,
3699
+ awsRegion: params.awsRegion,
3700
+ dynamicAccessKeyId: params.dynamicAccessKeyId,
3701
+ dynamicSecretAccessKey: params.dynamicSecretAccessKey,
3702
+ dynamicSessionToken: params.dynamicSessionToken
3703
+ });
3704
+ const uploadId = (0, uuid.v4)();
3705
+ const fileStream = new node_stream.PassThrough({ highWaterMark: 1024 * 1024 });
3706
+ executionState[uploadId] = {
3707
+ uploadFinisher: new _aws_sdk_lib_storage.Upload({
3708
+ client: s3,
3709
+ params: {
3710
+ ACL: params.acl || null,
3711
+ Bucket: params.bucket,
3712
+ Key: params.objectKey,
3713
+ Body: fileStream,
3714
+ Tagging: encodeTags(params.tagging)
3715
+ }
3716
+ }).done(),
3717
+ fileStream
3718
+ };
3719
+ return { data: uploadId };
3720
+ },
3721
+ examplePerform: async () => createUploadStreamExamplePayload,
3722
+ examplePayload: createUploadStreamExamplePayload
3723
+ }),
3724
+ writeUploadStream: (0, _prismatic_io_spectral.action)({
3725
+ display: {
3726
+ label: "Write Upload Stream",
3727
+ description: "Write to an upload stream"
3728
+ },
3729
+ inputs: writeUploadStreamInputs,
3730
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
3731
+ type: "actionOutput",
3732
+ schema: writeUploadStreamOutputSchema
3733
+ }),
3734
+ performSafety: "notAllowed",
3735
+ perform: async ({ executionState }, params) => {
3736
+ const { fileStream } = getUploadStream(executionState, params.uploadId);
3737
+ await new Promise((resolve) => {
3738
+ if (!fileStream.write(params.fileContents.data)) fileStream.once("drain", resolve);
3739
+ else resolve(true);
3740
+ });
3741
+ return { data: null };
3742
+ },
3743
+ examplePerform: async () => writeUploadStreamExamplePayload,
3744
+ examplePayload: writeUploadStreamExamplePayload
3745
+ })
3746
+ };
3747
+ //#endregion
3748
+ //#region src/actions/index.ts
3749
+ var actions_default = {
3750
+ ...bucketNotifications_default,
3751
+ ...buckets_default,
3752
+ ...misc_default,
3753
+ ...multipartUploads_default,
3754
+ ...objectLock_default,
3755
+ ...objects_default,
3756
+ ...sns_default,
3757
+ ...uploadStreams_default
3758
+ };
3759
+ //#endregion
3760
+ //#region src/dataSources/index.ts
3761
+ var dataSources_default = {
3762
+ selectBucket: (0, _prismatic_io_spectral.dataSource)({
3763
+ display: {
3764
+ label: "Select Bucket",
3765
+ description: "A picklist of buckets in the AWS account."
3766
+ },
3767
+ dataSourceType: "picklist",
3768
+ perform: async (_, params) => {
3769
+ return { result: (await listAllBuckets(await createS3Client({
3770
+ awsConnection: params.accessKey,
3771
+ awsRegion: "",
3772
+ dynamicAccessKeyId: params.dynamicAccessKeyId,
3773
+ dynamicSecretAccessKey: params.dynamicSecretAccessKey,
3774
+ dynamicSessionToken: params.dynamicSessionToken
3775
+ }))).map((bucket) => ({
3776
+ label: bucket.Name,
3777
+ key: bucket.Name
3778
+ })) };
3779
+ },
3780
+ inputs: selectBucketInputs,
3781
+ examplePayload: selectBucketExamplePayload
3782
+ }),
3783
+ selectRegion
3784
+ };
3785
+ //#endregion
3786
+ //#region src/triggers/pollChangesFilesTrigger.ts
3787
+ const pollChangesFilesTrigger = (0, _prismatic_io_spectral.pollingTrigger)({
3788
+ display: {
3789
+ label: "New and Updated Files",
3790
+ description: "Checks for new and updated files in a specified S3 bucket on a configured schedule."
3791
+ },
3792
+ inputs: pollChangesFilesTriggerInputs,
3793
+ triggerResolverSupport: "valid",
3794
+ batchConfig: { batchSize: 50 },
3795
+ triggerResolver: {
3796
+ resolveItems: (_context, { payload }) => resolvePolledFileChanges(payload.body.data),
3797
+ getNextPaginationState: (_context, { payload }) => payload.paginationState ?? null
3798
+ },
3799
+ perform: async (context, payload, { accessKey, awsRegion, bucket, lookBackDate, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3800
+ const isBatching = context.batch?.enabled === true;
3801
+ const incoming = payload.paginationState;
3802
+ const state = context.polling.getState();
3803
+ const window = resolveFileListingWindow(state, incoming, isBatching, lookBackDate, (/* @__PURE__ */ new Date()).toISOString());
3804
+ const windowIsEmpty = window.windowStart >= window.windowEnd;
3805
+ const s3 = await createS3Client({
3806
+ awsConnection: accessKey,
3807
+ awsRegion,
3808
+ dynamicAccessKeyId,
3809
+ dynamicSecretAccessKey,
3810
+ dynamicSessionToken,
3811
+ logger: context.logger,
3812
+ debug: context.debug.enabled
3813
+ });
3814
+ const { keys, startAfter } = windowIsEmpty ? {
3815
+ keys: [],
3816
+ startAfter: void 0
3817
+ } : await listObjectsInWindow(s3, bucket, window, isBatching);
3818
+ const nextCursor = startAfter ? {
3819
+ windowStart: window.windowStart,
3820
+ windowEnd: window.windowEnd,
3821
+ startAfter
3822
+ } : void 0;
3823
+ context.polling.setState(nextCursor ? {
3824
+ ...state.lastPolledAt ? { lastPolledAt: state.lastPolledAt } : {},
3825
+ cursor: nextCursor
3826
+ } : { lastPolledAt: windowIsEmpty ? window.windowStart : window.windowEnd });
3827
+ if (context.debug.enabled) context.logger.debug(`Listed ${bucket} from ${window.startAfter ?? "the first key"}: ${keys.length} keys modified between ${window.windowStart} and ${window.windowEnd}; ${nextCursor ? "more pages remain" : "window exhausted"}`);
3828
+ return {
3829
+ payload: {
3830
+ ...payload,
3831
+ paginationState: nextCursor,
3832
+ body: { data: keys }
3833
+ },
3834
+ polledNoChanges: keys.length === 0 && !nextCursor && !incoming
3835
+ };
3836
+ },
3837
+ examplePayload: pollChangesFilesTriggerExamplePayload
3838
+ });
3839
+ //#endregion
3840
+ //#region src/triggers/pollNewBucketsTrigger.ts
3841
+ const pollNewBucketsTrigger = (0, _prismatic_io_spectral.pollingTrigger)({
3842
+ display: {
3843
+ label: "New Buckets",
3844
+ description: "Checks for new buckets in Amazon S3 on a configured schedule."
3845
+ },
3846
+ inputs: pollNewBucketsTriggerInputs,
3847
+ triggerResolverSupport: "valid",
3848
+ batchConfig: { batchSize: 50 },
3849
+ triggerResolver: { resolveItems: (_context, { payload }) => resolvePolledBucketChanges(payload.body.data) },
3850
+ perform: async (context, payload, { accessKey, awsRegion, lookBackDate, dynamicAccessKeyId, dynamicSecretAccessKey, dynamicSessionToken }) => {
3851
+ const now = (/* @__PURE__ */ new Date()).toISOString();
3852
+ const { since, inclusive } = readLastPolledAt(context, now, lookBackDate);
3853
+ const changes = await listBucketsCreatedSince(await createS3Client({
3854
+ awsConnection: accessKey,
3855
+ awsRegion,
3856
+ dynamicAccessKeyId,
3857
+ dynamicSecretAccessKey,
3858
+ dynamicSessionToken,
3859
+ logger: context.logger,
3860
+ debug: context.debug.enabled
3861
+ }), since, inclusive);
3862
+ context.polling.setState({ lastPolledAt: now });
3863
+ return {
3864
+ payload: {
3865
+ ...payload,
3866
+ body: { data: changes }
3867
+ },
3868
+ polledNoChanges: changes.length === 0
3869
+ };
3870
+ },
3871
+ examplePayload: pollNewBucketsTriggerExamplePayload
3872
+ });
3873
+ //#endregion
3874
+ //#region src/triggers/index.ts
3875
+ var triggers_default = {
3876
+ snsS3NotificationWebhook: (0, _prismatic_io_spectral.trigger)({
3877
+ display: {
3878
+ label: "Webhook",
3879
+ description: "Receive Amazon SNS notifications for Amazon S3 events. Confirms SNS subscription requests automatically."
3880
+ },
3881
+ allowsBranching: true,
3882
+ staticBranchNames: ["Notification", "Subscribe"],
3883
+ perform: async (_context, payload, { expectedTopicArn }) => {
3884
+ const bodyData = _prismatic_io_spectral.util.types.toString(payload.rawBody.data);
3885
+ if (!bodyData.length) throw new Error("Missing data in payload");
3886
+ const data = JSON.parse(bodyData);
3887
+ const eventType = data.Type;
3888
+ if (!eventType) throw new Error("Event type not received");
3889
+ if (eventType !== "Notification" && eventType !== "SubscriptionConfirmation") throw new Error(`Message type was not "Notification" or "SubscriptionConfirmation", but "${eventType}" instead.`);
3890
+ await verifySnsMessageSignature(data);
3891
+ if (expectedTopicArn && data.TopicArn !== expectedTopicArn) throw new Error(`Amazon SNS message TopicArn "${data.TopicArn}" did not match the configured Topic ARN; the message was rejected.`);
3892
+ if (eventType === "SubscriptionConfirmation") {
3893
+ assertSnsUrl(data.SubscribeURL, "SubscribeURL");
3894
+ await (0, _prismatic_io_spectral_http.createClient)({ baseUrl: data.SubscribeURL }).get("");
3895
+ return {
3896
+ branch: "Subscribe",
3897
+ payload: {
3898
+ ...payload,
3899
+ body: { data }
3900
+ }
3901
+ };
3902
+ }
3903
+ return {
3904
+ branch: "Notification",
3905
+ payload: {
3906
+ ...payload,
3907
+ body: { data }
3908
+ }
3909
+ };
3910
+ },
3911
+ inputs: snsS3NotificationWebhookInputs,
3912
+ synchronousResponseSupport: "invalid",
3913
+ scheduleSupport: "invalid",
3914
+ examplePayload: snsS3NotificationWebhookExamplePayload
3915
+ }),
3916
+ pollChangesFilesTrigger,
3917
+ pollNewBucketsTrigger
3918
+ };
3919
+ //#endregion
3920
+ //#region src/index.ts
3921
+ var src_default = (0, _prismatic_io_spectral.component)({
3922
+ key: "aws-s3",
3923
+ documentationUrl: "https://prismatic.io/docs/components/aws-s3/",
3924
+ public: true,
3925
+ display: {
3926
+ label: "Amazon S3",
3927
+ description: "Manage objects and buckets in Amazon S3.",
3928
+ iconPath: "icon.png",
3929
+ category: "Data Platforms"
3930
+ },
3931
+ connections: connections_default,
3932
+ actions: actions_default,
3933
+ dataSources: dataSources_default,
3934
+ triggers: triggers_default,
3935
+ hooks: { error: _prismatic_io_spectral_http.handleErrors }
3936
+ });
3937
+ //#endregion
3938
+ //#region npm-dist/.entry.ts
3939
+ var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
3940
+ //#endregion
3941
+ module.exports = _entry_default;