@rocicorp/zero 1.4.0-canary.0 → 1.4.0-canary.2
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/analyze-cli.d.ts +1 -1
- package/out/analyze-query/src/analyze-cli.d.ts.map +1 -1
- package/out/analyze-query/src/analyze-cli.js +13 -3
- package/out/analyze-query/src/analyze-cli.js.map +1 -1
- package/out/analyze-query/src/bin-analyze.js +1 -1
- package/out/analyze-query/src/bin-analyze.js.map +1 -1
- package/out/analyze-query/src/bin-transform.js +1 -1
- package/out/analyze-query/src/bin-transform.js.map +1 -1
- package/out/replicache/src/btree/node.d.ts +1 -1
- package/out/replicache/src/btree/node.d.ts.map +1 -1
- package/out/replicache/src/btree/node.js +34 -21
- package/out/replicache/src/btree/node.js.map +1 -1
- package/out/replicache/src/btree/write.js +1 -2
- package/out/replicache/src/btree/write.js.map +1 -1
- package/out/shared/src/btree-set.d.ts +6 -0
- package/out/shared/src/btree-set.d.ts.map +1 -1
- package/out/shared/src/btree-set.js +34 -0
- package/out/shared/src/btree-set.js.map +1 -1
- package/out/zero/package.js +1 -1
- package/out/zero/package.js.map +1 -1
- package/out/zero/src/bindings.js +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +18 -0
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +35 -3
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/scripts/decommission.d.ts.map +1 -1
- package/out/zero-cache/src/scripts/decommission.js +3 -3
- package/out/zero-cache/src/scripts/decommission.js.map +1 -1
- package/out/zero-cache/src/scripts/deploy-permissions.js +1 -1
- package/out/zero-cache/src/scripts/deploy-permissions.js.map +1 -1
- package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
- package/out/zero-cache/src/server/change-streamer.js +2 -5
- package/out/zero-cache/src/server/change-streamer.js.map +1 -1
- package/out/zero-cache/src/server/main.d.ts.map +1 -1
- package/out/zero-cache/src/server/main.js +6 -1
- package/out/zero-cache/src/server/main.js.map +1 -1
- package/out/zero-cache/src/server/reaper.d.ts.map +1 -1
- package/out/zero-cache/src/server/reaper.js +1 -4
- package/out/zero-cache/src/server/reaper.js.map +1 -1
- package/out/zero-cache/src/server/shadow-syncer.js +35 -0
- package/out/zero-cache/src/server/shadow-syncer.js.map +1 -0
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +2 -8
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/server/worker-urls.d.ts +1 -0
- package/out/zero-cache/src/server/worker-urls.d.ts.map +1 -1
- package/out/zero-cache/src/server/worker-urls.js +2 -1
- package/out/zero-cache/src/server/worker-urls.js.map +1 -1
- package/out/zero-cache/src/services/change-source/custom/change-source.js +2 -2
- package/out/zero-cache/src/services/change-source/custom/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts +8 -1
- package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/backfill-stream.js +31 -18
- package/out/zero-cache/src/services/change-source/pg/backfill-stream.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/change-source.js +44 -46
- package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts +6 -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 +62 -22
- package/out/zero-cache/src/services/change-source/pg/initial-sync.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +5 -6
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/schema/tables.js +1 -1
- package/out/zero-cache/src/services/run-ast.js +1 -1
- package/out/zero-cache/src/services/shadow-sync/shadow-sync-service.js +49 -0
- package/out/zero-cache/src/services/shadow-sync/shadow-sync-service.js.map +1 -0
- package/out/zero-cache/src/services/statz.js +3 -3
- package/out/zero-cache/src/services/statz.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +1 -0
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.js +34 -11
- package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts +16 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +19 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js +1 -1
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +6 -0
- 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 +46 -3
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts +17 -0
- package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts.map +1 -0
- package/out/zero-cache/src/services/view-syncer/row-set-signature.js +29 -0
- package/out/zero-cache/src/services/view-syncer/row-set-signature.js.map +1 -0
- package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts +1 -0
- package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/cvr.js +1 -0
- package/out/zero-cache/src/services/view-syncer/schema/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/init.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/init.js +5 -1
- package/out/zero-cache/src/services/view-syncer/schema/init.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +105 -0
- package/out/zero-cache/src/services/view-syncer/schema/types.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/types.js +8 -4
- package/out/zero-cache/src/services/view-syncer/schema/types.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 +2 -2
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/types/pg.d.ts +1 -1
- package/out/zero-cache/src/types/pg.d.ts.map +1 -1
- package/out/zero-cache/src/types/pg.js +8 -2
- package/out/zero-cache/src/types/pg.js.map +1 -1
- package/out/zero-cache/src/types/timeout.d.ts +11 -0
- package/out/zero-cache/src/types/timeout.d.ts.map +1 -0
- package/out/zero-cache/src/types/timeout.js +26 -0
- package/out/zero-cache/src/types/timeout.js.map +1 -0
- package/out/zero-cache/src/workers/connection.js +5 -5
- package/out/zero-cache/src/workers/connection.js.map +1 -1
- package/out/zero-client/src/client/bindings.js +1 -1
- package/out/zero-client/src/client/log-options.d.ts +1 -0
- package/out/zero-client/src/client/log-options.d.ts.map +1 -1
- package/out/zero-client/src/client/log-options.js +3 -2
- package/out/zero-client/src/client/log-options.js.map +1 -1
- package/out/zero-client/src/client/options.d.ts +13 -1
- package/out/zero-client/src/client/options.d.ts.map +1 -1
- package/out/zero-client/src/client/options.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.js +2 -1
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-react/src/bindings.js +1 -1
- package/out/zero-server/src/adapters/postgresjs.d.ts.map +1 -1
- package/out/zero-server/src/adapters/postgresjs.js +1 -1
- package/out/zero-server/src/adapters/postgresjs.js.map +1 -1
- package/out/zero-solid/src/bindings.js +1 -1
- package/out/zero-solid/src/solid-view.js +1 -1
- package/out/zql/src/ivm/array-view.js +1 -1
- package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
- package/out/zql/src/ivm/memory-source.js +4 -4
- package/out/zql/src/ivm/memory-source.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 +2 -4
- package/out/zql/src/ivm/operator.js.map +1 -1
- package/out/zql/src/ivm/skip-yields.d.ts +4 -0
- package/out/zql/src/ivm/skip-yields.d.ts.map +1 -0
- package/out/zql/src/ivm/skip-yields.js +33 -0
- package/out/zql/src/ivm/skip-yields.js.map +1 -0
- package/out/zql/src/ivm/view-apply-change.js +1 -1
- package/out/zql/src/query/query-internals.d.ts.map +1 -1
- package/out/zql/src/query/query-internals.js +1 -1
- package/out/zql/src/query/query-internals.js.map +1 -1
- package/package.json +1 -1
|
@@ -82,6 +82,21 @@ export declare const baseQueryRecordSchema: v.ObjectType<{
|
|
|
82
82
|
configVersion?: number | undefined;
|
|
83
83
|
stateVersion: string;
|
|
84
84
|
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
87
|
+
* of every row currently attached to this query. Maintained incrementally by
|
|
88
|
+
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
89
|
+
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
90
|
+
* signature-provider callback.
|
|
91
|
+
*
|
|
92
|
+
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
93
|
+
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
94
|
+
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
95
|
+
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
96
|
+
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
97
|
+
* empty (no rows currently attached).
|
|
98
|
+
*/
|
|
99
|
+
rowSetSignature: v.Optional<string>;
|
|
85
100
|
}, undefined>;
|
|
86
101
|
/**
|
|
87
102
|
* Internal queries track rows in the database for internal use, such as the
|
|
@@ -128,6 +143,21 @@ export declare const internalQueryRecordSchema: v.ObjectType<Omit<{
|
|
|
128
143
|
configVersion?: number | undefined;
|
|
129
144
|
stateVersion: string;
|
|
130
145
|
}>;
|
|
146
|
+
/**
|
|
147
|
+
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
148
|
+
* of every row currently attached to this query. Maintained incrementally by
|
|
149
|
+
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
150
|
+
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
151
|
+
* signature-provider callback.
|
|
152
|
+
*
|
|
153
|
+
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
154
|
+
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
155
|
+
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
156
|
+
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
157
|
+
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
158
|
+
* empty (no rows currently attached).
|
|
159
|
+
*/
|
|
160
|
+
rowSetSignature: v.Optional<string>;
|
|
131
161
|
}, "type" | "ast"> & {
|
|
132
162
|
type: v.Type<"internal">;
|
|
133
163
|
ast: v.Type<import("../../../../../zero-protocol/src/ast.ts").AST>;
|
|
@@ -172,6 +202,21 @@ export declare const clientQueryRecordSchema: v.ObjectType<Omit<Omit<{
|
|
|
172
202
|
configVersion?: number | undefined;
|
|
173
203
|
stateVersion: string;
|
|
174
204
|
}>;
|
|
205
|
+
/**
|
|
206
|
+
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
207
|
+
* of every row currently attached to this query. Maintained incrementally by
|
|
208
|
+
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
209
|
+
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
210
|
+
* signature-provider callback.
|
|
211
|
+
*
|
|
212
|
+
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
213
|
+
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
214
|
+
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
215
|
+
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
216
|
+
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
217
|
+
* empty (no rows currently attached).
|
|
218
|
+
*/
|
|
219
|
+
rowSetSignature: v.Optional<string>;
|
|
175
220
|
}, "patchVersion" | "clientState"> & {
|
|
176
221
|
/**
|
|
177
222
|
* The client state for this query, which includes the inactivatedAt, ttl and
|
|
@@ -235,6 +280,21 @@ export declare const customQueryRecordSchema: v.ObjectType<Omit<Omit<{
|
|
|
235
280
|
configVersion?: number | undefined;
|
|
236
281
|
stateVersion: string;
|
|
237
282
|
}>;
|
|
283
|
+
/**
|
|
284
|
+
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
285
|
+
* of every row currently attached to this query. Maintained incrementally by
|
|
286
|
+
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
287
|
+
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
288
|
+
* signature-provider callback.
|
|
289
|
+
*
|
|
290
|
+
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
291
|
+
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
292
|
+
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
293
|
+
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
294
|
+
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
295
|
+
* empty (no rows currently attached).
|
|
296
|
+
*/
|
|
297
|
+
rowSetSignature: v.Optional<string>;
|
|
238
298
|
}, "patchVersion" | "clientState"> & {
|
|
239
299
|
/**
|
|
240
300
|
* The client state for this query, which includes the inactivatedAt, ttl and
|
|
@@ -298,6 +358,21 @@ export declare const queryRecordSchema: v.UnionType<[v.ObjectType<Omit<Omit<{
|
|
|
298
358
|
configVersion?: number | undefined;
|
|
299
359
|
stateVersion: string;
|
|
300
360
|
}>;
|
|
361
|
+
/**
|
|
362
|
+
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
363
|
+
* of every row currently attached to this query. Maintained incrementally by
|
|
364
|
+
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
365
|
+
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
366
|
+
* signature-provider callback.
|
|
367
|
+
*
|
|
368
|
+
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
369
|
+
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
370
|
+
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
371
|
+
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
372
|
+
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
373
|
+
* empty (no rows currently attached).
|
|
374
|
+
*/
|
|
375
|
+
rowSetSignature: v.Optional<string>;
|
|
301
376
|
}, "patchVersion" | "clientState"> & {
|
|
302
377
|
/**
|
|
303
378
|
* The client state for this query, which includes the inactivatedAt, ttl and
|
|
@@ -359,6 +434,21 @@ export declare const queryRecordSchema: v.UnionType<[v.ObjectType<Omit<Omit<{
|
|
|
359
434
|
configVersion?: number | undefined;
|
|
360
435
|
stateVersion: string;
|
|
361
436
|
}>;
|
|
437
|
+
/**
|
|
438
|
+
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
439
|
+
* of every row currently attached to this query. Maintained incrementally by
|
|
440
|
+
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
441
|
+
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
442
|
+
* signature-provider callback.
|
|
443
|
+
*
|
|
444
|
+
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
445
|
+
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
446
|
+
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
447
|
+
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
448
|
+
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
449
|
+
* empty (no rows currently attached).
|
|
450
|
+
*/
|
|
451
|
+
rowSetSignature: v.Optional<string>;
|
|
362
452
|
}, "patchVersion" | "clientState"> & {
|
|
363
453
|
/**
|
|
364
454
|
* The client state for this query, which includes the inactivatedAt, ttl and
|
|
@@ -420,6 +510,21 @@ export declare const queryRecordSchema: v.UnionType<[v.ObjectType<Omit<Omit<{
|
|
|
420
510
|
configVersion?: number | undefined;
|
|
421
511
|
stateVersion: string;
|
|
422
512
|
}>;
|
|
513
|
+
/**
|
|
514
|
+
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
515
|
+
* of every row currently attached to this query. Maintained incrementally by
|
|
516
|
+
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
517
|
+
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
518
|
+
* signature-provider callback.
|
|
519
|
+
*
|
|
520
|
+
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
521
|
+
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
522
|
+
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
523
|
+
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
524
|
+
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
525
|
+
* empty (no rows currently attached).
|
|
526
|
+
*/
|
|
527
|
+
rowSetSignature: v.Optional<string>;
|
|
423
528
|
}, "type" | "ast"> & {
|
|
424
529
|
type: v.Type<"internal">;
|
|
425
530
|
ast: v.Type<import("../../../../../zero-protocol/src/ast.ts").AST>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../zero-cache/src/services/view-syncer/schema/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,qCAAqC,CAAC;AAQzD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;;IAGH;;;;;;;;;;;;;;;OAeG;;aAEH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,iBAAiB,EAAE,UAEtB,CAAC;AAEX,wBAAgB,QAAQ,CAAC,CAAC,EAAE,kBAAkB,GAAG,UAAU,CAO1D;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,IAAI,CAAC;AAEnD,wBAAgB,WAAW,CACzB,CAAC,EAAE,kBAAkB,EACrB,CAAC,EAAE,kBAAkB,GACpB,MAAM,CAYR;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAEpE;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAErD;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAE5E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,kBAAkB,CAKzE;AAID,eAAO,MAAM,WAAW;;aAA6B,CAAC;AACtD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAiBhD,eAAO,MAAM,kBAAkB;IAC7B,6EAA6E;;IAG7E,sFAAsF;;aAEtF,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CA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BAAgB;;;;;;;aAI3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG;IAAC,EAAE,EAAE,KAAK,CAAA;CAAC,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG;IAAC,EAAE,EAAE,KAAK,CAAA;CAAC,CAAC;AAErD,eAAO,MAAM,mBAAmB;;;;;;;aAAmB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,UAQ1C;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAkBzD;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,WAAW,GACjB,UAAU,CA6CZ;AAED,eAAO,MAAM,kBAAkB,GAAI,GAAG,UAAU,GAAG,SAAS,kBAC/B,CAAC"}
|
|
@@ -42,7 +42,8 @@ valita_exports.object({
|
|
|
42
42
|
var baseQueryRecordSchema = valita_exports.object({
|
|
43
43
|
id: valita_exports.string(),
|
|
44
44
|
transformationHash: valita_exports.string().optional(),
|
|
45
|
-
transformationVersion: cvrVersionSchema.optional()
|
|
45
|
+
transformationVersion: cvrVersionSchema.optional(),
|
|
46
|
+
rowSetSignature: valita_exports.string().optional()
|
|
46
47
|
});
|
|
47
48
|
/**
|
|
48
49
|
* Internal queries track rows in the database for internal use, such as the
|
|
@@ -137,7 +138,8 @@ function queryRecordToQueryRow(clientGroupID, query) {
|
|
|
137
138
|
transformationHash: query.transformationHash ?? null,
|
|
138
139
|
transformationVersion: maybeVersionString(query.transformationVersion),
|
|
139
140
|
internal: true,
|
|
140
|
-
deleted: false
|
|
141
|
+
deleted: false,
|
|
142
|
+
rowSetSignature: query.rowSetSignature ?? null
|
|
141
143
|
};
|
|
142
144
|
case "client": return {
|
|
143
145
|
clientGroupID,
|
|
@@ -149,7 +151,8 @@ function queryRecordToQueryRow(clientGroupID, query) {
|
|
|
149
151
|
transformationHash: query.transformationHash ?? null,
|
|
150
152
|
transformationVersion: maybeVersionString(query.transformationVersion),
|
|
151
153
|
internal: null,
|
|
152
|
-
deleted: false
|
|
154
|
+
deleted: false,
|
|
155
|
+
rowSetSignature: query.rowSetSignature ?? null
|
|
153
156
|
};
|
|
154
157
|
case "custom": return {
|
|
155
158
|
clientGroupID,
|
|
@@ -161,7 +164,8 @@ function queryRecordToQueryRow(clientGroupID, query) {
|
|
|
161
164
|
transformationHash: query.transformationHash ?? null,
|
|
162
165
|
transformationVersion: maybeVersionString(query.transformationVersion),
|
|
163
166
|
internal: null,
|
|
164
|
-
deleted: false
|
|
167
|
+
deleted: false,
|
|
168
|
+
rowSetSignature: query.rowSetSignature ?? null
|
|
165
169
|
};
|
|
166
170
|
}
|
|
167
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../../../zero-cache/src/services/view-syncer/schema/types.ts"],"sourcesContent":["import {jsonValueSchema} from '../../../../../shared/src/bigint-json.ts';\nimport {jsonSchema} from '../../../../../shared/src/json-schema.ts';\nimport * as v from '../../../../../shared/src/valita.ts';\nimport {astSchema} from '../../../../../zero-protocol/src/ast.ts';\nimport {versionFromLexi, versionToLexi} from '../../../types/lexi-version.ts';\nimport {\n majorVersionToString,\n stateVersionFromString,\n} from '../../../types/state-version.ts';\nimport {ttlClockSchema} from '../ttl-clock.ts';\nimport type {QueriesRow} from './cvr.ts';\n\nexport const cvrVersionSchema = v.object({\n /**\n * The database `stateVersion` with which the rows in the CVR are consistent.\n */\n stateVersion: v.string(), // LexiVersion\n\n /**\n * `configVersion` is subversion of `stateVersion` that is initially absent for each\n * `stateVersion`, and incremented for configuration changes that affect the contents\n * of the CVR such as:\n *\n * * query set changes\n * * query transformation changes (which may happen for changes\n * in server-side logic or authorization policies)\n *\n * Such configuration changes are always correlated with a change to one or more\n * `/meta/...` records in the CVR, often (but not always) with corresponding\n * patches in `/patches/meta/...`.\n *\n * When the `stateVersion` moves forward, the `minorVersion` is reset to absent.\n * In this manner it behaves like the analogous concept in semantic versioning.\n */\n configVersion: v.number().optional(),\n});\n\nexport type CVRVersion = v.Infer<typeof cvrVersionSchema>;\n\nexport const EMPTY_CVR_VERSION: CVRVersion = {\n stateVersion: majorVersionToString(0),\n} as const;\n\nexport function oneAfter(v: NullableCVRVersion): CVRVersion {\n return v === null\n ? {stateVersion: majorVersionToString(0)}\n : {\n stateVersion: v.stateVersion,\n configVersion: (v.configVersion ?? 0) + 1,\n };\n}\n\nexport type NullableCVRVersion = CVRVersion | null;\n\nexport function cmpVersions(\n a: NullableCVRVersion,\n b: NullableCVRVersion,\n): number {\n return a === null && b === null\n ? 0\n : a === null\n ? -1\n : b === null\n ? 1\n : a.stateVersion < b.stateVersion\n ? -1\n : a.stateVersion > b.stateVersion\n ? 1\n : (a.configVersion ?? 0) - (b.configVersion ?? 0);\n}\n\nexport function maxVersion(a: CVRVersion, b?: CVRVersion): CVRVersion {\n return !b ? a : cmpVersions(b, a) > 0 ? b : a;\n}\n\nexport function versionToCookie(v: CVRVersion): string {\n return versionString(v);\n}\n\nexport function versionToNullableCookie(v: NullableCVRVersion): string | null {\n return v === null ? null : versionToCookie(v);\n}\n\nexport function cookieToVersion(cookie: string | null): NullableCVRVersion {\n if (cookie === null) {\n return null;\n }\n return versionFromString(cookie);\n}\n\n// Last Active tracking.\n\nexport const cvrIDSchema = v.object({id: v.string()});\nexport type CvrID = v.Infer<typeof cvrIDSchema>;\n\nconst cvrRecordSchema = v.object({\n /**\n * CVR records store the CVRVersion at which the record was last patched into\n * the CVR, which corresponds with a patch row that is cleaned up when the\n * record is changed (updated, deleted, and re-added in the case of rows).\n *\n * Tombstones are stored for row records but not for config records. This means\n * that \"orphaned\" delete patches for config records may exist, and therefore\n * scans of config patches must always run until the end of the list. On the\n * contrary, for row patches, the row record tombstones allow cleanup of delete\n * patches.\n */\n patchVersion: cvrVersionSchema,\n});\n\nexport const clientRecordSchema = v.object({\n /** The client ID, of which there can be multiple for a client group view. */\n id: v.string(),\n\n /** The client's desired query IDs. Patch information is stored in the QueryRecord. */\n desiredQueryIDs: v.array(v.string()),\n});\n\nexport type ClientRecord = v.Infer<typeof clientRecordSchema>;\n\nexport const baseQueryRecordSchema = v.object({\n /** The client-specified ID used to identify this query. Typically a hash. */\n id: v.string(),\n\n /**\n * The hash of the query after server-side transformations, which include:\n *\n * * Normalization (which may differ from what the client does)\n * * Query \"expansion\" to include primary keys and query-execution-related columns\n * * Authorization transforms\n *\n * Transformations depend on conditions that are independent of the db state version,\n * such as server-side logic and authorization policies. As such, the version of a CVR\n * version may need to be advanced independent of db state changes. This is done\n * via the `minorVersion` counter of the CVRVersion object, which is used to account\n * for both changes to the query set and changes to query transformations (which are\n * effectively remove-old-query + add-new-query).\n *\n * Note that the transformed AST itself is **not** stored, as the result of the previous\n * transformation is not useful in and of itself. If the current transformation results in\n * a different hash than that of the transformation used for the last version of the CVR,\n * it is simply handled by invalidating the existing rows, re-executed the query with\n * the new transformation, and advancing the CVR's `minorVersion` and this query's\n * `transformationVersion`.\n *\n * Note that the transformationHash is only stored when the query has reached the \"gotten\"\n * state. If the query is in the \"desired\" but not yet \"gotten\" state, the field is absent.\n */\n transformationHash: v.string().optional(),\n\n /**\n * The CVR version corresponding to the `transformationHash`. This essentially tracks when\n * this version of the query was effectively added to the CVR (as opposed to the\n * `patchVersion`, which is simply when the client was notified that its query was added\n * to the gotten set). Catchup of clients from old CVR versions require executing all\n * queries with a newer `transformationVersion`.\n */\n transformationVersion: cvrVersionSchema.optional(),\n});\n\n/**\n * Internal queries track rows in the database for internal use, such as the\n * `lastMutationID`s in the `zero.clients` table. They participate in the standard\n * invalidation / update logic for row contents, but not in the desired/got or\n * size-based quota logic for client-requested queries.\n */\nexport const internalQueryRecordSchema = baseQueryRecordSchema.extend({\n type: v.literal('internal'),\n ast: astSchema,\n});\n\nexport type InternalQueryRecord = v.Infer<typeof internalQueryRecordSchema>;\n\nconst clientStateSchema = v.object({\n /**\n * The time at which the query was last inactivated. If this undefined or\n * missing then the query is active.\n *\n * Desired queries are always active and have an undefined inactivatedAt.\n */\n inactivatedAt: ttlClockSchema.optional(),\n\n /**\n * TTL, time to live in milliseconds. If the query is not updated within this\n * time. The time to live is the time after it has become inactive. Negative\n * values are treated as `'forever'`.\n *\n * We do clamp this to a maximum of 10 minutes, so that queries do not\n * live for a very long time in the CVR.\n */\n ttl: v.number(),\n\n /**\n * The version at which the client state changed (i.e. individual `patchVersion`s).\n */\n version: cvrVersionSchema,\n});\n\nconst externalQueryRecordSchema = baseQueryRecordSchema.extend({\n /**\n * The client state for this query, which includes the inactivatedAt, ttl and\n * version. The client state is stored in a record with the client ID as the\n * key.\n */\n clientState: v.record(clientStateSchema),\n\n // For queries, the `patchVersion` indicates when query was added to the got set,\n // and is absent if not yet gotten.\n patchVersion: cvrVersionSchema.optional(),\n});\n\nexport const clientQueryRecordSchema = externalQueryRecordSchema.extend({\n type: v.literal('client'),\n\n /** The original AST as supplied by the client. */\n ast: astSchema,\n});\n\nexport type ClientQueryRecord = v.Infer<typeof clientQueryRecordSchema>;\n\nexport const customQueryRecordSchema = externalQueryRecordSchema.extend({\n type: v.literal('custom'),\n name: v.string(),\n args: v.readonly(v.array(jsonSchema)),\n});\n\nexport type CustomQueryRecord = v.Infer<typeof customQueryRecordSchema>;\n\nexport const queryRecordSchema = v.union(\n clientQueryRecordSchema,\n customQueryRecordSchema,\n internalQueryRecordSchema,\n);\n\nexport type QueryRecord = v.Infer<typeof queryRecordSchema>;\n\nexport const rowIDSchema = v.object({\n schema: v.string(),\n table: v.string(),\n rowKey: v.record(jsonValueSchema),\n});\n\nexport type RowID = v.Infer<typeof rowIDSchema>;\n\nexport const rowRecordSchema = cvrRecordSchema.extend({\n id: rowIDSchema,\n rowVersion: v.string(), // '_0_version' of the row\n // query hashes => refCount, or `null` for a row that was removed from the\n // view (i.e. tombstone).\n refCounts: v.record(v.number()).nullable(),\n});\n\nexport type RowRecord = v.Infer<typeof rowRecordSchema>;\n\nexport const patchSchema = v.object({\n type: v.literalUnion('row', 'query'),\n op: v.literalUnion('put', 'del'),\n});\n\nexport const putRowPatchSchema = patchSchema.extend({\n type: v.literal('row'),\n op: v.literal('put'),\n id: rowIDSchema,\n rowVersion: v.string(), // '_0_version' of the row\n});\n\nexport type PutRowPatch = v.Infer<typeof putRowPatchSchema>;\n\nexport const delRowPatchSchema = patchSchema.extend({\n type: v.literal('row'),\n op: v.literal('del'),\n id: rowIDSchema,\n});\n\nexport type DelRowPatch = v.Infer<typeof delRowPatchSchema>;\n\nexport const rowPatchSchema = v.union(putRowPatchSchema, delRowPatchSchema);\n\nexport type RowPatch = v.Infer<typeof rowPatchSchema>;\n\nexport const queryPatchSchema = patchSchema.extend({\n type: v.literal('query'),\n id: v.string(),\n clientID: v.string().optional(), // defined for \"desired\", undefined for \"got\"\n});\n\nexport type QueryPatch = v.Infer<typeof queryPatchSchema>;\n\nexport type PutQueryPatch = QueryPatch & {op: 'put'};\nexport type DelQueryPatch = QueryPatch & {op: 'del'};\n\nexport const metadataPatchSchema = queryPatchSchema;\n\nexport type MetadataPatch = v.Infer<typeof metadataPatchSchema>;\n\nexport function versionString(v: CVRVersion) {\n // The separator (e.g. \":\") needs to be lexicographically greater than the\n // storage key path separator (e.g. \"/\") so that \"01/row-hash\" is less than \"01:01/row-hash\".\n // In particular, the traditional separator for major.minor versions (\".\") does not\n // satisfy this quality.\n return v.configVersion\n ? `${v.stateVersion}:${versionToLexi(v.configVersion)}`\n : v.stateVersion;\n}\n\nexport function versionFromString(str: string): CVRVersion {\n const parts = str.split(':');\n const stateVersion = parts[0];\n switch (parts.length) {\n case 1: {\n stateVersionFromString(stateVersion); // Purely for validation.\n return {stateVersion};\n }\n case 2: {\n const configVersion = versionFromLexi(parts[1]);\n if (configVersion > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new Error(`minorVersion ${parts[1]} exceeds max safe integer`);\n }\n return {stateVersion, configVersion: Number(configVersion)};\n }\n default:\n throw new TypeError(`Invalid version string ${str}`);\n }\n}\n\nexport function queryRecordToQueryRow(\n clientGroupID: string,\n query: QueryRecord,\n): QueriesRow {\n switch (query.type) {\n case 'internal':\n return {\n clientGroupID,\n queryHash: query.id,\n clientAST: query.ast,\n queryName: null,\n queryArgs: null,\n patchVersion: null,\n transformationHash: query.transformationHash ?? null,\n transformationVersion: maybeVersionString(query.transformationVersion),\n internal: true,\n deleted: false, // put vs del \"got\" query\n };\n case 'client':\n return {\n clientGroupID,\n queryHash: query.id,\n clientAST: query.ast,\n queryName: null,\n queryArgs: null,\n patchVersion: maybeVersionString(query.patchVersion),\n transformationHash: query.transformationHash ?? null,\n transformationVersion: maybeVersionString(query.transformationVersion),\n internal: null,\n deleted: false, // put vs del \"got\" query\n };\n case 'custom':\n return {\n clientGroupID,\n queryHash: query.id,\n clientAST: null,\n queryName: query.name,\n queryArgs: query.args,\n patchVersion: maybeVersionString(query.patchVersion),\n transformationHash: query.transformationHash ?? null,\n transformationVersion: maybeVersionString(query.transformationVersion),\n internal: null,\n deleted: false, // put vs del \"got\" query\n };\n }\n}\n\nexport const maybeVersionString = (v: CVRVersion | undefined) =>\n v ? versionString(v) : null;\n"],"mappings":";;;;;;;;AAYA,IAAa,mBAAmB,eAAE,OAAO;CAIvC,cAAc,eAAE,QAAQ;CAkBxB,eAAe,eAAE,QAAQ,CAAC,UAAU;CACrC,CAAC;AAIF,IAAa,oBAAgC,EAC3C,cAAc,qBAAqB,EAAE,EACtC;AAED,SAAgB,SAAS,GAAmC;AAC1D,QAAO,MAAM,OACT,EAAC,cAAc,qBAAqB,EAAE,EAAC,GACvC;EACE,cAAc,EAAE;EAChB,gBAAgB,EAAE,iBAAiB,KAAK;EACzC;;AAKP,SAAgB,YACd,GACA,GACQ;AACR,QAAO,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,UAAO,EAAC,cAAa;EAEvB,KAAK,GAAG;GACN,MAAM,gBAAgB,gBAAgB,MAAM,GAAG;AAC/C,OAAI,gBAAgB,OAAO,OAAO,iBAAiB,CACjD,OAAM,IAAI,MAAM,gBAAgB,MAAM,GAAG,2BAA2B;AAEtE,UAAO;IAAC;IAAc,eAAe,OAAO,cAAc;IAAC;;EAE7D,QACE,OAAM,IAAI,UAAU,0BAA0B,MAAM;;;AAI1D,SAAgB,sBACd,eACA,OACY;AACZ,SAAQ,MAAM,MAAd;EACE,KAAK,WACH,QAAO;GACL;GACA,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,WAAW;GACX,WAAW;GACX,cAAc;GACd,oBAAoB,MAAM,sBAAsB;GAChD,uBAAuB,mBAAmB,MAAM,sBAAsB;GACtE,UAAU;GACV,SAAS;GACV;EACH,KAAK,SACH,QAAO;GACL;GACA,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,WAAW;GACX,WAAW;GACX,cAAc,mBAAmB,MAAM,aAAa;GACpD,oBAAoB,MAAM,sBAAsB;GAChD,uBAAuB,mBAAmB,MAAM,sBAAsB;GACtE,UAAU;GACV,SAAS;GACV;EACH,KAAK,SACH,QAAO;GACL;GACA,WAAW,MAAM;GACjB,WAAW;GACX,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,cAAc,mBAAmB,MAAM,aAAa;GACpD,oBAAoB,MAAM,sBAAsB;GAChD,uBAAuB,mBAAmB,MAAM,sBAAsB;GACtE,UAAU;GACV,SAAS;GACV;;;AAIP,IAAa,sBAAsB,MACjC,IAAI,cAAc,EAAE,GAAG"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../../../zero-cache/src/services/view-syncer/schema/types.ts"],"sourcesContent":["import {jsonValueSchema} from '../../../../../shared/src/bigint-json.ts';\nimport {jsonSchema} from '../../../../../shared/src/json-schema.ts';\nimport * as v from '../../../../../shared/src/valita.ts';\nimport {astSchema} from '../../../../../zero-protocol/src/ast.ts';\nimport {versionFromLexi, versionToLexi} from '../../../types/lexi-version.ts';\nimport {\n majorVersionToString,\n stateVersionFromString,\n} from '../../../types/state-version.ts';\nimport {ttlClockSchema} from '../ttl-clock.ts';\nimport type {QueriesRow} from './cvr.ts';\n\nexport const cvrVersionSchema = v.object({\n /**\n * The database `stateVersion` with which the rows in the CVR are consistent.\n */\n stateVersion: v.string(), // LexiVersion\n\n /**\n * `configVersion` is subversion of `stateVersion` that is initially absent for each\n * `stateVersion`, and incremented for configuration changes that affect the contents\n * of the CVR such as:\n *\n * * query set changes\n * * query transformation changes (which may happen for changes\n * in server-side logic or authorization policies)\n *\n * Such configuration changes are always correlated with a change to one or more\n * `/meta/...` records in the CVR, often (but not always) with corresponding\n * patches in `/patches/meta/...`.\n *\n * When the `stateVersion` moves forward, the `minorVersion` is reset to absent.\n * In this manner it behaves like the analogous concept in semantic versioning.\n */\n configVersion: v.number().optional(),\n});\n\nexport type CVRVersion = v.Infer<typeof cvrVersionSchema>;\n\nexport const EMPTY_CVR_VERSION: CVRVersion = {\n stateVersion: majorVersionToString(0),\n} as const;\n\nexport function oneAfter(v: NullableCVRVersion): CVRVersion {\n return v === null\n ? {stateVersion: majorVersionToString(0)}\n : {\n stateVersion: v.stateVersion,\n configVersion: (v.configVersion ?? 0) + 1,\n };\n}\n\nexport type NullableCVRVersion = CVRVersion | null;\n\nexport function cmpVersions(\n a: NullableCVRVersion,\n b: NullableCVRVersion,\n): number {\n return a === null && b === null\n ? 0\n : a === null\n ? -1\n : b === null\n ? 1\n : a.stateVersion < b.stateVersion\n ? -1\n : a.stateVersion > b.stateVersion\n ? 1\n : (a.configVersion ?? 0) - (b.configVersion ?? 0);\n}\n\nexport function maxVersion(a: CVRVersion, b?: CVRVersion): CVRVersion {\n return !b ? a : cmpVersions(b, a) > 0 ? b : a;\n}\n\nexport function versionToCookie(v: CVRVersion): string {\n return versionString(v);\n}\n\nexport function versionToNullableCookie(v: NullableCVRVersion): string | null {\n return v === null ? null : versionToCookie(v);\n}\n\nexport function cookieToVersion(cookie: string | null): NullableCVRVersion {\n if (cookie === null) {\n return null;\n }\n return versionFromString(cookie);\n}\n\n// Last Active tracking.\n\nexport const cvrIDSchema = v.object({id: v.string()});\nexport type CvrID = v.Infer<typeof cvrIDSchema>;\n\nconst cvrRecordSchema = v.object({\n /**\n * CVR records store the CVRVersion at which the record was last patched into\n * the CVR, which corresponds with a patch row that is cleaned up when the\n * record is changed (updated, deleted, and re-added in the case of rows).\n *\n * Tombstones are stored for row records but not for config records. This means\n * that \"orphaned\" delete patches for config records may exist, and therefore\n * scans of config patches must always run until the end of the list. On the\n * contrary, for row patches, the row record tombstones allow cleanup of delete\n * patches.\n */\n patchVersion: cvrVersionSchema,\n});\n\nexport const clientRecordSchema = v.object({\n /** The client ID, of which there can be multiple for a client group view. */\n id: v.string(),\n\n /** The client's desired query IDs. Patch information is stored in the QueryRecord. */\n desiredQueryIDs: v.array(v.string()),\n});\n\nexport type ClientRecord = v.Infer<typeof clientRecordSchema>;\n\nexport const baseQueryRecordSchema = v.object({\n /** The client-specified ID used to identify this query. Typically a hash. */\n id: v.string(),\n\n /**\n * The hash of the query after server-side transformations, which include:\n *\n * * Normalization (which may differ from what the client does)\n * * Query \"expansion\" to include primary keys and query-execution-related columns\n * * Authorization transforms\n *\n * Transformations depend on conditions that are independent of the db state version,\n * such as server-side logic and authorization policies. As such, the version of a CVR\n * version may need to be advanced independent of db state changes. This is done\n * via the `minorVersion` counter of the CVRVersion object, which is used to account\n * for both changes to the query set and changes to query transformations (which are\n * effectively remove-old-query + add-new-query).\n *\n * Note that the transformed AST itself is **not** stored, as the result of the previous\n * transformation is not useful in and of itself. If the current transformation results in\n * a different hash than that of the transformation used for the last version of the CVR,\n * it is simply handled by invalidating the existing rows, re-executed the query with\n * the new transformation, and advancing the CVR's `minorVersion` and this query's\n * `transformationVersion`.\n *\n * Note that the transformationHash is only stored when the query has reached the \"gotten\"\n * state. If the query is in the \"desired\" but not yet \"gotten\" state, the field is absent.\n */\n transformationHash: v.string().optional(),\n\n /**\n * The CVR version corresponding to the `transformationHash`. This essentially tracks when\n * this version of the query was effectively added to the CVR (as opposed to the\n * `patchVersion`, which is simply when the client was notified that its query was added\n * to the gotten set). Catchup of clients from old CVR versions require executing all\n * queries with a newer `transformationVersion`.\n */\n transformationVersion: cvrVersionSchema.optional(),\n\n /**\n * Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`\n * of every row currently attached to this query. Maintained incrementally by\n * `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline\n * (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a\n * signature-provider callback.\n *\n * Used to detect drift on re-hydration of queries containing the `Cap` operator,\n * which intentionally does not impose ordering and thus may pick a different N-row\n * subset on re-execution. Comparing the pre-hydration signature with the post-\n * hydration signature lets us force a `configVersion` bump so the standard CVR-diff\n * machinery emits the reconciling poke. Absent or `'0'` means the signature is\n * empty (no rows currently attached).\n */\n rowSetSignature: v.string().optional(),\n});\n\n/**\n * Internal queries track rows in the database for internal use, such as the\n * `lastMutationID`s in the `zero.clients` table. They participate in the standard\n * invalidation / update logic for row contents, but not in the desired/got or\n * size-based quota logic for client-requested queries.\n */\nexport const internalQueryRecordSchema = baseQueryRecordSchema.extend({\n type: v.literal('internal'),\n ast: astSchema,\n});\n\nexport type InternalQueryRecord = v.Infer<typeof internalQueryRecordSchema>;\n\nconst clientStateSchema = v.object({\n /**\n * The time at which the query was last inactivated. If this undefined or\n * missing then the query is active.\n *\n * Desired queries are always active and have an undefined inactivatedAt.\n */\n inactivatedAt: ttlClockSchema.optional(),\n\n /**\n * TTL, time to live in milliseconds. If the query is not updated within this\n * time. The time to live is the time after it has become inactive. Negative\n * values are treated as `'forever'`.\n *\n * We do clamp this to a maximum of 10 minutes, so that queries do not\n * live for a very long time in the CVR.\n */\n ttl: v.number(),\n\n /**\n * The version at which the client state changed (i.e. individual `patchVersion`s).\n */\n version: cvrVersionSchema,\n});\n\nconst externalQueryRecordSchema = baseQueryRecordSchema.extend({\n /**\n * The client state for this query, which includes the inactivatedAt, ttl and\n * version. The client state is stored in a record with the client ID as the\n * key.\n */\n clientState: v.record(clientStateSchema),\n\n // For queries, the `patchVersion` indicates when query was added to the got set,\n // and is absent if not yet gotten.\n patchVersion: cvrVersionSchema.optional(),\n});\n\nexport const clientQueryRecordSchema = externalQueryRecordSchema.extend({\n type: v.literal('client'),\n\n /** The original AST as supplied by the client. */\n ast: astSchema,\n});\n\nexport type ClientQueryRecord = v.Infer<typeof clientQueryRecordSchema>;\n\nexport const customQueryRecordSchema = externalQueryRecordSchema.extend({\n type: v.literal('custom'),\n name: v.string(),\n args: v.readonly(v.array(jsonSchema)),\n});\n\nexport type CustomQueryRecord = v.Infer<typeof customQueryRecordSchema>;\n\nexport const queryRecordSchema = v.union(\n clientQueryRecordSchema,\n customQueryRecordSchema,\n internalQueryRecordSchema,\n);\n\nexport type QueryRecord = v.Infer<typeof queryRecordSchema>;\n\nexport const rowIDSchema = v.object({\n schema: v.string(),\n table: v.string(),\n rowKey: v.record(jsonValueSchema),\n});\n\nexport type RowID = v.Infer<typeof rowIDSchema>;\n\nexport const rowRecordSchema = cvrRecordSchema.extend({\n id: rowIDSchema,\n rowVersion: v.string(), // '_0_version' of the row\n // query hashes => refCount, or `null` for a row that was removed from the\n // view (i.e. tombstone).\n refCounts: v.record(v.number()).nullable(),\n});\n\nexport type RowRecord = v.Infer<typeof rowRecordSchema>;\n\nexport const patchSchema = v.object({\n type: v.literalUnion('row', 'query'),\n op: v.literalUnion('put', 'del'),\n});\n\nexport const putRowPatchSchema = patchSchema.extend({\n type: v.literal('row'),\n op: v.literal('put'),\n id: rowIDSchema,\n rowVersion: v.string(), // '_0_version' of the row\n});\n\nexport type PutRowPatch = v.Infer<typeof putRowPatchSchema>;\n\nexport const delRowPatchSchema = patchSchema.extend({\n type: v.literal('row'),\n op: v.literal('del'),\n id: rowIDSchema,\n});\n\nexport type DelRowPatch = v.Infer<typeof delRowPatchSchema>;\n\nexport const rowPatchSchema = v.union(putRowPatchSchema, delRowPatchSchema);\n\nexport type RowPatch = v.Infer<typeof rowPatchSchema>;\n\nexport const queryPatchSchema = patchSchema.extend({\n type: v.literal('query'),\n id: v.string(),\n clientID: v.string().optional(), // defined for \"desired\", undefined for \"got\"\n});\n\nexport type QueryPatch = v.Infer<typeof queryPatchSchema>;\n\nexport type PutQueryPatch = QueryPatch & {op: 'put'};\nexport type DelQueryPatch = QueryPatch & {op: 'del'};\n\nexport const metadataPatchSchema = queryPatchSchema;\n\nexport type MetadataPatch = v.Infer<typeof metadataPatchSchema>;\n\nexport function versionString(v: CVRVersion) {\n // The separator (e.g. \":\") needs to be lexicographically greater than the\n // storage key path separator (e.g. \"/\") so that \"01/row-hash\" is less than \"01:01/row-hash\".\n // In particular, the traditional separator for major.minor versions (\".\") does not\n // satisfy this quality.\n return v.configVersion\n ? `${v.stateVersion}:${versionToLexi(v.configVersion)}`\n : v.stateVersion;\n}\n\nexport function versionFromString(str: string): CVRVersion {\n const parts = str.split(':');\n const stateVersion = parts[0];\n switch (parts.length) {\n case 1: {\n stateVersionFromString(stateVersion); // Purely for validation.\n return {stateVersion};\n }\n case 2: {\n const configVersion = versionFromLexi(parts[1]);\n if (configVersion > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new Error(`minorVersion ${parts[1]} exceeds max safe integer`);\n }\n return {stateVersion, configVersion: Number(configVersion)};\n }\n default:\n throw new TypeError(`Invalid version string ${str}`);\n }\n}\n\nexport function queryRecordToQueryRow(\n clientGroupID: string,\n query: QueryRecord,\n): QueriesRow {\n switch (query.type) {\n case 'internal':\n return {\n clientGroupID,\n queryHash: query.id,\n clientAST: query.ast,\n queryName: null,\n queryArgs: null,\n patchVersion: null,\n transformationHash: query.transformationHash ?? null,\n transformationVersion: maybeVersionString(query.transformationVersion),\n internal: true,\n deleted: false, // put vs del \"got\" query\n rowSetSignature: query.rowSetSignature ?? null,\n };\n case 'client':\n return {\n clientGroupID,\n queryHash: query.id,\n clientAST: query.ast,\n queryName: null,\n queryArgs: null,\n patchVersion: maybeVersionString(query.patchVersion),\n transformationHash: query.transformationHash ?? null,\n transformationVersion: maybeVersionString(query.transformationVersion),\n internal: null,\n deleted: false, // put vs del \"got\" query\n rowSetSignature: query.rowSetSignature ?? null,\n };\n case 'custom':\n return {\n clientGroupID,\n queryHash: query.id,\n clientAST: null,\n queryName: query.name,\n queryArgs: query.args,\n patchVersion: maybeVersionString(query.patchVersion),\n transformationHash: query.transformationHash ?? null,\n transformationVersion: maybeVersionString(query.transformationVersion),\n internal: null,\n deleted: false, // put vs del \"got\" query\n rowSetSignature: query.rowSetSignature ?? null,\n };\n }\n}\n\nexport const maybeVersionString = (v: CVRVersion | undefined) =>\n v ? versionString(v) : null;\n"],"mappings":";;;;;;;;AAYA,IAAa,mBAAmB,eAAE,OAAO;CAIvC,cAAc,eAAE,QAAQ;CAkBxB,eAAe,eAAE,QAAQ,CAAC,UAAU;CACrC,CAAC;AAIF,IAAa,oBAAgC,EAC3C,cAAc,qBAAqB,EAAE,EACtC;AAED,SAAgB,SAAS,GAAmC;AAC1D,QAAO,MAAM,OACT,EAAC,cAAc,qBAAqB,EAAE,EAAC,GACvC;EACE,cAAc,EAAE;EAChB,gBAAgB,EAAE,iBAAiB,KAAK;EACzC;;AAKP,SAAgB,YACd,GACA,GACQ;AACR,QAAO,MAAM,QAAQ,MAAM,OACvB,IACA,MAAM,OACJ,KACA,MAAM,OACJ,IACA,EAAE,eAAe,EAAE,eACjB,KACA,EAAE,eAAe,EAAE,eACjB,KACC,EAAE,iBAAiB,MAAM,EAAE,iBAAiB;;AAG3D,SAAgB,WAAW,GAAe,GAA4B;AACpE,QAAO,CAAC,IAAI,IAAI,YAAY,GAAG,EAAE,GAAG,IAAI,IAAI;;AAG9C,SAAgB,gBAAgB,GAAuB;AACrD,QAAO,cAAc,EAAE;;AAGzB,SAAgB,wBAAwB,GAAsC;AAC5E,QAAO,MAAM,OAAO,OAAO,gBAAgB,EAA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O;GACL;GACA,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,WAAW;GACX,WAAW;GACX,cAAc;GACd,oBAAoB,MAAM,sBAAsB;GAChD,uBAAuB,mBAAmB,MAAM,sBAAsB;GACtE,UAAU;GACV,SAAS;GACT,iBAAiB,MAAM,mBAAmB;GAC3C;EACH,KAAK,SACH,QAAO;GACL;GACA,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,WAAW;GACX,WAAW;GACX,cAAc,mBAAmB,MAAM,aAAa;GACpD,oBAAoB,MAAM,sBAAsB;GAChD,uBAAuB,mBAAmB,MAAM,sBAAsB;GACtE,UAAU;GACV,SAAS;GACT,iBAAiB,MAAM,mBAAmB;GAC3C;EACH,KAAK,SACH,QAAO;GACL;GACA,WAAW,MAAM;GACjB,WAAW;GACX,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,cAAc,mBAAmB,MAAM,aAAa;GACpD,oBAAoB,MAAM,sBAAsB;GAChD,uBAAuB,mBAAmB,MAAM,sBAAsB;GACtE,UAAU;GACV,SAAS;GACT,iBAAiB,MAAM,mBAAmB;GAC3C;;;AAIP,IAAa,sBAAsB,MACjC,IAAI,cAAc,EAAE,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-syncer.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/view-syncer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAcjD,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,yDAAyD,CAAC;AACzG,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,iDAAiD,CAAC;AAC1F,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uCAAuC,CAAC;AAQtE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KA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,GAC/B,OAAO,CAAC,IAAI,CAAC;IAiBV,UAAU,CACd,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,EAAE,iBAAiB,EACtB,mBAAmB,EAAE,OAAO,GAC3B,OAAO,CAAC,IAAI,CAAC;IAsCV,aAAa,CACjB,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC;IAszCd,OAAO,CACX,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,IAAI,CAAC;IA8IhB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BrB;;;OAGG;IACH,eAAe;CAGhB;AAsGD,qBAAa,cAAc;;gBAKb,EAAE,EAAE,UAAU;IAIpB,KAAK;IAOX,oBAAoB;IAMd,YAAY,CAAC,cAAc,CAAC,EAAE,MAAM;IAW1C,UAAU;IAWV,sCAAsC;IACtC,IAAI,IAAI,MAAM;IAKd;;;OAGG;IACH,YAAY,IAAI,MAAM;CAKvB"}
|
|
@@ -805,7 +805,7 @@ var ViewSyncerService = class {
|
|
|
805
805
|
const stateVersion = this.#pipelines.currentVersion();
|
|
806
806
|
lc = lc.withContext("stateVersion", stateVersion);
|
|
807
807
|
lc.info?.(`hydrating ${addQueries.length} queries`);
|
|
808
|
-
const updater = new CVRQueryDrivenUpdater(this.#cvrStore, cvr, stateVersion, this.#pipelines.replicaVersion);
|
|
808
|
+
const updater = new CVRQueryDrivenUpdater(this.#cvrStore, cvr, stateVersion, this.#pipelines.replicaVersion, (queryID) => this.#pipelines.rowSetSignature(queryID));
|
|
809
809
|
const { newVersion, queryPatches } = updater.trackQueries(lc, addQueries, removeQueries);
|
|
810
810
|
const pokers = startPoke(this.#getClients(), newVersion);
|
|
811
811
|
for (const patch of queryPatches) await pokers.addPatch(patch);
|
|
@@ -991,7 +991,7 @@ var ViewSyncerService = class {
|
|
|
991
991
|
const timer = new TimeSliceTimer(lc);
|
|
992
992
|
const { version, numChanges, changes } = this.#pipelines.advance(timer);
|
|
993
993
|
lc = lc.withContext("newVersion", version);
|
|
994
|
-
const updater = new CVRQueryDrivenUpdater(this.#cvrStore, cvr, version, this.#pipelines.replicaVersion);
|
|
994
|
+
const updater = new CVRQueryDrivenUpdater(this.#cvrStore, cvr, version, this.#pipelines.replicaVersion, (queryID) => this.#pipelines.rowSetSignature(queryID));
|
|
995
995
|
const pokers = startPoke(this.#getClients(cvr.version), updater.updatedVersion());
|
|
996
996
|
lc.debug?.(`applying ${numChanges} to advance to ${version}`);
|
|
997
997
|
try {
|