@midwayjs/axios 3.11.12 → 3.11.16
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/interface.d.ts +15 -9
- package/dist/interface.js +3 -0
- package/dist/serviceManager.d.ts +20 -13
- package/dist/serviceManager.js +14 -2
- package/package.json +5 -5
package/dist/interface.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse, AxiosInterceptorManager } from 'axios';
|
|
1
|
+
import type { AxiosRequestConfig, AxiosResponse, AxiosInterceptorManager, AxiosDefaults } from 'axios';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
export { axios };
|
|
2
4
|
export interface AxiosHttpService {
|
|
5
|
+
defaults: AxiosDefaults;
|
|
3
6
|
interceptors: {
|
|
4
7
|
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
|
5
8
|
response: AxiosInterceptorManager<AxiosResponse>;
|
|
6
9
|
};
|
|
7
10
|
getUri(config?: AxiosRequestConfig): string;
|
|
8
|
-
request<T = any, R = AxiosResponse<T
|
|
9
|
-
get<T = any, R = AxiosResponse<T
|
|
10
|
-
delete<T = any, R = AxiosResponse<T
|
|
11
|
-
head<T = any, R = AxiosResponse<T
|
|
12
|
-
options<T = any, R = AxiosResponse<T
|
|
13
|
-
post<T = any, R = AxiosResponse<T
|
|
14
|
-
put<T = any, R = AxiosResponse<T
|
|
15
|
-
patch<T = any, R = AxiosResponse<T
|
|
11
|
+
request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
|
12
|
+
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
13
|
+
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
14
|
+
head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
15
|
+
options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
16
|
+
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
17
|
+
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
18
|
+
patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
19
|
+
postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
20
|
+
putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
21
|
+
patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
16
22
|
}
|
|
17
23
|
//# sourceMappingURL=interface.d.ts.map
|
package/dist/interface.js
CHANGED
package/dist/serviceManager.d.ts
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
import * as axios from 'axios';
|
|
1
|
+
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from 'axios';
|
|
3
2
|
import { ServiceFactory } from '@midwayjs/core';
|
|
4
3
|
import { AxiosHttpService } from './interface';
|
|
5
4
|
export declare class HttpServiceFactory extends ServiceFactory<AxiosInstance> {
|
|
6
5
|
axiosConfig: any;
|
|
7
6
|
init(): Promise<void>;
|
|
8
|
-
protected createClient(config:
|
|
7
|
+
protected createClient(config: CreateAxiosDefaults, clientName: any): Promise<AxiosInstance>;
|
|
9
8
|
getName(): string;
|
|
10
9
|
}
|
|
11
10
|
export declare class HttpService implements AxiosHttpService {
|
|
12
11
|
private instance;
|
|
13
12
|
private serviceFactory;
|
|
13
|
+
get defaults(): Omit<import("axios").AxiosDefaults<any>, "headers"> & {
|
|
14
|
+
headers: import("axios").HeadersDefaults & {
|
|
15
|
+
[key: string]: import("axios").AxiosHeaderValue;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
14
18
|
get interceptors(): {
|
|
15
|
-
request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig<any>>;
|
|
16
|
-
response: axios.AxiosInterceptorManager<AxiosResponse<any, any>>;
|
|
19
|
+
request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig<any>>;
|
|
20
|
+
response: import("axios").AxiosInterceptorManager<AxiosResponse<any, any>>;
|
|
17
21
|
};
|
|
18
22
|
protected init(): Promise<void>;
|
|
19
23
|
getUri(config?: AxiosRequestConfig): string;
|
|
20
|
-
request<T = any, R = AxiosResponse<T
|
|
21
|
-
get<T = any, R = AxiosResponse<T
|
|
22
|
-
delete<T = any, R = AxiosResponse<T
|
|
23
|
-
head<T = any, R = AxiosResponse<T
|
|
24
|
-
options<T = any, R = AxiosResponse<T
|
|
25
|
-
post<T = any, R = AxiosResponse<T
|
|
26
|
-
put<T = any, R = AxiosResponse<T
|
|
27
|
-
patch<T = any, R = AxiosResponse<T
|
|
24
|
+
request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
|
25
|
+
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
26
|
+
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
27
|
+
head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
28
|
+
options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
29
|
+
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
30
|
+
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
31
|
+
patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
32
|
+
postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
33
|
+
putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
34
|
+
patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
28
35
|
}
|
|
29
36
|
//# sourceMappingURL=serviceManager.d.ts.map
|
package/dist/serviceManager.js
CHANGED
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.HttpService = exports.HttpServiceFactory = void 0;
|
|
13
|
-
const
|
|
13
|
+
const axios_1 = require("axios");
|
|
14
14
|
const core_1 = require("@midwayjs/core");
|
|
15
15
|
let HttpServiceFactory = class HttpServiceFactory extends core_1.ServiceFactory {
|
|
16
16
|
async init() {
|
|
@@ -26,7 +26,7 @@ let HttpServiceFactory = class HttpServiceFactory extends core_1.ServiceFactory
|
|
|
26
26
|
await this.initClients(axiosConfig);
|
|
27
27
|
}
|
|
28
28
|
async createClient(config, clientName) {
|
|
29
|
-
return
|
|
29
|
+
return axios_1.default.create(config);
|
|
30
30
|
}
|
|
31
31
|
getName() {
|
|
32
32
|
return 'axios';
|
|
@@ -48,6 +48,9 @@ HttpServiceFactory = __decorate([
|
|
|
48
48
|
], HttpServiceFactory);
|
|
49
49
|
exports.HttpServiceFactory = HttpServiceFactory;
|
|
50
50
|
let HttpService = class HttpService {
|
|
51
|
+
get defaults() {
|
|
52
|
+
return this.instance.defaults;
|
|
53
|
+
}
|
|
51
54
|
get interceptors() {
|
|
52
55
|
return this.instance.interceptors;
|
|
53
56
|
}
|
|
@@ -85,6 +88,15 @@ let HttpService = class HttpService {
|
|
|
85
88
|
patch(url, data, config) {
|
|
86
89
|
return this.instance.patch(url, data, config);
|
|
87
90
|
}
|
|
91
|
+
postForm(url, data, config) {
|
|
92
|
+
return this.instance.postForm(url, data, config);
|
|
93
|
+
}
|
|
94
|
+
putForm(url, data, config) {
|
|
95
|
+
return this.instance.putForm(url, data, config);
|
|
96
|
+
}
|
|
97
|
+
patchForm(url, data, config) {
|
|
98
|
+
return this.instance.patchForm(url, data, config);
|
|
99
|
+
}
|
|
88
100
|
};
|
|
89
101
|
__decorate([
|
|
90
102
|
(0, core_1.Inject)(),
|
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.11.
|
|
4
|
+
"version": "3.11.16",
|
|
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.11.
|
|
14
|
-
"@midwayjs/mock": "^3.11.
|
|
15
|
-
"nock": "13.3.
|
|
13
|
+
"@midwayjs/core": "^3.11.15",
|
|
14
|
+
"@midwayjs/mock": "^3.11.15",
|
|
15
|
+
"nock": "13.3.2"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"axios": "1.4.0"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/midwayjs/midway.git"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "ae8b35ec53d10f9c3b19bb74a9f0b235dcf5b030"
|
|
41
41
|
}
|