@did-space/s3-driver 0.2.126 → 0.2.128

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.
@@ -21,12 +21,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.S3SpaceOperator = void 0;
23
23
  const core_1 = require("@did-space/core");
24
- const url_join_1 = __importDefault(require("url-join"));
25
24
  const client_s3_1 = require("@aws-sdk/client-s3");
26
25
  const path_1 = require("path");
27
26
  const lib_storage_1 = require("@aws-sdk/lib-storage");
28
27
  const mime_types_1 = __importDefault(require("mime-types"));
29
- const lodash_1 = require("lodash");
28
+ const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
30
29
  class S3SpaceOperator {
31
30
  constructor(options) {
32
31
  this.options = options;
@@ -55,7 +54,7 @@ class S3SpaceOperator {
55
54
  */
56
55
  getSpaceSize() {
57
56
  return __awaiter(this, void 0, void 0, function* () {
58
- const prefix = (0, url_join_1.default)(this.options.root, '/');
57
+ const prefix = (0, path_1.join)(this.options.root, '/');
59
58
  const { size } = yield this.getPathStatus(prefix);
60
59
  return size;
61
60
  });
@@ -215,7 +214,7 @@ class S3SpaceOperator {
215
214
  var _a, e_2, _b, _c;
216
215
  var _d, _e;
217
216
  return __awaiter(this, void 0, void 0, function* () {
218
- const prefix = (0, url_join_1.default)(this.options.root, options.key);
217
+ const prefix = (0, path_1.join)(this.options.root, options.key);
219
218
  const objects = [];
220
219
  const folders = [];
221
220
  try {
@@ -231,10 +230,10 @@ class S3SpaceOperator {
231
230
  (_d = response === null || response === void 0 ? void 0 : response.Contents) === null || _d === void 0 ? void 0 : _d.forEach((content) => {
232
231
  const name = content.Key.replace(prefix, '');
233
232
  // @note: 有时候 name的值可能是空字符 ‘’
234
- if ((0, lodash_1.isEmpty)(name)) {
233
+ if ((0, isEmpty_1.default)(name)) {
235
234
  return;
236
235
  }
237
- const key = (0, url_join_1.default)(options.key, name);
236
+ const key = (0, path_1.join)(options.key, name);
238
237
  const isDir = content.Key.endsWith('/');
239
238
  objects.push({
240
239
  key,
@@ -291,7 +290,7 @@ class S3SpaceOperator {
291
290
  var _a, e_3, _b, _c;
292
291
  var _d;
293
292
  return __awaiter(this, void 0, void 0, function* () {
294
- const prefix = (0, url_join_1.default)(this.options.root, options.key);
293
+ const prefix = (0, path_1.join)(this.options.root, options.key);
295
294
  if (!(yield this.existsAsOwner(options.key))) {
296
295
  return [];
297
296
  }
@@ -314,6 +313,9 @@ class S3SpaceOperator {
314
313
  contents.forEach((content) => {
315
314
  const key = content.Key.replace(prefix, '/');
316
315
  const name = (0, path_1.basename)(key);
316
+ if ((0, isEmpty_1.default)(name)) {
317
+ return;
318
+ }
317
319
  objects.push({
318
320
  key,
319
321
  name,
@@ -346,7 +348,7 @@ class S3SpaceOperator {
346
348
  list(options) {
347
349
  var _a;
348
350
  return __awaiter(this, void 0, void 0, function* () {
349
- const key = (0, url_join_1.default)(this.options.root, options.key);
351
+ const key = (0, path_1.join)(this.options.root, options.key);
350
352
  const response = yield this.s3Client.send(new client_s3_1.ListObjectsCommand({
351
353
  Bucket: this.options.bucket,
352
354
  Prefix: key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/s3-driver",
3
- "version": "0.2.126",
3
+ "version": "0.2.128",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,17 +32,16 @@
32
32
  ]
33
33
  },
34
34
  "dependencies": {
35
- "@aws-sdk/client-s3": "^3.241.0",
36
- "@aws-sdk/lib-storage": "^3.241.0",
37
- "@did-space/core": "0.2.126",
35
+ "@aws-sdk/client-s3": "^3.362.0",
36
+ "@aws-sdk/lib-storage": "^3.362.0",
37
+ "@did-space/core": "0.2.128",
38
38
  "js-yaml": "^4.1.0",
39
39
  "lodash": "^4.17.21",
40
- "mime-types": "^2.1.35",
41
- "url-join": "4"
40
+ "mime-types": "^2.1.35"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@arcblock/eslint-config-ts": "^0.2.4",
45
- "@aws-sdk/types": "^3.241.0",
44
+ "@aws-sdk/types": "^3.357.0",
46
45
  "@types/fs-extra": "^9.0.13",
47
46
  "@types/jest": "^28.1.5",
48
47
  "@types/js-yaml": "^4.0.5",
@@ -50,12 +49,11 @@
50
49
  "@types/lodash": "^4.14.182",
51
50
  "@types/mime-types": "^2.1.1",
52
51
  "@types/node": "15.12.2",
53
- "@types/url-join": "^4.0.1",
54
52
  "@typescript-eslint/eslint-plugin": "^5.30.6",
55
53
  "eslint": "^8.19.0",
56
54
  "lint-staged": "^13.0.3",
57
55
  "ts-jest": "^28.0.6",
58
56
  "typescript": "^4.9.5"
59
57
  },
60
- "gitHead": "30d5525d885d6ab441718a95155c3ee79a2dcd2a"
58
+ "gitHead": "7ff4f04cb1a7b94dc500f4fdce188986d4064dbe"
61
59
  }