v0.9.15
This commit is contained in:
parent
bd192876a6
commit
550ac157dd
50
dist/ff-request.js
vendored
50
dist/ff-request.js
vendored
@ -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))
|
||||
throw TypeError("Cannot add the same private member more than once");
|
||||
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) {
|
||||
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
||||
}
|
||||
@ -16,7 +16,7 @@ var oe = {};
|
||||
(function(r) {
|
||||
(function(e) {
|
||||
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 || {};
|
||||
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");
|
||||
@ -144,13 +144,13 @@ var oe = {};
|
||||
var O = P[y++];
|
||||
if (o.verbose && console.log("Reading collection type " + (O === "$" ? "object" : "Array")), O === "@") {
|
||||
for (var p = []; y < x; y++) {
|
||||
var C = P[y];
|
||||
if (o.verbose && console.log("Read " + C + " symbol"), C === "]")
|
||||
var _ = P[y];
|
||||
if (o.verbose && console.log("Read " + _ + " symbol"), _ === "]")
|
||||
return p;
|
||||
if (C === "@" || C === "$")
|
||||
if (_ === "@" || _ === "$")
|
||||
p.push($());
|
||||
else
|
||||
switch (C) {
|
||||
switch (_) {
|
||||
case t:
|
||||
p.push(!0);
|
||||
break;
|
||||
@ -167,7 +167,7 @@ var oe = {};
|
||||
p.push("");
|
||||
break;
|
||||
default:
|
||||
p.push(f[C]);
|
||||
p.push(f[_]);
|
||||
}
|
||||
}
|
||||
return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p;
|
||||
@ -178,11 +178,11 @@ var oe = {};
|
||||
if (S === "]")
|
||||
return p;
|
||||
S === c ? S = "" : S = f[S];
|
||||
var C = P[++y];
|
||||
if (C === "@" || C === "$")
|
||||
var _ = P[++y];
|
||||
if (_ === "@" || _ === "$")
|
||||
p[S] = $();
|
||||
else
|
||||
switch (C) {
|
||||
switch (_) {
|
||||
case t:
|
||||
p[S] = !0;
|
||||
break;
|
||||
@ -199,7 +199,7 @@ var oe = {};
|
||||
p[S] = "";
|
||||
break;
|
||||
default:
|
||||
p[S] = f[C];
|
||||
p[S] = f[_];
|
||||
}
|
||||
}
|
||||
return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p;
|
||||
@ -238,7 +238,7 @@ var oe = {};
|
||||
};
|
||||
return {
|
||||
JSON,
|
||||
pack: A,
|
||||
pack: C,
|
||||
unpack: M
|
||||
};
|
||||
});
|
||||
@ -274,14 +274,14 @@ class ee {
|
||||
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, 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, 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), A(this, B, t), Promise.resolve(e == null ? void 0 : e(i(this, U).getPrototypeOf()))));
|
||||
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, 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();
|
||||
@ -364,7 +364,7 @@ var K;
|
||||
class Ee {
|
||||
constructor(e) {
|
||||
E(this, K, null);
|
||||
_(this, K, e);
|
||||
A(this, K, e);
|
||||
}
|
||||
get6bits() {
|
||||
let e = this.pos & 7, t = this.pos >> 3;
|
||||
@ -387,13 +387,13 @@ var H;
|
||||
class Oe {
|
||||
constructor(e) {
|
||||
E(this, H, null);
|
||||
_(this, H, e);
|
||||
A(this, H, e);
|
||||
}
|
||||
decode(e) {
|
||||
const t = new Uint8Array(Math.ceil(e.length * 6 / 8) + 1);
|
||||
let n = t.length, s = 0, c = 0;
|
||||
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)
|
||||
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);
|
||||
@ -423,13 +423,13 @@ class te {
|
||||
E(this, R, /* @__PURE__ */ new Map());
|
||||
v(this, "request", ({ url: e = "/", method: t = "GET", ...n }, s = !1) => {
|
||||
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();
|
||||
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) => {
|
||||
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)[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))
|
||||
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];
|
||||
}).then((u) => ((c === "GET" || A == "#") && i(this, m)[A].set(l, u), c === "GET" && !s && setTimeout(() => {
|
||||
i(this, m)[A].delete(l);
|
||||
}).then((u) => ((C == "#" || c == "GET") && i(this, m)[C].set(l, u), C != "#" && c == "GET" && !s && setTimeout(() => {
|
||||
i(this, m)[C].delete(l);
|
||||
}, 300), u)).then((u) => {
|
||||
var T;
|
||||
return (T = i(this, R).get(l)) == null ? void 0 : T.forEach((h, o, d) => {
|
||||
@ -437,7 +437,7 @@ class te {
|
||||
});
|
||||
}).catch((u) => {
|
||||
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];
|
||||
});
|
||||
}).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);
|
||||
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();
|
||||
|
4
dist/ff-request.umd.cjs
vendored
4
dist/ff-request.umd.cjs
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user