@activepieces/piece-amazon-s3 0.6.0 → 0.6.2

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.
Files changed (50) hide show
  1. package/package.json +7 -14
  2. package/src/i18n/translation.json +0 -40
  3. package/src/index.js +43 -27
  4. package/src/index.d.ts +0 -12
  5. package/src/index.d.ts.map +0 -1
  6. package/src/index.js.map +0 -1
  7. package/src/lib/actions/decrypt-pgp-file.d.ts +0 -19
  8. package/src/lib/actions/decrypt-pgp-file.d.ts.map +0 -1
  9. package/src/lib/actions/decrypt-pgp-file.js +0 -208
  10. package/src/lib/actions/decrypt-pgp-file.js.map +0 -1
  11. package/src/lib/actions/delete-file.d.ts +0 -14
  12. package/src/lib/actions/delete-file.d.ts.map +0 -1
  13. package/src/lib/actions/delete-file.js +0 -39
  14. package/src/lib/actions/delete-file.js.map +0 -1
  15. package/src/lib/actions/generate-signed-upload-url.d.ts +0 -15
  16. package/src/lib/actions/generate-signed-upload-url.d.ts.map +0 -1
  17. package/src/lib/actions/generate-signed-upload-url.js +0 -66
  18. package/src/lib/actions/generate-signed-upload-url.js.map +0 -1
  19. package/src/lib/actions/generate-signed-url.d.ts +0 -15
  20. package/src/lib/actions/generate-signed-url.d.ts.map +0 -1
  21. package/src/lib/actions/generate-signed-url.js +0 -64
  22. package/src/lib/actions/generate-signed-url.js.map +0 -1
  23. package/src/lib/actions/list-files.d.ts +0 -15
  24. package/src/lib/actions/list-files.d.ts.map +0 -1
  25. package/src/lib/actions/list-files.js +0 -75
  26. package/src/lib/actions/list-files.js.map +0 -1
  27. package/src/lib/actions/move-file.d.ts +0 -15
  28. package/src/lib/actions/move-file.d.ts.map +0 -1
  29. package/src/lib/actions/move-file.js +0 -53
  30. package/src/lib/actions/move-file.js.map +0 -1
  31. package/src/lib/actions/read-file.d.ts +0 -14
  32. package/src/lib/actions/read-file.d.ts.map +0 -1
  33. package/src/lib/actions/read-file.js +0 -47
  34. package/src/lib/actions/read-file.js.map +0 -1
  35. package/src/lib/actions/upload-file.d.ts +0 -17
  36. package/src/lib/actions/upload-file.d.ts.map +0 -1
  37. package/src/lib/actions/upload-file.js +0 -110
  38. package/src/lib/actions/upload-file.js.map +0 -1
  39. package/src/lib/auth.d.ts +0 -37
  40. package/src/lib/auth.d.ts.map +0 -1
  41. package/src/lib/auth.js +0 -255
  42. package/src/lib/auth.js.map +0 -1
  43. package/src/lib/common.d.ts +0 -30
  44. package/src/lib/common.d.ts.map +0 -1
  45. package/src/lib/common.js +0 -124
  46. package/src/lib/common.js.map +0 -1
  47. package/src/lib/triggers/new-file.d.ts +0 -55
  48. package/src/lib/triggers/new-file.d.ts.map +0 -1
  49. package/src/lib/triggers/new-file.js +0 -125
  50. package/src/lib/triggers/new-file.js.map +0 -1
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteFile = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../auth");
7
- const common_1 = require("../common");
8
- exports.deleteFile = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.amazonS3CombinedAuth,
10
- name: 'deleteFile',
11
- displayName: 'Delete File',
12
- description: 'Deletes an existing file.',
13
- audience: 'both',
14
- aiMetadata: {
15
- description: 'Deletes a single object from the configured S3 bucket by its full key (path). Use to remove a known file. Idempotent: deleting an already-absent key succeeds without error, so repeating the call has no further effect.',
16
- idempotent: true,
17
- },
18
- props: {
19
- key: pieces_framework_1.Property.ShortText({
20
- displayName: 'File Path',
21
- description: 'The full path to the file within your S3 bucket (e.g. "documents/report.csv" or "myfile.txt"). This is also called the S3 "key".',
22
- required: true,
23
- }),
24
- },
25
- run(context) {
26
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
- const authProps = context.auth.props;
28
- const { bucket } = authProps;
29
- const { key } = context.propsValue;
30
- const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
31
- const response = yield s3.deleteObject({
32
- Bucket: bucket,
33
- Key: key,
34
- });
35
- return response;
36
- });
37
- },
38
- });
39
- //# sourceMappingURL=delete-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA4D;AAC5D,sCAA4C;AAE/B,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2BAA2B;IACxC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,2NAA2N;QACxO,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,kIAAkI;YAC/I,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,SAAS,GAAgB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAClD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;YAC7B,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEnC,MAAM,EAAE,GAAG,MAAM,IAAA,wBAAe,EAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAExE,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,YAAY,CAAC;gBACrC,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,GAAG;aACT,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAA;QACjB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const generateSignedUploadUrl: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- }> | import("@activepieces/pieces-framework").OIDCProperty<{
8
- roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
- }>)[], {
12
- key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
- expiresIn: import("@activepieces/pieces-framework").NumberProperty<true>;
14
- }>;
15
- //# sourceMappingURL=generate-signed-upload-url.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-signed-upload-url.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-upload-url.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;EAqClC,CAAC"}
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateSignedUploadUrl = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const client_s3_1 = require("@aws-sdk/client-s3");
7
- const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
8
- const auth_1 = require("../auth");
9
- const common_1 = require("../common");
10
- exports.generateSignedUploadUrl = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.amazonS3CombinedAuth,
12
- name: 'generate-signed-upload-url',
13
- displayName: 'Generate Signed Upload URL',
14
- description: 'Generate a pre-signed URL that allows anyone with the link to upload a file directly to S3 without needing AWS credentials.',
15
- audience: 'both',
16
- aiMetadata: {
17
- description: 'Generates a time-limited pre-signed upload (PUT) URL for a target key in the configured S3 bucket, letting anyone with the link upload a file directly to S3 without AWS credentials until it expires. Use to delegate an upload to an external client. Generating the URL does not itself create or modify any object and is idempotent (each call returns a freshly signed URL).',
18
- idempotent: true,
19
- },
20
- props: {
21
- key: pieces_framework_1.Property.ShortText({
22
- displayName: 'File Key',
23
- description: 'The destination path and filename inside the bucket, e.g. "uploads/photo.jpg".',
24
- required: true,
25
- }),
26
- expiresIn: pieces_framework_1.Property.Number({
27
- displayName: 'Expires In (minutes)',
28
- description: 'How long the upload URL should remain valid (in minutes).',
29
- required: true,
30
- defaultValue: 10,
31
- }),
32
- },
33
- run(context) {
34
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
- const authProps = context.auth.props;
36
- const { key, expiresIn } = context.propsValue;
37
- const signedUrl = (0, common_1.isOidcAuth)(authProps)
38
- ? yield createUploadUrlWithAssumeRole({ auth: authProps, server: context.server, key, expiresIn })
39
- : yield createUploadUrlWithClient({ auth: authProps, key, expiresIn });
40
- return {
41
- url: signedUrl,
42
- };
43
- });
44
- },
45
- });
46
- function createUploadUrlWithAssumeRole(_a) {
47
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, server, key, expiresIn, }) {
48
- const expiresInSeconds = (expiresIn !== null && expiresIn !== void 0 ? expiresIn : 10) * 60;
49
- // A URL signed with temporary STS credentials stops working once the session expires,
50
- // so the session must outlast the requested URL validity — and STS caps web-identity
51
- // sessions at 12h. Beyond that the URL would die silently before its stated expiry.
52
- if (expiresInSeconds > common_1.MAX_STS_DURATION_SECONDS) {
53
- throw new Error(`IAM Role (OIDC) signed URLs can be valid for at most ${common_1.MAX_STS_DURATION_SECONDS / 60} minutes (12 hours). Reduce "Expires In", or use Access Key authentication for longer-lived URLs.`);
54
- }
55
- const durationSeconds = Math.max(expiresInSeconds, common_1.MIN_STS_DURATION_SECONDS);
56
- const s3 = yield (0, common_1.createS3WithAssumeRole)({ auth, server, durationSeconds });
57
- const command = new client_s3_1.PutObjectCommand({ Bucket: auth.bucket, Key: key });
58
- return (0, s3_request_presigner_1.getSignedUrl)(s3, command, { expiresIn: expiresInSeconds });
59
- });
60
- }
61
- function createUploadUrlWithClient({ auth, key, expiresIn, }) {
62
- const s3 = (0, common_1.createS3)(auth);
63
- const command = new client_s3_1.PutObjectCommand({ Bucket: auth.bucket, Key: key });
64
- return (0, s3_request_presigner_1.getSignedUrl)(s3, command, { expiresIn: (expiresIn !== null && expiresIn !== void 0 ? expiresIn : 10) * 60 });
65
- }
66
- //# sourceMappingURL=generate-signed-upload-url.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-signed-upload-url.js","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-upload-url.ts"],"names":[],"mappings":";;;;AAAA,qEAAuF;AACvF,kDAAsD;AACtD,wEAA6D;AAC7D,kCAA+F;AAC/F,sCAA6H;AAEhH,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EACT,6HAA6H;IAC/H,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,oXAAoX;QACjY,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,UAAU;YACvB,WAAW,EACT,gFAAgF;YAClF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,EAAE;SACjB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,SAAS,GAAgB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAClD,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE9C,MA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AAM,EAAE,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAI,4BAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACxE,OAAO,IAAA,mCAAY,EAAC,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const generateSignedUrl: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- }> | import("@activepieces/pieces-framework").OIDCProperty<{
8
- roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
- }>)[], {
12
- key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
- expiresIn: import("@activepieces/pieces-framework").NumberProperty<true>;
14
- }>;
15
- //# sourceMappingURL=generate-signed-url.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-signed-url.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-url.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;EAiC5B,CAAC"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateSignedUrl = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const client_s3_1 = require("@aws-sdk/client-s3");
7
- const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
8
- const auth_1 = require("../auth");
9
- const common_1 = require("../common");
10
- exports.generateSignedUrl = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.amazonS3CombinedAuth,
12
- name: 'generate-signed-url',
13
- displayName: 'Generate signed URL',
14
- description: 'Generate a signed URL for a file in a s3 bucket',
15
- audience: 'both',
16
- aiMetadata: {
17
- description: 'Generates a time-limited pre-signed download (GET) URL for an existing object in the configured S3 bucket, letting anyone with the link fetch the file without AWS credentials until it expires. Use when you need to share read access to a stored file. Read-only and idempotent (no object is modified), though each call returns a freshly signed URL.',
18
- idempotent: true,
19
- },
20
- props: {
21
- key: pieces_framework_1.Property.ShortText({
22
- displayName: 'File Path',
23
- description: 'The full path to the file within your S3 bucket (e.g. "documents/report.csv" or "myfile.txt"). This is also called the S3 "key".',
24
- required: true,
25
- }),
26
- expiresIn: pieces_framework_1.Property.Number({
27
- displayName: 'Expires In (minutes)',
28
- description: 'How long the URL should remain valid (in minutes).',
29
- required: true,
30
- defaultValue: 10,
31
- }),
32
- },
33
- run(context) {
34
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
- const authProps = context.auth.props;
36
- const { key, expiresIn } = context.propsValue;
37
- const clientUrl = (0, common_1.isOidcAuth)(authProps)
38
- ? yield createPresignedUrlWithAssumeRole({ auth: authProps, server: context.server, key, expiresIn })
39
- : yield createPresignedUrlWithClient({ auth: authProps, key, expiresIn });
40
- return clientUrl;
41
- });
42
- },
43
- });
44
- function createPresignedUrlWithAssumeRole(_a) {
45
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, server, key, expiresIn, }) {
46
- const expiresInSeconds = expiresIn * 60;
47
- // A URL signed with temporary STS credentials stops working once the session expires,
48
- // so the session must outlast the requested URL validity — and STS caps web-identity
49
- // sessions at 12h. Beyond that the URL would die silently before its stated expiry.
50
- if (expiresInSeconds > common_1.MAX_STS_DURATION_SECONDS) {
51
- throw new Error(`IAM Role (OIDC) signed URLs can be valid for at most ${common_1.MAX_STS_DURATION_SECONDS / 60} minutes (12 hours). Reduce "Expires In", or use Access Key authentication for longer-lived URLs.`);
52
- }
53
- const durationSeconds = Math.max(expiresInSeconds, common_1.MIN_STS_DURATION_SECONDS);
54
- const s3 = yield (0, common_1.createS3WithAssumeRole)({ auth, server, durationSeconds });
55
- const command = new client_s3_1.GetObjectCommand({ Bucket: auth.bucket, Key: key });
56
- return (0, s3_request_presigner_1.getSignedUrl)(s3, command, { expiresIn: expiresInSeconds });
57
- });
58
- }
59
- function createPresignedUrlWithClient({ auth, key, expiresIn, }) {
60
- const s3 = (0, common_1.createS3)(auth);
61
- const command = new client_s3_1.GetObjectCommand({ Bucket: auth.bucket, Key: key });
62
- return (0, s3_request_presigner_1.getSignedUrl)(s3, command, { expiresIn: expiresIn * 60 });
63
- }
64
- //# sourceMappingURL=generate-signed-url.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-signed-url.js","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-url.ts"],"names":[],"mappings":";;;;AAAA,qEAAuF;AACvF,kDAAsD;AACtD,wEAA6D;AAC7D,kCAA+F;AAC/F,sCAA6H;AAEhH,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,iDAAiD;IAC9D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,4VAA4V;QACzW,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,kIAAkI;YAC/I,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,E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CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QACxE,OAAO,IAAA,mCAAY,EAAC,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACpE,CAAC;CAAA;AAED,SAAS,4BAA4B,CAAC,EACpC,IAAI,EACJ,GAAG,EACH,SAAS,GAKV;IACC,MAAM,EAAE,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAI,4BAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACxE,OAAO,IAAA,mCAAY,EAAC,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,GAAG,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const listFiles: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- }> | import("@activepieces/pieces-framework").OIDCProperty<{
8
- roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
- }>)[], {
12
- prefix: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
- maxKeys: import("@activepieces/pieces-framework").NumberProperty<false>;
14
- }>;
15
- //# sourceMappingURL=list-files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-files.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-files.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,SAAS;;;;;;;;;;;;;EA2EpB,CAAC"}
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listFiles = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../auth");
7
- const common_1 = require("../common");
8
- exports.listFiles = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.amazonS3CombinedAuth,
10
- name: 'list-files',
11
- displayName: 'List Files',
12
- description: 'List all files from an S3 bucket folder/prefix.',
13
- audience: 'both',
14
- aiMetadata: {
15
- description: 'Lists objects in the configured S3 bucket, optionally filtered to a folder prefix (empty prefix lists the whole bucket), capped at a maximum count (1-1000, default 1000) and sorted newest-first. Use to discover files or look up an object key before reading, moving, or deleting it. Read-only and idempotent.',
16
- idempotent: true,
17
- },
18
- props: {
19
- prefix: pieces_framework_1.Property.ShortText({
20
- displayName: 'Folder Path (Optional)',
21
- description: 'Filter results to a specific folder. Enter the folder path including the trailing slash (e.g. "invoices/" or "reports/2024/"). Leave empty to list all files in the bucket.',
22
- required: false,
23
- }),
24
- maxKeys: pieces_framework_1.Property.Number({
25
- displayName: 'Maximum Files',
26
- description: 'Maximum number of files to return (1–1000). Defaults to 1000. Use a lower number if you only need the most recent files.',
27
- required: false,
28
- defaultValue: 1000,
29
- }),
30
- },
31
- run(context) {
32
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
- const authProps = context.auth.props;
34
- const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
35
- const params = {
36
- Bucket: authProps.bucket,
37
- MaxKeys: Math.min(Math.max(context.propsValue.maxKeys || 1000, 1), 1000),
38
- };
39
- if (context.propsValue.prefix) {
40
- params.Prefix = context.propsValue.prefix;
41
- }
42
- try {
43
- const response = yield s3.listObjectsV2(params);
44
- const files = [];
45
- // Include all files (including those in subfolders)
46
- if (response.Contents) {
47
- for (const object of response.Contents) {
48
- // Skip if required properties are missing
49
- if (!object.Key || object.Size === undefined || !object.LastModified || !object.ETag) {
50
- continue;
51
- }
52
- files.push({
53
- key: object.Key,
54
- size: object.Size,
55
- lastModified: object.LastModified,
56
- etag: object.ETag,
57
- storageClass: object.StorageClass,
58
- });
59
- }
60
- }
61
- // Sort files by lastModified date (most recent first)
62
- files.sort((a, b) => new Date(b.lastModified).getTime() - new Date(a.lastModified).getTime());
63
- const result = {
64
- files,
65
- isTruncated: response.IsTruncated || false,
66
- };
67
- return result;
68
- }
69
- catch (error) {
70
- throw new Error(`Failed to list files from S3: ${error instanceof Error ? error.message : 'Unknown error'}`);
71
- }
72
- });
73
- },
74
- });
75
- //# sourceMappingURL=list-files.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-files.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-files.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA4D;AAC5D,sCAA4C;AAiB/B,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,iDAAiD;IAC9D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,qTAAqT;QAClU,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,wBAAwB;YACrC,WAAW,EAAE,6KAA6K;YAC1L,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACvB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,0HAA0H;YACvI,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;KAEH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,SAAS,GAAgB,OAAO,CAAC,IAAI,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AC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;gBAE9F,MAAM,MAAM,GAAoB;oBAC9B,KAAK;oBACL,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,KAAK;iBAC3C,CAAC;gBAEF,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;YAC/G,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const moveFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- }> | import("@activepieces/pieces-framework").OIDCProperty<{
8
- roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
- }>)[], {
12
- fileKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
- folderKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
14
- }>;
15
- //# sourceMappingURL=move-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"move-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/move-file.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;EAgDnB,CAAC"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.moveFile = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../auth");
7
- const common_1 = require("../common");
8
- exports.moveFile = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.amazonS3CombinedAuth,
10
- name: 'moveFile',
11
- displayName: 'Move File',
12
- description: 'Move a File to Another Folder',
13
- audience: 'both',
14
- aiMetadata: {
15
- description: 'Moves an object within the configured S3 bucket by copying it to a new key under the destination folder (keeping the same filename) and then deleting the original. Use to relocate or archive a file. Not idempotent — the source object is deleted on the first successful run, so a repeat call errors because the source key no longer exists.',
16
- idempotent: false,
17
- },
18
- props: {
19
- fileKey: pieces_framework_1.Property.ShortText({
20
- displayName: 'File Path',
21
- description: 'The full path to the file you want to move (e.g. "old-folder/report.csv").',
22
- required: true,
23
- }),
24
- folderKey: pieces_framework_1.Property.ShortText({
25
- displayName: 'Destination Folder',
26
- description: 'The folder path to move the file into (e.g. "archive/" or "new-folder"). The file name is kept the same.',
27
- required: true,
28
- }),
29
- },
30
- run(context) {
31
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
- const authProps = context.auth.props;
33
- const { bucket } = authProps;
34
- const { fileKey, folderKey } = context.propsValue;
35
- const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
36
- const fileName = fileKey.split('/').pop();
37
- const folderName = folderKey.endsWith('/') ? folderKey.slice(0, -1) : folderKey;
38
- const newKey = `${folderName}/${fileName}`;
39
- const copyResponse = yield s3.copyObject({
40
- Bucket: bucket,
41
- Key: newKey,
42
- // https://github.com/aws/aws-sdk-js-v3/issues/5475
43
- CopySource: encodeURIComponent(`${bucket}/${fileKey}`),
44
- });
45
- const deleteResponse = yield s3.deleteObject({
46
- Bucket: bucket,
47
- Key: fileKey
48
- });
49
- return copyResponse;
50
- });
51
- },
52
- });
53
- //# sourceMappingURL=move-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"move-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/move-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA4D;AAC5D,sCAA4C;AAE/B,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,+BAA+B;IAC5C,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,oVAAoV;QACjW,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,4EAA4E;YACzF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,0GAA0G;YACvH,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,SAAS,GAAgB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAClD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;YAC7B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAClD,MAAM,EAAE,GAAG,MAAM,IAAA,wBAAe,EAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAExE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YAE1C,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,SAAS,CAAC;YAE/E,MAAM,MAAM,GAAG,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;YAE3C,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC;gBACvC,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,MAAM;gBACX,mDAAmD;gBACnD,UAAU,EAAE,kBAAkB,CAAC,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC;aACvD,CAAC,CAAA;YAEF,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC,YAAY,CAAC;gBAC3C,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,OAAO;aACb,CAAC,CAAA;YAEF,OAAO,YAAY,CAAA;QACrB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- export declare const readFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- }> | import("@activepieces/pieces-framework").OIDCProperty<{
8
- roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
- }>)[], {
12
- key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
- }>;
14
- //# sourceMappingURL=read-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/read-file.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ;;;;;;;;;;;;EAoCnB,CAAC"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readFile = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../auth");
7
- const common_1 = require("../common");
8
- exports.readFile = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.amazonS3CombinedAuth,
10
- name: 'read-file',
11
- displayName: 'Read File',
12
- description: 'Read a file from S3 to use it in other steps',
13
- audience: 'both',
14
- aiMetadata: {
15
- description: 'Downloads a single object from the configured S3 bucket by its full key (path) and makes its contents available as a file for later steps. Use to fetch a known file when you have its exact key. Reading the same key repeatedly returns the same content with no side effect (idempotent).',
16
- idempotent: true,
17
- },
18
- props: {
19
- key: pieces_framework_1.Property.ShortText({
20
- displayName: 'File Path',
21
- description: 'The full path to the file within your S3 bucket (e.g. "documents/report.csv" or "myfile.txt"). This is also called the S3 "key".',
22
- required: true,
23
- }),
24
- },
25
- run(context) {
26
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
- var _a;
28
- const authProps = context.auth.props;
29
- const { bucket } = authProps;
30
- const { key } = context.propsValue;
31
- const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
32
- const file = yield s3.getObject({
33
- Bucket: bucket,
34
- Key: key,
35
- });
36
- const base64 = yield ((_a = file.Body) === null || _a === void 0 ? void 0 : _a.transformToString('base64'));
37
- if (!base64) {
38
- throw new Error(`Could not read file ${key} from S3`);
39
- }
40
- return yield context.files.write({
41
- fileName: key,
42
- data: Buffer.from(base64, 'base64'),
43
- });
44
- });
45
- },
46
- });
47
- //# sourceMappingURL=read-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/read-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA4D;AAC5D,sCAA4C;AAE/B,QAAA,QAAQ,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}
@@ -1,17 +0,0 @@
1
- export declare const amazons3UploadFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- }> | import("@activepieces/pieces-framework").OIDCProperty<{
8
- roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
- }>)[], {
12
- file: import("@activepieces/pieces-framework").FileProperty<true>;
13
- fileName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
- acl: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
15
- type: import("@activepieces/pieces-framework").ShortTextProperty<false>;
16
- }>;
17
- //# sourceMappingURL=upload-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/upload-file.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAyG7B,CAAC"}
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.amazons3UploadFile = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../auth");
7
- const common_1 = require("../common");
8
- const mime_types_1 = tslib_1.__importDefault(require("mime-types"));
9
- exports.amazons3UploadFile = (0, pieces_framework_1.createAction)({
10
- auth: auth_1.amazonS3CombinedAuth,
11
- name: 'upload-file',
12
- displayName: 'Upload File',
13
- description: 'Upload an File to S3',
14
- audience: 'both',
15
- aiMetadata: {
16
- description: 'Uploads a file to the configured S3 bucket, optionally setting a destination filename, content type, and canned ACL (e.g. private vs. public-read). Use to store new content in S3. Not idempotent: when no filename is given a unique timestamp-based key is generated, so each call writes a new object.',
17
- idempotent: false,
18
- },
19
- props: {
20
- file: pieces_framework_1.Property.File({
21
- displayName: 'File',
22
- description: 'The file to upload to S3.',
23
- required: true,
24
- }),
25
- fileName: pieces_framework_1.Property.ShortText({
26
- displayName: 'File Name (Optional)',
27
- required: false,
28
- description: 'The name to save the file as in S3 (e.g. "report-2024.csv"). If left blank, a unique name is generated automatically.',
29
- }),
30
- acl: pieces_framework_1.Property.StaticDropdown({
31
- displayName: 'Access Control (ACL)',
32
- description: 'Who can access this file after upload. Use "Private" for internal files, "Public Read" to make the file publicly accessible via URL.',
33
- required: false,
34
- options: {
35
- options: [
36
- {
37
- label: 'Private (only your account)',
38
- value: 'private',
39
- },
40
- {
41
- label: 'Public Read (anyone can view)',
42
- value: 'public-read',
43
- },
44
- {
45
- label: 'Public Read/Write (anyone can view and upload)',
46
- value: 'public-read-write',
47
- },
48
- {
49
- label: 'Authenticated AWS Users Read',
50
- value: 'authenticated-read',
51
- },
52
- {
53
- label: 'AWS EC2 Read (aws-exec-read)',
54
- value: 'aws-exec-read',
55
- },
56
- {
57
- label: 'Bucket Owner Read',
58
- value: 'bucket-owner-read',
59
- },
60
- {
61
- label: 'Bucket Owner Full Control',
62
- value: 'bucket-owner-full-control',
63
- },
64
- ],
65
- },
66
- }),
67
- type: pieces_framework_1.Property.ShortText({
68
- displayName: "Content Type",
69
- description: "Content Type of the uploaded file, if not set the API will try to figure out the content type.",
70
- required: false
71
- })
72
- },
73
- run(context) {
74
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
75
- const authProps = context.auth.props;
76
- const { bucket } = authProps;
77
- const { file, fileName, acl, type } = context.propsValue;
78
- const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
79
- let contentType, extension = null;
80
- if (!type) {
81
- if (!file.extension || file.extension === undefined || !mime_types_1.default.contentType(file.extension)) {
82
- throw new Error("Content type could not be interpreted, please check the input file.");
83
- }
84
- extension = '.' + file.extension;
85
- contentType = mime_types_1.default.contentType(extension);
86
- }
87
- else if (!mime_types_1.default.extension(type)) {
88
- throw new Error("The content type entered does not exist or is misspelled, please check your input.");
89
- }
90
- else {
91
- contentType = type;
92
- extension = '.' + mime_types_1.default.extension(type);
93
- }
94
- const generatedName = new Date().toISOString() + Date.now() + extension;
95
- const finalFileName = fileName ? (fileName.endsWith(extension) ? fileName : fileName + extension) : generatedName;
96
- const uploadResponse = yield s3.putObject({
97
- Bucket: bucket,
98
- Key: finalFileName,
99
- ACL: acl,
100
- ContentType: contentType,
101
- Body: file.data,
102
- });
103
- return {
104
- fileName: finalFileName,
105
- etag: uploadResponse.ETag,
106
- };
107
- });
108
- },
109
- });
110
- //# sourceMappingURL=upload-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/upload-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA4D;AAC5D,sCAA4C;AAE5C,oEAA8B;AAEjB,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,4SAA4S;QACzT,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uHAAuH;S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