@openuverse/uvapi 0.0.0-stage → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3871 -3
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/api/RestAPIClient.d.ts +191 -0
- package/dist/api/RestAPIClient.js +328 -0
- package/dist/api/WebSocketClient.d.ts +174 -0
- package/dist/api/WebSocketClient.js +277 -0
- package/dist/api/index.d.ts +6 -0
- package/dist/api/modules/index.d.ts +2 -0
- package/dist/api/modules/task.d.ts +124 -0
- package/dist/api/modules/task.js +121 -0
- package/dist/api/modules/user.d.ts +114 -0
- package/dist/api/modules/user.js +113 -0
- package/dist/config/index.d.ts +120 -0
- package/dist/config/index.js +112 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useAttributeMonitor.d.ts +45 -0
- package/dist/hooks/useAttributeMonitor.js +115 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +93 -0
- package/dist/locale/de-DE.d.ts +18 -0
- package/dist/locale/de-DE.js +20 -0
- package/dist/locale/en-US.d.ts +18 -0
- package/dist/locale/en-US.js +20 -0
- package/dist/locale/es-ES.d.ts +18 -0
- package/dist/locale/es-ES.js +20 -0
- package/dist/locale/fr-FR.d.ts +18 -0
- package/dist/locale/fr-FR.js +20 -0
- package/dist/locale/id-ID.d.ts +18 -0
- package/dist/locale/id-ID.js +20 -0
- package/dist/locale/index.d.ts +19 -0
- package/dist/locale/index.js +70 -0
- package/dist/locale/ja-JP.d.ts +18 -0
- package/dist/locale/ja-JP.js +20 -0
- package/dist/locale/ko-KR.d.ts +18 -0
- package/dist/locale/ko-KR.js +20 -0
- package/dist/locale/pl-PL.d.ts +18 -0
- package/dist/locale/pl-PL.js +20 -0
- package/dist/locale/pt-BR.d.ts +18 -0
- package/dist/locale/pt-BR.js +20 -0
- package/dist/locale/ru-RU.d.ts +18 -0
- package/dist/locale/ru-RU.js +20 -0
- package/dist/locale/th-TH.d.ts +18 -0
- package/dist/locale/th-TH.js +20 -0
- package/dist/locale/zh-CN.d.ts +18 -0
- package/dist/locale/zh-CN.js +20 -0
- package/dist/locale/zh-TW.d.ts +18 -0
- package/dist/locale/zh-TW.js +20 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.js +38 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/DecodeError.js +14 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/Decoder.js +474 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/Encoder.js +232 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/ExtData.js +8 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.js +46 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/decode.js +7 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/encode.js +7 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/timestamp.js +66 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/int.js +24 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.js +6 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.js +9 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.js +93 -0
- package/dist/node_modules/axios/index.js +38 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +55 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +169 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +72 -0
- package/dist/node_modules/axios/lib/axios.js +46 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +77 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +11 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +6 -0
- package/dist/node_modules/axios/lib/core/Axios.js +136 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +56 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +181 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +58 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +9 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +31 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +70 -0
- package/dist/node_modules/axios/lib/core/settle.js +14 -0
- package/dist/node_modules/axios/lib/core/transformData.js +13 -0
- package/dist/node_modules/axios/lib/defaults/index.js +89 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +8 -0
- package/dist/node_modules/axios/lib/env/data.js +4 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +33 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +8 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +23 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +6 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +30 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +32 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +31 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +6 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +7 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +8 -0
- package/dist/node_modules/axios/lib/helpers/null.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +30 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +35 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +33 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +19 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +8 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +15 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +85 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +14 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +63 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +54 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +9 -0
- package/dist/node_modules/axios/lib/platform/index.js +9 -0
- package/dist/node_modules/axios/lib/utils.js +237 -0
- package/dist/node_modules/postcss-pxtorem/index.js +109 -0
- package/dist/node_modules/postcss-pxtorem/lib/filter-prop-list.js +13 -0
- package/dist/node_modules/postcss-pxtorem/lib/pixel-unit-regex.js +7 -0
- package/dist/node_modules/postcss-pxtorem/lib/type.js +14 -0
- package/dist/preload/index.d.ts +125 -0
- package/dist/preload/index.js +79 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/storeFactory.d.ts +584 -0
- package/dist/store/storeFactory.js +216 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +14 -0
- package/dist/types/index.d.ts +57 -0
- package/dist/types/uVerseAPI.d.ts +67 -0
- package/dist/utils/_internal.d.ts +14 -0
- package/dist/utils/_internal.js +72 -0
- package/dist/utils/constance.d.ts +16 -0
- package/dist/utils/constance.js +7 -0
- package/dist/utils/index.d.ts +79 -0
- package/dist/utils/index.js +96 -0
- package/dist/utils/logger.d.ts +118 -0
- package/dist/utils/logger.js +170 -0
- package/dist/utils/px2rem/remAdapter.d.ts +17 -0
- package/dist/utils/px2rem/remAdapter.js +62 -0
- package/dist/utils/px2rem/vite.d.ts +14 -0
- package/dist/utils/px2rem/vite.js +33 -0
- package/package.json +102 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ExtData as r } from "./ExtData.js";
|
|
2
|
+
import { timestampExtension as d } from "./timestamp.js";
|
|
3
|
+
class c {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.builtInEncoders = [], this.builtInDecoders = [], this.encoders = [], this.decoders = [], this.register(d);
|
|
6
|
+
}
|
|
7
|
+
register({ type: t, encode: n, decode: e }) {
|
|
8
|
+
if (t >= 0)
|
|
9
|
+
this.encoders[t] = n, this.decoders[t] = e;
|
|
10
|
+
else {
|
|
11
|
+
const s = -1 - t;
|
|
12
|
+
this.builtInEncoders[s] = n, this.builtInDecoders[s] = e;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
tryToEncode(t, n) {
|
|
16
|
+
for (let e = 0; e < this.builtInEncoders.length; e++) {
|
|
17
|
+
const s = this.builtInEncoders[e];
|
|
18
|
+
if (s != null) {
|
|
19
|
+
const i = s(t, n);
|
|
20
|
+
if (i != null) {
|
|
21
|
+
const o = -1 - e;
|
|
22
|
+
return new r(o, i);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
for (let e = 0; e < this.encoders.length; e++) {
|
|
27
|
+
const s = this.encoders[e];
|
|
28
|
+
if (s != null) {
|
|
29
|
+
const i = s(t, n);
|
|
30
|
+
if (i != null) {
|
|
31
|
+
const o = e;
|
|
32
|
+
return new r(o, i);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return t instanceof r ? t : null;
|
|
37
|
+
}
|
|
38
|
+
decode(t, n, e) {
|
|
39
|
+
const s = n < 0 ? this.builtInDecoders[-1 - n] : this.decoders[n];
|
|
40
|
+
return s ? s(t, n, e) : new r(n, t);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
c.defaultCodec = new c();
|
|
44
|
+
export {
|
|
45
|
+
c as ExtensionCodec
|
|
46
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DecodeError as i } from "./DecodeError.js";
|
|
2
|
+
import { getInt64 as r, setInt64 as f } from "./utils/int.js";
|
|
3
|
+
const m = -1, w = 4294967296 - 1, a = 17179869184 - 1;
|
|
4
|
+
function u({ sec: e, nsec: t }) {
|
|
5
|
+
if (e >= 0 && t >= 0 && e <= a)
|
|
6
|
+
if (t === 0 && e <= w) {
|
|
7
|
+
const n = new Uint8Array(4);
|
|
8
|
+
return new DataView(n.buffer).setUint32(0, e), n;
|
|
9
|
+
} else {
|
|
10
|
+
const n = e / 4294967296, c = e & 4294967295, o = new Uint8Array(8), s = new DataView(o.buffer);
|
|
11
|
+
return s.setUint32(0, t << 2 | n & 3), s.setUint32(4, c), o;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const n = new Uint8Array(12), c = new DataView(n.buffer);
|
|
15
|
+
return c.setUint32(0, t), f(c, 4, e), n;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function T(e) {
|
|
19
|
+
const t = e.getTime(), n = Math.floor(t / 1e3), c = (t - n * 1e3) * 1e6, o = Math.floor(c / 1e9);
|
|
20
|
+
return {
|
|
21
|
+
sec: n + o,
|
|
22
|
+
nsec: c - o * 1e9
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function p(e) {
|
|
26
|
+
if (e instanceof Date) {
|
|
27
|
+
const t = T(e);
|
|
28
|
+
return u(t);
|
|
29
|
+
} else
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function d(e) {
|
|
33
|
+
const t = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
34
|
+
switch (e.byteLength) {
|
|
35
|
+
case 4:
|
|
36
|
+
return { sec: t.getUint32(0), nsec: 0 };
|
|
37
|
+
case 8: {
|
|
38
|
+
const n = t.getUint32(0), c = t.getUint32(4), o = (n & 3) * 4294967296 + c, s = n >>> 2;
|
|
39
|
+
return { sec: o, nsec: s };
|
|
40
|
+
}
|
|
41
|
+
case 12: {
|
|
42
|
+
const n = r(t, 4), c = t.getUint32(0);
|
|
43
|
+
return { sec: n, nsec: c };
|
|
44
|
+
}
|
|
45
|
+
default:
|
|
46
|
+
throw new i(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function g(e) {
|
|
50
|
+
const t = d(e);
|
|
51
|
+
return new Date(t.sec * 1e3 + t.nsec / 1e6);
|
|
52
|
+
}
|
|
53
|
+
const U = {
|
|
54
|
+
type: m,
|
|
55
|
+
encode: p,
|
|
56
|
+
decode: g
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
m as EXT_TIMESTAMP,
|
|
60
|
+
g as decodeTimestampExtension,
|
|
61
|
+
d as decodeTimestampToTimeSpec,
|
|
62
|
+
T as encodeDateToTimeSpec,
|
|
63
|
+
u as encodeTimeSpecToTimestamp,
|
|
64
|
+
p as encodeTimestampExtension,
|
|
65
|
+
U as timestampExtension
|
|
66
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const s = 4294967295;
|
|
2
|
+
function g(t, n, o) {
|
|
3
|
+
const c = o / 4294967296, i = o;
|
|
4
|
+
t.setUint32(n, c), t.setUint32(n + 4, i);
|
|
5
|
+
}
|
|
6
|
+
function U(t, n, o) {
|
|
7
|
+
const c = Math.floor(o / 4294967296), i = o;
|
|
8
|
+
t.setUint32(n, c), t.setUint32(n + 4, i);
|
|
9
|
+
}
|
|
10
|
+
function h(t, n) {
|
|
11
|
+
const o = t.getInt32(n), c = t.getUint32(n + 4);
|
|
12
|
+
return o * 4294967296 + c;
|
|
13
|
+
}
|
|
14
|
+
function r(t, n) {
|
|
15
|
+
const o = t.getUint32(n), c = t.getUint32(n + 4);
|
|
16
|
+
return o * 4294967296 + c;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
s as UINT32_MAX,
|
|
20
|
+
h as getInt64,
|
|
21
|
+
r as getUint64,
|
|
22
|
+
U as setInt64,
|
|
23
|
+
g as setUint64
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function e(r) {
|
|
2
|
+
return r instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && r instanceof SharedArrayBuffer;
|
|
3
|
+
}
|
|
4
|
+
function n(r) {
|
|
5
|
+
return r instanceof Uint8Array ? r : ArrayBuffer.isView(r) ? new Uint8Array(r.buffer, r.byteOffset, r.byteLength) : e(r) ? new Uint8Array(r) : Uint8Array.from(r);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
n as ensureUint8Array
|
|
9
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function H(f) {
|
|
2
|
+
const e = f.length;
|
|
3
|
+
let x = 0, n = 0;
|
|
4
|
+
for (; n < e; ) {
|
|
5
|
+
let o = f.charCodeAt(n++);
|
|
6
|
+
if (o & 4294967168)
|
|
7
|
+
if (!(o & 4294965248))
|
|
8
|
+
x += 2;
|
|
9
|
+
else {
|
|
10
|
+
if (o >= 55296 && o <= 56319 && n < e) {
|
|
11
|
+
const c = f.charCodeAt(n);
|
|
12
|
+
(c & 64512) === 56320 && (++n, o = ((o & 1023) << 10) + (c & 1023) + 65536);
|
|
13
|
+
}
|
|
14
|
+
o & 4294901760 ? x += 4 : x += 3;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
x++;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return x;
|
|
22
|
+
}
|
|
23
|
+
function h(f, e, x) {
|
|
24
|
+
const n = f.length;
|
|
25
|
+
let o = x, c = 0;
|
|
26
|
+
for (; c < n; ) {
|
|
27
|
+
let t = f.charCodeAt(c++);
|
|
28
|
+
if (t & 4294967168)
|
|
29
|
+
if (!(t & 4294965248))
|
|
30
|
+
e[o++] = t >> 6 & 31 | 192;
|
|
31
|
+
else {
|
|
32
|
+
if (t >= 55296 && t <= 56319 && c < n) {
|
|
33
|
+
const s = f.charCodeAt(c);
|
|
34
|
+
(s & 64512) === 56320 && (++c, t = ((t & 1023) << 10) + (s & 1023) + 65536);
|
|
35
|
+
}
|
|
36
|
+
t & 4294901760 ? (e[o++] = t >> 18 & 7 | 240, e[o++] = t >> 12 & 63 | 128, e[o++] = t >> 6 & 63 | 128) : (e[o++] = t >> 12 & 15 | 224, e[o++] = t >> 6 & 63 | 128);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
e[o++] = t;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
e[o++] = t & 63 | 128;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const a = new TextEncoder(), u = 50;
|
|
46
|
+
function E(f, e, x) {
|
|
47
|
+
a.encodeInto(f, e.subarray(x));
|
|
48
|
+
}
|
|
49
|
+
function S(f, e, x) {
|
|
50
|
+
f.length > u ? E(f, e, x) : h(f, e, x);
|
|
51
|
+
}
|
|
52
|
+
const C = 4096;
|
|
53
|
+
function T(f, e, x) {
|
|
54
|
+
let n = e;
|
|
55
|
+
const o = n + x, c = [];
|
|
56
|
+
let t = "";
|
|
57
|
+
for (; n < o; ) {
|
|
58
|
+
const s = f[n++];
|
|
59
|
+
if (!(s & 128))
|
|
60
|
+
c.push(s);
|
|
61
|
+
else if ((s & 224) === 192) {
|
|
62
|
+
const l = f[n++] & 63;
|
|
63
|
+
c.push((s & 31) << 6 | l);
|
|
64
|
+
} else if ((s & 240) === 224) {
|
|
65
|
+
const l = f[n++] & 63, r = f[n++] & 63;
|
|
66
|
+
c.push((s & 31) << 12 | l << 6 | r);
|
|
67
|
+
} else if ((s & 248) === 240) {
|
|
68
|
+
const l = f[n++] & 63, r = f[n++] & 63, d = f[n++] & 63;
|
|
69
|
+
let i = (s & 7) << 18 | l << 12 | r << 6 | d;
|
|
70
|
+
i > 65535 && (i -= 65536, c.push(i >>> 10 & 1023 | 55296), i = 56320 | i & 1023), c.push(i);
|
|
71
|
+
} else
|
|
72
|
+
c.push(s);
|
|
73
|
+
c.length >= C && (t += String.fromCharCode(...c), c.length = 0);
|
|
74
|
+
}
|
|
75
|
+
return c.length > 0 && (t += String.fromCharCode(...c)), t;
|
|
76
|
+
}
|
|
77
|
+
const D = new TextDecoder(), g = 200;
|
|
78
|
+
function w(f, e, x) {
|
|
79
|
+
const n = f.subarray(e, e + x);
|
|
80
|
+
return D.decode(n);
|
|
81
|
+
}
|
|
82
|
+
function _(f, e, x) {
|
|
83
|
+
return x > g ? w(f, e, x) : T(f, e, x);
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
H as utf8Count,
|
|
87
|
+
_ as utf8Decode,
|
|
88
|
+
T as utf8DecodeJs,
|
|
89
|
+
w as utf8DecodeTD,
|
|
90
|
+
S as utf8Encode,
|
|
91
|
+
h as utf8EncodeJs,
|
|
92
|
+
E as utf8EncodeTE
|
|
93
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import o from "./lib/axios.js";
|
|
2
|
+
const {
|
|
3
|
+
Axios: e,
|
|
4
|
+
AxiosError: a,
|
|
5
|
+
CanceledError: s,
|
|
6
|
+
isCancel: t,
|
|
7
|
+
CancelToken: i,
|
|
8
|
+
VERSION: l,
|
|
9
|
+
all: n,
|
|
10
|
+
Cancel: d,
|
|
11
|
+
isAxiosError: x,
|
|
12
|
+
spread: C,
|
|
13
|
+
toFormData: c,
|
|
14
|
+
AxiosHeaders: m,
|
|
15
|
+
HttpStatusCode: p,
|
|
16
|
+
formToJSON: A,
|
|
17
|
+
getAdapter: f,
|
|
18
|
+
mergeConfig: E
|
|
19
|
+
} = o;
|
|
20
|
+
export {
|
|
21
|
+
e as Axios,
|
|
22
|
+
a as AxiosError,
|
|
23
|
+
m as AxiosHeaders,
|
|
24
|
+
d as Cancel,
|
|
25
|
+
i as CancelToken,
|
|
26
|
+
s as CanceledError,
|
|
27
|
+
p as HttpStatusCode,
|
|
28
|
+
l as VERSION,
|
|
29
|
+
n as all,
|
|
30
|
+
o as default,
|
|
31
|
+
A as formToJSON,
|
|
32
|
+
f as getAdapter,
|
|
33
|
+
x as isAxiosError,
|
|
34
|
+
t as isCancel,
|
|
35
|
+
E as mergeConfig,
|
|
36
|
+
C as spread,
|
|
37
|
+
c as toFormData
|
|
38
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import s from "../utils.js";
|
|
2
|
+
import m from "../helpers/null.js";
|
|
3
|
+
import u from "./xhr.js";
|
|
4
|
+
import { getFetch as b } from "./fetch.js";
|
|
5
|
+
import d from "../core/AxiosError.js";
|
|
6
|
+
const p = {
|
|
7
|
+
http: m,
|
|
8
|
+
xhr: u,
|
|
9
|
+
fetch: {
|
|
10
|
+
get: b
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
s.forEach(p, (e, o) => {
|
|
14
|
+
if (e) {
|
|
15
|
+
try {
|
|
16
|
+
Object.defineProperty(e, "name", { value: o });
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(e, "adapterName", { value: o });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const f = (e) => `- ${e}`, g = (e) => s.isFunction(e) || e === null || e === !1, y = {
|
|
23
|
+
getAdapter: (e, o) => {
|
|
24
|
+
e = s.isArray(e) ? e : [e];
|
|
25
|
+
const { length: a } = e;
|
|
26
|
+
let i, t;
|
|
27
|
+
const c = {};
|
|
28
|
+
for (let r = 0; r < a; r++) {
|
|
29
|
+
i = e[r];
|
|
30
|
+
let n;
|
|
31
|
+
if (t = i, !g(i) && (t = p[(n = String(i)).toLowerCase()], t === void 0))
|
|
32
|
+
throw new d(`Unknown adapter '${n}'`);
|
|
33
|
+
if (t && (s.isFunction(t) || (t = t.get(o))))
|
|
34
|
+
break;
|
|
35
|
+
c[n || "#" + r] = t;
|
|
36
|
+
}
|
|
37
|
+
if (!t) {
|
|
38
|
+
const r = Object.entries(c).map(
|
|
39
|
+
([l, h]) => `adapter ${l} ` + (h === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
40
|
+
);
|
|
41
|
+
let n = a ? r.length > 1 ? `since :
|
|
42
|
+
` + r.map(f).join(`
|
|
43
|
+
`) : " " + f(r[0]) : "as no adapter specified";
|
|
44
|
+
throw new d(
|
|
45
|
+
"There is no suitable adapter to dispatch the request " + n,
|
|
46
|
+
"ERR_NOT_SUPPORT"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
},
|
|
51
|
+
adapters: p
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
y as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import K from "../platform/index.js";
|
|
2
|
+
import t from "../utils.js";
|
|
3
|
+
import b from "../core/AxiosError.js";
|
|
4
|
+
import ee from "../helpers/composeSignals.js";
|
|
5
|
+
import { trackStream as z } from "../helpers/trackStream.js";
|
|
6
|
+
import te from "../core/AxiosHeaders.js";
|
|
7
|
+
import { progressEventDecorator as I, progressEventReducer as M, asyncDecorator as j } from "../helpers/progressEventReducer.js";
|
|
8
|
+
import se from "../helpers/resolveConfig.js";
|
|
9
|
+
import re from "../core/settle.js";
|
|
10
|
+
const J = 64 * 1024, { isFunction: P } = t, ne = (({ Request: r, Response: n }) => ({
|
|
11
|
+
Request: r,
|
|
12
|
+
Response: n
|
|
13
|
+
}))(t.global), {
|
|
14
|
+
ReadableStream: V,
|
|
15
|
+
TextEncoder: W
|
|
16
|
+
} = t.global, Z = (r, ...n) => {
|
|
17
|
+
try {
|
|
18
|
+
return !!r(...n);
|
|
19
|
+
} catch {
|
|
20
|
+
return !1;
|
|
21
|
+
}
|
|
22
|
+
}, oe = (r) => {
|
|
23
|
+
r = t.merge.call({
|
|
24
|
+
skipUndefined: !0
|
|
25
|
+
}, ne, r);
|
|
26
|
+
const { fetch: n, Request: o, Response: y } = r, g = n ? P(n) : typeof fetch == "function", f = P(o), F = P(y);
|
|
27
|
+
if (!g)
|
|
28
|
+
return !1;
|
|
29
|
+
const w = g && P(V), R = g && (typeof W == "function" ? /* @__PURE__ */ ((e) => (s) => e.encode(s))(new W()) : async (e) => new Uint8Array(await new o(e).arrayBuffer())), d = f && w && Z(() => {
|
|
30
|
+
let e = !1;
|
|
31
|
+
const s = new o(K.origin, {
|
|
32
|
+
body: new V(),
|
|
33
|
+
method: "POST",
|
|
34
|
+
get duplex() {
|
|
35
|
+
return e = !0, "half";
|
|
36
|
+
}
|
|
37
|
+
}).headers.has("Content-Type");
|
|
38
|
+
return e && !s;
|
|
39
|
+
}), h = F && w && Z(() => t.isReadableStream(new y("").body)), x = {
|
|
40
|
+
stream: h && ((e) => e.body)
|
|
41
|
+
};
|
|
42
|
+
g && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
|
|
43
|
+
!x[e] && (x[e] = (s, i) => {
|
|
44
|
+
let c = s && s[e];
|
|
45
|
+
if (c)
|
|
46
|
+
return c.call(s);
|
|
47
|
+
throw new b(`Response type '${e}' is not supported`, b.ERR_NOT_SUPPORT, i);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const $ = async (e) => {
|
|
51
|
+
if (e == null)
|
|
52
|
+
return 0;
|
|
53
|
+
if (t.isBlob(e))
|
|
54
|
+
return e.size;
|
|
55
|
+
if (t.isSpecCompliantForm(e))
|
|
56
|
+
return (await new o(K.origin, {
|
|
57
|
+
method: "POST",
|
|
58
|
+
body: e
|
|
59
|
+
}).arrayBuffer()).byteLength;
|
|
60
|
+
if (t.isArrayBufferView(e) || t.isArrayBuffer(e))
|
|
61
|
+
return e.byteLength;
|
|
62
|
+
if (t.isURLSearchParams(e) && (e = e + ""), t.isString(e))
|
|
63
|
+
return (await R(e)).byteLength;
|
|
64
|
+
}, G = async (e, s) => {
|
|
65
|
+
const i = t.toFiniteNumber(e.getContentLength());
|
|
66
|
+
return i ?? $(s);
|
|
67
|
+
};
|
|
68
|
+
return async (e) => {
|
|
69
|
+
let {
|
|
70
|
+
url: s,
|
|
71
|
+
method: i,
|
|
72
|
+
data: c,
|
|
73
|
+
signal: Q,
|
|
74
|
+
cancelToken: _,
|
|
75
|
+
timeout: X,
|
|
76
|
+
onDownloadProgress: O,
|
|
77
|
+
onUploadProgress: B,
|
|
78
|
+
responseType: l,
|
|
79
|
+
headers: q,
|
|
80
|
+
withCredentials: C = "same-origin",
|
|
81
|
+
fetchOptions: U
|
|
82
|
+
} = se(e), v = n || fetch;
|
|
83
|
+
l = l ? (l + "").toLowerCase() : "text";
|
|
84
|
+
let E = ee([Q, _ && _.toAbortSignal()], X), T = null;
|
|
85
|
+
const m = E && E.unsubscribe && (() => {
|
|
86
|
+
E.unsubscribe();
|
|
87
|
+
});
|
|
88
|
+
let D;
|
|
89
|
+
try {
|
|
90
|
+
if (B && d && i !== "get" && i !== "head" && (D = await G(q, c)) !== 0) {
|
|
91
|
+
let p = new o(s, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
body: c,
|
|
94
|
+
duplex: "half"
|
|
95
|
+
}), S;
|
|
96
|
+
if (t.isFormData(c) && (S = p.headers.get("content-type")) && q.setContentType(S), p.body) {
|
|
97
|
+
const [A, L] = I(
|
|
98
|
+
D,
|
|
99
|
+
M(j(B))
|
|
100
|
+
);
|
|
101
|
+
c = z(p.body, J, A, L);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
t.isString(C) || (C = C ? "include" : "omit");
|
|
105
|
+
const a = f && "credentials" in o.prototype, N = {
|
|
106
|
+
...U,
|
|
107
|
+
signal: E,
|
|
108
|
+
method: i.toUpperCase(),
|
|
109
|
+
headers: q.normalize().toJSON(),
|
|
110
|
+
body: c,
|
|
111
|
+
duplex: "half",
|
|
112
|
+
credentials: a ? C : void 0
|
|
113
|
+
};
|
|
114
|
+
T = f && new o(s, N);
|
|
115
|
+
let u = await (f ? v(T, U) : v(s, N));
|
|
116
|
+
const k = h && (l === "stream" || l === "response");
|
|
117
|
+
if (h && (O || k && m)) {
|
|
118
|
+
const p = {};
|
|
119
|
+
["status", "statusText", "headers"].forEach((H) => {
|
|
120
|
+
p[H] = u[H];
|
|
121
|
+
});
|
|
122
|
+
const S = t.toFiniteNumber(u.headers.get("content-length")), [A, L] = O && I(
|
|
123
|
+
S,
|
|
124
|
+
M(j(O), !0)
|
|
125
|
+
) || [];
|
|
126
|
+
u = new y(
|
|
127
|
+
z(u.body, J, A, () => {
|
|
128
|
+
L && L(), m && m();
|
|
129
|
+
}),
|
|
130
|
+
p
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
l = l || "text";
|
|
134
|
+
let Y = await x[t.findKey(x, l) || "text"](u, e);
|
|
135
|
+
return !k && m && m(), await new Promise((p, S) => {
|
|
136
|
+
re(p, S, {
|
|
137
|
+
data: Y,
|
|
138
|
+
headers: te.from(u.headers),
|
|
139
|
+
status: u.status,
|
|
140
|
+
statusText: u.statusText,
|
|
141
|
+
config: e,
|
|
142
|
+
request: T
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
} catch (a) {
|
|
146
|
+
throw m && m(), a && a.name === "TypeError" && /Load failed|fetch/i.test(a.message) ? Object.assign(
|
|
147
|
+
new b("Network Error", b.ERR_NETWORK, e, T),
|
|
148
|
+
{
|
|
149
|
+
cause: a.cause || a
|
|
150
|
+
}
|
|
151
|
+
) : b.from(a, a && a.code, e, T);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}, ae = /* @__PURE__ */ new Map(), ie = (r) => {
|
|
155
|
+
let n = r ? r.env : {};
|
|
156
|
+
const { fetch: o, Request: y, Response: g } = n, f = [
|
|
157
|
+
y,
|
|
158
|
+
g,
|
|
159
|
+
o
|
|
160
|
+
];
|
|
161
|
+
let F = f.length, w = F, R, d, h = ae;
|
|
162
|
+
for (; w--; )
|
|
163
|
+
R = f[w], d = h.get(R), d === void 0 && h.set(R, d = w ? /* @__PURE__ */ new Map() : oe(n)), h = d;
|
|
164
|
+
return d;
|
|
165
|
+
};
|
|
166
|
+
ie();
|
|
167
|
+
export {
|
|
168
|
+
ie as getFetch
|
|
169
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import H from "../utils.js";
|
|
2
|
+
import D from "../core/settle.js";
|
|
3
|
+
import L from "../defaults/transitional.js";
|
|
4
|
+
import n from "../core/AxiosError.js";
|
|
5
|
+
import y from "../cancel/CanceledError.js";
|
|
6
|
+
import O from "../helpers/parseProtocol.js";
|
|
7
|
+
import U from "../platform/index.js";
|
|
8
|
+
import q from "../core/AxiosHeaders.js";
|
|
9
|
+
import { progressEventReducer as A } from "../helpers/progressEventReducer.js";
|
|
10
|
+
import v from "../helpers/resolveConfig.js";
|
|
11
|
+
const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
|
|
12
|
+
return new Promise(function(C, i) {
|
|
13
|
+
const t = v(s);
|
|
14
|
+
let E = t.data;
|
|
15
|
+
const T = q.from(t.headers).normalize();
|
|
16
|
+
let { responseType: d, onUploadProgress: R, onDownloadProgress: h } = t, l, g, w, u, f;
|
|
17
|
+
function x() {
|
|
18
|
+
u && u(), f && f(), t.cancelToken && t.cancelToken.unsubscribe(l), t.signal && t.signal.removeEventListener("abort", l);
|
|
19
|
+
}
|
|
20
|
+
let e = new XMLHttpRequest();
|
|
21
|
+
e.open(t.method.toUpperCase(), t.url, !0), e.timeout = t.timeout;
|
|
22
|
+
function b() {
|
|
23
|
+
if (!e)
|
|
24
|
+
return;
|
|
25
|
+
const o = q.from(
|
|
26
|
+
"getAllResponseHeaders" in e && e.getAllResponseHeaders()
|
|
27
|
+
), a = {
|
|
28
|
+
data: !d || d === "text" || d === "json" ? e.responseText : e.response,
|
|
29
|
+
status: e.status,
|
|
30
|
+
statusText: e.statusText,
|
|
31
|
+
headers: o,
|
|
32
|
+
config: s,
|
|
33
|
+
request: e
|
|
34
|
+
};
|
|
35
|
+
D(function(c) {
|
|
36
|
+
C(c), x();
|
|
37
|
+
}, function(c) {
|
|
38
|
+
i(c), x();
|
|
39
|
+
}, a), e = null;
|
|
40
|
+
}
|
|
41
|
+
"onloadend" in e ? e.onloadend = b : e.onreadystatechange = function() {
|
|
42
|
+
!e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.indexOf("file:") === 0) || setTimeout(b);
|
|
43
|
+
}, e.onabort = function() {
|
|
44
|
+
e && (i(new n("Request aborted", n.ECONNABORTED, s, e)), e = null);
|
|
45
|
+
}, e.onerror = function(r) {
|
|
46
|
+
const a = r && r.message ? r.message : "Network Error", p = new n(a, n.ERR_NETWORK, s, e);
|
|
47
|
+
p.event = r || null, i(p), e = null;
|
|
48
|
+
}, e.ontimeout = function() {
|
|
49
|
+
let r = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded";
|
|
50
|
+
const a = t.transitional || L;
|
|
51
|
+
t.timeoutErrorMessage && (r = t.timeoutErrorMessage), i(new n(
|
|
52
|
+
r,
|
|
53
|
+
a.clarifyTimeoutError ? n.ETIMEDOUT : n.ECONNABORTED,
|
|
54
|
+
s,
|
|
55
|
+
e
|
|
56
|
+
)), e = null;
|
|
57
|
+
}, E === void 0 && T.setContentType(null), "setRequestHeader" in e && H.forEach(T.toJSON(), function(r, a) {
|
|
58
|
+
e.setRequestHeader(a, r);
|
|
59
|
+
}), H.isUndefined(t.withCredentials) || (e.withCredentials = !!t.withCredentials), d && d !== "json" && (e.responseType = t.responseType), h && ([w, f] = A(h, !0), e.addEventListener("progress", w)), R && e.upload && ([g, u] = A(R), e.upload.addEventListener("progress", g), e.upload.addEventListener("loadend", u)), (t.cancelToken || t.signal) && (l = (o) => {
|
|
60
|
+
e && (i(!o || o.type ? new y(null, s, e) : o), e.abort(), e = null);
|
|
61
|
+
}, t.cancelToken && t.cancelToken.subscribe(l), t.signal && (t.signal.aborted ? l() : t.signal.addEventListener("abort", l)));
|
|
62
|
+
const m = O(t.url);
|
|
63
|
+
if (m && U.protocols.indexOf(m) === -1) {
|
|
64
|
+
i(new n("Unsupported protocol " + m + ":", n.ERR_BAD_REQUEST, s));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
e.send(E || null);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
Q as default
|
|
72
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
};
|