@hkyhy/marsun-components-core 0.1.18 → 0.1.21
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/components/AgentHub/Chat/Detail/ChatAgentFab/index.d.ts +24 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/index.js +95 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/style.module.scss.js +15 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/index.d.ts +16 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/index.js +37 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/style.module.scss.js +9 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/index.d.ts +14 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/index.js +79 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/style.module.scss.js +18 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatInput/index.d.ts +2 -0
- package/dist/components/AgentHub/Chat/Detail/ChatInput/index.js +60 -49
- package/dist/components/AgentHub/Chat/Detail/ChatInput/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatInput/style.module.scss.js +7 -6
- package/dist/components/AgentHub/Chat/Detail/ChatInput/style.module.scss.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.d.ts +17 -4
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.js +104 -68
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/style.module.scss.js +13 -8
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/style.module.scss.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.js +5 -4
- package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/style.module.scss.js +2 -2
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/ChatWidgetSparkline.d.ts +7 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/ChatWidgetSparkline.js +55 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/ChatWidgetSparkline.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/index.d.ts +10 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/index.js +120 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/style.module.scss.js +32 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/CitationContent/style.module.scss.js +2 -2
- package/dist/components/AgentHub/Chat/Detail/MessageItem/index.js +130 -114
- package/dist/components/AgentHub/Chat/Detail/MessageItem/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/MessageItem/style.module.scss.js +20 -18
- package/dist/components/AgentHub/Chat/Detail/MessageItem/style.module.scss.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/index.d.ts +8 -0
- package/dist/components/AgentHub/Chat/hooks/index.d.ts +2 -0
- package/dist/components/AgentHub/Chat/hooks/useCitationPanel.d.ts +11 -0
- package/dist/components/AgentHub/Chat/hooks/useCitationPanel.js +22 -0
- package/dist/components/AgentHub/Chat/hooks/useCitationPanel.js.map +1 -0
- package/dist/components/AgentHub/types.d.ts +21 -0
- package/dist/components/Auth/ProtectedRoute.js +20 -14
- package/dist/components/Auth/ProtectedRoute.js.map +1 -1
- package/dist/components/File/index.d.ts +2 -0
- package/dist/components/File/utils/download.d.ts +20 -0
- package/dist/components/File/utils/download.js +30 -0
- package/dist/components/File/utils/download.js.map +1 -0
- package/dist/components/Filter/FilterDateRange/index.d.ts +6 -1
- package/dist/components/Filter/FilterDateRange/index.js +84 -62
- package/dist/components/Filter/FilterDateRange/index.js.map +1 -1
- package/dist/components/Filter/types.d.ts +1 -0
- package/dist/components/Filter/types.js.map +1 -1
- package/dist/components/Icons/index.d.ts +3 -1
- package/dist/components/Icons/index.js +157 -151
- package/dist/components/Icons/index.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +377 -298
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/node_modules/axios/index.js +41 -0
- package/dist/node_modules/axios/index.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +66 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +324 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +86 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js.map +1 -0
- package/dist/node_modules/axios/lib/axios.js +47 -0
- package/dist/node_modules/axios/lib/axios.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +78 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +19 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +7 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js.map +1 -0
- package/dist/node_modules/axios/lib/core/Axios.js +168 -0
- package/dist/node_modules/axios/lib/core/Axios.js.map +1 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +110 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js.map +1 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +193 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +60 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js.map +1 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +30 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js.map +1 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +43 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js.map +1 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +94 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js.map +1 -0
- package/dist/node_modules/axios/lib/core/settle.js +15 -0
- package/dist/node_modules/axios/lib/core/settle.js.map +1 -0
- package/dist/node_modules/axios/lib/core/transformData.js +14 -0
- package/dist/node_modules/axios/lib/core/transformData.js.map +1 -0
- package/dist/node_modules/axios/lib/defaults/index.js +96 -0
- package/dist/node_modules/axios/lib/defaults/index.js.map +1 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +12 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js.map +1 -0
- package/dist/node_modules/axios/lib/env/data.js +5 -0
- package/dist/node_modules/axios/lib/env/data.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +31 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +78 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +9 -0
- package/dist/node_modules/axios/lib/helpers/bind.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +24 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +7 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +33 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +44 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +43 -0
- package/dist/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +47 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +7 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +8 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +9 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/null.js +5 -0
- package/dist/node_modules/axios/lib/helpers/null.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +31 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +8 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +41 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +54 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +34 -0
- package/dist/node_modules/axios/lib/helpers/sanitizeHeaderValue.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +20 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +9 -0
- package/dist/node_modules/axios/lib/helpers/spread.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +16 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +115 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +15 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +67 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +58 -0
- package/dist/node_modules/axios/lib/helpers/validator.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +6 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +16 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +10 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/index.js +10 -0
- package/dist/node_modules/axios/lib/platform/index.js.map +1 -0
- package/dist/node_modules/axios/lib/utils.js +303 -0
- package/dist/node_modules/axios/lib/utils.js.map +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/types/auth.d.ts +18 -0
- package/dist/utils/authRedirect.d.ts +6 -0
- package/dist/utils/authRedirect.js +33 -0
- package/dist/utils/authRedirect.js.map +1 -0
- package/dist/utils/createMarsunRequest.d.ts +26 -0
- package/dist/utils/createMarsunRequest.js +53 -0
- package/dist/utils/createMarsunRequest.js.map +1 -0
- package/dist/utils/date.d.ts +16 -0
- package/dist/utils/date.js +36 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/department/departmentPath.d.ts +18 -0
- package/dist/utils/department/departmentPath.js +63 -0
- package/dist/utils/department/departmentPath.js.map +1 -0
- package/dist/utils/department/departmentScope.d.ts +20 -0
- package/dist/utils/department/departmentScope.js +63 -0
- package/dist/utils/department/departmentScope.js.map +1 -0
- package/dist/utils/department/types.d.ts +12 -0
- package/dist/utils/permissionStorage.d.ts +13 -0
- package/dist/utils/permissionStorage.js +43 -0
- package/dist/utils/permissionStorage.js.map +1 -0
- package/dist/utils/personOption.d.ts +49 -0
- package/dist/utils/personOption.js +90 -0
- package/dist/utils/personOption.js.map +1 -0
- package/dist/utils/sessionActivity.d.ts +5 -0
- package/dist/utils/sessionActivity.js +18 -0
- package/dist/utils/sessionActivity.js.map +1 -0
- package/dist/utils/user/employeeId.d.ts +8 -0
- package/dist/utils/user/employeeId.js +14 -0
- package/dist/utils/user/employeeId.js.map +1 -0
- package/package.json +26 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import W from "../platform/index.js";
|
|
2
|
+
import n from "../utils.js";
|
|
3
|
+
import o from "../core/AxiosError.js";
|
|
4
|
+
import we from "../helpers/composeSignals.js";
|
|
5
|
+
import { trackStream as re } from "../helpers/trackStream.js";
|
|
6
|
+
import ne from "../core/AxiosHeaders.js";
|
|
7
|
+
import { progressEventDecorator as se, progressEventReducer as oe, asyncDecorator as ae } from "../helpers/progressEventReducer.js";
|
|
8
|
+
import Re from "../helpers/resolveConfig.js";
|
|
9
|
+
import ye from "../core/settle.js";
|
|
10
|
+
import be from "../helpers/estimateDataURLDecodedBytes.js";
|
|
11
|
+
import { VERSION as Se } from "../env/data.js";
|
|
12
|
+
import { toByteStringHeaderObject as Ee } from "../helpers/sanitizeHeaderValue.js";
|
|
13
|
+
const ie = 64 * 1024, { isFunction: v } = n, xe = (a) => encodeURIComponent(a).replace(
|
|
14
|
+
/%([0-9A-F]{2})/gi,
|
|
15
|
+
(l, f) => String.fromCharCode(parseInt(f, 16))
|
|
16
|
+
), ue = (a) => {
|
|
17
|
+
if (!n.isString(a))
|
|
18
|
+
return a;
|
|
19
|
+
try {
|
|
20
|
+
return decodeURIComponent(a);
|
|
21
|
+
} catch {
|
|
22
|
+
return a;
|
|
23
|
+
}
|
|
24
|
+
}, ce = (a, ...l) => {
|
|
25
|
+
try {
|
|
26
|
+
return !!a(...l);
|
|
27
|
+
} catch {
|
|
28
|
+
return !1;
|
|
29
|
+
}
|
|
30
|
+
}, Le = (a) => {
|
|
31
|
+
const l = a.indexOf("://");
|
|
32
|
+
let f = a;
|
|
33
|
+
return l !== -1 && (f = f.slice(l + 3)), f.includes("@") || f.includes(":");
|
|
34
|
+
}, Ce = (a) => {
|
|
35
|
+
const l = n.global !== void 0 && n.global !== null ? n.global : globalThis, { ReadableStream: f, TextEncoder: P } = l;
|
|
36
|
+
a = n.merge.call(
|
|
37
|
+
{
|
|
38
|
+
skipUndefined: !0
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
Request: l.Request,
|
|
42
|
+
Response: l.Response
|
|
43
|
+
},
|
|
44
|
+
a
|
|
45
|
+
);
|
|
46
|
+
const { fetch: q, Request: m, Response: B } = a, y = q ? v(q) : typeof fetch == "function", h = v(m), L = v(B);
|
|
47
|
+
if (!y)
|
|
48
|
+
return !1;
|
|
49
|
+
const C = y && v(f), le = y && (typeof P == "function" ? /* @__PURE__ */ ((e) => (s) => e.encode(s))(new P()) : async (e) => new Uint8Array(await new m(e).arrayBuffer())), V = h && C && ce(() => {
|
|
50
|
+
let e = !1;
|
|
51
|
+
const s = new m(W.origin, {
|
|
52
|
+
body: new f(),
|
|
53
|
+
method: "POST",
|
|
54
|
+
get duplex() {
|
|
55
|
+
return e = !0, "half";
|
|
56
|
+
}
|
|
57
|
+
}), u = s.headers.has("Content-Type");
|
|
58
|
+
return s.body != null && s.body.cancel(), e && !u;
|
|
59
|
+
}), N = L && C && ce(() => n.isReadableStream(new B("").body)), F = {
|
|
60
|
+
stream: N && ((e) => e.body)
|
|
61
|
+
};
|
|
62
|
+
y && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
|
|
63
|
+
!F[e] && (F[e] = (s, u) => {
|
|
64
|
+
let c = s && s[e];
|
|
65
|
+
if (c)
|
|
66
|
+
return c.call(s);
|
|
67
|
+
throw new o(
|
|
68
|
+
`Response type '${e}' is not supported`,
|
|
69
|
+
o.ERR_NOT_SUPPORT,
|
|
70
|
+
u
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
const Q = async (e) => {
|
|
75
|
+
if (e == null)
|
|
76
|
+
return 0;
|
|
77
|
+
if (n.isBlob(e))
|
|
78
|
+
return e.size;
|
|
79
|
+
if (n.isSpecCompliantForm(e))
|
|
80
|
+
return (await new m(W.origin, {
|
|
81
|
+
method: "POST",
|
|
82
|
+
body: e
|
|
83
|
+
}).arrayBuffer()).byteLength;
|
|
84
|
+
if (n.isArrayBufferView(e) || n.isArrayBuffer(e))
|
|
85
|
+
return e.byteLength;
|
|
86
|
+
if (n.isURLSearchParams(e) && (e = e + ""), n.isString(e))
|
|
87
|
+
return (await le(e)).byteLength;
|
|
88
|
+
}, de = async (e, s) => {
|
|
89
|
+
const u = n.toFiniteNumber(e.getContentLength());
|
|
90
|
+
return u ?? Q(s);
|
|
91
|
+
};
|
|
92
|
+
return async (e) => {
|
|
93
|
+
let {
|
|
94
|
+
url: s,
|
|
95
|
+
method: u,
|
|
96
|
+
data: c,
|
|
97
|
+
signal: fe,
|
|
98
|
+
cancelToken: Z,
|
|
99
|
+
timeout: pe,
|
|
100
|
+
onDownloadProgress: H,
|
|
101
|
+
onUploadProgress: j,
|
|
102
|
+
responseType: b,
|
|
103
|
+
headers: S,
|
|
104
|
+
withCredentials: z = "same-origin",
|
|
105
|
+
fetchOptions: $,
|
|
106
|
+
maxContentLength: g,
|
|
107
|
+
maxBodyLength: k
|
|
108
|
+
} = Re(e);
|
|
109
|
+
const U = n.isNumber(g) && g > -1, M = n.isNumber(k) && k > -1, me = (r) => n.hasOwnProp(e, r) ? e[r] : void 0;
|
|
110
|
+
let G = q || fetch;
|
|
111
|
+
b = b ? (b + "").toLowerCase() : "text";
|
|
112
|
+
let E = we(
|
|
113
|
+
[fe, Z && Z.toAbortSignal()],
|
|
114
|
+
pe
|
|
115
|
+
), i = null;
|
|
116
|
+
const _ = E && E.unsubscribe && (() => {
|
|
117
|
+
E.unsubscribe();
|
|
118
|
+
});
|
|
119
|
+
let O, A = null;
|
|
120
|
+
const J = () => new o(
|
|
121
|
+
"Request body larger than maxBodyLength limit",
|
|
122
|
+
o.ERR_BAD_REQUEST,
|
|
123
|
+
e,
|
|
124
|
+
i
|
|
125
|
+
);
|
|
126
|
+
try {
|
|
127
|
+
let r;
|
|
128
|
+
const p = me("auth");
|
|
129
|
+
if (p) {
|
|
130
|
+
const t = n.getSafeProp(p, "username") || "", d = n.getSafeProp(p, "password") || "";
|
|
131
|
+
r = {
|
|
132
|
+
username: t,
|
|
133
|
+
password: d
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (Le(s)) {
|
|
137
|
+
const t = new URL(s, W.origin);
|
|
138
|
+
if (!r && (t.username || t.password)) {
|
|
139
|
+
const d = ue(t.username), x = ue(t.password);
|
|
140
|
+
r = {
|
|
141
|
+
username: d,
|
|
142
|
+
password: x
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
(t.username || t.password) && (t.username = "", t.password = "", s = t.href);
|
|
146
|
+
}
|
|
147
|
+
if (r && (S.delete("authorization"), S.set(
|
|
148
|
+
"Authorization",
|
|
149
|
+
"Basic " + btoa(xe((r.username || "") + ":" + (r.password || "")))
|
|
150
|
+
)), U && typeof s == "string" && s.startsWith("data:") && be(s) > g)
|
|
151
|
+
throw new o(
|
|
152
|
+
"maxContentLength size of " + g + " exceeded",
|
|
153
|
+
o.ERR_BAD_RESPONSE,
|
|
154
|
+
e,
|
|
155
|
+
i
|
|
156
|
+
);
|
|
157
|
+
if (M && u !== "get" && u !== "head") {
|
|
158
|
+
const t = await Q(c);
|
|
159
|
+
if (typeof t == "number" && isFinite(t) && (O = t, t > k))
|
|
160
|
+
throw J();
|
|
161
|
+
}
|
|
162
|
+
const I = M && (n.isReadableStream(c) || n.isStream(c)), X = (t, d, x) => re(
|
|
163
|
+
t,
|
|
164
|
+
ie,
|
|
165
|
+
(T) => {
|
|
166
|
+
if (M && T > k)
|
|
167
|
+
throw A = J();
|
|
168
|
+
d && d(T);
|
|
169
|
+
},
|
|
170
|
+
x
|
|
171
|
+
);
|
|
172
|
+
if (V && u !== "get" && u !== "head" && (j || I)) {
|
|
173
|
+
if (O = O ?? await de(S, c), O !== 0 || I) {
|
|
174
|
+
let t = new m(s, {
|
|
175
|
+
method: "POST",
|
|
176
|
+
body: c,
|
|
177
|
+
duplex: "half"
|
|
178
|
+
}), d;
|
|
179
|
+
if (n.isFormData(c) && (d = t.headers.get("content-type")) && S.setContentType(d), t.body) {
|
|
180
|
+
const [x, T] = j && se(
|
|
181
|
+
O,
|
|
182
|
+
oe(ae(j))
|
|
183
|
+
) || [];
|
|
184
|
+
c = X(t.body, x, T);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} else if (I && !h && C && u !== "get" && u !== "head")
|
|
188
|
+
c = X(c);
|
|
189
|
+
else if (I && h && !V && u !== "get" && u !== "head")
|
|
190
|
+
throw new o(
|
|
191
|
+
"Stream request bodies are not supported by the current fetch implementation",
|
|
192
|
+
o.ERR_NOT_SUPPORT,
|
|
193
|
+
e,
|
|
194
|
+
i
|
|
195
|
+
);
|
|
196
|
+
n.isString(z) || (z = z ? "include" : "omit");
|
|
197
|
+
const he = h && "credentials" in m.prototype;
|
|
198
|
+
if (n.isFormData(c)) {
|
|
199
|
+
const t = S.getContentType();
|
|
200
|
+
t && /^multipart\/form-data/i.test(t) && !/boundary=/i.test(t) && S.delete("content-type");
|
|
201
|
+
}
|
|
202
|
+
S.set("User-Agent", "axios/" + Se, !1);
|
|
203
|
+
const Y = {
|
|
204
|
+
...$,
|
|
205
|
+
signal: E,
|
|
206
|
+
method: u.toUpperCase(),
|
|
207
|
+
headers: Ee(S.normalize()),
|
|
208
|
+
body: c,
|
|
209
|
+
duplex: "half",
|
|
210
|
+
credentials: he ? z : void 0
|
|
211
|
+
};
|
|
212
|
+
i = h && new m(s, Y);
|
|
213
|
+
let w = await (h ? G(i, $) : G(s, Y));
|
|
214
|
+
const ee = ne.from(w.headers);
|
|
215
|
+
if (U) {
|
|
216
|
+
const t = n.toFiniteNumber(ee.getContentLength());
|
|
217
|
+
if (t != null && t > g)
|
|
218
|
+
throw new o(
|
|
219
|
+
"maxContentLength size of " + g + " exceeded",
|
|
220
|
+
o.ERR_BAD_RESPONSE,
|
|
221
|
+
e,
|
|
222
|
+
i
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
const K = N && (b === "stream" || b === "response");
|
|
226
|
+
if (N && w.body && (H || U || K && _)) {
|
|
227
|
+
const t = {};
|
|
228
|
+
["status", "statusText", "headers"].forEach((D) => {
|
|
229
|
+
t[D] = w[D];
|
|
230
|
+
});
|
|
231
|
+
const d = n.toFiniteNumber(ee.getContentLength()), [x, T] = H && se(
|
|
232
|
+
d,
|
|
233
|
+
oe(ae(H), !0)
|
|
234
|
+
) || [];
|
|
235
|
+
let te = 0;
|
|
236
|
+
const ge = (D) => {
|
|
237
|
+
if (U && (te = D, te > g))
|
|
238
|
+
throw new o(
|
|
239
|
+
"maxContentLength size of " + g + " exceeded",
|
|
240
|
+
o.ERR_BAD_RESPONSE,
|
|
241
|
+
e,
|
|
242
|
+
i
|
|
243
|
+
);
|
|
244
|
+
x && x(D);
|
|
245
|
+
};
|
|
246
|
+
w = new B(
|
|
247
|
+
re(w.body, ie, ge, () => {
|
|
248
|
+
T && T(), _ && _();
|
|
249
|
+
}),
|
|
250
|
+
t
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
b = b || "text";
|
|
254
|
+
let R = await F[n.findKey(F, b) || "text"](
|
|
255
|
+
w,
|
|
256
|
+
e
|
|
257
|
+
);
|
|
258
|
+
if (U && !N && !K) {
|
|
259
|
+
let t;
|
|
260
|
+
if (R != null && (typeof R.byteLength == "number" ? t = R.byteLength : typeof R.size == "number" ? t = R.size : typeof R == "string" && (t = typeof P == "function" ? new P().encode(R).byteLength : R.length)), typeof t == "number" && t > g)
|
|
261
|
+
throw new o(
|
|
262
|
+
"maxContentLength size of " + g + " exceeded",
|
|
263
|
+
o.ERR_BAD_RESPONSE,
|
|
264
|
+
e,
|
|
265
|
+
i
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
return !K && _ && _(), await new Promise((t, d) => {
|
|
269
|
+
ye(t, d, {
|
|
270
|
+
data: R,
|
|
271
|
+
headers: ne.from(w.headers),
|
|
272
|
+
status: w.status,
|
|
273
|
+
statusText: w.statusText,
|
|
274
|
+
config: e,
|
|
275
|
+
request: i
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
} catch (r) {
|
|
279
|
+
if (_ && _(), E && E.aborted && E.reason instanceof o) {
|
|
280
|
+
const p = E.reason;
|
|
281
|
+
throw p.config = e, i && (p.request = i), r !== p && Object.defineProperty(p, "cause", {
|
|
282
|
+
__proto__: null,
|
|
283
|
+
value: r,
|
|
284
|
+
writable: !0,
|
|
285
|
+
enumerable: !1,
|
|
286
|
+
configurable: !0
|
|
287
|
+
}), p;
|
|
288
|
+
}
|
|
289
|
+
if (A)
|
|
290
|
+
throw i && !A.request && (A.request = i), A;
|
|
291
|
+
if (r instanceof o)
|
|
292
|
+
throw i && !r.request && (r.request = i), r;
|
|
293
|
+
if (r && r.name === "TypeError" && /Load failed|fetch/i.test(r.message)) {
|
|
294
|
+
const p = new o(
|
|
295
|
+
"Network Error",
|
|
296
|
+
o.ERR_NETWORK,
|
|
297
|
+
e,
|
|
298
|
+
i,
|
|
299
|
+
r && r.response
|
|
300
|
+
);
|
|
301
|
+
throw Object.defineProperty(p, "cause", {
|
|
302
|
+
__proto__: null,
|
|
303
|
+
value: r.cause || r,
|
|
304
|
+
writable: !0,
|
|
305
|
+
enumerable: !1,
|
|
306
|
+
configurable: !0
|
|
307
|
+
}), p;
|
|
308
|
+
}
|
|
309
|
+
throw o.from(r, r && r.code, e, i, r && r.response);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}, _e = /* @__PURE__ */ new Map(), Te = (a) => {
|
|
313
|
+
let l = a && a.env || {};
|
|
314
|
+
const { fetch: f, Request: P, Response: q } = l, m = [P, q, f];
|
|
315
|
+
let B = m.length, y = B, h, L, C = _e;
|
|
316
|
+
for (; y--; )
|
|
317
|
+
h = m[y], L = C.get(h), L === void 0 && C.set(h, L = y ? /* @__PURE__ */ new Map() : Ce(l)), C = L;
|
|
318
|
+
return L;
|
|
319
|
+
};
|
|
320
|
+
Te();
|
|
321
|
+
export {
|
|
322
|
+
Te as getFetch
|
|
323
|
+
};
|
|
324
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sources":["../../../../../node_modules/axios/lib/adapters/fetch.js"],"sourcesContent":["import platform from '../platform/index.js';\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport composeSignals from '../helpers/composeSignals.js';\nimport { trackStream } from '../helpers/trackStream.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport {\n progressEventReducer,\n progressEventDecorator,\n asyncDecorator,\n} from '../helpers/progressEventReducer.js';\nimport resolveConfig from '../helpers/resolveConfig.js';\nimport settle from '../core/settle.js';\nimport estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';\nimport { VERSION } from '../env/data.js';\nimport { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst { isFunction } = utils;\n\n/**\n * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().\n * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.\n *\n * @param {string} str The string to encode\n *\n * @returns {string} UTF-8 bytes as a Latin-1 string\n */\nconst encodeUTF8 = (str) =>\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>\n String.fromCharCode(parseInt(hex, 16))\n );\n\n// Node's WHATWG URL parser returns `username` and `password` percent-encoded.\n// Decode before composing the `auth` option so credentials such as\n// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the\n// original value for malformed input so a bad encoding never throws.\nconst decodeURIComponentSafe = (value) => {\n if (!utils.isString(value)) {\n return value;\n }\n\n try {\n return decodeURIComponent(value);\n } catch (error) {\n return value;\n }\n};\n\nconst test = (fn, ...args) => {\n try {\n return !!fn(...args);\n } catch (e) {\n return false;\n }\n};\n\nconst maybeWithAuthCredentials = (url) => {\n const protocolIndex = url.indexOf('://');\n let urlToCheck = url;\n if (protocolIndex !== -1) {\n urlToCheck = urlToCheck.slice(protocolIndex + 3);\n }\n return urlToCheck.includes('@') || urlToCheck.includes(':');\n};\n\nconst factory = (env) => {\n const globalObject =\n utils.global !== undefined && utils.global !== null\n ? utils.global\n : globalThis;\n const { ReadableStream, TextEncoder } = globalObject;\n\n env = utils.merge.call(\n {\n skipUndefined: true,\n },\n {\n Request: globalObject.Request,\n Response: globalObject.Response,\n },\n env\n );\n\n const { fetch: envFetch, Request, Response } = env;\n const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';\n const isRequestSupported = isFunction(Request);\n const isResponseSupported = isFunction(Response);\n\n if (!isFetchSupported) {\n return false;\n }\n\n const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);\n\n const encodeText =\n isFetchSupported &&\n (typeof TextEncoder === 'function'\n ? (\n (encoder) => (str) =>\n encoder.encode(str)\n )(new TextEncoder())\n : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));\n\n const supportsRequestStream =\n isRequestSupported &&\n isReadableStreamSupported &&\n test(() => {\n let duplexAccessed = false;\n\n const request = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n });\n\n const hasContentType = request.headers.has('Content-Type');\n\n if (request.body != null) {\n request.body.cancel();\n }\n\n return duplexAccessed && !hasContentType;\n });\n\n const supportsResponseStream =\n isResponseSupported &&\n isReadableStreamSupported &&\n test(() => utils.isReadableStream(new Response('').body));\n\n const resolvers = {\n stream: supportsResponseStream && ((res) => res.body),\n };\n\n isFetchSupported &&\n (() => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {\n !resolvers[type] &&\n (resolvers[type] = (res, config) => {\n let method = res && res[type];\n\n if (method) {\n return method.call(res);\n }\n\n throw new AxiosError(\n `Response type '${type}' is not supported`,\n AxiosError.ERR_NOT_SUPPORT,\n config\n );\n });\n });\n })();\n\n const getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if (utils.isBlob(body)) {\n return body.size;\n }\n\n if (utils.isSpecCompliantForm(body)) {\n const _request = new Request(platform.origin, {\n method: 'POST',\n body,\n });\n return (await _request.arrayBuffer()).byteLength;\n }\n\n if (utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {\n return body.byteLength;\n }\n\n if (utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if (utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n };\n\n const resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n };\n\n return async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions,\n maxContentLength,\n maxBodyLength,\n } = resolveConfig(config);\n\n const hasMaxContentLength = utils.isNumber(maxContentLength) && maxContentLength > -1;\n const hasMaxBodyLength = utils.isNumber(maxBodyLength) && maxBodyLength > -1;\n const own = (key) => (utils.hasOwnProp(config, key) ? config[key] : undefined);\n\n let _fetch = envFetch || fetch;\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let composedSignal = composeSignals(\n [signal, cancelToken && cancelToken.toAbortSignal()],\n timeout\n );\n\n let request = null;\n\n const unsubscribe =\n composedSignal &&\n composedSignal.unsubscribe &&\n (() => {\n composedSignal.unsubscribe();\n });\n\n let requestContentLength;\n\n // AxiosError we raise while the request body is being streamed. Captured\n // by identity so the catch block can surface it directly, regardless of\n // how the runtime wraps the resulting fetch rejection (undici exposes it\n // as `err.cause`; some browsers drop the original error entirely).\n let pendingBodyError = null;\n\n const maxBodyLengthError = () =>\n new AxiosError(\n 'Request body larger than maxBodyLength limit',\n AxiosError.ERR_BAD_REQUEST,\n config,\n request\n );\n\n try {\n // HTTP basic authentication\n let auth = undefined;\n const configAuth = own('auth');\n\n if (configAuth) {\n const username = utils.getSafeProp(configAuth, 'username') || '';\n const password = utils.getSafeProp(configAuth, 'password') || '';\n auth = {\n username,\n password\n };\n }\n\n if (maybeWithAuthCredentials(url)) {\n const parsedURL = new URL(url, platform.origin);\n\n if (!auth && (parsedURL.username || parsedURL.password)) {\n const urlUsername = decodeURIComponentSafe(parsedURL.username);\n const urlPassword = decodeURIComponentSafe(parsedURL.password);\n auth = {\n username: urlUsername,\n password: urlPassword\n };\n }\n\n if (parsedURL.username || parsedURL.password) {\n parsedURL.username = '';\n parsedURL.password = '';\n url = parsedURL.href;\n }\n }\n\n if (auth) {\n headers.delete('authorization');\n headers.set(\n 'Authorization',\n 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))\n );\n }\n\n // Enforce maxContentLength for data: URLs up-front so we never materialize\n // an oversized payload. The HTTP adapter applies the same check (see http.js\n // \"if (protocol === 'data:')\" branch).\n if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {\n const estimated = estimateDataURLDecodedBytes(url);\n if (estimated > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n // Enforce maxBodyLength against known-size bodies before dispatch using\n // the body's *actual* size — never a caller-declared Content-Length,\n // which could under-report to slip an oversized body past the check.\n // Unknown-size streams return undefined here and are counted per-chunk\n // below as fetch consumes them.\n if (hasMaxBodyLength && method !== 'get' && method !== 'head') {\n const outboundLength = await getBodyLength(data);\n if (typeof outboundLength === 'number' && isFinite(outboundLength)) {\n requestContentLength = outboundLength;\n if (outboundLength > maxBodyLength) {\n throw maxBodyLengthError();\n }\n }\n }\n\n // A streamed body under maxBodyLength must be counted as fetch consumes\n // it; its size is never trusted from a caller-declared Content-Length.\n const mustEnforceStreamBody =\n hasMaxBodyLength && (utils.isReadableStream(data) || utils.isStream(data));\n\n const trackRequestStream = (stream, onProgress, flush) =>\n trackStream(\n stream,\n DEFAULT_CHUNK_SIZE,\n (loadedBytes) => {\n if (hasMaxBodyLength && loadedBytes > maxBodyLength) {\n throw (pendingBodyError = maxBodyLengthError());\n }\n onProgress && onProgress(loadedBytes);\n },\n flush\n );\n\n if (\n supportsRequestStream &&\n method !== 'get' &&\n method !== 'head' &&\n (onUploadProgress || mustEnforceStreamBody)\n ) {\n requestContentLength =\n requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;\n\n // A declared length of 0 is only trusted to skip the wrap when we are\n // not enforcing a stream limit (which must not rely on that header).\n if (requestContentLength !== 0 || mustEnforceStreamBody) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: 'half',\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader);\n }\n\n if (_request.body) {\n const [onProgress, flush] =\n (onUploadProgress &&\n progressEventDecorator(\n requestContentLength,\n progressEventReducer(asyncDecorator(onUploadProgress))\n )) ||\n [];\n\n data = trackRequestStream(_request.body, onProgress, flush);\n }\n }\n } else if (\n mustEnforceStreamBody &&\n !isRequestSupported &&\n isReadableStreamSupported &&\n method !== 'get' &&\n method !== 'head'\n ) {\n data = trackRequestStream(data);\n } else if (\n mustEnforceStreamBody &&\n isRequestSupported &&\n !supportsRequestStream &&\n method !== 'get' &&\n method !== 'head'\n ) {\n throw new AxiosError(\n 'Stream request bodies are not supported by the current fetch implementation',\n AxiosError.ERR_NOT_SUPPORT,\n config,\n request\n );\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'include' : 'omit';\n }\n\n // Cloudflare Workers throws when credentials are defined\n // see https://github.com/cloudflare/workerd/issues/902\n const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;\n\n // If data is FormData and Content-Type is multipart/form-data without boundary,\n // delete it so fetch can set it correctly with the boundary\n if (utils.isFormData(data)) {\n const contentType = headers.getContentType();\n if (\n contentType &&\n /^multipart\\/form-data/i.test(contentType) &&\n !/boundary=/i.test(contentType)\n ) {\n headers.delete('content-type');\n }\n }\n\n // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)\n headers.set('User-Agent', 'axios/' + VERSION, false);\n\n const resolvedOptions = {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: toByteStringHeaderObject(headers.normalize()),\n body: data,\n duplex: 'half',\n credentials: isCredentialsSupported ? withCredentials : undefined,\n };\n\n request = isRequestSupported && new Request(url, resolvedOptions);\n\n let response = await (isRequestSupported\n ? _fetch(request, fetchOptions)\n : _fetch(url, resolvedOptions));\n\n const responseHeaders = AxiosHeaders.from(response.headers);\n\n // Cheap pre-check: if the server honestly declares a content-length that\n // already exceeds the cap, reject before we start streaming.\n if (hasMaxContentLength) {\n const declaredLength = utils.toFiniteNumber(responseHeaders.getContentLength());\n if (declaredLength != null && declaredLength > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n const isStreamResponse =\n supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (\n supportsResponseStream &&\n response.body &&\n (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))\n ) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach((prop) => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(responseHeaders.getContentLength());\n\n const [onProgress, flush] =\n (onDownloadProgress &&\n progressEventDecorator(\n responseContentLength,\n progressEventReducer(asyncDecorator(onDownloadProgress), true)\n )) ||\n [];\n\n let bytesRead = 0;\n const onChunkProgress = (loadedBytes) => {\n if (hasMaxContentLength) {\n bytesRead = loadedBytes;\n if (bytesRead > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n onProgress && onProgress(loadedBytes);\n };\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {\n flush && flush();\n unsubscribe && unsubscribe();\n }),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](\n response,\n config\n );\n\n // Fallback enforcement for environments without ReadableStream support\n // (legacy runtimes). Detect materialized size from typed output; skip\n // streams/Response passthrough since the user will read those themselves.\n if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {\n let materializedSize;\n if (responseData != null) {\n if (typeof responseData.byteLength === 'number') {\n materializedSize = responseData.byteLength;\n } else if (typeof responseData.size === 'number') {\n materializedSize = responseData.size;\n } else if (typeof responseData === 'string') {\n materializedSize =\n typeof TextEncoder === 'function'\n ? new TextEncoder().encode(responseData).byteLength\n : responseData.length;\n }\n }\n if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n !isStreamResponse && unsubscribe && unsubscribe();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request,\n });\n });\n } catch (err) {\n unsubscribe && unsubscribe();\n\n // Safari can surface fetch aborts as a DOMException-like object whose\n // branded getters throw. Prefer our composed signal reason before reading\n // the caught error, preserving timeout vs cancellation semantics.\n if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {\n const canceledError = composedSignal.reason;\n canceledError.config = config;\n request && (canceledError.request = request);\n if (err !== canceledError) {\n // Non-enumerable to match native Error `cause` semantics so loggers\n // don't recurse into circular fetch internals (see #7205).\n Object.defineProperty(canceledError, 'cause', {\n __proto__: null,\n value: err,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n }\n throw canceledError;\n }\n\n // Surface a maxBodyLength violation we raised while the request body was\n // being streamed. Matching by identity (rather than reading\n // `err.cause.isAxiosError`) keeps the error deterministic across runtimes\n // and avoids both prototype-pollution reads and mis-attributing a foreign\n // AxiosError that merely happened to land in `err.cause`.\n if (pendingBodyError) {\n request && !pendingBodyError.request && (pendingBodyError.request = request);\n throw pendingBodyError;\n }\n\n // Re-throw AxiosErrors we raised synchronously (data: URL / content-length\n // pre-checks, response size enforcement) without re-wrapping them.\n if (err instanceof AxiosError) {\n request && !err.request && (err.request = request);\n throw err;\n }\n\n if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {\n const networkError = new AxiosError(\n 'Network Error',\n AxiosError.ERR_NETWORK,\n config,\n request,\n err && err.response\n );\n // Non-enumerable to match native Error `cause` semantics so loggers\n // don't recurse into circular fetch internals (see #7205).\n Object.defineProperty(networkError, 'cause', {\n __proto__: null,\n value: err.cause || err,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n throw networkError;\n }\n\n throw AxiosError.from(err, err && err.code, config, request, err && err.response);\n }\n };\n};\n\nconst seedCache = new Map();\n\nexport const getFetch = (config) => {\n let env = (config && config.env) || {};\n const { fetch, Request, Response } = env;\n const seeds = [Request, Response, fetch];\n\n let len = seeds.length,\n i = len,\n seed,\n target,\n map = seedCache;\n\n while (i--) {\n seed = seeds[i];\n target = map.get(seed);\n\n target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));\n\n map = target;\n }\n\n return target;\n};\n\nconst adapter = getFetch();\n\nexport default adapter;\n"],"names":["DEFAULT_CHUNK_SIZE","isFunction","utils","encodeUTF8","str","_","hex","decodeURIComponentSafe","value","test","fn","args","maybeWithAuthCredentials","url","protocolIndex","urlToCheck","factory","env","globalObject","ReadableStream","TextEncoder","envFetch","Request","Response","isFetchSupported","isRequestSupported","isResponseSupported","isReadableStreamSupported","encodeText","encoder","supportsRequestStream","duplexAccessed","request","platform","hasContentType","supportsResponseStream","resolvers","res","type","config","method","AxiosError","getBodyLength","body","resolveBodyLength","headers","length","data","signal","cancelToken","timeout","onDownloadProgress","onUploadProgress","responseType","withCredentials","fetchOptions","maxContentLength","maxBodyLength","resolveConfig","hasMaxContentLength","hasMaxBodyLength","own","key","_fetch","composedSignal","composeSignals","unsubscribe","requestContentLength","pendingBodyError","maxBodyLengthError","auth","configAuth","username","password","parsedURL","urlUsername","urlPassword","estimateDataURLDecodedBytes","outboundLength","mustEnforceStreamBody","trackRequestStream","stream","onProgress","flush","trackStream","loadedBytes","_request","contentTypeHeader","progressEventDecorator","progressEventReducer","asyncDecorator","isCredentialsSupported","contentType","VERSION","resolvedOptions","toByteStringHeaderObject","response","responseHeaders","AxiosHeaders","declaredLength","isStreamResponse","options","prop","responseContentLength","bytesRead","onChunkProgress","responseData","materializedSize","resolve","reject","settle","err","canceledError","networkError","seedCache","getFetch","fetch","seeds","len","i","seed","target","map"],"mappings":";;;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AGQ,qBAAO,eAAeE,GAAc,SAAS;AAAA,UAC3C,WAAW;AAAA,UACX,OAAOF,EAAI,SAASA;AAAA,UACpB,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,cAAc;AAAA,QACxB,CAAS,GACKE;AAAA,MACR;AAEA,YAAMxE,EAAW,KAAKsE,GAAKA,KAAOA,EAAI,MAAMxE,GAAQP,GAAS+E,KAAOA,EAAI,QAAQ;AAAA,IAClF;AAAA,EACF;AACF,GAEMG,KAAY,oBAAI,IAAG,GAEZC,KAAW,CAAC5E,MAAW;AAClC,MAAItB,IAAOsB,KAAUA,EAAO,OAAQ,CAAA;AACpC,QAAM,EAAE,OAAA6E,GAAO,SAAA9F,GAAS,UAAAC,EAAQ,IAAKN,GAC/BoG,IAAQ,CAAC/F,GAASC,GAAU6F,CAAK;AAEvC,MAAIE,IAAMD,EAAM,QACdE,IAAID,GACJE,GACAC,GACAC,IAAMR;AAER,SAAOK;AACL,IAAAC,IAAOH,EAAME,CAAC,GACdE,IAASC,EAAI,IAAIF,CAAI,GAErBC,MAAW,UAAaC,EAAI,IAAIF,GAAOC,IAASF,IAAI,oBAAI,IAAG,IAAKvG,GAAQC,CAAG,CAAC,GAE5EyG,IAAMD;AAGR,SAAOA;AACT;AAEgBN,GAAQ;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import q from "../utils.js";
|
|
2
|
+
import C from "../core/settle.js";
|
|
3
|
+
import D from "../defaults/transitional.js";
|
|
4
|
+
import n from "../core/AxiosError.js";
|
|
5
|
+
import L from "../cancel/CanceledError.js";
|
|
6
|
+
import U from "../helpers/parseProtocol.js";
|
|
7
|
+
import v from "../platform/index.js";
|
|
8
|
+
import x from "../core/AxiosHeaders.js";
|
|
9
|
+
import { progressEventReducer as y } from "../helpers/progressEventReducer.js";
|
|
10
|
+
import O from "../helpers/resolveConfig.js";
|
|
11
|
+
import { toByteStringHeaderObject as k } from "../helpers/sanitizeHeaderValue.js";
|
|
12
|
+
const M = typeof XMLHttpRequest < "u", G = M && function(s) {
|
|
13
|
+
return new Promise(function(A, l) {
|
|
14
|
+
const t = O(s);
|
|
15
|
+
let T = t.data;
|
|
16
|
+
const R = x.from(t.headers).normalize();
|
|
17
|
+
let { responseType: d, onUploadProgress: h, onDownloadProgress: g } = t, u, w, b, p, m;
|
|
18
|
+
function a() {
|
|
19
|
+
p && p(), m && m(), t.cancelToken && t.cancelToken.unsubscribe(u), t.signal && t.signal.removeEventListener("abort", u);
|
|
20
|
+
}
|
|
21
|
+
let e = new XMLHttpRequest();
|
|
22
|
+
e.open(t.method.toUpperCase(), t.url, !0), e.timeout = t.timeout;
|
|
23
|
+
function H() {
|
|
24
|
+
if (!e)
|
|
25
|
+
return;
|
|
26
|
+
const o = x.from(
|
|
27
|
+
"getAllResponseHeaders" in e && e.getAllResponseHeaders()
|
|
28
|
+
), i = {
|
|
29
|
+
data: !d || d === "text" || d === "json" ? e.responseText : e.response,
|
|
30
|
+
status: e.status,
|
|
31
|
+
statusText: e.statusText,
|
|
32
|
+
headers: o,
|
|
33
|
+
config: s,
|
|
34
|
+
request: e
|
|
35
|
+
};
|
|
36
|
+
C(
|
|
37
|
+
function(E) {
|
|
38
|
+
A(E), a();
|
|
39
|
+
},
|
|
40
|
+
function(E) {
|
|
41
|
+
l(E), a();
|
|
42
|
+
},
|
|
43
|
+
i
|
|
44
|
+
), e = null;
|
|
45
|
+
}
|
|
46
|
+
"onloadend" in e ? e.onloadend = H : e.onreadystatechange = function() {
|
|
47
|
+
!e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.startsWith("file:")) || setTimeout(H);
|
|
48
|
+
}, e.onabort = function() {
|
|
49
|
+
e && (l(new n("Request aborted", n.ECONNABORTED, s, e)), a(), e = null);
|
|
50
|
+
}, e.onerror = function(r) {
|
|
51
|
+
const i = r && r.message ? r.message : "Network Error", f = new n(i, n.ERR_NETWORK, s, e);
|
|
52
|
+
f.event = r || null, l(f), a(), e = null;
|
|
53
|
+
}, e.ontimeout = function() {
|
|
54
|
+
let r = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded";
|
|
55
|
+
const i = t.transitional || D;
|
|
56
|
+
t.timeoutErrorMessage && (r = t.timeoutErrorMessage), l(
|
|
57
|
+
new n(
|
|
58
|
+
r,
|
|
59
|
+
i.clarifyTimeoutError ? n.ETIMEDOUT : n.ECONNABORTED,
|
|
60
|
+
s,
|
|
61
|
+
e
|
|
62
|
+
)
|
|
63
|
+
), a(), e = null;
|
|
64
|
+
}, T === void 0 && R.setContentType(null), "setRequestHeader" in e && q.forEach(k(R), function(r, i) {
|
|
65
|
+
e.setRequestHeader(i, r);
|
|
66
|
+
}), q.isUndefined(t.withCredentials) || (e.withCredentials = !!t.withCredentials), d && d !== "json" && (e.responseType = t.responseType), g && ([b, m] = y(g, !0), e.addEventListener("progress", b)), h && e.upload && ([w, p] = y(h), e.upload.addEventListener("progress", w), e.upload.addEventListener("loadend", p)), (t.cancelToken || t.signal) && (u = (o) => {
|
|
67
|
+
e && (l(!o || o.type ? new L(null, s, e) : o), e.abort(), a(), e = null);
|
|
68
|
+
}, t.cancelToken && t.cancelToken.subscribe(u), t.signal && (t.signal.aborted ? u() : t.signal.addEventListener("abort", u)));
|
|
69
|
+
const c = U(t.url);
|
|
70
|
+
if (c && !v.protocols.includes(c)) {
|
|
71
|
+
l(
|
|
72
|
+
new n(
|
|
73
|
+
"Unsupported protocol " + c + ":",
|
|
74
|
+
n.ERR_BAD_REQUEST,
|
|
75
|
+
s
|
|
76
|
+
)
|
|
77
|
+
), a();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
e.send(T || null);
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
G as default
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=xhr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xhr.js","sources":["../../../../../node_modules/axios/lib/adapters/xhr.js"],"sourcesContent":["import utils from '../utils.js';\nimport settle from '../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport { progressEventReducer } from '../helpers/progressEventReducer.js';\nimport resolveConfig from '../helpers/resolveConfig.js';\nimport { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported &&\n function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let { responseType, onUploadProgress, onDownloadProgress } = _config;\n let onCanceled;\n let uploadThrottled, downloadThrottled;\n let flushUpload, flushDownload;\n\n function done() {\n flushUpload && flushUpload(); // flush events\n flushDownload && flushDownload(); // flush events\n\n _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);\n\n _config.signal && _config.signal.removeEventListener('abort', onCanceled);\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData =\n !responseType || responseType === 'text' || responseType === 'json'\n ? request.responseText\n : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request,\n };\n\n settle(\n function _resolve(value) {\n resolve(value);\n done();\n },\n function _reject(err) {\n reject(err);\n done();\n },\n response\n );\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (\n request.status === 0 &&\n !(request.responseURL && request.responseURL.startsWith('file:'))\n ) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n done();\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError(event) {\n // Browsers deliver a ProgressEvent in XHR onerror\n // (message may be empty; when present, surface it)\n // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event\n const msg = event && event.message ? event.message : 'Network Error';\n const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);\n // attach the underlying event for consumers who want details\n err.event = event || null;\n reject(err);\n done();\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout\n ? 'timeout of ' + _config.timeout + 'ms exceeded'\n : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(\n new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n request\n )\n );\n done();\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (onDownloadProgress) {\n [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);\n request.addEventListener('progress', downloadThrottled);\n }\n\n // Not all browsers support upload events\n if (onUploadProgress && request.upload) {\n [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);\n\n request.upload.addEventListener('progress', uploadThrottled);\n\n request.upload.addEventListener('loadend', flushUpload);\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = (cancel) => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n done();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted\n ? onCanceled()\n : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && !platform.protocols.includes(protocol)) {\n reject(\n new AxiosError(\n 'Unsupported protocol ' + protocol + ':',\n AxiosError.ERR_BAD_REQUEST,\n config\n )\n );\n done();\n return;\n }\n\n // Send the request\n request.send(requestData || null);\n });\n };\n"],"names":["isXHRAdapterSupported","xhrAdapter","config","resolve","reject","_config","resolveConfig","requestData","requestHeaders","AxiosHeaders","responseType","onUploadProgress","onDownloadProgress","onCanceled","uploadThrottled","downloadThrottled","flushUpload","flushDownload","done","request","onloadend","responseHeaders","response","settle","value","err","AxiosError","event","msg","timeoutErrorMessage","transitional","transitionalDefaults","utils","toByteStringHeaderObject","val","key","progressEventReducer","cancel","CanceledError","protocol","parseProtocol","platform"],"mappings":";;;;;;;;;;;AAYA,MAAMA,IAAwB,OAAO,iBAAmB,KAExDC,IAAeD,KACb,SAAUE,GAAQ;AAChB,SAAO,IAAI,QAAQ,SAA4BC,GAASC,GAAQ;AAC9D,U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AAI,GAClFO,EAAQ,iBAAiB,YAAYJ,CAAiB,IAIpDJ,KAAoBQ,EAAQ,WAC9B,CAACL,GAAiBE,CAAW,IAAIoB,EAAqBzB,CAAgB,GAEtEQ,EAAQ,OAAO,iBAAiB,YAAYL,CAAe,GAE3DK,EAAQ,OAAO,iBAAiB,WAAWH,CAAW,KAGpDX,EAAQ,eAAeA,EAAQ,YAGjCQ,IAAa,CAACwB,MAAW;AACvB,MAAKlB,MAGLf,EAAO,CAACiC,KAAUA,EAAO,OAAO,IAAIC,EAAc,MAAMpC,GAAQiB,CAAO,IAAIkB,CAAM,GACjFlB,EAAQ,MAAK,GACbD,EAAI,GACJC,IAAU;AAAA,IACZ,GAEAd,EAAQ,eAAeA,EAAQ,YAAY,UAAUQ,CAAU,GAC3DR,EAAQ,WACVA,EAAQ,OAAO,UACXQ,EAAU,IACVR,EAAQ,OAAO,iBAAiB,SAASQ,CAAU;AAI3D,UAAM0B,IAAWC,EAAcnC,EAAQ,GAAG;AAE1C,QAAIkC,KAAY,CAACE,EAAS,UAAU,SAASF,CAAQ,GAAG;AACtD,MAAAnC;AAAA,QACE,IAAIsB;AAAA,UACF,0BAA0Ba,IAAW;AAAA,UACrCb,EAAW;AAAA,UACXxB;AAAA,QACZ;AAAA,MACA,GACQgB,EAAI;AACJ;AAAA,IACF;AAGA,IAAAC,EAAQ,KAAKZ,KAAe,IAAI;AAAA,EAClC,CAAC;AACH;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import a from "./utils.js";
|
|
2
|
+
import p from "./helpers/bind.js";
|
|
3
|
+
import m from "./core/Axios.js";
|
|
4
|
+
import i from "./core/mergeConfig.js";
|
|
5
|
+
import f from "./defaults/index.js";
|
|
6
|
+
import l from "./helpers/formDataToJSON.js";
|
|
7
|
+
import c from "./cancel/CanceledError.js";
|
|
8
|
+
import d from "./cancel/CancelToken.js";
|
|
9
|
+
import u from "./cancel/isCancel.js";
|
|
10
|
+
import { VERSION as x } from "./env/data.js";
|
|
11
|
+
import C from "./helpers/toFormData.js";
|
|
12
|
+
import A from "./core/AxiosError.js";
|
|
13
|
+
import E from "./helpers/spread.js";
|
|
14
|
+
import O from "./helpers/isAxiosError.js";
|
|
15
|
+
import S from "./core/AxiosHeaders.js";
|
|
16
|
+
import H from "./adapters/adapters.js";
|
|
17
|
+
import T from "./helpers/HttpStatusCode.js";
|
|
18
|
+
function n(o) {
|
|
19
|
+
const t = new m(o), e = p(m.prototype.request, t);
|
|
20
|
+
return a.extend(e, m.prototype, t, { allOwnKeys: !0 }), a.extend(e, t, null, { allOwnKeys: !0 }), e.create = function(s) {
|
|
21
|
+
return n(i(o, s));
|
|
22
|
+
}, e;
|
|
23
|
+
}
|
|
24
|
+
const r = n(f);
|
|
25
|
+
r.Axios = m;
|
|
26
|
+
r.CanceledError = c;
|
|
27
|
+
r.CancelToken = d;
|
|
28
|
+
r.isCancel = u;
|
|
29
|
+
r.VERSION = x;
|
|
30
|
+
r.toFormData = C;
|
|
31
|
+
r.AxiosError = A;
|
|
32
|
+
r.Cancel = r.CanceledError;
|
|
33
|
+
r.all = function(t) {
|
|
34
|
+
return Promise.all(t);
|
|
35
|
+
};
|
|
36
|
+
r.spread = E;
|
|
37
|
+
r.isAxiosError = O;
|
|
38
|
+
r.mergeConfig = i;
|
|
39
|
+
r.AxiosHeaders = S;
|
|
40
|
+
r.formToJSON = (o) => l(a.isHTMLForm(o) ? new FormData(o) : o);
|
|
41
|
+
r.getAdapter = H.getAdapter;
|
|
42
|
+
r.HttpStatusCode = T;
|
|
43
|
+
r.default = r;
|
|
44
|
+
export {
|
|
45
|
+
r as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=axios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.js","sources":["../../../../node_modules/axios/lib/axios.js"],"sourcesContent":["'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport { VERSION } from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from './core/AxiosHeaders.js';\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, { allOwnKeys: true });\n\n // Copy context to instance\n utils.extend(instance, context, null, { allOwnKeys: true });\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios;\n"],"names":["createInstance","defaultConfig","context","Axios","instance","bind","utils","instanceConfig","mergeConfig","axios","defaults","CanceledError","CancelToken","isCancel","VERSION","toFormData","AxiosError","promises","spread","isAxiosError","AxiosHeaders","thing","formDataToJSON","adapters","HttpStatusCode"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,SAASA,EAAeC,GAAe;AACrC,QAAMC,IAAU,IAAIC,EAAMF,CAAa,GACjCG,IAAWC,EAAKF,EAAM,UAAU,SAASD,CAAO;AAGtD,SAAAI,EAAM,OAAOF,GAAUD,EAAM,WAAWD,GAAS,EAAE,YAAY,IAAM,GAGrEI,EAAM,OAAOF,GAAUF,GAAS,MAAM,EAAE,YAAY,IAAM,GAG1DE,EAAS,SAAS,SAAgBG,GAAgB;AAChD,WAAOP,EAAeQ,EAAYP,GAAeM,CAAc,CAAC;AAAA,EAClE,GAEOH;AACT;AAGK,MAACK,IAAQT,EAAeU,CAAQ;AAGrCD,EAAM,QAAQN;AAGdM,EAAM,gBAAgBE;AACtBF,EAAM,cAAcG;AACpBH,EAAM,WAAWI;AACjBJ,EAAM,UAAUK;AAChBL,EAAM,aAAaM;AAGnBN,EAAM,aAAaO;AAGnBP,EAAM,SAASA,EAAM;AAGrBA,EAAM,MAAM,SAAaQ,GAAU;AACjC,SAAO,QAAQ,IAAIA,CAAQ;AAC7B;AAEAR,EAAM,SAASS;AAGfT,EAAM,eAAeU;AAGrBV,EAAM,cAAcD;AAEpBC,EAAM,eAAeW;AAErBX,EAAM,aAAa,CAACY,MAAUC,EAAehB,EAAM,WAAWe,CAAK,IAAI,IAAI,SAASA,CAAK,IAAIA,CAAK;AAElGZ,EAAM,aAAac,EAAS;AAE5Bd,EAAM,iBAAiBe;AAEvBf,EAAM,UAAUA;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import u from "./CanceledError.js";
|
|
2
|
+
class c {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
if (typeof e != "function")
|
|
5
|
+
throw new TypeError("executor must be a function.");
|
|
6
|
+
let t;
|
|
7
|
+
this.promise = new Promise(function(r) {
|
|
8
|
+
t = r;
|
|
9
|
+
});
|
|
10
|
+
const s = this;
|
|
11
|
+
this.promise.then((n) => {
|
|
12
|
+
if (!s._listeners) return;
|
|
13
|
+
let r = s._listeners.length;
|
|
14
|
+
for (; r-- > 0; )
|
|
15
|
+
s._listeners[r](n);
|
|
16
|
+
s._listeners = null;
|
|
17
|
+
}), this.promise.then = (n) => {
|
|
18
|
+
let r;
|
|
19
|
+
const o = new Promise((i) => {
|
|
20
|
+
s.subscribe(i), r = i;
|
|
21
|
+
}).then(n);
|
|
22
|
+
return o.cancel = function() {
|
|
23
|
+
s.unsubscribe(r);
|
|
24
|
+
}, o;
|
|
25
|
+
}, e(function(r, o, i) {
|
|
26
|
+
s.reason || (s.reason = new u(r, o, i), t(s.reason));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
31
|
+
*/
|
|
32
|
+
throwIfRequested() {
|
|
33
|
+
if (this.reason)
|
|
34
|
+
throw this.reason;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Subscribe to the cancel signal
|
|
38
|
+
*/
|
|
39
|
+
subscribe(e) {
|
|
40
|
+
if (this.reason) {
|
|
41
|
+
e(this.reason);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this._listeners ? this._listeners.push(e) : this._listeners = [e];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Unsubscribe from the cancel signal
|
|
48
|
+
*/
|
|
49
|
+
unsubscribe(e) {
|
|
50
|
+
if (!this._listeners)
|
|
51
|
+
return;
|
|
52
|
+
const t = this._listeners.indexOf(e);
|
|
53
|
+
t !== -1 && this._listeners.splice(t, 1);
|
|
54
|
+
}
|
|
55
|
+
toAbortSignal() {
|
|
56
|
+
const e = new AbortController(), t = (s) => {
|
|
57
|
+
e.abort(s);
|
|
58
|
+
};
|
|
59
|
+
return this.subscribe(t), e.signal.unsubscribe = () => this.unsubscribe(t), e.signal;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
63
|
+
* cancels the `CancelToken`.
|
|
64
|
+
*/
|
|
65
|
+
static source() {
|
|
66
|
+
let e;
|
|
67
|
+
return {
|
|
68
|
+
token: new c(function(n) {
|
|
69
|
+
e = n;
|
|
70
|
+
}),
|
|
71
|
+
cancel: e
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
c as default
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=CancelToken.js.map
|