@rocicorp/zero 1.6.0-canary.11 → 1.6.0-canary.13
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/README.md +3 -28
- package/out/_virtual/{_@oxc-project_runtime@0.130.0 → _@oxc-project_runtime@0.122.0}/helpers/usingCtx.js +1 -1
- package/out/_virtual/_rolldown/runtime.js +1 -12
- package/out/analyze-query/src/analyze-cli.js.map +1 -1
- package/out/analyze-query/src/bin-analyze.js +1 -6
- package/out/analyze-query/src/bin-analyze.js.map +1 -1
- package/out/analyze-query/src/bin-transform.js.map +1 -1
- package/out/ast-to-zql/src/ast-to-zql.js.map +1 -1
- package/out/ast-to-zql/src/bin.js.map +1 -1
- package/out/ast-to-zql/src/format.js.map +1 -1
- package/out/datadog/src/datadog-log-sink.js.map +1 -1
- package/out/otel/src/enabled.js.map +1 -1
- package/out/otel/src/log-options.js.map +1 -1
- package/out/otel/src/maybe-time.js.map +1 -1
- package/out/otel/src/span.js.map +1 -1
- package/out/replicache/src/async-iterable-to-array.js.map +1 -1
- package/out/replicache/src/bg-interval.js.map +1 -1
- package/out/replicache/src/btree/diff.js.map +1 -1
- package/out/replicache/src/btree/node.js.map +1 -1
- package/out/replicache/src/btree/read.js.map +1 -1
- package/out/replicache/src/btree/splice.js.map +1 -1
- package/out/replicache/src/btree/write.js +3 -6
- package/out/replicache/src/btree/write.js.map +1 -1
- package/out/replicache/src/call-default-fetch.js.map +1 -1
- package/out/replicache/src/connection-loop-delegates.js.map +1 -1
- package/out/replicache/src/connection-loop.js.map +1 -1
- package/out/replicache/src/cookies.js.map +1 -1
- package/out/replicache/src/dag/chunk.js.map +1 -1
- package/out/replicache/src/dag/gc.js.map +1 -1
- package/out/replicache/src/dag/key.js.map +1 -1
- package/out/replicache/src/dag/lazy-store.js.map +1 -1
- package/out/replicache/src/dag/store-impl.js.map +1 -1
- package/out/replicache/src/dag/store.js.map +1 -1
- package/out/replicache/src/dag/visitor.js.map +1 -1
- package/out/replicache/src/db/commit.js.map +1 -1
- package/out/replicache/src/db/index.js.map +1 -1
- package/out/replicache/src/db/read.js.map +1 -1
- package/out/replicache/src/db/rebase.js.map +1 -1
- package/out/replicache/src/db/write.js.map +1 -1
- package/out/replicache/src/deleted-clients.js.map +1 -1
- package/out/replicache/src/error-responses.js.map +1 -1
- package/out/replicache/src/frozen-json.js.map +1 -1
- package/out/replicache/src/get-default-puller.js.map +1 -1
- package/out/replicache/src/get-default-pusher.js.map +1 -1
- package/out/replicache/src/get-kv-store-provider.js.map +1 -1
- package/out/replicache/src/hash.js.map +1 -1
- package/out/replicache/src/http-request-info.js.map +1 -1
- package/out/replicache/src/index-defs.js.map +1 -1
- package/out/replicache/src/kv/expo-sqlite/store.js.map +1 -1
- package/out/replicache/src/kv/idb-store-with-mem-fallback.js.map +1 -1
- package/out/replicache/src/kv/idb-store.js.map +1 -1
- package/out/replicache/src/kv/mem-store.js.map +1 -1
- package/out/replicache/src/kv/op-sqlite/store.js.map +1 -1
- package/out/replicache/src/kv/read-impl.js.map +1 -1
- package/out/replicache/src/kv/sqlite-store.d.ts.map +1 -1
- package/out/replicache/src/kv/sqlite-store.js +1 -4
- package/out/replicache/src/kv/sqlite-store.js.map +1 -1
- package/out/replicache/src/kv/throw-if-closed.js.map +1 -1
- package/out/replicache/src/kv/write-impl-base.js.map +1 -1
- package/out/replicache/src/kv/write-impl.js.map +1 -1
- package/out/replicache/src/lazy.js.map +1 -1
- package/out/replicache/src/log-options.js.map +1 -1
- package/out/replicache/src/make-idb-name.js.map +1 -1
- package/out/replicache/src/new-client-channel.js.map +1 -1
- package/out/replicache/src/on-persist-channel.js.map +1 -1
- package/out/replicache/src/patch-operation.js.map +1 -1
- package/out/replicache/src/pending-mutations.js.map +1 -1
- package/out/replicache/src/persist/client-gc.js.map +1 -1
- package/out/replicache/src/persist/client-group-gc.js.map +1 -1
- package/out/replicache/src/persist/client-groups.js +0 -40
- package/out/replicache/src/persist/client-groups.js.map +1 -1
- package/out/replicache/src/persist/clients.js +0 -28
- package/out/replicache/src/persist/clients.js.map +1 -1
- package/out/replicache/src/persist/collect-idb-databases.js.map +1 -1
- package/out/replicache/src/persist/gather-mem-only-visitor.js.map +1 -1
- package/out/replicache/src/persist/gather-not-cached-visitor.js.map +1 -1
- package/out/replicache/src/persist/heartbeat.js.map +1 -1
- package/out/replicache/src/persist/idb-databases-store-db-name.js.map +1 -1
- package/out/replicache/src/persist/idb-databases-store.js.map +1 -1
- package/out/replicache/src/persist/make-client-id.js.map +1 -1
- package/out/replicache/src/persist/persist.js.map +1 -1
- package/out/replicache/src/persist/refresh.js.map +1 -1
- package/out/replicache/src/process-scheduler.js.map +1 -1
- package/out/replicache/src/pusher.js.map +1 -1
- package/out/replicache/src/replicache-impl.js.map +1 -1
- package/out/replicache/src/report-error.js.map +1 -1
- package/out/replicache/src/request-idle.js.map +1 -1
- package/out/replicache/src/scan-iterator.js.map +1 -1
- package/out/replicache/src/scan-options.js.map +1 -1
- package/out/replicache/src/set-interval-with-signal.js.map +1 -1
- package/out/replicache/src/subscriptions.js.map +1 -1
- package/out/replicache/src/sync/diff.js.map +1 -1
- package/out/replicache/src/sync/ids.js.map +1 -1
- package/out/replicache/src/sync/patch.js.map +1 -1
- package/out/replicache/src/sync/pull-error.js.map +1 -1
- package/out/replicache/src/sync/pull.js.map +1 -1
- package/out/replicache/src/sync/push.js.map +1 -1
- package/out/replicache/src/sync/request-id.js.map +1 -1
- package/out/replicache/src/to-error.js.map +1 -1
- package/out/replicache/src/transaction-closed-error.js.map +1 -1
- package/out/replicache/src/transactions.js.map +1 -1
- package/out/replicache/src/with-transactions.js.map +1 -1
- package/out/shared/src/abort-error.js.map +1 -1
- package/out/shared/src/arrays.js.map +1 -1
- package/out/shared/src/asserts.js.map +1 -1
- package/out/shared/src/bigint-json.js.map +1 -1
- package/out/shared/src/binary-search.js.map +1 -1
- package/out/shared/src/broadcast-channel.js.map +1 -1
- package/out/shared/src/browser-env.js.map +1 -1
- package/out/shared/src/btree-set.js.map +1 -1
- package/out/shared/src/cache.js.map +1 -1
- package/out/shared/src/centroid.js.map +1 -1
- package/out/shared/src/custom-key-map.js.map +1 -1
- package/out/shared/src/custom-key-set.js.map +1 -1
- package/out/shared/src/deep-clone.js.map +1 -1
- package/out/shared/src/deep-merge.js.map +1 -1
- package/out/shared/src/document-visible.js.map +1 -1
- package/out/shared/src/dotenv.js.map +1 -1
- package/out/shared/src/error.js.map +1 -1
- package/out/shared/src/hash.js.map +1 -1
- package/out/shared/src/iterables.js.map +1 -1
- package/out/shared/src/json-schema.js.map +1 -1
- package/out/shared/src/json.js.map +1 -1
- package/out/shared/src/logging-test-utils.js.map +1 -1
- package/out/shared/src/logging.js.map +1 -1
- package/out/shared/src/map.js.map +1 -1
- package/out/shared/src/must.js.map +1 -1
- package/out/shared/src/object-traversal.js.map +1 -1
- package/out/shared/src/objects.js.map +1 -1
- package/out/shared/src/options.js.map +1 -1
- package/out/shared/src/parse-big-int.js.map +1 -1
- package/out/shared/src/promise-race.js.map +1 -1
- package/out/shared/src/queue.d.ts.map +1 -1
- package/out/shared/src/queue.js +21 -15
- package/out/shared/src/queue.js.map +1 -1
- package/out/shared/src/rand.js.map +1 -1
- package/out/shared/src/random-uint64.js.map +1 -1
- package/out/shared/src/random-values.js.map +1 -1
- package/out/shared/src/record-proxy.js.map +1 -1
- package/out/shared/src/resolved-promises.js.map +1 -1
- package/out/shared/src/sentinels.js.map +1 -1
- package/out/shared/src/set-utils.js.map +1 -1
- package/out/shared/src/size-of-value.js.map +1 -1
- package/out/shared/src/sleep.js.map +1 -1
- package/out/shared/src/sorted-entries.js.map +1 -1
- package/out/shared/src/string-compare.js.map +1 -1
- package/out/shared/src/subscribable.js.map +1 -1
- package/out/shared/src/tdigest-schema.js.map +1 -1
- package/out/shared/src/tdigest.js.map +1 -1
- package/out/shared/src/valita.js.map +1 -1
- package/out/z2s/src/compiler.js.map +1 -1
- package/out/z2s/src/sql.js.map +1 -1
- package/out/zero/package.js +23 -23
- package/out/zero/package.js.map +1 -1
- package/out/zero/src/build-schema.js.map +1 -1
- package/out/zero/src/zero-cache-dev.js.map +1 -1
- package/out/zero/src/zero-out.js.map +1 -1
- package/out/zero-cache/src/auth/auth.js.map +1 -1
- package/out/zero-cache/src/auth/jwt.js.map +1 -1
- package/out/zero-cache/src/auth/load-permissions.js.map +1 -1
- package/out/zero-cache/src/auth/read-authorizer.js.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/network.js.map +1 -1
- package/out/zero-cache/src/config/normalize.js.map +1 -1
- package/out/zero-cache/src/config/server-context.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +0 -5
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/custom/fetch.js.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.js.map +1 -1
- package/out/zero-cache/src/db/create.js.map +1 -1
- package/out/zero-cache/src/db/delete-lite-db.js.map +1 -1
- package/out/zero-cache/src/db/lite-tables.js.map +1 -1
- package/out/zero-cache/src/db/migration-lite.js +0 -19
- package/out/zero-cache/src/db/migration-lite.js.map +1 -1
- package/out/zero-cache/src/db/migration.js +0 -19
- package/out/zero-cache/src/db/migration.js.map +1 -1
- package/out/zero-cache/src/db/pg-copy-binary.js.map +1 -1
- package/out/zero-cache/src/db/pg-copy.js.map +1 -1
- package/out/zero-cache/src/db/pg-to-lite.js.map +1 -1
- package/out/zero-cache/src/db/pg-type-parser.js.map +1 -1
- package/out/zero-cache/src/db/run-transaction.js.map +1 -1
- package/out/zero-cache/src/db/specs.js.map +1 -1
- package/out/zero-cache/src/db/statements.js.map +1 -1
- package/out/zero-cache/src/db/transaction-pool.js.map +1 -1
- package/out/zero-cache/src/db/warmup.js.map +1 -1
- package/out/zero-cache/src/observability/events.js.map +1 -1
- package/out/zero-cache/src/observability/metrics.js.map +1 -1
- package/out/zero-cache/src/scripts/decommission.js.map +1 -1
- package/out/zero-cache/src/scripts/deploy-permissions.js.map +1 -1
- package/out/zero-cache/src/scripts/permissions.js.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.js +10 -11
- package/out/zero-cache/src/server/anonymous-otel-start.js.map +1 -1
- package/out/zero-cache/src/server/change-streamer.js.map +1 -1
- package/out/zero-cache/src/server/inspector-delegate.js.map +1 -1
- package/out/zero-cache/src/server/logging.js.map +1 -1
- package/out/zero-cache/src/server/main.js.map +1 -1
- package/out/zero-cache/src/server/mutator.js.map +1 -1
- package/out/zero-cache/src/server/otel-diag-logger.js.map +1 -1
- package/out/zero-cache/src/server/otel-log-sink.js.map +1 -1
- package/out/zero-cache/src/server/otel-start.js +1 -1
- package/out/zero-cache/src/server/otel-start.js.map +1 -1
- package/out/zero-cache/src/server/priority-op.js.map +1 -1
- package/out/zero-cache/src/server/reaper.js.map +1 -1
- package/out/zero-cache/src/server/replicator.js.map +1 -1
- package/out/zero-cache/src/server/runner/main.js.map +1 -1
- package/out/zero-cache/src/server/runner/run-worker.js.map +1 -1
- package/out/zero-cache/src/server/runner/runtime.js.map +1 -1
- package/out/zero-cache/src/server/runner/zero-dispatcher.js.map +1 -1
- package/out/zero-cache/src/server/shadow-syncer.js.map +1 -1
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/server/worker-dispatcher.js.map +1 -1
- package/out/zero-cache/src/server/worker-urls.js.map +1 -1
- package/out/zero-cache/src/services/analyze.d.ts.map +1 -1
- package/out/zero-cache/src/services/analyze.js +2 -5
- package/out/zero-cache/src/services/analyze.js.map +1 -1
- package/out/zero-cache/src/services/change-source/common/backfill-manager.js.map +1 -1
- package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.js.map +1 -1
- package/out/zero-cache/src/services/change-source/common/replica-schema.js.map +1 -1
- 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-metadata.js.map +1 -1
- 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.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/decommission.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/initial-sync.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput-parser.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/lsn.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/replication-slots.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/init.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/published.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/shard.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/validation.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/control.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/data.js +0 -2
- package/out/zero-cache/src/services/change-source/protocol/current/data.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/downstream.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/json.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/status.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/upstream.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/backup-monitor.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/broadcast.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-service.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/forwarder.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/replica-monitor.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/schema/init.js +25 -21
- package/out/zero-cache/src/services/change-streamer/schema/init.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/schema/tables.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/snapshot.js +0 -15
- package/out/zero-cache/src/services/change-streamer/snapshot.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/subscriber.js.map +1 -1
- package/out/zero-cache/src/services/heapz.js.map +1 -1
- package/out/zero-cache/src/services/http-service.js.map +1 -1
- package/out/zero-cache/src/services/life-cycle.js.map +1 -1
- package/out/zero-cache/src/services/limiter/sliding-window-limiter.js.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/error.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/replicator/change-processor.js.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.js.map +1 -1
- package/out/zero-cache/src/services/replicator/notifier.js.map +1 -1
- package/out/zero-cache/src/services/replicator/replication-status.js.map +1 -1
- package/out/zero-cache/src/services/replicator/replicator.js.map +1 -1
- package/out/zero-cache/src/services/replicator/reporter/recorder.js.map +1 -1
- package/out/zero-cache/src/services/replicator/reporter/report-schema.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/change-log.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/column-metadata.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/replication-state.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/table-metadata.js.map +1 -1
- package/out/zero-cache/src/services/replicator/write-worker-client.js.map +1 -1
- package/out/zero-cache/src/services/replicator/write-worker.js.map +1 -1
- package/out/zero-cache/src/services/run-ast.d.ts.map +1 -1
- package/out/zero-cache/src/services/run-ast.js +0 -1
- package/out/zero-cache/src/services/run-ast.js.map +1 -1
- package/out/zero-cache/src/services/runner.js.map +1 -1
- package/out/zero-cache/src/services/running-state.js.map +1 -1
- package/out/zero-cache/src/services/shadow-sync/shadow-sync-service.js.map +1 -1
- package/out/zero-cache/src/services/statz.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/active-users-gauge.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/connection-context-manager.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.js +1 -2
- package/out/zero-cache/src/services/view-syncer/cvr-purger.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/drain-coordinator.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts +14 -0
- package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js +25 -2
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/row-record-cache.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/row-set-signature.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/init.js +113 -97
- package/out/zero-cache/src/services/view-syncer/schema/init.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/types.js +1 -103
- package/out/zero-cache/src/services/view-syncer/schema/types.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/tracer.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/ttl-clock.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +1 -4
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/types/configuration-error.js.map +1 -1
- package/out/zero-cache/src/types/error-with-level.js.map +1 -1
- package/out/zero-cache/src/types/http.js.map +1 -1
- package/out/zero-cache/src/types/lexi-version.js.map +1 -1
- package/out/zero-cache/src/types/lite.js.map +1 -1
- package/out/zero-cache/src/types/names.js.map +1 -1
- package/out/zero-cache/src/types/pg-data-type.js.map +1 -1
- package/out/zero-cache/src/types/pg.js.map +1 -1
- package/out/zero-cache/src/types/processes.js.map +1 -1
- package/out/zero-cache/src/types/profiler.js.map +1 -1
- package/out/zero-cache/src/types/row-key.js.map +1 -1
- package/out/zero-cache/src/types/shards.js.map +1 -1
- package/out/zero-cache/src/types/sql.js.map +1 -1
- package/out/zero-cache/src/types/state-version.js.map +1 -1
- package/out/zero-cache/src/types/streams.js.map +1 -1
- package/out/zero-cache/src/types/strings.js.map +1 -1
- package/out/zero-cache/src/types/subscription.js.map +1 -1
- package/out/zero-cache/src/types/timeout.js.map +1 -1
- package/out/zero-cache/src/types/url-params.js.map +1 -1
- package/out/zero-cache/src/types/websocket-handoff.js.map +1 -1
- package/out/zero-cache/src/types/ws.js.map +1 -1
- package/out/zero-cache/src/workers/connect-params.js.map +1 -1
- package/out/zero-cache/src/workers/connection.js.map +1 -1
- package/out/zero-cache/src/workers/mutator.js.map +1 -1
- package/out/zero-cache/src/workers/replicator.js.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-cache/src/workers/syncer.js.map +1 -1
- package/out/zero-client/src/client/active-clients-manager.js.map +1 -1
- package/out/zero-client/src/client/connection-manager.js +1 -2
- package/out/zero-client/src/client/connection-manager.js.map +1 -1
- package/out/zero-client/src/client/connection.js.map +1 -1
- package/out/zero-client/src/client/context.js.map +1 -1
- package/out/zero-client/src/client/crud-impl.js.map +1 -1
- package/out/zero-client/src/client/crud.js.map +1 -1
- package/out/zero-client/src/client/custom.js +1 -2
- package/out/zero-client/src/client/custom.js.map +1 -1
- package/out/zero-client/src/client/delete-clients-manager.js.map +1 -1
- package/out/zero-client/src/client/enable-analytics.js.map +1 -1
- package/out/zero-client/src/client/error.js.map +1 -1
- package/out/zero-client/src/client/http-string.js.map +1 -1
- package/out/zero-client/src/client/inspector/client-group.js.map +1 -1
- package/out/zero-client/src/client/inspector/client.js.map +1 -1
- package/out/zero-client/src/client/inspector/html-dialog-prompt.js.map +1 -1
- package/out/zero-client/src/client/inspector/inspector.js.map +1 -1
- package/out/zero-client/src/client/inspector/lazy-inspector.js.map +1 -1
- package/out/zero-client/src/client/inspector/query.js.map +1 -1
- package/out/zero-client/src/client/ivm-branch.js.map +1 -1
- package/out/zero-client/src/client/keys.js.map +1 -1
- package/out/zero-client/src/client/log-options.js.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.js.map +1 -1
- package/out/zero-client/src/client/metrics.js.map +1 -1
- package/out/zero-client/src/client/mutation-tracker.js.map +1 -1
- package/out/zero-client/src/client/mutator-proxy.js.map +1 -1
- package/out/zero-client/src/client/options.js.map +1 -1
- package/out/zero-client/src/client/query-manager.js.map +1 -1
- package/out/zero-client/src/client/reload-error-handler.js.map +1 -1
- package/out/zero-client/src/client/server-option.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero-poke-handler.js.map +1 -1
- package/out/zero-client/src/client/zero-rep.js.map +1 -1
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.js +32 -58
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-client/src/util/nanoid.js.map +1 -1
- package/out/zero-client/src/util/socket.d.ts +3 -0
- package/out/zero-client/src/util/socket.d.ts.map +1 -0
- package/out/zero-client/src/util/socket.js +8 -0
- package/out/zero-client/src/util/socket.js.map +1 -0
- package/out/zero-protocol/src/analyze-query-result.js +0 -3
- package/out/zero-protocol/src/analyze-query-result.js.map +1 -1
- package/out/zero-protocol/src/application-error.js.map +1 -1
- package/out/zero-protocol/src/ast.js.map +1 -1
- package/out/zero-protocol/src/change-desired-queries.js +0 -1
- package/out/zero-protocol/src/change-desired-queries.js.map +1 -1
- package/out/zero-protocol/src/client-schema.js.map +1 -1
- package/out/zero-protocol/src/close-connection.js.map +1 -1
- package/out/zero-protocol/src/connect.js +0 -7
- package/out/zero-protocol/src/connect.js.map +1 -1
- package/out/zero-protocol/src/custom-queries.js.map +1 -1
- package/out/zero-protocol/src/data.js.map +1 -1
- package/out/zero-protocol/src/delete-clients.js.map +1 -1
- package/out/zero-protocol/src/down.js.map +1 -1
- package/out/zero-protocol/src/error.js +0 -7
- package/out/zero-protocol/src/error.js.map +1 -1
- package/out/zero-protocol/src/inspect-down.js.map +1 -1
- package/out/zero-protocol/src/inspect-up.js +0 -1
- package/out/zero-protocol/src/inspect-up.js.map +1 -1
- package/out/zero-protocol/src/mutate-server.js.map +1 -1
- package/out/zero-protocol/src/mutation-id.js.map +1 -1
- package/out/zero-protocol/src/mutation.js.map +1 -1
- package/out/zero-protocol/src/mutations-patch.js.map +1 -1
- package/out/zero-protocol/src/ping.js.map +1 -1
- package/out/zero-protocol/src/poke.js +0 -4
- package/out/zero-protocol/src/poke.js.map +1 -1
- package/out/zero-protocol/src/pong.js.map +1 -1
- package/out/zero-protocol/src/primary-key.js.map +1 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/pull.js.map +1 -1
- package/out/zero-protocol/src/push.js +0 -16
- package/out/zero-protocol/src/push.js.map +1 -1
- package/out/zero-protocol/src/queries-patch.js.map +1 -1
- package/out/zero-protocol/src/query-hash.js.map +1 -1
- package/out/zero-protocol/src/query-server.js.map +1 -1
- package/out/zero-protocol/src/row-patch.js.map +1 -1
- package/out/zero-protocol/src/up.js.map +1 -1
- package/out/zero-protocol/src/update-auth.js.map +1 -1
- package/out/zero-protocol/src/version.js.map +1 -1
- package/out/zero-react/src/use-connection-state.js +2 -4
- package/out/zero-react/src/use-connection-state.js.map +1 -1
- package/out/zero-react/src/use-query.js +4 -6
- package/out/zero-react/src/use-query.js.map +1 -1
- package/out/zero-react/src/use-zero-online.js +2 -4
- package/out/zero-react/src/use-zero-online.js.map +1 -1
- package/out/zero-react/src/zero-provider.js +12 -15
- package/out/zero-react/src/zero-provider.js.map +1 -1
- package/out/zero-schema/src/builder/relationship-builder.js.map +1 -1
- package/out/zero-schema/src/builder/schema-builder.js.map +1 -1
- package/out/zero-schema/src/builder/table-builder.js.map +1 -1
- package/out/zero-schema/src/compiled-permissions.js.map +1 -1
- package/out/zero-schema/src/name-mapper.js.map +1 -1
- package/out/zero-schema/src/permissions.js.map +1 -1
- package/out/zero-schema/src/schema-config.js.map +1 -1
- package/out/zero-server/src/adapters/drizzle.js.map +1 -1
- package/out/zero-server/src/adapters/kysely.js.map +1 -1
- package/out/zero-server/src/adapters/pg.js +1 -1
- package/out/zero-server/src/adapters/pg.js.map +1 -1
- package/out/zero-server/src/adapters/postgresjs.js.map +1 -1
- package/out/zero-server/src/adapters/prisma.js.map +1 -1
- package/out/zero-server/src/custom.js +1 -2
- package/out/zero-server/src/custom.js.map +1 -1
- package/out/zero-server/src/logging.js.map +1 -1
- package/out/zero-server/src/pg-query-executor.js.map +1 -1
- package/out/zero-server/src/process-mutations.js.map +1 -1
- package/out/zero-server/src/push-processor.js.map +1 -1
- package/out/zero-server/src/queries/process-queries.js.map +1 -1
- package/out/zero-server/src/schema.js.map +1 -1
- package/out/zero-server/src/zql-database.js.map +1 -1
- package/out/zero-solid/src/solid-view.js +1 -1
- package/out/zero-solid/src/solid-view.js.map +1 -1
- package/out/zero-solid/src/use-connection-state.js +1 -1
- package/out/zero-solid/src/use-connection-state.js.map +1 -1
- package/out/zero-solid/src/use-query.js +2 -2
- package/out/zero-solid/src/use-query.js.map +1 -1
- package/out/zero-solid/src/use-zero-online.js +1 -1
- package/out/zero-solid/src/use-zero-online.js.map +1 -1
- package/out/zero-solid/src/use-zero.js +1 -1
- package/out/zero-solid/src/use-zero.js.map +1 -1
- package/out/zero-types/src/format.js.map +1 -1
- package/out/zero-types/src/name-mapper.js.map +1 -1
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/builder/debug-delegate.d.ts +0 -5
- package/out/zql/src/builder/debug-delegate.d.ts.map +1 -1
- package/out/zql/src/builder/debug-delegate.js +1 -10
- package/out/zql/src/builder/debug-delegate.js.map +1 -1
- package/out/zql/src/builder/filter.js.map +1 -1
- package/out/zql/src/builder/like.js.map +1 -1
- package/out/zql/src/error.js.map +1 -1
- package/out/zql/src/ivm/array-view.js.map +1 -1
- package/out/zql/src/ivm/cap.js.map +1 -1
- package/out/zql/src/ivm/change.js.map +1 -1
- package/out/zql/src/ivm/constraint.js +1 -1
- package/out/zql/src/ivm/constraint.js.map +1 -1
- package/out/zql/src/ivm/data.js.map +1 -1
- package/out/zql/src/ivm/exists.js.map +1 -1
- package/out/zql/src/ivm/fan-in.js.map +1 -1
- package/out/zql/src/ivm/fan-out.js.map +1 -1
- package/out/zql/src/ivm/filter-operators.js.map +1 -1
- package/out/zql/src/ivm/filter-push.js.map +1 -1
- package/out/zql/src/ivm/filter.js.map +1 -1
- package/out/zql/src/ivm/flipped-join.d.ts +8 -4
- package/out/zql/src/ivm/flipped-join.d.ts.map +1 -1
- package/out/zql/src/ivm/flipped-join.js +63 -59
- package/out/zql/src/ivm/flipped-join.js.map +1 -1
- package/out/zql/src/ivm/join-utils.js.map +1 -1
- package/out/zql/src/ivm/join.js.map +1 -1
- package/out/zql/src/ivm/maybe-split-and-push-edit-change.js.map +1 -1
- package/out/zql/src/ivm/memory-source.js.map +1 -1
- package/out/zql/src/ivm/memory-storage.js.map +1 -1
- package/out/zql/src/ivm/operator.d.ts +1 -1
- package/out/zql/src/ivm/operator.js.map +1 -1
- package/out/zql/src/ivm/push-accumulated.js.map +1 -1
- package/out/zql/src/ivm/schema.d.ts +8 -0
- package/out/zql/src/ivm/schema.d.ts.map +1 -1
- package/out/zql/src/ivm/skip-yields.js.map +1 -1
- package/out/zql/src/ivm/skip.js.map +1 -1
- package/out/zql/src/ivm/source.js.map +1 -1
- package/out/zql/src/ivm/stream.js.map +1 -1
- package/out/zql/src/ivm/take.js.map +1 -1
- package/out/zql/src/ivm/union-fan-in.js.map +1 -1
- package/out/zql/src/ivm/union-fan-out.js.map +1 -1
- package/out/zql/src/ivm/view-apply-change.js.map +1 -1
- package/out/zql/src/mutate/crud.js.map +1 -1
- package/out/zql/src/mutate/custom.js.map +1 -1
- package/out/zql/src/mutate/mutator-registry.js.map +1 -1
- package/out/zql/src/mutate/mutator.js.map +1 -1
- package/out/zql/src/planner/planner-builder.js.map +1 -1
- package/out/zql/src/planner/planner-connection.js.map +1 -1
- package/out/zql/src/planner/planner-constraint.js.map +1 -1
- package/out/zql/src/planner/planner-debug.js.map +1 -1
- package/out/zql/src/planner/planner-fan-in.js.map +1 -1
- package/out/zql/src/planner/planner-fan-out.js.map +1 -1
- package/out/zql/src/planner/planner-graph.js.map +1 -1
- package/out/zql/src/planner/planner-join.d.ts.map +1 -1
- package/out/zql/src/planner/planner-join.js +1 -2
- package/out/zql/src/planner/planner-join.js.map +1 -1
- package/out/zql/src/planner/planner-node.js.map +1 -1
- package/out/zql/src/planner/planner-source.js.map +1 -1
- package/out/zql/src/planner/planner-terminus.js.map +1 -1
- package/out/zql/src/query/complete-ordering.js.map +1 -1
- package/out/zql/src/query/create-builder.js.map +1 -1
- package/out/zql/src/query/error.js.map +1 -1
- package/out/zql/src/query/escape-like.js.map +1 -1
- package/out/zql/src/query/expression.js.map +1 -1
- package/out/zql/src/query/measure-push-operator.js.map +1 -1
- package/out/zql/src/query/metrics-delegate.js.map +1 -1
- package/out/zql/src/query/named.js.map +1 -1
- package/out/zql/src/query/query-delegate-base.js.map +1 -1
- package/out/zql/src/query/query-impl.js +1 -1
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zql/src/query/query-internals.js.map +1 -1
- package/out/zql/src/query/query-registry.js.map +1 -1
- package/out/zql/src/query/runnable-query-impl.js.map +1 -1
- package/out/zql/src/query/static-query.js.map +1 -1
- package/out/zql/src/query/ttl.js.map +1 -1
- package/out/zql/src/query/validate-input.js.map +1 -1
- package/out/zqlite/src/database-storage.js.map +1 -1
- package/out/zqlite/src/db.js.map +1 -1
- package/out/zqlite/src/explain-queries.js.map +1 -1
- package/out/zqlite/src/internal/sql-inline.js.map +1 -1
- package/out/zqlite/src/internal/sql.js.map +1 -1
- package/out/zqlite/src/internal/statement-cache.js.map +1 -1
- package/out/zqlite/src/query-builder.js.map +1 -1
- package/out/zqlite/src/query-delegate.js.map +1 -1
- package/out/zqlite/src/resolve-scalar-subqueries.js.map +1 -1
- package/out/zqlite/src/sqlite-cost-model.js.map +1 -1
- package/out/zqlite/src/sqlite-stat-fanout.js.map +1 -1
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +6 -6
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +23 -23
- package/out/_virtual/__vite-optional-peer-dep_pg-native_pg.js +0 -13
- package/out/_virtual/__vite-optional-peer-dep_pg-native_pg.js.map +0 -1
- package/out/node_modules/.pnpm/@opentelemetry_semantic-conventions@1.41.1/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +0 -12
- package/out/node_modules/.pnpm/@opentelemetry_semantic-conventions@1.41.1/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +0 -1
- package/out/node_modules/.pnpm/pg-cloudflare@1.3.0/node_modules/pg-cloudflare/dist/empty.js +0 -11
- package/out/node_modules/.pnpm/pg-cloudflare@1.3.0/node_modules/pg-cloudflare/dist/empty.js.map +0 -1
- package/out/node_modules/.pnpm/pg-connection-string@2.12.0/node_modules/pg-connection-string/index.js +0 -130
- package/out/node_modules/.pnpm/pg-connection-string@2.12.0/node_modules/pg-connection-string/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg-int8@1.0.1/node_modules/pg-int8/index.js +0 -62
- package/out/node_modules/.pnpm/pg-int8@1.0.1/node_modules/pg-int8/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg-pool@3.13.0_pg@8.20.0/node_modules/pg-pool/index.js +0 -353
- package/out/node_modules/.pnpm/pg-pool@3.13.0_pg@8.20.0/node_modules/pg-pool/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/buffer-reader.js +0 -60
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/buffer-reader.js.map +0 -1
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/buffer-writer.js +0 -81
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/buffer-writer.js.map +0 -1
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/index.js +0 -35
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/messages.js +0 -167
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/messages.js.map +0 -1
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/parser.js +0 -288
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/parser.js.map +0 -1
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/serializer.js +0 -177
- package/out/node_modules/.pnpm/pg-protocol@1.13.0/node_modules/pg-protocol/dist/serializer.js.map +0 -1
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/index.js +0 -46
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/arrayParser.js +0 -16
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/arrayParser.js.map +0 -1
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/binaryParsers.js +0 -165
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/binaryParsers.js.map +0 -1
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/builtins.js +0 -81
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/builtins.js.map +0 -1
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/textParsers.js +0 -167
- package/out/node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/textParsers.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/esm/index.js +0 -19
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/esm/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/client.js +0 -508
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/client.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/connection-parameters.js +0 -104
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/connection-parameters.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/connection.js +0 -160
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/connection.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/cert-signatures.js +0 -97
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/cert-signatures.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/sasl.js +0 -131
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/sasl.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/utils-legacy.js +0 -39
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/utils-legacy.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/utils-webcrypto.js +0 -89
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/utils-webcrypto.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/utils.js +0 -13
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/crypto/utils.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/defaults.js +0 -46
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/defaults.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/index.js +0 -71
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/native/client.js +0 -226
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/native/client.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/native/index.js +0 -11
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/native/index.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/native/query.js +0 -117
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/native/query.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/query.js +0 -151
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/query.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/result.js +0 -76
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/result.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/stream.js +0 -73
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/stream.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/type-overrides.js +0 -35
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/type-overrides.js.map +0 -1
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/utils.js +0 -118
- package/out/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/utils.js.map +0 -1
- package/out/node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js +0 -147
- package/out/node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js.map +0 -1
- package/out/node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js +0 -21
- package/out/node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js.map +0 -1
- package/out/node_modules/.pnpm/postgres-array@2.0.0/node_modules/postgres-array/index.js +0 -84
- package/out/node_modules/.pnpm/postgres-array@2.0.0/node_modules/postgres-array/index.js.map +0 -1
- package/out/node_modules/.pnpm/postgres-bytea@1.0.1/node_modules/postgres-bytea/index.js +0 -28
- package/out/node_modules/.pnpm/postgres-bytea@1.0.1/node_modules/postgres-bytea/index.js.map +0 -1
- package/out/node_modules/.pnpm/postgres-date@1.0.7/node_modules/postgres-date/index.js +0 -65
- package/out/node_modules/.pnpm/postgres-date@1.0.7/node_modules/postgres-date/index.js.map +0 -1
- package/out/node_modules/.pnpm/postgres-interval@1.2.0/node_modules/postgres-interval/index.js +0 -107
- package/out/node_modules/.pnpm/postgres-interval@1.2.0/node_modules/postgres-interval/index.js.map +0 -1
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js +0 -696
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js.map +0 -1
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -44
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js.map +0 -1
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js +0 -1585
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js.map +0 -1
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js +0 -329
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js.map +0 -1
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/index.js +0 -13
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/index.js.map +0 -1
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js +0 -13
- package/out/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js.map +0 -1
- package/out/node_modules/.pnpm/solid-js@1.9.13/node_modules/solid-js/dist/server.js +0 -131
- package/out/node_modules/.pnpm/solid-js@1.9.13/node_modules/solid-js/dist/server.js.map +0 -1
- package/out/node_modules/.pnpm/solid-js@1.9.13/node_modules/solid-js/store/dist/server.js +0 -96
- package/out/node_modules/.pnpm/solid-js@1.9.13/node_modules/solid-js/store/dist/server.js.map +0 -1
- package/out/node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js +0 -95
- package/out/node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js.map +0 -1
- package/out/node_modules/.pnpm/xtend@4.0.2/node_modules/xtend/mutable.js +0 -18
- package/out/node_modules/.pnpm/xtend@4.0.2/node_modules/xtend/mutable.js.map +0 -1
- package/out/shared/src/ring-buffer.d.ts +0 -32
- package/out/shared/src/ring-buffer.d.ts.map +0 -1
- package/out/shared/src/ring-buffer.js +0 -109
- package/out/shared/src/ring-buffer.js.map +0 -1
|
@@ -4,137 +4,153 @@ import { createRowsVersionTable, setupCVRTables } from "./cvr.js";
|
|
|
4
4
|
//#region ../zero-cache/src/services/view-syncer/schema/init.ts
|
|
5
5
|
async function initViewSyncerSchema(log, db, shard) {
|
|
6
6
|
const schema = cvrSchema(shard);
|
|
7
|
-
|
|
7
|
+
const setupMigration = {
|
|
8
8
|
migrateSchema: (lc, tx) => setupCVRTables(lc, tx, shard),
|
|
9
9
|
minSafeVersion: 1
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
for await (const versions of tx`
|
|
10
|
+
};
|
|
11
|
+
const migrateV1toV2 = { migrateSchema: async (_, tx) => {
|
|
12
|
+
await tx`ALTER TABLE ${tx(schema)}.instances ADD "replicaVersion" TEXT`;
|
|
13
|
+
} };
|
|
14
|
+
const migrateV2ToV3 = {
|
|
15
|
+
migrateSchema: async (_, tx) => {
|
|
16
|
+
await tx.unsafe(createRowsVersionTable(shard));
|
|
17
|
+
},
|
|
18
|
+
migrateData: async (lc, tx) => {
|
|
19
|
+
const pending = [];
|
|
20
|
+
for await (const versions of tx`
|
|
22
21
|
SELECT "clientGroupID", "version" FROM ${tx(schema)}.instances`.cursor(5e3)) for (const version of versions) pending.push(tx`INSERT INTO ${tx(schema)}."rowsVersion" ${tx(version)}
|
|
23
22
|
ON CONFLICT ("clientGroupID")
|
|
24
23
|
DO UPDATE SET ${tx(version)}`.execute());
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
await tx`
|
|
24
|
+
lc.info?.(`initializing rowsVersion for ${pending.length} cvrs`);
|
|
25
|
+
await Promise.all(pending);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const migrateV3ToV4 = { migrateSchema: async (_, tx) => {
|
|
29
|
+
await tx`ALTER TABLE ${tx(schema)}.instances ADD "owner" TEXT`;
|
|
30
|
+
await tx`ALTER TABLE ${tx(schema)}.instances ADD "grantedAt" TIMESTAMPTZ`;
|
|
31
|
+
} };
|
|
32
|
+
const migrateV5ToV6 = { migrateSchema: async (_, tx) => {
|
|
33
|
+
await tx`
|
|
36
34
|
ALTER TABLE ${tx(schema)}."rows"
|
|
37
35
|
DROP CONSTRAINT fk_rows_client_group`;
|
|
38
|
-
|
|
36
|
+
await tx`
|
|
39
37
|
ALTER TABLE ${tx(schema)}."rowsVersion"
|
|
40
38
|
DROP CONSTRAINT fk_rows_version_client_group`;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
39
|
+
} };
|
|
40
|
+
const migrateV6ToV7 = { migrateSchema: async (_, tx) => {
|
|
41
|
+
await tx`ALTER TABLE ${tx(schema)}.desires ADD "expiresAt" TIMESTAMPTZ`;
|
|
42
|
+
await tx`ALTER TABLE ${tx(schema)}.desires ADD "inactivatedAt" TIMESTAMPTZ`;
|
|
43
|
+
await tx`ALTER TABLE ${tx(schema)}.desires ADD "ttl" INTERVAL`;
|
|
44
|
+
await tx`CREATE INDEX desires_expires_at ON ${tx(schema)}.desires ("expiresAt")`;
|
|
45
|
+
await tx`CREATE INDEX desires_inactivated_at ON ${tx(schema)}.desires ("inactivatedAt")`;
|
|
46
|
+
} };
|
|
47
|
+
const migrateV7ToV8 = { migrateSchema: async (_, tx) => {
|
|
48
|
+
await tx`ALTER TABLE ${tx(schema)}."desires" DROP CONSTRAINT fk_desires_client`;
|
|
49
|
+
} };
|
|
50
|
+
const migrateV8ToV9 = { migrateSchema: async (_, tx) => {
|
|
51
|
+
await tx`ALTER TABLE ${tx(schema)}.instances ADD "clientSchema" JSONB`;
|
|
52
|
+
} };
|
|
53
|
+
const migrateV9ToV10 = { migrateSchema: async (_, tx) => {
|
|
54
|
+
await tx`ALTER TABLE ${tx(schema)}.queries ADD "queryName" TEXT`;
|
|
55
|
+
await tx`ALTER TABLE ${tx(schema)}.queries ADD "queryArgs" JSONB`;
|
|
56
|
+
await tx`ALTER TABLE ${tx(schema)}.queries ALTER COLUMN "clientAST" DROP NOT NULL`;
|
|
57
|
+
} };
|
|
58
|
+
const migrateV10ToV11 = { migrateSchema: async (_, tx) => {
|
|
59
|
+
await tx`DROP INDEX IF EXISTS ${tx(schema)}.desires_expires_at`;
|
|
60
|
+
await tx`ALTER TABLE ${tx(schema)}.desires DROP COLUMN "expiresAt"`;
|
|
61
|
+
await tx`DROP INDEX IF EXISTS ${tx(schema)}.client_patch_version`;
|
|
62
|
+
await tx`ALTER TABLE ${tx(schema)}.clients DROP COLUMN "patchVersion"`;
|
|
63
|
+
await tx`ALTER TABLE ${tx(schema)}.clients DROP COLUMN "deleted"`;
|
|
64
|
+
} };
|
|
65
|
+
const migratedV11ToV12 = { migrateSchema: async (_, tx) => {
|
|
66
|
+
await tx`ALTER TABLE ${tx(schema)}.queries ALTER COLUMN "queryArgs" TYPE JSON USING "queryArgs"::JSON`;
|
|
67
|
+
} };
|
|
68
|
+
const migratedV12ToV13 = { migrateSchema: async (_, tx) => {
|
|
69
|
+
await tx`ALTER TABLE ${tx(schema)}.instances ADD COLUMN "ttlClock" DOUBLE PRECISION NOT NULL DEFAULT 0`;
|
|
70
|
+
} };
|
|
71
|
+
const migratedV13ToV14 = { migrateSchema: async (_, sql) => {
|
|
72
|
+
await sql`
|
|
75
73
|
CREATE INDEX instances_last_active ON ${sql(schema)}.instances ("lastActive");
|
|
76
74
|
`;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
for (const [table, reference] of [
|
|
76
|
+
["clients", "instances"],
|
|
77
|
+
["queries", "instances"],
|
|
78
|
+
["rows", "rowsVersion"]
|
|
79
|
+
]) {
|
|
80
|
+
const constraint = sql(`fk_${table}_client_group`);
|
|
81
|
+
await sql`
|
|
84
82
|
ALTER TABLE ${sql(schema)}.${sql(table)} DROP CONSTRAINT IF EXISTS ${constraint}`;
|
|
85
|
-
|
|
83
|
+
await sql`
|
|
86
84
|
ALTER TABLE ${sql(schema)}.${sql(table)} ADD CONSTRAINT ${constraint}
|
|
87
85
|
FOREIGN KEY("clientGroupID")
|
|
88
86
|
REFERENCES ${sql(schema)}.${sql(reference)} ("clientGroupID")
|
|
89
87
|
ON DELETE CASCADE;
|
|
90
88
|
`;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
}
|
|
90
|
+
} };
|
|
91
|
+
const migratedV14ToV15 = {
|
|
92
|
+
migrateSchema: async (_, sql) => {
|
|
93
|
+
await sql`ALTER TABLE ${sql(schema)}.desires
|
|
96
94
|
ADD COLUMN "inactivatedAtMs" DOUBLE PRECISION`;
|
|
97
|
-
|
|
95
|
+
await sql`ALTER TABLE ${sql(schema)}.desires
|
|
98
96
|
ADD COLUMN "ttlMs" DOUBLE PRECISION`;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
},
|
|
98
|
+
migrateData: async (lc, sql) => {
|
|
99
|
+
lc.info?.("Migrating desires.inactivatedAt to inactivatedAtMs and ttl to ttlMs");
|
|
100
|
+
await sql`
|
|
103
101
|
UPDATE ${sql(schema)}.desires
|
|
104
102
|
SET "inactivatedAtMs" = EXTRACT(EPOCH FROM "inactivatedAt") * 1000,
|
|
105
103
|
"ttlMs" = EXTRACT(EPOCH FROM "ttl") * 1000
|
|
106
104
|
`;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const migratedV15ToV16 = {
|
|
108
|
+
migrateSchema: async (_, sql) => {
|
|
109
|
+
await sql`ALTER TABLE ${sql(schema)}.instances ADD COLUMN "profileID" TEXT`;
|
|
110
|
+
await sql`ALTER TABLE ${sql(schema)}.instances ADD COLUMN "deleted" BOOL DEFAULT FALSE`;
|
|
111
|
+
await sql`
|
|
114
112
|
DROP INDEX IF EXISTS ${sql(schema)}.instances_last_active`;
|
|
115
|
-
|
|
113
|
+
await sql`
|
|
116
114
|
CREATE INDEX instances_last_active ON ${sql(schema)}.instances ("lastActive")
|
|
117
115
|
WHERE NOT "deleted"`;
|
|
118
|
-
|
|
116
|
+
await sql`
|
|
119
117
|
CREATE INDEX tombstones_last_active ON ${sql(schema)}.instances ("lastActive")
|
|
120
118
|
WHERE "deleted"`;
|
|
121
|
-
|
|
119
|
+
await sql`
|
|
122
120
|
CREATE INDEX profile_ids_last_active ON ${sql(schema)}.instances ("lastActive", "profileID")
|
|
123
121
|
WHERE "profileID" IS NOT NULL`;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
},
|
|
123
|
+
migrateData: async (lc, sql) => {
|
|
124
|
+
lc.info?.("Backfilling instance.profileIDs");
|
|
125
|
+
await sql`
|
|
128
126
|
UPDATE ${sql(schema)}.instances
|
|
129
127
|
SET "profileID" = 'cg' || "clientGroupID"
|
|
130
128
|
WHERE "profileID" IS NULL
|
|
131
129
|
`;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const migratedV16ToV17 = { migrateSchema: async (_, sql) => {
|
|
133
|
+
await sql`ALTER TABLE ${sql(schema)}.queries ADD COLUMN "rowSetSignature" TEXT`;
|
|
134
|
+
} };
|
|
135
|
+
const schemaVersionMigrationMap = {
|
|
136
|
+
2: migrateV1toV2,
|
|
137
|
+
3: migrateV2ToV3,
|
|
138
|
+
4: migrateV3ToV4,
|
|
139
|
+
5: { minSafeVersion: 3 },
|
|
140
|
+
6: migrateV5ToV6,
|
|
141
|
+
7: migrateV6ToV7,
|
|
142
|
+
8: migrateV7ToV8,
|
|
143
|
+
9: migrateV8ToV9,
|
|
144
|
+
10: migrateV9ToV10,
|
|
145
|
+
11: migrateV10ToV11,
|
|
146
|
+
12: migratedV11ToV12,
|
|
147
|
+
13: migratedV12ToV13,
|
|
148
|
+
14: migratedV13ToV14,
|
|
149
|
+
15: migratedV14ToV15,
|
|
150
|
+
16: migratedV15ToV16,
|
|
151
|
+
17: migratedV16ToV17
|
|
152
|
+
};
|
|
153
|
+
await runSchemaMigrations(log, "view-syncer", cvrSchema(shard), db, setupMigration, schemaVersionMigrationMap);
|
|
138
154
|
}
|
|
139
155
|
//#endregion
|
|
140
156
|
export { initViewSyncerSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":[],"sources":["../../../../../../../zero-cache/src/services/view-syncer/schema/init.ts"],"sourcesContent":["import type {LogContext} from '@rocicorp/logger';\nimport type {PendingQuery, Row} from 'postgres';\nimport {\n runSchemaMigrations,\n type IncrementalMigrationMap,\n type Migration,\n} from '../../../db/migration.ts';\nimport type {PostgresDB} from '../../../types/pg.ts';\nimport {cvrSchema, type ShardID} from '../../../types/shards.ts';\nimport {createRowsVersionTable, setupCVRTables} from './cvr.ts';\n\nexport async function initViewSyncerSchema(\n log: LogContext,\n db: PostgresDB,\n shard: ShardID,\n): Promise<void> {\n const schema = cvrSchema(shard);\n\n const setupMigration: Migration = {\n migrateSchema: (lc, tx) => setupCVRTables(lc, tx, shard),\n minSafeVersion: 1,\n };\n\n const migrateV1toV2: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"replicaVersion\" TEXT`;\n },\n };\n\n const migrateV2ToV3: Migration = {\n migrateSchema: async (_, tx) => {\n await tx.unsafe(createRowsVersionTable(shard));\n },\n\n /** Populates the cvr.rowsVersion table with versions from cvr.instances. */\n migrateData: async (lc, tx) => {\n const pending: PendingQuery<Row[]>[] = [];\n for await (const versions of tx<\n {clientGroupID: string; version: string}[]\n >`\n SELECT \"clientGroupID\", \"version\" FROM ${tx(schema)}.instances`.cursor(\n 5000,\n )) {\n for (const version of versions) {\n pending.push(\n tx`INSERT INTO ${tx(schema)}.\"rowsVersion\" ${tx(version)} \n ON CONFLICT (\"clientGroupID\")\n DO UPDATE SET ${tx(version)}`.execute(),\n );\n }\n }\n lc.info?.(`initializing rowsVersion for ${pending.length} cvrs`);\n await Promise.all(pending);\n },\n };\n\n const migrateV3ToV4: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"owner\" TEXT`;\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"grantedAt\" TIMESTAMPTZ`;\n },\n };\n\n const migrateV5ToV6: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`\n ALTER TABLE ${tx(schema)}.\"rows\"\n DROP CONSTRAINT fk_rows_client_group`;\n await tx`\n ALTER TABLE ${tx(schema)}.\"rowsVersion\"\n DROP CONSTRAINT fk_rows_version_client_group`;\n },\n };\n\n const migrateV6ToV7: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.desires ADD \"expiresAt\" TIMESTAMPTZ`;\n await tx`ALTER TABLE ${tx(\n schema,\n )}.desires ADD \"inactivatedAt\" TIMESTAMPTZ`;\n await tx`ALTER TABLE ${tx(schema)}.desires ADD \"ttl\" INTERVAL`;\n\n await tx`CREATE INDEX desires_expires_at ON ${tx(\n schema,\n )}.desires (\"expiresAt\")`;\n await tx`CREATE INDEX desires_inactivated_at ON ${tx(\n schema,\n )}.desires (\"inactivatedAt\")`;\n },\n };\n\n const migrateV7ToV8: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(\n schema,\n )}.\"desires\" DROP CONSTRAINT fk_desires_client`;\n },\n };\n\n const migrateV8ToV9: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"clientSchema\" JSONB`;\n },\n };\n\n const migrateV9ToV10: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.queries ADD \"queryName\" TEXT`;\n await tx`ALTER TABLE ${tx(schema)}.queries ADD \"queryArgs\" JSONB`;\n await tx`ALTER TABLE ${tx(schema)}.queries ALTER COLUMN \"clientAST\" DROP NOT NULL`;\n },\n };\n\n const migrateV10ToV11: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`DROP INDEX IF EXISTS ${tx(schema)}.desires_expires_at`;\n await tx`ALTER TABLE ${tx(schema)}.desires DROP COLUMN \"expiresAt\"`;\n await tx`DROP INDEX IF EXISTS ${tx(schema)}.client_patch_version`;\n await tx`ALTER TABLE ${tx(schema)}.clients DROP COLUMN \"patchVersion\"`;\n await tx`ALTER TABLE ${tx(schema)}.clients DROP COLUMN \"deleted\"`;\n },\n };\n\n const migratedV11ToV12: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.queries ALTER COLUMN \"queryArgs\" TYPE JSON USING \"queryArgs\"::JSON`;\n },\n };\n\n const migratedV12ToV13: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD COLUMN \"ttlClock\" DOUBLE PRECISION NOT NULL DEFAULT 0`;\n },\n };\n\n const migratedV13ToV14: Migration = {\n migrateSchema: async (_, sql) => {\n await sql`\n CREATE INDEX instances_last_active ON ${sql(schema)}.instances (\"lastActive\");\n `;\n\n // Update / add foreign key constraints to cascade deletes.\n for (const [table, reference] of [\n ['clients', 'instances'],\n ['queries', 'instances'],\n ['rows', 'rowsVersion'],\n ] as [string, string][]) {\n const constraint = sql(`fk_${table}_client_group`);\n await sql`\n ALTER TABLE ${sql(schema)}.${sql(table)} DROP CONSTRAINT IF EXISTS ${constraint}`;\n await sql`\n ALTER TABLE ${sql(schema)}.${sql(table)} ADD CONSTRAINT ${constraint}\n FOREIGN KEY(\"clientGroupID\")\n REFERENCES ${sql(schema)}.${sql(reference)} (\"clientGroupID\")\n ON DELETE CASCADE;\n `;\n }\n },\n };\n\n const migratedV14ToV15: Migration = {\n migrateSchema: async (_, sql) => {\n // Add new columns for storing inactivatedAt and ttl in milliseconds.\n // This avoids postgres.js type conversion issues with TIMESTAMPTZ and INTERVAL.\n await sql`ALTER TABLE ${sql(schema)}.desires \n ADD COLUMN \"inactivatedAtMs\" DOUBLE PRECISION`;\n await sql`ALTER TABLE ${sql(schema)}.desires \n ADD COLUMN \"ttlMs\" DOUBLE PRECISION`;\n },\n // Migrate existing data: convert TIMESTAMPTZ to milliseconds for inactivatedAt\n // and INTERVAL to milliseconds for ttl\n // Note: EXTRACT(EPOCH FROM NULL) returns NULL, so NULL values are preserved\n migrateData: async (lc, sql) => {\n lc.info?.(\n 'Migrating desires.inactivatedAt to inactivatedAtMs and ttl to ttlMs',\n );\n await sql`\n UPDATE ${sql(schema)}.desires\n SET \"inactivatedAtMs\" = EXTRACT(EPOCH FROM \"inactivatedAt\") * 1000,\n \"ttlMs\" = EXTRACT(EPOCH FROM \"ttl\") * 1000\n `;\n },\n };\n\n const migratedV15ToV16: Migration = {\n migrateSchema: async (_, sql) => {\n await sql`ALTER TABLE ${sql(schema)}.instances ADD COLUMN \"profileID\" TEXT`;\n await sql`ALTER TABLE ${sql(schema)}.instances ADD COLUMN \"deleted\" BOOL DEFAULT FALSE`;\n\n // Recreate the instances_last_active index to exclude tombstones\n await sql`\n DROP INDEX IF EXISTS ${sql(schema)}.instances_last_active`;\n await sql`\n CREATE INDEX instances_last_active ON ${sql(schema)}.instances (\"lastActive\")\n WHERE NOT \"deleted\"`;\n await sql`\n CREATE INDEX tombstones_last_active ON ${sql(schema)}.instances (\"lastActive\")\n WHERE \"deleted\"`;\n await sql`\n CREATE INDEX profile_ids_last_active ON ${sql(schema)}.instances (\"lastActive\", \"profileID\")\n WHERE \"profileID\" IS NOT NULL`;\n },\n\n // Backfill profileIDs to the `cg${clientGroupID}`, as is done for\n // client groups from old zero-clients that don't send a profileID.\n migrateData: async (lc, sql) => {\n lc.info?.('Backfilling instance.profileIDs');\n await sql`\n UPDATE ${sql(schema)}.instances\n SET \"profileID\" = 'cg' || \"clientGroupID\"\n WHERE \"profileID\" IS NULL\n `;\n },\n };\n\n const migratedV16ToV17: Migration = {\n migrateSchema: async (_, sql) => {\n await sql`ALTER TABLE ${sql(schema)}.queries ADD COLUMN \"rowSetSignature\" TEXT`;\n },\n };\n\n const schemaVersionMigrationMap: IncrementalMigrationMap = {\n 2: migrateV1toV2,\n 3: migrateV2ToV3,\n 4: migrateV3ToV4,\n // v5 enables asynchronous row-record flushing, and thus relies on\n // the logic that updates and checks the rowsVersion table in v3.\n 5: {minSafeVersion: 3},\n 6: migrateV5ToV6,\n 7: migrateV6ToV7,\n 8: migrateV7ToV8,\n 9: migrateV8ToV9,\n // v10 adds queryName and queryArgs to the queries table to support\n // custom queries. clientAST is now optional to support migrating\n // off client queries.\n 10: migrateV9ToV10,\n // V11 removes the deprecated queries.\"expiresAt\", clients.\"patchVersion\",\n // clients.\"deleted\" columns.\n 11: migrateV10ToV11,\n 12: migratedV11ToV12,\n // V13 adds instances.\"ttlClock\"\n 13: migratedV12ToV13,\n // V14 adds an index on instances.\"lastActive\" and a FK constraint\n // from rows.\"clientGroupID\" to rowsVersion.\"clientGroupID\" for\n // garbage collection\n 14: migratedV13ToV14,\n // V15 adds desires.\"inactivatedAtTTLClock\" to store TTLClock values\n // directly as DOUBLE PRECISION, avoiding postgres.js TIMESTAMPTZ\n // type conversion issues\n 15: migratedV14ToV15,\n // V16 adds instances.\"profileID\" and a corresponding index for estimating\n // active user counts more accurately for apps that use memstore.\n 16: migratedV15ToV16,\n // V17 adds queries.\"rowSetSignature\" — XOR'd hash of row IDs attached to\n // each query, used to detect drift on re-hydration of queries containing\n // the Cap operator.\n 17: migratedV16ToV17,\n };\n\n await runSchemaMigrations(\n log,\n 'view-syncer',\n cvrSchema(shard),\n db,\n setupMigration,\n schemaVersionMigrationMap,\n );\n}\n"],"mappings":";;;;AAWA,eAAsB,qBACpB,KACA,IACA,OACe;CACf,MAAM,SAAS,UAAU,KAAK;CAmP9B,MAAM,oBACJ,KACA,eACA,UAAU,KAAK,GACf,IACA;EArPA,gBAAgB,IAAI,OAAO,eAAe,IAAI,IAAI,KAAK;EACvD,gBAAgB;CAoPhB,GACA;EA3CA,GAAG,EAtMH,eAAe,OAAO,GAAG,OAAO;GAC9B,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE;EACpC,EAoMG;EACH,GAAG;GAjMH,eAAe,OAAO,GAAG,OAAO;IAC9B,MAAM,GAAG,OAAO,uBAAuB,KAAK,CAAC;GAC/C;;GAGA,aAAa,OAAO,IAAI,OAAO;IAC7B,MAAM,UAAiC,CAAC;IACxC,WAAW,MAAM,YAAY,EAE5B;+CACwC,GAAG,MAAM,EAAE,YAAY,OAC9D,GACF,GACE,KAAK,MAAM,WAAW,UACpB,QAAQ,KACN,EAAE,eAAe,GAAG,MAAM,EAAE,iBAAiB,GAAG,OAAO,EAAE;;+BAEtC,GAAG,OAAO,IAAI,QAAQ,CAC3C;IAGJ,GAAG,OAAO,gCAAgC,QAAQ,OAAO,MAAM;IAC/D,MAAM,QAAQ,IAAI,OAAO;GAC3B;EA0KG;EACH,GAAG,EAvKH,eAAe,OAAO,GAAG,OAAO;GAC9B,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE;GAClC,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE;EACpC,EAoKG;EAGH,GAAG,EAAC,gBAAgB,EAAC;EACrB,GAAG,EApKH,eAAe,OAAO,GAAG,OAAO;GAC9B,MAAM,EAAE;oBACM,GAAG,MAAM,EAAE;;GAEzB,MAAM,EAAE;oBACM,GAAG,MAAM,EAAE;;EAE3B,EA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"init.js","names":[],"sources":["../../../../../../../zero-cache/src/services/view-syncer/schema/init.ts"],"sourcesContent":["import type {LogContext} from '@rocicorp/logger';\nimport type {PendingQuery, Row} from 'postgres';\nimport {\n runSchemaMigrations,\n type IncrementalMigrationMap,\n type Migration,\n} from '../../../db/migration.ts';\nimport type {PostgresDB} from '../../../types/pg.ts';\nimport {cvrSchema, type ShardID} from '../../../types/shards.ts';\nimport {createRowsVersionTable, setupCVRTables} from './cvr.ts';\n\nexport async function initViewSyncerSchema(\n log: LogContext,\n db: PostgresDB,\n shard: ShardID,\n): Promise<void> {\n const schema = cvrSchema(shard);\n\n const setupMigration: Migration = {\n migrateSchema: (lc, tx) => setupCVRTables(lc, tx, shard),\n minSafeVersion: 1,\n };\n\n const migrateV1toV2: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"replicaVersion\" TEXT`;\n },\n };\n\n const migrateV2ToV3: Migration = {\n migrateSchema: async (_, tx) => {\n await tx.unsafe(createRowsVersionTable(shard));\n },\n\n /** Populates the cvr.rowsVersion table with versions from cvr.instances. */\n migrateData: async (lc, tx) => {\n const pending: PendingQuery<Row[]>[] = [];\n for await (const versions of tx<\n {clientGroupID: string; version: string}[]\n >`\n SELECT \"clientGroupID\", \"version\" FROM ${tx(schema)}.instances`.cursor(\n 5000,\n )) {\n for (const version of versions) {\n pending.push(\n tx`INSERT INTO ${tx(schema)}.\"rowsVersion\" ${tx(version)} \n ON CONFLICT (\"clientGroupID\")\n DO UPDATE SET ${tx(version)}`.execute(),\n );\n }\n }\n lc.info?.(`initializing rowsVersion for ${pending.length} cvrs`);\n await Promise.all(pending);\n },\n };\n\n const migrateV3ToV4: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"owner\" TEXT`;\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"grantedAt\" TIMESTAMPTZ`;\n },\n };\n\n const migrateV5ToV6: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`\n ALTER TABLE ${tx(schema)}.\"rows\"\n DROP CONSTRAINT fk_rows_client_group`;\n await tx`\n ALTER TABLE ${tx(schema)}.\"rowsVersion\"\n DROP CONSTRAINT fk_rows_version_client_group`;\n },\n };\n\n const migrateV6ToV7: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.desires ADD \"expiresAt\" TIMESTAMPTZ`;\n await tx`ALTER TABLE ${tx(\n schema,\n )}.desires ADD \"inactivatedAt\" TIMESTAMPTZ`;\n await tx`ALTER TABLE ${tx(schema)}.desires ADD \"ttl\" INTERVAL`;\n\n await tx`CREATE INDEX desires_expires_at ON ${tx(\n schema,\n )}.desires (\"expiresAt\")`;\n await tx`CREATE INDEX desires_inactivated_at ON ${tx(\n schema,\n )}.desires (\"inactivatedAt\")`;\n },\n };\n\n const migrateV7ToV8: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(\n schema,\n )}.\"desires\" DROP CONSTRAINT fk_desires_client`;\n },\n };\n\n const migrateV8ToV9: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD \"clientSchema\" JSONB`;\n },\n };\n\n const migrateV9ToV10: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.queries ADD \"queryName\" TEXT`;\n await tx`ALTER TABLE ${tx(schema)}.queries ADD \"queryArgs\" JSONB`;\n await tx`ALTER TABLE ${tx(schema)}.queries ALTER COLUMN \"clientAST\" DROP NOT NULL`;\n },\n };\n\n const migrateV10ToV11: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`DROP INDEX IF EXISTS ${tx(schema)}.desires_expires_at`;\n await tx`ALTER TABLE ${tx(schema)}.desires DROP COLUMN \"expiresAt\"`;\n await tx`DROP INDEX IF EXISTS ${tx(schema)}.client_patch_version`;\n await tx`ALTER TABLE ${tx(schema)}.clients DROP COLUMN \"patchVersion\"`;\n await tx`ALTER TABLE ${tx(schema)}.clients DROP COLUMN \"deleted\"`;\n },\n };\n\n const migratedV11ToV12: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.queries ALTER COLUMN \"queryArgs\" TYPE JSON USING \"queryArgs\"::JSON`;\n },\n };\n\n const migratedV12ToV13: Migration = {\n migrateSchema: async (_, tx) => {\n await tx`ALTER TABLE ${tx(schema)}.instances ADD COLUMN \"ttlClock\" DOUBLE PRECISION NOT NULL DEFAULT 0`;\n },\n };\n\n const migratedV13ToV14: Migration = {\n migrateSchema: async (_, sql) => {\n await sql`\n CREATE INDEX instances_last_active ON ${sql(schema)}.instances (\"lastActive\");\n `;\n\n // Update / add foreign key constraints to cascade deletes.\n for (const [table, reference] of [\n ['clients', 'instances'],\n ['queries', 'instances'],\n ['rows', 'rowsVersion'],\n ] as [string, string][]) {\n const constraint = sql(`fk_${table}_client_group`);\n await sql`\n ALTER TABLE ${sql(schema)}.${sql(table)} DROP CONSTRAINT IF EXISTS ${constraint}`;\n await sql`\n ALTER TABLE ${sql(schema)}.${sql(table)} ADD CONSTRAINT ${constraint}\n FOREIGN KEY(\"clientGroupID\")\n REFERENCES ${sql(schema)}.${sql(reference)} (\"clientGroupID\")\n ON DELETE CASCADE;\n `;\n }\n },\n };\n\n const migratedV14ToV15: Migration = {\n migrateSchema: async (_, sql) => {\n // Add new columns for storing inactivatedAt and ttl in milliseconds.\n // This avoids postgres.js type conversion issues with TIMESTAMPTZ and INTERVAL.\n await sql`ALTER TABLE ${sql(schema)}.desires \n ADD COLUMN \"inactivatedAtMs\" DOUBLE PRECISION`;\n await sql`ALTER TABLE ${sql(schema)}.desires \n ADD COLUMN \"ttlMs\" DOUBLE PRECISION`;\n },\n // Migrate existing data: convert TIMESTAMPTZ to milliseconds for inactivatedAt\n // and INTERVAL to milliseconds for ttl\n // Note: EXTRACT(EPOCH FROM NULL) returns NULL, so NULL values are preserved\n migrateData: async (lc, sql) => {\n lc.info?.(\n 'Migrating desires.inactivatedAt to inactivatedAtMs and ttl to ttlMs',\n );\n await sql`\n UPDATE ${sql(schema)}.desires\n SET \"inactivatedAtMs\" = EXTRACT(EPOCH FROM \"inactivatedAt\") * 1000,\n \"ttlMs\" = EXTRACT(EPOCH FROM \"ttl\") * 1000\n `;\n },\n };\n\n const migratedV15ToV16: Migration = {\n migrateSchema: async (_, sql) => {\n await sql`ALTER TABLE ${sql(schema)}.instances ADD COLUMN \"profileID\" TEXT`;\n await sql`ALTER TABLE ${sql(schema)}.instances ADD COLUMN \"deleted\" BOOL DEFAULT FALSE`;\n\n // Recreate the instances_last_active index to exclude tombstones\n await sql`\n DROP INDEX IF EXISTS ${sql(schema)}.instances_last_active`;\n await sql`\n CREATE INDEX instances_last_active ON ${sql(schema)}.instances (\"lastActive\")\n WHERE NOT \"deleted\"`;\n await sql`\n CREATE INDEX tombstones_last_active ON ${sql(schema)}.instances (\"lastActive\")\n WHERE \"deleted\"`;\n await sql`\n CREATE INDEX profile_ids_last_active ON ${sql(schema)}.instances (\"lastActive\", \"profileID\")\n WHERE \"profileID\" IS NOT NULL`;\n },\n\n // Backfill profileIDs to the `cg${clientGroupID}`, as is done for\n // client groups from old zero-clients that don't send a profileID.\n migrateData: async (lc, sql) => {\n lc.info?.('Backfilling instance.profileIDs');\n await sql`\n UPDATE ${sql(schema)}.instances\n SET \"profileID\" = 'cg' || \"clientGroupID\"\n WHERE \"profileID\" IS NULL\n `;\n },\n };\n\n const migratedV16ToV17: Migration = {\n migrateSchema: async (_, sql) => {\n await sql`ALTER TABLE ${sql(schema)}.queries ADD COLUMN \"rowSetSignature\" TEXT`;\n },\n };\n\n const schemaVersionMigrationMap: IncrementalMigrationMap = {\n 2: migrateV1toV2,\n 3: migrateV2ToV3,\n 4: migrateV3ToV4,\n // v5 enables asynchronous row-record flushing, and thus relies on\n // the logic that updates and checks the rowsVersion table in v3.\n 5: {minSafeVersion: 3},\n 6: migrateV5ToV6,\n 7: migrateV6ToV7,\n 8: migrateV7ToV8,\n 9: migrateV8ToV9,\n // v10 adds queryName and queryArgs to the queries table to support\n // custom queries. clientAST is now optional to support migrating\n // off client queries.\n 10: migrateV9ToV10,\n // V11 removes the deprecated queries.\"expiresAt\", clients.\"patchVersion\",\n // clients.\"deleted\" columns.\n 11: migrateV10ToV11,\n 12: migratedV11ToV12,\n // V13 adds instances.\"ttlClock\"\n 13: migratedV12ToV13,\n // V14 adds an index on instances.\"lastActive\" and a FK constraint\n // from rows.\"clientGroupID\" to rowsVersion.\"clientGroupID\" for\n // garbage collection\n 14: migratedV13ToV14,\n // V15 adds desires.\"inactivatedAtTTLClock\" to store TTLClock values\n // directly as DOUBLE PRECISION, avoiding postgres.js TIMESTAMPTZ\n // type conversion issues\n 15: migratedV14ToV15,\n // V16 adds instances.\"profileID\" and a corresponding index for estimating\n // active user counts more accurately for apps that use memstore.\n 16: migratedV15ToV16,\n // V17 adds queries.\"rowSetSignature\" — XOR'd hash of row IDs attached to\n // each query, used to detect drift on re-hydration of queries containing\n // the Cap operator.\n 17: migratedV16ToV17,\n };\n\n await runSchemaMigrations(\n log,\n 'view-syncer',\n cvrSchema(shard),\n db,\n setupMigration,\n schemaVersionMigrationMap,\n );\n}\n"],"mappings":";;;;AAWA,eAAsB,qBACpB,KACA,IACA,OACe;CACf,MAAM,SAAS,UAAU,MAAM;CAE/B,MAAM,iBAA4B;EAChC,gBAAgB,IAAI,OAAO,eAAe,IAAI,IAAI,MAAM;EACxD,gBAAgB;EACjB;CAED,MAAM,gBAA2B,EAC/B,eAAe,OAAO,GAAG,OAAO;AAC9B,QAAM,EAAE,eAAe,GAAG,OAAO,CAAC;IAErC;CAED,MAAM,gBAA2B;EAC/B,eAAe,OAAO,GAAG,OAAO;AAC9B,SAAM,GAAG,OAAO,uBAAuB,MAAM,CAAC;;EAIhD,aAAa,OAAO,IAAI,OAAO;GAC7B,MAAM,UAAiC,EAAE;AACzC,cAAW,MAAM,YAAY,EAE5B;+CACwC,GAAG,OAAO,CAAC,YAAY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AAO,CAAC;AACpC,SAAM,GAAG,eAAe,IAAI,OAAO,CAAC;AAGpC,SAAM,GAAG;+BACgB,IAAI,OAAO,CAAC;AACrC,SAAM,GAAG;gDACiC,IAAI,OAAO,CAAC;;AAEtD,SAAM,GAAG;iDACkC,IAAI,OAAO,CAAC;;AAEvD,SAAM,GAAG;kDACmC,IAAI,OAAO,CAAC;;;EAM1D,aAAa,OAAO,IAAI,QAAQ;AAC9B,MAAG,OAAO,kCAAkC;AAC5C,SAAM,GAAG;iBACE,IAAI,OAAO,CAAC;;;;;EAK1B;CAED,MAAM,mBAA8B,EAClC,eAAe,OAAO,GAAG,QAAQ;AAC/B,QAAM,GAAG,eAAe,IAAI,OAAO,CAAC;IAEvC;CAED,MAAM,4BAAqD;EACzD,GAAG;EACH,GAAG;EACH,GAAG;EAGH,GAAG,EAAC,gBAAgB,GAAE;EACtB,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EAIH,IAAI;EAGJ,IAAI;EACJ,IAAI;EAEJ,IAAI;EAIJ,IAAI;EAIJ,IAAI;EAGJ,IAAI;EAIJ,IAAI;EACL;AAED,OAAM,oBACJ,KACA,eACA,UAAU,MAAM,EAChB,IACA,gBACA,0BACD"}
|
|
@@ -7,26 +7,7 @@ import { majorVersionToString, stateVersionFromString } from "../../../types/sta
|
|
|
7
7
|
import { ttlClockSchema } from "../ttl-clock.js";
|
|
8
8
|
//#region ../zero-cache/src/services/view-syncer/schema/types.ts
|
|
9
9
|
var cvrVersionSchema = valita_exports.object({
|
|
10
|
-
/**
|
|
11
|
-
* The database `stateVersion` with which the rows in the CVR are consistent.
|
|
12
|
-
*/
|
|
13
10
|
stateVersion: valita_exports.string(),
|
|
14
|
-
/**
|
|
15
|
-
* `configVersion` is subversion of `stateVersion` that is initially absent for each
|
|
16
|
-
* `stateVersion`, and incremented for configuration changes that affect the contents
|
|
17
|
-
* of the CVR such as:
|
|
18
|
-
*
|
|
19
|
-
* * query set changes
|
|
20
|
-
* * query transformation changes (which may happen for changes
|
|
21
|
-
* in server-side logic or authorization policies)
|
|
22
|
-
*
|
|
23
|
-
* Such configuration changes are always correlated with a change to one or more
|
|
24
|
-
* `/meta/...` records in the CVR, often (but not always) with corresponding
|
|
25
|
-
* patches in `/patches/meta/...`.
|
|
26
|
-
*
|
|
27
|
-
* When the `stateVersion` moves forward, the `minorVersion` is reset to absent.
|
|
28
|
-
* In this manner it behaves like the analogous concept in semantic versioning.
|
|
29
|
-
*/
|
|
30
11
|
configVersion: valita_exports.number().optional()
|
|
31
12
|
});
|
|
32
13
|
var EMPTY_CVR_VERSION = { stateVersion: majorVersionToString(0) };
|
|
@@ -53,75 +34,15 @@ function cookieToVersion(cookie) {
|
|
|
53
34
|
return versionFromString(cookie);
|
|
54
35
|
}
|
|
55
36
|
valita_exports.object({ id: valita_exports.string() });
|
|
56
|
-
var cvrRecordSchema = valita_exports.object({
|
|
57
|
-
/**
|
|
58
|
-
* CVR records store the CVRVersion at which the record was last patched into
|
|
59
|
-
* the CVR, which corresponds with a patch row that is cleaned up when the
|
|
60
|
-
* record is changed (updated, deleted, and re-added in the case of rows).
|
|
61
|
-
*
|
|
62
|
-
* Tombstones are stored for row records but not for config records. This means
|
|
63
|
-
* that "orphaned" delete patches for config records may exist, and therefore
|
|
64
|
-
* scans of config patches must always run until the end of the list. On the
|
|
65
|
-
* contrary, for row patches, the row record tombstones allow cleanup of delete
|
|
66
|
-
* patches.
|
|
67
|
-
*/
|
|
68
|
-
patchVersion: cvrVersionSchema });
|
|
37
|
+
var cvrRecordSchema = valita_exports.object({ patchVersion: cvrVersionSchema });
|
|
69
38
|
valita_exports.object({
|
|
70
|
-
/** The client ID, of which there can be multiple for a client group view. */
|
|
71
39
|
id: valita_exports.string(),
|
|
72
|
-
/** The client's desired query IDs. Patch information is stored in the QueryRecord. */
|
|
73
40
|
desiredQueryIDs: valita_exports.array(valita_exports.string())
|
|
74
41
|
});
|
|
75
42
|
var baseQueryRecordSchema = valita_exports.object({
|
|
76
|
-
/** The client-specified ID used to identify this query. Typically a hash. */
|
|
77
43
|
id: valita_exports.string(),
|
|
78
|
-
/**
|
|
79
|
-
* The hash of the query after server-side transformations, which include:
|
|
80
|
-
*
|
|
81
|
-
* * Normalization (which may differ from what the client does)
|
|
82
|
-
* * Query "expansion" to include primary keys and query-execution-related columns
|
|
83
|
-
* * Authorization transforms
|
|
84
|
-
*
|
|
85
|
-
* Transformations depend on conditions that are independent of the db state version,
|
|
86
|
-
* such as server-side logic and authorization policies. As such, the version of a CVR
|
|
87
|
-
* version may need to be advanced independent of db state changes. This is done
|
|
88
|
-
* via the `minorVersion` counter of the CVRVersion object, which is used to account
|
|
89
|
-
* for both changes to the query set and changes to query transformations (which are
|
|
90
|
-
* effectively remove-old-query + add-new-query).
|
|
91
|
-
*
|
|
92
|
-
* Note that the transformed AST itself is **not** stored, as the result of the previous
|
|
93
|
-
* transformation is not useful in and of itself. If the current transformation results in
|
|
94
|
-
* a different hash than that of the transformation used for the last version of the CVR,
|
|
95
|
-
* it is simply handled by invalidating the existing rows, re-executed the query with
|
|
96
|
-
* the new transformation, and advancing the CVR's `minorVersion` and this query's
|
|
97
|
-
* `transformationVersion`.
|
|
98
|
-
*
|
|
99
|
-
* Note that the transformationHash is only stored when the query has reached the "gotten"
|
|
100
|
-
* state. If the query is in the "desired" but not yet "gotten" state, the field is absent.
|
|
101
|
-
*/
|
|
102
44
|
transformationHash: valita_exports.string().optional(),
|
|
103
|
-
/**
|
|
104
|
-
* The CVR version corresponding to the `transformationHash`. This essentially tracks when
|
|
105
|
-
* this version of the query was effectively added to the CVR (as opposed to the
|
|
106
|
-
* `patchVersion`, which is simply when the client was notified that its query was added
|
|
107
|
-
* to the gotten set). Catchup of clients from old CVR versions require executing all
|
|
108
|
-
* queries with a newer `transformationVersion`.
|
|
109
|
-
*/
|
|
110
45
|
transformationVersion: cvrVersionSchema.optional(),
|
|
111
|
-
/**
|
|
112
|
-
* Hex-encoded XOR signature over `h64(JSON.stringify([schema, table, rowKey]))`
|
|
113
|
-
* of every row currently attached to this query. Maintained incrementally by
|
|
114
|
-
* `PipelineDriver` as ADDs / REMOVEs are yielded from the query's pipeline
|
|
115
|
-
* (EDITs no-op), and persisted via `CVRQueryDrivenUpdater.flush` by a
|
|
116
|
-
* signature-provider callback.
|
|
117
|
-
*
|
|
118
|
-
* Used to detect drift on re-hydration of queries containing the `Cap` operator,
|
|
119
|
-
* which intentionally does not impose ordering and thus may pick a different N-row
|
|
120
|
-
* subset on re-execution. Comparing the pre-hydration signature with the post-
|
|
121
|
-
* hydration signature lets us force a `configVersion` bump so the standard CVR-diff
|
|
122
|
-
* machinery emits the reconciling poke. Absent or `'0'` means the signature is
|
|
123
|
-
* empty (no rows currently attached).
|
|
124
|
-
*/
|
|
125
46
|
rowSetSignature: valita_exports.string().optional()
|
|
126
47
|
});
|
|
127
48
|
/**
|
|
@@ -135,39 +56,16 @@ var internalQueryRecordSchema = baseQueryRecordSchema.extend({
|
|
|
135
56
|
ast: astSchema
|
|
136
57
|
});
|
|
137
58
|
var clientStateSchema = valita_exports.object({
|
|
138
|
-
/**
|
|
139
|
-
* The time at which the query was last inactivated. If this undefined or
|
|
140
|
-
* missing then the query is active.
|
|
141
|
-
*
|
|
142
|
-
* Desired queries are always active and have an undefined inactivatedAt.
|
|
143
|
-
*/
|
|
144
59
|
inactivatedAt: ttlClockSchema.optional(),
|
|
145
|
-
/**
|
|
146
|
-
* TTL, time to live in milliseconds. If the query is not updated within this
|
|
147
|
-
* time. The time to live is the time after it has become inactive. Negative
|
|
148
|
-
* values are treated as `'forever'`.
|
|
149
|
-
*
|
|
150
|
-
* We do clamp this to a maximum of 10 minutes, so that queries do not
|
|
151
|
-
* live for a very long time in the CVR.
|
|
152
|
-
*/
|
|
153
60
|
ttl: valita_exports.number(),
|
|
154
|
-
/**
|
|
155
|
-
* The version at which the client state changed (i.e. individual `patchVersion`s).
|
|
156
|
-
*/
|
|
157
61
|
version: cvrVersionSchema
|
|
158
62
|
});
|
|
159
63
|
var externalQueryRecordSchema = baseQueryRecordSchema.extend({
|
|
160
|
-
/**
|
|
161
|
-
* The client state for this query, which includes the inactivatedAt, ttl and
|
|
162
|
-
* version. The client state is stored in a record with the client ID as the
|
|
163
|
-
* key.
|
|
164
|
-
*/
|
|
165
64
|
clientState: valita_exports.record(clientStateSchema),
|
|
166
65
|
patchVersion: cvrVersionSchema.optional()
|
|
167
66
|
});
|
|
168
67
|
var clientQueryRecordSchema = externalQueryRecordSchema.extend({
|
|
169
68
|
type: valita_exports.literal("client"),
|
|
170
|
-
/** The original AST as supplied by the client. */
|
|
171
69
|
ast: astSchema
|
|
172
70
|
});
|
|
173
71
|
var customQueryRecordSchema = externalQueryRecordSchema.extend({
|
|
@@ -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 * 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;;;;CAI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S;GACT,iBAAiB,MAAM,mBAAmB;EAC5C;EACF,KAAK,UACH,OAAO;GACL;GACA,WAAW,MAAM;GACjB,WAAW;GACX,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,cAAc,mBAAmB,MAAM,YAAY;GACnD,oBAAoB,MAAM,sBAAsB;GAChD,uBAAuB,mBAAmB,MAAM,qBAAqB;GACrE,UAAU;GACV,SAAS;GACT,iBAAiB,MAAM,mBAAmB;EAC5C;CACJ;AACF;AAEA,IAAa,sBAAsB,MACjC,IAAI,cAAc,CAAC,IAAI"}
|
|
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,E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