@midwayjs/oss 3.0.0-beta.8 → 3.0.2
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/configuration.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/manager.js.map +1 -0
- package/package.json +11 -10
- package/CHANGELOG.md +0 -118
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAoD;AACpD,uCAA8C;AAgB9C,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAC3B,KAAK,CAAC,OAAO,CAAC,SAAS;QACrB,MAAM,SAAS,CAAC,QAAQ,CAAC,2BAAiB,CAAC,CAAC;IAC9C,CAAC;CACF,CAAA;AAJY,gBAAgB;IAd5B,IAAA,yBAAa,EAAC;QACb,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE;YACb;gBACE,OAAO,EAAE;oBACP,GAAG,EAAE;wBACH,OAAO,EAAE;4BACP,OAAO,EAAE,KAAK;yBACf;qBACF;iBACF;aACF;SACF;KACF,CAAC;GACW,gBAAgB,CAI5B;AAJY,4CAAgB","sourcesContent":["import { Configuration } from '@midwayjs/decorator';\nimport { OSSServiceFactory } from './manager';\n\n@Configuration({\n namespace: 'oss',\n importConfigs: [\n {\n default: {\n oss: {\n default: {\n timeout: '60s',\n },\n },\n },\n },\n ],\n})\nexport class OSSConfiguration {\n async onReady(container) {\n await container.getAsync(OSSServiceFactory);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iDAAoE;AAA3D,8GAAA,gBAAgB,OAAiB;AAC1C,4CAA0B","sourcesContent":["export { OSSConfiguration as Configuration } from './configuration';\nexport * from './manager';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,MAAa,UAAU;IAQrB,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CACF,CAAA;AATC;IADC,IAAA,kBAAM,GAAE;8BACe,iBAAiB;kDAAM;AAM/C;IADC,IAAA,gBAAI,GAAE;;;;sCAGN;AAVU,UAAU;IAFtB,IAAA,mBAAO,GAAE;IACT,IAAA,iBAAK,EAAC,qBAAS,CAAC,SAAS,CAAC;GACd,UAAU,CAWtB;AAXY,gCAAU;AAkBvB,IAAA,oCAA6B,EAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAIjD,IAAa,aAAa,GAA1B,MAAa,aAAa;IAOxB,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,UAAU,CACd,OAAe,EACf,MAAyC,EACzC,iBAA0B,EAC1B,OAAgB,EAChB,OAAuC;QAEvC,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAC7B,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;CACF,CAAA;AAxBC;IADC,IAAA,kBAAM,GAAE;8BACe,iBAAiB;qDAAU;AAKnD;IADC,IAAA,gBAAI,GAAE;;;;yCAGN;AATU,aAAa;IAFzB,IAAA,mBAAO,GAAE;IACT,IAAA,iBAAK,EAAC,qBAAS,CAAC,SAAS,CAAC;GACd,aAAa,CA0BzB;AA1BY,sCAAa","sourcesContent":["import {\n Config,\n Init,\n Inject,\n Provide,\n Scope,\n ScopeEnum,\n} from '@midwayjs/decorator';\nimport * as OSS from 'ali-oss';\nimport * as assert from 'assert';\nimport { ServiceFactory, delegateTargetPrototypeMethod } from '@midwayjs/core';\n\nfunction checkBucketConfig(config) {\n assert(\n config.endpoint || config.region,\n \"[@midwayjs/oss] Must set `endpoint` or `region` in oss's config\"\n );\n assert(\n config.accessKeySecret && config.accessKeyId,\n \"[@midwayjs/oss] Must set `accessKeyId` and `accessKeySecret` in oss's config\"\n );\n}\n\n@Provide()\n@Scope(ScopeEnum.Singleton)\nexport class OSSServiceFactory<T = OSS> extends ServiceFactory<T> {\n @Config('oss')\n ossConfig;\n\n @Init()\n async init() {\n await this.initClients(this.ossConfig);\n }\n\n async createClient(config): Promise<T> {\n if (config.cluster) {\n config.cluster.forEach(checkBucketConfig);\n return new (OSS as any).ClusterClient(config);\n }\n\n if (config.sts === true) {\n return new OSS.STS(config) as any;\n }\n\n checkBucketConfig(config);\n return new OSS(config) as any;\n }\n\n getName() {\n return 'oss';\n }\n}\n\n@Provide()\n@Scope(ScopeEnum.Singleton)\nexport class OSSService implements OSS {\n @Inject()\n private serviceFactory: OSSServiceFactory<OSS>;\n\n // @ts-expect-error used\n private instance: OSS;\n\n @Init()\n async init() {\n this.instance = this.serviceFactory.get('default');\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OSSService extends OSS {\n // empty\n}\n\ndelegateTargetPrototypeMethod(OSSService, [OSS]);\n\n@Provide()\n@Scope(ScopeEnum.Singleton)\nexport class OSSSTSService implements OSS.STS {\n @Inject()\n private serviceFactory: OSSServiceFactory<OSS.STS>;\n\n private instance: OSS.STS;\n\n @Init()\n async init() {\n this.instance = this.serviceFactory.get('default');\n }\n\n async assumeRole(\n roleArn: string,\n policy?: Record<string, unknown> | string,\n expirationSeconds?: number,\n session?: string,\n options?: { timeout: number; ctx: any }\n ): Promise<{ credentials: OSS.Credentials }> {\n return this.instance.assumeRole(\n roleArn,\n policy,\n expirationSeconds,\n session,\n options\n );\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/oss",
|
|
3
3
|
"description": "midway oss component",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist/**/*.js",
|
|
9
9
|
"dist/**/*.d.ts",
|
|
10
|
-
"index.d.ts"
|
|
10
|
+
"index.d.ts",
|
|
11
|
+
"dist/**/*.js.map"
|
|
11
12
|
],
|
|
12
13
|
"devDependencies": {
|
|
13
|
-
"@midwayjs/core": "^3.0.
|
|
14
|
-
"@midwayjs/decorator": "^3.0.
|
|
15
|
-
"@midwayjs/mock": "^3.0.
|
|
16
|
-
"@types/ali-oss": "
|
|
17
|
-
"dotenv": "
|
|
14
|
+
"@midwayjs/core": "^3.0.2",
|
|
15
|
+
"@midwayjs/decorator": "^3.0.2",
|
|
16
|
+
"@midwayjs/mock": "^3.0.2",
|
|
17
|
+
"@types/ali-oss": "6.16.2",
|
|
18
|
+
"dotenv": "14.2.0"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"ali-oss": "^6.16.0"
|
|
@@ -27,8 +28,8 @@
|
|
|
27
28
|
"license": "MIT",
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build": "tsc",
|
|
30
|
-
"test": "node --require=ts-node/register ../../node_modules/.bin/jest",
|
|
31
|
-
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --coverage --forceExit",
|
|
31
|
+
"test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
|
|
32
|
+
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit",
|
|
32
33
|
"ci": "npm run test",
|
|
33
34
|
"lint": "mwts check"
|
|
34
35
|
},
|
|
@@ -39,5 +40,5 @@
|
|
|
39
40
|
"type": "git",
|
|
40
41
|
"url": "https://github.com/midwayjs/midway.git"
|
|
41
42
|
},
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ca77247d229978a736e79bb208579c014ed226fc"
|
|
43
44
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* express routing middleware takes effect at the controller level ([#1364](https://github.com/midwayjs/midway/issues/1364)) ([b9272e0](https://github.com/midwayjs/midway/commit/b9272e0971003443304b0c53815be31a0061b4bd))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
|
|
18
|
-
|
|
19
|
-
**Note:** Version bump only for package @midwayjs/oss
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
|
|
26
|
-
|
|
27
|
-
**Note:** Version bump only for package @midwayjs/oss
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @midwayjs/oss
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
|
|
42
|
-
|
|
43
|
-
**Note:** Version bump only for package @midwayjs/oss
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
### Features
|
|
53
|
-
|
|
54
|
-
* add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
|
|
61
|
-
|
|
62
|
-
**Note:** Version bump only for package @midwayjs/oss
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
# [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
### Bug Fixes
|
|
72
|
-
|
|
73
|
-
* serverless local dev bodyparser limit ([#1245](https://github.com/midwayjs/midway/issues/1245)) ([6bdf378](https://github.com/midwayjs/midway/commit/6bdf37841260b1f77e20d913ee85a45ae41ca559))
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### Features
|
|
77
|
-
|
|
78
|
-
* add cos component ([#1271](https://github.com/midwayjs/midway/issues/1271)) ([c18e597](https://github.com/midwayjs/midway/commit/c18e597d55a6452188cc7daecd0062bf161028cc))
|
|
79
|
-
* add ctx.throw for serverless app ([#1262](https://github.com/midwayjs/midway/issues/1262)) ([70008b3](https://github.com/midwayjs/midway/commit/70008b32157286708ec01390b0bf8233ba5a84dd))
|
|
80
|
-
* add redis component ([#1270](https://github.com/midwayjs/midway/issues/1270)) ([09c993a](https://github.com/midwayjs/midway/commit/09c993ac308d26fa9c742a659471c3f4cf5c5782))
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### Features
|
|
90
|
-
|
|
91
|
-
* support object config load and async config ([#1212](https://github.com/midwayjs/midway/issues/1212)) ([a035ccb](https://github.com/midwayjs/midway/commit/a035ccbb513b0ba423bd2b48bc228b5e916c89e8))
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
## [2.12.1](https://github.com/midwayjs/midway/compare/v2.12.0...v2.12.1) (2021-08-01)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### Bug Fixes
|
|
101
|
-
|
|
102
|
-
* server hostname args ([#1196](https://github.com/midwayjs/midway/issues/1196)) ([b9d73f0](https://github.com/midwayjs/midway/commit/b9d73f036befd13c1db28f967fb769459237c52e))
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### Features
|
|
106
|
-
|
|
107
|
-
* add http client component ([#1098](https://github.com/midwayjs/midway/issues/1098)) ([4e2f90a](https://github.com/midwayjs/midway/commit/4e2f90a9de946fa5abc2af4cd8a0ad9ee4188991))
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
# [2.12.0](https://github.com/midwayjs/midway/compare/v2.11.7...v2.12.0) (2021-07-30)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Features
|
|
117
|
-
|
|
118
|
-
* add oss component ([#1181](https://github.com/midwayjs/midway/issues/1181)) ([e83171c](https://github.com/midwayjs/midway/commit/e83171c73cdc1098796f06919dc652a6d83c3af4))
|