@adtrackify/at-service-common 1.0.4 → 1.0.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.
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const axiosHttpService: (config?: AxiosRequestConfig) => {
|
|
1
|
+
export declare const axiosHttpService: (config?: any) => {
|
|
3
2
|
instance: () => import("axios").AxiosInstance;
|
|
4
|
-
get: (url: string, config?:
|
|
3
|
+
get: (url: string, config?: any) => Promise<{
|
|
5
4
|
headers: any;
|
|
6
5
|
data: any;
|
|
7
6
|
status: any;
|
|
8
7
|
}>;
|
|
9
|
-
post: (url: string, data?: any, config?:
|
|
8
|
+
post: (url: string, data?: any, config?: any) => Promise<{
|
|
10
9
|
headers: any;
|
|
11
10
|
data: any;
|
|
12
11
|
status: any;
|
|
13
12
|
}>;
|
|
14
|
-
delete: (url: string, config?:
|
|
13
|
+
delete: (url: string, config?: any) => Promise<{
|
|
15
14
|
headers: any;
|
|
16
15
|
data: any;
|
|
17
16
|
status: any;
|
|
18
17
|
}>;
|
|
19
|
-
put: (url: string, data?: any, config?:
|
|
18
|
+
put: (url: string, data?: any, config?: any) => Promise<{
|
|
20
19
|
headers: any;
|
|
21
20
|
data: any;
|
|
22
21
|
status: any;
|
|
23
22
|
}>;
|
|
24
|
-
patch: (url: string, data?: any, config?:
|
|
23
|
+
patch: (url: string, data?: any, config?: any) => Promise<{
|
|
25
24
|
headers: any;
|
|
26
25
|
data: any;
|
|
27
26
|
status: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/clients/http-client.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/clients/http-client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAAqC;AACrC,kDAA0B;AAC1B,mEAAkD;AAElD,MAAM,YAAY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,CAAC,GAAW,EAAE,MAAY,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC;QACtG,IAAI,EAAE,CAAC,GAAW,EAAE,IAAU,EAAE,MAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC;QAC1H,MAAM,EAAE,CAAC,GAAW,EAAE,MAAY,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC;QAC5G,GAAG,EAAE,CAAC,GAAW,EAAE,IAAU,EAAE,MAAY,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC;QACxH,KAAK,EAAE,CAAC,GAAW,EAAE,IAAU,EAAE,MAAY,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC;QAC5H,UAAU,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,GAAG,GAAG,CAAC;KACrE,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,gBAAgB,oBAqB3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import axios
|
|
1
|
+
import axios from 'axios';
|
|
2
2
|
import axiosRetry from 'axios-retry';
|
|
3
|
-
import https from 'https'
|
|
3
|
+
import https from 'https';
|
|
4
4
|
import httpAdapter from 'axios/lib/adapters/http';
|
|
5
5
|
|
|
6
6
|
const httpResponse = (res: any = {}) => {
|
|
@@ -11,7 +11,7 @@ const httpResponse = (res: any = {}) => {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export const axiosHttpService = (config:
|
|
14
|
+
export const axiosHttpService = (config: any = {}) => {
|
|
15
15
|
config.adapter = httpAdapter;
|
|
16
16
|
config.httpsAgent = new https.Agent({ keepAlive: true });
|
|
17
17
|
const axiosService = axios.create(config);
|
|
@@ -25,12 +25,12 @@ export const axiosHttpService = (config: AxiosRequestConfig = {}) => {
|
|
|
25
25
|
|
|
26
26
|
return {
|
|
27
27
|
instance: () => axiosService,
|
|
28
|
-
get: (url: string, config?:
|
|
29
|
-
post: (url: string, data?: any, config?:
|
|
30
|
-
delete: (url: string, config?:
|
|
31
|
-
put: (url: string, data?: any, config?:
|
|
32
|
-
patch: (url: string, data?: any, config?:
|
|
28
|
+
get: (url: string, config?: any) => axiosService.get(url, config).then(httpResponse, handleAxiosError),
|
|
29
|
+
post: (url: string, data?: any, config?: any) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),
|
|
30
|
+
delete: (url: string, config?: any) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),
|
|
31
|
+
put: (url: string, data?: any, config?: any) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),
|
|
32
|
+
patch: (url: string, data?: any, config?: any) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),
|
|
33
33
|
setBaseUrl: (url: string) => !!(axiosService.defaults.baseURL = url)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
36
|
|