abbot-http-client 0.0.53 → 0.0.55

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.cjs CHANGED
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
22
  // If the importer is in node compatibility mode or this is not an ESM
22
23
  // file that has been converted to a CommonJS file using a Babel-
@@ -32,7 +33,7 @@ var index_exports = {};
32
33
  __export(index_exports, {
33
34
  AbbotHttp: () => AbbotHttp,
34
35
  AppError: () => AppError,
35
- Axios: () => Axios,
36
+ AxiosBase: () => AxiosBase,
36
37
  Cryp: () => Cryp,
37
38
  ES: () => ES,
38
39
  RestError: () => RestError,
@@ -68,8 +69,7 @@ var defaultConfig = {
68
69
  trackingId: "",
69
70
  userJwt: null
70
71
  },
71
- devMode: false,
72
- keepAlive: false
72
+ devMode: false
73
73
  };
74
74
 
75
75
  // src/utilities.ts
@@ -86,8 +86,6 @@ function deepMerge(target, source) {
86
86
  }
87
87
 
88
88
  // src/config/axiosFn.ts
89
- var import_http = __toESM(require("http"), 1);
90
- var import_https = __toESM(require("https"), 1);
91
89
  function axiosConf(cfg) {
92
90
  return import_axios.default.create({
93
91
  baseURL: cfg.axios?.baseUrl,
@@ -101,12 +99,10 @@ function axiosConf(cfg) {
101
99
  }
102
100
  },
103
101
  timeout: cfg.axios?.timeout,
104
- withCredentials: true,
105
- httpAgent: cfg.keepAlive ? new import_http.default.Agent({ keepAlive: true }) : null,
106
- httpsAgent: cfg.keepAlive ? new import_https.default.Agent({ keepAlive: true, timeout: 6e4 }) : null
102
+ withCredentials: true
107
103
  });
108
104
  }
