@did-space/s3-driver 0.3.21 → 0.3.23
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/dist/operator/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare class S3SpaceOperator implements SpaceOperatorProtocol {
|
|
|
75
75
|
* @memberof S3SpaceOperator
|
|
76
76
|
*/
|
|
77
77
|
lists(options: ListsOptions): Promise<Object[]>;
|
|
78
|
-
list(options: ListOptions): Promise<Object>;
|
|
78
|
+
list(options: ListOptions): Promise<Object | null>;
|
|
79
79
|
writeAsOwner(key: string, data: Data, options?: WriteAsOwnerOptions): Promise<void>;
|
|
80
80
|
/**
|
|
81
81
|
*
|
package/dist/operator/index.js
CHANGED
|
@@ -430,7 +430,9 @@ class S3SpaceOperator {
|
|
|
430
430
|
list(options) {
|
|
431
431
|
var _a;
|
|
432
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
-
|
|
433
|
+
debug('list.before', JSON.stringify({ options: (0, lodash_1.omit)(options, 'data') }));
|
|
434
|
+
const absolutePath = (0, common_1.getSafeKey)((options === null || options === void 0 ? void 0 : options.useGlobal) ? options.key : (0, path_1.join)(this.options.root, options.key));
|
|
435
|
+
debug('list.before.$absolutePath', absolutePath);
|
|
434
436
|
const response = yield this.s3Client.send(new client_s3_1.ListObjectsCommand({
|
|
435
437
|
Bucket: this.options.bucket,
|
|
436
438
|
Prefix: absolutePath,
|
|
@@ -455,6 +457,7 @@ class S3SpaceOperator {
|
|
|
455
457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
456
458
|
debug('writeAsOwner.before', JSON.stringify({ key, options: (0, lodash_1.omit)(options, 'data') }));
|
|
457
459
|
const $key = (0, common_1.getSafeKey)((options === null || options === void 0 ? void 0 : options.useGlobal) ? key : (0, path_1.join)(this.options.root, key));
|
|
460
|
+
const isDirectory = $key.endsWith('/');
|
|
458
461
|
debug('writeAsOwner.$$key', $key);
|
|
459
462
|
const upload = new lib_storage_1.Upload({
|
|
460
463
|
client: this.s3Client,
|
|
@@ -466,6 +469,11 @@ class S3SpaceOperator {
|
|
|
466
469
|
},
|
|
467
470
|
});
|
|
468
471
|
yield upload.done();
|
|
472
|
+
const object = yield this.list(Object.assign(Object.assign({}, options), { key }));
|
|
473
|
+
if (!isDirectory && (!object || object.size !== (options === null || options === void 0 ? void 0 : options.size))) {
|
|
474
|
+
core_1.logger.error('writeAsOwner.throwError', { key, options });
|
|
475
|
+
throw new Error(`Uploaded size ${object === null || object === void 0 ? void 0 : object.size} does not match actual size ${options === null || options === void 0 ? void 0 : options.size}`);
|
|
476
|
+
}
|
|
469
477
|
debug('writeAsOwner.after', JSON.stringify({ key, options }));
|
|
470
478
|
});
|
|
471
479
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@did-space/s3-driver",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.23",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@aws-sdk/client-s3": "3.370.0",
|
|
40
40
|
"@aws-sdk/lib-storage": "3.370.0",
|
|
41
|
-
"@did-space/core": "0.3.
|
|
41
|
+
"@did-space/core": "0.3.23",
|
|
42
42
|
"aws-sdk-v3-proxy": "^2.1.2",
|
|
43
43
|
"debug": "^4.3.4",
|
|
44
44
|
"js-yaml": "^4.1.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"ts-jest": "^28.0.6",
|
|
63
63
|
"typescript": "^4.9.5"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "5e918882de7560a6fcb4e4cfa64272d3ac6162e3"
|
|
66
66
|
}
|