@aiao/rxdb-adapter-pglite 0.0.8 → 0.0.9
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/dist/RxDBAdapterPGlite.d.ts +4 -0
- package/dist/RxDBAdapterPGlite.d.ts.map +1 -1
- package/dist/index.js +266 -257
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropertyType as k, RxDBChange as ht, EntityLocalCreatedEvent as et, EntityLocalRemovedEvent as Xt, EntityLocalUpdatedEvent as Kt, RelationKind as
|
|
1
|
+
import { PropertyType as k, RxDBChange as ht, EntityLocalCreatedEvent as et, EntityLocalRemovedEvent as Xt, EntityLocalUpdatedEvent as Kt, RelationKind as we, getEntityMetadata as re, RepositoryBase as or, getEntityStatus as be, RxDBBranch as zt, RxDBAdapterLocalBase as cr } from "@aiao/rxdb";
|
|
2
2
|
import { pickBy as Zt, EventDispatcher as lr, traverseObjectKeys as ur, isFunction as en, isString as fr, AsyncQueueExecutor as hr } from "@aiao/utils";
|
|
3
3
|
import { PGlite as dr } from "@electric-sql/pglite";
|
|
4
4
|
import { ReplaySubject as pr } from "rxjs";
|
|
@@ -83,10 +83,10 @@ const tn = (e, t = "public") => `"${t}"."${e}"`, oe = (e) => tn(e.name, e.namesp
|
|
|
83
83
|
f && (n[a] = Er(t[a], f));
|
|
84
84
|
}
|
|
85
85
|
return n;
|
|
86
|
-
}, sn = (e, t) => Zt(t, (n, s) => e.propertyMap.has(s) || e.foreignKeyNames.includes(s)), mr = (e, t) => Zt(t, (n, s) => e.propertyMap.get(s)?.readonly !== !0),
|
|
86
|
+
}, sn = (e, t) => Zt(t, (n, s) => e.propertyMap.has(s) || e.foreignKeyNames.includes(s)), mr = (e, t) => Zt(t, (n, s) => e.propertyMap.get(s)?.readonly !== !0), wr = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, pt = (e) => {
|
|
87
87
|
if (typeof e == "string") {
|
|
88
88
|
const t = e.replaceAll("'", "''");
|
|
89
|
-
return
|
|
89
|
+
return wr.test(e) ? `'${t}'::uuid` : `'${t}'`;
|
|
90
90
|
}
|
|
91
91
|
return e == null ? "NULL" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? `'${e.toISOString()}'` : Array.isArray(e) ? `ARRAY[${e.map((n) => pt(n)).join(", ")}]` : typeof e == "object" ? `'${JSON.stringify(e).replaceAll("'", "''")}'::jsonb` : String(e);
|
|
92
92
|
}, Ji = (e, t = []) => !t || t.length === 0 ? e : e.replace(/\$(\d+)/g, (n, s) => {
|
|
@@ -105,7 +105,7 @@ const tn = (e, t = "public") => `"${t}"."${e}"`, oe = (e) => tn(e.name, e.namesp
|
|
|
105
105
|
a ? a.type === k.number && typeof r == "string" ? n[s] = parseFloat(r) : a.type === k.integer && typeof r == "string" ? n[s] = parseInt(r, 10) : n[s] = r : n[s] = r;
|
|
106
106
|
}
|
|
107
107
|
}), n;
|
|
108
|
-
},
|
|
108
|
+
}, _r = (e, t) => {
|
|
109
109
|
if (e == null) return e;
|
|
110
110
|
switch (t.type) {
|
|
111
111
|
case k.date:
|
|
@@ -122,7 +122,7 @@ const tn = (e, t = "public") => `"${t}"."${e}"`, oe = (e) => tn(e.name, e.namesp
|
|
|
122
122
|
}
|
|
123
123
|
}, $t = (e, t) => (Object.keys(t).forEach((n) => {
|
|
124
124
|
const s = t[n], r = e.propertyMap.get(n);
|
|
125
|
-
r && (t[n] =
|
|
125
|
+
r && (t[n] = _r(s, r));
|
|
126
126
|
}), t);
|
|
127
127
|
var br = Object.defineProperty, an = (e) => {
|
|
128
128
|
throw TypeError(e);
|
|
@@ -134,9 +134,9 @@ var br = Object.defineProperty, an = (e) => {
|
|
|
134
134
|
return T(e, t, s);
|
|
135
135
|
} }), pe = Tr(() => {
|
|
136
136
|
}), Ar = {};
|
|
137
|
-
Fe(Ar, { ABSTIME: () => qr, ACLITEM: () => Yr, BIT: () => Qr, BOOL: () => tt, BPCHAR: () => dn, BYTEA: () => nt, CHAR: () => Sr, CID: () => Lr, CIDR: () =>
|
|
137
|
+
Fe(Ar, { ABSTIME: () => qr, ACLITEM: () => Yr, BIT: () => Qr, BOOL: () => tt, BPCHAR: () => dn, BYTEA: () => nt, CHAR: () => Sr, CID: () => Lr, CIDR: () => Ur, CIRCLE: () => Pr, DATE: () => yn, FLOAT4: () => fn, FLOAT8: () => hn, GTSVECTOR: () => fs, INET: () => Gr, INT2: () => cn, INT4: () => ln, INT8: () => rt, INTERVAL: () => Hr, JSON: () => st, JSONB: () => En, MACADDR: () => Wr, MACADDR8: () => Fr, MONEY: () => kr, NUMERIC: () => Kr, OID: () => un, PATH: () => Mr, PG_DEPENDENCIES: () => cs, PG_LSN: () => as, PG_NDISTINCT: () => os, PG_NODE_TREE: () => Dr, POLYGON: () => Br, REFCURSOR: () => zr, REGCLASS: () => ns, REGCONFIG: () => hs, REGDICTIONARY: () => ds, REGNAMESPACE: () => ps, REGOPER: () => es, REGOPERATOR: () => ts, REGPROC: () => Nr, REGPROCEDURE: () => Zr, REGROLE: () => ys, REGTYPE: () => rs, RELTIME: () => jr, SMGR: () => Cr, TEXT: () => Ce, TID: () => Rr, TIME: () => Vr, TIMESTAMP: () => gn, TIMESTAMPTZ: () => it, TIMETZ: () => Jr, TINTERVAL: () => xr, TSQUERY: () => us, TSVECTOR: () => ls, TXID_SNAPSHOT: () => is, UUID: () => ss, VARBIT: () => Xr, VARCHAR: () => pn, XID: () => vr, XML: () => Or, arrayParser: () => Ts, arraySerializer: () => wn, parseType: () => at, parsers: () => gs, serializers: () => Es, types: () => mn });
|
|
138
138
|
pe();
|
|
139
|
-
var Ir = globalThis.JSON.parse, $r = globalThis.JSON.stringify, tt = 16, nt = 17, Sr = 18, rt = 20, cn = 21, ln = 23, Nr = 24, Ce = 25, un = 26, Rr = 27, vr = 28, Lr = 29, st = 114, Or = 142, Dr = 194, Cr = 210, Mr = 602,
|
|
139
|
+
var Ir = globalThis.JSON.parse, $r = globalThis.JSON.stringify, tt = 16, nt = 17, Sr = 18, rt = 20, cn = 21, ln = 23, Nr = 24, Ce = 25, un = 26, Rr = 27, vr = 28, Lr = 29, st = 114, Or = 142, Dr = 194, Cr = 210, Mr = 602, Br = 604, Ur = 650, fn = 700, hn = 701, qr = 702, jr = 703, xr = 704, Pr = 718, Fr = 774, kr = 790, Wr = 829, Gr = 869, Yr = 1033, dn = 1042, pn = 1043, yn = 1082, Vr = 1083, gn = 1114, it = 1184, Hr = 1186, Jr = 1266, Qr = 1560, Xr = 1562, Kr = 1700, zr = 1790, Zr = 2202, es = 2203, ts = 2204, ns = 2205, rs = 2206, ss = 2950, is = 2970, as = 3220, os = 3361, cs = 3402, ls = 3614, us = 3615, fs = 3642, hs = 3734, ds = 3769, En = 3802, ps = 4089, ys = 4096, mn = { string: { to: Ce, from: [Ce, pn, dn], serialize: (e) => {
|
|
140
140
|
if (typeof e == "string") return e;
|
|
141
141
|
if (typeof e == "number") return e.toString();
|
|
142
142
|
throw new Error("Invalid input for string type");
|
|
@@ -171,26 +171,26 @@ function ms(e) {
|
|
|
171
171
|
}) : (t[a] = d, n[a] = f), { parsers: t, serializers: n };
|
|
172
172
|
}, { parsers: {}, serializers: {} });
|
|
173
173
|
}
|
|
174
|
-
var
|
|
174
|
+
var ws = /\\/g, _s = /"/g;
|
|
175
175
|
function bs(e) {
|
|
176
|
-
return e.replace(
|
|
176
|
+
return e.replace(ws, "\\\\").replace(_s, '\\"');
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function wn(e, t, n) {
|
|
179
179
|
if (Array.isArray(e) === !1) return e;
|
|
180
180
|
if (!e.length) return "{}";
|
|
181
181
|
let s = e[0], r = n === 1020 ? ";" : ",";
|
|
182
|
-
return Array.isArray(s) ? `{${e.map((a) =>
|
|
182
|
+
return Array.isArray(s) ? `{${e.map((a) => wn(a, t, n)).join(r)}}` : `{${e.map((a) => (a === void 0 && (a = null), a === null ? "null" : '"' + bs(t ? t(a) : a.toString()) + '"')).join(r)}}`;
|
|
183
183
|
}
|
|
184
184
|
var Qe = { i: 0, char: null, str: "", quoted: !1, last: 0, p: null };
|
|
185
185
|
function Ts(e, t, n) {
|
|
186
|
-
return Qe.i = Qe.last = 0,
|
|
186
|
+
return Qe.i = Qe.last = 0, _n(Qe, e, t, n)[0];
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function _n(e, t, n, s) {
|
|
189
189
|
let r = [], a = s === 1020 ? ";" : ",";
|
|
190
190
|
for (; e.i < t.length; e.i++) {
|
|
191
191
|
if (e.char = t[e.i], e.quoted) e.char === "\\" ? e.str += t[++e.i] : e.char === '"' ? (r.push(n ? n(e.str) : e.str), e.str = "", e.quoted = t[e.i + 1] === '"', e.last = e.i + 2) : e.str += e.char;
|
|
192
192
|
else if (e.char === '"') e.quoted = !0;
|
|
193
|
-
else if (e.char === "{") e.last = ++e.i, r.push(
|
|
193
|
+
else if (e.char === "{") e.last = ++e.i, r.push(_n(e, t, n, s));
|
|
194
194
|
else if (e.char === "}") {
|
|
195
195
|
e.quoted = !1, e.last < e.i && r.push(n ? n(t.slice(e.last, e.i)) : t.slice(e.last, e.i)), e.last = e.i + 1;
|
|
196
196
|
break;
|
|
@@ -243,7 +243,7 @@ function bn(e) {
|
|
|
243
243
|
return t ? t.dataTypeIDs : [];
|
|
244
244
|
}
|
|
245
245
|
var Tn = {};
|
|
246
|
-
Fe(Tn, { AuthenticationCleartextPassword: () => Dn, AuthenticationMD5Password: () => Cn, AuthenticationOk: () => On, AuthenticationSASL: () => Mn, AuthenticationSASLContinue: () =>
|
|
246
|
+
Fe(Tn, { AuthenticationCleartextPassword: () => Dn, AuthenticationMD5Password: () => Cn, AuthenticationOk: () => On, AuthenticationSASL: () => Mn, AuthenticationSASLContinue: () => Bn, AuthenticationSASLFinal: () => Un, BackendKeyDataMessage: () => Wn, CommandCompleteMessage: () => Vn, CopyDataMessage: () => qn, CopyResponse: () => jn, DataRowMessage: () => Hn, DatabaseError: () => ot, Field: () => xn, NoticeMessage: () => Jn, NotificationResponseMessage: () => Gn, ParameterDescriptionMessage: () => Fn, ParameterStatusMessage: () => kn, ReadyForQueryMessage: () => Yn, RowDescriptionMessage: () => Pn, bindComplete: () => In, closeComplete: () => $n, copyDone: () => Ln, emptyQuery: () => vn, noData: () => Sn, parseComplete: () => An, portalSuspended: () => Nn, replicationStart: () => Rn });
|
|
247
247
|
pe();
|
|
248
248
|
var An = { name: "parseComplete", length: 5 }, In = { name: "bindComplete", length: 5 }, $n = { name: "closeComplete", length: 5 }, Sn = { name: "noData", length: 5 }, Nn = { name: "portalSuspended", length: 5 }, Rn = { name: "replicationStart", length: 4 }, vn = { name: "emptyQuery", length: 4 }, Ln = { name: "copyDone", length: 4 }, On = class {
|
|
249
249
|
constructor(t) {
|
|
@@ -261,11 +261,11 @@ var An = { name: "parseComplete", length: 5 }, In = { name: "bindComplete", leng
|
|
|
261
261
|
constructor(t, n) {
|
|
262
262
|
this.length = t, this.mechanisms = n, this.name = "authenticationSASL";
|
|
263
263
|
}
|
|
264
|
-
},
|
|
264
|
+
}, Bn = class {
|
|
265
265
|
constructor(e, t) {
|
|
266
266
|
this.length = e, this.data = t, this.name = "authenticationSASLContinue";
|
|
267
267
|
}
|
|
268
|
-
},
|
|
268
|
+
}, Un = class {
|
|
269
269
|
constructor(e, t) {
|
|
270
270
|
this.length = e, this.data = t, this.name = "authenticationSASLFinal";
|
|
271
271
|
}
|
|
@@ -389,7 +389,7 @@ var J = new We(), Ns = (e) => {
|
|
|
389
389
|
t.length > 63 && (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)", t, t.length), console.error("This can cause conflicts and silent errors executing queries"));
|
|
390
390
|
let n = J.addCString(t).addCString(e.text).addInt16(e.types?.length ?? 0);
|
|
391
391
|
return e.types?.forEach((s) => n.addInt32(s)), J.flush(80);
|
|
392
|
-
}, Ie = new We(),
|
|
392
|
+
}, Ie = new We(), Bs = (e, t) => {
|
|
393
393
|
for (let n = 0; n < e.length; n++) {
|
|
394
394
|
let s = t ? t(e[n], n) : e[n];
|
|
395
395
|
if (s === null) J.addInt16(0), Ie.addInt32(-1);
|
|
@@ -398,9 +398,9 @@ var J = new We(), Ns = (e) => {
|
|
|
398
398
|
J.addInt16(1), Ie.addInt32(r.byteLength), Ie.add(r);
|
|
399
399
|
} else J.addInt16(0), Ie.addInt32(ke(s)), Ie.addString(s);
|
|
400
400
|
}
|
|
401
|
-
},
|
|
401
|
+
}, Us = (e = {}) => {
|
|
402
402
|
let t = e.portal ?? "", n = e.statement ?? "", s = e.binary ?? !1, r = e.values ?? Cs, a = r.length;
|
|
403
|
-
return J.addCString(t).addCString(n), J.addInt16(a),
|
|
403
|
+
return J.addCString(t).addCString(n), J.addInt16(a), Bs(r, e.valueMapper), J.addInt16(a), J.add(Ie.flush()), J.addInt16(s ? 1 : 0), J.flush(66);
|
|
404
404
|
}, qs = new Uint8Array([69, 0, 0, 0, 9, 0, 0, 0, 0, 0]), js = (e) => {
|
|
405
405
|
if (!e || !e.portal && !e.rows) return qs;
|
|
406
406
|
let t = e.portal ?? "", n = e.rows ?? 0, s = ke(t), r = 4 + s + 1 + 4, a = new DataView(new ArrayBuffer(1 + r));
|
|
@@ -414,28 +414,28 @@ var J = new We(), Ns = (e) => {
|
|
|
414
414
|
}, Ps = J.addCString("P").flush(68), Fs = J.addCString("S").flush(68), ks = (e) => e.name ? Et(68, `${e.type}${e.name ?? ""}`) : e.type === "P" ? Ps : Fs, Ws = (e) => {
|
|
415
415
|
let t = `${e.type}${e.name ?? ""}`;
|
|
416
416
|
return Et(67, t);
|
|
417
|
-
}, Gs = (e) => J.add(e).flush(100), Ys = (e) => Et(102, e), Ge = (e) => new Uint8Array([e, 0, 0, 0, 4]), Vs = Ge(72), Hs = Ge(83), Js = Ge(88), Qs = Ge(99), Oe = { startup: Ns, password: vs, requestSsl: Rs, sendSASLInitialResponseMessage: Ls, sendSCRAMClientFinalMessage: Os, query: Ds, parse: Ms, bind:
|
|
417
|
+
}, Gs = (e) => J.add(e).flush(100), Ys = (e) => Et(102, e), Ge = (e) => new Uint8Array([e, 0, 0, 0, 4]), Vs = Ge(72), Hs = Ge(83), Js = Ge(88), Qs = Ge(99), Oe = { startup: Ns, password: vs, requestSsl: Rs, sendSASLInitialResponseMessage: Ls, sendSCRAMClientFinalMessage: Os, query: Ds, parse: Ms, bind: Us, execute: js, describe: ks, close: Ws, flush: () => Vs, sync: () => Hs, end: () => Js, copyData: Gs, copyDone: () => Qs, copyFail: Ys, cancel: xs };
|
|
418
418
|
pe();
|
|
419
419
|
pe();
|
|
420
420
|
var St = { text: 0, binary: 1 };
|
|
421
421
|
pe();
|
|
422
|
-
var Xs = new ArrayBuffer(0),
|
|
422
|
+
var Xs = new ArrayBuffer(0), _e, ne, lt, ut, De, Ks = class {
|
|
423
423
|
constructor(e = 0) {
|
|
424
|
-
ae(this,
|
|
424
|
+
ae(this, _e, new DataView(Xs)), ae(this, ne), ae(this, lt, "utf-8"), ae(this, ut, new TextDecoder(T(this, lt))), ae(this, De, !1), Y(this, ne, e);
|
|
425
425
|
}
|
|
426
426
|
setBuffer(e, t) {
|
|
427
|
-
Y(this, ne, e), Y(this,
|
|
427
|
+
Y(this, ne, e), Y(this, _e, new DataView(t));
|
|
428
428
|
}
|
|
429
429
|
int16() {
|
|
430
|
-
let e = T(this,
|
|
430
|
+
let e = T(this, _e).getInt16(T(this, ne), T(this, De));
|
|
431
431
|
return Y(this, ne, T(this, ne) + 2), e;
|
|
432
432
|
}
|
|
433
433
|
byte() {
|
|
434
|
-
let e = T(this,
|
|
434
|
+
let e = T(this, _e).getUint8(T(this, ne));
|
|
435
435
|
return on(this, ne)._++, e;
|
|
436
436
|
}
|
|
437
437
|
int32() {
|
|
438
|
-
let e = T(this,
|
|
438
|
+
let e = T(this, _e).getInt32(T(this, ne), T(this, De));
|
|
439
439
|
return Y(this, ne, T(this, ne) + 4), e;
|
|
440
440
|
}
|
|
441
441
|
string(e) {
|
|
@@ -443,17 +443,17 @@ var Xs = new ArrayBuffer(0), we, ne, lt, ut, De, Ks = class {
|
|
|
443
443
|
}
|
|
444
444
|
cstring() {
|
|
445
445
|
let e = T(this, ne), t = e;
|
|
446
|
-
for (; T(this,
|
|
446
|
+
for (; T(this, _e).getUint8(t++) !== 0; ) ;
|
|
447
447
|
let n = this.string(t - e - 1);
|
|
448
448
|
return Y(this, ne, t), n;
|
|
449
449
|
}
|
|
450
450
|
bytes(e) {
|
|
451
|
-
let t = T(this,
|
|
451
|
+
let t = T(this, _e).buffer.slice(T(this, ne), T(this, ne) + e);
|
|
452
452
|
return Y(this, ne, T(this, ne) + e), new Uint8Array(t);
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
|
-
|
|
456
|
-
var ft = 1, zs = 4, Nt = ft + zs, Rt = new ArrayBuffer(0), fe, he, de, x, K, Xn, Kn, vt, Lt, Ot, Dt, Ct, Xe, Mt,
|
|
455
|
+
_e = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap();
|
|
456
|
+
var ft = 1, zs = 4, Nt = ft + zs, Rt = new ArrayBuffer(0), fe, he, de, x, K, Xn, Kn, vt, Lt, Ot, Dt, Ct, Xe, Mt, Bt, Ut, qt, jt, xt, Pt, Ft, Ke, Zs = class {
|
|
457
457
|
constructor() {
|
|
458
458
|
ae(this, K), ae(this, fe, new DataView(Rt)), ae(this, he, 0), ae(this, de, 0), ae(this, x, new Ks());
|
|
459
459
|
}
|
|
@@ -522,7 +522,7 @@ fe = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), de = /*
|
|
|
522
522
|
case 78:
|
|
523
523
|
return G(this, K, Ke).call(this, e, n, s, "notice");
|
|
524
524
|
case 84:
|
|
525
|
-
return G(this, K,
|
|
525
|
+
return G(this, K, Bt).call(this, e, n, s);
|
|
526
526
|
case 116:
|
|
527
527
|
return G(this, K, qt).call(this, e, n, s);
|
|
528
528
|
case 71:
|
|
@@ -558,12 +558,12 @@ fe = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), de = /*
|
|
|
558
558
|
T(this, x).setBuffer(e, n);
|
|
559
559
|
let s = T(this, x).int32(), r = T(this, x).cstring(), a = T(this, x).cstring();
|
|
560
560
|
return new Gn(t, s, r, a);
|
|
561
|
-
},
|
|
561
|
+
}, Bt = function(e, t, n) {
|
|
562
562
|
T(this, x).setBuffer(e, n);
|
|
563
563
|
let s = T(this, x).int16(), r = new Pn(t, s);
|
|
564
|
-
for (let a = 0; a < s; a++) r.fields[a] = G(this, K,
|
|
564
|
+
for (let a = 0; a < s; a++) r.fields[a] = G(this, K, Ut).call(this);
|
|
565
565
|
return r;
|
|
566
|
-
},
|
|
566
|
+
}, Ut = function() {
|
|
567
567
|
let e = T(this, x).cstring(), t = T(this, x).int32(), n = T(this, x).int16(), s = T(this, x).int32(), r = T(this, x).int16(), a = T(this, x).int32(), f = T(this, x).int16() === 0 ? St.text : St.binary;
|
|
568
568
|
return new xn(e, t, n, s, r, a, f);
|
|
569
569
|
}, qt = function(e, t, n) {
|
|
@@ -606,9 +606,9 @@ fe = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), de = /*
|
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
case 11:
|
|
609
|
-
return new Un(t, T(this, x).string(t - 8));
|
|
610
|
-
case 12:
|
|
611
609
|
return new Bn(t, T(this, x).string(t - 8));
|
|
610
|
+
case 12:
|
|
611
|
+
return new Un(t, T(this, x).string(t - 8));
|
|
612
612
|
default:
|
|
613
613
|
throw new Error("Unknown authenticationOk message type " + s);
|
|
614
614
|
}
|
|
@@ -677,7 +677,7 @@ var ei = 5, ti = async (e, t) => {
|
|
|
677
677
|
if (typeof r != "string" && (d = r.signal, a = r.params, f = r.callback, h = r.offset, E = r.limit, r = r.query), h === void 0 != (E === void 0)) throw new Error("offset and limit must be provided together");
|
|
678
678
|
let $ = h !== void 0 && E !== void 0, N;
|
|
679
679
|
if ($ && (typeof h != "number" || isNaN(h) || typeof E != "number" || isNaN(E))) throw new Error("offset and limit must be numbers");
|
|
680
|
-
let D = f ? [f] : [], M = kt().replace(/-/g, ""), S = !1, C,
|
|
680
|
+
let D = f ? [f] : [], M = kt().replace(/-/g, ""), S = !1, C, w, R = async () => {
|
|
681
681
|
await e.transaction(async (I) => {
|
|
682
682
|
let p = a && a.length > 0 ? await Wt(e, r, a, I) : r;
|
|
683
683
|
await I.exec(`CREATE OR REPLACE TEMP VIEW live_query_${M}_view AS ${p}`);
|
|
@@ -692,7 +692,7 @@ var ei = 5, ti = async (e, t) => {
|
|
|
692
692
|
`), N = (await I.query(`EXECUTE live_query_${M}_get_total_count;`)).rows[0].count, C = { ...await I.query(`EXECUTE live_query_${M}_get(${E}, ${h});`), offset: h, limit: E, totalCount: N }) : (await I.exec(`
|
|
693
693
|
PREPARE live_query_${M}_get AS
|
|
694
694
|
SELECT * FROM live_query_${M}_view;
|
|
695
|
-
`), C = await I.query(`EXECUTE live_query_${M}_get;`)),
|
|
695
|
+
`), C = await I.query(`EXECUTE live_query_${M}_get;`)), w = await Promise.all(m.map((c) => I.listen(`"table_change__${c.schema_oid}__${c.table_oid}"`, async () => {
|
|
696
696
|
O();
|
|
697
697
|
})));
|
|
698
698
|
});
|
|
@@ -725,7 +725,7 @@ var ei = 5, ti = async (e, t) => {
|
|
|
725
725
|
D.push(I);
|
|
726
726
|
}, b = async (I) => {
|
|
727
727
|
I ? D = D.filter((p) => p !== p) : D = [], D.length === 0 && !S && (S = !0, await e.transaction(async (p) => {
|
|
728
|
-
await Promise.all(
|
|
728
|
+
await Promise.all(w.map((m) => m(p))), await p.exec(`
|
|
729
729
|
DROP VIEW IF EXISTS live_query_${M}_view;
|
|
730
730
|
DEALLOCATE live_query_${M}_get;
|
|
731
731
|
`);
|
|
@@ -802,12 +802,12 @@ var ei = 5, ti = async (e, t) => {
|
|
|
802
802
|
`);
|
|
803
803
|
}
|
|
804
804
|
S = await Promise.all(I.map((m) => A.listen(`"table_change__${m.schema_oid}__${m.table_oid}"`, async () => {
|
|
805
|
-
|
|
805
|
+
w();
|
|
806
806
|
})));
|
|
807
807
|
});
|
|
808
808
|
};
|
|
809
809
|
await C();
|
|
810
|
-
let
|
|
810
|
+
let w = Gt(async () => {
|
|
811
811
|
if (E.length === 0 && M) return;
|
|
812
812
|
let A = !1;
|
|
813
813
|
for (let b = 0; b < 5; b++) try {
|
|
@@ -843,11 +843,11 @@ var ei = 5, ti = async (e, t) => {
|
|
|
843
843
|
};
|
|
844
844
|
return h?.aborted ? await O() : h?.addEventListener("abort", () => {
|
|
845
845
|
O();
|
|
846
|
-
}, { once: !0 }), await
|
|
846
|
+
}, { once: !0 }), await w(), { fields: M.fields.filter((A) => !["__after__", "__op__", "__changed_columns__"].includes(A.name)), initialChanges: M.rows, subscribe: R, unsubscribe: O, refresh: w };
|
|
847
847
|
}, async incrementalQuery(r, a, f, d) {
|
|
848
848
|
let h;
|
|
849
849
|
if (typeof r != "string" && (h = r.signal, a = r.params, f = r.key, d = r.callback, r = r.query), !f) throw new Error("key is required for incremental queries");
|
|
850
|
-
let E = d ? [d] : [], $ = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), D = [], M = !0, { fields: S, unsubscribe: C, refresh:
|
|
850
|
+
let E = d ? [d] : [], $ = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), D = [], M = !0, { fields: S, unsubscribe: C, refresh: w } = await s.changes(r, a, f, (A) => {
|
|
851
851
|
for (let p of A) {
|
|
852
852
|
let { __op__: m, __changed_columns__: c, ...l } = p;
|
|
853
853
|
switch (m) {
|
|
@@ -887,7 +887,7 @@ var ei = 5, ti = async (e, t) => {
|
|
|
887
887
|
};
|
|
888
888
|
return h?.aborted ? await O() : h?.addEventListener("abort", () => {
|
|
889
889
|
O();
|
|
890
|
-
}, { once: !0 }), { initialResults: { rows: D, fields: S }, subscribe: R, unsubscribe: O, refresh:
|
|
890
|
+
}, { once: !0 }), { initialResults: { rows: D, fields: S }, subscribe: R, unsubscribe: O, refresh: w };
|
|
891
891
|
} };
|
|
892
892
|
return { namespaceObj: s };
|
|
893
893
|
}, ni = { name: "Live Queries", setup: ti };
|
|
@@ -1092,12 +1092,12 @@ function ii() {
|
|
|
1092
1092
|
}, r.keysMD5 = function(p) {
|
|
1093
1093
|
return C(p, { algorithm: "md5", encoding: "hex", excludeValues: !0 });
|
|
1094
1094
|
};
|
|
1095
|
-
var
|
|
1095
|
+
var w = S.getHashes ? S.getHashes().slice() : ["sha1", "md5"], R = (w.push("passthrough"), ["buffer", "hex", "binary", "base64"]);
|
|
1096
1096
|
function O(p, m) {
|
|
1097
1097
|
var c = {};
|
|
1098
1098
|
if (c.algorithm = (m = m || {}).algorithm || "sha1", c.encoding = m.encoding || "hex", c.excludeValues = !!m.excludeValues, c.algorithm = c.algorithm.toLowerCase(), c.encoding = c.encoding.toLowerCase(), c.ignoreUnknown = m.ignoreUnknown === !0, c.respectType = m.respectType !== !1, c.respectFunctionNames = m.respectFunctionNames !== !1, c.respectFunctionProperties = m.respectFunctionProperties !== !1, c.unorderedArrays = m.unorderedArrays === !0, c.unorderedSets = m.unorderedSets !== !1, c.unorderedObjects = m.unorderedObjects !== !1, c.replacer = m.replacer || void 0, c.excludeKeys = m.excludeKeys || void 0, p === void 0) throw new Error("Object argument required.");
|
|
1099
|
-
for (var l = 0; l <
|
|
1100
|
-
if (
|
|
1099
|
+
for (var l = 0; l < w.length; ++l) w[l].toLowerCase() === c.algorithm.toLowerCase() && (c.algorithm = w[l]);
|
|
1100
|
+
if (w.indexOf(c.algorithm) === -1) throw new Error('Algorithm "' + c.algorithm + '" not supported. supported values: ' + w.join(", "));
|
|
1101
1101
|
if (R.indexOf(c.encoding) === -1 && c.algorithm !== "passthrough") throw new Error('Encoding "' + c.encoding + '" not supported. supported values: ' + R.join(", "));
|
|
1102
1102
|
return c;
|
|
1103
1103
|
}
|
|
@@ -1112,12 +1112,12 @@ function ii() {
|
|
|
1112
1112
|
return { dispatch: function(o) {
|
|
1113
1113
|
return this["_" + ((o = p.replacer ? p.replacer(o) : o) === null ? "null" : typeof o)](o);
|
|
1114
1114
|
}, _object: function(o) {
|
|
1115
|
-
var g,
|
|
1116
|
-
if (P = (P = P ? P[1] : "unknown:[" +
|
|
1115
|
+
var g, _ = Object.prototype.toString.call(o), P = /\[object (.*)\]/i.exec(_);
|
|
1116
|
+
if (P = (P = P ? P[1] : "unknown:[" + _ + "]").toLowerCase(), 0 <= (_ = c.indexOf(o))) return this.dispatch("[CIRCULAR:" + _ + "]");
|
|
1117
1117
|
if (c.push(o), d !== void 0 && d.isBuffer && d.isBuffer(o)) return l("buffer:"), l(o);
|
|
1118
|
-
if (P === "object" || P === "function" || P === "asyncfunction") return
|
|
1118
|
+
if (P === "object" || P === "function" || P === "asyncfunction") return _ = Object.keys(o), p.unorderedObjects && (_ = _.sort()), p.respectType === !1 || A(o) || _.splice(0, 0, "prototype", "__proto__", "constructor"), p.excludeKeys && (_ = _.filter(function(j) {
|
|
1119
1119
|
return !p.excludeKeys(j);
|
|
1120
|
-
})), l("object:" +
|
|
1120
|
+
})), l("object:" + _.length + ":"), g = this, _.forEach(function(j) {
|
|
1121
1121
|
g.dispatch(j), l(":"), p.excludeValues || g.dispatch(o[j]), l(",");
|
|
1122
1122
|
});
|
|
1123
1123
|
if (!this["_" + P]) {
|
|
@@ -1127,9 +1127,9 @@ function ii() {
|
|
|
1127
1127
|
this["_" + P](o);
|
|
1128
1128
|
}, _array: function(o, j) {
|
|
1129
1129
|
j = j !== void 0 ? j : p.unorderedArrays !== !1;
|
|
1130
|
-
var
|
|
1130
|
+
var _ = this;
|
|
1131
1131
|
if (l("array:" + o.length + ":"), !j || o.length <= 1) return o.forEach(function(F) {
|
|
1132
|
-
return
|
|
1132
|
+
return _.dispatch(F);
|
|
1133
1133
|
});
|
|
1134
1134
|
var P = [], j = o.map(function(F) {
|
|
1135
1135
|
var q = new I(), H = c.slice();
|
|
@@ -1248,25 +1248,25 @@ Use "options.replacer" or "options.ignoreUnknown"
|
|
|
1248
1248
|
}, { buffer: 3, crypto: 5, lYpoI2: 11 }], 2: [function(n, s, r) {
|
|
1249
1249
|
(function(a, f, d, h, E, $, N, D, M) {
|
|
1250
1250
|
(function(S) {
|
|
1251
|
-
var C = typeof Uint8Array < "u" ? Uint8Array : Array,
|
|
1251
|
+
var C = typeof Uint8Array < "u" ? Uint8Array : Array, w = 43, R = 47, O = 48, A = 97, b = 65, I = 45, p = 95;
|
|
1252
1252
|
function m(c) {
|
|
1253
|
-
return c = c.charCodeAt(0), c ===
|
|
1253
|
+
return c = c.charCodeAt(0), c === w || c === I ? 62 : c === R || c === p ? 63 : c < O ? -1 : c < O + 10 ? c - O + 26 + 26 : c < b + 26 ? c - b : c < A + 26 ? c - A + 26 : void 0;
|
|
1254
1254
|
}
|
|
1255
1255
|
S.toByteArray = function(c) {
|
|
1256
1256
|
var l, o;
|
|
1257
1257
|
if (0 < c.length % 4) throw new Error("Invalid string. Length must be a multiple of 4");
|
|
1258
|
-
var g = c.length, g = c.charAt(g - 2) === "=" ? 2 : c.charAt(g - 1) === "=" ? 1 : 0,
|
|
1258
|
+
var g = c.length, g = c.charAt(g - 2) === "=" ? 2 : c.charAt(g - 1) === "=" ? 1 : 0, _ = new C(3 * c.length / 4 - g), P = 0 < g ? c.length - 4 : c.length, j = 0;
|
|
1259
1259
|
function F(q) {
|
|
1260
|
-
|
|
1260
|
+
_[j++] = q;
|
|
1261
1261
|
}
|
|
1262
1262
|
for (l = 0; l < P; l += 4, 0) F((16711680 & (o = m(c.charAt(l)) << 18 | m(c.charAt(l + 1)) << 12 | m(c.charAt(l + 2)) << 6 | m(c.charAt(l + 3)))) >> 16), F((65280 & o) >> 8), F(255 & o);
|
|
1263
|
-
return g == 2 ? F(255 & (o = m(c.charAt(l)) << 2 | m(c.charAt(l + 1)) >> 4)) : g == 1 && (F((o = m(c.charAt(l)) << 10 | m(c.charAt(l + 1)) << 4 | m(c.charAt(l + 2)) >> 2) >> 8 & 255), F(255 & o)),
|
|
1263
|
+
return g == 2 ? F(255 & (o = m(c.charAt(l)) << 2 | m(c.charAt(l + 1)) >> 4)) : g == 1 && (F((o = m(c.charAt(l)) << 10 | m(c.charAt(l + 1)) << 4 | m(c.charAt(l + 2)) >> 2) >> 8 & 255), F(255 & o)), _;
|
|
1264
1264
|
}, S.fromByteArray = function(c) {
|
|
1265
|
-
var l, o, g,
|
|
1265
|
+
var l, o, g, _, P = c.length % 3, j = "";
|
|
1266
1266
|
function F(q) {
|
|
1267
1267
|
return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(q);
|
|
1268
1268
|
}
|
|
1269
|
-
for (l = 0, g = c.length - P; l < g; l += 3) o = (c[l] << 16) + (c[l + 1] << 8) + c[l + 2], j += F((
|
|
1269
|
+
for (l = 0, g = c.length - P; l < g; l += 3) o = (c[l] << 16) + (c[l + 1] << 8) + c[l + 2], j += F((_ = o) >> 18 & 63) + F(_ >> 12 & 63) + F(_ >> 6 & 63) + F(63 & _);
|
|
1270
1270
|
switch (P) {
|
|
1271
1271
|
case 1:
|
|
1272
1272
|
j = (j += F((o = c[c.length - 1]) >> 2)) + F(o << 4 & 63) + "==";
|
|
@@ -1279,33 +1279,33 @@ Use "options.replacer" or "options.ignoreUnknown"
|
|
|
1279
1279
|
})(r === void 0 ? this.base64js = {} : r);
|
|
1280
1280
|
}).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js", "/node_modules/gulp-browserify/node_modules/base64-js/lib");
|
|
1281
1281
|
}, { buffer: 3, lYpoI2: 11 }], 3: [function(n, s, r) {
|
|
1282
|
-
(function(a, f,
|
|
1282
|
+
(function(a, f, w, h, E, $, N, D, M) {
|
|
1283
1283
|
var S = n("base64-js"), C = n("ieee754");
|
|
1284
|
-
function
|
|
1285
|
-
if (!(this instanceof
|
|
1286
|
-
var L, v,
|
|
1284
|
+
function w(i, u, y) {
|
|
1285
|
+
if (!(this instanceof w)) return new w(i, u, y);
|
|
1286
|
+
var L, v, U, W, X = typeof i;
|
|
1287
1287
|
if (u === "base64" && X == "string") for (i = (W = i).trim ? W.trim() : W.replace(/^\s+|\s+$/g, ""); i.length % 4 != 0; ) i += "=";
|
|
1288
1288
|
if (X == "number") L = se(i);
|
|
1289
|
-
else if (X == "string") L =
|
|
1289
|
+
else if (X == "string") L = w.byteLength(i, u);
|
|
1290
1290
|
else {
|
|
1291
1291
|
if (X != "object") throw new Error("First argument needs to be a number, array or string.");
|
|
1292
1292
|
L = se(i.length);
|
|
1293
1293
|
}
|
|
1294
|
-
if (
|
|
1295
|
-
else if (Q(W = i) ||
|
|
1294
|
+
if (w._useTypedArrays ? v = w._augment(new Uint8Array(L)) : ((v = this).length = L, v._isBuffer = !0), w._useTypedArrays && typeof i.byteLength == "number") v._set(i);
|
|
1295
|
+
else if (Q(W = i) || w.isBuffer(W) || W && typeof W == "object" && typeof W.length == "number") for (U = 0; U < L; U++) w.isBuffer(i) ? v[U] = i.readUInt8(U) : v[U] = i[U];
|
|
1296
1296
|
else if (X == "string") v.write(i, 0, u);
|
|
1297
|
-
else if (X == "number" && !
|
|
1297
|
+
else if (X == "number" && !w._useTypedArrays && !y) for (U = 0; U < L; U++) v[U] = 0;
|
|
1298
1298
|
return v;
|
|
1299
1299
|
}
|
|
1300
1300
|
function R(i, u, y, L) {
|
|
1301
|
-
return
|
|
1302
|
-
for (var
|
|
1303
|
-
return
|
|
1301
|
+
return w._charsWritten = Re((function(v) {
|
|
1302
|
+
for (var U = [], W = 0; W < v.length; W++) U.push(255 & v.charCodeAt(W));
|
|
1303
|
+
return U;
|
|
1304
1304
|
})(u), i, y, L);
|
|
1305
1305
|
}
|
|
1306
1306
|
function O(i, u, y, L) {
|
|
1307
|
-
return
|
|
1308
|
-
for (var
|
|
1307
|
+
return w._charsWritten = Re((function(v) {
|
|
1308
|
+
for (var U, W, X = [], ee = 0; ee < v.length; ee++) W = v.charCodeAt(ee), U = W >> 8, W = W % 256, X.push(W), X.push(U);
|
|
1309
1309
|
return X;
|
|
1310
1310
|
})(u), i, y, L);
|
|
1311
1311
|
}
|
|
@@ -1315,47 +1315,47 @@ Use "options.replacer" or "options.ignoreUnknown"
|
|
|
1315
1315
|
for (var v = u; v < y; v++) L += String.fromCharCode(i[v]);
|
|
1316
1316
|
return L;
|
|
1317
1317
|
}
|
|
1318
|
-
function b(i, u, y,
|
|
1319
|
-
|
|
1320
|
-
var v,
|
|
1321
|
-
if (!(
|
|
1318
|
+
function b(i, u, y, U) {
|
|
1319
|
+
U || (B(typeof y == "boolean", "missing or invalid endian"), B(u != null, "missing offset"), B(u + 1 < i.length, "Trying to read beyond buffer length"));
|
|
1320
|
+
var v, U = i.length;
|
|
1321
|
+
if (!(U <= u)) return y ? (v = i[u], u + 1 < U && (v |= i[u + 1] << 8)) : (v = i[u] << 8, u + 1 < U && (v |= i[u + 1])), v;
|
|
1322
1322
|
}
|
|
1323
|
-
function I(i, u, y,
|
|
1324
|
-
|
|
1325
|
-
var v,
|
|
1326
|
-
if (!(
|
|
1323
|
+
function I(i, u, y, U) {
|
|
1324
|
+
U || (B(typeof y == "boolean", "missing or invalid endian"), B(u != null, "missing offset"), B(u + 3 < i.length, "Trying to read beyond buffer length"));
|
|
1325
|
+
var v, U = i.length;
|
|
1326
|
+
if (!(U <= u)) return y ? (u + 2 < U && (v = i[u + 2] << 16), u + 1 < U && (v |= i[u + 1] << 8), v |= i[u], u + 3 < U && (v += i[u + 3] << 24 >>> 0)) : (u + 1 < U && (v = i[u + 1] << 16), u + 2 < U && (v |= i[u + 2] << 8), u + 3 < U && (v |= i[u + 3]), v += i[u] << 24 >>> 0), v;
|
|
1327
1327
|
}
|
|
1328
1328
|
function p(i, u, y, L) {
|
|
1329
|
-
if (L || (
|
|
1329
|
+
if (L || (B(typeof y == "boolean", "missing or invalid endian"), B(u != null, "missing offset"), B(u + 1 < i.length, "Trying to read beyond buffer length")), !(i.length <= u)) return L = b(i, u, y, !0), 32768 & L ? -1 * (65535 - L + 1) : L;
|
|
1330
1330
|
}
|
|
1331
1331
|
function m(i, u, y, L) {
|
|
1332
|
-
if (L || (
|
|
1332
|
+
if (L || (B(typeof y == "boolean", "missing or invalid endian"), B(u != null, "missing offset"), B(u + 3 < i.length, "Trying to read beyond buffer length")), !(i.length <= u)) return L = I(i, u, y, !0), 2147483648 & L ? -1 * (4294967295 - L + 1) : L;
|
|
1333
1333
|
}
|
|
1334
1334
|
function c(i, u, y, L) {
|
|
1335
|
-
return L || (
|
|
1335
|
+
return L || (B(typeof y == "boolean", "missing or invalid endian"), B(u + 3 < i.length, "Trying to read beyond buffer length")), C.read(i, u, y, 23, 4);
|
|
1336
1336
|
}
|
|
1337
1337
|
function l(i, u, y, L) {
|
|
1338
|
-
return L || (
|
|
1338
|
+
return L || (B(typeof y == "boolean", "missing or invalid endian"), B(u + 7 < i.length, "Trying to read beyond buffer length")), C.read(i, u, y, 52, 8);
|
|
1339
1339
|
}
|
|
1340
1340
|
function o(i, u, y, L, v) {
|
|
1341
|
-
if (v || (
|
|
1341
|
+
if (v || (B(u != null, "missing value"), B(typeof L == "boolean", "missing or invalid endian"), B(y != null, "missing offset"), B(y + 1 < i.length, "trying to write beyond buffer length"), He(u, 65535)), v = i.length, !(v <= y)) for (var U = 0, W = Math.min(v - y, 2); U < W; U++) i[y + U] = (u & 255 << 8 * (L ? U : 1 - U)) >>> 8 * (L ? U : 1 - U);
|
|
1342
1342
|
}
|
|
1343
1343
|
function g(i, u, y, L, v) {
|
|
1344
|
-
if (v || (
|
|
1344
|
+
if (v || (B(u != null, "missing value"), B(typeof L == "boolean", "missing or invalid endian"), B(y != null, "missing offset"), B(y + 3 < i.length, "trying to write beyond buffer length"), He(u, 4294967295)), v = i.length, !(v <= y)) for (var U = 0, W = Math.min(v - y, 4); U < W; U++) i[y + U] = u >>> 8 * (L ? U : 3 - U) & 255;
|
|
1345
1345
|
}
|
|
1346
|
-
function
|
|
1347
|
-
v || (
|
|
1346
|
+
function _(i, u, y, L, v) {
|
|
1347
|
+
v || (B(u != null, "missing value"), B(typeof L == "boolean", "missing or invalid endian"), B(y != null, "missing offset"), B(y + 1 < i.length, "Trying to write beyond buffer length"), Je(u, 32767, -32768)), i.length <= y || o(i, 0 <= u ? u : 65535 + u + 1, y, L, v);
|
|
1348
1348
|
}
|
|
1349
1349
|
function P(i, u, y, L, v) {
|
|
1350
|
-
v || (
|
|
1350
|
+
v || (B(u != null, "missing value"), B(typeof L == "boolean", "missing or invalid endian"), B(y != null, "missing offset"), B(y + 3 < i.length, "Trying to write beyond buffer length"), Je(u, 2147483647, -2147483648)), i.length <= y || g(i, 0 <= u ? u : 4294967295 + u + 1, y, L, v);
|
|
1351
1351
|
}
|
|
1352
1352
|
function j(i, u, y, L, v) {
|
|
1353
|
-
v || (
|
|
1353
|
+
v || (B(u != null, "missing value"), B(typeof L == "boolean", "missing or invalid endian"), B(y != null, "missing offset"), B(y + 3 < i.length, "Trying to write beyond buffer length"), At(u, 34028234663852886e22, -34028234663852886e22)), i.length <= y || C.write(i, u, y, L, 23, 4);
|
|
1354
1354
|
}
|
|
1355
1355
|
function F(i, u, y, L, v) {
|
|
1356
|
-
v || (
|
|
1356
|
+
v || (B(u != null, "missing value"), B(typeof L == "boolean", "missing or invalid endian"), B(y != null, "missing offset"), B(y + 7 < i.length, "Trying to write beyond buffer length"), At(u, 17976931348623157e292, -17976931348623157e292)), i.length <= y || C.write(i, u, y, L, 52, 8);
|
|
1357
1357
|
}
|
|
1358
|
-
r.Buffer =
|
|
1358
|
+
r.Buffer = w, r.SlowBuffer = w, r.INSPECT_MAX_BYTES = 50, w.poolSize = 8192, w._useTypedArrays = (function() {
|
|
1359
1359
|
try {
|
|
1360
1360
|
var i = new ArrayBuffer(0), u = new Uint8Array(i);
|
|
1361
1361
|
return u.foo = function() {
|
|
@@ -1364,7 +1364,7 @@ Use "options.replacer" or "options.ignoreUnknown"
|
|
|
1364
1364
|
} catch {
|
|
1365
1365
|
return !1;
|
|
1366
1366
|
}
|
|
1367
|
-
})(),
|
|
1367
|
+
})(), w.isEncoding = function(i) {
|
|
1368
1368
|
switch (String(i).toLowerCase()) {
|
|
1369
1369
|
case "hex":
|
|
1370
1370
|
case "utf8":
|
|
@@ -1381,9 +1381,9 @@ Use "options.replacer" or "options.ignoreUnknown"
|
|
|
1381
1381
|
default:
|
|
1382
1382
|
return !1;
|
|
1383
1383
|
}
|
|
1384
|
-
},
|
|
1384
|
+
}, w.isBuffer = function(i) {
|
|
1385
1385
|
return !(i == null || !i._isBuffer);
|
|
1386
|
-
},
|
|
1386
|
+
}, w.byteLength = function(i, u) {
|
|
1387
1387
|
var y;
|
|
1388
1388
|
switch (i += "", u || "utf8") {
|
|
1389
1389
|
case "hex":
|
|
@@ -1411,42 +1411,42 @@ Use "options.replacer" or "options.ignoreUnknown"
|
|
|
1411
1411
|
throw new Error("Unknown encoding");
|
|
1412
1412
|
}
|
|
1413
1413
|
return y;
|
|
1414
|
-
},
|
|
1415
|
-
if (
|
|
1416
|
-
list should be an Array.`), i.length === 0) return new
|
|
1414
|
+
}, w.concat = function(i, u) {
|
|
1415
|
+
if (B(Q(i), `Usage: Buffer.concat(list, [totalLength])
|
|
1416
|
+
list should be an Array.`), i.length === 0) return new w(0);
|
|
1417
1417
|
if (i.length === 1) return i[0];
|
|
1418
1418
|
if (typeof u != "number") for (v = u = 0; v < i.length; v++) u += i[v].length;
|
|
1419
|
-
for (var y = new
|
|
1420
|
-
var
|
|
1421
|
-
|
|
1419
|
+
for (var y = new w(u), L = 0, v = 0; v < i.length; v++) {
|
|
1420
|
+
var U = i[v];
|
|
1421
|
+
U.copy(y, L), L += U.length;
|
|
1422
1422
|
}
|
|
1423
1423
|
return y;
|
|
1424
|
-
},
|
|
1424
|
+
}, w.prototype.write = function(i, u, y, L) {
|
|
1425
1425
|
isFinite(u) ? isFinite(y) || (L = y, y = void 0) : (ee = L, L = u, u = y, y = ee), u = Number(u) || 0;
|
|
1426
|
-
var v,
|
|
1426
|
+
var v, U, W, X, ee = this.length - u;
|
|
1427
1427
|
switch ((!y || ee < (y = Number(y))) && (y = ee), L = String(L || "utf8").toLowerCase()) {
|
|
1428
1428
|
case "hex":
|
|
1429
1429
|
v = (function(ye, le, ue, te) {
|
|
1430
1430
|
ue = Number(ue) || 0;
|
|
1431
1431
|
var z = ye.length - ue;
|
|
1432
|
-
(!te || z < (te = Number(te))) && (te = z),
|
|
1432
|
+
(!te || z < (te = Number(te))) && (te = z), B((z = le.length) % 2 == 0, "Invalid hex string"), z / 2 < te && (te = z / 2);
|
|
1433
1433
|
for (var Te = 0; Te < te; Te++) {
|
|
1434
1434
|
var It = parseInt(le.substr(2 * Te, 2), 16);
|
|
1435
|
-
|
|
1435
|
+
B(!isNaN(It), "Invalid hex string"), ye[ue + Te] = It;
|
|
1436
1436
|
}
|
|
1437
|
-
return
|
|
1437
|
+
return w._charsWritten = 2 * Te, Te;
|
|
1438
1438
|
})(this, i, u, y);
|
|
1439
1439
|
break;
|
|
1440
1440
|
case "utf8":
|
|
1441
1441
|
case "utf-8":
|
|
1442
|
-
|
|
1442
|
+
U = this, W = u, X = y, v = w._charsWritten = Re(me(i), U, W, X);
|
|
1443
1443
|
break;
|
|
1444
1444
|
case "ascii":
|
|
1445
1445
|
case "binary":
|
|
1446
1446
|
v = R(this, i, u, y);
|
|
1447
1447
|
break;
|
|
1448
1448
|
case "base64":
|
|
1449
|
-
|
|
1449
|
+
U = this, W = u, X = y, v = w._charsWritten = Re(bt(i), U, W, X);
|
|
1450
1450
|
break;
|
|
1451
1451
|
case "ucs2":
|
|
1452
1452
|
case "ucs-2":
|
|
@@ -1458,8 +1458,8 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1458
1458
|
throw new Error("Unknown encoding");
|
|
1459
1459
|
}
|
|
1460
1460
|
return v;
|
|
1461
|
-
},
|
|
1462
|
-
var L, v,
|
|
1461
|
+
}, w.prototype.toString = function(i, u, y) {
|
|
1462
|
+
var L, v, U, W, X = this;
|
|
1463
1463
|
if (i = String(i || "utf8").toLowerCase(), u = Number(u) || 0, (y = y !== void 0 ? Number(y) : X.length) === u) return "";
|
|
1464
1464
|
switch (i) {
|
|
1465
1465
|
case "hex":
|
|
@@ -1484,7 +1484,7 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1484
1484
|
L = A(X, u, y);
|
|
1485
1485
|
break;
|
|
1486
1486
|
case "base64":
|
|
1487
|
-
v = X, W = y, L = (
|
|
1487
|
+
v = X, W = y, L = (U = u) === 0 && W === v.length ? S.fromByteArray(v) : S.fromByteArray(v.slice(U, W));
|
|
1488
1488
|
break;
|
|
1489
1489
|
case "ucs2":
|
|
1490
1490
|
case "ucs-2":
|
|
@@ -1499,98 +1499,98 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1499
1499
|
throw new Error("Unknown encoding");
|
|
1500
1500
|
}
|
|
1501
1501
|
return L;
|
|
1502
|
-
},
|
|
1502
|
+
}, w.prototype.toJSON = function() {
|
|
1503
1503
|
return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) };
|
|
1504
|
-
},
|
|
1504
|
+
}, w.prototype.copy = function(i, u, y, L) {
|
|
1505
1505
|
if (u = u || 0, (L = L || L === 0 ? L : this.length) !== (y = y || 0) && i.length !== 0 && this.length !== 0) {
|
|
1506
|
-
|
|
1506
|
+
B(y <= L, "sourceEnd < sourceStart"), B(0 <= u && u < i.length, "targetStart out of bounds"), B(0 <= y && y < this.length, "sourceStart out of bounds"), B(0 <= L && L <= this.length, "sourceEnd out of bounds"), L > this.length && (L = this.length);
|
|
1507
1507
|
var v = (L = i.length - u < L - y ? i.length - u + y : L) - y;
|
|
1508
|
-
if (v < 100 || !
|
|
1508
|
+
if (v < 100 || !w._useTypedArrays) for (var U = 0; U < v; U++) i[U + u] = this[U + y];
|
|
1509
1509
|
else i._set(this.subarray(y, y + v), u);
|
|
1510
1510
|
}
|
|
1511
|
-
},
|
|
1511
|
+
}, w.prototype.slice = function(i, u) {
|
|
1512
1512
|
var y = this.length;
|
|
1513
|
-
if (i = H(i, y, 0), u = H(u, y, y),
|
|
1514
|
-
for (var L = u - i, v = new
|
|
1513
|
+
if (i = H(i, y, 0), u = H(u, y, y), w._useTypedArrays) return w._augment(this.subarray(i, u));
|
|
1514
|
+
for (var L = u - i, v = new w(L, void 0, !0), U = 0; U < L; U++) v[U] = this[U + i];
|
|
1515
1515
|
return v;
|
|
1516
|
-
},
|
|
1516
|
+
}, w.prototype.get = function(i) {
|
|
1517
1517
|
return console.log(".get() is deprecated. Access using array indexes instead."), this.readUInt8(i);
|
|
1518
|
-
},
|
|
1518
|
+
}, w.prototype.set = function(i, u) {
|
|
1519
1519
|
return console.log(".set() is deprecated. Access using array indexes instead."), this.writeUInt8(i, u);
|
|
1520
|
-
},
|
|
1521
|
-
if (u || (
|
|
1522
|
-
},
|
|
1520
|
+
}, w.prototype.readUInt8 = function(i, u) {
|
|
1521
|
+
if (u || (B(i != null, "missing offset"), B(i < this.length, "Trying to read beyond buffer length")), !(i >= this.length)) return this[i];
|
|
1522
|
+
}, w.prototype.readUInt16LE = function(i, u) {
|
|
1523
1523
|
return b(this, i, !0, u);
|
|
1524
|
-
},
|
|
1524
|
+
}, w.prototype.readUInt16BE = function(i, u) {
|
|
1525
1525
|
return b(this, i, !1, u);
|
|
1526
|
-
},
|
|
1526
|
+
}, w.prototype.readUInt32LE = function(i, u) {
|
|
1527
1527
|
return I(this, i, !0, u);
|
|
1528
|
-
},
|
|
1528
|
+
}, w.prototype.readUInt32BE = function(i, u) {
|
|
1529
1529
|
return I(this, i, !1, u);
|
|
1530
|
-
},
|
|
1531
|
-
if (u || (
|
|
1532
|
-
},
|
|
1530
|
+
}, w.prototype.readInt8 = function(i, u) {
|
|
1531
|
+
if (u || (B(i != null, "missing offset"), B(i < this.length, "Trying to read beyond buffer length")), !(i >= this.length)) return 128 & this[i] ? -1 * (255 - this[i] + 1) : this[i];
|
|
1532
|
+
}, w.prototype.readInt16LE = function(i, u) {
|
|
1533
1533
|
return p(this, i, !0, u);
|
|
1534
|
-
},
|
|
1534
|
+
}, w.prototype.readInt16BE = function(i, u) {
|
|
1535
1535
|
return p(this, i, !1, u);
|
|
1536
|
-
},
|
|
1536
|
+
}, w.prototype.readInt32LE = function(i, u) {
|
|
1537
1537
|
return m(this, i, !0, u);
|
|
1538
|
-
},
|
|
1538
|
+
}, w.prototype.readInt32BE = function(i, u) {
|
|
1539
1539
|
return m(this, i, !1, u);
|
|
1540
|
-
},
|
|
1540
|
+
}, w.prototype.readFloatLE = function(i, u) {
|
|
1541
1541
|
return c(this, i, !0, u);
|
|
1542
|
-
},
|
|
1542
|
+
}, w.prototype.readFloatBE = function(i, u) {
|
|
1543
1543
|
return c(this, i, !1, u);
|
|
1544
|
-
},
|
|
1544
|
+
}, w.prototype.readDoubleLE = function(i, u) {
|
|
1545
1545
|
return l(this, i, !0, u);
|
|
1546
|
-
},
|
|
1546
|
+
}, w.prototype.readDoubleBE = function(i, u) {
|
|
1547
1547
|
return l(this, i, !1, u);
|
|
1548
|
-
},
|
|
1549
|
-
y || (
|
|
1550
|
-
},
|
|
1548
|
+
}, w.prototype.writeUInt8 = function(i, u, y) {
|
|
1549
|
+
y || (B(i != null, "missing value"), B(u != null, "missing offset"), B(u < this.length, "trying to write beyond buffer length"), He(i, 255)), u >= this.length || (this[u] = i);
|
|
1550
|
+
}, w.prototype.writeUInt16LE = function(i, u, y) {
|
|
1551
1551
|
o(this, i, u, !0, y);
|
|
1552
|
-
},
|
|
1552
|
+
}, w.prototype.writeUInt16BE = function(i, u, y) {
|
|
1553
1553
|
o(this, i, u, !1, y);
|
|
1554
|
-
},
|
|
1554
|
+
}, w.prototype.writeUInt32LE = function(i, u, y) {
|
|
1555
1555
|
g(this, i, u, !0, y);
|
|
1556
|
-
},
|
|
1556
|
+
}, w.prototype.writeUInt32BE = function(i, u, y) {
|
|
1557
1557
|
g(this, i, u, !1, y);
|
|
1558
|
-
},
|
|
1559
|
-
y || (
|
|
1560
|
-
},
|
|
1561
|
-
|
|
1562
|
-
},
|
|
1563
|
-
|
|
1564
|
-
},
|
|
1558
|
+
}, w.prototype.writeInt8 = function(i, u, y) {
|
|
1559
|
+
y || (B(i != null, "missing value"), B(u != null, "missing offset"), B(u < this.length, "Trying to write beyond buffer length"), Je(i, 127, -128)), u >= this.length || (0 <= i ? this.writeUInt8(i, u, y) : this.writeUInt8(255 + i + 1, u, y));
|
|
1560
|
+
}, w.prototype.writeInt16LE = function(i, u, y) {
|
|
1561
|
+
_(this, i, u, !0, y);
|
|
1562
|
+
}, w.prototype.writeInt16BE = function(i, u, y) {
|
|
1563
|
+
_(this, i, u, !1, y);
|
|
1564
|
+
}, w.prototype.writeInt32LE = function(i, u, y) {
|
|
1565
1565
|
P(this, i, u, !0, y);
|
|
1566
|
-
},
|
|
1566
|
+
}, w.prototype.writeInt32BE = function(i, u, y) {
|
|
1567
1567
|
P(this, i, u, !1, y);
|
|
1568
|
-
},
|
|
1568
|
+
}, w.prototype.writeFloatLE = function(i, u, y) {
|
|
1569
1569
|
j(this, i, u, !0, y);
|
|
1570
|
-
},
|
|
1570
|
+
}, w.prototype.writeFloatBE = function(i, u, y) {
|
|
1571
1571
|
j(this, i, u, !1, y);
|
|
1572
|
-
},
|
|
1572
|
+
}, w.prototype.writeDoubleLE = function(i, u, y) {
|
|
1573
1573
|
F(this, i, u, !0, y);
|
|
1574
|
-
},
|
|
1574
|
+
}, w.prototype.writeDoubleBE = function(i, u, y) {
|
|
1575
1575
|
F(this, i, u, !1, y);
|
|
1576
|
-
},
|
|
1577
|
-
if (u = u || 0, y = y || this.length,
|
|
1578
|
-
|
|
1576
|
+
}, w.prototype.fill = function(i, u, y) {
|
|
1577
|
+
if (u = u || 0, y = y || this.length, B(typeof (i = typeof (i = i || 0) == "string" ? i.charCodeAt(0) : i) == "number" && !isNaN(i), "value is not a number"), B(u <= y, "end < start"), y !== u && this.length !== 0) {
|
|
1578
|
+
B(0 <= u && u < this.length, "start out of bounds"), B(0 <= y && y <= this.length, "end out of bounds");
|
|
1579
1579
|
for (var L = u; L < y; L++) this[L] = i;
|
|
1580
1580
|
}
|
|
1581
|
-
},
|
|
1581
|
+
}, w.prototype.inspect = function() {
|
|
1582
1582
|
for (var i = [], u = this.length, y = 0; y < u; y++) if (i[y] = V(this[y]), y === r.INSPECT_MAX_BYTES) {
|
|
1583
1583
|
i[y + 1] = "...";
|
|
1584
1584
|
break;
|
|
1585
1585
|
}
|
|
1586
1586
|
return "<Buffer " + i.join(" ") + ">";
|
|
1587
|
-
},
|
|
1587
|
+
}, w.prototype.toArrayBuffer = function() {
|
|
1588
1588
|
if (typeof Uint8Array > "u") throw new Error("Buffer.toArrayBuffer not supported in this browser");
|
|
1589
|
-
if (
|
|
1589
|
+
if (w._useTypedArrays) return new w(this).buffer;
|
|
1590
1590
|
for (var i = new Uint8Array(this.length), u = 0, y = i.length; u < y; u += 1) i[u] = this[u];
|
|
1591
1591
|
return i.buffer;
|
|
1592
1592
|
};
|
|
1593
|
-
var q =
|
|
1593
|
+
var q = w.prototype;
|
|
1594
1594
|
function H(i, u, y) {
|
|
1595
1595
|
return typeof i != "number" ? y : u <= (i = ~~i) ? u : 0 <= i || 0 <= (i += u) ? i : 0;
|
|
1596
1596
|
}
|
|
@@ -1609,7 +1609,7 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1609
1609
|
for (var u = [], y = 0; y < i.length; y++) {
|
|
1610
1610
|
var L = i.charCodeAt(y);
|
|
1611
1611
|
if (L <= 127) u.push(i.charCodeAt(y));
|
|
1612
|
-
else for (var v = y,
|
|
1612
|
+
else for (var v = y, U = (55296 <= L && L <= 57343 && y++, encodeURIComponent(i.slice(v, y + 1)).substr(1).split("%")), W = 0; W < U.length; W++) u.push(parseInt(U[W], 16));
|
|
1613
1613
|
}
|
|
1614
1614
|
return u;
|
|
1615
1615
|
}
|
|
@@ -1628,28 +1628,28 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1628
1628
|
}
|
|
1629
1629
|
}
|
|
1630
1630
|
function He(i, u) {
|
|
1631
|
-
|
|
1631
|
+
B(typeof i == "number", "cannot write a non-number as a number"), B(0 <= i, "specified a negative value for writing an unsigned value"), B(i <= u, "value is larger than maximum value for type"), B(Math.floor(i) === i, "value has a fractional component");
|
|
1632
1632
|
}
|
|
1633
1633
|
function Je(i, u, y) {
|
|
1634
|
-
|
|
1634
|
+
B(typeof i == "number", "cannot write a non-number as a number"), B(i <= u, "value larger than maximum allowed value"), B(y <= i, "value smaller than minimum allowed value"), B(Math.floor(i) === i, "value has a fractional component");
|
|
1635
1635
|
}
|
|
1636
1636
|
function At(i, u, y) {
|
|
1637
|
-
|
|
1637
|
+
B(typeof i == "number", "cannot write a non-number as a number"), B(i <= u, "value larger than maximum allowed value"), B(y <= i, "value smaller than minimum allowed value");
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function B(i, u) {
|
|
1640
1640
|
if (!i) throw new Error(u || "Failed assertion");
|
|
1641
1641
|
}
|
|
1642
|
-
|
|
1642
|
+
w._augment = function(i) {
|
|
1643
1643
|
return i._isBuffer = !0, i._get = i.get, i._set = i.set, i.get = q.get, i.set = q.set, i.write = q.write, i.toString = q.toString, i.toLocaleString = q.toString, i.toJSON = q.toJSON, i.copy = q.copy, i.slice = q.slice, i.readUInt8 = q.readUInt8, i.readUInt16LE = q.readUInt16LE, i.readUInt16BE = q.readUInt16BE, i.readUInt32LE = q.readUInt32LE, i.readUInt32BE = q.readUInt32BE, i.readInt8 = q.readInt8, i.readInt16LE = q.readInt16LE, i.readInt16BE = q.readInt16BE, i.readInt32LE = q.readInt32LE, i.readInt32BE = q.readInt32BE, i.readFloatLE = q.readFloatLE, i.readFloatBE = q.readFloatBE, i.readDoubleLE = q.readDoubleLE, i.readDoubleBE = q.readDoubleBE, i.writeUInt8 = q.writeUInt8, i.writeUInt16LE = q.writeUInt16LE, i.writeUInt16BE = q.writeUInt16BE, i.writeUInt32LE = q.writeUInt32LE, i.writeUInt32BE = q.writeUInt32BE, i.writeInt8 = q.writeInt8, i.writeInt16LE = q.writeInt16LE, i.writeInt16BE = q.writeInt16BE, i.writeInt32LE = q.writeInt32LE, i.writeInt32BE = q.writeInt32BE, i.writeFloatLE = q.writeFloatLE, i.writeFloatBE = q.writeFloatBE, i.writeDoubleLE = q.writeDoubleLE, i.writeDoubleBE = q.writeDoubleBE, i.fill = q.fill, i.inspect = q.inspect, i.toArrayBuffer = q.toArrayBuffer, i;
|
|
1644
1644
|
};
|
|
1645
1645
|
}).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/buffer/index.js", "/node_modules/gulp-browserify/node_modules/buffer");
|
|
1646
1646
|
}, { "base64-js": 2, buffer: 3, ieee754: 10, lYpoI2: 11 }], 4: [function(n, s, r) {
|
|
1647
1647
|
(function(a, f, S, h, E, $, N, D, M) {
|
|
1648
|
-
var S = n("buffer").Buffer, C = 4,
|
|
1649
|
-
|
|
1648
|
+
var S = n("buffer").Buffer, C = 4, w = new S(C);
|
|
1649
|
+
w.fill(0), s.exports = { hash: function(R, O, A, b) {
|
|
1650
1650
|
for (var I = O((function(o, g) {
|
|
1651
|
-
o.length % C != 0 && (
|
|
1652
|
-
for (var
|
|
1651
|
+
o.length % C != 0 && (_ = o.length + (C - o.length % C), o = S.concat([o, w], _));
|
|
1652
|
+
for (var _, P = [], j = g ? o.readInt32BE : o.readInt32LE, F = 0; F < o.length; F += C) P.push(j.call(o, F));
|
|
1653
1653
|
return P;
|
|
1654
1654
|
})(R = S.isBuffer(R) ? R : new S(R), b), 8 * R.length), O = b, p = new S(A), m = O ? p.writeInt32BE : p.writeInt32LE, c = 0; c < I.length; c++) m.call(p, I[c], 4 * c, !0);
|
|
1655
1655
|
return p;
|
|
@@ -1657,17 +1657,17 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1657
1657
|
}).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
|
|
1658
1658
|
}, { buffer: 3, lYpoI2: 11 }], 5: [function(n, s, r) {
|
|
1659
1659
|
(function(a, f, S, h, E, $, N, D, M) {
|
|
1660
|
-
var S = n("buffer").Buffer, C = n("./sha"),
|
|
1660
|
+
var S = n("buffer").Buffer, C = n("./sha"), w = n("./sha256"), R = n("./rng"), O = { sha1: C, sha256: w, md5: n("./md5") }, A = 64, b = new S(A);
|
|
1661
1661
|
function I(o, g) {
|
|
1662
|
-
var
|
|
1663
|
-
return
|
|
1662
|
+
var _ = O[o = o || "sha1"], P = [];
|
|
1663
|
+
return _ || p("algorithm:", o, "is not yet supported"), { update: function(j) {
|
|
1664
1664
|
return S.isBuffer(j) || (j = new S(j)), P.push(j), j.length, this;
|
|
1665
1665
|
}, digest: function(j) {
|
|
1666
1666
|
var F = S.concat(P), F = g ? (function(q, H, se) {
|
|
1667
1667
|
S.isBuffer(H) || (H = new S(H)), S.isBuffer(se) || (se = new S(se)), H.length > A ? H = q(H) : H.length < A && (H = S.concat([H, b], A));
|
|
1668
1668
|
for (var Q = new S(A), V = new S(A), me = 0; me < A; me++) Q[me] = 54 ^ H[me], V[me] = 92 ^ H[me];
|
|
1669
1669
|
return se = q(S.concat([Q, se])), q(S.concat([V, se]));
|
|
1670
|
-
})(
|
|
1670
|
+
})(_, g, F) : _(F);
|
|
1671
1671
|
return P = null, j ? F.toString(j) : F;
|
|
1672
1672
|
} };
|
|
1673
1673
|
}
|
|
@@ -1682,8 +1682,8 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1682
1682
|
if (!g || !g.call) return new S(R(o));
|
|
1683
1683
|
try {
|
|
1684
1684
|
g.call(this, void 0, new S(R(o)));
|
|
1685
|
-
} catch (
|
|
1686
|
-
g(
|
|
1685
|
+
} catch (_) {
|
|
1686
|
+
g(_);
|
|
1687
1687
|
}
|
|
1688
1688
|
};
|
|
1689
1689
|
var m, c = ["createCredentials", "createCipher", "createCipheriv", "createDecipher", "createDecipheriv", "createSign", "createVerify", "createDiffieHellman", "pbkdf2"], l = function(o) {
|
|
@@ -1698,26 +1698,26 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1698
1698
|
var S = n("./helpers");
|
|
1699
1699
|
function C(p, m) {
|
|
1700
1700
|
p[m >> 5] |= 128 << m % 32, p[14 + (m + 64 >>> 9 << 4)] = m;
|
|
1701
|
-
for (var c = 1732584193, l = -271733879, o = -1732584194, g = 271733878,
|
|
1702
|
-
var P = c, j = l, F = o, q = g, c = R(c, l, o, g, p[
|
|
1703
|
-
c = R(c, l, o, g, p[
|
|
1701
|
+
for (var c = 1732584193, l = -271733879, o = -1732584194, g = 271733878, _ = 0; _ < p.length; _ += 16) {
|
|
1702
|
+
var P = c, j = l, F = o, q = g, c = R(c, l, o, g, p[_ + 0], 7, -680876936), g = R(g, c, l, o, p[_ + 1], 12, -389564586), o = R(o, g, c, l, p[_ + 2], 17, 606105819), l = R(l, o, g, c, p[_ + 3], 22, -1044525330);
|
|
1703
|
+
c = R(c, l, o, g, p[_ + 4], 7, -176418897), g = R(g, c, l, o, p[_ + 5], 12, 1200080426), o = R(o, g, c, l, p[_ + 6], 17, -1473231341), l = R(l, o, g, c, p[_ + 7], 22, -45705983), c = R(c, l, o, g, p[_ + 8], 7, 1770035416), g = R(g, c, l, o, p[_ + 9], 12, -1958414417), o = R(o, g, c, l, p[_ + 10], 17, -42063), l = R(l, o, g, c, p[_ + 11], 22, -1990404162), c = R(c, l, o, g, p[_ + 12], 7, 1804603682), g = R(g, c, l, o, p[_ + 13], 12, -40341101), o = R(o, g, c, l, p[_ + 14], 17, -1502002290), c = O(c, l = R(l, o, g, c, p[_ + 15], 22, 1236535329), o, g, p[_ + 1], 5, -165796510), g = O(g, c, l, o, p[_ + 6], 9, -1069501632), o = O(o, g, c, l, p[_ + 11], 14, 643717713), l = O(l, o, g, c, p[_ + 0], 20, -373897302), c = O(c, l, o, g, p[_ + 5], 5, -701558691), g = O(g, c, l, o, p[_ + 10], 9, 38016083), o = O(o, g, c, l, p[_ + 15], 14, -660478335), l = O(l, o, g, c, p[_ + 4], 20, -405537848), c = O(c, l, o, g, p[_ + 9], 5, 568446438), g = O(g, c, l, o, p[_ + 14], 9, -1019803690), o = O(o, g, c, l, p[_ + 3], 14, -187363961), l = O(l, o, g, c, p[_ + 8], 20, 1163531501), c = O(c, l, o, g, p[_ + 13], 5, -1444681467), g = O(g, c, l, o, p[_ + 2], 9, -51403784), o = O(o, g, c, l, p[_ + 7], 14, 1735328473), c = A(c, l = O(l, o, g, c, p[_ + 12], 20, -1926607734), o, g, p[_ + 5], 4, -378558), g = A(g, c, l, o, p[_ + 8], 11, -2022574463), o = A(o, g, c, l, p[_ + 11], 16, 1839030562), l = A(l, o, g, c, p[_ + 14], 23, -35309556), c = A(c, l, o, g, p[_ + 1], 4, -1530992060), g = A(g, c, l, o, p[_ + 4], 11, 1272893353), o = A(o, g, c, l, p[_ + 7], 16, -155497632), l = A(l, o, g, c, p[_ + 10], 23, -1094730640), c = A(c, l, o, g, p[_ + 13], 4, 681279174), g = A(g, c, l, o, p[_ + 0], 11, -358537222), o = A(o, g, c, l, p[_ + 3], 16, -722521979), l = A(l, o, g, c, p[_ + 6], 23, 76029189), c = A(c, l, o, g, p[_ + 9], 4, -640364487), g = A(g, c, l, o, p[_ + 12], 11, -421815835), o = A(o, g, c, l, p[_ + 15], 16, 530742520), c = b(c, l = A(l, o, g, c, p[_ + 2], 23, -995338651), o, g, p[_ + 0], 6, -198630844), g = b(g, c, l, o, p[_ + 7], 10, 1126891415), o = b(o, g, c, l, p[_ + 14], 15, -1416354905), l = b(l, o, g, c, p[_ + 5], 21, -57434055), c = b(c, l, o, g, p[_ + 12], 6, 1700485571), g = b(g, c, l, o, p[_ + 3], 10, -1894986606), o = b(o, g, c, l, p[_ + 10], 15, -1051523), l = b(l, o, g, c, p[_ + 1], 21, -2054922799), c = b(c, l, o, g, p[_ + 8], 6, 1873313359), g = b(g, c, l, o, p[_ + 15], 10, -30611744), o = b(o, g, c, l, p[_ + 6], 15, -1560198380), l = b(l, o, g, c, p[_ + 13], 21, 1309151649), c = b(c, l, o, g, p[_ + 4], 6, -145523070), g = b(g, c, l, o, p[_ + 11], 10, -1120210379), o = b(o, g, c, l, p[_ + 2], 15, 718787259), l = b(l, o, g, c, p[_ + 9], 21, -343485551), c = I(c, P), l = I(l, j), o = I(o, F), g = I(g, q);
|
|
1704
1704
|
}
|
|
1705
1705
|
return Array(c, l, o, g);
|
|
1706
1706
|
}
|
|
1707
|
-
function
|
|
1707
|
+
function w(p, m, c, l, o, g) {
|
|
1708
1708
|
return I((m = I(I(m, p), I(l, g))) << o | m >>> 32 - o, c);
|
|
1709
1709
|
}
|
|
1710
|
-
function R(p, m, c, l, o, g,
|
|
1711
|
-
return
|
|
1710
|
+
function R(p, m, c, l, o, g, _) {
|
|
1711
|
+
return w(m & c | ~m & l, p, m, o, g, _);
|
|
1712
1712
|
}
|
|
1713
|
-
function O(p, m, c, l, o, g,
|
|
1714
|
-
return
|
|
1713
|
+
function O(p, m, c, l, o, g, _) {
|
|
1714
|
+
return w(m & l | c & ~l, p, m, o, g, _);
|
|
1715
1715
|
}
|
|
1716
|
-
function A(p, m, c, l, o, g,
|
|
1717
|
-
return
|
|
1716
|
+
function A(p, m, c, l, o, g, _) {
|
|
1717
|
+
return w(m ^ c ^ l, p, m, o, g, _);
|
|
1718
1718
|
}
|
|
1719
|
-
function b(p, m, c, l, o, g,
|
|
1720
|
-
return
|
|
1719
|
+
function b(p, m, c, l, o, g, _) {
|
|
1720
|
+
return w(c ^ (m | ~l), p, m, o, g, _);
|
|
1721
1721
|
}
|
|
1722
1722
|
function I(p, m) {
|
|
1723
1723
|
var c = (65535 & p) + (65535 & m);
|
|
@@ -1730,8 +1730,8 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1730
1730
|
}, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 7: [function(n, s, r) {
|
|
1731
1731
|
(function(a, f, d, h, E, $, N, D, M) {
|
|
1732
1732
|
s.exports = function(S) {
|
|
1733
|
-
for (var C,
|
|
1734
|
-
return
|
|
1733
|
+
for (var C, w = new Array(S), R = 0; R < S; R++) (3 & R) == 0 && (C = 4294967296 * Math.random()), w[R] = C >>> ((3 & R) << 3) & 255;
|
|
1734
|
+
return w;
|
|
1735
1735
|
};
|
|
1736
1736
|
}).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
|
|
1737
1737
|
}, { buffer: 3, lYpoI2: 11 }], 8: [function(n, s, r) {
|
|
@@ -1739,16 +1739,16 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1739
1739
|
var S = n("./helpers");
|
|
1740
1740
|
function C(O, A) {
|
|
1741
1741
|
O[A >> 5] |= 128 << 24 - A % 32, O[15 + (A + 64 >> 9 << 4)] = A;
|
|
1742
|
-
for (var b, I, p, m = Array(80), c = 1732584193, l = -271733879, o = -1732584194, g = 271733878,
|
|
1743
|
-
for (var j = c, F = l, q = o, H = g, se =
|
|
1742
|
+
for (var b, I, p, m = Array(80), c = 1732584193, l = -271733879, o = -1732584194, g = 271733878, _ = -1009589776, P = 0; P < O.length; P += 16) {
|
|
1743
|
+
for (var j = c, F = l, q = o, H = g, se = _, Q = 0; Q < 80; Q++) {
|
|
1744
1744
|
m[Q] = Q < 16 ? O[P + Q] : R(m[Q - 3] ^ m[Q - 8] ^ m[Q - 14] ^ m[Q - 16], 1);
|
|
1745
|
-
var V =
|
|
1745
|
+
var V = w(w(R(c, 5), (V = l, I = o, p = g, (b = Q) < 20 ? V & I | ~V & p : !(b < 40) && b < 60 ? V & I | V & p | I & p : V ^ I ^ p)), w(w(_, m[Q]), (b = Q) < 20 ? 1518500249 : b < 40 ? 1859775393 : b < 60 ? -1894007588 : -899497514)), _ = g, g = o, o = R(l, 30), l = c, c = V;
|
|
1746
1746
|
}
|
|
1747
|
-
c =
|
|
1747
|
+
c = w(c, j), l = w(l, F), o = w(o, q), g = w(g, H), _ = w(_, se);
|
|
1748
1748
|
}
|
|
1749
|
-
return Array(c, l, o, g,
|
|
1749
|
+
return Array(c, l, o, g, _);
|
|
1750
1750
|
}
|
|
1751
|
-
function
|
|
1751
|
+
function w(O, A) {
|
|
1752
1752
|
var b = (65535 & O) + (65535 & A);
|
|
1753
1753
|
return (O >> 16) + (A >> 16) + (b >> 16) << 16 | 65535 & b;
|
|
1754
1754
|
}
|
|
@@ -1769,24 +1769,24 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1769
1769
|
var I, p = new Array(1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298), m = new Array(1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225), c = new Array(64);
|
|
1770
1770
|
A[b >> 5] |= 128 << 24 - b % 32, A[15 + (b + 64 >> 9 << 4)] = b;
|
|
1771
1771
|
for (var l, o, g = 0; g < A.length; g += 16) {
|
|
1772
|
-
for (var
|
|
1773
|
-
m[0] = S(
|
|
1772
|
+
for (var _ = m[0], P = m[1], j = m[2], F = m[3], q = m[4], H = m[5], se = m[6], Q = m[7], V = 0; V < 64; V++) c[V] = V < 16 ? A[V + g] : S(S(S((o = c[V - 2], R(o, 17) ^ R(o, 19) ^ O(o, 10)), c[V - 7]), (o = c[V - 15], R(o, 7) ^ R(o, 18) ^ O(o, 3))), c[V - 16]), I = S(S(S(S(Q, R(o = q, 6) ^ R(o, 11) ^ R(o, 25)), q & H ^ ~q & se), p[V]), c[V]), l = S(R(l = _, 2) ^ R(l, 13) ^ R(l, 22), _ & P ^ _ & j ^ P & j), Q = se, se = H, H = q, q = S(F, I), F = j, j = P, P = _, _ = S(I, l);
|
|
1773
|
+
m[0] = S(_, m[0]), m[1] = S(P, m[1]), m[2] = S(j, m[2]), m[3] = S(F, m[3]), m[4] = S(q, m[4]), m[5] = S(H, m[5]), m[6] = S(se, m[6]), m[7] = S(Q, m[7]);
|
|
1774
1774
|
}
|
|
1775
1775
|
return m;
|
|
1776
1776
|
}
|
|
1777
|
-
var
|
|
1777
|
+
var w = n("./helpers"), R = function(A, b) {
|
|
1778
1778
|
return A >>> b | A << 32 - b;
|
|
1779
1779
|
}, O = function(A, b) {
|
|
1780
1780
|
return A >>> b;
|
|
1781
1781
|
};
|
|
1782
1782
|
s.exports = function(A) {
|
|
1783
|
-
return
|
|
1783
|
+
return w.hash(A, C, 32, !0);
|
|
1784
1784
|
};
|
|
1785
1785
|
}).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
|
|
1786
1786
|
}, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 10: [function(n, s, r) {
|
|
1787
1787
|
(function(a, f, d, h, E, $, N, D, M) {
|
|
1788
|
-
r.read = function(S, C,
|
|
1789
|
-
var A, b, I = 8 * g - R - 1, p = (1 << I) - 1, m = p >> 1, c = -7, l =
|
|
1788
|
+
r.read = function(S, C, w, R, g) {
|
|
1789
|
+
var A, b, I = 8 * g - R - 1, p = (1 << I) - 1, m = p >> 1, c = -7, l = w ? g - 1 : 0, o = w ? -1 : 1, g = S[C + l];
|
|
1790
1790
|
for (l += o, A = g & (1 << -c) - 1, g >>= -c, c += I; 0 < c; A = 256 * A + S[C + l], l += o, c -= 8) ;
|
|
1791
1791
|
for (b = A & (1 << -c) - 1, A >>= -c, c += R; 0 < c; b = 256 * b + S[C + l], l += o, c -= 8) ;
|
|
1792
1792
|
if (A === 0) A = 1 - m;
|
|
@@ -1795,21 +1795,21 @@ list should be an Array.`), i.length === 0) return new _(0);
|
|
|
1795
1795
|
b += Math.pow(2, R), A -= m;
|
|
1796
1796
|
}
|
|
1797
1797
|
return (g ? -1 : 1) * b * Math.pow(2, A - R);
|
|
1798
|
-
}, r.write = function(S, C,
|
|
1799
|
-
var b, I, p = 8 *
|
|
1800
|
-
for (C = Math.abs(C), isNaN(C) || C === 1 / 0 ? (I = isNaN(C) ? 1 : 0, b = m) : (b = Math.floor(Math.log(C) / Math.LN2), C * (R = Math.pow(2, -b)) < 1 && (b--, R *= 2), 2 <= (C += 1 <= b + c ? l / R : l * Math.pow(2, 1 - c)) * R && (b++, R /= 2), m <= b + c ? (I = 0, b = m) : 1 <= b + c ? (I = (C * R - 1) * Math.pow(2, O), b += c) : (I = C * Math.pow(2, c - 1) * Math.pow(2, O), b = 0)); 8 <= O; S[
|
|
1801
|
-
for (b = b << O | I, p += O; 0 < p; S[
|
|
1802
|
-
S[
|
|
1798
|
+
}, r.write = function(S, C, w, R, O, _) {
|
|
1799
|
+
var b, I, p = 8 * _ - O - 1, m = (1 << p) - 1, c = m >> 1, l = O === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, o = R ? 0 : _ - 1, g = R ? 1 : -1, _ = C < 0 || C === 0 && 1 / C < 0 ? 1 : 0;
|
|
1800
|
+
for (C = Math.abs(C), isNaN(C) || C === 1 / 0 ? (I = isNaN(C) ? 1 : 0, b = m) : (b = Math.floor(Math.log(C) / Math.LN2), C * (R = Math.pow(2, -b)) < 1 && (b--, R *= 2), 2 <= (C += 1 <= b + c ? l / R : l * Math.pow(2, 1 - c)) * R && (b++, R /= 2), m <= b + c ? (I = 0, b = m) : 1 <= b + c ? (I = (C * R - 1) * Math.pow(2, O), b += c) : (I = C * Math.pow(2, c - 1) * Math.pow(2, O), b = 0)); 8 <= O; S[w + o] = 255 & I, o += g, I /= 256, O -= 8) ;
|
|
1801
|
+
for (b = b << O | I, p += O; 0 < p; S[w + o] = 255 & b, o += g, b /= 256, p -= 8) ;
|
|
1802
|
+
S[w + o - g] |= 128 * _;
|
|
1803
1803
|
};
|
|
1804
1804
|
}).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/ieee754/index.js", "/node_modules/gulp-browserify/node_modules/ieee754");
|
|
1805
1805
|
}, { buffer: 3, lYpoI2: 11 }], 11: [function(n, s, r) {
|
|
1806
1806
|
(function(a, f, d, h, E, $, N, D, M) {
|
|
1807
|
-
var S, C,
|
|
1807
|
+
var S, C, w;
|
|
1808
1808
|
function R() {
|
|
1809
1809
|
}
|
|
1810
|
-
(a = s.exports = {}).nextTick = (C = typeof window < "u" && window.setImmediate,
|
|
1810
|
+
(a = s.exports = {}).nextTick = (C = typeof window < "u" && window.setImmediate, w = typeof window < "u" && window.postMessage && window.addEventListener, C ? function(O) {
|
|
1811
1811
|
return window.setImmediate(O);
|
|
1812
|
-
} :
|
|
1812
|
+
} : w ? (S = [], window.addEventListener("message", function(O) {
|
|
1813
1813
|
var A = O.source;
|
|
1814
1814
|
A !== window && A !== null || O.data !== "process-tick" || (O.stopPropagation(), 0 < S.length && S.shift()());
|
|
1815
1815
|
}, !0), function(O) {
|
|
@@ -1832,7 +1832,7 @@ var ai = ii();
|
|
|
1832
1832
|
const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
1833
1833
|
const n = oe(e), s = t.map((r) => `'${r.id}'`).join(",");
|
|
1834
1834
|
return `DELETE FROM ${n} WHERE id IN (${s});`;
|
|
1835
|
-
},
|
|
1835
|
+
}, Be = (e, t, n) => {
|
|
1836
1836
|
const s = oe(e), r = n?.userId && e.propertyMap.has("createdBy"), a = n?.userId && e.propertyMap.has("updatedBy"), f = [...e.propertyMap.keys(), ...e.foreignKeyNames], d = [];
|
|
1837
1837
|
t.forEach((E) => {
|
|
1838
1838
|
const $ = sn(e, E);
|
|
@@ -1999,7 +1999,7 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
1999
1999
|
sql: N,
|
|
2000
2000
|
params: h
|
|
2001
2001
|
};
|
|
2002
|
-
}, mt = "_", tr = (e) => e.replaceAll(".", "_"),
|
|
2002
|
+
}, mt = "_", tr = (e) => e.replaceAll(".", "_"), Ue = (e, t) => {
|
|
2003
2003
|
if (e.relationAliasMap.has(t)) return e.relationAliasMap.get(t);
|
|
2004
2004
|
const n = t.includes("_") ? t : t.split("_")[0], s = rr(e, tr(n));
|
|
2005
2005
|
return e.relationAliasMap.set(t, s), s;
|
|
@@ -2023,8 +2023,8 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2023
2023
|
if (N && N.type === k.keyValue) {
|
|
2024
2024
|
const D = r.slice(0, a).join(".");
|
|
2025
2025
|
nr(e, t, h, D);
|
|
2026
|
-
const M = h[h.length - 1].relation, S = je(h, D, M), C =
|
|
2027
|
-
return t.fieldAliasMap.set(s, `"${C}"."${E}" ->> '${
|
|
2026
|
+
const M = h[h.length - 1].relation, S = je(h, D, M), C = Ue(t, S), w = $ ? `$.${$}` : "$";
|
|
2027
|
+
return t.fieldAliasMap.set(s, `"${C}"."${E}" ->> '${w.replace("$.", "")}'`), !0;
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
2030
|
return !1;
|
|
@@ -2032,21 +2032,21 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2032
2032
|
n.forEach(({ metadata: r, relation: a }, f) => {
|
|
2033
2033
|
const d = e.rxdb.schemaManager.findMappedRelation(r, a);
|
|
2034
2034
|
if (!d) throw new ce("mappedRelation not found");
|
|
2035
|
-
const h = je(n, s, a), E =
|
|
2035
|
+
const h = je(n, s, a), E = Ue(t, h);
|
|
2036
2036
|
let $ = mt;
|
|
2037
2037
|
if (f > 0) {
|
|
2038
2038
|
const N = n[f - 1], D = je(n, s, N.relation);
|
|
2039
|
-
$ =
|
|
2039
|
+
$ = Ue(t, D);
|
|
2040
2040
|
}
|
|
2041
2041
|
switch (a.kind) {
|
|
2042
|
-
case
|
|
2042
|
+
case we.ONE_TO_MANY:
|
|
2043
2043
|
pi(t, d, E, $);
|
|
2044
2044
|
break;
|
|
2045
|
-
case
|
|
2046
|
-
case
|
|
2045
|
+
case we.ONE_TO_ONE:
|
|
2046
|
+
case we.MANY_TO_ONE:
|
|
2047
2047
|
yi(t, d, E, $, a);
|
|
2048
2048
|
break;
|
|
2049
|
-
case
|
|
2049
|
+
case we.MANY_TO_MANY:
|
|
2050
2050
|
gi(e, t, d, E, $, a);
|
|
2051
2051
|
break;
|
|
2052
2052
|
}
|
|
@@ -2055,18 +2055,18 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2055
2055
|
const r = qe(e, t.metadata), a = `${t.relation.name}Id`;
|
|
2056
2056
|
r.push({
|
|
2057
2057
|
joinTableName: n,
|
|
2058
|
-
on: `"${n}"."${a}" = ${
|
|
2058
|
+
on: `"${n}"."${a}" = ${wt(s)}."id"`
|
|
2059
2059
|
});
|
|
2060
2060
|
}, yi = (e, t, n, s, r) => {
|
|
2061
2061
|
qe(e, t.metadata).push({
|
|
2062
2062
|
joinTableName: n,
|
|
2063
|
-
on: `"${n}"."id" = ${
|
|
2063
|
+
on: `"${n}"."id" = ${wt(s)}."${r.name}Id"`
|
|
2064
2064
|
});
|
|
2065
2065
|
}, gi = (e, t, n, s, r, a) => {
|
|
2066
2066
|
const f = re(a.junctionEntityType), d = qe(t, f), h = rr(t, tr(`${a.name}_m_n`));
|
|
2067
2067
|
d.push({
|
|
2068
2068
|
joinTableName: h,
|
|
2069
|
-
on: `"${h}"."${n.relation.name}Id" = ${
|
|
2069
|
+
on: `"${h}"."${n.relation.name}Id" = ${wt(r)}."id"`
|
|
2070
2070
|
}), qe(t, n.metadata).push({
|
|
2071
2071
|
joinTableName: s,
|
|
2072
2072
|
on: `"${s}"."id" = "${h}"."${a.name}Id"`
|
|
@@ -2076,7 +2076,7 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2076
2076
|
for (; e.usedAliases.has(n); )
|
|
2077
2077
|
n = `${t}_${s++}`;
|
|
2078
2078
|
return e.usedAliases.add(n), n;
|
|
2079
|
-
}, je = (e, t, n) => e.length === 1 ? n.name : `${t}_${n.name}`,
|
|
2079
|
+
}, je = (e, t, n) => e.length === 1 ? n.name : `${t}_${n.name}`, wt = (e) => e === mt ? e : `"${e}"`, sr = (e, t, n) => {
|
|
2080
2080
|
const s = {
|
|
2081
2081
|
joinMap: /* @__PURE__ */ new Map(),
|
|
2082
2082
|
usedAliases: /* @__PURE__ */ new Set(),
|
|
@@ -2104,7 +2104,7 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2104
2104
|
}
|
|
2105
2105
|
const $ = s.replace(`.${E.propertyName}`, "");
|
|
2106
2106
|
nr(e, t, E.relations, $);
|
|
2107
|
-
const N = E.relations[E.relations.length - 1], D = je(E.relations, $, N.relation), M =
|
|
2107
|
+
const N = E.relations[E.relations.length - 1], D = je(E.relations, $, N.relation), M = Ue(t, D);
|
|
2108
2108
|
t.fieldAliasMap.set(s, `"${M}"."${E.propertyName}"`);
|
|
2109
2109
|
return;
|
|
2110
2110
|
} catch {
|
|
@@ -2133,10 +2133,10 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2133
2133
|
notStartsWith: "NOT LIKE",
|
|
2134
2134
|
endsWith: "LIKE",
|
|
2135
2135
|
notEndsWith: "NOT LIKE"
|
|
2136
|
-
},
|
|
2136
|
+
}, wi = (e) => {
|
|
2137
2137
|
if (e?.length)
|
|
2138
2138
|
return e.map((t) => `${xe}."${t.field}" ${t.sort.toUpperCase()}`).join(", ");
|
|
2139
|
-
},
|
|
2139
|
+
}, _i = (e) => mi[e] || e, bi = (e) => e && typeof e == "object" && "rules" in e && Array.isArray(e.rules), Ti = (e, t, n) => {
|
|
2140
2140
|
if (t) return t;
|
|
2141
2141
|
if (!e.includes("."))
|
|
2142
2142
|
return e.toLowerCase() !== e ? `"${e}"` : e;
|
|
@@ -2174,7 +2174,7 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2174
2174
|
const M = h.startsWith("not") ? "NOT LIKE" : "LIKE";
|
|
2175
2175
|
return `${f} ${M} $${t.length}`;
|
|
2176
2176
|
}
|
|
2177
|
-
const N =
|
|
2177
|
+
const N = _i(h);
|
|
2178
2178
|
return t.push(d), $ && $.type === k.uuid ? `${f}::uuid ${N} $${t.length}::uuid` : `${f} ${N} $${t.length}`;
|
|
2179
2179
|
}, Ye = (e, t, n = /* @__PURE__ */ new Map(), s) => {
|
|
2180
2180
|
const r = e.rules.map(
|
|
@@ -2191,7 +2191,7 @@ const zn = /* @__PURE__ */ si(ai), Zn = (e, t) => {
|
|
|
2191
2191
|
let t = `SELECT COUNT(*) as count FROM ${e.tableName} AS ${xe}`;
|
|
2192
2192
|
return e.join && (t += ` ${e.join}`), e.where && (t += ` WHERE ${e.where}`), t;
|
|
2193
2193
|
}, Pe = (e, t, n) => {
|
|
2194
|
-
const s = oe(t), r = [], { joinSQL: a, fieldAliasMap: f } = n.where ? sr(e, t, n.where) : { joinSQL: "", fieldAliasMap: /* @__PURE__ */ new Map() }, d = n.where ? Ye(n.where, r, f, t) : void 0, h =
|
|
2194
|
+
const s = oe(t), r = [], { joinSQL: a, fieldAliasMap: f } = n.where ? sr(e, t, n.where) : { joinSQL: "", fieldAliasMap: /* @__PURE__ */ new Map() }, d = n.where ? Ye(n.where, r, f, t) : void 0, h = wi(n.orderBy), E = "limit" in n ? n.limit : void 0, $ = "offset" in n ? n.offset : void 0;
|
|
2195
2195
|
return { sql: Ii(
|
|
2196
2196
|
{
|
|
2197
2197
|
tableName: s,
|
|
@@ -2352,16 +2352,16 @@ const Mi = async (e, t, n) => {
|
|
|
2352
2352
|
for (const [a, f] of t.create.entries()) {
|
|
2353
2353
|
const d = Array.from(f);
|
|
2354
2354
|
d.forEach((C) => s.add(C));
|
|
2355
|
-
const h = re(a), E =
|
|
2355
|
+
const h = re(a), E = Be(h, d, e.rxdb.context);
|
|
2356
2356
|
await e.query(E);
|
|
2357
2357
|
const $ = d.map((C) => C.id), { sql: N, params: D } = Pe(e, h, {
|
|
2358
2358
|
where: { combinator: "and", rules: [{ field: "id", operator: "in", value: $ }] }
|
|
2359
2359
|
}), M = await e.query(N, D), S = e.getRepository(a);
|
|
2360
2360
|
for (const C of M.rows) {
|
|
2361
|
-
const
|
|
2361
|
+
const w = Ne(h, C), R = w.id;
|
|
2362
2362
|
if (S.hasEntityRef(R)) {
|
|
2363
2363
|
const O = S.getEntityRef(R);
|
|
2364
|
-
S.updateEntity(O,
|
|
2364
|
+
S.updateEntity(O, w);
|
|
2365
2365
|
const A = be(O);
|
|
2366
2366
|
A.local = !0, A.modified = !1;
|
|
2367
2367
|
}
|
|
@@ -2383,8 +2383,8 @@ const Mi = async (e, t, n) => {
|
|
|
2383
2383
|
updatedAt: r
|
|
2384
2384
|
});
|
|
2385
2385
|
await e.query(S, C);
|
|
2386
|
-
const
|
|
2387
|
-
where: { combinator: "and", rules: [{ field: "id", operator: "in", value:
|
|
2386
|
+
const w = N.map((A) => A.id), R = Pe(e, h, {
|
|
2387
|
+
where: { combinator: "and", rules: [{ field: "id", operator: "in", value: w }] }
|
|
2388
2388
|
}), O = await e.query(R.sql, R.params);
|
|
2389
2389
|
for (const A of O.rows) {
|
|
2390
2390
|
const b = Ne(h, A), I = b.id;
|
|
@@ -2410,7 +2410,7 @@ const Mi = async (e, t, n) => {
|
|
|
2410
2410
|
}
|
|
2411
2411
|
}
|
|
2412
2412
|
return Array.from(s);
|
|
2413
|
-
},
|
|
2413
|
+
}, Bi = (e, t) => {
|
|
2414
2414
|
const n = oe(t);
|
|
2415
2415
|
let s = `CREATE TABLE ${n} (`;
|
|
2416
2416
|
const r = [], a = [], f = [];
|
|
@@ -2436,7 +2436,7 @@ ${h}`).join(","), s += `
|
|
|
2436
2436
|
return r.length && (s += `
|
|
2437
2437
|
` + r.join(`
|
|
2438
2438
|
`)), s;
|
|
2439
|
-
},
|
|
2439
|
+
}, Ui = (e, t) => {
|
|
2440
2440
|
let n = "";
|
|
2441
2441
|
const s = oe(t);
|
|
2442
2442
|
return t.indexes && t.indexes.length > 0 && t.indexes.forEach((r) => {
|
|
@@ -2449,8 +2449,8 @@ CREATE ${d}INDEX "${a}" ON ${s}(${f});`;
|
|
|
2449
2449
|
const s = oe(t);
|
|
2450
2450
|
return Array.from(t.relationMap.values()).forEach((r) => {
|
|
2451
2451
|
switch (r.kind) {
|
|
2452
|
-
case
|
|
2453
|
-
case
|
|
2452
|
+
case we.ONE_TO_ONE:
|
|
2453
|
+
case we.MANY_TO_ONE:
|
|
2454
2454
|
{
|
|
2455
2455
|
const a = `${r.name}Id`;
|
|
2456
2456
|
let f = "uuid";
|
|
@@ -2469,7 +2469,7 @@ CREATE ${d}INDEX "${a}" ON ${s}(${f});`;
|
|
|
2469
2469
|
} catch {
|
|
2470
2470
|
}
|
|
2471
2471
|
if (n += `
|
|
2472
|
-
ALTER TABLE ${s} ADD COLUMN "${a}" ${f}`, r.nullable || (n += " NOT NULL"), r.kind ===
|
|
2472
|
+
ALTER TABLE ${s} ADD COLUMN "${a}" ${f}`, r.nullable || (n += " NOT NULL"), r.kind === we.MANY_TO_ONE && Reflect.get(r, "default") !== void 0) {
|
|
2473
2473
|
const h = r;
|
|
2474
2474
|
let E = h.default;
|
|
2475
2475
|
en(h.default) && (E = h.default()), n += ` DEFAULT '${E}'`;
|
|
@@ -2479,9 +2479,9 @@ ALTER TABLE ${s} ADD COLUMN "${a}" ${f}`, r.nullable || (n += " NOT NULL"), r.ki
|
|
|
2479
2479
|
if (r.mappedEntity && !d) {
|
|
2480
2480
|
const h = tn(r.mappedEntity, r.mappedNamespace || t.namespace), E = `${s}_${a}_fk`.replace(/"/g, "");
|
|
2481
2481
|
n += `
|
|
2482
|
-
ALTER TABLE ${s} ADD CONSTRAINT "${E}" FOREIGN KEY ("${a}") REFERENCES ${h}(id)`, r.onDelete ? n += ` ON DELETE ${r.onDelete}` : r.kind ===
|
|
2482
|
+
ALTER TABLE ${s} ADD CONSTRAINT "${E}" FOREIGN KEY ("${a}") REFERENCES ${h}(id)`, r.onDelete ? n += ` ON DELETE ${r.onDelete}` : r.kind === we.MANY_TO_ONE && (r.nullable ? n += " ON DELETE SET NULL" : n += " ON DELETE CASCADE"), n += " DEFERRABLE INITIALLY DEFERRED", n += ";";
|
|
2483
2483
|
}
|
|
2484
|
-
(r.unique || r.kind ===
|
|
2484
|
+
(r.unique || r.kind === we.ONE_TO_ONE) && (n += `
|
|
2485
2485
|
CREATE UNIQUE INDEX "${rn(t, r)}" ON ${s}("${a}");`);
|
|
2486
2486
|
}
|
|
2487
2487
|
break;
|
|
@@ -2489,7 +2489,7 @@ CREATE UNIQUE INDEX "${rn(t, r)}" ON ${s}("${a}");`);
|
|
|
2489
2489
|
}), n;
|
|
2490
2490
|
}, ar = (e, t) => {
|
|
2491
2491
|
let n = "";
|
|
2492
|
-
return n +=
|
|
2492
|
+
return n += Bi(e, t), n += qi(e, t), n += Ui(e, t), n;
|
|
2493
2493
|
};
|
|
2494
2494
|
function ji() {
|
|
2495
2495
|
return `
|
|
@@ -2567,10 +2567,10 @@ function Pi(e = ["public$RxDBChange", "public$RxDBBranch", "public$RxDBMigration
|
|
|
2567
2567
|
|
|
2568
2568
|
`);
|
|
2569
2569
|
}
|
|
2570
|
-
function
|
|
2571
|
-
const n = oe(e), s = re(ht), r = oe(s), { propertyMap: a, name: f, foreignKeyNames: d, namespace: h } = e, { branchId: E, transactionId: $ } = t, N = `"${f}_change_trigger"`, D = [...a.keys(), ...d].filter((I) => I !== "id"), M = 'type, namespace, entity, "branchId", "transactionId", "entityId", "inversePatch", patch', S = $ ? `'${$}'` : "NULL", C = E || "main",
|
|
2570
|
+
function _t(e, t = {}) {
|
|
2571
|
+
const n = oe(e), s = re(ht), r = oe(s), { propertyMap: a, name: f, foreignKeyNames: d, namespace: h } = e, { branchId: E, transactionId: $ } = t, N = `"${f}_change_trigger"`, D = [...a.keys(), ...d].filter((I) => I !== "id"), M = 'type, namespace, entity, "branchId", "transactionId", "entityId", "inversePatch", patch', S = $ ? `'${$}'` : "NULL", C = E || "main", w = `"${h}"."${f}_change_trigger_fn"`, R = `'${h}','${f}','${C}',${S}`, O = `
|
|
2572
2572
|
-- 创建或替换触发器函数
|
|
2573
|
-
CREATE OR REPLACE FUNCTION ${
|
|
2573
|
+
CREATE OR REPLACE FUNCTION ${w}()
|
|
2574
2574
|
RETURNS TRIGGER AS $$
|
|
2575
2575
|
DECLARE
|
|
2576
2576
|
old_values JSONB;
|
|
@@ -2633,7 +2633,7 @@ DROP TRIGGER IF EXISTS ${N} ON ${n}`, b = `
|
|
|
2633
2633
|
CREATE TRIGGER ${N}
|
|
2634
2634
|
AFTER INSERT OR UPDATE OR DELETE ON ${n}
|
|
2635
2635
|
FOR EACH ROW
|
|
2636
|
-
EXECUTE FUNCTION ${
|
|
2636
|
+
EXECUTE FUNCTION ${w}()`;
|
|
2637
2637
|
return [O, A, b].join(`
|
|
2638
2638
|
---STATEMENT_SEPARATOR---
|
|
2639
2639
|
`);
|
|
@@ -2685,7 +2685,7 @@ function Qt(e, t, n) {
|
|
|
2685
2685
|
return e.rxdb.config.entities.forEach((r) => {
|
|
2686
2686
|
const a = re(r);
|
|
2687
2687
|
if (a.log !== !1) {
|
|
2688
|
-
const d =
|
|
2688
|
+
const d = _t(a, { branchId: t, transactionId: n }).split("---STATEMENT_SEPARATOR---").map((h) => h.trim()).filter((h) => h.length > 0);
|
|
2689
2689
|
s.push(...d);
|
|
2690
2690
|
}
|
|
2691
2691
|
}), s;
|
|
@@ -2716,6 +2716,15 @@ class Zi extends cr {
|
|
|
2716
2716
|
#s;
|
|
2717
2717
|
/** 适配器名称 */
|
|
2718
2718
|
name = yr;
|
|
2719
|
+
getMetadataByIds(t, n) {
|
|
2720
|
+
throw new Error("Method not implemented.");
|
|
2721
|
+
}
|
|
2722
|
+
upsertMany(t, n) {
|
|
2723
|
+
throw new Error("Method not implemented.");
|
|
2724
|
+
}
|
|
2725
|
+
deleteByIds(t, n) {
|
|
2726
|
+
throw new Error("Method not implemented.");
|
|
2727
|
+
}
|
|
2719
2728
|
async mutations(t) {
|
|
2720
2729
|
const n = async () => await Mi(this, t, this.rxdb.context);
|
|
2721
2730
|
return this.#t ? await n() : await this.transaction(() => n());
|
|
@@ -2761,7 +2770,7 @@ class Zi extends cr {
|
|
|
2761
2770
|
}
|
|
2762
2771
|
const s = async () => {
|
|
2763
2772
|
for (const [r, a] of n.entries()) {
|
|
2764
|
-
const f = re(r), d =
|
|
2773
|
+
const f = re(r), d = Be(f, a, this.rxdb.context);
|
|
2765
2774
|
await this.query(d);
|
|
2766
2775
|
for (const h of a) {
|
|
2767
2776
|
const E = be(h);
|
|
@@ -2897,7 +2906,7 @@ class Zi extends cr {
|
|
|
2897
2906
|
for (const a of t) {
|
|
2898
2907
|
const f = re(a);
|
|
2899
2908
|
if (f.log !== !1) {
|
|
2900
|
-
const d =
|
|
2909
|
+
const d = _t(f);
|
|
2901
2910
|
await this.#c(d.replace(/---STATEMENT_SEPARATOR---/g, ";"));
|
|
2902
2911
|
}
|
|
2903
2912
|
}
|
|
@@ -2908,7 +2917,7 @@ class Zi extends cr {
|
|
|
2908
2917
|
a.has(d) || a.set(d, []), a.get(d).push(f);
|
|
2909
2918
|
}
|
|
2910
2919
|
for (const [f, d] of a) {
|
|
2911
|
-
const h = re(f), E =
|
|
2920
|
+
const h = re(f), E = Be(h, d, this.rxdb.context);
|
|
2912
2921
|
await this.#c(E);
|
|
2913
2922
|
}
|
|
2914
2923
|
}
|
|
@@ -3109,7 +3118,7 @@ function ta(e, t, n) {
|
|
|
3109
3118
|
const a = t[r], f = re(a), d = ar(e, f);
|
|
3110
3119
|
if (s += `
|
|
3111
3120
|
` + d, f.log !== !1) {
|
|
3112
|
-
const h =
|
|
3121
|
+
const h = _t(f);
|
|
3113
3122
|
s += `
|
|
3114
3123
|
` + h;
|
|
3115
3124
|
}
|
|
@@ -3121,7 +3130,7 @@ function ta(e, t, n) {
|
|
|
3121
3130
|
r.has(f) || r.set(f, /* @__PURE__ */ new Set()), r.get(f).add(a);
|
|
3122
3131
|
});
|
|
3123
3132
|
for (const [a, f] of r.entries()) {
|
|
3124
|
-
const d =
|
|
3133
|
+
const d = Be(a, Array.from(f), e.rxdb.context);
|
|
3125
3134
|
s += `
|
|
3126
3135
|
` + d;
|
|
3127
3136
|
}
|
|
@@ -3154,7 +3163,7 @@ export {
|
|
|
3154
3163
|
ji as generateNotifyFunctionSQL,
|
|
3155
3164
|
Pi as generateNotifyInfrastructureSQL,
|
|
3156
3165
|
xi as generateNotifyTriggerSQL,
|
|
3157
|
-
|
|
3166
|
+
_t as generate_trigger_sql,
|
|
3158
3167
|
Ne as getEntityObjectFromResult,
|
|
3159
3168
|
pt as getSqlValue,
|
|
3160
3169
|
Ji as getSqlWithParams,
|
|
@@ -3172,5 +3181,5 @@ export {
|
|
|
3172
3181
|
$t as transformEntityValuePGliteToJs,
|
|
3173
3182
|
dt as transformEntityValueToSql,
|
|
3174
3183
|
Er as transformValueJsToPGlite,
|
|
3175
|
-
|
|
3184
|
+
_r as transformValuePGliteToJs
|
|
3176
3185
|
};
|