@activepieces/piece-amazon-s3 0.1.2 → 0.2.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 +3 -4
- package/src/index.d.ts +4 -2
- package/src/index.js +48 -4
- package/src/index.js.map +1 -1
- package/src/lib/actions/read-file.d.ts +2 -1
- package/src/lib/actions/upload-file-from-base64.d.ts +2 -1
- package/src/lib/actions/upload-file-from-url.d.ts +2 -1
- package/src/lib/triggers/new-file.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-amazon-s3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@aws-sdk/client-s3": "^3.347.0",
|
|
6
6
|
"@sinclair/typebox": "^0.26.3",
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
"dayjs": "^1.11.8",
|
|
9
9
|
"is-base64": "^1.1.0",
|
|
10
10
|
"nanoid": "^3.3.4",
|
|
11
|
-
"object-sizeof": "^2.6.3",
|
|
12
11
|
"semver": "7.5.4",
|
|
13
12
|
"@activepieces/pieces-common": "0.2.2",
|
|
14
|
-
"@activepieces/pieces-framework": "0.6.
|
|
15
|
-
"@activepieces/shared": "0.
|
|
13
|
+
"@activepieces/pieces-framework": "0.6.15",
|
|
14
|
+
"@activepieces/shared": "0.8.0",
|
|
16
15
|
"tslib": "2.6.1"
|
|
17
16
|
},
|
|
18
17
|
"main": "./src/index.js",
|
package/src/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export declare const amazonS3Auth: import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
4
|
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
7
|
}>;
|
|
7
8
|
export declare const amazonS3: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
8
9
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
10
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
11
11
|
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
+
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
12
14
|
}>>;
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.amazonS3 = exports.amazonS3Auth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
6
|
const upload_file_from_base64_1 = require("./lib/actions/upload-file-from-base64");
|
|
6
7
|
const upload_file_from_url_1 = require("./lib/actions/upload-file-from-url");
|
|
7
8
|
const new_file_1 = require("./lib/triggers/new-file");
|
|
8
9
|
const read_file_1 = require("./lib/actions/read-file");
|
|
10
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
11
|
+
const description = `
|
|
12
|
+
This piece allows you to upload files to Amazon S3 or other S3 compatible services.
|
|
13
|
+
|
|
14
|
+
Amazon S3 Settings:
|
|
15
|
+
Regions: https://docs.aws.amazon.com/general/latest/gr/s3.html
|
|
16
|
+
Endpoint: leave blank
|
|
17
|
+
`;
|
|
9
18
|
exports.amazonS3Auth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
19
|
+
description: description,
|
|
10
20
|
props: {
|
|
11
21
|
accessKeyId: pieces_framework_1.Property.ShortText({
|
|
12
22
|
displayName: 'Access Key ID',
|
|
@@ -16,10 +26,22 @@ exports.amazonS3Auth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
|
16
26
|
displayName: 'Secret Access Key',
|
|
17
27
|
required: true,
|
|
18
28
|
}),
|
|
29
|
+
bucket: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Bucket',
|
|
31
|
+
required: true,
|
|
32
|
+
}),
|
|
33
|
+
endpoint: pieces_framework_1.Property.ShortText({
|
|
34
|
+
displayName: 'Endpoint',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
19
37
|
region: pieces_framework_1.Property.StaticDropdown({
|
|
20
38
|
displayName: 'Region',
|
|
21
39
|
options: {
|
|
22
40
|
"options": [
|
|
41
|
+
{
|
|
42
|
+
"label": "Default",
|
|
43
|
+
"value": 'us-east-1',
|
|
44
|
+
},
|
|
23
45
|
{
|
|
24
46
|
"label": "US East (N. Virginia) [us-east-1]",
|
|
25
47
|
"value": "us-east-1"
|
|
@@ -140,11 +162,33 @@ exports.amazonS3Auth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
|
140
162
|
},
|
|
141
163
|
required: true,
|
|
142
164
|
}),
|
|
143
|
-
bucket: pieces_framework_1.Property.ShortText({
|
|
144
|
-
displayName: 'Bucket',
|
|
145
|
-
required: true,
|
|
146
|
-
})
|
|
147
165
|
},
|
|
166
|
+
validate: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
+
const { accessKeyId, secretAccessKey, region, bucket } = auth;
|
|
168
|
+
const s3 = new client_s3_1.S3({
|
|
169
|
+
credentials: {
|
|
170
|
+
accessKeyId,
|
|
171
|
+
secretAccessKey
|
|
172
|
+
},
|
|
173
|
+
endpoint: auth.endpoint,
|
|
174
|
+
region: region !== null && region !== void 0 ? region : undefined
|
|
175
|
+
});
|
|
176
|
+
try {
|
|
177
|
+
yield s3.listObjectsV2({
|
|
178
|
+
Bucket: bucket,
|
|
179
|
+
MaxKeys: 1
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
valid: true
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
return {
|
|
187
|
+
valid: false,
|
|
188
|
+
error: e === null || e === void 0 ? void 0 : e.message
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
148
192
|
required: true
|
|
149
193
|
});
|
|
150
194
|
exports.amazonS3 = (0, pieces_framework_1.createPiece)({
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/amazon-s3/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/amazon-s3/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAkF;AAClF,mFAAuF;AACvF,6EAAqF;AACrF,sDAAkD;AAClD,uDAAmD;AACnD,kDAAwC;AAExC,MAAM,WAAW,GAAG;;;;;;CAMnB,CAAA;AAEY,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,WAAW;IACxB,KAAK,EAAE;QACH,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,eAAe,EAAE,4BAAS,CAAC,UAAU,CAAC;YAClC,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,QAAQ,EAAE,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aAClB;YACD,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS;SAC9B,CAAC,CAAA;QACF,IAAI;YACA,MAAM,EAAE,CAAC,aAAa,CAAC;gBACnB,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,CAAC;aACb,CAAC,CAAA;YACF,OAAO;gBACH,KAAK,EAAE,IAAI;aACd,CAAA;SACJ;QAAC,OAAO,CAAC,EAAE;YACR,OAAO;gBACH,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAG,CAAW,aAAX,CAAC,uBAAD,CAAC,CAAY,OAAO;aAC/B,CAAA;SACJ;IACL,CAAC,CAAA;IACD,QAAQ,EAAE,IAAI;CACjB,CAAC,CAAA;AAEW,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,WAAW;IAExB,OAAO,EAAE,mDAAmD;IAC5D,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,IAAI,EAAE,oBAAY;IAClB,OAAO,EAAE;QACL,wDAA8B;QAC9B,sDAA+B;QAC/B,oBAAQ;KACX;IACD,QAAQ,EAAE;QACN,kBAAO;KACV;CACJ,CAAC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const readFile: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
4
|
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
7
|
}>, {
|
|
7
8
|
key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
9
|
}>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const amazonS3UploadBase64FileAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
4
|
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
7
|
}>, {
|
|
7
8
|
base64: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
8
9
|
fileName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const amazonS3UploadFileFromUrlAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
2
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
4
|
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
7
|
}>, {
|
|
7
8
|
url: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
8
9
|
imageName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
@@ -2,8 +2,9 @@ import { TriggerStrategy } from "@activepieces/pieces-framework";
|
|
|
2
2
|
export declare const newFile: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
3
3
|
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
4
|
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
5
|
bucket: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
endpoint: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
8
|
}>, {
|
|
8
9
|
folderPath: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
10
|
}>;
|