@lowdefy/plugin-aws 4.7.3 → 5.1.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.
Files changed (32) hide show
  1. package/dist/blocks/S3Download/S3Download.js +6 -14
  2. package/dist/blocks/S3Download/gallery.yaml +234 -0
  3. package/dist/blocks/S3Download/meta.js +103 -0
  4. package/dist/blocks/S3Download/schema.js +107 -0
  5. package/dist/blocks/S3UploadButton/S3UploadButton.js +5 -14
  6. package/dist/blocks/S3UploadButton/gallery.yaml +349 -0
  7. package/dist/blocks/S3UploadButton/meta.js +156 -0
  8. package/dist/blocks/S3UploadButton/schema.js +121 -0
  9. package/dist/blocks/S3UploadDragger/S3UploadDragger.js +8 -16
  10. package/dist/blocks/S3UploadDragger/gallery.yaml +275 -0
  11. package/dist/blocks/S3UploadDragger/meta.js +102 -0
  12. package/dist/blocks/S3UploadDragger/schema.js +119 -0
  13. package/dist/blocks/S3UploadPhoto/S3UploadPhoto.js +20 -19
  14. package/dist/blocks/S3UploadPhoto/gallery.yaml +259 -0
  15. package/dist/blocks/S3UploadPhoto/meta.js +93 -0
  16. package/dist/blocks/S3UploadPhoto/schema.js +113 -0
  17. package/dist/blocks/utils/getS3Upload.js +35 -24
  18. package/dist/blocks/utils/useFileList.js +27 -4
  19. package/dist/blocks/withTheme.js +40 -0
  20. package/dist/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.js +15 -11
  21. package/dist/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js +12 -11
  22. package/dist/{blocks/S3UploadButton/style.less → metas.js} +4 -4
  23. package/dist/types.js +11 -17
  24. package/package.json +20 -16
  25. package/dist/blocks/S3Download/schema.json +0 -85
  26. package/dist/blocks/S3Download/style.less +0 -17
  27. package/dist/blocks/S3UploadButton/schema.json +0 -103
  28. package/dist/blocks/S3UploadDragger/schema.json +0 -97
  29. package/dist/blocks/S3UploadDragger/style.less +0 -17
  30. package/dist/blocks/S3UploadPhoto/schema.json +0 -95
  31. package/dist/blocks/S3UploadPhoto/style.less +0 -17
  32. /package/dist/blocks/S3UploadButton/{examples.yaml → tests.yaml} +0 -0
@@ -12,17 +12,17 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import AWS from 'aws-sdk';
15
+ */ import { S3Client } from '@aws-sdk/client-s3';
16
+ import { createPresignedPost } from '@aws-sdk/s3-presigned-post';
16
17
  import schema from './schema.js';
17
18
  import { type } from '@lowdefy/helpers';
