@statezero/core 0.2.52 → 0.2.53
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 +465 -457
- package/dist/adaptors/vue/composables.d.ts +1 -1
- package/dist/adaptors/vue/composables.js +8 -2
- package/dist/adaptors/vue/reactivity.js +3 -3
- package/dist/syncEngine/cache/cache.d.ts +1 -1
- package/dist/syncEngine/cache/cache.js +8 -1
- package/dist/syncEngine/registries/metricRegistry.d.ts +14 -3
- package/dist/syncEngine/registries/metricRegistry.js +20 -6
- package/dist/syncEngine/stores/querysetStore.js +18 -6
- package/package.json +1 -1
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { ref as J, computed as R, onMounted as
|
|
1
|
+
import { ref as J, computed as R, onMounted as fs, onBeforeUnmount as ps, watch as it, createElementBlock as $, openBlock as A, createElementVNode as h, createVNode as Mt, toDisplayString as S, createCommentVNode as V, Fragment as W, renderList as ce, normalizeClass as $t, normalizeStyle as at, withDirectives as Qe, createTextVNode as Ve, vModelCheckbox as At, vModelSelect as Ot, Transition as Pt, withCtx as Ft } from "vue";
|
|
2
2
|
import { v7 as G } from "uuid";
|
|
3
|
-
import { isNil as E, isEmpty as ve, trim as
|
|
3
|
+
import { isNil as E, isEmpty as ve, trim as ut, isEqual as qe } from "lodash-es";
|
|
4
4
|
import Ae from "mitt";
|
|
5
5
|
import It from "handlebars";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import Dt from "superjson";
|
|
7
|
+
import ms from "p-queue";
|
|
8
|
+
import ys from "axios";
|
|
9
9
|
import { z as P } from "zod";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import gs from "pusher-js";
|
|
11
|
+
import Yt, { createEqualsOperation as ee } from "sift";
|
|
12
12
|
import { DateTime as _e } from "luxon";
|
|
13
|
-
import { parse as
|
|
14
|
-
import { Graph as
|
|
13
|
+
import { parse as _s, format as ws } from "date-fns";
|
|
14
|
+
import { Graph as zt } from "graphlib";
|
|
15
15
|
import Le from "object-hash";
|
|
16
|
-
import * as
|
|
17
|
-
import
|
|
18
|
-
const se = /* @__PURE__ */ new Map(),
|
|
19
|
-
function
|
|
20
|
-
return
|
|
16
|
+
import * as Xt from "mathjs";
|
|
17
|
+
import Cs from "rfdc";
|
|
18
|
+
const se = /* @__PURE__ */ new Map(), ht = /* @__PURE__ */ new Set();
|
|
19
|
+
function vs(n) {
|
|
20
|
+
return ht.add(n), () => ht.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 Kt(n) {
|
|
26
26
|
return `{{TempPK_${n}}}`;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Rt(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
|
-
for (const o of
|
|
31
|
+
for (const o of ht)
|
|
32
32
|
try {
|
|
33
33
|
o(t, e);
|
|
34
34
|
} catch (i) {
|
|
35
35
|
console.warn("[tempPk] onResolve callback error:", i);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Es(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;
|
|
@@ -48,14 +48,14 @@ function We(n) {
|
|
|
48
48
|
try {
|
|
49
49
|
if (typeof n == "string")
|
|
50
50
|
return It.compile(n, { noEscape: !0 })(e);
|
|
51
|
-
const t =
|
|
52
|
-
return
|
|
51
|
+
const t = Dt.stringify(n), r = It.compile(t, { noEscape: !0 })(e);
|
|
52
|
+
return Dt.parse(r);
|
|
53
53
|
} catch {
|
|
54
54
|
return n;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
class
|
|
57
|
+
const bs = Ae(), ks = Ae(), Nt = Ae(), lt = /* @__PURE__ */ new Map();
|
|
58
|
+
class Ss {
|
|
59
59
|
constructor(e, t = {}) {
|
|
60
60
|
this.dbName = e, this.storeName = t.storeName || "keyval-store", this.batchDelay = t.batchDelay || 50, this.version = t.version || 5, this.resetOnErrors = t.resetOnErrors || [
|
|
61
61
|
"VersionError",
|
|
@@ -236,9 +236,9 @@ class ks {
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
class
|
|
239
|
+
class Et {
|
|
240
240
|
constructor(e, t = {}, s = null) {
|
|
241
|
-
this.store = new
|
|
241
|
+
lt.has(e) ? this.store = lt.get(e) : (this.store = new Ss(e, t), lt.set(e, this.store)), 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);
|
|
@@ -294,7 +294,7 @@ const ge = (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
|
+
bs.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 Ts {
|
|
344
344
|
modelClass;
|
|
345
345
|
fetchFn;
|
|
346
346
|
groundTruthArray;
|
|
347
347
|
operationsMap;
|
|
348
348
|
isSyncing;
|
|
349
349
|
constructor(e, t, s = null, r = null, o = {}) {
|
|
350
|
-
this.modelClass = e, this.fetchFn = t, this.isSyncing = !1, this.pruneThreshold = o.pruneThreshold || 10, this.groundTruthArray = s || [], this.operationsMap = /* @__PURE__ */ new Map(), r && r.length > 0 && this._loadOperations(r), this.modelCache = new
|
|
350
|
+
this.modelClass = e, this.fetchFn = t, this.isSyncing = !1, this.pruneThreshold = o.pruneThreshold || 10, this.groundTruthArray = s || [], this.operationsMap = /* @__PURE__ */ new Map(), r && r.length > 0 && this._loadOperations(r), this.modelCache = new Et("model-cache", {}, this.onHydrated.bind(this)), this._lastRenderedData = /* @__PURE__ */ new Map(), this.renderCallbacks = /* @__PURE__ */ new Set(), this._unsubscribeTempPk = vs((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);
|
|
@@ -382,7 +382,7 @@ class Ss {
|
|
|
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) || ve(
|
|
385
|
+
if (!(typeof o == "string" && Je(o) && (o = We(r[t]), E(o) || ve(ut(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 Ss {
|
|
|
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) || ve(
|
|
401
|
+
typeof f == "string" && Je(f) && (f = We(c[s]), E(f) || ve(ut(f))) || (c[s] = f, r.push(c));
|
|
402
402
|
}), t === null) {
|
|
403
403
|
this.setCache(r);
|
|
404
404
|
return;
|
|
@@ -600,7 +600,7 @@ class Ss {
|
|
|
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) => Es(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 Ts(e, t, null, null)), this.syncManager.followModel(this, e);
|
|
692
692
|
}
|
|
693
693
|
return this._stores.get(e);
|
|
694
694
|
}
|
|
@@ -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 Ms {
|
|
822
822
|
constructor() {
|
|
823
823
|
this._operations = /* @__PURE__ */ new Map(), this._querysetStates = /* @__PURE__ */ new Map();
|
|
824
824
|
}
|
|
@@ -903,9 +903,9 @@ class Ts {
|
|
|
903
903
|
return t.length > 0 ? t[t.length - 1] : void 0;
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
const Pe = new
|
|
907
|
-
function
|
|
908
|
-
|
|
906
|
+
const Pe = new Ms(), $s = Ae();
|
|
907
|
+
function As(n) {
|
|
908
|
+
$s.emit("error", n);
|
|
909
909
|
}
|
|
910
910
|
class fe extends Error {
|
|
911
911
|
/**
|
|
@@ -917,7 +917,7 @@ class fe 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), As(this);
|
|
921
921
|
}
|
|
922
922
|
/**
|
|
923
923
|
* Returns a full error message including the detail.
|
|
@@ -950,7 +950,7 @@ class Oe extends fe {
|
|
|
950
950
|
super("Validation error", "validation_error", e, t), this.name = "ValidationError";
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
|
-
class
|
|
953
|
+
class xt extends fe {
|
|
954
954
|
/**
|
|
955
955
|
* Creates a new DoesNotExist error.
|
|
956
956
|
*
|
|
@@ -961,7 +961,7 @@ class Nt extends fe {
|
|
|
961
961
|
super("DoesNotExist", "does_not_exist", e, t), this.name = "DoesNotExist";
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
class
|
|
964
|
+
class ct extends fe {
|
|
965
965
|
/**
|
|
966
966
|
* Creates a new PermissionDenied error.
|
|
967
967
|
*
|
|
@@ -972,7 +972,7 @@ class lt extends fe {
|
|
|
972
972
|
super("Permission denied", "permission_denied", e, t), this.name = "PermissionDenied";
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
class
|
|
975
|
+
class Os extends fe {
|
|
976
976
|
/**
|
|
977
977
|
* Creates a new MultipleObjectsReturned error.
|
|
978
978
|
*
|
|
@@ -983,7 +983,7 @@ class As extends fe {
|
|
|
983
983
|
super("Multiple objects returned", "multiple_objects_returned", e, t), this.name = "MultipleObjectsReturned";
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
class
|
|
986
|
+
class jt extends fe {
|
|
987
987
|
/**
|
|
988
988
|
* Creates a new ConflictError.
|
|
989
989
|
*
|
|
@@ -994,7 +994,7 @@ class xt extends fe {
|
|
|
994
994
|
super("Conflict", "conflict", e, t), this.name = "ConflictError";
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
-
class
|
|
997
|
+
class Ps extends fe {
|
|
998
998
|
/**
|
|
999
999
|
* Creates a new ASTValidationError.
|
|
1000
1000
|
*
|
|
@@ -1016,24 +1016,24 @@ class x extends fe {
|
|
|
1016
1016
|
super("Configuration error", "config_error", e, t), this.name = "ConfigError";
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function Fs(n) {
|
|
1020
1020
|
const { status: e, type: t, detail: s } = n;
|
|
1021
1021
|
if (t === void 0 && s === "Invalid token.")
|
|
1022
|
-
return new
|
|
1022
|
+
return new ct(s, 403);
|
|
1023
1023
|
switch (t) {
|
|
1024
1024
|
// Direct mappings
|
|
1025
1025
|
case "ValidationError":
|
|
1026
1026
|
return new Oe(s, e);
|
|
1027
1027
|
case "NotFound":
|
|
1028
|
-
return new
|
|
1028
|
+
return new xt(s, e);
|
|
1029
1029
|
case "MultipleObjectsReturned":
|
|
1030
|
-
return new
|
|
1030
|
+
return new Os(s, e);
|
|
1031
1031
|
case "PermissionDenied":
|
|
1032
|
-
return new
|
|
1032
|
+
return new ct(s, e);
|
|
1033
1033
|
case "ConflictError":
|
|
1034
|
-
return new
|
|
1034
|
+
return new jt(s, e);
|
|
1035
1035
|
case "ASTValidationError":
|
|
1036
|
-
return new
|
|
1036
|
+
return new Ps(s, e);
|
|
1037
1037
|
case "ConfigError":
|
|
1038
1038
|
return new x(s, e);
|
|
1039
1039
|
// Django error types that map to our error classes
|
|
@@ -1042,10 +1042,10 @@ function Ps(n) {
|
|
|
1042
1042
|
case "ValueError":
|
|
1043
1043
|
return new Oe(s, e);
|
|
1044
1044
|
default:
|
|
1045
|
-
return e === 400 ? new Oe(s, e) : e === 403 ? new
|
|
1045
|
+
return e === 400 ? new Oe(s, e) : e === 403 ? new ct(s, e) : e === 404 ? new xt(s, e) : e === 409 ? new jt(s, e) : new fe("Unknown error", "unknown", s, e);
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
|
-
const
|
|
1048
|
+
const Ut = {
|
|
1049
1049
|
CREATE: "create",
|
|
1050
1050
|
UPDATE: "update",
|
|
1051
1051
|
DELETE: "delete",
|
|
@@ -1063,7 +1063,7 @@ class Is {
|
|
|
1063
1063
|
this.configKey = t, this.connectionTimeoutId = null, s.appKey && /^\d+$/.test(s.appKey) && s.appKey.length < 15 && console.warn(
|
|
1064
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}".`,
|
|
1065
1065
|
"color: orange; font-weight: bold; font-size: 14px;"
|
|
1066
|
-
), this.pusherClient = new
|
|
1066
|
+
), this.pusherClient = new gs(s.appKey, {
|
|
1067
1067
|
cluster: s.cluster,
|
|
1068
1068
|
forceTLS: s.forceTLS ?? !0,
|
|
1069
1069
|
authEndpoint: s.authEndpoint,
|
|
@@ -1143,7 +1143,7 @@ Common causes:
|
|
|
1143
1143
|
`%cAuthentication failed for channel ${t}. Check your authEndpoint and server-side permissions.`,
|
|
1144
1144
|
"color: orange; font-weight: bold;"
|
|
1145
1145
|
);
|
|
1146
|
-
}), Object.values(
|
|
1146
|
+
}), Object.values(Ut).forEach((r) => {
|
|
1147
1147
|
s.bind(r, (o) => {
|
|
1148
1148
|
const i = {
|
|
1149
1149
|
...o,
|
|
@@ -1158,7 +1158,7 @@ Common causes:
|
|
|
1158
1158
|
unsubscribe(e) {
|
|
1159
1159
|
const t = this.channels.get(e);
|
|
1160
1160
|
if (!t) return;
|
|
1161
|
-
Object.values(
|
|
1161
|
+
Object.values(Ut).forEach((r) => {
|
|
1162
1162
|
t.unbind(r);
|
|
1163
1163
|
});
|
|
1164
1164
|
const s = e.startsWith("private-") ? e : this.formatChannelName(e);
|
|
@@ -1201,20 +1201,20 @@ Common causes:
|
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
1203
|
const Ze = /* @__PURE__ */ new Map();
|
|
1204
|
-
function
|
|
1204
|
+
function Ds(n, e) {
|
|
1205
1205
|
const t = Ze.get(n);
|
|
1206
1206
|
t && t.disconnect(), Ze.set(n, e), e.connect();
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function Qt(n = "default") {
|
|
1209
1209
|
return Ze.get(n);
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1211
|
+
function zs() {
|
|
1212
1212
|
return Ze;
|
|
1213
1213
|
}
|
|
1214
|
-
let
|
|
1214
|
+
let Vt = {
|
|
1215
1215
|
backendConfigs: {}
|
|
1216
1216
|
};
|
|
1217
|
-
const
|
|
1217
|
+
const Ks = P.object({
|
|
1218
1218
|
clientOptions: P.object({
|
|
1219
1219
|
appKey: P.string({ required_error: "Pusher appKey is required" }),
|
|
1220
1220
|
cluster: P.string({ required_error: "Pusher cluster is required" }),
|
|
@@ -1225,10 +1225,10 @@ const zs = P.object({
|
|
|
1225
1225
|
"getAuthHeaders must be a function if provided"
|
|
1226
1226
|
)
|
|
1227
1227
|
})
|
|
1228
|
-
}),
|
|
1228
|
+
}), Rs = P.object({
|
|
1229
1229
|
type: P.enum(["websocket", "pusher", "none"]),
|
|
1230
1230
|
websocketUrl: P.string().url().optional(),
|
|
1231
|
-
pusher:
|
|
1231
|
+
pusher: Ks.optional(),
|
|
1232
1232
|
hotpaths: P.array(P.string()).default(["default"])
|
|
1233
1233
|
}).superRefine((n, e) => {
|
|
1234
1234
|
n.type === "websocket" && (n.websocketUrl || e.addIssue({
|
|
@@ -1258,8 +1258,8 @@ const zs = P.object({
|
|
|
1258
1258
|
(n) => n === void 0 || typeof n == "function",
|
|
1259
1259
|
"eventInterceptor must be a function if provided"
|
|
1260
1260
|
),
|
|
1261
|
-
events: P.lazy(() =>
|
|
1262
|
-
}),
|
|
1261
|
+
events: P.lazy(() => Rs.optional())
|
|
1262
|
+
}), Ns = P.object({
|
|
1263
1263
|
backendConfigs: P.record(P.string(), Be).refine(
|
|
1264
1264
|
(n) => {
|
|
1265
1265
|
for (const [e, t] of Object.entries(n))
|
|
@@ -1281,22 +1281,22 @@ const zs = P.object({
|
|
|
1281
1281
|
),
|
|
1282
1282
|
periodicSyncIntervalSeconds: P.number().min(5).nullable().optional().default(null)
|
|
1283
1283
|
});
|
|
1284
|
-
let
|
|
1285
|
-
function
|
|
1286
|
-
|
|
1287
|
-
const e =
|
|
1284
|
+
let ft = null;
|
|
1285
|
+
function xs(n) {
|
|
1286
|
+
Vt = n;
|
|
1287
|
+
const e = Ns.safeParse(Vt);
|
|
1288
1288
|
if (!e.success) {
|
|
1289
1289
|
const t = e.error.errors.map((s) => s.message);
|
|
1290
1290
|
throw new x(`Error setting configuration: ${t.join(", ")}`);
|
|
1291
1291
|
}
|
|
1292
|
-
|
|
1292
|
+
ft = e.data;
|
|
1293
1293
|
}
|
|
1294
1294
|
function he() {
|
|
1295
|
-
if (!
|
|
1295
|
+
if (!ft)
|
|
1296
1296
|
throw new x("Configuration not set. Please call setConfig() with a valid configuration.");
|
|
1297
|
-
return
|
|
1297
|
+
return ft;
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1299
|
+
function js(n, e) {
|
|
1300
1300
|
try {
|
|
1301
1301
|
const t = he();
|
|
1302
1302
|
if (!t.backendConfigs[n])
|
|
@@ -1311,7 +1311,7 @@ function xs(n, e) {
|
|
|
1311
1311
|
throw t instanceof x ? t : new x(t.message || "Invalid backend configuration");
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1314
|
+
function es(n = "default") {
|
|
1315
1315
|
try {
|
|
1316
1316
|
const e = he();
|
|
1317
1317
|
if (!e.backendConfigs[n])
|
|
@@ -1340,17 +1340,17 @@ function Xt(n = "default") {
|
|
|
1340
1340
|
default:
|
|
1341
1341
|
throw new x(`Unknown event receiver type: ${t.events.type}`);
|
|
1342
1342
|
}
|
|
1343
|
-
return s &&
|
|
1343
|
+
return s && Ds(n, s), s;
|
|
1344
1344
|
} catch (e) {
|
|
1345
1345
|
throw e instanceof x ? e : new x(`Failed to initialize event receiver: ${e.message}`);
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1348
|
+
function Us() {
|
|
1349
1349
|
try {
|
|
1350
1350
|
const n = he(), e = {};
|
|
1351
1351
|
return Object.keys(n.backendConfigs).forEach((t) => {
|
|
1352
1352
|
try {
|
|
1353
|
-
e[t] =
|
|
1353
|
+
e[t] = es(t);
|
|
1354
1354
|
} catch (s) {
|
|
1355
1355
|
console.warn(`Failed to initialize event receiver for backend "${t}": ${s.message}`);
|
|
1356
1356
|
}
|
|
@@ -1359,13 +1359,13 @@ function js() {
|
|
|
1359
1359
|
throw new x(`Failed to initialize event receivers: ${n.message}`);
|
|
1360
1360
|
}
|
|
1361
1361
|
}
|
|
1362
|
-
let
|
|
1363
|
-
function
|
|
1362
|
+
let pt = null;
|
|
1363
|
+
function Qs(n) {
|
|
1364
1364
|
if (typeof n != "function")
|
|
1365
1365
|
throw new x("Provided model getter must be a function.");
|
|
1366
|
-
|
|
1366
|
+
pt = n;
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1368
|
+
function Vs(n, e = "default") {
|
|
1369
1369
|
if (n && n.startsWith("http"))
|
|
1370
1370
|
return n;
|
|
1371
1371
|
const s = he().backendConfigs[e];
|
|
@@ -1373,20 +1373,20 @@ function Qs(n, e = "default") {
|
|
|
1373
1373
|
throw new x(`Backend "${e}" not found in configuration.`);
|
|
1374
1374
|
return s.fileRootURL ? s.fileRootURL.replace(/\/$/, "") + n : n;
|
|
1375
1375
|
}
|
|
1376
|
-
function
|
|
1377
|
-
if (!
|
|
1376
|
+
function ts(n, e) {
|
|
1377
|
+
if (!pt)
|
|
1378
1378
|
throw new x("Model registry not registered. Please call registerModelGetter() with the function from model-registry.js during app initialization.");
|
|
1379
|
-
return
|
|
1379
|
+
return pt(n, e);
|
|
1380
1380
|
}
|
|
1381
|
-
const
|
|
1382
|
-
setConfig:
|
|
1381
|
+
const Ie = {
|
|
1382
|
+
setConfig: xs,
|
|
1383
1383
|
getConfig: he,
|
|
1384
|
-
setBackendConfig:
|
|
1385
|
-
initializeEventReceiver:
|
|
1386
|
-
registerModelGetter:
|
|
1387
|
-
getModelClass:
|
|
1388
|
-
buildFileUrl:
|
|
1389
|
-
},
|
|
1384
|
+
setBackendConfig: js,
|
|
1385
|
+
initializeEventReceiver: es,
|
|
1386
|
+
registerModelGetter: Qs,
|
|
1387
|
+
getModelClass: ts,
|
|
1388
|
+
buildFileUrl: Vs
|
|
1389
|
+
}, ss = "__STATEZERO_DEBUG__", X = globalThis[ss] || {
|
|
1390
1390
|
emitter: Ae(),
|
|
1391
1391
|
buffer: [],
|
|
1392
1392
|
enabled: !0,
|
|
@@ -1394,7 +1394,7 @@ const Fe = {
|
|
|
1394
1394
|
maxEntries: 500,
|
|
1395
1395
|
nextId: 1
|
|
1396
1396
|
};
|
|
1397
|
-
globalThis[
|
|
1397
|
+
globalThis[ss] = X;
|
|
1398
1398
|
const Me = X.emitter, ue = X.buffer;
|
|
1399
1399
|
function Te(n) {
|
|
1400
1400
|
if (!X.enabled) return;
|
|
@@ -1408,23 +1408,23 @@ function Te(n) {
|
|
|
1408
1408
|
function B(n) {
|
|
1409
1409
|
Te(n);
|
|
1410
1410
|
}
|
|
1411
|
-
function
|
|
1411
|
+
function Ls(n) {
|
|
1412
1412
|
return Me.on("record", n), () => Me.off("record", n);
|
|
1413
1413
|
}
|
|
1414
|
-
function
|
|
1414
|
+
function Gs(n) {
|
|
1415
1415
|
return Me.on("clear", n), () => Me.off("clear", n);
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function Lt() {
|
|
1418
1418
|
return ue.slice();
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function Bs() {
|
|
1421
1421
|
ue.length = 0, Me.emit("clear");
|
|
1422
1422
|
}
|
|
1423
|
-
function
|
|
1423
|
+
function Gt(n) {
|
|
1424
1424
|
const e = Number(n);
|
|
1425
1425
|
!Number.isFinite(e) || e <= 0 || (X.maxEntries = Math.floor(e), ue.length > X.maxEntries && ue.splice(0, ue.length - X.maxEntries));
|
|
1426
1426
|
}
|
|
1427
|
-
function
|
|
1427
|
+
function Hs() {
|
|
1428
1428
|
X.started || (X.started = !0, ie.on(C.CREATED, (n) => {
|
|
1429
1429
|
Te({
|
|
1430
1430
|
type: "operation",
|
|
@@ -1477,11 +1477,11 @@ function Bs() {
|
|
|
1477
1477
|
Te({ type: "operation", subtype: C.CLEAR });
|
|
1478
1478
|
}));
|
|
1479
1479
|
}
|
|
1480
|
-
const
|
|
1481
|
-
function
|
|
1482
|
-
return
|
|
1480
|
+
const dt = /* @__PURE__ */ new Map();
|
|
1481
|
+
function qs(n = "default") {
|
|
1482
|
+
return dt.has(n) || dt.set(n, new ms({ concurrency: 1 })), dt.get(n);
|
|
1483
1483
|
}
|
|
1484
|
-
function
|
|
1484
|
+
function Js(n, e = 3e4) {
|
|
1485
1485
|
return Promise.race([
|
|
1486
1486
|
n,
|
|
1487
1487
|
new Promise(
|
|
@@ -1496,7 +1496,7 @@ function we(n, e, t, s = null) {
|
|
|
1496
1496
|
s && (o = j.getStore(s));
|
|
1497
1497
|
try {
|
|
1498
1498
|
for (const [i, l] of Object.entries(e)) {
|
|
1499
|
-
const a =
|
|
1499
|
+
const a = Ie.getModelClass(i, r);
|
|
1500
1500
|
if (!a)
|
|
1501
1501
|
throw console.error(
|
|
1502
1502
|
`Model class not found for ${i} in config ${r}`
|
|
@@ -1518,7 +1518,7 @@ function we(n, e, t, s = null) {
|
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
1520
1520
|
async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
1521
|
-
const { namespace: l = "default", timeout: a } = i, c = n.ModelClass, p =
|
|
1521
|
+
const { namespace: l = "default", timeout: a } = i, c = n.ModelClass, p = Ie.getConfig().backendConfigs[c.configKey];
|
|
1522
1522
|
if (!p)
|
|
1523
1523
|
throw new Error(
|
|
1524
1524
|
`No backend configuration found for key: ${c.configKey}`
|
|
@@ -1548,7 +1548,7 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1548
1548
|
"delete_instance",
|
|
1549
1549
|
"get_or_create",
|
|
1550
1550
|
"update_or_create"
|
|
1551
|
-
].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() : {}, F = n.semanticKey;
|
|
1552
1552
|
s && (N["X-Operation-ID"] = s), o && (N["X-Canonical-ID"] = o);
|
|
1553
1553
|
const re = async () => {
|
|
1554
1554
|
try {
|
|
@@ -1556,7 +1556,7 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1556
1556
|
type: "request",
|
|
1557
1557
|
modelName: c.modelName,
|
|
1558
1558
|
configKey: c.configKey,
|
|
1559
|
-
semanticKey:
|
|
1559
|
+
semanticKey: F,
|
|
1560
1560
|
operationType: e,
|
|
1561
1561
|
operationId: s,
|
|
1562
1562
|
canonicalId: o,
|
|
@@ -1564,9 +1564,9 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1564
1564
|
payload: w,
|
|
1565
1565
|
namespace: l
|
|
1566
1566
|
});
|
|
1567
|
-
let D = await
|
|
1567
|
+
let D = await ys.post(U, We(w), { headers: N });
|
|
1568
1568
|
typeof r == "function" && D?.data && await r(D.data);
|
|
1569
|
-
const
|
|
1569
|
+
const I = D?.data?.data, K = D?.data?.included, me = Array.isArray(I) ? I.length : I != null ? 1 : 0, Ye = K ? Object.keys(K).length : 0, ye = 100, Ke = Array.isArray(I) && I.length > ye ? I.slice(0, ye) : I, Xe = Array.isArray(I) && I.length > ye;
|
|
1570
1570
|
let Re = K, Ee = !1;
|
|
1571
1571
|
if (K && typeof K == "object") {
|
|
1572
1572
|
const Ne = {};
|
|
@@ -1582,7 +1582,7 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1582
1582
|
type: "response",
|
|
1583
1583
|
modelName: c.modelName,
|
|
1584
1584
|
configKey: c.configKey,
|
|
1585
|
-
semanticKey:
|
|
1585
|
+
semanticKey: F,
|
|
1586
1586
|
operationType: e,
|
|
1587
1587
|
operationId: s,
|
|
1588
1588
|
canonicalId: o,
|
|
@@ -1600,7 +1600,7 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1600
1600
|
type: "error",
|
|
1601
1601
|
modelName: c.modelName,
|
|
1602
1602
|
configKey: c.configKey,
|
|
1603
|
-
semanticKey:
|
|
1603
|
+
semanticKey: F,
|
|
1604
1604
|
operationType: e,
|
|
1605
1605
|
operationId: s,
|
|
1606
1606
|
canonicalId: o,
|
|
@@ -1608,19 +1608,19 @@ async function L(n, e, t = {}, s, r = null, o = null, i = {}) {
|
|
|
1608
1608
|
status: D?.response?.status,
|
|
1609
1609
|
message: D?.message
|
|
1610
1610
|
}), D?.code === "ECONNREFUSED") {
|
|
1611
|
-
const
|
|
1612
|
-
throw new Error(`${
|
|
1611
|
+
const I = "Connection refused. If you're running tests, start the test server with `python manage.py statezero_testserver`.";
|
|
1612
|
+
throw new Error(`${I} (${U})`);
|
|
1613
1613
|
}
|
|
1614
1614
|
if (D.response && D.response.data) {
|
|
1615
|
-
const
|
|
1616
|
-
throw Error.captureStackTrace && Error.captureStackTrace(
|
|
1615
|
+
const I = Fs(D.response.data);
|
|
1616
|
+
throw Error.captureStackTrace && Error.captureStackTrace(I, L), I;
|
|
1617
1617
|
}
|
|
1618
1618
|
throw new Error(`API call failed: ${D.message}`);
|
|
1619
1619
|
}
|
|
1620
|
-
}, pe =
|
|
1621
|
-
return a ?
|
|
1620
|
+
}, pe = qs(l), ae = b ? pe.add(re) : re();
|
|
1621
|
+
return a ? Js(ae, a) : ae;
|
|
1622
1622
|
}
|
|
1623
|
-
class
|
|
1623
|
+
class Bt {
|
|
1624
1624
|
// Supported Django strftime formats and their date-fns equivalents
|
|
1625
1625
|
static SUPPORTED_FORMATS = {
|
|
1626
1626
|
"iso-8601": null,
|
|
@@ -1674,7 +1674,7 @@ class Gt {
|
|
|
1674
1674
|
return c.isValid ? c.toJSDate() : (console.error(`Failed to parse ISO date "${e}":`, c.invalidReason), null);
|
|
1675
1675
|
}
|
|
1676
1676
|
const a = this.SUPPORTED_FORMATS[l];
|
|
1677
|
-
return
|
|
1677
|
+
return _s(e, a, /* @__PURE__ */ new Date());
|
|
1678
1678
|
} catch (a) {
|
|
1679
1679
|
return console.error(`Failed to parse date "${e}" with format "${l}"`, a), null;
|
|
1680
1680
|
}
|
|
@@ -1706,19 +1706,19 @@ class Gt {
|
|
|
1706
1706
|
if (!i || i === "iso-8601")
|
|
1707
1707
|
return r === "date" ? e.toISOString().slice(0, 10) : e.toISOString();
|
|
1708
1708
|
const l = this.SUPPORTED_FORMATS[i];
|
|
1709
|
-
return
|
|
1709
|
+
return ws(e, l);
|
|
1710
1710
|
} catch (l) {
|
|
1711
1711
|
return console.error(`Failed to format date with format "${i}"`, l), e.toISOString();
|
|
1712
1712
|
}
|
|
1713
1713
|
}
|
|
1714
1714
|
}
|
|
1715
|
-
function
|
|
1715
|
+
function Ws(n) {
|
|
1716
1716
|
if (!n || !n.configKey)
|
|
1717
1717
|
return "UTC";
|
|
1718
|
-
const e =
|
|
1718
|
+
const e = Ie.getConfig();
|
|
1719
1719
|
return (e.backendConfigs[n.configKey] || e.backendConfigs.default).BACKEND_TZ || "UTC";
|
|
1720
1720
|
}
|
|
1721
|
-
const
|
|
1721
|
+
const Ht = {
|
|
1722
1722
|
// Store backend snake_case format internally for consistency with API
|
|
1723
1723
|
toInternal: (n, e = {}) => {
|
|
1724
1724
|
if (typeof n == "string")
|
|
@@ -1738,7 +1738,7 @@ const Bt = {
|
|
|
1738
1738
|
// Return object with both formats for maximum compatibility
|
|
1739
1739
|
toLive: (n, e = {}) => {
|
|
1740
1740
|
if (!n || typeof n != "object") return n;
|
|
1741
|
-
const t = e.model?.constructor?.configKey || "default", s = n.file_url ?
|
|
1741
|
+
const t = e.model?.constructor?.configKey || "default", s = n.file_url ? Ie.buildFileUrl(n.file_url, t) : null;
|
|
1742
1742
|
return {
|
|
1743
1743
|
// snake_case (backend format)
|
|
1744
1744
|
file_path: n.file_path,
|
|
@@ -1755,14 +1755,14 @@ const Bt = {
|
|
|
1755
1755
|
mimeType: n.mime_type
|
|
1756
1756
|
};
|
|
1757
1757
|
}
|
|
1758
|
-
},
|
|
1758
|
+
}, qt = {
|
|
1759
1759
|
toInternal: (n, e = {}) => {
|
|
1760
1760
|
if (E(n) || typeof n == "string") return n;
|
|
1761
1761
|
if (n instanceof Date) {
|
|
1762
1762
|
const { model: t, field: s, fieldSchema: r } = e, o = t?.schema || r?.format && {
|
|
1763
1763
|
properties: { [s]: { format: r.format } }
|
|
1764
1764
|
};
|
|
1765
|
-
return o ?
|
|
1765
|
+
return o ? Bt.serializeDate(n, s, o) : n.toISOString();
|
|
1766
1766
|
}
|
|
1767
1767
|
throw new Error(`expected string or Date, got ${typeof n}`);
|
|
1768
1768
|
},
|
|
@@ -1770,8 +1770,8 @@ const Bt = {
|
|
|
1770
1770
|
if (E(n) || typeof n != "string") return n;
|
|
1771
1771
|
const { model: t, field: s } = e;
|
|
1772
1772
|
if (t?.schema) {
|
|
1773
|
-
const r =
|
|
1774
|
-
return
|
|
1773
|
+
const r = Ws(t);
|
|
1774
|
+
return Bt.parseDate(n, s, t.schema, r);
|
|
1775
1775
|
}
|
|
1776
1776
|
try {
|
|
1777
1777
|
return new Date(n);
|
|
@@ -1794,7 +1794,7 @@ const Bt = {
|
|
|
1794
1794
|
const { model: t, field: s } = e;
|
|
1795
1795
|
return t.relationshipFields.has(s) && n ? t.relationshipFields.get(s).ModelClass().fromPk(n) : n;
|
|
1796
1796
|
}
|
|
1797
|
-
},
|
|
1797
|
+
}, Zs = {
|
|
1798
1798
|
toInternal: (n, e = {}) => {
|
|
1799
1799
|
if (E(n)) return n;
|
|
1800
1800
|
if (!Array.isArray(n)) throw new Error(`expected array, got ${typeof n}`);
|
|
@@ -1822,10 +1822,10 @@ const Bt = {
|
|
|
1822
1822
|
}
|
|
1823
1823
|
}, Se = {
|
|
1824
1824
|
string: {
|
|
1825
|
-
"file-path":
|
|
1826
|
-
"image-path":
|
|
1827
|
-
date:
|
|
1828
|
-
"date-time":
|
|
1825
|
+
"file-path": Ht,
|
|
1826
|
+
"image-path": Ht,
|
|
1827
|
+
date: qt,
|
|
1828
|
+
"date-time": qt,
|
|
1829
1829
|
"foreign-key": ke,
|
|
1830
1830
|
"one-to-one": ke
|
|
1831
1831
|
},
|
|
@@ -1839,10 +1839,10 @@ const Bt = {
|
|
|
1839
1839
|
"one-to-one": ke
|
|
1840
1840
|
},
|
|
1841
1841
|
array: {
|
|
1842
|
-
"many-to-many":
|
|
1842
|
+
"many-to-many": Zs
|
|
1843
1843
|
}
|
|
1844
1844
|
};
|
|
1845
|
-
class
|
|
1845
|
+
class rs {
|
|
1846
1846
|
constructor(e) {
|
|
1847
1847
|
this.modelClass = e;
|
|
1848
1848
|
}
|
|
@@ -1897,15 +1897,15 @@ class ss {
|
|
|
1897
1897
|
return t;
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
|
-
function
|
|
1900
|
+
function Ys(n) {
|
|
1901
1901
|
if (!n || !n.configKey)
|
|
1902
1902
|
return "UTC";
|
|
1903
|
-
const e =
|
|
1903
|
+
const e = Ie.getConfig();
|
|
1904
1904
|
return (e.backendConfigs[n.configKey] || e.backendConfigs.default).BACKEND_TZ || "UTC";
|
|
1905
1905
|
}
|
|
1906
|
-
function
|
|
1906
|
+
function Xs(n, e, t) {
|
|
1907
1907
|
if (!t?.schema || !n) return e;
|
|
1908
|
-
const s = new
|
|
1908
|
+
const s = new rs(t);
|
|
1909
1909
|
return Array.isArray(e) ? e.map((r) => s.toLiveField(n, r)) : s.toLiveField(n, e);
|
|
1910
1910
|
}
|
|
1911
1911
|
function De(n, e, t, s = {}) {
|
|
@@ -1947,13 +1947,13 @@ function De(n, e, t, s = {}) {
|
|
|
1947
1947
|
k === "pk" && p && (k = p.primaryKeyField);
|
|
1948
1948
|
const U = b === c.length - 1;
|
|
1949
1949
|
if (p && p.relationshipFields && p.relationshipFields instanceof Map && p.relationshipFields.has(k)) {
|
|
1950
|
-
const N = p.relationshipFields.get(k),
|
|
1950
|
+
const N = p.relationshipFields.get(k), F = N.ModelClass(), re = N.relationshipType;
|
|
1951
1951
|
if (!U && re === "many-to-many") {
|
|
1952
1952
|
let ae = c.slice(b + 1).join("__");
|
|
1953
1953
|
a.length > 0 ? ae += "__" + a.join("__") : f && (ae += "__" + f);
|
|
1954
|
-
const D = De(ae, e,
|
|
1954
|
+
const D = De(ae, e, F, s), I = m.length > 0 ? m.join(".") + "." + k : k, K = D.requiredPath || D.field, me = `${I}.${K}`;
|
|
1955
1955
|
return {
|
|
1956
|
-
field:
|
|
1956
|
+
field: I,
|
|
1957
1957
|
operator: { $elemMatch: { [D.field]: D.operator } },
|
|
1958
1958
|
isM2M: !0,
|
|
1959
1959
|
requiredPath: me
|
|
@@ -1961,49 +1961,49 @@ function De(n, e, t, s = {}) {
|
|
|
1961
1961
|
};
|
|
1962
1962
|
}
|
|
1963
1963
|
if (m.push(k), !U)
|
|
1964
|
-
p =
|
|
1964
|
+
p = F;
|
|
1965
1965
|
else {
|
|
1966
1966
|
if (y = !0, re === "many-to-many")
|
|
1967
1967
|
_ = !0, w = k;
|
|
1968
1968
|
else {
|
|
1969
|
-
const pe =
|
|
1969
|
+
const pe = F.primaryKeyField || "id";
|
|
1970
1970
|
m.push(pe), w = pe;
|
|
1971
1971
|
}
|
|
1972
|
-
p =
|
|
1972
|
+
p = F;
|
|
1973
1973
|
}
|
|
1974
1974
|
} else if (p && p.fields && p.fields.includes(k)) {
|
|
1975
1975
|
if (m.push(k), w = k, U)
|
|
1976
1976
|
break;
|
|
1977
1977
|
const N = p.schema?.properties?.[k];
|
|
1978
1978
|
if (N && N.format === "json") {
|
|
1979
|
-
const
|
|
1980
|
-
m.push(...
|
|
1979
|
+
const F = c.slice(b + 1);
|
|
1980
|
+
m.push(...F);
|
|
1981
1981
|
break;
|
|
1982
1982
|
}
|
|
1983
1983
|
throw new Error(`Field '${k}' in '${n}' is not a relationship field and cannot be traversed.`);
|
|
1984
1984
|
} else
|
|
1985
1985
|
throw new Error(`Field '${k}' in '${n}' not found in model ${p.modelName}.`);
|
|
1986
1986
|
}
|
|
1987
|
-
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 : Xs(w, e, p);
|
|
1988
1988
|
if (a.length === 2) {
|
|
1989
1989
|
const [b, k] = a;
|
|
1990
|
-
return
|
|
1990
|
+
return er(v, b, k, T, y);
|
|
1991
1991
|
}
|
|
1992
1992
|
if (f)
|
|
1993
|
-
return
|
|
1993
|
+
return tr(v, f, T, y, p, w, _);
|
|
1994
1994
|
if (y) {
|
|
1995
1995
|
let b = T;
|
|
1996
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 } };
|
|
1997
1997
|
}
|
|
1998
1998
|
return { field: v, operator: { $eq: T } };
|
|
1999
1999
|
}
|
|
2000
|
-
function
|
|
2000
|
+
function er(n, e, t, s, r) {
|
|
2001
2001
|
return r ? (console.warn(`Date part comparison on relationship fields may not work as expected: ${n}`), { field: n, operator: { $eq: s } }) : {
|
|
2002
2002
|
field: n,
|
|
2003
2003
|
operator: { [`$${e}_${t}`]: s }
|
|
2004
2004
|
};
|
|
2005
2005
|
}
|
|
2006
|
-
function
|
|
2006
|
+
function tr(n, e, t, s, r, o, i = !1) {
|
|
2007
2007
|
function l(a) {
|
|
2008
2008
|
return a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2009
2009
|
}
|
|
@@ -2058,8 +2058,8 @@ function er(n, e, t, s, r, o, i = !1) {
|
|
|
2058
2058
|
operator: { $regex: new RegExp(`${l(t)}$`, "i") }
|
|
2059
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 } };
|
|
2060
2060
|
}
|
|
2061
|
-
function
|
|
2062
|
-
const t = e ? new
|
|
2061
|
+
function sr(n = "UTC", e = null) {
|
|
2062
|
+
const t = e ? new rs(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) => {
|
|
2063
2063
|
const p = s(a, f);
|
|
2064
2064
|
if (!p || !(p instanceof Date) || isNaN(p.getTime()))
|
|
2065
2065
|
return null;
|
|
@@ -2233,13 +2233,13 @@ function tr(n = "UTC", e = null) {
|
|
|
2233
2233
|
});
|
|
2234
2234
|
}), o;
|
|
2235
2235
|
}
|
|
2236
|
-
function
|
|
2237
|
-
const t =
|
|
2238
|
-
return
|
|
2239
|
-
operations:
|
|
2236
|
+
function rr(n, e) {
|
|
2237
|
+
const t = Ys(e);
|
|
2238
|
+
return Yt(n, {
|
|
2239
|
+
operations: sr(t, e)
|
|
2240
2240
|
});
|
|
2241
2241
|
}
|
|
2242
|
-
function
|
|
2242
|
+
function mt(n, e) {
|
|
2243
2243
|
const t = {}, s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
2244
2244
|
for (const [o, i] of Object.entries(n))
|
|
2245
2245
|
try {
|
|
@@ -2267,9 +2267,9 @@ function pt(n, e) {
|
|
|
2267
2267
|
}
|
|
2268
2268
|
return t;
|
|
2269
2269
|
}
|
|
2270
|
-
function
|
|
2270
|
+
function nr(n, e) {
|
|
2271
2271
|
return !n || !n.length ? null : {
|
|
2272
|
-
$or: n.map((t) => "operator" in t && "conditions" in t ? { [t.operator === "AND" ? "$and" : "$or"]: t.conditions.map((r) =>
|
|
2272
|
+
$or: n.map((t) => "operator" in t && "conditions" in t ? { [t.operator === "AND" ? "$and" : "$or"]: t.conditions.map((r) => mt(r, e)) } : mt(t, e))
|
|
2273
2273
|
};
|
|
2274
2274
|
}
|
|
2275
2275
|
function He(n, e) {
|
|
@@ -2277,8 +2277,8 @@ function He(n, e) {
|
|
|
2277
2277
|
if (n.type === "filter") {
|
|
2278
2278
|
const { conditions: t, Q: s } = n;
|
|
2279
2279
|
let r = {};
|
|
2280
|
-
if (t && Object.keys(t).length > 0 && (r =
|
|
2281
|
-
const o =
|
|
2280
|
+
if (t && Object.keys(t).length > 0 && (r = mt(t, e)), s && s.length > 0) {
|
|
2281
|
+
const o = nr(s, e);
|
|
2282
2282
|
if (o)
|
|
2283
2283
|
return Object.keys(r).length > 0 ? { $and: [r, o] } : o;
|
|
2284
2284
|
}
|
|
@@ -2298,7 +2298,7 @@ function He(n, e) {
|
|
|
2298
2298
|
}
|
|
2299
2299
|
return null;
|
|
2300
2300
|
}
|
|
2301
|
-
function
|
|
2301
|
+
function or(n, e, t) {
|
|
2302
2302
|
if (!e || !e.searchQuery) return n;
|
|
2303
2303
|
const s = e.searchFields || (n[0] ? Object.keys(n[0]).filter((i) => typeof n[0][i] == "string") : []);
|
|
2304
2304
|
if (!s.length) return n;
|
|
@@ -2321,9 +2321,9 @@ function nr(n, e, t) {
|
|
|
2321
2321
|
};
|
|
2322
2322
|
}
|
|
2323
2323
|
});
|
|
2324
|
-
return n.filter(
|
|
2324
|
+
return n.filter(Yt({ $or: o }));
|
|
2325
2325
|
}
|
|
2326
|
-
function
|
|
2326
|
+
function Jt(n, e) {
|
|
2327
2327
|
const t = e.split(".");
|
|
2328
2328
|
let s = n;
|
|
2329
2329
|
for (const r of t) {
|
|
@@ -2333,7 +2333,7 @@ function qt(n, e) {
|
|
|
2333
2333
|
}
|
|
2334
2334
|
return s;
|
|
2335
2335
|
}
|
|
2336
|
-
function
|
|
2336
|
+
function ir(n, e) {
|
|
2337
2337
|
return n.map((t) => {
|
|
2338
2338
|
const s = t.startsWith("-"), r = s ? t.substring(1) : t;
|
|
2339
2339
|
try {
|
|
@@ -2350,12 +2350,12 @@ function or(n, e) {
|
|
|
2350
2350
|
}
|
|
2351
2351
|
});
|
|
2352
2352
|
}
|
|
2353
|
-
function
|
|
2353
|
+
function ar(n, e, t) {
|
|
2354
2354
|
if (!e || !e.length) return [...n];
|
|
2355
|
-
const s =
|
|
2355
|
+
const s = ir(e, t);
|
|
2356
2356
|
return [...n].sort((r, o) => {
|
|
2357
2357
|
for (const { field: i, desc: l } of s) {
|
|
2358
|
-
const a =
|
|
2358
|
+
const a = Jt(r, i), c = Jt(o, i);
|
|
2359
2359
|
if (a !== c) {
|
|
2360
2360
|
if (a === null && c !== null) return l ? -1 : 1;
|
|
2361
2361
|
if (a !== null && c === null) return l ? 1 : -1;
|
|
@@ -2368,7 +2368,7 @@ function ir(n, e, t) {
|
|
|
2368
2368
|
return 0;
|
|
2369
2369
|
});
|
|
2370
2370
|
}
|
|
2371
|
-
function
|
|
2371
|
+
function yt(n, e, t) {
|
|
2372
2372
|
if (!Array.isArray(n) || n.length === 0)
|
|
2373
2373
|
return [];
|
|
2374
2374
|
if (!t)
|
|
@@ -2377,11 +2377,11 @@ function mt(n, e, t) {
|
|
|
2377
2377
|
let r = [...n];
|
|
2378
2378
|
if (e.filter) {
|
|
2379
2379
|
const o = He(e.filter, t);
|
|
2380
|
-
o && Object.keys(o).length && (r = r.filter(
|
|
2380
|
+
o && Object.keys(o).length && (r = r.filter(rr(o, t)));
|
|
2381
2381
|
}
|
|
2382
|
-
return e.search && e.search.searchQuery && (r =
|
|
2382
|
+
return e.search && e.search.searchQuery && (r = or(r, e.search, t)), Array.isArray(e.orderBy) && e.orderBy.length && (r = ar(r, e.orderBy, t)), r.map((o) => o[s]);
|
|
2383
2383
|
}
|
|
2384
|
-
function
|
|
2384
|
+
function gt(n, e) {
|
|
2385
2385
|
const t = /* @__PURE__ */ new Set(), s = e.primaryKeyField;
|
|
2386
2386
|
t.add(s);
|
|
2387
2387
|
function r(i) {
|
|
@@ -2414,36 +2414,36 @@ function yt(n, e) {
|
|
|
2414
2414
|
r(i.replace(/^-/, ""));
|
|
2415
2415
|
}), Array.from(t);
|
|
2416
2416
|
}
|
|
2417
|
-
function
|
|
2417
|
+
function _t(n, e, t) {
|
|
2418
2418
|
if (e == null || t.length === 0)
|
|
2419
2419
|
return;
|
|
2420
2420
|
const [s, ...r] = t, o = e[s];
|
|
2421
2421
|
o !== void 0 && (r.length === 0 ? n[s] = o : Array.isArray(o) ? (s in n || (n[s] = []), o.forEach((i, l) => {
|
|
2422
|
-
n[s][l] === void 0 && (n[s][l] = {}),
|
|
2423
|
-
})) : typeof o == "object" && (s in n || (n[s] = {}),
|
|
2422
|
+
n[s][l] === void 0 && (n[s][l] = {}), _t(n[s][l], i, r);
|
|
2423
|
+
})) : typeof o == "object" && (s in n || (n[s] = {}), _t(n[s], o, r)));
|
|
2424
2424
|
}
|
|
2425
|
-
function
|
|
2425
|
+
function wt(n, e) {
|
|
2426
2426
|
const t = {};
|
|
2427
2427
|
return n.forEach((s) => {
|
|
2428
2428
|
const r = s.split(".");
|
|
2429
|
-
|
|
2429
|
+
_t(t, e, r);
|
|
2430
2430
|
}), t;
|
|
2431
2431
|
}
|
|
2432
|
-
function
|
|
2432
|
+
function Ct(n, e, t, s = !1) {
|
|
2433
2433
|
if (!Array.isArray(n) || n.length === 0)
|
|
2434
2434
|
return [];
|
|
2435
2435
|
if (!t)
|
|
2436
2436
|
throw new Error("ModelClass is required for proper relationship traversal");
|
|
2437
2437
|
const r = t.primaryKeyField || "id";
|
|
2438
|
-
let o =
|
|
2439
|
-
const l =
|
|
2438
|
+
let o = gt(e, t), i = n.map((a) => wt(o, a));
|
|
2439
|
+
const l = yt(i, e, t);
|
|
2440
2440
|
if (s) {
|
|
2441
2441
|
const a = new Map(n.map((c) => [c[r], c]));
|
|
2442
2442
|
return l.map((c) => a.get(c));
|
|
2443
2443
|
}
|
|
2444
2444
|
return l;
|
|
2445
2445
|
}
|
|
2446
|
-
class
|
|
2446
|
+
class lr {
|
|
2447
2447
|
modelClass;
|
|
2448
2448
|
fetchFn;
|
|
2449
2449
|
queryset;
|
|
@@ -2457,7 +2457,7 @@ class ar {
|
|
|
2457
2457
|
const c = Pe.get(l.operationId) || new q(l, !0);
|
|
2458
2458
|
this.operationsMap.set(c.operationId, c);
|
|
2459
2459
|
}
|
|
2460
|
-
if (this.qsCache = new
|
|
2460
|
+
if (this.qsCache = new Et("queryset-cache", {}, this.onHydrated.bind(this)), this._lastRenderedPks = null, this.renderCallbacks = /* @__PURE__ */ new Set(), !this.isTemp) {
|
|
2461
2461
|
const l = Q.getStore(this.modelClass);
|
|
2462
2462
|
this._modelStoreUnregister = l.registerRenderCallback(() => {
|
|
2463
2463
|
this._emitRenderEvent();
|
|
@@ -2469,15 +2469,14 @@ class ar {
|
|
|
2469
2469
|
return this.queryset.semanticKey;
|
|
2470
2470
|
}
|
|
2471
2471
|
onHydrated(e) {
|
|
2472
|
-
if (this.groundTruthPks.length
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
}
|
|
2472
|
+
if (this.lastSync !== null || this.groundTruthPks.length > 0 || this.operationsMap.size > 0) return;
|
|
2473
|
+
const t = this.qsCache.get(this.cacheKey);
|
|
2474
|
+
!E(t) && !ve(t) && (this.groundTruthPks = Array.isArray(t) ? t : [], this._emitRenderEvent());
|
|
2476
2475
|
}
|
|
2477
2476
|
setCache(e) {
|
|
2478
2477
|
let t = [];
|
|
2479
2478
|
e.forEach((s) => {
|
|
2480
|
-
typeof s == "string" && Je(s) && (s = We(s), E(s) || ve(
|
|
2479
|
+
typeof s == "string" && Je(s) && (s = We(s), E(s) || ve(ut(s))) || t.push(s);
|
|
2481
2480
|
}), this.qsCache.set(this.cacheKey, t);
|
|
2482
2481
|
}
|
|
2483
2482
|
clearCache() {
|
|
@@ -2501,7 +2500,7 @@ class ar {
|
|
|
2501
2500
|
} catch (s) {
|
|
2502
2501
|
console.warn("Error in render callback:", s);
|
|
2503
2502
|
}
|
|
2504
|
-
}), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e,
|
|
2503
|
+
}), qe(e, this._lastRenderedPks) || (this._lastRenderedPks = e, ks.emit(
|
|
2505
2504
|
`${this.modelClass.configKey}::${this.modelClass.modelName}::queryset::render`,
|
|
2506
2505
|
{ ast: this.queryset.build(), ModelClass: this.modelClass }
|
|
2507
2506
|
));
|
|
@@ -2570,12 +2569,12 @@ class ar {
|
|
|
2570
2569
|
const t = Array.from(e).map((o) => this.modelClass.fromPk(o, this.queryset)).filter(
|
|
2571
2570
|
(o) => Q.getEntity(this.modelClass, o.pk) !== null
|
|
2572
2571
|
), s = this.queryset.build();
|
|
2573
|
-
return
|
|
2572
|
+
return Ct(t, s, this.modelClass, !1);
|
|
2574
2573
|
}
|
|
2575
2574
|
render(e = !0, t = !1) {
|
|
2576
2575
|
if (t) {
|
|
2577
|
-
const
|
|
2578
|
-
if (Array.isArray(
|
|
2576
|
+
const c = this.qsCache.get(this.cacheKey);
|
|
2577
|
+
if (Array.isArray(c))
|
|
2579
2578
|
return B({
|
|
2580
2579
|
type: "render",
|
|
2581
2580
|
source: "cache",
|
|
@@ -2585,13 +2584,13 @@ class ar {
|
|
|
2585
2584
|
optimistic: e,
|
|
2586
2585
|
groundTruthCount: this.groundTruthPks.length,
|
|
2587
2586
|
operationsCount: this.operationsMap.size,
|
|
2588
|
-
resultCount:
|
|
2589
|
-
}),
|
|
2587
|
+
resultCount: c.length
|
|
2588
|
+
}), c;
|
|
2590
2589
|
}
|
|
2591
|
-
const s = this.groundTruthPks.length === 0 && this.lastSync === null ? this.renderFromModelStore() : this.renderFromData(e);
|
|
2592
|
-
let
|
|
2593
|
-
const
|
|
2594
|
-
return
|
|
2590
|
+
const s = this.queryset.build().serializerOptions?.offset, o = this.groundTruthPks.length === 0 && this.lastSync === null && !(s != null && s > 0) ? this.renderFromModelStore() : this.renderFromData(e);
|
|
2591
|
+
let i = this._getValidatedAndFilteredPks(o);
|
|
2592
|
+
const l = i.length, a = this.queryset.build().serializerOptions?.limit;
|
|
2593
|
+
return a && (i = i.slice(0, a)), this.setCache(i), B({
|
|
2595
2594
|
type: "render",
|
|
2596
2595
|
source: this.groundTruthPks.length === 0 && this.lastSync === null ? "modelStore" : "groundTruth",
|
|
2597
2596
|
semanticKey: this.queryset.semanticKey,
|
|
@@ -2600,11 +2599,11 @@ class ar {
|
|
|
2600
2599
|
optimistic: e,
|
|
2601
2600
|
groundTruthCount: this.groundTruthPks.length,
|
|
2602
2601
|
operationsCount: this.operationsMap.size,
|
|
2603
|
-
rawCount: Array.isArray(
|
|
2604
|
-
filteredCount:
|
|
2605
|
-
resultCount:
|
|
2606
|
-
limit:
|
|
2607
|
-
}),
|
|
2602
|
+
rawCount: Array.isArray(o) ? o.length : 0,
|
|
2603
|
+
filteredCount: l,
|
|
2604
|
+
resultCount: i.length,
|
|
2605
|
+
limit: a
|
|
2606
|
+
}), i;
|
|
2608
2607
|
}
|
|
2609
2608
|
renderFromData(e = !0) {
|
|
2610
2609
|
const t = this.groundTruthSet;
|
|
@@ -2618,7 +2617,7 @@ class ar {
|
|
|
2618
2617
|
*/
|
|
2619
2618
|
renderFromModelStore() {
|
|
2620
2619
|
const s = Q.getStore(this.modelClass).groundTruthPks.map((o) => this.modelClass.fromPk(o, this.queryset)), r = this.queryset.build();
|
|
2621
|
-
return
|
|
2620
|
+
return Ct(s, r, this.modelClass, !1);
|
|
2622
2621
|
}
|
|
2623
2622
|
applyOperation(e, t) {
|
|
2624
2623
|
const s = this.pkField;
|
|
@@ -2702,9 +2701,9 @@ class ar {
|
|
|
2702
2701
|
}
|
|
2703
2702
|
}
|
|
2704
2703
|
}
|
|
2705
|
-
class
|
|
2704
|
+
class cr {
|
|
2706
2705
|
constructor() {
|
|
2707
|
-
this.graph = new
|
|
2706
|
+
this.graph = new zt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
|
|
2708
2707
|
}
|
|
2709
2708
|
/**
|
|
2710
2709
|
* Add a queryset and its parent relationship to the graph
|
|
@@ -2790,10 +2789,10 @@ class lr {
|
|
|
2790
2789
|
return !e && !t ? !0 : !e || !t || e.length !== t.length ? !1 : e.every((s, r) => s === t[r]);
|
|
2791
2790
|
}
|
|
2792
2791
|
clear() {
|
|
2793
|
-
this.graph = new
|
|
2792
|
+
this.graph = new zt({ directed: !0 }), this.processedQuerysets = /* @__PURE__ */ new Set();
|
|
2794
2793
|
}
|
|
2795
2794
|
}
|
|
2796
|
-
class
|
|
2795
|
+
class dr {
|
|
2797
2796
|
#e;
|
|
2798
2797
|
#t;
|
|
2799
2798
|
#s;
|
|
@@ -2837,7 +2836,7 @@ class Ce {
|
|
|
2837
2836
|
constructor() {
|
|
2838
2837
|
this._stores = /* @__PURE__ */ new Map(), this._tempStores = /* @__PURE__ */ new WeakMap(), this.followingQuerysets = /* @__PURE__ */ new Map(), this.syncManager = () => {
|
|
2839
2838
|
console.warn("SyncManager not set for QuerysetStoreRegistry");
|
|
2840
|
-
}, this.querysetStoreGraph = new
|
|
2839
|
+
}, this.querysetStoreGraph = new cr(), this._groupSyncCache = /* @__PURE__ */ new Map();
|
|
2841
2840
|
}
|
|
2842
2841
|
clear() {
|
|
2843
2842
|
this._stores.forEach((e) => {
|
|
@@ -2885,7 +2884,7 @@ class Ce {
|
|
|
2885
2884
|
{ namespace: "sync", timeout: 3e4 }
|
|
2886
2885
|
// Sync ops on separate queue
|
|
2887
2886
|
)).data;
|
|
2888
|
-
}, o = new
|
|
2887
|
+
}, o = new lr(
|
|
2889
2888
|
e.ModelClass,
|
|
2890
2889
|
r,
|
|
2891
2890
|
e,
|
|
@@ -2909,7 +2908,7 @@ class Ce {
|
|
|
2909
2908
|
this.addFollowingQueryset(s, e);
|
|
2910
2909
|
let r;
|
|
2911
2910
|
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));
|
|
2912
|
-
const o = new
|
|
2911
|
+
const o = new dr(e);
|
|
2913
2912
|
return t && r.sync(), o;
|
|
2914
2913
|
}
|
|
2915
2914
|
/**
|
|
@@ -3013,7 +3012,7 @@ class Ce {
|
|
|
3013
3012
|
});
|
|
3014
3013
|
return;
|
|
3015
3014
|
}
|
|
3016
|
-
const v = p.pks.map((b) => i.fromPk(b, e)), O = e.build(), T =
|
|
3015
|
+
const v = p.pks.map((b) => i.fromPk(b, e)), O = e.build(), T = Ct(v, O, i, !1);
|
|
3017
3016
|
m.setGroundTruth(T), m.setOperations(m.getInflightOperations()), m.lastSync = Date.now(), B({
|
|
3018
3017
|
type: "groupSync",
|
|
3019
3018
|
phase: "filteredFromRoot",
|
|
@@ -3073,7 +3072,7 @@ class ze {
|
|
|
3073
3072
|
return isNaN(r) ? 0 : r;
|
|
3074
3073
|
}
|
|
3075
3074
|
}
|
|
3076
|
-
class
|
|
3075
|
+
class ur extends ze {
|
|
3077
3076
|
reduceOperation(e, t, s) {
|
|
3078
3077
|
if (t.status === C.REJECTED)
|
|
3079
3078
|
return e;
|
|
@@ -3081,7 +3080,7 @@ class dr extends ze {
|
|
|
3081
3080
|
return r === M.CREATE ? e + 1 : [M.DELETE, M.DELETE_INSTANCE].includes(r) ? Math.max(0, e - 1) : e;
|
|
3082
3081
|
}
|
|
3083
3082
|
}
|
|
3084
|
-
class
|
|
3083
|
+
class hr extends ze {
|
|
3085
3084
|
reduceOperation(e, t, s) {
|
|
3086
3085
|
if (t.status === C.REJECTED)
|
|
3087
3086
|
return e;
|
|
@@ -3106,7 +3105,7 @@ class ur extends ze {
|
|
|
3106
3105
|
}
|
|
3107
3106
|
}
|
|
3108
3107
|
}
|
|
3109
|
-
class
|
|
3108
|
+
class fr extends ze {
|
|
3110
3109
|
getInitialValue() {
|
|
3111
3110
|
return 1 / 0;
|
|
3112
3111
|
}
|
|
@@ -3129,7 +3128,7 @@ class hr extends ze {
|
|
|
3129
3128
|
return e;
|
|
3130
3129
|
}
|
|
3131
3130
|
}
|
|
3132
|
-
class
|
|
3131
|
+
class pr extends ze {
|
|
3133
3132
|
getInitialValue() {
|
|
3134
3133
|
return -1 / 0;
|
|
3135
3134
|
}
|
|
@@ -3152,15 +3151,15 @@ class fr extends ze {
|
|
|
3152
3151
|
return e;
|
|
3153
3152
|
}
|
|
3154
3153
|
}
|
|
3155
|
-
class
|
|
3154
|
+
class mr {
|
|
3156
3155
|
// Collection of custom strategy overrides
|
|
3157
3156
|
static #e = /* @__PURE__ */ new Map();
|
|
3158
3157
|
// Default strategy map
|
|
3159
3158
|
static #t = /* @__PURE__ */ new Map([
|
|
3160
|
-
["count", () => new
|
|
3161
|
-
["sum", () => new
|
|
3162
|
-
["min", () => new
|
|
3163
|
-
["max", () => new
|
|
3159
|
+
["count", () => new ur()],
|
|
3160
|
+
["sum", () => new hr()],
|
|
3161
|
+
["min", () => new fr()],
|
|
3162
|
+
["max", () => new pr()]
|
|
3164
3163
|
]);
|
|
3165
3164
|
/**
|
|
3166
3165
|
* Clear all custom strategy overrides
|
|
@@ -3206,9 +3205,9 @@ class pr {
|
|
|
3206
3205
|
return this.#e.has(o) ? this.#e.get(o) : (this.#t.get(s) || this.#t.get("count"))();
|
|
3207
3206
|
}
|
|
3208
3207
|
}
|
|
3209
|
-
class
|
|
3208
|
+
class yr {
|
|
3210
3209
|
constructor(e, t, s, r = null, o = null, i) {
|
|
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 =
|
|
3210
|
+
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 = mr.getStrategy(e, t), this.operations = [], this.confirmedOps = /* @__PURE__ */ new Set(), this.metricCache = new Et(
|
|
3212
3211
|
"metric-store-cache",
|
|
3213
3212
|
{},
|
|
3214
3213
|
this.onHydrated.bind(this)
|
|
@@ -3282,7 +3281,7 @@ class mr {
|
|
|
3282
3281
|
}
|
|
3283
3282
|
setGroundTruth(e) {
|
|
3284
3283
|
const t = !qe(this.groundTruthValue, e);
|
|
3285
|
-
this.groundTruthValue = e, this.setCache(), t &&
|
|
3284
|
+
this.groundTruthValue = e, this.setCache(), t && Nt.emit("metric::render", {
|
|
3286
3285
|
metricType: this.metricType,
|
|
3287
3286
|
ModelClass: this.modelClass,
|
|
3288
3287
|
field: this.field,
|
|
@@ -3303,7 +3302,7 @@ class mr {
|
|
|
3303
3302
|
this.field,
|
|
3304
3303
|
this.modelClass
|
|
3305
3304
|
);
|
|
3306
|
-
return qe(this._lastCalculatedValue, e) || (this._lastCalculatedValue = e,
|
|
3305
|
+
return qe(this._lastCalculatedValue, e) || (this._lastCalculatedValue = e, Nt.emit("metric::render", {
|
|
3307
3306
|
metricType: this.metricType,
|
|
3308
3307
|
ModelClass: this.modelClass,
|
|
3309
3308
|
field: this.field,
|
|
@@ -3348,13 +3347,13 @@ function te(n, e) {
|
|
|
3348
3347
|
function Z(n) {
|
|
3349
3348
|
return delete n.isOptimistic, delete n.then, delete n.catch, n;
|
|
3350
3349
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
function
|
|
3350
|
+
Cs();
|
|
3351
|
+
Xt.create();
|
|
3352
|
+
function gr(n, e) {
|
|
3354
3353
|
if (!n || !n.__f_expr)
|
|
3355
3354
|
return n;
|
|
3356
3355
|
try {
|
|
3357
|
-
return
|
|
3356
|
+
return Xt.evaluate(n.original_expr, e);
|
|
3358
3357
|
} catch (t) {
|
|
3359
3358
|
return console.warn(`Error evaluating F expression: ${t.message}`), null;
|
|
3360
3359
|
}
|
|
@@ -3368,7 +3367,7 @@ class de {
|
|
|
3368
3367
|
* @returns {Operation} The created operation
|
|
3369
3368
|
*/
|
|
3370
3369
|
static createCreateOperation(e, t = {}, s = null) {
|
|
3371
|
-
const o = e.ModelClass.primaryKeyField, i = s || `${G()}`, l =
|
|
3370
|
+
const o = e.ModelClass.primaryKeyField, i = s || `${G()}`, l = Kt(i);
|
|
3372
3371
|
return new q({
|
|
3373
3372
|
operationId: i,
|
|
3374
3373
|
type: M.CREATE,
|
|
@@ -3387,7 +3386,7 @@ class de {
|
|
|
3387
3386
|
*/
|
|
3388
3387
|
static createBulkCreateOperation(e, t = [], s = null) {
|
|
3389
3388
|
const o = e.ModelClass.primaryKeyField, i = s || `${G()}`, l = t.map((a, c) => {
|
|
3390
|
-
const f =
|
|
3389
|
+
const f = Kt(`${i}_${c}`);
|
|
3391
3390
|
return { ...a, [o]: f };
|
|
3392
3391
|
});
|
|
3393
3392
|
return new q({
|
|
@@ -3413,7 +3412,7 @@ class de {
|
|
|
3413
3412
|
y[i] = p;
|
|
3414
3413
|
for (const [_, w] of Object.entries(t))
|
|
3415
3414
|
if (w && typeof w == "object" && w.__f_expr) {
|
|
3416
|
-
const v =
|
|
3415
|
+
const v = gr(w, m);
|
|
3417
3416
|
v !== null ? y[_] = v : y[_] = m[_];
|
|
3418
3417
|
} else
|
|
3419
3418
|
y[_] = w;
|
|
@@ -3490,9 +3489,9 @@ class de {
|
|
|
3490
3489
|
* @returns {Operation} The created operation
|
|
3491
3490
|
*/
|
|
3492
3491
|
static createGetOrCreateOperation(e, t = {}, s = {}, r = null) {
|
|
3493
|
-
const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y =
|
|
3494
|
-
(k) =>
|
|
3495
|
-
), w =
|
|
3492
|
+
const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y = gt(m, o), _ = c.map(
|
|
3493
|
+
(k) => wt(y, o.fromPk(k[i], e))
|
|
3494
|
+
), w = yt(_, m, o), v = c.filter(
|
|
3496
3495
|
(k) => w.includes(k[i])
|
|
3497
3496
|
), O = v.length === 0, T = O ? M.CREATE : M.UPDATE, b = O ? { ...t, ...s, [i]: l } : v[0];
|
|
3498
3497
|
return new q({
|
|
@@ -3513,9 +3512,9 @@ class de {
|
|
|
3513
3512
|
* @returns {Operation} The created operation
|
|
3514
3513
|
*/
|
|
3515
3514
|
static createUpdateOrCreateOperation(e, t = {}, s = {}, r = null) {
|
|
3516
|
-
const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y =
|
|
3517
|
-
(k) =>
|
|
3518
|
-
), w =
|
|
3515
|
+
const o = e.ModelClass, i = o.primaryKeyField, l = r || `${G()}`, c = Q.getStore(o).render(), f = { ...t }, m = new e.constructor(o).filter(f).build(), y = gt(m, o), _ = c.map(
|
|
3516
|
+
(k) => wt(y, o.fromPk(k[i], e))
|
|
3517
|
+
), w = yt(_, m, o), v = c.filter(
|
|
3519
3518
|
(k) => w.includes(k[i])
|
|
3520
3519
|
), O = v.length === 0, T = O ? M.CREATE : M.UPDATE, b = O ? { ...t, ...s, [i]: l } : { ...v[0], ...s };
|
|
3521
3520
|
return new q({
|
|
@@ -3528,7 +3527,7 @@ class de {
|
|
|
3528
3527
|
});
|
|
3529
3528
|
}
|
|
3530
3529
|
}
|
|
3531
|
-
class
|
|
3530
|
+
class Wt extends Array {
|
|
3532
3531
|
/**
|
|
3533
3532
|
* Creates a new ResultTuple.
|
|
3534
3533
|
*
|
|
@@ -3539,7 +3538,7 @@ class Jt extends Array {
|
|
|
3539
3538
|
super(2), this[0] = e, this[1] = t, this.instance = e, this.created = t;
|
|
3540
3539
|
}
|
|
3541
3540
|
}
|
|
3542
|
-
class
|
|
3541
|
+
class _r {
|
|
3543
3542
|
/**
|
|
3544
3543
|
* Executes a get operation (get, first, last) with the QuerySet.
|
|
3545
3544
|
*
|
|
@@ -3598,7 +3597,7 @@ class gr {
|
|
|
3598
3597
|
lookup: s.lookup || {},
|
|
3599
3598
|
defaults: s.defaults || {}
|
|
3600
3599
|
}, 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);
|
|
3601
|
-
let f = new
|
|
3600
|
+
let f = new Wt(c, a);
|
|
3602
3601
|
if (l.localOnly)
|
|
3603
3602
|
return l.updateStatus(C.CONFIRMED, l.instances), f;
|
|
3604
3603
|
const p = L(
|
|
@@ -3615,7 +3614,7 @@ class gr {
|
|
|
3615
3614
|
return b && l.mutate({
|
|
3616
3615
|
instances: [b],
|
|
3617
3616
|
status: C.CONFIRMED
|
|
3618
|
-
}), f = new
|
|
3617
|
+
}), f = new Wt(c, v), Z(f), f;
|
|
3619
3618
|
}).catch((m) => {
|
|
3620
3619
|
throw l.updateStatus(C.REJECTED), m;
|
|
3621
3620
|
});
|
|
@@ -3635,7 +3634,7 @@ class gr {
|
|
|
3635
3634
|
throw new Error(
|
|
3636
3635
|
`Field parameter is required for ${t} operation`
|
|
3637
3636
|
);
|
|
3638
|
-
const i =
|
|
3637
|
+
const i = Fe.getEntity(t, e, o), l = {};
|
|
3639
3638
|
t !== "exists" && (l.field = o);
|
|
3640
3639
|
const a = L(
|
|
3641
3640
|
e,
|
|
@@ -3643,7 +3642,7 @@ class gr {
|
|
|
3643
3642
|
l
|
|
3644
3643
|
).then((c) => {
|
|
3645
3644
|
const f = c.data, p = j.getEntity(e);
|
|
3646
|
-
return
|
|
3645
|
+
return Fe.setEntity(t, e, o, f, p), Z(i), f;
|
|
3647
3646
|
});
|
|
3648
3647
|
return te(i, a);
|
|
3649
3648
|
}
|
|
@@ -3745,7 +3744,7 @@ class gr {
|
|
|
3745
3744
|
o,
|
|
3746
3745
|
async (p) => {
|
|
3747
3746
|
const { data: m } = p.data, y = Array.isArray(m) ? m[0] : m;
|
|
3748
|
-
|
|
3747
|
+
Rt(o, y);
|
|
3749
3748
|
}
|
|
3750
3749
|
).then((p) => {
|
|
3751
3750
|
const { data: m, included: y, model_name: _ } = p.data;
|
|
@@ -3795,7 +3794,7 @@ class gr {
|
|
|
3795
3794
|
const { data: m } = p.data;
|
|
3796
3795
|
(Array.isArray(m) ? m : []).forEach((_, w) => {
|
|
3797
3796
|
const v = `${o}_${w}`;
|
|
3798
|
-
|
|
3797
|
+
Rt(v, _);
|
|
3799
3798
|
});
|
|
3800
3799
|
}
|
|
3801
3800
|
).then((p) => {
|
|
@@ -3937,7 +3936,7 @@ class gr {
|
|
|
3937
3936
|
return L(e, t, s);
|
|
3938
3937
|
}
|
|
3939
3938
|
}
|
|
3940
|
-
class
|
|
3939
|
+
class wr {
|
|
3941
3940
|
constructor(e, t, s = null) {
|
|
3942
3941
|
this.queryset = e, this.metricType = t, this.field = s;
|
|
3943
3942
|
}
|
|
@@ -3949,25 +3948,34 @@ class _r {
|
|
|
3949
3948
|
* Delegates to the underlying store's sync method
|
|
3950
3949
|
*/
|
|
3951
3950
|
refreshFromDb() {
|
|
3952
|
-
return
|
|
3951
|
+
return Fe.getStore(
|
|
3953
3952
|
this.metricType,
|
|
3954
3953
|
this.queryset,
|
|
3955
3954
|
this.field
|
|
3956
3955
|
).sync(!0);
|
|
3957
3956
|
}
|
|
3958
3957
|
/**
|
|
3959
|
-
*
|
|
3958
|
+
* Returns the current metric value from the store.
|
|
3959
|
+
* Called implicitly by JS when coercing to a primitive (arithmetic, template literals, etc.)
|
|
3960
3960
|
*/
|
|
3961
|
-
|
|
3962
|
-
const e =
|
|
3961
|
+
valueOf() {
|
|
3962
|
+
const e = Fe.getStore(
|
|
3963
3963
|
this.metricType,
|
|
3964
3964
|
this.queryset,
|
|
3965
3965
|
this.field
|
|
3966
3966
|
);
|
|
3967
3967
|
return e ? e.render() : null;
|
|
3968
3968
|
}
|
|
3969
|
+
toString() {
|
|
3970
|
+
const e = this.valueOf();
|
|
3971
|
+
return e === null ? "" : String(e);
|
|
3972
|
+
}
|
|
3973
|
+
/** @deprecated Use valueOf() coercion instead (e.g. +metric, `${metric}`, metric + 0) */
|
|
3974
|
+
get value() {
|
|
3975
|
+
return this.valueOf();
|
|
3976
|
+
}
|
|
3969
3977
|
}
|
|
3970
|
-
class
|
|
3978
|
+
class vt {
|
|
3971
3979
|
constructor() {
|
|
3972
3980
|
this._stores = /* @__PURE__ */ new Map(), this.syncManager = null;
|
|
3973
3981
|
}
|
|
@@ -4008,8 +4016,8 @@ class Ct {
|
|
|
4008
4016
|
if (!this._stores.has(i)) {
|
|
4009
4017
|
const l = async ({ metricType: c, modelClass: f, field: p, ast: m }) => {
|
|
4010
4018
|
const y = t.clone();
|
|
4011
|
-
return await
|
|
4012
|
-
}, a = new
|
|
4019
|
+
return await _r.executeAgg(y, c, { field: p });
|
|
4020
|
+
}, a = new yr(
|
|
4013
4021
|
e,
|
|
4014
4022
|
r,
|
|
4015
4023
|
t,
|
|
@@ -4032,7 +4040,7 @@ class Ct {
|
|
|
4032
4040
|
if (E(e) || E(t) || E(t.ModelClass))
|
|
4033
4041
|
return null;
|
|
4034
4042
|
this.getStore(e, t, s);
|
|
4035
|
-
const r = new
|
|
4043
|
+
const r = new wr(t, e, s);
|
|
4036
4044
|
return r;
|
|
4037
4045
|
}
|
|
4038
4046
|
/**
|
|
@@ -4059,8 +4067,8 @@ class Ct {
|
|
|
4059
4067
|
return this._stores.has(e) ? this._stores.get(e).queryset : null;
|
|
4060
4068
|
}
|
|
4061
4069
|
}
|
|
4062
|
-
const
|
|
4063
|
-
class
|
|
4070
|
+
const Fe = new vt();
|
|
4071
|
+
class Cr {
|
|
4064
4072
|
constructor(e) {
|
|
4065
4073
|
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 ? {
|
|
4066
4074
|
...t,
|
|
@@ -4068,7 +4076,7 @@ class wr {
|
|
|
4068
4076
|
} : t) || e.instances, this._cachedInstances = null;
|
|
4069
4077
|
}
|
|
4070
4078
|
get modelClass() {
|
|
4071
|
-
return
|
|
4079
|
+
return ts(this.model, this.configKey);
|
|
4072
4080
|
}
|
|
4073
4081
|
async getFullInstances() {
|
|
4074
4082
|
if (this.event === "delete")
|
|
@@ -4082,7 +4090,7 @@ class wr {
|
|
|
4082
4090
|
}).fetch()), this._cachedInstances;
|
|
4083
4091
|
}
|
|
4084
4092
|
}
|
|
4085
|
-
class
|
|
4093
|
+
class vr {
|
|
4086
4094
|
constructor() {
|
|
4087
4095
|
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;
|
|
4088
4096
|
}
|
|
@@ -4105,7 +4113,7 @@ class Cr {
|
|
|
4105
4113
|
* Initialize event handlers for all event receivers
|
|
4106
4114
|
*/
|
|
4107
4115
|
initialize() {
|
|
4108
|
-
|
|
4116
|
+
Us(), zs().forEach((t, s) => {
|
|
4109
4117
|
t && t.addModelEventHandler(this.handleEvent.bind(this));
|
|
4110
4118
|
}), this.startPeriodicSync();
|
|
4111
4119
|
}
|
|
@@ -4157,7 +4165,7 @@ class Cr {
|
|
|
4157
4165
|
const r = [...this.followedModels.values()].some(
|
|
4158
4166
|
(o) => o.has(t)
|
|
4159
4167
|
);
|
|
4160
|
-
s.add(t), r ||
|
|
4168
|
+
s.add(t), r || Qt(t.configKey)?.subscribe(
|
|
4161
4169
|
t.modelName,
|
|
4162
4170
|
this.handleEvent
|
|
4163
4171
|
);
|
|
@@ -4167,7 +4175,7 @@ class Cr {
|
|
|
4167
4175
|
if (!s) return;
|
|
4168
4176
|
s.delete(t), [...this.followedModels.values()].some(
|
|
4169
4177
|
(o) => o.has(t)
|
|
4170
|
-
) ||
|
|
4178
|
+
) || Qt(t.configKey)?.unsubscribe(
|
|
4171
4179
|
t.modelName,
|
|
4172
4180
|
this.handleEvent
|
|
4173
4181
|
);
|
|
@@ -4215,8 +4223,8 @@ class Cr {
|
|
|
4215
4223
|
operationId: e.operation_id,
|
|
4216
4224
|
socketId: e.socket_id
|
|
4217
4225
|
});
|
|
4218
|
-
let t = new
|
|
4219
|
-
if (this.registries.has(
|
|
4226
|
+
let t = new Cr(e), s = Pe.has(t.operation_id);
|
|
4227
|
+
if (this.registries.has(vt) && this.processMetrics(t), s) {
|
|
4220
4228
|
this.syncQuerysetsNeedingVerification(t.operation_id);
|
|
4221
4229
|
return;
|
|
4222
4230
|
}
|
|
@@ -4283,7 +4291,7 @@ class Cr {
|
|
|
4283
4291
|
);
|
|
4284
4292
|
}
|
|
4285
4293
|
processMetrics(e) {
|
|
4286
|
-
const t = this.registries.get(
|
|
4294
|
+
const t = this.registries.get(vt);
|
|
4287
4295
|
for (const [s, r] of t._stores.entries())
|
|
4288
4296
|
if (r.queryset && r.queryset.modelClass.modelName === e.model && r.queryset.modelClass.configKey === e.configKey) {
|
|
4289
4297
|
if (this.followAllQuerysets) {
|
|
@@ -4312,97 +4320,97 @@ class Cr {
|
|
|
4312
4320
|
}), a.length > 0 && s.sync(a);
|
|
4313
4321
|
}
|
|
4314
4322
|
}
|
|
4315
|
-
const $e = new
|
|
4323
|
+
const $e = new vr();
|
|
4316
4324
|
$e.manageRegistry(j);
|
|
4317
4325
|
$e.manageRegistry(Q);
|
|
4318
|
-
$e.manageRegistry(
|
|
4319
|
-
const
|
|
4320
|
-
function
|
|
4321
|
-
typeof n == "function" &&
|
|
4326
|
+
$e.manageRegistry(Fe);
|
|
4327
|
+
const Er = /* @__PURE__ */ new Set();
|
|
4328
|
+
function br(n) {
|
|
4329
|
+
typeof n == "function" && Er.add(n);
|
|
4322
4330
|
}
|
|
4323
4331
|
$e.followAllQuerysets = !1;
|
|
4324
|
-
const
|
|
4325
|
-
|
|
4326
|
-
|
|
4332
|
+
const ns = /* @__PURE__ */ new Map();
|
|
4333
|
+
br(() => {
|
|
4334
|
+
ns.clear(), $e.followAllQuerysets = !0, $e.followedQuerysets.clear();
|
|
4327
4335
|
});
|
|
4328
|
-
const
|
|
4336
|
+
const kr = (n, e) => {
|
|
4329
4337
|
const t = n.__vccOpts || n;
|
|
4330
4338
|
for (const [s, r] of e)
|
|
4331
4339
|
t[s] = r;
|
|
4332
4340
|
return t;
|
|
4333
|
-
},
|
|
4341
|
+
}, Sr = { class: "szd" }, Tr = { class: "szd-header" }, Mr = { class: "szd-header__top" }, $r = { class: "szd-header__left" }, Ar = {
|
|
4334
4342
|
key: 0,
|
|
4335
4343
|
class: "szd-header__model"
|
|
4336
|
-
},
|
|
4344
|
+
}, Or = {
|
|
4337
4345
|
key: 1,
|
|
4338
4346
|
class: "szd-header__model szd-header__model--empty"
|
|
4339
|
-
},
|
|
4347
|
+
}, Pr = { class: "szd-header__right" }, Fr = {
|
|
4340
4348
|
key: 0,
|
|
4341
4349
|
class: "szd-header__badge szd-header__badge--syncing"
|
|
4342
4350
|
}, Ir = {
|
|
4343
4351
|
key: 1,
|
|
4344
4352
|
class: "szd-header__badge"
|
|
4345
|
-
},
|
|
4353
|
+
}, Dr = { class: "szd-header__badge" }, zr = { class: "szd-tabs" }, Kr = ["onClick"], Rr = { class: "szd-content" }, Nr = {
|
|
4346
4354
|
key: 0,
|
|
4347
4355
|
class: "szd-panel"
|
|
4348
|
-
},
|
|
4356
|
+
}, xr = { class: "szd-panel__section" }, jr = { class: "szd-kv" }, Ur = { class: "szd-kv__row" }, Qr = { class: "szd-kv__value" }, Vr = { class: "szd-kv__row" }, Lr = { class: "szd-kv__value" }, Gr = { class: "szd-kv__row" }, Br = { class: "szd-kv__value" }, Hr = { class: "szd-kv__row" }, qr = { class: "szd-kv__value" }, Jr = { class: "szd-panel__section" }, Wr = { class: "szd-stats" }, Zr = { class: "szd-stat" }, Yr = { class: "szd-stat__value" }, Xr = { class: "szd-stat" }, en = { class: "szd-stat__value" }, tn = { class: "szd-stat" }, sn = { class: "szd-stat__value" }, rn = { class: "szd-stat" }, nn = { class: "szd-stat__value" }, on = {
|
|
4349
4357
|
class: "szd-kv",
|
|
4350
4358
|
style: { "margin-top": "12px" }
|
|
4351
|
-
},
|
|
4359
|
+
}, an = { class: "szd-kv__row" }, ln = { class: "szd-kv__value" }, cn = {
|
|
4352
4360
|
key: 0,
|
|
4353
4361
|
class: "szd-panel__section"
|
|
4354
|
-
},
|
|
4362
|
+
}, dn = { class: "szd-event-preview__text" }, un = { class: "szd-event-preview__time" }, hn = {
|
|
4355
4363
|
key: 1,
|
|
4356
4364
|
class: "szd-panel"
|
|
4357
|
-
},
|
|
4365
|
+
}, fn = { class: "szd-timeline-filters" }, pn = ["onUpdate:modelValue"], mn = { class: "szd-timeline" }, yn = ["onClick"], gn = { class: "szd-timeline__time" }, _n = { class: "szd-timeline__text" }, wn = {
|
|
4358
4366
|
key: 0,
|
|
4359
4367
|
class: "szd-empty"
|
|
4360
|
-
},
|
|
4368
|
+
}, Cn = {
|
|
4361
4369
|
key: 2,
|
|
4362
4370
|
class: "szd-panel"
|
|
4363
|
-
},
|
|
4371
|
+
}, vn = { class: "szd-pipeline" }, En = ["onClick"], bn = { class: "szd-pipeline__label" }, kn = { class: "szd-pipeline__count" }, Sn = {
|
|
4364
4372
|
key: 0,
|
|
4365
4373
|
class: "szd-pipeline__arrow"
|
|
4366
|
-
},
|
|
4374
|
+
}, Tn = {
|
|
4367
4375
|
class: "szd-panel__section",
|
|
4368
4376
|
style: { "margin-top": "20px" }
|
|
4369
|
-
},
|
|
4377
|
+
}, Mn = { class: "szd-preview-header" }, $n = ["value"], An = {
|
|
4370
4378
|
key: 0,
|
|
4371
4379
|
class: "szd-data-grid"
|
|
4372
|
-
},
|
|
4380
|
+
}, On = { class: "szd-data-card__header" }, Pn = {
|
|
4373
4381
|
key: 0,
|
|
4374
4382
|
class: "szd-data-card__badge"
|
|
4375
|
-
},
|
|
4383
|
+
}, Fn = {
|
|
4376
4384
|
key: 1,
|
|
4377
4385
|
class: "szd-data-card__badge szd-data-card__badge--absent"
|
|
4378
|
-
}, In = { class: "szd-data-card__content" },
|
|
4386
|
+
}, In = { class: "szd-data-card__content" }, Dn = {
|
|
4379
4387
|
key: 1,
|
|
4380
4388
|
class: "szd-empty"
|
|
4381
|
-
},
|
|
4389
|
+
}, zn = {
|
|
4382
4390
|
key: 3,
|
|
4383
4391
|
class: "szd-panel"
|
|
4384
|
-
},
|
|
4392
|
+
}, Kn = {
|
|
4385
4393
|
class: "szd-kv",
|
|
4386
4394
|
style: { "margin-bottom": "16px" }
|
|
4387
|
-
},
|
|
4395
|
+
}, Rn = { class: "szd-kv__row" }, Nn = { class: "szd-kv__value szd-kv__value--mono" }, xn = { class: "szd-ast" }, jn = {
|
|
4388
4396
|
key: 0,
|
|
4389
4397
|
class: "szd-detail"
|
|
4390
|
-
},
|
|
4398
|
+
}, Un = { class: "szd-detail__panel szd-detail__panel--sm" }, Qn = { class: "szd-detail__header" }, Vn = { class: "szd-detail__body" }, Ln = { class: "szd-settings-section" }, Gn = ["value"], Bn = {
|
|
4391
4399
|
key: 0,
|
|
4392
4400
|
class: "szd-settings-section"
|
|
4393
|
-
},
|
|
4401
|
+
}, Hn = { class: "szd-settings-row" }, qn = { class: "szd-settings-code" }, Jn = { class: "szd-settings-section" }, Wn = { class: "szd-settings-actions" }, Zn = ["disabled"], Yn = { class: "szd-settings-section" }, Xn = { class: "szd-toggle" }, eo = {
|
|
4394
4402
|
key: 1,
|
|
4395
4403
|
class: "szd-settings-section"
|
|
4396
|
-
},
|
|
4404
|
+
}, to = { class: "szd-kv" }, so = { class: "szd-kv__row" }, ro = { class: "szd-kv__value" }, no = { class: "szd-kv__row" }, oo = { class: "szd-kv__value" }, io = { class: "szd-kv__row" }, ao = { class: "szd-kv__value" }, lo = { class: "szd-kv__row" }, co = { class: "szd-kv__value" }, uo = { class: "szd-kv__row" }, ho = { class: "szd-kv__value" }, fo = {
|
|
4397
4405
|
key: 0,
|
|
4398
4406
|
class: "szd-detail"
|
|
4399
|
-
},
|
|
4407
|
+
}, po = { class: "szd-detail__panel" }, mo = { class: "szd-detail__header" }, yo = { class: "szd-detail__title" }, go = { class: "szd-detail__body" }, _o = { class: "szd-kv" }, wo = { class: "szd-kv__key" }, Co = { class: "szd-kv__value" }, vo = { class: "szd-ast" }, Eo = {
|
|
4400
4408
|
class: "szd-kv",
|
|
4401
4409
|
style: { "margin-bottom": "16px" }
|
|
4402
|
-
},
|
|
4410
|
+
}, bo = { class: "szd-kv__row" }, ko = { class: "szd-kv__value" }, So = { class: "szd-kv__row" }, To = { class: "szd-kv__value" }, Mo = {
|
|
4403
4411
|
key: 0,
|
|
4404
4412
|
class: "szd-kv__note"
|
|
4405
|
-
},
|
|
4413
|
+
}, $o = { class: "szd-ast" }, Zt = 100, Ao = {
|
|
4406
4414
|
__name: "StateZeroDebugPanel",
|
|
4407
4415
|
props: {
|
|
4408
4416
|
queryset: { type: [Object, String], default: null },
|
|
@@ -4416,7 +4424,7 @@ const br = (n, e) => {
|
|
|
4416
4424
|
{ id: "timeline", label: "Timeline" },
|
|
4417
4425
|
{ id: "data", label: "Data" },
|
|
4418
4426
|
{ id: "ast", label: "AST" }
|
|
4419
|
-
], r = J(""), o = J(e.useQueryset), i = J(!0), l = J(
|
|
4427
|
+
], r = J(""), o = J(e.useQueryset), i = J(!0), l = J(Lt()), a = J(0), c = J(!1), f = J(null), p = J(!1), m = J(null), y = J({
|
|
4420
4428
|
request: !0,
|
|
4421
4429
|
response: !0,
|
|
4422
4430
|
render: !0,
|
|
@@ -4437,7 +4445,7 @@ const br = (n, e) => {
|
|
|
4437
4445
|
), v = R(() => {
|
|
4438
4446
|
a.value;
|
|
4439
4447
|
const u = [];
|
|
4440
|
-
return
|
|
4448
|
+
return ns.forEach((d) => {
|
|
4441
4449
|
d?.semanticKey && u.push({
|
|
4442
4450
|
semanticKey: d.semanticKey,
|
|
4443
4451
|
modelName: d.ModelClass?.modelName,
|
|
@@ -4472,9 +4480,9 @@ const br = (n, e) => {
|
|
|
4472
4480
|
return null;
|
|
4473
4481
|
}
|
|
4474
4482
|
return k.value && j._stores.get(k.value) || null;
|
|
4475
|
-
}),
|
|
4483
|
+
}), F = R(() => {
|
|
4476
4484
|
a.value;
|
|
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,
|
|
4485
|
+
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, ds = u?.groundTruthPks?.length ?? 0, us = u ? u.lastSync === null ? "model store" : "ground truth" : "—", hs = 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.";
|
|
4478
4486
|
return {
|
|
4479
4487
|
modelName: g,
|
|
4480
4488
|
configKey: z,
|
|
@@ -4484,9 +4492,9 @@ const br = (n, e) => {
|
|
|
4484
4492
|
isSyncing: be,
|
|
4485
4493
|
lastSync: Ue,
|
|
4486
4494
|
optimisticCount: ot,
|
|
4487
|
-
confirmedCount:
|
|
4488
|
-
source:
|
|
4489
|
-
reason:
|
|
4495
|
+
confirmedCount: ds,
|
|
4496
|
+
source: us,
|
|
4497
|
+
reason: hs
|
|
4490
4498
|
};
|
|
4491
4499
|
}), re = R(() => {
|
|
4492
4500
|
a.value;
|
|
@@ -4513,7 +4521,7 @@ const br = (n, e) => {
|
|
|
4513
4521
|
limit: u?.serializerOptions?.limit ?? "—"
|
|
4514
4522
|
};
|
|
4515
4523
|
});
|
|
4516
|
-
function
|
|
4524
|
+
function I(u, d, g, z) {
|
|
4517
4525
|
if (!u || !Array.isArray(g)) return [];
|
|
4518
4526
|
const H = [];
|
|
4519
4527
|
for (const oe of g.slice(0, z))
|
|
@@ -4541,7 +4549,7 @@ const br = (n, e) => {
|
|
|
4541
4549
|
finalSample: [],
|
|
4542
4550
|
limit: null
|
|
4543
4551
|
};
|
|
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 ?
|
|
4552
|
+
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 ? I(
|
|
4545
4553
|
u.modelClass,
|
|
4546
4554
|
d,
|
|
4547
4555
|
le,
|
|
@@ -4554,25 +4562,25 @@ const br = (n, e) => {
|
|
|
4554
4562
|
filtered: oe,
|
|
4555
4563
|
final: Ue,
|
|
4556
4564
|
modelStoreSample: ot,
|
|
4557
|
-
groundTruthSample:
|
|
4565
|
+
groundTruthSample: I(
|
|
4558
4566
|
u.modelClass,
|
|
4559
4567
|
d,
|
|
4560
4568
|
g,
|
|
4561
4569
|
e.sampleSize
|
|
4562
4570
|
),
|
|
4563
|
-
optimisticSample:
|
|
4571
|
+
optimisticSample: I(
|
|
4564
4572
|
u.modelClass,
|
|
4565
4573
|
d,
|
|
4566
4574
|
z,
|
|
4567
4575
|
e.sampleSize
|
|
4568
4576
|
),
|
|
4569
|
-
filteredSample:
|
|
4577
|
+
filteredSample: I(
|
|
4570
4578
|
u.modelClass,
|
|
4571
4579
|
d,
|
|
4572
4580
|
oe,
|
|
4573
4581
|
e.sampleSize
|
|
4574
4582
|
),
|
|
4575
|
-
finalSample:
|
|
4583
|
+
finalSample: I(
|
|
4576
4584
|
u.modelClass,
|
|
4577
4585
|
d,
|
|
4578
4586
|
Ue,
|
|
@@ -4602,8 +4610,8 @@ const br = (n, e) => {
|
|
|
4602
4610
|
const Ke = R(() => {
|
|
4603
4611
|
if (!f.value || f.value.type !== "snapshot") return [];
|
|
4604
4612
|
const u = f.value.data, d = N.value, g = U.value;
|
|
4605
|
-
return !d || !g || !u.pks ? [] :
|
|
4606
|
-
}), Xe = R(() => !f.value || f.value.type !== "snapshot" ? !1 : f.value.data.count >
|
|
4613
|
+
return !d || !g || !u.pks ? [] : I(d.modelClass, g, u.pks, Zt);
|
|
4614
|
+
}), Xe = R(() => !f.value || f.value.type !== "snapshot" ? !1 : f.value.data.count > Zt), Re = R(() => {
|
|
4607
4615
|
if (!k.value) return l.value;
|
|
4608
4616
|
const u = N.value;
|
|
4609
4617
|
return l.value.filter((d) => d.semanticKey === k.value ? !0 : u ? d.modelName === u.modelClass?.modelName && d.configKey === u.modelClass?.configKey : !1);
|
|
@@ -4631,7 +4639,7 @@ const br = (n, e) => {
|
|
|
4631
4639
|
return "";
|
|
4632
4640
|
}
|
|
4633
4641
|
}
|
|
4634
|
-
function
|
|
4642
|
+
function bt(u) {
|
|
4635
4643
|
if (!u) return "";
|
|
4636
4644
|
switch (u.type) {
|
|
4637
4645
|
case "request":
|
|
@@ -4656,7 +4664,7 @@ const br = (n, e) => {
|
|
|
4656
4664
|
return u.type;
|
|
4657
4665
|
}
|
|
4658
4666
|
}
|
|
4659
|
-
function
|
|
4667
|
+
function os(u) {
|
|
4660
4668
|
if (!u) return null;
|
|
4661
4669
|
const d = {
|
|
4662
4670
|
type: u.type,
|
|
@@ -4688,13 +4696,13 @@ const br = (n, e) => {
|
|
|
4688
4696
|
return d;
|
|
4689
4697
|
}
|
|
4690
4698
|
}
|
|
4691
|
-
function os() {
|
|
4692
|
-
Gs(), l.value = [];
|
|
4693
|
-
}
|
|
4694
4699
|
function is() {
|
|
4700
|
+
Bs(), l.value = [];
|
|
4701
|
+
}
|
|
4702
|
+
function as() {
|
|
4695
4703
|
!k.value || !navigator?.clipboard || navigator.clipboard.writeText(k.value);
|
|
4696
4704
|
}
|
|
4697
|
-
async function
|
|
4705
|
+
async function ls() {
|
|
4698
4706
|
if (!(!N.value || c.value)) {
|
|
4699
4707
|
c.value = !0;
|
|
4700
4708
|
try {
|
|
@@ -4705,36 +4713,36 @@ const br = (n, e) => {
|
|
|
4705
4713
|
}
|
|
4706
4714
|
}
|
|
4707
4715
|
}
|
|
4708
|
-
function
|
|
4716
|
+
function kt(u) {
|
|
4709
4717
|
f.value = { type: "entry", data: u };
|
|
4710
4718
|
}
|
|
4711
|
-
function
|
|
4719
|
+
function cs(u) {
|
|
4712
4720
|
f.value = { type: "snapshot", data: u };
|
|
4713
4721
|
}
|
|
4714
|
-
function
|
|
4722
|
+
function St() {
|
|
4715
4723
|
f.value = null;
|
|
4716
4724
|
}
|
|
4717
|
-
function
|
|
4725
|
+
function Tt(u) {
|
|
4718
4726
|
Object.keys(y.value).forEach((d) => {
|
|
4719
4727
|
y.value[d] = u;
|
|
4720
4728
|
});
|
|
4721
4729
|
}
|
|
4722
4730
|
let tt = null, st = null, rt = null, nt = null;
|
|
4723
|
-
return
|
|
4724
|
-
|
|
4731
|
+
return fs(() => {
|
|
4732
|
+
Hs(), Gt(e.maxEntries), tt = Ls((u) => {
|
|
4725
4733
|
i.value && (l.value = [...l.value, u], l.value.length > e.maxEntries && (l.value = l.value.slice(-e.maxEntries)));
|
|
4726
|
-
}), st =
|
|
4734
|
+
}), st = Gs(() => {
|
|
4727
4735
|
l.value = [];
|
|
4728
4736
|
}), rt = setInterval(() => {
|
|
4729
4737
|
a.value += 1;
|
|
4730
4738
|
}, 2e3), nt = setInterval(() => {
|
|
4731
|
-
l.value =
|
|
4739
|
+
l.value = Lt();
|
|
4732
4740
|
}, 1e3);
|
|
4733
|
-
}),
|
|
4741
|
+
}), ps(() => {
|
|
4734
4742
|
tt && tt(), st && st(), rt && clearInterval(rt), nt && clearInterval(nt);
|
|
4735
4743
|
}), it(
|
|
4736
4744
|
() => e.maxEntries,
|
|
4737
|
-
(u) =>
|
|
4745
|
+
(u) => Gt(u)
|
|
4738
4746
|
), it(
|
|
4739
4747
|
() => e.useQueryset,
|
|
4740
4748
|
(u) => {
|
|
@@ -4742,17 +4750,17 @@ const br = (n, e) => {
|
|
|
4742
4750
|
}
|
|
4743
4751
|
), it(k, () => {
|
|
4744
4752
|
m.value = null;
|
|
4745
|
-
}), (u, d) => (A(), $("section",
|
|
4746
|
-
h("header",
|
|
4747
|
-
h("div",
|
|
4748
|
-
h("div",
|
|
4753
|
+
}), (u, d) => (A(), $("section", Sr, [
|
|
4754
|
+
h("header", Tr, [
|
|
4755
|
+
h("div", Mr, [
|
|
4756
|
+
h("div", $r, [
|
|
4749
4757
|
d[9] || (d[9] = h("div", { class: "szd-header__title" }, "StateZero", -1)),
|
|
4750
|
-
k.value ? (A(), $("span",
|
|
4758
|
+
k.value ? (A(), $("span", Ar, S(F.value.modelName || "?"), 1)) : (A(), $("span", Or, "No queryset"))
|
|
4751
4759
|
]),
|
|
4752
|
-
h("div",
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
h("span",
|
|
4760
|
+
h("div", Pr, [
|
|
4761
|
+
F.value.isSyncing ? (A(), $("span", Fr, "Syncing")) : V("", !0),
|
|
4762
|
+
F.value.opsCount > 0 ? (A(), $("span", Ir, S(F.value.opsCount) + " ops", 1)) : V("", !0),
|
|
4763
|
+
h("span", Dr, S(Ne.value) + " events", 1),
|
|
4756
4764
|
h("button", {
|
|
4757
4765
|
class: "szd-btn szd-btn--icon",
|
|
4758
4766
|
onClick: d[0] || (d[0] = (g) => p.value = !0),
|
|
@@ -4776,138 +4784,138 @@ const br = (n, e) => {
|
|
|
4776
4784
|
])])
|
|
4777
4785
|
])
|
|
4778
4786
|
]),
|
|
4779
|
-
h("nav",
|
|
4787
|
+
h("nav", zr, [
|
|
4780
4788
|
(A(), $(W, null, ce(s, (g) => h("button", {
|
|
4781
4789
|
key: g.id,
|
|
4782
|
-
class:
|
|
4790
|
+
class: $t(["szd-tabs__tab", { "szd-tabs__tab--active": t.value === g.id }]),
|
|
4783
4791
|
onClick: (z) => t.value = g.id
|
|
4784
|
-
}, S(g.label), 11,
|
|
4792
|
+
}, S(g.label), 11, Kr)), 64))
|
|
4785
4793
|
])
|
|
4786
4794
|
]),
|
|
4787
|
-
h("main",
|
|
4788
|
-
t.value === "overview" ? (A(), $("div",
|
|
4789
|
-
h("div",
|
|
4795
|
+
h("main", Rr, [
|
|
4796
|
+
t.value === "overview" ? (A(), $("div", Nr, [
|
|
4797
|
+
h("div", xr, [
|
|
4790
4798
|
d[15] || (d[15] = h("h3", { class: "szd-panel__heading" }, "Why This View?", -1)),
|
|
4791
|
-
h("div",
|
|
4792
|
-
h("div",
|
|
4799
|
+
h("div", jr, [
|
|
4800
|
+
h("div", Ur, [
|
|
4793
4801
|
d[11] || (d[11] = h("span", { class: "szd-kv__key" }, "Filter:", -1)),
|
|
4794
|
-
h("span",
|
|
4802
|
+
h("span", Qr, S(D.value.filter), 1)
|
|
4795
4803
|
]),
|
|
4796
|
-
h("div",
|
|
4804
|
+
h("div", Vr, [
|
|
4797
4805
|
d[12] || (d[12] = h("span", { class: "szd-kv__key" }, "Order:", -1)),
|
|
4798
|
-
h("span",
|
|
4806
|
+
h("span", Lr, S(D.value.orderBy), 1)
|
|
4799
4807
|
]),
|
|
4800
|
-
h("div",
|
|
4808
|
+
h("div", Gr, [
|
|
4801
4809
|
d[13] || (d[13] = h("span", { class: "szd-kv__key" }, "Limit:", -1)),
|
|
4802
|
-
h("span",
|
|
4810
|
+
h("span", Br, S(D.value.limit), 1)
|
|
4803
4811
|
]),
|
|
4804
|
-
h("div",
|
|
4812
|
+
h("div", Hr, [
|
|
4805
4813
|
d[14] || (d[14] = h("span", { class: "szd-kv__key" }, "Reason:", -1)),
|
|
4806
|
-
h("span",
|
|
4814
|
+
h("span", qr, S(F.value.reason), 1)
|
|
4807
4815
|
])
|
|
4808
4816
|
])
|
|
4809
4817
|
]),
|
|
4810
|
-
h("div",
|
|
4818
|
+
h("div", Jr, [
|
|
4811
4819
|
d[21] || (d[21] = h("h3", { class: "szd-panel__heading" }, "Current State", -1)),
|
|
4812
|
-
h("div",
|
|
4813
|
-
h("div",
|
|
4814
|
-
h("div",
|
|
4820
|
+
h("div", Wr, [
|
|
4821
|
+
h("div", Zr, [
|
|
4822
|
+
h("div", Yr, S(F.value.optimisticCount ?? "—"), 1),
|
|
4815
4823
|
d[16] || (d[16] = h("div", { class: "szd-stat__label" }, "Optimistic", -1))
|
|
4816
4824
|
]),
|
|
4817
|
-
h("div",
|
|
4818
|
-
h("div",
|
|
4825
|
+
h("div", Xr, [
|
|
4826
|
+
h("div", en, S(F.value.confirmedCount), 1),
|
|
4819
4827
|
d[17] || (d[17] = h("div", { class: "szd-stat__label" }, "Confirmed", -1))
|
|
4820
4828
|
]),
|
|
4821
|
-
h("div",
|
|
4822
|
-
h("div",
|
|
4829
|
+
h("div", tn, [
|
|
4830
|
+
h("div", sn, S(F.value.groundTruthCount), 1),
|
|
4823
4831
|
d[18] || (d[18] = h("div", { class: "szd-stat__label" }, "Ground Truth", -1))
|
|
4824
4832
|
]),
|
|
4825
|
-
h("div",
|
|
4826
|
-
h("div",
|
|
4833
|
+
h("div", rn, [
|
|
4834
|
+
h("div", nn, S(F.value.inFlightCount), 1),
|
|
4827
4835
|
d[19] || (d[19] = h("div", { class: "szd-stat__label" }, "In-Flight", -1))
|
|
4828
4836
|
])
|
|
4829
4837
|
]),
|
|
4830
|
-
h("div",
|
|
4831
|
-
h("div",
|
|
4838
|
+
h("div", on, [
|
|
4839
|
+
h("div", an, [
|
|
4832
4840
|
d[20] || (d[20] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
|
|
4833
|
-
h("span",
|
|
4841
|
+
h("span", ln, S(F.value.lastSync), 1)
|
|
4834
4842
|
])
|
|
4835
4843
|
])
|
|
4836
4844
|
]),
|
|
4837
|
-
ne.value ? (A(), $("div",
|
|
4845
|
+
ne.value ? (A(), $("div", cn, [
|
|
4838
4846
|
d[22] || (d[22] = h("h3", { class: "szd-panel__heading" }, "Last Event", -1)),
|
|
4839
4847
|
h("button", {
|
|
4840
4848
|
class: "szd-event-preview",
|
|
4841
|
-
onClick: d[1] || (d[1] = (g) =>
|
|
4849
|
+
onClick: d[1] || (d[1] = (g) => kt(ne.value))
|
|
4842
4850
|
}, [
|
|
4843
4851
|
h("span", {
|
|
4844
4852
|
class: "szd-event-preview__badge",
|
|
4845
4853
|
style: at({ background: je(ne.value.type) })
|
|
4846
4854
|
}, S(ne.value.type), 5),
|
|
4847
|
-
h("span",
|
|
4848
|
-
h("span",
|
|
4855
|
+
h("span", dn, S(bt(ne.value)), 1),
|
|
4856
|
+
h("span", un, S(et(ne.value.ts)), 1)
|
|
4849
4857
|
])
|
|
4850
4858
|
])) : V("", !0)
|
|
4851
4859
|
])) : V("", !0),
|
|
4852
|
-
t.value === "timeline" ? (A(), $("div",
|
|
4853
|
-
h("div",
|
|
4860
|
+
t.value === "timeline" ? (A(), $("div", hn, [
|
|
4861
|
+
h("div", fn, [
|
|
4854
4862
|
h("button", {
|
|
4855
4863
|
class: "szd-btn szd-btn--sm",
|
|
4856
|
-
onClick: d[2] || (d[2] = (g) =>
|
|
4864
|
+
onClick: d[2] || (d[2] = (g) => Tt(!0))
|
|
4857
4865
|
}, "All"),
|
|
4858
4866
|
h("button", {
|
|
4859
4867
|
class: "szd-btn szd-btn--sm",
|
|
4860
|
-
onClick: d[3] || (d[3] = (g) =>
|
|
4868
|
+
onClick: d[3] || (d[3] = (g) => Tt(!1))
|
|
4861
4869
|
}, "None"),
|
|
4862
4870
|
(A(), $(W, null, ce(xe, (g) => h("label", {
|
|
4863
4871
|
key: g.id,
|
|
4864
|
-
class:
|
|
4872
|
+
class: $t(["szd-filter-chip", { "szd-filter-chip--active": y.value[g.id] }]),
|
|
4865
4873
|
style: at(y.value[g.id] ? { background: g.color, borderColor: g.color } : {})
|
|
4866
4874
|
}, [
|
|
4867
4875
|
Qe(h("input", {
|
|
4868
4876
|
type: "checkbox",
|
|
4869
4877
|
"onUpdate:modelValue": (z) => y.value[g.id] = z,
|
|
4870
4878
|
class: "szd-filter-chip__input"
|
|
4871
|
-
}, null, 8,
|
|
4872
|
-
[
|
|
4879
|
+
}, null, 8, pn), [
|
|
4880
|
+
[At, y.value[g.id]]
|
|
4873
4881
|
]),
|
|
4874
4882
|
Ve(" " + S(g.label), 1)
|
|
4875
4883
|
], 6)), 64))
|
|
4876
4884
|
]),
|
|
4877
|
-
h("div",
|
|
4885
|
+
h("div", mn, [
|
|
4878
4886
|
(A(!0), $(W, null, ce(Ee.value, (g) => (A(), $("div", {
|
|
4879
4887
|
key: g.id,
|
|
4880
4888
|
class: "szd-timeline__item",
|
|
4881
|
-
onClick: (z) =>
|
|
4889
|
+
onClick: (z) => kt(g)
|
|
4882
4890
|
}, [
|
|
4883
|
-
h("span",
|
|
4891
|
+
h("span", gn, S(et(g.ts)), 1),
|
|
4884
4892
|
h("span", {
|
|
4885
4893
|
class: "szd-timeline__badge",
|
|
4886
4894
|
style: at({ background: je(g.type) })
|
|
4887
4895
|
}, S(g.type), 5),
|
|
4888
|
-
h("span",
|
|
4889
|
-
], 8,
|
|
4890
|
-
Ee.value.length ? V("", !0) : (A(), $("div",
|
|
4896
|
+
h("span", _n, S(bt(g)), 1)
|
|
4897
|
+
], 8, yn))), 128)),
|
|
4898
|
+
Ee.value.length ? V("", !0) : (A(), $("div", wn, " No events match current filters "))
|
|
4891
4899
|
])
|
|
4892
4900
|
])) : V("", !0),
|
|
4893
|
-
t.value === "data" ? (A(), $("div",
|
|
4901
|
+
t.value === "data" ? (A(), $("div", Cn, [
|
|
4894
4902
|
d[25] || (d[25] = h("h3", { class: "szd-panel__heading" }, "Data Pipeline", -1)),
|
|
4895
|
-
h("div",
|
|
4903
|
+
h("div", vn, [
|
|
4896
4904
|
(A(!0), $(W, null, ce(me.value, (g, z) => (A(), $(W, {
|
|
4897
4905
|
key: g.id
|
|
4898
4906
|
}, [
|
|
4899
4907
|
h("div", {
|
|
4900
4908
|
class: "szd-pipeline__stage",
|
|
4901
|
-
onClick: (H) =>
|
|
4909
|
+
onClick: (H) => cs(g)
|
|
4902
4910
|
}, [
|
|
4903
|
-
h("div",
|
|
4904
|
-
h("div",
|
|
4905
|
-
], 8,
|
|
4906
|
-
z < me.value.length - 1 ? (A(), $("div",
|
|
4911
|
+
h("div", bn, S(g.label), 1),
|
|
4912
|
+
h("div", kn, S(g.count), 1)
|
|
4913
|
+
], 8, En),
|
|
4914
|
+
z < me.value.length - 1 ? (A(), $("div", Sn, "→")) : V("", !0)
|
|
4907
4915
|
], 64))), 128))
|
|
4908
4916
|
]),
|
|
4909
|
-
h("div",
|
|
4910
|
-
h("div",
|
|
4917
|
+
h("div", Tn, [
|
|
4918
|
+
h("div", Mn, [
|
|
4911
4919
|
d[24] || (d[24] = h("h3", { class: "szd-panel__heading" }, "Instance Preview", -1)),
|
|
4912
4920
|
Qe(h("select", {
|
|
4913
4921
|
"onUpdate:modelValue": d[4] || (d[4] = (g) => m.value = g),
|
|
@@ -4917,53 +4925,53 @@ const br = (n, e) => {
|
|
|
4917
4925
|
(A(!0), $(W, null, ce(Ye.value, (g) => (A(), $("option", {
|
|
4918
4926
|
key: g,
|
|
4919
4927
|
value: g
|
|
4920
|
-
}, S(g), 9,
|
|
4928
|
+
}, S(g), 9, $n))), 128))
|
|
4921
4929
|
], 512), [
|
|
4922
|
-
[
|
|
4930
|
+
[Ot, m.value]
|
|
4923
4931
|
])
|
|
4924
4932
|
]),
|
|
4925
|
-
m.value != null ? (A(), $("div",
|
|
4933
|
+
m.value != null ? (A(), $("div", An, [
|
|
4926
4934
|
(A(!0), $(W, null, ce(me.value, (g) => (A(), $("div", {
|
|
4927
4935
|
key: g.id,
|
|
4928
4936
|
class: "szd-data-card"
|
|
4929
4937
|
}, [
|
|
4930
|
-
h("div",
|
|
4938
|
+
h("div", On, [
|
|
4931
4939
|
Ve(S(g.label) + " ", 1),
|
|
4932
|
-
g.pks.includes(m.value) ? (A(), $("span",
|
|
4940
|
+
g.pks.includes(m.value) ? (A(), $("span", Pn, "Present")) : (A(), $("span", Fn, "Absent"))
|
|
4933
4941
|
]),
|
|
4934
4942
|
h("pre", In, S(g.pks.includes(m.value) ? JSON.stringify(ye(m.value), null, 2) : "—"), 1)
|
|
4935
4943
|
]))), 128))
|
|
4936
|
-
])) : (A(), $("div",
|
|
4944
|
+
])) : (A(), $("div", Dn, "Select an instance to preview"))
|
|
4937
4945
|
])
|
|
4938
4946
|
])) : V("", !0),
|
|
4939
|
-
t.value === "ast" ? (A(), $("div",
|
|
4947
|
+
t.value === "ast" ? (A(), $("div", zn, [
|
|
4940
4948
|
d[27] || (d[27] = h("h3", { class: "szd-panel__heading" }, "Query AST", -1)),
|
|
4941
|
-
h("div",
|
|
4942
|
-
h("div",
|
|
4949
|
+
h("div", Kn, [
|
|
4950
|
+
h("div", Rn, [
|
|
4943
4951
|
d[26] || (d[26] = h("span", { class: "szd-kv__key" }, "Semantic Key:", -1)),
|
|
4944
|
-
h("code",
|
|
4952
|
+
h("code", Nn, S(k.value || "—"), 1)
|
|
4945
4953
|
])
|
|
4946
4954
|
]),
|
|
4947
|
-
h("pre",
|
|
4955
|
+
h("pre", xn, S(re.value ? JSON.stringify(re.value, null, 2) : "Select a queryset to view AST"), 1)
|
|
4948
4956
|
])) : V("", !0)
|
|
4949
4957
|
]),
|
|
4950
|
-
|
|
4951
|
-
default:
|
|
4952
|
-
p.value ? (A(), $("div",
|
|
4958
|
+
Mt(Pt, { name: "szd-slide" }, {
|
|
4959
|
+
default: Ft(() => [
|
|
4960
|
+
p.value ? (A(), $("div", jn, [
|
|
4953
4961
|
h("div", {
|
|
4954
4962
|
class: "szd-detail__backdrop",
|
|
4955
4963
|
onClick: d[5] || (d[5] = (g) => p.value = !1)
|
|
4956
4964
|
}),
|
|
4957
|
-
h("div",
|
|
4958
|
-
h("div",
|
|
4965
|
+
h("div", Un, [
|
|
4966
|
+
h("div", Qn, [
|
|
4959
4967
|
d[28] || (d[28] = h("h3", { class: "szd-detail__title" }, "Debug Settings", -1)),
|
|
4960
4968
|
h("button", {
|
|
4961
4969
|
class: "szd-btn",
|
|
4962
4970
|
onClick: d[6] || (d[6] = (g) => p.value = !1)
|
|
4963
4971
|
}, "Close")
|
|
4964
4972
|
]),
|
|
4965
|
-
h("div",
|
|
4966
|
-
h("div",
|
|
4973
|
+
h("div", Vn, [
|
|
4974
|
+
h("div", Ln, [
|
|
4967
4975
|
d[30] || (d[30] = h("label", { class: "szd-settings-label" }, "Queryset", -1)),
|
|
4968
4976
|
Qe(h("select", {
|
|
4969
4977
|
"onUpdate:modelValue": d[7] || (d[7] = (g) => r.value = g),
|
|
@@ -4973,69 +4981,69 @@ const br = (n, e) => {
|
|
|
4973
4981
|
(A(!0), $(W, null, ce(b.value, (g) => (A(), $("option", {
|
|
4974
4982
|
key: g.semanticKey,
|
|
4975
4983
|
value: g.semanticKey
|
|
4976
|
-
}, S(g.modelName || "?") + " · " + S(g.semanticKey), 9,
|
|
4984
|
+
}, S(g.modelName || "?") + " · " + S(g.semanticKey), 9, Gn))), 128))
|
|
4977
4985
|
], 512), [
|
|
4978
|
-
[
|
|
4986
|
+
[Ot, r.value]
|
|
4979
4987
|
])
|
|
4980
4988
|
]),
|
|
4981
|
-
k.value ? (A(), $("div",
|
|
4989
|
+
k.value ? (A(), $("div", Bn, [
|
|
4982
4990
|
d[31] || (d[31] = h("label", { class: "szd-settings-label" }, "Semantic Key", -1)),
|
|
4983
|
-
h("div",
|
|
4984
|
-
h("code",
|
|
4991
|
+
h("div", Hn, [
|
|
4992
|
+
h("code", qn, S(k.value), 1),
|
|
4985
4993
|
h("button", {
|
|
4986
4994
|
class: "szd-btn szd-btn--sm",
|
|
4987
|
-
onClick:
|
|
4995
|
+
onClick: as
|
|
4988
4996
|
}, "Copy")
|
|
4989
4997
|
])
|
|
4990
4998
|
])) : V("", !0),
|
|
4991
|
-
h("div",
|
|
4999
|
+
h("div", Jn, [
|
|
4992
5000
|
d[32] || (d[32] = h("label", { class: "szd-settings-label" }, "Actions", -1)),
|
|
4993
|
-
h("div",
|
|
5001
|
+
h("div", Wn, [
|
|
4994
5002
|
h("button", {
|
|
4995
5003
|
class: "szd-btn",
|
|
4996
|
-
onClick:
|
|
5004
|
+
onClick: ls,
|
|
4997
5005
|
disabled: !N.value || c.value
|
|
4998
|
-
}, S(c.value ? "Syncing..." : "Sync Now"), 9,
|
|
5006
|
+
}, S(c.value ? "Syncing..." : "Sync Now"), 9, Zn),
|
|
4999
5007
|
h("button", {
|
|
5000
5008
|
class: "szd-btn",
|
|
5001
|
-
onClick:
|
|
5009
|
+
onClick: is
|
|
5002
5010
|
}, "Clear Events")
|
|
5003
5011
|
])
|
|
5004
5012
|
]),
|
|
5005
|
-
h("div",
|
|
5013
|
+
h("div", Yn, [
|
|
5006
5014
|
d[34] || (d[34] = h("label", { class: "szd-settings-label" }, "Options", -1)),
|
|
5007
|
-
h("label",
|
|
5015
|
+
h("label", Xn, [
|
|
5008
5016
|
Qe(h("input", {
|
|
5009
5017
|
type: "checkbox",
|
|
5010
5018
|
"onUpdate:modelValue": d[8] || (d[8] = (g) => i.value = g)
|
|
5011
5019
|
}, null, 512), [
|
|
5012
|
-
[
|
|
5020
|
+
[At, i.value]
|
|
5013
5021
|
]),
|
|
5014
5022
|
d[33] || (d[33] = Ve(" Live updates ", -1))
|
|
5015
5023
|
])
|
|
5016
5024
|
]),
|
|
5017
|
-
k.value ? (A(), $("div",
|
|
5025
|
+
k.value ? (A(), $("div", eo, [
|
|
5018
5026
|
d[40] || (d[40] = h("label", { class: "szd-settings-label" }, "Current State", -1)),
|
|
5019
|
-
h("div",
|
|
5020
|
-
h("div",
|
|
5027
|
+
h("div", to, [
|
|
5028
|
+
h("div", so, [
|
|
5021
5029
|
d[35] || (d[35] = h("span", { class: "szd-kv__key" }, "Model:", -1)),
|
|
5022
|
-
h("span",
|
|
5030
|
+
h("span", ro, S(F.value.modelName || "—"), 1)
|
|
5023
5031
|
]),
|
|
5024
|
-
h("div",
|
|
5032
|
+
h("div", no, [
|
|
5025
5033
|
d[36] || (d[36] = h("span", { class: "szd-kv__key" }, "Source:", -1)),
|
|
5026
|
-
h("span",
|
|
5034
|
+
h("span", oo, S(F.value.source), 1)
|
|
5027
5035
|
]),
|
|
5028
|
-
h("div",
|
|
5036
|
+
h("div", io, [
|
|
5029
5037
|
d[37] || (d[37] = h("span", { class: "szd-kv__key" }, "Syncing:", -1)),
|
|
5030
|
-
h("span",
|
|
5038
|
+
h("span", ao, S(F.value.isSyncing ? "Yes" : "No"), 1)
|
|
5031
5039
|
]),
|
|
5032
|
-
h("div",
|
|
5040
|
+
h("div", lo, [
|
|
5033
5041
|
d[38] || (d[38] = h("span", { class: "szd-kv__key" }, "Operations:", -1)),
|
|
5034
|
-
h("span",
|
|
5042
|
+
h("span", co, S(F.value.opsCount), 1)
|
|
5035
5043
|
]),
|
|
5036
|
-
h("div",
|
|
5044
|
+
h("div", uo, [
|
|
5037
5045
|
d[39] || (d[39] = h("span", { class: "szd-kv__key" }, "Last Sync:", -1)),
|
|
5038
|
-
h("span",
|
|
5046
|
+
h("span", ho, S(F.value.lastSync), 1)
|
|
5039
5047
|
])
|
|
5040
5048
|
])
|
|
5041
5049
|
])) : V("", !0)
|
|
@@ -5045,50 +5053,50 @@ const br = (n, e) => {
|
|
|
5045
5053
|
]),
|
|
5046
5054
|
_: 1
|
|
5047
5055
|
}),
|
|
5048
|
-
|
|
5049
|
-
default:
|
|
5050
|
-
f.value ? (A(), $("div",
|
|
5056
|
+
Mt(Pt, { name: "szd-slide" }, {
|
|
5057
|
+
default: Ft(() => [
|
|
5058
|
+
f.value ? (A(), $("div", fo, [
|
|
5051
5059
|
h("div", {
|
|
5052
5060
|
class: "szd-detail__backdrop",
|
|
5053
|
-
onClick:
|
|
5061
|
+
onClick: St
|
|
5054
5062
|
}),
|
|
5055
|
-
h("div",
|
|
5056
|
-
h("div",
|
|
5057
|
-
h("h3",
|
|
5063
|
+
h("div", po, [
|
|
5064
|
+
h("div", mo, [
|
|
5065
|
+
h("h3", yo, S(f.value.type === "entry" ? "Event Detail" : "Snapshot: " + f.value.data.label), 1),
|
|
5058
5066
|
h("button", {
|
|
5059
5067
|
class: "szd-btn",
|
|
5060
|
-
onClick:
|
|
5068
|
+
onClick: St
|
|
5061
5069
|
}, "Close")
|
|
5062
5070
|
]),
|
|
5063
|
-
h("div",
|
|
5071
|
+
h("div", go, [
|
|
5064
5072
|
f.value.type === "entry" ? (A(), $(W, { key: 0 }, [
|
|
5065
|
-
h("div",
|
|
5066
|
-
(A(!0), $(W, null, ce(
|
|
5073
|
+
h("div", _o, [
|
|
5074
|
+
(A(!0), $(W, null, ce(os(f.value.data), (g, z) => (A(), $("div", {
|
|
5067
5075
|
key: z,
|
|
5068
5076
|
class: "szd-kv__row"
|
|
5069
5077
|
}, [
|
|
5070
|
-
h("span",
|
|
5071
|
-
h("span",
|
|
5078
|
+
h("span", wo, S(z) + ":", 1),
|
|
5079
|
+
h("span", Co, S(g ?? "—"), 1)
|
|
5072
5080
|
]))), 128))
|
|
5073
5081
|
]),
|
|
5074
5082
|
d[41] || (d[41] = h("h4", { style: { margin: "16px 0 8px" } }, "Raw JSON", -1)),
|
|
5075
|
-
h("pre",
|
|
5083
|
+
h("pre", vo, S(JSON.stringify(f.value.data, null, 2)), 1)
|
|
5076
5084
|
], 64)) : (A(), $(W, { key: 1 }, [
|
|
5077
|
-
h("div",
|
|
5078
|
-
h("div",
|
|
5085
|
+
h("div", Eo, [
|
|
5086
|
+
h("div", bo, [
|
|
5079
5087
|
d[42] || (d[42] = h("span", { class: "szd-kv__key" }, "Total Count:", -1)),
|
|
5080
|
-
h("span",
|
|
5088
|
+
h("span", ko, S(f.value.data.count), 1)
|
|
5081
5089
|
]),
|
|
5082
|
-
h("div",
|
|
5090
|
+
h("div", So, [
|
|
5083
5091
|
d[43] || (d[43] = h("span", { class: "szd-kv__key" }, "Showing:", -1)),
|
|
5084
|
-
h("span",
|
|
5092
|
+
h("span", To, [
|
|
5085
5093
|
Ve(S(Ke.value.length) + " items ", 1),
|
|
5086
|
-
Xe.value ? (A(), $("span",
|
|
5094
|
+
Xe.value ? (A(), $("span", Mo, "(limited to first 100)")) : V("", !0)
|
|
5087
5095
|
])
|
|
5088
5096
|
])
|
|
5089
5097
|
]),
|
|
5090
5098
|
d[44] || (d[44] = h("h4", { style: { margin: "0 0 8px" } }, "Data", -1)),
|
|
5091
|
-
h("pre",
|
|
5099
|
+
h("pre", $o, S(JSON.stringify(Ke.value, null, 2)), 1)
|
|
5092
5100
|
], 64))
|
|
5093
5101
|
])
|
|
5094
5102
|
])
|
|
@@ -5098,7 +5106,7 @@ const br = (n, e) => {
|
|
|
5098
5106
|
})
|
|
5099
5107
|
]));
|
|
5100
5108
|
}
|
|
5101
|
-
},
|
|
5109
|
+
}, Bo = /* @__PURE__ */ kr(Ao, [["__scopeId", "data-v-6d80920c"]]);
|
|
5102
5110
|
export {
|
|
5103
|
-
|
|
5111
|
+
Bo as default
|
|
5104
5112
|
};
|