@midwayjs/axios 3.20.4 → 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.
- package/dist/configuration.js +2 -2
- package/dist/http-service.d.ts +4 -2
- package/dist/http-service.factory.js +4 -4
- package/dist/http-service.js +2 -2
- package/dist/index.d.ts +2 -7
- package/dist/index.js +3 -4
- package/package.json +6 -6
package/dist/configuration.js
CHANGED
|
@@ -15,7 +15,8 @@ let AxiosConfiguration = class AxiosConfiguration {
|
|
|
15
15
|
await container.getAsync(http_service_factory_1.HttpServiceFactory);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
AxiosConfiguration =
|
|
18
|
+
exports.AxiosConfiguration = AxiosConfiguration;
|
|
19
|
+
exports.AxiosConfiguration = AxiosConfiguration = __decorate([
|
|
19
20
|
(0, core_1.Configuration)({
|
|
20
21
|
namespace: 'axios',
|
|
21
22
|
importConfigs: [
|
|
@@ -43,5 +44,4 @@ AxiosConfiguration = __decorate([
|
|
|
43
44
|
},
|
|
44
45
|
})
|
|
45
46
|
], AxiosConfiguration);
|
|
46
|
-
exports.AxiosConfiguration = AxiosConfiguration;
|
|
47
47
|
//# sourceMappingURL=configuration.js.map
|
package/dist/http-service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { AxiosRequestConfig, AxiosResponse } from './interface';
|
|
3
|
-
export declare class HttpService
|
|
3
|
+
export declare class HttpService {
|
|
4
4
|
private instance;
|
|
5
5
|
private serviceFactory;
|
|
6
6
|
protected init(): Promise<void>;
|
|
@@ -26,4 +26,6 @@ export declare class HttpService implements Axios {
|
|
|
26
26
|
putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
27
27
|
patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
28
28
|
}
|
|
29
|
+
export interface HttpService extends AxiosInstance {
|
|
30
|
+
}
|
|
29
31
|
//# sourceMappingURL=http-service.d.ts.map
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.HttpServiceFactory = void 0;
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
|
-
const
|
|
14
|
+
const axios = require("axios");
|
|
15
15
|
let HttpServiceFactory = class HttpServiceFactory extends core_1.ServiceFactory {
|
|
16
16
|
async init() {
|
|
17
17
|
let axiosConfig = this.axiosConfig;
|
|
@@ -29,9 +29,10 @@ let HttpServiceFactory = class HttpServiceFactory extends core_1.ServiceFactory
|
|
|
29
29
|
return 'axios';
|
|
30
30
|
}
|
|
31
31
|
async createClient(config, clientName) {
|
|
32
|
-
return
|
|
32
|
+
return axios.create(config);
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
+
exports.HttpServiceFactory = HttpServiceFactory;
|
|
35
36
|
__decorate([
|
|
36
37
|
(0, core_1.Config)('axios'),
|
|
37
38
|
__metadata("design:type", Object)
|
|
@@ -42,9 +43,8 @@ __decorate([
|
|
|
42
43
|
__metadata("design:paramtypes", []),
|
|
43
44
|
__metadata("design:returntype", Promise)
|
|
44
45
|
], HttpServiceFactory.prototype, "init", null);
|
|
45
|
-
HttpServiceFactory = __decorate([
|
|
46
|
+
exports.HttpServiceFactory = HttpServiceFactory = __decorate([
|
|
46
47
|
(0, core_1.Provide)(),
|
|
47
48
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
48
49
|
], HttpServiceFactory);
|
|
49
|
-
exports.HttpServiceFactory = HttpServiceFactory;
|
|
50
50
|
//# sourceMappingURL=http-service.factory.js.map
|
package/dist/http-service.js
CHANGED
|
@@ -63,6 +63,7 @@ let HttpService = class HttpService {
|
|
|
63
63
|
return this.instance.patchForm(url, data, config);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
+
exports.HttpService = HttpService;
|
|
66
67
|
__decorate([
|
|
67
68
|
(0, core_1.Inject)(),
|
|
68
69
|
__metadata("design:type", http_service_factory_1.HttpServiceFactory)
|
|
@@ -73,9 +74,8 @@ __decorate([
|
|
|
73
74
|
__metadata("design:paramtypes", []),
|
|
74
75
|
__metadata("design:returntype", Promise)
|
|
75
76
|
], HttpService.prototype, "init", null);
|
|
76
|
-
HttpService = __decorate([
|
|
77
|
+
exports.HttpService = HttpService = __decorate([
|
|
77
78
|
(0, core_1.Provide)(),
|
|
78
79
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
79
80
|
], HttpService);
|
|
80
|
-
exports.HttpService = HttpService;
|
|
81
81
|
//# sourceMappingURL=http-service.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import * as Axios from 'axios';
|
|
1
|
+
declare const Axios: any;
|
|
3
2
|
export { AxiosConfiguration as Configuration } from './configuration';
|
|
4
3
|
export * from './http-service.factory';
|
|
5
4
|
export * from './http-service';
|
|
6
5
|
export * from './interface';
|
|
7
|
-
export {
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use `Axios` directly
|
|
10
|
-
*/
|
|
11
|
-
axios, Axios, };
|
|
6
|
+
export { Axios };
|
|
12
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,10 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Axios = exports.
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const Axios = require("axios");
|
|
17
|
+
exports.Axios = exports.Configuration = void 0;
|
|
18
|
+
const axios = require("axios");
|
|
19
|
+
const Axios = axios['default'];
|
|
21
20
|
exports.Axios = Axios;
|
|
22
21
|
var configuration_1 = require("./configuration");
|
|
23
22
|
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.AxiosConfiguration; } });
|
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": "
|
|
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": "^
|
|
14
|
-
"@midwayjs/mock": "^
|
|
13
|
+
"@midwayjs/core": "^4.0.0-beta.1",
|
|
14
|
+
"@midwayjs/mock": "^4.0.0-beta.1",
|
|
15
15
|
"nock": "13.5.6"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc",
|
|
28
|
-
"test": "node
|
|
29
|
-
"cov": "node
|
|
28
|
+
"test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
|
|
29
|
+
"cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
|
|
30
30
|
"ci": "npm run test",
|
|
31
31
|
"lint": "mwts check"
|
|
32
32
|
},
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/midwayjs/midway.git"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "832961ec3aff123c033197d8c00cb2bc9bad7ff8"
|
|
41
41
|
}
|