@acrool/react-fetcher 0.0.2 → 0.0.3
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/README.md +4 -0
- package/dist/AuthStateProvider/AuthStateProvider.d.ts +2 -1
- package/dist/acrool-react-fetcher.es.js +211 -209
- package/dist/fetchers/createGraphQLFetcher/createGraphQLFetcher.d.ts +2 -2
- package/dist/fetchers/createGraphQLFetcher/index.d.ts +1 -1
- package/dist/fetchers/createGraphQLFetcher/types.d.ts +1 -1
- package/dist/fetchers/createRestFulFetcher/createRestFulFetcher.d.ts +2 -2
- package/dist/fetchers/createRestFulFetcher/index.d.ts +1 -1
- package/dist/fetchers/createRestFulFetcher/types.d.ts +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,10 @@ Acrool React Fetcher is a solution for API integration and Auth state management
|
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
A solution for API integration and token management in React projects
|
|
11
|
+
|
|
12
|
+
https://acrool-react-fetcher-graphql.pages.dev/
|
|
13
|
+
https://acrool-react-fetcher-restful.pages.dev/
|
|
14
|
+
|
|
11
15
|
</p>
|
|
12
16
|
|
|
13
17
|
<div align="center">
|
|
@@ -15,6 +15,7 @@ interface AuthStateProviderProps {
|
|
|
15
15
|
onGetTokens: TOnGetTokens;
|
|
16
16
|
onRefreshTokens?: TOnRefreshToken;
|
|
17
17
|
onForceLogout?: TOnForceLogout;
|
|
18
|
+
isDebug?: boolean;
|
|
18
19
|
}
|
|
19
|
-
declare const AuthStateProvider: ({ children, onGetTokens, onSetTokens, onRefreshTokens, onForceLogout }: AuthStateProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare const AuthStateProvider: ({ children, onGetTokens, onSetTokens, onRefreshTokens, onForceLogout, isDebug, }: AuthStateProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export default AuthStateProvider;
|
|
@@ -38,11 +38,11 @@ const pt = 400, Kt = (e) => "File" in window && e instanceof File, Xt = (e) => "
|
|
|
38
38
|
const p = ht(i);
|
|
39
39
|
if (c = p.values.length > 0, c) {
|
|
40
40
|
s = "multipart/form-data";
|
|
41
|
-
const
|
|
41
|
+
const y = JSON.stringify({
|
|
42
42
|
query: t,
|
|
43
43
|
variables: p.variables
|
|
44
44
|
}), T = p.map.reduce((R, m, S) => (R[S] = [m], R), {}), h = [
|
|
45
|
-
{ name: "operations", value:
|
|
45
|
+
{ name: "operations", value: y },
|
|
46
46
|
{ name: "map", value: JSON.stringify(T) },
|
|
47
47
|
...p.values.map((R, m) => ({ name: m, value: R }))
|
|
48
48
|
];
|
|
@@ -84,12 +84,12 @@ function Gt(e) {
|
|
|
84
84
|
}
|
|
85
85
|
var de = /* @__PURE__ */ ((e) => (e.formData = "multipart/form-data", e.formUrlDecode = "application/x-www-form-urlencoded", e.json = "application/json", e))(de || {}), Zt = /* @__PURE__ */ ((e) => (e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.DELETE = "DELETE", e.PATCH = "PATCH", e))(Zt || {});
|
|
86
86
|
const Qt = (e, t = {}) => [de.formData, de.formUrlDecode].includes(e) ? Gt(t) : JSON.stringify(t), en = (e) => de.json, Vr = (e, t, n = en) => async (r) => {
|
|
87
|
-
var u, p;
|
|
88
|
-
const s = (t == null ? void 0 : t.method) || "", o =
|
|
87
|
+
var u, p, y;
|
|
88
|
+
const s = (t == null ? void 0 : t.method) || "", o = r == null ? void 0 : r.fetchOptions, i = (u = r == null ? void 0 : r.variables) == null ? void 0 : u.params, c = ((p = o == null ? void 0 : o.headers) == null ? void 0 : p.contentType) ?? n(s.toUpperCase()), d = {
|
|
89
89
|
url: t.url,
|
|
90
90
|
method: s,
|
|
91
91
|
params: i,
|
|
92
|
-
data: Qt(c, r == null ? void 0 : r.body),
|
|
92
|
+
data: Qt(c, (y = r == null ? void 0 : r.variables) == null ? void 0 : y.body),
|
|
93
93
|
...o,
|
|
94
94
|
headers: {
|
|
95
95
|
...o == null ? void 0 : o.headers,
|
|
@@ -101,7 +101,7 @@ const Qt = (e, t = {}) => [de.formData, de.formUrlDecode].includes(e) ? Gt(t) :
|
|
|
101
101
|
]);
|
|
102
102
|
return l.data;
|
|
103
103
|
};
|
|
104
|
-
var ce = { exports: {} },
|
|
104
|
+
var ce = { exports: {} }, Z = {};
|
|
105
105
|
/**
|
|
106
106
|
* @license React
|
|
107
107
|
* react-jsx-runtime.production.js
|
|
@@ -113,7 +113,7 @@ var ce = { exports: {} }, G = {};
|
|
|
113
113
|
*/
|
|
114
114
|
var Ve;
|
|
115
115
|
function tn() {
|
|
116
|
-
if (Ve) return
|
|
116
|
+
if (Ve) return Z;
|
|
117
117
|
Ve = 1;
|
|
118
118
|
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
119
119
|
function n(r, s, o) {
|
|
@@ -131,9 +131,9 @@ function tn() {
|
|
|
131
131
|
props: o
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
return
|
|
134
|
+
return Z.Fragment = t, Z.jsx = n, Z.jsxs = n, Z;
|
|
135
135
|
}
|
|
136
|
-
var
|
|
136
|
+
var Q = {};
|
|
137
137
|
/**
|
|
138
138
|
* @license React
|
|
139
139
|
* react-jsx-runtime.development.js
|
|
@@ -160,9 +160,9 @@ function nn() {
|
|
|
160
160
|
return "StrictMode";
|
|
161
161
|
case g:
|
|
162
162
|
return "Suspense";
|
|
163
|
-
case
|
|
163
|
+
case x:
|
|
164
164
|
return "SuspenseList";
|
|
165
|
-
case
|
|
165
|
+
case j:
|
|
166
166
|
return "Activity";
|
|
167
167
|
}
|
|
168
168
|
if (typeof f == "object")
|
|
@@ -337,19 +337,19 @@ React keys must be passed directly to JSX without using spread:
|
|
|
337
337
|
function p(f) {
|
|
338
338
|
typeof f == "object" && f !== null && f.$$typeof === T && f._store && (f._store.validated = 1);
|
|
339
339
|
}
|
|
340
|
-
var
|
|
340
|
+
var y = Wt, T = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), A = Symbol.for("react.consumer"), E = Symbol.for("react.context"), O = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), x = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), j = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), H = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Ie = Object.prototype.hasOwnProperty, Mt = Array.isArray, ge = console.createTask ? console.createTask : function() {
|
|
341
341
|
return null;
|
|
342
342
|
};
|
|
343
|
-
|
|
343
|
+
y = {
|
|
344
344
|
"react-stack-bottom-frame": function(f) {
|
|
345
345
|
return f();
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
|
-
var $e, Me = {}, He =
|
|
349
|
-
|
|
348
|
+
var $e, Me = {}, He = y["react-stack-bottom-frame"].bind(
|
|
349
|
+
y,
|
|
350
350
|
o
|
|
351
351
|
)(), ze = ge(r(o)), Je = {};
|
|
352
|
-
|
|
352
|
+
Q.Fragment = R, Q.jsx = function(f, w, _, C, M) {
|
|
353
353
|
var q = 1e4 > H.recentlyCreatedOwnerStacks++;
|
|
354
354
|
return u(
|
|
355
355
|
f,
|
|
@@ -361,7 +361,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
361
361
|
q ? Error("react-stack-top-frame") : He,
|
|
362
362
|
q ? ge(r(f)) : ze
|
|
363
363
|
);
|
|
364
|
-
},
|
|
364
|
+
}, Q.jsxs = function(f, w, _, C, M) {
|
|
365
365
|
var q = 1e4 > H.recentlyCreatedOwnerStacks++;
|
|
366
366
|
return u(
|
|
367
367
|
f,
|
|
@@ -374,7 +374,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
374
374
|
q ? ge(r(f)) : ze
|
|
375
375
|
);
|
|
376
376
|
};
|
|
377
|
-
}()),
|
|
377
|
+
}()), Q;
|
|
378
378
|
}
|
|
379
379
|
var Ke;
|
|
380
380
|
function rn() {
|
|
@@ -428,7 +428,7 @@ function ln(e, ...t) {
|
|
|
428
428
|
]).join(";");
|
|
429
429
|
oe(e, n, ...t);
|
|
430
430
|
}
|
|
431
|
-
const
|
|
431
|
+
const v = {
|
|
432
432
|
primary: sn,
|
|
433
433
|
success: on,
|
|
434
434
|
info: an,
|
|
@@ -448,7 +448,7 @@ function Xe(e, t) {
|
|
|
448
448
|
isFalse: !0
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
|
-
class
|
|
451
|
+
class K extends Error {
|
|
452
452
|
constructor(n) {
|
|
453
453
|
super(n.message);
|
|
454
454
|
$(this, "code");
|
|
@@ -472,45 +472,47 @@ class te extends Error {
|
|
|
472
472
|
const Rt = ft({
|
|
473
473
|
lastUpdateTimestamp: 0,
|
|
474
474
|
isAuth: !1,
|
|
475
|
-
getTokens: () => (
|
|
476
|
-
updateTokens: () =>
|
|
477
|
-
forceLogout: () =>
|
|
475
|
+
getTokens: () => (v.warning("AuthStateContext", "getTokens not yet ready"), null),
|
|
476
|
+
updateTokens: () => v.warning("AuthStateContext", "updateTokens not yet ready"),
|
|
477
|
+
forceLogout: () => v.warning("AuthStateContext", "forceLogout not yet ready"),
|
|
478
478
|
refreshTokens: async () => {
|
|
479
|
-
|
|
479
|
+
v.warning("AuthStateContext", "refreshToken not yet ready");
|
|
480
480
|
}
|
|
481
481
|
}), un = () => Vt(Rt), Yr = ({
|
|
482
482
|
children: e,
|
|
483
483
|
onGetTokens: t,
|
|
484
484
|
onSetTokens: n,
|
|
485
485
|
onRefreshTokens: r,
|
|
486
|
-
onForceLogout: s
|
|
486
|
+
onForceLogout: s,
|
|
487
|
+
isDebug: o = !1
|
|
487
488
|
}) => {
|
|
488
|
-
const [
|
|
489
|
-
let
|
|
490
|
-
typeof
|
|
491
|
-
},
|
|
492
|
-
|
|
493
|
-
},
|
|
494
|
-
var
|
|
495
|
-
const
|
|
496
|
-
if (!
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
489
|
+
const [i, c] = We(0), [d, l] = We(() => Xe(t())), u = (T) => {
|
|
490
|
+
let h;
|
|
491
|
+
typeof T == "function" ? h = T(t()) : h = T, n(h), l(Xe(h)), c(Date.now());
|
|
492
|
+
}, p = () => {
|
|
493
|
+
u(null), s && s();
|
|
494
|
+
}, y = async () => {
|
|
495
|
+
var h;
|
|
496
|
+
const T = (h = t()) == null ? void 0 : h.refreshToken;
|
|
497
|
+
if (!T || !r)
|
|
498
|
+
throw o && v.danger("[AuthStateProvider] handleOnRefreshTokens", "refreshToken|onRefreshTokens empty"), new K({ message: "refreshToken|onRefreshTokens empty", code: "REFRESH_TOKEN_EMPTY" });
|
|
499
|
+
try {
|
|
500
|
+
const R = await r(T);
|
|
501
|
+
if (Ue(R))
|
|
502
|
+
throw o && v.danger("[AuthStateProvider] handleOnRefreshTokens", "new refresh token fail"), new K({ message: "new refresh token fail", code: "NEW_REFRESH_TOKEN_EMPTY" });
|
|
503
|
+
u(R);
|
|
504
|
+
return;
|
|
505
|
+
} catch {
|
|
506
|
+
throw p(), new K({ message: "refresh token fail", code: "REFRESH_TOKEN_CATCH" });
|
|
507
|
+
}
|
|
506
508
|
};
|
|
507
509
|
return /* @__PURE__ */ mt.jsx(Rt.Provider, { value: {
|
|
508
|
-
lastUpdateTimestamp:
|
|
509
|
-
isAuth:
|
|
510
|
+
lastUpdateTimestamp: i,
|
|
511
|
+
isAuth: d,
|
|
510
512
|
getTokens: t,
|
|
511
|
-
updateTokens:
|
|
512
|
-
refreshTokens:
|
|
513
|
-
forceLogout:
|
|
513
|
+
updateTokens: u,
|
|
514
|
+
refreshTokens: y,
|
|
515
|
+
forceLogout: p
|
|
514
516
|
}, children: e });
|
|
515
517
|
}, Ge = {
|
|
516
518
|
"en-US": {
|
|
@@ -593,7 +595,7 @@ const Kr = (e) => {
|
|
|
593
595
|
message: "Axios error",
|
|
594
596
|
code: "ERR_SYS_BAD_RESPONSE"
|
|
595
597
|
};
|
|
596
|
-
let
|
|
598
|
+
let ee = !1, _e = [];
|
|
597
599
|
const pn = ft(null), Xr = ({
|
|
598
600
|
children: e,
|
|
599
601
|
axiosInstance: t,
|
|
@@ -609,57 +611,57 @@ const pn = ft(null), Xr = ({
|
|
|
609
611
|
getTokens: l,
|
|
610
612
|
updateTokens: u,
|
|
611
613
|
refreshTokens: p,
|
|
612
|
-
forceLogout:
|
|
614
|
+
forceLogout: y
|
|
613
615
|
} = un();
|
|
614
616
|
Yt(() => {
|
|
615
617
|
const E = t.interceptors.request.use(R), O = t.interceptors.response.use(m, A);
|
|
616
618
|
return () => {
|
|
617
619
|
t.interceptors.request.eject(E), t.interceptors.response.eject(O);
|
|
618
620
|
};
|
|
619
|
-
}, [l, p, u,
|
|
621
|
+
}, [l, p, u, y]);
|
|
620
622
|
const T = (E) => {
|
|
621
|
-
d &&
|
|
623
|
+
d && v.warning("[FetcherProvider] runPendingRequest", { isSuccess: E }), ee = !1;
|
|
622
624
|
for (const O of _e)
|
|
623
625
|
O(E);
|
|
624
626
|
_e = [];
|
|
625
627
|
}, h = (E, O) => (g) => {
|
|
626
|
-
d &&
|
|
627
|
-
|
|
628
|
+
d && v.info("[FetcherProvider] Request add pending queue", { originConfig: g }), _e.push((x) => {
|
|
629
|
+
x ? (g.pendingRequest = !0, E(t(g))) : O(new K({
|
|
628
630
|
message: S(401),
|
|
629
631
|
code: "UNAUTHORIZED",
|
|
630
632
|
path: "AxiosClientProvider.pushPendingRequestQueues"
|
|
631
633
|
}));
|
|
632
634
|
});
|
|
633
635
|
}, R = (E) => new Promise((O, g) => {
|
|
634
|
-
var
|
|
636
|
+
var j, V;
|
|
635
637
|
E.headers["Accept-Language"] = n;
|
|
636
|
-
const
|
|
637
|
-
if (!((V = E.fetchOptions) == null ? void 0 : V.forceGuest) &&
|
|
638
|
+
const x = (j = l()) == null ? void 0 : j.accessToken;
|
|
639
|
+
if (!((V = E.fetchOptions) == null ? void 0 : V.forceGuest) && x && (E.headers.Authorization = [i, x].filter((H) => H).join(" ")), !(E && o ? o(E) : !1) && ee) {
|
|
638
640
|
h(O, g)(E), g(new fn({
|
|
639
641
|
message: "Token refreshing, so request save queues not send",
|
|
640
|
-
code: "
|
|
642
|
+
code: "REFRESHING_TOKEN"
|
|
641
643
|
}));
|
|
642
644
|
return;
|
|
643
645
|
}
|
|
644
646
|
O(E);
|
|
645
|
-
}), m = (E) => (d &&
|
|
647
|
+
}), m = (E) => (d && v.info("[FetcherProvider] interceptorsResponseSuccess", { response: E }), E), S = (E) => {
|
|
646
648
|
const O = (c == null ? void 0 : c[n]) || Ge[n] || Ge["en-US"];
|
|
647
649
|
return (O == null ? void 0 : O[E]) || `Error: ${E}`;
|
|
648
650
|
}, A = (E) => {
|
|
649
|
-
const O = E.response, g = E.config,
|
|
650
|
-
d &&
|
|
651
|
+
const O = E.response, g = E.config, x = E.status, N = r(O);
|
|
652
|
+
d && v.warning("[FetcherProvider] interceptorsResponseError", { status: x, responseFirstError: N }), s && s(N);
|
|
651
653
|
const B = g && o ? o(g) : !1;
|
|
652
|
-
if (O && g && (
|
|
653
|
-
const
|
|
654
|
-
return d &&
|
|
655
|
-
d &&
|
|
654
|
+
if (O && g && (x === 401 || N.code === "UNAUTHENTICATED")) {
|
|
655
|
+
const j = l();
|
|
656
|
+
return d && v.warning("[FetcherProvider] enter refresh token flow", { refreshToken: j == null ? void 0 : j.refreshToken }), Ue(j == null ? void 0 : j.refreshToken) || B || g.pendingRequest ? (ee = !1, d && v.warning("[FetcherProvider] no refreshToken/refreshAPI|pendingRequest fail, force logout"), y(), Promise.reject(new K(N))) : (ee || (ee = !0, d && v.warning("[FetcherProvider] refreshTokens"), p().then(() => {
|
|
657
|
+
d && v.info("[FetcherProvider] refreshTokens success"), T(!0);
|
|
656
658
|
}).catch(() => {
|
|
657
|
-
d &&
|
|
659
|
+
d && v.danger("[FetcherProvider] refreshTokens fail"), T(!1);
|
|
658
660
|
})), new Promise((V, H) => {
|
|
659
661
|
h(V, H)(g);
|
|
660
662
|
}));
|
|
661
663
|
}
|
|
662
|
-
return Promise.reject(new
|
|
664
|
+
return Promise.reject(new K(N));
|
|
663
665
|
};
|
|
664
666
|
return /* @__PURE__ */ mt.jsx(
|
|
665
667
|
pn.Provider,
|
|
@@ -677,30 +679,30 @@ function Et(e, t) {
|
|
|
677
679
|
const { toString: hn } = Object.prototype, { getPrototypeOf: De } = Object, { iterator: me, toStringTag: bt } = Symbol, Re = /* @__PURE__ */ ((e) => (t) => {
|
|
678
680
|
const n = hn.call(t);
|
|
679
681
|
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
680
|
-
})(/* @__PURE__ */ Object.create(null)), D = (e) => (e = e.toLowerCase(), (t) => Re(t) === e), Ee = (e) => (t) => typeof t === e, { isArray:
|
|
682
|
+
})(/* @__PURE__ */ Object.create(null)), D = (e) => (e = e.toLowerCase(), (t) => Re(t) === e), Ee = (e) => (t) => typeof t === e, { isArray: X } = Array, ne = Ee("undefined");
|
|
681
683
|
function mn(e) {
|
|
682
|
-
return e !== null && !ne(e) && e.constructor !== null && !ne(e.constructor) &&
|
|
684
|
+
return e !== null && !ne(e) && e.constructor !== null && !ne(e.constructor) && L(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
683
685
|
}
|
|
684
686
|
const yt = D("ArrayBuffer");
|
|
685
687
|
function Rn(e) {
|
|
686
688
|
let t;
|
|
687
689
|
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && yt(e.buffer), t;
|
|
688
690
|
}
|
|
689
|
-
const En = Ee("string"),
|
|
691
|
+
const En = Ee("string"), L = Ee("function"), wt = Ee("number"), be = (e) => e !== null && typeof e == "object", bn = (e) => e === !0 || e === !1, le = (e) => {
|
|
690
692
|
if (Re(e) !== "object")
|
|
691
693
|
return !1;
|
|
692
694
|
const t = De(e);
|
|
693
695
|
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(bt in e) && !(me in e);
|
|
694
|
-
}, yn = D("Date"), wn = D("File"), Tn = D("Blob"), gn = D("FileList"), Sn = (e) => be(e) &&
|
|
696
|
+
}, yn = D("Date"), wn = D("File"), Tn = D("Blob"), gn = D("FileList"), Sn = (e) => be(e) && L(e.pipe), On = (e) => {
|
|
695
697
|
let t;
|
|
696
|
-
return e && (typeof FormData == "function" && e instanceof FormData ||
|
|
697
|
-
t === "object" &&
|
|
698
|
-
}, An = D("URLSearchParams"), [_n,
|
|
698
|
+
return e && (typeof FormData == "function" && e instanceof FormData || L(e.append) && ((t = Re(e)) === "formdata" || // detect form-data instance
|
|
699
|
+
t === "object" && L(e.toString) && e.toString() === "[object FormData]"));
|
|
700
|
+
}, An = D("URLSearchParams"), [_n, Pn, xn, Nn] = ["ReadableStream", "Request", "Response", "Headers"].map(D), Cn = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
699
701
|
function ie(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
700
702
|
if (e === null || typeof e > "u")
|
|
701
703
|
return;
|
|
702
704
|
let r, s;
|
|
703
|
-
if (typeof e != "object" && (e = [e]),
|
|
705
|
+
if (typeof e != "object" && (e = [e]), X(e))
|
|
704
706
|
for (r = 0, s = e.length; r < s; r++)
|
|
705
707
|
t.call(null, e[r], r, e);
|
|
706
708
|
else {
|
|
@@ -723,14 +725,14 @@ const z = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : type
|
|
|
723
725
|
function Ce() {
|
|
724
726
|
const { caseless: e } = gt(this) && this || {}, t = {}, n = (r, s) => {
|
|
725
727
|
const o = e && Tt(t, s) || s;
|
|
726
|
-
le(t[o]) && le(r) ? t[o] = Ce(t[o], r) : le(r) ? t[o] = Ce({}, r) :
|
|
728
|
+
le(t[o]) && le(r) ? t[o] = Ce(t[o], r) : le(r) ? t[o] = Ce({}, r) : X(r) ? t[o] = r.slice() : t[o] = r;
|
|
727
729
|
};
|
|
728
730
|
for (let r = 0, s = arguments.length; r < s; r++)
|
|
729
731
|
arguments[r] && ie(arguments[r], n);
|
|
730
732
|
return t;
|
|
731
733
|
}
|
|
732
734
|
const kn = (e, t, n, { allOwnKeys: r } = {}) => (ie(t, (s, o) => {
|
|
733
|
-
n &&
|
|
735
|
+
n && L(s) ? e[o] = Et(s, n) : e[o] = s;
|
|
734
736
|
}, { allOwnKeys: r }), e), Fn = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), vn = (e, t, n, r) => {
|
|
735
737
|
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
736
738
|
value: t.prototype
|
|
@@ -751,7 +753,7 @@ const kn = (e, t, n, { allOwnKeys: r } = {}) => (ie(t, (s, o) => {
|
|
|
751
753
|
return r !== -1 && r === n;
|
|
752
754
|
}, Un = (e) => {
|
|
753
755
|
if (!e) return null;
|
|
754
|
-
if (
|
|
756
|
+
if (X(e)) return e;
|
|
755
757
|
let t = e.length;
|
|
756
758
|
if (!wt(t)) return null;
|
|
757
759
|
const n = new Array(t);
|
|
@@ -784,10 +786,10 @@ const kn = (e, t, n, { allOwnKeys: r } = {}) => (ie(t, (s, o) => {
|
|
|
784
786
|
}), Object.defineProperties(e, r);
|
|
785
787
|
}, Hn = (e) => {
|
|
786
788
|
St(e, (t, n) => {
|
|
787
|
-
if (
|
|
789
|
+
if (L(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
788
790
|
return !1;
|
|
789
791
|
const r = e[n];
|
|
790
|
-
if (
|
|
792
|
+
if (L(r)) {
|
|
791
793
|
if (t.enumerable = !1, "writable" in t) {
|
|
792
794
|
t.writable = !1;
|
|
793
795
|
return;
|
|
@@ -803,11 +805,11 @@ const kn = (e, t, n, { allOwnKeys: r } = {}) => (ie(t, (s, o) => {
|
|
|
803
805
|
n[o] = !0;
|
|
804
806
|
});
|
|
805
807
|
};
|
|
806
|
-
return
|
|
808
|
+
return X(e) ? r(e) : r(String(e).split(t)), n;
|
|
807
809
|
}, Jn = () => {
|
|
808
810
|
}, Wn = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
809
811
|
function Vn(e) {
|
|
810
|
-
return !!(e &&
|
|
812
|
+
return !!(e && L(e.append) && e[bt] === "FormData" && e[me]);
|
|
811
813
|
}
|
|
812
814
|
const Yn = (e) => {
|
|
813
815
|
const t = new Array(10), n = (r, s) => {
|
|
@@ -816,7 +818,7 @@ const Yn = (e) => {
|
|
|
816
818
|
return;
|
|
817
819
|
if (!("toJSON" in r)) {
|
|
818
820
|
t[s] = r;
|
|
819
|
-
const o =
|
|
821
|
+
const o = X(r) ? [] : {};
|
|
820
822
|
return ie(r, (i, c) => {
|
|
821
823
|
const d = n(i, s + 1);
|
|
822
824
|
!ne(d) && (o[c] = d);
|
|
@@ -826,15 +828,15 @@ const Yn = (e) => {
|
|
|
826
828
|
return r;
|
|
827
829
|
};
|
|
828
830
|
return n(e, 0);
|
|
829
|
-
}, Kn = D("AsyncFunction"), Xn = (e) => e && (be(e) ||
|
|
831
|
+
}, Kn = D("AsyncFunction"), Xn = (e) => e && (be(e) || L(e)) && L(e.then) && L(e.catch), Ot = ((e, t) => e ? setImmediate : t ? ((n, r) => (z.addEventListener("message", ({ source: s, data: o }) => {
|
|
830
832
|
s === z && o === n && r.length && r.shift()();
|
|
831
833
|
}, !1), (s) => {
|
|
832
834
|
r.push(s), z.postMessage(n, "*");
|
|
833
835
|
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
834
836
|
typeof setImmediate == "function",
|
|
835
|
-
|
|
836
|
-
), Gn = typeof queueMicrotask < "u" ? queueMicrotask.bind(z) : typeof process < "u" && process.nextTick || Ot, Zn = (e) => e != null &&
|
|
837
|
-
isArray:
|
|
837
|
+
L(z.postMessage)
|
|
838
|
+
), Gn = typeof queueMicrotask < "u" ? queueMicrotask.bind(z) : typeof process < "u" && process.nextTick || Ot, Zn = (e) => e != null && L(e[me]), a = {
|
|
839
|
+
isArray: X,
|
|
838
840
|
isArrayBuffer: yt,
|
|
839
841
|
isBuffer: mn,
|
|
840
842
|
isFormData: On,
|
|
@@ -845,15 +847,15 @@ const Yn = (e) => {
|
|
|
845
847
|
isObject: be,
|
|
846
848
|
isPlainObject: le,
|
|
847
849
|
isReadableStream: _n,
|
|
848
|
-
isRequest:
|
|
849
|
-
isResponse:
|
|
850
|
+
isRequest: Pn,
|
|
851
|
+
isResponse: xn,
|
|
850
852
|
isHeaders: Nn,
|
|
851
853
|
isUndefined: ne,
|
|
852
854
|
isDate: yn,
|
|
853
855
|
isFile: wn,
|
|
854
856
|
isBlob: Tn,
|
|
855
857
|
isRegExp: Mn,
|
|
856
|
-
isFunction:
|
|
858
|
+
isFunction: L,
|
|
857
859
|
isStream: Sn,
|
|
858
860
|
isURLSearchParams: An,
|
|
859
861
|
isTypedArray: Dn,
|
|
@@ -892,10 +894,10 @@ const Yn = (e) => {
|
|
|
892
894
|
asap: Gn,
|
|
893
895
|
isIterable: Zn
|
|
894
896
|
};
|
|
895
|
-
function
|
|
897
|
+
function b(e, t, n, r, s) {
|
|
896
898
|
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), s && (this.response = s, this.status = s.status ? s.status : null);
|
|
897
899
|
}
|
|
898
|
-
a.inherits(
|
|
900
|
+
a.inherits(b, Error, {
|
|
899
901
|
toJSON: function() {
|
|
900
902
|
return {
|
|
901
903
|
// Standard
|
|
@@ -916,7 +918,7 @@ a.inherits(y, Error, {
|
|
|
916
918
|
};
|
|
917
919
|
}
|
|
918
920
|
});
|
|
919
|
-
const At =
|
|
921
|
+
const At = b.prototype, _t = {};
|
|
920
922
|
[
|
|
921
923
|
"ERR_BAD_OPTION_VALUE",
|
|
922
924
|
"ERR_BAD_OPTION",
|
|
@@ -934,24 +936,24 @@ const At = y.prototype, _t = {};
|
|
|
934
936
|
].forEach((e) => {
|
|
935
937
|
_t[e] = { value: e };
|
|
936
938
|
});
|
|
937
|
-
Object.defineProperties(
|
|
939
|
+
Object.defineProperties(b, _t);
|
|
938
940
|
Object.defineProperty(At, "isAxiosError", { value: !0 });
|
|
939
|
-
|
|
941
|
+
b.from = (e, t, n, r, s, o) => {
|
|
940
942
|
const i = Object.create(At);
|
|
941
943
|
return a.toFlatObject(e, i, function(d) {
|
|
942
944
|
return d !== Error.prototype;
|
|
943
|
-
}, (c) => c !== "isAxiosError"),
|
|
945
|
+
}, (c) => c !== "isAxiosError"), b.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
|
|
944
946
|
};
|
|
945
947
|
const Qn = null;
|
|
946
948
|
function ke(e) {
|
|
947
949
|
return a.isPlainObject(e) || a.isArray(e);
|
|
948
950
|
}
|
|
949
|
-
function
|
|
951
|
+
function Pt(e) {
|
|
950
952
|
return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
951
953
|
}
|
|
952
954
|
function Qe(e, t, n) {
|
|
953
955
|
return e ? e.concat(t).map(function(s, o) {
|
|
954
|
-
return s =
|
|
956
|
+
return s = Pt(s), !n && o ? "[" + s + "]" : s;
|
|
955
957
|
}).join(n ? "." : "") : t;
|
|
956
958
|
}
|
|
957
959
|
function er(e) {
|
|
@@ -978,7 +980,7 @@ function ye(e, t, n) {
|
|
|
978
980
|
if (a.isDate(h))
|
|
979
981
|
return h.toISOString();
|
|
980
982
|
if (!d && a.isBlob(h))
|
|
981
|
-
throw new
|
|
983
|
+
throw new b("Blob is not supported. Use a Buffer instead.");
|
|
982
984
|
return a.isArrayBuffer(h) || a.isTypedArray(h) ? d && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
|
|
983
985
|
}
|
|
984
986
|
function u(h, R, m) {
|
|
@@ -987,7 +989,7 @@ function ye(e, t, n) {
|
|
|
987
989
|
if (a.endsWith(R, "{}"))
|
|
988
990
|
R = r ? R : R.slice(0, -2), h = JSON.stringify(h);
|
|
989
991
|
else if (a.isArray(h) && er(h) || (a.isFileList(h) || a.endsWith(R, "[]")) && (S = a.toArray(h)))
|
|
990
|
-
return R =
|
|
992
|
+
return R = Pt(R), S.forEach(function(E, O) {
|
|
991
993
|
!(a.isUndefined(E) || E === null) && t.append(
|
|
992
994
|
// eslint-disable-next-line no-nested-ternary
|
|
993
995
|
i === !0 ? Qe([R], O, o) : i === null ? R : R + "[]",
|
|
@@ -997,7 +999,7 @@ function ye(e, t, n) {
|
|
|
997
999
|
}
|
|
998
1000
|
return ke(h) ? !0 : (t.append(Qe(m, R, o), l(h)), !1);
|
|
999
1001
|
}
|
|
1000
|
-
const p = [],
|
|
1002
|
+
const p = [], y = Object.assign(tr, {
|
|
1001
1003
|
defaultVisitor: u,
|
|
1002
1004
|
convertValue: l,
|
|
1003
1005
|
isVisitable: ke
|
|
@@ -1012,7 +1014,7 @@ function ye(e, t, n) {
|
|
|
1012
1014
|
S,
|
|
1013
1015
|
a.isString(A) ? A.trim() : A,
|
|
1014
1016
|
R,
|
|
1015
|
-
|
|
1017
|
+
y
|
|
1016
1018
|
)) === !0 && T(S, R ? R.concat(A) : [A]);
|
|
1017
1019
|
}), p.pop();
|
|
1018
1020
|
}
|
|
@@ -1038,11 +1040,11 @@ function et(e) {
|
|
|
1038
1040
|
function Be(e, t) {
|
|
1039
1041
|
this._pairs = [], e && ye(e, this, t);
|
|
1040
1042
|
}
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
+
const xt = Be.prototype;
|
|
1044
|
+
xt.append = function(t, n) {
|
|
1043
1045
|
this._pairs.push([t, n]);
|
|
1044
1046
|
};
|
|
1045
|
-
|
|
1047
|
+
xt.toString = function(t) {
|
|
1046
1048
|
const n = t ? function(r) {
|
|
1047
1049
|
return t.call(this, r, et);
|
|
1048
1050
|
} : et;
|
|
@@ -1228,7 +1230,7 @@ const ae = {
|
|
|
1228
1230
|
return JSON.parse(t);
|
|
1229
1231
|
} catch (c) {
|
|
1230
1232
|
if (i)
|
|
1231
|
-
throw c.name === "SyntaxError" ?
|
|
1233
|
+
throw c.name === "SyntaxError" ? b.from(c, b.ERR_BAD_RESPONSE, this, null, this.response) : c;
|
|
1232
1234
|
}
|
|
1233
1235
|
}
|
|
1234
1236
|
return t;
|
|
@@ -1285,7 +1287,7 @@ const mr = a.toObjectSet([
|
|
|
1285
1287
|
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && mr[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
1286
1288
|
}), t;
|
|
1287
1289
|
}, nt = Symbol("internals");
|
|
1288
|
-
function
|
|
1290
|
+
function te(e) {
|
|
1289
1291
|
return e && String(e).trim().toLowerCase();
|
|
1290
1292
|
}
|
|
1291
1293
|
function ue(e) {
|
|
@@ -1299,7 +1301,7 @@ function Er(e) {
|
|
|
1299
1301
|
return t;
|
|
1300
1302
|
}
|
|
1301
1303
|
const br = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
1302
|
-
function
|
|
1304
|
+
function Pe(e, t, n, r, s) {
|
|
1303
1305
|
if (a.isFunction(r))
|
|
1304
1306
|
return r.call(this, t, n);
|
|
1305
1307
|
if (s && (t = n), !!a.isString(t)) {
|
|
@@ -1323,14 +1325,14 @@ function wr(e, t) {
|
|
|
1323
1325
|
});
|
|
1324
1326
|
});
|
|
1325
1327
|
}
|
|
1326
|
-
let
|
|
1328
|
+
let U = class {
|
|
1327
1329
|
constructor(t) {
|
|
1328
1330
|
t && this.set(t);
|
|
1329
1331
|
}
|
|
1330
1332
|
set(t, n, r) {
|
|
1331
1333
|
const s = this;
|
|
1332
1334
|
function o(c, d, l) {
|
|
1333
|
-
const u =
|
|
1335
|
+
const u = te(d);
|
|
1334
1336
|
if (!u)
|
|
1335
1337
|
throw new Error("header name must be a non-empty string");
|
|
1336
1338
|
const p = a.findKey(s, u);
|
|
@@ -1354,7 +1356,7 @@ let L = class {
|
|
|
1354
1356
|
return this;
|
|
1355
1357
|
}
|
|
1356
1358
|
get(t, n) {
|
|
1357
|
-
if (t =
|
|
1359
|
+
if (t = te(t), t) {
|
|
1358
1360
|
const r = a.findKey(this, t);
|
|
1359
1361
|
if (r) {
|
|
1360
1362
|
const s = this[r];
|
|
@@ -1371,9 +1373,9 @@ let L = class {
|
|
|
1371
1373
|
}
|
|
1372
1374
|
}
|
|
1373
1375
|
has(t, n) {
|
|
1374
|
-
if (t =
|
|
1376
|
+
if (t = te(t), t) {
|
|
1375
1377
|
const r = a.findKey(this, t);
|
|
1376
|
-
return !!(r && this[r] !== void 0 && (!n ||
|
|
1378
|
+
return !!(r && this[r] !== void 0 && (!n || Pe(this, this[r], r, n)));
|
|
1377
1379
|
}
|
|
1378
1380
|
return !1;
|
|
1379
1381
|
}
|
|
@@ -1381,9 +1383,9 @@ let L = class {
|
|
|
1381
1383
|
const r = this;
|
|
1382
1384
|
let s = !1;
|
|
1383
1385
|
function o(i) {
|
|
1384
|
-
if (i =
|
|
1386
|
+
if (i = te(i), i) {
|
|
1385
1387
|
const c = a.findKey(r, i);
|
|
1386
|
-
c && (!n ||
|
|
1388
|
+
c && (!n || Pe(r, r[c], c, n)) && (delete r[c], s = !0);
|
|
1387
1389
|
}
|
|
1388
1390
|
}
|
|
1389
1391
|
return a.isArray(t) ? t.forEach(o) : o(t), s;
|
|
@@ -1393,7 +1395,7 @@ let L = class {
|
|
|
1393
1395
|
let r = n.length, s = !1;
|
|
1394
1396
|
for (; r--; ) {
|
|
1395
1397
|
const o = n[r];
|
|
1396
|
-
(!t ||
|
|
1398
|
+
(!t || Pe(this, this[o], o, t, !0)) && (delete this[o], s = !0);
|
|
1397
1399
|
}
|
|
1398
1400
|
return s;
|
|
1399
1401
|
}
|
|
@@ -1443,14 +1445,14 @@ let L = class {
|
|
|
1443
1445
|
accessors: {}
|
|
1444
1446
|
}).accessors, s = this.prototype;
|
|
1445
1447
|
function o(i) {
|
|
1446
|
-
const c =
|
|
1448
|
+
const c = te(i);
|
|
1447
1449
|
r[c] || (wr(s, i), r[c] = !0);
|
|
1448
1450
|
}
|
|
1449
1451
|
return a.isArray(t) ? t.forEach(o) : o(t), this;
|
|
1450
1452
|
}
|
|
1451
1453
|
};
|
|
1452
|
-
|
|
1453
|
-
a.reduceDescriptors(
|
|
1454
|
+
U.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1455
|
+
a.reduceDescriptors(U.prototype, ({ value: e }, t) => {
|
|
1454
1456
|
let n = t[0].toUpperCase() + t.slice(1);
|
|
1455
1457
|
return {
|
|
1456
1458
|
get: () => e,
|
|
@@ -1459,9 +1461,9 @@ a.reduceDescriptors(L.prototype, ({ value: e }, t) => {
|
|
|
1459
1461
|
}
|
|
1460
1462
|
};
|
|
1461
1463
|
});
|
|
1462
|
-
a.freezeMethods(
|
|
1463
|
-
function
|
|
1464
|
-
const n = this || ae, r = t || n, s =
|
|
1464
|
+
a.freezeMethods(U);
|
|
1465
|
+
function xe(e, t) {
|
|
1466
|
+
const n = this || ae, r = t || n, s = U.from(r.headers);
|
|
1465
1467
|
let o = r.data;
|
|
1466
1468
|
return a.forEach(e, function(c) {
|
|
1467
1469
|
o = c.call(n, o, s.normalize(), t ? t.status : void 0);
|
|
@@ -1470,17 +1472,17 @@ function Pe(e, t) {
|
|
|
1470
1472
|
function Ft(e) {
|
|
1471
1473
|
return !!(e && e.__CANCEL__);
|
|
1472
1474
|
}
|
|
1473
|
-
function
|
|
1474
|
-
|
|
1475
|
+
function G(e, t, n) {
|
|
1476
|
+
b.call(this, e ?? "canceled", b.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
1475
1477
|
}
|
|
1476
|
-
a.inherits(
|
|
1478
|
+
a.inherits(G, b, {
|
|
1477
1479
|
__CANCEL__: !0
|
|
1478
1480
|
});
|
|
1479
1481
|
function vt(e, t, n) {
|
|
1480
1482
|
const r = n.config.validateStatus;
|
|
1481
|
-
!n.status || !r || r(n.status) ? e(n) : t(new
|
|
1483
|
+
!n.status || !r || r(n.status) ? e(n) : t(new b(
|
|
1482
1484
|
"Request failed with status code " + n.status,
|
|
1483
|
-
[
|
|
1485
|
+
[b.ERR_BAD_REQUEST, b.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
|
|
1484
1486
|
n.config,
|
|
1485
1487
|
n.request,
|
|
1486
1488
|
n
|
|
@@ -1497,13 +1499,13 @@ function gr(e, t) {
|
|
|
1497
1499
|
return t = t !== void 0 ? t : 1e3, function(d) {
|
|
1498
1500
|
const l = Date.now(), u = r[o];
|
|
1499
1501
|
i || (i = l), n[s] = d, r[s] = l;
|
|
1500
|
-
let p = o,
|
|
1502
|
+
let p = o, y = 0;
|
|
1501
1503
|
for (; p !== s; )
|
|
1502
|
-
|
|
1504
|
+
y += n[p++], p = p % e;
|
|
1503
1505
|
if (s = (s + 1) % e, s === o && (o = (o + 1) % e), l - i < t)
|
|
1504
1506
|
return;
|
|
1505
1507
|
const T = u && l - u;
|
|
1506
|
-
return T ? Math.round(
|
|
1508
|
+
return T ? Math.round(y * 1e3 / T) : void 0;
|
|
1507
1509
|
};
|
|
1508
1510
|
}
|
|
1509
1511
|
function Sr(e, t) {
|
|
@@ -1577,25 +1579,25 @@ const pe = (e, t, n = 3) => {
|
|
|
1577
1579
|
function _r(e) {
|
|
1578
1580
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
1579
1581
|
}
|
|
1580
|
-
function
|
|
1582
|
+
function Pr(e, t) {
|
|
1581
1583
|
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
1582
1584
|
}
|
|
1583
1585
|
function jt(e, t, n) {
|
|
1584
1586
|
let r = !_r(t);
|
|
1585
|
-
return e && (r || n == !1) ?
|
|
1587
|
+
return e && (r || n == !1) ? Pr(e, t) : t;
|
|
1586
1588
|
}
|
|
1587
|
-
const ot = (e) => e instanceof
|
|
1589
|
+
const ot = (e) => e instanceof U ? { ...e } : e;
|
|
1588
1590
|
function W(e, t) {
|
|
1589
1591
|
t = t || {};
|
|
1590
1592
|
const n = {};
|
|
1591
|
-
function r(l, u, p,
|
|
1592
|
-
return a.isPlainObject(l) && a.isPlainObject(u) ? a.merge.call({ caseless:
|
|
1593
|
+
function r(l, u, p, y) {
|
|
1594
|
+
return a.isPlainObject(l) && a.isPlainObject(u) ? a.merge.call({ caseless: y }, l, u) : a.isPlainObject(u) ? a.merge({}, u) : a.isArray(u) ? u.slice() : u;
|
|
1593
1595
|
}
|
|
1594
|
-
function s(l, u, p,
|
|
1596
|
+
function s(l, u, p, y) {
|
|
1595
1597
|
if (a.isUndefined(u)) {
|
|
1596
1598
|
if (!a.isUndefined(l))
|
|
1597
|
-
return r(void 0, l, p,
|
|
1598
|
-
} else return r(l, u, p,
|
|
1599
|
+
return r(void 0, l, p, y);
|
|
1600
|
+
} else return r(l, u, p, y);
|
|
1599
1601
|
}
|
|
1600
1602
|
function o(l, u) {
|
|
1601
1603
|
if (!a.isUndefined(u))
|
|
@@ -1645,14 +1647,14 @@ function W(e, t) {
|
|
|
1645
1647
|
headers: (l, u, p) => s(ot(l), ot(u), p, !0)
|
|
1646
1648
|
};
|
|
1647
1649
|
return a.forEach(Object.keys(Object.assign({}, e, t)), function(u) {
|
|
1648
|
-
const p = d[u] || s,
|
|
1649
|
-
a.isUndefined(
|
|
1650
|
+
const p = d[u] || s, y = p(e[u], t[u], u);
|
|
1651
|
+
a.isUndefined(y) && p !== c || (n[u] = y);
|
|
1650
1652
|
}), n;
|
|
1651
1653
|
}
|
|
1652
1654
|
const Lt = (e) => {
|
|
1653
1655
|
const t = W({}, e);
|
|
1654
1656
|
let { data: n, withXSRFToken: r, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: c } = t;
|
|
1655
|
-
t.headers = i =
|
|
1657
|
+
t.headers = i = U.from(i), t.url = Nt(jt(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), c && i.set(
|
|
1656
1658
|
"Authorization",
|
|
1657
1659
|
"Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
|
|
1658
1660
|
);
|
|
@@ -1670,12 +1672,12 @@ const Lt = (e) => {
|
|
|
1670
1672
|
l && i.set(s, l);
|
|
1671
1673
|
}
|
|
1672
1674
|
return t;
|
|
1673
|
-
},
|
|
1675
|
+
}, xr = typeof XMLHttpRequest < "u", Nr = xr && function(e) {
|
|
1674
1676
|
return new Promise(function(n, r) {
|
|
1675
1677
|
const s = Lt(e);
|
|
1676
1678
|
let o = s.data;
|
|
1677
|
-
const i =
|
|
1678
|
-
let { responseType: c, onUploadProgress: d, onDownloadProgress: l } = s, u, p,
|
|
1679
|
+
const i = U.from(s.headers).normalize();
|
|
1680
|
+
let { responseType: c, onUploadProgress: d, onDownloadProgress: l } = s, u, p, y, T, h;
|
|
1679
1681
|
function R() {
|
|
1680
1682
|
T && T(), h && h(), s.cancelToken && s.cancelToken.unsubscribe(u), s.signal && s.signal.removeEventListener("abort", u);
|
|
1681
1683
|
}
|
|
@@ -1684,7 +1686,7 @@ const Lt = (e) => {
|
|
|
1684
1686
|
function S() {
|
|
1685
1687
|
if (!m)
|
|
1686
1688
|
return;
|
|
1687
|
-
const E =
|
|
1689
|
+
const E = U.from(
|
|
1688
1690
|
"getAllResponseHeaders" in m && m.getAllResponseHeaders()
|
|
1689
1691
|
), g = {
|
|
1690
1692
|
data: !c || c === "text" || c === "json" ? m.responseText : m.response,
|
|
@@ -1703,26 +1705,26 @@ const Lt = (e) => {
|
|
|
1703
1705
|
"onloadend" in m ? m.onloadend = S : m.onreadystatechange = function() {
|
|
1704
1706
|
!m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(S);
|
|
1705
1707
|
}, m.onabort = function() {
|
|
1706
|
-
m && (r(new
|
|
1708
|
+
m && (r(new b("Request aborted", b.ECONNABORTED, e, m)), m = null);
|
|
1707
1709
|
}, m.onerror = function() {
|
|
1708
|
-
r(new
|
|
1710
|
+
r(new b("Network Error", b.ERR_NETWORK, e, m)), m = null;
|
|
1709
1711
|
}, m.ontimeout = function() {
|
|
1710
1712
|
let O = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
1711
1713
|
const g = s.transitional || Ct;
|
|
1712
|
-
s.timeoutErrorMessage && (O = s.timeoutErrorMessage), r(new
|
|
1714
|
+
s.timeoutErrorMessage && (O = s.timeoutErrorMessage), r(new b(
|
|
1713
1715
|
O,
|
|
1714
|
-
g.clarifyTimeoutError ?
|
|
1716
|
+
g.clarifyTimeoutError ? b.ETIMEDOUT : b.ECONNABORTED,
|
|
1715
1717
|
e,
|
|
1716
1718
|
m
|
|
1717
1719
|
)), m = null;
|
|
1718
1720
|
}, o === void 0 && i.setContentType(null), "setRequestHeader" in m && a.forEach(i.toJSON(), function(O, g) {
|
|
1719
1721
|
m.setRequestHeader(g, O);
|
|
1720
|
-
}), a.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), c && c !== "json" && (m.responseType = s.responseType), l && ([
|
|
1721
|
-
m && (r(!E || E.type ? new
|
|
1722
|
+
}), a.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), c && c !== "json" && (m.responseType = s.responseType), l && ([y, h] = pe(l, !0), m.addEventListener("progress", y)), d && m.upload && ([p, T] = pe(d), m.upload.addEventListener("progress", p), m.upload.addEventListener("loadend", T)), (s.cancelToken || s.signal) && (u = (E) => {
|
|
1723
|
+
m && (r(!E || E.type ? new G(null, e, m) : E), m.abort(), m = null);
|
|
1722
1724
|
}, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
|
|
1723
1725
|
const A = Tr(s.url);
|
|
1724
1726
|
if (A && F.protocols.indexOf(A) === -1) {
|
|
1725
|
-
r(new
|
|
1727
|
+
r(new b("Unsupported protocol " + A + ":", b.ERR_BAD_REQUEST, e));
|
|
1726
1728
|
return;
|
|
1727
1729
|
}
|
|
1728
1730
|
m.send(o || null);
|
|
@@ -1735,11 +1737,11 @@ const Lt = (e) => {
|
|
|
1735
1737
|
if (!s) {
|
|
1736
1738
|
s = !0, c();
|
|
1737
1739
|
const u = l instanceof Error ? l : this.reason;
|
|
1738
|
-
r.abort(u instanceof
|
|
1740
|
+
r.abort(u instanceof b ? u : new G(u instanceof Error ? u.message : u));
|
|
1739
1741
|
}
|
|
1740
1742
|
};
|
|
1741
1743
|
let i = t && setTimeout(() => {
|
|
1742
|
-
i = null, o(new
|
|
1744
|
+
i = null, o(new b(`timeout ${t} of ms exceeded`, b.ETIMEDOUT));
|
|
1743
1745
|
}, t);
|
|
1744
1746
|
const c = () => {
|
|
1745
1747
|
e && (i && clearTimeout(i), i = null, e.forEach((l) => {
|
|
@@ -1793,8 +1795,8 @@ const Lt = (e) => {
|
|
|
1793
1795
|
}
|
|
1794
1796
|
let p = u.byteLength;
|
|
1795
1797
|
if (n) {
|
|
1796
|
-
let
|
|
1797
|
-
n(
|
|
1798
|
+
let y = o += p;
|
|
1799
|
+
n(y);
|
|
1798
1800
|
}
|
|
1799
1801
|
d.enqueue(new Uint8Array(u));
|
|
1800
1802
|
} catch (l) {
|
|
@@ -1829,7 +1831,7 @@ const Lt = (e) => {
|
|
|
1829
1831
|
we && ((e) => {
|
|
1830
1832
|
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
|
|
1831
1833
|
!he[t] && (he[t] = a.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
|
|
1832
|
-
throw new
|
|
1834
|
+
throw new b(`Response type '${t}' is not supported`, b.ERR_NOT_SUPPORT, r);
|
|
1833
1835
|
});
|
|
1834
1836
|
});
|
|
1835
1837
|
})(new Response());
|
|
@@ -1863,7 +1865,7 @@ const Ur = async (e) => {
|
|
|
1863
1865
|
responseType: l,
|
|
1864
1866
|
headers: u,
|
|
1865
1867
|
withCredentials: p = "same-origin",
|
|
1866
|
-
fetchOptions:
|
|
1868
|
+
fetchOptions: y
|
|
1867
1869
|
} = Lt(e);
|
|
1868
1870
|
l = l ? (l + "").toLowerCase() : "text";
|
|
1869
1871
|
let T = Cr([s, o && o.toAbortSignal()], i), h;
|
|
@@ -1877,8 +1879,8 @@ const Ur = async (e) => {
|
|
|
1877
1879
|
method: "POST",
|
|
1878
1880
|
body: r,
|
|
1879
1881
|
duplex: "half"
|
|
1880
|
-
}),
|
|
1881
|
-
if (a.isFormData(r) && (
|
|
1882
|
+
}), x;
|
|
1883
|
+
if (a.isFormData(r) && (x = g.headers.get("content-type")) && u.setContentType(x), g.body) {
|
|
1882
1884
|
const [N, B] = rt(
|
|
1883
1885
|
m,
|
|
1884
1886
|
pe(st(d))
|
|
@@ -1889,7 +1891,7 @@ const Ur = async (e) => {
|
|
|
1889
1891
|
a.isString(p) || (p = p ? "include" : "omit");
|
|
1890
1892
|
const S = "credentials" in Request.prototype;
|
|
1891
1893
|
h = new Request(t, {
|
|
1892
|
-
...
|
|
1894
|
+
...y,
|
|
1893
1895
|
signal: T,
|
|
1894
1896
|
method: n.toUpperCase(),
|
|
1895
1897
|
headers: u.normalize().toJSON(),
|
|
@@ -1901,11 +1903,11 @@ const Ur = async (e) => {
|
|
|
1901
1903
|
const E = ve && (l === "stream" || l === "response");
|
|
1902
1904
|
if (ve && (c || E && R)) {
|
|
1903
1905
|
const g = {};
|
|
1904
|
-
["status", "statusText", "headers"].forEach((
|
|
1905
|
-
g[
|
|
1906
|
+
["status", "statusText", "headers"].forEach((j) => {
|
|
1907
|
+
g[j] = A[j];
|
|
1906
1908
|
});
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1909
|
+
const x = a.toFiniteNumber(A.headers.get("content-length")), [N, B] = c && rt(
|
|
1910
|
+
x,
|
|
1909
1911
|
pe(st(c), !0)
|
|
1910
1912
|
) || [];
|
|
1911
1913
|
A = new Response(
|
|
@@ -1917,10 +1919,10 @@ const Ur = async (e) => {
|
|
|
1917
1919
|
}
|
|
1918
1920
|
l = l || "text";
|
|
1919
1921
|
let O = await he[a.findKey(he, l) || "text"](A, e);
|
|
1920
|
-
return !E && R && R(), await new Promise((g,
|
|
1921
|
-
vt(g,
|
|
1922
|
+
return !E && R && R(), await new Promise((g, x) => {
|
|
1923
|
+
vt(g, x, {
|
|
1922
1924
|
data: O,
|
|
1923
|
-
headers:
|
|
1925
|
+
headers: U.from(A.headers),
|
|
1924
1926
|
status: A.status,
|
|
1925
1927
|
statusText: A.statusText,
|
|
1926
1928
|
config: e,
|
|
@@ -1929,11 +1931,11 @@ const Ur = async (e) => {
|
|
|
1929
1931
|
});
|
|
1930
1932
|
} catch (S) {
|
|
1931
1933
|
throw R && R(), S && S.name === "TypeError" && /Load failed|fetch/i.test(S.message) ? Object.assign(
|
|
1932
|
-
new
|
|
1934
|
+
new b("Network Error", b.ERR_NETWORK, e, h),
|
|
1933
1935
|
{
|
|
1934
1936
|
cause: S.cause || S
|
|
1935
1937
|
}
|
|
1936
|
-
) :
|
|
1938
|
+
) : b.from(S, S && S.code, e, h);
|
|
1937
1939
|
}
|
|
1938
1940
|
}), je = {
|
|
1939
1941
|
http: Qn,
|
|
@@ -1959,7 +1961,7 @@ const ct = (e) => `- ${e}`, qr = (e) => a.isFunction(e) || e === null || e === !
|
|
|
1959
1961
|
n = e[o];
|
|
1960
1962
|
let i;
|
|
1961
1963
|
if (r = n, !qr(n) && (r = je[(i = String(n)).toLowerCase()], r === void 0))
|
|
1962
|
-
throw new
|
|
1964
|
+
throw new b(`Unknown adapter '${i}'`);
|
|
1963
1965
|
if (r)
|
|
1964
1966
|
break;
|
|
1965
1967
|
s[i || "#" + o] = r;
|
|
@@ -1971,7 +1973,7 @@ const ct = (e) => `- ${e}`, qr = (e) => a.isFunction(e) || e === null || e === !
|
|
|
1971
1973
|
let i = t ? o.length > 1 ? `since :
|
|
1972
1974
|
` + o.map(ct).join(`
|
|
1973
1975
|
`) : " " + ct(o[0]) : "as no adapter specified";
|
|
1974
|
-
throw new
|
|
1976
|
+
throw new b(
|
|
1975
1977
|
"There is no suitable adapter to dispatch the request " + i,
|
|
1976
1978
|
"ERR_NOT_SUPPORT"
|
|
1977
1979
|
);
|
|
@@ -1982,24 +1984,24 @@ const ct = (e) => `- ${e}`, qr = (e) => a.isFunction(e) || e === null || e === !
|
|
|
1982
1984
|
};
|
|
1983
1985
|
function Ne(e) {
|
|
1984
1986
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1985
|
-
throw new
|
|
1987
|
+
throw new G(null, e);
|
|
1986
1988
|
}
|
|
1987
1989
|
function lt(e) {
|
|
1988
|
-
return Ne(e), e.headers =
|
|
1990
|
+
return Ne(e), e.headers = U.from(e.headers), e.data = xe.call(
|
|
1989
1991
|
e,
|
|
1990
1992
|
e.transformRequest
|
|
1991
1993
|
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Bt.getAdapter(e.adapter || ae.adapter)(e).then(function(r) {
|
|
1992
|
-
return Ne(e), r.data =
|
|
1994
|
+
return Ne(e), r.data = xe.call(
|
|
1993
1995
|
e,
|
|
1994
1996
|
e.transformResponse,
|
|
1995
1997
|
r
|
|
1996
|
-
), r.headers =
|
|
1998
|
+
), r.headers = U.from(r.headers), r;
|
|
1997
1999
|
}, function(r) {
|
|
1998
|
-
return Ft(r) || (Ne(e), r && r.response && (r.response.data =
|
|
2000
|
+
return Ft(r) || (Ne(e), r && r.response && (r.response.data = xe.call(
|
|
1999
2001
|
e,
|
|
2000
2002
|
e.transformResponse,
|
|
2001
2003
|
r.response
|
|
2002
|
-
), r.response.headers =
|
|
2004
|
+
), r.response.headers = U.from(r.response.headers))), Promise.reject(r);
|
|
2003
2005
|
});
|
|
2004
2006
|
}
|
|
2005
2007
|
const qt = "1.9.0", Te = {};
|
|
@@ -2015,9 +2017,9 @@ Te.transitional = function(t, n, r) {
|
|
|
2015
2017
|
}
|
|
2016
2018
|
return (o, i, c) => {
|
|
2017
2019
|
if (t === !1)
|
|
2018
|
-
throw new
|
|
2020
|
+
throw new b(
|
|
2019
2021
|
s(i, " has been removed" + (n ? " in " + n : "")),
|
|
2020
|
-
|
|
2022
|
+
b.ERR_DEPRECATED
|
|
2021
2023
|
);
|
|
2022
2024
|
return n && !ut[i] && (ut[i] = !0, console.warn(
|
|
2023
2025
|
s(
|
|
@@ -2032,7 +2034,7 @@ Te.spelling = function(t) {
|
|
|
2032
2034
|
};
|
|
2033
2035
|
function Ir(e, t, n) {
|
|
2034
2036
|
if (typeof e != "object")
|
|
2035
|
-
throw new
|
|
2037
|
+
throw new b("options must be an object", b.ERR_BAD_OPTION_VALUE);
|
|
2036
2038
|
const r = Object.keys(e);
|
|
2037
2039
|
let s = r.length;
|
|
2038
2040
|
for (; s-- > 0; ) {
|
|
@@ -2040,11 +2042,11 @@ function Ir(e, t, n) {
|
|
|
2040
2042
|
if (i) {
|
|
2041
2043
|
const c = e[o], d = c === void 0 || i(c, o, e);
|
|
2042
2044
|
if (d !== !0)
|
|
2043
|
-
throw new
|
|
2045
|
+
throw new b("option " + o + " must be " + d, b.ERR_BAD_OPTION_VALUE);
|
|
2044
2046
|
continue;
|
|
2045
2047
|
}
|
|
2046
2048
|
if (n !== !0)
|
|
2047
|
-
throw new
|
|
2049
|
+
throw new b("Unknown option " + o, b.ERR_BAD_OPTION);
|
|
2048
2050
|
}
|
|
2049
2051
|
}
|
|
2050
2052
|
const fe = {
|
|
@@ -2108,7 +2110,7 @@ let J = class {
|
|
|
2108
2110
|
(h) => {
|
|
2109
2111
|
delete o[h];
|
|
2110
2112
|
}
|
|
2111
|
-
), n.headers =
|
|
2113
|
+
), n.headers = U.concat(i, o);
|
|
2112
2114
|
const c = [];
|
|
2113
2115
|
let d = !0;
|
|
2114
2116
|
this.interceptors.request.forEach(function(R) {
|
|
@@ -2118,16 +2120,16 @@ let J = class {
|
|
|
2118
2120
|
this.interceptors.response.forEach(function(R) {
|
|
2119
2121
|
l.push(R.fulfilled, R.rejected);
|
|
2120
2122
|
});
|
|
2121
|
-
let u, p = 0,
|
|
2123
|
+
let u, p = 0, y;
|
|
2122
2124
|
if (!d) {
|
|
2123
2125
|
const h = [lt.bind(this), void 0];
|
|
2124
|
-
for (h.unshift.apply(h, c), h.push.apply(h, l),
|
|
2126
|
+
for (h.unshift.apply(h, c), h.push.apply(h, l), y = h.length, u = Promise.resolve(n); p < y; )
|
|
2125
2127
|
u = u.then(h[p++], h[p++]);
|
|
2126
2128
|
return u;
|
|
2127
2129
|
}
|
|
2128
|
-
|
|
2130
|
+
y = c.length;
|
|
2129
2131
|
let T = n;
|
|
2130
|
-
for (p = 0; p <
|
|
2132
|
+
for (p = 0; p < y; ) {
|
|
2131
2133
|
const h = c[p++], R = c[p++];
|
|
2132
2134
|
try {
|
|
2133
2135
|
T = h(T);
|
|
@@ -2141,7 +2143,7 @@ let J = class {
|
|
|
2141
2143
|
} catch (h) {
|
|
2142
2144
|
return Promise.reject(h);
|
|
2143
2145
|
}
|
|
2144
|
-
for (p = 0,
|
|
2146
|
+
for (p = 0, y = l.length; p < y; )
|
|
2145
2147
|
u = u.then(l[p++], l[p++]);
|
|
2146
2148
|
return u;
|
|
2147
2149
|
}
|
|
@@ -2199,7 +2201,7 @@ let $r = class It {
|
|
|
2199
2201
|
r.unsubscribe(o);
|
|
2200
2202
|
}, i;
|
|
2201
2203
|
}, t(function(o, i, c) {
|
|
2202
|
-
r.reason || (r.reason = new
|
|
2204
|
+
r.reason || (r.reason = new G(o, i, c), n(r.reason));
|
|
2203
2205
|
});
|
|
2204
2206
|
}
|
|
2205
2207
|
/**
|
|
@@ -2330,26 +2332,26 @@ function $t(e) {
|
|
|
2330
2332
|
return $t(W(e, s));
|
|
2331
2333
|
}, n;
|
|
2332
2334
|
}
|
|
2333
|
-
const
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2335
|
+
const P = $t(ae);
|
|
2336
|
+
P.Axios = J;
|
|
2337
|
+
P.CanceledError = G;
|
|
2338
|
+
P.CancelToken = $r;
|
|
2339
|
+
P.isCancel = Ft;
|
|
2340
|
+
P.VERSION = qt;
|
|
2341
|
+
P.toFormData = ye;
|
|
2342
|
+
P.AxiosError = b;
|
|
2343
|
+
P.Cancel = P.CanceledError;
|
|
2344
|
+
P.all = function(t) {
|
|
2343
2345
|
return Promise.all(t);
|
|
2344
2346
|
};
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2347
|
+
P.spread = Mr;
|
|
2348
|
+
P.isAxiosError = Hr;
|
|
2349
|
+
P.mergeConfig = W;
|
|
2350
|
+
P.AxiosHeaders = U;
|
|
2351
|
+
P.formToJSON = (e) => kt(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
2352
|
+
P.getAdapter = Bt.getAdapter;
|
|
2353
|
+
P.HttpStatusCode = Le;
|
|
2354
|
+
P.default = P;
|
|
2353
2355
|
const {
|
|
2354
2356
|
Axios: Qr,
|
|
2355
2357
|
AxiosError: es,
|
|
@@ -2367,7 +2369,7 @@ const {
|
|
|
2367
2369
|
formToJSON: ds,
|
|
2368
2370
|
getAdapter: ps,
|
|
2369
2371
|
mergeConfig: hs
|
|
2370
|
-
} =
|
|
2372
|
+
} = P, ms = (e) => P.create({
|
|
2371
2373
|
timeout: 2 * 60 * 1e3,
|
|
2372
2374
|
...e
|
|
2373
2375
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import {
|
|
2
|
+
import { IUseGraphQLFetcherArgs } from './types';
|
|
3
3
|
import { TFileMapVariables } from './utils';
|
|
4
4
|
/**
|
|
5
5
|
* GraphQL 的查詢器
|
|
@@ -7,5 +7,5 @@ import { TFileMapVariables } from './utils';
|
|
|
7
7
|
* @param axiosInstance
|
|
8
8
|
* @param query
|
|
9
9
|
*/
|
|
10
|
-
declare const createGraphQLFetcher: <TData, TArgs extends
|
|
10
|
+
declare const createGraphQLFetcher: <TData, TArgs extends IUseGraphQLFetcherArgs<TFileMapVariables>>(axiosInstance: AxiosInstance, query: string) => ((args?: TArgs) => Promise<TData>);
|
|
11
11
|
export default createGraphQLFetcher;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as createGraphQLFetcher } from './createGraphQLFetcher';
|
|
2
|
-
export type {
|
|
2
|
+
export type { IUseGraphQLFetcherArgs } from './types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { IDocument,
|
|
2
|
+
import { IDocument, IUseRestFulFetcherArgs, TContentTypeResolver, TFileMapVariables } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* RestFul 的查詢器
|
|
5
5
|
* https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-react-query#usage-example-isreacthook-true
|
|
@@ -7,5 +7,5 @@ import { IDocument, IUseFetcherArgs, TContentTypeResolver, TFileMapVariables } f
|
|
|
7
7
|
* @param document
|
|
8
8
|
* @param contentTypeResolver
|
|
9
9
|
*/
|
|
10
|
-
declare const createRestFulFetcher: <TData, TArgs extends
|
|
10
|
+
declare const createRestFulFetcher: <TData, TArgs extends IUseRestFulFetcherArgs<TFileMapVariables>>(axiosInstance: AxiosInstance, document: IDocument, contentTypeResolver?: TContentTypeResolver) => ((args?: TArgs) => Promise<TData>);
|
|
11
11
|
export default createRestFulFetcher;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as createRestFulFetcher } from './createRestFulFetcher';
|
|
2
|
-
export type {
|
|
2
|
+
export type { IUseRestFulFetcherArgs, TContentTypeResolver } from './types';
|
|
3
3
|
export * from './config';
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { IRequestConfig } from '../types';
|
|
2
2
|
import { ERequestMethod } from './config';
|
|
3
|
-
export type
|
|
3
|
+
export type IUseRestFulFetcherArgs<TVariables> = [
|
|
4
|
+
TVariables
|
|
5
|
+
] extends [void] ? void | {
|
|
4
6
|
fetchOptions?: IRequestConfig;
|
|
5
|
-
}
|
|
7
|
+
} : {
|
|
8
|
+
variables: TVariables;
|
|
9
|
+
fetchOptions?: IRequestConfig;
|
|
10
|
+
};
|
|
6
11
|
export interface IDocument {
|
|
7
12
|
url: string;
|
|
8
13
|
method?: string;
|