@biorate/axios 3.3.4 → 3.4.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.
@@ -104,28 +104,29 @@ class Axios extends singleton_1.Singleton {
104
104
  const params = {
105
105
  ...(0, lodash_es_1.omit)(settings, axiosRetryConfigKeys.concat(axiosExcludeKeys)),
106
106
  };
107
- await this.before(params);
107
+ const meta = {};
108
+ await this.before(params, meta);
108
109
  const startTime = this.getStartTime();
109
110
  try {
110
111
  const result = await __classPrivateFieldGet(this, _Axios_client, "f").call(this, params);
111
- await this.after(result, startTime, params);
112
+ await this.after(result, startTime, params, meta);
112
113
  return result;
113
114
  }
114
115
  catch (e) {
115
- await this.catch(e, startTime, params);
116
+ await this.catch(e, startTime, params, meta);
116
117
  throw e;
117
118
  }
118
119
  finally {
119
- await this.finally(startTime, params);
120
+ await this.finally(startTime, params, meta);
120
121
  }
121
122
  }
122
123
  getStartTime() {
123
124
  return [Date.now(), 0];
124
125
  }
125
- async before(params) { }
126
- async after(result, startTime, params) { }
127
- async catch(e, startTime, params) { }
128
- async finally(startTime, params) { }
126
+ async before(params, meta) { }
127
+ async after(result, startTime, params, meta) { }
128
+ async catch(e, startTime, params, meta) { }
129
+ async finally(startTime, params, meta) { }
129
130
  }
130
131
  exports.Axios = Axios;
131
132
  _Axios_client = new WeakMap();
@@ -84,28 +84,29 @@ export class Axios extends Singleton {
84
84
  const params = {
85
85
  ...omit(settings, axiosRetryConfigKeys.concat(axiosExcludeKeys)),
86
86
  };
87
- await this.before(params);
87
+ const meta = {};
88
+ await this.before(params, meta);
88
89
  const startTime = this.getStartTime();
89
90
  try {
90
91
  const result = await __classPrivateFieldGet(this, _Axios_client, "f").call(this, params);
91
- await this.after(result, startTime, params);
92
+ await this.after(result, startTime, params, meta);
92
93
  return result;
93
94
  }
94
95
  catch (e) {
95
- await this.catch(e, startTime, params);
96
+ await this.catch(e, startTime, params, meta);
96
97
  throw e;
97
98
  }
98
99
  finally {
99
- await this.finally(startTime, params);
100
+ await this.finally(startTime, params, meta);
100
101
  }
101
102
  }
102
103
  getStartTime() {
103
104
  return [Date.now(), 0];
104
105
  }
105
- async before(params) { }
106
- async after(result, startTime, params) { }
107
- async catch(e, startTime, params) { }
108
- async finally(startTime, params) { }
106
+ async before(params, meta) { }
107
+ async after(result, startTime, params, meta) { }
108
+ async catch(e, startTime, params, meta) { }
109
+ async finally(startTime, params, meta) { }
109
110
  }
110
111
  _Axios_client = new WeakMap();
111
112
  Axios.mocks = new WeakMap();
@@ -26,8 +26,8 @@ export declare class Axios extends Singleton {
26
26
  timeout: number;
27
27
  protected fetch<T, D>(options?: IAxiosFetchOptions): Promise<AxiosResponse<T, D>>;
28
28
  protected getStartTime(): [number, number];
29
- protected before(params?: IAxiosFetchOptions): Promise<void>;
30
- protected after<T = any, D = any>(result: AxiosResponse<T, D>, startTime: [number, number], params?: IAxiosFetchOptions): Promise<void>;
31
- protected catch(e: Error, startTime: [number, number], params?: IAxiosFetchOptions): Promise<void>;
32
- protected finally(startTime: [number, number], params?: IAxiosFetchOptions): Promise<void>;
29
+ protected before(params?: IAxiosFetchOptions, meta?: Record<string, unknown>): Promise<void>;
30
+ protected after<T = any, D = any>(result: AxiosResponse<T, D>, startTime: [number, number], params?: IAxiosFetchOptions, meta?: Record<string, unknown>): Promise<void>;
31
+ protected catch(e: Error, startTime: [number, number], params?: IAxiosFetchOptions, meta?: Record<string, unknown>): Promise<void>;
32
+ protected finally(startTime: [number, number], params?: IAxiosFetchOptions, meta?: Record<string, unknown>): Promise<void>;
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biorate/axios",
3
- "version": "3.3.4",
3
+ "version": "3.4.0",
4
4
  "description": "Axios OOP static interface",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -47,7 +47,7 @@
47
47
  ],
48
48
  "author": "llevkin",
49
49
  "license": "MIT",
50
- "gitHead": "0696f1a30056198ed9371cad19789cb586fe79d1",
50
+ "gitHead": "e24019783b77fff5f6208b83a39055ab216c06b6",
51
51
  "peerDependencies": {
52
52
  "lodash-es": ">=4.18.1"
53
53
  },