@statezero/core 0.2.50 → 0.2.52
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/adaptors/vue/components/StateZeroDebugPanel.js +489 -471
- package/dist/adaptors/vue/reactivity.d.ts +1 -0
- package/dist/adaptors/vue/reactivity.js +17 -5
- package/dist/cli/commands/syncActions.js +33 -1
- package/dist/cli/commands/syncModels.js +44 -3
- package/dist/filtering/localFiltering.js +4 -4
- package/dist/flavours/django/errors.d.ts +12 -0
- package/dist/flavours/django/errors.js +20 -0
- package/dist/flavours/django/f.js +16 -15
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/models/backend1/django_app/author.d.ts +284 -0
- package/dist/models/backend1/django_app/author.js +69 -0
- package/dist/models/backend1/django_app/author.schema.json +281 -0
- package/dist/models/backend1/django_app/book.d.ts +262 -0
- package/dist/models/backend1/django_app/book.js +71 -0
- package/dist/models/backend1/django_app/book.schema.json +254 -0
- package/dist/models/backend1/django_app/composeditem.d.ts +140 -0
- package/dist/models/backend1/django_app/composeditem.js +69 -0
- package/dist/models/backend1/django_app/composeditem.schema.json +122 -0
- package/dist/models/backend1/django_app/comprehensivemodel.schema.json +3 -3
- package/dist/models/backend1/django_app/dailyrate.schema.json +7 -7
- package/dist/models/backend1/django_app/deepmodellevel1.schema.json +1 -1
- package/dist/models/backend1/django_app/dummymodel.schema.json +3 -3
- package/dist/models/backend1/django_app/errortestcompoundunique.d.ts +124 -0
- package/dist/models/backend1/django_app/errortestcompoundunique.js +69 -0
- package/dist/models/backend1/django_app/errortestcompoundunique.schema.json +106 -0
- package/dist/models/backend1/django_app/errortestonetoonemodel.d.ts +118 -0
- package/dist/models/backend1/django_app/errortestonetoonemodel.js +71 -0
- package/dist/models/backend1/django_app/errortestonetoonemodel.schema.json +90 -0
- package/dist/models/backend1/django_app/errortestparent.d.ts +92 -0
- package/dist/models/backend1/django_app/errortestparent.js +69 -0
- package/dist/models/backend1/django_app/errortestparent.schema.json +70 -0
- package/dist/models/backend1/django_app/errortestprotectedchild.d.ts +118 -0
- package/dist/models/backend1/django_app/errortestprotectedchild.js +71 -0
- package/dist/models/backend1/django_app/errortestprotectedchild.schema.json +94 -0
- package/dist/models/backend1/django_app/errortestuniquemodel.d.ts +108 -0
- package/dist/models/backend1/django_app/errortestuniquemodel.js +69 -0
- package/dist/models/backend1/django_app/errortestuniquemodel.schema.json +88 -0
- package/dist/models/backend1/django_app/excludeditem.d.ts +124 -0
- package/dist/models/backend1/django_app/excludeditem.js +69 -0
- package/dist/models/backend1/django_app/excludeditem.schema.json +105 -0
- package/dist/models/backend1/django_app/hfchild.d.ts +118 -0
- package/dist/models/backend1/django_app/hfchild.js +71 -0
- package/dist/models/backend1/django_app/hfchild.schema.json +94 -0
- package/dist/models/backend1/django_app/hfparent.d.ts +124 -0
- package/dist/models/backend1/django_app/hfparent.js +69 -0
- package/dist/models/backend1/django_app/hfparent.schema.json +105 -0
- package/dist/models/backend1/django_app/index.js +19 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.schema.json +3 -3
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.schema.json +3 -3
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.schema.json +5 -5
- package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +2 -2
- package/dist/models/backend1/django_app/nodeleteitem.d.ts +124 -0
- package/dist/models/backend1/django_app/nodeleteitem.js +69 -0
- package/dist/models/backend1/django_app/nodeleteitem.schema.json +105 -0
- package/dist/models/backend1/django_app/objectlevelitem.d.ts +124 -0
- package/dist/models/backend1/django_app/objectlevelitem.js +69 -0
- package/dist/models/backend1/django_app/objectlevelitem.schema.json +105 -0
- package/dist/models/backend1/django_app/order.schema.json +7 -7
- package/dist/models/backend1/django_app/orderitem.schema.json +5 -5
- package/dist/models/backend1/django_app/product.schema.json +11 -11
- package/dist/models/backend1/django_app/productcategory.schema.json +2 -2
- package/dist/models/backend1/django_app/rateplan.schema.json +2 -2
- package/dist/models/backend1/django_app/readonlyitem.d.ts +124 -0
- package/dist/models/backend1/django_app/readonlyitem.js +69 -0
- package/dist/models/backend1/django_app/readonlyitem.schema.json +105 -0
- package/dist/models/backend1/django_app/restrictedcreateitem.d.ts +124 -0
- package/dist/models/backend1/django_app/restrictedcreateitem.js +69 -0
- package/dist/models/backend1/django_app/restrictedcreateitem.schema.json +105 -0
- package/dist/models/backend1/django_app/restrictededititem.d.ts +124 -0
- package/dist/models/backend1/django_app/restrictededititem.js +69 -0
- package/dist/models/backend1/django_app/restrictededititem.schema.json +105 -0
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +1 -1
- package/dist/models/backend1/django_app/rowfiltereditem.d.ts +124 -0
- package/dist/models/backend1/django_app/rowfiltereditem.js +69 -0
- package/dist/models/backend1/django_app/rowfiltereditem.schema.json +105 -0
- package/dist/models/backend1/django_app/tag.d.ts +554 -0
- package/dist/models/backend1/django_app/tag.js +71 -0
- package/dist/models/backend1/django_app/tag.schema.json +541 -0
- package/dist/models/backend1/django_app/updateonlyitem.d.ts +108 -0
- package/dist/models/backend1/django_app/updateonlyitem.js +69 -0
- package/dist/models/backend1/django_app/updateonlyitem.schema.json +88 -0
- package/dist/models/default/django_app/author.d.ts +284 -0
- package/dist/models/default/django_app/author.js +69 -0
- package/dist/models/default/django_app/author.schema.json +281 -0
- package/dist/models/default/django_app/book.d.ts +262 -0
- package/dist/models/default/django_app/book.js +71 -0
- package/dist/models/default/django_app/book.schema.json +254 -0
- package/dist/models/default/django_app/composeditem.d.ts +140 -0
- package/dist/models/default/django_app/composeditem.js +69 -0
- package/dist/models/default/django_app/composeditem.schema.json +122 -0
- package/dist/models/default/django_app/comprehensivemodel.schema.json +3 -3
- package/dist/models/default/django_app/dailyrate.schema.json +7 -7
- package/dist/models/default/django_app/deepmodellevel1.d.ts +1 -13
- package/dist/models/default/django_app/deepmodellevel1.schema.json +2 -14
- package/dist/models/default/django_app/deepmodellevel2.d.ts +1 -13
- package/dist/models/default/django_app/deepmodellevel2.schema.json +1 -13
- package/dist/models/default/django_app/deepmodellevel3.d.ts +1 -13
- package/dist/models/default/django_app/deepmodellevel3.schema.json +1 -13
- package/dist/models/default/django_app/dummymodel.d.ts +1 -13
- package/dist/models/default/django_app/dummymodel.schema.json +4 -16
- package/dist/models/default/django_app/dummyrelatedmodel.d.ts +1 -13
- package/dist/models/default/django_app/dummyrelatedmodel.schema.json +1 -13
- package/dist/models/default/django_app/errortestcompoundunique.d.ts +124 -0
- package/dist/models/default/django_app/errortestcompoundunique.js +69 -0
- package/dist/models/default/django_app/errortestcompoundunique.schema.json +106 -0
- package/dist/models/default/django_app/errortestonetoonemodel.d.ts +118 -0
- package/dist/models/default/django_app/errortestonetoonemodel.js +71 -0
- package/dist/models/default/django_app/errortestonetoonemodel.schema.json +90 -0
- package/dist/models/default/django_app/errortestparent.d.ts +92 -0
- package/dist/models/default/django_app/errortestparent.js +69 -0
- package/dist/models/default/django_app/errortestparent.schema.json +70 -0
- package/dist/models/default/django_app/errortestprotectedchild.d.ts +118 -0
- package/dist/models/default/django_app/errortestprotectedchild.js +71 -0
- package/dist/models/default/django_app/errortestprotectedchild.schema.json +94 -0
- package/dist/models/default/django_app/errortestuniquemodel.d.ts +108 -0
- package/dist/models/default/django_app/errortestuniquemodel.js +69 -0
- package/dist/models/default/django_app/errortestuniquemodel.schema.json +88 -0
- package/dist/models/default/django_app/excludeditem.d.ts +124 -0
- package/dist/models/default/django_app/excludeditem.js +69 -0
- package/dist/models/default/django_app/excludeditem.schema.json +105 -0
- package/dist/models/default/django_app/filetest.d.ts +1 -13
- package/dist/models/default/django_app/filetest.schema.json +1 -13
- package/dist/models/default/django_app/hfchild.d.ts +118 -0
- package/dist/models/default/django_app/hfchild.js +71 -0
- package/dist/models/default/django_app/hfchild.schema.json +94 -0
- package/dist/models/default/django_app/hfparent.d.ts +124 -0
- package/dist/models/default/django_app/hfparent.js +69 -0
- package/dist/models/default/django_app/hfparent.schema.json +105 -0
- package/dist/models/default/django_app/index.js +19 -0
- package/dist/models/default/django_app/m2mdepthtestlevel1.schema.json +3 -3
- package/dist/models/default/django_app/m2mdepthtestlevel2.schema.json +3 -3
- package/dist/models/default/django_app/m2mdepthtestlevel3.schema.json +5 -5
- package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +2 -2
- package/dist/models/default/django_app/nodeleteitem.d.ts +124 -0
- package/dist/models/default/django_app/nodeleteitem.js +69 -0
- package/dist/models/default/django_app/nodeleteitem.schema.json +105 -0
- package/dist/models/default/django_app/objectlevelitem.d.ts +124 -0
- package/dist/models/default/django_app/objectlevelitem.js +69 -0
- package/dist/models/default/django_app/objectlevelitem.schema.json +105 -0
- package/dist/models/default/django_app/order.schema.json +7 -7
- package/dist/models/default/django_app/orderitem.schema.json +5 -5
- package/dist/models/default/django_app/product.schema.json +11 -11
- package/dist/models/default/django_app/productcategory.schema.json +2 -2
- package/dist/models/default/django_app/rateplan.schema.json +2 -2
- package/dist/models/default/django_app/readonlyitem.d.ts +124 -0
- package/dist/models/default/django_app/readonlyitem.js +69 -0
- package/dist/models/default/django_app/readonlyitem.schema.json +105 -0
- package/dist/models/default/django_app/restrictedcreateitem.d.ts +124 -0
- package/dist/models/default/django_app/restrictedcreateitem.js +69 -0
- package/dist/models/default/django_app/restrictedcreateitem.schema.json +105 -0
- package/dist/models/default/django_app/restrictededititem.d.ts +124 -0
- package/dist/models/default/django_app/restrictededititem.js +69 -0
- package/dist/models/default/django_app/restrictededititem.schema.json +105 -0
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +1 -1
- package/dist/models/default/django_app/rowfiltereditem.d.ts +124 -0
- package/dist/models/default/django_app/rowfiltereditem.js +69 -0
- package/dist/models/default/django_app/rowfiltereditem.schema.json +105 -0
- package/dist/models/default/django_app/tag.d.ts +554 -0
- package/dist/models/default/django_app/tag.js +71 -0
- package/dist/models/default/django_app/tag.schema.json +541 -0
- package/dist/models/default/django_app/updateonlyitem.d.ts +108 -0
- package/dist/models/default/django_app/updateonlyitem.js +69 -0
- package/dist/models/default/django_app/updateonlyitem.schema.json +88 -0
- package/dist/schemaIntegrity.d.ts +14 -0
- package/dist/schemaIntegrity.js +29 -0
- package/dist/setup.js +6 -0
- package/dist/syncEngine/stores/operationEventHandlers.js +10 -8
- package/dist/syncEngine/stores/querysetStore.js +9 -0
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ref as J, computed as R, onMounted as
|
|
1
|
+
import { ref as J, computed as R, onMounted as hs, onBeforeUnmount as fs, watch as it, createElementBlock as $, openBlock as A, createElementVNode as h, createVNode as Tt, toDisplayString as S, createCommentVNode as V, Fragment as W, renderList as ce, normalizeClass as Mt, normalizeStyle as at, withDirectives as Qe, createTextVNode as Ve, vModelCheckbox as $t, vModelSelect as At, Transition as Ot, withCtx as Pt } from "vue";
|
|
2
2
|
import { v7 as G } from "uuid";
|
|
3
|
-
import { isNil as E, isEmpty as
|
|
3
|
+
import { isNil as E, isEmpty as ve, trim as dt, isEqual as qe } from "lodash-es";
|
|
4
4
|
import Ae from "mitt";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import It from "handlebars";
|
|
6
|
+
import Ft from "superjson";
|
|
7
|
+
import ps from "p-queue";
|
|
8
|
+
import ms from "axios";
|
|
9
9
|
import { z as P } from "zod";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { DateTime as
|
|
13
|
-
import { parse as
|
|
14
|
-
import { Graph as
|
|
10
|
+
import ys from "pusher-js";
|
|
11
|
+
import Zt, { createEqualsOperation as ee } from "sift";
|
|
12
|
+
import { DateTime as _e } from "luxon";
|
|
13
|
+
import { parse as gs, format as _s } from "date-fns";
|
|
14
|
+
import { Graph as Dt } from "graphlib";
|
|
15
15
|
import Le from "object-hash";
|
|
16
|
-
import * as
|
|
17
|
-
import
|
|
16
|
+
import * as Yt from "mathjs";
|
|
17
|
+
import ws from "rfdc";
|
|
18
18
|
const se = /* @__PURE__ */ new Map(), ut = /* @__PURE__ */ new Set();
|
|
19
|
-
function
|
|
19
|
+
function Cs(n) {
|
|
20
20
|
return ut.add(n), () => ut.delete(n);
|
|
21
21
|
}
|
|
22
22
|
function Je(n) {
|
|
@@ -25,7 +25,7 @@ function Je(n) {
|
|
|
25
25
|
function zt(n) {
|
|
26
26
|
return `{{TempPK_${n}}}`;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Kt(n, e) {
|
|
29
29
|
const t = `{{TempPK_${n}}}`, s = `"TempPK_${n}"`, r = typeof e == "string" ? `"${e}"` : String(e);
|
|
30
30
|
se.set(s, r);
|
|
31
31
|
for (const o of ut)
|
|
@@ -35,7 +35,7 @@ function Rt(n, e) {
|
|
|
35
35
|
console.warn("[tempPk] onResolve callback error:", i);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function vs(n) {
|
|
39
39
|
if (!Je(String(n))) return n;
|
|
40
40
|
const e = String(n).match(/\{\{\s*TempPK_([^}\s]+)\s*\}\}/);
|
|
41
41
|
if (!e) return n;
|
|
@@ -47,15 +47,15 @@ function We(n) {
|
|
|
47
47
|
const e = Object.fromEntries(se);
|
|
48
48
|
try {
|
|
49
49
|
if (typeof n == "string")
|
|
50
|
-
return
|
|
51
|
-
const t =
|
|
52
|
-
return
|
|
50
|
+
return It.compile(n, { noEscape: !0 })(e);
|
|
51
|
+
const t = Ft.stringify(n), r = It.compile(t, { noEscape: !0 })(e);
|
|
52
|
+
return Ft.parse(r);
|
|
53
53
|
} catch {
|
|
54
54
|
return n;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
class
|
|
57
|
+
const Es = Ae(), bs = Ae(), Rt = Ae();
|
|
58
|
+
class ks {
|
|
59
59
|
constructor(e, t = {}) {
|
|
60
60
|
this.dbName = e, this.storeName = t.storeName || "keyval-store", this.batchDelay = t.batchDelay || 50, this.version = t.version || 5, this.resetOnErrors = t.resetOnErrors || [
|
|
61
61
|
"VersionError",
|
|
@@ -236,9 +236,9 @@ class bs {
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
class
|
|
239
|
+
class vt {
|
|
240
240
|
constructor(e, t = {}, s = null) {
|
|
241
|
-
this.store = new
|
|
241
|
+
this.store = new ks(e, t), this.localMap = /* @__PURE__ */ new Map(), this.hydrate().then((r) => {
|
|
242
242
|
typeof s == "function" && s(r);
|
|
243
243
|
}).catch((r) => {
|
|
244
244
|
console.error(`Cache hydration failed for "${e}":`, r);
|
|
@@ -285,7 +285,7 @@ class Et {
|
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
const
|
|
288
|
+
const ge = (n, e) => {
|
|
289
289
|
if (!e || !e.pks || e.pks.length === 0) return;
|
|
290
290
|
const t = e.pks.map((r) => n._lastRenderedData.get(r) ?? null), s = n.render(e.pks, !0, !1);
|
|
291
291
|
if (!qe(s, t)) {
|
|
@@ -294,7 +294,7 @@ const ye = (n, e) => {
|
|
|
294
294
|
o && o[r] != null && n._lastRenderedData.set(o[r], o);
|
|
295
295
|
for (const o of e.pks)
|
|
296
296
|
s.some((i) => i && i[r] === o) || n._lastRenderedData.set(o, null);
|
|
297
|
-
|
|
297
|
+
Es.emit(
|
|
298
298
|
`${n.modelClass.configKey}::${n.modelClass.modelName}::render`,
|
|
299
299
|
e
|
|
300
300
|
), n.renderCallbacks.forEach((o) => {
|
|
@@ -340,14 +340,14 @@ class Y {
|
|
|
340
340
|
return r.size > 0 ? new Y(t, Array.from(r)) : null;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
class
|
|
343
|
+
class Ss {
|
|
344
344
|
modelClass;
|
|
345
345
|
fetchFn;
|
|
346
346
|
groundTruthArray;
|
|
347
347
|
operationsMap;
|
|
348
348
|
isSyncing;
|
|
349
349
|
constructor(e, t, s = null, r = null, o = {}) {
|
|
350
|
-
this.modelClass = e, this.fetchFn = t, this.isSyncing = !1, this.pruneThreshold = o.pruneThreshold || 10, this.groundTruthArray = s || [], this.operationsMap = /* @__PURE__ */ new Map(), r && r.length > 0 && this._loadOperations(r), this.modelCache = new
|
|
350
|
+
this.modelClass = e, this.fetchFn = t, this.isSyncing = !1, this.pruneThreshold = o.pruneThreshold || 10, this.groundTruthArray = s || [], this.operationsMap = /* @__PURE__ */ new Map(), r && r.length > 0 && this._loadOperations(r), this.modelCache = new vt("model-cache", {}, this.onHydrated.bind(this)), this._lastRenderedData = /* @__PURE__ */ new Map(), this.renderCallbacks = /* @__PURE__ */ new Set(), this._unsubscribeTempPk = Cs((i, l) => {
|
|
351
351
|
if (this._lastRenderedData.has(i)) {
|
|
352
352
|
const a = this._lastRenderedData.get(i);
|
|
353
353
|
a && typeof a == "object" && (a[this.pkField] = l), this._lastRenderedData.set(l, a), this._lastRenderedData.delete(i);
|
|
@@ -363,7 +363,7 @@ class ks {
|
|
|
363
363
|
*/
|
|
364
364
|
_loadOperations(e) {
|
|
365
365
|
e.forEach((t) => {
|
|
366
|
-
const s =
|
|
366
|
+
const s = Pe.get(t.operationId);
|
|
367
367
|
s ? this.operationsMap.set(s.operationId, s) : this.operationsMap.set(t.operationId, new q(t, !0));
|
|
368
368
|
});
|
|
369
369
|
}
|
|
@@ -374,7 +374,7 @@ class ks {
|
|
|
374
374
|
onHydrated() {
|
|
375
375
|
if (this.groundTruthArray.length === 0 && this.operationsMap.size === 0) {
|
|
376
376
|
let e = this.modelCache.get(this.cacheKey);
|
|
377
|
-
!E(e) && !
|
|
377
|
+
!E(e) && !ve(e) && this.setGroundTruth(e);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
setCache(e) {
|
|
@@ -382,7 +382,7 @@ class ks {
|
|
|
382
382
|
let s = [];
|
|
383
383
|
e.forEach((r) => {
|
|
384
384
|
let o = r[t];
|
|
385
|
-
if (!(typeof o == "string" && Je(o) && (o = We(r[t]), E(o) ||
|
|
385
|
+
if (!(typeof o == "string" && Je(o) && (o = We(r[t]), E(o) || ve(dt(o)))))
|
|
386
386
|
if (r && typeof r.serialize == "function") {
|
|
387
387
|
const i = r.serialize(!0);
|
|
388
388
|
i[t] = o, s.push(i);
|
|
@@ -398,7 +398,7 @@ class ks {
|
|
|
398
398
|
let r = [];
|
|
399
399
|
if (e.forEach((c) => {
|
|
400
400
|
let f = c[s];
|
|
401
|
-
typeof f == "string" && Je(f) && (f = We(c[s]), E(f) ||
|
|
401
|
+
typeof f == "string" && Je(f) && (f = We(c[s]), E(f) || ve(dt(f))) || (c[s] = f, r.push(c));
|
|
402
402
|
}), t === null) {
|
|
403
403
|
this.setCache(r);
|
|
404
404
|
return;
|
|
@@ -422,16 +422,16 @@ class ks {
|
|
|
422
422
|
}
|
|
423
423
|
// Commit optimistic updates
|
|
424
424
|
addOperation(e) {
|
|
425
|
-
this.operationsMap.set(e.operationId, e), this.operationsMap.size > this.pruneThreshold && this.prune(),
|
|
425
|
+
this.operationsMap.set(e.operationId, e), this.operationsMap.size > this.pruneThreshold && this.prune(), ge(this, Y.fromOperation(e));
|
|
426
426
|
}
|
|
427
427
|
updateOperation(e) {
|
|
428
|
-
return this.operationsMap.has(e.operationId) ? (this.operationsMap.set(e.operationId, e),
|
|
428
|
+
return this.operationsMap.has(e.operationId) ? (this.operationsMap.set(e.operationId, e), ge(this, Y.fromOperation(e)), !0) : !1;
|
|
429
429
|
}
|
|
430
430
|
confirm(e) {
|
|
431
|
-
this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e),
|
|
431
|
+
this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), ge(this, Y.fromOperation(e)));
|
|
432
432
|
}
|
|
433
433
|
reject(e) {
|
|
434
|
-
this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e),
|
|
434
|
+
this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), ge(this, Y.fromOperation(e)));
|
|
435
435
|
}
|
|
436
436
|
setOperations(e = []) {
|
|
437
437
|
const t = this.operations;
|
|
@@ -439,14 +439,14 @@ class ks {
|
|
|
439
439
|
this.operationsMap.set(r.operationId, r);
|
|
440
440
|
});
|
|
441
441
|
const s = [...t, ...this.operations];
|
|
442
|
-
|
|
442
|
+
ge(this, Y.fromOperations(s));
|
|
443
443
|
}
|
|
444
444
|
// Ground truth data methods
|
|
445
445
|
setGroundTruth(e) {
|
|
446
446
|
let t = this.groundTruthArray;
|
|
447
447
|
this.groundTruthArray = Array.isArray(e) ? e : [];
|
|
448
448
|
const s = [...t, ...this.groundTruthArray];
|
|
449
|
-
|
|
449
|
+
ge(this, Y.fromInstances(s, this.modelClass));
|
|
450
450
|
}
|
|
451
451
|
getGroundTruth() {
|
|
452
452
|
return this.groundTruthArray;
|
|
@@ -491,7 +491,7 @@ class ks {
|
|
|
491
491
|
l
|
|
492
492
|
);
|
|
493
493
|
}
|
|
494
|
-
|
|
494
|
+
ge(
|
|
495
495
|
this,
|
|
496
496
|
Y.fromInstances(
|
|
497
497
|
[...i, ...Array.from(s.values())],
|
|
@@ -600,7 +600,7 @@ class ks {
|
|
|
600
600
|
// Render methods
|
|
601
601
|
render(e = null, t = !0, s = !0) {
|
|
602
602
|
if (s && e !== null) {
|
|
603
|
-
const o = (Array.isArray(e) ? e : [e]).map((a) =>
|
|
603
|
+
const o = (Array.isArray(e) ? e : [e]).map((a) => vs(a)), i = [];
|
|
604
604
|
for (const a of o)
|
|
605
605
|
this._lastRenderedData.has(a) || i.push(a);
|
|
606
606
|
if (i.length === 0)
|
|
@@ -688,7 +688,7 @@ class Ge {
|
|
|
688
688
|
const t = async ({ pks: s, modelClass: r }) => await r.objects.filter({
|
|
689
689
|
[`${r.primaryKeyField}__in`]: s
|
|
690
690
|
}).fetch().serialize();
|
|
691
|
-
this._stores.set(e, new
|
|
691
|
+
this._stores.set(e, new Ss(e, t, null, null)), this.syncManager.followModel(this, e);
|
|
692
692
|
}
|
|
693
693
|
return this._stores.get(e);
|
|
694
694
|
}
|
|
@@ -751,7 +751,7 @@ class q {
|
|
|
751
751
|
throw new Error(`All operation instances must be objects with the '${o}' field`);
|
|
752
752
|
this.#e = r;
|
|
753
753
|
const i = r.map((a) => a[o]);
|
|
754
|
-
Q.getStore(s).render(i, !0, !1), this.#t = r.map((a) => s.fromPk(a[o]).serialize()), this.timestamp = e.timestamp || Date.now(), !t && (
|
|
754
|
+
Q.getStore(s).render(i, !0, !1), this.#t = r.map((a) => s.fromPk(a[o]).serialize()), this.timestamp = e.timestamp || Date.now(), !t && (Pe.register(this), ie.emit(C.CREATED, this));
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
757
757
|
* Getter for instances that replaces any temporary PKs with real PKs
|
|
@@ -818,7 +818,7 @@ class q {
|
|
|
818
818
|
return e.instances && !Array.isArray(e.instances) && (e.instances = [e.instances]), Object.assign(this, e), this.timestamp = Date.now(), ie.emit(C.MUTATED, this), this;
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
-
class
|
|
821
|
+
class Ts {
|
|
822
822
|
constructor() {
|
|
823
823
|
this._operations = /* @__PURE__ */ new Map(), this._querysetStates = /* @__PURE__ */ new Map();
|
|
824
824
|
}
|
|
@@ -903,11 +903,11 @@ class Ss {
|
|
|
903
903
|
return t.length > 0 ? t[t.length - 1] : void 0;
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
const
|
|
907
|
-
function
|
|
908
|
-
|
|
906
|
+
const Pe = new Ts(), Ms = Ae();
|
|
907
|
+
function $s(n) {
|
|
908
|
+
Ms.emit("error", n);
|
|
909
909
|
}
|
|
910
|
-
class
|
|
910
|
+
class fe extends Error {
|
|
911
911
|
/**
|
|
912
912
|
* Creates a new StateZeroError.
|
|
913
913
|
*
|
|
@@ -917,7 +917,7 @@ class ve extends Error {
|
|
|
917
917
|
* @param {number} status - The HTTP status code.
|
|
918
918
|
*/
|
|
919
919
|
constructor(e, t, s, r) {
|
|
920
|
-
super(e), this.name = "StateZeroError", this.code = t, this.detail = s, this.status = r, Object.setPrototypeOf(this, new.target.prototype),
|
|
920
|
+
super(e), this.name = "StateZeroError", this.code = t, this.detail = s, this.status = r, Object.setPrototypeOf(this, new.target.prototype), $s(this);
|
|
921
921
|
}
|
|
922
922
|
/**
|
|
923
923
|
* Returns a full error message including the detail.
|
|
@@ -939,7 +939,7 @@ class ve extends Error {
|
|
|
939
939
|
return this.message;
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
class
|
|
942
|
+
class Oe extends fe {
|
|
943
943
|
/**
|
|
944
944
|
* Creates a new ValidationError.
|
|
945
945
|
*
|
|
@@ -950,7 +950,7 @@ class Ve extends ve {
|
|
|
950
950
|
super("Validation error", "validation_error", e, t), this.name = "ValidationError";
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
|
-
class
|
|
953
|
+
class Nt extends fe {
|
|
954
954
|
/**
|
|
955
955
|
* Creates a new DoesNotExist error.
|
|
956
956
|
*
|
|
@@ -961,7 +961,7 @@ class xt extends ve {
|
|
|
961
961
|
super("DoesNotExist", "does_not_exist", e, t), this.name = "DoesNotExist";
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
class lt extends
|
|
964
|
+
class lt extends fe {
|
|
965
965
|
/**
|
|
966
966
|
* Creates a new PermissionDenied error.
|
|
967
967
|
*
|
|
@@ -972,7 +972,7 @@ class lt extends ve {
|
|
|
972
972
|
super("Permission denied", "permission_denied", e, t), this.name = "PermissionDenied";
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
class
|
|
975
|
+
class As extends fe {
|
|
976
976
|
/**
|
|
977
977
|
* Creates a new MultipleObjectsReturned error.
|
|
978
978
|
*
|
|
@@ -983,7 +983,18 @@ class $s extends ve {
|
|
|
983
983
|
super("Multiple objects returned", "multiple_objects_returned", e, t), this.name = "MultipleObjectsReturned";
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
class
|
|
986
|
+
class xt extends fe {
|
|
987
|
+
/**
|
|
988
|
+
* Creates a new ConflictError.
|
|
989
|
+
*
|
|
990
|
+
* @param {IErrorDetail|Object|string} [detail="A database conflict occurred."] - The error details.
|
|
991
|
+
* @param {number} [status=409] - The HTTP status code.
|
|
992
|
+
*/
|
|
993
|
+
constructor(e = "A database conflict occurred.", t = 409) {
|
|
994
|
+
super("Conflict", "conflict", e, t), this.name = "ConflictError";
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
class Os extends fe {
|
|
987
998
|
/**
|
|
988
999
|
* Creates a new ASTValidationError.
|
|
989
1000
|
*
|
|
@@ -994,7 +1005,7 @@ class As extends ve {
|
|
|
994
1005
|
super("Query syntax error", "ast_validation_error", e, t), this.name = "ASTValidationError";
|
|
995
1006
|
}
|
|
996
1007
|
}
|
|
997
|
-
class x extends
|
|
1008
|
+
class x extends fe {
|
|
998
1009
|
/**
|
|
999
1010
|
* Creates a new ConfigError.
|
|
1000
1011
|
*
|
|
@@ -1005,31 +1016,33 @@ class x extends ve {
|
|
|
1005
1016
|
super("Configuration error", "config_error", e, t), this.name = "ConfigError";
|
|
1006
1017
|
}
|
|
1007
1018
|
}
|
|
1008
|
-
function
|
|
1019
|
+
function Ps(n) {
|
|
1009
1020
|
const { status: e, type: t, detail: s } = n;
|
|
1010
1021
|
if (t === void 0 && s === "Invalid token.")
|
|
1011
1022
|
return new lt(s, 403);
|
|
1012
1023
|
switch (t) {
|
|
1013
1024
|
// Direct mappings
|
|
1014
1025
|
case "ValidationError":
|
|
1015
|
-
return new
|
|
1026
|
+
return new Oe(s, e);
|
|
1016
1027
|
case "NotFound":
|
|
1017
|
-
return new
|
|
1028
|
+
return new Nt(s, e);
|
|
1018
1029
|
case "MultipleObjectsReturned":
|
|
1019
|
-
return new
|
|
1030
|
+
return new As(s, e);
|
|
1020
1031
|
case "PermissionDenied":
|
|
1021
1032
|
return new lt(s, e);
|
|
1033
|
+
case "ConflictError":
|
|
1034
|
+
return new xt(s, e);
|
|
1022
1035
|
case "ASTValidationError":
|
|
1023
|
-
return new
|
|
1036
|
+
return new Os(s, e);
|
|
1024
1037
|
case "ConfigError":
|
|
1025
1038
|
return new x(s, e);
|
|
1026
1039
|
// Django error types that map to our error classes
|
|
1027
1040
|
case "FieldError":
|
|
1028
|
-
return new
|
|
1041
|
+
return new Oe(s, e);
|
|
1029
1042
|
case "ValueError":
|
|
1030
|
-
return new
|
|
1043
|
+
return new Oe(s, e);
|
|
1031
1044
|
default:
|
|
1032
|
-
return e === 400 ? new
|
|
1045
|
+
return e === 400 ? new Oe(s, e) : e === 403 ? new lt(s, e) : e === 404 ? new Nt(s, e) : e === 409 ? new xt(s, e) : new fe("Unknown error", "unknown", s, e);
|
|
1033
1046
|
}
|
|
1034
1047
|
}
|
|
1035
1048
|
const jt = {
|
|
@@ -1040,7 +1053,7 @@ const jt = {
|
|
|
1040
1053
|
BULK_UPDATE: "bulk_update",
|
|
1041
1054
|
BULK_DELETE: "bulk_delete"
|
|
1042
1055
|
};
|
|
1043
|
-
class
|
|
1056
|
+
class Is {
|
|
1044
1057
|
/**
|
|
1045
1058
|
* @param {PusherReceiverOptions} options
|
|
1046
1059
|
* @param {string} configKey - The backend configuration key
|
|
@@ -1050,7 +1063,7 @@ class Ps {
|
|
|
1050
1063
|
this.configKey = t, this.connectionTimeoutId = null, s.appKey && /^\d+$/.test(s.appKey) && s.appKey.length < 15 && console.warn(
|
|
1051
1064
|
`%c[Pusher Warning] The provided appKey ("${s.appKey}") looks like a numeric app_id. Pusher requires the alphanumeric key, not the ID. Please verify your configuration for backend: "${this.configKey}".`,
|
|
1052
1065
|
"color: orange; font-weight: bold; font-size: 14px;"
|
|
1053
|
-
), this.pusherClient = new
|
|
1066
|
+
), this.pusherClient = new ys(s.appKey, {
|
|
1054
1067
|
cluster: s.cluster,
|
|
1055
1068
|
forceTLS: s.forceTLS ?? !0,
|
|
1056
1069
|
authEndpoint: s.authEndpoint,
|
|
@@ -1201,7 +1214,7 @@ function Ds() {
|
|
|
1201
1214
|
let Qt = {
|
|
1202
1215
|
backendConfigs: {}
|
|
1203
1216
|
};
|
|
1204
|
-
const
|
|
1217
|
+
const zs = P.object({
|
|
1205
1218
|
clientOptions: P.object({
|
|
1206
1219
|
appKey: P.string({ required_error: "Pusher appKey is required" }),
|
|
1207
1220
|
cluster: P.string({ required_error: "Pusher cluster is required" }),
|
|
@@ -1215,7 +1228,7 @@ const Is = P.object({
|
|
|
1215
1228
|
}), Ks = P.object({
|
|
1216
1229
|
type: P.enum(["websocket", "pusher", "none"]),
|
|
1217
1230
|
websocketUrl: P.string().url().optional(),
|
|
1218
|
-
pusher:
|
|
1231
|
+
pusher: zs.optional(),
|
|
1219
1232
|
hotpaths: P.array(P.string()).default(["default"])
|
|
1220
1233
|
}).superRefine((n, e) => {
|
|
1221
1234
|
n.type === "websocket" && (n.websocketUrl || e.addIssue({
|
|
@@ -1246,7 +1259,7 @@ const Is = P.object({
|
|
|
1246
1259
|
"eventInterceptor must be a function if provided"
|
|
1247
1260
|
),
|
|
1248
1261
|
events: P.lazy(() => Ks.optional())
|
|
1249
|
-
}),
|
|
1262
|
+
}), Rs = P.object({
|
|
1250
1263
|
backendConfigs: P.record(P.string(), Be).refine(
|
|
1251
1264
|
(n) => {
|
|
1252
1265
|
for (const [e, t] of Object.entries(n))
|
|
@@ -1269,9 +1282,9 @@ const Is = P.object({
|
|
|
1269
1282
|
periodicSyncIntervalSeconds: P.number().min(5).nullable().optional().default(null)
|
|
1270
1283
|
});
|
|
1271
1284
|
let ht = null;
|
|
1272
|
-
function
|
|
1285
|
+
function Ns(n) {
|
|
1273
1286
|
Qt = n;
|
|
1274
|
-
const e =
|
|
1287
|
+
const e = Rs.safeParse(Qt);
|
|
1275
1288
|
if (!e.success) {
|
|
1276
1289
|
const t = e.error.errors.map((s) => s.message);
|
|
1277
1290
|
throw new x(`Error setting configuration: ${t.join(", ")}`);
|
|
@@ -1283,7 +1296,7 @@ function he() {
|
|
|
1283
1296
|
throw new x("Configuration not set. Please call setConfig() with a valid configuration.");
|
|
1284
1297
|
return ht;
|
|
1285
1298
|
}
|
|
1286
|
-
function
|
|
1299
|
+
function xs(n, e) {
|
|
1287
1300
|
try {
|
|
1288
1301
|
const t = he();
|
|
1289
1302
|
if (!t.backendConfigs[n])
|
|
@@ -1298,7 +1311,7 @@ function Ns(n, e) {
|
|
|
1298
1311
|
throw t instanceof x ? t : new x(t.message || "Invalid backend configuration");
|
|
1299
1312
|
}
|
|
1300
1313
|
}
|
|
1301
|
-
function
|
|
1314
|
+
function Xt(n = "default") {
|
|
1302
1315
|
try {
|
|
1303
1316
|
const e = he();
|
|
1304
1317
|
if (!e.backendConfigs[n])
|
|
@@ -1320,7 +1333,7 @@ function Yt(n = "default") {
|
|
|
1320
1333
|
...t.events.pusher.clientOptions,
|
|
1321
1334
|
getAuthHeaders: i
|
|
1322
1335
|
};
|
|
1323
|
-
s = new
|
|
1336
|
+
s = new Is({ clientOptions: l }, n);
|
|
1324
1337
|
break;
|
|
1325
1338
|
case "none":
|
|
1326
1339
|
return null;
|
|
@@ -1332,12 +1345,12 @@ function Yt(n = "default") {
|
|
|
1332
1345
|
throw e instanceof x ? e : new x(`Failed to initialize event receiver: ${e.message}`);
|
|
1333
1346
|
}
|
|
1334
1347
|
}
|
|
1335
|
-
function
|
|
1348
|
+
function js() {
|
|
1336
1349
|
try {
|
|
1337
1350
|
const n = he(), e = {};
|
|
1338
1351
|
return Object.keys(n.backendConfigs).forEach((t) => {
|
|
1339
1352
|
try {
|
|
1340
|
-
e[t] =
|
|
1353
|
+
e[t] = Xt(t);
|
|
1341
1354
|
} catch (s) {
|
|
1342
1355
|
console.warn(`Failed to initialize event receiver for backend "${t}": ${s.message}`);
|
|
1343
1356
|
}
|
|
@@ -1347,12 +1360,12 @@ function xs() {
|
|
|
1347
1360
|
}
|
|
1348
1361
|
}
|
|
1349
1362
|
let ft = null;
|
|
1350
|
-
function
|
|
1363
|
+
function Us(n) {
|
|
1351
1364
|
if (typeof n != "function")
|
|
1352
1365
|
throw new x("Provided model getter must be a function.");
|
|
1353
1366
|
ft = n;
|
|
1354
1367
|
}
|
|
1355
|
-
function
|
|
1368
|
+
function Qs(n, e = "default") {
|
|
1356
1369
|
if (n && n.startsWith("http"))
|
|
1357
1370
|
return n;
|
|
1358
1371
|
const s = he().backendConfigs[e];
|
|
@@ -1360,20 +1373,20 @@ function Us(n, e = "default") {
|
|
|
1360
1373
|
throw new x(`Backend "${e}" not found in configuration.`);
|
|
1361
1374
|
return s.fileRootURL ? s.fileRootURL.replace(/\/$/, "") + n : n;
|
|
1362
1375
|
}
|
|
1363
|
-
function
|
|
1376
|
+
function es(n, e) {
|
|
1364
1377
|
if (!ft)
|
|
1365
1378
|
throw new x("Model registry not registered. Please call registerModelGetter() with the function from model-registry.js during app initialization.");
|
|
1366
1379
|
return ft(n, e);
|
|
1367
1380
|
}
|
|
1368
1381
|
const Fe = {
|
|
1369
|
-
setConfig:
|
|
1382
|
+
setConfig: Ns,
|
|
1370
1383
|
getConfig: he,
|
|
1371
|
-
setBackendConfig:
|
|
1372
|
-
initializeEventReceiver:
|
|
1373
|
-
registerModelGetter:
|
|
1374
|
-
getModelClass:
|
|
1375
|
-
buildFileUrl:
|
|
1376
|
-
},
|
|
1384
|
+
setBackendConfig: xs,
|
|
1385
|
+
initializeEventReceiver: Xt,
|
|
1386
|
+
registerModelGetter: Us,
|
|
1387
|
+
getModelClass: es,
|
|
1388
|
+
buildFileUrl: Qs
|
|
1389
|
+
}, ts = "__STATEZERO_DEBUG__", X = globalThis[ts] || {
|
|
1377
1390
|
emitter: Ae(),
|
|
1378
1391
|
buffer: [],
|
|
1379
1392
|
enabled: !0,
|
|
@@ -1381,7 +1394,7 @@ const Fe = {
|
|
|
1381
1394
|
maxEntries: 500,
|
|
1382
1395
|
nextId: 1
|
|
1383
1396
|
};
|
|
1384
|
-
globalThis[
|
|
1397
|
+
globalThis[ts] = X;
|
|
1385
1398
|
const Me = X.emitter, ue = X.buffer;
|
|
1386
1399
|
function Te(n) {
|
|
1387
1400
|
if (!X.enabled) return;
|
|
@@ -1395,23 +1408,23 @@ function Te(n) {
|
|
|
1395
1408
|
function B(n) {
|
|
1396
1409
|
Te(n);
|
|
1397
1410
|
}
|
|
1398
|
-
function
|
|
1411
|
+
function Vs(n) {
|
|
1399
1412
|
return Me.on("record", n), () => Me.off("record", n);
|
|
1400
1413
|
}
|
|
1401
|
-
function
|
|
1414
|
+
function Ls(n) {
|
|
1402
1415
|
return Me.on("clear", n), () => Me.off("clear", n);
|
|
1403
1416
|
}
|
|
1404
1417
|
function Vt() {
|
|
1405
1418
|
return ue.slice();
|
|
1406
1419
|
}
|
|
1407
|
-
function
|
|
1420
|
+
function Gs() {
|
|
1408
1421
|
ue.length = 0, Me.emit("clear");
|
|
1409
1422
|
}
|
|
1410
1423
|
function Lt(n) {
|
|
1411
1424
|
const e = Number(n);
|
|
1412
1425
|
!Number.isFinite(e) || e <= 0 || (X.maxEntries = Math.floor(e), ue.length > X.maxEntries && ue.splice(0, ue.length - X.maxEntries));
|
|
1413
1426
|
}
|
|
1414
|
-
function
|
|
1427
|
+
function Bs() {
|
|
1415
1428
|
X.started || (X.started = !0, ie.on(C.CREATED, (n) => {
|
|
1416
1429
|
Te({
|
|
1417
1430
|
type: "operation",
|
|
@@ -1465,10 +1478,10 @@ function Gs() {
|
|
|
1465
1478
|
}));
|
|
1466
1479
|
}
|
|
1467
1480
|
const ct = /* @__PURE__ */ new Map();
|
|
1468
|
-
function
|
|
1469
|
-
return ct.has(n) || ct.set(n, new
|
|
1481
|
+
function Hs(n = "default") {
|
|
1482
|
+
return ct.has(n) || ct.set(n, new ps({ concurrency: 1 })), ct.get(n);
|
|
1470
1483
|
}
|
|
1471
|
-
function
|
|
1484
|
+
function qs(n, e = 3e4) {
|
|
1472
1485
|
return Promise.race([
|
|
1473
1486
|
n,
|
|
1474
1487
|
new Promise(
|
|
@@ -1476,7 +1489,7 @@ function Hs(n, e = 3e4) {
|
|
|
1476
1489
|
)
|
|
1477
1490
|
]);
|
|
1478
1491
|
}
|
|
1479
|
-
function
|
|
1492
|
+
function we(n, e, t, s = null) {
|
|
1480
1493
|
if (!e) return;
|
|
1481
1494
|
const r = t.configKey;
|
|
1482
1495
|
let o = null;
|
|
@@ -1535,7 +1548,7 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1535
1548
|
"delete_instance",
|
|
1536
1549
|
"get_or_create",
|
|
1537
1550
|
"update_or_create"
|
|
1538
|
-
].includes(e), U = `${p.API_URL.replace(/\/+$/, "")}/${c.modelName}/`, N = p.getAuthHeaders ? p.getAuthHeaders() : {},
|
|
1551
|
+
].includes(e), U = `${p.API_URL.replace(/\/+$/, "")}/${c.modelName}/`, N = p.getAuthHeaders ? p.getAuthHeaders() : {}, I = n.semanticKey;
|
|
1539
1552
|
s && (N["X-Operation-ID"] = s), o && (N["X-Canonical-ID"] = o);
|
|
1540
1553
|
const re = async () => {
|
|
1541
1554
|
try {
|
|
@@ -1543,7 +1556,7 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1543
1556
|
type: "request",
|
|
1544
1557
|
modelName: c.modelName,
|
|
1545
1558
|
configKey: c.configKey,
|
|
1546
|
-
semanticKey:
|
|
1559
|
+
semanticKey: I,
|
|
1547
1560
|
operationType: e,
|
|
1548
1561
|
operationId: s,
|
|
1549
1562
|
canonicalId: o,
|
|
@@ -1551,61 +1564,61 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1551
1564
|
payload: w,
|
|
1552
1565
|
namespace: l
|
|
1553
1566
|
});
|
|
1554
|
-
let
|
|
1555
|
-
typeof r == "function" &&
|
|
1556
|
-
const
|
|
1557
|
-
let
|
|
1558
|
-
if (
|
|
1559
|
-
const
|
|
1567
|
+
let D = await ms.post(U, We(w), { headers: N });
|
|
1568
|
+
typeof r == "function" && D?.data && await r(D.data);
|
|
1569
|
+
const F = D?.data?.data, K = D?.data?.included, me = Array.isArray(F) ? F.length : F != null ? 1 : 0, Ye = K ? Object.keys(K).length : 0, ye = 100, Ke = Array.isArray(F) && F.length > ye ? F.slice(0, ye) : F, Xe = Array.isArray(F) && F.length > ye;
|
|
1570
|
+
let Re = K, Ee = !1;
|
|
1571
|
+
if (K && typeof K == "object") {
|
|
1572
|
+
const Ne = {};
|
|
1560
1573
|
let ne = 0;
|
|
1561
|
-
for (const [
|
|
1562
|
-
if (
|
|
1574
|
+
for (const [xe, je] of Object.entries(K))
|
|
1575
|
+
if (Ne[xe] = je, ne += 1, ne >= ye) {
|
|
1563
1576
|
Ee = !0;
|
|
1564
1577
|
break;
|
|
1565
1578
|
}
|
|
1566
|
-
|
|
1579
|
+
Re = Ee ? Ne : K;
|
|
1567
1580
|
}
|
|
1568
1581
|
return B({
|
|
1569
1582
|
type: "response",
|
|
1570
1583
|
modelName: c.modelName,
|
|
1571
1584
|
configKey: c.configKey,
|
|
1572
|
-
semanticKey:
|
|
1585
|
+
semanticKey: I,
|
|
1573
1586
|
operationType: e,
|
|
1574
1587
|
operationId: s,
|
|
1575
1588
|
canonicalId: o,
|
|
1576
1589
|
url: U,
|
|
1577
|
-
status:
|
|
1578
|
-
dataCount:
|
|
1590
|
+
status: D.status,
|
|
1591
|
+
dataCount: me,
|
|
1579
1592
|
includedCount: Ye,
|
|
1580
1593
|
data: Ke,
|
|
1581
|
-
included:
|
|
1594
|
+
included: Re,
|
|
1582
1595
|
dataTruncated: Xe,
|
|
1583
1596
|
includedTruncated: Ee
|
|
1584
|
-
}),
|
|
1585
|
-
} catch (
|
|
1597
|
+
}), D.data;
|
|
1598
|
+
} catch (D) {
|
|
1586
1599
|
if (B({
|
|
1587
1600
|
type: "error",
|
|
1588
1601
|
modelName: c.modelName,
|
|
1589
1602
|
configKey: c.configKey,
|
|
1590
|
-
semanticKey:
|
|
1603
|
+
semanticKey: I,
|
|
1591
1604
|
operationType: e,
|
|
1592
1605
|
operationId: s,
|
|
1593
1606
|
canonicalId: o,
|
|
1594
1607
|
url: U,
|
|
1595
|
-
status:
|
|
1596
|
-
message:
|
|
1597
|
-
}),
|
|
1598
|
-
const
|
|
1599
|
-
throw new Error(`${
|
|
1608
|
+
status: D?.response?.status,
|
|
1609
|
+
message: D?.message
|
|
1610
|
+
}), D?.code === "ECONNREFUSED") {
|
|
1611
|
+
const F = "Connection refused. If you're running tests, start the test server with `python manage.py statezero_testserver`.";
|
|
1612
|
+
throw new Error(`${F} (${U})`);
|
|
1600
1613
|
}
|
|
1601
|
-
if (
|
|
1602
|
-
const
|
|
1603
|
-
throw Error.captureStackTrace && Error.captureStackTrace(
|
|
1614
|
+
if (D.response && D.response.data) {
|
|
1615
|
+
const F = Ps(D.response.data);
|
|
1616
|
+
throw Error.captureStackTrace && Error.captureStackTrace(F, L), F;
|
|
1604
1617
|
}
|
|
1605
|
-
throw new Error(`API call failed: ${
|
|
1618
|
+
throw new Error(`API call failed: ${D.message}`);
|
|
1606
1619
|
}
|
|
1607
|
-
},
|
|
1608
|
-
return a ?
|
|
1620
|
+
}, pe = Hs(l), ae = b ? pe.add(re) : re();
|
|
1621
|
+
return a ? qs(ae, a) : ae;
|
|
1609
1622
|
}
|
|
1610
1623
|
class Gt {
|
|
1611
1624
|
// Supported Django strftime formats and their date-fns equivalents
|
|
@@ -1657,11 +1670,11 @@ class Gt {
|
|
|
1657
1670
|
);
|
|
1658
1671
|
try {
|
|
1659
1672
|
if (!l || l === "iso-8601") {
|
|
1660
|
-
const c =
|
|
1673
|
+
const c = _e.fromISO(e, { zone: r });
|
|
1661
1674
|
return c.isValid ? c.toJSDate() : (console.error(`Failed to parse ISO date "${e}":`, c.invalidReason), null);
|
|
1662
1675
|
}
|
|
1663
1676
|
const a = this.SUPPORTED_FORMATS[l];
|
|
1664
|
-
return
|
|
1677
|
+
return gs(e, a, /* @__PURE__ */ new Date());
|
|
1665
1678
|
} catch (a) {
|
|
1666
1679
|
return console.error(`Failed to parse date "${e}" with format "${l}"`, a), null;
|
|
1667
1680
|
}
|
|
@@ -1693,13 +1706,13 @@ class Gt {
|
|
|
1693
1706
|
if (!i || i === "iso-8601")
|
|
1694
1707
|
return r === "date" ? e.toISOString().slice(0, 10) : e.toISOString();
|
|
1695
1708
|
const l = this.SUPPORTED_FORMATS[i];
|
|
1696
|
-
return
|
|
1709
|
+
return _s(e, l);
|
|
1697
1710
|
} catch (l) {
|
|
1698
1711
|
return console.error(`Failed to format date with format "${i}"`, l), e.toISOString();
|
|
1699
1712
|
}
|
|
1700
1713
|
}
|
|
1701
1714
|
}
|
|
1702
|
-
function
|
|
1715
|
+
function Js(n) {
|
|
1703
1716
|
if (!n || !n.configKey)
|
|
1704
1717
|
return "UTC";
|
|
1705
1718
|
const e = Fe.getConfig();
|
|
@@ -1757,7 +1770,7 @@ const Bt = {
|
|
|
1757
1770
|
if (E(n) || typeof n != "string") return n;
|
|
1758
1771
|
const { model: t, field: s } = e;
|
|
1759
1772
|
if (t?.schema) {
|
|
1760
|
-
const r =
|
|
1773
|
+
const r = Js(t);
|
|
1761
1774
|
return Gt.parseDate(n, s, t.schema, r);
|
|
1762
1775
|
}
|
|
1763
1776
|
try {
|
|
@@ -1781,7 +1794,7 @@ const Bt = {
|
|
|
1781
1794
|
const { model: t, field: s } = e;
|
|
1782
1795
|
return t.relationshipFields.has(s) && n ? t.relationshipFields.get(s).ModelClass().fromPk(n) : n;
|
|
1783
1796
|
}
|
|
1784
|
-
},
|
|
1797
|
+
}, Ws = {
|
|
1785
1798
|
toInternal: (n, e = {}) => {
|
|
1786
1799
|
if (E(n)) return n;
|
|
1787
1800
|
if (!Array.isArray(n)) throw new Error(`expected array, got ${typeof n}`);
|
|
@@ -1826,10 +1839,10 @@ const Bt = {
|
|
|
1826
1839
|
"one-to-one": ke
|
|
1827
1840
|
},
|
|
1828
1841
|
array: {
|
|
1829
|
-
"many-to-many":
|
|
1842
|
+
"many-to-many": Ws
|
|
1830
1843
|
}
|
|
1831
1844
|
};
|
|
1832
|
-
class
|
|
1845
|
+
class ss {
|
|
1833
1846
|
constructor(e) {
|
|
1834
1847
|
this.modelClass = e;
|
|
1835
1848
|
}
|
|
@@ -1884,16 +1897,15 @@ class ts {
|
|
|
1884
1897
|
return t;
|
|
1885
1898
|
}
|
|
1886
1899
|
}
|
|
1887
|
-
|
|
1888
|
-
function Ws(n) {
|
|
1900
|
+
function Zs(n) {
|
|
1889
1901
|
if (!n || !n.configKey)
|
|
1890
1902
|
return "UTC";
|
|
1891
1903
|
const e = Fe.getConfig();
|
|
1892
1904
|
return (e.backendConfigs[n.configKey] || e.backendConfigs.default).BACKEND_TZ || "UTC";
|
|
1893
1905
|
}
|
|
1894
|
-
function
|
|
1906
|
+
function Ys(n, e, t) {
|
|
1895
1907
|
if (!t?.schema || !n) return e;
|
|
1896
|
-
const s = new
|
|
1908
|
+
const s = new ss(t);
|
|
1897
1909
|
return Array.isArray(e) ? e.map((r) => s.toLiveField(n, r)) : s.toLiveField(n, e);
|
|
1898
1910
|
}
|
|
1899
1911
|
function De(n, e, t, s = {}) {
|
|
@@ -1912,8 +1924,6 @@ function De(n, e, t, s = {}) {
|
|
|
1912
1924
|
"lt",
|
|
1913
1925
|
"lte",
|
|
1914
1926
|
"isnull",
|
|
1915
|
-
"regex",
|
|
1916
|
-
"iregex",
|
|
1917
1927
|
"year",
|
|
1918
1928
|
"month",
|
|
1919
1929
|
"day",
|
|
@@ -1937,63 +1947,63 @@ function De(n, e, t, s = {}) {
|
|
|
1937
1947
|
k === "pk" && p && (k = p.primaryKeyField);
|
|
1938
1948
|
const U = b === c.length - 1;
|
|
1939
1949
|
if (p && p.relationshipFields && p.relationshipFields instanceof Map && p.relationshipFields.has(k)) {
|
|
1940
|
-
const N = p.relationshipFields.get(k),
|
|
1950
|
+
const N = p.relationshipFields.get(k), I = N.ModelClass(), re = N.relationshipType;
|
|
1941
1951
|
if (!U && re === "many-to-many") {
|
|
1942
1952
|
let ae = c.slice(b + 1).join("__");
|
|
1943
1953
|
a.length > 0 ? ae += "__" + a.join("__") : f && (ae += "__" + f);
|
|
1944
|
-
const
|
|
1954
|
+
const D = De(ae, e, I, s), F = m.length > 0 ? m.join(".") + "." + k : k, K = D.requiredPath || D.field, me = `${F}.${K}`;
|
|
1945
1955
|
return {
|
|
1946
|
-
field:
|
|
1947
|
-
operator: { $elemMatch: { [
|
|
1956
|
+
field: F,
|
|
1957
|
+
operator: { $elemMatch: { [D.field]: D.operator } },
|
|
1948
1958
|
isM2M: !0,
|
|
1949
|
-
requiredPath:
|
|
1959
|
+
requiredPath: me
|
|
1950
1960
|
// Full path for data picking
|
|
1951
1961
|
};
|
|
1952
1962
|
}
|
|
1953
1963
|
if (m.push(k), !U)
|
|
1954
|
-
p =
|
|
1964
|
+
p = I;
|
|
1955
1965
|
else {
|
|
1956
1966
|
if (y = !0, re === "many-to-many")
|
|
1957
1967
|
_ = !0, w = k;
|
|
1958
1968
|
else {
|
|
1959
|
-
const
|
|
1960
|
-
m.push(
|
|
1969
|
+
const pe = I.primaryKeyField || "id";
|
|
1970
|
+
m.push(pe), w = pe;
|
|
1961
1971
|
}
|
|
1962
|
-
p =
|
|
1972
|
+
p = I;
|
|
1963
1973
|
}
|
|
1964
1974
|
} else if (p && p.fields && p.fields.includes(k)) {
|
|
1965
1975
|
if (m.push(k), w = k, U)
|
|
1966
1976
|
break;
|
|
1967
1977
|
const N = p.schema?.properties?.[k];
|
|
1968
1978
|
if (N && N.format === "json") {
|
|
1969
|
-
const
|
|
1970
|
-
m.push(...
|
|
1979
|
+
const I = c.slice(b + 1);
|
|
1980
|
+
m.push(...I);
|
|
1971
1981
|
break;
|
|
1972
1982
|
}
|
|
1973
1983
|
throw new Error(`Field '${k}' in '${n}' is not a relationship field and cannot be traversed.`);
|
|
1974
1984
|
} else
|
|
1975
1985
|
throw new Error(`Field '${k}' in '${n}' not found in model ${p.modelName}.`);
|
|
1976
1986
|
}
|
|
1977
|
-
const v = m.join("."), T = i.includes(f) || a.length === 2 && i.includes(a[0]) ? e :
|
|
1987
|
+
const v = m.join("."), T = i.includes(f) || a.length === 2 && i.includes(a[0]) ? e : Ys(w, e, p);
|
|
1978
1988
|
if (a.length === 2) {
|
|
1979
1989
|
const [b, k] = a;
|
|
1980
|
-
return
|
|
1990
|
+
return Xs(v, b, k, T, y);
|
|
1981
1991
|
}
|
|
1982
1992
|
if (f)
|
|
1983
|
-
return
|
|
1993
|
+
return er(v, f, T, y, p, w, _);
|
|
1984
1994
|
if (y) {
|
|
1985
1995
|
let b = T;
|
|
1986
1996
|
return T && typeof T == "object" && "pk" in T && (b = T.pk), _ ? { field: v, operator: { $elemMatch: { pk: { $eq: b } } }, isM2M: !0 } : { field: v, operator: { $eq: b } };
|
|
1987
1997
|
}
|
|
1988
1998
|
return { field: v, operator: { $eq: T } };
|
|
1989
1999
|
}
|
|
1990
|
-
function
|
|
2000
|
+
function Xs(n, e, t, s, r) {
|
|
1991
2001
|
return r ? (console.warn(`Date part comparison on relationship fields may not work as expected: ${n}`), { field: n, operator: { $eq: s } }) : {
|
|
1992
2002
|
field: n,
|
|
1993
2003
|
operator: { [`$${e}_${t}`]: s }
|
|
1994
2004
|
};
|
|
1995
2005
|
}
|
|
1996
|
-
function
|
|
2006
|
+
function er(n, e, t, s, r, o, i = !1) {
|
|
1997
2007
|
function l(a) {
|
|
1998
2008
|
return a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1999
2009
|
}
|
|
@@ -2048,12 +2058,12 @@ function Xs(n, e, t, s, r, o, i = !1) {
|
|
|
2048
2058
|
operator: { $regex: new RegExp(`${l(t)}$`, "i") }
|
|
2049
2059
|
} : e === "in" ? { field: n, operator: { $in: t } } : e === "gt" ? { field: n, operator: { $nin: [null, void 0], $gt: t } } : e === "gte" ? { field: n, operator: { $nin: [null, void 0], $gte: t } } : e === "lt" ? { field: n, operator: { $nin: [null, void 0], $lt: t } } : e === "lte" ? { field: n, operator: { $nin: [null, void 0], $lte: t } } : { field: n, operator: { $eq: t } };
|
|
2050
2060
|
}
|
|
2051
|
-
function
|
|
2052
|
-
const t = e ? new
|
|
2061
|
+
function tr(n = "UTC", e = null) {
|
|
2062
|
+
const t = e ? new ss(e) : null, s = (a, c = null) => a ? a instanceof Date ? a : t && c && typeof a == "string" ? t.toLiveField(c, a) : (console.warn("Date conversion without serializer context:", a), null) : null, r = (a, c, f = null) => {
|
|
2053
2063
|
const p = s(a, f);
|
|
2054
2064
|
if (!p || !(p instanceof Date) || isNaN(p.getTime()))
|
|
2055
2065
|
return null;
|
|
2056
|
-
const m =
|
|
2066
|
+
const m = _e.fromJSDate(p).setZone(n);
|
|
2057
2067
|
return c(m);
|
|
2058
2068
|
}, o = {
|
|
2059
2069
|
// Year - same in both
|
|
@@ -2149,7 +2159,7 @@ function er(n = "UTC", e = null) {
|
|
|
2149
2159
|
return !1;
|
|
2150
2160
|
const _ = s(a, m);
|
|
2151
2161
|
if (!_ || isNaN(_.getTime())) return !1;
|
|
2152
|
-
const w =
|
|
2162
|
+
const w = _e.fromJSDate(y).setZone(n), v = _e.fromJSDate(_).setZone(n);
|
|
2153
2163
|
return w.year === v.year && w.month === v.month && w.day === v.day;
|
|
2154
2164
|
},
|
|
2155
2165
|
c,
|
|
@@ -2163,7 +2173,7 @@ function er(n = "UTC", e = null) {
|
|
|
2163
2173
|
const y = s(p, m);
|
|
2164
2174
|
if (!y || !(y instanceof Date) || isNaN(y.getTime()))
|
|
2165
2175
|
return !1;
|
|
2166
|
-
const _ =
|
|
2176
|
+
const _ = _e.fromJSDate(y).setZone(n);
|
|
2167
2177
|
let w, v, O;
|
|
2168
2178
|
if (typeof a == "string") {
|
|
2169
2179
|
const T = a.split(":");
|
|
@@ -2171,7 +2181,7 @@ function er(n = "UTC", e = null) {
|
|
|
2171
2181
|
} else {
|
|
2172
2182
|
const T = s(a, m);
|
|
2173
2183
|
if (!T) return !1;
|
|
2174
|
-
const b =
|
|
2184
|
+
const b = _e.fromJSDate(T).setZone(n);
|
|
2175
2185
|
w = b.hour, v = b.minute, O = b.second;
|
|
2176
2186
|
}
|
|
2177
2187
|
return _.hour === w && _.minute === v && _.second === O;
|
|
@@ -2201,7 +2211,7 @@ function er(n = "UTC", e = null) {
|
|
|
2201
2211
|
const v = s(_, w);
|
|
2202
2212
|
if (!v || !(v instanceof Date) || isNaN(v.getTime()))
|
|
2203
2213
|
return !1;
|
|
2204
|
-
const O =
|
|
2214
|
+
const O = _e.fromJSDate(v).setZone(n), T = c(O), b = a === "date" ? p : typeof p == "string" ? Number(p) : p;
|
|
2205
2215
|
switch (f) {
|
|
2206
2216
|
case "gt":
|
|
2207
2217
|
return T > b;
|
|
@@ -2223,10 +2233,10 @@ function er(n = "UTC", e = null) {
|
|
|
2223
2233
|
});
|
|
2224
2234
|
}), o;
|
|
2225
2235
|
}
|
|
2226
|
-
function
|
|
2227
|
-
const t =
|
|
2228
|
-
return
|
|
2229
|
-
operations:
|
|
2236
|
+
function sr(n, e) {
|
|
2237
|
+
const t = Zs(e);
|
|
2238
|
+
return Zt(n, {
|
|
2239
|
+
operations: tr(t, e)
|
|
2230
2240
|
});
|
|
2231
2241
|
}
|
|
2232
2242
|
function pt(n, e) {
|
|
@@ -2236,7 +2246,7 @@ function pt(n, e) {
|
|
|
2236
2246
|
const l = De(o, i, e), { field: a, operator: c, isDatePart: f, isM2M: p } = l;
|
|
2237
2247
|
f ? (s.has(a) || s.set(a, []), s.get(a).push({ [a]: c })) : p && c.$elemMatch ? (r.has(a) || r.set(a, []), r.get(a).push(c.$elemMatch)) : t[a] ? t[a] = { ...t[a], ...c } : t[a] = c;
|
|
2238
2248
|
} catch (l) {
|
|
2239
|
-
throw new
|
|
2249
|
+
throw new Oe(`Failed to process field '${o}': ${l.message}`);
|
|
2240
2250
|
}
|
|
2241
2251
|
for (const [o, i] of r.entries())
|
|
2242
2252
|
i.length === 1 ? t[o] = { $elemMatch: i[0] } : t[o] = { $elemMatch: { $and: i } };
|
|
@@ -2257,7 +2267,7 @@ function pt(n, e) {
|
|
|
2257
2267
|
}
|
|
2258
2268
|
return t;
|
|
2259
2269
|
}
|
|
2260
|
-
function
|
|
2270
|
+
function rr(n, e) {
|
|
2261
2271
|
return !n || !n.length ? null : {
|
|
2262
2272
|
$or: n.map((t) => "operator" in t && "conditions" in t ? { [t.operator === "AND" ? "$and" : "$or"]: t.conditions.map((r) => pt(r, e)) } : pt(t, e))
|
|
2263
2273
|
};
|
|
@@ -2268,7 +2278,7 @@ function He(n, e) {
|
|
|
2268
2278
|
const { conditions: t, Q: s } = n;
|
|
2269
2279
|
let r = {};
|
|
2270
2280
|
if (t && Object.keys(t).length > 0 && (r = pt(t, e)), s && s.length > 0) {
|
|
2271
|
-
const o =
|
|
2281
|
+
const o = rr(s, e);
|
|
2272
2282
|
if (o)
|
|
2273
2283
|
return Object.keys(r).length > 0 ? { $and: [r, o] } : o;
|
|
2274
2284
|
}
|
|
@@ -2288,7 +2298,7 @@ function He(n, e) {
|
|
|
2288
2298
|
}
|
|
2289
2299
|
return null;
|
|
2290
2300
|
}
|
|
2291
|
-
function
|
|
2301
|
+
function nr(n, e, t) {
|
|
2292
2302
|
if (!e || !e.searchQuery) return n;
|
|
2293
2303
|
const s = e.searchFields || (n[0] ? Object.keys(n[0]).filter((i) => typeof n[0][i] == "string") : []);
|
|
2294
2304
|
if (!s.length) return n;
|
|
@@ -2311,7 +2321,7 @@ function rr(n, e, t) {
|
|
|
2311
2321
|
};
|
|
2312
2322
|
}
|
|
2313
2323
|
});
|
|
2314
|
-
return n.filter(
|
|
2324
|
+
return n.filter(Zt({ $or: o }));
|
|
2315
2325
|
}
|
|
2316
2326
|
function qt(n, e) {
|
|
2317
2327
|
const t = e.split(".");
|
|
@@ -2323,7 +2333,7 @@ function qt(n, e) {
|
|
|
2323
2333
|
}
|
|
2324
2334
|
return s;
|
|
2325
2335
|
}
|
|
2326
|
-
function
|
|
2336
|
+
function or(n, e) {
|
|
2327
2337
|
return n.map((t) => {
|
|
2328
2338
|
const s = t.startsWith("-"), r = s ? t.substring(1) : t;
|
|
2329
2339
|
try {
|
|
@@ -2340,9 +2350,9 @@ function nr(n, e) {
|
|
|
2340
2350
|
}
|
|
2341
2351
|
});
|
|
2342
2352
|
}
|
|
2343
|
-
function
|
|
2353
|
+
function ir(n, e, t) {
|
|
2344
2354
|
if (!e || !e.length) return [...n];
|
|
2345
|
-
const s =
|
|
2355
|
+
const s = or(e, t);
|
|
2346
2356
|
return [...n].sort((r, o) => {
|
|
2347
2357
|
for (const { field: i, desc: l } of s) {
|
|
2348
2358
|
const a = qt(r, i), c = qt(o, i);
|
|
@@ -2367,9 +2377,9 @@ function mt(n, e, t) {
|
|
|
2367
2377
|
let r = [...n];
|
|
2368
2378
|
if (e.filter) {
|
|
2369
2379
|
const o = He(e.filter, t);
|
|
2370
|
-
o && Object.keys(o).length && (r = r.filter(
|
|
2380
|
+
o && Object.keys(o).length && (r = r.filter(sr(o, t)));
|
|
2371
2381
|
}
|
|
2372
|
-
return e.search && e.search.searchQuery && (r =
|
|
2382
|
+
return e.search && e.search.searchQuery && (r = nr(r, e.search, t)), Array.isArray(e.orderBy) && e.orderBy.length && (r = ir(r, e.orderBy, t)), r.map((o) => o[s]);
|
|
2373
2383
|
}
|
|
2374
2384
|
function yt(n, e) {
|
|
2375
2385
|
const t = /* @__PURE__ */ new Set(), s = e.primaryKeyField;
|
|
@@ -2433,7 +2443,7 @@ function wt(n, e, t, s = !1) {
|
|
|
2433
2443
|
}
|
|
2434
2444
|
return l;
|
|
2435
2445
|
}
|
|
2436
|
-
class
|
|
2446
|
+
class ar {
|
|
2437
2447
|
modelClass;
|
|
2438
2448
|
fetchFn;
|
|
2439
2449
|
queryset;
|
|
@@ -2444,10 +2454,10 @@ class ir {
|
|
|
2444
2454
|
constructor(e, t, s, r = null, o = null, i = {}) {
|
|
2445
2455
|
if (this.modelClass = e, this.fetchFn = t, this.queryset = s, this.isSyncing = !1, this.lastSync = null, this.isTemp = i.isTemp || !1, this.pruneThreshold = i.pruneThreshold || 10, this.groundTruthPks = r || [], this.operationsMap = /* @__PURE__ */ new Map(), this.includedPks = /* @__PURE__ */ new Map(), Array.isArray(o))
|
|
2446
2456
|
for (const l of o) {
|
|
2447
|
-
const c =
|
|
2457
|
+
const c = Pe.get(l.operationId) || new q(l, !0);
|
|
2448
2458
|
this.operationsMap.set(c.operationId, c);
|
|
2449
2459
|
}
|
|
2450
|
-
if (this.qsCache = new
|
|
2460
|
+
if (this.qsCache = new vt("queryset-cache", {}, this.onHydrated.bind(this)), this._lastRenderedPks = null, this.renderCallbacks = /* @__PURE__ */ new Set(), !this.isTemp) {
|
|
2451
2461
|
const l = Q.getStore(this.modelClass);
|
|
2452
2462
|
this._modelStoreUnregister = l.registerRenderCallback(() => {
|
|
2453
2463
|
this._emitRenderEvent();
|
|
@@ -2461,13 +2471,13 @@ class ir {
|
|
|
2461
2471
|
onHydrated(e) {
|
|
2462
2472
|
if (this.groundTruthPks.length === 0 && this.operationsMap.size === 0) {
|
|
2463
2473
|
const t = this.qsCache.get(this.cacheKey);
|
|
2464
|
-
!E(t) && !
|
|
2474
|
+
!E(t) && !ve(t) && this.setGroundTruth(t);
|
|
2465
2475
|
}
|
|
2466
2476
|
}
|
|
2467
2477
|
setCache(e) {
|
|
2468
2478
|
let t = [];
|
|
2469
2479
|
e.forEach((s) => {
|
|
2470
|
-
typeof s == "string" && Je(s) && (s = We(s), E(s) ||
|
|
2480
|
+
typeof s == "string" && Je(s) && (s = We(s), E(s) || ve(dt(s))) || t.push(s);
|
|
2471
2481
|
}), this.qsCache.set(this.cacheKey, t);
|
|
2472
2482
|
}
|
|
2473
2483
|
clearCache() {
|
|
@@ -2491,7 +2501,7 @@ class ir {
|
|
|
2491
2501
|
} catch (s) {
|
|
2492
2502
|
console.warn("Error in render callback:", s);
|
|
2493
2503
|
}
|
|
2494
|
-
}), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e,
|
|
2504
|
+
}), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e, bs.emit(
|
|
2495
2505
|
`${this.modelClass.configKey}::${this.modelClass.modelName}::queryset::render`,
|
|
2496
2506
|
{ ast: this.queryset.build(), ModelClass: this.modelClass }
|
|
2497
2507
|
));
|
|
@@ -2510,7 +2520,13 @@ class ir {
|
|
|
2510
2520
|
this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), this._emitRenderEvent());
|
|
2511
2521
|
}
|
|
2512
2522
|
async setGroundTruth(e) {
|
|
2513
|
-
this.groundTruthPks = Array.isArray(e) ? e : [], this.
|
|
2523
|
+
if (this.groundTruthPks = Array.isArray(e) ? e : [], this.groundTruthPks.length > 500) {
|
|
2524
|
+
const t = this.queryset?._serializerOptions?.limit;
|
|
2525
|
+
console.warn(
|
|
2526
|
+
`[statezero] ⚠️ ${this.modelClass.modelName} (${this.queryset.semanticKey}) received ${this.groundTruthPks.length} items${t ? ` (limit: ${t})` : " with NO limit"}. Live querysets re-render on every change — at this size, this WILL cause UI freezes on mobile. Add .fetch({ limit }) or use narrower filters.`
|
|
2527
|
+
);
|
|
2528
|
+
}
|
|
2529
|
+
this.lastSync = Date.now(), this._emitRenderEvent();
|
|
2514
2530
|
}
|
|
2515
2531
|
async setOperations(e) {
|
|
2516
2532
|
if (this.operationsMap.clear(), Array.isArray(e))
|
|
@@ -2620,8 +2636,10 @@ class ir {
|
|
|
2620
2636
|
t.add(o);
|
|
2621
2637
|
break;
|
|
2622
2638
|
case M.CHECKPOINT:
|
|
2639
|
+
break;
|
|
2623
2640
|
case M.UPDATE:
|
|
2624
2641
|
case M.UPDATE_INSTANCE:
|
|
2642
|
+
t.add(o);
|
|
2625
2643
|
break;
|
|
2626
2644
|
case M.DELETE:
|
|
2627
2645
|
case M.DELETE_INSTANCE:
|
|
@@ -2659,7 +2677,7 @@ class ir {
|
|
|
2659
2677
|
modelClass: this.modelClass,
|
|
2660
2678
|
canonical_id: e
|
|
2661
2679
|
}), { data: r, included: o } = s;
|
|
2662
|
-
E(r) || (this.includedPks.clear(),
|
|
2680
|
+
E(r) || (this.includedPks.clear(), we(Q, o, this.modelClass, this.queryset), this.setGroundTruth(r)), this.setOperations(this.getInflightOperations()), this.lastSync = Date.now(), B({
|
|
2663
2681
|
type: "sync",
|
|
2664
2682
|
phase: "success",
|
|
2665
2683
|
semanticKey: this.queryset.semanticKey,
|
|
@@ -2684,9 +2702,9 @@ class ir {
|
|
|
2684
2702
|
}
|
|
2685
2703
|
}
|
|
2686
2704
|
}
|
|
2687
|
-
class
|
|
2705
|
+
class lr {
|
|
2688
2706
|
constructor() {
|
|
2689
|
-
this.graph = new
|
|
2707
|
+
this.graph = new Dt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
|
|
2690
2708
|
}
|
|
2691
2709
|
/**
|
|
2692
2710
|
* Add a queryset and its parent relationship to the graph
|
|
@@ -2772,10 +2790,10 @@ class ar {
|
|
|
2772
2790
|
return !e && !t ? !0 : !e || !t || e.length !== t.length ? !1 : e.every((s, r) => s === t[r]);
|
|
2773
2791
|
}
|
|
2774
2792
|
clear() {
|
|
2775
|
-
this.graph = new
|
|
2793
|
+
this.graph = new Dt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
|
|
2776
2794
|
}
|
|
2777
2795
|
}
|
|
2778
|
-
class
|
|
2796
|
+
class cr {
|
|
2779
2797
|
#e;
|
|
2780
2798
|
#t;
|
|
2781
2799
|
#s;
|
|
@@ -2815,11 +2833,11 @@ class lr {
|
|
|
2815
2833
|
return j.getStore(this.#e).render().map((r) => (this.#t.primaryKeyField, this.#t.fromPk(r, this.#e)));
|
|
2816
2834
|
}
|
|
2817
2835
|
}
|
|
2818
|
-
class
|
|
2836
|
+
class Ce {
|
|
2819
2837
|
constructor() {
|
|
2820
2838
|
this._stores = /* @__PURE__ */ new Map(), this._tempStores = /* @__PURE__ */ new WeakMap(), this.followingQuerysets = /* @__PURE__ */ new Map(), this.syncManager = () => {
|
|
2821
2839
|
console.warn("SyncManager not set for QuerysetStoreRegistry");
|
|
2822
|
-
}, this.querysetStoreGraph = new
|
|
2840
|
+
}, this.querysetStoreGraph = new lr(), this._groupSyncCache = /* @__PURE__ */ new Map();
|
|
2823
2841
|
}
|
|
2824
2842
|
clear() {
|
|
2825
2843
|
this._stores.forEach((e) => {
|
|
@@ -2867,7 +2885,7 @@ class we {
|
|
|
2867
2885
|
{ namespace: "sync", timeout: 3e4 }
|
|
2868
2886
|
// Sync ops on separate queue
|
|
2869
2887
|
)).data;
|
|
2870
|
-
}, o = new
|
|
2888
|
+
}, o = new ar(
|
|
2871
2889
|
e.ModelClass,
|
|
2872
2890
|
r,
|
|
2873
2891
|
e,
|
|
@@ -2891,7 +2909,7 @@ class we {
|
|
|
2891
2909
|
this.addFollowingQueryset(s, e);
|
|
2892
2910
|
let r;
|
|
2893
2911
|
this._tempStores.has(e) ? (r = this._tempStores.get(e), r.isTemp = !1, r.registerWithModelStore(), this._stores.set(s, r), this.syncManager.followModel(this, e.ModelClass)) : this._stores.has(s) ? r = this._stores.get(s) : (r = this.getStore(e), r.isTemp = !1, r.registerWithModelStore(), this._stores.set(s, r), this.syncManager.followModel(this, e.ModelClass));
|
|
2894
|
-
const o = new
|
|
2912
|
+
const o = new cr(e);
|
|
2895
2913
|
return t && r.sync(), o;
|
|
2896
2914
|
}
|
|
2897
2915
|
/**
|
|
@@ -3009,8 +3027,8 @@ class we {
|
|
|
3009
3027
|
}
|
|
3010
3028
|
}
|
|
3011
3029
|
}
|
|
3012
|
-
const j = new
|
|
3013
|
-
class
|
|
3030
|
+
const j = new Ce();
|
|
3031
|
+
class ze {
|
|
3014
3032
|
/**
|
|
3015
3033
|
* Calculate metric based on ground truth and operations
|
|
3016
3034
|
*/
|
|
@@ -3055,7 +3073,7 @@ class Ie {
|
|
|
3055
3073
|
return isNaN(r) ? 0 : r;
|
|
3056
3074
|
}
|
|
3057
3075
|
}
|
|
3058
|
-
class
|
|
3076
|
+
class dr extends ze {
|
|
3059
3077
|
reduceOperation(e, t, s) {
|
|
3060
3078
|
if (t.status === C.REJECTED)
|
|
3061
3079
|
return e;
|
|
@@ -3063,7 +3081,7 @@ class cr extends Ie {
|
|
|
3063
3081
|
return r === M.CREATE ? e + 1 : [M.DELETE, M.DELETE_INSTANCE].includes(r) ? Math.max(0, e - 1) : e;
|
|
3064
3082
|
}
|
|
3065
3083
|
}
|
|
3066
|
-
class
|
|
3084
|
+
class ur extends ze {
|
|
3067
3085
|
reduceOperation(e, t, s) {
|
|
3068
3086
|
if (t.status === C.REJECTED)
|
|
3069
3087
|
return e;
|
|
@@ -3088,7 +3106,7 @@ class dr extends Ie {
|
|
|
3088
3106
|
}
|
|
3089
3107
|
}
|
|
3090
3108
|
}
|
|
3091
|
-
class
|
|
3109
|
+
class hr extends ze {
|
|
3092
3110
|
getInitialValue() {
|
|
3093
3111
|
return 1 / 0;
|
|
3094
3112
|
}
|
|
@@ -3111,7 +3129,7 @@ class ur extends Ie {
|
|
|
3111
3129
|
return e;
|
|
3112
3130
|
}
|
|
3113
3131
|
}
|
|
3114
|
-
class
|
|
3132
|
+
class fr extends ze {
|
|
3115
3133
|
getInitialValue() {
|
|
3116
3134
|
return -1 / 0;
|
|
3117
3135
|
}
|
|
@@ -3134,15 +3152,15 @@ class hr extends Ie {
|
|
|
3134
3152
|
return e;
|
|
3135
3153
|
}
|
|
3136
3154
|
}
|
|
3137
|
-
class
|
|
3155
|
+
class pr {
|
|
3138
3156
|
// Collection of custom strategy overrides
|
|
3139
3157
|
static #e = /* @__PURE__ */ new Map();
|
|
3140
3158
|
// Default strategy map
|
|
3141
3159
|
static #t = /* @__PURE__ */ new Map([
|
|
3142
|
-
["count", () => new
|
|
3143
|
-
["sum", () => new
|
|
3144
|
-
["min", () => new
|
|
3145
|
-
["max", () => new
|
|
3160
|
+
["count", () => new dr()],
|
|
3161
|
+
["sum", () => new ur()],
|
|
3162
|
+
["min", () => new hr()],
|
|
3163
|
+
["max", () => new fr()]
|
|
3146
3164
|
]);
|
|
3147
3165
|
/**
|
|
3148
3166
|
* Clear all custom strategy overrides
|
|
@@ -3169,7 +3187,7 @@ class fr {
|
|
|
3169
3187
|
static overrideStrategy(e, t, s) {
|
|
3170
3188
|
if (!e || !s)
|
|
3171
3189
|
throw new Error("overrideStrategy requires metricType and strategy");
|
|
3172
|
-
if (!(s instanceof
|
|
3190
|
+
if (!(s instanceof ze))
|
|
3173
3191
|
throw new Error("strategy must be an instance of MetricCalculationStrategy");
|
|
3174
3192
|
let r;
|
|
3175
3193
|
t ? r = this.#s(e, t) : r = `${e}::*::*`, this.#e.set(r, s);
|
|
@@ -3188,9 +3206,9 @@ class fr {
|
|
|
3188
3206
|
return this.#e.has(o) ? this.#e.get(o) : (this.#t.get(s) || this.#t.get("count"))();
|
|
3189
3207
|
}
|
|
3190
3208
|
}
|
|
3191
|
-
class
|
|
3209
|
+
class mr {
|
|
3192
3210
|
constructor(e, t, s, r = null, o = null, i) {
|
|
3193
|
-
this.metricType = e, this.modelClass = t, this.queryset = s, this.field = r, this.ast = o, this.fetchFn = i, this.groundTruthValue = null, this.isSyncing = !1, this.strategy =
|
|
3211
|
+
this.metricType = e, this.modelClass = t, this.queryset = s, this.field = r, this.ast = o, this.fetchFn = i, this.groundTruthValue = null, this.isSyncing = !1, this.strategy = pr.getStrategy(e, t), this.operations = [], this.confirmedOps = /* @__PURE__ */ new Set(), this.metricCache = new vt(
|
|
3194
3212
|
"metric-store-cache",
|
|
3195
3213
|
{},
|
|
3196
3214
|
this.onHydrated.bind(this)
|
|
@@ -3250,7 +3268,7 @@ class pr {
|
|
|
3250
3268
|
onHydrated() {
|
|
3251
3269
|
if (this.groundTruthValue === null) {
|
|
3252
3270
|
const e = this.metricCache.get(this.cacheKey);
|
|
3253
|
-
!E(e) && !
|
|
3271
|
+
!E(e) && !ve(e) && this.setGroundTruth(e?.value);
|
|
3254
3272
|
}
|
|
3255
3273
|
}
|
|
3256
3274
|
setCache() {
|
|
@@ -3264,7 +3282,7 @@ class pr {
|
|
|
3264
3282
|
}
|
|
3265
3283
|
setGroundTruth(e) {
|
|
3266
3284
|
const t = !qe(this.groundTruthValue, e);
|
|
3267
|
-
this.groundTruthValue = e, this.setCache(), t &&
|
|
3285
|
+
this.groundTruthValue = e, this.setCache(), t && Rt.emit("metric::render", {
|
|
3268
3286
|
metricType: this.metricType,
|
|
3269
3287
|
ModelClass: this.modelClass,
|
|
3270
3288
|
field: this.field,
|
|
@@ -3285,7 +3303,7 @@ class pr {
|
|
|
3285
3303
|
this.field,
|
|
3286
3304
|
this.modelClass
|
|
3287
3305
|
);
|
|
3288
|
-
return qe(this._lastCalculatedValue, e) || (this._lastCalculatedValue = e,
|
|
3306
|
+
return qe(this._lastCalculatedValue, e) || (this._lastCalculatedValue = e, Rt.emit("metric::render", {
|
|
3289
3307
|
metricType: this.metricType,
|
|
3290
3308
|
ModelClass: this.modelClass,
|
|
3291
3309
|
field: this.field,
|
|
@@ -3330,13 +3348,13 @@ function te(n, e) {
|
|
|
3330
3348
|
function Z(n) {
|
|
3331
3349
|
return delete n.isOptimistic, delete n.then, delete n.catch, n;
|
|
3332
3350
|
}
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
function
|
|
3351
|
+
ws();
|
|
3352
|
+
Yt.create();
|
|
3353
|
+
function yr(n, e) {
|
|
3336
3354
|
if (!n || !n.__f_expr)
|
|
3337
3355
|
return n;
|
|
3338
3356
|
try {
|
|
3339
|
-
return
|
|
3357
|
+
return Yt.evaluate(n.original_expr, e);
|
|
3340
3358
|
} catch (t) {
|
|
3341
3359
|
return console.warn(`Error evaluating F expression: ${t.message}`), null;
|
|
3342
3360
|
}
|
|
@@ -3395,7 +3413,7 @@ class de {
|
|
|
3395
3413
|
y[i] = p;
|
|
3396
3414
|
for (const [_, w] of Object.entries(t))
|
|
3397
3415
|
if (w && typeof w == "object" && w.__f_expr) {
|
|
3398
|
-
const v =
|
|
3416
|
+
const v = yr(w, m);
|
|
3399
3417
|
v !== null ? y[_] = v : y[_] = m[_];
|
|
3400
3418
|
} else
|
|
3401
3419
|
y[_] = w;
|
|
@@ -3521,7 +3539,7 @@ class Jt extends Array {
|
|
|
3521
3539
|
super(2), this[0] = e, this[1] = t, this.instance = e, this.created = t;
|
|
3522
3540
|
}
|
|
3523
3541
|
}
|
|
3524
|
-
class
|
|
3542
|
+
class gr {
|
|
3525
3543
|
/**
|
|
3526
3544
|
* Executes a get operation (get, first, last) with the QuerySet.
|
|
3527
3545
|
*
|
|
@@ -3536,7 +3554,7 @@ class yr {
|
|
|
3536
3554
|
const { data: p, included: m, model_name: y } = f.data;
|
|
3537
3555
|
if (E(p) || Array.isArray(p) && p.length === 0)
|
|
3538
3556
|
return null;
|
|
3539
|
-
|
|
3557
|
+
we(Q, m, r, e);
|
|
3540
3558
|
const _ = Array.isArray(p) ? p[0] : p;
|
|
3541
3559
|
return a.pk = _, Z(a), a;
|
|
3542
3560
|
}
|
|
@@ -3561,7 +3579,7 @@ class yr {
|
|
|
3561
3579
|
static executeList(e, t = "list", s = {}) {
|
|
3562
3580
|
const r = j.getEntity(e), o = L(e, t, s).then((i) => {
|
|
3563
3581
|
const { data: l, included: a } = i.data;
|
|
3564
|
-
|
|
3582
|
+
we(Q, a, e.ModelClass, e);
|
|
3565
3583
|
const c = Array.isArray(l) ? l : [];
|
|
3566
3584
|
return j.setEntity(e, c), Z(r), r;
|
|
3567
3585
|
});
|
|
@@ -3590,7 +3608,7 @@ class yr {
|
|
|
3590
3608
|
l.operationId
|
|
3591
3609
|
).then((m) => {
|
|
3592
3610
|
const { data: y, included: _, model_name: w } = m.data, v = m.metadata.created;
|
|
3593
|
-
|
|
3611
|
+
we(Q, _, r, e);
|
|
3594
3612
|
const O = Array.isArray(y) ? y[0] : y;
|
|
3595
3613
|
a && (c.pk = O);
|
|
3596
3614
|
const b = (_[w] || {})[O];
|
|
@@ -3617,7 +3635,7 @@ class yr {
|
|
|
3617
3635
|
throw new Error(
|
|
3618
3636
|
`Field parameter is required for ${t} operation`
|
|
3619
3637
|
);
|
|
3620
|
-
const i =
|
|
3638
|
+
const i = Ie.getEntity(t, e, o), l = {};
|
|
3621
3639
|
t !== "exists" && (l.field = o);
|
|
3622
3640
|
const a = L(
|
|
3623
3641
|
e,
|
|
@@ -3625,7 +3643,7 @@ class yr {
|
|
|
3625
3643
|
l
|
|
3626
3644
|
).then((c) => {
|
|
3627
3645
|
const f = c.data, p = j.getEntity(e);
|
|
3628
|
-
return
|
|
3646
|
+
return Ie.setEntity(t, e, o, f, p), Z(i), f;
|
|
3629
3647
|
});
|
|
3630
3648
|
return te(i, a);
|
|
3631
3649
|
}
|
|
@@ -3727,11 +3745,11 @@ class yr {
|
|
|
3727
3745
|
o,
|
|
3728
3746
|
async (p) => {
|
|
3729
3747
|
const { data: m } = p.data, y = Array.isArray(m) ? m[0] : m;
|
|
3730
|
-
|
|
3748
|
+
Kt(o, y);
|
|
3731
3749
|
}
|
|
3732
3750
|
).then((p) => {
|
|
3733
3751
|
const { data: m, included: y, model_name: _ } = p.data;
|
|
3734
|
-
|
|
3752
|
+
we(Q, y, r, e);
|
|
3735
3753
|
const w = Array.isArray(m) ? m[0] : m;
|
|
3736
3754
|
c.pk = w;
|
|
3737
3755
|
const O = (y[_] || {})[w];
|
|
@@ -3777,12 +3795,12 @@ class yr {
|
|
|
3777
3795
|
const { data: m } = p.data;
|
|
3778
3796
|
(Array.isArray(m) ? m : []).forEach((_, w) => {
|
|
3779
3797
|
const v = `${o}_${w}`;
|
|
3780
|
-
|
|
3798
|
+
Kt(v, _);
|
|
3781
3799
|
});
|
|
3782
3800
|
}
|
|
3783
3801
|
).then((p) => {
|
|
3784
3802
|
const { data: m, included: y, model_name: _ } = p.data;
|
|
3785
|
-
|
|
3803
|
+
we(Q, y, r, e);
|
|
3786
3804
|
const w = Array.isArray(m) ? m : [];
|
|
3787
3805
|
w.forEach((T, b) => {
|
|
3788
3806
|
c[b] && (c[b].pk = T);
|
|
@@ -3818,7 +3836,7 @@ class yr {
|
|
|
3818
3836
|
a.operationId
|
|
3819
3837
|
).then((m) => {
|
|
3820
3838
|
const { data: y, included: _, model_name: w } = m.data;
|
|
3821
|
-
|
|
3839
|
+
we(Q, _, r, e);
|
|
3822
3840
|
const v = Array.isArray(y) ? y[0] : y;
|
|
3823
3841
|
f.pk = v;
|
|
3824
3842
|
const T = (_[w] || {})[v];
|
|
@@ -3919,7 +3937,7 @@ class yr {
|
|
|
3919
3937
|
return L(e, t, s);
|
|
3920
3938
|
}
|
|
3921
3939
|
}
|
|
3922
|
-
class
|
|
3940
|
+
class _r {
|
|
3923
3941
|
constructor(e, t, s = null) {
|
|
3924
3942
|
this.queryset = e, this.metricType = t, this.field = s;
|
|
3925
3943
|
}
|
|
@@ -3931,7 +3949,7 @@ class gr {
|
|
|
3931
3949
|
* Delegates to the underlying store's sync method
|
|
3932
3950
|
*/
|
|
3933
3951
|
refreshFromDb() {
|
|
3934
|
-
return
|
|
3952
|
+
return Ie.getStore(
|
|
3935
3953
|
this.metricType,
|
|
3936
3954
|
this.queryset,
|
|
3937
3955
|
this.field
|
|
@@ -3941,7 +3959,7 @@ class gr {
|
|
|
3941
3959
|
* Getter that always returns the current value from the store
|
|
3942
3960
|
*/
|
|
3943
3961
|
get value() {
|
|
3944
|
-
const e =
|
|
3962
|
+
const e = Ie.getStore(
|
|
3945
3963
|
this.metricType,
|
|
3946
3964
|
this.queryset,
|
|
3947
3965
|
this.field
|
|
@@ -3990,8 +4008,8 @@ class Ct {
|
|
|
3990
4008
|
if (!this._stores.has(i)) {
|
|
3991
4009
|
const l = async ({ metricType: c, modelClass: f, field: p, ast: m }) => {
|
|
3992
4010
|
const y = t.clone();
|
|
3993
|
-
return await
|
|
3994
|
-
}, a = new
|
|
4011
|
+
return await gr.executeAgg(y, c, { field: p });
|
|
4012
|
+
}, a = new mr(
|
|
3995
4013
|
e,
|
|
3996
4014
|
r,
|
|
3997
4015
|
t,
|
|
@@ -4014,7 +4032,7 @@ class Ct {
|
|
|
4014
4032
|
if (E(e) || E(t) || E(t.ModelClass))
|
|
4015
4033
|
return null;
|
|
4016
4034
|
this.getStore(e, t, s);
|
|
4017
|
-
const r = new
|
|
4035
|
+
const r = new _r(t, e, s);
|
|
4018
4036
|
return r;
|
|
4019
4037
|
}
|
|
4020
4038
|
/**
|
|
@@ -4024,7 +4042,7 @@ class Ct {
|
|
|
4024
4042
|
if (E(e) || E(t) || E(t.ModelClass))
|
|
4025
4043
|
return null;
|
|
4026
4044
|
const o = this.getStore(e, t, s);
|
|
4027
|
-
return o ? ((!E(o.groundTruthValue) || !
|
|
4045
|
+
return o ? ((!E(o.groundTruthValue) || !ve(o.operations)) && o.reset(), o.setGroundTruth(r), r) : null;
|
|
4028
4046
|
}
|
|
4029
4047
|
/**
|
|
4030
4048
|
* Sync a specific metric with the server
|
|
@@ -4041,8 +4059,8 @@ class Ct {
|
|
|
4041
4059
|
return this._stores.has(e) ? this._stores.get(e).queryset : null;
|
|
4042
4060
|
}
|
|
4043
4061
|
}
|
|
4044
|
-
const
|
|
4045
|
-
class
|
|
4062
|
+
const Ie = new Ct();
|
|
4063
|
+
class wr {
|
|
4046
4064
|
constructor(e) {
|
|
4047
4065
|
this.event = e.event, this.model = e.model, this.operation_id = e.operation_id, this.pk_field_name = e.pk_field_name, this.configKey = e.configKey, this.canonical_id = e.canonical_id || null, this.server_ts_ms = e.server_ts_ms || null, this.instances = e.instances?.map((t) => t && this.pk_field_name && t[this.pk_field_name] != null ? {
|
|
4048
4066
|
...t,
|
|
@@ -4050,7 +4068,7 @@ class _r {
|
|
|
4050
4068
|
} : t) || e.instances, this._cachedInstances = null;
|
|
4051
4069
|
}
|
|
4052
4070
|
get modelClass() {
|
|
4053
|
-
return
|
|
4071
|
+
return es(this.model, this.configKey);
|
|
4054
4072
|
}
|
|
4055
4073
|
async getFullInstances() {
|
|
4056
4074
|
if (this.event === "delete")
|
|
@@ -4064,7 +4082,7 @@ class _r {
|
|
|
4064
4082
|
}).fetch()), this._cachedInstances;
|
|
4065
4083
|
}
|
|
4066
4084
|
}
|
|
4067
|
-
class
|
|
4085
|
+
class Cr {
|
|
4068
4086
|
constructor() {
|
|
4069
4087
|
this.registries = /* @__PURE__ */ new Map(), this.followedModels = /* @__PURE__ */ new Map(), this.followAllQuerysets = !0, this.followedQuerysets = /* @__PURE__ */ new Map(), this.periodicSyncTimer = null, this.eventBatch = /* @__PURE__ */ new Map(), this.debounceTimer = null, this.maxWaitTimer = null, this.debounceMs = 100, this.maxWaitMs = 2e3, this.batchStartTime = null;
|
|
4070
4088
|
}
|
|
@@ -4087,7 +4105,7 @@ class wr {
|
|
|
4087
4105
|
* Initialize event handlers for all event receivers
|
|
4088
4106
|
*/
|
|
4089
4107
|
initialize() {
|
|
4090
|
-
|
|
4108
|
+
js(), Ds().forEach((t, s) => {
|
|
4091
4109
|
t && t.addModelEventHandler(this.handleEvent.bind(this));
|
|
4092
4110
|
}), this.startPeriodicSync();
|
|
4093
4111
|
}
|
|
@@ -4105,7 +4123,7 @@ class wr {
|
|
|
4105
4123
|
}
|
|
4106
4124
|
}
|
|
4107
4125
|
async syncStaleQuerysets() {
|
|
4108
|
-
const e = this.registries.get(
|
|
4126
|
+
const e = this.registries.get(Ce);
|
|
4109
4127
|
if (!e) return;
|
|
4110
4128
|
const t = `periodic-sync-${G()}`, s = new Set(
|
|
4111
4129
|
[...this.followedQuerysets].map((o) => o.semanticKey).filter((o) => e._stores.has(o))
|
|
@@ -4121,7 +4139,7 @@ class wr {
|
|
|
4121
4139
|
), this.pruneUnreferencedModels();
|
|
4122
4140
|
}
|
|
4123
4141
|
pruneUnreferencedModels() {
|
|
4124
|
-
const e = this.registries.get(Ge), t = this.registries.get(
|
|
4142
|
+
const e = this.registries.get(Ge), t = this.registries.get(Ce);
|
|
4125
4143
|
if (!(!e || !t))
|
|
4126
4144
|
for (const [s, r] of e._stores.entries())
|
|
4127
4145
|
r.pruneUnreferencedInstances(t);
|
|
@@ -4166,9 +4184,9 @@ class wr {
|
|
|
4166
4184
|
* Checks the `verify` flag on membership state to determine which querysets need syncing.
|
|
4167
4185
|
*/
|
|
4168
4186
|
syncQuerysetsNeedingVerification(e) {
|
|
4169
|
-
const t =
|
|
4187
|
+
const t = Pe.getQuerysetStates(e);
|
|
4170
4188
|
if (!t) return;
|
|
4171
|
-
const s = this.registries.get(
|
|
4189
|
+
const s = this.registries.get(Ce);
|
|
4172
4190
|
if (!s) return;
|
|
4173
4191
|
const r = [];
|
|
4174
4192
|
for (const [l, a] of t.entries())
|
|
@@ -4197,7 +4215,7 @@ class wr {
|
|
|
4197
4215
|
operationId: e.operation_id,
|
|
4198
4216
|
socketId: e.socket_id
|
|
4199
4217
|
});
|
|
4200
|
-
let t = new
|
|
4218
|
+
let t = new wr(e), s = Pe.has(t.operation_id);
|
|
4201
4219
|
if (this.registries.has(Ct) && this.processMetrics(t), s) {
|
|
4202
4220
|
this.syncQuerysetsNeedingVerification(t.operation_id);
|
|
4203
4221
|
return;
|
|
@@ -4225,7 +4243,7 @@ class wr {
|
|
|
4225
4243
|
s.has(o) || s.set(o, []), s.get(o).push(r);
|
|
4226
4244
|
}), s.forEach((r, o) => {
|
|
4227
4245
|
const i = r[0];
|
|
4228
|
-
this.registries.has(
|
|
4246
|
+
this.registries.has(Ce) && this.processQuerysetsBatch(i, r), this.registries.has(Ge) && this.processModels(i);
|
|
4229
4247
|
});
|
|
4230
4248
|
}
|
|
4231
4249
|
isQuerysetFollowed(e) {
|
|
@@ -4241,7 +4259,7 @@ class wr {
|
|
|
4241
4259
|
return !1;
|
|
4242
4260
|
}
|
|
4243
4261
|
processQuerysetsBatch(e, t) {
|
|
4244
|
-
const s = this.registries.get(
|
|
4262
|
+
const s = this.registries.get(Ce), r = [];
|
|
4245
4263
|
for (const [c, f] of s._stores.entries())
|
|
4246
4264
|
if (f.modelClass.modelName === e.model && f.modelClass.configKey === e.configKey) {
|
|
4247
4265
|
if (this.followAllQuerysets) {
|
|
@@ -4284,7 +4302,7 @@ class wr {
|
|
|
4284
4302
|
(e.instances || []).filter((c) => c && c[e.pk_field_name] != null).map((c) => c[e.pk_field_name])
|
|
4285
4303
|
);
|
|
4286
4304
|
if (r.size === 0) return;
|
|
4287
|
-
const o = new Set(s.groundTruthPks), i = this.registries.get(
|
|
4305
|
+
const o = new Set(s.groundTruthPks), i = this.registries.get(Ce), l = /* @__PURE__ */ new Set();
|
|
4288
4306
|
if (i)
|
|
4289
4307
|
for (const [c, f] of i._stores.entries())
|
|
4290
4308
|
f.modelClass.modelName === e.model && f.modelClass.configKey === e.configKey && f.groundTruthPks.forEach((p) => l.add(p));
|
|
@@ -4294,97 +4312,97 @@ class wr {
|
|
|
4294
4312
|
}), a.length > 0 && s.sync(a);
|
|
4295
4313
|
}
|
|
4296
4314
|
}
|
|
4297
|
-
const $e = new
|
|
4315
|
+
const $e = new Cr();
|
|
4298
4316
|
$e.manageRegistry(j);
|
|
4299
4317
|
$e.manageRegistry(Q);
|
|
4300
|
-
$e.manageRegistry(
|
|
4301
|
-
const
|
|
4302
|
-
function
|
|
4303
|
-
typeof n == "function" &&
|
|
4318
|
+
$e.manageRegistry(Ie);
|
|
4319
|
+
const vr = /* @__PURE__ */ new Set();
|
|
4320
|
+
function Er(n) {
|
|
4321
|
+
typeof n == "function" && vr.add(n);
|
|
4304
4322
|
}
|
|
4305
4323
|
$e.followAllQuerysets = !1;
|
|
4306
|
-
const
|
|
4307
|
-
|
|
4308
|
-
|
|
4324
|
+
const rs = /* @__PURE__ */ new Map();
|
|
4325
|
+
Er(() => {
|
|
4326
|
+
rs.clear(), $e.followAllQuerysets = !0, $e.followedQuerysets.clear();
|
|
4309
4327
|
});
|
|
4310
|
-
const
|
|
4328
|
+
const br = (n, e) => {
|
|
4311
4329
|
const t = n.__vccOpts || n;
|
|
4312
4330
|
for (const [s, r] of e)
|
|
4313
4331
|
t[s] = r;
|
|
4314
4332
|
return t;
|
|
4315
|
-
},
|
|
4333
|
+
}, kr = { class: "szd" }, Sr = { class: "szd-header" }, Tr = { class: "szd-header__top" }, Mr = { class: "szd-header__left" }, $r = {
|
|
4316
4334
|
key: 0,
|
|
4317
4335
|
class: "szd-header__model"
|
|
4318
|
-
},
|
|
4336
|
+
}, Ar = {
|
|
4319
4337
|
key: 1,
|
|
4320
4338
|
class: "szd-header__model szd-header__model--empty"
|
|
4321
|
-
},
|
|
4339
|
+
}, Or = { class: "szd-header__right" }, Pr = {
|
|
4322
4340
|
key: 0,
|
|
4323
4341
|
class: "szd-header__badge szd-header__badge--syncing"
|
|
4324
|
-
},
|
|
4342
|
+
}, Ir = {
|
|
4325
4343
|
key: 1,
|
|
4326
4344
|
class: "szd-header__badge"
|
|
4327
|
-
}, Fr = { class: "szd-header__badge" }, Dr = { class: "szd-tabs" },
|
|
4345
|
+
}, Fr = { class: "szd-header__badge" }, Dr = { class: "szd-tabs" }, zr = ["onClick"], Kr = { class: "szd-content" }, Rr = {
|
|
4328
4346
|
key: 0,
|
|
4329
4347
|
class: "szd-panel"
|
|
4330
|
-
},
|
|
4348
|
+
}, Nr = { class: "szd-panel__section" }, xr = { class: "szd-kv" }, jr = { class: "szd-kv__row" }, Ur = { class: "szd-kv__value" }, Qr = { class: "szd-kv__row" }, Vr = { class: "szd-kv__value" }, Lr = { class: "szd-kv__row" }, Gr = { class: "szd-kv__value" }, Br = { class: "szd-kv__row" }, Hr = { class: "szd-kv__value" }, qr = { class: "szd-panel__section" }, Jr = { class: "szd-stats" }, Wr = { class: "szd-stat" }, Zr = { class: "szd-stat__value" }, Yr = { class: "szd-stat" }, Xr = { class: "szd-stat__value" }, en = { class: "szd-stat" }, tn = { class: "szd-stat__value" }, sn = { class: "szd-stat" }, rn = { class: "szd-stat__value" }, nn = {
|
|
4331
4349
|
class: "szd-kv",
|
|
4332
4350
|
style: { "margin-top": "12px" }
|
|
4333
|
-
},
|
|
4351
|
+
}, on = { class: "szd-kv__row" }, an = { class: "szd-kv__value" }, ln = {
|
|
4334
4352
|
key: 0,
|
|
4335
4353
|
class: "szd-panel__section"
|
|
4336
|
-
},
|
|
4354
|
+
}, cn = { class: "szd-event-preview__text" }, dn = { class: "szd-event-preview__time" }, un = {
|
|
4337
4355
|
key: 1,
|
|
4338
4356
|
class: "szd-panel"
|
|
4339
|
-
},
|
|
4357
|
+
}, hn = { class: "szd-timeline-filters" }, fn = ["onUpdate:modelValue"], pn = { class: "szd-timeline" }, mn = ["onClick"], yn = { class: "szd-timeline__time" }, gn = { class: "szd-timeline__text" }, _n = {
|
|
4340
4358
|
key: 0,
|
|
4341
4359
|
class: "szd-empty"
|
|
4342
|
-
},
|
|
4360
|
+
}, wn = {
|
|
4343
4361
|
key: 2,
|
|
4344
4362
|
class: "szd-panel"
|
|
4345
|
-
},
|
|
4363
|
+
}, Cn = { class: "szd-pipeline" }, vn = ["onClick"], En = { class: "szd-pipeline__label" }, bn = { class: "szd-pipeline__count" }, kn = {
|
|
4346
4364
|
key: 0,
|
|
4347
4365
|
class: "szd-pipeline__arrow"
|
|
4348
|
-
},
|
|
4366
|
+
}, Sn = {
|
|
4349
4367
|
class: "szd-panel__section",
|
|
4350
4368
|
style: { "margin-top": "20px" }
|
|
4351
|
-
},
|
|
4369
|
+
}, Tn = { class: "szd-preview-header" }, Mn = ["value"], $n = {
|
|
4352
4370
|
key: 0,
|
|
4353
4371
|
class: "szd-data-grid"
|
|
4354
|
-
},
|
|
4372
|
+
}, An = { class: "szd-data-card__header" }, On = {
|
|
4355
4373
|
key: 0,
|
|
4356
4374
|
class: "szd-data-card__badge"
|
|
4357
|
-
},
|
|
4375
|
+
}, Pn = {
|
|
4358
4376
|
key: 1,
|
|
4359
4377
|
class: "szd-data-card__badge szd-data-card__badge--absent"
|
|
4360
|
-
},
|
|
4378
|
+
}, In = { class: "szd-data-card__content" }, Fn = {
|
|
4361
4379
|
key: 1,
|
|
4362
4380
|
class: "szd-empty"
|
|
4363
4381
|
}, Dn = {
|
|
4364
4382
|
key: 3,
|
|
4365
4383
|
class: "szd-panel"
|
|
4366
|
-
},
|
|
4384
|
+
}, zn = {
|
|
4367
4385
|
class: "szd-kv",
|
|
4368
4386
|
style: { "margin-bottom": "16px" }
|
|
4369
|
-
}, Kn = { class: "szd-kv__row" },
|
|
4387
|
+
}, Kn = { class: "szd-kv__row" }, Rn = { class: "szd-kv__value szd-kv__value--mono" }, Nn = { class: "szd-ast" }, xn = {
|
|
4370
4388
|
key: 0,
|
|
4371
4389
|
class: "szd-detail"
|
|
4372
|
-
},
|
|
4390
|
+
}, jn = { class: "szd-detail__panel szd-detail__panel--sm" }, Un = { class: "szd-detail__header" }, Qn = { class: "szd-detail__body" }, Vn = { class: "szd-settings-section" }, Ln = ["value"], Gn = {
|
|
4373
4391
|
key: 0,
|
|
4374
4392
|
class: "szd-settings-section"
|
|
4375
|
-
},
|
|
4393
|
+
}, Bn = { class: "szd-settings-row" }, Hn = { class: "szd-settings-code" }, qn = { class: "szd-settings-section" }, Jn = { class: "szd-settings-actions" }, Wn = ["disabled"], Zn = { class: "szd-settings-section" }, Yn = { class: "szd-toggle" }, Xn = {
|
|
4376
4394
|
key: 1,
|
|
4377
4395
|
class: "szd-settings-section"
|
|
4378
|
-
},
|
|
4396
|
+
}, eo = { class: "szd-kv" }, to = { class: "szd-kv__row" }, so = { class: "szd-kv__value" }, ro = { class: "szd-kv__row" }, no = { class: "szd-kv__value" }, oo = { class: "szd-kv__row" }, io = { class: "szd-kv__value" }, ao = { class: "szd-kv__row" }, lo = { class: "szd-kv__value" }, co = { class: "szd-kv__row" }, uo = { class: "szd-kv__value" }, ho = {
|
|
4379
4397
|
key: 0,
|
|
4380
4398
|
class: "szd-detail"
|
|
4381
|
-
},
|
|
4399
|
+
}, fo = { class: "szd-detail__panel" }, po = { class: "szd-detail__header" }, mo = { class: "szd-detail__title" }, yo = { class: "szd-detail__body" }, go = { class: "szd-kv" }, _o = { class: "szd-kv__key" }, wo = { class: "szd-kv__value" }, Co = { class: "szd-ast" }, vo = {
|
|
4382
4400
|
class: "szd-kv",
|
|
4383
4401
|
style: { "margin-bottom": "16px" }
|
|
4384
|
-
},
|
|
4402
|
+
}, Eo = { class: "szd-kv__row" }, bo = { class: "szd-kv__value" }, ko = { class: "szd-kv__row" }, So = { class: "szd-kv__value" }, To = {
|
|
4385
4403
|
key: 0,
|
|
4386
4404
|
class: "szd-kv__note"
|
|
4387
|
-
},
|
|
4405
|
+
}, Mo = { class: "szd-ast" }, Wt = 100, $o = {
|
|
4388
4406
|
__name: "StateZeroDebugPanel",
|
|
4389
4407
|
props: {
|
|
4390
4408
|
queryset: { type: [Object, String], default: null },
|
|
@@ -4419,7 +4437,7 @@ const Er = (n, e) => {
|
|
|
4419
4437
|
), v = R(() => {
|
|
4420
4438
|
a.value;
|
|
4421
4439
|
const u = [];
|
|
4422
|
-
return
|
|
4440
|
+
return rs.forEach((d) => {
|
|
4423
4441
|
d?.semanticKey && u.push({
|
|
4424
4442
|
semanticKey: d.semanticKey,
|
|
4425
4443
|
modelName: d.ModelClass?.modelName,
|
|
@@ -4454,21 +4472,21 @@ const Er = (n, e) => {
|
|
|
4454
4472
|
return null;
|
|
4455
4473
|
}
|
|
4456
4474
|
return k.value && j._stores.get(k.value) || null;
|
|
4457
|
-
}),
|
|
4475
|
+
}), I = R(() => {
|
|
4458
4476
|
a.value;
|
|
4459
|
-
const u = N.value, d = U.value, g = u?.modelClass?.modelName || d?.ModelClass?.modelName,
|
|
4477
|
+
const u = N.value, d = U.value, g = u?.modelClass?.modelName || d?.ModelClass?.modelName, z = u?.modelClass?.configKey || d?.ModelClass?.configKey, H = u?.groundTruthPks?.length ?? 0, oe = u?.operationsMap?.size ?? 0, le = u?.getInflightOperations?.() || [], be = u?.isSyncing ?? !1, Ue = u?.lastSync ? new Date(u.lastSync).toLocaleString() : "—", ot = u && Array.isArray(u._lastRenderedPks) ? u._lastRenderedPks.length : null, cs = u?.groundTruthPks?.length ?? 0, ds = u ? u.lastSync === null ? "model store" : "ground truth" : "—", us = be ? "Sync in progress — results may change." : oe > 0 ? "Optimistic operations are applied to results." : u?.lastSync === null ? "No ground truth yet — rendering from model store." : "Using ground truth + local filters.";
|
|
4460
4478
|
return {
|
|
4461
4479
|
modelName: g,
|
|
4462
|
-
configKey:
|
|
4480
|
+
configKey: z,
|
|
4463
4481
|
groundTruthCount: H,
|
|
4464
4482
|
opsCount: oe,
|
|
4465
4483
|
inFlightCount: le.length,
|
|
4466
4484
|
isSyncing: be,
|
|
4467
|
-
lastSync:
|
|
4485
|
+
lastSync: Ue,
|
|
4468
4486
|
optimisticCount: ot,
|
|
4469
|
-
confirmedCount:
|
|
4470
|
-
source:
|
|
4471
|
-
reason:
|
|
4487
|
+
confirmedCount: cs,
|
|
4488
|
+
source: ds,
|
|
4489
|
+
reason: us
|
|
4472
4490
|
};
|
|
4473
4491
|
}), re = R(() => {
|
|
4474
4492
|
a.value;
|
|
@@ -4478,27 +4496,27 @@ const Er = (n, e) => {
|
|
|
4478
4496
|
return { error: u?.message || "Failed to build AST" };
|
|
4479
4497
|
}
|
|
4480
4498
|
});
|
|
4481
|
-
function
|
|
4499
|
+
function pe(u) {
|
|
4482
4500
|
if (!u?.filter?.conditions) return "—";
|
|
4483
4501
|
const d = u.filter.conditions;
|
|
4484
|
-
return typeof d != "object" ? String(d) : Object.entries(d).map(([
|
|
4502
|
+
return typeof d != "object" ? String(d) : Object.entries(d).map(([z, H]) => H === null ? `${z}: null` : typeof H == "object" ? `${z}: ${JSON.stringify(H)}` : `${z}: ${H}`).join(", ");
|
|
4485
4503
|
}
|
|
4486
4504
|
function ae(u) {
|
|
4487
4505
|
const d = u?.orderBy;
|
|
4488
4506
|
return !d || Array.isArray(d) && d.length === 0 ? "—" : Array.isArray(d) ? d.join(", ") : String(d);
|
|
4489
4507
|
}
|
|
4490
|
-
const
|
|
4508
|
+
const D = R(() => {
|
|
4491
4509
|
const u = re.value;
|
|
4492
4510
|
return {
|
|
4493
|
-
filter:
|
|
4511
|
+
filter: pe(u),
|
|
4494
4512
|
orderBy: ae(u),
|
|
4495
4513
|
limit: u?.serializerOptions?.limit ?? "—"
|
|
4496
4514
|
};
|
|
4497
4515
|
});
|
|
4498
|
-
function
|
|
4516
|
+
function F(u, d, g, z) {
|
|
4499
4517
|
if (!u || !Array.isArray(g)) return [];
|
|
4500
4518
|
const H = [];
|
|
4501
|
-
for (const oe of g.slice(0,
|
|
4519
|
+
for (const oe of g.slice(0, z))
|
|
4502
4520
|
try {
|
|
4503
4521
|
const le = u.fromPk(oe, d);
|
|
4504
4522
|
le && H.push(le.serialize());
|
|
@@ -4506,7 +4524,7 @@ const Er = (n, e) => {
|
|
|
4506
4524
|
}
|
|
4507
4525
|
return H;
|
|
4508
4526
|
}
|
|
4509
|
-
const
|
|
4527
|
+
const K = R(() => {
|
|
4510
4528
|
a.value;
|
|
4511
4529
|
const u = N.value, d = U.value;
|
|
4512
4530
|
if (!u || !d)
|
|
@@ -4523,7 +4541,7 @@ const Er = (n, e) => {
|
|
|
4523
4541
|
finalSample: [],
|
|
4524
4542
|
limit: null
|
|
4525
4543
|
};
|
|
4526
|
-
const g = Array.isArray(u.groundTruthPks) ? [...u.groundTruthPks] : [],
|
|
4544
|
+
const g = Array.isArray(u.groundTruthPks) ? [...u.groundTruthPks] : [], z = u.renderFromData(!0), H = u.renderFromData(!1), oe = u._getValidatedAndFilteredPks(z), le = u.lastSync === null ? u.renderFromModelStore() : [], be = d.build()?.serializerOptions?.limit ?? null, Ue = be ? oe.slice(0, be) : oe, ot = le.length > 0 ? F(
|
|
4527
4545
|
u.modelClass,
|
|
4528
4546
|
d,
|
|
4529
4547
|
le,
|
|
@@ -4532,66 +4550,66 @@ const Er = (n, e) => {
|
|
|
4532
4550
|
return {
|
|
4533
4551
|
modelStoreFiltered: le,
|
|
4534
4552
|
groundTruth: g,
|
|
4535
|
-
optimistic:
|
|
4553
|
+
optimistic: z,
|
|
4536
4554
|
filtered: oe,
|
|
4537
|
-
final:
|
|
4555
|
+
final: Ue,
|
|
4538
4556
|
modelStoreSample: ot,
|
|
4539
|
-
groundTruthSample:
|
|
4557
|
+
groundTruthSample: F(
|
|
4540
4558
|
u.modelClass,
|
|
4541
4559
|
d,
|
|
4542
4560
|
g,
|
|
4543
4561
|
e.sampleSize
|
|
4544
4562
|
),
|
|
4545
|
-
optimisticSample:
|
|
4563
|
+
optimisticSample: F(
|
|
4546
4564
|
u.modelClass,
|
|
4547
4565
|
d,
|
|
4548
|
-
|
|
4566
|
+
z,
|
|
4549
4567
|
e.sampleSize
|
|
4550
4568
|
),
|
|
4551
|
-
filteredSample:
|
|
4569
|
+
filteredSample: F(
|
|
4552
4570
|
u.modelClass,
|
|
4553
4571
|
d,
|
|
4554
4572
|
oe,
|
|
4555
4573
|
e.sampleSize
|
|
4556
4574
|
),
|
|
4557
|
-
finalSample:
|
|
4575
|
+
finalSample: F(
|
|
4558
4576
|
u.modelClass,
|
|
4559
4577
|
d,
|
|
4560
|
-
|
|
4578
|
+
Ue,
|
|
4561
4579
|
e.sampleSize
|
|
4562
4580
|
),
|
|
4563
4581
|
limit: be,
|
|
4564
4582
|
confirmed: H
|
|
4565
4583
|
};
|
|
4566
|
-
}),
|
|
4567
|
-
{ id: "model-store", label: "Model Store", count:
|
|
4568
|
-
{ id: "ground-truth", label: "Ground Truth", count:
|
|
4569
|
-
{ id: "optimistic", label: "Optimistic", count:
|
|
4570
|
-
{ id: "filtered", label: "Filtered", count:
|
|
4571
|
-
{ id: "final", label: "Final", count:
|
|
4572
|
-
]), Ye = R(() =>
|
|
4573
|
-
function
|
|
4584
|
+
}), me = R(() => [
|
|
4585
|
+
{ id: "model-store", label: "Model Store", count: K.value.modelStoreFiltered.length, pks: K.value.modelStoreFiltered },
|
|
4586
|
+
{ id: "ground-truth", label: "Ground Truth", count: K.value.groundTruth.length, pks: K.value.groundTruth },
|
|
4587
|
+
{ id: "optimistic", label: "Optimistic", count: K.value.optimistic.length, pks: K.value.optimistic },
|
|
4588
|
+
{ id: "filtered", label: "Filtered", count: K.value.filtered.length, pks: K.value.filtered },
|
|
4589
|
+
{ id: "final", label: "Final", count: K.value.final.length, pks: K.value.final }
|
|
4590
|
+
]), Ye = R(() => K.value.final || []);
|
|
4591
|
+
function ye(u) {
|
|
4574
4592
|
const d = N.value, g = U.value;
|
|
4575
4593
|
if (!d || !g || u == null) return null;
|
|
4576
4594
|
try {
|
|
4577
|
-
const
|
|
4578
|
-
return
|
|
4595
|
+
const z = d.modelClass.fromPk(u, g);
|
|
4596
|
+
return z ? z.serialize() : null;
|
|
4579
4597
|
} catch {
|
|
4580
4598
|
return null;
|
|
4581
4599
|
}
|
|
4582
4600
|
}
|
|
4583
|
-
R(() => m.value == null ? null :
|
|
4601
|
+
R(() => m.value == null ? null : ye(m.value));
|
|
4584
4602
|
const Ke = R(() => {
|
|
4585
4603
|
if (!f.value || f.value.type !== "snapshot") return [];
|
|
4586
4604
|
const u = f.value.data, d = N.value, g = U.value;
|
|
4587
|
-
return !d || !g || !u.pks ? [] :
|
|
4588
|
-
}), Xe = R(() => !f.value || f.value.type !== "snapshot" ? !1 : f.value.data.count > Wt),
|
|
4605
|
+
return !d || !g || !u.pks ? [] : F(d.modelClass, g, u.pks, Wt);
|
|
4606
|
+
}), Xe = R(() => !f.value || f.value.type !== "snapshot" ? !1 : f.value.data.count > Wt), Re = R(() => {
|
|
4589
4607
|
if (!k.value) return l.value;
|
|
4590
4608
|
const u = N.value;
|
|
4591
4609
|
return l.value.filter((d) => d.semanticKey === k.value ? !0 : u ? d.modelName === u.modelClass?.modelName && d.configKey === u.modelClass?.configKey : !1);
|
|
4592
|
-
}), Ee = R(() =>
|
|
4610
|
+
}), Ee = R(() => Re.value.filter((u) => y.value[u.type])), Ne = R(() => l.value.length), ne = R(
|
|
4593
4611
|
() => l.value.length ? l.value[l.value.length - 1] : null
|
|
4594
|
-
),
|
|
4612
|
+
), xe = [
|
|
4595
4613
|
{ id: "request", label: "Requests", color: "#3b82f6" },
|
|
4596
4614
|
{ id: "response", label: "Responses", color: "#22c55e" },
|
|
4597
4615
|
{ id: "render", label: "Renders", color: "#a855f7" },
|
|
@@ -4602,8 +4620,8 @@ const Er = (n, e) => {
|
|
|
4602
4620
|
{ id: "groupSync", label: "Group Sync", color: "#8b5cf6" },
|
|
4603
4621
|
{ id: "error", label: "Errors", color: "#ef4444" }
|
|
4604
4622
|
];
|
|
4605
|
-
function
|
|
4606
|
-
return
|
|
4623
|
+
function je(u) {
|
|
4624
|
+
return xe.find((d) => d.id === u)?.color || "#6b7280";
|
|
4607
4625
|
}
|
|
4608
4626
|
function et(u) {
|
|
4609
4627
|
if (!u) return "";
|
|
@@ -4613,7 +4631,7 @@ const Er = (n, e) => {
|
|
|
4613
4631
|
return "";
|
|
4614
4632
|
}
|
|
4615
4633
|
}
|
|
4616
|
-
function
|
|
4634
|
+
function Et(u) {
|
|
4617
4635
|
if (!u) return "";
|
|
4618
4636
|
switch (u.type) {
|
|
4619
4637
|
case "request":
|
|
@@ -4638,7 +4656,7 @@ const Er = (n, e) => {
|
|
|
4638
4656
|
return u.type;
|
|
4639
4657
|
}
|
|
4640
4658
|
}
|
|
4641
|
-
function
|
|
4659
|
+
function ns(u) {
|
|
4642
4660
|
if (!u) return null;
|
|
4643
4661
|
const d = {
|
|
4644
4662
|
type: u.type,
|
|
@@ -4670,13 +4688,13 @@ const Er = (n, e) => {
|
|
|
4670
4688
|
return d;
|
|
4671
4689
|
}
|
|
4672
4690
|
}
|
|
4673
|
-
function ns() {
|
|
4674
|
-
Ls(), l.value = [];
|
|
4675
|
-
}
|
|
4676
4691
|
function os() {
|
|
4692
|
+
Gs(), l.value = [];
|
|
4693
|
+
}
|
|
4694
|
+
function is() {
|
|
4677
4695
|
!k.value || !navigator?.clipboard || navigator.clipboard.writeText(k.value);
|
|
4678
4696
|
}
|
|
4679
|
-
async function
|
|
4697
|
+
async function as() {
|
|
4680
4698
|
if (!(!N.value || c.value)) {
|
|
4681
4699
|
c.value = !0;
|
|
4682
4700
|
try {
|
|
@@ -4687,32 +4705,32 @@ const Er = (n, e) => {
|
|
|
4687
4705
|
}
|
|
4688
4706
|
}
|
|
4689
4707
|
}
|
|
4690
|
-
function
|
|
4708
|
+
function bt(u) {
|
|
4691
4709
|
f.value = { type: "entry", data: u };
|
|
4692
4710
|
}
|
|
4693
|
-
function
|
|
4711
|
+
function ls(u) {
|
|
4694
4712
|
f.value = { type: "snapshot", data: u };
|
|
4695
4713
|
}
|
|
4696
|
-
function
|
|
4714
|
+
function kt() {
|
|
4697
4715
|
f.value = null;
|
|
4698
4716
|
}
|
|
4699
|
-
function
|
|
4717
|
+
function St(u) {
|
|
4700
4718
|
Object.keys(y.value).forEach((d) => {
|
|
4701
4719
|
y.value[d] = u;
|
|
4702
4720
|
});
|
|
4703
4721
|
}
|
|
4704
4722
|
let tt = null, st = null, rt = null, nt = null;
|
|
4705
|
-
return
|
|
4706
|
-
|
|
4723
|
+
return hs(() => {
|
|
4724
|
+
Bs(), Lt(e.maxEntries), tt = Vs((u) => {
|
|
4707
4725
|
i.value && (l.value = [...l.value, u], l.value.length > e.maxEntries && (l.value = l.value.slice(-e.maxEntries)));
|
|
4708
|
-
}), st =
|
|
4726
|
+
}), st = Ls(() => {
|
|
4709
4727
|
l.value = [];
|
|
4710
4728
|
}), rt = setInterval(() => {
|
|
4711
4729
|
a.value += 1;
|
|
4712
4730
|
}, 2e3), nt = setInterval(() => {
|
|
4713
4731
|
l.value = Vt();
|
|
4714
4732
|
}, 1e3);
|
|
4715
|
-
}),
|
|
4733
|
+
}), fs(() => {
|
|
4716
4734
|
tt && tt(), st && st(), rt && clearInterval(rt), nt && clearInterval(nt);
|
|
4717
4735
|
}), it(
|
|
4718
4736
|
() => e.maxEntries,
|
|
@@ -4724,17 +4742,17 @@ const Er = (n, e) => {
|
|
|
4724
4742
|
}
|
|
4725
4743
|
), it(k, () => {
|
|
4726
4744
|
m.value = null;
|
|
4727
|
-
}), (u, d) => (A(), $("section",
|
|
4728
|
-
h("header",
|
|
4729
|
-
h("div",
|
|
4730
|
-
h("div",
|
|
4745
|
+
}), (u, d) => (A(), $("section", kr, [
|
|
4746
|
+
h("header", Sr, [
|
|
4747
|
+
h("div", Tr, [
|
|
4748
|
+
h("div", Mr, [
|
|
4731
4749
|
d[9] || (d[9] = h("div", { class: "szd-header__title" }, "StateZero", -1)),
|
|
4732
|
-
k.value ? (A(), $("span",
|
|
4750
|
+
k.value ? (A(), $("span", $r, S(I.value.modelName || "?"), 1)) : (A(), $("span", Ar, "No queryset"))
|
|
4733
4751
|
]),
|
|
4734
|
-
h("div",
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
h("span", Fr, S(
|
|
4752
|
+
h("div", Or, [
|
|
4753
|
+
I.value.isSyncing ? (A(), $("span", Pr, "Syncing")) : V("", !0),
|
|
4754
|
+
I.value.opsCount > 0 ? (A(), $("span", Ir, S(I.value.opsCount) + " ops", 1)) : V("", !0),
|
|
4755
|
+
h("span", Fr, S(Ne.value) + " events", 1),
|
|
4738
4756
|
h("button", {
|
|
4739
4757
|
class: "szd-btn szd-btn--icon",
|
|
4740
4758
|
onClick: d[0] || (d[0] = (g) => p.value = !0),
|
|
@@ -4761,137 +4779,137 @@ const Er = (n, e) => {
|
|
|
4761
4779
|
h("nav", Dr, [
|
|
4762
4780
|
(A(), $(W, null, ce(s, (g) => h("button", {
|
|
4763
4781
|
key: g.id,
|
|
4764
|
-
class:
|
|
4765
|
-
onClick: (
|
|
4766
|
-
}, S(g.label), 11,
|
|
4782
|
+
class: Mt(["szd-tabs__tab", { "szd-tabs__tab--active": t.value === g.id }]),
|
|
4783
|
+
onClick: (z) => t.value = g.id
|
|
4784
|
+
}, S(g.label), 11, zr)), 64))
|
|
4767
4785
|
])
|
|
4768
4786
|
]),
|
|
4769
4787
|
h("main", Kr, [
|
|
4770
|
-
t.value === "overview" ? (A(), $("div",
|
|
4771
|
-
h("div",
|
|
4788
|
+
t.value === "overview" ? (A(), $("div", Rr, [
|
|
4789
|
+
h("div", Nr, [
|
|
4772
4790
|
d[15] || (d[15] = h("h3", { class: "szd-panel__heading" }, "Why This View?", -1)),
|
|
4773
|
-
h("div",
|
|
4774
|
-
h("div",
|
|
4791
|
+
h("div", xr, [
|
|
4792
|
+
h("div", jr, [
|
|
4775
4793
|
d[11] || (d[11] = h("span", { class: "szd-kv__key" }, "Filter:", -1)),
|
|
4776
|
-
h("span",
|
|
4794
|
+
h("span", Ur, S(D.value.filter), 1)
|
|
4777
4795
|
]),
|
|
4778
|
-
h("div",
|
|
4796
|
+
h("div", Qr, [
|
|
4779
4797
|
d[12] || (d[12] = h("span", { class: "szd-kv__key" }, "Order:", -1)),
|
|
4780
|
-
h("span",
|
|
4798
|
+
h("span", Vr, S(D.value.orderBy), 1)
|
|
4781
4799
|
]),
|
|
4782
|
-
h("div",
|
|
4800
|
+
h("div", Lr, [
|
|
4783
4801
|
d[13] || (d[13] = h("span", { class: "szd-kv__key" }, "Limit:", -1)),
|
|
4784
|
-
h("span",
|
|
4802
|
+
h("span", Gr, S(D.value.limit), 1)
|
|
4785
4803
|
]),
|
|
4786
|
-
h("div",
|
|
4804
|
+
h("div", Br, [
|
|
4787
4805
|
d[14] || (d[14] = h("span", { class: "szd-kv__key" }, "Reason:", -1)),
|
|
4788
|
-
h("span",
|
|
4806
|
+
h("span", Hr, S(I.value.reason), 1)
|
|
4789
4807
|
])
|
|
4790
4808
|
])
|
|
4791
4809
|
]),
|
|
4792
|
-
h("div",
|
|
4810
|
+
h("div", qr, [
|
|
4793
4811
|
d[21] || (d[21] = h("h3", { class: "szd-panel__heading" }, "Current State", -1)),
|
|
4794
|
-
h("div",
|
|
4795
|
-
h("div",
|
|
4796
|
-
h("div",
|
|
4812
|
+
h("div", Jr, [
|
|
4813
|
+
h("div", Wr, [
|
|
4814
|
+
h("div", Zr, S(I.value.optimisticCount ?? "—"), 1),
|
|
4797
4815
|
d[16] || (d[16] = h("div", { class: "szd-stat__label" }, "Optimistic", -1))
|
|
4798
4816
|
]),
|
|
4799
|
-
h("div",
|
|
4800
|
-
h("div",
|
|
4817
|
+
h("div", Yr, [
|
|
4818
|
+
h("div", Xr, S(I.value.confirmedCount), 1),
|
|
4801
4819
|
d[17] || (d[17] = h("div", { class: "szd-stat__label" }, "Confirmed", -1))
|
|
4802
4820
|
]),
|
|
4803
|
-
h("div",
|
|
4804
|
-
h("div",
|
|
4821
|
+
h("div", en, [
|
|
4822
|
+
h("div", tn, S(I.value.groundTruthCount), 1),
|
|
4805
4823
|
d[18] || (d[18] = h("div", { class: "szd-stat__label" }, "Ground Truth", -1))
|
|
4806
4824
|
]),
|
|
4807
|
-
h("div",
|
|
4808
|
-
h("div",
|
|
4825
|
+
h("div", sn, [
|
|
4826
|
+
h("div", rn, S(I.value.inFlightCount), 1),
|
|
4809
4827
|
d[19] || (d[19] = h("div", { class: "szd-stat__label" }, "In-Flight", -1))
|
|
4810
4828
|
])
|
|
4811
4829
|
]),
|
|
4812
|
-
h("div",
|
|
4813
|
-
h("div",
|
|
4830
|
+
h("div", nn, [
|
|
4831
|
+
h("div", on, [
|
|
4814
4832
|
d[20] || (d[20] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
|
|
4815
|
-
h("span",
|
|
4833
|
+
h("span", an, S(I.value.lastSync), 1)
|
|
4816
4834
|
])
|
|
4817
4835
|
])
|
|
4818
4836
|
]),
|
|
4819
|
-
ne.value ? (A(), $("div",
|
|
4837
|
+
ne.value ? (A(), $("div", ln, [
|
|
4820
4838
|
d[22] || (d[22] = h("h3", { class: "szd-panel__heading" }, "Last Event", -1)),
|
|
4821
4839
|
h("button", {
|
|
4822
4840
|
class: "szd-event-preview",
|
|
4823
|
-
onClick: d[1] || (d[1] = (g) =>
|
|
4841
|
+
onClick: d[1] || (d[1] = (g) => bt(ne.value))
|
|
4824
4842
|
}, [
|
|
4825
4843
|
h("span", {
|
|
4826
4844
|
class: "szd-event-preview__badge",
|
|
4827
|
-
style: at({ background:
|
|
4845
|
+
style: at({ background: je(ne.value.type) })
|
|
4828
4846
|
}, S(ne.value.type), 5),
|
|
4829
|
-
h("span",
|
|
4830
|
-
h("span",
|
|
4847
|
+
h("span", cn, S(Et(ne.value)), 1),
|
|
4848
|
+
h("span", dn, S(et(ne.value.ts)), 1)
|
|
4831
4849
|
])
|
|
4832
4850
|
])) : V("", !0)
|
|
4833
4851
|
])) : V("", !0),
|
|
4834
|
-
t.value === "timeline" ? (A(), $("div",
|
|
4835
|
-
h("div",
|
|
4852
|
+
t.value === "timeline" ? (A(), $("div", un, [
|
|
4853
|
+
h("div", hn, [
|
|
4836
4854
|
h("button", {
|
|
4837
4855
|
class: "szd-btn szd-btn--sm",
|
|
4838
|
-
onClick: d[2] || (d[2] = (g) =>
|
|
4856
|
+
onClick: d[2] || (d[2] = (g) => St(!0))
|
|
4839
4857
|
}, "All"),
|
|
4840
4858
|
h("button", {
|
|
4841
4859
|
class: "szd-btn szd-btn--sm",
|
|
4842
|
-
onClick: d[3] || (d[3] = (g) =>
|
|
4860
|
+
onClick: d[3] || (d[3] = (g) => St(!1))
|
|
4843
4861
|
}, "None"),
|
|
4844
|
-
(A(), $(W, null, ce(
|
|
4862
|
+
(A(), $(W, null, ce(xe, (g) => h("label", {
|
|
4845
4863
|
key: g.id,
|
|
4846
|
-
class:
|
|
4864
|
+
class: Mt(["szd-filter-chip", { "szd-filter-chip--active": y.value[g.id] }]),
|
|
4847
4865
|
style: at(y.value[g.id] ? { background: g.color, borderColor: g.color } : {})
|
|
4848
4866
|
}, [
|
|
4849
|
-
|
|
4867
|
+
Qe(h("input", {
|
|
4850
4868
|
type: "checkbox",
|
|
4851
|
-
"onUpdate:modelValue": (
|
|
4869
|
+
"onUpdate:modelValue": (z) => y.value[g.id] = z,
|
|
4852
4870
|
class: "szd-filter-chip__input"
|
|
4853
|
-
}, null, 8,
|
|
4854
|
-
[
|
|
4871
|
+
}, null, 8, fn), [
|
|
4872
|
+
[$t, y.value[g.id]]
|
|
4855
4873
|
]),
|
|
4856
|
-
|
|
4874
|
+
Ve(" " + S(g.label), 1)
|
|
4857
4875
|
], 6)), 64))
|
|
4858
4876
|
]),
|
|
4859
|
-
h("div",
|
|
4877
|
+
h("div", pn, [
|
|
4860
4878
|
(A(!0), $(W, null, ce(Ee.value, (g) => (A(), $("div", {
|
|
4861
4879
|
key: g.id,
|
|
4862
4880
|
class: "szd-timeline__item",
|
|
4863
|
-
onClick: (
|
|
4881
|
+
onClick: (z) => bt(g)
|
|
4864
4882
|
}, [
|
|
4865
|
-
h("span",
|
|
4883
|
+
h("span", yn, S(et(g.ts)), 1),
|
|
4866
4884
|
h("span", {
|
|
4867
4885
|
class: "szd-timeline__badge",
|
|
4868
|
-
style: at({ background:
|
|
4886
|
+
style: at({ background: je(g.type) })
|
|
4869
4887
|
}, S(g.type), 5),
|
|
4870
|
-
h("span",
|
|
4871
|
-
], 8,
|
|
4872
|
-
Ee.value.length ? V("", !0) : (A(), $("div",
|
|
4888
|
+
h("span", gn, S(Et(g)), 1)
|
|
4889
|
+
], 8, mn))), 128)),
|
|
4890
|
+
Ee.value.length ? V("", !0) : (A(), $("div", _n, " No events match current filters "))
|
|
4873
4891
|
])
|
|
4874
4892
|
])) : V("", !0),
|
|
4875
|
-
t.value === "data" ? (A(), $("div",
|
|
4893
|
+
t.value === "data" ? (A(), $("div", wn, [
|
|
4876
4894
|
d[25] || (d[25] = h("h3", { class: "szd-panel__heading" }, "Data Pipeline", -1)),
|
|
4877
|
-
h("div",
|
|
4878
|
-
(A(!0), $(W, null, ce(
|
|
4895
|
+
h("div", Cn, [
|
|
4896
|
+
(A(!0), $(W, null, ce(me.value, (g, z) => (A(), $(W, {
|
|
4879
4897
|
key: g.id
|
|
4880
4898
|
}, [
|
|
4881
4899
|
h("div", {
|
|
4882
4900
|
class: "szd-pipeline__stage",
|
|
4883
|
-
onClick: (H) =>
|
|
4901
|
+
onClick: (H) => ls(g)
|
|
4884
4902
|
}, [
|
|
4885
|
-
h("div",
|
|
4886
|
-
h("div",
|
|
4887
|
-
], 8,
|
|
4888
|
-
|
|
4903
|
+
h("div", En, S(g.label), 1),
|
|
4904
|
+
h("div", bn, S(g.count), 1)
|
|
4905
|
+
], 8, vn),
|
|
4906
|
+
z < me.value.length - 1 ? (A(), $("div", kn, "→")) : V("", !0)
|
|
4889
4907
|
], 64))), 128))
|
|
4890
4908
|
]),
|
|
4891
|
-
h("div",
|
|
4892
|
-
h("div",
|
|
4909
|
+
h("div", Sn, [
|
|
4910
|
+
h("div", Tn, [
|
|
4893
4911
|
d[24] || (d[24] = h("h3", { class: "szd-panel__heading" }, "Instance Preview", -1)),
|
|
4894
|
-
|
|
4912
|
+
Qe(h("select", {
|
|
4895
4913
|
"onUpdate:modelValue": d[4] || (d[4] = (g) => m.value = g),
|
|
4896
4914
|
class: "szd-select"
|
|
4897
4915
|
}, [
|
|
@@ -4899,55 +4917,55 @@ const Er = (n, e) => {
|
|
|
4899
4917
|
(A(!0), $(W, null, ce(Ye.value, (g) => (A(), $("option", {
|
|
4900
4918
|
key: g,
|
|
4901
4919
|
value: g
|
|
4902
|
-
}, S(g), 9,
|
|
4920
|
+
}, S(g), 9, Mn))), 128))
|
|
4903
4921
|
], 512), [
|
|
4904
|
-
[
|
|
4922
|
+
[At, m.value]
|
|
4905
4923
|
])
|
|
4906
4924
|
]),
|
|
4907
|
-
m.value != null ? (A(), $("div",
|
|
4908
|
-
(A(!0), $(W, null, ce(
|
|
4925
|
+
m.value != null ? (A(), $("div", $n, [
|
|
4926
|
+
(A(!0), $(W, null, ce(me.value, (g) => (A(), $("div", {
|
|
4909
4927
|
key: g.id,
|
|
4910
4928
|
class: "szd-data-card"
|
|
4911
4929
|
}, [
|
|
4912
|
-
h("div",
|
|
4913
|
-
|
|
4914
|
-
g.pks.includes(m.value) ? (A(), $("span",
|
|
4930
|
+
h("div", An, [
|
|
4931
|
+
Ve(S(g.label) + " ", 1),
|
|
4932
|
+
g.pks.includes(m.value) ? (A(), $("span", On, "Present")) : (A(), $("span", Pn, "Absent"))
|
|
4915
4933
|
]),
|
|
4916
|
-
h("pre",
|
|
4934
|
+
h("pre", In, S(g.pks.includes(m.value) ? JSON.stringify(ye(m.value), null, 2) : "—"), 1)
|
|
4917
4935
|
]))), 128))
|
|
4918
4936
|
])) : (A(), $("div", Fn, "Select an instance to preview"))
|
|
4919
4937
|
])
|
|
4920
4938
|
])) : V("", !0),
|
|
4921
4939
|
t.value === "ast" ? (A(), $("div", Dn, [
|
|
4922
4940
|
d[27] || (d[27] = h("h3", { class: "szd-panel__heading" }, "Query AST", -1)),
|
|
4923
|
-
h("div",
|
|
4941
|
+
h("div", zn, [
|
|
4924
4942
|
h("div", Kn, [
|
|
4925
4943
|
d[26] || (d[26] = h("span", { class: "szd-kv__key" }, "Semantic Key:", -1)),
|
|
4926
|
-
h("code",
|
|
4944
|
+
h("code", Rn, S(k.value || "—"), 1)
|
|
4927
4945
|
])
|
|
4928
4946
|
]),
|
|
4929
|
-
h("pre",
|
|
4947
|
+
h("pre", Nn, S(re.value ? JSON.stringify(re.value, null, 2) : "Select a queryset to view AST"), 1)
|
|
4930
4948
|
])) : V("", !0)
|
|
4931
4949
|
]),
|
|
4932
|
-
|
|
4933
|
-
default:
|
|
4934
|
-
p.value ? (A(), $("div",
|
|
4950
|
+
Tt(Ot, { name: "szd-slide" }, {
|
|
4951
|
+
default: Pt(() => [
|
|
4952
|
+
p.value ? (A(), $("div", xn, [
|
|
4935
4953
|
h("div", {
|
|
4936
4954
|
class: "szd-detail__backdrop",
|
|
4937
4955
|
onClick: d[5] || (d[5] = (g) => p.value = !1)
|
|
4938
4956
|
}),
|
|
4939
|
-
h("div",
|
|
4940
|
-
h("div",
|
|
4957
|
+
h("div", jn, [
|
|
4958
|
+
h("div", Un, [
|
|
4941
4959
|
d[28] || (d[28] = h("h3", { class: "szd-detail__title" }, "Debug Settings", -1)),
|
|
4942
4960
|
h("button", {
|
|
4943
4961
|
class: "szd-btn",
|
|
4944
4962
|
onClick: d[6] || (d[6] = (g) => p.value = !1)
|
|
4945
4963
|
}, "Close")
|
|
4946
4964
|
]),
|
|
4947
|
-
h("div",
|
|
4948
|
-
h("div",
|
|
4965
|
+
h("div", Qn, [
|
|
4966
|
+
h("div", Vn, [
|
|
4949
4967
|
d[30] || (d[30] = h("label", { class: "szd-settings-label" }, "Queryset", -1)),
|
|
4950
|
-
|
|
4968
|
+
Qe(h("select", {
|
|
4951
4969
|
"onUpdate:modelValue": d[7] || (d[7] = (g) => r.value = g),
|
|
4952
4970
|
class: "szd-select szd-select--full"
|
|
4953
4971
|
}, [
|
|
@@ -4955,69 +4973,69 @@ const Er = (n, e) => {
|
|
|
4955
4973
|
(A(!0), $(W, null, ce(b.value, (g) => (A(), $("option", {
|
|
4956
4974
|
key: g.semanticKey,
|
|
4957
4975
|
value: g.semanticKey
|
|
4958
|
-
}, S(g.modelName || "?") + " · " + S(g.semanticKey), 9,
|
|
4976
|
+
}, S(g.modelName || "?") + " · " + S(g.semanticKey), 9, Ln))), 128))
|
|
4959
4977
|
], 512), [
|
|
4960
|
-
[
|
|
4978
|
+
[At, r.value]
|
|
4961
4979
|
])
|
|
4962
4980
|
]),
|
|
4963
|
-
k.value ? (A(), $("div",
|
|
4981
|
+
k.value ? (A(), $("div", Gn, [
|
|
4964
4982
|
d[31] || (d[31] = h("label", { class: "szd-settings-label" }, "Semantic Key", -1)),
|
|
4965
|
-
h("div",
|
|
4966
|
-
h("code",
|
|
4983
|
+
h("div", Bn, [
|
|
4984
|
+
h("code", Hn, S(k.value), 1),
|
|
4967
4985
|
h("button", {
|
|
4968
4986
|
class: "szd-btn szd-btn--sm",
|
|
4969
|
-
onClick:
|
|
4987
|
+
onClick: is
|
|
4970
4988
|
}, "Copy")
|
|
4971
4989
|
])
|
|
4972
4990
|
])) : V("", !0),
|
|
4973
|
-
h("div",
|
|
4991
|
+
h("div", qn, [
|
|
4974
4992
|
d[32] || (d[32] = h("label", { class: "szd-settings-label" }, "Actions", -1)),
|
|
4975
|
-
h("div",
|
|
4993
|
+
h("div", Jn, [
|
|
4976
4994
|
h("button", {
|
|
4977
4995
|
class: "szd-btn",
|
|
4978
|
-
onClick:
|
|
4996
|
+
onClick: as,
|
|
4979
4997
|
disabled: !N.value || c.value
|
|
4980
|
-
}, S(c.value ? "Syncing..." : "Sync Now"), 9,
|
|
4998
|
+
}, S(c.value ? "Syncing..." : "Sync Now"), 9, Wn),
|
|
4981
4999
|
h("button", {
|
|
4982
5000
|
class: "szd-btn",
|
|
4983
|
-
onClick:
|
|
5001
|
+
onClick: os
|
|
4984
5002
|
}, "Clear Events")
|
|
4985
5003
|
])
|
|
4986
5004
|
]),
|
|
4987
|
-
h("div",
|
|
5005
|
+
h("div", Zn, [
|
|
4988
5006
|
d[34] || (d[34] = h("label", { class: "szd-settings-label" }, "Options", -1)),
|
|
4989
|
-
h("label",
|
|
4990
|
-
|
|
5007
|
+
h("label", Yn, [
|
|
5008
|
+
Qe(h("input", {
|
|
4991
5009
|
type: "checkbox",
|
|
4992
5010
|
"onUpdate:modelValue": d[8] || (d[8] = (g) => i.value = g)
|
|
4993
5011
|
}, null, 512), [
|
|
4994
|
-
[
|
|
5012
|
+
[$t, i.value]
|
|
4995
5013
|
]),
|
|
4996
|
-
d[33] || (d[33] =
|
|
5014
|
+
d[33] || (d[33] = Ve(" Live updates ", -1))
|
|
4997
5015
|
])
|
|
4998
5016
|
]),
|
|
4999
|
-
k.value ? (A(), $("div",
|
|
5017
|
+
k.value ? (A(), $("div", Xn, [
|
|
5000
5018
|
d[40] || (d[40] = h("label", { class: "szd-settings-label" }, "Current State", -1)),
|
|
5001
|
-
h("div",
|
|
5002
|
-
h("div",
|
|
5019
|
+
h("div", eo, [
|
|
5020
|
+
h("div", to, [
|
|
5003
5021
|
d[35] || (d[35] = h("span", { class: "szd-kv__key" }, "Model:", -1)),
|
|
5004
|
-
h("span",
|
|
5022
|
+
h("span", so, S(I.value.modelName || "—"), 1)
|
|
5005
5023
|
]),
|
|
5006
|
-
h("div",
|
|
5024
|
+
h("div", ro, [
|
|
5007
5025
|
d[36] || (d[36] = h("span", { class: "szd-kv__key" }, "Source:", -1)),
|
|
5008
|
-
h("span",
|
|
5026
|
+
h("span", no, S(I.value.source), 1)
|
|
5009
5027
|
]),
|
|
5010
|
-
h("div",
|
|
5028
|
+
h("div", oo, [
|
|
5011
5029
|
d[37] || (d[37] = h("span", { class: "szd-kv__key" }, "Syncing:", -1)),
|
|
5012
|
-
h("span",
|
|
5030
|
+
h("span", io, S(I.value.isSyncing ? "Yes" : "No"), 1)
|
|
5013
5031
|
]),
|
|
5014
|
-
h("div",
|
|
5032
|
+
h("div", ao, [
|
|
5015
5033
|
d[38] || (d[38] = h("span", { class: "szd-kv__key" }, "Operations:", -1)),
|
|
5016
|
-
h("span",
|
|
5034
|
+
h("span", lo, S(I.value.opsCount), 1)
|
|
5017
5035
|
]),
|
|
5018
|
-
h("div",
|
|
5036
|
+
h("div", co, [
|
|
5019
5037
|
d[39] || (d[39] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
|
|
5020
|
-
h("span",
|
|
5038
|
+
h("span", uo, S(I.value.lastSync), 1)
|
|
5021
5039
|
])
|
|
5022
5040
|
])
|
|
5023
5041
|
])) : V("", !0)
|
|
@@ -5027,50 +5045,50 @@ const Er = (n, e) => {
|
|
|
5027
5045
|
]),
|
|
5028
5046
|
_: 1
|
|
5029
5047
|
}),
|
|
5030
|
-
|
|
5031
|
-
default:
|
|
5032
|
-
f.value ? (A(), $("div",
|
|
5048
|
+
Tt(Ot, { name: "szd-slide" }, {
|
|
5049
|
+
default: Pt(() => [
|
|
5050
|
+
f.value ? (A(), $("div", ho, [
|
|
5033
5051
|
h("div", {
|
|
5034
5052
|
class: "szd-detail__backdrop",
|
|
5035
|
-
onClick:
|
|
5053
|
+
onClick: kt
|
|
5036
5054
|
}),
|
|
5037
|
-
h("div",
|
|
5038
|
-
h("div",
|
|
5039
|
-
h("h3",
|
|
5055
|
+
h("div", fo, [
|
|
5056
|
+
h("div", po, [
|
|
5057
|
+
h("h3", mo, S(f.value.type === "entry" ? "Event Detail" : "Snapshot: " + f.value.data.label), 1),
|
|
5040
5058
|
h("button", {
|
|
5041
5059
|
class: "szd-btn",
|
|
5042
|
-
onClick:
|
|
5060
|
+
onClick: kt
|
|
5043
5061
|
}, "Close")
|
|
5044
5062
|
]),
|
|
5045
|
-
h("div",
|
|
5063
|
+
h("div", yo, [
|
|
5046
5064
|
f.value.type === "entry" ? (A(), $(W, { key: 0 }, [
|
|
5047
|
-
h("div",
|
|
5048
|
-
(A(!0), $(W, null, ce(
|
|
5049
|
-
key:
|
|
5065
|
+
h("div", go, [
|
|
5066
|
+
(A(!0), $(W, null, ce(ns(f.value.data), (g, z) => (A(), $("div", {
|
|
5067
|
+
key: z,
|
|
5050
5068
|
class: "szd-kv__row"
|
|
5051
5069
|
}, [
|
|
5052
|
-
h("span",
|
|
5053
|
-
h("span",
|
|
5070
|
+
h("span", _o, S(z) + ":", 1),
|
|
5071
|
+
h("span", wo, S(g ?? "—"), 1)
|
|
5054
5072
|
]))), 128))
|
|
5055
5073
|
]),
|
|
5056
5074
|
d[41] || (d[41] = h("h4", { style: { margin: "16px 0 8px" } }, "Raw JSON", -1)),
|
|
5057
|
-
h("pre",
|
|
5075
|
+
h("pre", Co, S(JSON.stringify(f.value.data, null, 2)), 1)
|
|
5058
5076
|
], 64)) : (A(), $(W, { key: 1 }, [
|
|
5059
|
-
h("div",
|
|
5060
|
-
h("div",
|
|
5077
|
+
h("div", vo, [
|
|
5078
|
+
h("div", Eo, [
|
|
5061
5079
|
d[42] || (d[42] = h("span", { class: "szd-kv__key" }, "Total Count:", -1)),
|
|
5062
|
-
h("span",
|
|
5080
|
+
h("span", bo, S(f.value.data.count), 1)
|
|
5063
5081
|
]),
|
|
5064
|
-
h("div",
|
|
5082
|
+
h("div", ko, [
|
|
5065
5083
|
d[43] || (d[43] = h("span", { class: "szd-kv__key" }, "Showing:", -1)),
|
|
5066
|
-
h("span",
|
|
5067
|
-
|
|
5068
|
-
Xe.value ? (A(), $("span",
|
|
5084
|
+
h("span", So, [
|
|
5085
|
+
Ve(S(Ke.value.length) + " items ", 1),
|
|
5086
|
+
Xe.value ? (A(), $("span", To, "(limited to first 100)")) : V("", !0)
|
|
5069
5087
|
])
|
|
5070
5088
|
])
|
|
5071
5089
|
]),
|
|
5072
5090
|
d[44] || (d[44] = h("h4", { style: { margin: "0 0 8px" } }, "Data", -1)),
|
|
5073
|
-
h("pre",
|
|
5091
|
+
h("pre", Mo, S(JSON.stringify(Ke.value, null, 2)), 1)
|
|
5074
5092
|
], 64))
|
|
5075
5093
|
])
|
|
5076
5094
|
])
|
|
@@ -5080,7 +5098,7 @@ const Er = (n, e) => {
|
|
|
5080
5098
|
})
|
|
5081
5099
|
]));
|
|
5082
5100
|
}
|
|
5083
|
-
},
|
|
5101
|
+
}, Go = /* @__PURE__ */ br($o, [["__scopeId", "data-v-6d80920c"]]);
|
|
5084
5102
|
export {
|
|
5085
|
-
|
|
5103
|
+
Go as default
|
|
5086
5104
|
};
|