@rocicorp/zero 0.20.2025051200 → 0.20.2025051301
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 +3 -0
- package/out/analyze-query/src/bin-analyze.js.map +1 -1
- package/out/{chunk-N44AEZOH.js → chunk-VUNJ4EVY.js} +43 -3
- package/out/chunk-VUNJ4EVY.js.map +7 -0
- package/out/{chunk-FQVNXKQI.js → chunk-WPG5C4ZQ.js} +43 -39
- package/out/chunk-WPG5C4ZQ.js.map +7 -0
- package/out/{chunk-EBZYAQDK.js → chunk-ZKX3QQMT.js} +186 -211
- package/out/chunk-ZKX3QQMT.js.map +7 -0
- package/out/{inspector-GCX7QH7K.js → inspector-DW7VIQTY.js} +3 -3
- package/out/otel/src/log-options.d.ts +1 -1
- package/out/otel/src/log-options.d.ts.map +1 -1
- package/out/otel/src/log-options.js +3 -5
- package/out/otel/src/log-options.js.map +1 -1
- package/out/react.js +1 -1
- package/out/shared/src/valita.d.ts +2 -0
- package/out/shared/src/valita.d.ts.map +1 -1
- package/out/shared/src/valita.js +3 -0
- package/out/shared/src/valita.js.map +1 -1
- package/out/solid.js +3 -3
- package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js +1 -0
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/network.d.ts.map +1 -1
- package/out/zero-cache/src/config/network.js +6 -1
- package/out/zero-cache/src/config/network.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +3 -7
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/db/specs.d.ts +3 -3
- package/out/zero-cache/src/db/specs.d.ts.map +1 -1
- package/out/zero-cache/src/db/specs.js +3 -3
- package/out/zero-cache/src/db/specs.js.map +1 -1
- package/out/zero-cache/src/db/transaction-pool.d.ts +19 -1
- package/out/zero-cache/src/db/transaction-pool.d.ts.map +1 -1
- package/out/zero-cache/src/db/transaction-pool.js +125 -86
- package/out/zero-cache/src/db/transaction-pool.js.map +1 -1
- package/out/zero-cache/src/scripts/permissions.d.ts +1 -1
- package/out/zero-cache/src/scripts/permissions.d.ts.map +1 -1
- package/out/zero-cache/src/scripts/permissions.js +2 -4
- package/out/zero-cache/src/scripts/permissions.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js +7 -7
- package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/data.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/data.js +2 -2
- package/out/zero-cache/src/services/change-source/protocol/current/data.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-service.js +5 -2
- package/out/zero-cache/src/services/change-streamer/change-streamer-service.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/storer.js +9 -3
- package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/change-log.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/change-log.js +1 -1
- package/out/zero-cache/src/services/replicator/schema/change-log.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 +1 -0
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +14 -14
- package/out/zero-cache/src/services/view-syncer/schema/types.js +2 -2
- package/out/zero-cache/src/services/view-syncer/schema/types.js.map +1 -1
- package/out/zero-cache/src/workers/replicator.d.ts +1 -1
- package/out/zero-cache/src/workers/replicator.d.ts.map +1 -1
- package/out/zero-cache/src/workers/replicator.js +1 -1
- package/out/zero-cache/src/workers/replicator.js.map +1 -1
- package/out/zero-client/src/client/context.d.ts +2 -0
- package/out/zero-client/src/client/context.d.ts.map +1 -1
- package/out/zero-protocol/src/ast.d.ts +6 -6
- package/out/zero-protocol/src/ast.d.ts.map +1 -1
- package/out/zero-protocol/src/ast.js +8 -10
- package/out/zero-protocol/src/ast.js.map +1 -1
- package/out/zero-protocol/src/client-schema.js +1 -1
- package/out/zero-protocol/src/client-schema.js.map +1 -1
- package/out/zero-protocol/src/down.d.ts +1 -1
- package/out/zero-protocol/src/error.d.ts +3 -3
- package/out/zero-protocol/src/error.js +2 -2
- package/out/zero-protocol/src/error.js.map +1 -1
- package/out/zero-protocol/src/push.d.ts +6 -6
- package/out/zero-protocol/src/push.js +1 -1
- package/out/zero-protocol/src/push.js.map +1 -1
- package/out/zero-schema/src/schema-config.js +1 -1
- package/out/zero-schema/src/schema-config.js.map +1 -1
- package/out/zero.js +3 -3
- package/out/zql/src/builder/builder.d.ts +3 -1
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +7 -3
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/ivm/exists.d.ts +6 -6
- package/out/zql/src/ivm/exists.d.ts.map +1 -1
- package/out/zql/src/ivm/exists.js +14 -23
- package/out/zql/src/ivm/exists.js.map +1 -1
- package/out/zql/src/ivm/fan-in.d.ts +6 -8
- package/out/zql/src/ivm/fan-in.d.ts.map +1 -1
- package/out/zql/src/ivm/fan-in.js +8 -16
- package/out/zql/src/ivm/fan-in.js.map +1 -1
- package/out/zql/src/ivm/fan-out.d.ts +6 -6
- package/out/zql/src/ivm/fan-out.d.ts.map +1 -1
- package/out/zql/src/ivm/fan-out.js +13 -7
- package/out/zql/src/ivm/fan-out.js.map +1 -1
- package/out/zql/src/ivm/filter-operators.d.ts +61 -0
- package/out/zql/src/ivm/filter-operators.d.ts.map +1 -0
- package/out/zql/src/ivm/filter-operators.js +91 -0
- package/out/zql/src/ivm/filter-operators.js.map +1 -0
- package/out/zql/src/ivm/filter.d.ts +6 -6
- package/out/zql/src/ivm/filter.d.ts.map +1 -1
- package/out/zql/src/ivm/filter.js +8 -22
- package/out/zql/src/ivm/filter.js.map +1 -1
- package/out/zql/src/ivm/operator.d.ts +11 -9
- package/out/zql/src/ivm/operator.d.ts.map +1 -1
- package/out/zql/src/ivm/operator.js.map +1 -1
- package/out/zql/src/query/query-impl.d.ts +8 -8
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.js +25 -33
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/package.json +1 -1
- package/out/chunk-EBZYAQDK.js.map +0 -7
- package/out/chunk-FQVNXKQI.js.map +0 -7
- package/out/chunk-N44AEZOH.js.map +0 -7
- /package/out/{inspector-GCX7QH7K.js.map → inspector-DW7VIQTY.js.map} +0 -0
|
@@ -21,6 +21,7 @@ __export(valita_exports, {
|
|
|
21
21
|
deepPartial: () => deepPartial,
|
|
22
22
|
instanceOfAbstractType: () => instanceOfAbstractType,
|
|
23
23
|
is: () => is,
|
|
24
|
+
literalUnion: () => literalUnion,
|
|
24
25
|
parse: () => parse,
|
|
25
26
|
readonly: () => readonly,
|
|
26
27
|
readonlyArray: () => readonlyArray,
|
|
@@ -222,6 +223,9 @@ function deepPartial(s) {
|
|
|
222
223
|
}
|
|
223
224
|
return v.object(shape);
|
|
224
225
|
}
|
|
226
|
+
function literalUnion(...literals) {
|
|
227
|
+
return v.union(...literals.map(v.literal));
|
|
228
|
+
}
|
|
225
229
|
|
|
226
230
|
// ../zql/src/query/ttl.ts
|
|
227
231
|
var DEFAULT_TTL = "none";
|
|
@@ -495,7 +499,7 @@ var rowSchema = readonlyRecord(valueSchema);
|
|
|
495
499
|
var selectorSchema = valita_exports.string();
|
|
496
500
|
var toStaticParam = Symbol();
|
|
497
501
|
var orderingElementSchema = readonly(
|
|
498
|
-
valita_exports.tuple([selectorSchema,
|
|
502
|
+
valita_exports.tuple([selectorSchema, literalUnion("asc", "desc")])
|
|
499
503
|
);
|
|
500
504
|
var orderingSchema = readonlyArray(orderingElementSchema);
|
|
501
505
|
var primitiveSchema = valita_exports.union(
|
|
@@ -504,25 +508,15 @@ var primitiveSchema = valita_exports.union(
|
|
|
504
508
|
valita_exports.boolean(),
|
|
505
509
|
valita_exports.null()
|
|
506
510
|
);
|
|
507
|
-
var equalityOpsSchema =
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
valita_exports.literal("<"),
|
|
515
|
-
valita_exports.literal(">"),
|
|
516
|
-
valita_exports.literal("<="),
|
|
517
|
-
valita_exports.literal(">=")
|
|
518
|
-
);
|
|
519
|
-
var likeOpsSchema = valita_exports.union(
|
|
520
|
-
valita_exports.literal("LIKE"),
|
|
521
|
-
valita_exports.literal("NOT LIKE"),
|
|
522
|
-
valita_exports.literal("ILIKE"),
|
|
523
|
-
valita_exports.literal("NOT ILIKE")
|
|
511
|
+
var equalityOpsSchema = literalUnion("=", "!=", "IS", "IS NOT");
|
|
512
|
+
var orderOpsSchema = literalUnion("<", ">", "<=", ">=");
|
|
513
|
+
var likeOpsSchema = literalUnion(
|
|
514
|
+
"LIKE",
|
|
515
|
+
"NOT LIKE",
|
|
516
|
+
"ILIKE",
|
|
517
|
+
"NOT ILIKE"
|
|
524
518
|
);
|
|
525
|
-
var inOpsSchema =
|
|
519
|
+
var inOpsSchema = literalUnion("IN", "NOT IN");
|
|
526
520
|
var simpleOperatorSchema = valita_exports.union(
|
|
527
521
|
equalityOpsSchema,
|
|
528
522
|
orderOpsSchema,
|
|
@@ -550,7 +544,7 @@ var parameterReferenceSchema = readonlyObject({
|
|
|
550
544
|
// prior to the mutation being run (preMutationRow).
|
|
551
545
|
// Read and write authorization will both send the
|
|
552
546
|
// current authentication data (authData).
|
|
553
|
-
anchor:
|
|
547
|
+
anchor: literalUnion("authData", "preMutationRow"),
|
|
554
548
|
field: valita_exports.union(valita_exports.string(), valita_exports.array(valita_exports.string()))
|
|
555
549
|
});
|
|
556
550
|
var conditionValueSchema = valita_exports.union(
|
|
@@ -564,7 +558,7 @@ var simpleConditionSchema = readonlyObject({
|
|
|
564
558
|
left: conditionValueSchema,
|
|
565
559
|
right: valita_exports.union(parameterReferenceSchema, literalReferenceSchema)
|
|
566
560
|
});
|
|
567
|
-
var correlatedSubqueryConditionOperatorSchema =
|
|
561
|
+
var correlatedSubqueryConditionOperatorSchema = literalUnion("EXISTS", "NOT EXISTS");
|
|
568
562
|
var correlatedSubqueryConditionSchema = readonlyObject({
|
|
569
563
|
type: valita_exports.literal("correlatedSubquery"),
|
|
570
564
|
related: valita_exports.lazy(() => correlatedSubquerySchema),
|
|
@@ -598,7 +592,7 @@ var correlationSchema = readonlyObject({
|
|
|
598
592
|
var correlatedSubquerySchemaOmitSubquery = readonlyObject({
|
|
599
593
|
correlation: correlationSchema,
|
|
600
594
|
hidden: valita_exports.boolean().optional(),
|
|
601
|
-
system:
|
|
595
|
+
system: literalUnion("permissions", "client", "test").optional()
|
|
602
596
|
});
|
|
603
597
|
var correlatedSubquerySchema = correlatedSubquerySchemaOmitSubquery.extend({
|
|
604
598
|
subquery: valita_exports.lazy(() => astSchema)
|
|
@@ -832,6 +826,91 @@ function hashOfAST(ast) {
|
|
|
832
826
|
return hash2;
|
|
833
827
|
}
|
|
834
828
|
|
|
829
|
+
// ../zql/src/ivm/filter-operators.ts
|
|
830
|
+
var throwFilterOutput = {
|
|
831
|
+
push(_change) {
|
|
832
|
+
throw new Error("Output not set");
|
|
833
|
+
},
|
|
834
|
+
filter(_node, _cleanup) {
|
|
835
|
+
throw new Error("Output not set");
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
var FilterStart = class {
|
|
839
|
+
#input;
|
|
840
|
+
#output = throwFilterOutput;
|
|
841
|
+
constructor(input) {
|
|
842
|
+
this.#input = input;
|
|
843
|
+
input.setOutput(this);
|
|
844
|
+
}
|
|
845
|
+
setFilterOutput(output) {
|
|
846
|
+
this.#output = output;
|
|
847
|
+
}
|
|
848
|
+
destroy() {
|
|
849
|
+
this.#input.destroy();
|
|
850
|
+
}
|
|
851
|
+
getSchema() {
|
|
852
|
+
return this.#input.getSchema();
|
|
853
|
+
}
|
|
854
|
+
push(change) {
|
|
855
|
+
this.#output.push(change);
|
|
856
|
+
}
|
|
857
|
+
*fetch(req) {
|
|
858
|
+
for (const node of this.#input.fetch(req)) {
|
|
859
|
+
if (this.#output.filter(node, false)) {
|
|
860
|
+
yield node;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
*cleanup(req) {
|
|
865
|
+
for (const node of this.#input.cleanup(req)) {
|
|
866
|
+
if (this.#output.filter(node, true)) {
|
|
867
|
+
yield node;
|
|
868
|
+
} else {
|
|
869
|
+
drainStreams(node);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
var FilterEnd = class {
|
|
875
|
+
#start;
|
|
876
|
+
#input;
|
|
877
|
+
#output = throwFilterOutput;
|
|
878
|
+
constructor(start, input) {
|
|
879
|
+
this.#start = start;
|
|
880
|
+
this.#input = input;
|
|
881
|
+
input.setFilterOutput(this);
|
|
882
|
+
}
|
|
883
|
+
*fetch(req) {
|
|
884
|
+
for (const node of this.#start.fetch(req)) {
|
|
885
|
+
yield node;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
*cleanup(req) {
|
|
889
|
+
for (const node of this.#start.cleanup(req)) {
|
|
890
|
+
yield node;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
filter(_node, _cleanup) {
|
|
894
|
+
return true;
|
|
895
|
+
}
|
|
896
|
+
setOutput(output) {
|
|
897
|
+
this.#output = output;
|
|
898
|
+
}
|
|
899
|
+
destroy() {
|
|
900
|
+
this.#input.destroy();
|
|
901
|
+
}
|
|
902
|
+
getSchema() {
|
|
903
|
+
return this.#input.getSchema();
|
|
904
|
+
}
|
|
905
|
+
push(change) {
|
|
906
|
+
this.#output.push(change);
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
function buildFilterPipeline(input, pipeline) {
|
|
910
|
+
const filterStart = new FilterStart(input);
|
|
911
|
+
return new FilterEnd(filterStart, pipeline(filterStart));
|
|
912
|
+
}
|
|
913
|
+
|
|
835
914
|
// ../zql/src/ivm/operator.ts
|
|
836
915
|
var throwOutput = {
|
|
837
916
|
push(_change) {
|
|
@@ -867,7 +946,7 @@ var Exists = class {
|
|
|
867
946
|
#not;
|
|
868
947
|
#parentJoinKey;
|
|
869
948
|
#noSizeReuse;
|
|
870
|
-
#output =
|
|
949
|
+
#output = throwFilterOutput;
|
|
871
950
|
/**
|
|
872
951
|
* This instance variable is `true` when this operator is processing a `push`,
|
|
873
952
|
* and is used to disable reuse of cached sizes across rows with the
|
|
@@ -880,7 +959,7 @@ var Exists = class {
|
|
|
880
959
|
constructor(input, storage, relationshipName, parentJoinKey, type) {
|
|
881
960
|
this.#input = input;
|
|
882
961
|
this.#relationshipName = relationshipName;
|
|
883
|
-
this.#input.
|
|
962
|
+
this.#input.setFilterOutput(this);
|
|
884
963
|
this.#storage = storage;
|
|
885
964
|
assert(
|
|
886
965
|
this.#input.getSchema().relationships[relationshipName],
|
|
@@ -893,33 +972,24 @@ var Exists = class {
|
|
|
893
972
|
this.#input.getSchema().primaryKey
|
|
894
973
|
);
|
|
895
974
|
}
|
|
896
|
-
|
|
975
|
+
setFilterOutput(output) {
|
|
897
976
|
this.#output = output;
|
|
898
977
|
}
|
|
978
|
+
filter(node, cleanup) {
|
|
979
|
+
const result = this.#filter(node) && this.#output.filter(node, cleanup);
|
|
980
|
+
if (cleanup) {
|
|
981
|
+
this.#delSize(node);
|
|
982
|
+
}
|
|
983
|
+
return result;
|
|
984
|
+
}
|
|
899
985
|
destroy() {
|
|
900
986
|
this.#input.destroy();
|
|
901
987
|
}
|
|
902
988
|
getSchema() {
|
|
903
989
|
return this.#input.getSchema();
|
|
904
990
|
}
|
|
905
|
-
*fetch(req) {
|
|
906
|
-
for (const node of this.#input.fetch(req)) {
|
|
907
|
-
if (this.#filter(node)) {
|
|
908
|
-
yield node;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
*cleanup(req) {
|
|
913
|
-
for (const node of this.#input.cleanup(req)) {
|
|
914
|
-
if (this.#filter(node)) {
|
|
915
|
-
yield node;
|
|
916
|
-
} else {
|
|
917
|
-
drainStreams(node);
|
|
918
|
-
}
|
|
919
|
-
this.#delSize(node);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
991
|
push(change) {
|
|
992
|
+
assert(!this.#inPush, "Unexpected re-entrancy");
|
|
923
993
|
this.#inPush = true;
|
|
924
994
|
try {
|
|
925
995
|
switch (change.type) {
|
|
@@ -1094,93 +1164,21 @@ var Exists = class {
|
|
|
1094
1164
|
}
|
|
1095
1165
|
};
|
|
1096
1166
|
|
|
1097
|
-
// ../shared/src/iterables.ts
|
|
1098
|
-
function* joinIterables(...iters) {
|
|
1099
|
-
for (const iter of iters) {
|
|
1100
|
-
yield* iter;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
function* filterIter(iter, p) {
|
|
1104
|
-
let index = 0;
|
|
1105
|
-
for (const t of iter) {
|
|
1106
|
-
if (p(t, index++)) {
|
|
1107
|
-
yield t;
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
function* mapIter(iter, f) {
|
|
1112
|
-
let index = 0;
|
|
1113
|
-
for (const t of iter) {
|
|
1114
|
-
yield f(t, index++);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
var IterWrapper = class _IterWrapper {
|
|
1118
|
-
iter;
|
|
1119
|
-
constructor(iter) {
|
|
1120
|
-
this.iter = iter;
|
|
1121
|
-
}
|
|
1122
|
-
[Symbol.iterator]() {
|
|
1123
|
-
return this.iter[Symbol.iterator]();
|
|
1124
|
-
}
|
|
1125
|
-
map(f) {
|
|
1126
|
-
return new _IterWrapper(mapIter(this.iter, f));
|
|
1127
|
-
}
|
|
1128
|
-
filter(p) {
|
|
1129
|
-
return new _IterWrapper(filterIter(this.iter, p));
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
function wrapIterable(iter) {
|
|
1133
|
-
return new IterWrapper(iter);
|
|
1134
|
-
}
|
|
1135
|
-
function* mergeIterables(iterables, comparator, distinct = false) {
|
|
1136
|
-
const iterators = iterables.map((i) => i[Symbol.iterator]());
|
|
1137
|
-
try {
|
|
1138
|
-
const current = iterators.map((i) => i.next());
|
|
1139
|
-
let lastYielded;
|
|
1140
|
-
while (current.some((c) => !c.done)) {
|
|
1141
|
-
const min = current.reduce(
|
|
1142
|
-
(acc, c, i) => {
|
|
1143
|
-
if (c.done) {
|
|
1144
|
-
return acc;
|
|
1145
|
-
}
|
|
1146
|
-
if (acc === void 0 || comparator(c.value, acc[0]) < 0) {
|
|
1147
|
-
return [c.value, i];
|
|
1148
|
-
}
|
|
1149
|
-
return acc;
|
|
1150
|
-
},
|
|
1151
|
-
void 0
|
|
1152
|
-
);
|
|
1153
|
-
assert(min !== void 0, "min is undefined");
|
|
1154
|
-
current[min[1]] = iterators[min[1]].next();
|
|
1155
|
-
if (lastYielded !== void 0 && distinct && comparator(lastYielded, min[0]) === 0) {
|
|
1156
|
-
continue;
|
|
1157
|
-
}
|
|
1158
|
-
lastYielded = min[0];
|
|
1159
|
-
yield min[0];
|
|
1160
|
-
}
|
|
1161
|
-
} finally {
|
|
1162
|
-
for (const it of iterators) {
|
|
1163
|
-
it.return?.();
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
1167
|
// ../zql/src/ivm/fan-in.ts
|
|
1169
1168
|
var FanIn = class {
|
|
1170
1169
|
#inputs;
|
|
1171
1170
|
#schema;
|
|
1172
|
-
#output =
|
|
1173
|
-
#accumulatedPushes;
|
|
1171
|
+
#output = throwFilterOutput;
|
|
1172
|
+
#accumulatedPushes = [];
|
|
1174
1173
|
constructor(fanOut, inputs) {
|
|
1175
1174
|
this.#inputs = inputs;
|
|
1176
1175
|
this.#schema = fanOut.getSchema();
|
|
1177
1176
|
for (const input of inputs) {
|
|
1178
|
-
input.
|
|
1177
|
+
input.setFilterOutput(this);
|
|
1179
1178
|
assert(this.#schema === input.getSchema(), `Schema mismatch in fan-in`);
|
|
1180
1179
|
}
|
|
1181
|
-
this.#accumulatedPushes = [];
|
|
1182
1180
|
}
|
|
1183
|
-
|
|
1181
|
+
setFilterOutput(output) {
|
|
1184
1182
|
this.#output = output;
|
|
1185
1183
|
}
|
|
1186
1184
|
destroy() {
|
|
@@ -1191,19 +1189,8 @@ var FanIn = class {
|
|
|
1191
1189
|
getSchema() {
|
|
1192
1190
|
return this.#schema;
|
|
1193
1191
|
}
|
|
1194
|
-
|
|
1195
|
-
return this.#
|
|
1196
|
-
}
|
|
1197
|
-
cleanup(req) {
|
|
1198
|
-
return this.#fetchOrCleanup((input) => input.cleanup(req));
|
|
1199
|
-
}
|
|
1200
|
-
*#fetchOrCleanup(streamProvider) {
|
|
1201
|
-
const iterables = this.#inputs.map((input) => streamProvider(input));
|
|
1202
|
-
yield* mergeIterables(
|
|
1203
|
-
iterables,
|
|
1204
|
-
(l, r) => must(this.#schema).compareRows(l.row, r.row),
|
|
1205
|
-
true
|
|
1206
|
-
);
|
|
1192
|
+
filter(node, cleanup) {
|
|
1193
|
+
return this.#output.filter(node, cleanup);
|
|
1207
1194
|
}
|
|
1208
1195
|
push(change) {
|
|
1209
1196
|
this.#accumulatedPushes.push(change);
|
|
@@ -1313,12 +1300,12 @@ var FanOut = class {
|
|
|
1313
1300
|
#destroyCount = 0;
|
|
1314
1301
|
constructor(input) {
|
|
1315
1302
|
this.#input = input;
|
|
1316
|
-
input.
|
|
1303
|
+
input.setFilterOutput(this);
|
|
1317
1304
|
}
|
|
1318
1305
|
setFanIn(fanIn) {
|
|
1319
1306
|
this.#fanIn = fanIn;
|
|
1320
1307
|
}
|
|
1321
|
-
|
|
1308
|
+
setFilterOutput(output) {
|
|
1322
1309
|
this.#outputs.push(output);
|
|
1323
1310
|
}
|
|
1324
1311
|
destroy() {
|
|
@@ -1334,11 +1321,15 @@ var FanOut = class {
|
|
|
1334
1321
|
getSchema() {
|
|
1335
1322
|
return this.#input.getSchema();
|
|
1336
1323
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1324
|
+
filter(node, cleanup) {
|
|
1325
|
+
let result = false;
|
|
1326
|
+
for (const output of this.#outputs) {
|
|
1327
|
+
result = output.filter(node, cleanup) || result;
|
|
1328
|
+
if (!cleanup && result) {
|
|
1329
|
+
return true;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
return result;
|
|
1342
1333
|
}
|
|
1343
1334
|
push(change) {
|
|
1344
1335
|
for (const out of this.#outputs) {
|
|
@@ -1400,13 +1391,16 @@ function filterPush(change, output, predicate) {
|
|
|
1400
1391
|
var Filter = class {
|
|
1401
1392
|
#input;
|
|
1402
1393
|
#predicate;
|
|
1403
|
-
#output =
|
|
1394
|
+
#output = throwFilterOutput;
|
|
1404
1395
|
constructor(input, predicate) {
|
|
1405
1396
|
this.#input = input;
|
|
1406
1397
|
this.#predicate = predicate;
|
|
1407
|
-
input.
|
|
1398
|
+
input.setFilterOutput(this);
|
|
1408
1399
|
}
|
|
1409
|
-
|
|
1400
|
+
filter(node, cleanup) {
|
|
1401
|
+
return this.#predicate(node.row) && this.#output.filter(node, cleanup);
|
|
1402
|
+
}
|
|
1403
|
+
setFilterOutput(output) {
|
|
1410
1404
|
this.#output = output;
|
|
1411
1405
|
}
|
|
1412
1406
|
destroy() {
|
|
@@ -1415,22 +1409,6 @@ var Filter = class {
|
|
|
1415
1409
|
getSchema() {
|
|
1416
1410
|
return this.#input.getSchema();
|
|
1417
1411
|
}
|
|
1418
|
-
*fetch(req) {
|
|
1419
|
-
for (const node of this.#input.fetch(req)) {
|
|
1420
|
-
if (this.#predicate(node.row)) {
|
|
1421
|
-
yield node;
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
*cleanup(req) {
|
|
1426
|
-
for (const node of this.#input.cleanup(req)) {
|
|
1427
|
-
if (this.#predicate(node.row)) {
|
|
1428
|
-
yield node;
|
|
1429
|
-
} else {
|
|
1430
|
-
drainStreams(node);
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
1412
|
push(change) {
|
|
1435
1413
|
filterPush(change, this.#output, this.#predicate);
|
|
1436
1414
|
}
|
|
@@ -2658,6 +2636,12 @@ function buildPipelineInternal(ast, delegate, name, partitionKey) {
|
|
|
2658
2636
|
return end;
|
|
2659
2637
|
}
|
|
2660
2638
|
function applyWhere(input, condition, delegate, name) {
|
|
2639
|
+
return buildFilterPipeline(
|
|
2640
|
+
input,
|
|
2641
|
+
(filterInput) => applyFilter(filterInput, condition, delegate, name)
|
|
2642
|
+
);
|
|
2643
|
+
}
|
|
2644
|
+
function applyFilter(input, condition, delegate, name) {
|
|
2661
2645
|
switch (condition.type) {
|
|
2662
2646
|
case "and":
|
|
2663
2647
|
return applyAnd(input, condition, delegate, name);
|
|
@@ -2671,7 +2655,7 @@ function applyWhere(input, condition, delegate, name) {
|
|
|
2671
2655
|
}
|
|
2672
2656
|
function applyAnd(input, condition, delegate, name) {
|
|
2673
2657
|
for (const subCondition of condition.conditions) {
|
|
2674
|
-
input =
|
|
2658
|
+
input = applyFilter(input, subCondition, delegate, name);
|
|
2675
2659
|
}
|
|
2676
2660
|
return input;
|
|
2677
2661
|
}
|
|
@@ -2688,7 +2672,7 @@ function applyOr(input, condition, delegate, name) {
|
|
|
2688
2672
|
}
|
|
2689
2673
|
const fanOut = new FanOut(input);
|
|
2690
2674
|
const branches = subqueryConditions.map(
|
|
2691
|
-
(subCondition) =>
|
|
2675
|
+
(subCondition) => applyFilter(fanOut, subCondition, delegate, name)
|
|
2692
2676
|
);
|
|
2693
2677
|
if (otherConditions.length > 0) {
|
|
2694
2678
|
branches.push(
|
|
@@ -2753,7 +2737,7 @@ function applyCorrelatedSubQuery(sq, delegate, end, name) {
|
|
|
2753
2737
|
function applyCorrelatedSubqueryCondition(input, condition, delegate, name) {
|
|
2754
2738
|
assert(condition.op === "EXISTS" || condition.op === "NOT EXISTS");
|
|
2755
2739
|
const existsName = `${name}:exists(${condition.related.subquery.alias})`;
|
|
2756
|
-
return delegate.
|
|
2740
|
+
return delegate.decorateFilterInput(
|
|
2757
2741
|
new Exists(
|
|
2758
2742
|
input,
|
|
2759
2743
|
delegate.createStorage(existsName),
|
|
@@ -3217,24 +3201,20 @@ var AbstractQuery = class {
|
|
|
3217
3201
|
}
|
|
3218
3202
|
return this.#hash;
|
|
3219
3203
|
}
|
|
3220
|
-
one()
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
whereExists(relationship, cb) {
|
|
3235
|
-
return this.where(({ exists }) => exists(relationship, cb));
|
|
3236
|
-
}
|
|
3237
|
-
related(relationship, cb) {
|
|
3204
|
+
one = () => this[newQuerySymbol](
|
|
3205
|
+
this.#schema,
|
|
3206
|
+
this.#tableName,
|
|
3207
|
+
{
|
|
3208
|
+
...this.#ast,
|
|
3209
|
+
limit: 1
|
|
3210
|
+
},
|
|
3211
|
+
{
|
|
3212
|
+
...this.format,
|
|
3213
|
+
singular: true
|
|
3214
|
+
}
|
|
3215
|
+
);
|
|
3216
|
+
whereExists = (relationship, cb) => this.where(({ exists }) => exists(relationship, cb));
|
|
3217
|
+
related = (relationship, cb) => {
|
|
3238
3218
|
if (relationship.startsWith(SUBQ_PREFIX)) {
|
|
3239
3219
|
throw new Error(
|
|
3240
3220
|
`Relationship names may not start with "${SUBQ_PREFIX}". That is a reserved prefix.`
|
|
@@ -3372,8 +3352,8 @@ var AbstractQuery = class {
|
|
|
3372
3352
|
);
|
|
3373
3353
|
}
|
|
3374
3354
|
throw new Error(`Invalid relationship ${relationship}`);
|
|
3375
|
-
}
|
|
3376
|
-
where(fieldOrExpressionFactory, opOrValue, value) {
|
|
3355
|
+
};
|
|
3356
|
+
where = (fieldOrExpressionFactory, opOrValue, value) => {
|
|
3377
3357
|
let cond;
|
|
3378
3358
|
if (typeof fieldOrExpressionFactory === "function") {
|
|
3379
3359
|
cond = fieldOrExpressionFactory(
|
|
@@ -3400,22 +3380,20 @@ var AbstractQuery = class {
|
|
|
3400
3380
|
},
|
|
3401
3381
|
this.format
|
|
3402
3382
|
);
|
|
3403
|
-
}
|
|
3404
|
-
start(row, opts)
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
}
|
|
3418
|
-
limit(limit) {
|
|
3383
|
+
};
|
|
3384
|
+
start = (row, opts) => this[newQuerySymbol](
|
|
3385
|
+
this.#schema,
|
|
3386
|
+
this.#tableName,
|
|
3387
|
+
{
|
|
3388
|
+
...this.#ast,
|
|
3389
|
+
start: {
|
|
3390
|
+
row,
|
|
3391
|
+
exclusive: !opts?.inclusive
|
|
3392
|
+
}
|
|
3393
|
+
},
|
|
3394
|
+
this.format
|
|
3395
|
+
);
|
|
3396
|
+
limit = (limit) => {
|
|
3419
3397
|
if (limit < 0) {
|
|
3420
3398
|
throw new Error("Limit must be non-negative");
|
|
3421
3399
|
}
|
|
@@ -3431,18 +3409,16 @@ var AbstractQuery = class {
|
|
|
3431
3409
|
},
|
|
3432
3410
|
this.format
|
|
3433
3411
|
);
|
|
3434
|
-
}
|
|
3435
|
-
orderBy(field, direction)
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
);
|
|
3445
|
-
}
|
|
3412
|
+
};
|
|
3413
|
+
orderBy = (field, direction) => this[newQuerySymbol](
|
|
3414
|
+
this.#schema,
|
|
3415
|
+
this.#tableName,
|
|
3416
|
+
{
|
|
3417
|
+
...this.#ast,
|
|
3418
|
+
orderBy: [...this.#ast.orderBy ?? [], [field, direction]]
|
|
3419
|
+
},
|
|
3420
|
+
this.format
|
|
3421
|
+
);
|
|
3446
3422
|
_exists = (relationship, cb = (q) => q) => {
|
|
3447
3423
|
const related = this.#schema.relationships[this.#tableName][relationship];
|
|
3448
3424
|
assert(related, "Invalid relationship");
|
|
@@ -3723,9 +3699,8 @@ export {
|
|
|
3723
3699
|
readonlyObject,
|
|
3724
3700
|
readonlyArray,
|
|
3725
3701
|
readonlyRecord,
|
|
3702
|
+
literalUnion,
|
|
3726
3703
|
valita_exports,
|
|
3727
|
-
joinIterables,
|
|
3728
|
-
wrapIterable,
|
|
3729
3704
|
jsonSchema,
|
|
3730
3705
|
jsonObjectSchema,
|
|
3731
3706
|
h64,
|
|
@@ -3753,4 +3728,4 @@ export {
|
|
|
3753
3728
|
newQuerySymbol,
|
|
3754
3729
|
AbstractQuery
|
|
3755
3730
|
};
|
|
3756
|
-
//# sourceMappingURL=chunk-
|
|
3731
|
+
//# sourceMappingURL=chunk-ZKX3QQMT.js.map
|