@activepieces/piece-amazon-s3 0.3.10 → 0.3.11
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-amazon-s3",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@ai-sdk/anthropic": "1.2.12",
|
|
6
6
|
"@ai-sdk/google": "1.2.19",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"semver": "7.6.0",
|
|
21
21
|
"zod": "3.25.76",
|
|
22
22
|
"@activepieces/pieces-common": "0.6.1",
|
|
23
|
-
"@activepieces/pieces-framework": "0.
|
|
24
|
-
"@activepieces/shared": "0.17.
|
|
23
|
+
"@activepieces/pieces-framework": "0.17.0",
|
|
24
|
+
"@activepieces/shared": "0.17.6",
|
|
25
25
|
"tslib": "2.8.1"
|
|
26
26
|
},
|
|
27
27
|
"overrides": {
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"vite": {
|
|
32
32
|
"rollup": "npm:@rollup/wasm-node"
|
|
33
|
-
}
|
|
34
|
-
"stylus": "0.0.1-security"
|
|
33
|
+
}
|
|
35
34
|
},
|
|
36
35
|
"resolutions": {
|
|
37
36
|
"rollup": "npm:@rollup/wasm-node"
|
|
@@ -8,5 +8,5 @@ export declare const amazons3UploadFile: import("@activepieces/pieces-framework"
|
|
|
8
8
|
file: import("@activepieces/pieces-framework").FileProperty<true>;
|
|
9
9
|
fileName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
10
|
acl: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
11
|
-
type: import("@activepieces/pieces-framework").
|
|
11
|
+
type: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
12
|
}>;
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const __1 = require("../..");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
|
+
const mime_types_1 = tslib_1.__importDefault(require("mime-types"));
|
|
8
9
|
exports.amazons3UploadFile = (0, pieces_framework_1.createAction)({
|
|
9
10
|
auth: __1.amazonS3Auth,
|
|
10
11
|
name: 'upload-file',
|
|
@@ -18,7 +19,7 @@ exports.amazons3UploadFile = (0, pieces_framework_1.createAction)({
|
|
|
18
19
|
fileName: pieces_framework_1.Property.ShortText({
|
|
19
20
|
displayName: 'File Name',
|
|
20
21
|
required: false,
|
|
21
|
-
description: '
|
|
22
|
+
description: 'The File Name to use, if not set the API will try to figure out the file name.',
|
|
22
23
|
}),
|
|
23
24
|
acl: pieces_framework_1.Property.StaticDropdown({
|
|
24
25
|
displayName: 'ACL',
|
|
@@ -56,65 +57,34 @@ exports.amazons3UploadFile = (0, pieces_framework_1.createAction)({
|
|
|
56
57
|
],
|
|
57
58
|
},
|
|
58
59
|
}),
|
|
59
|
-
type: pieces_framework_1.Property.
|
|
60
|
-
displayName:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
label: 'image/png',
|
|
66
|
-
value: 'image/png',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
label: 'image/jpeg',
|
|
70
|
-
value: 'image/jpeg',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
label: 'image/gif',
|
|
74
|
-
value: 'image/gif',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
label: 'audio/mpeg',
|
|
78
|
-
value: 'audio/mpeg',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
label: 'audio/wav',
|
|
82
|
-
value: 'audio/wav',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
label: 'video/mp4',
|
|
86
|
-
value: 'video/mp4',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
label: 'application/pdf',
|
|
90
|
-
value: 'application/pdf',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
label: 'application/msword',
|
|
94
|
-
value: 'application/msword',
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
label: 'text/plain',
|
|
98
|
-
value: 'text/plain',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
label: 'application/json',
|
|
102
|
-
value: 'application/json',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
}),
|
|
60
|
+
type: pieces_framework_1.Property.ShortText({
|
|
61
|
+
displayName: "Content Type",
|
|
62
|
+
description: "Content Type of the uploaded file, if not set the API will try to figure out the content type.",
|
|
63
|
+
required: false
|
|
64
|
+
})
|
|
107
65
|
},
|
|
108
66
|
run(context) {
|
|
109
67
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
110
68
|
const { bucket } = context.auth;
|
|
111
69
|
const { file, fileName, acl, type } = context.propsValue;
|
|
112
70
|
const s3 = (0, common_1.createS3)(context.auth);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
71
|
+
let contentType, extension = null;
|
|
72
|
+
if (!type) {
|
|
73
|
+
if (!file.extension || file.extension === undefined || !mime_types_1.default.contentType(file.extension)) {
|
|
74
|
+
throw new Error("Content type could not be interpreted, please check the input file.");
|
|
75
|
+
}
|
|
76
|
+
extension = '.' + file.extension;
|
|
77
|
+
contentType = mime_types_1.default.contentType(extension);
|
|
78
|
+
}
|
|
79
|
+
else if (!mime_types_1.default.extension(type)) {
|
|
80
|
+
throw new Error("The content type entered does not exist or is misspelled, please check your input.");
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
contentType = type;
|
|
84
|
+
extension = '.' + mime_types_1.default.extension(type);
|
|
85
|
+
}
|
|
116
86
|
const generatedName = new Date().toISOString() + Date.now() + extension;
|
|
117
|
-
const finalFileName = fileName ? fileName + extension : generatedName;
|
|
87
|
+
const finalFileName = fileName ? (fileName.endsWith(extension) ? fileName : fileName + extension) : generatedName;
|
|
118
88
|
const uploadResponse = yield s3.putObject({
|
|
119
89
|
Bucket: bucket,
|
|
120
90
|
Key: finalFileName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/amazon-s3/src/lib/actions/upload-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAqC;AACrC,sCAAqC;
|
|
1
|
+
{"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/amazon-s3/src/lib/actions/upload-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAqC;AACrC,sCAAqC;AAErC,oEAA8B;AAEjB,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,sBAAsB;IACnC,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,gFAAgF;SAC9F,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC3B,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,SAAS;qBACjB;oBACD;wBACE,KAAK,EAAE,aAAa;wBACpB,KAAK,EAAE,aAAa;qBACrB;oBACD;wBACE,KAAK,EAAE,mBAAmB;wBAC1B,KAAK,EAAE,mBAAmB;qBAC3B;oBACD;w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