This commit is contained in:
what 2025-01-03 17:15:08 +08:00
parent bd192876a6
commit 550ac157dd
2 changed files with 27 additions and 27 deletions

50
dist/ff-request.js vendored
View File

@ -8,7 +8,7 @@ var i = (r, e, t) => (re(r, e, "read from private field"), t ? t.call(r) : e.get
if (e.has(r)) if (e.has(r))
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(r) : e.set(r, t); e instanceof WeakSet ? e.add(r) : e.set(r, t);
}, _ = (r, e, t, n) => (re(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t); }, A = (r, e, t, n) => (re(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t);
function he(r) { function he(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
} }
@ -16,7 +16,7 @@ var oe = {};
(function(r) { (function(r) {
(function(e) { (function(e) {
e([], function() { e([], function() {
var t = -1, n = -2, s = -3, c = -4, l = -5, A = function(h, o) { var t = -1, n = -2, s = -3, c = -4, l = -5, C = function(h, o) {
o = o || {}; o = o || {};
var d = o.verbose || !1; var d = o.verbose || !1;
d && console.log("Normalize the JSON Object"), h = typeof h == "string" ? this.JSON.parse(h) : h, d && console.log("Creating a empty dictionary"); d && console.log("Normalize the JSON Object"), h = typeof h == "string" ? this.JSON.parse(h) : h, d && console.log("Creating a empty dictionary");
@ -144,13 +144,13 @@ var oe = {};
var O = P[y++]; var O = P[y++];
if (o.verbose && console.log("Reading collection type " + (O === "$" ? "object" : "Array")), O === "@") { if (o.verbose && console.log("Reading collection type " + (O === "$" ? "object" : "Array")), O === "@") {
for (var p = []; y < x; y++) { for (var p = []; y < x; y++) {
var C = P[y]; var _ = P[y];
if (o.verbose && console.log("Read " + C + " symbol"), C === "]") if (o.verbose && console.log("Read " + _ + " symbol"), _ === "]")
return p; return p;
if (C === "@" || C === "$") if (_ === "@" || _ === "$")
p.push($()); p.push($());
else else
switch (C) { switch (_) {
case t: case t:
p.push(!0); p.push(!0);
break; break;
@ -167,7 +167,7 @@ var oe = {};
p.push(""); p.push("");
break; break;
default: default:
p.push(f[C]); p.push(f[_]);
} }
} }
return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p; return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p;
@ -178,11 +178,11 @@ var oe = {};
if (S === "]") if (S === "]")
return p; return p;
S === c ? S = "" : S = f[S]; S === c ? S = "" : S = f[S];
var C = P[++y]; var _ = P[++y];
if (C === "@" || C === "$") if (_ === "@" || _ === "$")
p[S] = $(); p[S] = $();
else else
switch (C) { switch (_) {
case t: case t:
p[S] = !0; p[S] = !0;
break; break;
@ -199,7 +199,7 @@ var oe = {};
p[S] = ""; p[S] = "";
break; break;
default: default:
p[S] = f[C]; p[S] = f[_];
} }
} }
return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p; return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p;
@ -238,7 +238,7 @@ var oe = {};
}; };
return { return {
JSON, JSON,
pack: A, pack: C,
unpack: M unpack: M
}; };
}); });
@ -274,14 +274,14 @@ class ee {
value: i(this, U).getPrototypeOf() value: i(this, U).getPrototypeOf()
}) })
}); });
E(this, Y, (e) => e === "$echoMsg" ? i(this, J) : e === "msg" ? i(this, Q) : e === "then" || e === "resp" ? (_(this, D, !0), _(this, B, e === "resp"), i(this, W)) : e === "catch" ? i(this, X) : e === "IS_ECHO_MSG" ? i(this, D) : Reflect.get(this, e)); E(this, Y, (e) => e === "$echoMsg" ? i(this, J) : e === "msg" ? i(this, Q) : e === "then" || e === "resp" ? (A(this, D, !0), A(this, B, e === "resp"), i(this, W)) : e === "catch" ? i(this, X) : e === "IS_ECHO_MSG" ? i(this, D) : Reflect.get(this, e));
E(this, Q, (e = (n) => n, t = !1) => (i(this, J).call(this), _(this, B, t), Promise.resolve(e == null ? void 0 : e(i(this, U).getPrototypeOf())))); E(this, Q, (e = (n) => n, t = !1) => (i(this, J).call(this), A(this, B, t), Promise.resolve(e == null ? void 0 : e(i(this, U).getPrototypeOf()))));
E(this, J, () => { E(this, J, () => {
i(this, D) && (_(this, D, !1), Te.onMsg(this.code, this.message)); i(this, D) && (A(this, D, !1), Te.onMsg(this.code, this.message));
}); });
E(this, W, (e) => [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(i(this, U).getPrototypeOf())) : Promise.reject(i(this, j))); E(this, W, (e) => [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(i(this, U).getPrototypeOf())) : Promise.reject(i(this, j)));
E(this, X, (e) => Promise.resolve(e(i(this, j)))); E(this, X, (e) => Promise.resolve(e(i(this, j))));
return this.code = e, this.message = t, this.data = n, this.url = s, this.res = c, _(this, j, new Proxy(this, i(this, U))); return this.code = e, this.message = t, this.data = n, this.url = s, this.res = c, A(this, j, new Proxy(this, i(this, U)));
} }
} }
j = new WeakMap(), B = new WeakMap(), D = new WeakMap(), U = new WeakMap(), Y = new WeakMap(), Q = new WeakMap(), J = new WeakMap(), W = new WeakMap(), X = new WeakMap(); j = new WeakMap(), B = new WeakMap(), D = new WeakMap(), U = new WeakMap(), Y = new WeakMap(), Q = new WeakMap(), J = new WeakMap(), W = new WeakMap(), X = new WeakMap();
@ -364,7 +364,7 @@ var K;
class Ee { class Ee {
constructor(e) { constructor(e) {
E(this, K, null); E(this, K, null);
_(this, K, e); A(this, K, e);
} }
get6bits() { get6bits() {
let e = this.pos & 7, t = this.pos >> 3; let e = this.pos & 7, t = this.pos >> 3;
@ -387,13 +387,13 @@ var H;
class Oe { class Oe {
constructor(e) { constructor(e) {
E(this, H, null); E(this, H, null);
_(this, H, e); A(this, H, e);
} }
decode(e) { decode(e) {
const t = new Uint8Array(Math.ceil(e.length * 6 / 8) + 1); const t = new Uint8Array(Math.ceil(e.length * 6 / 8) + 1);
let n = t.length, s = 0, c = 0; let n = t.length, s = 0, c = 0;
for (let l = 0; l < e.length; l++) { for (let l = 0; l < e.length; l++) {
const A = e[l].charCodeAt(0), M = i(this, H).decodeMap[A]; const C = e[l].charCodeAt(0), M = i(this, H).decodeMap[C];
if (M === 255) if (M === 255)
throw new Error(`CorruptInputError at index ${l}`); throw new Error(`CorruptInputError at index ${l}`);
l === e.length - 1 ? (c |= M << s, s += Math.ceil(Math.log2(M + 1))) : (M & V) === V ? (c |= M << s, s += 5) : (c |= M << s, s += 6), s >= 8 && (n--, t[n] = c & 255, s %= 8, c >>= 8); l === e.length - 1 ? (c |= M << s, s += Math.ceil(Math.log2(M + 1))) : (M & V) === V ? (c |= M << s, s += 5) : (c |= M << s, s += 6), s >= 8 && (n--, t[n] = c & 255, s %= 8, c >>= 8);
@ -423,13 +423,13 @@ class te {
E(this, R, /* @__PURE__ */ new Map()); E(this, R, /* @__PURE__ */ new Map());
v(this, "request", ({ url: e = "/", method: t = "GET", ...n }, s = !1) => { v(this, "request", ({ url: e = "/", method: t = "GET", ...n }, s = !1) => {
var F; var F;
const c = t.toUpperCase(), l = pe(JSON.stringify([e, c, n])), A = (F = e == null ? void 0 : e.includes) != null && F.call(e, "/_/") ? "#" : "$", { promise: M, resolve: G, reject: z } = Promise.withResolvers(); const c = t.toUpperCase(), l = pe(JSON.stringify([e, c, n])), C = (F = e == null ? void 0 : e.includes) != null && F.call(e, "/_/") ? "#" : "$", { promise: M, resolve: G, reject: z } = Promise.withResolvers();
return i(this, m)[A].has(l) ? (console.log("cache", e), G(i(this, m)[A].get(l))) : i(this, R).has(l) ? i(this, R).get(l).push([G, z]) : (i(this, R).set(l, [[G, z]]), i(this, L).call(this, { url: e, method: c, ...n }).then((u) => { return i(this, m)[C].has(l) ? (console.log("cache", e), G(i(this, m)[C].get(l))) : i(this, R).has(l) ? i(this, R).get(l).push([G, z]) : (i(this, R).set(l, [[G, z]]), i(this, L).call(this, { url: e, method: c, ...n }).then((u) => {
if (![0, 1].includes(u.code)) if (![0, 1].includes(u.code))
throw k(u.code, u.msg, u.data, e, u == null ? void 0 : u.res); throw k(u.code, u.msg, u.data, e, u == null ? void 0 : u.res);
return [u.code, u.msg, u.data, e, u == null ? void 0 : u.res]; return [u.code, u.msg, u.data, e, u == null ? void 0 : u.res];
}).then((u) => ((c === "GET" || A == "#") && i(this, m)[A].set(l, u), c === "GET" && !s && setTimeout(() => { }).then((u) => ((C == "#" || c == "GET") && i(this, m)[C].set(l, u), C != "#" && c == "GET" && !s && setTimeout(() => {
i(this, m)[A].delete(l); i(this, m)[C].delete(l);
}, 300), u)).then((u) => { }, 300), u)).then((u) => {
var T; var T;
return (T = i(this, R).get(l)) == null ? void 0 : T.forEach((h, o, d) => { return (T = i(this, R).get(l)) == null ? void 0 : T.forEach((h, o, d) => {
@ -437,7 +437,7 @@ class te {
}); });
}).catch((u) => { }).catch((u) => {
var T; var T;
i(this, m)[A].delete(l), (T = i(this, R).get(l)) == null || T.forEach((h, o, d) => { i(this, m)[C].delete(l), (T = i(this, R).get(l)) == null || T.forEach((h, o, d) => {
h && h[1](u instanceof ee ? u : k(-1, u, null, e)), delete d[o]; h && h[1](u instanceof ee ? u : k(-1, u, null, e)), delete d[o];
}); });
}).finally(() => i(this, R).delete(l))), new Proxy(M, { }).finally(() => i(this, R).delete(l))), new Proxy(M, {
@ -475,7 +475,7 @@ class te {
const t = JSON.stringify(e, (n, s) => s === void 0 ? null : s); const t = JSON.stringify(e, (n, s) => s === void 0 ? null : s);
return i(this, q).encode(ne.pack(t)); return i(this, q).encode(ne.pack(t));
}); });
_(this, Z, e), _(this, L, n), _(this, q, new be(t)); A(this, Z, e), A(this, L, n), A(this, q, new be(t));
} }
} }
L = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), m = new WeakMap(), R = new WeakMap(); L = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), m = new WeakMap(), R = new WeakMap();

File diff suppressed because one or more lines are too long