@lowdefy/plugin-aws 4.0.0-rc.11 → 4.0.0-rc.12
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.
|
@@ -43,12 +43,10 @@ const makeOnChangeValue = (s3Parameters, changeEvent)=>{
|
|
|
43
43
|
};
|
|
44
44
|
const getDisabled = ({ properties, value })=>{
|
|
45
45
|
if (properties.disabled) return true;
|
|
46
|
-
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
46
|
+
return properties.singleFile && value && (value.fileList || []).length >= 1;
|
|
50
47
|
};
|
|
51
48
|
const getCustomRequest = ({ methods, setS3Parameters })=>async ({ file, onError, onProgress, onSuccess })=>{
|
|
49
|
+
let meta;
|
|
52
50
|
try {
|
|
53
51
|
const { name, size, type, uid } = file;
|
|
54
52
|
const s3PostPolicyResponse = await methods.triggerEvent({
|
|
@@ -65,7 +63,7 @@ const getCustomRequest = ({ methods, setS3Parameters })=>async ({ file, onError,
|
|
|
65
63
|
}
|
|
66
64
|
const { url, fields } = s3PostPolicyResponse.responses.__getS3PostPolicy.response[0];
|
|
67
65
|
const { bucket, key } = fields;
|
|
68
|
-
|
|
66
|
+
meta = {
|
|
69
67
|
bucket,
|
|
70
68
|
key,
|
|
71
69
|
filename: name,
|
|
@@ -95,39 +93,39 @@ const getCustomRequest = ({ methods, setS3Parameters })=>async ({ file, onError,
|
|
|
95
93
|
// file needs to be the last field in the form
|
|
96
94
|
formData.append('file', file);
|
|
97
95
|
const xhr = new XMLHttpRequest();
|
|
98
|
-
xhr.upload.onprogress = (
|
|
99
|
-
if (
|
|
96
|
+
xhr.upload.onprogress = (event)=>{
|
|
97
|
+
if (event.lengthComputable) {
|
|
100
98
|
onProgress({
|
|
101
|
-
percent:
|
|
99
|
+
percent: event.loaded / event.total * 80 + 20
|
|
102
100
|
});
|
|
103
101
|
}
|
|
104
102
|
};
|
|
105
|
-
xhr.addEventListener('error', async (
|
|
103
|
+
xhr.addEventListener('error', async (event)=>{
|
|
106
104
|
await methods.triggerEvent({
|
|
107
105
|
name: 'onError',
|
|
108
106
|
event: {
|
|
109
|
-
meta
|
|
110
|
-
event
|
|
107
|
+
meta,
|
|
108
|
+
event
|
|
111
109
|
}
|
|
112
110
|
});
|
|
113
|
-
onError(
|
|
111
|
+
onError(event);
|
|
114
112
|
});
|
|
115
|
-
xhr.addEventListener('load', async (
|
|
113
|
+
xhr.addEventListener('load', async (event)=>{
|
|
116
114
|
await methods.triggerEvent({
|
|
117
115
|
name: 'onSuccess',
|
|
118
116
|
event: {
|
|
119
|
-
meta
|
|
120
|
-
event
|
|
117
|
+
meta,
|
|
118
|
+
event
|
|
121
119
|
}
|
|
122
120
|
});
|
|
123
|
-
onSuccess(
|
|
121
|
+
onSuccess(event);
|
|
124
122
|
});
|
|
125
|
-
xhr.addEventListener('loadend', async (
|
|
123
|
+
xhr.addEventListener('loadend', async (event)=>{
|
|
126
124
|
await methods.triggerEvent({
|
|
127
125
|
name: 'onDone',
|
|
128
126
|
event: {
|
|
129
|
-
meta
|
|
130
|
-
event
|
|
127
|
+
meta,
|
|
128
|
+
event
|
|
131
129
|
}
|
|
132
130
|
});
|
|
133
131
|
});
|
|
@@ -139,7 +137,7 @@ const getCustomRequest = ({ methods, setS3Parameters })=>async ({ file, onError,
|
|
|
139
137
|
name: 'onError',
|
|
140
138
|
event: {
|
|
141
139
|
meta,
|
|
142
|
-
|
|
140
|
+
error
|
|
143
141
|
}
|
|
144
142
|
});
|
|
145
143
|
onError(error);
|
|
@@ -184,8 +182,8 @@ const S3UploadButtonBlock = ({ blockId, components, events, methods, properties,
|
|
|
184
182
|
id: blockId,
|
|
185
183
|
multiple: !properties.singleFile,
|
|
186
184
|
showUploadList: properties.showUploadList,
|
|
187
|
-
onChange: (
|
|
188
|
-
methods.setValue(makeOnChangeValue(s3Parameters,
|
|
185
|
+
onChange: (event)=>{
|
|
186
|
+
methods.setValue(makeOnChangeValue(s3Parameters, event));
|
|
189
187
|
methods.triggerEvent({
|
|
190
188
|
name: 'onChange'
|
|
191
189
|
});
|
|
@@ -41,6 +41,7 @@ const makeOnChangeValue = (s3Parameters, changeEvent)=>{
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
const getCustomRequest = ({ methods, setS3Parameters, setLoading })=>async ({ file, onError, onProgress, onSuccess })=>{
|
|
44
|
+
let meta;
|
|
44
45
|
try {
|
|
45
46
|
setLoading(true);
|
|
46
47
|
const { name, size, type, uid } = file;
|
|
@@ -59,7 +60,7 @@ const getCustomRequest = ({ methods, setS3Parameters, setLoading })=>async ({ fi
|
|
|
59
60
|
}
|
|
60
61
|
const { url, fields } = s3PostPolicyResponse.responses.__getS3PostPolicy.response[0];
|
|
61
62
|
const { bucket, key } = fields;
|
|
62
|
-
|
|
63
|
+
meta = {
|
|
63
64
|
bucket,
|
|
64
65
|
key,
|
|
65
66
|
filename: name,
|
|
@@ -89,39 +90,39 @@ const getCustomRequest = ({ methods, setS3Parameters, setLoading })=>async ({ fi
|
|
|
89
90
|
// file needs to be the last field in the form
|
|
90
91
|
formData.append('file', file);
|
|
91
92
|
const xhr = new XMLHttpRequest();
|
|
92
|
-
xhr.upload.onprogress = (
|
|
93
|
-
if (
|
|
93
|
+
xhr.upload.onprogress = (event)=>{
|
|
94
|
+
if (event.lengthComputable) {
|
|
94
95
|
onProgress({
|
|
95
|
-
percent:
|
|
96
|
+
percent: event.loaded / event.total * 80 + 20
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
};
|
|
99
|
-
xhr.addEventListener('error', async (
|
|
100
|
+
xhr.addEventListener('error', async (event)=>{
|
|
100
101
|
await methods.triggerEvent({
|
|
101
102
|
name: 'onError',
|
|
102
103
|
event: {
|
|
103
|
-
meta
|
|
104
|
-
event
|
|
104
|
+
meta,
|
|
105
|
+
event
|
|
105
106
|
}
|
|
106
107
|
});
|
|
107
|
-
onError(
|
|
108
|
+
onError(event);
|
|
108
109
|
});
|
|
109
|
-
xhr.addEventListener('load', async (
|
|
110
|
+
xhr.addEventListener('load', async (event)=>{
|
|
110
111
|
await methods.triggerEvent({
|
|
111
112
|
name: 'onSuccess',
|
|
112
113
|
event: {
|
|
113
|
-
meta
|
|
114
|
-
event
|
|
114
|
+
meta,
|
|
115
|
+
event
|
|
115
116
|
}
|
|
116
117
|
});
|
|
117
|
-
onSuccess(
|
|
118
|
+
onSuccess(event);
|
|
118
119
|
});
|
|
119
|
-
xhr.addEventListener('loadend', async (
|
|
120
|
+
xhr.addEventListener('loadend', async (event)=>{
|
|
120
121
|
await methods.triggerEvent({
|
|
121
122
|
name: 'onDone',
|
|
122
123
|
event: {
|
|
123
|
-
meta
|
|
124
|
-
event
|
|
124
|
+
meta,
|
|
125
|
+
event
|
|
125
126
|
}
|
|
126
127
|
});
|
|
127
128
|
setLoading(false);
|
|
@@ -134,7 +135,7 @@ const getCustomRequest = ({ methods, setS3Parameters, setLoading })=>async ({ fi
|
|
|
134
135
|
name: 'onError',
|
|
135
136
|
event: {
|
|
136
137
|
meta,
|
|
137
|
-
|
|
138
|
+
error
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
onError(error);
|
|
@@ -179,8 +180,8 @@ const S3UploadPhoto = ({ blockId, components: { Icon }, events, methods, propert
|
|
|
179
180
|
id: blockId,
|
|
180
181
|
multiple: !properties.singleFile,
|
|
181
182
|
showUploadList: properties.showUploadList,
|
|
182
|
-
onChange: (
|
|
183
|
-
methods.setValue(makeOnChangeValue(s3Parameters,
|
|
183
|
+
onChange: (event)=>{
|
|
184
|
+
methods.setValue(makeOnChangeValue(s3Parameters, event));
|
|
184
185
|
methods.triggerEvent({
|
|
185
186
|
name: 'onChange'
|
|
186
187
|
});
|
package/dist/types.js
CHANGED
|
@@ -17,8 +17,8 @@ import * as blocks from './blocks.js';
|
|
|
17
17
|
const icons = {};
|
|
18
18
|
const styles = {};
|
|
19
19
|
Object.keys(blocks).forEach((block)=>{
|
|
20
|
-
icons[block] = blocks[block].meta.icons
|
|
21
|
-
styles[block] = blocks[block].meta.styles
|
|
20
|
+
icons[block] = blocks[block].meta.icons ?? [];
|
|
21
|
+
styles[block] = blocks[block].meta.styles ?? [];
|
|
22
22
|
});
|
|
23
23
|
export default {
|
|
24
24
|
blocks: Object.keys(blocks),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/plugin-aws",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.12",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\""
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@lowdefy/block-utils": "4.0.0-rc.
|
|
49
|
-
"@lowdefy/blocks-antd": "4.0.0-rc.
|
|
50
|
-
"@lowdefy/helpers": "4.0.0-rc.
|
|
48
|
+
"@lowdefy/block-utils": "4.0.0-rc.12",
|
|
49
|
+
"@lowdefy/blocks-antd": "4.0.0-rc.12",
|
|
50
|
+
"@lowdefy/helpers": "4.0.0-rc.12",
|
|
51
51
|
"antd": "4.24.14",
|
|
52
52
|
"aws-sdk": "2.1459.0",
|
|
53
53
|
"react": "18.2.0",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@emotion/jest": "11.10.5",
|
|
58
|
-
"@lowdefy/ajv": "4.0.0-rc.
|
|
59
|
-
"@lowdefy/block-dev": "4.0.0-rc.
|
|
60
|
-
"@lowdefy/jest-yaml-transform": "4.0.0-rc.
|
|
58
|
+
"@lowdefy/ajv": "4.0.0-rc.12",
|
|
59
|
+
"@lowdefy/block-dev": "4.0.0-rc.12",
|
|
60
|
+
"@lowdefy/jest-yaml-transform": "4.0.0-rc.12",
|
|
61
61
|
"@swc/cli": "0.1.62",
|
|
62
62
|
"@swc/core": "1.3.92",
|
|
63
63
|
"@swc/jest": "0.2.29",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "7f3059b6778b1cb8900b1d4456681b977521d45d"
|
|
76
76
|
}
|