@dialecte/core 0.2.9 → 0.2.11
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/{index-1D8DELEq.js → index-BdP_eGXx.js} +373 -370
- package/dist/index.js +1 -1
- package/dist/test/config.d.ts +6 -15
- package/dist/test/config.d.ts.map +1 -1
- package/dist/test/create-test-dialecte.d.ts +9 -5
- package/dist/test/create-test-dialecte.d.ts.map +1 -1
- package/dist/test/generated/constants.generated.d.ts.map +1 -1
- package/dist/test/generated/definition.generated.d.ts +6 -15
- package/dist/test/generated/definition.generated.d.ts.map +1 -1
- package/dist/test/generated/types.generated.d.ts +0 -2
- package/dist/test/generated/types.generated.d.ts.map +1 -1
- package/dist/test/run-test-cases.d.ts +16 -17
- package/dist/test/run-test-cases.d.ts.map +1 -1
- package/dist/test/run-test-cases.type.d.ts +6 -6
- package/dist/test/run-test-cases.type.d.ts.map +1 -1
- package/dist/test/test-record.d.ts +48 -120
- package/dist/test/test-record.d.ts.map +1 -1
- package/dist/test.js +193 -190
- package/package.json +1 -1
|
@@ -6,8 +6,8 @@ function gr(m, r) {
|
|
|
6
6
|
for (const o of Object.keys(m)) {
|
|
7
7
|
const f = m[o], d = {};
|
|
8
8
|
for (const v of Object.keys(f)) {
|
|
9
|
-
const
|
|
10
|
-
d[v] = (...D) =>
|
|
9
|
+
const p = f[v];
|
|
10
|
+
d[v] = (...D) => p(r, ...D);
|
|
11
11
|
}
|
|
12
12
|
s[o] = d;
|
|
13
13
|
}
|
|
@@ -120,10 +120,10 @@ async function vi(m) {
|
|
|
120
120
|
if (d) return me({ context: r, ref: d });
|
|
121
121
|
const v = r.dialecteConfig.transparentElements;
|
|
122
122
|
if (!v?.length) return;
|
|
123
|
-
const
|
|
123
|
+
const p = f.children.filter(
|
|
124
124
|
(D) => v.includes(D.tagName)
|
|
125
125
|
);
|
|
126
|
-
for (const D of
|
|
126
|
+
for (const D of p) {
|
|
127
127
|
const R = await me({ context: r, ref: D });
|
|
128
128
|
if (!R) continue;
|
|
129
129
|
const K = R.children.find((B) => B.tagName === o);
|
|
@@ -140,24 +140,24 @@ async function bi(m) {
|
|
|
140
140
|
);
|
|
141
141
|
const v = r.dialecteConfig.transparentElements;
|
|
142
142
|
if (!v?.length) return [];
|
|
143
|
-
const
|
|
143
|
+
const p = f.children.filter(
|
|
144
144
|
(B) => v.includes(B.tagName)
|
|
145
145
|
);
|
|
146
|
-
if (!
|
|
147
|
-
const R = (await Zt({ context: r, refs:
|
|
146
|
+
if (!p.length) return [];
|
|
147
|
+
const R = (await Zt({ context: r, refs: p })).filter((B) => B !== void 0).flatMap((B) => B.children.filter((Y) => Y.tagName === o)).map((B) => ({ tagName: o, id: B.id }));
|
|
148
148
|
return R.length ? (await Zt({ context: r, refs: R })).filter(
|
|
149
149
|
(B) => B !== void 0
|
|
150
150
|
) : [];
|
|
151
151
|
}
|
|
152
152
|
async function wi(m) {
|
|
153
|
-
const { context: r, ref: s, options: o } = m, f = o?.depth ?? 1 / 0, d = o?.stopAtTagName, v = o?.order ?? "bottom-up",
|
|
153
|
+
const { context: r, ref: s, options: o } = m, f = o?.depth ?? 1 / 0, d = o?.stopAtTagName, v = o?.order ?? "bottom-up", p = [];
|
|
154
154
|
let D = await me({ context: r, ref: s });
|
|
155
|
-
for (; D?.parent &&
|
|
155
|
+
for (; D?.parent && p.length < f; ) {
|
|
156
156
|
const R = D.parent, K = await me({ context: r, ref: R });
|
|
157
|
-
if (!K || (
|
|
157
|
+
if (!K || (p.push(K), d && K.tagName === d)) break;
|
|
158
158
|
D = K;
|
|
159
159
|
}
|
|
160
|
-
return v === "top-down" ?
|
|
160
|
+
return v === "top-down" ? p.reverse() : p;
|
|
161
161
|
}
|
|
162
162
|
async function Er(m) {
|
|
163
163
|
const { context: r, tagName: s, attributes: o } = m, f = await Sn({ context: r, tagName: s }), d = [];
|
|
@@ -172,11 +172,11 @@ function xt(m) {
|
|
|
172
172
|
for (const [o, f] of Object.entries(s)) {
|
|
173
173
|
if (f === void 0) continue;
|
|
174
174
|
const v = r.attributes.find(
|
|
175
|
-
(
|
|
175
|
+
(p) => p.name === o
|
|
176
176
|
)?.value ?? "";
|
|
177
177
|
if (v === "") return !1;
|
|
178
178
|
if (Array.isArray(f)) {
|
|
179
|
-
if (!f.some((
|
|
179
|
+
if (!f.some((p) => v === p))
|
|
180
180
|
return !1;
|
|
181
181
|
} else if (v !== f)
|
|
182
182
|
return !1;
|
|
@@ -184,11 +184,11 @@ function xt(m) {
|
|
|
184
184
|
return !0;
|
|
185
185
|
}
|
|
186
186
|
async function wr(m) {
|
|
187
|
-
const { context: r, ref: s, options: o } = m, { collect: f, omit: d } = o, v = xo(d),
|
|
188
|
-
for (const K of
|
|
187
|
+
const { context: r, ref: s, options: o } = m, { collect: f, omit: d } = o, v = xo(d), p = To(f), D = /* @__PURE__ */ new Map();
|
|
188
|
+
for (const K of p.allTags)
|
|
189
189
|
D.set(K, /* @__PURE__ */ new Map());
|
|
190
190
|
const R = await me({ context: r, ref: s });
|
|
191
|
-
return R && (
|
|
191
|
+
return R && (p.mode === "flat" ? await Co({ context: r, rootId: R.id, collectSpec: p, omitSpec: v, collected: D }) : await xi({ context: r, record: R, pathNodes: p.paths, omitSpec: v, collected: D })), ii(D);
|
|
192
192
|
}
|
|
193
193
|
function xo(m) {
|
|
194
194
|
const r = /* @__PURE__ */ new Set(), s = [];
|
|
@@ -222,8 +222,8 @@ function To(m) {
|
|
|
222
222
|
if (typeof d == "string")
|
|
223
223
|
o.push({ tagName: d }), f.add(d);
|
|
224
224
|
else
|
|
225
|
-
for (const [v,
|
|
226
|
-
o.push({ tagName: v, where:
|
|
225
|
+
for (const [v, p] of Object.entries(d))
|
|
226
|
+
o.push({ tagName: v, where: p?.where }), f.add(v);
|
|
227
227
|
return { mode: "flat", targets: o, allTags: f };
|
|
228
228
|
}
|
|
229
229
|
const r = /* @__PURE__ */ new Set();
|
|
@@ -247,21 +247,21 @@ function No(m) {
|
|
|
247
247
|
const f = s, d = f.where, v = Object.keys(f).filter((R) => R !== "where");
|
|
248
248
|
if (v.length === 0)
|
|
249
249
|
return { tagName: r, where: d, children: [], isLeaf: !0 };
|
|
250
|
-
const
|
|
250
|
+
const p = {};
|
|
251
251
|
for (const R of v)
|
|
252
|
-
|
|
253
|
-
const D = _i(
|
|
252
|
+
p[R] = f[R];
|
|
253
|
+
const D = _i(p, o);
|
|
254
254
|
return { tagName: r, where: d, children: D, isLeaf: !1 };
|
|
255
255
|
}
|
|
256
256
|
async function Co(m) {
|
|
257
257
|
const { context: r, rootId: s, collectSpec: o, omitSpec: f, collected: d } = m;
|
|
258
258
|
for (const v of o.targets) {
|
|
259
259
|
if (f.unconditional.has(v.tagName)) continue;
|
|
260
|
-
const
|
|
260
|
+
const p = await Sn({
|
|
261
261
|
context: r,
|
|
262
262
|
tagName: v.tagName
|
|
263
263
|
});
|
|
264
|
-
for (const D of
|
|
264
|
+
for (const D of p)
|
|
265
265
|
Ei({ record: D, where: v.where }) && (xr({ record: D, omitSpec: f }) || await Oo({ context: r, record: D, rootId: s, omitSpec: f }) && d.get(v.tagName).set(D.id, D));
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -288,34 +288,34 @@ async function Oo(m) {
|
|
|
288
288
|
async function xi(m) {
|
|
289
289
|
const { context: r, record: s, pathNodes: o, omitSpec: f, collected: d } = m;
|
|
290
290
|
if (!s.children?.length) return;
|
|
291
|
-
const v = new Set(o.map((
|
|
292
|
-
for (const
|
|
291
|
+
const v = new Set(o.map((p) => p.tagName));
|
|
292
|
+
for (const p of o) {
|
|
293
293
|
const D = await Ao({
|
|
294
294
|
context: r,
|
|
295
295
|
record: s,
|
|
296
|
-
tagName:
|
|
297
|
-
where:
|
|
296
|
+
tagName: p.tagName,
|
|
297
|
+
where: p.where,
|
|
298
298
|
omitSpec: f,
|
|
299
299
|
stopAtTagNames: v
|
|
300
300
|
});
|
|
301
301
|
for (const R of D)
|
|
302
|
-
d.get(
|
|
302
|
+
d.get(p.tagName).set(R.id, R), !p.isLeaf && p.children.length > 0 && await xi({
|
|
303
303
|
context: r,
|
|
304
304
|
record: R,
|
|
305
|
-
pathNodes:
|
|
305
|
+
pathNodes: p.children,
|
|
306
306
|
omitSpec: f,
|
|
307
307
|
collected: d
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
async function Ao(m) {
|
|
312
|
-
const { context: r, record: s, tagName: o, where: f, omitSpec: d, stopAtTagNames: v } = m,
|
|
313
|
-
if (!s.children?.length) return
|
|
312
|
+
const { context: r, record: s, tagName: o, where: f, omitSpec: d, stopAtTagNames: v } = m, p = [];
|
|
313
|
+
if (!s.children?.length) return p;
|
|
314
314
|
const D = [], R = await ri({ context: r, record: s, omitSpec: d });
|
|
315
315
|
for (D.push(...R); D.length > 0; ) {
|
|
316
316
|
const K = D.shift();
|
|
317
317
|
if (K.tagName === o) {
|
|
318
|
-
Ei({ record: K, where: f }) &&
|
|
318
|
+
Ei({ record: K, where: f }) && p.push(K);
|
|
319
319
|
continue;
|
|
320
320
|
}
|
|
321
321
|
if (!(v.has(K.tagName) && K.tagName !== o) && K.children?.length) {
|
|
@@ -323,7 +323,7 @@ async function Ao(m) {
|
|
|
323
323
|
D.push(...B);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
return
|
|
326
|
+
return p;
|
|
327
327
|
}
|
|
328
328
|
async function ri(m) {
|
|
329
329
|
const { context: r, record: s, omitSpec: o } = m;
|
|
@@ -343,11 +343,11 @@ function ii(m) {
|
|
|
343
343
|
}
|
|
344
344
|
async function Ti(m) {
|
|
345
345
|
const { context: r, ref: s, name: o } = m;
|
|
346
|
-
return ((await me({ context: r, ref: s }))?.attributes ?? []).find((
|
|
346
|
+
return ((await me({ context: r, ref: s }))?.attributes ?? []).find((p) => p.name === o)?.value ?? "";
|
|
347
347
|
}
|
|
348
348
|
async function Ni(m) {
|
|
349
349
|
const { context: r, ref: s, name: o } = m;
|
|
350
|
-
return ((await me({ context: r, ref: s }))?.attributes ?? []).find((
|
|
350
|
+
return ((await me({ context: r, ref: s }))?.attributes ?? []).find((p) => p.name === o);
|
|
351
351
|
}
|
|
352
352
|
async function Ci(m) {
|
|
353
353
|
const { context: r, ref: s } = m;
|
|
@@ -361,7 +361,7 @@ async function Oi(m) {
|
|
|
361
361
|
return (await me({ context: r, ref: s }))?.attributes ?? [];
|
|
362
362
|
}
|
|
363
363
|
async function Ai(m) {
|
|
364
|
-
const { context: r, ref: s, options: o = {}, dialecteConfig: f } = m, { select: d, omit: v, unwrap:
|
|
364
|
+
const { context: r, ref: s, options: o = {}, dialecteConfig: f } = m, { select: d, omit: v, unwrap: p } = o, D = await me({ context: r, ref: s });
|
|
365
365
|
we(D, {
|
|
366
366
|
detail: "No record found for provided ref",
|
|
367
367
|
key: "ELEMENT_NOT_FOUND"
|
|
@@ -373,7 +373,7 @@ async function Ai(m) {
|
|
|
373
373
|
compiledOmit: R,
|
|
374
374
|
dialecteConfig: f
|
|
375
375
|
});
|
|
376
|
-
return K ?
|
|
376
|
+
return K ? p ? qo({ tree: K, unwrapTagNames: p }) : K : br({ record: D });
|
|
377
377
|
}
|
|
378
378
|
function Do(m) {
|
|
379
379
|
const r = /* @__PURE__ */ new Set(), s = [];
|
|
@@ -441,12 +441,12 @@ async function Ro(m) {
|
|
|
441
441
|
const B = s.tagName, Y = d.children[B], oe = o[B] !== void 0;
|
|
442
442
|
Y?.includes(B) && !oe && v.add(B);
|
|
443
443
|
}
|
|
444
|
-
const
|
|
444
|
+
const p = s.children.filter(
|
|
445
445
|
(B) => Io({ tagName: B.tagName, compiledOmit: f, selectKeys: v })
|
|
446
446
|
);
|
|
447
|
-
if (!
|
|
447
|
+
if (!p.length) return [];
|
|
448
448
|
const K = (await Promise.all(
|
|
449
|
-
|
|
449
|
+
p.map(
|
|
450
450
|
(B) => me({
|
|
451
451
|
context: r,
|
|
452
452
|
ref: ce(B)
|
|
@@ -474,20 +474,20 @@ function Bo(m) {
|
|
|
474
474
|
return r.map((v) => ({ record: v, select: void 0 }));
|
|
475
475
|
const d = [];
|
|
476
476
|
for (const v of r) {
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
477
|
+
const p = s[v.tagName];
|
|
478
|
+
if (p === void 0 && v.tagName === o.tagName) {
|
|
479
479
|
const R = jo({ child: v, select: s, dialecteConfig: f });
|
|
480
480
|
if (R) {
|
|
481
481
|
d.push(R);
|
|
482
482
|
continue;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
if (
|
|
486
|
-
if (
|
|
485
|
+
if (p === void 0 || p === !1) continue;
|
|
486
|
+
if (p === !0) {
|
|
487
487
|
d.push({ record: v, select: void 0 });
|
|
488
488
|
continue;
|
|
489
489
|
}
|
|
490
|
-
const D = Mo({ child: v, entry:
|
|
490
|
+
const D = Mo({ child: v, entry: p, parentRecord: o });
|
|
491
491
|
D && d.push(D);
|
|
492
492
|
}
|
|
493
493
|
return d;
|
|
@@ -816,14 +816,14 @@ class ki {
|
|
|
816
816
|
}
|
|
817
817
|
function et(m) {
|
|
818
818
|
const { context: r, status: s, record: o, oldRecord: f, newRecord: d } = m;
|
|
819
|
-
let v,
|
|
820
|
-
o && (v = pr(o)), f && (
|
|
819
|
+
let v, p, D;
|
|
820
|
+
o && (v = pr(o)), f && (p = pr(f)), d && (D = pr(d)), s === "created" ? (we(v, {
|
|
821
821
|
detail: "Record is required for created",
|
|
822
822
|
key: "ELEMENT_NOT_FOUND"
|
|
823
|
-
}), r.stagedOperations.push({ status: s, oldRecord: void 0, newRecord: v })) : s === "updated" ? (we(
|
|
823
|
+
}), r.stagedOperations.push({ status: s, oldRecord: void 0, newRecord: v })) : s === "updated" ? (we(p && D, {
|
|
824
824
|
detail: "Old record and new record are required for updated",
|
|
825
825
|
key: "ELEMENT_NOT_FOUND"
|
|
826
|
-
}), r.stagedOperations.push({ status: s, oldRecord:
|
|
826
|
+
}), r.stagedOperations.push({ status: s, oldRecord: p, newRecord: D })) : s === "deleted" && v && (we(v, {
|
|
827
827
|
detail: "Record is required for deleted",
|
|
828
828
|
key: "ELEMENT_NOT_FOUND"
|
|
829
829
|
}), r.stagedOperations.push({ status: s, oldRecord: v, newRecord: void 0 }));
|
|
@@ -849,7 +849,7 @@ function Tr(m) {
|
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
async function kn(m) {
|
|
852
|
-
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, params: v } = m, { id:
|
|
852
|
+
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, params: v } = m, { id: p, tagName: D, attributes: R, namespace: K, value: B } = v, Y = await me({ context: o, ref: d });
|
|
853
853
|
we(Y, {
|
|
854
854
|
detail: "Parent record not found",
|
|
855
855
|
key: "ELEMENT_NOT_FOUND",
|
|
@@ -859,7 +859,7 @@ async function kn(m) {
|
|
|
859
859
|
dialecteConfig: r,
|
|
860
860
|
hooks: s,
|
|
861
861
|
record: {
|
|
862
|
-
id:
|
|
862
|
+
id: p ?? crypto.randomUUID(),
|
|
863
863
|
tagName: D,
|
|
864
864
|
attributes: R,
|
|
865
865
|
namespace: K,
|
|
@@ -893,7 +893,7 @@ async function kn(m) {
|
|
|
893
893
|
return oe;
|
|
894
894
|
}
|
|
895
895
|
async function Ri(m) {
|
|
896
|
-
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, record: v, cumulativeCloneMappings:
|
|
896
|
+
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, record: v, cumulativeCloneMappings: p } = m, D = [], R = await Ii({
|
|
897
897
|
dialecteConfig: r,
|
|
898
898
|
hooks: s,
|
|
899
899
|
context: o,
|
|
@@ -902,9 +902,9 @@ async function Ri(m) {
|
|
|
902
902
|
record: v,
|
|
903
903
|
mappings: D
|
|
904
904
|
});
|
|
905
|
-
if (
|
|
905
|
+
if (p.push(...D), s?.afterDeepClone) {
|
|
906
906
|
const K = await s.afterDeepClone({
|
|
907
|
-
cumulativeCloneMappings:
|
|
907
|
+
cumulativeCloneMappings: p,
|
|
908
908
|
query: f
|
|
909
909
|
});
|
|
910
910
|
o.stagedOperations.push(...K);
|
|
@@ -915,7 +915,7 @@ async function Ri(m) {
|
|
|
915
915
|
};
|
|
916
916
|
}
|
|
917
917
|
async function Ii(m) {
|
|
918
|
-
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, record: v, mappings:
|
|
918
|
+
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, record: v, mappings: p } = m;
|
|
919
919
|
let D = !0, R = v;
|
|
920
920
|
if (s?.beforeClone) {
|
|
921
921
|
const Y = s.beforeClone({ record: v });
|
|
@@ -935,7 +935,7 @@ async function Ii(m) {
|
|
|
935
935
|
value: R.value
|
|
936
936
|
}
|
|
937
937
|
}), B = ce(v);
|
|
938
|
-
|
|
938
|
+
p.push({
|
|
939
939
|
source: Object.assign(B, {
|
|
940
940
|
attributes: [...v.attributes]
|
|
941
941
|
}),
|
|
@@ -949,7 +949,7 @@ async function Ii(m) {
|
|
|
949
949
|
query: f,
|
|
950
950
|
parentRef: ce(K),
|
|
951
951
|
record: Y,
|
|
952
|
-
mappings:
|
|
952
|
+
mappings: p
|
|
953
953
|
});
|
|
954
954
|
return K;
|
|
955
955
|
}
|
|
@@ -967,16 +967,16 @@ async function Pi(m) {
|
|
|
967
967
|
Tr({ context: s, operations: R });
|
|
968
968
|
}
|
|
969
969
|
await Fi({ context: s, record: d }), et({ context: s, status: "deleted", record: d });
|
|
970
|
-
const v = ce(d.parent),
|
|
971
|
-
we(
|
|
970
|
+
const v = ce(d.parent), p = await me({ context: s, ref: v });
|
|
971
|
+
we(p, {
|
|
972
972
|
detail: `Parent record not found (tagName=${d.parent.tagName}, id=${d.parent.id})`,
|
|
973
973
|
key: "ELEMENT_NOT_FOUND"
|
|
974
974
|
});
|
|
975
975
|
const D = {
|
|
976
|
-
...
|
|
977
|
-
children:
|
|
976
|
+
...p,
|
|
977
|
+
children: p.children.filter((R) => R.id !== d.id)
|
|
978
978
|
};
|
|
979
|
-
return et({ context: s, status: "updated", oldRecord:
|
|
979
|
+
return et({ context: s, status: "updated", oldRecord: p, newRecord: D }), D;
|
|
980
980
|
}
|
|
981
981
|
async function Fi(m) {
|
|
982
982
|
const { context: r, record: s } = m;
|
|
@@ -986,12 +986,12 @@ async function Fi(m) {
|
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
async function Bi(m) {
|
|
989
|
-
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, params: v } = m,
|
|
990
|
-
if (
|
|
989
|
+
const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, params: v } = m, p = Lo(v.attributes);
|
|
990
|
+
if (p) {
|
|
991
991
|
const [D] = await Er({
|
|
992
992
|
context: o,
|
|
993
993
|
tagName: v.tagName,
|
|
994
|
-
attributes:
|
|
994
|
+
attributes: p
|
|
995
995
|
});
|
|
996
996
|
if (D) return D;
|
|
997
997
|
} else {
|
|
@@ -1012,18 +1012,18 @@ function Lo(m) {
|
|
|
1012
1012
|
return Object.values(r).some((o) => o !== void 0 && o !== "") ? r : void 0;
|
|
1013
1013
|
}
|
|
1014
1014
|
async function ji(m) {
|
|
1015
|
-
const { dialecteConfig: r, hooks: s, context: o, query: f, ref: d, params: v } = m, { attributes:
|
|
1015
|
+
const { dialecteConfig: r, hooks: s, context: o, query: f, ref: d, params: v } = m, { attributes: p, value: D } = v, R = await me({ context: o, ref: d });
|
|
1016
1016
|
we(R, {
|
|
1017
1017
|
detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
|
|
1018
1018
|
key: "ELEMENT_NOT_FOUND",
|
|
1019
1019
|
ref: d
|
|
1020
1020
|
});
|
|
1021
1021
|
let K = R.attributes;
|
|
1022
|
-
if (
|
|
1022
|
+
if (p) {
|
|
1023
1023
|
const Y = bo({
|
|
1024
1024
|
dialecteConfig: r,
|
|
1025
1025
|
tagName: R.tagName,
|
|
1026
|
-
attributes:
|
|
1026
|
+
attributes: p
|
|
1027
1027
|
});
|
|
1028
1028
|
K = [...R.attributes.filter(
|
|
1029
1029
|
(M) => !Y.some((j) => j.name === M.name)
|
|
@@ -1145,14 +1145,14 @@ function Vo(m) {
|
|
|
1145
1145
|
};
|
|
1146
1146
|
}
|
|
1147
1147
|
async function $o(m) {
|
|
1148
|
-
const { stagedOperations: r, store: s, documentId: o, documentState: f } = m, { creates: d, updates: v, deletes:
|
|
1148
|
+
const { stagedOperations: r, store: s, documentId: o, documentState: f } = m, { creates: d, updates: v, deletes: p } = Vo(r), D = d.length + v.length + p.length;
|
|
1149
1149
|
f.loading = !0, f.progress = { message: "Committing changes...", current: 0, total: D };
|
|
1150
1150
|
try {
|
|
1151
1151
|
await s.commit({
|
|
1152
1152
|
documentId: o,
|
|
1153
1153
|
creates: d.map((R) => R.newRecord),
|
|
1154
1154
|
updates: v.map((R) => R.newRecord),
|
|
1155
|
-
deletes:
|
|
1155
|
+
deletes: p.map((R) => R.oldRecord.id),
|
|
1156
1156
|
onProgress: (R, K) => {
|
|
1157
1157
|
f.progress = { message: "Committing changes...", current: R, total: K };
|
|
1158
1158
|
}
|
|
@@ -1364,8 +1364,8 @@ class Wo {
|
|
|
1364
1364
|
progress: null,
|
|
1365
1365
|
history: [],
|
|
1366
1366
|
lastUpdate: null
|
|
1367
|
-
}, this.activeTransactions = 0, this.store = r, this.config = s, this.documentId = o, this.hooks = d, this.extensionsRegistry = f, this.channel = v, this.channel.onmessage = (
|
|
1368
|
-
|
|
1367
|
+
}, this.activeTransactions = 0, this.store = r, this.config = s, this.documentId = o, this.hooks = d, this.extensionsRegistry = f, this.channel = v, this.channel.onmessage = (p) => {
|
|
1368
|
+
p.data?.type === "commit" && p.data.documentId === this.documentId && (this.state.lastUpdate = p.data.timestamp ?? Date.now());
|
|
1369
1369
|
};
|
|
1370
1370
|
}
|
|
1371
1371
|
//== Query access (read-only, no mutations exposed)
|
|
@@ -1444,17 +1444,17 @@ class Wo {
|
|
|
1444
1444
|
const o = this.createTransaction();
|
|
1445
1445
|
try {
|
|
1446
1446
|
await r(this.withAllExtensions(o));
|
|
1447
|
-
} catch (
|
|
1447
|
+
} catch (p) {
|
|
1448
1448
|
throw this.activeTransactions--, this.state.loading = !1, this.state.error ?? $e("UNKNOWN", {
|
|
1449
|
-
detail:
|
|
1450
|
-
cause:
|
|
1449
|
+
detail: p instanceof Error ? p.message : String(p),
|
|
1450
|
+
cause: p instanceof Error ? p : void 0
|
|
1451
1451
|
});
|
|
1452
1452
|
}
|
|
1453
1453
|
this.activeTransactions--, this.state.loading = !1;
|
|
1454
1454
|
const f = o.getStagedOperations(), d = {
|
|
1455
|
-
creates: f.filter((
|
|
1456
|
-
updates: f.filter((
|
|
1457
|
-
deletes: f.filter((
|
|
1455
|
+
creates: f.filter((p) => p.status === "created").length,
|
|
1456
|
+
updates: f.filter((p) => p.status === "updated").length,
|
|
1457
|
+
deletes: f.filter((p) => p.status === "deleted").length
|
|
1458
1458
|
};
|
|
1459
1459
|
let v = !1;
|
|
1460
1460
|
return {
|
|
@@ -1473,10 +1473,10 @@ class Wo {
|
|
|
1473
1473
|
message: s?.label ?? "Changes committed",
|
|
1474
1474
|
timestamp: Date.now()
|
|
1475
1475
|
});
|
|
1476
|
-
} catch (
|
|
1476
|
+
} catch (p) {
|
|
1477
1477
|
throw this.state.error ?? $e("UNKNOWN", {
|
|
1478
|
-
detail:
|
|
1479
|
-
cause:
|
|
1478
|
+
detail: p instanceof Error ? p.message : String(p),
|
|
1479
|
+
cause: p instanceof Error ? p : void 0
|
|
1480
1480
|
});
|
|
1481
1481
|
} finally {
|
|
1482
1482
|
this.activeTransactions--, this.state.loading = !1;
|
|
@@ -1569,7 +1569,7 @@ function Zo() {
|
|
|
1569
1569
|
for (var i, a = 0, u = t.length; a < u; a++) !i && a in t || ((i = i || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
|
|
1570
1570
|
return e.concat(i || Array.prototype.slice.call(t));
|
|
1571
1571
|
}
|
|
1572
|
-
var d = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : zo, v = Object.keys,
|
|
1572
|
+
var d = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : zo, v = Object.keys, p = Array.isArray;
|
|
1573
1573
|
function D(e, t) {
|
|
1574
1574
|
return typeof t != "object" || v(t).forEach(function(n) {
|
|
1575
1575
|
e[n] = t[n];
|
|
@@ -1619,8 +1619,8 @@ function Zo() {
|
|
|
1619
1619
|
}
|
|
1620
1620
|
var h = t.indexOf(".");
|
|
1621
1621
|
if (h !== -1) {
|
|
1622
|
-
var
|
|
1623
|
-
return
|
|
1622
|
+
var g = e[t.substr(0, h)];
|
|
1623
|
+
return g == null ? void 0 : he(g, t.substr(h + 1));
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
function de(e, t, n) {
|
|
@@ -1628,8 +1628,8 @@ function Zo() {
|
|
|
1628
1628
|
Z(typeof n != "string" && "length" in n);
|
|
1629
1629
|
for (var i = 0, a = t.length; i < a; ++i) de(e, t[i], n[i]);
|
|
1630
1630
|
} else {
|
|
1631
|
-
var u, h,
|
|
1632
|
-
|
|
1631
|
+
var u, h, g = t.indexOf(".");
|
|
1632
|
+
g !== -1 ? (u = t.substr(0, g), (h = t.substr(g + 1)) === "" ? n === void 0 ? p(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : de(g = !(g = e[u]) || !B(e, u) ? e[u] = {} : g, h, n)) : n === void 0 ? p(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
1633
1633
|
}
|
|
1634
1634
|
}
|
|
1635
1635
|
function ve(e) {
|
|
@@ -1655,13 +1655,13 @@ function Zo() {
|
|
|
1655
1655
|
if (!n || typeof n != "object") return n;
|
|
1656
1656
|
var i = Ue.get(n);
|
|
1657
1657
|
if (i) return i;
|
|
1658
|
-
if (
|
|
1658
|
+
if (p(n)) {
|
|
1659
1659
|
i = [], Ue.set(n, i);
|
|
1660
1660
|
for (var a = 0, u = n.length; a < u; ++a) i.push(t(n[a]));
|
|
1661
1661
|
} else if (Bt.has(n.constructor)) i = n;
|
|
1662
1662
|
else {
|
|
1663
|
-
var h,
|
|
1664
|
-
for (h in i =
|
|
1663
|
+
var h, g = R(n);
|
|
1664
|
+
for (h in i = g === Object.prototype ? {} : Object.create(g), Ue.set(n, i), n) B(n, h) && (i[h] = t(n[h]));
|
|
1665
1665
|
}
|
|
1666
1666
|
return i;
|
|
1667
1667
|
})(e), Ue = null, e;
|
|
@@ -1683,7 +1683,7 @@ function Zo() {
|
|
|
1683
1683
|
function ke(e) {
|
|
1684
1684
|
var t, n, i, a;
|
|
1685
1685
|
if (arguments.length === 1) {
|
|
1686
|
-
if (
|
|
1686
|
+
if (p(e)) return e.slice();
|
|
1687
1687
|
if (this === Qe && typeof e == "string") return [e];
|
|
1688
1688
|
if (a = _e(e)) {
|
|
1689
1689
|
for (n = []; !(i = a.next()).done; ) n.push(i.value);
|
|
@@ -1824,8 +1824,8 @@ function Zo() {
|
|
|
1824
1824
|
if (i._state === null) {
|
|
1825
1825
|
if (u === i) throw new TypeError("A promise cannot be resolved with itself.");
|
|
1826
1826
|
var h = i._lib && At();
|
|
1827
|
-
u && typeof u.then == "function" ? n(i, function(
|
|
1828
|
-
u instanceof W ? u._then(
|
|
1827
|
+
u && typeof u.then == "function" ? n(i, function(g, b) {
|
|
1828
|
+
u instanceof W ? u._then(g, b) : u.then(g, b);
|
|
1829
1829
|
}) : (i._state = !0, i._value = u, Cr(i)), h && Dt();
|
|
1830
1830
|
}
|
|
1831
1831
|
}, Kn.bind(null, i));
|
|
@@ -1837,8 +1837,8 @@ function Zo() {
|
|
|
1837
1837
|
var Mn = { get: function() {
|
|
1838
1838
|
var e = H, t = cn;
|
|
1839
1839
|
function n(i, a) {
|
|
1840
|
-
var u = this, h = !e.global && (e !== H || t !== cn),
|
|
1841
|
-
qn(u, new Nr(Ar(i, e, h,
|
|
1840
|
+
var u = this, h = !e.global && (e !== H || t !== cn), g = h && !at(), b = new W(function(_, T) {
|
|
1841
|
+
qn(u, new Nr(Ar(i, e, h, g), Ar(a, e, h, g), _, T, e));
|
|
1842
1842
|
});
|
|
1843
1843
|
return this._consoleTask && (b._consoleTask = this._consoleTask), b;
|
|
1844
1844
|
}
|
|
@@ -1998,11 +1998,11 @@ function Zo() {
|
|
|
1998
1998
|
return ot(function(a, u) {
|
|
1999
1999
|
var h = H;
|
|
2000
2000
|
h.unhandleds = [], h.onunhandled = u, h.finalize = E(function() {
|
|
2001
|
-
var
|
|
2002
|
-
|
|
2001
|
+
var g, b = this;
|
|
2002
|
+
g = function() {
|
|
2003
2003
|
b.unhandleds.length === 0 ? a() : u(b.unhandleds[0]);
|
|
2004
2004
|
}, rn.push(function _() {
|
|
2005
|
-
|
|
2005
|
+
g(), rn.splice(rn.indexOf(_), 1);
|
|
2006
2006
|
}), ++pt, Kt(function() {
|
|
2007
2007
|
--pt == 0 && Ln();
|
|
2008
2008
|
}, []);
|
|
@@ -2030,10 +2030,10 @@ function Zo() {
|
|
|
2030
2030
|
e.length === 0 && n(new AggregateError([]));
|
|
2031
2031
|
var i = e.length, a = new Array(i);
|
|
2032
2032
|
e.forEach(function(u, h) {
|
|
2033
|
-
return W.resolve(u).then(function(
|
|
2034
|
-
return t(
|
|
2035
|
-
}, function(
|
|
2036
|
-
a[h] =
|
|
2033
|
+
return W.resolve(u).then(function(g) {
|
|
2034
|
+
return t(g);
|
|
2035
|
+
}, function(g) {
|
|
2036
|
+
a[h] = g, --i || n(new AggregateError(a));
|
|
2037
2037
|
});
|
|
2038
2038
|
});
|
|
2039
2039
|
});
|
|
@@ -2123,16 +2123,16 @@ function Zo() {
|
|
|
2123
2123
|
return t < e ? 1 : e < t ? -1 : 0;
|
|
2124
2124
|
case "binary":
|
|
2125
2125
|
return (function(a, u) {
|
|
2126
|
-
for (var h = a.length,
|
|
2127
|
-
return h ===
|
|
2126
|
+
for (var h = a.length, g = u.length, b = h < g ? h : g, _ = 0; _ < b; ++_) if (a[_] !== u[_]) return a[_] < u[_] ? -1 : 1;
|
|
2127
|
+
return h === g ? 0 : h < g ? -1 : 1;
|
|
2128
2128
|
})(Ir(e), Ir(t));
|
|
2129
2129
|
case "Array":
|
|
2130
2130
|
return (function(a, u) {
|
|
2131
|
-
for (var h = a.length,
|
|
2131
|
+
for (var h = a.length, g = u.length, b = h < g ? h : g, _ = 0; _ < b; ++_) {
|
|
2132
2132
|
var T = ae(a[_], u[_]);
|
|
2133
2133
|
if (T !== 0) return T;
|
|
2134
2134
|
}
|
|
2135
|
-
return h ===
|
|
2135
|
+
return h === g ? 0 : h < g ? -1 : 1;
|
|
2136
2136
|
})(e, t);
|
|
2137
2137
|
}
|
|
2138
2138
|
} catch {
|
|
@@ -2162,7 +2162,7 @@ function Zo() {
|
|
|
2162
2162
|
if (!y.schema[a]) throw new Q.NotFound("Table " + a + " not part of transaction");
|
|
2163
2163
|
return t(y.idbtrans, y);
|
|
2164
2164
|
}
|
|
2165
|
-
var
|
|
2165
|
+
var g = At();
|
|
2166
2166
|
try {
|
|
2167
2167
|
var b = i && i.db._novip === this.db._novip ? i === H.trans ? i._promise(e, h, n) : ot(function() {
|
|
2168
2168
|
return i._promise(e, h, n);
|
|
@@ -2203,7 +2203,7 @@ function Zo() {
|
|
|
2203
2203
|
return console.trace(_), Te(_);
|
|
2204
2204
|
})), b;
|
|
2205
2205
|
} finally {
|
|
2206
|
-
|
|
2206
|
+
g && Dt();
|
|
2207
2207
|
}
|
|
2208
2208
|
}, pe.prototype.get = function(e, t) {
|
|
2209
2209
|
var n = this;
|
|
@@ -2214,19 +2214,19 @@ function Zo() {
|
|
|
2214
2214
|
}).then(t);
|
|
2215
2215
|
}, pe.prototype.where = function(e) {
|
|
2216
2216
|
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
2217
|
-
if (
|
|
2217
|
+
if (p(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
|
|
2218
2218
|
var t = v(e);
|
|
2219
2219
|
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
|
|
2220
|
-
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(
|
|
2221
|
-
if (
|
|
2222
|
-
return 0 <=
|
|
2220
|
+
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(g) {
|
|
2221
|
+
if (g.compound && t.every(function(_) {
|
|
2222
|
+
return 0 <= g.keyPath.indexOf(_);
|
|
2223
2223
|
})) {
|
|
2224
|
-
for (var b = 0; b < t.length; ++b) if (t.indexOf(
|
|
2224
|
+
for (var b = 0; b < t.length; ++b) if (t.indexOf(g.keyPath[b]) === -1) return !1;
|
|
2225
2225
|
return !0;
|
|
2226
2226
|
}
|
|
2227
2227
|
return !1;
|
|
2228
|
-
}).sort(function(
|
|
2229
|
-
return
|
|
2228
|
+
}).sort(function(g, b) {
|
|
2229
|
+
return g.keyPath.length - b.keyPath.length;
|
|
2230
2230
|
})[0];
|
|
2231
2231
|
if (n && this.db._maxKey !== yt) {
|
|
2232
2232
|
var u = n.keyPath.slice(0, t.length);
|
|
@@ -2236,13 +2236,13 @@ function Zo() {
|
|
|
2236
2236
|
}
|
|
2237
2237
|
!n && Ce && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
|
|
2238
2238
|
var i = this.schema.idxByName;
|
|
2239
|
-
function a(
|
|
2240
|
-
return ae(
|
|
2239
|
+
function a(g, b) {
|
|
2240
|
+
return ae(g, b) === 0;
|
|
2241
2241
|
}
|
|
2242
2242
|
var h = t.reduce(function(y, b) {
|
|
2243
2243
|
var _ = y[0], T = y[1], y = i[b], O = e[b];
|
|
2244
2244
|
return [_ || y, _ || !y ? vt(T, y && y.multi ? function(w) {
|
|
2245
|
-
return w = he(w, b),
|
|
2245
|
+
return w = he(w, b), p(w) && w.some(function(x) {
|
|
2246
2246
|
return a(O, x);
|
|
2247
2247
|
});
|
|
2248
2248
|
} : function(w) {
|
|
@@ -2265,7 +2265,7 @@ function Zo() {
|
|
|
2265
2265
|
}, pe.prototype.toCollection = function() {
|
|
2266
2266
|
return new this.db.Collection(new this.db.WhereClause(this));
|
|
2267
2267
|
}, pe.prototype.orderBy = function(e) {
|
|
2268
|
-
return new this.db.Collection(new this.db.WhereClause(this,
|
|
2268
|
+
return new this.db.Collection(new this.db.WhereClause(this, p(e) ? "[".concat(e.join("+"), "]") : e));
|
|
2269
2269
|
}, pe.prototype.reverse = function() {
|
|
2270
2270
|
return this.toCollection().reverse();
|
|
2271
2271
|
}, pe.prototype.mapToClass = function(e) {
|
|
@@ -2287,7 +2287,7 @@ function Zo() {
|
|
|
2287
2287
|
for (var u = /* @__PURE__ */ new Set(), h = e.prototype; h; h = R(h)) Object.getOwnPropertyNames(h).forEach(function(b) {
|
|
2288
2288
|
return u.add(b);
|
|
2289
2289
|
});
|
|
2290
|
-
function
|
|
2290
|
+
function g(b) {
|
|
2291
2291
|
if (!b) return b;
|
|
2292
2292
|
var _, T = Object.create(e.prototype);
|
|
2293
2293
|
for (_ in b) if (!u.has(_)) try {
|
|
@@ -2296,38 +2296,38 @@ function Zo() {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
return T;
|
|
2298
2298
|
}
|
|
2299
|
-
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook =
|
|
2299
|
+
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = g, this.hook("reading", g), e;
|
|
2300
2300
|
}, pe.prototype.defineClass = function() {
|
|
2301
2301
|
return this.mapToClass(function(e) {
|
|
2302
2302
|
D(this, e);
|
|
2303
2303
|
});
|
|
2304
2304
|
}, pe.prototype.add = function(e, t) {
|
|
2305
2305
|
var n = this, i = this.schema.primKey, a = i.auto, u = i.keyPath, h = e;
|
|
2306
|
-
return u && a && (h = fn(u)(e)), this._trans("readwrite", function(
|
|
2307
|
-
return n.core.mutate({ trans:
|
|
2308
|
-
}).then(function(
|
|
2309
|
-
return
|
|
2310
|
-
}).then(function(
|
|
2306
|
+
return u && a && (h = fn(u)(e)), this._trans("readwrite", function(g) {
|
|
2307
|
+
return n.core.mutate({ trans: g, type: "add", keys: t != null ? [t] : null, values: [h] });
|
|
2308
|
+
}).then(function(g) {
|
|
2309
|
+
return g.numFailures ? W.reject(g.failures[0]) : g.lastResult;
|
|
2310
|
+
}).then(function(g) {
|
|
2311
2311
|
if (u) try {
|
|
2312
|
-
de(e, u,
|
|
2312
|
+
de(e, u, g);
|
|
2313
2313
|
} catch {
|
|
2314
2314
|
}
|
|
2315
|
-
return
|
|
2315
|
+
return g;
|
|
2316
2316
|
});
|
|
2317
2317
|
}, pe.prototype.update = function(e, t) {
|
|
2318
|
-
return typeof e != "object" ||
|
|
2318
|
+
return typeof e != "object" || p(e) ? this.where(":id").equals(e).modify(t) : (e = he(e, this.schema.primKey.keyPath), e === void 0 ? Te(new Q.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
2319
2319
|
}, pe.prototype.put = function(e, t) {
|
|
2320
2320
|
var n = this, i = this.schema.primKey, a = i.auto, u = i.keyPath, h = e;
|
|
2321
|
-
return u && a && (h = fn(u)(e)), this._trans("readwrite", function(
|
|
2322
|
-
return n.core.mutate({ trans:
|
|
2323
|
-
}).then(function(
|
|
2324
|
-
return
|
|
2325
|
-
}).then(function(
|
|
2321
|
+
return u && a && (h = fn(u)(e)), this._trans("readwrite", function(g) {
|
|
2322
|
+
return n.core.mutate({ trans: g, type: "put", values: [h], keys: t != null ? [t] : null });
|
|
2323
|
+
}).then(function(g) {
|
|
2324
|
+
return g.numFailures ? W.reject(g.failures[0]) : g.lastResult;
|
|
2325
|
+
}).then(function(g) {
|
|
2326
2326
|
if (u) try {
|
|
2327
|
-
de(e, u,
|
|
2327
|
+
de(e, u, g);
|
|
2328
2328
|
} catch {
|
|
2329
2329
|
}
|
|
2330
|
-
return
|
|
2330
|
+
return g;
|
|
2331
2331
|
});
|
|
2332
2332
|
}, pe.prototype.delete = function(e) {
|
|
2333
2333
|
var t = this;
|
|
@@ -2359,10 +2359,10 @@ function Zo() {
|
|
|
2359
2359
|
}, pe.prototype.bulkAdd = function(e, t, n) {
|
|
2360
2360
|
var i = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
2361
2361
|
return this._trans("readwrite", function(h) {
|
|
2362
|
-
var _ = i.schema.primKey,
|
|
2362
|
+
var _ = i.schema.primKey, g = _.auto, _ = _.keyPath;
|
|
2363
2363
|
if (_ && a) throw new Q.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
2364
2364
|
if (a && a.length !== e.length) throw new Q.InvalidArgument("Arguments objects and keys must have the same length");
|
|
2365
|
-
var b = e.length, _ = _ &&
|
|
2365
|
+
var b = e.length, _ = _ && g ? e.map(fn(_)) : e;
|
|
2366
2366
|
return i.core.mutate({ trans: h, type: "add", keys: a, values: _, wantResults: u }).then(function(x) {
|
|
2367
2367
|
var y = x.numFailures, O = x.results, w = x.lastResult, x = x.failures;
|
|
2368
2368
|
if (y === 0) return u ? O : w;
|
|
@@ -2372,10 +2372,10 @@ function Zo() {
|
|
|
2372
2372
|
}, pe.prototype.bulkPut = function(e, t, n) {
|
|
2373
2373
|
var i = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
2374
2374
|
return this._trans("readwrite", function(h) {
|
|
2375
|
-
var _ = i.schema.primKey,
|
|
2375
|
+
var _ = i.schema.primKey, g = _.auto, _ = _.keyPath;
|
|
2376
2376
|
if (_ && a) throw new Q.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
2377
2377
|
if (a && a.length !== e.length) throw new Q.InvalidArgument("Arguments objects and keys must have the same length");
|
|
2378
|
-
var b = e.length, _ = _ &&
|
|
2378
|
+
var b = e.length, _ = _ && g ? e.map(fn(_)) : e;
|
|
2379
2379
|
return i.core.mutate({ trans: h, type: "put", keys: a, values: _, wantResults: u }).then(function(x) {
|
|
2380
2380
|
var y = x.numFailures, O = x.results, w = x.lastResult, x = x.failures;
|
|
2381
2381
|
if (y === 0) return u ? O : w;
|
|
@@ -2389,10 +2389,10 @@ function Zo() {
|
|
|
2389
2389
|
return h.changes;
|
|
2390
2390
|
}), u = [];
|
|
2391
2391
|
return this._trans("readwrite", function(h) {
|
|
2392
|
-
return n.getMany({ trans: h, keys: i, cache: "clone" }).then(function(
|
|
2392
|
+
return n.getMany({ trans: h, keys: i, cache: "clone" }).then(function(g) {
|
|
2393
2393
|
var b = [], _ = [];
|
|
2394
2394
|
e.forEach(function(y, O) {
|
|
2395
|
-
var w = y.key, x = y.changes, C =
|
|
2395
|
+
var w = y.key, x = y.changes, C = g[O];
|
|
2396
2396
|
if (C) {
|
|
2397
2397
|
for (var N = 0, A = Object.keys(x); N < A.length; N++) {
|
|
2398
2398
|
var k = A[N], P = x[k];
|
|
@@ -2430,8 +2430,8 @@ function Zo() {
|
|
|
2430
2430
|
function pe() {
|
|
2431
2431
|
}
|
|
2432
2432
|
function Lt(e) {
|
|
2433
|
-
function t(h,
|
|
2434
|
-
if (
|
|
2433
|
+
function t(h, g) {
|
|
2434
|
+
if (g) {
|
|
2435
2435
|
for (var b = arguments.length, _ = new Array(b - 1); --b; ) _[b - 1] = arguments[b];
|
|
2436
2436
|
return n[h].subscribe.apply(null, _), e;
|
|
2437
2437
|
}
|
|
@@ -2441,22 +2441,22 @@ function Zo() {
|
|
|
2441
2441
|
t.addEventType = u;
|
|
2442
2442
|
for (var i = 1, a = arguments.length; i < a; ++i) u(arguments[i]);
|
|
2443
2443
|
return t;
|
|
2444
|
-
function u(h,
|
|
2444
|
+
function u(h, g, b) {
|
|
2445
2445
|
if (typeof h != "object") {
|
|
2446
2446
|
var _;
|
|
2447
|
-
|
|
2447
|
+
g = g || Re;
|
|
2448
2448
|
var T = { subscribers: [], fire: b = b || l, subscribe: function(y) {
|
|
2449
|
-
T.subscribers.indexOf(y) === -1 && (T.subscribers.push(y), T.fire =
|
|
2449
|
+
T.subscribers.indexOf(y) === -1 && (T.subscribers.push(y), T.fire = g(T.fire, y));
|
|
2450
2450
|
}, unsubscribe: function(y) {
|
|
2451
2451
|
T.subscribers = T.subscribers.filter(function(O) {
|
|
2452
2452
|
return O !== y;
|
|
2453
|
-
}), T.fire = T.subscribers.reduce(
|
|
2453
|
+
}), T.fire = T.subscribers.reduce(g, b);
|
|
2454
2454
|
} };
|
|
2455
2455
|
return n[h] = t[h] = T;
|
|
2456
2456
|
}
|
|
2457
2457
|
v(_ = h).forEach(function(y) {
|
|
2458
2458
|
var O = _[y];
|
|
2459
|
-
if (
|
|
2459
|
+
if (p(O)) u(y, _[y][0], _[y][1]);
|
|
2460
2460
|
else {
|
|
2461
2461
|
if (O !== "asap") throw new Q.InvalidArgument("Invalid event config");
|
|
2462
2462
|
var w = u(y, c, function() {
|
|
@@ -2499,35 +2499,35 @@ function Zo() {
|
|
|
2499
2499
|
function mn(e, t, n, i) {
|
|
2500
2500
|
var a = e.replayFilter ? vt(e.filter, e.replayFilter()) : e.filter;
|
|
2501
2501
|
if (e.or) {
|
|
2502
|
-
var u = {}, h = function(
|
|
2502
|
+
var u = {}, h = function(g, b, _) {
|
|
2503
2503
|
var T, y;
|
|
2504
2504
|
a && !a(b, _, function(O) {
|
|
2505
2505
|
return b.stop(O);
|
|
2506
2506
|
}, function(O) {
|
|
2507
2507
|
return b.fail(O);
|
|
2508
|
-
}) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), B(u, y) || (u[y] = !0, t(
|
|
2508
|
+
}) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), B(u, y) || (u[y] = !0, t(g, b, _)));
|
|
2509
2509
|
};
|
|
2510
2510
|
return Promise.all([e.or._iterate(h, n), Br(Fr(e, i, n), e.algorithm, h, !e.keysOnly && e.valueMapper)]);
|
|
2511
2511
|
}
|
|
2512
2512
|
return Br(Fr(e, i, n), vt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
|
|
2513
2513
|
}
|
|
2514
2514
|
function Br(e, t, n, i) {
|
|
2515
|
-
var a = ge(i ? function(u, h,
|
|
2516
|
-
return n(i(u), h,
|
|
2515
|
+
var a = ge(i ? function(u, h, g) {
|
|
2516
|
+
return n(i(u), h, g);
|
|
2517
2517
|
} : n);
|
|
2518
2518
|
return e.then(function(u) {
|
|
2519
2519
|
if (u) return u.start(function() {
|
|
2520
2520
|
var h = function() {
|
|
2521
2521
|
return u.continue();
|
|
2522
2522
|
};
|
|
2523
|
-
t && !t(u, function(
|
|
2524
|
-
return h =
|
|
2525
|
-
}, function(
|
|
2526
|
-
u.stop(
|
|
2527
|
-
}, function(
|
|
2528
|
-
u.fail(
|
|
2529
|
-
}) || a(u.value, u, function(
|
|
2530
|
-
return h =
|
|
2523
|
+
t && !t(u, function(g) {
|
|
2524
|
+
return h = g;
|
|
2525
|
+
}, function(g) {
|
|
2526
|
+
u.stop(g), h = l;
|
|
2527
|
+
}, function(g) {
|
|
2528
|
+
u.fail(g), h = l;
|
|
2529
|
+
}) || a(u.value, u, function(g) {
|
|
2530
|
+
return h = g;
|
|
2531
2531
|
}), h();
|
|
2532
2532
|
});
|
|
2533
2533
|
});
|
|
@@ -2536,7 +2536,7 @@ function Zo() {
|
|
|
2536
2536
|
var t = this["@@propmod"];
|
|
2537
2537
|
if (t.add !== void 0) {
|
|
2538
2538
|
var n = t.add;
|
|
2539
|
-
if (
|
|
2539
|
+
if (p(n)) return f(f([], p(e) ? e : [], !0), n).sort();
|
|
2540
2540
|
if (typeof n == "number") return (Number(e) || 0) + n;
|
|
2541
2541
|
if (typeof n == "bigint") try {
|
|
2542
2542
|
return BigInt(e) + n;
|
|
@@ -2547,7 +2547,7 @@ function Zo() {
|
|
|
2547
2547
|
}
|
|
2548
2548
|
if (t.remove !== void 0) {
|
|
2549
2549
|
var i = t.remove;
|
|
2550
|
-
if (
|
|
2550
|
+
if (p(i)) return p(e) ? e.filter(function(a) {
|
|
2551
2551
|
return !i.includes(a);
|
|
2552
2552
|
}).sort() : [];
|
|
2553
2553
|
if (typeof i == "number") return Number(e) - i;
|
|
@@ -2604,11 +2604,11 @@ function Zo() {
|
|
|
2604
2604
|
return _ ? u(b[n[_]], _ - 1) : b[i];
|
|
2605
2605
|
}
|
|
2606
2606
|
var h = this._ctx.dir === "next" ? 1 : -1;
|
|
2607
|
-
function
|
|
2607
|
+
function g(b, _) {
|
|
2608
2608
|
return ae(u(b, a), u(_, a)) * h;
|
|
2609
2609
|
}
|
|
2610
2610
|
return this.toArray(function(b) {
|
|
2611
|
-
return b.sort(
|
|
2611
|
+
return b.sort(g);
|
|
2612
2612
|
}).then(t);
|
|
2613
2613
|
}, ue.prototype.toArray = function(e) {
|
|
2614
2614
|
var t = this;
|
|
@@ -2616,13 +2616,13 @@ function Zo() {
|
|
|
2616
2616
|
var i = t._ctx;
|
|
2617
2617
|
if (i.dir === "next" && Rt(i, !0) && 0 < i.limit) {
|
|
2618
2618
|
var a = i.valueMapper, u = hn(i, i.table.core.schema);
|
|
2619
|
-
return i.table.core.query({ trans: n, limit: i.limit, values: !0, query: { index: u, range: i.range } }).then(function(
|
|
2620
|
-
return
|
|
2619
|
+
return i.table.core.query({ trans: n, limit: i.limit, values: !0, query: { index: u, range: i.range } }).then(function(g) {
|
|
2620
|
+
return g = g.result, a ? g.map(a) : g;
|
|
2621
2621
|
});
|
|
2622
2622
|
}
|
|
2623
2623
|
var h = [];
|
|
2624
|
-
return mn(i, function(
|
|
2625
|
-
return h.push(
|
|
2624
|
+
return mn(i, function(g) {
|
|
2625
|
+
return h.push(g);
|
|
2626
2626
|
}, n, i.table.core).then(function() {
|
|
2627
2627
|
return h;
|
|
2628
2628
|
});
|
|
@@ -2735,8 +2735,8 @@ function Zo() {
|
|
|
2735
2735
|
}
|
|
2736
2736
|
return k;
|
|
2737
2737
|
});
|
|
2738
|
-
var
|
|
2739
|
-
y && (T = typeof y == "object" ? y[
|
|
2738
|
+
var g = n.table.core, y = g.schema.primaryKey, b = y.outbound, _ = y.extractKey, T = 200, y = t.db._options.modifyChunkSize;
|
|
2739
|
+
y && (T = typeof y == "object" ? y[g.name] || y["*"] || 200 : y);
|
|
2740
2740
|
function O(A, F) {
|
|
2741
2741
|
var P = F.failures, F = F.numFailures;
|
|
2742
2742
|
x += A - F;
|
|
@@ -2749,21 +2749,21 @@ function Zo() {
|
|
|
2749
2749
|
return t.clone().primaryKeys().then(function(A) {
|
|
2750
2750
|
function k(F) {
|
|
2751
2751
|
var q = Math.min(T, A.length - F), V = A.slice(F, F + q);
|
|
2752
|
-
return (N ? Promise.resolve([]) :
|
|
2752
|
+
return (N ? Promise.resolve([]) : g.getMany({ trans: i, keys: V, cache: "immutable" })).then(function(L) {
|
|
2753
2753
|
var U = [], G = [], $ = b ? [] : null, X = N ? V : [];
|
|
2754
2754
|
if (!N) for (var re = 0; re < q; ++re) {
|
|
2755
2755
|
var se = L[re], te = { value: He(se), primKey: A[F + re] };
|
|
2756
2756
|
h.call(te, te.value, te) !== !1 && (te.value == null ? X.push(A[F + re]) : b || ae(_(se), _(te.value)) === 0 ? (G.push(te.value), b && $.push(A[F + re])) : (X.push(A[F + re]), U.push(te.value)));
|
|
2757
2757
|
}
|
|
2758
|
-
return Promise.resolve(0 < U.length &&
|
|
2758
|
+
return Promise.resolve(0 < U.length && g.mutate({ trans: i, type: "add", values: U }).then(function(Ee) {
|
|
2759
2759
|
for (var ee in Ee.failures) X.splice(parseInt(ee), 1);
|
|
2760
2760
|
O(U.length, Ee);
|
|
2761
2761
|
})).then(function() {
|
|
2762
|
-
return (0 < G.length || P && typeof e == "object") &&
|
|
2762
|
+
return (0 < G.length || P && typeof e == "object") && g.mutate({ trans: i, type: "put", keys: $, values: G, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < F }).then(function(Ee) {
|
|
2763
2763
|
return O(G.length, Ee);
|
|
2764
2764
|
});
|
|
2765
2765
|
}).then(function() {
|
|
2766
|
-
return (0 < X.length || P && N) &&
|
|
2766
|
+
return (0 < X.length || P && N) && g.mutate({ trans: i, type: "delete", keys: X, criteria: P, isAdditionalChunk: 0 < F }).then(function(Ee) {
|
|
2767
2767
|
return dn(n.table, X, Ee);
|
|
2768
2768
|
}).then(function(Ee) {
|
|
2769
2769
|
return O(X.length, Ee);
|
|
@@ -2786,9 +2786,9 @@ function Zo() {
|
|
|
2786
2786
|
var i = e.table.core.schema.primaryKey, a = t;
|
|
2787
2787
|
return e.table.core.count({ trans: n, query: { index: i, range: a } }).then(function(u) {
|
|
2788
2788
|
return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(b) {
|
|
2789
|
-
var
|
|
2790
|
-
if (b) throw new nt("Could not delete some values", Object.keys(
|
|
2791
|
-
return
|
|
2789
|
+
var g = b.failures, b = b.numFailures;
|
|
2790
|
+
if (b) throw new nt("Could not delete some values", Object.keys(g).map(function(_) {
|
|
2791
|
+
return g[_];
|
|
2792
2792
|
}), u - b);
|
|
2793
2793
|
return u - b;
|
|
2794
2794
|
});
|
|
@@ -2815,7 +2815,7 @@ function Zo() {
|
|
|
2815
2815
|
}).limit(0);
|
|
2816
2816
|
}
|
|
2817
2817
|
function pn(e, t, n, i) {
|
|
2818
|
-
var a, u, h,
|
|
2818
|
+
var a, u, h, g, b, _, T, y = n.length;
|
|
2819
2819
|
if (!n.every(function(x) {
|
|
2820
2820
|
return typeof x == "string";
|
|
2821
2821
|
})) return qe(e, Dr);
|
|
@@ -2834,14 +2834,14 @@ function Zo() {
|
|
|
2834
2834
|
}).sort(function(N, A) {
|
|
2835
2835
|
return h(N.lower, A.lower);
|
|
2836
2836
|
});
|
|
2837
|
-
|
|
2837
|
+
g = C.map(function(N) {
|
|
2838
2838
|
return N.upper;
|
|
2839
2839
|
}), b = C.map(function(N) {
|
|
2840
2840
|
return N.lower;
|
|
2841
2841
|
}), T = (_ = x) === "next" ? "" : i;
|
|
2842
2842
|
}
|
|
2843
2843
|
O("next"), e = new e.Collection(e, function() {
|
|
2844
|
-
return ct(
|
|
2844
|
+
return ct(g[0], b[y - 1] + i);
|
|
2845
2845
|
}), e._ondirectionchange = function(x) {
|
|
2846
2846
|
O(x);
|
|
2847
2847
|
};
|
|
@@ -2859,7 +2859,7 @@ function Zo() {
|
|
|
2859
2859
|
$(V[te], Ee) < 0 && (se = te);
|
|
2860
2860
|
}
|
|
2861
2861
|
return re < G.length && X === "next" ? V + U.substr(V.length) : re < V.length && X === "prev" ? V.substr(0, U.length) : se < 0 ? null : V.substr(0, se) + G[se] + U.substr(se + 1);
|
|
2862
|
-
})(A, k,
|
|
2862
|
+
})(A, k, g[F], b[F], h, _);
|
|
2863
2863
|
q === null && P === null ? w = F + 1 : (P === null || 0 < h(P, q)) && (P = q);
|
|
2864
2864
|
}
|
|
2865
2865
|
return C(P !== null ? function() {
|
|
@@ -2941,8 +2941,8 @@ function Zo() {
|
|
|
2941
2941
|
n = u === "next" ? e._ascending : e._descending, t.sort(n);
|
|
2942
2942
|
};
|
|
2943
2943
|
var a = 0;
|
|
2944
|
-
return i._addAlgorithm(function(u, h,
|
|
2945
|
-
for (var b = u.key; 0 < n(b, t[a]); ) if (++a === t.length) return h(
|
|
2944
|
+
return i._addAlgorithm(function(u, h, g) {
|
|
2945
|
+
for (var b = u.key; 0 < n(b, t[a]); ) if (++a === t.length) return h(g), !1;
|
|
2946
2946
|
return n(b, t[a]) === 0 || (h(function() {
|
|
2947
2947
|
u.continue(t[a]);
|
|
2948
2948
|
}), !1);
|
|
@@ -2962,7 +2962,7 @@ function Zo() {
|
|
|
2962
2962
|
}, null);
|
|
2963
2963
|
return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
|
|
2964
2964
|
}, Se.prototype.inAnyRange = function(A, t) {
|
|
2965
|
-
var n = this, i = this._cmp, a = this._ascending, u = this._descending, h = this._min,
|
|
2965
|
+
var n = this, i = this._cmp, a = this._ascending, u = this._descending, h = this._min, g = this._max;
|
|
2966
2966
|
if (A.length === 0) return It(this);
|
|
2967
2967
|
if (!A.every(function(k) {
|
|
2968
2968
|
return k[0] !== void 0 && k[1] !== void 0 && a(k[0], k[1]) <= 0;
|
|
@@ -2976,7 +2976,7 @@ function Zo() {
|
|
|
2976
2976
|
for (var F = 0, q = k.length; F < q; ++F) {
|
|
2977
2977
|
var V = k[F];
|
|
2978
2978
|
if (i(P[0], V[1]) < 0 && 0 < i(P[1], V[0])) {
|
|
2979
|
-
V[0] = h(V[0], P[0]), V[1] =
|
|
2979
|
+
V[0] = h(V[0], P[0]), V[1] = g(V[1], P[1]);
|
|
2980
2980
|
break;
|
|
2981
2981
|
}
|
|
2982
2982
|
}
|
|
@@ -3065,18 +3065,18 @@ function Zo() {
|
|
|
3065
3065
|
}, H]);
|
|
3066
3066
|
});
|
|
3067
3067
|
if (n) return ot(function() {
|
|
3068
|
-
var u = new W(function(h,
|
|
3068
|
+
var u = new W(function(h, g) {
|
|
3069
3069
|
i._lock();
|
|
3070
|
-
var b = t(h,
|
|
3071
|
-
b && b.then && b.then(h,
|
|
3070
|
+
var b = t(h, g, i);
|
|
3071
|
+
b && b.then && b.then(h, g);
|
|
3072
3072
|
});
|
|
3073
3073
|
return u.finally(function() {
|
|
3074
3074
|
return i._unlock();
|
|
3075
3075
|
}), u._lib = !0, u;
|
|
3076
3076
|
});
|
|
3077
3077
|
var a = new W(function(u, h) {
|
|
3078
|
-
var
|
|
3079
|
-
|
|
3078
|
+
var g = t(u, h, i);
|
|
3079
|
+
g && g.then && g.then(u, h);
|
|
3080
3080
|
});
|
|
3081
3081
|
return a._lib = !0, a;
|
|
3082
3082
|
}, Xe.prototype._root = function() {
|
|
@@ -3091,10 +3091,10 @@ function Zo() {
|
|
|
3091
3091
|
})());
|
|
3092
3092
|
var a = n._waitingFor;
|
|
3093
3093
|
return new W(function(u, h) {
|
|
3094
|
-
i.then(function(
|
|
3095
|
-
return n._waitingQueue.push(ge(u.bind(null,
|
|
3096
|
-
}, function(
|
|
3097
|
-
return n._waitingQueue.push(ge(h.bind(null,
|
|
3094
|
+
i.then(function(g) {
|
|
3095
|
+
return n._waitingQueue.push(ge(u.bind(null, g)));
|
|
3096
|
+
}, function(g) {
|
|
3097
|
+
return n._waitingQueue.push(ge(h.bind(null, g)));
|
|
3098
3098
|
}).finally(function() {
|
|
3099
3099
|
n._waitingFor === a && (n._waitingFor = null);
|
|
3100
3100
|
});
|
|
@@ -3110,8 +3110,8 @@ function Zo() {
|
|
|
3110
3110
|
}, Xe);
|
|
3111
3111
|
function Xe() {
|
|
3112
3112
|
}
|
|
3113
|
-
function Yn(e, t, n, i, a, u, h,
|
|
3114
|
-
return { name: e, keyPath: t, unique: n, multi: i, auto: a, compound: u, src: (n && !h ? "&" : "") + (i ? "*" : "") + (a ? "++" : "") + Lr(t), type:
|
|
3113
|
+
function Yn(e, t, n, i, a, u, h, g) {
|
|
3114
|
+
return { name: e, keyPath: t, unique: n, multi: i, auto: a, compound: u, src: (n && !h ? "&" : "") + (i ? "*" : "") + (a ? "++" : "") + Lr(t), type: g };
|
|
3115
3115
|
}
|
|
3116
3116
|
function Lr(e) {
|
|
3117
3117
|
return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
|
|
@@ -3274,19 +3274,19 @@ function Zo() {
|
|
|
3274
3274
|
});
|
|
3275
3275
|
} };
|
|
3276
3276
|
}
|
|
3277
|
-
var u, h,
|
|
3277
|
+
var u, h, g, T = (h = b, g = Ur((u = e).objectStoreNames), { schema: { name: u.name, tables: g.map(function(O) {
|
|
3278
3278
|
return h.objectStore(O);
|
|
3279
3279
|
}).map(function(O) {
|
|
3280
|
-
var w = O.keyPath, N = O.autoIncrement, x =
|
|
3280
|
+
var w = O.keyPath, N = O.autoIncrement, x = p(w), C = {}, N = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: w == null, compound: x, keyPath: w, autoIncrement: N, unique: !0, extractKey: Hn(w) }, indexes: Ur(O.indexNames).map(function(A) {
|
|
3281
3281
|
return O.index(A);
|
|
3282
3282
|
}).map(function(F) {
|
|
3283
|
-
var k = F.name, P = F.unique, q = F.multiEntry, F = F.keyPath, q = { name: k, compound:
|
|
3283
|
+
var k = F.name, P = F.unique, q = F.multiEntry, F = F.keyPath, q = { name: k, compound: p(F), keyPath: F, unique: P, multiEntry: q, extractKey: Hn(F) };
|
|
3284
3284
|
return C[Xt(F)] = q;
|
|
3285
3285
|
}), getIndexByKeyPath: function(A) {
|
|
3286
3286
|
return C[Xt(A)];
|
|
3287
3287
|
} };
|
|
3288
3288
|
return C[":id"] = N.primaryKey, w != null && (C[Xt(w)] = N.primaryKey), N;
|
|
3289
|
-
}) }, hasGetAll: 0 <
|
|
3289
|
+
}) }, hasGetAll: 0 < g.length && "getAll" in h.objectStore(g[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), b = T.schema, _ = T.hasGetAll, T = b.tables.map(a), y = {};
|
|
3290
3290
|
return T.forEach(function(O) {
|
|
3291
3291
|
return y[O.name] = O;
|
|
3292
3292
|
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(O) {
|
|
@@ -3313,10 +3313,10 @@ function Zo() {
|
|
|
3313
3313
|
n.forEach(function(a) {
|
|
3314
3314
|
var u = i[a];
|
|
3315
3315
|
t.forEach(function(h) {
|
|
3316
|
-
var
|
|
3316
|
+
var g = (function b(_, T) {
|
|
3317
3317
|
return z(_, T) || (_ = R(_)) && b(_, T);
|
|
3318
3318
|
})(h, a);
|
|
3319
|
-
(!
|
|
3319
|
+
(!g || "value" in g && g.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? M(h, a, { get: function() {
|
|
3320
3320
|
return this.table(a);
|
|
3321
3321
|
}, set: function(b) {
|
|
3322
3322
|
oe(this, a, { value: b, writable: !0, configurable: !0, enumerable: !0 });
|
|
@@ -3337,9 +3337,9 @@ function Zo() {
|
|
|
3337
3337
|
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = zn("$meta", $r("")[0], []), e._storeNames.push("$meta"));
|
|
3338
3338
|
var u = e._createTransaction("readwrite", e._storeNames, a);
|
|
3339
3339
|
u.create(n), u._completion.catch(i);
|
|
3340
|
-
var h = u._reject.bind(u),
|
|
3340
|
+
var h = u._reject.bind(u), g = H.transless || H;
|
|
3341
3341
|
ot(function() {
|
|
3342
|
-
return H.trans = u, H.transless =
|
|
3342
|
+
return H.trans = u, H.transless = g, t !== 0 ? (gn(e, n), _ = t, ((b = u).storeNames.includes("$meta") ? b.table("$meta").get("version").then(function(T) {
|
|
3343
3343
|
return T ?? _;
|
|
3344
3344
|
}) : W.resolve(_)).then(function(T) {
|
|
3345
3345
|
return O = T, w = u, x = n, C = [], T = (y = e)._versions, N = y._dbSchema = bn(0, y.idbdb, x), (T = T.filter(function(A) {
|
|
@@ -3408,9 +3408,9 @@ function Zo() {
|
|
|
3408
3408
|
for (var i = 0, a = Zn(n, e._dbSchema).change; i < a.length; i++) {
|
|
3409
3409
|
var u = (function(h) {
|
|
3410
3410
|
if (h.change.length || h.recreate) return console.warn("Unable to patch indexes of table ".concat(h.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
|
|
3411
|
-
var
|
|
3411
|
+
var g = t.objectStore(h.name);
|
|
3412
3412
|
h.add.forEach(function(b) {
|
|
3413
|
-
Ce && console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name, ".").concat(b.src)), vn(
|
|
3413
|
+
Ce && console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name, ".").concat(b.src)), vn(g, b);
|
|
3414
3414
|
});
|
|
3415
3415
|
})(a[i]);
|
|
3416
3416
|
if (typeof u == "object") return u.value;
|
|
@@ -3425,10 +3425,10 @@ function Zo() {
|
|
|
3425
3425
|
var h = { name: n, def: u, recreate: !1, del: [], add: [], change: [] };
|
|
3426
3426
|
if ("" + (a.primKey.keyPath || "") != "" + (u.primKey.keyPath || "") || a.primKey.auto !== u.primKey.auto) h.recreate = !0, i.change.push(h);
|
|
3427
3427
|
else {
|
|
3428
|
-
var
|
|
3429
|
-
for (_ in
|
|
3428
|
+
var g = a.idxByName, b = u.idxByName, _ = void 0;
|
|
3429
|
+
for (_ in g) b[_] || h.del.push(_);
|
|
3430
3430
|
for (_ in b) {
|
|
3431
|
-
var T =
|
|
3431
|
+
var T = g[_], y = b[_];
|
|
3432
3432
|
T ? T.src !== y.src && h.change.push(y) : h.add.push(y);
|
|
3433
3433
|
}
|
|
3434
3434
|
(0 < h.del.length || 0 < h.add.length || 0 < h.change.length) && i.change.push(h);
|
|
@@ -3454,19 +3454,19 @@ function Zo() {
|
|
|
3454
3454
|
function bn(e, t, n) {
|
|
3455
3455
|
var i = {};
|
|
3456
3456
|
return ye(t.objectStoreNames, 0).forEach(function(a) {
|
|
3457
|
-
for (var u = n.objectStore(a), h = Yn(Lr(_ = u.keyPath), _ || "", !0, !1, !!u.autoIncrement, _ && typeof _ != "string", !0),
|
|
3457
|
+
for (var u = n.objectStore(a), h = Yn(Lr(_ = u.keyPath), _ || "", !0, !1, !!u.autoIncrement, _ && typeof _ != "string", !0), g = [], b = 0; b < u.indexNames.length; ++b) {
|
|
3458
3458
|
var T = u.index(u.indexNames[b]), _ = T.keyPath, T = Yn(T.name, _, !!T.unique, !!T.multiEntry, !1, _ && typeof _ != "string", !1);
|
|
3459
|
-
|
|
3459
|
+
g.push(T);
|
|
3460
3460
|
}
|
|
3461
|
-
i[a] = zn(a, h,
|
|
3461
|
+
i[a] = zn(a, h, g);
|
|
3462
3462
|
}), i;
|
|
3463
3463
|
}
|
|
3464
3464
|
function wn(e, t, n) {
|
|
3465
3465
|
for (var i = n.db.objectStoreNames, a = 0; a < i.length; ++a) {
|
|
3466
3466
|
var u = i[a], h = n.objectStore(u);
|
|
3467
3467
|
e._hasGetAll = "getAll" in h;
|
|
3468
|
-
for (var
|
|
3469
|
-
var b = h.indexNames[
|
|
3468
|
+
for (var g = 0; g < h.indexNames.length; ++g) {
|
|
3469
|
+
var b = h.indexNames[g], _ = h.index(b).keyPath, T = typeof _ == "string" ? _ : "[" + ye(_).join("+") + "]";
|
|
3470
3470
|
!t[u] || (_ = t[u].idxByName[T]) && (_.name = b, delete t[u].idxByName[T], t[u].idxByName[b] = _);
|
|
3471
3471
|
}
|
|
3472
3472
|
}
|
|
@@ -3475,7 +3475,7 @@ function Zo() {
|
|
|
3475
3475
|
function $r(e) {
|
|
3476
3476
|
return e.split(",").map(function(t, n) {
|
|
3477
3477
|
var u = t.split(":"), i = (a = u[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = u[0].trim()).replace(/([&*]|\+\+)/g, ""), u = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
3478
|
-
return Yn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t),
|
|
3478
|
+
return Yn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), p(u), n === 0, i);
|
|
3479
3479
|
});
|
|
3480
3480
|
}
|
|
3481
3481
|
var so = (Pt.prototype._createTableSchema = zn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
|
|
@@ -3538,16 +3538,16 @@ function Zo() {
|
|
|
3538
3538
|
}
|
|
3539
3539
|
function zt(e, t) {
|
|
3540
3540
|
rr(t) || (function n(i, b) {
|
|
3541
|
-
var u = b.from, h = b.to,
|
|
3542
|
-
Yt(i, u, h),
|
|
3541
|
+
var u = b.from, h = b.to, g = b.l, b = b.r;
|
|
3542
|
+
Yt(i, u, h), g && n(i, g), b && n(i, b);
|
|
3543
3543
|
})(e, t);
|
|
3544
3544
|
}
|
|
3545
3545
|
function Gr(e, t) {
|
|
3546
3546
|
var n = _n(t), i = n.next();
|
|
3547
3547
|
if (i.done) return !1;
|
|
3548
|
-
for (var a = i.value, u = _n(e), h = u.next(a.from),
|
|
3549
|
-
if (ae(
|
|
3550
|
-
ae(a.from,
|
|
3548
|
+
for (var a = i.value, u = _n(e), h = u.next(a.from), g = h.value; !i.done && !h.done; ) {
|
|
3549
|
+
if (ae(g.from, a.to) <= 0 && 0 <= ae(g.to, a.from)) return !0;
|
|
3550
|
+
ae(a.from, g.from) < 0 ? a = (i = n.next(g.from)).value : g = (h = u.next(a.from)).value;
|
|
3551
3551
|
}
|
|
3552
3552
|
return !1;
|
|
3553
3553
|
}
|
|
@@ -3582,9 +3582,9 @@ function Zo() {
|
|
|
3582
3582
|
function En(e, t) {
|
|
3583
3583
|
return v(t).forEach(function(n) {
|
|
3584
3584
|
e[n] ? zt(e[n], t[n]) : e[n] = (function i(a) {
|
|
3585
|
-
var u, h,
|
|
3586
|
-
for (u in a) B(a, u) && (h = a[u],
|
|
3587
|
-
return
|
|
3585
|
+
var u, h, g = {};
|
|
3586
|
+
for (u in a) B(a, u) && (h = a[u], g[u] = !h || typeof h != "object" || Bt.has(h.constructor) ? h : i(h));
|
|
3587
|
+
return g;
|
|
3588
3588
|
})(t[n]);
|
|
3589
3589
|
}), e;
|
|
3590
3590
|
}
|
|
@@ -3619,8 +3619,8 @@ function Zo() {
|
|
|
3619
3619
|
var n = /* @__PURE__ */ new Set();
|
|
3620
3620
|
if (e.all) for (var i = 0, a = Object.values(bt); i < a.length; i++) Yr(h = a[i], e, n, t);
|
|
3621
3621
|
else for (var u in e) {
|
|
3622
|
-
var h,
|
|
3623
|
-
|
|
3622
|
+
var h, g = /^idb\:\/\/(.*)\/(.*)\//.exec(u);
|
|
3623
|
+
g && (u = g[1], g = g[2], (h = bt["idb://".concat(u, "/").concat(g)]) && Yr(h, e, n, t));
|
|
3624
3624
|
}
|
|
3625
3625
|
n.forEach(function(b) {
|
|
3626
3626
|
return b();
|
|
@@ -3628,7 +3628,7 @@ function Zo() {
|
|
|
3628
3628
|
}
|
|
3629
3629
|
function Yr(e, t, n, i) {
|
|
3630
3630
|
for (var a = [], u = 0, h = Object.entries(e.queries.query); u < h.length; u++) {
|
|
3631
|
-
for (var
|
|
3631
|
+
for (var g = h[u], b = g[0], _ = [], T = 0, y = g[1]; T < y.length; T++) {
|
|
3632
3632
|
var O = y[T];
|
|
3633
3633
|
ir(t, O.obsSet) ? O.subscribers.forEach(function(N) {
|
|
3634
3634
|
return n.add(N);
|
|
@@ -3651,7 +3651,7 @@ function Zo() {
|
|
|
3651
3651
|
function h() {
|
|
3652
3652
|
if (t.openCanceller !== i) throw new Q.DatabaseClosed("db.open() was cancelled");
|
|
3653
3653
|
}
|
|
3654
|
-
function
|
|
3654
|
+
function g() {
|
|
3655
3655
|
return new W(function(O, w) {
|
|
3656
3656
|
if (h(), !n) throw new Q.MissingAPI();
|
|
3657
3657
|
var x = e.name, C = t.autoSchema || !a ? n.open(x) : n.open(x, a);
|
|
@@ -3669,7 +3669,7 @@ function Zo() {
|
|
|
3669
3669
|
if (t.autoSchema) A = q, k = L, (N = e).verno = A.version / 10, k = N._dbSchema = bn(0, A, k), N._storeNames = ye(A.objectStoreNames, 0), yn(N, [N._allTables], v(k), k);
|
|
3670
3670
|
else if (wn(e, e._dbSchema, L), ((F = Zn(bn(0, (F = e).idbdb, L), F._dbSchema)).add.length || F.change.some(function(U) {
|
|
3671
3671
|
return U.add.length || U.change.length;
|
|
3672
|
-
})) && !u) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), q.close(), a = q.version + 1, u = !0, O(
|
|
3672
|
+
})) && !u) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), q.close(), a = q.version + 1, u = !0, O(g());
|
|
3673
3673
|
gn(e, L);
|
|
3674
3674
|
} catch {
|
|
3675
3675
|
}
|
|
@@ -3682,10 +3682,10 @@ function Zo() {
|
|
|
3682
3682
|
}).catch(function(O) {
|
|
3683
3683
|
switch (O?.name) {
|
|
3684
3684
|
case "UnknownError":
|
|
3685
|
-
if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"),
|
|
3685
|
+
if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), g();
|
|
3686
3686
|
break;
|
|
3687
3687
|
case "VersionError":
|
|
3688
|
-
if (0 < a) return a = 0,
|
|
3688
|
+
if (0 < a) return a = 0, g();
|
|
3689
3689
|
}
|
|
3690
3690
|
return W.reject(O);
|
|
3691
3691
|
});
|
|
@@ -3698,7 +3698,7 @@ function Zo() {
|
|
|
3698
3698
|
b = setInterval(w, 100), w();
|
|
3699
3699
|
}).finally(function() {
|
|
3700
3700
|
return clearInterval(b);
|
|
3701
|
-
}) : Promise.resolve()).then(
|
|
3701
|
+
}) : Promise.resolve()).then(g)]).then(function() {
|
|
3702
3702
|
return h(), t.onReadyBeingFired = [], W.resolve(nr(function() {
|
|
3703
3703
|
return e.on.ready.fire(e.vip);
|
|
3704
3704
|
})).then(function O() {
|
|
@@ -3738,14 +3738,14 @@ function Zo() {
|
|
|
3738
3738
|
});
|
|
3739
3739
|
function a(u) {
|
|
3740
3740
|
return function(b) {
|
|
3741
|
-
var
|
|
3742
|
-
return
|
|
3741
|
+
var g = u(b), b = g.value;
|
|
3742
|
+
return g.done ? b : b && typeof b.then == "function" ? b.then(n, i) : p(b) ? Promise.all(b).then(n, i) : n(b);
|
|
3743
3743
|
};
|
|
3744
3744
|
}
|
|
3745
3745
|
return a(t)();
|
|
3746
3746
|
}
|
|
3747
3747
|
function Tn(e, t, n) {
|
|
3748
|
-
for (var i =
|
|
3748
|
+
for (var i = p(e) ? e.slice() : [e], a = 0; a < n; ++a) i.push(t);
|
|
3749
3749
|
return i;
|
|
3750
3750
|
}
|
|
3751
3751
|
var uo = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
@@ -3758,8 +3758,8 @@ function Zo() {
|
|
|
3758
3758
|
}), A;
|
|
3759
3759
|
}
|
|
3760
3760
|
t = h(i.primaryKey.keyPath, 0, i.primaryKey), a[":id"] = [t];
|
|
3761
|
-
for (var
|
|
3762
|
-
var _ = b[
|
|
3761
|
+
for (var g = 0, b = i.indexes; g < b.length; g++) {
|
|
3762
|
+
var _ = b[g];
|
|
3763
3763
|
h(_.keyPath, 0, _);
|
|
3764
3764
|
}
|
|
3765
3765
|
function T(y) {
|
|
@@ -3796,8 +3796,8 @@ function Zo() {
|
|
|
3796
3796
|
} };
|
|
3797
3797
|
function ur(e, t, n, i) {
|
|
3798
3798
|
return n = n || {}, i = i || "", v(e).forEach(function(a) {
|
|
3799
|
-
var u, h,
|
|
3800
|
-
B(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (
|
|
3799
|
+
var u, h, g;
|
|
3800
|
+
B(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (g = jt(u)) !== jt(h) ? n[i + a] = t[a] : g === "Object" ? ur(u, h, n, i + a + ".") : u !== h && (n[i + a] = t[a]) : u !== h && (n[i + a] = t[a])) : n[i + a] = void 0;
|
|
3801
3801
|
}), v(t).forEach(function(a) {
|
|
3802
3802
|
B(e, a) || (n[i + a] = t[a]);
|
|
3803
3803
|
}), n;
|
|
@@ -3809,7 +3809,7 @@ function Zo() {
|
|
|
3809
3809
|
return o(o({}, e), { table: function(t) {
|
|
3810
3810
|
var n = e.table(t), i = n.schema.primaryKey;
|
|
3811
3811
|
return o(o({}, n), { mutate: function(a) {
|
|
3812
|
-
var u = H.trans, h = u.table(t).hook,
|
|
3812
|
+
var u = H.trans, h = u.table(t).hook, g = h.deleting, b = h.creating, _ = h.updating;
|
|
3813
3813
|
switch (a.type) {
|
|
3814
3814
|
case "add":
|
|
3815
3815
|
if (b.fire === l) break;
|
|
@@ -3822,12 +3822,12 @@ function Zo() {
|
|
|
3822
3822
|
return T(a);
|
|
3823
3823
|
}, !0);
|
|
3824
3824
|
case "delete":
|
|
3825
|
-
if (
|
|
3825
|
+
if (g.fire === l) break;
|
|
3826
3826
|
return u._promise("readwrite", function() {
|
|
3827
3827
|
return T(a);
|
|
3828
3828
|
}, !0);
|
|
3829
3829
|
case "deleteRange":
|
|
3830
|
-
if (
|
|
3830
|
+
if (g.fire === l) break;
|
|
3831
3831
|
return u._promise("readwrite", function() {
|
|
3832
3832
|
return (function y(O, w, x) {
|
|
3833
3833
|
return n.query({ trans: O, values: !1, query: { index: i, range: w }, limit: x }).then(function(C) {
|
|
@@ -3846,7 +3846,7 @@ function Zo() {
|
|
|
3846
3846
|
return (y = y.type === "add" || y.type === "put" ? o(o({}, y), { keys: N }) : o({}, y)).type !== "delete" && (y.values = f([], y.values)), y.keys && (y.keys = f([], y.keys)), O = n, x = N, ((w = y).type === "add" ? Promise.resolve([]) : O.getMany({ trans: w.trans, keys: x, cache: "immutable" })).then(function(A) {
|
|
3847
3847
|
var k = N.map(function(P, F) {
|
|
3848
3848
|
var q, V, L, U = A[F], G = { onerror: null, onsuccess: null };
|
|
3849
|
-
return y.type === "delete" ?
|
|
3849
|
+
return y.type === "delete" ? g.fire.call(G, P, U, C) : y.type === "add" || U === void 0 ? (q = b.fire.call(G, P, y.values[F], C), P == null && q != null && (y.keys[F] = P = q, i.outbound || de(y.values[F], i.keyPath, P))) : (q = ur(U, y.values[F]), (V = _.fire.call(G, q, P, U, C)) && (L = y.values[F], Object.keys(V).forEach(function($) {
|
|
3850
3850
|
B(L, $) ? L[$] = V[$] : de(L, $, V[$]);
|
|
3851
3851
|
}))), G;
|
|
3852
3852
|
});
|
|
@@ -3909,7 +3909,7 @@ function Zo() {
|
|
|
3909
3909
|
if (H.subscr && a !== "readonly") throw new Q.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(H.querier));
|
|
3910
3910
|
return e.transaction(i, a, u);
|
|
3911
3911
|
}, table: function(i) {
|
|
3912
|
-
var a = e.table(i), u = a.schema, h = u.primaryKey, y = u.indexes,
|
|
3912
|
+
var a = e.table(i), u = a.schema, h = u.primaryKey, y = u.indexes, g = h.extractKey, b = h.outbound, _ = h.autoIncrement && y.filter(function(w) {
|
|
3913
3913
|
return w.compound && w.keyPath.includes(h.keyPath);
|
|
3914
3914
|
}), T = o(o({}, a), { mutate: function(w) {
|
|
3915
3915
|
function x($) {
|
|
@@ -3918,13 +3918,13 @@ function Zo() {
|
|
|
3918
3918
|
var C, N, A, k = w.trans, P = w.mutatedParts || (w.mutatedParts = {}), F = x(""), q = x(":dels"), V = w.type, G = w.type === "deleteRange" ? [w.range] : w.type === "delete" ? [w.keys] : w.values.length < 50 ? [lr(h, w).filter(function($) {
|
|
3919
3919
|
return $;
|
|
3920
3920
|
}), w.values] : [], L = G[0], U = G[1], G = w.trans._cache;
|
|
3921
|
-
return
|
|
3921
|
+
return p(L) ? (F.addKeys(L), (G = V === "delete" || L.length === U.length ? zr(L, G) : null) || q.addKeys(L), (G || U) && (C = x, N = G, A = U, u.indexes.forEach(function($) {
|
|
3922
3922
|
var X = C($.name || "");
|
|
3923
3923
|
function re(te) {
|
|
3924
3924
|
return te != null ? $.extractKey(te) : null;
|
|
3925
3925
|
}
|
|
3926
3926
|
function se(te) {
|
|
3927
|
-
return $.multiEntry &&
|
|
3927
|
+
return $.multiEntry && p(te) ? te.forEach(function(Ee) {
|
|
3928
3928
|
return X.addKey(Ee);
|
|
3929
3929
|
}) : X.addKey(te);
|
|
3930
3930
|
}
|
|
@@ -3967,7 +3967,7 @@ function Zo() {
|
|
|
3967
3967
|
if (b && x.values) return q.then(function(re) {
|
|
3968
3968
|
return re = re.result, P.addKeys(re), U;
|
|
3969
3969
|
});
|
|
3970
|
-
var G = x.values ? U.result.map(
|
|
3970
|
+
var G = x.values ? U.result.map(g) : U.result;
|
|
3971
3971
|
(x.values ? P : F).addKeys(G);
|
|
3972
3972
|
} else if (w === "openCursor") {
|
|
3973
3973
|
var $ = U, X = x.values;
|
|
@@ -3995,9 +3995,9 @@ function Zo() {
|
|
|
3995
3995
|
if (n.numFailures === 0) return t;
|
|
3996
3996
|
if (t.type === "deleteRange") return null;
|
|
3997
3997
|
var i = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
|
|
3998
|
-
return n.numFailures === i ? null : (t = o({}, t),
|
|
3998
|
+
return n.numFailures === i ? null : (t = o({}, t), p(t.keys) && (t.keys = t.keys.filter(function(a, u) {
|
|
3999
3999
|
return !(u in n.failures);
|
|
4000
|
-
})), "values" in t &&
|
|
4000
|
+
})), "values" in t && p(t.values) && (t.values = t.values.filter(function(a, u) {
|
|
4001
4001
|
return !(u in n.failures);
|
|
4002
4002
|
})), t);
|
|
4003
4003
|
}
|
|
@@ -4007,11 +4007,11 @@ function Zo() {
|
|
|
4007
4007
|
}
|
|
4008
4008
|
function Jr(e, t, O, i, a, u) {
|
|
4009
4009
|
if (!O || O.length === 0) return e;
|
|
4010
|
-
var h = t.query.index,
|
|
4010
|
+
var h = t.query.index, g = h.multiEntry, b = t.query.range, _ = i.schema.primaryKey.extractKey, T = h.extractKey, y = (h.lowLevelIndex || h).extractKey, O = O.reduce(function(w, x) {
|
|
4011
4011
|
var C = w, N = [];
|
|
4012
4012
|
if (x.type === "add" || x.type === "put") for (var A = new Ie(), k = x.values.length - 1; 0 <= k; --k) {
|
|
4013
4013
|
var P, F = x.values[k], q = _(F);
|
|
4014
|
-
A.hasKey(q) || (P = T(F), (
|
|
4014
|
+
A.hasKey(q) || (P = T(F), (g && p(P) ? P.some(function($) {
|
|
4015
4015
|
return fr($, b);
|
|
4016
4016
|
}) : fr(P, b)) && (A.addKey(q), N.push(F)));
|
|
4017
4017
|
}
|
|
@@ -4090,7 +4090,7 @@ function Zo() {
|
|
|
4090
4090
|
var go = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
|
|
4091
4091
|
var t = e.schema.name;
|
|
4092
4092
|
return o(o({}, e), { transaction: function(n, i, a) {
|
|
4093
|
-
var u, h,
|
|
4093
|
+
var u, h, g = e.transaction(n, i, a);
|
|
4094
4094
|
return i === "readwrite" && (h = (u = new AbortController()).signal, a = function(b) {
|
|
4095
4095
|
return function() {
|
|
4096
4096
|
if (u.abort(), i === "readwrite") {
|
|
@@ -4098,16 +4098,16 @@ function Zo() {
|
|
|
4098
4098
|
var O = y[T], w = bt["idb://".concat(t, "/").concat(O)];
|
|
4099
4099
|
if (w) {
|
|
4100
4100
|
var x = e.table(O), C = w.optimisticOps.filter(function(X) {
|
|
4101
|
-
return X.trans ===
|
|
4101
|
+
return X.trans === g;
|
|
4102
4102
|
});
|
|
4103
|
-
if (
|
|
4103
|
+
if (g._explicit && b && g.mutatedParts) for (var N = 0, A = Object.values(w.queries.query); N < A.length; N++) for (var k = 0, P = (V = A[N]).slice(); k < P.length; k++) ir((L = P[k]).obsSet, g.mutatedParts) && (Ke(V, L), L.subscribers.forEach(function(X) {
|
|
4104
4104
|
return _.add(X);
|
|
4105
4105
|
}));
|
|
4106
4106
|
else if (0 < C.length) {
|
|
4107
4107
|
w.optimisticOps = w.optimisticOps.filter(function(X) {
|
|
4108
|
-
return X.trans !==
|
|
4108
|
+
return X.trans !== g;
|
|
4109
4109
|
});
|
|
4110
|
-
for (var F = 0, q = Object.values(w.queries.query); F < q.length; F++) for (var V, L, U, G = 0, $ = (V = q[F]).slice(); G < $.length; G++) (L = $[G]).res != null &&
|
|
4110
|
+
for (var F = 0, q = Object.values(w.queries.query); F < q.length; F++) for (var V, L, U, G = 0, $ = (V = q[F]).slice(); G < $.length; G++) (L = $[G]).res != null && g.mutatedParts && (b && !L.dirty ? (U = Object.isFrozen(L.res), U = Jr(L.res, L.req, C, x, L, U), L.dirty ? (Ke(V, L), L.subscribers.forEach(function(X) {
|
|
4111
4111
|
return _.add(X);
|
|
4112
4112
|
})) : U !== L.res && (L.res = U, L.promise = W.resolve({ result: U }))) : (L.dirty && Ke(V, L), L.subscribers.forEach(function(X) {
|
|
4113
4113
|
return _.add(X);
|
|
@@ -4120,31 +4120,31 @@ function Zo() {
|
|
|
4120
4120
|
});
|
|
4121
4121
|
}
|
|
4122
4122
|
};
|
|
4123
|
-
},
|
|
4123
|
+
}, g.addEventListener("abort", a(!1), { signal: h }), g.addEventListener("error", a(!1), { signal: h }), g.addEventListener("complete", a(!0), { signal: h })), g;
|
|
4124
4124
|
}, table: function(n) {
|
|
4125
4125
|
var i = e.table(n), a = i.schema.primaryKey;
|
|
4126
4126
|
return o(o({}, i), { mutate: function(u) {
|
|
4127
4127
|
var h = H.trans;
|
|
4128
4128
|
if (a.outbound || h.db._options.cache === "disabled" || h.explicit || h.idbtrans.mode !== "readwrite") return i.mutate(u);
|
|
4129
|
-
var
|
|
4130
|
-
return
|
|
4129
|
+
var g = bt["idb://".concat(t, "/").concat(n)];
|
|
4130
|
+
return g ? (h = i.mutate(u), u.type !== "add" && u.type !== "put" || !(50 <= u.values.length || lr(a, u).some(function(b) {
|
|
4131
4131
|
return b == null;
|
|
4132
|
-
})) ? (
|
|
4133
|
-
0 < b.numFailures && (Ke(
|
|
4132
|
+
})) ? (g.optimisticOps.push(u), u.mutatedParts && xn(u.mutatedParts), h.then(function(b) {
|
|
4133
|
+
0 < b.numFailures && (Ke(g.optimisticOps, u), (b = Zr(0, u, b)) && g.optimisticOps.push(b), u.mutatedParts && xn(u.mutatedParts));
|
|
4134
4134
|
}), h.catch(function() {
|
|
4135
|
-
Ke(
|
|
4135
|
+
Ke(g.optimisticOps, u), u.mutatedParts && xn(u.mutatedParts);
|
|
4136
4136
|
})) : h.then(function(b) {
|
|
4137
4137
|
var _ = Zr(0, o(o({}, u), { values: u.values.map(function(T, y) {
|
|
4138
4138
|
var O;
|
|
4139
4139
|
return b.failures[y] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? He(T) : o({}, T), de(T, a.keyPath, b.results[y]), T);
|
|
4140
4140
|
}) }), b);
|
|
4141
|
-
|
|
4141
|
+
g.optimisticOps.push(_), queueMicrotask(function() {
|
|
4142
4142
|
return u.mutatedParts && xn(u.mutatedParts);
|
|
4143
4143
|
});
|
|
4144
4144
|
}), h) : i.mutate(u);
|
|
4145
4145
|
}, query: function(u) {
|
|
4146
4146
|
if (!Hr(H, i) || !Qr("query", u)) return i.query(u);
|
|
4147
|
-
var h = ((_ = H.trans) === null || _ === void 0 ? void 0 : _.db._options.cache) === "immutable", y = H,
|
|
4147
|
+
var h = ((_ = H.trans) === null || _ === void 0 ? void 0 : _.db._options.cache) === "immutable", y = H, g = y.requery, b = y.signal, _ = (function(x, C, N, A) {
|
|
4148
4148
|
var k = bt["idb://".concat(x, "/").concat(C)];
|
|
4149
4149
|
if (!k) return [];
|
|
4150
4150
|
if (!(C = k.queries[N])) return [null, !1, k, null];
|
|
@@ -4173,7 +4173,7 @@ function Zo() {
|
|
|
4173
4173
|
return x;
|
|
4174
4174
|
}).catch(function(x) {
|
|
4175
4175
|
return w && T && Ke(w, T), Promise.reject(x);
|
|
4176
|
-
}), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), po(T, w,
|
|
4176
|
+
}), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), po(T, w, g, b), T.promise.then(function(x) {
|
|
4177
4177
|
return { result: Jr(x.result, u, O?.optimisticOps, i, T, h) };
|
|
4178
4178
|
});
|
|
4179
4179
|
} });
|
|
@@ -4242,11 +4242,11 @@ function Zo() {
|
|
|
4242
4242
|
return new W(function(a, u) {
|
|
4243
4243
|
function h() {
|
|
4244
4244
|
t.close(e);
|
|
4245
|
-
var
|
|
4246
|
-
|
|
4245
|
+
var g = t._deps.indexedDB.deleteDatabase(t.name);
|
|
4246
|
+
g.onsuccess = ge(function() {
|
|
4247
4247
|
var b, _, T;
|
|
4248
4248
|
b = t._deps, _ = t.name, T = b.indexedDB, b = b.IDBKeyRange, tr(T) || _ === ln || er(T, b).delete(_).catch(l), a();
|
|
4249
|
-
}),
|
|
4249
|
+
}), g.onerror = We(u), g.onblocked = t._fireOnBlocked;
|
|
4250
4250
|
}
|
|
4251
4251
|
if (n) throw new Q.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
4252
4252
|
i.isBeingOpened ? i.dbReadyPromise.then(h) : h();
|
|
@@ -4278,7 +4278,7 @@ function Zo() {
|
|
|
4278
4278
|
}, Ne.prototype._transaction = function(e, t, n) {
|
|
4279
4279
|
var i = this, a = H.trans;
|
|
4280
4280
|
a && a.db === this && e.indexOf("!") === -1 || (a = null);
|
|
4281
|
-
var u, h,
|
|
4281
|
+
var u, h, g = e.indexOf("?") !== -1;
|
|
4282
4282
|
e = e.replace("!", "").replace("?", "");
|
|
4283
4283
|
try {
|
|
4284
4284
|
if (h = t.map(function(_) {
|
|
@@ -4291,15 +4291,15 @@ function Zo() {
|
|
|
4291
4291
|
}
|
|
4292
4292
|
if (a) {
|
|
4293
4293
|
if (a.mode === Vn && u === $n) {
|
|
4294
|
-
if (!
|
|
4294
|
+
if (!g) throw new Q.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
4295
4295
|
a = null;
|
|
4296
4296
|
}
|
|
4297
4297
|
a && h.forEach(function(_) {
|
|
4298
4298
|
if (a && a.storeNames.indexOf(_) === -1) {
|
|
4299
|
-
if (!
|
|
4299
|
+
if (!g) throw new Q.SubTransaction("Table " + _ + " not included in parent transaction.");
|
|
4300
4300
|
a = null;
|
|
4301
4301
|
}
|
|
4302
|
-
}),
|
|
4302
|
+
}), g && a && !a.active && (a = null);
|
|
4303
4303
|
}
|
|
4304
4304
|
} catch (_) {
|
|
4305
4305
|
return a ? a._promise(null, function(T, y) {
|
|
@@ -4346,7 +4346,7 @@ function Zo() {
|
|
|
4346
4346
|
this._middlewares = {}, this.verno = 0;
|
|
4347
4347
|
var i = Ne.dependencies;
|
|
4348
4348
|
this._options = t = o({ addons: Ne.addons, autoOpen: !0, indexedDB: i.indexedDB, IDBKeyRange: i.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, i = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
4349
|
-
var a, u, h,
|
|
4349
|
+
var a, u, h, g, b, _ = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: l, dbReadyPromise: null, cancelOpen: l, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
4350
4350
|
_.dbReadyPromise = new W(function(y) {
|
|
4351
4351
|
_.dbReadyResolve = y;
|
|
4352
4352
|
}), _.openCanceller = new W(function(y, O) {
|
|
@@ -4392,8 +4392,8 @@ function Zo() {
|
|
|
4392
4392
|
var k = N.active;
|
|
4393
4393
|
return N.active = !1, N.on.error.fire(A), N.parent ? N.parent._reject(A) : k && N.idbtrans && N.idbtrans.abort(), Te(A);
|
|
4394
4394
|
});
|
|
4395
|
-
})), this.Version = (
|
|
4396
|
-
this.db =
|
|
4395
|
+
})), this.Version = (g = this, Ut(so.prototype, function(y) {
|
|
4396
|
+
this.db = g, this._cfg = { version: y, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
4397
4397
|
})), this.WhereClause = (b = this, Ut(qr.prototype, function(y, O, w) {
|
|
4398
4398
|
if (this.db = b, this._ctx = { table: y, index: O === ":id" ? null : O, or: w }, this._cmp = this._ascending = ae, this._descending = function(x, C) {
|
|
4399
4399
|
return ae(C, x);
|
|
@@ -4446,10 +4446,10 @@ function Zo() {
|
|
|
4446
4446
|
}
|
|
4447
4447
|
function ti(e) {
|
|
4448
4448
|
var t, n = !1, i = new yo(function(a) {
|
|
4449
|
-
var u = Tt(e), h,
|
|
4450
|
-
return
|
|
4449
|
+
var u = Tt(e), h, g = !1, b = {}, _ = {}, T = { get closed() {
|
|
4450
|
+
return g;
|
|
4451
4451
|
}, unsubscribe: function() {
|
|
4452
|
-
|
|
4452
|
+
g || (g = !0, h && h.abort(), y && ut.storagemutated.unsubscribe(w));
|
|
4453
4453
|
} };
|
|
4454
4454
|
a.start && a.start(T);
|
|
4455
4455
|
var y = !1, O = function() {
|
|
@@ -4458,7 +4458,7 @@ function Zo() {
|
|
|
4458
4458
|
En(b, C), ir(_, b) && O();
|
|
4459
4459
|
}, x = function() {
|
|
4460
4460
|
var C, N, A;
|
|
4461
|
-
!
|
|
4461
|
+
!g && Cn.indexedDB && (b = {}, C = {}, h && h.abort(), h = new AbortController(), A = (function(k) {
|
|
4462
4462
|
var P = At();
|
|
4463
4463
|
try {
|
|
4464
4464
|
u && St();
|
|
@@ -4468,15 +4468,15 @@ function Zo() {
|
|
|
4468
4468
|
P && Dt();
|
|
4469
4469
|
}
|
|
4470
4470
|
})(N = { subscr: C, signal: h.signal, requery: O, querier: e, trans: null }), Promise.resolve(A).then(function(k) {
|
|
4471
|
-
n = !0, t = k,
|
|
4471
|
+
n = !0, t = k, g || N.signal.aborted || (b = {}, (function(P) {
|
|
4472
4472
|
for (var F in P) if (B(P, F)) return;
|
|
4473
4473
|
return 1;
|
|
4474
4474
|
})(_ = C) || y || (ut(Gt, w), y = !0), Un(function() {
|
|
4475
|
-
return !
|
|
4475
|
+
return !g && a.next && a.next(k);
|
|
4476
4476
|
}));
|
|
4477
4477
|
}, function(k) {
|
|
4478
|
-
n = !1, ["DatabaseClosedError", "AbortError"].includes(k?.name) ||
|
|
4479
|
-
|
|
4478
|
+
n = !1, ["DatabaseClosedError", "AbortError"].includes(k?.name) || g || Un(function() {
|
|
4479
|
+
g || a.error && a.error(k);
|
|
4480
4480
|
});
|
|
4481
4481
|
}));
|
|
4482
4482
|
};
|
|
@@ -4696,8 +4696,8 @@ class ta {
|
|
|
4696
4696
|
const { creates: o, updates: f, deletes: d } = s, v = this.db.table(this.resolveTableName(r));
|
|
4697
4697
|
await this.db.transaction("rw", v, async () => {
|
|
4698
4698
|
if (o?.length && await v.bulkAdd(o), f?.length)
|
|
4699
|
-
for (const { recordId:
|
|
4700
|
-
const R = await v.get(
|
|
4699
|
+
for (const { recordId: p, ...D } of f) {
|
|
4700
|
+
const R = await v.get(p);
|
|
4701
4701
|
if (!R) continue;
|
|
4702
4702
|
const K = { ...D };
|
|
4703
4703
|
if (D.attributes) {
|
|
@@ -4716,25 +4716,25 @@ class ta {
|
|
|
4716
4716
|
}
|
|
4717
4717
|
K.children = B;
|
|
4718
4718
|
}
|
|
4719
|
-
await v.update(
|
|
4719
|
+
await v.update(p, K);
|
|
4720
4720
|
}
|
|
4721
4721
|
d?.length && await v.bulkDelete(d);
|
|
4722
4722
|
});
|
|
4723
4723
|
}
|
|
4724
4724
|
async commit(r) {
|
|
4725
|
-
const { documentId: s, creates: o, updates: f, deletes: d, onProgress: v } = r,
|
|
4725
|
+
const { documentId: s, creates: o, updates: f, deletes: d, onProgress: v } = r, p = this.db.table(this.resolveTableName(s)), D = o.length + f.length + d.length;
|
|
4726
4726
|
let R = 0;
|
|
4727
4727
|
try {
|
|
4728
4728
|
await this.db.transaction(
|
|
4729
4729
|
"rw",
|
|
4730
|
-
|
|
4730
|
+
p,
|
|
4731
4731
|
this.db.table(Ye),
|
|
4732
4732
|
this.db.table(ze),
|
|
4733
4733
|
async () => {
|
|
4734
|
-
const K = f.length > 0 ? await
|
|
4734
|
+
const K = f.length > 0 ? await p.bulkGet(f.map((z) => z.id)) : [], B = d.length > 0 ? await p.bulkGet(d) : [];
|
|
4735
4735
|
if (o.length > 0)
|
|
4736
4736
|
try {
|
|
4737
|
-
await
|
|
4737
|
+
await p.bulkAdd(o), R += o.length, v(R, D);
|
|
4738
4738
|
} catch (z) {
|
|
4739
4739
|
$e("STORE_BULK_ADD_FAILED", {
|
|
4740
4740
|
detail: z instanceof Error ? z.message : String(z),
|
|
@@ -4743,7 +4743,7 @@ class ta {
|
|
|
4743
4743
|
}
|
|
4744
4744
|
if (f.length > 0)
|
|
4745
4745
|
try {
|
|
4746
|
-
await
|
|
4746
|
+
await p.bulkPut(f), R += f.length, v(R, D);
|
|
4747
4747
|
} catch (z) {
|
|
4748
4748
|
$e("STORE_BULK_UPDATE_FAILED", {
|
|
4749
4749
|
detail: z instanceof Error ? z.message : String(z),
|
|
@@ -4752,7 +4752,7 @@ class ta {
|
|
|
4752
4752
|
}
|
|
4753
4753
|
if (d.length > 0)
|
|
4754
4754
|
try {
|
|
4755
|
-
await
|
|
4755
|
+
await p.bulkDelete(d), R += d.length, v(R, D);
|
|
4756
4756
|
} catch (z) {
|
|
4757
4757
|
$e("STORE_DELETE_FAILED", {
|
|
4758
4758
|
detail: z instanceof Error ? z.message : String(z),
|
|
@@ -4794,8 +4794,8 @@ class ta {
|
|
|
4794
4794
|
if (!o) return;
|
|
4795
4795
|
const f = this.db.table(this.resolveTableName(r));
|
|
4796
4796
|
await this.db.transaction("rw", f, this.db.table(ze), async () => {
|
|
4797
|
-
const { creates: d, updates: v, deletes:
|
|
4798
|
-
d.length > 0 && await f.bulkDelete(d.map((D) => D.id)), v.length > 0 && await f.bulkPut(v.map((D) => D.before)),
|
|
4797
|
+
const { creates: d, updates: v, deletes: p } = o.operations;
|
|
4798
|
+
d.length > 0 && await f.bulkDelete(d.map((D) => D.id)), v.length > 0 && await f.bulkPut(v.map((D) => D.before)), p.length > 0 && await f.bulkAdd(p), await this.setHead(r, s - 1);
|
|
4799
4799
|
});
|
|
4800
4800
|
}
|
|
4801
4801
|
async redo(r) {
|
|
@@ -4803,8 +4803,8 @@ class ta {
|
|
|
4803
4803
|
if (!f) return;
|
|
4804
4804
|
const d = this.db.table(this.resolveTableName(r));
|
|
4805
4805
|
await this.db.transaction("rw", d, this.db.table(ze), async () => {
|
|
4806
|
-
const { creates: v, updates:
|
|
4807
|
-
v.length > 0 && await d.bulkAdd(v),
|
|
4806
|
+
const { creates: v, updates: p, deletes: D } = f.operations;
|
|
4807
|
+
v.length > 0 && await d.bulkAdd(v), p.length > 0 && await d.bulkPut(p.map((R) => R.after)), D.length > 0 && await d.bulkDelete(D.map((R) => R.id)), await this.setHead(r, o);
|
|
4808
4808
|
});
|
|
4809
4809
|
}
|
|
4810
4810
|
async getChangeLog(r) {
|
|
@@ -4872,13 +4872,13 @@ function ra() {
|
|
|
4872
4872
|
r.ParsingError = s;
|
|
4873
4873
|
let o;
|
|
4874
4874
|
function f() {
|
|
4875
|
-
return D(!1) || Y() || B() || K() ||
|
|
4875
|
+
return D(!1) || Y() || B() || K() || p();
|
|
4876
4876
|
}
|
|
4877
4877
|
function d() {
|
|
4878
|
-
return j(/\s*/), D(!0) || B() || R() ||
|
|
4878
|
+
return j(/\s*/), D(!0) || B() || R() || p();
|
|
4879
4879
|
}
|
|
4880
4880
|
function v() {
|
|
4881
|
-
const ne =
|
|
4881
|
+
const ne = p(), Z = [];
|
|
4882
4882
|
let J, he = d();
|
|
4883
4883
|
for (; he; ) {
|
|
4884
4884
|
if (he.node.type === "Element") {
|
|
@@ -4898,7 +4898,7 @@ function ra() {
|
|
|
4898
4898
|
children: Z
|
|
4899
4899
|
};
|
|
4900
4900
|
}
|
|
4901
|
-
function
|
|
4901
|
+
function p() {
|
|
4902
4902
|
const ne = j(/^<\?([\w-:.]+)\s*/);
|
|
4903
4903
|
if (!ne)
|
|
4904
4904
|
return;
|
|
@@ -5067,7 +5067,7 @@ function ia() {
|
|
|
5067
5067
|
function v(M, j) {
|
|
5068
5068
|
M.content += j;
|
|
5069
5069
|
}
|
|
5070
|
-
function
|
|
5070
|
+
function p(M, j, z) {
|
|
5071
5071
|
if (M.type === "Element")
|
|
5072
5072
|
K(M, j, z);
|
|
5073
5073
|
else if (M.type === "ProcessingInstruction")
|
|
@@ -5106,7 +5106,7 @@ function ia() {
|
|
|
5106
5106
|
}), Z && (!he || !J) && (ye = !0);
|
|
5107
5107
|
}
|
|
5108
5108
|
ie.forEach(function(Z) {
|
|
5109
|
-
|
|
5109
|
+
p(Z, j, z || ye);
|
|
5110
5110
|
}), j.level--, !z && !ye && f(j), ne && d(j), v(j, "</" + M.name + ">");
|
|
5111
5111
|
}
|
|
5112
5112
|
j.path.pop();
|
|
@@ -5131,7 +5131,7 @@ function ia() {
|
|
|
5131
5131
|
try {
|
|
5132
5132
|
const z = (0, o.default)(M, { filter: j.filter, strictMode: j.strictMode }), ie = { content: "", level: 0, options: j, path: [] };
|
|
5133
5133
|
return z.declaration && Y(z.declaration, ie), z.children.forEach(function(ye) {
|
|
5134
|
-
|
|
5134
|
+
p(ye, ie, !1);
|
|
5135
5135
|
}), j.lineSeparator ? ie.content.replace(/\r\n/g, `
|
|
5136
5136
|
`).replace(/\n/g, j.lineSeparator) : ie.content;
|
|
5137
5137
|
} catch (z) {
|
|
@@ -5150,8 +5150,8 @@ function sa(m) {
|
|
|
5150
5150
|
}
|
|
5151
5151
|
const Ki = "_temp-idb-id";
|
|
5152
5152
|
async function ca(m) {
|
|
5153
|
-
const { extension: r, xmlDocument: s, filename: o } = m,
|
|
5154
|
-
` + new XMLSerializer().serializeToString(s), D = sa(
|
|
5153
|
+
const { extension: r, xmlDocument: s, filename: o } = m, p = `<?xml version="1.0" encoding="UTF-8"?>
|
|
5154
|
+
` + new XMLSerializer().serializeToString(s), D = sa(p), R = new Blob([D], { type: "application/xml" });
|
|
5155
5155
|
if ("showSaveFilePicker" in window)
|
|
5156
5156
|
try {
|
|
5157
5157
|
const B = await (await window.showSaveFilePicker({
|
|
@@ -5181,39 +5181,39 @@ function ua(m) {
|
|
|
5181
5181
|
detail: `No ${s.rootElementName} root element found in records`,
|
|
5182
5182
|
key: "EXPORT_ROOT_NOT_FOUND"
|
|
5183
5183
|
});
|
|
5184
|
-
const v = s.namespaces.default,
|
|
5184
|
+
const v = s.namespaces.default, p = document.implementation.createDocument(v.uri, null, null), D = p.createElementNS(d.namespace.uri, d.tagName);
|
|
5185
5185
|
return D.setAttribute("xmlns", d.namespace.uri), d.attributes && Li({
|
|
5186
5186
|
config: s,
|
|
5187
|
-
document:
|
|
5187
|
+
document: p,
|
|
5188
5188
|
element: D,
|
|
5189
5189
|
attributes: d.attributes,
|
|
5190
5190
|
tagName: d.tagName,
|
|
5191
5191
|
isRoot: !0
|
|
5192
|
-
}), Vi({ config: s, rootElement: D, namespace: d.namespace }), d.value && (D.textContent = d.value.trim()), o && D.setAttribute(Ki, d.id),
|
|
5192
|
+
}), Vi({ config: s, rootElement: D, namespace: d.namespace }), d.value && (D.textContent = d.value.trim()), o && D.setAttribute(Ki, d.id), p.appendChild(D), qi({
|
|
5193
5193
|
index: f,
|
|
5194
5194
|
config: s,
|
|
5195
5195
|
withDatabaseIds: o,
|
|
5196
|
-
xmlDocument:
|
|
5196
|
+
xmlDocument: p,
|
|
5197
5197
|
parentRecord: d,
|
|
5198
5198
|
parentElement: D
|
|
5199
|
-
}),
|
|
5199
|
+
}), p;
|
|
5200
5200
|
}
|
|
5201
5201
|
function qi(m) {
|
|
5202
5202
|
const { index: r, config: s, withDatabaseIds: o, xmlDocument: f, parentRecord: d, parentElement: v } = m;
|
|
5203
5203
|
if (!d.children || d.children.length === 0) return;
|
|
5204
|
-
const
|
|
5204
|
+
const p = [];
|
|
5205
5205
|
for (const R of d.children) {
|
|
5206
5206
|
const K = r.get(R.id);
|
|
5207
5207
|
we(K, {
|
|
5208
5208
|
detail: `Parent '${d.tagName}' references non-existent child '${R.tagName}' (id: ${R.id})`,
|
|
5209
5209
|
key: "EXPORT_ORPHAN_CHILD_REF",
|
|
5210
5210
|
ref: { tagName: d.tagName, id: d.id }
|
|
5211
|
-
}),
|
|
5211
|
+
}), p.push(K);
|
|
5212
5212
|
}
|
|
5213
5213
|
const D = fa({
|
|
5214
5214
|
parentTagName: d.tagName,
|
|
5215
5215
|
availableChildren: s.children,
|
|
5216
|
-
childrenRecords:
|
|
5216
|
+
childrenRecords: p
|
|
5217
5217
|
});
|
|
5218
5218
|
for (const R of D) {
|
|
5219
5219
|
const K = la({
|
|
@@ -5235,33 +5235,36 @@ function qi(m) {
|
|
|
5235
5235
|
}
|
|
5236
5236
|
function la(m) {
|
|
5237
5237
|
const { config: r, document: s, record: o, defaultNamespace: f, withDatabaseIds: d } = m, v = o.namespace.uri === f.uri;
|
|
5238
|
-
let
|
|
5239
|
-
return !v && o.namespace.prefix && o.namespace.prefix !== "xmlns" ? (Ui({ config: r, document: s, namespace: o.namespace }),
|
|
5238
|
+
let p;
|
|
5239
|
+
return !v && o.namespace.prefix && o.namespace.prefix !== "xmlns" ? (Ui({ config: r, document: s, namespace: o.namespace }), p = s.createElementNS(
|
|
5240
5240
|
o.namespace.uri,
|
|
5241
5241
|
`${o.namespace.prefix}:${o.tagName}`
|
|
5242
|
-
)) :
|
|
5242
|
+
)) : p = s.createElementNS(o.namespace.uri, o.tagName), o.attributes && Li({
|
|
5243
5243
|
config: r,
|
|
5244
5244
|
document: s,
|
|
5245
|
-
element:
|
|
5245
|
+
element: p,
|
|
5246
5246
|
attributes: o.attributes,
|
|
5247
5247
|
tagName: o.tagName,
|
|
5248
5248
|
isRoot: !1
|
|
5249
|
-
}), o.value && (
|
|
5249
|
+
}), o.value && (p.textContent = o.value.trim()), d && p.setAttribute(Ki, o.id), p;
|
|
5250
5250
|
}
|
|
5251
5251
|
function Li(m) {
|
|
5252
5252
|
const { config: r, document: s, element: o, attributes: f, tagName: d, isRoot: v } = m;
|
|
5253
|
-
for (const
|
|
5254
|
-
if (da(
|
|
5255
|
-
|
|
5256
|
-
|
|
5253
|
+
for (const p of f) {
|
|
5254
|
+
if (da(p)) continue;
|
|
5255
|
+
const D = p.value;
|
|
5256
|
+
if (!v && !D && ha({ config: r, tagName: d, attribute: p }))
|
|
5257
|
+
continue;
|
|
5258
|
+
if (!Gi(p) || !p.namespace.prefix) {
|
|
5259
|
+
o.setAttribute(p.name, String(p.value));
|
|
5257
5260
|
continue;
|
|
5258
5261
|
}
|
|
5259
|
-
v || Ui({ config: r, document: s, namespace:
|
|
5260
|
-
const
|
|
5262
|
+
v || Ui({ config: r, document: s, namespace: p.namespace });
|
|
5263
|
+
const R = $i(p.name);
|
|
5261
5264
|
o.setAttributeNS(
|
|
5262
|
-
|
|
5263
|
-
`${
|
|
5264
|
-
String(
|
|
5265
|
+
p.namespace.uri,
|
|
5266
|
+
`${p.namespace.prefix}:${R}`,
|
|
5267
|
+
String(p.value)
|
|
5265
5268
|
);
|
|
5266
5269
|
}
|
|
5267
5270
|
}
|
|
@@ -5274,16 +5277,16 @@ function Ui(m) {
|
|
|
5274
5277
|
function Vi(m) {
|
|
5275
5278
|
const { config: r, rootElement: s, namespace: o } = m, f = Object.entries(
|
|
5276
5279
|
r.definition[r.rootElementName].attributes.details
|
|
5277
|
-
).filter(([v,
|
|
5280
|
+
).filter(([v, p]) => o.uri === r.namespaces.default.uri ? !p.namespace : p.namespace?.prefix === o.prefix && p.namespace?.uri === o.uri);
|
|
5278
5281
|
if (f.length > 0)
|
|
5279
|
-
for (const [v,
|
|
5282
|
+
for (const [v, p] of f) {
|
|
5280
5283
|
const D = $i(v);
|
|
5281
|
-
if (!(
|
|
5282
|
-
if (
|
|
5283
|
-
const K = `${
|
|
5284
|
-
s.setAttributeNS(
|
|
5284
|
+
if (!(p.namespace ? s.hasAttributeNS(p.namespace.uri, D) : s.hasAttribute(D)))
|
|
5285
|
+
if (p.namespace) {
|
|
5286
|
+
const K = `${p.namespace.prefix}:${D}`;
|
|
5287
|
+
s.setAttributeNS(p.namespace.uri, K, p.default || "");
|
|
5285
5288
|
} else
|
|
5286
|
-
s.setAttribute(D,
|
|
5289
|
+
s.setAttribute(D, p.default || "");
|
|
5287
5290
|
}
|
|
5288
5291
|
}
|
|
5289
5292
|
function fa(m) {
|
|
@@ -5294,12 +5297,12 @@ function fa(m) {
|
|
|
5294
5297
|
d.set(D, []);
|
|
5295
5298
|
for (const D of o)
|
|
5296
5299
|
f.has(D.tagName) ? d.get(D.tagName)?.push(D) : v.push(D);
|
|
5297
|
-
const
|
|
5300
|
+
const p = [];
|
|
5298
5301
|
for (const D of f) {
|
|
5299
5302
|
const R = d.get(D);
|
|
5300
|
-
R && R.length &&
|
|
5303
|
+
R && R.length && p.push(...R);
|
|
5301
5304
|
}
|
|
5302
|
-
return
|
|
5305
|
+
return p.push(...v), p;
|
|
5303
5306
|
}
|
|
5304
5307
|
function $i(m) {
|
|
5305
5308
|
const r = m.lastIndexOf(":");
|
|
@@ -5317,7 +5320,7 @@ function ha(m) {
|
|
|
5317
5320
|
const f = r.definition[s];
|
|
5318
5321
|
if (!f) return !1;
|
|
5319
5322
|
const d = f.attributes.details[o.name];
|
|
5320
|
-
return !(!d || d.required ||
|
|
5323
|
+
return !(!d || d.required || f.attributes.identityFields?.includes(o.name));
|
|
5321
5324
|
}
|
|
5322
5325
|
class ma {
|
|
5323
5326
|
constructor() {
|
|
@@ -5457,14 +5460,14 @@ function ba() {
|
|
|
5457
5460
|
v(this);
|
|
5458
5461
|
}
|
|
5459
5462
|
};
|
|
5460
|
-
var
|
|
5463
|
+
var p;
|
|
5461
5464
|
try {
|
|
5462
|
-
|
|
5465
|
+
p = va.Stream;
|
|
5463
5466
|
} catch {
|
|
5464
|
-
|
|
5467
|
+
p = function() {
|
|
5465
5468
|
};
|
|
5466
5469
|
}
|
|
5467
|
-
|
|
5470
|
+
p || (p = function() {
|
|
5468
5471
|
});
|
|
5469
5472
|
var D = r.EVENTS.filter(function(l) {
|
|
5470
5473
|
return l !== "error" && l !== "end";
|
|
@@ -5484,7 +5487,7 @@ function ba() {
|
|
|
5484
5487
|
function B(l, c) {
|
|
5485
5488
|
if (!(this instanceof B))
|
|
5486
5489
|
return new B(l, c);
|
|
5487
|
-
|
|
5490
|
+
p.apply(this), this._parser = new o(l, c), this.writable = !0, this.readable = !0;
|
|
5488
5491
|
var I = this;
|
|
5489
5492
|
this._parser.onend = function() {
|
|
5490
5493
|
I.emit("end");
|
|
@@ -5505,7 +5508,7 @@ function ba() {
|
|
|
5505
5508
|
});
|
|
5506
5509
|
});
|
|
5507
5510
|
}
|
|
5508
|
-
B.prototype = Object.create(
|
|
5511
|
+
B.prototype = Object.create(p.prototype, {
|
|
5509
5512
|
constructor: {
|
|
5510
5513
|
value: B
|
|
5511
5514
|
}
|
|
@@ -5539,7 +5542,7 @@ function ba() {
|
|
|
5539
5542
|
return !I._parser["on" + l] && D.indexOf(l) !== -1 && (I._parser["on" + l] = function() {
|
|
5540
5543
|
var E = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
5541
5544
|
E.splice(0, 0, l), I.emit.apply(I, E);
|
|
5542
|
-
}),
|
|
5545
|
+
}), p.prototype.on.call(I, l, c);
|
|
5543
5546
|
};
|
|
5544
5547
|
var Y = "[CDATA[", oe = "DOCTYPE", M = "http://www.w3.org/XML/1998/namespace", j = "http://www.w3.org/2000/xmlns/", z = { xml: M, xmlns: j }, ie = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ye = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, ne = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, Z = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
|
|
5545
5548
|
function J(l) {
|
|
@@ -6316,7 +6319,7 @@ function _a(m) {
|
|
|
6316
6319
|
stack: [],
|
|
6317
6320
|
recordsBatch: []
|
|
6318
6321
|
};
|
|
6319
|
-
const
|
|
6322
|
+
const p = wa.parser(
|
|
6320
6323
|
!0,
|
|
6321
6324
|
// strict mode
|
|
6322
6325
|
{
|
|
@@ -6332,16 +6335,16 @@ function _a(m) {
|
|
|
6332
6335
|
// Enable namespace handling
|
|
6333
6336
|
}
|
|
6334
6337
|
);
|
|
6335
|
-
|
|
6338
|
+
p.onopentag = (K) => v = Ea({
|
|
6336
6339
|
node: K,
|
|
6337
6340
|
state: v,
|
|
6338
6341
|
dialecteConfig: r,
|
|
6339
6342
|
useCustomRecordsIds: s
|
|
6340
|
-
}),
|
|
6343
|
+
}), p.ontext = (K) => v = pi({ text: K, state: v }), p.oncdata = (K) => v = pi({ text: K, state: v }), p.onclosetag = () => ({ updatedState: v } = xa({
|
|
6341
6344
|
state: v,
|
|
6342
6345
|
ioHooks: f,
|
|
6343
6346
|
session: o
|
|
6344
|
-
})),
|
|
6347
|
+
})), p.onerror = Ta;
|
|
6345
6348
|
function D() {
|
|
6346
6349
|
const K = v.recordsBatch;
|
|
6347
6350
|
return v.recordsBatch = [], K;
|
|
@@ -6350,7 +6353,7 @@ function _a(m) {
|
|
|
6350
6353
|
return v.recordsBatch.length;
|
|
6351
6354
|
}
|
|
6352
6355
|
return {
|
|
6353
|
-
parser:
|
|
6356
|
+
parser: p,
|
|
6354
6357
|
drainBatch: D,
|
|
6355
6358
|
getSize: R
|
|
6356
6359
|
};
|
|
@@ -6362,13 +6365,13 @@ function Ea(m) {
|
|
|
6362
6365
|
defaultNamespace: o.namespaces.default,
|
|
6363
6366
|
rootElementName: o.rootElementName
|
|
6364
6367
|
}));
|
|
6365
|
-
const
|
|
6368
|
+
const p = Oa(r, d.defaultNamespace), D = Sa({ attributes: r.attributes, useCustomRecordsIds: f }), R = ka({
|
|
6366
6369
|
attributes: r.attributes,
|
|
6367
6370
|
useCustomRecordsIds: f
|
|
6368
6371
|
}), K = Aa(R), B = Da(s.stack), Y = {
|
|
6369
6372
|
id: D,
|
|
6370
6373
|
tagName: v,
|
|
6371
|
-
namespace:
|
|
6374
|
+
namespace: p,
|
|
6372
6375
|
attributes: K,
|
|
6373
6376
|
value: "",
|
|
6374
6377
|
parent: B,
|
|
@@ -6389,9 +6392,9 @@ function xa(m) {
|
|
|
6389
6392
|
record: f,
|
|
6390
6393
|
ancestry: d
|
|
6391
6394
|
}), d.length) {
|
|
6392
|
-
const
|
|
6395
|
+
const p = d.length - 1;
|
|
6393
6396
|
d = d.map(
|
|
6394
|
-
(D, R) => R ===
|
|
6397
|
+
(D, R) => R === p ? {
|
|
6395
6398
|
...D,
|
|
6396
6399
|
children: [
|
|
6397
6400
|
...D.children,
|
|
@@ -6462,9 +6465,9 @@ function ka(m) {
|
|
|
6462
6465
|
}
|
|
6463
6466
|
const Ra = 32 * 1024, Ia = 2e3;
|
|
6464
6467
|
async function Pa(m) {
|
|
6465
|
-
const { file: r, documentId: s, store: o, config: f, useCustomRecordsIds: d = !1, chunkOptions: v } = m, { supportedFileExtensions:
|
|
6468
|
+
const { file: r, documentId: s, store: o, config: f, useCustomRecordsIds: d = !1, chunkOptions: v } = m, { supportedFileExtensions: p } = f.io;
|
|
6466
6469
|
if (we(
|
|
6467
|
-
|
|
6470
|
+
p.some((M) => r.name.toLowerCase().endsWith(M)),
|
|
6468
6471
|
{ key: "ASSERTION_FAILED", detail: `Unsupported file type: ${r.name}` }
|
|
6469
6472
|
), r.size === 0)
|
|
6470
6473
|
return { documentId: s, recordCount: 0 };
|
|
@@ -6480,7 +6483,7 @@ async function Pa(m) {
|
|
|
6480
6483
|
return { documentId: s, recordCount: Y + oe };
|
|
6481
6484
|
}
|
|
6482
6485
|
async function Fa(m) {
|
|
6483
|
-
const { file: r, sax: s, session: o, store: f, documentId: d, chunkSize: v, batchSize:
|
|
6486
|
+
const { file: r, sax: s, session: o, store: f, documentId: d, chunkSize: v, batchSize: p } = m;
|
|
6484
6487
|
let D = 0;
|
|
6485
6488
|
const R = r.stream().getReader(), K = new TextDecoder();
|
|
6486
6489
|
let B = new Uint8Array(0), Y = !1;
|
|
@@ -6493,7 +6496,7 @@ async function Fa(m) {
|
|
|
6493
6496
|
if (oe.value)
|
|
6494
6497
|
for (B = ja(B, oe.value); B.length >= v; ) {
|
|
6495
6498
|
const M = K.decode(B.slice(0, v), { stream: !0 });
|
|
6496
|
-
B = B.slice(v), s.parser.write(M), D += await gi({ sax: s, session: o, store: f, documentId: d, threshold:
|
|
6499
|
+
B = B.slice(v), s.parser.write(M), D += await gi({ sax: s, session: o, store: f, documentId: d, threshold: p });
|
|
6497
6500
|
}
|
|
6498
6501
|
}
|
|
6499
6502
|
return D;
|
|
@@ -6511,22 +6514,22 @@ function ja(m, r) {
|
|
|
6511
6514
|
async function gi(m) {
|
|
6512
6515
|
const { sax: r, session: s, store: o, documentId: f, threshold: d } = m;
|
|
6513
6516
|
if (r.getSize() < d) return 0;
|
|
6514
|
-
const v = r.drainBatch(),
|
|
6515
|
-
return await o.bulkWrite(f, { creates:
|
|
6517
|
+
const v = r.drainBatch(), p = s.resolveChildrenForBatch(v);
|
|
6518
|
+
return await o.bulkWrite(f, { creates: p }), p.length;
|
|
6516
6519
|
}
|
|
6517
6520
|
async function Ma(m) {
|
|
6518
|
-
const { documentId: r, state: s, configs: o, store: f, projectName: d, options: v } = m,
|
|
6519
|
-
we(
|
|
6521
|
+
const { documentId: r, state: s, configs: o, store: f, projectName: d, options: v } = m, p = s.documents.get(r);
|
|
6522
|
+
we(p, {
|
|
6520
6523
|
key: "DOCUMENT_NOT_REGISTERED",
|
|
6521
6524
|
detail: `Document "${r}" not registered in project "${d}"`
|
|
6522
6525
|
});
|
|
6523
|
-
const D = o[
|
|
6526
|
+
const D = o[p.record.configKey], R = await f.getByDocumentId(r), K = ua({
|
|
6524
6527
|
records: R,
|
|
6525
6528
|
config: D,
|
|
6526
6529
|
withDatabaseIds: v?.withDatabaseIds
|
|
6527
|
-
}), B = `${
|
|
6530
|
+
}), B = `${p.record.name}${p.record.extension}`;
|
|
6528
6531
|
return v?.withDownload && await ca({
|
|
6529
|
-
extension:
|
|
6532
|
+
extension: p.record.extension,
|
|
6530
6533
|
xmlDocument: K,
|
|
6531
6534
|
filename: B
|
|
6532
6535
|
}), { xmlDocument: K, filename: B };
|
|
@@ -6552,12 +6555,12 @@ function Ka(m, r) {
|
|
|
6552
6555
|
return m;
|
|
6553
6556
|
}
|
|
6554
6557
|
async function qa(m) {
|
|
6555
|
-
const { file: r, store: s, configs: o, defaultConfigKey: f, options: d } = m, v = d?.configKey ?? f,
|
|
6556
|
-
we(
|
|
6558
|
+
const { file: r, store: s, configs: o, defaultConfigKey: f, options: d } = m, v = d?.configKey ?? f, p = o[v];
|
|
6559
|
+
we(p, {
|
|
6557
6560
|
key: "UNKNOWN_CONFIG_KEY",
|
|
6558
6561
|
detail: `Unknown configKey: "${v}". Available: ${Object.keys(o).join(", ")}`
|
|
6559
6562
|
});
|
|
6560
|
-
const D = crypto.randomUUID(), R = r.name.includes(".") ? `.${r.name.split(".").pop()}` :
|
|
6563
|
+
const D = crypto.randomUUID(), R = r.name.includes(".") ? `.${r.name.split(".").pop()}` : p.io.supportedFileExtensions[0], K = r.name.replace(/\.[^.]+$/, "") || "untitled", B = {
|
|
6561
6564
|
id: D,
|
|
6562
6565
|
name: K,
|
|
6563
6566
|
extension: R,
|
|
@@ -6570,7 +6573,7 @@ async function qa(m) {
|
|
|
6570
6573
|
file: r,
|
|
6571
6574
|
documentId: D,
|
|
6572
6575
|
store: s,
|
|
6573
|
-
config:
|
|
6576
|
+
config: p,
|
|
6574
6577
|
useCustomRecordsIds: d?.useCustomRecordsIds,
|
|
6575
6578
|
chunkOptions: d?.chunkOptions
|
|
6576
6579
|
});
|
|
@@ -6587,10 +6590,10 @@ async function La(m) {
|
|
|
6587
6590
|
key: "UNKNOWN_CONFIG_KEY",
|
|
6588
6591
|
detail: `Unknown configKey: "${d}". Available: ${Object.keys(s).join(", ")}`
|
|
6589
6592
|
});
|
|
6590
|
-
const
|
|
6593
|
+
const p = f?.extension ?? v.io.supportedFileExtensions[0], D = f?.name ?? "untitled", R = crypto.randomUUID(), K = {
|
|
6591
6594
|
id: R,
|
|
6592
6595
|
name: D,
|
|
6593
|
-
extension:
|
|
6596
|
+
extension: p,
|
|
6594
6597
|
configKey: d,
|
|
6595
6598
|
createdAt: Date.now(),
|
|
6596
6599
|
metadata: f?.metadata
|