@adminforth/upload 2.3.7 → 2.3.8
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/build.log +2 -2
- package/custom/tsconfig.json +1 -4
- package/dist/custom/tsconfig.json +1 -4
- package/dist/index.js +24 -4
- package/index.ts +19 -3
- package/package.json +2 -2
package/build.log
CHANGED
|
@@ -11,5 +11,5 @@ custom/preview.vue
|
|
|
11
11
|
custom/tsconfig.json
|
|
12
12
|
custom/uploader.vue
|
|
13
13
|
|
|
14
|
-
sent
|
|
15
|
-
total size is 46,
|
|
14
|
+
sent 46,937 bytes received 134 bytes 94,142.00 bytes/sec
|
|
15
|
+
total size is 46,455 speedup is 0.99
|
package/custom/tsconfig.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
3
|
+
"baseUrl": ".",
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
6
|
"../../../adminforth/spa/src/*"
|
|
8
7
|
],
|
|
9
8
|
"*": [
|
|
10
|
-
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
9
|
"../../../adminforth/spa/node_modules/*"
|
|
12
10
|
],
|
|
13
11
|
"@@/*": [
|
|
14
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
12
|
"."
|
|
16
13
|
]
|
|
17
14
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
3
|
+
"baseUrl": ".",
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
6
|
"../../../adminforth/spa/src/*"
|
|
8
7
|
],
|
|
9
8
|
"*": [
|
|
10
|
-
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
9
|
"../../../adminforth/spa/node_modules/*"
|
|
12
10
|
],
|
|
13
11
|
"@@/*": [
|
|
14
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
12
|
"."
|
|
16
13
|
]
|
|
17
14
|
}
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,12 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
116
116
|
if (record[pathColumnName]) {
|
|
117
117
|
process.env.HEAVY_DEBUG && console.log('🪥🪥 remove ObjectTagging', record[pathColumnName]);
|
|
118
118
|
// let it crash if it fails: this is a new file which just was uploaded.
|
|
119
|
-
|
|
119
|
+
if (this.options.storageAdapter.markKeyForNotDeletion !== undefined) {
|
|
120
|
+
yield this.options.storageAdapter.markKeyForNotDeletion(record[pathColumnName]);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
yield this.options.storageAdapter.markKeyForNotDeletation(record[pathColumnName]);
|
|
124
|
+
}
|
|
120
125
|
}
|
|
121
126
|
return { ok: true };
|
|
122
127
|
}));
|
|
@@ -150,7 +155,12 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
150
155
|
resourceConfig.hooks.delete.afterSave.push((_a) => __awaiter(this, [_a], void 0, function* ({ record }) {
|
|
151
156
|
if (record[pathColumnName]) {
|
|
152
157
|
try {
|
|
153
|
-
|
|
158
|
+
if (this.options.storageAdapter.markKeyForDeletion !== undefined) {
|
|
159
|
+
yield this.options.storageAdapter.markKeyForDeletion(record[pathColumnName]);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
yield this.options.storageAdapter.markKeyForDeletation(record[pathColumnName]);
|
|
163
|
+
}
|
|
154
164
|
}
|
|
155
165
|
catch (e) {
|
|
156
166
|
// file might be e.g. already deleted, so we catch error
|
|
@@ -166,7 +176,12 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
166
176
|
if (oldRecord[pathColumnName]) {
|
|
167
177
|
// put tag to delete old file
|
|
168
178
|
try {
|
|
169
|
-
|
|
179
|
+
if (this.options.storageAdapter.markKeyForDeletion !== undefined) {
|
|
180
|
+
yield this.options.storageAdapter.markKeyForDeletion(oldRecord[pathColumnName]);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
yield this.options.storageAdapter.markKeyForDeletation(oldRecord[pathColumnName]);
|
|
184
|
+
}
|
|
170
185
|
}
|
|
171
186
|
catch (e) {
|
|
172
187
|
// file might be e.g. already deleted, so we catch error
|
|
@@ -176,7 +191,12 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
176
191
|
if (updates[pathColumnName] !== null) {
|
|
177
192
|
// remove tag from new file
|
|
178
193
|
// in this case we let it crash if it fails: this is a new file which just was uploaded.
|
|
179
|
-
|
|
194
|
+
if (this.options.storageAdapter.markKeyForNotDeletion !== undefined) {
|
|
195
|
+
yield this.options.storageAdapter.markKeyForNotDeletion(updates[pathColumnName]);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
yield this.options.storageAdapter.markKeyForNotDeletation(updates[pathColumnName]);
|
|
199
|
+
}
|
|
180
200
|
}
|
|
181
201
|
}
|
|
182
202
|
return { ok: true };
|
package/index.ts
CHANGED
|
@@ -128,7 +128,11 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
128
128
|
if (record[pathColumnName]) {
|
|
129
129
|
process.env.HEAVY_DEBUG && console.log('🪥🪥 remove ObjectTagging', record[pathColumnName]);
|
|
130
130
|
// let it crash if it fails: this is a new file which just was uploaded.
|
|
131
|
-
|
|
131
|
+
if (this.options.storageAdapter.markKeyForNotDeletion !== undefined) {
|
|
132
|
+
await this.options.storageAdapter.markKeyForNotDeletion(record[pathColumnName]);
|
|
133
|
+
} else {
|
|
134
|
+
await this.options.storageAdapter.markKeyForNotDeletation(record[pathColumnName]);
|
|
135
|
+
}
|
|
132
136
|
}
|
|
133
137
|
return { ok: true };
|
|
134
138
|
});
|
|
@@ -171,7 +175,11 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
171
175
|
resourceConfig.hooks.delete.afterSave.push(async ({ record }: { record: any }) => {
|
|
172
176
|
if (record[pathColumnName]) {
|
|
173
177
|
try {
|
|
174
|
-
|
|
178
|
+
if (this.options.storageAdapter.markKeyForDeletion !== undefined) {
|
|
179
|
+
await this.options.storageAdapter.markKeyForDeletion(record[pathColumnName]);
|
|
180
|
+
} else {
|
|
181
|
+
await this.options.storageAdapter.markKeyForDeletation(record[pathColumnName]);
|
|
182
|
+
}
|
|
175
183
|
} catch (e) {
|
|
176
184
|
// file might be e.g. already deleted, so we catch error
|
|
177
185
|
console.error(`Error setting tag ${ADMINFORTH_NOT_YET_USED_TAG} to true for object ${record[pathColumnName]}. File will not be auto-cleaned up`, e);
|
|
@@ -192,7 +200,11 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
192
200
|
if (oldRecord[pathColumnName]) {
|
|
193
201
|
// put tag to delete old file
|
|
194
202
|
try {
|
|
195
|
-
|
|
203
|
+
if (this.options.storageAdapter.markKeyForDeletion !== undefined) {
|
|
204
|
+
await this.options.storageAdapter.markKeyForDeletion(oldRecord[pathColumnName]);
|
|
205
|
+
} else {
|
|
206
|
+
await this.options.storageAdapter.markKeyForDeletation(oldRecord[pathColumnName]);
|
|
207
|
+
}
|
|
196
208
|
} catch (e) {
|
|
197
209
|
// file might be e.g. already deleted, so we catch error
|
|
198
210
|
console.error(`Error setting tag ${ADMINFORTH_NOT_YET_USED_TAG} to true for object ${oldRecord[pathColumnName]}. File will not be auto-cleaned up`, e);
|
|
@@ -201,8 +213,12 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
201
213
|
if (updates[pathColumnName] !== null) {
|
|
202
214
|
// remove tag from new file
|
|
203
215
|
// in this case we let it crash if it fails: this is a new file which just was uploaded.
|
|
216
|
+
if (this.options.storageAdapter.markKeyForNotDeletion !== undefined) {
|
|
217
|
+
await this.options.storageAdapter.markKeyForNotDeletion(updates[pathColumnName]);
|
|
218
|
+
} else {
|
|
204
219
|
await this.options.storageAdapter.markKeyForNotDeletation(updates[pathColumnName]);
|
|
205
220
|
}
|
|
221
|
+
}
|
|
206
222
|
}
|
|
207
223
|
return { ok: true };
|
|
208
224
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/upload",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.8",
|
|
4
4
|
"description": "Plugin for uploading files for adminforth",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@aws-sdk/client-s3": "^3.629.0",
|
|
24
24
|
"@aws-sdk/s3-request-presigner": "^3.629.0",
|
|
25
|
-
"adminforth": "^2.4.0-next.
|
|
25
|
+
"adminforth": "^2.4.0-next.315"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"adminforth",
|