@midwayjs/oss 3.20.6 → 4.0.0-beta.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,12 +14,14 @@ 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() {
22
- await this.initClients(this.ossConfig);
22
+ await this.initClients(this.ossConfig, {
23
+ concurrent: true,
24
+ });
23
25
  }
24
26
  async createClient(config) {
25
27
  if (config['cluster'] && !config.clusters) {
@@ -42,6 +44,7 @@ let OSSServiceFactory = class OSSServiceFactory extends core_1.ServiceFactory {
42
44
  return 'oss';
43
45
  }
44
46
  };
47
+ exports.OSSServiceFactory = OSSServiceFactory;
45
48
  __decorate([
46
49
  (0, core_1.Config)('oss'),
47
50
  __metadata("design:type", Object)
@@ -52,20 +55,19 @@ __decorate([
52
55
  __metadata("design:paramtypes", []),
53
56
  __metadata("design:returntype", Promise)
54
57
  ], OSSServiceFactory.prototype, "init", null);
55
- OSSServiceFactory = __decorate([
58
+ exports.OSSServiceFactory = OSSServiceFactory = __decorate([
56
59
  (0, core_1.Provide)(),
57
60
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
58
61
  ], OSSServiceFactory);
59
- exports.OSSServiceFactory = OSSServiceFactory;
60
62
  let OSSService = class OSSService {
61
63
  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');
64
+ this.instance = this.serviceFactory.get(this.serviceFactory.getDefaultClientName?.() || 'default');
64
65
  if (!this.instance) {
65
66
  throw new core_1.MidwayCommonError('oss default instance not found.');
66
67
  }
67
68
  }
68
69
  };
70
+ exports.OSSService = OSSService;
69
71
  __decorate([
70
72
  (0, core_1.Inject)(),
71
73
  __metadata("design:type", OSSServiceFactory)
@@ -76,16 +78,14 @@ __decorate([
76
78
  __metadata("design:paramtypes", []),
77
79
  __metadata("design:returntype", Promise)
78
80
  ], OSSService.prototype, "init", null);
79
- OSSService = __decorate([
81
+ exports.OSSService = OSSService = __decorate([
80
82
  (0, core_1.Provide)(),
81
83
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
82
84
  ], OSSService);
83
- exports.OSSService = OSSService;
84
85
  (0, core_1.delegateTargetPrototypeMethod)(OSSService, [OSS]);
85
86
  let OSSSTSService = class OSSSTSService {
86
87
  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');
88
+ this.instance = this.serviceFactory.get(this.serviceFactory.getDefaultClientName?.() || 'default');
89
89
  if (!this.instance) {
90
90
  throw new core_1.MidwayCommonError('oss sts default instance not found.');
91
91
  }
@@ -94,6 +94,7 @@ let OSSSTSService = class OSSSTSService {
94
94
  return this.instance.assumeRole(roleArn, policy, expirationSeconds, session, options);
95
95
  }
96
96
  };
97
+ exports.OSSSTSService = OSSSTSService;
97
98
  __decorate([
98
99
  (0, core_1.Inject)(),
99
100
  __metadata("design:type", OSSServiceFactory)
@@ -104,9 +105,8 @@ __decorate([
104
105
  __metadata("design:paramtypes", []),
105
106
  __metadata("design:returntype", Promise)
106
107
  ], OSSSTSService.prototype, "init", null);
107
- OSSSTSService = __decorate([
108
+ exports.OSSSTSService = OSSSTSService = __decorate([
108
109
  (0, core_1.Provide)(),
109
110
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
110
111
  ], OSSSTSService);
111
- exports.OSSSTSService = OSSSTSService;
112
112
  //# 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.20.6",
4
+ "version": "4.0.0-beta.1",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -10,8 +10,8 @@
10
10
  "index.d.ts"
11
11
  ],
12
12
  "devDependencies": {
13
- "@midwayjs/core": "^3.20.4",
14
- "@midwayjs/mock": "^3.20.4",
13
+ "@midwayjs/core": "^4.0.0-beta.1",
14
+ "@midwayjs/mock": "^4.0.0-beta.1",
15
15
  "dotenv": "16.4.7"
16
16
  },
17
17
  "dependencies": {
@@ -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": "3bfa0c5d058250a16f4ef304c2c0d10dc060b95c"
41
+ "gitHead": "832961ec3aff123c033197d8c00cb2bc9bad7ff8"
42
42
  }