@cccsaurora/clue-ui 0.15.0-dev.31 → 0.15.0-dev.35
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/{ActionForm-DgfJwTzt.js → ActionForm-oJuQC4we.js} +1 -1
- package/{ClueEnrichContext-DXwLVp0M.js → ClueEnrichContext-DxA21fqe.js} +1 -1
- package/components/AnnotationDetails.js +1 -1
- package/components/EnrichedCard.js +1 -1
- package/components/actions/ActionForm.js +1 -1
- package/components/enrichment/EnrichPopover.js +1 -1
- package/components/group/GroupControl.js +1 -1
- package/hooks/ClueActionContext.js +2 -2
- package/hooks/ClueEnrichContext.js +2 -2
- package/hooks/ClueFetcherContext.js +1 -1
- package/hooks/ClueProvider.js +2 -2
- package/hooks/selectors.js +2 -2
- package/hooks/useClue.js +1 -1
- package/hooks/useClueActions.js +1 -1
- package/hooks/useClueTypeConfig.js +1 -1
- package/icons/Action.js +1 -1
- package/main.js +2 -2
- package/package.json +1 -1
- package/{useClueTypeConfig-D9ZSxa4F.js → useClueTypeConfig-CkNWpHd2.js} +264 -181
|
@@ -7,7 +7,7 @@ import { J as JSONViewer } from "./index-BDrtH5ec.js";
|
|
|
7
7
|
import { ClueComponentContext } from "./hooks/ClueComponentContext.js";
|
|
8
8
|
import { c as createContext, u as useContextSelector, a as useContext } from "./index-BDVjGvMI.js";
|
|
9
9
|
import { A as Ajv } from "./index-Dn2NHyXg.js";
|
|
10
|
-
import { a as api } from "./useClueTypeConfig-
|
|
10
|
+
import { a as api } from "./useClueTypeConfig-CkNWpHd2.js";
|
|
11
11
|
import { useState, useCallback, useEffect, useMemo, memo } from "react";
|
|
12
12
|
import ErrorBoundary from "./components/ErrorBoundary.js";
|
|
13
13
|
import { adaptSchema } from "./components/actions/form/schemaAdapter.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { a as addAPIProvider } from "./iconify-CXMreGTg.js";
|
|
3
|
-
import { u as useClueTypeConfig, a as api, p as post } from "./useClueTypeConfig-
|
|
3
|
+
import { u as useClueTypeConfig, a as api, p as post } from "./useClueTypeConfig-CkNWpHd2.js";
|
|
4
4
|
import { clueDebugLogger } from "./utils/loggerUtil.js";
|
|
5
5
|
import { useContext, useMemo, useState, useRef, useEffect, useCallback } from "react";
|
|
6
6
|
import { c as createContext } from "./index-BDVjGvMI.js";
|
|
@@ -15,7 +15,7 @@ import ExecutePopover from "./actions/ExecutePopover.js";
|
|
|
15
15
|
import AnnotationEntry from "./AnnotationEntry.js";
|
|
16
16
|
import ClassificationChip from "./ClassificationChip.js";
|
|
17
17
|
import EnrichPopover from "./enrichment/EnrichPopover.js";
|
|
18
|
-
import { u as uniq } from "../ClueEnrichContext-
|
|
18
|
+
import { u as uniq } from "../ClueEnrichContext-DxA21fqe.js";
|
|
19
19
|
import { g as groupBy } from "../groupBy-DC2oOuBN.js";
|
|
20
20
|
import { i as isNull } from "../isUndefined-CE8h73dH.js";
|
|
21
21
|
const AnnotationDetails = ({ enrichRequest, setReady, updatePosition }) => {
|
|
@@ -13,7 +13,7 @@ import FrequencyText from "../text/Frequency.js";
|
|
|
13
13
|
import { memo, useState, useMemo, useCallback } from "react";
|
|
14
14
|
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
|
15
15
|
import AnnotationEntry from "./AnnotationEntry.js";
|
|
16
|
-
import { u as uniq } from "../ClueEnrichContext-
|
|
16
|
+
import { u as uniq } from "../ClueEnrichContext-DxA21fqe.js";
|
|
17
17
|
const EnrichedCard = ({
|
|
18
18
|
type,
|
|
19
19
|
value,
|
|
@@ -5,7 +5,7 @@ import "@mui/material";
|
|
|
5
5
|
import "../display/icons/Iconified.js";
|
|
6
6
|
import "../../index-BDrtH5ec.js";
|
|
7
7
|
import "../../hooks/ClueComponentContext.js";
|
|
8
|
-
import { A } from "../../ActionForm-
|
|
8
|
+
import { A } from "../../ActionForm-oJuQC4we.js";
|
|
9
9
|
import "react";
|
|
10
10
|
import "../../index-BDVjGvMI.js";
|
|
11
11
|
import "../ErrorBoundary.js";
|
|
@@ -3,7 +3,7 @@ import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper
|
|
|
3
3
|
import { useClueComponentSelector, useClueEnrichSelector } from "../../hooks/selectors.js";
|
|
4
4
|
import { useState, useRef, useCallback, useEffect } from "react";
|
|
5
5
|
import Iconified from "../display/icons/Iconified.js";
|
|
6
|
-
import { c as capitalize } from "../../ActionForm-
|
|
6
|
+
import { c as capitalize } from "../../ActionForm-oJuQC4we.js";
|
|
7
7
|
const EnrichPopover = ({ show = false, size = "small", selector }) => {
|
|
8
8
|
const { t } = useClueComponentSelector((ctx) => ctx.i18next);
|
|
9
9
|
const theme = useTheme();
|
|
@@ -9,7 +9,7 @@ import { safeDispatchEvent } from "../../utils/window.js";
|
|
|
9
9
|
import { useState, useMemo, useCallback } from "react";
|
|
10
10
|
import { u as useContextSelector } from "../../index-BDVjGvMI.js";
|
|
11
11
|
import ExecutePopover from "../actions/ExecutePopover.js";
|
|
12
|
-
import { c as capitalize } from "../../ActionForm-
|
|
12
|
+
import { c as capitalize } from "../../ActionForm-oJuQC4we.js";
|
|
13
13
|
const GroupControl = () => {
|
|
14
14
|
const { t } = useClueComponentSelector((ctx) => ctx.i18next);
|
|
15
15
|
const { type, values, classification } = useContextSelector(ClueGroupContext, (ctx) => ({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "@mui/material";
|
|
3
3
|
import "../index-Dn2NHyXg.js";
|
|
4
|
-
import "../useClueTypeConfig-
|
|
5
|
-
import { a, C } from "../ActionForm-
|
|
4
|
+
import "../useClueTypeConfig-CkNWpHd2.js";
|
|
5
|
+
import { a, C } from "../ActionForm-oJuQC4we.js";
|
|
6
6
|
import "../components/actions/ResultModal.js";
|
|
7
7
|
import "../components/display/icons/Iconified.js";
|
|
8
8
|
import "../components/ErrorBoundary.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../iconify-CXMreGTg.js";
|
|
3
|
-
import "../useClueTypeConfig-
|
|
3
|
+
import "../useClueTypeConfig-CkNWpHd2.js";
|
|
4
4
|
import "../utils/loggerUtil.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "../index-BDVjGvMI.js";
|
|
7
7
|
import "./ClueDatabaseContext.js";
|
|
8
8
|
import "./useClueConfig.js";
|
|
9
|
-
import { C, a } from "../ClueEnrichContext-
|
|
9
|
+
import { C, a } from "../ClueEnrichContext-DxA21fqe.js";
|
|
10
10
|
import "../groupBy-DC2oOuBN.js";
|
|
11
11
|
import "../debounce-bV0h5FC5.js";
|
|
12
12
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { a as api } from "../useClueTypeConfig-
|
|
2
|
+
import { a as api } from "../useClueTypeConfig-CkNWpHd2.js";
|
|
3
3
|
import { useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
4
4
|
import { c as createContext } from "../index-BDVjGvMI.js";
|
|
5
5
|
import useClue from "./useClue.js";
|
package/hooks/ClueProvider.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { C as ClueActionProvider } from "../ActionForm-
|
|
2
|
+
import { C as ClueActionProvider } from "../ActionForm-oJuQC4we.js";
|
|
3
3
|
import { ClueComponentProvider } from "./ClueComponentContext.js";
|
|
4
4
|
import { ClueConfigProvider } from "./ClueConfigProvider.js";
|
|
5
5
|
import { ClueDatabaseProvider } from "./ClueDatabaseContext.js";
|
|
6
|
-
import { a as ClueEnrichProvider } from "../ClueEnrichContext-
|
|
6
|
+
import { a as ClueEnrichProvider } from "../ClueEnrichContext-DxA21fqe.js";
|
|
7
7
|
import { ClueFetcherProvider } from "./ClueFetcherContext.js";
|
|
8
8
|
import { a as CluePopupProvider } from "../AnnotationPreview-BvNpZOP0.js";
|
|
9
9
|
const ClueProvider = ({ children, ...props }) => {
|
package/hooks/selectors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
|
2
|
-
import { a as ClueActionContext } from "../ActionForm-
|
|
2
|
+
import { a as ClueActionContext } from "../ActionForm-oJuQC4we.js";
|
|
3
3
|
import { ClueComponentContext } from "./ClueComponentContext.js";
|
|
4
|
-
import { C as ClueEnrichContext } from "../ClueEnrichContext-
|
|
4
|
+
import { C as ClueEnrichContext } from "../ClueEnrichContext-DxA21fqe.js";
|
|
5
5
|
import { ClueFetcherContext } from "./ClueFetcherContext.js";
|
|
6
6
|
const useClueFetcherSelector = (selector) => {
|
|
7
7
|
return useContextSelector(ClueFetcherContext, selector);
|
package/hooks/useClue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as useContext } from "../index-BDVjGvMI.js";
|
|
2
|
-
import { C as ClueEnrichContext } from "../ClueEnrichContext-
|
|
2
|
+
import { C as ClueEnrichContext } from "../ClueEnrichContext-DxA21fqe.js";
|
|
3
3
|
const useClue = () => {
|
|
4
4
|
return useContext(ClueEnrichContext);
|
|
5
5
|
};
|
package/hooks/useClueActions.js
CHANGED
package/icons/Action.js
CHANGED
|
@@ -3,7 +3,7 @@ import { I as Icon } from "../iconify-CXMreGTg.js";
|
|
|
3
3
|
import { useTheme, Stack, Divider, Typography } from "@mui/material";
|
|
4
4
|
import CountBadge from "../components/CountBadge.js";
|
|
5
5
|
import { C as CluePopupContext } from "../AnnotationPreview-BvNpZOP0.js";
|
|
6
|
-
import { u as useClueActions } from "../ActionForm-
|
|
6
|
+
import { u as useClueActions } from "../ActionForm-oJuQC4we.js";
|
|
7
7
|
import { memo, useRef, useMemo, useEffect } from "react";
|
|
8
8
|
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
|
9
9
|
import { g as groupBy } from "../groupBy-DC2oOuBN.js";
|
package/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, u, u as u2 } from "./ActionForm-
|
|
1
|
+
import { A, u, u as u2 } from "./ActionForm-oJuQC4we.js";
|
|
2
2
|
import { default as default2 } from "./components/AnnotationDetailPopover.js";
|
|
3
3
|
import { default as default3 } from "./components/AnnotationDetails.js";
|
|
4
4
|
import { default as default4 } from "./components/AnnotationEntry.js";
|
|
@@ -17,7 +17,7 @@ import { SNACKBAR_EVENT_ID } from "./data/event.js";
|
|
|
17
17
|
import { b } from "./index-Dn2NHyXg.js";
|
|
18
18
|
import { ClueComponentContext, ClueComponentContext as ClueComponentContext2 } from "./hooks/ClueComponentContext.js";
|
|
19
19
|
import { ClueDatabaseContext, ClueDatabaseContext as ClueDatabaseContext2 } from "./hooks/ClueDatabaseContext.js";
|
|
20
|
-
import { C as C3, C as C4 } from "./ClueEnrichContext-
|
|
20
|
+
import { C as C3, C as C4 } from "./ClueEnrichContext-DxA21fqe.js";
|
|
21
21
|
import { ClueProvider, ClueProvider as ClueProvider2 } from "./hooks/ClueProvider.js";
|
|
22
22
|
import { useClueActionsSelector, useClueEnrichSelector, useClueFetcherSelector, useClueActionsSelector as useClueActionsSelector2, useClueEnrichSelector as useClueEnrichSelector2, useClueFetcherSelector as useClueFetcherSelector2 } from "./hooks/selectors.js";
|
|
23
23
|
import { default as default15, default as default16 } from "./hooks/useClue.js";
|
package/package.json
CHANGED
|
@@ -208,7 +208,7 @@ const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
|
208
208
|
const { isArray } = Array;
|
|
209
209
|
const isUndefined = typeOfTest("undefined");
|
|
210
210
|
function isBuffer(val) {
|
|
211
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
211
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
212
212
|
}
|
|
213
213
|
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
214
214
|
function isArrayBufferView(val) {
|
|
@@ -221,7 +221,7 @@ function isArrayBufferView(val) {
|
|
|
221
221
|
return result;
|
|
222
222
|
}
|
|
223
223
|
const isString = typeOfTest("string");
|
|
224
|
-
const isFunction = typeOfTest("function");
|
|
224
|
+
const isFunction$1 = typeOfTest("function");
|
|
225
225
|
const isNumber = typeOfTest("number");
|
|
226
226
|
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
227
227
|
const isBoolean = (thing) => thing === true || thing === false;
|
|
@@ -232,15 +232,25 @@ const isPlainObject = (val) => {
|
|
|
232
232
|
const prototype2 = getPrototypeOf(val);
|
|
233
233
|
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
234
234
|
};
|
|
235
|
+
const isEmptyObject = (val) => {
|
|
236
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
241
|
+
} catch (e) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
235
245
|
const isDate = kindOfTest("Date");
|
|
236
246
|
const isFile = kindOfTest("File");
|
|
237
247
|
const isBlob = kindOfTest("Blob");
|
|
238
248
|
const isFileList = kindOfTest("FileList");
|
|
239
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
249
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
240
250
|
const isFormData = (thing) => {
|
|
241
251
|
let kind;
|
|
242
|
-
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
243
|
-
kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
|
|
252
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
253
|
+
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
|
|
244
254
|
};
|
|
245
255
|
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
246
256
|
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
@@ -259,6 +269,9 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
259
269
|
fn.call(null, obj[i], i, obj);
|
|
260
270
|
}
|
|
261
271
|
} else {
|
|
272
|
+
if (isBuffer(obj)) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
262
275
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
263
276
|
const len = keys.length;
|
|
264
277
|
let key;
|
|
@@ -269,6 +282,9 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
269
282
|
}
|
|
270
283
|
}
|
|
271
284
|
function findKey(obj, key) {
|
|
285
|
+
if (isBuffer(obj)) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
272
288
|
key = key.toLowerCase();
|
|
273
289
|
const keys = Object.keys(obj);
|
|
274
290
|
let i = keys.length;
|
|
@@ -287,7 +303,7 @@ const _global = (() => {
|
|
|
287
303
|
})();
|
|
288
304
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
289
305
|
function merge() {
|
|
290
|
-
const { caseless } = isContextDefined(this) && this || {};
|
|
306
|
+
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
291
307
|
const result = {};
|
|
292
308
|
const assignValue = (val, key) => {
|
|
293
309
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -298,7 +314,9 @@ function merge() {
|
|
|
298
314
|
} else if (isArray(val)) {
|
|
299
315
|
result[targetKey] = val.slice();
|
|
300
316
|
} else {
|
|
301
|
-
|
|
317
|
+
if (!skipUndefined || !isUndefined(val)) {
|
|
318
|
+
result[targetKey] = val;
|
|
319
|
+
}
|
|
302
320
|
}
|
|
303
321
|
};
|
|
304
322
|
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
@@ -308,7 +326,7 @@ function merge() {
|
|
|
308
326
|
}
|
|
309
327
|
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
310
328
|
forEach(b, (val, key) => {
|
|
311
|
-
if (thisArg && isFunction(val)) {
|
|
329
|
+
if (thisArg && isFunction$1(val)) {
|
|
312
330
|
a[key] = bind(val, thisArg);
|
|
313
331
|
} else {
|
|
314
332
|
a[key] = val;
|
|
@@ -417,11 +435,11 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
417
435
|
};
|
|
418
436
|
const freezeMethods = (obj) => {
|
|
419
437
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
420
|
-
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
438
|
+
if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
421
439
|
return false;
|
|
422
440
|
}
|
|
423
441
|
const value = obj[name];
|
|
424
|
-
if (!isFunction(value)) return;
|
|
442
|
+
if (!isFunction$1(value)) return;
|
|
425
443
|
descriptor.enumerable = false;
|
|
426
444
|
if ("writable" in descriptor) {
|
|
427
445
|
descriptor.writable = false;
|
|
@@ -450,7 +468,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
450
468
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
451
469
|
};
|
|
452
470
|
function isSpecCompliantForm(thing) {
|
|
453
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
471
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
454
472
|
}
|
|
455
473
|
const toJSONObject = (obj) => {
|
|
456
474
|
const stack = new Array(10);
|
|
@@ -459,6 +477,9 @@ const toJSONObject = (obj) => {
|
|
|
459
477
|
if (stack.indexOf(source) >= 0) {
|
|
460
478
|
return;
|
|
461
479
|
}
|
|
480
|
+
if (isBuffer(source)) {
|
|
481
|
+
return source;
|
|
482
|
+
}
|
|
462
483
|
if (!("toJSON" in source)) {
|
|
463
484
|
stack[i] = source;
|
|
464
485
|
const target = isArray(source) ? [] : {};
|
|
@@ -475,7 +496,7 @@ const toJSONObject = (obj) => {
|
|
|
475
496
|
return visit(obj, 0);
|
|
476
497
|
};
|
|
477
498
|
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
478
|
-
const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
499
|
+
const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
479
500
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
480
501
|
if (setImmediateSupported) {
|
|
481
502
|
return setImmediate;
|
|
@@ -493,10 +514,10 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
493
514
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
494
515
|
})(
|
|
495
516
|
typeof setImmediate === "function",
|
|
496
|
-
isFunction(_global.postMessage)
|
|
517
|
+
isFunction$1(_global.postMessage)
|
|
497
518
|
);
|
|
498
519
|
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
499
|
-
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
520
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
500
521
|
const utils$1 = {
|
|
501
522
|
isArray,
|
|
502
523
|
isArrayBuffer,
|
|
@@ -508,6 +529,7 @@ const utils$1 = {
|
|
|
508
529
|
isBoolean,
|
|
509
530
|
isObject,
|
|
510
531
|
isPlainObject,
|
|
532
|
+
isEmptyObject,
|
|
511
533
|
isReadableStream,
|
|
512
534
|
isRequest,
|
|
513
535
|
isResponse,
|
|
@@ -517,7 +539,7 @@ const utils$1 = {
|
|
|
517
539
|
isFile,
|
|
518
540
|
isBlob,
|
|
519
541
|
isRegExp,
|
|
520
|
-
isFunction,
|
|
542
|
+
isFunction: isFunction$1,
|
|
521
543
|
isStream,
|
|
522
544
|
isURLSearchParams,
|
|
523
545
|
isTypedArray,
|
|
@@ -622,9 +644,13 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
|
622
644
|
}, (prop) => {
|
|
623
645
|
return prop !== "isAxiosError";
|
|
624
646
|
});
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
axiosError
|
|
647
|
+
const msg = error && error.message ? error.message : "Error";
|
|
648
|
+
const errCode = code == null && error ? error.code : code;
|
|
649
|
+
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
650
|
+
if (error && axiosError.cause == null) {
|
|
651
|
+
Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
|
|
652
|
+
}
|
|
653
|
+
axiosError.name = error && error.name || "Error";
|
|
628
654
|
customProps && Object.assign(axiosError, customProps);
|
|
629
655
|
return axiosError;
|
|
630
656
|
};
|
|
@@ -674,6 +700,9 @@ function toFormData$1(obj, formData, options) {
|
|
|
674
700
|
if (utils$1.isDate(value)) {
|
|
675
701
|
return value.toISOString();
|
|
676
702
|
}
|
|
703
|
+
if (utils$1.isBoolean(value)) {
|
|
704
|
+
return value.toString();
|
|
705
|
+
}
|
|
677
706
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
678
707
|
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
679
708
|
}
|
|
@@ -769,7 +798,7 @@ prototype.toString = function toString2(encoder) {
|
|
|
769
798
|
}, "").join("&");
|
|
770
799
|
};
|
|
771
800
|
function encode(val) {
|
|
772
|
-
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+")
|
|
801
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
773
802
|
}
|
|
774
803
|
function buildURL(url, params, options) {
|
|
775
804
|
if (!params) {
|
|
@@ -896,15 +925,16 @@ const platform = {
|
|
|
896
925
|
...platform$1
|
|
897
926
|
};
|
|
898
927
|
function toURLEncodedForm(data, options) {
|
|
899
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(),
|
|
928
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
900
929
|
visitor: function(value, key, path, helpers) {
|
|
901
930
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
902
931
|
this.append(key, value.toString("base64"));
|
|
903
932
|
return false;
|
|
904
933
|
}
|
|
905
934
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
906
|
-
}
|
|
907
|
-
|
|
935
|
+
},
|
|
936
|
+
...options
|
|
937
|
+
});
|
|
908
938
|
}
|
|
909
939
|
function parsePropPath(name) {
|
|
910
940
|
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
@@ -1024,7 +1054,7 @@ const defaults = {
|
|
|
1024
1054
|
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
1025
1055
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1026
1056
|
try {
|
|
1027
|
-
return JSON.parse(data);
|
|
1057
|
+
return JSON.parse(data, this.parseReviver);
|
|
1028
1058
|
} catch (e) {
|
|
1029
1059
|
if (strictJSONParsing) {
|
|
1030
1060
|
if (e.name === "SyntaxError") {
|
|
@@ -1415,7 +1445,7 @@ function throttle(fn, freq) {
|
|
|
1415
1445
|
clearTimeout(timer);
|
|
1416
1446
|
timer = null;
|
|
1417
1447
|
}
|
|
1418
|
-
fn
|
|
1448
|
+
fn(...args);
|
|
1419
1449
|
};
|
|
1420
1450
|
const throttled = (...args) => {
|
|
1421
1451
|
const now = Date.now();
|
|
@@ -1590,7 +1620,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
1590
1620
|
validateStatus: mergeDirectKeys,
|
|
1591
1621
|
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
1592
1622
|
};
|
|
1593
|
-
utils$1.forEach(Object.keys(
|
|
1623
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
1594
1624
|
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
1595
1625
|
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
1596
1626
|
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
@@ -1608,13 +1638,17 @@ const resolveConfig = (config) => {
|
|
|
1608
1638
|
"Basic " + btoa((auth2.username || "") + ":" + (auth2.password ? unescape(encodeURIComponent(auth2.password)) : ""))
|
|
1609
1639
|
);
|
|
1610
1640
|
}
|
|
1611
|
-
let contentType;
|
|
1612
1641
|
if (utils$1.isFormData(data)) {
|
|
1613
1642
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
1614
1643
|
headers.setContentType(void 0);
|
|
1615
|
-
} else if ((
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1644
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
1645
|
+
const formHeaders = data.getHeaders();
|
|
1646
|
+
const allowedHeaders = ["content-type", "content-length"];
|
|
1647
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
1648
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
1649
|
+
headers.set(key, val);
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1618
1652
|
}
|
|
1619
1653
|
}
|
|
1620
1654
|
if (platform.hasStandardBrowserEnv) {
|
|
@@ -1692,8 +1726,11 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
|
1692
1726
|
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
1693
1727
|
request = null;
|
|
1694
1728
|
};
|
|
1695
|
-
request.onerror = function handleError() {
|
|
1696
|
-
|
|
1729
|
+
request.onerror = function handleError(event) {
|
|
1730
|
+
const msg = event && event.message ? event.message : "Network Error";
|
|
1731
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
1732
|
+
err.event = event || null;
|
|
1733
|
+
reject(err);
|
|
1697
1734
|
request = null;
|
|
1698
1735
|
};
|
|
1699
1736
|
request.ontimeout = function handleTimeout() {
|
|
@@ -1861,9 +1898,17 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
1861
1898
|
highWaterMark: 2
|
|
1862
1899
|
});
|
|
1863
1900
|
};
|
|
1864
|
-
const
|
|
1865
|
-
const
|
|
1866
|
-
const
|
|
1901
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
1902
|
+
const { isFunction } = utils$1;
|
|
1903
|
+
const globalFetchAPI = (({ fetch, Request, Response }) => ({
|
|
1904
|
+
fetch,
|
|
1905
|
+
Request,
|
|
1906
|
+
Response
|
|
1907
|
+
}))(utils$1.global);
|
|
1908
|
+
const {
|
|
1909
|
+
ReadableStream: ReadableStream$1,
|
|
1910
|
+
TextEncoder
|
|
1911
|
+
} = utils$1.global;
|
|
1867
1912
|
const test = (fn, ...args) => {
|
|
1868
1913
|
try {
|
|
1869
1914
|
return !!fn(...args);
|
|
@@ -1871,162 +1916,200 @@ const test = (fn, ...args) => {
|
|
|
1871
1916
|
return false;
|
|
1872
1917
|
}
|
|
1873
1918
|
};
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1876
|
-
const
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
return "half";
|
|
1882
|
-
}
|
|
1883
|
-
}).headers.has("Content-Type");
|
|
1884
|
-
return duplexAccessed && !hasContentType;
|
|
1885
|
-
});
|
|
1886
|
-
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
1887
|
-
const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
1888
|
-
const resolvers = {
|
|
1889
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
1890
|
-
};
|
|
1891
|
-
isFetchSupported && ((res) => {
|
|
1892
|
-
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
1893
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
|
|
1894
|
-
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
1895
|
-
});
|
|
1896
|
-
});
|
|
1897
|
-
})(new Response());
|
|
1898
|
-
const getBodyLength = async (body) => {
|
|
1899
|
-
if (body == null) {
|
|
1900
|
-
return 0;
|
|
1901
|
-
}
|
|
1902
|
-
if (utils$1.isBlob(body)) {
|
|
1903
|
-
return body.size;
|
|
1919
|
+
const factory = (env) => {
|
|
1920
|
+
const { fetch, Request, Response } = Object.assign({}, globalFetchAPI, env);
|
|
1921
|
+
const isFetchSupported = isFunction(fetch);
|
|
1922
|
+
const isRequestSupported = isFunction(Request);
|
|
1923
|
+
const isResponseSupported = isFunction(Response);
|
|
1924
|
+
if (!isFetchSupported) {
|
|
1925
|
+
return false;
|
|
1904
1926
|
}
|
|
1905
|
-
|
|
1906
|
-
|
|
1927
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
1928
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
1929
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
1930
|
+
let duplexAccessed = false;
|
|
1931
|
+
const hasContentType = new Request(platform.origin, {
|
|
1932
|
+
body: new ReadableStream$1(),
|
|
1907
1933
|
method: "POST",
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
return
|
|
1914
|
-
}
|
|
1915
|
-
if (utils$1.isURLSearchParams(body)) {
|
|
1916
|
-
body = body + "";
|
|
1917
|
-
}
|
|
1918
|
-
if (utils$1.isString(body)) {
|
|
1919
|
-
return (await encodeText(body)).byteLength;
|
|
1920
|
-
}
|
|
1921
|
-
};
|
|
1922
|
-
const resolveBodyLength = async (headers, body) => {
|
|
1923
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
1924
|
-
return length == null ? getBodyLength(body) : length;
|
|
1925
|
-
};
|
|
1926
|
-
const fetchAdapter = isFetchSupported && (async (config) => {
|
|
1927
|
-
let {
|
|
1928
|
-
url,
|
|
1929
|
-
method,
|
|
1930
|
-
data,
|
|
1931
|
-
signal,
|
|
1932
|
-
cancelToken,
|
|
1933
|
-
timeout,
|
|
1934
|
-
onDownloadProgress,
|
|
1935
|
-
onUploadProgress,
|
|
1936
|
-
responseType,
|
|
1937
|
-
headers,
|
|
1938
|
-
withCredentials = "same-origin",
|
|
1939
|
-
fetchOptions
|
|
1940
|
-
} = resolveConfig(config);
|
|
1941
|
-
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
1942
|
-
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
1943
|
-
let request;
|
|
1944
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
1945
|
-
composedSignal.unsubscribe();
|
|
1934
|
+
get duplex() {
|
|
1935
|
+
duplexAccessed = true;
|
|
1936
|
+
return "half";
|
|
1937
|
+
}
|
|
1938
|
+
}).headers.has("Content-Type");
|
|
1939
|
+
return duplexAccessed && !hasContentType;
|
|
1946
1940
|
});
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1941
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
1942
|
+
const resolvers = {
|
|
1943
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
1944
|
+
};
|
|
1945
|
+
isFetchSupported && (() => {
|
|
1946
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
1947
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
1948
|
+
let method = res && res[type];
|
|
1949
|
+
if (method) {
|
|
1950
|
+
return method.call(res);
|
|
1951
|
+
}
|
|
1952
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
1954
1953
|
});
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
const [onProgress, flush] = progressEventDecorator(
|
|
1961
|
-
requestContentLength,
|
|
1962
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
1963
|
-
);
|
|
1964
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
1965
|
-
}
|
|
1954
|
+
});
|
|
1955
|
+
})();
|
|
1956
|
+
const getBodyLength = async (body) => {
|
|
1957
|
+
if (body == null) {
|
|
1958
|
+
return 0;
|
|
1966
1959
|
}
|
|
1967
|
-
if (
|
|
1968
|
-
|
|
1960
|
+
if (utils$1.isBlob(body)) {
|
|
1961
|
+
return body.size;
|
|
1969
1962
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
method: method.toUpperCase(),
|
|
1975
|
-
headers: headers.normalize().toJSON(),
|
|
1976
|
-
body: data,
|
|
1977
|
-
duplex: "half",
|
|
1978
|
-
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
1979
|
-
});
|
|
1980
|
-
let response = await fetch(request);
|
|
1981
|
-
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
1982
|
-
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
1983
|
-
const options = {};
|
|
1984
|
-
["status", "statusText", "headers"].forEach((prop) => {
|
|
1985
|
-
options[prop] = response[prop];
|
|
1963
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
1964
|
+
const _request = new Request(platform.origin, {
|
|
1965
|
+
method: "POST",
|
|
1966
|
+
body
|
|
1986
1967
|
});
|
|
1987
|
-
|
|
1988
|
-
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
1989
|
-
responseContentLength,
|
|
1990
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
1991
|
-
) || [];
|
|
1992
|
-
response = new Response(
|
|
1993
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
1994
|
-
flush && flush();
|
|
1995
|
-
unsubscribe && unsubscribe();
|
|
1996
|
-
}),
|
|
1997
|
-
options
|
|
1998
|
-
);
|
|
1968
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
1999
1969
|
}
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
1970
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
1971
|
+
return body.byteLength;
|
|
1972
|
+
}
|
|
1973
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
1974
|
+
body = body + "";
|
|
1975
|
+
}
|
|
1976
|
+
if (utils$1.isString(body)) {
|
|
1977
|
+
return (await encodeText(body)).byteLength;
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
const resolveBodyLength = async (headers, body) => {
|
|
1981
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
1982
|
+
return length == null ? getBodyLength(body) : length;
|
|
1983
|
+
};
|
|
1984
|
+
return async (config) => {
|
|
1985
|
+
let {
|
|
1986
|
+
url,
|
|
1987
|
+
method,
|
|
1988
|
+
data,
|
|
1989
|
+
signal,
|
|
1990
|
+
cancelToken,
|
|
1991
|
+
timeout,
|
|
1992
|
+
onDownloadProgress,
|
|
1993
|
+
onUploadProgress,
|
|
1994
|
+
responseType,
|
|
1995
|
+
headers,
|
|
1996
|
+
withCredentials = "same-origin",
|
|
1997
|
+
fetchOptions
|
|
1998
|
+
} = resolveConfig(config);
|
|
1999
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
2000
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2001
|
+
let request = null;
|
|
2002
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2003
|
+
composedSignal.unsubscribe();
|
|
2012
2004
|
});
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2005
|
+
let requestContentLength;
|
|
2006
|
+
try {
|
|
2007
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
2008
|
+
let _request = new Request(url, {
|
|
2009
|
+
method: "POST",
|
|
2010
|
+
body: data,
|
|
2011
|
+
duplex: "half"
|
|
2012
|
+
});
|
|
2013
|
+
let contentTypeHeader;
|
|
2014
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
2015
|
+
headers.setContentType(contentTypeHeader);
|
|
2020
2016
|
}
|
|
2021
|
-
|
|
2017
|
+
if (_request.body) {
|
|
2018
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
2019
|
+
requestContentLength,
|
|
2020
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
2021
|
+
);
|
|
2022
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
if (!utils$1.isString(withCredentials)) {
|
|
2026
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
2027
|
+
}
|
|
2028
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
2029
|
+
const resolvedOptions = {
|
|
2030
|
+
...fetchOptions,
|
|
2031
|
+
signal: composedSignal,
|
|
2032
|
+
method: method.toUpperCase(),
|
|
2033
|
+
headers: headers.normalize().toJSON(),
|
|
2034
|
+
body: data,
|
|
2035
|
+
duplex: "half",
|
|
2036
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
2037
|
+
};
|
|
2038
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
2039
|
+
let response = await (isRequestSupported ? fetch(request, fetchOptions) : fetch(url, resolvedOptions));
|
|
2040
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
2041
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
2042
|
+
const options = {};
|
|
2043
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
2044
|
+
options[prop] = response[prop];
|
|
2045
|
+
});
|
|
2046
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
2047
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2048
|
+
responseContentLength,
|
|
2049
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
2050
|
+
) || [];
|
|
2051
|
+
response = new Response(
|
|
2052
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2053
|
+
flush && flush();
|
|
2054
|
+
unsubscribe && unsubscribe();
|
|
2055
|
+
}),
|
|
2056
|
+
options
|
|
2057
|
+
);
|
|
2058
|
+
}
|
|
2059
|
+
responseType = responseType || "text";
|
|
2060
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
|
|
2061
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
2062
|
+
return await new Promise((resolve, reject) => {
|
|
2063
|
+
settle(resolve, reject, {
|
|
2064
|
+
data: responseData,
|
|
2065
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
2066
|
+
status: response.status,
|
|
2067
|
+
statusText: response.statusText,
|
|
2068
|
+
config,
|
|
2069
|
+
request
|
|
2070
|
+
});
|
|
2071
|
+
});
|
|
2072
|
+
} catch (err) {
|
|
2073
|
+
unsubscribe && unsubscribe();
|
|
2074
|
+
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
2075
|
+
throw Object.assign(
|
|
2076
|
+
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
|
|
2077
|
+
{
|
|
2078
|
+
cause: err.cause || err
|
|
2079
|
+
}
|
|
2080
|
+
);
|
|
2081
|
+
}
|
|
2082
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
2022
2083
|
}
|
|
2023
|
-
|
|
2084
|
+
};
|
|
2085
|
+
};
|
|
2086
|
+
const seedCache = /* @__PURE__ */ new Map();
|
|
2087
|
+
const getFetch = (config) => {
|
|
2088
|
+
let env = utils$1.merge.call({
|
|
2089
|
+
skipUndefined: true
|
|
2090
|
+
}, globalFetchAPI, config ? config.env : null);
|
|
2091
|
+
const { fetch, Request, Response } = env;
|
|
2092
|
+
const seeds = [
|
|
2093
|
+
Request,
|
|
2094
|
+
Response,
|
|
2095
|
+
fetch
|
|
2096
|
+
];
|
|
2097
|
+
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
2098
|
+
while (i--) {
|
|
2099
|
+
seed = seeds[i];
|
|
2100
|
+
target = map.get(seed);
|
|
2101
|
+
target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
|
|
2102
|
+
map = target;
|
|
2024
2103
|
}
|
|
2025
|
-
|
|
2104
|
+
return target;
|
|
2105
|
+
};
|
|
2106
|
+
getFetch();
|
|
2026
2107
|
const knownAdapters = {
|
|
2027
2108
|
http: httpAdapter,
|
|
2028
2109
|
xhr: xhrAdapter,
|
|
2029
|
-
fetch:
|
|
2110
|
+
fetch: {
|
|
2111
|
+
get: getFetch
|
|
2112
|
+
}
|
|
2030
2113
|
};
|
|
2031
2114
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
2032
2115
|
if (fn) {
|
|
@@ -2040,7 +2123,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
2040
2123
|
const renderReason = (reason) => `- ${reason}`;
|
|
2041
2124
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
2042
2125
|
const adapters = {
|
|
2043
|
-
getAdapter: (adapters2) => {
|
|
2126
|
+
getAdapter: (adapters2, config) => {
|
|
2044
2127
|
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
2045
2128
|
const { length } = adapters2;
|
|
2046
2129
|
let nameOrAdapter;
|
|
@@ -2056,7 +2139,7 @@ const adapters = {
|
|
|
2056
2139
|
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
2057
2140
|
}
|
|
2058
2141
|
}
|
|
2059
|
-
if (adapter) {
|
|
2142
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
2060
2143
|
break;
|
|
2061
2144
|
}
|
|
2062
2145
|
rejectedReasons[id || "#" + i] = adapter;
|
|
@@ -2093,7 +2176,7 @@ function dispatchRequest(config) {
|
|
|
2093
2176
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
2094
2177
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
2095
2178
|
}
|
|
2096
|
-
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
2179
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
2097
2180
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
2098
2181
|
throwIfCancellationRequested(config);
|
|
2099
2182
|
response.data = transformData.call(
|
|
@@ -2118,7 +2201,7 @@ function dispatchRequest(config) {
|
|
|
2118
2201
|
return Promise.reject(reason);
|
|
2119
2202
|
});
|
|
2120
2203
|
}
|
|
2121
|
-
const VERSION$1 = "1.
|
|
2204
|
+
const VERSION$1 = "1.12.0";
|
|
2122
2205
|
const validators$1 = {};
|
|
2123
2206
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
2124
2207
|
validators$1[type] = function validator2(thing) {
|
|
@@ -2286,8 +2369,8 @@ let Axios$1 = class Axios {
|
|
|
2286
2369
|
let len;
|
|
2287
2370
|
if (!synchronousRequestInterceptors) {
|
|
2288
2371
|
const chain = [dispatchRequest.bind(this), void 0];
|
|
2289
|
-
chain.unshift
|
|
2290
|
-
chain.push
|
|
2372
|
+
chain.unshift(...requestInterceptorChain);
|
|
2373
|
+
chain.push(...responseInterceptorChain);
|
|
2291
2374
|
len = chain.length;
|
|
2292
2375
|
promise = Promise.resolve(config);
|
|
2293
2376
|
while (i < len) {
|