@activepieces/piece-amazon-s3 0.6.0 → 0.6.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.
- package/package.json +7 -22
- package/src/i18n/translation.json +0 -40
- package/src/index.js +183 -27
- package/src/index.d.ts +0 -12
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/decrypt-pgp-file.d.ts +0 -19
- package/src/lib/actions/decrypt-pgp-file.d.ts.map +0 -1
- package/src/lib/actions/decrypt-pgp-file.js +0 -208
- package/src/lib/actions/decrypt-pgp-file.js.map +0 -1
- package/src/lib/actions/delete-file.d.ts +0 -14
- package/src/lib/actions/delete-file.d.ts.map +0 -1
- package/src/lib/actions/delete-file.js +0 -39
- package/src/lib/actions/delete-file.js.map +0 -1
- package/src/lib/actions/generate-signed-upload-url.d.ts +0 -15
- package/src/lib/actions/generate-signed-upload-url.d.ts.map +0 -1
- package/src/lib/actions/generate-signed-upload-url.js +0 -66
- package/src/lib/actions/generate-signed-upload-url.js.map +0 -1
- package/src/lib/actions/generate-signed-url.d.ts +0 -15
- package/src/lib/actions/generate-signed-url.d.ts.map +0 -1
- package/src/lib/actions/generate-signed-url.js +0 -64
- package/src/lib/actions/generate-signed-url.js.map +0 -1
- package/src/lib/actions/list-files.d.ts +0 -15
- package/src/lib/actions/list-files.d.ts.map +0 -1
- package/src/lib/actions/list-files.js +0 -75
- package/src/lib/actions/list-files.js.map +0 -1
- package/src/lib/actions/move-file.d.ts +0 -15
- package/src/lib/actions/move-file.d.ts.map +0 -1
- package/src/lib/actions/move-file.js +0 -53
- package/src/lib/actions/move-file.js.map +0 -1
- package/src/lib/actions/read-file.d.ts +0 -14
- package/src/lib/actions/read-file.d.ts.map +0 -1
- package/src/lib/actions/read-file.js +0 -47
- package/src/lib/actions/read-file.js.map +0 -1
- package/src/lib/actions/upload-file.d.ts +0 -17
- package/src/lib/actions/upload-file.d.ts.map +0 -1
- package/src/lib/actions/upload-file.js +0 -110
- package/src/lib/actions/upload-file.js.map +0 -1
- package/src/lib/auth.d.ts +0 -37
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -255
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common.d.ts +0 -30
- package/src/lib/common.d.ts.map +0 -1
- package/src/lib/common.js +0 -124
- package/src/lib/common.js.map +0 -1
- package/src/lib/triggers/new-file.d.ts +0 -55
- package/src/lib/triggers/new-file.d.ts.map +0 -1
- package/src/lib/triggers/new-file.js +0 -125
- package/src/lib/triggers/new-file.js.map +0 -1
package/src/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const amazonS3: import("@activepieces/pieces-framework").Piece<(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
|
-
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ;;;;;;;;;;MAWnB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,19 +0,0 @@
|
|
|
1
|
-
export declare const decryptPgpFile: 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
|
-
secretArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
-
passphraseArn: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
15
|
-
secretsManagerRegion: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
|
-
allowUnauthenticatedMessages: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
17
|
-
allowInsecureDecryptionWithSigningKeys: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
18
|
-
}>;
|
|
19
|
-
//# sourceMappingURL=decrypt-pgp-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decryptPgpFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
|
|
7
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
8
|
-
const openpgp = tslib_1.__importStar(require("openpgp"));
|
|
9
|
-
const auth_1 = require("../auth");
|
|
10
|
-
const common_1 = require("../common");
|
|
11
|
-
exports.decryptPgpFile = (0, pieces_framework_1.createAction)({
|
|
12
|
-
auth: auth_1.amazonS3CombinedAuth,
|
|
13
|
-
name: 'decrypt-pgp-file',
|
|
14
|
-
displayName: 'Decrypt PGP File',
|
|
15
|
-
description: 'Decrypt a PGP encrypted file from S3 using a private key stored in AWS Secrets Manager',
|
|
16
|
-
audience: 'both',
|
|
17
|
-
aiMetadata: {
|
|
18
|
-
description: 'Downloads a PGP-encrypted object from the configured S3 bucket and decrypts it using a private key (and optional passphrase) retrieved from AWS Secrets Manager by ARN, returning the decrypted contents as a file. Use when an S3 file is PGP-encrypted and you have the key stored in Secrets Manager. Requires the secret ARN for the private key; idempotent since it only reads and decrypts without modifying anything.',
|
|
19
|
-
idempotent: true,
|
|
20
|
-
},
|
|
21
|
-
props: {
|
|
22
|
-
key: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'S3 File Key',
|
|
24
|
-
description: 'The key (path) of the encrypted file in S3',
|
|
25
|
-
required: true,
|
|
26
|
-
}),
|
|
27
|
-
secretArn: pieces_framework_1.Property.ShortText({
|
|
28
|
-
displayName: 'Secret ARN',
|
|
29
|
-
description: 'The ARN of the secret in AWS Secrets Manager containing the PGP private key',
|
|
30
|
-
required: true,
|
|
31
|
-
}),
|
|
32
|
-
passphraseArn: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'Passphrase ARN',
|
|
34
|
-
description: 'Optional ARN of the secret in AWS Secrets Manager containing the passphrase for the private key (if the key is encrypted)',
|
|
35
|
-
required: false,
|
|
36
|
-
}),
|
|
37
|
-
secretsManagerRegion: pieces_framework_1.Property.ShortText({
|
|
38
|
-
displayName: 'Secrets Manager Region',
|
|
39
|
-
description: 'The AWS region where the Secrets Manager secret is stored (defaults to S3 region if not provided)',
|
|
40
|
-
required: false,
|
|
41
|
-
}),
|
|
42
|
-
allowUnauthenticatedMessages: pieces_framework_1.Property.Checkbox({
|
|
43
|
-
displayName: 'Allow Unauthenticated Messages',
|
|
44
|
-
description: 'Allow decryption of messages without integrity protection (no MDC). WARNING: Without MDC, a malicious actor can silently modify the ciphertext, so the decrypted output may have been tampered with. Only enable this when working with legacy files where integrity protection was never used.',
|
|
45
|
-
required: false,
|
|
46
|
-
defaultValue: false,
|
|
47
|
-
}),
|
|
48
|
-
allowInsecureDecryptionWithSigningKeys: pieces_framework_1.Property.Checkbox({
|
|
49
|
-
displayName: 'Allow Decryption With Signing Keys',
|
|
50
|
-
description: 'Allow decryption using a key not marked for encryption (e.g. a signing-only key). Enable this if your PGP key was not flagged for encryption use.',
|
|
51
|
-
required: false,
|
|
52
|
-
defaultValue: false,
|
|
53
|
-
}),
|
|
54
|
-
},
|
|
55
|
-
run(context) {
|
|
56
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
var _a, _b;
|
|
58
|
-
const authProps = context.auth.props;
|
|
59
|
-
const { bucket } = authProps;
|
|
60
|
-
const { key, secretArn, passphraseArn, secretsManagerRegion, allowUnauthenticatedMessages, allowInsecureDecryptionWithSigningKeys } = context.propsValue;
|
|
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
|
-
}
|
|
73
|
-
// Download the encrypted file from S3
|
|
74
|
-
let encryptedData;
|
|
75
|
-
try {
|
|
76
|
-
const file = yield s3.getObject({
|
|
77
|
-
Bucket: bucket,
|
|
78
|
-
Key: key,
|
|
79
|
-
});
|
|
80
|
-
const base64 = yield ((_a = file.Body) === null || _a === void 0 ? void 0 : _a.transformToString('base64'));
|
|
81
|
-
if (!base64) {
|
|
82
|
-
throw new Error(`Could not read file ${key} from S3`);
|
|
83
|
-
}
|
|
84
|
-
encryptedData = Buffer.from(base64, 'base64');
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
throw new Error(`Failed to download file from S3: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
88
|
-
}
|
|
89
|
-
// Fetch the secret key from AWS Secrets Manager
|
|
90
|
-
let privateKeyArmored;
|
|
91
|
-
try {
|
|
92
|
-
const command = new client_secrets_manager_1.GetSecretValueCommand({
|
|
93
|
-
SecretId: secretArn,
|
|
94
|
-
});
|
|
95
|
-
const response = yield secretsClient.send(command);
|
|
96
|
-
if (!response.SecretString) {
|
|
97
|
-
throw new Error(`Secret ${secretArn} does not contain a string value`);
|
|
98
|
-
}
|
|
99
|
-
// Trim whitespace from the key (AWS Secrets Manager might add extra whitespace)
|
|
100
|
-
privateKeyArmored = response.SecretString.trim();
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
// Provide more specific error messages for common issues
|
|
104
|
-
if (error instanceof Error && error.name === 'AccessDeniedException') {
|
|
105
|
-
throw new Error(`Access denied when retrieving secret ${secretArn}. ` +
|
|
106
|
-
`Please ensure your AWS credentials have the secretsmanager:GetSecretValue permission for this secret.`);
|
|
107
|
-
}
|
|
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}.`);
|
|
110
|
-
}
|
|
111
|
-
if (error instanceof Error && error.name === 'InvalidParameterException') {
|
|
112
|
-
throw new Error(`Invalid secret ARN: ${secretArn}. Please verify the ARN format is correct.`);
|
|
113
|
-
}
|
|
114
|
-
throw new Error(`Failed to retrieve secret from AWS Secrets Manager: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
115
|
-
}
|
|
116
|
-
// Fetch the passphrase from AWS Secrets Manager if provided
|
|
117
|
-
let passphrase;
|
|
118
|
-
if (passphraseArn) {
|
|
119
|
-
try {
|
|
120
|
-
const passphraseCommand = new client_secrets_manager_1.GetSecretValueCommand({
|
|
121
|
-
SecretId: passphraseArn,
|
|
122
|
-
});
|
|
123
|
-
const passphraseResponse = yield secretsClient.send(passphraseCommand);
|
|
124
|
-
if (!passphraseResponse.SecretString) {
|
|
125
|
-
throw new Error(`Secret ${passphraseArn} does not contain a string value`);
|
|
126
|
-
}
|
|
127
|
-
passphrase = passphraseResponse.SecretString.trim();
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
// Provide more specific error messages for common issues
|
|
131
|
-
if (error instanceof Error && error.name === 'AccessDeniedException') {
|
|
132
|
-
throw new Error(`Access denied when retrieving passphrase secret ${passphraseArn}. ` +
|
|
133
|
-
`Please ensure your AWS credentials have the secretsmanager:GetSecretValue permission for this secret.`);
|
|
134
|
-
}
|
|
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}.`);
|
|
137
|
-
}
|
|
138
|
-
if (error instanceof Error && error.name === 'InvalidParameterException') {
|
|
139
|
-
throw new Error(`Invalid passphrase secret ARN: ${passphraseArn}. Please verify the ARN format is correct.`);
|
|
140
|
-
}
|
|
141
|
-
throw new Error(`Failed to retrieve passphrase from AWS Secrets Manager: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
// Read the encrypted file data
|
|
145
|
-
const encryptedString = encryptedData.toString('utf8');
|
|
146
|
-
// Decrypt the file using OpenPGP
|
|
147
|
-
try {
|
|
148
|
-
let message;
|
|
149
|
-
try {
|
|
150
|
-
message = yield openpgp.readMessage({
|
|
151
|
-
armoredMessage: encryptedString,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
catch (_c) {
|
|
155
|
-
// If armored fails, try as binary
|
|
156
|
-
message = yield openpgp.readMessage({
|
|
157
|
-
binaryMessage: encryptedData,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
// Read the private key
|
|
161
|
-
let privateKey = yield openpgp.readPrivateKey({
|
|
162
|
-
armoredKey: privateKeyArmored,
|
|
163
|
-
});
|
|
164
|
-
if (!privateKey.isPrivate()) {
|
|
165
|
-
throw new Error('The provided key is not a private key. Please ensure you are using a private key, not a public key.');
|
|
166
|
-
}
|
|
167
|
-
// Check if the key is encrypted and needs a passphrase
|
|
168
|
-
if (!privateKey.isDecrypted()) {
|
|
169
|
-
if (!passphrase) {
|
|
170
|
-
throw new Error('Private key is encrypted but no passphrase was provided. Please provide a Passphrase ARN.');
|
|
171
|
-
}
|
|
172
|
-
try {
|
|
173
|
-
const decryptedKey = yield openpgp.decryptKey({
|
|
174
|
-
privateKey: privateKey,
|
|
175
|
-
passphrase: passphrase,
|
|
176
|
-
});
|
|
177
|
-
privateKey = decryptedKey;
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
throw new Error(`Failed to unlock private key with passphrase: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
// Decrypt the message
|
|
184
|
-
const decrypted = yield openpgp.decrypt({
|
|
185
|
-
message,
|
|
186
|
-
decryptionKeys: privateKey,
|
|
187
|
-
format: 'binary',
|
|
188
|
-
config: {
|
|
189
|
-
allowInsecureDecryptionWithSigningKeys: allowInsecureDecryptionWithSigningKeys !== null && allowInsecureDecryptionWithSigningKeys !== void 0 ? allowInsecureDecryptionWithSigningKeys : false,
|
|
190
|
-
allowUnauthenticatedMessages: allowUnauthenticatedMessages !== null && allowUnauthenticatedMessages !== void 0 ? allowUnauthenticatedMessages : false,
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
// Get the decrypted data
|
|
194
|
-
const decryptedData = new Uint8Array(yield decrypted.data);
|
|
195
|
-
// Write the decrypted file
|
|
196
|
-
const fileName = (_b = key.split('/').at(-1)) === null || _b === void 0 ? void 0 : _b.toLowerCase().replace(/\.(pgp|gpg)$/i, '');
|
|
197
|
-
return yield context.files.write({
|
|
198
|
-
fileName: fileName !== null && fileName !== void 0 ? fileName : 'decrypted_file',
|
|
199
|
-
data: Buffer.from(decryptedData),
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
catch (error) {
|
|
203
|
-
throw new Error(`Failed to decrypt file: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
});
|
|
208
|
-
//# sourceMappingURL=decrypt-pgp-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;YA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AAC,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;gBAE3D,2BAA2B;gBAC3B,MAAM,QAAQ,GAAG,MAAA,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,0CAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;gBAEnF,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;oBAC/B,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,gBAAgB;oBACtC,IAAI,EAAE,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,14 +0,0 @@
|
|
|
1
|
-
export declare const deleteFile: 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=delete-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -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-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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,2B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YAChD,MAAM,IAAI,KAAK,CACb,wDAAwD,iCAAwB,GAAG,EAAE,mGAAmG,CACzL,CAAC;QACJ,CAAC;QACD,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,iCAAwB,CAAC,CAAC;QAC7E,MAAM,EAAE,GAAG,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,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,CAAC,KAAK,CAAC;YAClD,MAAM,EAAE,GAAG,MAAM,IAAA,wBAAe,EAAC,EAAE,SAAS,E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