v0.9.8
This commit is contained in:
parent
2a631303f3
commit
d32e92509c
250
dist/ff-request.js
vendored
250
dist/ff-request.js
vendored
@ -1,6 +1,6 @@
|
|||||||
var oe = Object.defineProperty;
|
var oe = Object.defineProperty;
|
||||||
var ie = (t, e, r) => e in t ? oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
var ae = (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) => (ie(t, typeof e != "symbol" ? e + "" : e, r), r), k = (t, e, r) => {
|
var A = (t, e, r) => (ae(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);
|
||||||
};
|
};
|
||||||
@ -8,11 +8,11 @@ var h = (t, e, r) => (k(t, e, "read from private field"), r ? r.call(t) : e.get(
|
|||||||
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);
|
||||||
}, m = (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 ae(t) {
|
function ie(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++)
|
||||||
@ -24,53 +24,53 @@ function ae(t) {
|
|||||||
e[v] = n;
|
e[v] = n;
|
||||||
}
|
}
|
||||||
var c = t.length, U = t.charAt(0), B = Math.log(c) / Math.log(256), D = Math.log(256) / Math.log(c);
|
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(i) {
|
||||||
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 (i instanceof Uint8Array || (ArrayBuffer.isView(i) ? i = new Uint8Array(i.buffer, i.byteOffset, i.byteLength) : Array.isArray(i) && (i = Uint8Array.from(i))), !(i instanceof Uint8Array))
|
||||||
throw new TypeError("Expected Uint8Array");
|
throw new TypeError("Expected Uint8Array");
|
||||||
if (f.length === 0)
|
if (i.length === 0)
|
||||||
return "";
|
return "";
|
||||||
for (var o = 0, i = 0, g = 0, a = f.length; g !== a && f[g] === 0; )
|
for (var a = 0, s = 0, g = 0, f = i.length; g !== f && i[g] === 0; )
|
||||||
g++, o++;
|
g++, a++;
|
||||||
for (var l = (a - g) * D + 1 >>> 0, d = new Uint8Array(l); g !== a; ) {
|
for (var l = (f - g) * D + 1 >>> 0, d = new Uint8Array(l); g !== f; ) {
|
||||||
for (var T = f[g], E = 0, w = l - 1; (T !== 0 || E < i) && w !== -1; w--, E++)
|
for (var T = i[g], E = 0, w = l - 1; (T !== 0 || E < s) && w !== -1; w--, E++)
|
||||||
T += 256 * d[w] >>> 0, d[w] = T % c >>> 0, T = T / c >>> 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");
|
||||||
i = E, g++;
|
s = E, g++;
|
||||||
}
|
}
|
||||||
for (var s = l - i; s !== l && d[s] === 0; )
|
for (var o = l - s; o !== l && d[o] === 0; )
|
||||||
s++;
|
o++;
|
||||||
for (var y = U.repeat(o); s < l; ++s)
|
for (var y = U.repeat(a); o < l; ++o)
|
||||||
y += t.charAt(d[s]);
|
y += t.charAt(d[o]);
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
function x(f) {
|
function x(i) {
|
||||||
if (typeof f != "string")
|
if (typeof i != "string")
|
||||||
throw new TypeError("Expected String");
|
throw new TypeError("Expected String");
|
||||||
if (f.length === 0)
|
if (i.length === 0)
|
||||||
return new Uint8Array();
|
return new Uint8Array();
|
||||||
for (var o = 0, i = 0, g = 0; f[o] === U; )
|
for (var a = 0, s = 0, g = 0; i[a] === U; )
|
||||||
i++, o++;
|
s++, a++;
|
||||||
for (var a = (f.length - o) * B + 1 >>> 0, l = new Uint8Array(a); f[o]; ) {
|
for (var f = (i.length - a) * B + 1 >>> 0, l = new Uint8Array(f); i[a]; ) {
|
||||||
var d = e[f.charCodeAt(o)];
|
var d = e[i.charCodeAt(a)];
|
||||||
if (d === 255)
|
if (d === 255)
|
||||||
return;
|
return;
|
||||||
for (var T = 0, E = a - 1; (d !== 0 || T < g) && E !== -1; E--, T++)
|
for (var T = 0, E = f - 1; (d !== 0 || T < g) && E !== -1; E--, T++)
|
||||||
d += c * l[E] >>> 0, l[E] = d % 256 >>> 0, d = d / 256 >>> 0;
|
d += c * l[E] >>> 0, l[E] = d % 256 >>> 0, d = d / 256 >>> 0;
|
||||||
if (d !== 0)
|
if (d !== 0)
|
||||||
throw new Error("Non-zero carry");
|
throw new Error("Non-zero carry");
|
||||||
g = T, o++;
|
g = T, a++;
|
||||||
}
|
}
|
||||||
for (var w = a - g; w !== a && l[w] === 0; )
|
for (var w = f - g; w !== f && l[w] === 0; )
|
||||||
w++;
|
w++;
|
||||||
for (var s = new Uint8Array(i + (a - w)), y = i; w !== a; )
|
for (var o = new Uint8Array(s + (f - w)), y = s; w !== f; )
|
||||||
s[y++] = l[w++];
|
o[y++] = l[w++];
|
||||||
return s;
|
return o;
|
||||||
}
|
}
|
||||||
function p(f) {
|
function p(i) {
|
||||||
var o = x(f);
|
var a = x(i);
|
||||||
if (o)
|
if (a)
|
||||||
return o;
|
return a;
|
||||||
throw new Error("Non-base" + c + " character");
|
throw new Error("Non-base" + c + " character");
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@ -79,69 +79,69 @@ function ae(t) {
|
|||||||
decode: p
|
decode: p
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var fe = ae;
|
var fe = ie;
|
||||||
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, c = -5, U = function(o, i) {
|
var r = -1, n = -2, u = -3, v = -4, c = -5, U = function(a, s) {
|
||||||
i = i || {};
|
s = s || {};
|
||||||
var g = i.verbose || !1;
|
var g = s.verbose || !1;
|
||||||
g && console.log("Normalize the JSON Object"), o = typeof o == "string" ? this.JSON.parse(o) : o, g && console.log("Creating a empty dictionary");
|
g && console.log("Normalize the JSON Object"), a = typeof a == "string" ? this.JSON.parse(a) : a, g && console.log("Creating a empty dictionary");
|
||||||
var a = {
|
var f = {
|
||||||
strings: [],
|
strings: [],
|
||||||
integers: [],
|
integers: [],
|
||||||
floats: []
|
floats: []
|
||||||
};
|
};
|
||||||
g && console.log("Creating the AST");
|
g && console.log("Creating the AST");
|
||||||
var l = function w(s) {
|
var l = function w(o) {
|
||||||
g && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(s));
|
g && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(o));
|
||||||
var y = typeof s;
|
var y = typeof o;
|
||||||
if (s === null)
|
if (o === null)
|
||||||
return {
|
return {
|
||||||
type: "null",
|
type: "null",
|
||||||
index: u
|
index: u
|
||||||
};
|
};
|
||||||
if (typeof s > "u")
|
if (typeof o > "u")
|
||||||
return {
|
return {
|
||||||
type: "undefined",
|
type: "undefined",
|
||||||
index: c
|
index: c
|
||||||
};
|
};
|
||||||
if (s instanceof Array) {
|
if (o instanceof Array) {
|
||||||
var _ = ["@"];
|
var _ = ["@"];
|
||||||
for (var O in s)
|
for (var O in o)
|
||||||
s.hasOwnProperty(O) && _.push(w(s[O]));
|
o.hasOwnProperty(O) && _.push(w(o[O]));
|
||||||
return _;
|
return _;
|
||||||
}
|
}
|
||||||
if (y === "object") {
|
if (y === "object") {
|
||||||
var _ = ["$"];
|
var _ = ["$"];
|
||||||
for (var R in s)
|
for (var R in o)
|
||||||
s.hasOwnProperty(R) && (_.push(w(R)), _.push(w(s[R])));
|
o.hasOwnProperty(R) && (_.push(w(R)), _.push(w(o[R])));
|
||||||
return _;
|
return _;
|
||||||
}
|
}
|
||||||
if (s === "")
|
if (o === "")
|
||||||
return {
|
return {
|
||||||
type: "empty",
|
type: "empty",
|
||||||
index: v
|
index: v
|
||||||
};
|
};
|
||||||
if (y === "string") {
|
if (y === "string") {
|
||||||
var P = f.call(a.strings, s);
|
var P = i.call(f.strings, o);
|
||||||
return P == -1 && (a.strings.push(D(s)), P = a.strings.length - 1), {
|
return P == -1 && (f.strings.push(D(o)), P = f.strings.length - 1), {
|
||||||
type: "strings",
|
type: "strings",
|
||||||
index: P
|
index: P
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (y === "number" && s % 1 === 0) {
|
if (y === "number" && o % 1 === 0) {
|
||||||
var P = f.call(a.integers, s);
|
var P = i.call(f.integers, o);
|
||||||
return P == -1 && (a.integers.push(x(s)), P = a.integers.length - 1), {
|
return P == -1 && (f.integers.push(x(o)), P = f.integers.length - 1), {
|
||||||
type: "integers",
|
type: "integers",
|
||||||
index: P
|
index: P
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (y === "number") {
|
if (y === "number") {
|
||||||
var P = f.call(a.floats, s);
|
var P = i.call(f.floats, o);
|
||||||
return P == -1 && (a.floats.push(s), P = a.floats.length - 1), {
|
return P == -1 && (f.floats.push(o), P = f.floats.length - 1), {
|
||||||
type: "floats",
|
type: "floats",
|
||||||
index: P
|
index: P
|
||||||
};
|
};
|
||||||
@ -149,20 +149,20 @@ var re = {};
|
|||||||
if (y === "boolean")
|
if (y === "boolean")
|
||||||
return {
|
return {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
index: s ? r : n
|
index: o ? r : n
|
||||||
};
|
};
|
||||||
throw new Error("Unexpected argument of type " + typeof s);
|
throw new Error("Unexpected argument of type " + typeof o);
|
||||||
}(o), d = a.strings.length, T = a.integers.length;
|
}(a), d = f.strings.length, T = f.integers.length;
|
||||||
a.floats.length, g && console.log("Parsing the dictionary");
|
f.floats.length, g && console.log("Parsing the dictionary");
|
||||||
var E = a.strings.join("|");
|
var E = f.strings.join("|");
|
||||||
return E += "^" + a.integers.join("|"), E += "^" + a.floats.join("|"), g && console.log("Parsing the structure"), E += "^" + function w(s) {
|
return E += "^" + f.integers.join("|"), E += "^" + f.floats.join("|"), g && console.log("Parsing the structure"), E += "^" + function w(o) {
|
||||||
if (g && console.log("Calling a recursiveParser with " + this.JSON.stringify(s)), s instanceof Array) {
|
if (g && console.log("Calling a recursiveParser with " + this.JSON.stringify(o)), o instanceof Array) {
|
||||||
var y = s.shift();
|
var y = o.shift();
|
||||||
for (var _ in s)
|
for (var _ in o)
|
||||||
s.hasOwnProperty(_) && (y += w(s[_]) + "|");
|
o.hasOwnProperty(_) && (y += w(o[_]) + "|");
|
||||||
return (y[y.length - 1] === "|" ? y.slice(0, -1) : y) + "]";
|
return (y[y.length - 1] === "|" ? y.slice(0, -1) : y) + "]";
|
||||||
}
|
}
|
||||||
var O = s.type, R = s.index;
|
var O = o.type, R = o.index;
|
||||||
if (O === "strings")
|
if (O === "strings")
|
||||||
return x(R);
|
return x(R);
|
||||||
if (O === "integers")
|
if (O === "integers")
|
||||||
@ -170,7 +170,7 @@ var re = {};
|
|||||||
if (O === "floats")
|
if (O === "floats")
|
||||||
return x(d + T + R);
|
return x(d + T + R);
|
||||||
if (O === "boolean")
|
if (O === "boolean")
|
||||||
return s.index;
|
return o.index;
|
||||||
if (O === "null")
|
if (O === "null")
|
||||||
return u;
|
return u;
|
||||||
if (O === "undefined")
|
if (O === "undefined")
|
||||||
@ -178,43 +178,43 @@ var re = {};
|
|||||||
if (O === "empty")
|
if (O === "empty")
|
||||||
return v;
|
return v;
|
||||||
throw new TypeError("The item is alien!");
|
throw new TypeError("The item is alien!");
|
||||||
}(l), g && console.log("Ending parser"), i.debug ? {
|
}(l), g && console.log("Ending parser"), s.debug ? {
|
||||||
dictionary: a,
|
dictionary: f,
|
||||||
ast: l,
|
ast: l,
|
||||||
packed: E
|
packed: E
|
||||||
} : E;
|
} : E;
|
||||||
}, B = function(o, i) {
|
}, B = function(a, s) {
|
||||||
i = i || {};
|
s = s || {};
|
||||||
var g = o.split("^");
|
var g = a.split("^");
|
||||||
i.verbose && console.log("Building dictionary");
|
s.verbose && console.log("Building dictionary");
|
||||||
var a = [], l = g[0];
|
var f = [], l = g[0];
|
||||||
if (l !== "") {
|
if (l !== "") {
|
||||||
l = l.split("|"), i.verbose && console.log("Parse the strings dictionary");
|
l = l.split("|"), s.verbose && console.log("Parse the strings dictionary");
|
||||||
for (var d = 0, T = l.length; d < T; d++)
|
for (var d = 0, T = l.length; d < T; d++)
|
||||||
a.push(q(l[d]));
|
f.push(q(l[d]));
|
||||||
}
|
}
|
||||||
if (l = g[1], l !== "") {
|
if (l = g[1], l !== "") {
|
||||||
l = l.split("|"), i.verbose && console.log("Parse the integers dictionary");
|
l = l.split("|"), s.verbose && console.log("Parse the integers dictionary");
|
||||||
for (var d = 0, T = l.length; d < T; d++)
|
for (var d = 0, T = l.length; d < T; d++)
|
||||||
a.push(p(l[d]));
|
f.push(p(l[d]));
|
||||||
}
|
}
|
||||||
if (l = g[2], l !== "") {
|
if (l = g[2], l !== "") {
|
||||||
l = l.split("|"), i.verbose && console.log("Parse the floats dictionary");
|
l = l.split("|"), s.verbose && console.log("Parse the floats dictionary");
|
||||||
for (var d = 0, T = l.length; d < T; d++)
|
for (var d = 0, T = l.length; d < T; d++)
|
||||||
a.push(parseFloat(l[d]));
|
f.push(parseFloat(l[d]));
|
||||||
}
|
}
|
||||||
l = null, i.verbose && console.log("Tokenizing the structure");
|
l = null, s.verbose && console.log("Tokenizing the structure");
|
||||||
for (var E = "", w = [], s = g[3].length, d = 0; d < s; d++) {
|
for (var E = "", w = [], o = g[3].length, d = 0; d < o; d++) {
|
||||||
var y = g[3].charAt(d);
|
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 i.verbose && console.log("Starting recursive parser"), function R() {
|
return s.verbose && console.log("Starting recursive parser"), function R() {
|
||||||
var P = w[O++];
|
var P = w[O++];
|
||||||
if (i.verbose && console.log("Reading collection type " + (P === "$" ? "object" : "Array")), P === "@") {
|
if (s.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 (i.verbose && console.log("Read " + N + " symbol"), N === "]")
|
if (s.verbose && console.log("Read " + N + " symbol"), N === "]")
|
||||||
return b;
|
return b;
|
||||||
if (N === "@" || N === "$")
|
if (N === "@" || N === "$")
|
||||||
b.push(R());
|
b.push(R());
|
||||||
@ -236,17 +236,17 @@ var re = {};
|
|||||||
b.push("");
|
b.push("");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
b.push(a[N]);
|
b.push(f[N]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i.verbose && console.log("Parsed " + this.JSON.stringify(b)), b;
|
return s.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 = a[C];
|
C === v ? C = "" : C = f[C];
|
||||||
var N = w[++O];
|
var N = w[++O];
|
||||||
if (N === "@" || N === "$")
|
if (N === "@" || N === "$")
|
||||||
b[C] = R();
|
b[C] = R();
|
||||||
@ -268,40 +268,40 @@ var re = {};
|
|||||||
b[C] = "";
|
b[C] = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
b[C] = a[N];
|
b[C] = f[N];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i.verbose && console.log("Parsed " + this.JSON.stringify(b)), b;
|
return s.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(a) {
|
||||||
return typeof o != "string" ? o : o.replace(/[\+ \|\^\%]/g, function(i) {
|
return typeof a != "string" ? a : a.replace(/[\+ \|\^\%]/g, function(s) {
|
||||||
return {
|
return {
|
||||||
" ": "+",
|
" ": "+",
|
||||||
"+": "%2B",
|
"+": "%2B",
|
||||||
"|": "%7C",
|
"|": "%7C",
|
||||||
"^": "%5E",
|
"^": "%5E",
|
||||||
"%": "%25"
|
"%": "%25"
|
||||||
}[i];
|
}[s];
|
||||||
});
|
});
|
||||||
}, q = function(o) {
|
}, q = function(a) {
|
||||||
return typeof o != "string" ? o : o.replace(/\+|%2B|%7C|%5E|%25/g, function(i) {
|
return typeof a != "string" ? a : a.replace(/\+|%2B|%7C|%5E|%25/g, function(s) {
|
||||||
return {
|
return {
|
||||||
"+": " ",
|
"+": " ",
|
||||||
"%2B": "+",
|
"%2B": "+",
|
||||||
"%7C": "|",
|
"%7C": "|",
|
||||||
"%5E": "^",
|
"%5E": "^",
|
||||||
"%25": "%"
|
"%25": "%"
|
||||||
}[i];
|
}[s];
|
||||||
});
|
});
|
||||||
}, x = function(o) {
|
}, x = function(a) {
|
||||||
return Number.prototype.toString.call(o, 36).toUpperCase();
|
return Number.prototype.toString.call(a, 36).toUpperCase();
|
||||||
}, p = function(o) {
|
}, p = function(a) {
|
||||||
return parseInt(o, 36);
|
return parseInt(a, 36);
|
||||||
}, f = Array.prototype.indexOf || function(o, i) {
|
}, i = Array.prototype.indexOf || function(a, s) {
|
||||||
for (var g = i || 0, a = this.length; g < a; g++)
|
for (var g = s || 0, f = this.length; g < f; g++)
|
||||||
if (this[g] === o)
|
if (this[g] === a)
|
||||||
return g;
|
return g;
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
@ -343,14 +343,14 @@ class X {
|
|||||||
value: h(this, I).getPrototypeOf()
|
value: h(this, I).getPrototypeOf()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
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, 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) => (h(this, K).call(this), m(this, z, r), Promise.resolve(e == null ? void 0 : e(h(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, () => {
|
||||||
h(this, j) && (m(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(h(this, I).getPrototypeOf())) : Promise.reject(h(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(h(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, m(this, J, new Proxy(this, h(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();
|
||||||
@ -401,13 +401,13 @@ 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, $;
|
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()
|
||||||
@ -417,17 +417,23 @@ class Z {
|
|||||||
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(), 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();
|
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 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) => {
|
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") && 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(() => {
|
}).then((p) => ((U == "#" || u && v === "GET") && h(this, m)[U].set(c, p), p)).then((p) => h(this, $).get(c).forEach((i, a, s) => {
|
||||||
h(this, $).delete(c);
|
i && i[0](p), delete s[a];
|
||||||
})), new Proxy(B, {
|
})).catch((p) => {
|
||||||
get: (p, f) => (...o) => p.then((i) => W(...i)[f](...o)).catch((i) => {
|
h(this, m)[U].delete(c), h(this, $).get(c).forEach((i, a, s) => {
|
||||||
if (!i instanceof X)
|
i && i[1](p instanceof X ? p : W(-1, p, null, e)), delete s[a];
|
||||||
throw i;
|
});
|
||||||
return typeof i[f] == "function" ? i[f](...o) : i[f];
|
}).finally(() => {
|
||||||
|
console.log(1111, h(this, $).get(c));
|
||||||
|
}), new Proxy(B, {
|
||||||
|
get: (p, i) => (...a) => p.then((s) => W(...s)[i](...a)).catch((s) => {
|
||||||
|
if (!s instanceof X)
|
||||||
|
throw s;
|
||||||
|
return typeof s[i] == "function" ? s[i](...a) : s[i];
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -442,7 +448,7 @@ class Z {
|
|||||||
A(this, "getAppInfo", () => {
|
A(this, "getAppInfo", () => {
|
||||||
});
|
});
|
||||||
A(this, "refreshCache", (e = !1) => {
|
A(this, "refreshCache", (e = !1) => {
|
||||||
e && h(this, M)["#"].clear(), h(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)
|
||||||
@ -458,10 +464,10 @@ class Z {
|
|||||||
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 h(this, G).encode(pe(ee.pack(r)));
|
return h(this, G).encode(pe(ee.pack(r)));
|
||||||
});
|
});
|
||||||
m(this, Q, e), m(this, F, n), m(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(), $ = 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, c;
|
var e, r, n, u, v, c;
|
||||||
|
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.7",
|
"version": "0.9.8",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
Loading…
Reference in New Issue
Block a user