18
- function AwsS3PresignedPostPolicy({ request, connection }) {
19
+ async function AwsS3PresignedPostPolicy({ request, connection }) {
19
20
  const { accessKeyId, secretAccessKey, region, bucket } = connection;
20
21
  const { acl, conditions, expires, key, fields = {} } = request;
21
22
  const params = {
22
23
  Bucket: bucket,
23
- Fields: {
24
- key
25
- }
24
+ Key: key,
25
+ Fields: {}
26
26
  };
27
27
  if (conditions) {
28
28
  params.Conditions = conditions;
@@ -41,13 +41,14 @@ function AwsS3PresignedPostPolicy({ request, connection }) {
41
41
  params.Fields[field] = fields[field];
42
42
  }
43
43
  });
44
- const s3 = new AWS.S3({
45
- accessKeyId,
46
- secretAccessKey,
47
- region,
48
- bucket
44
+ const s3 = new S3Client({
45
+ credentials: {
46
+ accessKeyId,
47
+ secretAccessKey
48
+ },
49
+ region
49
50
  });
50
- return s3.createPresignedPost(params);
51
+ return createPresignedPost(s3, params);
51
52
  }
52
53
  AwsS3PresignedPostPolicy.schema = schema;
53
54
  AwsS3PresignedPostPolicy.meta = {
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */
16
-
17
- @import 'antd/lib/upload/style/index.less';
18
- @import 'antd/lib/button/style/index.less';
15
+ */ export { default as S3Download } from './blocks/S3Download/meta.js';
16
+ export { default as S3UploadButton } from './blocks/S3UploadButton/meta.js';
17
+ export { default as S3UploadDragger } from './blocks/S3UploadDragger/meta.js';
18
+ export { default as S3UploadPhoto } from './blocks/S3UploadPhoto/meta.js';
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable import/namespace */ /*
1
+ /*
2
2
  Copyright 2020-2026 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,21 +12,15 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import * as connections from './connections.js';
16
- import * as blocks from './blocks.js';
17
- const icons = {};
18
- const styles = {};
19
- Object.keys(blocks).forEach((block)=>{
20
- icons[block] = blocks[block].meta.icons ?? [];
21
- styles[block] = blocks[block].meta.styles ?? [];
22
- });
15
+ */ import { extractBlockTypes } from '@lowdefy/block-utils';
16
+ import * as metas from './metas.js';
23
17
  export default {
24
- blocks: Object.keys(blocks),
25
- icons,
26
- styles: {
27
- default: [],
28
- ...styles
29
- },
30
- connections: Object.keys(connections),
31
- requests: Object.keys(connections).map((connection)=>Object.keys(connections[connection].requests)).flat()
18
+ ...extractBlockTypes(metas),
19
+ connections: [
20
+ 'AwsS3Bucket'
21
+ ],
22
+ requests: [
23
+ 'AwsS3PresignedGetObject',
24
+ 'AwsS3PresignedPostPolicy'
25
+ ]
32
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/plugin-aws",
3
- "version": "4.7.3",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -34,28 +34,32 @@
34
34
  "./*": "./dist/*",
35
35
  "./connections/*": "./dist/connections/*",
36
36
  "./blocks": "./dist/blocks.js",
37
+ "./metas": "./dist/metas.js",
37
38
  "./types": "./dist/types.js"
38
39
  },
39
40
  "files": [
40
41
  "dist/*"
41
42
  ],
42
43
  "dependencies": {
43
- "@lowdefy/block-utils": "4.7.3",
44
- "@lowdefy/blocks-antd": "4.7.3",
45
- "@lowdefy/helpers": "4.7.3",
46
- "antd": "4.24.14",
47
- "aws-sdk": "2.1459.0",
48
- "react": "18.2.0",
49
- "react-dom": "18.2.0"
44
+ "@lowdefy/block-utils": "5.1.0",
45
+ "@lowdefy/blocks-antd": "5.1.0",
46
+ "@lowdefy/helpers": "5.1.0",
47
+ "@aws-sdk/client-s3": "3.797.0",
48
+ "@aws-sdk/s3-presigned-post": "3.797.0",
49
+ "@aws-sdk/s3-request-presigner": "3.797.0"
50
+ },
51
+ "peerDependencies": {
52
+ "antd": ">=6",
53
+ "react": ">=18",
54
+ "react-dom": ">=18"
50
55
  },
51
56
  "devDependencies": {
52
- "@emotion/jest": "11.10.5",
53
- "@lowdefy/ajv": "4.7.3",
54
- "@lowdefy/block-dev": "4.7.3",
55
- "@lowdefy/jest-yaml-transform": "4.7.3",
56
- "@swc/cli": "0.1.63",
57
- "@swc/core": "1.3.99",
58
- "@swc/jest": "0.2.29",
57
+ "@lowdefy/ajv": "5.1.0",
58
+ "@lowdefy/block-dev": "5.1.0",
59
+ "@lowdefy/jest-yaml-transform": "5.1.0",
60
+ "@swc/cli": "0.8.0",
61
+ "@swc/core": "1.15.18",
62
+ "@swc/jest": "0.2.39",
59
63
  "@testing-library/dom": "8.19.1",
60
64
  "@testing-library/react": "13.4.0",
61
65
  "@testing-library/user-event": "14.4.3",
@@ -68,7 +72,7 @@
68
72
  "access": "public"
69
73
  },
70
74
  "scripts": {
71
- "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
75
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --cli-config-file ../../../../.swc-cli.json --copy-files",
72
76
  "clean": "rm -rf dist",
73
77
  "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\""
74
78
  }
@@ -1,85 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "required": ["s3GetPolicyRequestId"],
6
- "properties": {
7
- "fileList": {
8
- "type": "array",
9
- "description": "List of files to be downloaded. If files were uploaded using an S3Upload block, the fileList value can just be mapped to this field.",
10
- "items": {
11
- "type": "object",
12
- "required": ["key"],
13
- "properties": {
14
- "key": {
15
- "type": "string",
16
- "description": "S3 file key."
17
- },
18
- "lastModified": {
19
- "type": "string",
20
- "description": "File last modified date."
21
- },
22
- "name": {
23
- "type": "string",
24
- "description": "File name."
25
- },
26
- "size": {
27
- "type": "number",
28
- "description": "File size in bytes."
29
- },
30
- "type": {
31
- "type": "string",
32
- "description": "File MIME type."
33
- }
34
- }
35
- }
36
- },
37
- "s3GetPolicyRequestId": {
38
- "type": "string",
39
- "description": "Id of a request of type s3GetPolicyRequestId that defines to which S3 bucket and what file should be downloaded.",
40
- "docs": {
41
- "displayType": "manual",
42
- "block": {
43
- "id": "block_properties_s3GetPolicyRequestId",
44
- "layout": { "_global": "settings_input_layout" },
45
- "type": "Label",
46
- "required": true,
47
- "properties": {
48
- "title": "s3GetPolicyRequestId",
49
- "span": 8,
50
- "align": "right"
51
- },
52
- "blocks": [
53
- {
54
- "id": "block_properties_s3GetPolicyRequestId_text",
55
- "type": "Markdown",
56
- "style": {
57
- "color": "#8c8c8c"
58
- },
59
- "properties": {
60
- "content": "Id of a request of type AwsS3PresignedGetPolicy that defines to which S3 bucket and what file should be downloaded."
61
- }
62
- }
63
- ]
64
- }
65
- }
66
- },
67
- "style": {
68
- "type": "object",
69
- "description": "Css style object to applied to download component.",
70
- "docs": {
71
- "displayType": "yaml"
72
- }
73
- }
74
- }
75
- },
76
- "events": {
77
- "type": "object",
78
- "properties": {
79
- "onChange": {
80
- "type": "array",
81
- "description": "Triggered when the upload state is changing."
82
- }
83
- }
84
- }
85
- }
@@ -1,17 +0,0 @@
1
- /*
2
- Copyright 2020-2026 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- @import 'antd/lib/upload/style/index.less';
@@ -1,103 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "required": ["s3PostPolicyRequestId"],
6
- "properties": {
7
- "accept": {
8
- "type": "string",
9
- "description": "File types accepted by the input. See html file type input accept property at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept."
10
- },
11
- "button": {
12
- "type": "object",
13
- "description": "Button block properties.",
14
- "default": {
15
- "icon": "UploadOutlined",
16
- "title": "Upload",
17
- "type": "default"
18
- },
19
- "docs": {
20
- "displayType": "button"
21
- }
22
- },
23
- "disabled": {
24
- "type": "boolean",
25
- "description": "Disable the file input."
26
- },
27
- "maxCount": {
28
- "type": "number",
29
- "description": "Maximum number of files that can be uploaded."
30
- },
31
- "s3PostPolicyRequestId": {
32
- "type": "string",
33
- "description": "Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.",
34
- "docs": {
35
- "displayType": "manual",
36
- "block": {
37
- "id": "block_properties_s3PostPolicyRequestId",
38
- "layout": { "_global": "settings_input_layout" },
39
- "type": "Label",
40
- "required": true,
41
- "properties": {
42
- "title": "s3PostPolicyRequestId",
43
- "span": 8,
44
- "align": "right"
45
- },
46
- "blocks": [
47
- {
48
- "id": "block_properties_s3PostPolicyRequestId_text",
49
- "type": "Markdown",
50
- "style": {
51
- "color": "#8c8c8c"
52
- },
53
- "properties": {
54
- "content": "Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded."
55
- }
56
- }
57
- ]
58
- },
59
- "getter": {}
60
- }
61
- },
62
- "showUploadList": {
63
- "type": "boolean",
64
- "default": true,
65
- "description": "Whether to show default upload list."
66
- },
67
- "singleFile": {
68
- "type": "boolean",
69
- "default": false,
70
- "description": "Only allow a single file to be uploaded. Only one file can be selected in the prompt."
71
- }
72
- }
73
- },
74
- "events": {
75
- "type": "object",
76
- "properties": {
77
- "onChange": {
78
- "type": "array",
79
- "description": "Triggered when the upload state is changing."
80
- },
81
- "onProgress": {
82
- "type": "array",
83
- "description": "Triggered when the upload state is in progress."
84
- },
85
- "onSuccess": {
86
- "type": "array",
87
- "description": "Triggered when the upload state is done uploading."
88
- },
89
- "onRemove": {
90
- "type": "array",
91
- "description": "Triggered when the upload has been removed."
92
- },
93
- "onError": {
94
- "type": "array",
95
- "description": "Triggered when the upload has failed."
96
- },
97
- "onClick": {
98
- "type": "array",
99
- "description": "Triggered when the upload button is clicked."
100
- }
101
- }
102
- }
103
- }
@@ -1,97 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "required": ["s3PostPolicyRequestId"],
6
- "properties": {
7
- "title": {
8
- "type": "string",
9
- "description": "Title of the file input to be displayed on the draggable area."
10
- },
11
- "accept": {
12
- "type": "string",
13
- "description": "File types accepted by the input. See html file type input accept property at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept."
14
- },
15
- "disabled": {
16
- "type": "boolean",
17
- "description": "Disable the file input."
18
- },
19
- "maxCount": {
20
- "type": "number",
21
- "description": "Maximum number of files that can be uploaded."
22
- },
23
- "s3PostPolicyRequestId": {
24
- "type": "string",
25
- "description": "Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.",
26
- "docs": {
27
- "displayType": "manual",
28
- "block": {
29
- "id": "block_properties_s3PostPolicyRequestId",
30
- "layout": { "_global": "settings_input_layout" },
31
- "type": "Label",
32
- "required": true,
33
- "properties": {
34
- "title": "s3PostPolicyRequestId",
35
- "span": 8,
36
- "align": "right"
37
- },
38
- "blocks": [
39
- {
40
- "id": "block_properties_s3PostPolicyRequestId_text",
41
- "type": "Markdown",
42
- "style": {
43
- "color": "#8c8c8c"
44
- },
45
- "properties": {
46
- "content": "Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded."
47
- }
48
- }
49
- ]
50
- }
51
- }
52
- },
53
- "showUploadList": {
54
- "type": "boolean",
55
- "default": true,
56
- "description": "Whether to show default upload list."
57
- },
58
- "singleFile": {
59
- "type": "boolean",
60
- "default": false,
61
- "description": "Only allow a single file to be uploaded. Only one file can be selected in the prompt."
62
- },
63
- "style": {
64
- "type": "object",
65
- "description": "Css style object to applied to draggable area.",
66
- "docs": {
67
- "displayType": "yaml"
68
- }
69
- }
70
- }
71
- },
72
- "events": {
73
- "type": "object",
74
- "properties": {
75
- "onChange": {
76
- "type": "array",
77
- "description": "Triggered when the upload state is changing."
78
- },
79
- "onProgress": {
80
- "type": "array",
81
- "description": "Triggered when the upload state is in progress."
82
- },
83
- "onSuccess": {
84
- "type": "array",
85
- "description": "Triggered when the upload state is done uploading."
86
- },
87
- "onRemove": {
88
- "type": "array",
89
- "description": "Triggered when the upload has been removed."
90
- },
91
- "onError": {
92
- "type": "array",
93
- "description": "Triggered when the upload has failed."
94
- }
95
- }
96
- }
97
- }
@@ -1,17 +0,0 @@
1
- /*
2
- Copyright 2020-2026 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- @import 'antd/lib/upload/style/index.less';
@@ -1,95 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "required": ["s3PostPolicyRequestId"],
6
- "properties": {
7
- "title": {
8
- "type": "string",
9
- "description": "Title of the file input to be displayed instead of 'Upload image'.",
10
- "default": "Upload image"
11
- },
12
- "disabled": {
13
- "type": "boolean",
14
- "description": "Disable the file input."
15
- },
16
- "maxCount": {
17
- "type": "number",
18
- "description": "Maximum number of files that can be uploaded."
19
- },
20
- "s3PostPolicyRequestId": {
21
- "type": "string",
22
- "description": "Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.",
23
- "docs": {
24
- "displayType": "manual",
25
- "block": {
26
- "id": "block_properties_s3PostPolicyRequestId",
27
- "layout": { "_global": "settings_input_layout" },
28
- "type": "Label",
29
- "required": true,
30
- "properties": {
31
- "title": "s3PostPolicyRequestId",
32
- "span": 8,
33
- "align": "right"
34
- },
35
- "blocks": [
36
- {
37
- "id": "block_properties_s3PostPolicyRequestId_text",
38
- "type": "Markdown",
39
- "style": {
40
- "color": "#8c8c8c"
41
- },
42
- "properties": {
43
- "content": "Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded."
44
- }
45
- }
46
- ]
47
- },
48
- "getter": {}
49
- }
50
- },
51
- "showUploadList": {
52
- "type": "boolean",
53
- "default": true,
54
- "description": "Whether to show default upload list."
55
- },
56
- "singleFile": {
57
- "type": "boolean",
58
- "default": false,
59
- "description": "Only allow a single file to be uploaded. Only one file can be selected in the prompt."
60
- },
61
- "style": {
62
- "type": "object",
63
- "description": "Css style object to applied to draggable area.",
64
- "docs": {
65
- "displayType": "yaml"
66
- }
67
- }
68
- }
69
- },
70
- "events": {
71
- "type": "object",
72
- "properties": {
73
- "onChange": {
74
- "type": "array",
75
- "description": "Triggered when the upload state is changing."
76
- },
77
- "onProgress": {
78
- "type": "array",
79
- "description": "Triggered when the upload state is in progress."
80
- },
81
- "onSuccess": {
82
- "type": "array",
83
- "description": "Triggered when the upload state is done uploading."
84
- },
85
- "onRemove": {
86
- "type": "array",
87
- "description": "Triggered when the upload has been removed."
88
- },
89
- "onError": {
90
- "type": "array",
91
- "description": "Triggered when the upload has failed."
92
- }
93
- }
94
- }
95
- }
@@ -1,17 +0,0 @@
1
- /*
2
- Copyright 2020-2026 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- @import 'antd/lib/upload/style/index.less';