v0.9.7
This commit is contained in:
parent
69301b83e7
commit
2a631303f3
246
dist/ff-request.js
vendored
246
dist/ff-request.js
vendored
@ -1,18 +1,18 @@
|
|||||||
var oe = Object.defineProperty;
|
var oe = Object.defineProperty;
|
||||||
var ae = (t, e, r) => e in t ? oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
var ie = (t, e, r) => e in t ? oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
||||||
var A = (t, e, r) => (ae(t, typeof e != "symbol" ? e + "" : e, r), r), k = (t, e, r) => {
|
var A = (t, e, r) => (ie(t, typeof e != "symbol" ? e + "" : e, r), r), k = (t, e, r) => {
|
||||||
if (!e.has(t))
|
if (!e.has(t))
|
||||||
throw TypeError("Cannot " + r);
|
throw TypeError("Cannot " + r);
|
||||||
};
|
};
|
||||||
var l = (t, e, r) => (k(t, e, "read from private field"), r ? r.call(t) : e.get(t)), S = (t, e, r) => {
|
var h = (t, e, r) => (k(t, e, "read from private field"), r ? r.call(t) : e.get(t)), S = (t, e, r) => {
|
||||||
if (e.has(t))
|
if (e.has(t))
|
||||||
throw TypeError("Cannot add the same private member more than once");
|
throw TypeError("Cannot add the same private member more than once");
|
||||||
e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
||||||
}, $ = (t, e, r, n) => (k(t, e, "write to private field"), n ? n.call(t, r) : e.set(t, r), r);
|
}, m = (t, e, r, n) => (k(t, e, "write to private field"), n ? n.call(t, r) : e.set(t, r), r);
|
||||||
function te(t) {
|
function te(t) {
|
||||||
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
||||||
}
|
}
|
||||||
function ie(t) {
|
function ae(t) {
|
||||||
if (t.length >= 255)
|
if (t.length >= 255)
|
||||||
throw new TypeError("Alphabet too long");
|
throw new TypeError("Alphabet too long");
|
||||||
for (var e = new Uint8Array(256), r = 0; r < e.length; r++)
|
for (var e = new Uint8Array(256), r = 0; r < e.length; r++)
|
||||||
@ -23,25 +23,25 @@ function ie(t) {
|
|||||||
throw new TypeError(u + " is ambiguous");
|
throw new TypeError(u + " is ambiguous");
|
||||||
e[v] = n;
|
e[v] = n;
|
||||||
}
|
}
|
||||||
var d = t.length, U = t.charAt(0), B = Math.log(d) / Math.log(256), D = Math.log(256) / Math.log(d);
|
var c = t.length, U = t.charAt(0), B = Math.log(c) / Math.log(256), D = Math.log(256) / Math.log(c);
|
||||||
function q(f) {
|
function q(f) {
|
||||||
if (f instanceof Uint8Array || (ArrayBuffer.isView(f) ? f = new Uint8Array(f.buffer, f.byteOffset, f.byteLength) : Array.isArray(f) && (f = Uint8Array.from(f))), !(f instanceof Uint8Array))
|
if (f instanceof Uint8Array || (ArrayBuffer.isView(f) ? f = new Uint8Array(f.buffer, f.byteOffset, f.byteLength) : Array.isArray(f) && (f = Uint8Array.from(f))), !(f instanceof Uint8Array))
|
||||||
throw new TypeError("Expected Uint8Array");
|
throw new TypeError("Expected Uint8Array");
|
||||||
if (f.length === 0)
|
if (f.length === 0)
|
||||||
return "";
|
return "";
|
||||||
for (var o = 0, a = 0, c = 0, i = f.length; c !== i && f[c] === 0; )
|
for (var o = 0, i = 0, g = 0, a = f.length; g !== a && f[g] === 0; )
|
||||||
c++, o++;
|
g++, o++;
|
||||||
for (var h = (i - c) * D + 1 >>> 0, g = new Uint8Array(h); c !== i; ) {
|
for (var l = (a - g) * D + 1 >>> 0, d = new Uint8Array(l); g !== a; ) {
|
||||||
for (var T = f[c], E = 0, w = h - 1; (T !== 0 || E < a) && w !== -1; w--, E++)
|
for (var T = f[g], E = 0, w = l - 1; (T !== 0 || E < i) && w !== -1; w--, E++)
|
||||||
T += 256 * g[w] >>> 0, g[w] = T % d >>> 0, T = T / d >>> 0;
|
T += 256 * d[w] >>> 0, d[w] = T % c >>> 0, T = T / c >>> 0;
|
||||||
if (T !== 0)
|
if (T !== 0)
|
||||||
throw new Error("Non-zero carry");
|
throw new Error("Non-zero carry");
|
||||||
a = E, c++;
|
i = E, g++;
|
||||||
}
|
}
|
||||||
for (var s = h - a; s !== h && g[s] === 0; )
|
for (var s = l - i; s !== l && d[s] === 0; )
|
||||||
s++;
|
s++;
|
||||||
for (var y = U.repeat(o); s < h; ++s)
|
for (var y = U.repeat(o); s < l; ++s)
|
||||||
y += t.charAt(g[s]);
|
y += t.charAt(d[s]);
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
function x(f) {
|
function x(f) {
|
||||||
@ -49,29 +49,29 @@ function ie(t) {
|
|||||||
throw new TypeError("Expected String");
|
throw new TypeError("Expected String");
|
||||||
if (f.length === 0)
|
if (f.length === 0)
|
||||||
return new Uint8Array();
|
return new Uint8Array();
|
||||||
for (var o = 0, a = 0, c = 0; f[o] === U; )
|
for (var o = 0, i = 0, g = 0; f[o] === U; )
|
||||||
a++, o++;
|
i++, o++;
|
||||||
for (var i = (f.length - o) * B + 1 >>> 0, h = new Uint8Array(i); f[o]; ) {
|
for (var a = (f.length - o) * B + 1 >>> 0, l = new Uint8Array(a); f[o]; ) {
|
||||||
var g = e[f.charCodeAt(o)];
|
var d = e[f.charCodeAt(o)];
|
||||||
if (g === 255)
|
if (d === 255)
|
||||||
return;
|
return;
|
||||||
for (var T = 0, E = i - 1; (g !== 0 || T < c) && E !== -1; E--, T++)
|
for (var T = 0, E = a - 1; (d !== 0 || T < g) && E !== -1; E--, T++)
|
||||||
g += d * h[E] >>> 0, h[E] = g % 256 >>> 0, g = g / 256 >>> 0;
|
d += c * l[E] >>> 0, l[E] = d % 256 >>> 0, d = d / 256 >>> 0;
|
||||||
if (g !== 0)
|
if (d !== 0)
|
||||||
throw new Error("Non-zero carry");
|
throw new Error("Non-zero carry");
|
||||||
c = T, o++;
|
g = T, o++;
|
||||||
}
|
}
|
||||||
for (var w = i - c; w !== i && h[w] === 0; )
|
for (var w = a - g; w !== a && l[w] === 0; )
|
||||||
w++;
|
w++;
|
||||||
for (var s = new Uint8Array(a + (i - w)), y = a; w !== i; )
|
for (var s = new Uint8Array(i + (a - w)), y = i; w !== a; )
|
||||||
s[y++] = h[w++];
|
s[y++] = l[w++];
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
function p(f) {
|
function p(f) {
|
||||||
var o = x(f);
|
var o = x(f);
|
||||||
if (o)
|
if (o)
|
||||||
return o;
|
return o;
|
||||||
throw new Error("Non-base" + d + " character");
|
throw new Error("Non-base" + c + " character");
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
encode: q,
|
encode: q,
|
||||||
@ -79,24 +79,24 @@ function ie(t) {
|
|||||||
decode: p
|
decode: p
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var fe = ie;
|
var fe = ae;
|
||||||
const he = /* @__PURE__ */ te(fe);
|
const he = /* @__PURE__ */ te(fe);
|
||||||
var re = {};
|
var re = {};
|
||||||
(function(t) {
|
(function(t) {
|
||||||
(function(e) {
|
(function(e) {
|
||||||
e([], function() {
|
e([], function() {
|
||||||
var r = -1, n = -2, u = -3, v = -4, d = -5, U = function(o, a) {
|
var r = -1, n = -2, u = -3, v = -4, c = -5, U = function(o, i) {
|
||||||
a = a || {};
|
i = i || {};
|
||||||
var c = a.verbose || !1;
|
var g = i.verbose || !1;
|
||||||
c && console.log("Normalize the JSON Object"), o = typeof o == "string" ? this.JSON.parse(o) : o, c && console.log("Creating a empty dictionary");
|
g && console.log("Normalize the JSON Object"), o = typeof o == "string" ? this.JSON.parse(o) : o, g && console.log("Creating a empty dictionary");
|
||||||
var i = {
|
var a = {
|
||||||
strings: [],
|
strings: [],
|
||||||
integers: [],
|
integers: [],
|
||||||
floats: []
|
floats: []
|
||||||
};
|
};
|
||||||
c && console.log("Creating the AST");
|
g && console.log("Creating the AST");
|
||||||
var h = function w(s) {
|
var l = function w(s) {
|
||||||
c && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(s));
|
g && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(s));
|
||||||
var y = typeof s;
|
var y = typeof s;
|
||||||
if (s === null)
|
if (s === null)
|
||||||
return {
|
return {
|
||||||
@ -106,7 +106,7 @@ var re = {};
|
|||||||
if (typeof s > "u")
|
if (typeof s > "u")
|
||||||
return {
|
return {
|
||||||
type: "undefined",
|
type: "undefined",
|
||||||
index: d
|
index: c
|
||||||
};
|
};
|
||||||
if (s instanceof Array) {
|
if (s instanceof Array) {
|
||||||
var _ = ["@"];
|
var _ = ["@"];
|
||||||
@ -126,22 +126,22 @@ var re = {};
|
|||||||
index: v
|
index: v
|
||||||
};
|
};
|
||||||
if (y === "string") {
|
if (y === "string") {
|
||||||
var P = f.call(i.strings, s);
|
var P = f.call(a.strings, s);
|
||||||
return P == -1 && (i.strings.push(D(s)), P = i.strings.length - 1), {
|
return P == -1 && (a.strings.push(D(s)), P = a.strings.length - 1), {
|
||||||
type: "strings",
|
type: "strings",
|
||||||
index: P
|
index: P
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (y === "number" && s % 1 === 0) {
|
if (y === "number" && s % 1 === 0) {
|
||||||
var P = f.call(i.integers, s);
|
var P = f.call(a.integers, s);
|
||||||
return P == -1 && (i.integers.push(x(s)), P = i.integers.length - 1), {
|
return P == -1 && (a.integers.push(x(s)), P = a.integers.length - 1), {
|
||||||
type: "integers",
|
type: "integers",
|
||||||
index: P
|
index: P
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (y === "number") {
|
if (y === "number") {
|
||||||
var P = f.call(i.floats, s);
|
var P = f.call(a.floats, s);
|
||||||
return P == -1 && (i.floats.push(s), P = i.floats.length - 1), {
|
return P == -1 && (a.floats.push(s), P = a.floats.length - 1), {
|
||||||
type: "floats",
|
type: "floats",
|
||||||
index: P
|
index: P
|
||||||
};
|
};
|
||||||
@ -152,11 +152,11 @@ var re = {};
|
|||||||
index: s ? r : n
|
index: s ? r : n
|
||||||
};
|
};
|
||||||
throw new Error("Unexpected argument of type " + typeof s);
|
throw new Error("Unexpected argument of type " + typeof s);
|
||||||
}(o), g = i.strings.length, T = i.integers.length;
|
}(o), d = a.strings.length, T = a.integers.length;
|
||||||
i.floats.length, c && console.log("Parsing the dictionary");
|
a.floats.length, g && console.log("Parsing the dictionary");
|
||||||
var E = i.strings.join("|");
|
var E = a.strings.join("|");
|
||||||
return E += "^" + i.integers.join("|"), E += "^" + i.floats.join("|"), c && console.log("Parsing the structure"), E += "^" + function w(s) {
|
return E += "^" + a.integers.join("|"), E += "^" + a.floats.join("|"), g && console.log("Parsing the structure"), E += "^" + function w(s) {
|
||||||
if (c && console.log("Calling a recursiveParser with " + this.JSON.stringify(s)), s instanceof Array) {
|
if (g && console.log("Calling a recursiveParser with " + this.JSON.stringify(s)), s instanceof Array) {
|
||||||
var y = s.shift();
|
var y = s.shift();
|
||||||
for (var _ in s)
|
for (var _ in s)
|
||||||
s.hasOwnProperty(_) && (y += w(s[_]) + "|");
|
s.hasOwnProperty(_) && (y += w(s[_]) + "|");
|
||||||
@ -166,55 +166,55 @@ var re = {};
|
|||||||
if (O === "strings")
|
if (O === "strings")
|
||||||
return x(R);
|
return x(R);
|
||||||
if (O === "integers")
|
if (O === "integers")
|
||||||
return x(g + R);
|
return x(d + R);
|
||||||
if (O === "floats")
|
if (O === "floats")
|
||||||
return x(g + T + R);
|
return x(d + T + R);
|
||||||
if (O === "boolean")
|
if (O === "boolean")
|
||||||
return s.index;
|
return s.index;
|
||||||
if (O === "null")
|
if (O === "null")
|
||||||
return u;
|
return u;
|
||||||
if (O === "undefined")
|
if (O === "undefined")
|
||||||
return d;
|
return c;
|
||||||
if (O === "empty")
|
if (O === "empty")
|
||||||
return v;
|
return v;
|
||||||
throw new TypeError("The item is alien!");
|
throw new TypeError("The item is alien!");
|
||||||
}(h), c && console.log("Ending parser"), a.debug ? {
|
}(l), g && console.log("Ending parser"), i.debug ? {
|
||||||
dictionary: i,
|
dictionary: a,
|
||||||
ast: h,
|
ast: l,
|
||||||
packed: E
|
packed: E
|
||||||
} : E;
|
} : E;
|
||||||
}, B = function(o, a) {
|
}, B = function(o, i) {
|
||||||
a = a || {};
|
i = i || {};
|
||||||
var c = o.split("^");
|
var g = o.split("^");
|
||||||
a.verbose && console.log("Building dictionary");
|
i.verbose && console.log("Building dictionary");
|
||||||
var i = [], h = c[0];
|
var a = [], l = g[0];
|
||||||
if (h !== "") {
|
if (l !== "") {
|
||||||
h = h.split("|"), a.verbose && console.log("Parse the strings dictionary");
|
l = l.split("|"), i.verbose && console.log("Parse the strings dictionary");
|
||||||
for (var g = 0, T = h.length; g < T; g++)
|
for (var d = 0, T = l.length; d < T; d++)
|
||||||
i.push(q(h[g]));
|
a.push(q(l[d]));
|
||||||
}
|
}
|
||||||
if (h = c[1], h !== "") {
|
if (l = g[1], l !== "") {
|
||||||
h = h.split("|"), a.verbose && console.log("Parse the integers dictionary");
|
l = l.split("|"), i.verbose && console.log("Parse the integers dictionary");
|
||||||
for (var g = 0, T = h.length; g < T; g++)
|
for (var d = 0, T = l.length; d < T; d++)
|
||||||
i.push(p(h[g]));
|
a.push(p(l[d]));
|
||||||
}
|
}
|
||||||
if (h = c[2], h !== "") {
|
if (l = g[2], l !== "") {
|
||||||
h = h.split("|"), a.verbose && console.log("Parse the floats dictionary");
|
l = l.split("|"), i.verbose && console.log("Parse the floats dictionary");
|
||||||
for (var g = 0, T = h.length; g < T; g++)
|
for (var d = 0, T = l.length; d < T; d++)
|
||||||
i.push(parseFloat(h[g]));
|
a.push(parseFloat(l[d]));
|
||||||
}
|
}
|
||||||
h = null, a.verbose && console.log("Tokenizing the structure");
|
l = null, i.verbose && console.log("Tokenizing the structure");
|
||||||
for (var E = "", w = [], s = c[3].length, g = 0; g < s; g++) {
|
for (var E = "", w = [], s = g[3].length, d = 0; d < s; d++) {
|
||||||
var y = c[3].charAt(g);
|
var y = g[3].charAt(d);
|
||||||
y === "|" || y === "$" || y === "@" || y === "]" ? (E && (w.push(p(E)), E = ""), y !== "|" && w.push(y)) : E += y;
|
y === "|" || y === "$" || y === "@" || y === "]" ? (E && (w.push(p(E)), E = ""), y !== "|" && w.push(y)) : E += y;
|
||||||
}
|
}
|
||||||
var _ = w.length, O = 0;
|
var _ = w.length, O = 0;
|
||||||
return a.verbose && console.log("Starting recursive parser"), function R() {
|
return i.verbose && console.log("Starting recursive parser"), function R() {
|
||||||
var P = w[O++];
|
var P = w[O++];
|
||||||
if (a.verbose && console.log("Reading collection type " + (P === "$" ? "object" : "Array")), P === "@") {
|
if (i.verbose && console.log("Reading collection type " + (P === "$" ? "object" : "Array")), P === "@") {
|
||||||
for (var b = []; O < _; O++) {
|
for (var b = []; O < _; O++) {
|
||||||
var N = w[O];
|
var N = w[O];
|
||||||
if (a.verbose && console.log("Read " + N + " symbol"), N === "]")
|
if (i.verbose && console.log("Read " + N + " symbol"), N === "]")
|
||||||
return b;
|
return b;
|
||||||
if (N === "@" || N === "$")
|
if (N === "@" || N === "$")
|
||||||
b.push(R());
|
b.push(R());
|
||||||
@ -229,24 +229,24 @@ var re = {};
|
|||||||
case u:
|
case u:
|
||||||
b.push(null);
|
b.push(null);
|
||||||
break;
|
break;
|
||||||
case d:
|
case c:
|
||||||
b.push(void 0);
|
b.push(void 0);
|
||||||
break;
|
break;
|
||||||
case v:
|
case v:
|
||||||
b.push("");
|
b.push("");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
b.push(i[N]);
|
b.push(a[N]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return a.verbose && console.log("Parsed " + this.JSON.stringify(b)), b;
|
return i.verbose && console.log("Parsed " + this.JSON.stringify(b)), b;
|
||||||
}
|
}
|
||||||
if (P === "$") {
|
if (P === "$") {
|
||||||
for (var b = {}; O < _; O++) {
|
for (var b = {}; O < _; O++) {
|
||||||
var C = w[O];
|
var C = w[O];
|
||||||
if (C === "]")
|
if (C === "]")
|
||||||
return b;
|
return b;
|
||||||
C === v ? C = "" : C = i[C];
|
C === v ? C = "" : C = a[C];
|
||||||
var N = w[++O];
|
var N = w[++O];
|
||||||
if (N === "@" || N === "$")
|
if (N === "@" || N === "$")
|
||||||
b[C] = R();
|
b[C] = R();
|
||||||
@ -261,48 +261,48 @@ var re = {};
|
|||||||
case u:
|
case u:
|
||||||
b[C] = null;
|
b[C] = null;
|
||||||
break;
|
break;
|
||||||
case d:
|
case c:
|
||||||
b[C] = void 0;
|
b[C] = void 0;
|
||||||
break;
|
break;
|
||||||
case v:
|
case v:
|
||||||
b[C] = "";
|
b[C] = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
b[C] = i[N];
|
b[C] = a[N];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return a.verbose && console.log("Parsed " + this.JSON.stringify(b)), b;
|
return i.verbose && console.log("Parsed " + this.JSON.stringify(b)), b;
|
||||||
}
|
}
|
||||||
throw new TypeError("Bad token " + P + " isn't a type");
|
throw new TypeError("Bad token " + P + " isn't a type");
|
||||||
}();
|
}();
|
||||||
}, D = function(o) {
|
}, D = function(o) {
|
||||||
return typeof o != "string" ? o : o.replace(/[\+ \|\^\%]/g, function(a) {
|
return typeof o != "string" ? o : o.replace(/[\+ \|\^\%]/g, function(i) {
|
||||||
return {
|
return {
|
||||||
" ": "+",
|
" ": "+",
|
||||||
"+": "%2B",
|
"+": "%2B",
|
||||||
"|": "%7C",
|
"|": "%7C",
|
||||||
"^": "%5E",
|
"^": "%5E",
|
||||||
"%": "%25"
|
"%": "%25"
|
||||||
}[a];
|
}[i];
|
||||||
});
|
});
|
||||||
}, q = function(o) {
|
}, q = function(o) {
|
||||||
return typeof o != "string" ? o : o.replace(/\+|%2B|%7C|%5E|%25/g, function(a) {
|
return typeof o != "string" ? o : o.replace(/\+|%2B|%7C|%5E|%25/g, function(i) {
|
||||||
return {
|
return {
|
||||||
"+": " ",
|
"+": " ",
|
||||||
"%2B": "+",
|
"%2B": "+",
|
||||||
"%7C": "|",
|
"%7C": "|",
|
||||||
"%5E": "^",
|
"%5E": "^",
|
||||||
"%25": "%"
|
"%25": "%"
|
||||||
}[a];
|
}[i];
|
||||||
});
|
});
|
||||||
}, x = function(o) {
|
}, x = function(o) {
|
||||||
return Number.prototype.toString.call(o, 36).toUpperCase();
|
return Number.prototype.toString.call(o, 36).toUpperCase();
|
||||||
}, p = function(o) {
|
}, p = function(o) {
|
||||||
return parseInt(o, 36);
|
return parseInt(o, 36);
|
||||||
}, f = Array.prototype.indexOf || function(o, a) {
|
}, f = Array.prototype.indexOf || function(o, i) {
|
||||||
for (var c = a || 0, i = this.length; c < i; c++)
|
for (var g = i || 0, a = this.length; g < a; g++)
|
||||||
if (this[c] === o)
|
if (this[g] === o)
|
||||||
return c;
|
return g;
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
@ -333,24 +333,24 @@ class X {
|
|||||||
// 判罚是否已经给出错误提示
|
// 判罚是否已经给出错误提示
|
||||||
S(this, j, !0);
|
S(this, j, !0);
|
||||||
S(this, I, {
|
S(this, I, {
|
||||||
get: (e, r) => l(this, L).call(this, r),
|
get: (e, r) => h(this, L).call(this, r),
|
||||||
ownKeys: () => Object.keys(l(this, I).getPrototypeOf() || {}),
|
ownKeys: () => Object.keys(h(this, I).getPrototypeOf() || {}),
|
||||||
getPrototypeOf: () => l(this, z) ? this : this.data,
|
getPrototypeOf: () => h(this, z) ? this : this.data,
|
||||||
getOwnPropertyDescriptor: () => ({
|
getOwnPropertyDescriptor: () => ({
|
||||||
configurable: !0,
|
configurable: !0,
|
||||||
enumerable: !0,
|
enumerable: !0,
|
||||||
writable: !0,
|
writable: !0,
|
||||||
value: l(this, I).getPrototypeOf()
|
value: h(this, I).getPrototypeOf()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
S(this, L, (e) => e === "$toast" ? l(this, K) : e === "msg" ? l(this, H) : e === "then" || e === "resp" ? ($(this, j, !0), $(this, z, e === "resp"), l(this, V)) : e === "catch" ? l(this, Y) : e === "IS_ECHO_MSG" ? l(this, j) : Reflect.get(this, e));
|
S(this, L, (e) => e === "$toast" ? h(this, K) : e === "msg" ? h(this, H) : e === "then" || e === "resp" ? (m(this, j, !0), m(this, z, e === "resp"), h(this, V)) : e === "catch" ? h(this, Y) : e === "IS_ECHO_MSG" ? h(this, j) : Reflect.get(this, e));
|
||||||
S(this, H, (e = (n) => n, r = !1) => (l(this, K).call(this), $(this, z, r), Promise.resolve(e == null ? void 0 : e(l(this, I).getPrototypeOf()))));
|
S(this, H, (e = (n) => n, r = !1) => (h(this, K).call(this), m(this, z, r), Promise.resolve(e == null ? void 0 : e(h(this, I).getPrototypeOf()))));
|
||||||
S(this, K, () => {
|
S(this, K, () => {
|
||||||
l(this, j) && ($(this, j, !1), we.onToast(this.code, this.message));
|
h(this, j) && (m(this, j, !1), we.onToast(this.code, this.message));
|
||||||
});
|
});
|
||||||
S(this, V, (e) => [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(l(this, I).getPrototypeOf())) : Promise.reject(l(this, J)));
|
S(this, V, (e) => [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(h(this, I).getPrototypeOf())) : Promise.reject(h(this, J)));
|
||||||
S(this, Y, (e) => Promise.resolve(e(l(this, J))));
|
S(this, Y, (e) => Promise.resolve(e(h(this, J))));
|
||||||
return this.code = e, this.message = r, this.data = n, this.url = u, this.res = v, $(this, J, new Proxy(this, l(this, I)));
|
return this.code = e, this.message = r, this.data = n, this.url = u, this.res = v, m(this, J, new Proxy(this, h(this, I)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
J = new WeakMap(), z = new WeakMap(), j = new WeakMap(), I = new WeakMap(), L = new WeakMap(), H = new WeakMap(), K = new WeakMap(), V = new WeakMap(), Y = new WeakMap();
|
J = new WeakMap(), z = new WeakMap(), j = new WeakMap(), I = new WeakMap(), L = new WeakMap(), H = new WeakMap(), K = new WeakMap(), V = new WeakMap(), Y = new WeakMap();
|
||||||
@ -384,8 +384,8 @@ function ue(t) {
|
|||||||
throw new TypeError("stream option must be boolean");
|
throw new TypeError("stream option must be boolean");
|
||||||
if (ArrayBuffer.isView(e)) {
|
if (ArrayBuffer.isView(e)) {
|
||||||
var u = new Uint8Array(e.buffer, e.byteOffset, e.byteLength), v = new Array(u.length);
|
var u = new Uint8Array(e.buffer, e.byteOffset, e.byteLength), v = new Array(u.length);
|
||||||
for (let d = 0; d < u.length; d++)
|
for (let c = 0; c < u.length; c++)
|
||||||
v[d] = String.fromCharCode(u[d]);
|
v[c] = String.fromCharCode(u[c]);
|
||||||
return decodeURIComponent(escape(v.join("")));
|
return decodeURIComponent(escape(v.join("")));
|
||||||
} else
|
} else
|
||||||
throw new TypeError("passed argument must be an array buffer view");
|
throw new TypeError("passed argument must be an array buffer view");
|
||||||
@ -401,31 +401,33 @@ const ce = new se.TextEncoder("utf8"), ge = new se.TextDecoder("utf8"), de = (t)
|
|||||||
e = e * 33 ^ t.charCodeAt(r);
|
e = e * 33 ^ t.charCodeAt(r);
|
||||||
return (e >>> 0).toString(16);
|
return (e >>> 0).toString(16);
|
||||||
}, be = (t, e) => t.replace(new RegExp(`^${e}+|${e}+$`, "g"), ""), pe = (t) => ce.encode(t || ""), ve = (t) => ge.decode(new DataView(t), {});
|
}, be = (t, e) => t.replace(new RegExp(`^${e}+|${e}+$`, "g"), ""), pe = (t) => ce.encode(t || ""), ve = (t) => ge.decode(new DataView(t), {});
|
||||||
var F, G, Q, m, M;
|
var F, G, Q, M, $;
|
||||||
class Z {
|
class Z {
|
||||||
constructor(e, r, n = ({}) => Promise.reject({ code: -1, msg: "请初始化HTTP请求方法主体" })) {
|
constructor(e, r, n = ({}) => Promise.reject({ code: -1, msg: "请初始化HTTP请求方法主体" })) {
|
||||||
S(this, F, void 0);
|
S(this, F, void 0);
|
||||||
S(this, G, void 0);
|
S(this, G, void 0);
|
||||||
S(this, Q, void 0);
|
S(this, Q, void 0);
|
||||||
S(this, m, {
|
S(this, M, {
|
||||||
"#": /* @__PURE__ */ new Map(),
|
"#": /* @__PURE__ */ new Map(),
|
||||||
// 系统缓存
|
// 系统缓存
|
||||||
$: /* @__PURE__ */ new Map()
|
$: /* @__PURE__ */ new Map()
|
||||||
// 普通缓存
|
// 普通缓存
|
||||||
});
|
});
|
||||||
S(this, M, /* @__PURE__ */ new Map());
|
S(this, $, /* @__PURE__ */ new Map());
|
||||||
A(this, "request", ({ url: e = "/", method: r = "GET", ...n }, u = !1) => {
|
A(this, "request", ({ url: e = "/", method: r = "GET", ...n }, u = !1) => {
|
||||||
var x;
|
var x;
|
||||||
const v = r.toUpperCase(), d = de(JSON.stringify([e, v, n])), U = (x = e == null ? void 0 : e.includes) != null && x.call(e, "/_/") ? "#" : "$", { promise: B, resolve: D, reject: q } = Promise.withResolvers();
|
const v = r.toUpperCase(), c = de(JSON.stringify([e, v, n])), U = (x = e == null ? void 0 : e.includes) != null && x.call(e, "/_/") ? "#" : "$", { promise: B, resolve: D, reject: q } = Promise.withResolvers();
|
||||||
return l(this, m)[U].has(d) ? (console.log("缓存命中", e), D(l(this, m)[U].get(d))) : l(this, M).has(d) ? l(this, M).get(d).push([D, q]) : l(this, M).set(d, [[D, q]]), l(this, M).get(d).length === 1 && l(this, F).call(this, { url: e, method: v, ...n }).then((p) => {
|
return h(this, M)[U].has(c) ? (console.log("缓存命中", e), D(h(this, M)[U].get(c))) : h(this, $).has(c) ? h(this, $).get(c).push([D, q]) : h(this, $).set(c, [[D, q]]), h(this, $).get(c).length === 1 && h(this, F).call(this, { url: e, method: v, ...n }).then((p) => {
|
||||||
if (![0, 1].includes(p.code))
|
if (![0, 1].includes(p.code))
|
||||||
throw W(p.code, p.msg, p.data, e, p == null ? void 0 : p.res);
|
throw W(p.code, p.msg, p.data, e, p == null ? void 0 : p.res);
|
||||||
return [p.code, p.msg, p.data, e, p == null ? void 0 : p.res];
|
return [p.code, p.msg, p.data, e, p == null ? void 0 : p.res];
|
||||||
}).then((p) => ((U == "#" || u && v === "GET") && l(this, m)[U].set(d, p), p)).then((p) => l(this, M).get(d).forEach(([f, o]) => f(p))).catch((p) => (l(this, m)[U].delete(d), l(this, M).get(d).forEach(([f, o]) => o(p instanceof X ? p : W(-1, p, null, e))))), new Proxy(B, {
|
}).then((p) => ((U == "#" || u && v === "GET") && h(this, M)[U].set(c, p), p)).then((p) => h(this, $).get(c).forEach(([f, o]) => f(p))).catch((p) => (h(this, M)[U].delete(c), h(this, $).get(c).forEach(([f, o]) => o(p instanceof X ? p : W(-1, p, null, e))))).finally(() => setTimeout(() => {
|
||||||
get: (p, f) => (...o) => p.then((a) => W(...a)[f](...o)).catch((a) => {
|
h(this, $).delete(c);
|
||||||
if (!a instanceof X)
|
})), new Proxy(B, {
|
||||||
throw a;
|
get: (p, f) => (...o) => p.then((i) => W(...i)[f](...o)).catch((i) => {
|
||||||
return typeof a[f] == "function" ? a[f](...o) : a[f];
|
if (!i instanceof X)
|
||||||
|
throw i;
|
||||||
|
return typeof i[f] == "function" ? i[f](...o) : i[f];
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -440,13 +442,13 @@ class Z {
|
|||||||
A(this, "getAppInfo", () => {
|
A(this, "getAppInfo", () => {
|
||||||
});
|
});
|
||||||
A(this, "refreshCache", (e = !1) => {
|
A(this, "refreshCache", (e = !1) => {
|
||||||
e && l(this, m)["#"].clear(), l(this, m).$.clear();
|
e && h(this, M)["#"].clear(), h(this, M).$.clear();
|
||||||
});
|
});
|
||||||
A(this, "decode", (e = "", r = {}) => {
|
A(this, "decode", (e = "", r = {}) => {
|
||||||
if (e === void 0 || e === "" || e === null)
|
if (e === void 0 || e === "" || e === null)
|
||||||
return r;
|
return r;
|
||||||
try {
|
try {
|
||||||
const n = l(this, G).decode(e).buffer;
|
const n = h(this, G).decode(e).buffer;
|
||||||
return ee.unpack(ve(n));
|
return ee.unpack(ve(n));
|
||||||
} catch {
|
} catch {
|
||||||
return console.warn("core.decode", e), r;
|
return console.warn("core.decode", e), r;
|
||||||
@ -454,16 +456,16 @@ class Z {
|
|||||||
});
|
});
|
||||||
A(this, "encode", (e = {}) => {
|
A(this, "encode", (e = {}) => {
|
||||||
const r = JSON.stringify(e, (n, u) => u === void 0 ? null : u);
|
const r = JSON.stringify(e, (n, u) => u === void 0 ? null : u);
|
||||||
return l(this, G).encode(pe(ee.pack(r)));
|
return h(this, G).encode(pe(ee.pack(r)));
|
||||||
});
|
});
|
||||||
$(this, Q, e), $(this, F, n), $(this, G, he(r));
|
m(this, Q, e), m(this, F, n), m(this, G, he(r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
F = new WeakMap(), G = new WeakMap(), Q = new WeakMap(), m = new WeakMap(), M = new WeakMap();
|
F = new WeakMap(), G = new WeakMap(), Q = new WeakMap(), M = new WeakMap(), $ = new WeakMap();
|
||||||
const we = Z;
|
const we = Z;
|
||||||
Z.onUnhandledRejection = (t) => {
|
Z.onUnhandledRejection = (t) => {
|
||||||
var e, r, n, u, v, d;
|
var e, r, n, u, v, c;
|
||||||
t != null && t.IS_ECHO_MSG ? ((e = t == null ? void 0 : t.$toast) == null || e.call(t), (r = t == null ? void 0 : t.preventDefault) == null || r.call(t)) : (n = t.reason) != null && n.IS_ECHO_MSG && ((v = (u = t.reason) == null ? void 0 : u.$toast) == null || v.call(u), (d = t == null ? void 0 : t.preventDefault) == null || d.call(t));
|
t != null && t.IS_ECHO_MSG ? ((e = t == null ? void 0 : t.$toast) == null || e.call(t), (r = t == null ? void 0 : t.preventDefault) == null || r.call(t)) : (n = t.reason) != null && n.IS_ECHO_MSG && ((v = (u = t.reason) == null ? void 0 : u.$toast) == null || v.call(u), (c = t == null ? void 0 : t.preventDefault) == null || c.call(t));
|
||||||
};
|
};
|
||||||
Z.onToast = (t, e) => [0, 1].includes(t) ? console.log(e) : console.warn(e);
|
Z.onToast = (t, e) => [0, 1].includes(t) ? console.log(e) : console.warn(e);
|
||||||
export {
|
export {
|
||||||
|
2
dist/ff-request.umd.cjs
vendored
2
dist/ff-request.umd.cjs
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ff-request",
|
"name": "ff-request",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.9.6",
|
"version": "0.9.7",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
Loading…
Reference in New Issue
Block a user