@statezero/core 0.2.51 → 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 +495 -476
- 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 +3 -2
- 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,31 +1,31 @@
|
|
|
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) {
|
|
23
23
|
return typeof n == "string" && /\{\{\s*TempPK_[^}\s]+\s*\}\}/.test(n);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
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 zt(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",
|
|
@@ -238,7 +238,7 @@ class bs {
|
|
|
238
238
|
}
|
|
239
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 vt {
|
|
|
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 vt("model-cache", {}, this.onHydrated.bind(this)), this._lastRenderedData = /* @__PURE__ */ new Map(), this.renderCallbacks = /* @__PURE__ */ new Set(), this._unsubscribeTempPk =
|
|
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 Nt extends
|
|
953
|
+
class Nt extends fe {
|
|
954
954
|
/**
|
|
955
955
|
* Creates a new DoesNotExist error.
|
|
956
956
|
*
|
|
@@ -961,7 +961,7 @@ class Nt 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,34 +1016,36 @@ 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
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
|
-
const
|
|
1048
|
+
const jt = {
|
|
1036
1049
|
CREATE: "create",
|
|
1037
1050
|
UPDATE: "update",
|
|
1038
1051
|
DELETE: "delete",
|
|
@@ -1040,7 +1053,7 @@ const xt = {
|
|
|
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,
|
|
@@ -1130,7 +1143,7 @@ Common causes:
|
|
|
1130
1143
|
`%cAuthentication failed for channel ${t}. Check your authEndpoint and server-side permissions.`,
|
|
1131
1144
|
"color: orange; font-weight: bold;"
|
|
1132
1145
|
);
|
|
1133
|
-
}), Object.values(
|
|
1146
|
+
}), Object.values(jt).forEach((r) => {
|
|
1134
1147
|
s.bind(r, (o) => {
|
|
1135
1148
|
const i = {
|
|
1136
1149
|
...o,
|
|
@@ -1145,7 +1158,7 @@ Common causes:
|
|
|
1145
1158
|
unsubscribe(e) {
|
|
1146
1159
|
const t = this.channels.get(e);
|
|
1147
1160
|
if (!t) return;
|
|
1148
|
-
Object.values(
|
|
1161
|
+
Object.values(jt).forEach((r) => {
|
|
1149
1162
|
t.unbind(r);
|
|
1150
1163
|
});
|
|
1151
1164
|
const s = e.startsWith("private-") ? e : this.formatChannelName(e);
|
|
@@ -1192,16 +1205,16 @@ function Fs(n, e) {
|
|
|
1192
1205
|
const t = Ze.get(n);
|
|
1193
1206
|
t && t.disconnect(), Ze.set(n, e), e.connect();
|
|
1194
1207
|
}
|
|
1195
|
-
function
|
|
1208
|
+
function Ut(n = "default") {
|
|
1196
1209
|
return Ze.get(n);
|
|
1197
1210
|
}
|
|
1198
1211
|
function Ds() {
|
|
1199
1212
|
return Ze;
|
|
1200
1213
|
}
|
|
1201
|
-
let
|
|
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
|
|
1273
|
-
|
|
1274
|
-
const e =
|
|
1285
|
+
function Ns(n) {
|
|
1286
|
+
Qt = n;
|
|
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
|
-
function
|
|
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
|
-
function
|
|
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,63 +1564,63 @@ 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
|
-
class
|
|
1623
|
+
class Gt {
|
|
1611
1624
|
// Supported Django strftime formats and their date-fns equivalents
|
|
1612
1625
|
static SUPPORTED_FORMATS = {
|
|
1613
1626
|
"iso-8601": null,
|
|
@@ -1657,11 +1670,11 @@ class Lt {
|
|
|
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,19 +1706,19 @@ class Lt {
|
|
|
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();
|
|
1706
1719
|
return (e.backendConfigs[n.configKey] || e.backendConfigs.default).BACKEND_TZ || "UTC";
|
|
1707
1720
|
}
|
|
1708
|
-
const
|
|
1721
|
+
const Bt = {
|
|
1709
1722
|
// Store backend snake_case format internally for consistency with API
|
|
1710
1723
|
toInternal: (n, e = {}) => {
|
|
1711
1724
|
if (typeof n == "string")
|
|
@@ -1742,14 +1755,14 @@ const Gt = {
|
|
|
1742
1755
|
mimeType: n.mime_type
|
|
1743
1756
|
};
|
|
1744
1757
|
}
|
|
1745
|
-
},
|
|
1758
|
+
}, Ht = {
|
|
1746
1759
|
toInternal: (n, e = {}) => {
|
|
1747
1760
|
if (E(n) || typeof n == "string") return n;
|
|
1748
1761
|
if (n instanceof Date) {
|
|
1749
1762
|
const { model: t, field: s, fieldSchema: r } = e, o = t?.schema || r?.format && {
|
|
1750
1763
|
properties: { [s]: { format: r.format } }
|
|
1751
1764
|
};
|
|
1752
|
-
return o ?
|
|
1765
|
+
return o ? Gt.serializeDate(n, s, o) : n.toISOString();
|
|
1753
1766
|
}
|
|
1754
1767
|
throw new Error(`expected string or Date, got ${typeof n}`);
|
|
1755
1768
|
},
|
|
@@ -1757,8 +1770,8 @@ const Gt = {
|
|
|
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 =
|
|
1761
|
-
return
|
|
1773
|
+
const r = Js(t);
|
|
1774
|
+
return Gt.parseDate(n, s, t.schema, r);
|
|
1762
1775
|
}
|
|
1763
1776
|
try {
|
|
1764
1777
|
return new Date(n);
|
|
@@ -1781,7 +1794,7 @@ const Gt = {
|
|
|
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}`);
|
|
@@ -1809,10 +1822,10 @@ const Gt = {
|
|
|
1809
1822
|
}
|
|
1810
1823
|
}, Se = {
|
|
1811
1824
|
string: {
|
|
1812
|
-
"file-path":
|
|
1813
|
-
"image-path":
|
|
1814
|
-
date:
|
|
1815
|
-
"date-time":
|
|
1825
|
+
"file-path": Bt,
|
|
1826
|
+
"image-path": Bt,
|
|
1827
|
+
date: Ht,
|
|
1828
|
+
"date-time": Ht,
|
|
1816
1829
|
"foreign-key": ke,
|
|
1817
1830
|
"one-to-one": ke
|
|
1818
1831
|
},
|
|
@@ -1826,10 +1839,10 @@ const Gt = {
|
|
|
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,15 +1897,15 @@ class ts {
|
|
|
1884
1897
|
return t;
|
|
1885
1898
|
}
|
|
1886
1899
|
}
|
|
1887
|
-
function
|
|
1900
|
+
function Zs(n) {
|
|
1888
1901
|
if (!n || !n.configKey)
|
|
1889
1902
|
return "UTC";
|
|
1890
1903
|
const e = Fe.getConfig();
|
|
1891
1904
|
return (e.backendConfigs[n.configKey] || e.backendConfigs.default).BACKEND_TZ || "UTC";
|
|
1892
1905
|
}
|
|
1893
|
-
function
|
|
1906
|
+
function Ys(n, e, t) {
|
|
1894
1907
|
if (!t?.schema || !n) return e;
|
|
1895
|
-
const s = new
|
|
1908
|
+
const s = new ss(t);
|
|
1896
1909
|
return Array.isArray(e) ? e.map((r) => s.toLiveField(n, r)) : s.toLiveField(n, e);
|
|
1897
1910
|
}
|
|
1898
1911
|
function De(n, e, t, s = {}) {
|
|
@@ -1911,8 +1924,6 @@ function De(n, e, t, s = {}) {
|
|
|
1911
1924
|
"lt",
|
|
1912
1925
|
"lte",
|
|
1913
1926
|
"isnull",
|
|
1914
|
-
"regex",
|
|
1915
|
-
"iregex",
|
|
1916
1927
|
"year",
|
|
1917
1928
|
"month",
|
|
1918
1929
|
"day",
|
|
@@ -1936,63 +1947,63 @@ function De(n, e, t, s = {}) {
|
|
|
1936
1947
|
k === "pk" && p && (k = p.primaryKeyField);
|
|
1937
1948
|
const U = b === c.length - 1;
|
|
1938
1949
|
if (p && p.relationshipFields && p.relationshipFields instanceof Map && p.relationshipFields.has(k)) {
|
|
1939
|
-
const N = p.relationshipFields.get(k),
|
|
1950
|
+
const N = p.relationshipFields.get(k), I = N.ModelClass(), re = N.relationshipType;
|
|
1940
1951
|
if (!U && re === "many-to-many") {
|
|
1941
1952
|
let ae = c.slice(b + 1).join("__");
|
|
1942
1953
|
a.length > 0 ? ae += "__" + a.join("__") : f && (ae += "__" + f);
|
|
1943
|
-
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}`;
|
|
1944
1955
|
return {
|
|
1945
|
-
field:
|
|
1946
|
-
operator: { $elemMatch: { [
|
|
1956
|
+
field: F,
|
|
1957
|
+
operator: { $elemMatch: { [D.field]: D.operator } },
|
|
1947
1958
|
isM2M: !0,
|
|
1948
|
-
requiredPath:
|
|
1959
|
+
requiredPath: me
|
|
1949
1960
|
// Full path for data picking
|
|
1950
1961
|
};
|
|
1951
1962
|
}
|
|
1952
1963
|
if (m.push(k), !U)
|
|
1953
|
-
p =
|
|
1964
|
+
p = I;
|
|
1954
1965
|
else {
|
|
1955
1966
|
if (y = !0, re === "many-to-many")
|
|
1956
1967
|
_ = !0, w = k;
|
|
1957
1968
|
else {
|
|
1958
|
-
const
|
|
1959
|
-
m.push(
|
|
1969
|
+
const pe = I.primaryKeyField || "id";
|
|
1970
|
+
m.push(pe), w = pe;
|
|
1960
1971
|
}
|
|
1961
|
-
p =
|
|
1972
|
+
p = I;
|
|
1962
1973
|
}
|
|
1963
1974
|
} else if (p && p.fields && p.fields.includes(k)) {
|
|
1964
1975
|
if (m.push(k), w = k, U)
|
|
1965
1976
|
break;
|
|
1966
1977
|
const N = p.schema?.properties?.[k];
|
|
1967
1978
|
if (N && N.format === "json") {
|
|
1968
|
-
const
|
|
1969
|
-
m.push(...
|
|
1979
|
+
const I = c.slice(b + 1);
|
|
1980
|
+
m.push(...I);
|
|
1970
1981
|
break;
|
|
1971
1982
|
}
|
|
1972
1983
|
throw new Error(`Field '${k}' in '${n}' is not a relationship field and cannot be traversed.`);
|
|
1973
1984
|
} else
|
|
1974
1985
|
throw new Error(`Field '${k}' in '${n}' not found in model ${p.modelName}.`);
|
|
1975
1986
|
}
|
|
1976
|
-
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);
|
|
1977
1988
|
if (a.length === 2) {
|
|
1978
1989
|
const [b, k] = a;
|
|
1979
|
-
return
|
|
1990
|
+
return Xs(v, b, k, T, y);
|
|
1980
1991
|
}
|
|
1981
1992
|
if (f)
|
|
1982
|
-
return
|
|
1993
|
+
return er(v, f, T, y, p, w, _);
|
|
1983
1994
|
if (y) {
|
|
1984
1995
|
let b = T;
|
|
1985
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 } };
|
|
1986
1997
|
}
|
|
1987
1998
|
return { field: v, operator: { $eq: T } };
|
|
1988
1999
|
}
|
|
1989
|
-
function
|
|
2000
|
+
function Xs(n, e, t, s, r) {
|
|
1990
2001
|
return r ? (console.warn(`Date part comparison on relationship fields may not work as expected: ${n}`), { field: n, operator: { $eq: s } }) : {
|
|
1991
2002
|
field: n,
|
|
1992
2003
|
operator: { [`$${e}_${t}`]: s }
|
|
1993
2004
|
};
|
|
1994
2005
|
}
|
|
1995
|
-
function
|
|
2006
|
+
function er(n, e, t, s, r, o, i = !1) {
|
|
1996
2007
|
function l(a) {
|
|
1997
2008
|
return a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1998
2009
|
}
|
|
@@ -2047,12 +2058,12 @@ function Xs(n, e, t, s, r, o, i = !1) {
|
|
|
2047
2058
|
operator: { $regex: new RegExp(`${l(t)}$`, "i") }
|
|
2048
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 } };
|
|
2049
2060
|
}
|
|
2050
|
-
function
|
|
2051
|
-
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) => {
|
|
2052
2063
|
const p = s(a, f);
|
|
2053
2064
|
if (!p || !(p instanceof Date) || isNaN(p.getTime()))
|
|
2054
2065
|
return null;
|
|
2055
|
-
const m =
|
|
2066
|
+
const m = _e.fromJSDate(p).setZone(n);
|
|
2056
2067
|
return c(m);
|
|
2057
2068
|
}, o = {
|
|
2058
2069
|
// Year - same in both
|
|
@@ -2148,7 +2159,7 @@ function er(n = "UTC", e = null) {
|
|
|
2148
2159
|
return !1;
|
|
2149
2160
|
const _ = s(a, m);
|
|
2150
2161
|
if (!_ || isNaN(_.getTime())) return !1;
|
|
2151
|
-
const w =
|
|
2162
|
+
const w = _e.fromJSDate(y).setZone(n), v = _e.fromJSDate(_).setZone(n);
|
|
2152
2163
|
return w.year === v.year && w.month === v.month && w.day === v.day;
|
|
2153
2164
|
},
|
|
2154
2165
|
c,
|
|
@@ -2162,7 +2173,7 @@ function er(n = "UTC", e = null) {
|
|
|
2162
2173
|
const y = s(p, m);
|
|
2163
2174
|
if (!y || !(y instanceof Date) || isNaN(y.getTime()))
|
|
2164
2175
|
return !1;
|
|
2165
|
-
const _ =
|
|
2176
|
+
const _ = _e.fromJSDate(y).setZone(n);
|
|
2166
2177
|
let w, v, O;
|
|
2167
2178
|
if (typeof a == "string") {
|
|
2168
2179
|
const T = a.split(":");
|
|
@@ -2170,7 +2181,7 @@ function er(n = "UTC", e = null) {
|
|
|
2170
2181
|
} else {
|
|
2171
2182
|
const T = s(a, m);
|
|
2172
2183
|
if (!T) return !1;
|
|
2173
|
-
const b =
|
|
2184
|
+
const b = _e.fromJSDate(T).setZone(n);
|
|
2174
2185
|
w = b.hour, v = b.minute, O = b.second;
|
|
2175
2186
|
}
|
|
2176
2187
|
return _.hour === w && _.minute === v && _.second === O;
|
|
@@ -2200,7 +2211,7 @@ function er(n = "UTC", e = null) {
|
|
|
2200
2211
|
const v = s(_, w);
|
|
2201
2212
|
if (!v || !(v instanceof Date) || isNaN(v.getTime()))
|
|
2202
2213
|
return !1;
|
|
2203
|
-
const O =
|
|
2214
|
+
const O = _e.fromJSDate(v).setZone(n), T = c(O), b = a === "date" ? p : typeof p == "string" ? Number(p) : p;
|
|
2204
2215
|
switch (f) {
|
|
2205
2216
|
case "gt":
|
|
2206
2217
|
return T > b;
|
|
@@ -2222,10 +2233,10 @@ function er(n = "UTC", e = null) {
|
|
|
2222
2233
|
});
|
|
2223
2234
|
}), o;
|
|
2224
2235
|
}
|
|
2225
|
-
function
|
|
2226
|
-
const t =
|
|
2227
|
-
return
|
|
2228
|
-
operations:
|
|
2236
|
+
function sr(n, e) {
|
|
2237
|
+
const t = Zs(e);
|
|
2238
|
+
return Zt(n, {
|
|
2239
|
+
operations: tr(t, e)
|
|
2229
2240
|
});
|
|
2230
2241
|
}
|
|
2231
2242
|
function pt(n, e) {
|
|
@@ -2235,7 +2246,7 @@ function pt(n, e) {
|
|
|
2235
2246
|
const l = De(o, i, e), { field: a, operator: c, isDatePart: f, isM2M: p } = l;
|
|
2236
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;
|
|
2237
2248
|
} catch (l) {
|
|
2238
|
-
throw new
|
|
2249
|
+
throw new Oe(`Failed to process field '${o}': ${l.message}`);
|
|
2239
2250
|
}
|
|
2240
2251
|
for (const [o, i] of r.entries())
|
|
2241
2252
|
i.length === 1 ? t[o] = { $elemMatch: i[0] } : t[o] = { $elemMatch: { $and: i } };
|
|
@@ -2256,7 +2267,7 @@ function pt(n, e) {
|
|
|
2256
2267
|
}
|
|
2257
2268
|
return t;
|
|
2258
2269
|
}
|
|
2259
|
-
function
|
|
2270
|
+
function rr(n, e) {
|
|
2260
2271
|
return !n || !n.length ? null : {
|
|
2261
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))
|
|
2262
2273
|
};
|
|
@@ -2267,7 +2278,7 @@ function He(n, e) {
|
|
|
2267
2278
|
const { conditions: t, Q: s } = n;
|
|
2268
2279
|
let r = {};
|
|
2269
2280
|
if (t && Object.keys(t).length > 0 && (r = pt(t, e)), s && s.length > 0) {
|
|
2270
|
-
const o =
|
|
2281
|
+
const o = rr(s, e);
|
|
2271
2282
|
if (o)
|
|
2272
2283
|
return Object.keys(r).length > 0 ? { $and: [r, o] } : o;
|
|
2273
2284
|
}
|
|
@@ -2287,7 +2298,7 @@ function He(n, e) {
|
|
|
2287
2298
|
}
|
|
2288
2299
|
return null;
|
|
2289
2300
|
}
|
|
2290
|
-
function
|
|
2301
|
+
function nr(n, e, t) {
|
|
2291
2302
|
if (!e || !e.searchQuery) return n;
|
|
2292
2303
|
const s = e.searchFields || (n[0] ? Object.keys(n[0]).filter((i) => typeof n[0][i] == "string") : []);
|
|
2293
2304
|
if (!s.length) return n;
|
|
@@ -2310,9 +2321,9 @@ function rr(n, e, t) {
|
|
|
2310
2321
|
};
|
|
2311
2322
|
}
|
|
2312
2323
|
});
|
|
2313
|
-
return n.filter(
|
|
2324
|
+
return n.filter(Zt({ $or: o }));
|
|
2314
2325
|
}
|
|
2315
|
-
function
|
|
2326
|
+
function qt(n, e) {
|
|
2316
2327
|
const t = e.split(".");
|
|
2317
2328
|
let s = n;
|
|
2318
2329
|
for (const r of t) {
|
|
@@ -2322,7 +2333,7 @@ function Ht(n, e) {
|
|
|
2322
2333
|
}
|
|
2323
2334
|
return s;
|
|
2324
2335
|
}
|
|
2325
|
-
function
|
|
2336
|
+
function or(n, e) {
|
|
2326
2337
|
return n.map((t) => {
|
|
2327
2338
|
const s = t.startsWith("-"), r = s ? t.substring(1) : t;
|
|
2328
2339
|
try {
|
|
@@ -2339,12 +2350,12 @@ function nr(n, e) {
|
|
|
2339
2350
|
}
|
|
2340
2351
|
});
|
|
2341
2352
|
}
|
|
2342
|
-
function
|
|
2353
|
+
function ir(n, e, t) {
|
|
2343
2354
|
if (!e || !e.length) return [...n];
|
|
2344
|
-
const s =
|
|
2355
|
+
const s = or(e, t);
|
|
2345
2356
|
return [...n].sort((r, o) => {
|
|
2346
2357
|
for (const { field: i, desc: l } of s) {
|
|
2347
|
-
const a =
|
|
2358
|
+
const a = qt(r, i), c = qt(o, i);
|
|
2348
2359
|
if (a !== c) {
|
|
2349
2360
|
if (a === null && c !== null) return l ? -1 : 1;
|
|
2350
2361
|
if (a !== null && c === null) return l ? 1 : -1;
|
|
@@ -2366,9 +2377,9 @@ function mt(n, e, t) {
|
|
|
2366
2377
|
let r = [...n];
|
|
2367
2378
|
if (e.filter) {
|
|
2368
2379
|
const o = He(e.filter, t);
|
|
2369
|
-
o && Object.keys(o).length && (r = r.filter(
|
|
2380
|
+
o && Object.keys(o).length && (r = r.filter(sr(o, t)));
|
|
2370
2381
|
}
|
|
2371
|
-
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]);
|
|
2372
2383
|
}
|
|
2373
2384
|
function yt(n, e) {
|
|
2374
2385
|
const t = /* @__PURE__ */ new Set(), s = e.primaryKeyField;
|
|
@@ -2432,7 +2443,7 @@ function wt(n, e, t, s = !1) {
|
|
|
2432
2443
|
}
|
|
2433
2444
|
return l;
|
|
2434
2445
|
}
|
|
2435
|
-
class
|
|
2446
|
+
class ar {
|
|
2436
2447
|
modelClass;
|
|
2437
2448
|
fetchFn;
|
|
2438
2449
|
queryset;
|
|
@@ -2443,7 +2454,7 @@ class ir {
|
|
|
2443
2454
|
constructor(e, t, s, r = null, o = null, i = {}) {
|
|
2444
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))
|
|
2445
2456
|
for (const l of o) {
|
|
2446
|
-
const c =
|
|
2457
|
+
const c = Pe.get(l.operationId) || new q(l, !0);
|
|
2447
2458
|
this.operationsMap.set(c.operationId, c);
|
|
2448
2459
|
}
|
|
2449
2460
|
if (this.qsCache = new vt("queryset-cache", {}, this.onHydrated.bind(this)), this._lastRenderedPks = null, this.renderCallbacks = /* @__PURE__ */ new Set(), !this.isTemp) {
|
|
@@ -2460,13 +2471,13 @@ class ir {
|
|
|
2460
2471
|
onHydrated(e) {
|
|
2461
2472
|
if (this.groundTruthPks.length === 0 && this.operationsMap.size === 0) {
|
|
2462
2473
|
const t = this.qsCache.get(this.cacheKey);
|
|
2463
|
-
!E(t) && !
|
|
2474
|
+
!E(t) && !ve(t) && this.setGroundTruth(t);
|
|
2464
2475
|
}
|
|
2465
2476
|
}
|
|
2466
2477
|
setCache(e) {
|
|
2467
2478
|
let t = [];
|
|
2468
2479
|
e.forEach((s) => {
|
|
2469
|
-
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);
|
|
2470
2481
|
}), this.qsCache.set(this.cacheKey, t);
|
|
2471
2482
|
}
|
|
2472
2483
|
clearCache() {
|
|
@@ -2490,7 +2501,7 @@ class ir {
|
|
|
2490
2501
|
} catch (s) {
|
|
2491
2502
|
console.warn("Error in render callback:", s);
|
|
2492
2503
|
}
|
|
2493
|
-
}), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e,
|
|
2504
|
+
}), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e, bs.emit(
|
|
2494
2505
|
`${this.modelClass.configKey}::${this.modelClass.modelName}::queryset::render`,
|
|
2495
2506
|
{ ast: this.queryset.build(), ModelClass: this.modelClass }
|
|
2496
2507
|
));
|
|
@@ -2509,7 +2520,13 @@ class ir {
|
|
|
2509
2520
|
this.operationsMap.has(e.operationId) && (this.operationsMap.set(e.operationId, e), this._emitRenderEvent());
|
|
2510
2521
|
}
|
|
2511
2522
|
async setGroundTruth(e) {
|
|
2512
|
-
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();
|
|
2513
2530
|
}
|
|
2514
2531
|
async setOperations(e) {
|
|
2515
2532
|
if (this.operationsMap.clear(), Array.isArray(e))
|
|
@@ -2619,8 +2636,10 @@ class ir {
|
|
|
2619
2636
|
t.add(o);
|
|
2620
2637
|
break;
|
|
2621
2638
|
case M.CHECKPOINT:
|
|
2639
|
+
break;
|
|
2622
2640
|
case M.UPDATE:
|
|
2623
2641
|
case M.UPDATE_INSTANCE:
|
|
2642
|
+
t.add(o);
|
|
2624
2643
|
break;
|
|
2625
2644
|
case M.DELETE:
|
|
2626
2645
|
case M.DELETE_INSTANCE:
|
|
@@ -2658,7 +2677,7 @@ class ir {
|
|
|
2658
2677
|
modelClass: this.modelClass,
|
|
2659
2678
|
canonical_id: e
|
|
2660
2679
|
}), { data: r, included: o } = s;
|
|
2661
|
-
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({
|
|
2662
2681
|
type: "sync",
|
|
2663
2682
|
phase: "success",
|
|
2664
2683
|
semanticKey: this.queryset.semanticKey,
|
|
@@ -2683,9 +2702,9 @@ class ir {
|
|
|
2683
2702
|
}
|
|
2684
2703
|
}
|
|
2685
2704
|
}
|
|
2686
|
-
class
|
|
2705
|
+
class lr {
|
|
2687
2706
|
constructor() {
|
|
2688
|
-
this.graph = new
|
|
2707
|
+
this.graph = new Dt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
|
|
2689
2708
|
}
|
|
2690
2709
|
/**
|
|
2691
2710
|
* Add a queryset and its parent relationship to the graph
|
|
@@ -2771,10 +2790,10 @@ class ar {
|
|
|
2771
2790
|
return !e && !t ? !0 : !e || !t || e.length !== t.length ? !1 : e.every((s, r) => s === t[r]);
|
|
2772
2791
|
}
|
|
2773
2792
|
clear() {
|
|
2774
|
-
this.graph = new
|
|
2793
|
+
this.graph = new Dt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
|
|
2775
2794
|
}
|
|
2776
2795
|
}
|
|
2777
|
-
class
|
|
2796
|
+
class cr {
|
|
2778
2797
|
#e;
|
|
2779
2798
|
#t;
|
|
2780
2799
|
#s;
|
|
@@ -2814,11 +2833,11 @@ class lr {
|
|
|
2814
2833
|
return j.getStore(this.#e).render().map((r) => (this.#t.primaryKeyField, this.#t.fromPk(r, this.#e)));
|
|
2815
2834
|
}
|
|
2816
2835
|
}
|
|
2817
|
-
class
|
|
2836
|
+
class Ce {
|
|
2818
2837
|
constructor() {
|
|
2819
2838
|
this._stores = /* @__PURE__ */ new Map(), this._tempStores = /* @__PURE__ */ new WeakMap(), this.followingQuerysets = /* @__PURE__ */ new Map(), this.syncManager = () => {
|
|
2820
2839
|
console.warn("SyncManager not set for QuerysetStoreRegistry");
|
|
2821
|
-
}, this.querysetStoreGraph = new
|
|
2840
|
+
}, this.querysetStoreGraph = new lr(), this._groupSyncCache = /* @__PURE__ */ new Map();
|
|
2822
2841
|
}
|
|
2823
2842
|
clear() {
|
|
2824
2843
|
this._stores.forEach((e) => {
|
|
@@ -2866,7 +2885,7 @@ class we {
|
|
|
2866
2885
|
{ namespace: "sync", timeout: 3e4 }
|
|
2867
2886
|
// Sync ops on separate queue
|
|
2868
2887
|
)).data;
|
|
2869
|
-
}, o = new
|
|
2888
|
+
}, o = new ar(
|
|
2870
2889
|
e.ModelClass,
|
|
2871
2890
|
r,
|
|
2872
2891
|
e,
|
|
@@ -2890,7 +2909,7 @@ class we {
|
|
|
2890
2909
|
this.addFollowingQueryset(s, e);
|
|
2891
2910
|
let r;
|
|
2892
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));
|
|
2893
|
-
const o = new
|
|
2912
|
+
const o = new cr(e);
|
|
2894
2913
|
return t && r.sync(), o;
|
|
2895
2914
|
}
|
|
2896
2915
|
/**
|
|
@@ -3008,8 +3027,8 @@ class we {
|
|
|
3008
3027
|
}
|
|
3009
3028
|
}
|
|
3010
3029
|
}
|
|
3011
|
-
const j = new
|
|
3012
|
-
class
|
|
3030
|
+
const j = new Ce();
|
|
3031
|
+
class ze {
|
|
3013
3032
|
/**
|
|
3014
3033
|
* Calculate metric based on ground truth and operations
|
|
3015
3034
|
*/
|
|
@@ -3054,7 +3073,7 @@ class Ie {
|
|
|
3054
3073
|
return isNaN(r) ? 0 : r;
|
|
3055
3074
|
}
|
|
3056
3075
|
}
|
|
3057
|
-
class
|
|
3076
|
+
class dr extends ze {
|
|
3058
3077
|
reduceOperation(e, t, s) {
|
|
3059
3078
|
if (t.status === C.REJECTED)
|
|
3060
3079
|
return e;
|
|
@@ -3062,7 +3081,7 @@ class cr extends Ie {
|
|
|
3062
3081
|
return r === M.CREATE ? e + 1 : [M.DELETE, M.DELETE_INSTANCE].includes(r) ? Math.max(0, e - 1) : e;
|
|
3063
3082
|
}
|
|
3064
3083
|
}
|
|
3065
|
-
class
|
|
3084
|
+
class ur extends ze {
|
|
3066
3085
|
reduceOperation(e, t, s) {
|
|
3067
3086
|
if (t.status === C.REJECTED)
|
|
3068
3087
|
return e;
|
|
@@ -3087,7 +3106,7 @@ class dr extends Ie {
|
|
|
3087
3106
|
}
|
|
3088
3107
|
}
|
|
3089
3108
|
}
|
|
3090
|
-
class
|
|
3109
|
+
class hr extends ze {
|
|
3091
3110
|
getInitialValue() {
|
|
3092
3111
|
return 1 / 0;
|
|
3093
3112
|
}
|
|
@@ -3110,7 +3129,7 @@ class ur extends Ie {
|
|
|
3110
3129
|
return e;
|
|
3111
3130
|
}
|
|
3112
3131
|
}
|
|
3113
|
-
class
|
|
3132
|
+
class fr extends ze {
|
|
3114
3133
|
getInitialValue() {
|
|
3115
3134
|
return -1 / 0;
|
|
3116
3135
|
}
|
|
@@ -3133,15 +3152,15 @@ class hr extends Ie {
|
|
|
3133
3152
|
return e;
|
|
3134
3153
|
}
|
|
3135
3154
|
}
|
|
3136
|
-
class
|
|
3155
|
+
class pr {
|
|
3137
3156
|
// Collection of custom strategy overrides
|
|
3138
3157
|
static #e = /* @__PURE__ */ new Map();
|
|
3139
3158
|
// Default strategy map
|
|
3140
3159
|
static #t = /* @__PURE__ */ new Map([
|
|
3141
|
-
["count", () => new
|
|
3142
|
-
["sum", () => new
|
|
3143
|
-
["min", () => new
|
|
3144
|
-
["max", () => new
|
|
3160
|
+
["count", () => new dr()],
|
|
3161
|
+
["sum", () => new ur()],
|
|
3162
|
+
["min", () => new hr()],
|
|
3163
|
+
["max", () => new fr()]
|
|
3145
3164
|
]);
|
|
3146
3165
|
/**
|
|
3147
3166
|
* Clear all custom strategy overrides
|
|
@@ -3168,7 +3187,7 @@ class fr {
|
|
|
3168
3187
|
static overrideStrategy(e, t, s) {
|
|
3169
3188
|
if (!e || !s)
|
|
3170
3189
|
throw new Error("overrideStrategy requires metricType and strategy");
|
|
3171
|
-
if (!(s instanceof
|
|
3190
|
+
if (!(s instanceof ze))
|
|
3172
3191
|
throw new Error("strategy must be an instance of MetricCalculationStrategy");
|
|
3173
3192
|
let r;
|
|
3174
3193
|
t ? r = this.#s(e, t) : r = `${e}::*::*`, this.#e.set(r, s);
|
|
@@ -3187,9 +3206,9 @@ class fr {
|
|
|
3187
3206
|
return this.#e.has(o) ? this.#e.get(o) : (this.#t.get(s) || this.#t.get("count"))();
|
|
3188
3207
|
}
|
|
3189
3208
|
}
|
|
3190
|
-
class
|
|
3209
|
+
class mr {
|
|
3191
3210
|
constructor(e, t, s, r = null, o = null, i) {
|
|
3192
|
-
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(
|
|
3193
3212
|
"metric-store-cache",
|
|
3194
3213
|
{},
|
|
3195
3214
|
this.onHydrated.bind(this)
|
|
@@ -3249,7 +3268,7 @@ class pr {
|
|
|
3249
3268
|
onHydrated() {
|
|
3250
3269
|
if (this.groundTruthValue === null) {
|
|
3251
3270
|
const e = this.metricCache.get(this.cacheKey);
|
|
3252
|
-
!E(e) && !
|
|
3271
|
+
!E(e) && !ve(e) && this.setGroundTruth(e?.value);
|
|
3253
3272
|
}
|
|
3254
3273
|
}
|
|
3255
3274
|
setCache() {
|
|
@@ -3329,13 +3348,13 @@ function te(n, e) {
|
|
|
3329
3348
|
function Z(n) {
|
|
3330
3349
|
return delete n.isOptimistic, delete n.then, delete n.catch, n;
|
|
3331
3350
|
}
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
function
|
|
3351
|
+
ws();
|
|
3352
|
+
Yt.create();
|
|
3353
|
+
function yr(n, e) {
|
|
3335
3354
|
if (!n || !n.__f_expr)
|
|
3336
3355
|
return n;
|
|
3337
3356
|
try {
|
|
3338
|
-
return
|
|
3357
|
+
return Yt.evaluate(n.original_expr, e);
|
|
3339
3358
|
} catch (t) {
|
|
3340
3359
|
return console.warn(`Error evaluating F expression: ${t.message}`), null;
|
|
3341
3360
|
}
|
|
@@ -3349,7 +3368,7 @@ class de {
|
|
|
3349
3368
|
* @returns {Operation} The created operation
|
|
3350
3369
|
*/
|
|
3351
3370
|
static createCreateOperation(e, t = {}, s = null) {
|
|
3352
|
-
const o = e.ModelClass.primaryKeyField, i = s || `${G()}`, l =
|
|
3371
|
+
const o = e.ModelClass.primaryKeyField, i = s || `${G()}`, l = zt(i);
|
|
3353
3372
|
return new q({
|
|
3354
3373
|
operationId: i,
|
|
3355
3374
|
type: M.CREATE,
|
|
@@ -3368,7 +3387,7 @@ class de {
|
|
|
3368
3387
|
*/
|
|
3369
3388
|
static createBulkCreateOperation(e, t = [], s = null) {
|
|
3370
3389
|
const o = e.ModelClass.primaryKeyField, i = s || `${G()}`, l = t.map((a, c) => {
|
|
3371
|
-
const f =
|
|
3390
|
+
const f = zt(`${i}_${c}`);
|
|
3372
3391
|
return { ...a, [o]: f };
|
|
3373
3392
|
});
|
|
3374
3393
|
return new q({
|
|
@@ -3394,7 +3413,7 @@ class de {
|
|
|
3394
3413
|
y[i] = p;
|
|
3395
3414
|
for (const [_, w] of Object.entries(t))
|
|
3396
3415
|
if (w && typeof w == "object" && w.__f_expr) {
|
|
3397
|
-
const v =
|
|
3416
|
+
const v = yr(w, m);
|
|
3398
3417
|
v !== null ? y[_] = v : y[_] = m[_];
|
|
3399
3418
|
} else
|
|
3400
3419
|
y[_] = w;
|
|
@@ -3509,7 +3528,7 @@ class de {
|
|
|
3509
3528
|
});
|
|
3510
3529
|
}
|
|
3511
3530
|
}
|
|
3512
|
-
class
|
|
3531
|
+
class Jt extends Array {
|
|
3513
3532
|
/**
|
|
3514
3533
|
* Creates a new ResultTuple.
|
|
3515
3534
|
*
|
|
@@ -3520,7 +3539,7 @@ class qt extends Array {
|
|
|
3520
3539
|
super(2), this[0] = e, this[1] = t, this.instance = e, this.created = t;
|
|
3521
3540
|
}
|
|
3522
3541
|
}
|
|
3523
|
-
class
|
|
3542
|
+
class gr {
|
|
3524
3543
|
/**
|
|
3525
3544
|
* Executes a get operation (get, first, last) with the QuerySet.
|
|
3526
3545
|
*
|
|
@@ -3535,7 +3554,7 @@ class yr {
|
|
|
3535
3554
|
const { data: p, included: m, model_name: y } = f.data;
|
|
3536
3555
|
if (E(p) || Array.isArray(p) && p.length === 0)
|
|
3537
3556
|
return null;
|
|
3538
|
-
|
|
3557
|
+
we(Q, m, r, e);
|
|
3539
3558
|
const _ = Array.isArray(p) ? p[0] : p;
|
|
3540
3559
|
return a.pk = _, Z(a), a;
|
|
3541
3560
|
}
|
|
@@ -3560,7 +3579,7 @@ class yr {
|
|
|
3560
3579
|
static executeList(e, t = "list", s = {}) {
|
|
3561
3580
|
const r = j.getEntity(e), o = L(e, t, s).then((i) => {
|
|
3562
3581
|
const { data: l, included: a } = i.data;
|
|
3563
|
-
|
|
3582
|
+
we(Q, a, e.ModelClass, e);
|
|
3564
3583
|
const c = Array.isArray(l) ? l : [];
|
|
3565
3584
|
return j.setEntity(e, c), Z(r), r;
|
|
3566
3585
|
});
|
|
@@ -3579,7 +3598,7 @@ class yr {
|
|
|
3579
3598
|
lookup: s.lookup || {},
|
|
3580
3599
|
defaults: s.defaults || {}
|
|
3581
3600
|
}, l = t === "get_or_create" ? de.createGetOrCreateOperation(e, i.lookup, i.defaults) : de.createUpdateOrCreateOperation(e, i.lookup, i.defaults), a = l.type === "create", c = r.fromPk(l.instances[0][o], e);
|
|
3582
|
-
let f = new
|
|
3601
|
+
let f = new Jt(c, a);
|
|
3583
3602
|
if (l.localOnly)
|
|
3584
3603
|
return l.updateStatus(C.CONFIRMED, l.instances), f;
|
|
3585
3604
|
const p = L(
|
|
@@ -3589,14 +3608,14 @@ class yr {
|
|
|
3589
3608
|
l.operationId
|
|
3590
3609
|
).then((m) => {
|
|
3591
3610
|
const { data: y, included: _, model_name: w } = m.data, v = m.metadata.created;
|
|
3592
|
-
|
|
3611
|
+
we(Q, _, r, e);
|
|
3593
3612
|
const O = Array.isArray(y) ? y[0] : y;
|
|
3594
3613
|
a && (c.pk = O);
|
|
3595
3614
|
const b = (_[w] || {})[O];
|
|
3596
3615
|
return b && l.mutate({
|
|
3597
3616
|
instances: [b],
|
|
3598
3617
|
status: C.CONFIRMED
|
|
3599
|
-
}), f = new
|
|
3618
|
+
}), f = new Jt(c, v), Z(f), f;
|
|
3600
3619
|
}).catch((m) => {
|
|
3601
3620
|
throw l.updateStatus(C.REJECTED), m;
|
|
3602
3621
|
});
|
|
@@ -3616,7 +3635,7 @@ class yr {
|
|
|
3616
3635
|
throw new Error(
|
|
3617
3636
|
`Field parameter is required for ${t} operation`
|
|
3618
3637
|
);
|
|
3619
|
-
const i =
|
|
3638
|
+
const i = Ie.getEntity(t, e, o), l = {};
|
|
3620
3639
|
t !== "exists" && (l.field = o);
|
|
3621
3640
|
const a = L(
|
|
3622
3641
|
e,
|
|
@@ -3624,7 +3643,7 @@ class yr {
|
|
|
3624
3643
|
l
|
|
3625
3644
|
).then((c) => {
|
|
3626
3645
|
const f = c.data, p = j.getEntity(e);
|
|
3627
|
-
return
|
|
3646
|
+
return Ie.setEntity(t, e, o, f, p), Z(i), f;
|
|
3628
3647
|
});
|
|
3629
3648
|
return te(i, a);
|
|
3630
3649
|
}
|
|
@@ -3726,11 +3745,11 @@ class yr {
|
|
|
3726
3745
|
o,
|
|
3727
3746
|
async (p) => {
|
|
3728
3747
|
const { data: m } = p.data, y = Array.isArray(m) ? m[0] : m;
|
|
3729
|
-
|
|
3748
|
+
Kt(o, y);
|
|
3730
3749
|
}
|
|
3731
3750
|
).then((p) => {
|
|
3732
3751
|
const { data: m, included: y, model_name: _ } = p.data;
|
|
3733
|
-
|
|
3752
|
+
we(Q, y, r, e);
|
|
3734
3753
|
const w = Array.isArray(m) ? m[0] : m;
|
|
3735
3754
|
c.pk = w;
|
|
3736
3755
|
const O = (y[_] || {})[w];
|
|
@@ -3776,12 +3795,12 @@ class yr {
|
|
|
3776
3795
|
const { data: m } = p.data;
|
|
3777
3796
|
(Array.isArray(m) ? m : []).forEach((_, w) => {
|
|
3778
3797
|
const v = `${o}_${w}`;
|
|
3779
|
-
|
|
3798
|
+
Kt(v, _);
|
|
3780
3799
|
});
|
|
3781
3800
|
}
|
|
3782
3801
|
).then((p) => {
|
|
3783
3802
|
const { data: m, included: y, model_name: _ } = p.data;
|
|
3784
|
-
|
|
3803
|
+
we(Q, y, r, e);
|
|
3785
3804
|
const w = Array.isArray(m) ? m : [];
|
|
3786
3805
|
w.forEach((T, b) => {
|
|
3787
3806
|
c[b] && (c[b].pk = T);
|
|
@@ -3817,7 +3836,7 @@ class yr {
|
|
|
3817
3836
|
a.operationId
|
|
3818
3837
|
).then((m) => {
|
|
3819
3838
|
const { data: y, included: _, model_name: w } = m.data;
|
|
3820
|
-
|
|
3839
|
+
we(Q, _, r, e);
|
|
3821
3840
|
const v = Array.isArray(y) ? y[0] : y;
|
|
3822
3841
|
f.pk = v;
|
|
3823
3842
|
const T = (_[w] || {})[v];
|
|
@@ -3918,7 +3937,7 @@ class yr {
|
|
|
3918
3937
|
return L(e, t, s);
|
|
3919
3938
|
}
|
|
3920
3939
|
}
|
|
3921
|
-
class
|
|
3940
|
+
class _r {
|
|
3922
3941
|
constructor(e, t, s = null) {
|
|
3923
3942
|
this.queryset = e, this.metricType = t, this.field = s;
|
|
3924
3943
|
}
|
|
@@ -3930,7 +3949,7 @@ class gr {
|
|
|
3930
3949
|
* Delegates to the underlying store's sync method
|
|
3931
3950
|
*/
|
|
3932
3951
|
refreshFromDb() {
|
|
3933
|
-
return
|
|
3952
|
+
return Ie.getStore(
|
|
3934
3953
|
this.metricType,
|
|
3935
3954
|
this.queryset,
|
|
3936
3955
|
this.field
|
|
@@ -3940,7 +3959,7 @@ class gr {
|
|
|
3940
3959
|
* Getter that always returns the current value from the store
|
|
3941
3960
|
*/
|
|
3942
3961
|
get value() {
|
|
3943
|
-
const e =
|
|
3962
|
+
const e = Ie.getStore(
|
|
3944
3963
|
this.metricType,
|
|
3945
3964
|
this.queryset,
|
|
3946
3965
|
this.field
|
|
@@ -3989,8 +4008,8 @@ class Ct {
|
|
|
3989
4008
|
if (!this._stores.has(i)) {
|
|
3990
4009
|
const l = async ({ metricType: c, modelClass: f, field: p, ast: m }) => {
|
|
3991
4010
|
const y = t.clone();
|
|
3992
|
-
return await
|
|
3993
|
-
}, a = new
|
|
4011
|
+
return await gr.executeAgg(y, c, { field: p });
|
|
4012
|
+
}, a = new mr(
|
|
3994
4013
|
e,
|
|
3995
4014
|
r,
|
|
3996
4015
|
t,
|
|
@@ -4013,7 +4032,7 @@ class Ct {
|
|
|
4013
4032
|
if (E(e) || E(t) || E(t.ModelClass))
|
|
4014
4033
|
return null;
|
|
4015
4034
|
this.getStore(e, t, s);
|
|
4016
|
-
const r = new
|
|
4035
|
+
const r = new _r(t, e, s);
|
|
4017
4036
|
return r;
|
|
4018
4037
|
}
|
|
4019
4038
|
/**
|
|
@@ -4023,7 +4042,7 @@ class Ct {
|
|
|
4023
4042
|
if (E(e) || E(t) || E(t.ModelClass))
|
|
4024
4043
|
return null;
|
|
4025
4044
|
const o = this.getStore(e, t, s);
|
|
4026
|
-
return o ? ((!E(o.groundTruthValue) || !
|
|
4045
|
+
return o ? ((!E(o.groundTruthValue) || !ve(o.operations)) && o.reset(), o.setGroundTruth(r), r) : null;
|
|
4027
4046
|
}
|
|
4028
4047
|
/**
|
|
4029
4048
|
* Sync a specific metric with the server
|
|
@@ -4040,8 +4059,8 @@ class Ct {
|
|
|
4040
4059
|
return this._stores.has(e) ? this._stores.get(e).queryset : null;
|
|
4041
4060
|
}
|
|
4042
4061
|
}
|
|
4043
|
-
const
|
|
4044
|
-
class
|
|
4062
|
+
const Ie = new Ct();
|
|
4063
|
+
class wr {
|
|
4045
4064
|
constructor(e) {
|
|
4046
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 ? {
|
|
4047
4066
|
...t,
|
|
@@ -4049,7 +4068,7 @@ class _r {
|
|
|
4049
4068
|
} : t) || e.instances, this._cachedInstances = null;
|
|
4050
4069
|
}
|
|
4051
4070
|
get modelClass() {
|
|
4052
|
-
return
|
|
4071
|
+
return es(this.model, this.configKey);
|
|
4053
4072
|
}
|
|
4054
4073
|
async getFullInstances() {
|
|
4055
4074
|
if (this.event === "delete")
|
|
@@ -4063,7 +4082,7 @@ class _r {
|
|
|
4063
4082
|
}).fetch()), this._cachedInstances;
|
|
4064
4083
|
}
|
|
4065
4084
|
}
|
|
4066
|
-
class
|
|
4085
|
+
class Cr {
|
|
4067
4086
|
constructor() {
|
|
4068
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;
|
|
4069
4088
|
}
|
|
@@ -4086,7 +4105,7 @@ class wr {
|
|
|
4086
4105
|
* Initialize event handlers for all event receivers
|
|
4087
4106
|
*/
|
|
4088
4107
|
initialize() {
|
|
4089
|
-
|
|
4108
|
+
js(), Ds().forEach((t, s) => {
|
|
4090
4109
|
t && t.addModelEventHandler(this.handleEvent.bind(this));
|
|
4091
4110
|
}), this.startPeriodicSync();
|
|
4092
4111
|
}
|
|
@@ -4104,7 +4123,7 @@ class wr {
|
|
|
4104
4123
|
}
|
|
4105
4124
|
}
|
|
4106
4125
|
async syncStaleQuerysets() {
|
|
4107
|
-
const e = this.registries.get(
|
|
4126
|
+
const e = this.registries.get(Ce);
|
|
4108
4127
|
if (!e) return;
|
|
4109
4128
|
const t = `periodic-sync-${G()}`, s = new Set(
|
|
4110
4129
|
[...this.followedQuerysets].map((o) => o.semanticKey).filter((o) => e._stores.has(o))
|
|
@@ -4120,7 +4139,7 @@ class wr {
|
|
|
4120
4139
|
), this.pruneUnreferencedModels();
|
|
4121
4140
|
}
|
|
4122
4141
|
pruneUnreferencedModels() {
|
|
4123
|
-
const e = this.registries.get(Ge), t = this.registries.get(
|
|
4142
|
+
const e = this.registries.get(Ge), t = this.registries.get(Ce);
|
|
4124
4143
|
if (!(!e || !t))
|
|
4125
4144
|
for (const [s, r] of e._stores.entries())
|
|
4126
4145
|
r.pruneUnreferencedInstances(t);
|
|
@@ -4138,7 +4157,7 @@ class wr {
|
|
|
4138
4157
|
const r = [...this.followedModels.values()].some(
|
|
4139
4158
|
(o) => o.has(t)
|
|
4140
4159
|
);
|
|
4141
|
-
s.add(t), r ||
|
|
4160
|
+
s.add(t), r || Ut(t.configKey)?.subscribe(
|
|
4142
4161
|
t.modelName,
|
|
4143
4162
|
this.handleEvent
|
|
4144
4163
|
);
|
|
@@ -4148,7 +4167,7 @@ class wr {
|
|
|
4148
4167
|
if (!s) return;
|
|
4149
4168
|
s.delete(t), [...this.followedModels.values()].some(
|
|
4150
4169
|
(o) => o.has(t)
|
|
4151
|
-
) ||
|
|
4170
|
+
) || Ut(t.configKey)?.unsubscribe(
|
|
4152
4171
|
t.modelName,
|
|
4153
4172
|
this.handleEvent
|
|
4154
4173
|
);
|
|
@@ -4165,9 +4184,9 @@ class wr {
|
|
|
4165
4184
|
* Checks the `verify` flag on membership state to determine which querysets need syncing.
|
|
4166
4185
|
*/
|
|
4167
4186
|
syncQuerysetsNeedingVerification(e) {
|
|
4168
|
-
const t =
|
|
4187
|
+
const t = Pe.getQuerysetStates(e);
|
|
4169
4188
|
if (!t) return;
|
|
4170
|
-
const s = this.registries.get(
|
|
4189
|
+
const s = this.registries.get(Ce);
|
|
4171
4190
|
if (!s) return;
|
|
4172
4191
|
const r = [];
|
|
4173
4192
|
for (const [l, a] of t.entries())
|
|
@@ -4196,7 +4215,7 @@ class wr {
|
|
|
4196
4215
|
operationId: e.operation_id,
|
|
4197
4216
|
socketId: e.socket_id
|
|
4198
4217
|
});
|
|
4199
|
-
let t = new
|
|
4218
|
+
let t = new wr(e), s = Pe.has(t.operation_id);
|
|
4200
4219
|
if (this.registries.has(Ct) && this.processMetrics(t), s) {
|
|
4201
4220
|
this.syncQuerysetsNeedingVerification(t.operation_id);
|
|
4202
4221
|
return;
|
|
@@ -4224,7 +4243,7 @@ class wr {
|
|
|
4224
4243
|
s.has(o) || s.set(o, []), s.get(o).push(r);
|
|
4225
4244
|
}), s.forEach((r, o) => {
|
|
4226
4245
|
const i = r[0];
|
|
4227
|
-
this.registries.has(
|
|
4246
|
+
this.registries.has(Ce) && this.processQuerysetsBatch(i, r), this.registries.has(Ge) && this.processModels(i);
|
|
4228
4247
|
});
|
|
4229
4248
|
}
|
|
4230
4249
|
isQuerysetFollowed(e) {
|
|
@@ -4240,7 +4259,7 @@ class wr {
|
|
|
4240
4259
|
return !1;
|
|
4241
4260
|
}
|
|
4242
4261
|
processQuerysetsBatch(e, t) {
|
|
4243
|
-
const s = this.registries.get(
|
|
4262
|
+
const s = this.registries.get(Ce), r = [];
|
|
4244
4263
|
for (const [c, f] of s._stores.entries())
|
|
4245
4264
|
if (f.modelClass.modelName === e.model && f.modelClass.configKey === e.configKey) {
|
|
4246
4265
|
if (this.followAllQuerysets) {
|
|
@@ -4283,7 +4302,7 @@ class wr {
|
|
|
4283
4302
|
(e.instances || []).filter((c) => c && c[e.pk_field_name] != null).map((c) => c[e.pk_field_name])
|
|
4284
4303
|
);
|
|
4285
4304
|
if (r.size === 0) return;
|
|
4286
|
-
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();
|
|
4287
4306
|
if (i)
|
|
4288
4307
|
for (const [c, f] of i._stores.entries())
|
|
4289
4308
|
f.modelClass.modelName === e.model && f.modelClass.configKey === e.configKey && f.groundTruthPks.forEach((p) => l.add(p));
|
|
@@ -4293,97 +4312,97 @@ class wr {
|
|
|
4293
4312
|
}), a.length > 0 && s.sync(a);
|
|
4294
4313
|
}
|
|
4295
4314
|
}
|
|
4296
|
-
const $e = new
|
|
4315
|
+
const $e = new Cr();
|
|
4297
4316
|
$e.manageRegistry(j);
|
|
4298
4317
|
$e.manageRegistry(Q);
|
|
4299
|
-
$e.manageRegistry(
|
|
4300
|
-
const
|
|
4301
|
-
function
|
|
4302
|
-
typeof n == "function" &&
|
|
4318
|
+
$e.manageRegistry(Ie);
|
|
4319
|
+
const vr = /* @__PURE__ */ new Set();
|
|
4320
|
+
function Er(n) {
|
|
4321
|
+
typeof n == "function" && vr.add(n);
|
|
4303
4322
|
}
|
|
4304
4323
|
$e.followAllQuerysets = !1;
|
|
4305
|
-
const
|
|
4306
|
-
|
|
4307
|
-
|
|
4324
|
+
const rs = /* @__PURE__ */ new Map();
|
|
4325
|
+
Er(() => {
|
|
4326
|
+
rs.clear(), $e.followAllQuerysets = !0, $e.followedQuerysets.clear();
|
|
4308
4327
|
});
|
|
4309
|
-
const
|
|
4328
|
+
const br = (n, e) => {
|
|
4310
4329
|
const t = n.__vccOpts || n;
|
|
4311
4330
|
for (const [s, r] of e)
|
|
4312
4331
|
t[s] = r;
|
|
4313
4332
|
return t;
|
|
4314
|
-
},
|
|
4333
|
+
}, kr = { class: "szd" }, Sr = { class: "szd-header" }, Tr = { class: "szd-header__top" }, Mr = { class: "szd-header__left" }, $r = {
|
|
4315
4334
|
key: 0,
|
|
4316
4335
|
class: "szd-header__model"
|
|
4317
|
-
},
|
|
4336
|
+
}, Ar = {
|
|
4318
4337
|
key: 1,
|
|
4319
4338
|
class: "szd-header__model szd-header__model--empty"
|
|
4320
|
-
},
|
|
4339
|
+
}, Or = { class: "szd-header__right" }, Pr = {
|
|
4321
4340
|
key: 0,
|
|
4322
4341
|
class: "szd-header__badge szd-header__badge--syncing"
|
|
4323
|
-
},
|
|
4342
|
+
}, Ir = {
|
|
4324
4343
|
key: 1,
|
|
4325
4344
|
class: "szd-header__badge"
|
|
4326
|
-
}, 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 = {
|
|
4327
4346
|
key: 0,
|
|
4328
4347
|
class: "szd-panel"
|
|
4329
|
-
},
|
|
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 = {
|
|
4330
4349
|
class: "szd-kv",
|
|
4331
4350
|
style: { "margin-top": "12px" }
|
|
4332
|
-
},
|
|
4351
|
+
}, on = { class: "szd-kv__row" }, an = { class: "szd-kv__value" }, ln = {
|
|
4333
4352
|
key: 0,
|
|
4334
4353
|
class: "szd-panel__section"
|
|
4335
|
-
},
|
|
4354
|
+
}, cn = { class: "szd-event-preview__text" }, dn = { class: "szd-event-preview__time" }, un = {
|
|
4336
4355
|
key: 1,
|
|
4337
4356
|
class: "szd-panel"
|
|
4338
|
-
},
|
|
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 = {
|
|
4339
4358
|
key: 0,
|
|
4340
4359
|
class: "szd-empty"
|
|
4341
|
-
},
|
|
4360
|
+
}, wn = {
|
|
4342
4361
|
key: 2,
|
|
4343
4362
|
class: "szd-panel"
|
|
4344
|
-
},
|
|
4363
|
+
}, Cn = { class: "szd-pipeline" }, vn = ["onClick"], En = { class: "szd-pipeline__label" }, bn = { class: "szd-pipeline__count" }, kn = {
|
|
4345
4364
|
key: 0,
|
|
4346
4365
|
class: "szd-pipeline__arrow"
|
|
4347
|
-
},
|
|
4366
|
+
}, Sn = {
|
|
4348
4367
|
class: "szd-panel__section",
|
|
4349
4368
|
style: { "margin-top": "20px" }
|
|
4350
|
-
},
|
|
4369
|
+
}, Tn = { class: "szd-preview-header" }, Mn = ["value"], $n = {
|
|
4351
4370
|
key: 0,
|
|
4352
4371
|
class: "szd-data-grid"
|
|
4353
|
-
},
|
|
4372
|
+
}, An = { class: "szd-data-card__header" }, On = {
|
|
4354
4373
|
key: 0,
|
|
4355
4374
|
class: "szd-data-card__badge"
|
|
4356
|
-
},
|
|
4375
|
+
}, Pn = {
|
|
4357
4376
|
key: 1,
|
|
4358
4377
|
class: "szd-data-card__badge szd-data-card__badge--absent"
|
|
4359
|
-
},
|
|
4378
|
+
}, In = { class: "szd-data-card__content" }, Fn = {
|
|
4360
4379
|
key: 1,
|
|
4361
4380
|
class: "szd-empty"
|
|
4362
4381
|
}, Dn = {
|
|
4363
4382
|
key: 3,
|
|
4364
4383
|
class: "szd-panel"
|
|
4365
|
-
},
|
|
4384
|
+
}, zn = {
|
|
4366
4385
|
class: "szd-kv",
|
|
4367
4386
|
style: { "margin-bottom": "16px" }
|
|
4368
|
-
}, 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 = {
|
|
4369
4388
|
key: 0,
|
|
4370
4389
|
class: "szd-detail"
|
|
4371
|
-
},
|
|
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 = {
|
|
4372
4391
|
key: 0,
|
|
4373
4392
|
class: "szd-settings-section"
|
|
4374
|
-
},
|
|
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 = {
|
|
4375
4394
|
key: 1,
|
|
4376
4395
|
class: "szd-settings-section"
|
|
4377
|
-
},
|
|
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 = {
|
|
4378
4397
|
key: 0,
|
|
4379
4398
|
class: "szd-detail"
|
|
4380
|
-
},
|
|
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 = {
|
|
4381
4400
|
class: "szd-kv",
|
|
4382
4401
|
style: { "margin-bottom": "16px" }
|
|
4383
|
-
},
|
|
4402
|
+
}, Eo = { class: "szd-kv__row" }, bo = { class: "szd-kv__value" }, ko = { class: "szd-kv__row" }, So = { class: "szd-kv__value" }, To = {
|
|
4384
4403
|
key: 0,
|
|
4385
4404
|
class: "szd-kv__note"
|
|
4386
|
-
},
|
|
4405
|
+
}, Mo = { class: "szd-ast" }, Wt = 100, $o = {
|
|
4387
4406
|
__name: "StateZeroDebugPanel",
|
|
4388
4407
|
props: {
|
|
4389
4408
|
queryset: { type: [Object, String], default: null },
|
|
@@ -4397,7 +4416,7 @@ const Er = (n, e) => {
|
|
|
4397
4416
|
{ id: "timeline", label: "Timeline" },
|
|
4398
4417
|
{ id: "data", label: "Data" },
|
|
4399
4418
|
{ id: "ast", label: "AST" }
|
|
4400
|
-
], r = J(""), o = J(e.useQueryset), i = J(!0), l = J(
|
|
4419
|
+
], r = J(""), o = J(e.useQueryset), i = J(!0), l = J(Vt()), a = J(0), c = J(!1), f = J(null), p = J(!1), m = J(null), y = J({
|
|
4401
4420
|
request: !0,
|
|
4402
4421
|
response: !0,
|
|
4403
4422
|
render: !0,
|
|
@@ -4418,7 +4437,7 @@ const Er = (n, e) => {
|
|
|
4418
4437
|
), v = R(() => {
|
|
4419
4438
|
a.value;
|
|
4420
4439
|
const u = [];
|
|
4421
|
-
return
|
|
4440
|
+
return rs.forEach((d) => {
|
|
4422
4441
|
d?.semanticKey && u.push({
|
|
4423
4442
|
semanticKey: d.semanticKey,
|
|
4424
4443
|
modelName: d.ModelClass?.modelName,
|
|
@@ -4453,21 +4472,21 @@ const Er = (n, e) => {
|
|
|
4453
4472
|
return null;
|
|
4454
4473
|
}
|
|
4455
4474
|
return k.value && j._stores.get(k.value) || null;
|
|
4456
|
-
}),
|
|
4475
|
+
}), I = R(() => {
|
|
4457
4476
|
a.value;
|
|
4458
|
-
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.";
|
|
4459
4478
|
return {
|
|
4460
4479
|
modelName: g,
|
|
4461
|
-
configKey:
|
|
4480
|
+
configKey: z,
|
|
4462
4481
|
groundTruthCount: H,
|
|
4463
4482
|
opsCount: oe,
|
|
4464
4483
|
inFlightCount: le.length,
|
|
4465
4484
|
isSyncing: be,
|
|
4466
|
-
lastSync:
|
|
4485
|
+
lastSync: Ue,
|
|
4467
4486
|
optimisticCount: ot,
|
|
4468
|
-
confirmedCount:
|
|
4469
|
-
source:
|
|
4470
|
-
reason:
|
|
4487
|
+
confirmedCount: cs,
|
|
4488
|
+
source: ds,
|
|
4489
|
+
reason: us
|
|
4471
4490
|
};
|
|
4472
4491
|
}), re = R(() => {
|
|
4473
4492
|
a.value;
|
|
@@ -4477,27 +4496,27 @@ const Er = (n, e) => {
|
|
|
4477
4496
|
return { error: u?.message || "Failed to build AST" };
|
|
4478
4497
|
}
|
|
4479
4498
|
});
|
|
4480
|
-
function
|
|
4499
|
+
function pe(u) {
|
|
4481
4500
|
if (!u?.filter?.conditions) return "—";
|
|
4482
4501
|
const d = u.filter.conditions;
|
|
4483
|
-
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(", ");
|
|
4484
4503
|
}
|
|
4485
4504
|
function ae(u) {
|
|
4486
4505
|
const d = u?.orderBy;
|
|
4487
4506
|
return !d || Array.isArray(d) && d.length === 0 ? "—" : Array.isArray(d) ? d.join(", ") : String(d);
|
|
4488
4507
|
}
|
|
4489
|
-
const
|
|
4508
|
+
const D = R(() => {
|
|
4490
4509
|
const u = re.value;
|
|
4491
4510
|
return {
|
|
4492
|
-
filter:
|
|
4511
|
+
filter: pe(u),
|
|
4493
4512
|
orderBy: ae(u),
|
|
4494
4513
|
limit: u?.serializerOptions?.limit ?? "—"
|
|
4495
4514
|
};
|
|
4496
4515
|
});
|
|
4497
|
-
function
|
|
4516
|
+
function F(u, d, g, z) {
|
|
4498
4517
|
if (!u || !Array.isArray(g)) return [];
|
|
4499
4518
|
const H = [];
|
|
4500
|
-
for (const oe of g.slice(0,
|
|
4519
|
+
for (const oe of g.slice(0, z))
|
|
4501
4520
|
try {
|
|
4502
4521
|
const le = u.fromPk(oe, d);
|
|
4503
4522
|
le && H.push(le.serialize());
|
|
@@ -4505,7 +4524,7 @@ const Er = (n, e) => {
|
|
|
4505
4524
|
}
|
|
4506
4525
|
return H;
|
|
4507
4526
|
}
|
|
4508
|
-
const
|
|
4527
|
+
const K = R(() => {
|
|
4509
4528
|
a.value;
|
|
4510
4529
|
const u = N.value, d = U.value;
|
|
4511
4530
|
if (!u || !d)
|
|
@@ -4522,7 +4541,7 @@ const Er = (n, e) => {
|
|
|
4522
4541
|
finalSample: [],
|
|
4523
4542
|
limit: null
|
|
4524
4543
|
};
|
|
4525
|
-
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(
|
|
4526
4545
|
u.modelClass,
|
|
4527
4546
|
d,
|
|
4528
4547
|
le,
|
|
@@ -4531,66 +4550,66 @@ const Er = (n, e) => {
|
|
|
4531
4550
|
return {
|
|
4532
4551
|
modelStoreFiltered: le,
|
|
4533
4552
|
groundTruth: g,
|
|
4534
|
-
optimistic:
|
|
4553
|
+
optimistic: z,
|
|
4535
4554
|
filtered: oe,
|
|
4536
|
-
final:
|
|
4555
|
+
final: Ue,
|
|
4537
4556
|
modelStoreSample: ot,
|
|
4538
|
-
groundTruthSample:
|
|
4557
|
+
groundTruthSample: F(
|
|
4539
4558
|
u.modelClass,
|
|
4540
4559
|
d,
|
|
4541
4560
|
g,
|
|
4542
4561
|
e.sampleSize
|
|
4543
4562
|
),
|
|
4544
|
-
optimisticSample:
|
|
4563
|
+
optimisticSample: F(
|
|
4545
4564
|
u.modelClass,
|
|
4546
4565
|
d,
|
|
4547
|
-
|
|
4566
|
+
z,
|
|
4548
4567
|
e.sampleSize
|
|
4549
4568
|
),
|
|
4550
|
-
filteredSample:
|
|
4569
|
+
filteredSample: F(
|
|
4551
4570
|
u.modelClass,
|
|
4552
4571
|
d,
|
|
4553
4572
|
oe,
|
|
4554
4573
|
e.sampleSize
|
|
4555
4574
|
),
|
|
4556
|
-
finalSample:
|
|
4575
|
+
finalSample: F(
|
|
4557
4576
|
u.modelClass,
|
|
4558
4577
|
d,
|
|
4559
|
-
|
|
4578
|
+
Ue,
|
|
4560
4579
|
e.sampleSize
|
|
4561
4580
|
),
|
|
4562
4581
|
limit: be,
|
|
4563
4582
|
confirmed: H
|
|
4564
4583
|
};
|
|
4565
|
-
}),
|
|
4566
|
-
{ id: "model-store", label: "Model Store", count:
|
|
4567
|
-
{ id: "ground-truth", label: "Ground Truth", count:
|
|
4568
|
-
{ id: "optimistic", label: "Optimistic", count:
|
|
4569
|
-
{ id: "filtered", label: "Filtered", count:
|
|
4570
|
-
{ id: "final", label: "Final", count:
|
|
4571
|
-
]), Ye = R(() =>
|
|
4572
|
-
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) {
|
|
4573
4592
|
const d = N.value, g = U.value;
|
|
4574
4593
|
if (!d || !g || u == null) return null;
|
|
4575
4594
|
try {
|
|
4576
|
-
const
|
|
4577
|
-
return
|
|
4595
|
+
const z = d.modelClass.fromPk(u, g);
|
|
4596
|
+
return z ? z.serialize() : null;
|
|
4578
4597
|
} catch {
|
|
4579
4598
|
return null;
|
|
4580
4599
|
}
|
|
4581
4600
|
}
|
|
4582
|
-
R(() => m.value == null ? null :
|
|
4601
|
+
R(() => m.value == null ? null : ye(m.value));
|
|
4583
4602
|
const Ke = R(() => {
|
|
4584
4603
|
if (!f.value || f.value.type !== "snapshot") return [];
|
|
4585
4604
|
const u = f.value.data, d = N.value, g = U.value;
|
|
4586
|
-
return !d || !g || !u.pks ? [] :
|
|
4587
|
-
}), Xe = R(() => !f.value || f.value.type !== "snapshot" ? !1 : f.value.data.count >
|
|
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(() => {
|
|
4588
4607
|
if (!k.value) return l.value;
|
|
4589
4608
|
const u = N.value;
|
|
4590
4609
|
return l.value.filter((d) => d.semanticKey === k.value ? !0 : u ? d.modelName === u.modelClass?.modelName && d.configKey === u.modelClass?.configKey : !1);
|
|
4591
|
-
}), Ee = R(() =>
|
|
4610
|
+
}), Ee = R(() => Re.value.filter((u) => y.value[u.type])), Ne = R(() => l.value.length), ne = R(
|
|
4592
4611
|
() => l.value.length ? l.value[l.value.length - 1] : null
|
|
4593
|
-
),
|
|
4612
|
+
), xe = [
|
|
4594
4613
|
{ id: "request", label: "Requests", color: "#3b82f6" },
|
|
4595
4614
|
{ id: "response", label: "Responses", color: "#22c55e" },
|
|
4596
4615
|
{ id: "render", label: "Renders", color: "#a855f7" },
|
|
@@ -4601,8 +4620,8 @@ const Er = (n, e) => {
|
|
|
4601
4620
|
{ id: "groupSync", label: "Group Sync", color: "#8b5cf6" },
|
|
4602
4621
|
{ id: "error", label: "Errors", color: "#ef4444" }
|
|
4603
4622
|
];
|
|
4604
|
-
function
|
|
4605
|
-
return
|
|
4623
|
+
function je(u) {
|
|
4624
|
+
return xe.find((d) => d.id === u)?.color || "#6b7280";
|
|
4606
4625
|
}
|
|
4607
4626
|
function et(u) {
|
|
4608
4627
|
if (!u) return "";
|
|
@@ -4637,7 +4656,7 @@ const Er = (n, e) => {
|
|
|
4637
4656
|
return u.type;
|
|
4638
4657
|
}
|
|
4639
4658
|
}
|
|
4640
|
-
function
|
|
4659
|
+
function ns(u) {
|
|
4641
4660
|
if (!u) return null;
|
|
4642
4661
|
const d = {
|
|
4643
4662
|
type: u.type,
|
|
@@ -4669,13 +4688,13 @@ const Er = (n, e) => {
|
|
|
4669
4688
|
return d;
|
|
4670
4689
|
}
|
|
4671
4690
|
}
|
|
4672
|
-
function ns() {
|
|
4673
|
-
Ls(), l.value = [];
|
|
4674
|
-
}
|
|
4675
4691
|
function os() {
|
|
4692
|
+
Gs(), l.value = [];
|
|
4693
|
+
}
|
|
4694
|
+
function is() {
|
|
4676
4695
|
!k.value || !navigator?.clipboard || navigator.clipboard.writeText(k.value);
|
|
4677
4696
|
}
|
|
4678
|
-
async function
|
|
4697
|
+
async function as() {
|
|
4679
4698
|
if (!(!N.value || c.value)) {
|
|
4680
4699
|
c.value = !0;
|
|
4681
4700
|
try {
|
|
@@ -4689,7 +4708,7 @@ const Er = (n, e) => {
|
|
|
4689
4708
|
function bt(u) {
|
|
4690
4709
|
f.value = { type: "entry", data: u };
|
|
4691
4710
|
}
|
|
4692
|
-
function
|
|
4711
|
+
function ls(u) {
|
|
4693
4712
|
f.value = { type: "snapshot", data: u };
|
|
4694
4713
|
}
|
|
4695
4714
|
function kt() {
|
|
@@ -4701,21 +4720,21 @@ const Er = (n, e) => {
|
|
|
4701
4720
|
});
|
|
4702
4721
|
}
|
|
4703
4722
|
let tt = null, st = null, rt = null, nt = null;
|
|
4704
|
-
return
|
|
4705
|
-
|
|
4723
|
+
return hs(() => {
|
|
4724
|
+
Bs(), Lt(e.maxEntries), tt = Vs((u) => {
|
|
4706
4725
|
i.value && (l.value = [...l.value, u], l.value.length > e.maxEntries && (l.value = l.value.slice(-e.maxEntries)));
|
|
4707
|
-
}), st =
|
|
4726
|
+
}), st = Ls(() => {
|
|
4708
4727
|
l.value = [];
|
|
4709
4728
|
}), rt = setInterval(() => {
|
|
4710
4729
|
a.value += 1;
|
|
4711
4730
|
}, 2e3), nt = setInterval(() => {
|
|
4712
|
-
l.value =
|
|
4731
|
+
l.value = Vt();
|
|
4713
4732
|
}, 1e3);
|
|
4714
|
-
}),
|
|
4733
|
+
}), fs(() => {
|
|
4715
4734
|
tt && tt(), st && st(), rt && clearInterval(rt), nt && clearInterval(nt);
|
|
4716
4735
|
}), it(
|
|
4717
4736
|
() => e.maxEntries,
|
|
4718
|
-
(u) =>
|
|
4737
|
+
(u) => Lt(u)
|
|
4719
4738
|
), it(
|
|
4720
4739
|
() => e.useQueryset,
|
|
4721
4740
|
(u) => {
|
|
@@ -4723,17 +4742,17 @@ const Er = (n, e) => {
|
|
|
4723
4742
|
}
|
|
4724
4743
|
), it(k, () => {
|
|
4725
4744
|
m.value = null;
|
|
4726
|
-
}), (u, d) => (A(), $("section",
|
|
4727
|
-
h("header",
|
|
4728
|
-
h("div",
|
|
4729
|
-
h("div",
|
|
4745
|
+
}), (u, d) => (A(), $("section", kr, [
|
|
4746
|
+
h("header", Sr, [
|
|
4747
|
+
h("div", Tr, [
|
|
4748
|
+
h("div", Mr, [
|
|
4730
4749
|
d[9] || (d[9] = h("div", { class: "szd-header__title" }, "StateZero", -1)),
|
|
4731
|
-
k.value ? (A(), $("span",
|
|
4750
|
+
k.value ? (A(), $("span", $r, S(I.value.modelName || "?"), 1)) : (A(), $("span", Ar, "No queryset"))
|
|
4732
4751
|
]),
|
|
4733
|
-
h("div",
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
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),
|
|
4737
4756
|
h("button", {
|
|
4738
4757
|
class: "szd-btn szd-btn--icon",
|
|
4739
4758
|
onClick: d[0] || (d[0] = (g) => p.value = !0),
|
|
@@ -4761,61 +4780,61 @@ const Er = (n, e) => {
|
|
|
4761
4780
|
(A(), $(W, null, ce(s, (g) => h("button", {
|
|
4762
4781
|
key: g.id,
|
|
4763
4782
|
class: Mt(["szd-tabs__tab", { "szd-tabs__tab--active": t.value === g.id }]),
|
|
4764
|
-
onClick: (
|
|
4765
|
-
}, S(g.label), 11,
|
|
4783
|
+
onClick: (z) => t.value = g.id
|
|
4784
|
+
}, S(g.label), 11, zr)), 64))
|
|
4766
4785
|
])
|
|
4767
4786
|
]),
|
|
4768
4787
|
h("main", Kr, [
|
|
4769
|
-
t.value === "overview" ? (A(), $("div",
|
|
4770
|
-
h("div",
|
|
4788
|
+
t.value === "overview" ? (A(), $("div", Rr, [
|
|
4789
|
+
h("div", Nr, [
|
|
4771
4790
|
d[15] || (d[15] = h("h3", { class: "szd-panel__heading" }, "Why This View?", -1)),
|
|
4772
|
-
h("div",
|
|
4773
|
-
h("div",
|
|
4791
|
+
h("div", xr, [
|
|
4792
|
+
h("div", jr, [
|
|
4774
4793
|
d[11] || (d[11] = h("span", { class: "szd-kv__key" }, "Filter:", -1)),
|
|
4775
|
-
h("span",
|
|
4794
|
+
h("span", Ur, S(D.value.filter), 1)
|
|
4776
4795
|
]),
|
|
4777
|
-
h("div",
|
|
4796
|
+
h("div", Qr, [
|
|
4778
4797
|
d[12] || (d[12] = h("span", { class: "szd-kv__key" }, "Order:", -1)),
|
|
4779
|
-
h("span",
|
|
4798
|
+
h("span", Vr, S(D.value.orderBy), 1)
|
|
4780
4799
|
]),
|
|
4781
|
-
h("div",
|
|
4800
|
+
h("div", Lr, [
|
|
4782
4801
|
d[13] || (d[13] = h("span", { class: "szd-kv__key" }, "Limit:", -1)),
|
|
4783
|
-
h("span",
|
|
4802
|
+
h("span", Gr, S(D.value.limit), 1)
|
|
4784
4803
|
]),
|
|
4785
|
-
h("div",
|
|
4804
|
+
h("div", Br, [
|
|
4786
4805
|
d[14] || (d[14] = h("span", { class: "szd-kv__key" }, "Reason:", -1)),
|
|
4787
|
-
h("span",
|
|
4806
|
+
h("span", Hr, S(I.value.reason), 1)
|
|
4788
4807
|
])
|
|
4789
4808
|
])
|
|
4790
4809
|
]),
|
|
4791
|
-
h("div",
|
|
4810
|
+
h("div", qr, [
|
|
4792
4811
|
d[21] || (d[21] = h("h3", { class: "szd-panel__heading" }, "Current State", -1)),
|
|
4793
|
-
h("div",
|
|
4794
|
-
h("div",
|
|
4795
|
-
h("div",
|
|
4812
|
+
h("div", Jr, [
|
|
4813
|
+
h("div", Wr, [
|
|
4814
|
+
h("div", Zr, S(I.value.optimisticCount ?? "—"), 1),
|
|
4796
4815
|
d[16] || (d[16] = h("div", { class: "szd-stat__label" }, "Optimistic", -1))
|
|
4797
4816
|
]),
|
|
4798
|
-
h("div",
|
|
4799
|
-
h("div",
|
|
4817
|
+
h("div", Yr, [
|
|
4818
|
+
h("div", Xr, S(I.value.confirmedCount), 1),
|
|
4800
4819
|
d[17] || (d[17] = h("div", { class: "szd-stat__label" }, "Confirmed", -1))
|
|
4801
4820
|
]),
|
|
4802
|
-
h("div",
|
|
4803
|
-
h("div",
|
|
4821
|
+
h("div", en, [
|
|
4822
|
+
h("div", tn, S(I.value.groundTruthCount), 1),
|
|
4804
4823
|
d[18] || (d[18] = h("div", { class: "szd-stat__label" }, "Ground Truth", -1))
|
|
4805
4824
|
]),
|
|
4806
|
-
h("div",
|
|
4807
|
-
h("div",
|
|
4825
|
+
h("div", sn, [
|
|
4826
|
+
h("div", rn, S(I.value.inFlightCount), 1),
|
|
4808
4827
|
d[19] || (d[19] = h("div", { class: "szd-stat__label" }, "In-Flight", -1))
|
|
4809
4828
|
])
|
|
4810
4829
|
]),
|
|
4811
|
-
h("div",
|
|
4812
|
-
h("div",
|
|
4830
|
+
h("div", nn, [
|
|
4831
|
+
h("div", on, [
|
|
4813
4832
|
d[20] || (d[20] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
|
|
4814
|
-
h("span",
|
|
4833
|
+
h("span", an, S(I.value.lastSync), 1)
|
|
4815
4834
|
])
|
|
4816
4835
|
])
|
|
4817
4836
|
]),
|
|
4818
|
-
ne.value ? (A(), $("div",
|
|
4837
|
+
ne.value ? (A(), $("div", ln, [
|
|
4819
4838
|
d[22] || (d[22] = h("h3", { class: "szd-panel__heading" }, "Last Event", -1)),
|
|
4820
4839
|
h("button", {
|
|
4821
4840
|
class: "szd-event-preview",
|
|
@@ -4823,15 +4842,15 @@ const Er = (n, e) => {
|
|
|
4823
4842
|
}, [
|
|
4824
4843
|
h("span", {
|
|
4825
4844
|
class: "szd-event-preview__badge",
|
|
4826
|
-
style: at({ background:
|
|
4845
|
+
style: at({ background: je(ne.value.type) })
|
|
4827
4846
|
}, S(ne.value.type), 5),
|
|
4828
|
-
h("span",
|
|
4829
|
-
h("span",
|
|
4847
|
+
h("span", cn, S(Et(ne.value)), 1),
|
|
4848
|
+
h("span", dn, S(et(ne.value.ts)), 1)
|
|
4830
4849
|
])
|
|
4831
4850
|
])) : V("", !0)
|
|
4832
4851
|
])) : V("", !0),
|
|
4833
|
-
t.value === "timeline" ? (A(), $("div",
|
|
4834
|
-
h("div",
|
|
4852
|
+
t.value === "timeline" ? (A(), $("div", un, [
|
|
4853
|
+
h("div", hn, [
|
|
4835
4854
|
h("button", {
|
|
4836
4855
|
class: "szd-btn szd-btn--sm",
|
|
4837
4856
|
onClick: d[2] || (d[2] = (g) => St(!0))
|
|
@@ -4840,57 +4859,57 @@ const Er = (n, e) => {
|
|
|
4840
4859
|
class: "szd-btn szd-btn--sm",
|
|
4841
4860
|
onClick: d[3] || (d[3] = (g) => St(!1))
|
|
4842
4861
|
}, "None"),
|
|
4843
|
-
(A(), $(W, null, ce(
|
|
4862
|
+
(A(), $(W, null, ce(xe, (g) => h("label", {
|
|
4844
4863
|
key: g.id,
|
|
4845
4864
|
class: Mt(["szd-filter-chip", { "szd-filter-chip--active": y.value[g.id] }]),
|
|
4846
4865
|
style: at(y.value[g.id] ? { background: g.color, borderColor: g.color } : {})
|
|
4847
4866
|
}, [
|
|
4848
|
-
|
|
4867
|
+
Qe(h("input", {
|
|
4849
4868
|
type: "checkbox",
|
|
4850
|
-
"onUpdate:modelValue": (
|
|
4869
|
+
"onUpdate:modelValue": (z) => y.value[g.id] = z,
|
|
4851
4870
|
class: "szd-filter-chip__input"
|
|
4852
|
-
}, null, 8,
|
|
4871
|
+
}, null, 8, fn), [
|
|
4853
4872
|
[$t, y.value[g.id]]
|
|
4854
4873
|
]),
|
|
4855
|
-
|
|
4874
|
+
Ve(" " + S(g.label), 1)
|
|
4856
4875
|
], 6)), 64))
|
|
4857
4876
|
]),
|
|
4858
|
-
h("div",
|
|
4877
|
+
h("div", pn, [
|
|
4859
4878
|
(A(!0), $(W, null, ce(Ee.value, (g) => (A(), $("div", {
|
|
4860
4879
|
key: g.id,
|
|
4861
4880
|
class: "szd-timeline__item",
|
|
4862
|
-
onClick: (
|
|
4881
|
+
onClick: (z) => bt(g)
|
|
4863
4882
|
}, [
|
|
4864
|
-
h("span",
|
|
4883
|
+
h("span", yn, S(et(g.ts)), 1),
|
|
4865
4884
|
h("span", {
|
|
4866
4885
|
class: "szd-timeline__badge",
|
|
4867
|
-
style: at({ background:
|
|
4886
|
+
style: at({ background: je(g.type) })
|
|
4868
4887
|
}, S(g.type), 5),
|
|
4869
|
-
h("span",
|
|
4870
|
-
], 8,
|
|
4871
|
-
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 "))
|
|
4872
4891
|
])
|
|
4873
4892
|
])) : V("", !0),
|
|
4874
|
-
t.value === "data" ? (A(), $("div",
|
|
4893
|
+
t.value === "data" ? (A(), $("div", wn, [
|
|
4875
4894
|
d[25] || (d[25] = h("h3", { class: "szd-panel__heading" }, "Data Pipeline", -1)),
|
|
4876
|
-
h("div",
|
|
4877
|
-
(A(!0), $(W, null, ce(
|
|
4895
|
+
h("div", Cn, [
|
|
4896
|
+
(A(!0), $(W, null, ce(me.value, (g, z) => (A(), $(W, {
|
|
4878
4897
|
key: g.id
|
|
4879
4898
|
}, [
|
|
4880
4899
|
h("div", {
|
|
4881
4900
|
class: "szd-pipeline__stage",
|
|
4882
|
-
onClick: (H) =>
|
|
4901
|
+
onClick: (H) => ls(g)
|
|
4883
4902
|
}, [
|
|
4884
|
-
h("div",
|
|
4885
|
-
h("div",
|
|
4886
|
-
], 8,
|
|
4887
|
-
|
|
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)
|
|
4888
4907
|
], 64))), 128))
|
|
4889
4908
|
]),
|
|
4890
|
-
h("div",
|
|
4891
|
-
h("div",
|
|
4909
|
+
h("div", Sn, [
|
|
4910
|
+
h("div", Tn, [
|
|
4892
4911
|
d[24] || (d[24] = h("h3", { class: "szd-panel__heading" }, "Instance Preview", -1)),
|
|
4893
|
-
|
|
4912
|
+
Qe(h("select", {
|
|
4894
4913
|
"onUpdate:modelValue": d[4] || (d[4] = (g) => m.value = g),
|
|
4895
4914
|
class: "szd-select"
|
|
4896
4915
|
}, [
|
|
@@ -4898,55 +4917,55 @@ const Er = (n, e) => {
|
|
|
4898
4917
|
(A(!0), $(W, null, ce(Ye.value, (g) => (A(), $("option", {
|
|
4899
4918
|
key: g,
|
|
4900
4919
|
value: g
|
|
4901
|
-
}, S(g), 9,
|
|
4920
|
+
}, S(g), 9, Mn))), 128))
|
|
4902
4921
|
], 512), [
|
|
4903
4922
|
[At, m.value]
|
|
4904
4923
|
])
|
|
4905
4924
|
]),
|
|
4906
|
-
m.value != null ? (A(), $("div",
|
|
4907
|
-
(A(!0), $(W, null, ce(
|
|
4925
|
+
m.value != null ? (A(), $("div", $n, [
|
|
4926
|
+
(A(!0), $(W, null, ce(me.value, (g) => (A(), $("div", {
|
|
4908
4927
|
key: g.id,
|
|
4909
4928
|
class: "szd-data-card"
|
|
4910
4929
|
}, [
|
|
4911
|
-
h("div",
|
|
4912
|
-
|
|
4913
|
-
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"))
|
|
4914
4933
|
]),
|
|
4915
|
-
h("pre",
|
|
4934
|
+
h("pre", In, S(g.pks.includes(m.value) ? JSON.stringify(ye(m.value), null, 2) : "—"), 1)
|
|
4916
4935
|
]))), 128))
|
|
4917
4936
|
])) : (A(), $("div", Fn, "Select an instance to preview"))
|
|
4918
4937
|
])
|
|
4919
4938
|
])) : V("", !0),
|
|
4920
4939
|
t.value === "ast" ? (A(), $("div", Dn, [
|
|
4921
4940
|
d[27] || (d[27] = h("h3", { class: "szd-panel__heading" }, "Query AST", -1)),
|
|
4922
|
-
h("div",
|
|
4941
|
+
h("div", zn, [
|
|
4923
4942
|
h("div", Kn, [
|
|
4924
4943
|
d[26] || (d[26] = h("span", { class: "szd-kv__key" }, "Semantic Key:", -1)),
|
|
4925
|
-
h("code",
|
|
4944
|
+
h("code", Rn, S(k.value || "—"), 1)
|
|
4926
4945
|
])
|
|
4927
4946
|
]),
|
|
4928
|
-
h("pre",
|
|
4947
|
+
h("pre", Nn, S(re.value ? JSON.stringify(re.value, null, 2) : "Select a queryset to view AST"), 1)
|
|
4929
4948
|
])) : V("", !0)
|
|
4930
4949
|
]),
|
|
4931
4950
|
Tt(Ot, { name: "szd-slide" }, {
|
|
4932
4951
|
default: Pt(() => [
|
|
4933
|
-
p.value ? (A(), $("div",
|
|
4952
|
+
p.value ? (A(), $("div", xn, [
|
|
4934
4953
|
h("div", {
|
|
4935
4954
|
class: "szd-detail__backdrop",
|
|
4936
4955
|
onClick: d[5] || (d[5] = (g) => p.value = !1)
|
|
4937
4956
|
}),
|
|
4938
|
-
h("div",
|
|
4939
|
-
h("div",
|
|
4957
|
+
h("div", jn, [
|
|
4958
|
+
h("div", Un, [
|
|
4940
4959
|
d[28] || (d[28] = h("h3", { class: "szd-detail__title" }, "Debug Settings", -1)),
|
|
4941
4960
|
h("button", {
|
|
4942
4961
|
class: "szd-btn",
|
|
4943
4962
|
onClick: d[6] || (d[6] = (g) => p.value = !1)
|
|
4944
4963
|
}, "Close")
|
|
4945
4964
|
]),
|
|
4946
|
-
h("div",
|
|
4947
|
-
h("div",
|
|
4965
|
+
h("div", Qn, [
|
|
4966
|
+
h("div", Vn, [
|
|
4948
4967
|
d[30] || (d[30] = h("label", { class: "szd-settings-label" }, "Queryset", -1)),
|
|
4949
|
-
|
|
4968
|
+
Qe(h("select", {
|
|
4950
4969
|
"onUpdate:modelValue": d[7] || (d[7] = (g) => r.value = g),
|
|
4951
4970
|
class: "szd-select szd-select--full"
|
|
4952
4971
|
}, [
|
|
@@ -4954,69 +4973,69 @@ const Er = (n, e) => {
|
|
|
4954
4973
|
(A(!0), $(W, null, ce(b.value, (g) => (A(), $("option", {
|
|
4955
4974
|
key: g.semanticKey,
|
|
4956
4975
|
value: g.semanticKey
|
|
4957
|
-
}, S(g.modelName || "?") + " · " + S(g.semanticKey), 9,
|
|
4976
|
+
}, S(g.modelName || "?") + " · " + S(g.semanticKey), 9, Ln))), 128))
|
|
4958
4977
|
], 512), [
|
|
4959
4978
|
[At, r.value]
|
|
4960
4979
|
])
|
|
4961
4980
|
]),
|
|
4962
|
-
k.value ? (A(), $("div",
|
|
4981
|
+
k.value ? (A(), $("div", Gn, [
|
|
4963
4982
|
d[31] || (d[31] = h("label", { class: "szd-settings-label" }, "Semantic Key", -1)),
|
|
4964
|
-
h("div",
|
|
4965
|
-
h("code",
|
|
4983
|
+
h("div", Bn, [
|
|
4984
|
+
h("code", Hn, S(k.value), 1),
|
|
4966
4985
|
h("button", {
|
|
4967
4986
|
class: "szd-btn szd-btn--sm",
|
|
4968
|
-
onClick:
|
|
4987
|
+
onClick: is
|
|
4969
4988
|
}, "Copy")
|
|
4970
4989
|
])
|
|
4971
4990
|
])) : V("", !0),
|
|
4972
|
-
h("div",
|
|
4991
|
+
h("div", qn, [
|
|
4973
4992
|
d[32] || (d[32] = h("label", { class: "szd-settings-label" }, "Actions", -1)),
|
|
4974
|
-
h("div",
|
|
4993
|
+
h("div", Jn, [
|
|
4975
4994
|
h("button", {
|
|
4976
4995
|
class: "szd-btn",
|
|
4977
|
-
onClick:
|
|
4996
|
+
onClick: as,
|
|
4978
4997
|
disabled: !N.value || c.value
|
|
4979
|
-
}, S(c.value ? "Syncing..." : "Sync Now"), 9,
|
|
4998
|
+
}, S(c.value ? "Syncing..." : "Sync Now"), 9, Wn),
|
|
4980
4999
|
h("button", {
|
|
4981
5000
|
class: "szd-btn",
|
|
4982
|
-
onClick:
|
|
5001
|
+
onClick: os
|
|
4983
5002
|
}, "Clear Events")
|
|
4984
5003
|
])
|
|
4985
5004
|
]),
|
|
4986
|
-
h("div",
|
|
5005
|
+
h("div", Zn, [
|
|
4987
5006
|
d[34] || (d[34] = h("label", { class: "szd-settings-label" }, "Options", -1)),
|
|
4988
|
-
h("label",
|
|
4989
|
-
|
|
5007
|
+
h("label", Yn, [
|
|
5008
|
+
Qe(h("input", {
|
|
4990
5009
|
type: "checkbox",
|
|
4991
5010
|
"onUpdate:modelValue": d[8] || (d[8] = (g) => i.value = g)
|
|
4992
5011
|
}, null, 512), [
|
|
4993
5012
|
[$t, i.value]
|
|
4994
5013
|
]),
|
|
4995
|
-
d[33] || (d[33] =
|
|
5014
|
+
d[33] || (d[33] = Ve(" Live updates ", -1))
|
|
4996
5015
|
])
|
|
4997
5016
|
]),
|
|
4998
|
-
k.value ? (A(), $("div",
|
|
5017
|
+
k.value ? (A(), $("div", Xn, [
|
|
4999
5018
|
d[40] || (d[40] = h("label", { class: "szd-settings-label" }, "Current State", -1)),
|
|
5000
|
-
h("div",
|
|
5001
|
-
h("div",
|
|
5019
|
+
h("div", eo, [
|
|
5020
|
+
h("div", to, [
|
|
5002
5021
|
d[35] || (d[35] = h("span", { class: "szd-kv__key" }, "Model:", -1)),
|
|
5003
|
-
h("span",
|
|
5022
|
+
h("span", so, S(I.value.modelName || "—"), 1)
|
|
5004
5023
|
]),
|
|
5005
|
-
h("div",
|
|
5024
|
+
h("div", ro, [
|
|
5006
5025
|
d[36] || (d[36] = h("span", { class: "szd-kv__key" }, "Source:", -1)),
|
|
5007
|
-
h("span",
|
|
5026
|
+
h("span", no, S(I.value.source), 1)
|
|
5008
5027
|
]),
|
|
5009
|
-
h("div",
|
|
5028
|
+
h("div", oo, [
|
|
5010
5029
|
d[37] || (d[37] = h("span", { class: "szd-kv__key" }, "Syncing:", -1)),
|
|
5011
|
-
h("span",
|
|
5030
|
+
h("span", io, S(I.value.isSyncing ? "Yes" : "No"), 1)
|
|
5012
5031
|
]),
|
|
5013
|
-
h("div",
|
|
5032
|
+
h("div", ao, [
|
|
5014
5033
|
d[38] || (d[38] = h("span", { class: "szd-kv__key" }, "Operations:", -1)),
|
|
5015
|
-
h("span",
|
|
5034
|
+
h("span", lo, S(I.value.opsCount), 1)
|
|
5016
5035
|
]),
|
|
5017
|
-
h("div",
|
|
5036
|
+
h("div", co, [
|
|
5018
5037
|
d[39] || (d[39] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
|
|
5019
|
-
h("span",
|
|
5038
|
+
h("span", uo, S(I.value.lastSync), 1)
|
|
5020
5039
|
])
|
|
5021
5040
|
])
|
|
5022
5041
|
])) : V("", !0)
|
|
@@ -5028,48 +5047,48 @@ const Er = (n, e) => {
|
|
|
5028
5047
|
}),
|
|
5029
5048
|
Tt(Ot, { name: "szd-slide" }, {
|
|
5030
5049
|
default: Pt(() => [
|
|
5031
|
-
f.value ? (A(), $("div",
|
|
5050
|
+
f.value ? (A(), $("div", ho, [
|
|
5032
5051
|
h("div", {
|
|
5033
5052
|
class: "szd-detail__backdrop",
|
|
5034
5053
|
onClick: kt
|
|
5035
5054
|
}),
|
|
5036
|
-
h("div",
|
|
5037
|
-
h("div",
|
|
5038
|
-
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),
|
|
5039
5058
|
h("button", {
|
|
5040
5059
|
class: "szd-btn",
|
|
5041
5060
|
onClick: kt
|
|
5042
5061
|
}, "Close")
|
|
5043
5062
|
]),
|
|
5044
|
-
h("div",
|
|
5063
|
+
h("div", yo, [
|
|
5045
5064
|
f.value.type === "entry" ? (A(), $(W, { key: 0 }, [
|
|
5046
|
-
h("div",
|
|
5047
|
-
(A(!0), $(W, null, ce(
|
|
5048
|
-
key:
|
|
5065
|
+
h("div", go, [
|
|
5066
|
+
(A(!0), $(W, null, ce(ns(f.value.data), (g, z) => (A(), $("div", {
|
|
5067
|
+
key: z,
|
|
5049
5068
|
class: "szd-kv__row"
|
|
5050
5069
|
}, [
|
|
5051
|
-
h("span",
|
|
5052
|
-
h("span",
|
|
5070
|
+
h("span", _o, S(z) + ":", 1),
|
|
5071
|
+
h("span", wo, S(g ?? "—"), 1)
|
|
5053
5072
|
]))), 128))
|
|
5054
5073
|
]),
|
|
5055
5074
|
d[41] || (d[41] = h("h4", { style: { margin: "16px 0 8px" } }, "Raw JSON", -1)),
|
|
5056
|
-
h("pre",
|
|
5075
|
+
h("pre", Co, S(JSON.stringify(f.value.data, null, 2)), 1)
|
|
5057
5076
|
], 64)) : (A(), $(W, { key: 1 }, [
|
|
5058
|
-
h("div",
|
|
5059
|
-
h("div",
|
|
5077
|
+
h("div", vo, [
|
|
5078
|
+
h("div", Eo, [
|
|
5060
5079
|
d[42] || (d[42] = h("span", { class: "szd-kv__key" }, "Total Count:", -1)),
|
|
5061
|
-
h("span",
|
|
5080
|
+
h("span", bo, S(f.value.data.count), 1)
|
|
5062
5081
|
]),
|
|
5063
|
-
h("div",
|
|
5082
|
+
h("div", ko, [
|
|
5064
5083
|
d[43] || (d[43] = h("span", { class: "szd-kv__key" }, "Showing:", -1)),
|
|
5065
|
-
h("span",
|
|
5066
|
-
|
|
5067
|
-
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)
|
|
5068
5087
|
])
|
|
5069
5088
|
])
|
|
5070
5089
|
]),
|
|
5071
5090
|
d[44] || (d[44] = h("h4", { style: { margin: "0 0 8px" } }, "Data", -1)),
|
|
5072
|
-
h("pre",
|
|
5091
|
+
h("pre", Mo, S(JSON.stringify(Ke.value, null, 2)), 1)
|
|
5073
5092
|
], 64))
|
|
5074
5093
|
])
|
|
5075
5094
|
])
|
|
@@ -5079,7 +5098,7 @@ const Er = (n, e) => {
|
|
|
5079
5098
|
})
|
|
5080
5099
|
]));
|
|
5081
5100
|
}
|
|
5082
|
-
},
|
|
5101
|
+
}, Go = /* @__PURE__ */ br($o, [["__scopeId", "data-v-6d80920c"]]);
|
|
5083
5102
|
export {
|
|
5084
|
-
|
|
5103
|
+
Go as default
|
|
5085
5104
|
};
|