@acrool/react-fetcher 0.0.2-alpha.4 → 0.0.2-alpha.6
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,13 +1,13 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { IInternalRequestConfig } from '../fetchers/types';
|
|
4
4
|
import { IResponseFirstError } from './types';
|
|
5
5
|
export declare const AxiosClientContext: React.Context<AxiosInstance | null>;
|
|
6
6
|
export declare const useAxiosClient: () => null;
|
|
7
7
|
interface IProps {
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
axiosInstance: AxiosInstance;
|
|
10
|
-
checkIsRefreshTokenRequest?: (config:
|
|
10
|
+
checkIsRefreshTokenRequest?: (config: IInternalRequestConfig) => boolean;
|
|
11
11
|
locale?: string;
|
|
12
12
|
onError?: (error: IResponseFirstError) => void;
|
|
13
13
|
authorizationPrefix?: string;
|
|
@@ -42,7 +42,7 @@ const ht = 400, Gt = (e) => "File" in window && e instanceof File, Zt = (e) => "
|
|
|
42
42
|
const b = JSON.stringify({
|
|
43
43
|
query: t,
|
|
44
44
|
variables: p.variables
|
|
45
|
-
}), T = p.map.reduce((R, m,
|
|
45
|
+
}), T = p.map.reduce((R, m, g) => (R[g] = [m], R), {}), h = [
|
|
46
46
|
{ name: "operations", value: b },
|
|
47
47
|
{ name: "map", value: JSON.stringify(T) },
|
|
48
48
|
...p.values.map((R, m) => ({ name: m, value: R }))
|
|
@@ -194,7 +194,7 @@ function tr() {
|
|
|
194
194
|
switch (f) {
|
|
195
195
|
case R:
|
|
196
196
|
return "Fragment";
|
|
197
|
-
case
|
|
197
|
+
case g:
|
|
198
198
|
return "Profiler";
|
|
199
199
|
case m:
|
|
200
200
|
return "StrictMode";
|
|
@@ -211,7 +211,7 @@ function tr() {
|
|
|
211
211
|
), f.$$typeof) {
|
|
212
212
|
case h:
|
|
213
213
|
return "Portal";
|
|
214
|
-
case
|
|
214
|
+
case S:
|
|
215
215
|
return (f.displayName || "Context") + ".Provider";
|
|
216
216
|
case E:
|
|
217
217
|
return (f._context.displayName || "Context") + ".Consumer";
|
|
@@ -292,7 +292,7 @@ function tr() {
|
|
|
292
292
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
293
293
|
)), f = this.props.ref, f !== void 0 ? f : null;
|
|
294
294
|
}
|
|
295
|
-
function l(f, w, _, P, M, B,
|
|
295
|
+
function l(f, w, _, P, M, B, ge, Oe) {
|
|
296
296
|
return _ = B.ref, f = {
|
|
297
297
|
$$typeof: T,
|
|
298
298
|
type: f,
|
|
@@ -316,7 +316,7 @@ function tr() {
|
|
|
316
316
|
configurable: !1,
|
|
317
317
|
enumerable: !1,
|
|
318
318
|
writable: !0,
|
|
319
|
-
value:
|
|
319
|
+
value: ge
|
|
320
320
|
}), Object.defineProperty(f, "_debugTask", {
|
|
321
321
|
configurable: !1,
|
|
322
322
|
enumerable: !1,
|
|
@@ -324,7 +324,7 @@ function tr() {
|
|
|
324
324
|
value: Oe
|
|
325
325
|
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
|
|
326
326
|
}
|
|
327
|
-
function u(f, w, _, P, M, B,
|
|
327
|
+
function u(f, w, _, P, M, B, ge, Oe) {
|
|
328
328
|
var k = w.children;
|
|
329
329
|
if (k !== void 0)
|
|
330
330
|
if (P)
|
|
@@ -370,14 +370,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
370
370
|
M,
|
|
371
371
|
s(),
|
|
372
372
|
_,
|
|
373
|
-
|
|
373
|
+
ge,
|
|
374
374
|
Oe
|
|
375
375
|
);
|
|
376
376
|
}
|
|
377
377
|
function p(f) {
|
|
378
378
|
typeof f == "object" && f !== null && f.$$typeof === T && f._store && (f._store.validated = 1);
|
|
379
379
|
}
|
|
380
|
-
var b = Vt, T = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"),
|
|
380
|
+
var b = Vt, T = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), E = Symbol.for("react.consumer"), S = Symbol.for("react.context"), O = Symbol.for("react.forward_ref"), A = Symbol.for("react.suspense"), N = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), I = Symbol.for("react.activity"), X = Symbol.for("react.client.reference"), Te = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Ie = Object.prototype.hasOwnProperty, Ht = Array.isArray, Se = console.createTask ? console.createTask : function() {
|
|
381
381
|
return null;
|
|
382
382
|
};
|
|
383
383
|
b = {
|
|
@@ -388,7 +388,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
388
388
|
var $e, Me = {}, He = b["react-stack-bottom-frame"].bind(
|
|
389
389
|
b,
|
|
390
390
|
o
|
|
391
|
-
)(), ze =
|
|
391
|
+
)(), ze = Se(n(o)), Je = {};
|
|
392
392
|
Z.Fragment = R, Z.jsx = function(f, w, _, P, M) {
|
|
393
393
|
var B = 1e4 > Te.recentlyCreatedOwnerStacks++;
|
|
394
394
|
return u(
|
|
@@ -399,7 +399,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
399
399
|
P,
|
|
400
400
|
M,
|
|
401
401
|
B ? Error("react-stack-top-frame") : He,
|
|
402
|
-
B ?
|
|
402
|
+
B ? Se(n(f)) : ze
|
|
403
403
|
);
|
|
404
404
|
}, Z.jsxs = function(f, w, _, P, M) {
|
|
405
405
|
var B = 1e4 > Te.recentlyCreatedOwnerStacks++;
|
|
@@ -411,7 +411,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
411
411
|
P,
|
|
412
412
|
M,
|
|
413
413
|
B ? Error("react-stack-top-frame") : He,
|
|
414
|
-
B ?
|
|
414
|
+
B ? Se(n(f)) : ze
|
|
415
415
|
);
|
|
416
416
|
};
|
|
417
417
|
}()), Z;
|
|
@@ -652,41 +652,44 @@ const fr = dt(null), Yn = ({
|
|
|
652
652
|
forceLogout: p
|
|
653
653
|
} = cr();
|
|
654
654
|
Xt(() => {
|
|
655
|
-
const E = t.interceptors.request.use(h),
|
|
655
|
+
const E = t.interceptors.request.use(h), S = t.interceptors.response.use(R, g);
|
|
656
656
|
return () => {
|
|
657
|
-
t.interceptors.request.eject(E), t.interceptors.response.eject(
|
|
657
|
+
t.interceptors.request.eject(E), t.interceptors.response.eject(S);
|
|
658
658
|
};
|
|
659
659
|
}, [d, u, l, p]);
|
|
660
660
|
const b = (E) => {
|
|
661
661
|
c && v.warning("[FetcherProvider] runPendingRequest", { isSuccess: E }), Q = !1;
|
|
662
|
-
for (const
|
|
663
|
-
|
|
662
|
+
for (const S of _e)
|
|
663
|
+
S(E);
|
|
664
664
|
_e = [];
|
|
665
|
-
}, T = (E,
|
|
665
|
+
}, T = (E, S) => (O) => {
|
|
666
666
|
c && v.info("[FetcherProvider] Request add pending queue", { originConfig: O }), _e.push((A) => {
|
|
667
|
-
A ? (O.pendingRequest = !0, E(t(O))) :
|
|
667
|
+
A ? (O.pendingRequest = !0, E(t(O))) : S(new te({
|
|
668
668
|
message: m(401),
|
|
669
669
|
code: "UNAUTHORIZED",
|
|
670
670
|
path: "AxiosClientProvider.pushPendingRequestQueues"
|
|
671
671
|
}));
|
|
672
672
|
});
|
|
673
|
-
}, h = (E) => new Promise((
|
|
673
|
+
}, h = (E) => new Promise((S, O) => {
|
|
674
674
|
var C, I;
|
|
675
675
|
E.headers["Accept-Language"] = r;
|
|
676
676
|
const A = (C = d()) == null ? void 0 : C.accessToken;
|
|
677
677
|
if (!((I = E.fetchOptions) == null ? void 0 : I.forceGuest) && A && (E.headers.Authorization = [o, A].filter((X) => X).join(" ")), !(E && s ? s(E) : !1) && Q) {
|
|
678
|
-
T(
|
|
678
|
+
T(S, O)(E), O(new lr({
|
|
679
|
+
message: "Token refreshing, so request save queues not send",
|
|
680
|
+
code: "REFRESH_TOKEN"
|
|
681
|
+
}));
|
|
679
682
|
return;
|
|
680
683
|
}
|
|
681
|
-
|
|
684
|
+
S(E);
|
|
682
685
|
}), R = (E) => (c && v.info("[FetcherProvider] interceptorsResponseSuccess", { response: E }), E), m = (E) => {
|
|
683
|
-
const
|
|
684
|
-
return (
|
|
685
|
-
},
|
|
686
|
-
const
|
|
686
|
+
const S = (i == null ? void 0 : i[r]) || Ze[r] || Ze["en-US"];
|
|
687
|
+
return (S == null ? void 0 : S[E]) || `Error: ${E}`;
|
|
688
|
+
}, g = (E) => {
|
|
689
|
+
const S = E.response, O = E.config, A = E.status, N = ur(S);
|
|
687
690
|
c && v.warning("[FetcherProvider] interceptorsResponseError", { status: A, responseFirstError: N }), n && n(N);
|
|
688
691
|
const U = O && s ? s(O) : !1;
|
|
689
|
-
if (
|
|
692
|
+
if (S && O && (A === 401 || N.code === "UNAUTHENTICATED")) {
|
|
690
693
|
const C = d();
|
|
691
694
|
return c && v.warning("[FetcherProvider] enter refresh token flow", { refreshToken: C == null ? void 0 : C.refreshToken }), Ue(C == null ? void 0 : C.refreshToken) || U || O.pendingRequest ? (Q = !1, c && v.warning("[FetcherProvider] no refreshToken/refreshAPI|pendingRequest fail, force logout"), p(), Promise.reject(new te(N))) : (Q || (Q = !0, c && v.warning("[FetcherProvider] refreshTokens"), u().then(() => {
|
|
692
695
|
c && v.info("[FetcherProvider] refreshTokens success"), b(!0);
|
|
@@ -728,11 +731,11 @@ const mr = Re("string"), j = Re("function"), Tt = Re("number"), Ee = (e) => e !=
|
|
|
728
731
|
return !1;
|
|
729
732
|
const t = De(e);
|
|
730
733
|
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(yt in e) && !(he in e);
|
|
731
|
-
}, Er = D("Date"), br = D("File"), yr = D("Blob"), wr = D("FileList"), Tr = (e) => Ee(e) && j(e.pipe),
|
|
734
|
+
}, Er = D("Date"), br = D("File"), yr = D("Blob"), wr = D("FileList"), Tr = (e) => Ee(e) && j(e.pipe), Sr = (e) => {
|
|
732
735
|
let t;
|
|
733
736
|
return e && (typeof FormData == "function" && e instanceof FormData || j(e.append) && ((t = me(e)) === "formdata" || // detect form-data instance
|
|
734
737
|
t === "object" && j(e.toString) && e.toString() === "[object FormData]"));
|
|
735
|
-
},
|
|
738
|
+
}, gr = D("URLSearchParams"), [Or, Ar, _r, xr] = ["ReadableStream", "Request", "Response", "Headers"].map(D), Nr = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
736
739
|
function ie(e, t, { allOwnKeys: r = !1 } = {}) {
|
|
737
740
|
if (e === null || typeof e > "u")
|
|
738
741
|
return;
|
|
@@ -747,7 +750,7 @@ function ie(e, t, { allOwnKeys: r = !1 } = {}) {
|
|
|
747
750
|
c = o[n], t.call(null, e[c], c, e);
|
|
748
751
|
}
|
|
749
752
|
}
|
|
750
|
-
function
|
|
753
|
+
function St(e, t) {
|
|
751
754
|
t = t.toLowerCase();
|
|
752
755
|
const r = Object.keys(e);
|
|
753
756
|
let n = r.length, s;
|
|
@@ -756,10 +759,10 @@ function gt(e, t) {
|
|
|
756
759
|
return s;
|
|
757
760
|
return null;
|
|
758
761
|
}
|
|
759
|
-
const H = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global,
|
|
762
|
+
const H = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, gt = (e) => !re(e) && e !== H;
|
|
760
763
|
function Pe() {
|
|
761
|
-
const { caseless: e } =
|
|
762
|
-
const o = e &&
|
|
764
|
+
const { caseless: e } = gt(this) && this || {}, t = {}, r = (n, s) => {
|
|
765
|
+
const o = e && St(t, s) || s;
|
|
763
766
|
le(t[o]) && le(n) ? t[o] = Pe(t[o], n) : le(n) ? t[o] = Pe({}, n) : Y(n) ? t[o] = n.slice() : t[o] = n;
|
|
764
767
|
};
|
|
765
768
|
for (let n = 0, s = arguments.length; n < s; n++)
|
|
@@ -874,7 +877,7 @@ const Wr = (e) => {
|
|
|
874
877
|
isArray: Y,
|
|
875
878
|
isArrayBuffer: wt,
|
|
876
879
|
isBuffer: pr,
|
|
877
|
-
isFormData:
|
|
880
|
+
isFormData: Sr,
|
|
878
881
|
isArrayBufferView: hr,
|
|
879
882
|
isString: mr,
|
|
880
883
|
isNumber: Tt,
|
|
@@ -892,7 +895,7 @@ const Wr = (e) => {
|
|
|
892
895
|
isRegExp: Ir,
|
|
893
896
|
isFunction: j,
|
|
894
897
|
isStream: Tr,
|
|
895
|
-
isURLSearchParams:
|
|
898
|
+
isURLSearchParams: gr,
|
|
896
899
|
isTypedArray: Lr,
|
|
897
900
|
isFileList: wr,
|
|
898
901
|
forEach: ie,
|
|
@@ -918,9 +921,9 @@ const Wr = (e) => {
|
|
|
918
921
|
toCamelCase: qr,
|
|
919
922
|
noop: Hr,
|
|
920
923
|
toFiniteNumber: zr,
|
|
921
|
-
findKey:
|
|
924
|
+
findKey: St,
|
|
922
925
|
global: H,
|
|
923
|
-
isContextDefined:
|
|
926
|
+
isContextDefined: gt,
|
|
924
927
|
isSpecCompliantForm: Jr,
|
|
925
928
|
toJSONObject: Wr,
|
|
926
929
|
isAsyncFn: Vr,
|
|
@@ -1019,16 +1022,16 @@ function be(e, t, r) {
|
|
|
1019
1022
|
return a.isArrayBuffer(h) || a.isTypedArray(h) ? d && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
|
|
1020
1023
|
}
|
|
1021
1024
|
function u(h, R, m) {
|
|
1022
|
-
let
|
|
1025
|
+
let g = h;
|
|
1023
1026
|
if (h && !m && typeof h == "object") {
|
|
1024
1027
|
if (a.endsWith(R, "{}"))
|
|
1025
1028
|
R = n ? R : R.slice(0, -2), h = JSON.stringify(h);
|
|
1026
|
-
else if (a.isArray(h) && Zr(h) || (a.isFileList(h) || a.endsWith(R, "[]")) && (
|
|
1027
|
-
return R = Nt(R),
|
|
1028
|
-
!(a.isUndefined(
|
|
1029
|
+
else if (a.isArray(h) && Zr(h) || (a.isFileList(h) || a.endsWith(R, "[]")) && (g = a.toArray(h)))
|
|
1030
|
+
return R = Nt(R), g.forEach(function(S, O) {
|
|
1031
|
+
!(a.isUndefined(S) || S === null) && t.append(
|
|
1029
1032
|
// eslint-disable-next-line no-nested-ternary
|
|
1030
1033
|
i === !0 ? et([R], O, o) : i === null ? R : R + "[]",
|
|
1031
|
-
l(
|
|
1034
|
+
l(S)
|
|
1032
1035
|
);
|
|
1033
1036
|
}), !1;
|
|
1034
1037
|
}
|
|
@@ -1043,14 +1046,14 @@ function be(e, t, r) {
|
|
|
1043
1046
|
if (!a.isUndefined(h)) {
|
|
1044
1047
|
if (p.indexOf(h) !== -1)
|
|
1045
1048
|
throw Error("Circular reference detected in " + R.join("."));
|
|
1046
|
-
p.push(h), a.forEach(h, function(
|
|
1047
|
-
(!(a.isUndefined(
|
|
1049
|
+
p.push(h), a.forEach(h, function(g, E) {
|
|
1050
|
+
(!(a.isUndefined(g) || g === null) && s.call(
|
|
1048
1051
|
t,
|
|
1049
|
-
|
|
1052
|
+
g,
|
|
1050
1053
|
a.isString(E) ? E.trim() : E,
|
|
1051
1054
|
R,
|
|
1052
1055
|
b
|
|
1053
|
-
)) === !0 && T(
|
|
1056
|
+
)) === !0 && T(g, R ? R.concat(E) : [E]);
|
|
1054
1057
|
}), p.pop();
|
|
1055
1058
|
}
|
|
1056
1059
|
}
|
|
@@ -1543,7 +1546,7 @@ function Tn(e, t) {
|
|
|
1543
1546
|
return T ? Math.round(b * 1e3 / T) : void 0;
|
|
1544
1547
|
};
|
|
1545
1548
|
}
|
|
1546
|
-
function
|
|
1549
|
+
function Sn(e, t) {
|
|
1547
1550
|
let r = 0, n = 1e3 / t, s, o;
|
|
1548
1551
|
const i = (l, u = Date.now()) => {
|
|
1549
1552
|
r = u, s = null, o && (clearTimeout(o), o = null), e.apply(null, l);
|
|
@@ -1558,7 +1561,7 @@ function gn(e, t) {
|
|
|
1558
1561
|
const de = (e, t, r = 3) => {
|
|
1559
1562
|
let n = 0;
|
|
1560
1563
|
const s = Tn(50, 250);
|
|
1561
|
-
return
|
|
1564
|
+
return Sn((o) => {
|
|
1562
1565
|
const i = o.loaded, c = o.lengthComputable ? o.total : void 0, d = i - n, l = s(d), u = i <= c;
|
|
1563
1566
|
n = i;
|
|
1564
1567
|
const p = {
|
|
@@ -1581,7 +1584,7 @@ const de = (e, t, r = 3) => {
|
|
|
1581
1584
|
total: e,
|
|
1582
1585
|
loaded: n
|
|
1583
1586
|
}), t[1]];
|
|
1584
|
-
}, ot = (e) => (...t) => a.asap(() => e(...t)),
|
|
1587
|
+
}, ot = (e) => (...t) => a.asap(() => e(...t)), gn = F.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (r) => (r = new URL(r, F.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(
|
|
1585
1588
|
new URL(F.origin),
|
|
1586
1589
|
F.navigator && /(msie|trident)/i.test(F.navigator.userAgent)
|
|
1587
1590
|
) : () => !0, On = F.hasStandardBrowserEnv ? (
|
|
@@ -1702,7 +1705,7 @@ const Ut = (e) => {
|
|
|
1702
1705
|
i.setContentType([l || "multipart/form-data", ...u].join("; "));
|
|
1703
1706
|
}
|
|
1704
1707
|
}
|
|
1705
|
-
if (F.hasStandardBrowserEnv && (n && a.isFunction(n) && (n = n(t)), n || n !== !1 &&
|
|
1708
|
+
if (F.hasStandardBrowserEnv && (n && a.isFunction(n) && (n = n(t)), n || n !== !1 && gn(t.url))) {
|
|
1706
1709
|
const l = s && o && On.read(o);
|
|
1707
1710
|
l && i.set(s, l);
|
|
1708
1711
|
}
|
|
@@ -1718,16 +1721,16 @@ const Ut = (e) => {
|
|
|
1718
1721
|
}
|
|
1719
1722
|
let m = new XMLHttpRequest();
|
|
1720
1723
|
m.open(s.method.toUpperCase(), s.url, !0), m.timeout = s.timeout;
|
|
1721
|
-
function
|
|
1724
|
+
function g() {
|
|
1722
1725
|
if (!m)
|
|
1723
1726
|
return;
|
|
1724
|
-
const
|
|
1727
|
+
const S = L.from(
|
|
1725
1728
|
"getAllResponseHeaders" in m && m.getAllResponseHeaders()
|
|
1726
1729
|
), A = {
|
|
1727
1730
|
data: !c || c === "text" || c === "json" ? m.responseText : m.response,
|
|
1728
1731
|
status: m.status,
|
|
1729
1732
|
statusText: m.statusText,
|
|
1730
|
-
headers:
|
|
1733
|
+
headers: S,
|
|
1731
1734
|
config: e,
|
|
1732
1735
|
request: m
|
|
1733
1736
|
};
|
|
@@ -1737,8 +1740,8 @@ const Ut = (e) => {
|
|
|
1737
1740
|
n(U), R();
|
|
1738
1741
|
}, A), m = null;
|
|
1739
1742
|
}
|
|
1740
|
-
"onloadend" in m ? m.onloadend =
|
|
1741
|
-
!m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(
|
|
1743
|
+
"onloadend" in m ? m.onloadend = g : m.onreadystatechange = function() {
|
|
1744
|
+
!m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(g);
|
|
1742
1745
|
}, m.onabort = function() {
|
|
1743
1746
|
m && (n(new y("Request aborted", y.ECONNABORTED, e, m)), m = null);
|
|
1744
1747
|
}, m.onerror = function() {
|
|
@@ -1754,8 +1757,8 @@ const Ut = (e) => {
|
|
|
1754
1757
|
)), m = null;
|
|
1755
1758
|
}, o === void 0 && i.setContentType(null), "setRequestHeader" in m && a.forEach(i.toJSON(), function(O, A) {
|
|
1756
1759
|
m.setRequestHeader(A, O);
|
|
1757
|
-
}), a.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), c && c !== "json" && (m.responseType = s.responseType), l && ([b, h] = de(l, !0), m.addEventListener("progress", b)), d && m.upload && ([p, T] = de(d), m.upload.addEventListener("progress", p), m.upload.addEventListener("loadend", T)), (s.cancelToken || s.signal) && (u = (
|
|
1758
|
-
m && (n(!
|
|
1760
|
+
}), a.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), c && c !== "json" && (m.responseType = s.responseType), l && ([b, h] = de(l, !0), m.addEventListener("progress", b)), d && m.upload && ([p, T] = de(d), m.upload.addEventListener("progress", p), m.upload.addEventListener("loadend", T)), (s.cancelToken || s.signal) && (u = (S) => {
|
|
1761
|
+
m && (n(!S || S.type ? new K(null, e, m) : S), m.abort(), m = null);
|
|
1759
1762
|
}, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
|
|
1760
1763
|
const E = wn(s.url);
|
|
1761
1764
|
if (E && F.protocols.indexOf(E) === -1) {
|
|
@@ -1924,7 +1927,7 @@ const Ln = async (e) => {
|
|
|
1924
1927
|
}
|
|
1925
1928
|
}
|
|
1926
1929
|
a.isString(p) || (p = p ? "include" : "omit");
|
|
1927
|
-
const
|
|
1930
|
+
const g = "credentials" in Request.prototype;
|
|
1928
1931
|
h = new Request(t, {
|
|
1929
1932
|
...b,
|
|
1930
1933
|
signal: T,
|
|
@@ -1932,11 +1935,11 @@ const Ln = async (e) => {
|
|
|
1932
1935
|
headers: u.normalize().toJSON(),
|
|
1933
1936
|
body: n,
|
|
1934
1937
|
duplex: "half",
|
|
1935
|
-
credentials:
|
|
1938
|
+
credentials: g ? p : void 0
|
|
1936
1939
|
});
|
|
1937
1940
|
let E = await fetch(h);
|
|
1938
|
-
const
|
|
1939
|
-
if (ve && (c ||
|
|
1941
|
+
const S = ve && (l === "stream" || l === "response");
|
|
1942
|
+
if (ve && (c || S && R)) {
|
|
1940
1943
|
const A = {};
|
|
1941
1944
|
["status", "statusText", "headers"].forEach((I) => {
|
|
1942
1945
|
A[I] = E[I];
|
|
@@ -1954,7 +1957,7 @@ const Ln = async (e) => {
|
|
|
1954
1957
|
}
|
|
1955
1958
|
l = l || "text";
|
|
1956
1959
|
let O = await pe[a.findKey(pe, l) || "text"](E, e);
|
|
1957
|
-
return !
|
|
1960
|
+
return !S && R && R(), await new Promise((A, N) => {
|
|
1958
1961
|
jt(A, N, {
|
|
1959
1962
|
data: O,
|
|
1960
1963
|
headers: L.from(E.headers),
|
|
@@ -1964,13 +1967,13 @@ const Ln = async (e) => {
|
|
|
1964
1967
|
request: h
|
|
1965
1968
|
});
|
|
1966
1969
|
});
|
|
1967
|
-
} catch (
|
|
1968
|
-
throw R && R(),
|
|
1970
|
+
} catch (g) {
|
|
1971
|
+
throw R && R(), g && g.name === "TypeError" && /Load failed|fetch/i.test(g.message) ? Object.assign(
|
|
1969
1972
|
new y("Network Error", y.ERR_NETWORK, e, h),
|
|
1970
1973
|
{
|
|
1971
|
-
cause:
|
|
1974
|
+
cause: g.cause || g
|
|
1972
1975
|
}
|
|
1973
|
-
) : y.from(
|
|
1976
|
+
) : y.from(g, g && g.code, e, h);
|
|
1974
1977
|
}
|
|
1975
1978
|
}), je = {
|
|
1976
1979
|
http: Gr,
|
|
@@ -2405,7 +2408,6 @@ const {
|
|
|
2405
2408
|
getAdapter: fs,
|
|
2406
2409
|
mergeConfig: ds
|
|
2407
2410
|
} = x, ps = (e) => x.create({
|
|
2408
|
-
baseURL: "/graphql",
|
|
2409
2411
|
timeout: 2 * 60 * 1e3,
|
|
2410
2412
|
...e
|
|
2411
2413
|
});
|
package/dist/createAxios.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const createAxiosInstance: (config?: TCreateAxiosInstanceConfig) => import('axios').AxiosInstance;
|
|
4
|
-
export {};
|
|
1
|
+
import { CreateAxiosDefaults } from 'axios';
|
|
2
|
+
export declare const createAxiosInstance: (config?: CreateAxiosDefaults) => import('axios').AxiosInstance;
|
package/dist/fetchers/types.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
|
|
1
|
+
import { AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
interface IFetchOptions {
|
|
3
3
|
pendingRequest?: boolean;
|
|
4
4
|
requestCode?: string;
|
|
5
5
|
forceGuest?: boolean;
|
|
6
6
|
leastTime?: number;
|
|
7
7
|
timeout?: number;
|
|
8
8
|
}
|
|
9
|
+
export interface IInternalRequestConfig extends InternalAxiosRequestConfig, IFetchOptions {
|
|
10
|
+
}
|
|
9
11
|
export interface IRequestConfig extends AxiosRequestConfig, IFetchOptions {
|
|
10
12
|
}
|
|
13
|
+
export {};
|