@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
|
@@ -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,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,8CAA8C;IAC3D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,8RAA8R;QAC3S,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;YACnC,MAAM,EAAE,GAAG,MAAM,IAAA,wBAAe,EAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAExE,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC;gBAC9B,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,GAAG;aACT,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAA,CAAC;YAC5D,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,UAAU,CAAC,CAAC;YACxD,CAAC;YACD,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;gBAC/B,QAAQ,EAAE,GAAG;gBACb,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC;aACpC,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -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;SACrI,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC3B,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,sIAAsI;YACnJ,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,6BAA6B;wBACpC,KAAK,EAAE,SAAS;qBACjB;oBACD;wBACE,KAAK,EAAE,+BAA+B;wBACtC,KAAK,EAAE,aAAa;qBACrB;oBACD;wBACE,KAAK,EAAE,gDAAgD;wBACvD,KAAK,EAAE,mBAAm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oBAAI,CAAC,SAAS,CAAC,IAAc,CAAC,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;YACvG,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,IAAI,CAAA;gBAClB,SAAS,GAAG,GAAG,GAAG,oBAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YACxC,CAAC;YAED,MAAM,aAAa,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YAExE,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;YAElH,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC;gBACxC,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,aAAa;gBAClB,GAAG,EAAE,GAAkC;gBACvC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;YAEH,OAAO;gBACL,QAAQ,EAAE,aAAa;gBACvB,IAAI,EAAE,cAAc,CAAC,IAAI;aAC1B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare const amazonS3Auth: 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
|
-
}>;
|
|
8
|
-
export declare const amazonS3OidcAuth: import("@activepieces/pieces-framework").OIDCProperty<{
|
|
9
|
-
roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
11
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
}>;
|
|
13
|
-
export declare const amazonS3CombinedAuth: (import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
-
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
-
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
16
|
-
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
18
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
19
|
-
}> | import("@activepieces/pieces-framework").OIDCProperty<{
|
|
20
|
-
roleArn: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
21
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
22
|
-
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
23
|
-
}>)[];
|
|
24
|
-
export type AccessKeyAuthProps = {
|
|
25
|
-
accessKeyId: string | undefined;
|
|
26
|
-
secretAccessKey: string | undefined;
|
|
27
|
-
endpoint: string | undefined;
|
|
28
|
-
bucket: string;
|
|
29
|
-
region: string;
|
|
30
|
-
};
|
|
31
|
-
export type OidcAuthProps = {
|
|
32
|
-
roleArn: string | undefined;
|
|
33
|
-
bucket: string;
|
|
34
|
-
region: string;
|
|
35
|
-
};
|
|
36
|
-
export type S3AuthProps = AccessKeyAuthProps | OidcAuthProps;
|
|
37
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/src/lib/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AA4KA,eAAO,MAAM,YAAY;;;;;;EA6CvB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;EAiC3B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;KAAmC,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,aAAa,CAAC"}
|
package/src/lib/auth.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.amazonS3CombinedAuth = exports.amazonS3OidcAuth = exports.amazonS3Auth = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("./common");
|
|
7
|
-
const accessKeyDescription = `
|
|
8
|
-
Connect your Amazon S3 account using AWS Access Key credentials.
|
|
9
|
-
|
|
10
|
-
**How to get your credentials:**
|
|
11
|
-
1. Open the [AWS IAM Console](https://console.aws.amazon.com/iam/) and go to **Users**.
|
|
12
|
-
2. Select your user (or create a new one), then go to **Security credentials**.
|
|
13
|
-
3. Click **Create access key** — copy both the Access Key ID and Secret Access Key.
|
|
14
|
-
4. Make sure the IAM user has the **AmazonS3FullAccess** policy (or a scoped S3 policy for your bucket).
|
|
15
|
-
|
|
16
|
-
Using a non-AWS S3-compatible service (MinIO, DigitalOcean Spaces, Backblaze B2, etc.)? Set the **Endpoint** field to your service URL.
|
|
17
|
-
`;
|
|
18
|
-
const oidcDescription = `
|
|
19
|
-
Connect your Amazon S3 account using an IAM Role via OIDC — no permanent keys required.
|
|
20
|
-
|
|
21
|
-
Activepieces acts as an OIDC identity provider. AWS trusts this provider and issues temporary credentials via \`AssumeRoleWithWebIdentity\`.
|
|
22
|
-
|
|
23
|
-
**Setup steps:**
|
|
24
|
-
1. In AWS IAM → Identity Providers → Create Provider:
|
|
25
|
-
- Provider type: **OpenID Connect**
|
|
26
|
-
- Provider URL: \`{{frontendUrl}}\`
|
|
27
|
-
- Audience: \`sts.amazonaws.com\`
|
|
28
|
-
|
|
29
|
-
> AWS fetches \`{{frontendUrl}}/.well-known/openid-configuration\` to discover the OIDC metadata. If your frontend and API run on different domains, make sure the API server is reachable at \`{{frontendUrl}}\` (or that your frontend proxies \`/.well-known/*\` to the API), otherwise \`AssumeRoleWithWebIdentity\` will fail.
|
|
30
|
-
2. Create an IAM Role with this trust policy:
|
|
31
|
-
\`\`\`json
|
|
32
|
-
{
|
|
33
|
-
"Version": "2012-10-17",
|
|
34
|
-
"Statement": [{
|
|
35
|
-
"Effect": "Allow",
|
|
36
|
-
"Principal": { "Federated": "arn:aws:iam::YOUR_ACCOUNT_ID:oidc-provider/{{frontendHost}}" },
|
|
37
|
-
"Action": "sts:AssumeRoleWithWebIdentity",
|
|
38
|
-
"Condition": {
|
|
39
|
-
"StringEquals": {
|
|
40
|
-
"{{frontendHost}}:aud": "sts.amazonaws.com"
|
|
41
|
-
},
|
|
42
|
-
"StringLike": {
|
|
43
|
-
"{{frontendHost}}:sub": "platform:{{platformId}}:project:{{projectId}}"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}]
|
|
47
|
-
}
|
|
48
|
-
\`\`\`
|
|
49
|
-
3. Attach S3 permissions to the role and paste the **Role ARN** below.
|
|
50
|
-
`;
|
|
51
|
-
const AWS_REGIONS = [
|
|
52
|
-
{
|
|
53
|
-
label: 'Default',
|
|
54
|
-
value: 'us-east-1',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
label: 'US East (N. Virginia) [us-east-1]',
|
|
58
|
-
value: 'us-east-1',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
label: 'US East (Ohio) [us-east-2]',
|
|
62
|
-
value: 'us-east-2',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
label: 'US West (N. California) [us-west-1]',
|
|
66
|
-
value: 'us-west-1',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
label: 'US West (Oregon) [us-west-2]',
|
|
70
|
-
value: 'us-west-2',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
label: 'Africa (Cape Town) [af-south-1]',
|
|
74
|
-
value: 'af-south-1',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
label: 'Asia Pacific (Hong Kong) [ap-east-1]',
|
|
78
|
-
value: 'ap-east-1',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
label: 'Asia Pacific (Mumbai) [ap-south-1]',
|
|
82
|
-
value: 'ap-south-1',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
label: 'Asia Pacific (Osaka-Local) [ap-northeast-3]',
|
|
86
|
-
value: 'ap-northeast-3',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
label: 'Asia Pacific (Seoul) [ap-northeast-2]',
|
|
90
|
-
value: 'ap-northeast-2',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
label: 'Asia Pacific (Singapore) [ap-southeast-1]',
|
|
94
|
-
value: 'ap-southeast-1',
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
label: 'Asia Pacific (Sydney) [ap-southeast-2]',
|
|
98
|
-
value: 'ap-southeast-2',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
label: 'Asia Pacific (Tokyo) [ap-northeast-1]',
|
|
102
|
-
value: 'ap-northeast-1',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: 'Canada (Central) [ca-central-1]',
|
|
106
|
-
value: 'ca-central-1',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: 'Europe (Frankfurt) [eu-central-1]',
|
|
110
|
-
value: 'eu-central-1',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
label: 'Europe (Ireland) [eu-west-1]',
|
|
114
|
-
value: 'eu-west-1',
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
label: 'Europe (London) [eu-west-2]',
|
|
118
|
-
value: 'eu-west-2',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
label: 'Europe (Milan) [eu-south-1]',
|
|
122
|
-
value: 'eu-south-1',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
label: 'Europe (Paris) [eu-west-3]',
|
|
126
|
-
value: 'eu-west-3',
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
label: 'Europe (Stockholm) [eu-north-1]',
|
|
130
|
-
value: 'eu-north-1',
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
label: 'Middle East (Bahrain) [me-south-1]',
|
|
134
|
-
value: 'me-south-1',
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
label: 'South America (São Paulo) [sa-east-1]',
|
|
138
|
-
value: 'sa-east-1',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
label: 'Europe (Spain) [eu-south-2]',
|
|
142
|
-
value: 'eu-south-2',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
label: 'Asia Pacific (Hyderabad) [ap-south-2]',
|
|
146
|
-
value: 'ap-south-2',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
label: 'Asia Pacific (Jakarta) [ap-southeast-3]',
|
|
150
|
-
value: 'ap-southeast-3',
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
label: 'Asia Pacific (Melbourne) [ap-southeast-4]',
|
|
154
|
-
value: 'ap-southeast-4',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
label: 'China (Beijing) [cn-north-1]',
|
|
158
|
-
value: 'cn-north-1',
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
label: 'China (Ningxia) [cn-northwest-1]',
|
|
162
|
-
value: 'cn-northwest-1',
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
label: 'Europe (Zurich) [eu-central-2]',
|
|
166
|
-
value: 'eu-central-2',
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
label: 'Middle East (UAE) [me-central-1]',
|
|
170
|
-
value: 'me-central-1',
|
|
171
|
-
},
|
|
172
|
-
];
|
|
173
|
-
exports.amazonS3Auth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
174
|
-
displayName: 'Amazon S3 (Access Key)',
|
|
175
|
-
description: accessKeyDescription,
|
|
176
|
-
props: {
|
|
177
|
-
accessKeyId: pieces_framework_1.Property.ShortText({
|
|
178
|
-
displayName: 'Access Key ID',
|
|
179
|
-
description: 'Your AWS access key ID. Found in AWS IAM Console → Users → Security credentials.',
|
|
180
|
-
required: true,
|
|
181
|
-
}),
|
|
182
|
-
secretAccessKey: pieces_framework_1.PieceAuth.SecretText({
|
|
183
|
-
displayName: 'Secret Access Key',
|
|
184
|
-
description: 'Your AWS secret access key. Only shown once when you create the access key.',
|
|
185
|
-
required: true,
|
|
186
|
-
}),
|
|
187
|
-
endpoint: pieces_framework_1.Property.ShortText({
|
|
188
|
-
displayName: 'Endpoint (Optional)',
|
|
189
|
-
description: 'Leave blank for Amazon S3. Only set when using MinIO, DigitalOcean Spaces, Backblaze B2, etc.',
|
|
190
|
-
required: false,
|
|
191
|
-
}),
|
|
192
|
-
region: pieces_framework_1.Property.StaticDropdown({
|
|
193
|
-
displayName: 'Region',
|
|
194
|
-
options: {
|
|
195
|
-
options: AWS_REGIONS,
|
|
196
|
-
},
|
|
197
|
-
required: true,
|
|
198
|
-
}),
|
|
199
|
-
bucket: pieces_framework_1.Property.ShortText({
|
|
200
|
-
displayName: 'Bucket Name',
|
|
201
|
-
description: 'The name of your S3 bucket (e.g. "my-company-files").',
|
|
202
|
-
required: true,
|
|
203
|
-
}),
|
|
204
|
-
},
|
|
205
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
206
|
-
if (!auth.accessKeyId || !auth.secretAccessKey) {
|
|
207
|
-
return { valid: false, error: 'Access Key ID and Secret Access Key are required.' };
|
|
208
|
-
}
|
|
209
|
-
try {
|
|
210
|
-
const s3 = (0, common_1.createS3)(auth);
|
|
211
|
-
yield s3.listObjectsV2({ Bucket: auth.bucket, MaxKeys: 1 });
|
|
212
|
-
return { valid: true };
|
|
213
|
-
}
|
|
214
|
-
catch (e) {
|
|
215
|
-
return { valid: false, error: e === null || e === void 0 ? void 0 : e.message };
|
|
216
|
-
}
|
|
217
|
-
}),
|
|
218
|
-
required: true,
|
|
219
|
-
});
|
|
220
|
-
exports.amazonS3OidcAuth = pieces_framework_1.PieceAuth.OIDC({
|
|
221
|
-
displayName: 'Amazon S3 (IAM Role / OIDC)',
|
|
222
|
-
description: oidcDescription,
|
|
223
|
-
props: {
|
|
224
|
-
roleArn: pieces_framework_1.Property.ShortText({
|
|
225
|
-
displayName: 'Role ARN',
|
|
226
|
-
description: 'The ARN of the IAM role to assume (e.g. arn:aws:iam::123456789012:role/MyRole).',
|
|
227
|
-
required: true,
|
|
228
|
-
}),
|
|
229
|
-
region: pieces_framework_1.Property.StaticDropdown({
|
|
230
|
-
displayName: 'Region',
|
|
231
|
-
options: {
|
|
232
|
-
options: AWS_REGIONS,
|
|
233
|
-
},
|
|
234
|
-
required: true,
|
|
235
|
-
}),
|
|
236
|
-
bucket: pieces_framework_1.Property.ShortText({
|
|
237
|
-
displayName: 'Bucket Name',
|
|
238
|
-
description: 'The name of your S3 bucket (e.g. "my-company-files").',
|
|
239
|
-
required: true,
|
|
240
|
-
}),
|
|
241
|
-
},
|
|
242
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
243
|
-
if (!auth.roleArn) {
|
|
244
|
-
return { valid: false, error: 'Role ARN is required for IAM Role authentication.' };
|
|
245
|
-
}
|
|
246
|
-
const arnRegex = /^arn:(?:aws|aws-us-gov|aws-cn):iam::\d{12}:role\/[\w+=,.@\-/]{1,512}$/;
|
|
247
|
-
if (!arnRegex.test(auth.roleArn)) {
|
|
248
|
-
return { valid: false, error: 'Invalid IAM Role ARN format. Expected: arn:aws:iam::123456789012:role/RoleName' };
|
|
249
|
-
}
|
|
250
|
-
return { valid: true };
|
|
251
|
-
}),
|
|
252
|
-
required: true,
|
|
253
|
-
});
|
|
254
|
-
exports.amazonS3CombinedAuth = [exports.amazonS3Auth, exports.amazonS3OidcAuth];
|
|
255
|
-
//# sourceMappingURL=auth.js.map
|
package/src/lib/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,qCAAoC;AAEpC,MAAM,oBAAoB,GAAG;;;;;;;;;;CAU5B,CAAC;AAEF,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCvB,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB;QACE,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,WAAW;KACnB;IACD;QACE,KAAK,EAAE,mCAAmC;QAC1C,KAAK,EAAE,WAAW;KACnB;IACD;QACE,KAAK,EAAE,4BAA4B;QACnC,KAAK,EAAE,WAAW;KACnB;IACD;QACE,KAAK,EAAE,qCAAqC;QAC5C,KAAK,EAAE,WAAW;KACnB;IACD;QACE,KAAK,EAAE,8BAA8B;QACrC,KA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AC,OAAO,EAAE,CAAC;YAClB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mDAAmD,EAAE,CAAC;QACtF,CAAC;QACD,MAAM,QAAQ,GAAG,uEAAuE,CAAC;QACzF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACjC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,gFAAgF,EAAE,CAAC;QACnH,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC,CAAA;IACD,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,CAAC,oBAAY,EAAE,wBAAgB,CAAC,CAAC"}
|
package/src/lib/common.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { S3 } from '@aws-sdk/client-s3';
|
|
2
|
-
import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
|
|
3
|
-
import { ServerContext } from '@activepieces/pieces-framework';
|
|
4
|
-
import { AccessKeyAuthProps, OidcAuthProps, S3AuthProps } from './auth';
|
|
5
|
-
export declare function createS3(auth: AccessKeyAuthProps): S3;
|
|
6
|
-
export declare function createSecretsManagerClient(auth: AccessKeyAuthProps): SecretsManagerClient;
|
|
7
|
-
export declare function createS3WithAssumeRole({ auth, server, durationSeconds, }: {
|
|
8
|
-
auth: OidcAuthProps;
|
|
9
|
-
server: ServerContext;
|
|
10
|
-
durationSeconds?: number;
|
|
11
|
-
}): Promise<S3>;
|
|
12
|
-
export declare function isOidcAuth(authProps: S3AuthProps): authProps is OidcAuthProps;
|
|
13
|
-
export declare function resolveS3Client({ authProps, server, }: {
|
|
14
|
-
authProps: S3AuthProps;
|
|
15
|
-
server: ServerContext;
|
|
16
|
-
}): Promise<S3>;
|
|
17
|
-
export declare function getTemporaryCredentials({ auth, server, durationSeconds, }: {
|
|
18
|
-
auth: OidcAuthProps;
|
|
19
|
-
server: ServerContext;
|
|
20
|
-
durationSeconds?: number;
|
|
21
|
-
}): Promise<TemporaryCredentials>;
|
|
22
|
-
export declare const MIN_STS_DURATION_SECONDS = 900;
|
|
23
|
-
export declare const MAX_STS_DURATION_SECONDS = 43200;
|
|
24
|
-
type TemporaryCredentials = {
|
|
25
|
-
accessKeyId: string;
|
|
26
|
-
secretAccessKey: string;
|
|
27
|
-
sessionToken: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=common.d.ts.map
|
package/src/lib/common.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/lib/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAIxE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,MAehD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,kBAAkB,wBAalE;AAED,wBAAsB,sBAAsB,CAAC,EAC3C,IAAI,EACJ,MAAM,EACN,eAAe,GAChB,EAAE;IACD,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,EAAE,CAAC,CAMd;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,IAAI,aAAa,CAE7E;AAED,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;CACvB,GAAG,O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