109
- var Axios = class {
105
+ var AxiosBase = class {
110
106
  config = defaultConfig;
111
107
  constructor(config) {
112
108
  this.config = deepMerge(this.config, config);
@@ -247,7 +243,7 @@ ${(0, import_console_log_colors.blue)("res:")} ${res ? JSON.stringify(res) : "no
247
243
  };
248
244
 
249
245
  // src/http/core.ts
250
- var AbbotHttp = class extends Axios {
246
+ var AbbotHttp = class extends AxiosBase {
251
247
  constructor(config) {
252
248
  super(config);
253
249
  }
@@ -531,14 +527,17 @@ var RestError = class extends Error {
531
527
 
532
528
  // src/core.ts
533
529
  function create(config) {
534
- const http2 = new AbbotHttp(config);
535
- return http2;
530
+ const http = new AbbotHttp(config);
531
+ return http;
536
532
  }
533
+
534
+ // src/index.ts
535
+ __reExport(index_exports, require("axios"), module.exports);
537
536
  // Annotate the CommonJS export names for ESM import in node:
538
537
  0 && (module.exports = {
539
538
  AbbotHttp,
540
539
  AppError,
541
- Axios,
540
+ AxiosBase,
542
541
  Cryp,
543
542
  ES,
544
543
  RestError,
@@ -546,5 +545,6 @@ function create(config) {
546
545
  catchError,
547
546
  create,
548
547
  deepMerge,
549
- defaultConfig
548
+ defaultConfig,
549
+ ...require("axios")
550
550
  });
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ResponseType, AxiosInstance, AxiosResponse, AxiosError } from 'axios';
2
+ export * from 'axios';
2
3
 
3
4
  interface AbbotConfig {
4
5
  axios: {
@@ -21,7 +22,6 @@ interface AbbotConfig {
21
22
  userJwt: string | null;
22
23
  };
23
24
  devMode: boolean;
24
- keepAlive: boolean;
25
25
  }
26
26
  declare const defaultConfig: AbbotConfig;
27
27
 
@@ -88,7 +88,7 @@ interface HttpInstance extends AxiosInstance {
88
88
  cryp: Cryp;
89
89
  log: AbbLog;
90
90
  }
91
- declare class AbbotHttp extends Axios {
91
+ declare class AbbotHttp extends AxiosBase {
92
92
  constructor(config: DeepPartial<AbbotConfig>);
93
93
  getConfig(): AbbotConfig;
94
94
  private createAxiosInstance;
@@ -107,7 +107,7 @@ declare class AbbotHttp extends Axios {
107
107
  uploadFile<T>(url: string, file: File[], fileKeys: string[], param?: Record<string, any> | null, option?: Partial<MethodOption>): Promise<AbbotResponse<T>>;
108
108
  }
109
109
 
110
- declare class Axios {
110
+ declare class AxiosBase {
111
111
  config: AbbotConfig;
112
112
  constructor(config: DeepPartial<AbbotConfig>);
113
113
  axiosInstance(): HttpInstance;
@@ -126,4 +126,4 @@ declare class RestError<T extends AxiosError> extends Error {
126
126
 
127
127
  declare function create(config: DeepPartial<AbbotConfig>): AbbotHttp;
128
128
 
129
- export { type AbbotConfig, AbbotHttp, type AbbotResponse, AppError, Axios, Cryp, type DeepPartial, ES, type HttpInstance, type MethodOption, RestError, Secure, catchError, create, deepMerge, defaultConfig };
129
+ export { type AbbotConfig, AbbotHttp, type AbbotResponse, AppError, AxiosBase, Cryp, type DeepPartial, ES, type HttpInstance, type MethodOption, RestError, Secure, catchError, create, deepMerge, defaultConfig };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ResponseType, AxiosInstance, AxiosResponse, AxiosError } from 'axios';
2
+ export * from 'axios';
2
3
 
3
4
  interface AbbotConfig {
4
5
  axios: {
@@ -21,7 +22,6 @@ interface AbbotConfig {
21
22
  userJwt: string | null;
22
23
  };
23
24
  devMode: boolean;
24
- keepAlive: boolean;
25
25
  }
26
26
  declare const defaultConfig: AbbotConfig;
27
27
 
@@ -88,7 +88,7 @@ interface HttpInstance extends AxiosInstance {
88
88
  cryp: Cryp;
89
89
  log: AbbLog;
90
90
  }
91
- declare class AbbotHttp extends Axios {
91
+ declare class AbbotHttp extends AxiosBase {
92
92
  constructor(config: DeepPartial<AbbotConfig>);
93
93
  getConfig(): AbbotConfig;
94
94
  private createAxiosInstance;
@@ -107,7 +107,7 @@ declare class AbbotHttp extends Axios {
107
107
  uploadFile<T>(url: string, file: File[], fileKeys: string[], param?: Record<string, any> | null, option?: Partial<MethodOption>): Promise<AbbotResponse<T>>;
108
108
  }
109
109
 
110
- declare class Axios {
110
+ declare class AxiosBase {
111
111
  config: AbbotConfig;
112
112
  constructor(config: DeepPartial<AbbotConfig>);
113
113
  axiosInstance(): HttpInstance;
@@ -126,4 +126,4 @@ declare class RestError<T extends AxiosError> extends Error {
126
126
 
127
127
  declare function create(config: DeepPartial<AbbotConfig>): AbbotHttp;
128
128
 
129
- export { type AbbotConfig, AbbotHttp, type AbbotResponse, AppError, Axios, Cryp, type DeepPartial, ES, type HttpInstance, type MethodOption, RestError, Secure, catchError, create, deepMerge, defaultConfig };
129
+ export { type AbbotConfig, AbbotHttp, type AbbotResponse, AppError, AxiosBase, Cryp, type DeepPartial, ES, type HttpInstance, type MethodOption, RestError, Secure, catchError, create, deepMerge, defaultConfig };
package/dist/index.js CHANGED
@@ -22,8 +22,7 @@ var defaultConfig = {
22
22
  trackingId: "",
23
23
  userJwt: null
24
24
  },
25
- devMode: false,
26
- keepAlive: false
25
+ devMode: false
27
26
  };
28
27
 
29
28
  // src/utilities.ts
@@ -40,8 +39,6 @@ function deepMerge(target, source) {
40
39
  }
41
40
 
42
41
  // src/config/axiosFn.ts
43
- import http from "http";
44
- import https from "https";
45
42
  function axiosConf(cfg) {
46
43
  return axios.create({
47
44
  baseURL: cfg.axios?.baseUrl,
@@ -55,12 +52,10 @@ function axiosConf(cfg) {
55
52
  }
56
53
  },
57
54
  timeout: cfg.axios?.timeout,
58
- withCredentials: true,
59
- httpAgent: cfg.keepAlive ? new http.Agent({ keepAlive: true }) : null,
60
- httpsAgent: cfg.keepAlive ? new https.Agent({ keepAlive: true, timeout: 6e4 }) : null
55
+ withCredentials: true
61
56
  });
62
57
  }
63
- var Axios = class {
58
+ var AxiosBase = class {
64
59
  config = defaultConfig;
65
60
  constructor(config) {
66
61
  this.config = deepMerge(this.config, config);
@@ -201,7 +196,7 @@ ${blue("res:")} ${res ? JSON.stringify(res) : "no data from log response"}`
201
196
  };
202
197
 
203
198
  // src/http/core.ts
204
- var AbbotHttp = class extends Axios {
199
+ var AbbotHttp = class extends AxiosBase {
205
200
  constructor(config) {
206
201
  super(config);
207
202
  }
@@ -485,13 +480,16 @@ var RestError = class extends Error {
485
480
 
486
481
  // src/core.ts
487
482
  function create(config) {
488
- const http2 = new AbbotHttp(config);
489
- return http2;
483
+ const http = new AbbotHttp(config);
484
+ return http;
490
485
  }
486
+
487
+ // src/index.ts
488
+ export * from "axios";
491
489
  export {
492
490
  AbbotHttp,
493
491
  AppError,
494
- Axios,
492
+ AxiosBase,
495
493
  Cryp,
496
494
  ES,
497
495
  RestError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abbot-http-client",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "description": "This package helps Abbot team to handle all the axios requests.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",