@superutils/fetch 1.1.5 → 1.1.7

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.d.ts CHANGED
@@ -274,7 +274,7 @@ type FetchRetryOptions = Omit<Partial<RetryOptions>, 'retry' | 'retryIf'> & {
274
274
  /**
275
275
  * Generic fetch interceptor type
276
276
  */
277
- type Interceptor<T, TArgs extends unknown[], TArgsCb extends unknown[] = [value: T, ...TArgs]> = (...args: TArgsCb) => ValueOrPromise<void> | ValueOrPromise<T>;
277
+ type Interceptor<T, TArgs extends unknown[]> = (...args: [value: T, ...TArgs]) => ValueOrPromise<void> | ValueOrPromise<T>;
278
278
  type PostBody = Record<string, unknown> | BodyInit | null;
279
279
  type PostArgs<OmitMethod = false> = [
280
280
  url: string | URL,
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ var executeInterceptors = async (value, interceptors, ...args) => {
16
16
  for (const interceptor of interceptors.filter(isFn)) {
17
17
  value = (_a = await fallbackIfFails(
18
18
  interceptor,
19
- [value, args],
19
+ [value, ...args],
20
20
  void 0
21
21
  )) != null ? _a : value;
22
22
  }
@@ -63,7 +63,7 @@ var getResponse_default = getResponse;
63
63
  import { isEmpty, objKeys } from "@superutils/core";
64
64
  var mergeFetchOptions = (...allOptions) => allOptions.reduce(
65
65
  (o1, o2) => {
66
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
66
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
67
67
  const { errMsgs = {}, headers, interceptors: ints1 = {} } = o1;
68
68
  const { errMsgs: msgs2 = {}, interceptors: ints2 = {} } = o2;
69
69
  o2.headers && new Headers(o2.headers).forEach((value, key) => {
@@ -78,12 +78,21 @@ var mergeFetchOptions = (...allOptions) => allOptions.reduce(
78
78
  errMsgs,
79
79
  headers,
80
80
  interceptors: {
81
- error: (_c = (_b = ints1 == null ? void 0 : ints1.error) == null ? void 0 : _b.concat((_a = ints2 == null ? void 0 : ints2.error) != null ? _a : [])) != null ? _c : [],
82
- request: (_f = (_e = ints1 == null ? void 0 : ints1.request) == null ? void 0 : _e.concat((_d = ints2 == null ? void 0 : ints2.request) != null ? _d : [])) != null ? _f : [],
83
- response: (_i = (_h = ints1 == null ? void 0 : ints1.response) == null ? void 0 : _h.concat((_g = ints2 == null ? void 0 : ints2.response) != null ? _g : [])) != null ? _i : [],
84
- result: (_l = (_k = ints1 == null ? void 0 : ints1.result) == null ? void 0 : _k.concat((_j = ints2 == null ? void 0 : ints2.result) != null ? _j : [])) != null ? _l : []
81
+ error: [...(_a = ints1 == null ? void 0 : ints1.error) != null ? _a : [], ...(_b = ints2 == null ? void 0 : ints2.error) != null ? _b : []],
82
+ request: [
83
+ ...(_c = ints1 == null ? void 0 : ints1.request) != null ? _c : [],
84
+ ...(_d = ints2 == null ? void 0 : ints2.request) != null ? _d : []
85
+ ],
86
+ response: [
87
+ ...(_e = ints1 == null ? void 0 : ints1.response) != null ? _e : [],
88
+ ...(_f = ints2 == null ? void 0 : ints2.response) != null ? _f : []
89
+ ],
90
+ result: [
91
+ ...(_g = ints1 == null ? void 0 : ints1.result) != null ? _g : [],
92
+ ...(_h = ints2 == null ? void 0 : ints2.result) != null ? _h : []
93
+ ]
85
94
  },
86
- timeout: (_n = (_m = o2.timeout) != null ? _m : o1.timeout) != null ? _n : 0
95
+ timeout: (_j = (_i = o2.timeout) != null ? _i : o1.timeout) != null ? _j : 0
87
96
  };
88
97
  },
89
98
  { headers: new Headers() }
package/package.json CHANGED
@@ -45,5 +45,5 @@
45
45
  "sideEffects": false,
46
46
  "type": "module",
47
47
  "types": "dist/index.d.ts",
48
- "version": "1.1.5"
48
+ "version": "1.1.7"
49
49
  }