@rocicorp/zero 0.25.0-canary.13 → 0.25.0-canary.15
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/shared/src/record-proxy.d.ts +13 -0
- package/out/shared/src/record-proxy.d.ts.map +1 -0
- package/out/shared/src/record-proxy.js +59 -0
- package/out/shared/src/record-proxy.js.map +1 -0
- package/out/zero/package.json.js +1 -1
- package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js +20 -13
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +8 -0
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +12 -0
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/server/otel-start.d.ts.map +1 -1
- package/out/zero-cache/src/server/otel-start.js +1 -5
- package/out/zero-cache/src/server/otel-start.js.map +1 -1
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +6 -1
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +8 -9
- 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 +17 -11
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +2 -2
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.js +19 -4
- package/out/zero-cache/src/services/view-syncer/snapshotter.js.map +1 -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 +1 -7
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-client/src/client/crud.d.ts +3 -3
- package/out/zero-client/src/client/crud.d.ts.map +1 -1
- package/out/zero-client/src/client/crud.js +23 -13
- package/out/zero-client/src/client/crud.js.map +1 -1
- package/out/zero-client/src/client/custom.d.ts.map +1 -1
- package/out/zero-client/src/client/custom.js +4 -11
- package/out/zero-client/src/client/custom.js.map +1 -1
- package/out/zero-client/src/client/ivm-branch.d.ts.map +1 -1
- package/out/zero-client/src/client/ivm-branch.js +20 -13
- package/out/zero-client/src/client/ivm-branch.js.map +1 -1
- package/out/zero-client/src/client/make-mutate-property.d.ts +1 -1
- package/out/zero-client/src/client/make-mutate-property.d.ts.map +1 -1
- package/out/zero-client/src/client/make-mutate-property.js.map +1 -1
- package/out/zero-client/src/client/make-replicache-mutators.d.ts.map +1 -1
- package/out/zero-client/src/client/make-replicache-mutators.js +10 -6
- package/out/zero-client/src/client/make-replicache-mutators.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero.js +1 -1
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-server/src/custom.d.ts +2 -2
- package/out/zero-server/src/custom.d.ts.map +1 -1
- package/out/zero-server/src/custom.js +52 -32
- package/out/zero-server/src/custom.js.map +1 -1
- package/out/zero-server/src/zql-database.d.ts.map +1 -1
- package/out/zero-server/src/zql-database.js +1 -5
- package/out/zero-server/src/zql-database.js.map +1 -1
- package/out/zero-solid/src/solid-view.d.ts +1 -1
- package/out/zero-solid/src/solid-view.d.ts.map +1 -1
- package/out/zero-solid/src/solid-view.js +2 -0
- package/out/zero-solid/src/solid-view.js.map +1 -1
- package/out/zero-types/src/schema.d.ts +4 -4
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +1 -11
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/error.js +1 -10
- package/out/zql/src/error.js.map +1 -1
- package/out/zql/src/ivm/array-view.d.ts +1 -1
- package/out/zql/src/ivm/array-view.d.ts.map +1 -1
- package/out/zql/src/ivm/array-view.js +2 -0
- package/out/zql/src/ivm/array-view.js.map +1 -1
- package/out/zql/src/ivm/exists.d.ts +3 -2
- package/out/zql/src/ivm/exists.d.ts.map +1 -1
- package/out/zql/src/ivm/exists.js +25 -23
- package/out/zql/src/ivm/exists.js.map +1 -1
- package/out/zql/src/ivm/fan-in.d.ts +3 -3
- package/out/zql/src/ivm/fan-in.d.ts.map +1 -1
- package/out/zql/src/ivm/fan-in.js +6 -5
- package/out/zql/src/ivm/fan-in.js.map +1 -1
- package/out/zql/src/ivm/fan-out.d.ts +2 -2
- package/out/zql/src/ivm/fan-out.d.ts.map +1 -1
- package/out/zql/src/ivm/fan-out.js +5 -5
- package/out/zql/src/ivm/fan-out.js.map +1 -1
- package/out/zql/src/ivm/filter-operators.d.ts +5 -5
- package/out/zql/src/ivm/filter-operators.d.ts.map +1 -1
- package/out/zql/src/ivm/filter-operators.js +8 -8
- package/out/zql/src/ivm/filter-operators.js.map +1 -1
- package/out/zql/src/ivm/filter-push.d.ts +2 -1
- package/out/zql/src/ivm/filter-push.d.ts.map +1 -1
- package/out/zql/src/ivm/filter-push.js +5 -5
- package/out/zql/src/ivm/filter-push.js.map +1 -1
- package/out/zql/src/ivm/filter.d.ts +2 -2
- package/out/zql/src/ivm/filter.d.ts.map +1 -1
- package/out/zql/src/ivm/filter.js +4 -4
- package/out/zql/src/ivm/filter.js.map +1 -1
- package/out/zql/src/ivm/flipped-join.d.ts.map +1 -1
- package/out/zql/src/ivm/flipped-join.js +100 -83
- package/out/zql/src/ivm/flipped-join.js.map +1 -1
- package/out/zql/src/ivm/join.d.ts.map +1 -1
- package/out/zql/src/ivm/join.js +52 -50
- package/out/zql/src/ivm/join.js.map +1 -1
- package/out/zql/src/ivm/maybe-split-and-push-edit-change.d.ts +1 -1
- package/out/zql/src/ivm/maybe-split-and-push-edit-change.d.ts.map +1 -1
- package/out/zql/src/ivm/maybe-split-and-push-edit-change.js +4 -4
- package/out/zql/src/ivm/maybe-split-and-push-edit-change.js.map +1 -1
- package/out/zql/src/ivm/memory-source.d.ts +3 -3
- package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
- package/out/zql/src/ivm/memory-source.js +7 -4
- package/out/zql/src/ivm/memory-source.js.map +1 -1
- package/out/zql/src/ivm/operator.d.ts +10 -3
- 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/ivm/push-accumulated.d.ts +1 -1
- package/out/zql/src/ivm/push-accumulated.d.ts.map +1 -1
- package/out/zql/src/ivm/push-accumulated.js +8 -8
- package/out/zql/src/ivm/push-accumulated.js.map +1 -1
- package/out/zql/src/ivm/skip.d.ts +1 -1
- package/out/zql/src/ivm/skip.d.ts.map +1 -1
- package/out/zql/src/ivm/skip.js +8 -3
- package/out/zql/src/ivm/skip.js.map +1 -1
- package/out/zql/src/ivm/source.d.ts +15 -7
- package/out/zql/src/ivm/source.d.ts.map +1 -1
- package/out/zql/src/ivm/stream.d.ts +2 -0
- package/out/zql/src/ivm/stream.d.ts.map +1 -1
- package/out/zql/src/ivm/stream.js +5 -14
- package/out/zql/src/ivm/stream.js.map +1 -1
- package/out/zql/src/ivm/take.d.ts +1 -1
- package/out/zql/src/ivm/take.d.ts.map +1 -1
- package/out/zql/src/ivm/take.js +164 -147
- package/out/zql/src/ivm/take.js.map +1 -1
- package/out/zql/src/ivm/union-fan-in.d.ts +2 -2
- package/out/zql/src/ivm/union-fan-in.d.ts.map +1 -1
- package/out/zql/src/ivm/union-fan-in.js +7 -7
- package/out/zql/src/ivm/union-fan-in.js.map +1 -1
- package/out/zql/src/ivm/union-fan-out.d.ts +1 -1
- package/out/zql/src/ivm/union-fan-out.d.ts.map +1 -1
- package/out/zql/src/ivm/union-fan-out.js +3 -3
- package/out/zql/src/ivm/union-fan-out.js.map +1 -1
- package/out/zql/src/mutate/mutator-registry.d.ts.map +1 -1
- package/out/zql/src/mutate/mutator-registry.js +1 -0
- package/out/zql/src/mutate/mutator-registry.js.map +1 -1
- package/out/zql/src/mutate/mutator.d.ts +10 -0
- package/out/zql/src/mutate/mutator.d.ts.map +1 -1
- package/out/zql/src/mutate/mutator.js.map +1 -1
- package/out/zql/src/planner/planner-builder.d.ts +2 -1
- package/out/zql/src/planner/planner-builder.d.ts.map +1 -1
- package/out/zql/src/planner/planner-builder.js +5 -5
- package/out/zql/src/planner/planner-builder.js.map +1 -1
- package/out/zql/src/planner/planner-graph.d.ts +3 -1
- package/out/zql/src/planner/planner-graph.d.ts.map +1 -1
- package/out/zql/src/planner/planner-graph.js +5 -5
- package/out/zql/src/planner/planner-graph.js.map +1 -1
- package/out/zql/src/query/create-builder.d.ts.map +1 -1
- package/out/zql/src/query/create-builder.js +7 -36
- package/out/zql/src/query/create-builder.js.map +1 -1
- package/out/zql/src/query/measure-push-operator.d.ts +1 -1
- package/out/zql/src/query/measure-push-operator.d.ts.map +1 -1
- package/out/zql/src/query/measure-push-operator.js +2 -2
- package/out/zql/src/query/measure-push-operator.js.map +1 -1
- package/out/zqlite/src/internal/sql-inline.d.ts +13 -0
- package/out/zqlite/src/internal/sql-inline.d.ts.map +1 -0
- package/out/zqlite/src/internal/sql-inline.js +45 -0
- package/out/zqlite/src/internal/sql-inline.js.map +1 -0
- package/out/zqlite/src/sqlite-cost-model.d.ts.map +1 -1
- package/out/zqlite/src/sqlite-cost-model.js +2 -2
- package/out/zqlite/src/sqlite-cost-model.js.map +1 -1
- package/out/zqlite/src/table-source.d.ts +3 -2
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +5 -2
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import type { Row } from '../../../zero-protocol/src/data.ts';
|
|
|
3
3
|
import type { TableSchema } from '../../../zero-types/src/schema.ts';
|
|
4
4
|
import type { DebugDelegate } from '../builder/debug-delegate.ts';
|
|
5
5
|
import type { Input } from './operator.ts';
|
|
6
|
+
import type { Stream } from './stream.ts';
|
|
6
7
|
export type SourceChangeAdd = {
|
|
7
8
|
type: 'add';
|
|
8
9
|
row: Row;
|
|
@@ -54,18 +55,25 @@ export interface Source {
|
|
|
54
55
|
connect(sort: Ordering, filters?: Condition, splitEditKeys?: Set<string>, debug?: DebugDelegate): SourceInput;
|
|
55
56
|
/**
|
|
56
57
|
* Pushes a change into the source and into all connected outputs.
|
|
58
|
+
*
|
|
59
|
+
* The returned stream can yield 'yield' to yield control to the caller
|
|
60
|
+
* for purposes of responsiveness.
|
|
61
|
+
*
|
|
62
|
+
* Once the stream is exhausted, the change will have been pushed into all
|
|
63
|
+
* connected inputs and committed to the source.
|
|
57
64
|
*/
|
|
58
|
-
push(change: SourceChange):
|
|
65
|
+
push(change: SourceChange): Stream<'yield'>;
|
|
59
66
|
/**
|
|
60
67
|
* Pushes a change into the source.
|
|
61
|
-
* Iterating the returned iterator will push the
|
|
62
|
-
* change into one connected input at a time.
|
|
63
68
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
69
|
+
* Iterating the returned stream will push the change into one connected input
|
|
70
|
+
* at a time, yielding `undefined` between each, and yielding `'yield'` to
|
|
71
|
+
* yield control to the caller for purposes of responsiveness.
|
|
72
|
+
*
|
|
73
|
+
* Once the stream is exhausted, the change will have been pushed
|
|
74
|
+
* into all connected inputs and committed to the source.
|
|
67
75
|
*/
|
|
68
|
-
genPush(change: SourceChange):
|
|
76
|
+
genPush(change: SourceChange): Stream<'yield' | undefined>;
|
|
69
77
|
}
|
|
70
78
|
export interface SourceInput extends Input {
|
|
71
79
|
readonly fullyAppliedFilters: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAC5D,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAC5D,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,CAAC;AAErB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,WAAW,IAAI,WAAW,CAAC;IAC/B;;;;;;;;;;;OAWG;IACH,OAAO,CACL,IAAI,EAAE,QAAQ,EACd,OAAO,CAAC,EAAE,SAAS,EACnB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC3B,KAAK,CAAC,EAAE,aAAa,GACpB,WAAW,CAAC;IAEf;;;;;;;;OAQG;IACH,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE5C;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;CACvC"}
|
|
@@ -8,4 +8,6 @@
|
|
|
8
8
|
export type Stream<T> = Iterable<T>;
|
|
9
9
|
export declare function take<T>(stream: Stream<T>, limit: number): Stream<T>;
|
|
10
10
|
export declare function first<T>(stream: Stream<T>): T | undefined;
|
|
11
|
+
export declare function consume<T>(stream: Stream<T>): void;
|
|
12
|
+
export declare function drainGenerator<Yield, Return>(gen: Generator<Yield, Return, unknown>): Return;
|
|
11
13
|
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/stream.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEpC,wBAAiB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAWpE;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAKzD"}
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/stream.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEpC,wBAAiB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAWpE;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAKzD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,QAE3C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAC1C,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GACrC,MAAM,CAMR"}
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
function* take(stream, limit) {
|
|
2
|
-
if (limit < 1) {
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
let count = 0;
|
|
6
|
-
for (const v of stream) {
|
|
7
|
-
yield v;
|
|
8
|
-
if (++count === limit) {
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
1
|
function first(stream) {
|
|
14
2
|
const it = stream[Symbol.iterator]();
|
|
15
3
|
const { value } = it.next();
|
|
16
4
|
it.return?.();
|
|
17
5
|
return value;
|
|
18
6
|
}
|
|
7
|
+
function consume(stream) {
|
|
8
|
+
[...stream];
|
|
9
|
+
}
|
|
19
10
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
consume,
|
|
12
|
+
first
|
|
22
13
|
};
|
|
23
14
|
//# sourceMappingURL=stream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sources":["../../../../../zql/src/ivm/stream.ts"],"sourcesContent":["/**\n * streams are lazy forward-only iterables.\n * Once a stream reaches the end it can't be restarted.\n * They are iterable, not iterator, so that they can be used in for-each,\n * and so that we know when consumer has stopped iterating the stream. This allows us\n * to clean up resources like sql statements.\n */\nexport type Stream<T> = Iterable<T>;\n\nexport function* take<T>(stream: Stream<T>, limit: number): Stream<T> {\n if (limit < 1) {\n return;\n }\n let count = 0;\n for (const v of stream) {\n yield v;\n if (++count === limit) {\n break;\n }\n }\n}\n\nexport function first<T>(stream: Stream<T>): T | undefined {\n const it = stream[Symbol.iterator]();\n const {value} = it.next();\n it.return?.();\n return value;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.js","sources":["../../../../../zql/src/ivm/stream.ts"],"sourcesContent":["/**\n * streams are lazy forward-only iterables.\n * Once a stream reaches the end it can't be restarted.\n * They are iterable, not iterator, so that they can be used in for-each,\n * and so that we know when consumer has stopped iterating the stream. This allows us\n * to clean up resources like sql statements.\n */\nexport type Stream<T> = Iterable<T>;\n\nexport function* take<T>(stream: Stream<T>, limit: number): Stream<T> {\n if (limit < 1) {\n return;\n }\n let count = 0;\n for (const v of stream) {\n yield v;\n if (++count === limit) {\n break;\n }\n }\n}\n\nexport function first<T>(stream: Stream<T>): T | undefined {\n const it = stream[Symbol.iterator]();\n const {value} = it.next();\n it.return?.();\n return value;\n}\n\nexport function consume<T>(stream: Stream<T>) {\n [...stream];\n}\n\nexport function drainGenerator<Yield, Return>(\n gen: Generator<Yield, Return, unknown>,\n): Return {\n let result = gen.next();\n while (!result.done) {\n result = gen.next();\n }\n return result.value;\n}\n"],"names":[],"mappings":"AAsBO,SAAS,MAAS,QAAkC;AACzD,QAAM,KAAK,OAAO,OAAO,QAAQ,EAAA;AACjC,QAAM,EAAC,MAAA,IAAS,GAAG,KAAA;AACnB,KAAG,SAAA;AACH,SAAO;AACT;AAEO,SAAS,QAAW,QAAmB;AAC5C,GAAC,GAAG,MAAM;AACZ;"}
|
|
@@ -22,7 +22,7 @@ export declare class Take implements Operator {
|
|
|
22
22
|
setOutput(output: Output): void;
|
|
23
23
|
getSchema(): SourceSchema;
|
|
24
24
|
fetch(req: FetchRequest): Stream<Node | 'yield'>;
|
|
25
|
-
push(change: Change):
|
|
25
|
+
push(change: Change): Stream<'yield'>;
|
|
26
26
|
destroy(): void;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=take.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"take.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/take.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"take.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/take.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EAAC,KAAK,MAAM,EAAqC,MAAM,aAAa,CAAC;AAE5E,OAAO,EAAiC,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AACpE,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,KAAK,MAAM,EAAC,MAAM,aAAa,CAAC;AAiBxC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,qBAAa,IAAK,YAAW,QAAQ;;gBAYjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,YAAY;IAgB7B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B,SAAS,IAAI,YAAY;IAIxB,KAAK,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IAyJhD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;IA0ctC,OAAO,IAAI,IAAI;CAGhB"}
|
package/out/zql/src/ivm/take.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { assert, unreachable } from "../../../shared/src/asserts.js";
|
|
2
2
|
import { hasOwn } from "../../../shared/src/has-own.js";
|
|
3
|
-
import { must } from "../../../shared/src/must.js";
|
|
4
3
|
import { assertOrderingIncludesPK } from "../query/complete-ordering.js";
|
|
5
4
|
import { compareValues } from "./data.js";
|
|
6
|
-
import { throwOutput
|
|
7
|
-
import { first, take } from "./stream.js";
|
|
5
|
+
import { throwOutput } from "./operator.js";
|
|
8
6
|
const MAX_BOUND_KEY = "maxBound";
|
|
9
7
|
class Take {
|
|
10
8
|
#input;
|
|
@@ -146,9 +144,9 @@ class Take {
|
|
|
146
144
|
}
|
|
147
145
|
return { takeState, takeStateKey, maxBound, constraint };
|
|
148
146
|
}
|
|
149
|
-
push(change) {
|
|
147
|
+
*push(change) {
|
|
150
148
|
if (change.type === "edit") {
|
|
151
|
-
this.#pushEditChange(change);
|
|
149
|
+
yield* this.#pushEditChange(change);
|
|
152
150
|
return;
|
|
153
151
|
}
|
|
154
152
|
const { takeState, takeStateKey, maxBound, constraint } = this.#getStateAndConstraint(change.node.row);
|
|
@@ -164,7 +162,7 @@ class Take {
|
|
|
164
162
|
takeState.bound === void 0 || compareRows(takeState.bound, change.node.row) < 0 ? change.node.row : takeState.bound,
|
|
165
163
|
maxBound
|
|
166
164
|
);
|
|
167
|
-
this.#output.push(change, this);
|
|
165
|
+
yield* this.#output.push(change, this);
|
|
168
166
|
return;
|
|
169
167
|
}
|
|
170
168
|
if (takeState.bound === void 0 || compareRows(change.node.row, takeState.bound) >= 0) {
|
|
@@ -173,34 +171,41 @@ class Take {
|
|
|
173
171
|
let beforeBoundNode;
|
|
174
172
|
let boundNode;
|
|
175
173
|
if (this.#limit === 1) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
174
|
+
for (const node of this.#input.fetch({
|
|
175
|
+
start: {
|
|
176
|
+
row: takeState.bound,
|
|
177
|
+
basis: "at"
|
|
178
|
+
},
|
|
179
|
+
constraint
|
|
180
|
+
})) {
|
|
181
|
+
if (node === "yield") {
|
|
182
|
+
yield node;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
boundNode = node;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
189
188
|
} else {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
189
|
+
for (const node of this.#input.fetch({
|
|
190
|
+
start: {
|
|
191
|
+
row: takeState.bound,
|
|
192
|
+
basis: "at"
|
|
193
|
+
},
|
|
194
|
+
constraint,
|
|
195
|
+
reverse: true
|
|
196
|
+
})) {
|
|
197
|
+
if (node === "yield") {
|
|
198
|
+
yield node;
|
|
199
|
+
continue;
|
|
200
|
+
} else if (boundNode === void 0) {
|
|
201
|
+
boundNode = node;
|
|
202
|
+
} else {
|
|
203
|
+
beforeBoundNode = node;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
203
207
|
}
|
|
208
|
+
assert(boundNode !== void 0);
|
|
204
209
|
const removeChange = {
|
|
205
210
|
type: "remove",
|
|
206
211
|
node: boundNode
|
|
@@ -211,10 +216,8 @@ class Take {
|
|
|
211
216
|
beforeBoundNode === void 0 || compareRows(change.node.row, beforeBoundNode.row) > 0 ? change.node.row : beforeBoundNode.row,
|
|
212
217
|
maxBound
|
|
213
218
|
);
|
|
214
|
-
this.#
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
this.#output.push(change, this);
|
|
219
|
+
yield* this.#pushWithRowHiddenFromFetch(change.node.row, removeChange);
|
|
220
|
+
yield* this.#output.push(change, this);
|
|
218
221
|
} else if (change.type === "remove") {
|
|
219
222
|
if (takeState.bound === void 0) {
|
|
220
223
|
return;
|
|
@@ -223,19 +226,22 @@ class Take {
|
|
|
223
226
|
if (compToBound > 0) {
|
|
224
227
|
return;
|
|
225
228
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
229
|
+
let beforeBoundNode;
|
|
230
|
+
for (const node of this.#input.fetch({
|
|
231
|
+
start: {
|
|
232
|
+
row: takeState.bound,
|
|
233
|
+
basis: "after"
|
|
234
|
+
},
|
|
235
|
+
constraint,
|
|
236
|
+
reverse: true
|
|
237
|
+
})) {
|
|
238
|
+
if (node === "yield") {
|
|
239
|
+
yield node;
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
beforeBoundNode = node;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
239
245
|
let newBound;
|
|
240
246
|
if (beforeBoundNode) {
|
|
241
247
|
const push = compareRows(beforeBoundNode.row, takeState.bound) > 0;
|
|
@@ -245,15 +251,17 @@ class Take {
|
|
|
245
251
|
};
|
|
246
252
|
}
|
|
247
253
|
if (!newBound?.push) {
|
|
248
|
-
for (const node of
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
for (const node of this.#input.fetch({
|
|
255
|
+
start: {
|
|
256
|
+
row: takeState.bound,
|
|
257
|
+
basis: "at"
|
|
258
|
+
},
|
|
259
|
+
constraint
|
|
260
|
+
})) {
|
|
261
|
+
if (node === "yield") {
|
|
262
|
+
yield node;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
257
265
|
const push = compareRows(node.row, takeState.bound) > 0;
|
|
258
266
|
newBound = {
|
|
259
267
|
node,
|
|
@@ -265,14 +273,14 @@ class Take {
|
|
|
265
273
|
}
|
|
266
274
|
}
|
|
267
275
|
if (newBound?.push) {
|
|
268
|
-
this.#output.push(change, this);
|
|
276
|
+
yield* this.#output.push(change, this);
|
|
269
277
|
this.#setTakeState(
|
|
270
278
|
takeStateKey,
|
|
271
279
|
takeState.size,
|
|
272
280
|
newBound.node.row,
|
|
273
281
|
maxBound
|
|
274
282
|
);
|
|
275
|
-
this.#output.push(
|
|
283
|
+
yield* this.#output.push(
|
|
276
284
|
{
|
|
277
285
|
type: "add",
|
|
278
286
|
node: newBound.node
|
|
@@ -287,14 +295,14 @@ class Take {
|
|
|
287
295
|
newBound?.node.row,
|
|
288
296
|
maxBound
|
|
289
297
|
);
|
|
290
|
-
this.#output.push(change, this);
|
|
298
|
+
yield* this.#output.push(change, this);
|
|
291
299
|
} else if (change.type === "child") {
|
|
292
300
|
if (takeState.bound && compareRows(change.node.row, takeState.bound) <= 0) {
|
|
293
|
-
this.#output.push(change, this);
|
|
301
|
+
yield* this.#output.push(change, this);
|
|
294
302
|
}
|
|
295
303
|
}
|
|
296
304
|
}
|
|
297
|
-
|
|
305
|
+
*#pushEditChange(change) {
|
|
298
306
|
assert(
|
|
299
307
|
!this.#partitionKeyComparator || this.#partitionKeyComparator(change.oldNode.row, change.node.row) === 0,
|
|
300
308
|
"Unexpected change of partition key"
|
|
@@ -307,64 +315,71 @@ class Take {
|
|
|
307
315
|
const { compareRows } = this.getSchema();
|
|
308
316
|
const oldCmp = compareRows(change.oldNode.row, takeState.bound);
|
|
309
317
|
const newCmp = compareRows(change.node.row, takeState.bound);
|
|
310
|
-
const
|
|
311
|
-
|
|
318
|
+
const that = this;
|
|
319
|
+
const replaceBoundAndForwardChange = function* () {
|
|
320
|
+
that.#setTakeState(
|
|
312
321
|
takeStateKey,
|
|
313
322
|
takeState.size,
|
|
314
323
|
change.node.row,
|
|
315
324
|
maxBound
|
|
316
325
|
);
|
|
317
|
-
|
|
326
|
+
yield* that.#output.push(change, that);
|
|
318
327
|
};
|
|
319
328
|
if (oldCmp === 0) {
|
|
320
329
|
if (newCmp === 0) {
|
|
321
|
-
this.#output.push(change, this);
|
|
330
|
+
yield* this.#output.push(change, this);
|
|
322
331
|
return;
|
|
323
332
|
}
|
|
324
333
|
if (newCmp < 0) {
|
|
325
334
|
if (this.#limit === 1) {
|
|
326
|
-
replaceBoundAndForwardChange();
|
|
335
|
+
yield* replaceBoundAndForwardChange();
|
|
327
336
|
return;
|
|
328
337
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
338
|
+
let beforeBoundNode;
|
|
339
|
+
for (const node of this.#input.fetch({
|
|
340
|
+
start: {
|
|
341
|
+
row: takeState.bound,
|
|
342
|
+
basis: "after"
|
|
343
|
+
},
|
|
344
|
+
constraint,
|
|
345
|
+
reverse: true
|
|
346
|
+
})) {
|
|
347
|
+
if (node === "yield") {
|
|
348
|
+
yield node;
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
beforeBoundNode = node;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
assert(beforeBoundNode !== void 0);
|
|
343
355
|
this.#setTakeState(
|
|
344
356
|
takeStateKey,
|
|
345
357
|
takeState.size,
|
|
346
358
|
beforeBoundNode.row,
|
|
347
359
|
maxBound
|
|
348
360
|
);
|
|
349
|
-
this.#output.push(change, this);
|
|
361
|
+
yield* this.#output.push(change, this);
|
|
350
362
|
return;
|
|
351
363
|
}
|
|
352
364
|
assert(newCmp > 0, "New comparison must be greater than 0");
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
365
|
+
let newBoundNode;
|
|
366
|
+
for (const node of this.#input.fetch({
|
|
367
|
+
start: {
|
|
368
|
+
row: takeState.bound,
|
|
369
|
+
basis: "at"
|
|
370
|
+
},
|
|
371
|
+
constraint
|
|
372
|
+
})) {
|
|
373
|
+
if (node === "yield") {
|
|
374
|
+
yield node;
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
newBoundNode = node;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
assert(newBoundNode !== void 0);
|
|
366
381
|
if (compareRows(newBoundNode.row, change.node.row) === 0) {
|
|
367
|
-
replaceBoundAndForwardChange();
|
|
382
|
+
yield* replaceBoundAndForwardChange();
|
|
368
383
|
return;
|
|
369
384
|
}
|
|
370
385
|
this.#setTakeState(
|
|
@@ -373,16 +388,11 @@ class Take {
|
|
|
373
388
|
newBoundNode.row,
|
|
374
389
|
maxBound
|
|
375
390
|
);
|
|
376
|
-
this.#
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
type: "remove",
|
|
380
|
-
node: change.oldNode
|
|
381
|
-
},
|
|
382
|
-
this
|
|
383
|
-
);
|
|
391
|
+
yield* this.#pushWithRowHiddenFromFetch(newBoundNode.row, {
|
|
392
|
+
type: "remove",
|
|
393
|
+
node: change.oldNode
|
|
384
394
|
});
|
|
385
|
-
this.#output.push(
|
|
395
|
+
yield* this.#output.push(
|
|
386
396
|
{
|
|
387
397
|
type: "add",
|
|
388
398
|
node: newBoundNode
|
|
@@ -397,35 +407,39 @@ class Take {
|
|
|
397
407
|
return;
|
|
398
408
|
}
|
|
399
409
|
assert(newCmp < 0, "New comparison must be less than 0");
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
)
|
|
411
|
-
|
|
412
|
-
|
|
410
|
+
let oldBoundNode;
|
|
411
|
+
let newBoundNode;
|
|
412
|
+
for (const node of this.#input.fetch({
|
|
413
|
+
start: {
|
|
414
|
+
row: takeState.bound,
|
|
415
|
+
basis: "at"
|
|
416
|
+
},
|
|
417
|
+
constraint,
|
|
418
|
+
reverse: true
|
|
419
|
+
})) {
|
|
420
|
+
if (node === "yield") {
|
|
421
|
+
yield node;
|
|
422
|
+
continue;
|
|
423
|
+
} else if (oldBoundNode === void 0) {
|
|
424
|
+
oldBoundNode = node;
|
|
425
|
+
} else {
|
|
426
|
+
newBoundNode = node;
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
assert(oldBoundNode !== void 0);
|
|
431
|
+
assert(newBoundNode !== void 0);
|
|
413
432
|
this.#setTakeState(
|
|
414
433
|
takeStateKey,
|
|
415
434
|
takeState.size,
|
|
416
435
|
newBoundNode.row,
|
|
417
436
|
maxBound
|
|
418
437
|
);
|
|
419
|
-
this.#
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
type: "remove",
|
|
423
|
-
node: oldBoundNode
|
|
424
|
-
},
|
|
425
|
-
this
|
|
426
|
-
);
|
|
438
|
+
yield* this.#pushWithRowHiddenFromFetch(change.node.row, {
|
|
439
|
+
type: "remove",
|
|
440
|
+
node: oldBoundNode
|
|
427
441
|
});
|
|
428
|
-
this.#output.push(
|
|
442
|
+
yield* this.#output.push(
|
|
429
443
|
{
|
|
430
444
|
type: "add",
|
|
431
445
|
node: change.node
|
|
@@ -437,28 +451,31 @@ class Take {
|
|
|
437
451
|
if (oldCmp < 0) {
|
|
438
452
|
assert(newCmp !== 0, "Invalid state. Row has duplicate primary key");
|
|
439
453
|
if (newCmp < 0) {
|
|
440
|
-
this.#output.push(change, this);
|
|
454
|
+
yield* this.#output.push(change, this);
|
|
441
455
|
return;
|
|
442
456
|
}
|
|
443
457
|
assert(newCmp > 0, "New comparison must be greater than 0");
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
458
|
+
let afterBoundNode;
|
|
459
|
+
for (const node of this.#input.fetch({
|
|
460
|
+
start: {
|
|
461
|
+
row: takeState.bound,
|
|
462
|
+
basis: "after"
|
|
463
|
+
},
|
|
464
|
+
constraint
|
|
465
|
+
})) {
|
|
466
|
+
if (node === "yield") {
|
|
467
|
+
yield node;
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
afterBoundNode = node;
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
assert(afterBoundNode !== void 0);
|
|
457
474
|
if (compareRows(afterBoundNode.row, change.node.row) === 0) {
|
|
458
|
-
replaceBoundAndForwardChange();
|
|
475
|
+
yield* replaceBoundAndForwardChange();
|
|
459
476
|
return;
|
|
460
477
|
}
|
|
461
|
-
this.#output.push(
|
|
478
|
+
yield* this.#output.push(
|
|
462
479
|
{
|
|
463
480
|
type: "remove",
|
|
464
481
|
node: change.oldNode
|
|
@@ -471,7 +488,7 @@ class Take {
|
|
|
471
488
|
afterBoundNode.row,
|
|
472
489
|
maxBound
|
|
473
490
|
);
|
|
474
|
-
this.#output.push(
|
|
491
|
+
yield* this.#output.push(
|
|
475
492
|
{
|
|
476
493
|
type: "add",
|
|
477
494
|
node: afterBoundNode
|
|
@@ -482,10 +499,10 @@ class Take {
|
|
|
482
499
|
}
|
|
483
500
|
unreachable();
|
|
484
501
|
}
|
|
485
|
-
|
|
502
|
+
*#pushWithRowHiddenFromFetch(row, change) {
|
|
486
503
|
this.#rowHiddenFromFetch = row;
|
|
487
504
|
try {
|
|
488
|
-
|
|
505
|
+
yield* this.#output.push(change, this);
|
|
489
506
|
} finally {
|
|
490
507
|
this.#rowHiddenFromFetch = void 0;
|
|
491
508
|
}
|