@midwayjs/oss 3.19.0 → 4.0.0-alpha.1

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.
@@ -14,7 +14,8 @@ let OSSConfiguration = class OSSConfiguration {
14
14
  await container.getAsync(manager_1.OSSServiceFactory);
15
15
  }
16
16
  };
17
- OSSConfiguration = __decorate([
17
+ exports.OSSConfiguration = OSSConfiguration;
18
+ exports.OSSConfiguration = OSSConfiguration = __decorate([
18
19
  (0, core_1.Configuration)({
19
20
  namespace: 'oss',
20
21
  importConfigs: [
@@ -30,5 +31,4 @@ OSSConfiguration = __decorate([
30
31
  ],
31
32
  })
32
33
  ], OSSConfiguration);
33
- exports.OSSConfiguration = OSSConfiguration;
34
34
  //# sourceMappingURL=configuration.js.map
package/dist/manager.js CHANGED
@@ -14,8 +14,8 @@ const core_1 = require("@midwayjs/core");
14
14
  const OSS = require("ali-oss");
15
15
  const assert = require("assert");
16
16
  function checkBucketConfig(config) {
17
- assert(config.endpoint || config.region, "[midway:oss] Must set `endpoint` or `region` in oss's config");
18
- assert(config.accessKeySecret && config.accessKeyId, "[midway:oss] Must set `accessKeyId` and `accessKeySecret` in oss's config");
17
+ assert.ok(config.endpoint || config.region, "[midway:oss] Must set `endpoint` or `region` in oss's config");
18
+ assert.ok(config.accessKeySecret && config.accessKeyId, "[midway:oss] Must set `accessKeyId` and `accessKeySecret` in oss's config");
19
19
  }
20
20
  let OSSServiceFactory = class OSSServiceFactory extends core_1.ServiceFactory {
21
21
  async init() {
@@ -42,6 +42,7 @@ let OSSServiceFactory = class OSSServiceFactory extends core_1.ServiceFactory {
42
42
  return 'oss';
43
43
  }
44
44
  };
45
+ exports.OSSServiceFactory = OSSServiceFactory;
45
46
  __decorate([
46
47
  (0, core_1.Config)('oss'),
47
48
  __metadata("design:type", Object)
@@ -52,20 +53,19 @@ __decorate([
52
53
  __metadata("design:paramtypes", []),
53
54
  __metadata("design:returntype", Promise)
54
55
  ], OSSServiceFactory.prototype, "init", null);
55
- OSSServiceFactory = __decorate([
56
+ exports.OSSServiceFactory = OSSServiceFactory = __decorate([
56
57
  (0, core_1.Provide)(),
57
58
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
58
59
  ], OSSServiceFactory);
59
- exports.OSSServiceFactory = OSSServiceFactory;
60
60
  let OSSService = class OSSService {
61
61
  async init() {
62
- var _a, _b;
63
- this.instance = this.serviceFactory.get(((_b = (_a = this.serviceFactory).getDefaultClientName) === null || _b === void 0 ? void 0 : _b.call(_a)) || 'default');
62
+ this.instance = this.serviceFactory.get(this.serviceFactory.getDefaultClientName?.() || 'default');
64
63
  if (!this.instance) {
65
64
  throw new core_1.MidwayCommonError('oss default instance not found.');
66
65
  }
67
66
  }
68
67
  };
68
+ exports.OSSService = OSSService;
69
69
  __decorate([
70
70
  (0, core_1.Inject)(),
71
71
  __metadata("design:type", OSSServiceFactory)
@@ -76,16 +76,14 @@ __decorate([
76
76
  __metadata("design:paramtypes", []),
77
77
  __metadata("design:returntype", Promise)
78
78
  ], OSSService.prototype, "init", null);
79
- OSSService = __decorate([
79
+ exports.OSSService = OSSService = __decorate([
80
80
  (0, core_1.Provide)(),
81
81
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
82
82
  ], OSSService);
83
- exports.OSSService = OSSService;
84
83
  (0, core_1.delegateTargetPrototypeMethod)(OSSService, [OSS]);
85
84
  let OSSSTSService = class OSSSTSService {
86
85
  async init() {
87
- var _a, _b;
88
- this.instance = this.serviceFactory.get(((_b = (_a = this.serviceFactory).getDefaultClientName) === null || _b === void 0 ? void 0 : _b.call(_a)) || 'default');
86
+ this.instance = this.serviceFactory.get(this.serviceFactory.getDefaultClientName?.() || 'default');
89
87
  if (!this.instance) {
90
88
  throw new core_1.MidwayCommonError('oss sts default instance not found.');
91
89
  }
@@ -94,6 +92,7 @@ let OSSSTSService = class OSSSTSService {
94
92
  return this.instance.assumeRole(roleArn, policy, expirationSeconds, session, options);
95
93
  }
96
94
  };
95
+ exports.OSSSTSService = OSSSTSService;
97
96
  __decorate([
98
97
  (0, core_1.Inject)(),
99
98
  __metadata("design:type", OSSServiceFactory)
@@ -104,9 +103,8 @@ __decorate([
104
103
  __metadata("design:paramtypes", []),
105
104
  __metadata("design:returntype", Promise)
106
105
  ], OSSSTSService.prototype, "init", null);
107
- OSSSTSService = __decorate([
106
+ exports.OSSSTSService = OSSSTSService = __decorate([
108
107
  (0, core_1.Provide)(),
109
108
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
110
109
  ], OSSSTSService);
111
- exports.OSSSTSService = OSSSTSService;
112
110
  //# sourceMappingURL=manager.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midwayjs/oss",
3
3
  "description": "midway oss component",
4
- "version": "3.19.0",
4
+ "version": "4.0.0-alpha.1",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -10,9 +10,9 @@
10
10
  "index.d.ts"
11
11
  ],
12
12
  "devDependencies": {
13
- "@midwayjs/core": "^3.19.0",
14
- "@midwayjs/mock": "^3.19.0",
15
- "dotenv": "16.4.5"
13
+ "@midwayjs/core": "^4.0.0-alpha.1",
14
+ "@midwayjs/mock": "^4.0.0-alpha.1",
15
+ "dotenv": "16.4.7"
16
16
  },
17
17
  "dependencies": {
18
18
  "@types/ali-oss": "6.16.11",
@@ -26,8 +26,8 @@
26
26
  "license": "MIT",
27
27
  "scripts": {
28
28
  "build": "tsc",
29
- "test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
30
- "cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit",
29
+ "test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
30
+ "cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
31
31
  "ci": "npm run test",
32
32
  "lint": "mwts check"
33
33
  },
@@ -38,5 +38,5 @@
38
38
  "type": "git",
39
39
  "url": "https://github.com/midwayjs/midway.git"
40
40
  },
41
- "gitHead": "437e92d9375b0e375f83aa363f3e6a60187c7109"
41
+ "gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
42
42
  }