@activepieces/piece-amazon-s3 0.5.10 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/src/index.d.ts +7 -3
- package/src/index.d.ts.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/lib/actions/decrypt-pgp-file.d.ts +7 -3
- package/src/lib/actions/decrypt-pgp-file.d.ts.map +1 -1
- package/src/lib/actions/decrypt-pgp-file.js +25 -20
- package/src/lib/actions/decrypt-pgp-file.js.map +1 -1
- package/src/lib/actions/delete-file.d.ts +7 -3
- package/src/lib/actions/delete-file.d.ts.map +1 -1
- package/src/lib/actions/delete-file.js +4 -3
- package/src/lib/actions/delete-file.js.map +1 -1
- package/src/lib/actions/generate-signed-upload-url.d.ts +7 -3
- package/src/lib/actions/generate-signed-upload-url.d.ts.map +1 -1
- package/src/lib/actions/generate-signed-upload-url.js +26 -13
- package/src/lib/actions/generate-signed-upload-url.js.map +1 -1
- package/src/lib/actions/generate-signed-url.d.ts +7 -3
- package/src/lib/actions/generate-signed-url.d.ts.map +1 -1
- package/src/lib/actions/generate-signed-url.js +26 -21
- package/src/lib/actions/generate-signed-url.js.map +1 -1
- package/src/lib/actions/list-files.d.ts +7 -3
- package/src/lib/actions/list-files.d.ts.map +1 -1
- package/src/lib/actions/list-files.js +4 -3
- package/src/lib/actions/list-files.js.map +1 -1
- package/src/lib/actions/move-file.d.ts +7 -3
- package/src/lib/actions/move-file.d.ts.map +1 -1
- package/src/lib/actions/move-file.js +4 -3
- package/src/lib/actions/move-file.js.map +1 -1
- package/src/lib/actions/read-file.d.ts +7 -3
- package/src/lib/actions/read-file.d.ts.map +1 -1
- package/src/lib/actions/read-file.js +4 -3
- package/src/lib/actions/read-file.js.map +1 -1
- package/src/lib/actions/upload-file.d.ts +7 -3
- package/src/lib/actions/upload-file.d.ts.map +1 -1
- package/src/lib/actions/upload-file.js +4 -3
- package/src/lib/actions/upload-file.js.map +1 -1
- package/src/lib/auth.d.ts +30 -1
- package/src/lib/auth.d.ts.map +1 -1
- package/src/lib/auth.js +210 -145
- package/src/lib/auth.js.map +1 -1
- package/src/lib/common.d.ts +25 -9
- package/src/lib/common.d.ts.map +1 -1
- package/src/lib/common.js +93 -0
- package/src/lib/common.js.map +1 -1
- package/src/lib/triggers/new-file.d.ts +28 -12
- package/src/lib/triggers/new-file.d.ts.map +1 -1
- package/src/lib/triggers/new-file.js +60 -46
- package/src/lib/triggers/new-file.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-amazon-s3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@activepieces/pieces-common": "0.12.
|
|
8
|
-
"@activepieces/pieces-framework": "0.
|
|
9
|
-
"@activepieces/shared": "0.
|
|
7
|
+
"@activepieces/pieces-common": "0.12.5",
|
|
8
|
+
"@activepieces/pieces-framework": "0.32.0",
|
|
9
|
+
"@activepieces/shared": "0.95.1",
|
|
10
10
|
"@aws-sdk/client-s3": "3.974.0",
|
|
11
|
+
"@aws-sdk/client-sts": "3.974.0",
|
|
11
12
|
"@aws-sdk/client-secrets-manager": "3.0.0",
|
|
12
13
|
"@aws-sdk/s3-request-presigner": "3.894.0",
|
|
13
14
|
"dayjs": "1.11.9",
|
package/src/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export declare const amazonS3: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
1
|
+
export declare const amazonS3: import("@activepieces/pieces-framework").Piece<(import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
4
|
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
5
|
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
|
|
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
|
+
}>)[]>;
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ;;;;;;;;;;MAWnB,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -20,7 +20,7 @@ exports.amazonS3 = (0, pieces_framework_1.createPiece)({
|
|
|
20
20
|
minimumSupportedRelease: '0.30.0',
|
|
21
21
|
authors: ["Willianwg", "kishanprmr", "MoShizzle", "AbdulTheActivePiecer", "khaledmashaly", "abuaboud", "Kevinyu-alan", "hugh-codes"],
|
|
22
22
|
categories: [shared_1.PieceCategory.DEVELOPER_TOOLS],
|
|
23
|
-
auth: auth_1.
|
|
23
|
+
auth: auth_1.amazonS3CombinedAuth,
|
|
24
24
|
actions: [upload_file_1.amazons3UploadFile, read_file_1.readFile, generate_signed_url_1.generateSignedUrl, generate_signed_upload_url_1.generateSignedUploadUrl, move_file_1.moveFile, delete_file_1.deleteFile, list_files_1.listFiles, decrypt_pgp_file_1.decryptPgpFile],
|
|
25
25
|
triggers: [new_file_1.newFile],
|
|
26
26
|
});
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qEAEwC;AACxC,iDAAqD;AACrD,uDAAmD;AACnD,2DAA+D;AAC/D,sDAAkD;AAClD,2EAAsE;AACtE,yFAAmF;AACnF,uDAAmD;AACnD,2DAAuD;AACvD,yDAAqD;AACrD,qEAAgE;AAChE,qCAAkD;AAErC,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,+BAA+B;IAE5C,OAAO,EAAE,mDAAmD;IAC5D,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,sBAAsB,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC;IACpI,UAAU,EAAE,CAAC,sBAAa,CAAC,eAAe,CAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,OAAO,EAAE,CAAC,gCAAkB,EAAE,oBAAQ,EAAE,uCAAiB,EAAE,oDAAuB,EAAE,oBAAQ,EAAE,wBAAU,EAAE,sBAAS,EAAE,iCAAc,CAAC;IACpI,QAAQ,EAAE,CAAC,kBAAO,CAAC;CACpB,CAAC,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export declare const decryptPgpFile: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
1
|
+
export declare const decryptPgpFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
4
|
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
5
|
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
|
|
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
|
+
}>)[], {
|
|
8
12
|
key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
13
|
secretArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
14
|
passphraseArn: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decrypt-pgp-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/decrypt-pgp-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decrypt-pgp-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/decrypt-pgp-file.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;EA4NzB,CAAC"}
|
|
@@ -4,11 +4,12 @@ exports.decryptPgpFile = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
|
|
7
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
7
8
|
const openpgp = tslib_1.__importStar(require("openpgp"));
|
|
8
9
|
const auth_1 = require("../auth");
|
|
9
10
|
const common_1 = require("../common");
|
|
10
11
|
exports.decryptPgpFile = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.
|
|
12
|
+
auth: auth_1.amazonS3CombinedAuth,
|
|
12
13
|
name: 'decrypt-pgp-file',
|
|
13
14
|
displayName: 'Decrypt PGP File',
|
|
14
15
|
description: 'Decrypt a PGP encrypted file from S3 using a private key stored in AWS Secrets Manager',
|
|
@@ -54,11 +55,21 @@ exports.decryptPgpFile = (0, pieces_framework_1.createAction)({
|
|
|
54
55
|
run(context) {
|
|
55
56
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
57
|
var _a, _b;
|
|
57
|
-
const
|
|
58
|
+
const authProps = context.auth.props;
|
|
59
|
+
const { bucket } = authProps;
|
|
58
60
|
const { key, secretArn, passphraseArn, secretsManagerRegion, allowUnauthenticatedMessages, allowInsecureDecryptionWithSigningKeys } = context.propsValue;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
let s3;
|
|
62
|
+
let secretsClient;
|
|
63
|
+
if ((0, common_1.isOidcAuth)(authProps)) {
|
|
64
|
+
const credentials = yield (0, common_1.getTemporaryCredentials)({ auth: authProps, server: context.server });
|
|
65
|
+
s3 = new client_s3_1.S3({ credentials, region: authProps.region });
|
|
66
|
+
secretsClient = new client_secrets_manager_1.SecretsManagerClient({ credentials, region: secretsManagerRegion || authProps.region });
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const smAuth = secretsManagerRegion ? Object.assign(Object.assign({}, authProps), { region: secretsManagerRegion }) : authProps;
|
|
70
|
+
s3 = (0, common_1.createS3)(authProps);
|
|
71
|
+
secretsClient = (0, common_1.createSecretsManagerClient)(smAuth);
|
|
72
|
+
}
|
|
62
73
|
// Download the encrypted file from S3
|
|
63
74
|
let encryptedData;
|
|
64
75
|
try {
|
|
@@ -75,12 +86,6 @@ exports.decryptPgpFile = (0, pieces_framework_1.createAction)({
|
|
|
75
86
|
catch (error) {
|
|
76
87
|
throw new Error(`Failed to download file from S3: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
77
88
|
}
|
|
78
|
-
// Create AWS Secrets Manager client
|
|
79
|
-
const secretsClient = (0, common_1.createSecretsManagerClient)({
|
|
80
|
-
accessKeyId: accessKeyId,
|
|
81
|
-
secretAccessKey: secretAccessKey,
|
|
82
|
-
region: secretsManagerRegion || region,
|
|
83
|
-
});
|
|
84
89
|
// Fetch the secret key from AWS Secrets Manager
|
|
85
90
|
let privateKeyArmored;
|
|
86
91
|
try {
|
|
@@ -96,14 +101,14 @@ exports.decryptPgpFile = (0, pieces_framework_1.createAction)({
|
|
|
96
101
|
}
|
|
97
102
|
catch (error) {
|
|
98
103
|
// Provide more specific error messages for common issues
|
|
99
|
-
if (error.name === 'AccessDeniedException') {
|
|
104
|
+
if (error instanceof Error && error.name === 'AccessDeniedException') {
|
|
100
105
|
throw new Error(`Access denied when retrieving secret ${secretArn}. ` +
|
|
101
106
|
`Please ensure your AWS credentials have the secretsmanager:GetSecretValue permission for this secret.`);
|
|
102
107
|
}
|
|
103
|
-
if (error.name === 'ResourceNotFoundException') {
|
|
104
|
-
throw new Error(`Secret ${secretArn} not found. Please verify the secret ARN is correct and exists in region ${secretsManagerRegion || region}.`);
|
|
108
|
+
if (error instanceof Error && error.name === 'ResourceNotFoundException') {
|
|
109
|
+
throw new Error(`Secret ${secretArn} not found. Please verify the secret ARN is correct and exists in region ${secretsManagerRegion || authProps.region}.`);
|
|
105
110
|
}
|
|
106
|
-
if (error.name === 'InvalidParameterException') {
|
|
111
|
+
if (error instanceof Error && error.name === 'InvalidParameterException') {
|
|
107
112
|
throw new Error(`Invalid secret ARN: ${secretArn}. Please verify the ARN format is correct.`);
|
|
108
113
|
}
|
|
109
114
|
throw new Error(`Failed to retrieve secret from AWS Secrets Manager: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
@@ -123,14 +128,14 @@ exports.decryptPgpFile = (0, pieces_framework_1.createAction)({
|
|
|
123
128
|
}
|
|
124
129
|
catch (error) {
|
|
125
130
|
// Provide more specific error messages for common issues
|
|
126
|
-
if (error.name === 'AccessDeniedException') {
|
|
131
|
+
if (error instanceof Error && error.name === 'AccessDeniedException') {
|
|
127
132
|
throw new Error(`Access denied when retrieving passphrase secret ${passphraseArn}. ` +
|
|
128
133
|
`Please ensure your AWS credentials have the secretsmanager:GetSecretValue permission for this secret.`);
|
|
129
134
|
}
|
|
130
|
-
if (error.name === 'ResourceNotFoundException') {
|
|
131
|
-
throw new Error(`Passphrase secret ${passphraseArn} not found. Please verify the secret ARN is correct and exists in region ${secretsManagerRegion || region}.`);
|
|
135
|
+
if (error instanceof Error && error.name === 'ResourceNotFoundException') {
|
|
136
|
+
throw new Error(`Passphrase secret ${passphraseArn} not found. Please verify the secret ARN is correct and exists in region ${secretsManagerRegion || authProps.region}.`);
|
|
132
137
|
}
|
|
133
|
-
if (error.name === 'InvalidParameterException') {
|
|
138
|
+
if (error instanceof Error && error.name === 'InvalidParameterException') {
|
|
134
139
|
throw new Error(`Invalid passphrase secret ARN: ${passphraseArn}. Please verify the ARN format is correct.`);
|
|
135
140
|
}
|
|
136
141
|
throw new Error(`Failed to retrieve passphrase from AWS Secrets Manager: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
@@ -188,7 +193,7 @@ exports.decryptPgpFile = (0, pieces_framework_1.createAction)({
|
|
|
188
193
|
// Get the decrypted data
|
|
189
194
|
const decryptedData = new Uint8Array(yield decrypted.data);
|
|
190
195
|
// Write the decrypted file
|
|
191
|
-
const fileName = (_b = key.split(
|
|
196
|
+
const fileName = (_b = key.split('/').at(-1)) === null || _b === void 0 ? void 0 : _b.toLowerCase().replace(/\.(pgp|gpg)$/i, '');
|
|
192
197
|
return yield context.files.write({
|
|
193
198
|
fileName: fileName !== null && fileName !== void 0 ? fileName : 'decrypted_file',
|
|
194
199
|
data: Buffer.from(decryptedData),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decrypt-pgp-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/decrypt-pgp-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"decrypt-pgp-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/decrypt-pgp-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,4EAA8F;AAC9F,kDAAwC;AACxC,yDAAmC;AACnC,kCAA4D;AAC5D,sCAAsG;AAEzF,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,wFAAwF;IACrG,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,+ZAA+Z;QAC5a,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,6EAA6E;YAC1F,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,2HAA2H;YACxI,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,oBAAoB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvC,WAAW,EAAE,wBAAwB;YACrC,WAAW,EAAE,mGAAmG;YAChH,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,4BAA4B,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC9C,WAAW,EAAE,gCAAgC;YAC7C,WAAW,EAAE,iSAAiS;YAC9S,QAAQ,EAAE,KAAK;YACf,YAAY,EA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AE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;iBACjC,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;YACzG,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export declare const deleteFile: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
1
|
+
export declare const deleteFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
4
|
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
5
|
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
|
|
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
|
+
}>)[], {
|
|
8
12
|
key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
13
|
}>;
|
|
10
14
|
//# sourceMappingURL=delete-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-file.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"delete-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-file.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;;;;;;;;;;EA+BrB,CAAC"}
|
|
@@ -6,7 +6,7 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const auth_1 = require("../auth");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
8
|
exports.deleteFile = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: auth_1.
|
|
9
|
+
auth: auth_1.amazonS3CombinedAuth,
|
|
10
10
|
name: 'deleteFile',
|
|
11
11
|
displayName: 'Delete File',
|
|
12
12
|
description: 'Deletes an existing file.',
|
|
@@ -24,9 +24,10 @@ exports.deleteFile = (0, pieces_framework_1.createAction)({
|
|
|
24
24
|
},
|
|
25
25
|
run(context) {
|
|
26
26
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const
|
|
27
|
+
const authProps = context.auth.props;
|
|
28
|
+
const { bucket } = authProps;
|
|
28
29
|
const { key } = context.propsValue;
|
|
29
|
-
const s3 = (0, common_1.
|
|
30
|
+
const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
|
|
30
31
|
const response = yield s3.deleteObject({
|
|
31
32
|
Bucket: bucket,
|
|
32
33
|
Key: key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,
|
|
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,10 +1,14 @@
|
|
|
1
|
-
export declare const generateSignedUploadUrl: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
1
|
+
export declare const generateSignedUploadUrl: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
4
|
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
5
|
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
|
|
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
|
+
}>)[], {
|
|
8
12
|
key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
13
|
expiresIn: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
10
14
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-signed-upload-url.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-upload-url.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -6,8 +6,9 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
7
7
|
const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
|
|
8
8
|
const auth_1 = require("../auth");
|
|
9
|
+
const common_1 = require("../common");
|
|
9
10
|
exports.generateSignedUploadUrl = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.
|
|
11
|
+
auth: auth_1.amazonS3CombinedAuth,
|
|
11
12
|
name: 'generate-signed-upload-url',
|
|
12
13
|
displayName: 'Generate Signed Upload URL',
|
|
13
14
|
description: 'Generate a pre-signed URL that allows anyone with the link to upload a file directly to S3 without needing AWS credentials.',
|
|
@@ -31,23 +32,35 @@ exports.generateSignedUploadUrl = (0, pieces_framework_1.createAction)({
|
|
|
31
32
|
},
|
|
32
33
|
run(context) {
|
|
33
34
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
const
|
|
35
|
+
const authProps = context.auth.props;
|
|
35
36
|
const { key, expiresIn } = context.propsValue;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} }, (endpoint ? { endpoint, forcePathStyle: true } : {})));
|
|
40
|
-
const command = new client_s3_1.PutObjectCommand({
|
|
41
|
-
Bucket: bucket,
|
|
42
|
-
Key: key,
|
|
43
|
-
});
|
|
44
|
-
const signedUrl = yield (0, s3_request_presigner_1.getSignedUrl)(client, command, {
|
|
45
|
-
expiresIn: (expiresIn !== null && expiresIn !== void 0 ? expiresIn : 10) * 60,
|
|
46
|
-
});
|
|
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 });
|
|
47
40
|
return {
|
|
48
41
|
url: signedUrl,
|
|
49
42
|
};
|
|
50
43
|
});
|
|
51
44
|
},
|
|
52
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
|
+
}
|
|
53
66
|
//# sourceMappingURL=generate-signed-upload-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-signed-upload-url.js","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-upload-url.ts"],"names":[],"mappings":";;;;AAAA,
|
|
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,E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AAG,MAAM,IAAA,+BAAsB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;QAC3E,MAAM,OAAO,GAAG,IAAI,4BAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,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,yBAAyB,CAAC,EACjC,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,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export declare const generateSignedUrl: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
1
|
+
export declare const generateSignedUrl: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
4
|
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
5
|
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
|
|
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
|
+
}>)[], {
|
|
8
12
|
key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
13
|
expiresIn: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
10
14
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-signed-url.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-url.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -4,10 +4,11 @@ exports.generateSignedUrl = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
7
|
-
const auth_1 = require("../auth");
|
|
8
7
|
const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const common_1 = require("../common");
|
|
9
10
|
exports.generateSignedUrl = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.
|
|
11
|
+
auth: auth_1.amazonS3CombinedAuth,
|
|
11
12
|
name: 'generate-signed-url',
|
|
12
13
|
displayName: 'Generate signed URL',
|
|
13
14
|
description: 'Generate a signed URL for a file in a s3 bucket',
|
|
@@ -31,29 +32,33 @@ exports.generateSignedUrl = (0, pieces_framework_1.createAction)({
|
|
|
31
32
|
},
|
|
32
33
|
run(context) {
|
|
33
34
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
const
|
|
35
|
+
const authProps = context.auth.props;
|
|
35
36
|
const { key, expiresIn } = context.propsValue;
|
|
36
|
-
const clientUrl =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
key,
|
|
40
|
-
accessKeyId,
|
|
41
|
-
secretAccessKey,
|
|
42
|
-
expiresIn
|
|
43
|
-
});
|
|
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 });
|
|
44
40
|
return clientUrl;
|
|
45
41
|
});
|
|
46
42
|
},
|
|
47
43
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
credentials
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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 });
|
|
55
57
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
+
}
|
|
59
64
|
//# sourceMappingURL=generate-signed-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-signed-url.js","sourceRoot":"","sources":["../../../../src/lib/actions/generate-signed-url.ts"],"names":[],"mappings":";;;;AAAA,
|
|
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,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,oDAAoD;Y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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,10 +1,14 @@
|
|
|
1
|
-
export declare const listFiles: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
1
|
+
export declare const listFiles: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
4
|
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
5
|
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
|
|
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
|
+
}>)[], {
|
|
8
12
|
prefix: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
13
|
maxKeys: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
10
14
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-files.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-files.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"list-files.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-files.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,SAAS;;;;;;;;;;;;;EA2EpB,CAAC"}
|
|
@@ -6,7 +6,7 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const auth_1 = require("../auth");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
8
|
exports.listFiles = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: auth_1.
|
|
9
|
+
auth: auth_1.amazonS3CombinedAuth,
|
|
10
10
|
name: 'list-files',
|
|
11
11
|
displayName: 'List Files',
|
|
12
12
|
description: 'List all files from an S3 bucket folder/prefix.',
|
|
@@ -30,9 +30,10 @@ exports.listFiles = (0, pieces_framework_1.createAction)({
|
|
|
30
30
|
},
|
|
31
31
|
run(context) {
|
|
32
32
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const
|
|
33
|
+
const authProps = context.auth.props;
|
|
34
|
+
const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
|
|
34
35
|
const params = {
|
|
35
|
-
Bucket:
|
|
36
|
+
Bucket: authProps.bucket,
|
|
36
37
|
MaxKeys: Math.min(Math.max(context.propsValue.maxKeys || 1000, 1), 1000),
|
|
37
38
|
};
|
|
38
39
|
if (context.propsValue.prefix) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-files.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-files.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"list-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CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export declare const moveFile: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
1
|
+
export declare const moveFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
4
|
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
5
|
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
|
|
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
|
+
}>)[], {
|
|
8
12
|
fileKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
13
|
folderKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
14
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/move-file.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"move-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/move-file.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;EAgDnB,CAAC"}
|
|
@@ -6,7 +6,7 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const auth_1 = require("../auth");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
8
|
exports.moveFile = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: auth_1.
|
|
9
|
+
auth: auth_1.amazonS3CombinedAuth,
|
|
10
10
|
name: 'moveFile',
|
|
11
11
|
displayName: 'Move File',
|
|
12
12
|
description: 'Move a File to Another Folder',
|
|
@@ -29,9 +29,10 @@ exports.moveFile = (0, pieces_framework_1.createAction)({
|
|
|
29
29
|
},
|
|
30
30
|
run(context) {
|
|
31
31
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const
|
|
32
|
+
const authProps = context.auth.props;
|
|
33
|
+
const { bucket } = authProps;
|
|
33
34
|
const { fileKey, folderKey } = context.propsValue;
|
|
34
|
-
const s3 = (0, common_1.
|
|
35
|
+
const s3 = yield (0, common_1.resolveS3Client)({ authProps, server: context.server });
|
|
35
36
|
const fileName = fileKey.split('/').pop();
|
|
36
37
|
const folderName = folderKey.endsWith('/') ? folderKey.slice(0, -1) : folderKey;
|
|
37
38
|
const newKey = `${folderName}/${fileName}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/move-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,
|
|
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,OAA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