@midwayjs/axios 3.4.11 → 3.5.0
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 +19 -0
- package/dist/serviceManager.d.ts +1 -1
- package/dist/serviceManager.js +3 -0
- package/package.json +4 -4
package/dist/configuration.js
CHANGED
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AxiosConfiguration = void 0;
|
|
10
|
+
// import { MidwayConfigMissingError } from '@midwayjs/core';
|
|
10
11
|
const decorator_1 = require("@midwayjs/decorator");
|
|
11
12
|
const serviceManager_1 = require("./serviceManager");
|
|
12
13
|
let AxiosConfiguration = class AxiosConfiguration {
|
|
@@ -24,6 +25,24 @@ AxiosConfiguration = __decorate([
|
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
27
|
],
|
|
28
|
+
importConfigFilter: config => {
|
|
29
|
+
if (config['axios']) {
|
|
30
|
+
// 解决循环引用
|
|
31
|
+
if (config['axios']['clients'] || config['axios']['default']) {
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
// 兼容older
|
|
35
|
+
if (!config['axios']['clients'] || !config['axios']['client']) {
|
|
36
|
+
config['axios'] = {
|
|
37
|
+
default: {},
|
|
38
|
+
clients: {
|
|
39
|
+
default: config['axios'],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return config;
|
|
45
|
+
},
|
|
27
46
|
})
|
|
28
47
|
], AxiosConfiguration);
|
|
29
48
|
exports.AxiosConfiguration = AxiosConfiguration;
|
package/dist/serviceManager.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AxiosHttpService } from './interface';
|
|
|
4
4
|
export declare class HttpServiceFactory extends ServiceFactory<AxiosInstance> {
|
|
5
5
|
axiosConfig: any;
|
|
6
6
|
init(): Promise<void>;
|
|
7
|
-
protected createClient(config:
|
|
7
|
+
protected createClient(config: AxiosRequestConfig, clientName: any): Promise<AxiosInstance>;
|
|
8
8
|
getName(): string;
|
|
9
9
|
}
|
|
10
10
|
export declare class HttpService implements AxiosHttpService {
|
package/dist/serviceManager.js
CHANGED
|
@@ -54,6 +54,9 @@ let HttpService = class HttpService {
|
|
|
54
54
|
}
|
|
55
55
|
async init() {
|
|
56
56
|
this.instance = this.serviceFactory.get('default');
|
|
57
|
+
if (!this.instance) {
|
|
58
|
+
throw new core_1.MidwayCommonError('axios default instance not found.');
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
getUri(config) {
|
|
59
62
|
return this.instance.getUri(config);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/axios",
|
|
3
3
|
"description": "midway http client with axios",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
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.
|
|
13
|
+
"@midwayjs/core": "^3.5.0",
|
|
14
14
|
"@midwayjs/decorator": "^3.4.11",
|
|
15
|
-
"@midwayjs/mock": "^3.
|
|
15
|
+
"@midwayjs/mock": "^3.5.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"axios": "0.27.2"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/midwayjs/midway.git"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "4200e30d1af97a7817c36899c4ffc41a7d97c06d"
|
|
41
41
|
}
|