@midwayjs/oss 3.3.4 → 3.3.5
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interface.d.ts +19 -0
- package/dist/interface.js +3 -0
- package/dist/manager.d.ts +4 -3
- package/dist/manager.js +8 -2
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,4 +18,5 @@ exports.Configuration = void 0;
|
|
|
18
18
|
var configuration_1 = require("./configuration");
|
|
19
19
|
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.OSSConfiguration; } });
|
|
20
20
|
__exportStar(require("./manager"), exports);
|
|
21
|
+
__exportStar(require("./interface"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as OSS from 'ali-oss';
|
|
2
|
+
export declare type Without<T, U> = {
|
|
3
|
+
[P in Exclude<keyof T, keyof U>]?: never;
|
|
4
|
+
};
|
|
5
|
+
export declare type XOR<T, U> = (Without<T, U> & U) | (Without<U, T> & T);
|
|
6
|
+
export interface MWOSSOptions extends OSS.Options {
|
|
7
|
+
}
|
|
8
|
+
export interface MWOSSClusterOptions extends OSS.ClusterOptions {
|
|
9
|
+
clusters: (OSS.ClusterType & {
|
|
10
|
+
endpoint: string;
|
|
11
|
+
})[];
|
|
12
|
+
timeout?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MWOSSSTSOptions extends OSS.STSOptions {
|
|
15
|
+
sts: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare type OSSServiceFactoryReturnType = XOR<XOR<OSS, OSS.STS>, OSS.ClusterClient>;
|
|
18
|
+
export declare type OSSServiceFactoryCreateClientConfigType = XOR<XOR<MWOSSOptions, MWOSSClusterOptions>, MWOSSSTSOptions>;
|
|
19
|
+
//# sourceMappingURL=interface.d.ts.map
|
package/dist/manager.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as OSS from 'ali-oss';
|
|
2
2
|
import { ServiceFactory } from '@midwayjs/core';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { OSSServiceFactoryReturnType, OSSServiceFactoryCreateClientConfigType } from './interface';
|
|
4
|
+
export declare class OSSServiceFactory<T extends OSSServiceFactoryReturnType = OSSServiceFactoryReturnType> extends ServiceFactory<T> {
|
|
5
|
+
ossConfig: OSSServiceFactoryCreateClientConfigType;
|
|
5
6
|
init(): Promise<void>;
|
|
6
|
-
createClient(config:
|
|
7
|
+
createClient(config: OSSServiceFactoryCreateClientConfigType): Promise<T>;
|
|
7
8
|
getName(): string;
|
|
8
9
|
}
|
|
9
10
|
export declare class OSSService implements OSS {
|
package/dist/manager.js
CHANGED
|
@@ -23,14 +23,20 @@ let OSSServiceFactory = class OSSServiceFactory extends core_1.ServiceFactory {
|
|
|
23
23
|
await this.initClients(this.ossConfig);
|
|
24
24
|
}
|
|
25
25
|
async createClient(config) {
|
|
26
|
-
if (config.
|
|
27
|
-
config.cluster
|
|
26
|
+
if (config['cluster'] && !config.clusters) {
|
|
27
|
+
config.clusters = config['cluster'];
|
|
28
|
+
}
|
|
29
|
+
if (config.clusters) {
|
|
30
|
+
config.clusters.forEach(checkBucketConfig);
|
|
31
|
+
// @ts-expect-error because this code can return the correct type, but TS still reports an error
|
|
28
32
|
return new OSS.ClusterClient(config);
|
|
29
33
|
}
|
|
30
34
|
if (config.sts === true) {
|
|
35
|
+
// @ts-expect-error because this code can return the correct type, but TS still reports an error
|
|
31
36
|
return new OSS.STS(config);
|
|
32
37
|
}
|
|
33
38
|
checkBucketConfig(config);
|
|
39
|
+
// @ts-expect-error because this code can return the correct type, but TS still reports an error
|
|
34
40
|
return new OSS(config);
|
|
35
41
|
}
|
|
36
42
|
getName() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/oss",
|
|
3
3
|
"description": "midway oss component",
|
|
4
|
-
"version": "3.3.
|
|
4
|
+
"version": "3.3.5",
|
|
5
5
|
"main": "dist/index",
|
|
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.3.
|
|
13
|
+
"@midwayjs/core": "^3.3.5",
|
|
14
14
|
"@midwayjs/decorator": "^3.3.4",
|
|
15
|
-
"@midwayjs/mock": "^3.3.
|
|
15
|
+
"@midwayjs/mock": "^3.3.5",
|
|
16
16
|
"@types/ali-oss": "6.16.3",
|
|
17
17
|
"dotenv": "16.0.0"
|
|
18
18
|
},
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"type": "git",
|
|
40
40
|
"url": "https://github.com/midwayjs/midway.git"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "5a835008aaa26e1b3c7d99c525f4a9fdaa3e41d1"
|
|
43
43
|
}
|