@rocicorp/zero 0.22.2025081301 → 0.23.2025081400
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/out/analyze-query/src/bin-analyze.js +5 -8
- package/out/analyze-query/src/bin-analyze.js.map +1 -1
- package/out/{chunk-C3ZE2IHA.js → chunk-JHJ3MBXW.js} +8 -6
- package/out/chunk-JHJ3MBXW.js.map +7 -0
- package/out/chunk-MKB4RXL3.js +15 -0
- package/out/chunk-MKB4RXL3.js.map +7 -0
- package/out/{chunk-LENWM5WE.js → chunk-O536GEIT.js} +410 -218
- package/out/chunk-O536GEIT.js.map +7 -0
- package/out/chunk-SGW2EIVJ.js +192 -0
- package/out/chunk-SGW2EIVJ.js.map +7 -0
- package/out/{chunk-N2EOVSVB.js → chunk-ZKRMVMWK.js} +209 -153
- package/out/chunk-ZKRMVMWK.js.map +7 -0
- package/out/expo.js +356 -0
- package/out/expo.js.map +7 -0
- package/out/{inspector-AF3UI76B.js → inspector-J5P4DOGH.js} +122 -26
- package/out/inspector-J5P4DOGH.js.map +7 -0
- package/out/{inspector-ENPS6L3H.js → inspector-YIRP3TTL.js} +1 -1
- package/out/{inspector-ENPS6L3H.js.map → inspector-YIRP3TTL.js.map} +1 -1
- package/out/react.js +7 -4
- package/out/react.js.map +2 -2
- package/out/replicache/src/kv/sqlite-store.d.ts +117 -0
- package/out/replicache/src/kv/sqlite-store.d.ts.map +1 -0
- package/out/shared/src/binary-search.js +31 -0
- package/out/shared/src/binary-search.js.map +1 -0
- package/out/shared/src/centroid.d.ts +10 -0
- package/out/shared/src/centroid.d.ts.map +1 -0
- package/out/shared/src/centroid.js +28 -0
- package/out/shared/src/centroid.js.map +1 -0
- package/out/shared/src/logging-test-utils.d.ts +12 -0
- package/out/shared/src/logging-test-utils.d.ts.map +1 -0
- package/out/shared/src/logging-test-utils.js +21 -0
- package/out/shared/src/logging-test-utils.js.map +1 -0
- package/out/shared/src/objects.d.ts +3 -1
- package/out/shared/src/objects.d.ts.map +1 -1
- package/out/shared/src/objects.js.map +1 -1
- package/out/shared/src/tdigest-schema.d.ts +8 -0
- package/out/shared/src/tdigest-schema.d.ts.map +1 -0
- package/out/shared/src/tdigest-schema.js +7 -0
- package/out/shared/src/tdigest-schema.js.map +1 -0
- package/out/shared/src/tdigest.d.ts +53 -0
- package/out/shared/src/tdigest.d.ts.map +1 -0
- package/out/shared/src/tdigest.js +304 -0
- package/out/shared/src/tdigest.js.map +1 -0
- package/out/solid.js +13 -9
- package/out/solid.js.map +2 -2
- package/out/zero/package.json +9 -4
- package/out/zero/src/expo.d.ts +2 -0
- package/out/zero/src/expo.d.ts.map +1 -0
- package/out/zero/src/zero-cache-dev.js.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js +3 -2
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +18 -297
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +43 -5
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/observability/events.d.ts +15 -0
- package/out/zero-cache/src/observability/events.d.ts.map +1 -0
- package/out/zero-cache/src/observability/events.js +93 -0
- package/out/zero-cache/src/observability/events.js.map +1 -0
- package/out/zero-cache/src/server/anonymous-otel-start.d.ts +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.d.ts.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.js +40 -18
- package/out/zero-cache/src/server/anonymous-otel-start.js.map +1 -1
- package/out/zero-cache/src/server/change-streamer.js +4 -4
- package/out/zero-cache/src/server/change-streamer.js.map +1 -1
- package/out/zero-cache/src/server/main.js +4 -4
- package/out/zero-cache/src/server/main.js.map +1 -1
- package/out/zero-cache/src/server/replicator.d.ts.map +1 -1
- package/out/zero-cache/src/server/replicator.js +7 -6
- package/out/zero-cache/src/server/replicator.js.map +1 -1
- package/out/zero-cache/src/server/runner/run-worker.d.ts.map +1 -1
- package/out/zero-cache/src/server/runner/run-worker.js +3 -2
- package/out/zero-cache/src/server/runner/run-worker.js.map +1 -1
- package/out/zero-cache/src/server/syncer.js +5 -5
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/change-source/custom/change-source.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/custom/change-source.js +46 -35
- package/out/zero-cache/src/services/change-source/custom/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/initial-sync.js +7 -2
- package/out/zero-cache/src/services/change-source/pg/initial-sync.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +28 -2
- package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/replicator/change-processor.d.ts +5 -1
- package/out/zero-cache/src/services/replicator/change-processor.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/change-processor.js +10 -8
- package/out/zero-cache/src/services/replicator/change-processor.js.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.d.ts +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.js +17 -3
- package/out/zero-cache/src/services/replicator/incremental-sync.js.map +1 -1
- package/out/zero-cache/src/services/replicator/replication-status.d.ts +12 -0
- package/out/zero-cache/src/services/replicator/replication-status.d.ts.map +1 -0
- package/out/zero-cache/src/services/replicator/replication-status.js +92 -0
- package/out/zero-cache/src/services/replicator/replication-status.js.map +1 -0
- package/out/zero-cache/src/services/replicator/replicator.d.ts +1 -1
- package/out/zero-cache/src/services/replicator/replicator.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/replicator.js +2 -2
- package/out/zero-cache/src/services/replicator/replicator.js.map +1 -1
- package/out/zero-cache/src/services/statz.d.ts.map +1 -1
- package/out/zero-cache/src/services/statz.js +0 -23
- package/out/zero-cache/src/services/statz.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +2 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +10 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +77 -8
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/types/pg.d.ts +9 -0
- package/out/zero-cache/src/types/pg.d.ts.map +1 -1
- package/out/zero-cache/src/types/pg.js +78 -1
- package/out/zero-cache/src/types/pg.js.map +1 -1
- package/out/zero-client/src/client/context.d.ts +11 -11
- package/out/zero-client/src/client/context.d.ts.map +1 -1
- package/out/zero-client/src/client/custom.d.ts +6 -6
- package/out/zero-client/src/client/custom.d.ts.map +1 -1
- package/out/zero-client/src/client/inspector/inspector.d.ts +10 -1
- package/out/zero-client/src/client/inspector/inspector.d.ts.map +1 -1
- package/out/zero-client/src/client/inspector/types.d.ts +10 -0
- package/out/zero-client/src/client/inspector/types.d.ts.map +1 -1
- package/out/zero-client/src/client/measure-push-operator.d.ts +17 -0
- package/out/zero-client/src/client/measure-push-operator.d.ts.map +1 -0
- package/out/zero-client/src/client/options.d.ts +2 -2
- package/out/zero-client/src/client/options.d.ts.map +1 -1
- package/out/zero-client/src/client/query-manager.d.ts +18 -5
- package/out/zero-client/src/client/query-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.d.ts +4 -4
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/mod.d.ts +1 -1
- package/out/zero-client/src/mod.d.ts.map +1 -1
- package/out/zero-events/src/index.d.ts +29 -0
- package/out/zero-events/src/index.d.ts.map +1 -0
- package/out/zero-events/src/index.js +28 -0
- package/out/zero-events/src/index.js.map +1 -0
- package/out/zero-events/src/status.d.ts +113 -0
- package/out/zero-events/src/status.d.ts.map +1 -0
- package/out/zero-events/src/status.js +72 -0
- package/out/zero-events/src/status.js.map +1 -0
- package/out/zero-expo/src/mod.d.ts +2 -0
- package/out/zero-expo/src/mod.d.ts.map +1 -0
- package/out/zero-expo/src/store.d.ts +4 -0
- package/out/zero-expo/src/store.d.ts.map +1 -0
- package/out/zero-protocol/src/down.d.ts +18 -2
- package/out/zero-protocol/src/down.d.ts.map +1 -1
- package/out/zero-protocol/src/inspect-down.d.ts +64 -6
- package/out/zero-protocol/src/inspect-down.d.ts.map +1 -1
- package/out/zero-protocol/src/inspect-down.js +18 -3
- package/out/zero-protocol/src/inspect-down.js.map +1 -1
- package/out/zero-protocol/src/inspect-up.d.ts +25 -6
- package/out/zero-protocol/src/inspect-up.d.ts.map +1 -1
- package/out/zero-protocol/src/inspect-up.js +8 -3
- package/out/zero-protocol/src/inspect-up.js.map +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
- package/out/zero-protocol/src/protocol-version.js +3 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/up.d.ts +7 -2
- package/out/zero-protocol/src/up.d.ts.map +1 -1
- package/out/zero-react/src/components/inspector.d.ts +1 -1
- package/out/zero-react/src/components/inspector.d.ts.map +1 -1
- package/out/zero-react/src/components/zero-inspector.d.ts +1 -1
- package/out/zero-react/src/components/zero-inspector.d.ts.map +1 -1
- package/out/zero-react/src/zero-provider.d.ts +4 -4
- package/out/zero-react/src/zero-provider.d.ts.map +1 -1
- package/out/zero-schema/src/permissions.d.ts +15 -0
- package/out/zero-schema/src/permissions.d.ts.map +1 -1
- package/out/zero-schema/src/table-schema.d.ts +1 -8
- package/out/zero-schema/src/table-schema.d.ts.map +1 -1
- package/out/zero-schema/src/table-schema.js.map +1 -1
- package/out/zero-solid/src/use-zero.d.ts +4 -4
- package/out/zero-solid/src/use-zero.d.ts.map +1 -1
- package/out/zero.js +5 -3
- package/out/zql/src/builder/builder.d.ts +3 -2
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +9 -8
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/ivm/operator.d.ts +1 -1
- package/out/zql/src/ivm/operator.d.ts.map +1 -1
- package/out/zql/src/ivm/operator.js +0 -1
- package/out/zql/src/ivm/operator.js.map +1 -1
- package/out/zql/src/query/metrics-delegate.d.ts +14 -0
- package/out/zql/src/query/metrics-delegate.d.ts.map +1 -0
- package/out/zql/src/query/metrics-delegate.js +2 -0
- package/out/zql/src/query/metrics-delegate.js.map +1 -0
- package/out/zql/src/query/query-delegate.d.ts +7 -2
- package/out/zql/src/query/query-delegate.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.js +17 -14
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zqlite/src/query-delegate.d.ts +7 -6
- package/out/zqlite/src/query-delegate.d.ts.map +1 -1
- package/out/zqlite/src/query-delegate.js +5 -2
- package/out/zqlite/src/query-delegate.js.map +1 -1
- package/package.json +9 -4
- package/out/chunk-C3ZE2IHA.js.map +0 -7
- package/out/chunk-LENWM5WE.js.map +0 -7
- package/out/chunk-N2EOVSVB.js.map +0 -7
- package/out/inspector-AF3UI76B.js.map +0 -7
|
@@ -1,60 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assert,
|
|
3
|
+
assertArray,
|
|
4
|
+
assertBoolean,
|
|
5
|
+
assertDeepFrozen,
|
|
6
|
+
assertNumber,
|
|
7
|
+
assertObject,
|
|
8
|
+
assertString,
|
|
9
|
+
deepFreeze,
|
|
10
|
+
hasOwn,
|
|
11
|
+
isProd,
|
|
12
|
+
throwInvalidType,
|
|
13
|
+
unreachable
|
|
14
|
+
} from "./chunk-SGW2EIVJ.js";
|
|
1
15
|
import {
|
|
2
16
|
__export,
|
|
3
17
|
__reExport
|
|
4
18
|
} from "./chunk-424PT5DM.js";
|
|
5
19
|
|
|
6
|
-
// ../shared/src/asserts.ts
|
|
7
|
-
function assert(b, msg = "Assertion failed") {
|
|
8
|
-
if (!b) {
|
|
9
|
-
throw new Error(typeof msg === "string" ? msg : msg());
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function assertString(v2) {
|
|
13
|
-
assertType(v2, "string");
|
|
14
|
-
}
|
|
15
|
-
function assertNumber(v2) {
|
|
16
|
-
assertType(v2, "number");
|
|
17
|
-
}
|
|
18
|
-
function assertBoolean(v2) {
|
|
19
|
-
assertType(v2, "boolean");
|
|
20
|
-
}
|
|
21
|
-
function assertType(v2, t) {
|
|
22
|
-
if (typeof v2 !== t) {
|
|
23
|
-
throwInvalidType(v2, t);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function assertObject(v2) {
|
|
27
|
-
if (v2 === null) {
|
|
28
|
-
throwInvalidType(v2, "object");
|
|
29
|
-
}
|
|
30
|
-
assertType(v2, "object");
|
|
31
|
-
}
|
|
32
|
-
function assertArray(v2) {
|
|
33
|
-
if (!Array.isArray(v2)) {
|
|
34
|
-
throwInvalidType(v2, "array");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function invalidType(v2, t) {
|
|
38
|
-
let s = "Invalid type: ";
|
|
39
|
-
if (v2 === null || v2 === void 0) {
|
|
40
|
-
s += v2;
|
|
41
|
-
} else {
|
|
42
|
-
s += `${typeof v2} \`${v2}\``;
|
|
43
|
-
}
|
|
44
|
-
return s + `, expected ${t}`;
|
|
45
|
-
}
|
|
46
|
-
function throwInvalidType(v2, t) {
|
|
47
|
-
throw new Error(invalidType(v2, t));
|
|
48
|
-
}
|
|
49
|
-
function assertNotNull(v2) {
|
|
50
|
-
if (v2 === null) {
|
|
51
|
-
throw new Error("Expected non-null value");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function unreachable(_) {
|
|
55
|
-
throw new Error("Unreachable");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
20
|
// ../shared/src/valita.ts
|
|
59
21
|
var valita_exports = {};
|
|
60
22
|
__export(valita_exports, {
|
|
@@ -296,12 +258,6 @@ var V6 = 6;
|
|
|
296
258
|
var V7 = 7;
|
|
297
259
|
var Latest = V7;
|
|
298
260
|
|
|
299
|
-
// ../shared/src/config.ts
|
|
300
|
-
var isProd = process.env.NODE_ENV === "production";
|
|
301
|
-
|
|
302
|
-
// ../shared/src/has-own.ts
|
|
303
|
-
var { hasOwn } = Object;
|
|
304
|
-
|
|
305
261
|
// ../shared/src/json.ts
|
|
306
262
|
function deepEqual(a, b) {
|
|
307
263
|
if (a === b) {
|
|
@@ -599,123 +555,6 @@ function wrapIterable(iter) {
|
|
|
599
555
|
return new IterWrapper(iter);
|
|
600
556
|
}
|
|
601
557
|
|
|
602
|
-
// ../replicache/src/frozen-json.ts
|
|
603
|
-
var deepFrozenObjects = /* @__PURE__ */ new WeakSet();
|
|
604
|
-
function deepFreeze(v2) {
|
|
605
|
-
if (isProd) {
|
|
606
|
-
return v2;
|
|
607
|
-
}
|
|
608
|
-
deepFreezeInternal(v2, []);
|
|
609
|
-
return v2;
|
|
610
|
-
}
|
|
611
|
-
function deepFreezeInternal(v2, seen) {
|
|
612
|
-
switch (typeof v2) {
|
|
613
|
-
case "undefined":
|
|
614
|
-
throw new TypeError("Unexpected value undefined");
|
|
615
|
-
case "boolean":
|
|
616
|
-
case "number":
|
|
617
|
-
case "string":
|
|
618
|
-
return;
|
|
619
|
-
case "object": {
|
|
620
|
-
if (v2 === null) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
if (deepFrozenObjects.has(v2)) {
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
deepFrozenObjects.add(v2);
|
|
627
|
-
if (seen.includes(v2)) {
|
|
628
|
-
throwInvalidType(v2, "Cyclic JSON object");
|
|
629
|
-
}
|
|
630
|
-
seen.push(v2);
|
|
631
|
-
Object.freeze(v2);
|
|
632
|
-
if (Array.isArray(v2)) {
|
|
633
|
-
deepFreezeArray(v2, seen);
|
|
634
|
-
} else {
|
|
635
|
-
deepFreezeObject(v2, seen);
|
|
636
|
-
}
|
|
637
|
-
seen.pop();
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
default:
|
|
641
|
-
throwInvalidType(v2, "JSON value");
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
function deepFreezeArray(v2, seen) {
|
|
645
|
-
for (const item of v2) {
|
|
646
|
-
deepFreezeInternal(item, seen);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
function deepFreezeObject(v2, seen) {
|
|
650
|
-
for (const k in v2) {
|
|
651
|
-
if (hasOwn(v2, k)) {
|
|
652
|
-
const value = v2[k];
|
|
653
|
-
if (value !== void 0) {
|
|
654
|
-
deepFreezeInternal(value, seen);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
function assertDeepFrozen(v2) {
|
|
660
|
-
if (isProd) {
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
if (!isDeepFrozen(v2, [])) {
|
|
664
|
-
throw new Error("Expected frozen object");
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
function isDeepFrozen(v2, seen) {
|
|
668
|
-
switch (typeof v2) {
|
|
669
|
-
case "boolean":
|
|
670
|
-
case "number":
|
|
671
|
-
case "string":
|
|
672
|
-
return true;
|
|
673
|
-
case "object":
|
|
674
|
-
if (v2 === null) {
|
|
675
|
-
return true;
|
|
676
|
-
}
|
|
677
|
-
if (deepFrozenObjects.has(v2)) {
|
|
678
|
-
return true;
|
|
679
|
-
}
|
|
680
|
-
if (!Object.isFrozen(v2)) {
|
|
681
|
-
return false;
|
|
682
|
-
}
|
|
683
|
-
if (seen.includes(v2)) {
|
|
684
|
-
throwInvalidType(v2, "Cyclic JSON object");
|
|
685
|
-
}
|
|
686
|
-
seen.push(v2);
|
|
687
|
-
if (Array.isArray(v2)) {
|
|
688
|
-
for (const item of v2) {
|
|
689
|
-
if (!isDeepFrozen(item, seen)) {
|
|
690
|
-
seen.pop();
|
|
691
|
-
return false;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
} else {
|
|
695
|
-
for (const k in v2) {
|
|
696
|
-
if (hasOwn(v2, k)) {
|
|
697
|
-
const value = v2[k];
|
|
698
|
-
if (value !== void 0 && !isDeepFrozen(value, seen)) {
|
|
699
|
-
seen.pop();
|
|
700
|
-
return false;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
deepFrozenObjects.add(v2);
|
|
706
|
-
seen.pop();
|
|
707
|
-
return true;
|
|
708
|
-
default:
|
|
709
|
-
throwInvalidType(v2, "JSON value");
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
function deepFreezeAllowUndefined(v2) {
|
|
713
|
-
if (v2 === void 0) {
|
|
714
|
-
return void 0;
|
|
715
|
-
}
|
|
716
|
-
return deepFreeze(v2);
|
|
717
|
-
}
|
|
718
|
-
|
|
719
558
|
// ../replicache/src/btree/node.ts
|
|
720
559
|
var NODE_LEVEL = 0;
|
|
721
560
|
var NODE_ENTRIES = 1;
|
|
@@ -859,13 +698,13 @@ var DataNodeImpl = class extends NodeImpl {
|
|
|
859
698
|
}
|
|
860
699
|
}
|
|
861
700
|
};
|
|
862
|
-
function readonlySplice(
|
|
863
|
-
const arr =
|
|
701
|
+
function readonlySplice(array6, start, deleteCount, ...items) {
|
|
702
|
+
const arr = array6.slice(0, start);
|
|
864
703
|
for (let i = 0; i < items.length; i++) {
|
|
865
704
|
arr.push(items[i]);
|
|
866
705
|
}
|
|
867
|
-
for (let i = start + deleteCount; i <
|
|
868
|
-
arr.push(
|
|
706
|
+
for (let i = start + deleteCount; i < array6.length; i++) {
|
|
707
|
+
arr.push(array6[i]);
|
|
869
708
|
}
|
|
870
709
|
return arr;
|
|
871
710
|
}
|
|
@@ -3095,6 +2934,26 @@ async function setClients(clients, dagWrite) {
|
|
|
3095
2934
|
return chunk.hash;
|
|
3096
2935
|
}
|
|
3097
2936
|
|
|
2937
|
+
// ../shared/src/objects.ts
|
|
2938
|
+
function mapValues(input, mapper) {
|
|
2939
|
+
return mapEntries(input, (k, v2) => [k, mapper(v2)]);
|
|
2940
|
+
}
|
|
2941
|
+
function mapEntries(input, mapper) {
|
|
2942
|
+
const output = {};
|
|
2943
|
+
for (const entry of Object.entries(input)) {
|
|
2944
|
+
const mapped = mapper(entry[0], entry[1]);
|
|
2945
|
+
output[mapped[0]] = mapped[1];
|
|
2946
|
+
}
|
|
2947
|
+
return output;
|
|
2948
|
+
}
|
|
2949
|
+
function mapAllEntries(input, mapper) {
|
|
2950
|
+
const output = {};
|
|
2951
|
+
for (const mapped of mapper(Object.entries(input))) {
|
|
2952
|
+
output[mapped[0]] = mapped[1];
|
|
2953
|
+
}
|
|
2954
|
+
return output;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
3098
2957
|
// ../shared/src/must.ts
|
|
3099
2958
|
function must(v2, msg) {
|
|
3100
2959
|
if (v2 == null) {
|
|
@@ -3524,6 +3383,9 @@ var jsonObjectSchema = valita_exports.unknown().chain((v2) => {
|
|
|
3524
3383
|
return rv;
|
|
3525
3384
|
});
|
|
3526
3385
|
|
|
3386
|
+
// ../shared/src/tdigest-schema.ts
|
|
3387
|
+
var tdigestSchema = valita_exports.tuple([valita_exports.number()]).concat(valita_exports.array(valita_exports.number()));
|
|
3388
|
+
|
|
3527
3389
|
// ../zero-protocol/src/ast.ts
|
|
3528
3390
|
import { compareUTF8 as compareUTF83 } from "compare-utf8";
|
|
3529
3391
|
|
|
@@ -3858,6 +3720,9 @@ function compareUTF8MaybeNull(a, b) {
|
|
|
3858
3720
|
}
|
|
3859
3721
|
|
|
3860
3722
|
// ../zero-protocol/src/inspect-down.ts
|
|
3723
|
+
var serverMetricsSchema = valita_exports.object({
|
|
3724
|
+
"query-materialization-server": tdigestSchema
|
|
3725
|
+
});
|
|
3861
3726
|
var inspectQueryRowSchema = valita_exports.object({
|
|
3862
3727
|
clientID: valita_exports.string(),
|
|
3863
3728
|
queryID: valita_exports.string(),
|
|
@@ -3871,28 +3736,43 @@ var inspectQueryRowSchema = valita_exports.object({
|
|
|
3871
3736
|
deleted: valita_exports.boolean(),
|
|
3872
3737
|
ttl: valita_exports.number(),
|
|
3873
3738
|
inactivatedAt: valita_exports.number().nullable(),
|
|
3874
|
-
rowCount: valita_exports.number()
|
|
3739
|
+
rowCount: valita_exports.number(),
|
|
3740
|
+
metrics: serverMetricsSchema.nullable().optional()
|
|
3741
|
+
});
|
|
3742
|
+
var inspectBaseDownSchema = valita_exports.object({
|
|
3743
|
+
id: valita_exports.string()
|
|
3875
3744
|
});
|
|
3876
|
-
var inspectQueriesDownSchema =
|
|
3745
|
+
var inspectQueriesDownSchema = inspectBaseDownSchema.extend({
|
|
3877
3746
|
op: valita_exports.literal("queries"),
|
|
3878
|
-
id: valita_exports.string(),
|
|
3879
3747
|
value: valita_exports.array(inspectQueryRowSchema)
|
|
3880
3748
|
});
|
|
3881
|
-
var
|
|
3749
|
+
var inspectMetricsDownSchema = inspectBaseDownSchema.extend({
|
|
3750
|
+
op: valita_exports.literal("metrics"),
|
|
3751
|
+
value: serverMetricsSchema
|
|
3752
|
+
});
|
|
3753
|
+
var inspectVersionDownSchema = inspectBaseDownSchema.extend({
|
|
3754
|
+
op: valita_exports.literal("version"),
|
|
3755
|
+
value: valita_exports.string()
|
|
3756
|
+
});
|
|
3757
|
+
var inspectDownBodySchema = valita_exports.union(
|
|
3758
|
+
inspectQueriesDownSchema,
|
|
3759
|
+
inspectMetricsDownSchema,
|
|
3760
|
+
inspectVersionDownSchema
|
|
3761
|
+
);
|
|
3882
3762
|
var inspectDownMessageSchema = valita_exports.tuple([
|
|
3883
3763
|
valita_exports.literal("inspect"),
|
|
3884
3764
|
inspectDownBodySchema
|
|
3885
3765
|
]);
|
|
3886
3766
|
|
|
3887
3767
|
// ../shared/src/random-values.ts
|
|
3888
|
-
function getNonCryptoRandomValues(
|
|
3889
|
-
if (
|
|
3768
|
+
function getNonCryptoRandomValues(array6) {
|
|
3769
|
+
if (array6 === null) {
|
|
3890
3770
|
throw new TypeError("array cannot be null");
|
|
3891
3771
|
}
|
|
3892
|
-
for (let i = 0; i <
|
|
3893
|
-
|
|
3772
|
+
for (let i = 0; i < array6.length; i++) {
|
|
3773
|
+
array6[i] = Math.floor(Math.random() * 256);
|
|
3894
3774
|
}
|
|
3895
|
-
return
|
|
3775
|
+
return array6;
|
|
3896
3776
|
}
|
|
3897
3777
|
|
|
3898
3778
|
// ../zero-client/src/util/nanoid.ts
|
|
@@ -3969,6 +3849,309 @@ function sourceNameFromKey(key) {
|
|
|
3969
3849
|
return key.slice(ENTITIES_KEY_PREFIX.length, slash);
|
|
3970
3850
|
}
|
|
3971
3851
|
|
|
3852
|
+
// ../shared/src/centroid.ts
|
|
3853
|
+
var Centroid = class {
|
|
3854
|
+
mean;
|
|
3855
|
+
weight;
|
|
3856
|
+
constructor(mean, weight) {
|
|
3857
|
+
this.mean = mean;
|
|
3858
|
+
this.weight = weight;
|
|
3859
|
+
}
|
|
3860
|
+
add(r) {
|
|
3861
|
+
if (r.weight < 0) {
|
|
3862
|
+
throw new Error("centroid weight cannot be less than zero");
|
|
3863
|
+
}
|
|
3864
|
+
if (this.weight !== 0) {
|
|
3865
|
+
this.weight += r.weight;
|
|
3866
|
+
this.mean += r.weight * (r.mean - this.mean) / this.weight;
|
|
3867
|
+
} else {
|
|
3868
|
+
this.weight = r.weight;
|
|
3869
|
+
this.mean = r.mean;
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
};
|
|
3873
|
+
function sortCentroidList(centroids) {
|
|
3874
|
+
centroids.sort((a, b) => a.mean - b.mean);
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
// ../shared/src/tdigest.ts
|
|
3878
|
+
var TDigest = class _TDigest {
|
|
3879
|
+
compression;
|
|
3880
|
+
#maxProcessed;
|
|
3881
|
+
#maxUnprocessed;
|
|
3882
|
+
#processed;
|
|
3883
|
+
#unprocessed;
|
|
3884
|
+
#cumulative;
|
|
3885
|
+
#processedWeight;
|
|
3886
|
+
#unprocessedWeight;
|
|
3887
|
+
#min;
|
|
3888
|
+
#max;
|
|
3889
|
+
constructor(compression = 1e3) {
|
|
3890
|
+
this.compression = compression;
|
|
3891
|
+
this.#maxProcessed = processedSize(0, this.compression);
|
|
3892
|
+
this.#maxUnprocessed = unprocessedSize(0, this.compression);
|
|
3893
|
+
this.reset();
|
|
3894
|
+
}
|
|
3895
|
+
/**
|
|
3896
|
+
* fromJSON creates a TDigest from a JSON-serializable representation.
|
|
3897
|
+
* The data should be an object with compression and centroids array.
|
|
3898
|
+
*/
|
|
3899
|
+
static fromJSON(data) {
|
|
3900
|
+
const digest = new _TDigest(data[0]);
|
|
3901
|
+
if (data.length % 2 !== 1) {
|
|
3902
|
+
throw new Error("Invalid centroids array");
|
|
3903
|
+
}
|
|
3904
|
+
for (let i = 1; i < data.length; i += 2) {
|
|
3905
|
+
digest.add(data[i], data[i + 1]);
|
|
3906
|
+
}
|
|
3907
|
+
return digest;
|
|
3908
|
+
}
|
|
3909
|
+
reset() {
|
|
3910
|
+
this.#processed = [];
|
|
3911
|
+
this.#unprocessed = [];
|
|
3912
|
+
this.#cumulative = [];
|
|
3913
|
+
this.#processedWeight = 0;
|
|
3914
|
+
this.#unprocessedWeight = 0;
|
|
3915
|
+
this.#min = Number.MAX_VALUE;
|
|
3916
|
+
this.#max = -Number.MAX_VALUE;
|
|
3917
|
+
}
|
|
3918
|
+
add(mean, weight = 1) {
|
|
3919
|
+
this.addCentroid(new Centroid(mean, weight));
|
|
3920
|
+
}
|
|
3921
|
+
/** AddCentroidList can quickly add multiple centroids. */
|
|
3922
|
+
addCentroidList(centroidList) {
|
|
3923
|
+
for (const c of centroidList) {
|
|
3924
|
+
this.addCentroid(c);
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
/**
|
|
3928
|
+
* AddCentroid adds a single centroid.
|
|
3929
|
+
* Weights which are not a number or are <= 0 are ignored, as are NaN means.
|
|
3930
|
+
*/
|
|
3931
|
+
addCentroid(c) {
|
|
3932
|
+
if (Number.isNaN(c.mean) || c.weight <= 0 || Number.isNaN(c.weight) || !Number.isFinite(c.weight)) {
|
|
3933
|
+
return;
|
|
3934
|
+
}
|
|
3935
|
+
this.#unprocessed.push(new Centroid(c.mean, c.weight));
|
|
3936
|
+
this.#unprocessedWeight += c.weight;
|
|
3937
|
+
if (this.#processed.length > this.#maxProcessed || this.#unprocessed.length > this.#maxUnprocessed) {
|
|
3938
|
+
this.#process();
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
/**
|
|
3942
|
+
* Merges the supplied digest into this digest. Functionally equivalent to
|
|
3943
|
+
* calling t.AddCentroidList(t2.Centroids(nil)), but avoids making an extra
|
|
3944
|
+
* copy of the CentroidList.
|
|
3945
|
+
**/
|
|
3946
|
+
merge(t2) {
|
|
3947
|
+
t2.#process();
|
|
3948
|
+
this.addCentroidList(t2.#processed);
|
|
3949
|
+
}
|
|
3950
|
+
#process() {
|
|
3951
|
+
if (this.#unprocessed.length > 0 || this.#processed.length > this.#maxProcessed) {
|
|
3952
|
+
this.#unprocessed.push(...this.#processed);
|
|
3953
|
+
sortCentroidList(this.#unprocessed);
|
|
3954
|
+
this.#processed.length = 0;
|
|
3955
|
+
this.#processed.push(this.#unprocessed[0]);
|
|
3956
|
+
this.#processedWeight += this.#unprocessedWeight;
|
|
3957
|
+
this.#unprocessedWeight = 0;
|
|
3958
|
+
let soFar = this.#unprocessed[0].weight;
|
|
3959
|
+
let limit = this.#processedWeight * this.#integratedQ(1);
|
|
3960
|
+
for (let i = 1; i < this.#unprocessed.length; i++) {
|
|
3961
|
+
const centroid = this.#unprocessed[i];
|
|
3962
|
+
const projected = soFar + centroid.weight;
|
|
3963
|
+
if (projected <= limit) {
|
|
3964
|
+
soFar = projected;
|
|
3965
|
+
this.#processed[this.#processed.length - 1].add(centroid);
|
|
3966
|
+
} else {
|
|
3967
|
+
const k1 = this.#integratedLocation(soFar / this.#processedWeight);
|
|
3968
|
+
limit = this.#processedWeight * this.#integratedQ(k1 + 1);
|
|
3969
|
+
soFar += centroid.weight;
|
|
3970
|
+
this.#processed.push(centroid);
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
this.#min = Math.min(this.#min, this.#processed[0].mean);
|
|
3974
|
+
this.#max = Math.max(
|
|
3975
|
+
this.#max,
|
|
3976
|
+
this.#processed[this.#processed.length - 1].mean
|
|
3977
|
+
);
|
|
3978
|
+
this.#unprocessed.length = 0;
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
/**
|
|
3982
|
+
* Centroids returns a copy of processed centroids.
|
|
3983
|
+
* Useful when aggregating multiple t-digests.
|
|
3984
|
+
*
|
|
3985
|
+
* Centroids are appended to the passed CentroidList; if you're re-using a
|
|
3986
|
+
* buffer, be sure to pass cl[:0].
|
|
3987
|
+
*/
|
|
3988
|
+
centroids(cl = []) {
|
|
3989
|
+
this.#process();
|
|
3990
|
+
return cl.concat(this.#processed);
|
|
3991
|
+
}
|
|
3992
|
+
count() {
|
|
3993
|
+
this.#process();
|
|
3994
|
+
return this.#processedWeight;
|
|
3995
|
+
}
|
|
3996
|
+
/**
|
|
3997
|
+
* toJSON returns a JSON-serializable representation of the digest.
|
|
3998
|
+
* This processes the digest and returns an object with compression and centroid data.
|
|
3999
|
+
*/
|
|
4000
|
+
toJSON() {
|
|
4001
|
+
this.#process();
|
|
4002
|
+
const data = [this.compression];
|
|
4003
|
+
for (const centroid of this.#processed) {
|
|
4004
|
+
data.push(centroid.mean, centroid.weight);
|
|
4005
|
+
}
|
|
4006
|
+
return data;
|
|
4007
|
+
}
|
|
4008
|
+
#updateCumulative() {
|
|
4009
|
+
if (this.#cumulative.length > 0 && this.#cumulative[this.#cumulative.length - 1] === this.#processedWeight) {
|
|
4010
|
+
return;
|
|
4011
|
+
}
|
|
4012
|
+
const n = this.#processed.length + 1;
|
|
4013
|
+
if (this.#cumulative.length > n) {
|
|
4014
|
+
this.#cumulative.length = n;
|
|
4015
|
+
}
|
|
4016
|
+
let prev = 0;
|
|
4017
|
+
for (let i = 0; i < this.#processed.length; i++) {
|
|
4018
|
+
const centroid = this.#processed[i];
|
|
4019
|
+
const cur = centroid.weight;
|
|
4020
|
+
this.#cumulative[i] = prev + cur / 2;
|
|
4021
|
+
prev += cur;
|
|
4022
|
+
}
|
|
4023
|
+
this.#cumulative[this.#processed.length] = prev;
|
|
4024
|
+
}
|
|
4025
|
+
// Quantile returns the (approximate) quantile of
|
|
4026
|
+
// the distribution. Accepted values for q are between 0 and 1.
|
|
4027
|
+
// Returns NaN if Count is zero or bad inputs.
|
|
4028
|
+
quantile(q) {
|
|
4029
|
+
this.#process();
|
|
4030
|
+
this.#updateCumulative();
|
|
4031
|
+
if (q < 0 || q > 1 || this.#processed.length === 0) {
|
|
4032
|
+
return NaN;
|
|
4033
|
+
}
|
|
4034
|
+
if (this.#processed.length === 1) {
|
|
4035
|
+
return this.#processed[0].mean;
|
|
4036
|
+
}
|
|
4037
|
+
const index = q * this.#processedWeight;
|
|
4038
|
+
if (index <= this.#processed[0].weight / 2) {
|
|
4039
|
+
return this.#min + 2 * index / this.#processed[0].weight * (this.#processed[0].mean - this.#min);
|
|
4040
|
+
}
|
|
4041
|
+
const lower = binarySearch(
|
|
4042
|
+
this.#cumulative.length,
|
|
4043
|
+
(i) => -this.#cumulative[i] + index
|
|
4044
|
+
);
|
|
4045
|
+
if (lower + 1 !== this.#cumulative.length) {
|
|
4046
|
+
const z12 = index - this.#cumulative[lower - 1];
|
|
4047
|
+
const z22 = this.#cumulative[lower] - index;
|
|
4048
|
+
return weightedAverage(
|
|
4049
|
+
this.#processed[lower - 1].mean,
|
|
4050
|
+
z22,
|
|
4051
|
+
this.#processed[lower].mean,
|
|
4052
|
+
z12
|
|
4053
|
+
);
|
|
4054
|
+
}
|
|
4055
|
+
const z1 = index - this.#processedWeight - this.#processed[lower - 1].weight / 2;
|
|
4056
|
+
const z2 = this.#processed[lower - 1].weight / 2 - z1;
|
|
4057
|
+
return weightedAverage(
|
|
4058
|
+
this.#processed[this.#processed.length - 1].mean,
|
|
4059
|
+
z1,
|
|
4060
|
+
this.#max,
|
|
4061
|
+
z2
|
|
4062
|
+
);
|
|
4063
|
+
}
|
|
4064
|
+
/**
|
|
4065
|
+
* CDF returns the cumulative distribution function for a given value x.
|
|
4066
|
+
*/
|
|
4067
|
+
cdf(x) {
|
|
4068
|
+
this.#process();
|
|
4069
|
+
this.#updateCumulative();
|
|
4070
|
+
switch (this.#processed.length) {
|
|
4071
|
+
case 0:
|
|
4072
|
+
return 0;
|
|
4073
|
+
case 1: {
|
|
4074
|
+
const width = this.#max - this.#min;
|
|
4075
|
+
if (x <= this.#min) {
|
|
4076
|
+
return 0;
|
|
4077
|
+
}
|
|
4078
|
+
if (x >= this.#max) {
|
|
4079
|
+
return 1;
|
|
4080
|
+
}
|
|
4081
|
+
if (x - this.#min <= width) {
|
|
4082
|
+
return 0.5;
|
|
4083
|
+
}
|
|
4084
|
+
return (x - this.#min) / width;
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
if (x <= this.#min) {
|
|
4088
|
+
return 0;
|
|
4089
|
+
}
|
|
4090
|
+
if (x >= this.#max) {
|
|
4091
|
+
return 1;
|
|
4092
|
+
}
|
|
4093
|
+
const m0 = this.#processed[0].mean;
|
|
4094
|
+
if (x <= m0) {
|
|
4095
|
+
if (m0 - this.#min > 0) {
|
|
4096
|
+
return (x - this.#min) / (m0 - this.#min) * this.#processed[0].weight / this.#processedWeight / 2;
|
|
4097
|
+
}
|
|
4098
|
+
return 0;
|
|
4099
|
+
}
|
|
4100
|
+
const mn = this.#processed[this.#processed.length - 1].mean;
|
|
4101
|
+
if (x >= mn) {
|
|
4102
|
+
if (this.#max - mn > 0) {
|
|
4103
|
+
return 1 - (this.#max - x) / (this.#max - mn) * this.#processed[this.#processed.length - 1].weight / this.#processedWeight / 2;
|
|
4104
|
+
}
|
|
4105
|
+
return 1;
|
|
4106
|
+
}
|
|
4107
|
+
const upper = binarySearch(
|
|
4108
|
+
this.#processed.length,
|
|
4109
|
+
// Treat equals as greater than, so we can use the upper index
|
|
4110
|
+
// This is equivalent to:
|
|
4111
|
+
// i => this.#processed[i].mean > x ? -1 : 1,
|
|
4112
|
+
(i) => x - this.#processed[i].mean || 1
|
|
4113
|
+
);
|
|
4114
|
+
const z1 = x - this.#processed[upper - 1].mean;
|
|
4115
|
+
const z2 = this.#processed[upper].mean - x;
|
|
4116
|
+
return weightedAverage(
|
|
4117
|
+
this.#cumulative[upper - 1],
|
|
4118
|
+
z2,
|
|
4119
|
+
this.#cumulative[upper],
|
|
4120
|
+
z1
|
|
4121
|
+
) / this.#processedWeight;
|
|
4122
|
+
}
|
|
4123
|
+
#integratedQ(k) {
|
|
4124
|
+
return (Math.sin(
|
|
4125
|
+
Math.min(k, this.compression) * Math.PI / this.compression - Math.PI / 2
|
|
4126
|
+
) + 1) / 2;
|
|
4127
|
+
}
|
|
4128
|
+
#integratedLocation(q) {
|
|
4129
|
+
return this.compression * (Math.asin(2 * q - 1) + Math.PI / 2) / Math.PI;
|
|
4130
|
+
}
|
|
4131
|
+
};
|
|
4132
|
+
function weightedAverage(x1, w1, x2, w2) {
|
|
4133
|
+
if (x1 <= x2) {
|
|
4134
|
+
return weightedAverageSorted(x1, w1, x2, w2);
|
|
4135
|
+
}
|
|
4136
|
+
return weightedAverageSorted(x2, w2, x1, w1);
|
|
4137
|
+
}
|
|
4138
|
+
function weightedAverageSorted(x1, w1, x2, w2) {
|
|
4139
|
+
const x = (x1 * w1 + x2 * w2) / (w1 + w2);
|
|
4140
|
+
return Math.max(x1, Math.min(x, x2));
|
|
4141
|
+
}
|
|
4142
|
+
function processedSize(size, compression) {
|
|
4143
|
+
if (size === 0) {
|
|
4144
|
+
return Math.ceil(compression) * 2;
|
|
4145
|
+
}
|
|
4146
|
+
return size;
|
|
4147
|
+
}
|
|
4148
|
+
function unprocessedSize(size, compression) {
|
|
4149
|
+
if (size === 0) {
|
|
4150
|
+
return Math.ceil(compression) * 8;
|
|
4151
|
+
}
|
|
4152
|
+
return size;
|
|
4153
|
+
}
|
|
4154
|
+
|
|
3972
4155
|
// ../zero-schema/src/table-schema.ts
|
|
3973
4156
|
function isOneHop(r) {
|
|
3974
4157
|
return r.length === 1;
|
|
@@ -5704,8 +5887,8 @@ var negateOperatorMap = {
|
|
|
5704
5887
|
function negateOperator(op) {
|
|
5705
5888
|
return must(negateOperatorMap[op]);
|
|
5706
5889
|
}
|
|
5707
|
-
function filterUndefined(
|
|
5708
|
-
return
|
|
5890
|
+
function filterUndefined(array6) {
|
|
5891
|
+
return array6.filter((e) => e !== void 0);
|
|
5709
5892
|
}
|
|
5710
5893
|
function filterTrue(conditions) {
|
|
5711
5894
|
return conditions.filter((c) => !isAlwaysTrue(c));
|
|
@@ -5909,14 +6092,15 @@ function transformFilters(filters) {
|
|
|
5909
6092
|
}
|
|
5910
6093
|
|
|
5911
6094
|
// ../zql/src/builder/builder.ts
|
|
5912
|
-
function buildPipeline(ast, delegate) {
|
|
6095
|
+
function buildPipeline(ast, delegate, queryID) {
|
|
5913
6096
|
return buildPipelineInternal(
|
|
5914
6097
|
delegate.mapAst ? delegate.mapAst(ast) : ast,
|
|
5915
6098
|
delegate,
|
|
6099
|
+
queryID,
|
|
5916
6100
|
""
|
|
5917
6101
|
);
|
|
5918
6102
|
}
|
|
5919
|
-
function buildPipelineInternal(ast, delegate, name, partitionKey) {
|
|
6103
|
+
function buildPipelineInternal(ast, delegate, queryID, name, partitionKey) {
|
|
5920
6104
|
const source = delegate.getSource(ast.table);
|
|
5921
6105
|
if (!source) {
|
|
5922
6106
|
throw new Error(`Source not found: ${ast.table}`);
|
|
@@ -5941,13 +6125,14 @@ function buildPipelineInternal(ast, delegate, name, partitionKey) {
|
|
|
5941
6125
|
}
|
|
5942
6126
|
}
|
|
5943
6127
|
const conn = source.connect(must(ast.orderBy), ast.where, splitEditKeys);
|
|
5944
|
-
let end = delegate.
|
|
6128
|
+
let end = delegate.decorateSourceInput(conn, queryID);
|
|
6129
|
+
end = delegate.decorateInput(end, `${name}:source(${ast.table})`);
|
|
5945
6130
|
const { fullyAppliedFilters } = conn;
|
|
5946
6131
|
if (ast.start) {
|
|
5947
6132
|
end = delegate.decorateInput(new Skip(end, ast.start), `${name}:skip)`);
|
|
5948
6133
|
}
|
|
5949
6134
|
for (const csq of csqsFromCondition) {
|
|
5950
|
-
end = applyCorrelatedSubQuery(csq, delegate, end, name, true);
|
|
6135
|
+
end = applyCorrelatedSubQuery(csq, delegate, queryID, end, name, true);
|
|
5951
6136
|
}
|
|
5952
6137
|
if (ast.where && !fullyAppliedFilters) {
|
|
5953
6138
|
end = applyWhere(end, ast.where, delegate, name);
|
|
@@ -5961,7 +6146,7 @@ function buildPipelineInternal(ast, delegate, name, partitionKey) {
|
|
|
5961
6146
|
}
|
|
5962
6147
|
if (ast.related) {
|
|
5963
6148
|
for (const csq of ast.related) {
|
|
5964
|
-
end = applyCorrelatedSubQuery(csq, delegate, end, name, false);
|
|
6149
|
+
end = applyCorrelatedSubQuery(csq, delegate, queryID, end, name, false);
|
|
5965
6150
|
}
|
|
5966
6151
|
}
|
|
5967
6152
|
return end;
|
|
@@ -6043,7 +6228,7 @@ function isNotAndDoesNotContainSubquery(condition) {
|
|
|
6043
6228
|
function applySimpleCondition(input, condition) {
|
|
6044
6229
|
return new Filter(input, createPredicate(condition));
|
|
6045
6230
|
}
|
|
6046
|
-
function applyCorrelatedSubQuery(sq, delegate, end, name, fromCondition) {
|
|
6231
|
+
function applyCorrelatedSubQuery(sq, delegate, queryID, end, name, fromCondition) {
|
|
6047
6232
|
if (sq.subquery.limit === 0 && fromCondition) {
|
|
6048
6233
|
return end;
|
|
6049
6234
|
}
|
|
@@ -6051,6 +6236,7 @@ function applyCorrelatedSubQuery(sq, delegate, end, name, fromCondition) {
|
|
|
6051
6236
|
const child = buildPipelineInternal(
|
|
6052
6237
|
sq.subquery,
|
|
6053
6238
|
delegate,
|
|
6239
|
+
queryID,
|
|
6054
6240
|
`${name}.${sq.subquery.alias}`,
|
|
6055
6241
|
sq.correlation.childField
|
|
6056
6242
|
);
|
|
@@ -6795,7 +6981,6 @@ var QueryImpl = class _QueryImpl extends AbstractQuery {
|
|
|
6795
6981
|
this._delegate,
|
|
6796
6982
|
"materialize requires a query delegate to be set"
|
|
6797
6983
|
);
|
|
6798
|
-
const t0 = Date.now();
|
|
6799
6984
|
let factory;
|
|
6800
6985
|
if (typeof factoryOrTTL === "function") {
|
|
6801
6986
|
factory = factoryOrTTL;
|
|
@@ -6803,27 +6988,33 @@ var QueryImpl = class _QueryImpl extends AbstractQuery {
|
|
|
6803
6988
|
ttl = factoryOrTTL ?? DEFAULT_TTL_MS;
|
|
6804
6989
|
}
|
|
6805
6990
|
const ast = this._completeAst();
|
|
6991
|
+
const queryID = this.customQueryID ? hashOfNameAndArgs(this.customQueryID.name, this.customQueryID.args) : this.hash();
|
|
6806
6992
|
const queryCompleteResolver = resolver();
|
|
6807
6993
|
let queryComplete = delegate.defaultQueryComplete;
|
|
6994
|
+
const updateTTL = (newTTL) => {
|
|
6995
|
+
this.customQueryID ? delegate.updateCustomQuery(this.customQueryID, newTTL) : delegate.updateServerQuery(ast, newTTL);
|
|
6996
|
+
};
|
|
6808
6997
|
const gotCallback = (got) => {
|
|
6809
6998
|
if (got) {
|
|
6810
|
-
|
|
6811
|
-
|
|
6999
|
+
delegate.addMetric(
|
|
7000
|
+
"query-materialization-end-to-end",
|
|
7001
|
+
performance.now() - t0,
|
|
7002
|
+
queryID,
|
|
7003
|
+
ast
|
|
7004
|
+
);
|
|
6812
7005
|
queryComplete = true;
|
|
6813
7006
|
queryCompleteResolver.resolve(true);
|
|
6814
7007
|
}
|
|
6815
7008
|
};
|
|
6816
|
-
const removeServerQuery = this.customQueryID ? delegate.addCustomQuery(this.customQueryID, ttl, gotCallback) : delegate.addServerQuery(ast, ttl, gotCallback);
|
|
6817
|
-
const updateTTL = (newTTL) => {
|
|
6818
|
-
this.customQueryID ? delegate.updateCustomQuery(this.customQueryID, newTTL) : delegate.updateServerQuery(ast, newTTL);
|
|
6819
|
-
};
|
|
6820
|
-
const input = buildPipeline(ast, delegate);
|
|
6821
7009
|
let removeCommitObserver;
|
|
6822
7010
|
const onDestroy = () => {
|
|
6823
7011
|
input.destroy();
|
|
6824
7012
|
removeCommitObserver?.();
|
|
6825
|
-
|
|
7013
|
+
removeAddedQuery();
|
|
6826
7014
|
};
|
|
7015
|
+
const t0 = performance.now();
|
|
7016
|
+
const removeAddedQuery = this.customQueryID ? delegate.addCustomQuery(this.customQueryID, ttl, gotCallback) : delegate.addServerQuery(ast, ttl, gotCallback);
|
|
7017
|
+
const input = buildPipeline(ast, delegate, queryID);
|
|
6827
7018
|
const view = delegate.batchViewUpdates(
|
|
6828
7019
|
() => (factory ?? arrayViewFactory)(
|
|
6829
7020
|
this,
|
|
@@ -6837,6 +7028,11 @@ var QueryImpl = class _QueryImpl extends AbstractQuery {
|
|
|
6837
7028
|
updateTTL
|
|
6838
7029
|
)
|
|
6839
7030
|
);
|
|
7031
|
+
delegate.addMetric(
|
|
7032
|
+
"query-materialization-client",
|
|
7033
|
+
performance.now() - t0,
|
|
7034
|
+
queryID
|
|
7035
|
+
);
|
|
6840
7036
|
return view;
|
|
6841
7037
|
}
|
|
6842
7038
|
run(options) {
|
|
@@ -6930,23 +7126,12 @@ function isCompoundKey(field) {
|
|
|
6930
7126
|
}
|
|
6931
7127
|
|
|
6932
7128
|
export {
|
|
6933
|
-
assert,
|
|
6934
|
-
assertString,
|
|
6935
|
-
assertNumber,
|
|
6936
|
-
assertObject,
|
|
6937
|
-
assertArray,
|
|
6938
|
-
assertNotNull,
|
|
6939
|
-
unreachable,
|
|
6940
|
-
isProd,
|
|
6941
|
-
hasOwn,
|
|
6942
7129
|
deepEqual,
|
|
6943
7130
|
assertJSONValue,
|
|
6944
7131
|
assertJSONObject,
|
|
6945
7132
|
stringCompare,
|
|
6946
7133
|
compareCookies,
|
|
6947
7134
|
assertCookie,
|
|
6948
|
-
deepFreeze,
|
|
6949
|
-
deepFreezeAllowUndefined,
|
|
6950
7135
|
parse,
|
|
6951
7136
|
test,
|
|
6952
7137
|
readonly,
|
|
@@ -7037,11 +7222,15 @@ export {
|
|
|
7037
7222
|
mapAST,
|
|
7038
7223
|
mapCondition,
|
|
7039
7224
|
h64,
|
|
7225
|
+
mapValues,
|
|
7226
|
+
mapEntries,
|
|
7227
|
+
mapAllEntries,
|
|
7040
7228
|
hashOfAST,
|
|
7041
7229
|
hashOfNameAndArgs,
|
|
7042
7230
|
compareValues,
|
|
7043
7231
|
makeComparator,
|
|
7044
7232
|
valuesEqual,
|
|
7233
|
+
throwOutput,
|
|
7045
7234
|
filterPush,
|
|
7046
7235
|
ExpressionBuilder,
|
|
7047
7236
|
createPredicate,
|
|
@@ -7060,6 +7249,8 @@ export {
|
|
|
7060
7249
|
newQuerySymbol,
|
|
7061
7250
|
AbstractQuery,
|
|
7062
7251
|
inspectQueriesDownSchema,
|
|
7252
|
+
inspectMetricsDownSchema,
|
|
7253
|
+
inspectVersionDownSchema,
|
|
7063
7254
|
inspectDownMessageSchema,
|
|
7064
7255
|
primaryKeySchema,
|
|
7065
7256
|
primaryKeyValueRecordSchema,
|
|
@@ -7072,6 +7263,7 @@ export {
|
|
|
7072
7263
|
toGotQueriesKey,
|
|
7073
7264
|
toMutationResponseKey,
|
|
7074
7265
|
toPrimaryKeyString,
|
|
7075
|
-
sourceNameFromKey
|
|
7266
|
+
sourceNameFromKey,
|
|
7267
|
+
TDigest
|
|
7076
7268
|
};
|
|
7077
|
-
//# sourceMappingURL=chunk-
|
|
7269
|
+
//# sourceMappingURL=chunk-O536GEIT.js.map
|