@rocicorp/zero 1.12.0-canary.3 → 1.12.0-canary.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/_virtual/{_@oxc-project_runtime@0.130.0/helpers → _@oxc-project_runtime@0.154.0/helpers/esm}/usingCtx.js +2 -2
- package/out/analyze-query/src/analyze-cli.d.ts.map +1 -1
- package/out/analyze-query/src/analyze-cli.js +6 -4
- package/out/analyze-query/src/analyze-cli.js.map +1 -1
- package/out/analyze-query/src/bin-transform.js +4 -3
- package/out/analyze-query/src/bin-transform.js.map +1 -1
- package/out/analyze-query/src/zql-chain.d.ts +23 -0
- package/out/analyze-query/src/zql-chain.d.ts.map +1 -0
- package/out/analyze-query/src/zql-chain.js +162 -0
- package/out/analyze-query/src/zql-chain.js.map +1 -0
- package/out/ast-to-zql/src/ast-to-zql.js.map +1 -1
- package/out/ast-to-zql/src/bin.js +4 -3
- 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 +5 -4
- package/out/datadog/src/datadog-log-sink.js.map +1 -1
- package/out/otel/src/log-options.js.map +1 -1
- package/out/replicache/src/btree/node.js +13 -11
- package/out/replicache/src/btree/node.js.map +1 -1
- package/out/replicache/src/btree/read.js +4 -2
- 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 +9 -5
- package/out/replicache/src/btree/write.js.map +1 -1
- package/out/replicache/src/config.js +1 -2
- package/out/replicache/src/connection-loop.js.map +1 -1
- package/out/replicache/src/dag/chunk.js +1 -1
- package/out/replicache/src/dag/gc.js.map +1 -1
- package/out/replicache/src/dag/lazy-store.js +8 -7
- package/out/replicache/src/dag/lazy-store.js.map +1 -1
- package/out/replicache/src/dag/store-impl.js +1 -1
- package/out/replicache/src/dag/store-impl.js.map +1 -1
- package/out/replicache/src/dag/visitor.js.map +1 -1
- package/out/replicache/src/db/commit.js +5 -3
- package/out/replicache/src/db/commit.js.map +1 -1
- package/out/replicache/src/db/read.js +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 +5 -2
- package/out/replicache/src/db/write.js.map +1 -1
- package/out/replicache/src/deleted-clients.js +3 -2
- package/out/replicache/src/deleted-clients.js.map +1 -1
- package/out/replicache/src/expo-sqlite.js +1 -2
- package/out/replicache/src/frozen-json.js +1 -1
- package/out/replicache/src/frozen-json.js.map +1 -1
- package/out/replicache/src/get-default-puller.js +1 -1
- package/out/replicache/src/hash.js +1 -1
- package/out/replicache/src/hash.js.map +1 -1
- package/out/replicache/src/impl.js +1 -2
- package/out/replicache/src/index-defs.js +5 -3
- package/out/replicache/src/index-defs.js.map +1 -1
- package/out/replicache/src/kv/expo-sqlite/store.js +1 -1
- package/out/replicache/src/kv/expo-sqlite/store.js.map +1 -1
- package/out/replicache/src/kv/idb-store.js +1 -1
- package/out/replicache/src/kv/idb-store.js.map +1 -1
- package/out/replicache/src/kv/mem-fallback-store.js +1 -1
- package/out/replicache/src/kv/mem-fallback-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/op-sqlite/types.js.map +1 -1
- package/out/replicache/src/kv/read-impl.js.map +1 -1
- package/out/replicache/src/kv/sqlite-store.js +1 -1
- package/out/replicache/src/kv/sqlite-store.js.map +1 -1
- package/out/replicache/src/kv/write-impl-base.js +4 -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/log-options.js +2 -1
- package/out/replicache/src/log-options.js.map +1 -1
- package/out/replicache/src/make-idb-name.js +1 -1
- package/out/replicache/src/new-client-channel.js +9 -7
- package/out/replicache/src/new-client-channel.js.map +1 -1
- package/out/replicache/src/on-persist-channel.js +1 -1
- package/out/replicache/src/on-persist-channel.js.map +1 -1
- package/out/replicache/src/op-sqlite.js +1 -2
- package/out/replicache/src/pending-mutations.js +2 -1
- package/out/replicache/src/pending-mutations.js.map +1 -1
- package/out/replicache/src/persist/client-gc.js +2 -2
- package/out/replicache/src/persist/client-gc.js.map +1 -1
- package/out/replicache/src/persist/client-group-gc.js +2 -2
- package/out/replicache/src/persist/client-group-gc.js.map +1 -1
- package/out/replicache/src/persist/client-groups.js +1 -1
- package/out/replicache/src/persist/client-groups.js.map +1 -1
- package/out/replicache/src/persist/clients.js +1 -1
- package/out/replicache/src/persist/clients.js.map +1 -1
- package/out/replicache/src/persist/collect-idb-databases.js +5 -4
- 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 +2 -2
- package/out/replicache/src/persist/heartbeat.js.map +1 -1
- package/out/replicache/src/persist/idb-databases-store.js +1 -1
- package/out/replicache/src/persist/idb-databases-store.js.map +1 -1
- package/out/replicache/src/persist/make-client-id.js +1 -1
- package/out/replicache/src/persist/make-client-id.js.map +1 -1
- package/out/replicache/src/persist/persist.js +3 -2
- package/out/replicache/src/persist/persist.js.map +1 -1
- package/out/replicache/src/persist/refresh.js +8 -5
- package/out/replicache/src/persist/refresh.js.map +1 -1
- package/out/replicache/src/process-scheduler.js.map +1 -1
- package/out/replicache/src/replicache-impl.js +3 -3
- package/out/replicache/src/replicache-impl.js.map +1 -1
- package/out/replicache/src/scan-iterator.js.map +1 -1
- package/out/replicache/src/scan-options.js +7 -6
- package/out/replicache/src/scan-options.js.map +1 -1
- package/out/replicache/src/sqlite.js +1 -2
- package/out/replicache/src/subscriptions.js +1 -1
- package/out/replicache/src/subscriptions.js.map +1 -1
- package/out/replicache/src/sync/diff.js +3 -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 +2 -4
- package/out/replicache/src/sync/patch.js.map +1 -1
- package/out/replicache/src/sync/pull.js +3 -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 +1 -1
- package/out/replicache/src/sync/request-id.js.map +1 -1
- package/out/replicache/src/transactions.js +1 -1
- package/out/replicache/src/transactions.js.map +1 -1
- package/out/shared/src/arrays.js +4 -1
- package/out/shared/src/arrays.js.map +1 -1
- package/out/shared/src/asserts.js +1 -1
- package/out/shared/src/bigint-json.d.ts +9 -0
- package/out/shared/src/bigint-json.d.ts.map +1 -1
- package/out/shared/src/bigint-json.js +27 -2
- package/out/shared/src/bigint-json.js.map +1 -1
- package/out/shared/src/broadcast-channel.js +1 -1
- package/out/shared/src/btree-set.js +11 -8
- package/out/shared/src/btree-set.js.map +1 -1
- package/out/shared/src/cache.js.map +1 -1
- package/out/shared/src/config.js +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 +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 +1 -1
- package/out/shared/src/error.js.map +1 -1
- package/out/shared/src/hash.js +2 -2
- 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 +1 -1
- package/out/shared/src/logging.js +1 -1
- package/out/shared/src/logging.js.map +1 -1
- package/out/shared/src/navigator.js +1 -1
- package/out/shared/src/options.js +9 -12
- package/out/shared/src/options.js.map +1 -1
- package/out/shared/src/promise-race.js.map +1 -1
- package/out/shared/src/queue.js.map +1 -1
- package/out/shared/src/record-proxy.js.map +1 -1
- package/out/shared/src/ring-buffer.js.map +1 -1
- package/out/shared/src/size-of-value.js +7 -10
- package/out/shared/src/size-of-value.js.map +1 -1
- package/out/shared/src/sorted-entries.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 +1 -1
- package/out/shared/src/valita.js.map +1 -1
- package/out/z2s/src/compiler.js +2 -4
- package/out/z2s/src/compiler.js.map +1 -1
- package/out/z2s/src/sql.js +1 -1
- package/out/z2s/src/sql.js.map +1 -1
- package/out/zero/package.js +211 -189
- package/out/zero/package.js.map +1 -1
- package/out/zero/src/adapters/drizzle.js +1 -2
- package/out/zero/src/adapters/kysely.js +1 -2
- package/out/zero/src/adapters/pg.js +1 -2
- package/out/zero/src/adapters/postgresjs.js +1 -2
- package/out/zero/src/adapters/prisma.js +1 -2
- package/out/zero/src/analyze.js +1 -2
- package/out/zero/src/change-protocol/v0.js +1 -2
- package/out/zero/src/expo-sqlite.js +1 -2
- package/out/zero/src/op-sqlite.js +1 -2
- package/out/zero/src/react-native.js.map +1 -1
- package/out/zero/src/sqlite.js +1 -2
- package/out/zero/src/zero-cache-dev.js +10 -9
- package/out/zero/src/zero-cache-dev.js.map +1 -1
- package/out/zero/src/zero-out.js +2 -1
- package/out/zero/src/zero-out.js.map +1 -1
- package/out/zero-cache/src/auth/auth.js +1 -1
- package/out/zero-cache/src/auth/auth.js.map +1 -1
- package/out/zero-cache/src/auth/jwt.js +4 -1
- package/out/zero-cache/src/auth/jwt.js.map +1 -1
- package/out/zero-cache/src/auth/load-permissions.js +1 -1
- package/out/zero-cache/src/auth/load-permissions.js.map +1 -1
- package/out/zero-cache/src/auth/read-authorizer.js +3 -2
- package/out/zero-cache/src/auth/read-authorizer.js.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js +6 -17
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/network.js +1 -1
- package/out/zero-cache/src/config/network.js.map +1 -1
- package/out/zero-cache/src/config/server-context.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +5 -0
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +13 -2
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/custom/fetch.js +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/index-predicate.js.map +1 -1
- package/out/zero-cache/src/db/lite-tables.d.ts +2 -2
- package/out/zero-cache/src/db/lite-tables.d.ts.map +1 -1
- package/out/zero-cache/src/db/lite-tables.js.map +1 -1
- package/out/zero-cache/src/db/migration-lite.js +1 -1
- package/out/zero-cache/src/db/migration-lite.js.map +1 -1
- package/out/zero-cache/src/db/migration.js +5 -3
- package/out/zero-cache/src/db/migration.js.map +1 -1
- package/out/zero-cache/src/db/pg-copy-binary.js +4 -3
- package/out/zero-cache/src/db/pg-copy-binary.js.map +1 -1
- package/out/zero-cache/src/db/pg-copy.js +0 -1
- package/out/zero-cache/src/db/pg-copy.js.map +1 -1
- package/out/zero-cache/src/db/pg-to-lite.js +1 -1
- package/out/zero-cache/src/db/pg-to-lite.js.map +1 -1
- package/out/zero-cache/src/db/run-transaction.js.map +1 -1
- package/out/zero-cache/src/db/specs.js +7 -5
- package/out/zero-cache/src/db/specs.js.map +1 -1
- package/out/zero-cache/src/db/sqlite-corruption.js.map +1 -1
- package/out/zero-cache/src/db/statements.d.ts.map +1 -1
- package/out/zero-cache/src/db/statements.js +9 -2
- package/out/zero-cache/src/db/statements.js.map +1 -1
- package/out/zero-cache/src/db/transaction-pool.js +5 -3
- 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/log-throttle.js.map +1 -1
- package/out/zero-cache/src/observability/metrics.js.map +1 -1
- package/out/zero-cache/src/scripts/decommission.js +1 -1
- package/out/zero-cache/src/scripts/deploy-permissions.js +5 -3
- 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 +2 -1
- package/out/zero-cache/src/server/anonymous-otel-start.js.map +1 -1
- package/out/zero-cache/src/server/change-streamer.js +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 +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/otel-log-sink.js.map +1 -1
- package/out/zero-cache/src/server/otel-start.js.map +1 -1
- package/out/zero-cache/src/server/reaper.js +2 -2
- package/out/zero-cache/src/server/reaper.js.map +1 -1
- package/out/zero-cache/src/server/replicator.js +1 -1
- package/out/zero-cache/src/server/replicator.js.map +1 -1
- package/out/zero-cache/src/server/runner/run-worker.js +2 -1
- package/out/zero-cache/src/server/runner/run-worker.js.map +1 -1
- package/out/zero-cache/src/server/runner/runtime.js +2 -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 +1 -1
- package/out/zero-cache/src/server/shadow-syncer.js.map +1 -1
- package/out/zero-cache/src/server/slot-keeper.js.map +1 -1
- package/out/zero-cache/src/server/syncer-assigner.js.map +1 -1
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +9 -4
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/server/worker-dispatcher.js +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.js +2 -2
- package/out/zero-cache/src/services/analyze.js.map +1 -1
- package/out/zero-cache/src/services/change-source/common/backfill-manager.js +2 -2
- 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/init-cleanup.js.map +1 -1
- package/out/zero-cache/src/services/change-source/common/replica-restore.js.map +1 -1
- package/out/zero-cache/src/services/change-source/common/replica-schema.js +4 -4
- 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 +4 -4
- 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 +4 -4
- 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-init.js +3 -3
- package/out/zero-cache/src/services/change-source/pg/change-source-init.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/change-source.js +6 -8
- 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 +2 -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 +9 -7
- 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 +5 -4
- 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-slot-cleanup-monitor.js +2 -2
- package/out/zero-cache/src/services/change-source/pg/replication-slot-cleanup-monitor.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/replication-slot-health.js +1 -1
- package/out/zero-cache/src/services/change-source/pg/replication-slot-health.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/replication-slots.js +3 -3
- 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 +2 -2
- 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/index-predicate.js +13 -12
- package/out/zero-cache/src/services/change-source/pg/schema/index-predicate.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/init.js +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 +2 -2
- 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/replica-stage-enum.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/shard.js +10 -7
- 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 +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/backfill-progress.js +1 -1
- package/out/zero-cache/src/services/change-source/protocol/backfill-progress.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.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/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-source/protocol/current.js +1 -1
- package/out/zero-cache/src/services/change-source/protocol/mod.js +1 -2
- package/out/zero-cache/src/services/change-streamer/backfill-state-tracker.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/backfill-state.js +1 -1
- package/out/zero-cache/src/services/change-streamer/backfill-state.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.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 +1 -1
- package/out/zero-cache/src/services/change-streamer/broadcast.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts +1 -1
- package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-log-codec.js +2 -3
- package/out/zero-cache/src/services/change-streamer/change-log-codec.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-log-initializer.js +3 -3
- package/out/zero-cache/src/services/change-streamer/change-log-initializer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-log-transaction-hash.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +5 -3
- 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 +21 -21
- 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 +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/drain-tracker.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/forwarder.js +11 -10
- package/out/zero-cache/src/services/change-streamer/forwarder.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.js +1 -1
- package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.js +3 -3
- package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/replica-poller.js +2 -2
- package/out/zero-cache/src/services/change-streamer/replica-poller.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/restore-admission.js +12 -1
- package/out/zero-cache/src/services/change-streamer/restore-admission.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/schema/init.js +1 -1
- 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 +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-message.js +1 -1
- package/out/zero-cache/src/services/change-streamer/snapshot-message.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/snapshot-reservations.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.js +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.js +2 -2
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-purge-scheduler.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.js +4 -6
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.js +3 -5
- package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/storer.js +3 -3
- package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/subscribe.js +1 -1
- package/out/zero-cache/src/services/change-streamer/subscribe.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/subscriber.js +2 -2
- package/out/zero-cache/src/services/change-streamer/subscriber.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/upstream-acker.js +0 -1
- package/out/zero-cache/src/services/change-streamer/upstream-acker.js.map +1 -1
- package/out/zero-cache/src/services/heapz.js +2 -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 +2 -2
- package/out/zero-cache/src/services/life-cycle.js.map +1 -1
- package/out/zero-cache/src/services/limiter/sliding-window-limiter.js +4 -2
- package/out/zero-cache/src/services/limiter/sliding-window-limiter.js.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.js +3 -3
- package/out/zero-cache/src/services/litestream/commands.js.map +1 -1
- package/out/zero-cache/src/services/litestream/litestream-checkpointer.js +2 -2
- package/out/zero-cache/src/services/litestream/litestream-checkpointer.js.map +1 -1
- package/out/zero-cache/src/services/litestream/litestream-controller.js.map +1 -1
- package/out/zero-cache/src/services/litestream/metrics.js.map +1 -1
- package/out/zero-cache/src/services/litestream/restore-progress.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js +3 -2
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/plannerz.js +6 -5
- package/out/zero-cache/src/services/plannerz.js.map +1 -1
- package/out/zero-cache/src/services/profz.js +5 -3
- package/out/zero-cache/src/services/profz.js.map +1 -1
- package/out/zero-cache/src/services/replicator/change-log-cookies.js.map +1 -1
- package/out/zero-cache/src/services/replicator/change-log-db.js +4 -3
- package/out/zero-cache/src/services/replicator/change-log-db.js.map +1 -1
- package/out/zero-cache/src/services/replicator/change-log-stream-writer.js +1 -1
- package/out/zero-cache/src/services/replicator/change-log-stream-writer.js.map +1 -1
- package/out/zero-cache/src/services/replicator/change-processor.js.map +1 -1
- package/out/zero-cache/src/services/replicator/drain-handler.js.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.js +4 -4
- 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 +4 -3
- 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 +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 +1 -1
- package/out/zero-cache/src/services/replicator/reporter/report-schema.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/backfilling.js +2 -2
- package/out/zero-cache/src/services/replicator/schema/backfilling.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/change-log.d.ts +19 -7
- package/out/zero-cache/src/services/replicator/schema/change-log.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/change-log.js +31 -15
- 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 +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 +10 -7
- 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/sqlite-change-log-observability.js +1 -1
- package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.js.map +1 -1
- package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.js +1 -1
- package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.js.map +1 -1
- package/out/zero-cache/src/services/replicator/write-worker-client.js +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 +3 -3
- package/out/zero-cache/src/services/replicator/write-worker.js.map +1 -1
- package/out/zero-cache/src/services/run-ast.js +1 -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 +4 -3
- package/out/zero-cache/src/services/statz.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/active-users-gauge.js +2 -2
- package/out/zero-cache/src/services/view-syncer/active-users-gauge.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/advancement-metrics.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/batch-pacer.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.js +24 -3
- package/out/zero-cache/src/services/view-syncer/client-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.d.ts +15 -2
- package/out/zero-cache/src/services/view-syncer/client-schema.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.js +46 -6
- 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.js +2 -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.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.js +11 -6
- package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +12 -4
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.js +1 -1
- package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.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/e2e-serving-lag.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/hydration-budget.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.js +2 -2
- package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js +6 -4
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +13 -10
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/plan-warnings.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/push-cost.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/push-cutoff.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/query-covering.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/query-shape.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/query-stats.js +1 -1
- package/out/zero-cache/src/services/view-syncer/query-stats.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/row-record-cache.js +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/schema/cvr.js +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/types.js +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/types.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.js +7 -1
- package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +8 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.js +7 -6
- package/out/zero-cache/src/services/view-syncer/snapshotter.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.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +19 -15
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/types/error-with-level.js.map +1 -1
- package/out/zero-cache/src/types/lexi-version.js.map +1 -1
- package/out/zero-cache/src/types/lite.js +1 -1
- package/out/zero-cache/src/types/lite.js.map +1 -1
- package/out/zero-cache/src/types/pg-data-type.js +1 -1
- package/out/zero-cache/src/types/pg-data-type.js.map +1 -1
- package/out/zero-cache/src/types/pg.js +6 -4
- package/out/zero-cache/src/types/pg.js.map +1 -1
- package/out/zero-cache/src/types/poke-chunk.js +2 -2
- package/out/zero-cache/src/types/poke-chunk.js.map +1 -1
- package/out/zero-cache/src/types/processes.js +1 -1
- package/out/zero-cache/src/types/processes.js.map +1 -1
- package/out/zero-cache/src/types/profiler.js +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/sql.js.map +1 -1
- package/out/zero-cache/src/types/streams.js +10 -9
- 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 +1 -1
- package/out/zero-cache/src/types/websocket-handoff.js +1 -1
- package/out/zero-cache/src/types/ws.js +1 -1
- package/out/zero-cache/src/workers/connection.js +5 -6
- 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 +5 -4
- package/out/zero-cache/src/workers/replicator.js.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js +9 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-cache/src/workers/syncer.js +4 -4
- package/out/zero-cache/src/workers/syncer.js.map +1 -1
- package/out/zero-client/src/client/active-clients-manager.js +1 -1
- package/out/zero-client/src/client/active-clients-manager.js.map +1 -1
- package/out/zero-client/src/client/bindings.js +11 -11
- package/out/zero-client/src/client/connection-manager.js.map +1 -1
- package/out/zero-client/src/client/connection.js +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 +1 -1
- package/out/zero-client/src/client/crud-impl.js.map +1 -1
- package/out/zero-client/src/client/crud.js +1 -1
- package/out/zero-client/src/client/crud.js.map +1 -1
- package/out/zero-client/src/client/custom.js +1 -1
- 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 +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/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 +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 +1 -3
- package/out/zero-client/src/client/ivm-branch.js.map +1 -1
- package/out/zero-client/src/client/keys.js +2 -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-replicache-mutators.js +5 -3
- package/out/zero-client/src/client/make-replicache-mutators.js.map +1 -1
- package/out/zero-client/src/client/metrics.js +3 -5
- 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 +2 -2
- package/out/zero-client/src/client/query-manager.js.map +1 -1
- package/out/zero-client/src/client/reload-error-handler.js +4 -3
- package/out/zero-client/src/client/reload-error-handler.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero-poke-handler.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.js +19 -11
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-client/src/mod.js +23 -23
- package/out/zero-client/src/util/nanoid.js.map +1 -1
- package/out/zero-permissions/src/permissions.js +3 -2
- package/out/zero-permissions/src/permissions.js.map +1 -1
- package/out/zero-pg/src/mod.js +9 -9
- package/out/zero-protocol/src/analyze-query-result.js +1 -1
- 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 +19 -9
- package/out/zero-protocol/src/ast.js.map +1 -1
- package/out/zero-protocol/src/change-desired-queries.js.map +1 -1
- package/out/zero-protocol/src/client-schema.js +1 -1
- package/out/zero-protocol/src/client-schema.js.map +1 -1
- package/out/zero-protocol/src/close-connection.js +1 -1
- package/out/zero-protocol/src/close-connection.js.map +1 -1
- package/out/zero-protocol/src/connect.js +1 -1
- package/out/zero-protocol/src/connect.js.map +1 -1
- package/out/zero-protocol/src/custom-queries.js +1 -1
- package/out/zero-protocol/src/custom-queries.js.map +1 -1
- package/out/zero-protocol/src/data.js +4 -2
- 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.d.ts +27 -27
- package/out/zero-protocol/src/down.js.map +1 -1
- package/out/zero-protocol/src/error.js.map +1 -1
- package/out/zero-protocol/src/inspect-down.d.ts +81 -81
- package/out/zero-protocol/src/inspect-down.js +1 -1
- package/out/zero-protocol/src/inspect-down.js.map +1 -1
- package/out/zero-protocol/src/inspect-up.js +1 -1
- package/out/zero-protocol/src/inspect-up.js.map +1 -1
- package/out/zero-protocol/src/mutate-server.js +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 +1 -1
- package/out/zero-protocol/src/mutation.js.map +1 -1
- package/out/zero-protocol/src/mutations-patch.js +1 -1
- package/out/zero-protocol/src/mutations-patch.js.map +1 -1
- package/out/zero-protocol/src/ping.js +1 -1
- package/out/zero-protocol/src/ping.js.map +1 -1
- package/out/zero-protocol/src/poke.d.ts +6 -6
- package/out/zero-protocol/src/poke.js +1 -1
- package/out/zero-protocol/src/poke.js.map +1 -1
- package/out/zero-protocol/src/pong.js +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 +1 -0
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/pull.js +1 -1
- package/out/zero-protocol/src/pull.js.map +1 -1
- package/out/zero-protocol/src/push.js +1 -1
- package/out/zero-protocol/src/push.js.map +1 -1
- package/out/zero-protocol/src/queries-patch.js +1 -1
- package/out/zero-protocol/src/queries-patch.js.map +1 -1
- package/out/zero-protocol/src/query-hash-visitor.js.map +1 -1
- package/out/zero-protocol/src/query-hash.js +2 -2
- package/out/zero-protocol/src/query-server.js +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.d.ts +60 -60
- 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/bindings.js +11 -11
- package/out/zero-react/src/mod.js +5 -5
- package/out/zero-react/src/use-query.js +1 -1
- package/out/zero-react/src/use-query.js.map +1 -1
- package/out/zero-react/src/zero-provider.d.ts +1 -1
- package/out/zero-react/src/zero-provider.d.ts.map +1 -1
- package/out/zero-react/src/zero-provider.js +2 -1
- package/out/zero-react/src/zero-provider.js.map +1 -1
- package/out/zero-react/src/zero.js +23 -23
- package/out/zero-schema/src/builder/schema-builder.js +3 -2
- package/out/zero-schema/src/builder/schema-builder.js.map +1 -1
- package/out/zero-schema/src/builder/table-builder.js +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 +7 -5
- package/out/zero-schema/src/name-mapper.js.map +1 -1
- package/out/zero-schema/src/schema-config.js +1 -1
- package/out/zero-schema/src/schema-config.js.map +1 -1
- package/out/zero-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.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/closable-db-transaction.js.map +1 -1
- package/out/zero-server/src/custom.js +1 -1
- package/out/zero-server/src/custom.js.map +1 -1
- package/out/zero-server/src/mod.js +8 -8
- 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 +2 -1
- package/out/zero-server/src/queries/process-queries.js.map +1 -1
- package/out/zero-server/src/schema.js +7 -7
- 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/bindings.js +11 -11
- package/out/zero-solid/src/mod.js +5 -5
- 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 +2 -1
- package/out/zero-solid/src/use-connection-state.js.map +1 -1
- package/out/zero-solid/src/use-query.js.map +1 -1
- package/out/zero-solid/src/use-zero-online.js +2 -1
- package/out/zero-solid/src/use-zero-online.js.map +1 -1
- package/out/zero-solid/src/use-zero.js +3 -2
- package/out/zero-solid/src/use-zero.js.map +1 -1
- package/out/zero-solid/src/zero.js +23 -23
- package/out/zero-types/src/name-mapper.js.map +1 -1
- package/out/zql/src/builder/builder.js +15 -13
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/builder/correlated-predicate-pushdown.js.map +1 -1
- package/out/zql/src/builder/debug-delegate.js.map +1 -1
- package/out/zql/src/builder/like.js +0 -1
- package/out/zql/src/builder/like.js.map +1 -1
- package/out/zql/src/ivm/array-view.js.map +1 -1
- package/out/zql/src/ivm/cap.d.ts +1 -1
- package/out/zql/src/ivm/cap.d.ts.map +1 -1
- package/out/zql/src/ivm/cap.js +10 -0
- package/out/zql/src/ivm/cap.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.d.ts +15 -1
- package/out/zql/src/ivm/data.d.ts.map +1 -1
- package/out/zql/src/ivm/data.js +15 -1
- package/out/zql/src/ivm/data.js.map +1 -1
- package/out/zql/src/ivm/deferred-input.js.map +1 -1
- package/out/zql/src/ivm/exists.d.ts.map +1 -1
- package/out/zql/src/ivm/exists.js +32 -22
- 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.d.ts +5 -0
- package/out/zql/src/ivm/filter-operators.d.ts.map +1 -1
- package/out/zql/src/ivm/filter-operators.js +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.js +1 -3
- package/out/zql/src/ivm/flipped-join.js.map +1 -1
- package/out/zql/src/ivm/join-index-tap.js.map +1 -1
- package/out/zql/src/ivm/join-index.js.map +1 -1
- package/out/zql/src/ivm/join-utils.js +11 -13
- package/out/zql/src/ivm/join-utils.js.map +1 -1
- package/out/zql/src/ivm/join.d.ts.map +1 -1
- package/out/zql/src/ivm/join.js +6 -3
- 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 +27 -23
- 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 +6 -0
- package/out/zql/src/ivm/operator.d.ts.map +1 -1
- package/out/zql/src/ivm/operator.js +2 -2
- package/out/zql/src/ivm/operator.js.map +1 -1
- package/out/zql/src/ivm/push-accumulated.js +0 -1
- package/out/zql/src/ivm/push-accumulated.js.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/take-gate.js.map +1 -1
- package/out/zql/src/ivm/take.d.ts.map +1 -1
- package/out/zql/src/ivm/take.js +5 -4
- package/out/zql/src/ivm/take.js.map +1 -1
- package/out/zql/src/ivm/union-fan-in.js +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 +1 -1
- package/out/zql/src/ivm/view-apply-change.js.map +1 -1
- package/out/zql/src/mutate/crud.js +3 -2
- package/out/zql/src/mutate/crud.js.map +1 -1
- package/out/zql/src/planner/planner-builder.js +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-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-filter.js.map +1 -1
- package/out/zql/src/planner/planner-graph.js +1 -5
- package/out/zql/src/planner/planner-graph.js.map +1 -1
- package/out/zql/src/planner/planner-join.js +1 -1
- package/out/zql/src/planner/planner-join.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/create-builder.js +2 -1
- package/out/zql/src/query/create-builder.js.map +1 -1
- package/out/zql/src/query/expression.js +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/named.js +2 -1
- package/out/zql/src/query/named.js.map +1 -1
- package/out/zql/src/query/query-delegate-base.js +1 -1
- package/out/zql/src/query/query-delegate-base.js.map +1 -1
- package/out/zql/src/query/query-impl.js +3 -2
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zql/src/query/query-registry.js +1 -1
- package/out/zql/src/query/query-registry.js.map +1 -1
- package/out/zql/src/query/query-transitions.js +1 -1
- package/out/zql/src/query/query-transitions.js.map +1 -1
- package/out/zql/src/query/runnable-query-impl.js +3 -2
- 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 +8 -8
- 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.d.ts +27 -8
- package/out/zqlite/src/database-storage.d.ts.map +1 -1
- package/out/zqlite/src/database-storage.js +190 -53
- package/out/zqlite/src/database-storage.js.map +1 -1
- package/out/zqlite/src/db.d.ts +47 -1
- package/out/zqlite/src/db.d.ts.map +1 -1
- package/out/zqlite/src/db.js +121 -21
- package/out/zqlite/src/db.js.map +1 -1
- package/out/zqlite/src/explain-queries.js.map +1 -1
- package/out/zqlite/src/fetch-sql.js.map +1 -1
- package/out/zqlite/src/index-usage.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.d.ts +7 -0
- package/out/zqlite/src/internal/statement-cache.d.ts.map +1 -1
- package/out/zqlite/src/internal/statement-cache.js +11 -4
- package/out/zqlite/src/internal/statement-cache.js.map +1 -1
- package/out/zqlite/src/mod.js +5 -5
- package/out/zqlite/src/pending-delta.js.map +1 -1
- package/out/zqlite/src/query-builder.js +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 +2 -5
- package/out/zqlite/src/resolve-scalar-subqueries.js.map +1 -1
- package/out/zqlite/src/sqlite-cost-model.js +3 -2
- 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 +11 -0
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +63 -26
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +37 -36
- package/out/analyze-query/src/bin-analyze.d.ts +0 -2
- package/out/analyze-query/src/bin-analyze.d.ts.map +0 -1
- package/out/analyze-query/src/bin-analyze.js +0 -283
- package/out/analyze-query/src/bin-analyze.js.map +0 -1
- package/out/otel/src/maybe-time.d.ts +0 -3
- package/out/otel/src/maybe-time.d.ts.map +0 -1
- package/out/otel/src/maybe-time.js +0 -15
- package/out/otel/src/maybe-time.js.map +0 -1
- package/out/zero/src/analyze-query.d.ts +0 -3
- package/out/zero/src/analyze-query.d.ts.map +0 -1
- package/out/zero/src/analyze-query.js +0 -3
|
@@ -3,6 +3,6 @@ import { valita_exports } from "../../shared/src/valita.js";
|
|
|
3
3
|
var pingBodySchema = valita_exports.object({});
|
|
4
4
|
var pingMessageSchema = valita_exports.tuple([valita_exports.literal("ping"), pingBodySchema]);
|
|
5
5
|
//#endregion
|
|
6
|
-
export { pingMessageSchema };
|
|
6
|
+
export { pingBodySchema, pingMessageSchema };
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=ping.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ping.js","names":[],"sources":["../../../../zero-protocol/src/ping.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nexport const pingBodySchema = v.object({});\nexport const pingMessageSchema = v.tuple([v.literal('ping'), pingBodySchema]);\n\nexport type PingBody = v.Infer<typeof pingBodySchema>;\nexport type PingMessage = v.Infer<typeof pingMessageSchema>;\n"],"mappings":";;AAEA,IAAa,
|
|
1
|
+
{"version":3,"file":"ping.js","names":["v"],"sources":["../../../../zero-protocol/src/ping.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nexport const pingBodySchema = v.object({});\nexport const pingMessageSchema = v.tuple([v.literal('ping'), pingBodySchema]);\n\nexport type PingBody = v.Infer<typeof pingBodySchema>;\nexport type PingMessage = v.Infer<typeof pingMessageSchema>;\n"],"mappings":";;AAEA,IAAa,iBAAiBA,eAAE,OAAO,CAAC,CAAC;AACzC,IAAa,oBAAoBA,eAAE,MAAM,CAACA,eAAE,QAAQ,MAAM,GAAG,cAAc,CAAC"}
|
|
@@ -85,14 +85,14 @@ export declare const pokePartBodySchema: v.ObjectType<{
|
|
|
85
85
|
clientID: string;
|
|
86
86
|
};
|
|
87
87
|
result: {
|
|
88
|
+
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
89
|
+
} | {
|
|
88
90
|
error: "app";
|
|
89
91
|
message?: string | undefined;
|
|
90
92
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
91
93
|
} | {
|
|
92
94
|
error: "alreadyProcessed" | "oooMutation";
|
|
93
95
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
94
|
-
} | {
|
|
95
|
-
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
} | {
|
|
@@ -156,14 +156,14 @@ export declare const pokePartsSchema: v.ArrayType<v.ObjectType<{
|
|
|
156
156
|
clientID: string;
|
|
157
157
|
};
|
|
158
158
|
result: {
|
|
159
|
+
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
160
|
+
} | {
|
|
159
161
|
error: "app";
|
|
160
162
|
message?: string | undefined;
|
|
161
163
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
162
164
|
} | {
|
|
163
165
|
error: "alreadyProcessed" | "oooMutation";
|
|
164
166
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
165
|
-
} | {
|
|
166
|
-
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
167
167
|
};
|
|
168
168
|
};
|
|
169
169
|
} | {
|
|
@@ -240,14 +240,14 @@ export declare const pokePartMessageSchema: v.TupleType<[v.Type<"pokePart">, v.O
|
|
|
240
240
|
clientID: string;
|
|
241
241
|
};
|
|
242
242
|
result: {
|
|
243
|
+
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
244
|
+
} | {
|
|
243
245
|
error: "app";
|
|
244
246
|
message?: string | undefined;
|
|
245
247
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
246
248
|
} | {
|
|
247
249
|
error: "alreadyProcessed" | "oooMutation";
|
|
248
250
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
249
|
-
} | {
|
|
250
|
-
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
251
251
|
};
|
|
252
252
|
};
|
|
253
253
|
} | {
|
|
@@ -66,6 +66,6 @@ var pokeStartMessageSchema = valita_exports.tuple([valita_exports.literal("pokeS
|
|
|
66
66
|
var pokePartMessageSchema = valita_exports.tuple([valita_exports.literal("pokePart"), pokePartBodySchema]);
|
|
67
67
|
var pokeEndMessageSchema = valita_exports.tuple([valita_exports.literal("pokeEnd"), pokeEndBodySchema]);
|
|
68
68
|
//#endregion
|
|
69
|
-
export { pokeEndMessageSchema, pokePartMessageSchema, pokePartsSchema, pokeStartMessageSchema };
|
|
69
|
+
export { pokeEndBodySchema, pokeEndMessageSchema, pokePartBodySchema, pokePartMessageSchema, pokePartsSchema, pokeStartBodySchema, pokeStartMessageSchema };
|
|
70
70
|
|
|
71
71
|
//# sourceMappingURL=poke.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poke.js","names":[],"sources":["../../../../zero-protocol/src/poke.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {mutationsPatchSchema} from './mutations-patch.ts';\nimport {queriesPatchSchema} from './queries-patch.ts';\nimport {rowsPatchSchema} from './row-patch.ts';\nimport {nullableVersionSchema, versionSchema} from './version.ts';\n\n/**\n * Pokes use a multi-part format. Pokes send entity data to the client and can\n * be multiple mega-bytes in size. Using a multi-part format allows the server\n * to avoid having to have the full poke in memory at one time.\n *\n * Each poke is assigned a `pokeID`, a unique id (within the context of the\n * connection) for identifying the poke. All messages for a poke will have the\n * same `pokeID`.\n *\n * A poke begins with a `poke-start` message which contains the `baseCookie`\n * the poke is updating from and the `cookie` the poke is updating to.\n *\n * Through protocol version 51, the poke continues with zero to many\n * `poke-part` JSON messages. Starting in version 52, it continues with zero to\n * many binary `pokeChunk` messages. Each binary message starts with a message\n * type byte. Concatenating and decoding the payload after that byte produces a\n * PokePartBody array. pokeChunk boundaries have no semantic meaning.\n *\n * Finally, the poke ends with a `poke-end` message. The decoded patches can\n * now be applied as a whole to update from `baseCookie` to `cookie`.\n *\n * Poke messages can be intermingled with other `down` messages, but cannot be\n * intermingled with poke messages for a different `pokeID`. If this is\n * observed it is an unexpected error; the client should ignore both pokes,\n * disconnect, and reconnect.\n */\n\nexport const pokeStartBodySchema = v.object({\n pokeID: v.string(),\n // We always specify a Version as our cookie, but Replicache starts clients\n // with initial cookie `null`, before the first request. So we have to be\n // able to send a base cookie with value `null` to match that state.\n baseCookie: nullableVersionSchema,\n /**\n * This field is always set if the poke contains a `rowsPatch`.\n * It may be absent for patches that only update clients and queries.\n */\n schemaVersions: v\n .object({\n minSupportedVersion: v.number(),\n maxSupportedVersion: v.number(),\n })\n .optional(),\n timestamp: v.number().optional(),\n});\n\nexport const pokePartBodySchema = v.object({\n // Changes to last mutation id by client id.\n lastMutationIDChanges: v.record(v.number()).optional(),\n // Patches to the desired query sets by client id.\n desiredQueriesPatches: v.record(queriesPatchSchema).optional(),\n // Patches to the set of queries for which entities are sync'd in\n // rowsPatch.\n gotQueriesPatch: queriesPatchSchema.optional(),\n // Patches to the rows set.\n rowsPatch: rowsPatchSchema.optional(),\n // Mutation results patch\n mutationsPatch: mutationsPatchSchema.optional(),\n pokeID: v.string(),\n});\n\n/**\n * The logical payload carried by binary poke chunks. Chunk boundaries are\n * arbitrary; concatenating and decoding all chunks for a poke produces this\n * array.\n */\nexport const pokePartsSchema = v.array(pokePartBodySchema);\n\nexport const pokeEndBodySchema = v.object({\n pokeID: v.string(),\n // Note: This should be ignored (and may be empty) if cancel === `true`.\n cookie: versionSchema,\n // If `true`, the poke with id `pokeID` should be discarded without\n // applying it.\n cancel: v.boolean().optional(),\n});\n\nexport const pokeStartMessageSchema = v.tuple([\n v.literal('pokeStart'),\n pokeStartBodySchema,\n]);\nexport const pokePartMessageSchema = v.tuple([\n v.literal('pokePart'),\n pokePartBodySchema,\n]);\nexport const pokeEndMessageSchema = v.tuple([\n v.literal('pokeEnd'),\n pokeEndBodySchema,\n]);\n\nexport type PokeStartBody = v.Infer<typeof pokeStartBodySchema>;\nexport type PokePartBody = v.Infer<typeof pokePartBodySchema>;\nexport type PokeParts = v.Infer<typeof pokePartsSchema>;\nexport type PokeEndBody = v.Infer<typeof pokeEndBodySchema>;\n\n/** The first byte identifying a binary WebSocket message as a poke chunk. */\nexport const POKE_CHUNK_MESSAGE_TYPE = 0x00;\n\n/** The first protocol version that receives binary poke chunks. */\nexport const POKE_CHUNK_PROTOCOL_VERSION = 52;\n\n/** The last protocol version that receives JSON pokePart messages. */\nexport const LAST_POKE_PART_PROTOCOL_VERSION = 51;\n\n/** A tagged binary poke chunk WebSocket message. */\nexport type PokeChunk = Uint8Array;\n\nexport type PokeStartMessage = v.Infer<typeof pokeStartMessageSchema>;\nexport type PokePartMessage = v.Infer<typeof pokePartMessageSchema>;\nexport type PokeEndMessage = v.Infer<typeof pokeEndMessageSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,
|
|
1
|
+
{"version":3,"file":"poke.js","names":["v"],"sources":["../../../../zero-protocol/src/poke.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {mutationsPatchSchema} from './mutations-patch.ts';\nimport {queriesPatchSchema} from './queries-patch.ts';\nimport {rowsPatchSchema} from './row-patch.ts';\nimport {nullableVersionSchema, versionSchema} from './version.ts';\n\n/**\n * Pokes use a multi-part format. Pokes send entity data to the client and can\n * be multiple mega-bytes in size. Using a multi-part format allows the server\n * to avoid having to have the full poke in memory at one time.\n *\n * Each poke is assigned a `pokeID`, a unique id (within the context of the\n * connection) for identifying the poke. All messages for a poke will have the\n * same `pokeID`.\n *\n * A poke begins with a `poke-start` message which contains the `baseCookie`\n * the poke is updating from and the `cookie` the poke is updating to.\n *\n * Through protocol version 51, the poke continues with zero to many\n * `poke-part` JSON messages. Starting in version 52, it continues with zero to\n * many binary `pokeChunk` messages. Each binary message starts with a message\n * type byte. Concatenating and decoding the payload after that byte produces a\n * PokePartBody array. pokeChunk boundaries have no semantic meaning.\n *\n * Finally, the poke ends with a `poke-end` message. The decoded patches can\n * now be applied as a whole to update from `baseCookie` to `cookie`.\n *\n * Poke messages can be intermingled with other `down` messages, but cannot be\n * intermingled with poke messages for a different `pokeID`. If this is\n * observed it is an unexpected error; the client should ignore both pokes,\n * disconnect, and reconnect.\n */\n\nexport const pokeStartBodySchema = v.object({\n pokeID: v.string(),\n // We always specify a Version as our cookie, but Replicache starts clients\n // with initial cookie `null`, before the first request. So we have to be\n // able to send a base cookie with value `null` to match that state.\n baseCookie: nullableVersionSchema,\n /**\n * This field is always set if the poke contains a `rowsPatch`.\n * It may be absent for patches that only update clients and queries.\n */\n schemaVersions: v\n .object({\n minSupportedVersion: v.number(),\n maxSupportedVersion: v.number(),\n })\n .optional(),\n timestamp: v.number().optional(),\n});\n\nexport const pokePartBodySchema = v.object({\n // Changes to last mutation id by client id.\n lastMutationIDChanges: v.record(v.number()).optional(),\n // Patches to the desired query sets by client id.\n desiredQueriesPatches: v.record(queriesPatchSchema).optional(),\n // Patches to the set of queries for which entities are sync'd in\n // rowsPatch.\n gotQueriesPatch: queriesPatchSchema.optional(),\n // Patches to the rows set.\n rowsPatch: rowsPatchSchema.optional(),\n // Mutation results patch\n mutationsPatch: mutationsPatchSchema.optional(),\n pokeID: v.string(),\n});\n\n/**\n * The logical payload carried by binary poke chunks. Chunk boundaries are\n * arbitrary; concatenating and decoding all chunks for a poke produces this\n * array.\n */\nexport const pokePartsSchema = v.array(pokePartBodySchema);\n\nexport const pokeEndBodySchema = v.object({\n pokeID: v.string(),\n // Note: This should be ignored (and may be empty) if cancel === `true`.\n cookie: versionSchema,\n // If `true`, the poke with id `pokeID` should be discarded without\n // applying it.\n cancel: v.boolean().optional(),\n});\n\nexport const pokeStartMessageSchema = v.tuple([\n v.literal('pokeStart'),\n pokeStartBodySchema,\n]);\nexport const pokePartMessageSchema = v.tuple([\n v.literal('pokePart'),\n pokePartBodySchema,\n]);\nexport const pokeEndMessageSchema = v.tuple([\n v.literal('pokeEnd'),\n pokeEndBodySchema,\n]);\n\nexport type PokeStartBody = v.Infer<typeof pokeStartBodySchema>;\nexport type PokePartBody = v.Infer<typeof pokePartBodySchema>;\nexport type PokeParts = v.Infer<typeof pokePartsSchema>;\nexport type PokeEndBody = v.Infer<typeof pokeEndBodySchema>;\n\n/** The first byte identifying a binary WebSocket message as a poke chunk. */\nexport const POKE_CHUNK_MESSAGE_TYPE = 0x00;\n\n/** The first protocol version that receives binary poke chunks. */\nexport const POKE_CHUNK_PROTOCOL_VERSION = 52;\n\n/** The last protocol version that receives JSON pokePart messages. */\nexport const LAST_POKE_PART_PROTOCOL_VERSION = 51;\n\n/** A tagged binary poke chunk WebSocket message. */\nexport type PokeChunk = Uint8Array;\n\nexport type PokeStartMessage = v.Infer<typeof pokeStartMessageSchema>;\nexport type PokePartMessage = v.Infer<typeof pokePartMessageSchema>;\nexport type PokeEndMessage = v.Infer<typeof pokeEndMessageSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,sBAAsBA,eAAE,OAAO;CAC1C,QAAQA,eAAE,OAAO;CAIjB,YAAY;;;;;CAKZ,gBAAgBA,eACb,OAAO;EACN,qBAAqBA,eAAE,OAAO;EAC9B,qBAAqBA,eAAE,OAAO;CAChC,CAAC,CAAC,CACD,SAAS;CACZ,WAAWA,eAAE,OAAO,CAAC,CAAC,SAAS;AACjC,CAAC;AAED,IAAa,qBAAqBA,eAAE,OAAO;CAEzC,uBAAuBA,eAAE,OAAOA,eAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAErD,uBAAuBA,eAAE,OAAO,kBAAkB,CAAC,CAAC,SAAS;CAG7D,iBAAiB,mBAAmB,SAAS;CAE7C,WAAW,gBAAgB,SAAS;CAEpC,gBAAgB,qBAAqB,SAAS;CAC9C,QAAQA,eAAE,OAAO;AACnB,CAAC;;;;;;AAOD,IAAa,kBAAkBA,eAAE,MAAM,kBAAkB;AAEzD,IAAa,oBAAoBA,eAAE,OAAO;CACxC,QAAQA,eAAE,OAAO;CAEjB,QAAQ;CAGR,QAAQA,eAAE,QAAQ,CAAC,CAAC,SAAS;AAC/B,CAAC;AAED,IAAa,yBAAyBA,eAAE,MAAM,CAC5CA,eAAE,QAAQ,WAAW,GACrB,mBACF,CAAC;AACD,IAAa,wBAAwBA,eAAE,MAAM,CAC3CA,eAAE,QAAQ,UAAU,GACpB,kBACF,CAAC;AACD,IAAa,uBAAuBA,eAAE,MAAM,CAC1CA,eAAE,QAAQ,SAAS,GACnB,iBACF,CAAC"}
|
|
@@ -3,6 +3,6 @@ import { valita_exports } from "../../shared/src/valita.js";
|
|
|
3
3
|
var pongBodySchema = valita_exports.object({});
|
|
4
4
|
var pongMessageSchema = valita_exports.tuple([valita_exports.literal("pong"), pongBodySchema]);
|
|
5
5
|
//#endregion
|
|
6
|
-
export { pongMessageSchema };
|
|
6
|
+
export { pongBodySchema, pongMessageSchema };
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=pong.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pong.js","names":[],"sources":["../../../../zero-protocol/src/pong.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nexport const pongBodySchema = v.object({});\nexport const pongMessageSchema = v.tuple([v.literal('pong'), pongBodySchema]);\n\nexport type PongBody = v.Infer<typeof pongBodySchema>;\nexport type PongMessage = v.Infer<typeof pongMessageSchema>;\n"],"mappings":";;AAEA,IAAa,
|
|
1
|
+
{"version":3,"file":"pong.js","names":["v"],"sources":["../../../../zero-protocol/src/pong.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nexport const pongBodySchema = v.object({});\nexport const pongMessageSchema = v.tuple([v.literal('pong'), pongBodySchema]);\n\nexport type PongBody = v.Infer<typeof pongBodySchema>;\nexport type PongMessage = v.Infer<typeof pongMessageSchema>;\n"],"mappings":";;AAEA,IAAa,iBAAiBA,eAAE,OAAO,CAAC,CAAC;AACzC,IAAa,oBAAoBA,eAAE,MAAM,CAACA,eAAE,QAAQ,MAAM,GAAG,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primary-key.js","names":[],"sources":["../../../../zero-protocol/src/primary-key.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nexport const primaryKeySchema = v.readonly(\n // oxlint-disable-next-line e18e/prefer-spread-syntax\n v.tuple([v.string()]).concat(v.array(v.string())),\n);\n\nexport type PrimaryKey = v.Infer<typeof primaryKeySchema>;\n\nexport const primaryKeyValueSchema = v.union(\n v.string(),\n v.number(),\n v.boolean(),\n);\n\nexport type PrimaryKeyValue = v.Infer<typeof primaryKeyValueSchema>;\n\nexport const primaryKeyValueRecordSchema = v.readonlyRecord(\n primaryKeyValueSchema,\n);\n\nexport type PrimaryKeyValueRecord = v.Infer<typeof primaryKeyValueRecordSchema>;\n"],"mappings":";;AAEA,IAAa,
|
|
1
|
+
{"version":3,"file":"primary-key.js","names":["v.readonly","v","v.readonlyRecord"],"sources":["../../../../zero-protocol/src/primary-key.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nexport const primaryKeySchema = v.readonly(\n // oxlint-disable-next-line e18e/prefer-spread-syntax\n v.tuple([v.string()]).concat(v.array(v.string())),\n);\n\nexport type PrimaryKey = v.Infer<typeof primaryKeySchema>;\n\nexport const primaryKeyValueSchema = v.union(\n v.string(),\n v.number(),\n v.boolean(),\n);\n\nexport type PrimaryKeyValue = v.Infer<typeof primaryKeyValueSchema>;\n\nexport const primaryKeyValueRecordSchema = v.readonlyRecord(\n primaryKeyValueSchema,\n);\n\nexport type PrimaryKeyValueRecord = v.Infer<typeof primaryKeyValueRecordSchema>;\n"],"mappings":";;AAEA,IAAa,mBAAmBA,SAE9BC,eAAE,MAAM,CAACA,eAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAOA,eAAE,MAAMA,eAAE,OAAO,CAAC,CAAC,CAClD;AAIA,IAAa,wBAAwBA,eAAE,MACrCA,eAAE,OAAO,GACTA,eAAE,OAAO,GACTA,eAAE,QAAQ,CACZ;AAIA,IAAa,8BAA8BC,eACzC,qBACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-version.js","names":[],"sources":["../../../../zero-protocol/src/protocol-version.ts"],"sourcesContent":["import {assert} from '../../shared/src/asserts.ts';\n\n/**\n * The current `PROTOCOL_VERSION` of the code.\n *\n * The `PROTOCOL_VERSION` encompasses both the wire-protocol of the `/sync/...`\n * connection between the browser and `zero-cache`, as well as the format of\n * the `AST` objects stored in the CVR. The client's local database has its\n * own version, `STORAGE_VERSION` in zero-client. A bump that changes what the\n * client stores (as version 23 did by adding mutation results) must bump that\n * too.\n *\n * A change in the `AST` schema (e.g. new functionality added) must be\n * accompanied by an increment of the `PROTOCOL_VERSION` and a new major\n * release. The server (`zero-cache`) must be deployed before clients start\n * running the new code.\n */\n// History:\n// -- Version 5 adds support for `pokeEnd.cookie`. (0.14)\n// -- Version 6 makes `pokeStart.cookie` optional. (0.16)\n// -- Version 7 introduces the initConnection.clientSchema field. (0.17)\n// -- Version 8 drops support for Version 5 (0.18).\n// -- Version 11 adds inspect queries. (0.18)\n// -- Version 12 adds 'timestamp' and 'date' types to the ClientSchema ValueType. (not shipped, reversed by version 14)\n// -- Version 14 removes 'timestamp' and 'date' types from the ClientSchema ValueType. (0.18)\n// -- Version 15 adds a `userPushParams` field to `initConnection` (0.19)\n// -- Version 16 adds a new error type (alreadyProcessed) to mutation responses (0.19)\n// -- Version 17 deprecates `AST` in downstream query puts. It was never used anyway. (0.21)\n// -- Version 18 adds `name` and `args` to the `queries-patch` protocol (0.21)\n// -- Version 19 adds `activeClients` to the `initConnection` protocol (0.22)\n// -- Version 20 changes inspector down message (0.22)\n// -- Version 21 removes `AST` in downstream query puts which was deprecated in Version 17, removes support for versions < 18 (0.22)\n// -- Version 22 adds an optional 'userQueryParams' field to `initConnection` (0.22)\n// -- Version 23 add `mutationResults` to poke (0.22)\n// -- Version 24 adds `ackMutationResults` to upstream (0.22).\n// -- version 25 modifies `mutationsResults` to include `del` patches (0.22)\n// -- version 26 adds inspect/metrics and adds metrics to inspect/query (0.23)\n// -- version 27 adds inspect/version (0.23)\n// -- version 28 adds more inspect/metrics (0.23)\n// -- version 29 adds error responses for custom queries (0.23)\n// -- version 30 adds an optional primaryKey to the ClientSchema (0.24)\n// -- version 31 adds admin password authentication to inspector RPC calls (0.24)\n// -- version 32 adds analyze-query to the inspector RPC calls (0.24)\n// -- version 33 adds `flip` to CorrelatedSubquery (0.25)\n// -- version 34 moves `flip` from CorrelatedSubquery to CorrelatedSubqueryCondition (0.25)\n// -- version 35 adds `readRows`, `readRowCountsByQuery` and `readRowCount` to analyze-query result (0.25)\n// -- version 36 changes inspector analyze-query and adds error response to RPC (0.25)\n// -- version 37 adds `elapsed` to AnalyzeQueryResult (0.25)\n// -- version 38 adds structured push/transform error responses (0.25)\n// -- version 39 removes per-transform error types and adds `message` to app error (0.25)\n// -- version 40 adds `dbRowScansByQuery` to AnalyzeQueryResult (0.25)\n// -- version 41 makes ClientSchema.primaryKey required (0.25)\n// -- version 42 adds planner events to AnalyzeQueryResult (0.25)\n// -- version 43 renames `plans` to `sqlitePlans`, `plannerEvents` to `joinPlans`, and `plannerDebug` option to `joinPlans` (0.25)\n// -- version 44 adds profileID to connection URL (0.25)\n// -- version 45 adds userPushHeaders and userQueryHeaders to initConnection (0.25)\n// -- version 46 adds scalarSubquery condition type to AST\n// -- version 47 adds optional auth token to push body\n// -- version 48 adds updateAuth\n// -- version 49 adds `scalar` to CorrelatedSubqueryCondition, removes scalarSubquery\n// -- version 50 adds OTEL headers to push and query messages\n// -- version 51 changes inspector metrics fields\n// -- version 52 replaces JSON pokePart messages with binary poke chunks for\n// clients using protocol version 52 or newer. Older clients retain pokePart.\n// -- version 53 adds 'filter' node type to AnalyzeQueryResult\nexport const PROTOCOL_VERSION = 53;\n\n/**\n * The minimum server-supported sync protocol version (i.e. the version\n * declared in the \"/sync/v{#}/connect\" URL).\n *\n * CloudZero can serve applications running old client releases indefinitely.\n * Consequently, this value must never be increased: `zero-cache` must continue\n * to support every sync protocol from this version through `PROTOCOL_VERSION`.\n * A wire change that an old client cannot ignore must branch on the client's\n * protocol version and retain the old behavior. Keep each compatibility fork\n * isolated at the boundary that owns the changed behavior and test both sides\n * of its version cutoff.\n *\n * Client connections from protocol versions before this historical floor are\n * closed with a `VersionNotSupported` error.\n */\nexport const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 30;\n\nassert(\n MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION,\n 'MIN_SERVER_SUPPORTED_SYNC_PROTOCOL must be less than PROTOCOL_VERSION',\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"protocol-version.js","names":[],"sources":["../../../../zero-protocol/src/protocol-version.ts"],"sourcesContent":["import {assert} from '../../shared/src/asserts.ts';\n\n/**\n * The current `PROTOCOL_VERSION` of the code.\n *\n * The `PROTOCOL_VERSION` encompasses both the wire-protocol of the `/sync/...`\n * connection between the browser and `zero-cache`, as well as the format of\n * the `AST` objects stored in the CVR. The client's local database has its\n * own version, `STORAGE_VERSION` in zero-client. A bump that changes what the\n * client stores (as version 23 did by adding mutation results) must bump that\n * too.\n *\n * A change in the `AST` schema (e.g. new functionality added) must be\n * accompanied by an increment of the `PROTOCOL_VERSION` and a new major\n * release. The server (`zero-cache`) must be deployed before clients start\n * running the new code.\n */\n// History:\n// -- Version 5 adds support for `pokeEnd.cookie`. (0.14)\n// -- Version 6 makes `pokeStart.cookie` optional. (0.16)\n// -- Version 7 introduces the initConnection.clientSchema field. (0.17)\n// -- Version 8 drops support for Version 5 (0.18).\n// -- Version 11 adds inspect queries. (0.18)\n// -- Version 12 adds 'timestamp' and 'date' types to the ClientSchema ValueType. (not shipped, reversed by version 14)\n// -- Version 14 removes 'timestamp' and 'date' types from the ClientSchema ValueType. (0.18)\n// -- Version 15 adds a `userPushParams` field to `initConnection` (0.19)\n// -- Version 16 adds a new error type (alreadyProcessed) to mutation responses (0.19)\n// -- Version 17 deprecates `AST` in downstream query puts. It was never used anyway. (0.21)\n// -- Version 18 adds `name` and `args` to the `queries-patch` protocol (0.21)\n// -- Version 19 adds `activeClients` to the `initConnection` protocol (0.22)\n// -- Version 20 changes inspector down message (0.22)\n// -- Version 21 removes `AST` in downstream query puts which was deprecated in Version 17, removes support for versions < 18 (0.22)\n// -- Version 22 adds an optional 'userQueryParams' field to `initConnection` (0.22)\n// -- Version 23 add `mutationResults` to poke (0.22)\n// -- Version 24 adds `ackMutationResults` to upstream (0.22).\n// -- version 25 modifies `mutationsResults` to include `del` patches (0.22)\n// -- version 26 adds inspect/metrics and adds metrics to inspect/query (0.23)\n// -- version 27 adds inspect/version (0.23)\n// -- version 28 adds more inspect/metrics (0.23)\n// -- version 29 adds error responses for custom queries (0.23)\n// -- version 30 adds an optional primaryKey to the ClientSchema (0.24)\n// -- version 31 adds admin password authentication to inspector RPC calls (0.24)\n// -- version 32 adds analyze-query to the inspector RPC calls (0.24)\n// -- version 33 adds `flip` to CorrelatedSubquery (0.25)\n// -- version 34 moves `flip` from CorrelatedSubquery to CorrelatedSubqueryCondition (0.25)\n// -- version 35 adds `readRows`, `readRowCountsByQuery` and `readRowCount` to analyze-query result (0.25)\n// -- version 36 changes inspector analyze-query and adds error response to RPC (0.25)\n// -- version 37 adds `elapsed` to AnalyzeQueryResult (0.25)\n// -- version 38 adds structured push/transform error responses (0.25)\n// -- version 39 removes per-transform error types and adds `message` to app error (0.25)\n// -- version 40 adds `dbRowScansByQuery` to AnalyzeQueryResult (0.25)\n// -- version 41 makes ClientSchema.primaryKey required (0.25)\n// -- version 42 adds planner events to AnalyzeQueryResult (0.25)\n// -- version 43 renames `plans` to `sqlitePlans`, `plannerEvents` to `joinPlans`, and `plannerDebug` option to `joinPlans` (0.25)\n// -- version 44 adds profileID to connection URL (0.25)\n// -- version 45 adds userPushHeaders and userQueryHeaders to initConnection (0.25)\n// -- version 46 adds scalarSubquery condition type to AST\n// -- version 47 adds optional auth token to push body\n// -- version 48 adds updateAuth\n// -- version 49 adds `scalar` to CorrelatedSubqueryCondition, removes scalarSubquery\n// -- version 50 adds OTEL headers to push and query messages\n// -- version 51 changes inspector metrics fields\n// -- version 52 replaces JSON pokePart messages with binary poke chunks for\n// clients using protocol version 52 or newer. Older clients retain pokePart.\n// -- version 53 adds 'filter' node type to AnalyzeQueryResult\nexport const PROTOCOL_VERSION = 53;\n\n/**\n * The minimum server-supported sync protocol version (i.e. the version\n * declared in the \"/sync/v{#}/connect\" URL).\n *\n * CloudZero can serve applications running old client releases indefinitely.\n * Consequently, this value must never be increased: `zero-cache` must continue\n * to support every sync protocol from this version through `PROTOCOL_VERSION`.\n * A wire change that an old client cannot ignore must branch on the client's\n * protocol version and retain the old behavior. Keep each compatibility fork\n * isolated at the boundary that owns the changed behavior and test both sides\n * of its version cutoff.\n *\n * Client connections from protocol versions before this historical floor are\n * closed with a `VersionNotSupported` error.\n */\nexport const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 30;\n\nassert(\n MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION,\n 'MIN_SERVER_SUPPORTED_SYNC_PROTOCOL must be less than PROTOCOL_VERSION',\n);\n"],"mappings":";;AAoFA,OACE,MACA,uEACF"}
|
|
@@ -14,6 +14,6 @@ var pullResponseBodySchema = valita_exports.object({
|
|
|
14
14
|
var pullRequestMessageSchema = valita_exports.tuple([valita_exports.literal("pull"), pullRequestBodySchema]);
|
|
15
15
|
var pullResponseMessageSchema = valita_exports.tuple([valita_exports.literal("pull"), pullResponseBodySchema]);
|
|
16
16
|
//#endregion
|
|
17
|
-
export { pullRequestMessageSchema, pullResponseMessageSchema };
|
|
17
|
+
export { pullRequestBodySchema, pullRequestMessageSchema, pullResponseBodySchema, pullResponseMessageSchema };
|
|
18
18
|
|
|
19
19
|
//# sourceMappingURL=pull.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.js","names":[],"sources":["../../../../zero-protocol/src/pull.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {nullableVersionSchema, versionSchema} from './version.ts';\n\nexport const pullRequestBodySchema = v.object({\n clientGroupID: v.string(),\n cookie: nullableVersionSchema,\n requestID: v.string(),\n});\n\nexport const pullResponseBodySchema = v.object({\n cookie: versionSchema,\n // Matches pullRequestBodySchema requestID that initiated this response\n requestID: v.string(),\n lastMutationIDChanges: v.record(v.number()),\n // Pull is currently only used for mutation recovery which does not use\n // the patch so we save work by not computing the patch.\n});\n\nexport const pullRequestMessageSchema = v.tuple([\n v.literal('pull'),\n pullRequestBodySchema,\n]);\n\nexport const pullResponseMessageSchema = v.tuple([\n v.literal('pull'),\n pullResponseBodySchema,\n]);\n\nexport type PullRequestBody = v.Infer<typeof pullRequestBodySchema>;\nexport type PullResponseBody = v.Infer<typeof pullResponseBodySchema>;\n\nexport type PullRequestMessage = v.Infer<typeof pullRequestMessageSchema>;\nexport type PullResponseMessage = v.Infer<typeof pullResponseMessageSchema>;\n"],"mappings":";;;AAGA,IAAa,
|
|
1
|
+
{"version":3,"file":"pull.js","names":["v"],"sources":["../../../../zero-protocol/src/pull.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {nullableVersionSchema, versionSchema} from './version.ts';\n\nexport const pullRequestBodySchema = v.object({\n clientGroupID: v.string(),\n cookie: nullableVersionSchema,\n requestID: v.string(),\n});\n\nexport const pullResponseBodySchema = v.object({\n cookie: versionSchema,\n // Matches pullRequestBodySchema requestID that initiated this response\n requestID: v.string(),\n lastMutationIDChanges: v.record(v.number()),\n // Pull is currently only used for mutation recovery which does not use\n // the patch so we save work by not computing the patch.\n});\n\nexport const pullRequestMessageSchema = v.tuple([\n v.literal('pull'),\n pullRequestBodySchema,\n]);\n\nexport const pullResponseMessageSchema = v.tuple([\n v.literal('pull'),\n pullResponseBodySchema,\n]);\n\nexport type PullRequestBody = v.Infer<typeof pullRequestBodySchema>;\nexport type PullResponseBody = v.Infer<typeof pullResponseBodySchema>;\n\nexport type PullRequestMessage = v.Infer<typeof pullRequestMessageSchema>;\nexport type PullResponseMessage = v.Infer<typeof pullResponseMessageSchema>;\n"],"mappings":";;;AAGA,IAAa,wBAAwBA,eAAE,OAAO;CAC5C,eAAeA,eAAE,OAAO;CACxB,QAAQ;CACR,WAAWA,eAAE,OAAO;AACtB,CAAC;AAED,IAAa,yBAAyBA,eAAE,OAAO;CAC7C,QAAQ;CAER,WAAWA,eAAE,OAAO;CACpB,uBAAuBA,eAAE,OAAOA,eAAE,OAAO,CAAC;AAG5C,CAAC;AAED,IAAa,2BAA2BA,eAAE,MAAM,CAC9CA,eAAE,QAAQ,MAAM,GAChB,qBACF,CAAC;AAED,IAAa,4BAA4BA,eAAE,MAAM,CAC/CA,eAAE,QAAQ,MAAM,GAChB,sBACF,CAAC"}
|
|
@@ -71,6 +71,6 @@ valita_exports.union(pushResponseBodySchema, pushFailedBodySchema);
|
|
|
71
71
|
var pushResponseMessageSchema = valita_exports.tuple([valita_exports.literal("pushResponse"), pushResponseBodySchema]);
|
|
72
72
|
var ackMutationResponsesMessageSchema = valita_exports.tuple([valita_exports.literal("ackMutationResponses"), mutationIDSchema]);
|
|
73
73
|
//#endregion
|
|
74
|
-
export { ackMutationResponsesMessageSchema, pushBodySchema, pushErrorSchema, pushMessageSchema, pushResponseMessageSchema };
|
|
74
|
+
export { ackMutationResponsesMessageSchema, pushBodySchema, pushErrorSchema, pushMessageSchema, pushResponseBodySchema, pushResponseMessageSchema };
|
|
75
75
|
|
|
76
76
|
//# sourceMappingURL=push.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","names":[],"sources":["../../../../zero-protocol/src/push.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {pushFailedBodySchema} from './error.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport {mutationResponseSchema, mutationSchema} from './mutation.ts';\n\nexport const pushBodySchema = v.object({\n clientGroupID: v.string(),\n mutations: v.array(mutationSchema),\n pushVersion: v.number(),\n // For legacy (CRUD) mutations, the schema is tied to the client group /\n // sync connection. For custom mutations, schema versioning is delegated\n // to the custom protocol / api-server.\n schemaVersion: v.number().optional(),\n timestamp: v.number(),\n requestID: v.string(),\n /**\n * @deprecated auth is managed at client-group scope via connect/updateAuth\n * and should not be included in push messages.\n */\n auth: v.string().optional(),\n /** W3C traceparent header for distributed tracing. */\n traceparent: v.string().optional(),\n});\n\nexport const pushMessageSchema = v.tuple([v.literal('push'), pushBodySchema]);\n\nconst pushOkSchema = v.object({\n mutations: v.array(mutationResponseSchema),\n});\n\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedPushVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedPushVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedSchemaVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedSchemaVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push http errors are now represented as ['error', { ... }] messages\n */\nconst httpErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('http'),\n /** @deprecated */\n status: v.number(),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push zero errors are now represented as ['error', { ... }] messages\n */\nconst zeroPusherErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('zeroPusher'),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nexport const pushErrorSchema = v.union(\n unsupportedPushVersionSchema,\n unsupportedSchemaVersionSchema,\n httpErrorSchema,\n zeroPusherErrorSchema,\n);\n\nexport const pushResponseBodySchema = v.union(pushOkSchema, pushErrorSchema);\n\nexport const pushResponseSchema = v.union(\n pushResponseBodySchema,\n pushFailedBodySchema,\n);\nexport const pushResponseMessageSchema = v.tuple([\n v.literal('pushResponse'),\n pushResponseBodySchema,\n]);\n\nexport const ackMutationResponsesMessageSchema = v.tuple([\n v.literal('ackMutationResponses'),\n mutationIDSchema,\n]);\n\nexport type PushBody = v.Infer<typeof pushBodySchema>;\nexport type PushMessage = v.Infer<typeof pushMessageSchema>;\nexport type PushResponseBody = v.Infer<typeof pushResponseBodySchema>;\nexport type PushResponse = v.Infer<typeof pushResponseSchema>;\nexport type PushResponseMessage = v.Infer<typeof pushResponseMessageSchema>;\nexport type MutationResponse = v.Infer<typeof mutationResponseSchema>;\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nexport type PushError = v.Infer<typeof pushErrorSchema>;\nexport type PushOk = v.Infer<typeof pushOkSchema>;\nexport type AckMutationMessage = v.Infer<\n typeof ackMutationResponsesMessageSchema\n>;\n"],"mappings":";;;;;AAKA,IAAa,
|
|
1
|
+
{"version":3,"file":"push.js","names":["v"],"sources":["../../../../zero-protocol/src/push.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {pushFailedBodySchema} from './error.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport {mutationResponseSchema, mutationSchema} from './mutation.ts';\n\nexport const pushBodySchema = v.object({\n clientGroupID: v.string(),\n mutations: v.array(mutationSchema),\n pushVersion: v.number(),\n // For legacy (CRUD) mutations, the schema is tied to the client group /\n // sync connection. For custom mutations, schema versioning is delegated\n // to the custom protocol / api-server.\n schemaVersion: v.number().optional(),\n timestamp: v.number(),\n requestID: v.string(),\n /**\n * @deprecated auth is managed at client-group scope via connect/updateAuth\n * and should not be included in push messages.\n */\n auth: v.string().optional(),\n /** W3C traceparent header for distributed tracing. */\n traceparent: v.string().optional(),\n});\n\nexport const pushMessageSchema = v.tuple([v.literal('push'), pushBodySchema]);\n\nconst pushOkSchema = v.object({\n mutations: v.array(mutationResponseSchema),\n});\n\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedPushVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedPushVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedSchemaVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedSchemaVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push http errors are now represented as ['error', { ... }] messages\n */\nconst httpErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('http'),\n /** @deprecated */\n status: v.number(),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push zero errors are now represented as ['error', { ... }] messages\n */\nconst zeroPusherErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('zeroPusher'),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nexport const pushErrorSchema = v.union(\n unsupportedPushVersionSchema,\n unsupportedSchemaVersionSchema,\n httpErrorSchema,\n zeroPusherErrorSchema,\n);\n\nexport const pushResponseBodySchema = v.union(pushOkSchema, pushErrorSchema);\n\nexport const pushResponseSchema = v.union(\n pushResponseBodySchema,\n pushFailedBodySchema,\n);\nexport const pushResponseMessageSchema = v.tuple([\n v.literal('pushResponse'),\n pushResponseBodySchema,\n]);\n\nexport const ackMutationResponsesMessageSchema = v.tuple([\n v.literal('ackMutationResponses'),\n mutationIDSchema,\n]);\n\nexport type PushBody = v.Infer<typeof pushBodySchema>;\nexport type PushMessage = v.Infer<typeof pushMessageSchema>;\nexport type PushResponseBody = v.Infer<typeof pushResponseBodySchema>;\nexport type PushResponse = v.Infer<typeof pushResponseSchema>;\nexport type PushResponseMessage = v.Infer<typeof pushResponseMessageSchema>;\nexport type MutationResponse = v.Infer<typeof mutationResponseSchema>;\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nexport type PushError = v.Infer<typeof pushErrorSchema>;\nexport type PushOk = v.Infer<typeof pushOkSchema>;\nexport type AckMutationMessage = v.Infer<\n typeof ackMutationResponsesMessageSchema\n>;\n"],"mappings":";;;;;AAKA,IAAa,iBAAiBA,eAAE,OAAO;CACrC,eAAeA,eAAE,OAAO;CACxB,WAAWA,eAAE,MAAM,cAAc;CACjC,aAAaA,eAAE,OAAO;CAItB,eAAeA,eAAE,OAAO,CAAC,CAAC,SAAS;CACnC,WAAWA,eAAE,OAAO;CACpB,WAAWA,e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PatchOpSchema = valita_exports.union(upPutOpSchema, delOpSchema, clearOpSc
|
|
|
22
22
|
var queriesPatchSchema = valita_exports.array(patchOpSchema);
|
|
23
23
|
var upQueriesPatchSchema = valita_exports.array(upPatchOpSchema);
|
|
24
24
|
//#endregion
|
|
25
|
-
export { queriesPatchSchema, upQueriesPatchSchema };
|
|
25
|
+
export { putOpSchema, queriesPatchSchema, upPutOpSchema, upQueriesPatchSchema };
|
|
26
26
|
|
|
27
27
|
//# sourceMappingURL=queries-patch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries-patch.js","names":[],"sources":["../../../../zero-protocol/src/queries-patch.ts"],"sourcesContent":["import {jsonSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport {strictASTSchema} from './ast.ts';\n\nexport const putOpSchema = v.object({\n op: v.literal('put'),\n hash: v.string(),\n ttl: v.number().optional(),\n});\n\nexport const upPutOpSchema = putOpSchema.extend({\n // All fields are optional in this transitional period.\n // - ast is filled in for client queries\n // - name and args are filled in for custom queries\n ast: strictASTSchema.optional(),\n name: v.string().optional(),\n args: v.readonly(v.array(jsonSchema)).optional(),\n});\n\nconst delOpSchema = v.object({\n op: v.literal('del'),\n hash: v.string(),\n});\n\nconst clearOpSchema = v.object({\n op: v.literal('clear'),\n});\n\nconst patchOpSchema = v.union(putOpSchema, delOpSchema, clearOpSchema);\nconst upPatchOpSchema = v.union(upPutOpSchema, delOpSchema, clearOpSchema);\n\nexport const queriesPatchSchema = v.array(patchOpSchema);\nexport const upQueriesPatchSchema = v.array(upPatchOpSchema);\n\nexport type QueriesPutOp = v.Infer<typeof putOpSchema>;\nexport type QueriesDelOp = v.Infer<typeof delOpSchema>;\nexport type QueriesClearOp = v.Infer<typeof clearOpSchema>;\nexport type QueriesPatchOp = v.Infer<typeof patchOpSchema>;\nexport type UpQueriesPatchOp = v.Infer<typeof upPatchOpSchema>;\nexport type QueriesPatch = v.Infer<typeof queriesPatchSchema>;\nexport type UpQueriesPatch = v.Infer<typeof upQueriesPatchSchema>;\n"],"mappings":";;;;AAIA,IAAa,
|
|
1
|
+
{"version":3,"file":"queries-patch.js","names":["v","v.readonly"],"sources":["../../../../zero-protocol/src/queries-patch.ts"],"sourcesContent":["import {jsonSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport {strictASTSchema} from './ast.ts';\n\nexport const putOpSchema = v.object({\n op: v.literal('put'),\n hash: v.string(),\n ttl: v.number().optional(),\n});\n\nexport const upPutOpSchema = putOpSchema.extend({\n // All fields are optional in this transitional period.\n // - ast is filled in for client queries\n // - name and args are filled in for custom queries\n ast: strictASTSchema.optional(),\n name: v.string().optional(),\n args: v.readonly(v.array(jsonSchema)).optional(),\n});\n\nconst delOpSchema = v.object({\n op: v.literal('del'),\n hash: v.string(),\n});\n\nconst clearOpSchema = v.object({\n op: v.literal('clear'),\n});\n\nconst patchOpSchema = v.union(putOpSchema, delOpSchema, clearOpSchema);\nconst upPatchOpSchema = v.union(upPutOpSchema, delOpSchema, clearOpSchema);\n\nexport const queriesPatchSchema = v.array(patchOpSchema);\nexport const upQueriesPatchSchema = v.array(upPatchOpSchema);\n\nexport type QueriesPutOp = v.Infer<typeof putOpSchema>;\nexport type QueriesDelOp = v.Infer<typeof delOpSchema>;\nexport type QueriesClearOp = v.Infer<typeof clearOpSchema>;\nexport type QueriesPatchOp = v.Infer<typeof patchOpSchema>;\nexport type UpQueriesPatchOp = v.Infer<typeof upPatchOpSchema>;\nexport type QueriesPatch = v.Infer<typeof queriesPatchSchema>;\nexport type UpQueriesPatch = v.Infer<typeof upQueriesPatchSchema>;\n"],"mappings":";;;;AAIA,IAAa,cAAcA,eAAE,OAAO;CAClC,IAAIA,eAAE,QAAQ,KAAK;CACnB,MAAMA,eAAE,OAAO;CACf,KAAKA,eAAE,OAAO,CAAC,CAAC,SAAS;AAC3B,CAAC;AAED,IAAa,gBAAgB,YAAY,OAAO;CAI9C,KAAK,gBAAgB,SAAS;CAC9B,MAAMA,eAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MAAMC,SAAWD,eAAE,MAAM,UAAU,CAAC,CAAC,CAAC,SAAS;AACjD,CAAC;AAED,IAAM,cAAcA,eAAE,OAAO;CAC3B,IAAIA,eAAE,QAAQ,KAAK;CACnB,MAAMA,eAAE,OAAO;AACjB,CAAC;AAED,IAAM,gBAAgBA,eAAE,OAAO,EAC7B,IAAIA,eAAE,QAAQ,OAAO,EACvB,CAAC;AAED,IAAM,gBAAgBA,eAAE,MAAM,aAAa,aAAa,aAAa;AACrE,IAAM,kBAAkBA,eAAE,MAAM,eAAe,aAAa,aAAa;AAEzE,IAAa,qBAAqBA,eAAE,MAAM,aAAa;AACvD,IAAa,uBAAuBA,eAAE,MAAM,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-hash-visitor.js","names":[],"sources":["../../../../zero-protocol/src/query-hash-visitor.ts"],"sourcesContent":["import {unreachable} from '../../shared/src/asserts.ts';\n// These live in shared/src/xxhash32.ts, imported via hash.ts's re-export\n// rather than directly: the direct zero-protocol -> shared/xxhash32.ts edge\n// makes tsc 7.0.2 mis-evaluate Query-type relations in other programs --\n// phantom TS2345s in zql's runnable-query-impl.ts under the packages/zero\n// declaration build, and zero-client silently losing the type error that\n// custom.test.ts pins with a ts-expect-error directive. Bisected cold-cache\n// to that one import statement; the hash.ts route checks clean everywhere.\n// Collapse to a direct import when TypeScript is upgraded past this.\nimport {\n avalanche32,\n PRIME32_1,\n PRIME32_5,\n round32,\n} from '../../shared/src/hash.ts';\nimport type {Format} from '../../zero-types/src/format.ts';\n\n/**\n * Hashes a normalized AST by visiting it, rather than by rendering it to JSON\n * and hashing the bytes. `hashOfAST` and `hashOfNameAndArgs` in\n * `query-hash.ts` are both built on this, so these digests are the query IDs\n * the client registers and the transformation hashes the server stores.\n *\n * The pipeline this replaced was\n * `h64(JSON.stringify(normalizeAST(ast))).toString(36)`, which materialized\n * the whole AST as a string, UTF-8 encoded it, and only then hashed it — three\n * passes over the data, two of which existed purely to produce bytes to hash.\n *\n * A visitor can fold values into the hash state as it walks, so nothing is\n * materialized at all. The primitives that make that pay off:\n *\n * - Two 32-bit accumulators held in module-level `let`s, so the \"state\" is\n * plain numbers in registers rather than an object being threaded through\n * the walk.\n * - xxHash32's own round and final mix, shared with `shared/src/hash.ts` via\n * `shared/src/xxhash32.ts`. Only the ingestion differs: that one feeds them\n * UTF-8 bytes, this one feeds them words straight out of the structure.\n * - Strings folded straight from `charCodeAt`, two UTF-16 units at a time, into\n * one 32-bit word. No UTF-8 encoding, and half the loop iterations a\n * byte-oriented hash would need over ASCII.\n *\n * These digests do not agree with xxHash32 over the old JSON encoding, and are\n * not meant to: nothing recomputes a hash produced elsewhere and compares it,\n * so the encoding is free to change as long as every writer moves together.\n * What it does have to give is distinct words for structurally distinct\n * queries — a 64-bit digest cannot promise that absolutely, but every field\n * and node kind must at least reach the mixer, and no two of them may be\n * written so as to be confusable. `query-hash-visitor.test.ts` holds that\n * line with a corpus and a per-field mutation test.\n *\n * The walk is deliberately specialized to the AST shape rather than written as\n * a generic JSON-value walk. That is not premature: a generic version was\n * measured alongside this one and came out ~2.4x slower, no better than the\n * `JSON.stringify` it was meant to replace, because `for...in` and the\n * megamorphic property loads cost about what the native stringify costs. Only\n * `visitValue` below stays generic, for the two places an AST holds arbitrary\n * JSON: a literal's value and a bound's row.\n */\nimport type {\n AST,\n Condition,\n CorrelatedSubquery,\n Ordering,\n System,\n ValuePosition,\n} from './ast.ts';\n\n// Two 32-bit lanes, combined into 64 bits at the end. Module-level so the walk\n// mutates registers rather than allocating or threading state through it.\nlet h1 = 0;\nlet h2 = 0;\n\n/**\n * Fold one 32-bit word into both lanes.\n *\n * Both lanes run xxHash32's own round; only their starting values differ, so\n * they diverge immediately and stay diverged. That is the same construction\n * `h64` uses to widen xxHash32 past 32 bits, just fed words taken from a\n * structure rather than bytes taken from a string.\n */\nfunction mix(w: number): void {\n h1 = round32(h1, w);\n h2 = round32(h2, w);\n}\n\n/**\n * Fold a string, two UTF-16 units per word.\n *\n * The leading length keeps `['ab','c']` and `['a','bc']` apart. STR_MARK is\n * folded into that same word rather than mixed separately: it costs nothing,\n * and since every other count written by this file is a small array length, a\n * string can never fold like one.\n */\nfunction mixString(s: string): void {\n const n = s.length;\n mix(n | STR_MARK);\n let i = 0;\n for (; i + 1 < n; i += 2) {\n mix(s.charCodeAt(i) | (s.charCodeAt(i + 1) << 16));\n }\n if (i < n) {\n mix(s.charCodeAt(i));\n }\n}\n\n// A DataView with an explicit byte order, not a Float64Array/Int32Array\n// aliasing pair: typed arrays read the buffer in host byte order, and these\n// digests are persisted, so a big-endian runtime would fold a float's words\n// swapped and disagree with every little-endian peer.\nconst numView = new DataView(new ArrayBuffer(8));\n\n/** Fold a number: one word for an int32, two for anything else. */\nfunction mixNumber(n: number): void {\n if ((n | 0) === n) {\n mix(n);\n } else {\n numView.setFloat64(0, n, true);\n mix(numView.getInt32(0, true));\n mix(numView.getInt32(4, true));\n }\n}\n\n// Structural tags. Distinct constants so that, say, a string \"1\" and the\n// number 1 cannot fold to the same state.\nconst TAG_NULL = 0x1001;\nconst TAG_FALSE = 0x1002;\nconst TAG_TRUE = 0x1003;\nconst TAG_INT = 0x1004;\nconst TAG_FLOAT = 0x1005;\nconst TAG_ARR = 0x1007;\nconst TAG_OBJ = 0x1008;\nconst TAG_END = 0x1009;\nconst TAG_UNDEF = 0x100a;\n\n// Discriminators for the AST's own unions, kept distinct from the value tags\n// above so a node kind can never fold like a value of some other type.\nconst TAG_LITERAL = 0x2001;\nconst TAG_COLUMN = 0x2002;\nconst TAG_STATIC = 0x2003;\nconst TAG_SIMPLE = 0x2004;\nconst TAG_SUBQUERY = 0x2005;\nconst TAG_AND = 0x2006;\nconst TAG_OR = 0x2007;\nconst TAG_FORMAT = 0x2008;\nconst TAG_NAME_ARGS = 0x2009;\n// `System` is a closed set of three, so it folds as one word rather than as a\n// string -- on an AST it appears once per correlated subquery, so this is on\n// the walk's hot path. The switch below is exhaustive, so adding a member is a\n// type error rather than a silent collision with an existing one.\nconst TAG_SYSTEM_PERMISSIONS = 0x200a;\nconst TAG_SYSTEM_CLIENT = 0x200b;\nconst TAG_SYSTEM_TEST = 0x200c;\nconst TAG_JUNCTION = 0x200d;\n\n// Set on a string's length word. High enough that no array length reaches it.\nconst STR_MARK = 0x40000000;\n\nfunction reset(): void {\n h1 = PRIME32_5;\n h2 = PRIME32_1;\n}\n\n/** Collapse the two lanes into one 64-bit value, avalanching each first. */\nfunction finalize(): string {\n return (\n avalanche32(h1).toString(36).padStart(7, '0') +\n avalanche32(h2).toString(36).padStart(7, '0')\n );\n}\n\n// ---------------------------------------------------------------------------\n// The generic part: arbitrary JSON, for literal values and bound rows.\n// ---------------------------------------------------------------------------\n\nfunction visitValue(v: unknown): void {\n switch (typeof v) {\n case 'string':\n mixString(v);\n return;\n case 'number':\n // NaN and Infinity are null by the time they reach the wire, because\n // that is what JSON.stringify writes for them. Two queries identical on\n // the wire must not get different IDs.\n if (!Number.isFinite(v)) {\n mix(TAG_NULL);\n return;\n }\n mix((v | 0) === v ? TAG_INT : TAG_FLOAT);\n mixNumber(v);\n return;\n case 'boolean':\n mix(v ? TAG_TRUE : TAG_FALSE);\n return;\n case 'object': {\n if (v === null) {\n mix(TAG_NULL);\n return;\n }\n if (Array.isArray(v)) {\n mix(TAG_ARR);\n for (let i = 0; i < v.length; i++) {\n // An `undefined` element is `null` by the time it reaches the wire,\n // because that is what JSON.stringify makes of it. Dropping it\n // instead would fold `[undefined]` onto `[]`.\n const e: unknown = v[i];\n visitValue(e === undefined ? null : e);\n }\n mix(TAG_END);\n return;\n }\n mix(TAG_OBJ);\n // Sorted, so the digest is a function of the object's contents and not\n // of its key order. Rows and custom-query args round-trip through\n // Postgres JSONB, which reorders keys; an order-sensitive digest made\n // reloaded query records look changed. (The AST's own fields don't need\n // this: visitAST reads them in a fixed order by name.)\n const keys = Object.keys(v).sort();\n for (const k of keys) {\n const val = (v as Record<string, unknown>)[k];\n if (val === undefined) {\n continue; // as JSON.stringify does\n }\n mixString(k);\n visitValue(val);\n }\n mix(TAG_END);\n return;\n }\n default:\n // `undefined` and functions as an object's value: dropped, as\n // JSON.stringify drops them. Array elements are handled above.\n return;\n }\n}\n\n// ---------------------------------------------------------------------------\n// The specialized part: the AST's own shape.\n// ---------------------------------------------------------------------------\n\nfunction visitOptionalString(s: string | undefined): void {\n if (s === undefined) {\n mix(TAG_UNDEF);\n } else {\n mixString(s);\n }\n}\n\nfunction mixOptionalSystem(system: System | undefined): void {\n if (system === undefined) {\n mix(TAG_UNDEF);\n } else {\n mixSystem(system);\n }\n}\n\nfunction mixSystem(system: System): void {\n switch (system) {\n case 'permissions':\n mix(TAG_SYSTEM_PERMISSIONS);\n break;\n case 'client':\n mix(TAG_SYSTEM_CLIENT);\n break;\n case 'test':\n mix(TAG_SYSTEM_TEST);\n break;\n default:\n unreachable(system);\n }\n}\n\nfunction visitCompoundKey(k: readonly string[]): void {\n mix(k.length);\n for (let i = 0; i < k.length; i++) {\n mixString(k[i]);\n }\n}\n\nfunction visitOrdering(o: Ordering | undefined): void {\n if (o === undefined) {\n mix(TAG_UNDEF);\n return;\n }\n mix(o.length);\n for (let i = 0; i < o.length; i++) {\n const [field, dir] = o[i];\n mixString(field);\n mix(dir === 'asc' ? TAG_TRUE : TAG_FALSE);\n }\n}\n\nfunction visitValuePosition(v: ValuePosition): void {\n switch (v.type) {\n case 'literal':\n mix(TAG_LITERAL);\n visitValue(v.value);\n return;\n case 'column':\n mix(TAG_COLUMN);\n mixString(v.name);\n return;\n case 'static': {\n mix(TAG_STATIC);\n mixString(v.anchor);\n if (typeof v.field === 'string') {\n mixString(v.field);\n } else {\n visitCompoundKey(v.field);\n }\n return;\n }\n default:\n unreachable(v);\n }\n}\n\nfunction visitCondition(c: Condition): void {\n switch (c.type) {\n case 'simple':\n mix(TAG_SIMPLE);\n mixString(c.op);\n visitValuePosition(c.left);\n visitValuePosition(c.right);\n return;\n case 'correlatedSubquery':\n mix(TAG_SUBQUERY);\n mixString(c.op);\n mix(c.flip === undefined ? TAG_UNDEF : c.flip ? TAG_TRUE : TAG_FALSE);\n mix(c.scalar === undefined ? TAG_UNDEF : c.scalar ? TAG_TRUE : TAG_FALSE);\n visitCorrelatedSubquery(c.related);\n return;\n default: {\n c.type satisfies 'and' | 'or';\n mix(c.type === 'and' ? TAG_AND : TAG_OR);\n const conds = c.conditions;\n mix(conds.length);\n for (let i = 0; i < conds.length; i++) {\n visitCondition(conds[i]);\n }\n return;\n }\n }\n}\n\nfunction visitCorrelatedSubquery(csq: CorrelatedSubquery): void {\n visitCompoundKey(csq.correlation.parentField);\n visitCompoundKey(csq.correlation.childField);\n mix(csq.hidden === undefined ? TAG_UNDEF : csq.hidden ? TAG_TRUE : TAG_FALSE);\n mixOptionalSystem(csq.system);\n visitAST(csq.subquery);\n}\n\nfunction visitAST(ast: AST): void {\n mix(TAG_OBJ);\n visitOptionalString(ast.schema);\n mixString(ast.table);\n visitOptionalString(ast.alias);\n\n if (ast.where === undefined) {\n mix(TAG_UNDEF);\n } else {\n visitCondition(ast.where);\n }\n\n const related = ast.related;\n if (related === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(related.length);\n for (let i = 0; i < related.length; i++) {\n visitCorrelatedSubquery(related[i]);\n }\n }\n\n const start = ast.start;\n if (start === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(start.exclusive ? TAG_TRUE : TAG_FALSE);\n visitValue(start.row);\n }\n\n if (ast.limit === undefined) {\n mix(TAG_UNDEF);\n } else {\n // Tagged, because this is the one optional field whose present and absent\n // forms would otherwise both write a single bare word: an untagged\n // `limit: 4106` is the same word as TAG_UNDEF. The other optionals are\n // safe -- a present string carries STR_MARK, a condition or bound leads\n // with its own kind tag, and `related`/`orderBy` write a count followed by\n // that many items, so their streams diverge straight after.\n mix(TAG_INT);\n mixNumber(ast.limit);\n }\n\n visitOrdering(ast.orderBy);\n mix(TAG_END);\n}\n\nexport function hashAST(ast: AST): string {\n // Save and restore the lanes: `visitValue` reads properties of arbitrary\n // runtime objects, and a getter is free to ask for another hash mid-walk.\n // Without this, the inner call's reset() would corrupt the outer digest.\n const s1 = h1;\n const s2 = h2;\n try {\n reset();\n visitAST(ast);\n return finalize();\n } finally {\n h1 = s1;\n h2 = s2;\n }\n}\n\n/**\n * The identity of a custom query: its name and its arguments.\n *\n * Same walk, entered at a different node. `args` is arbitrary JSON, which is\n * what `visitValue` already exists to handle. The leading tag keeps this hash\n * space disjoint from `hashAST`'s -- both produce query IDs that live in the\n * same namespace, so an AST must not be able to fold to the same words as some\n * name and args.\n */\nexport function hashNameAndArgs(\n name: string,\n args: readonly unknown[],\n): string {\n const s1 = h1;\n const s2 = h2;\n try {\n reset();\n mix(TAG_NAME_ARGS);\n mixString(name);\n visitValue(args);\n return finalize();\n } finally {\n h1 = s1;\n h2 = s2;\n }\n}\n\n/**\n * The identity of a query as the client sees it: its AST, the shape it returns,\n * the system it was built for, and -- for a custom query -- the name and\n * arguments it was declared with.\n *\n * Everything past the AST is here because it is part of what makes two queries\n * different while leaving no trace, or an incomplete one, in the AST itself:\n *\n * - **name and args**: `nameAndArgs` reuses the AST it is given and only\n * attaches a `CustomQueryID`, so without these two different named queries\n * over the same table would be indistinguishable.\n * - **system**: a query stamps it onto every `related` entry and every `exists`\n * correlation it builds, so it is already hashed via\n * {@link visitCorrelatedSubquery} -- but a query with neither has nowhere to\n * put it, and would otherwise hash the same whether it was built for the\n * client or for permissions.\n * - **currentJunction**: builder state, set on the sub-query handed to a\n * two-hop relationship's callback, which makes `limit` and `orderBy` throw.\n * It leaves no trace in the AST at all, so two queries that differ only in\n * whether those methods work would otherwise be indistinguishable.\n *\n * The name and args are taken apart rather than as a `CustomQueryID` because\n * that type lives in `zql`, which is above this package; `hashNameAndArgs`\n * splits them the same way.\n */\nexport function hashOfQueryInternals(\n ast: AST,\n format: Format,\n system: System,\n currentJunction: string | undefined,\n customQueryName: string | undefined,\n customQueryArgs: readonly unknown[] | undefined,\n): string {\n const s1 = h1;\n const s2 = h2;\n try {\n reset();\n visitAST(ast);\n mix(TAG_FORMAT);\n visitValue(format);\n mixSystem(system);\n if (currentJunction === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(TAG_JUNCTION);\n mixString(currentJunction);\n }\n if (customQueryName === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(TAG_NAME_ARGS);\n mixString(customQueryName);\n visitValue(customQueryArgs);\n }\n return finalize();\n } finally {\n h1 = s1;\n h2 = s2;\n }\n}\n"],"mappings":";;;;AAqEA,IAAI,KAAK;AACT,IAAI,KAAK;;;;;;;;;AAUT,SAAS,IAAI,GAAiB;CAC5B,KAAK,QAAQ,IAAI,CAAC;CAClB,KAAK,QAAQ,IAAI,CAAC;AACpB;;;;;;;;;AAUA,SAAS,UAAU,GAAiB;CAClC,MAAM,IAAI,EAAE;CACZ,IAAI,IAAI,QAAQ;CAChB,IAAI,IAAI;CACR,OAAO,IAAI,IAAI,GAAG,KAAK,GACrB,IAAI,EAAE,WAAW,CAAC,IAAK,EAAE,WAAW,IAAI,CAAC,KAAK,EAAG;CAEnD,IAAI,IAAI,GACN,IAAI,EAAE,WAAW,CAAC,CAAC;AAEvB;AAMA,IAAM,0BAAU,IAAI,yBAAS,IAAI,YAAY,CAAC,CAAC;;AAG/C,SAAS,UAAU,GAAiB;CAClC,KAAK,IAAI,OAAO,GACd,IAAI,CAAC;MACA;EACL,QAAQ,WAAW,GAAG,GAAG,IAAI;EAC7B,IAAI,QAAQ,SAAS,GAAG,IAAI,CAAC;EAC7B,IAAI,QAAQ,SAAS,GAAG,IAAI,CAAC;CAC/B;AACF;AAIA,IAAM,WAAW;AACjB,IAAM,YAAY;AAClB,IAAM,WAAW;AACjB,IAAM,UAAU;AAChB,IAAM,YAAY;AAClB,IAAM,UAAU;AAChB,IAAM,UAAU;AAChB,IAAM,UAAU;AAChB,IAAM,YAAY;AAIlB,IAAM,cAAc;AACpB,IAA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B,IAAI,SAAS;MACR;EAOL,IAAI,OAAO;EACX,UAAU,IAAI,KAAK;CACrB;CAEA,cAAc,IAAI,OAAO;CACzB,IAAI,OAAO;AACb;AAEA,SAAgB,QAAQ,KAAkB;CAIxC,MAAM,KAAK;CACX,MAAM,KAAK;CACX,IAAI;EACF,MAAM;EACN,SAAS,GAAG;EACZ,OAAO,SAAS;CAClB,UAAU;EACR,KAAK;EACL,KAAK;CACP;AACF;;;;;;;;;;AAWA,SAAgB,gBACd,MACA,MACQ;CACR,MAAM,KAAK;CACX,MAAM,KAAK;CACX,IAAI;EACF,MAAM;EACN,IAAI,aAAa;EACjB,UAAU,IAAI;EACd,WAAW,IAAI;EACf,OAAO,SAAS;CAClB,UAAU;EACR,KAAK;EACL,KAAK;CACP;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,qBACd,KACA,QACA,QACA,iBACA,iBACA,iBACQ;CACR,MAAM,KAAK;CACX,MAAM,KAAK;CACX,IAAI;EACF,MAAM;EACN,SAAS,GAAG;EACZ,IAAI,UAAU;EACd,WAAW,MAAM;EACjB,UAAU,MAAM;EAChB,IAAI,oBAAoB,KAAA,GACtB,IAAI,SAAS;OACR;GACL,IAAI,YAAY;GAChB,UAAU,eAAe;EAC3B;EACA,IAAI,oBAAoB,KAAA,GACtB,IAAI,SAAS;OACR;GACL,IAAI,aAAa;GACjB,UAAU,eAAe;GACzB,WAAW,eAAe;EAC5B;EACA,OAAO,SAAS;CAClB,UAAU;EACR,KAAK;EACL,KAAK;CACP;AACF"}
|
|
1
|
+
{"version":3,"file":"query-hash-visitor.js","names":[],"sources":["../../../../zero-protocol/src/query-hash-visitor.ts"],"sourcesContent":["import {unreachable} from '../../shared/src/asserts.ts';\n// These live in shared/src/xxhash32.ts, imported via hash.ts's re-export\n// rather than directly: the direct zero-protocol -> shared/xxhash32.ts edge\n// makes tsc 7.0.2 mis-evaluate Query-type relations in other programs --\n// phantom TS2345s in zql's runnable-query-impl.ts under the packages/zero\n// declaration build, and zero-client silently losing the type error that\n// custom.test.ts pins with a ts-expect-error directive. Bisected cold-cache\n// to that one import statement; the hash.ts route checks clean everywhere.\n// Collapse to a direct import when TypeScript is upgraded past this.\nimport {\n avalanche32,\n PRIME32_1,\n PRIME32_5,\n round32,\n} from '../../shared/src/hash.ts';\nimport type {Format} from '../../zero-types/src/format.ts';\n\n/**\n * Hashes a normalized AST by visiting it, rather than by rendering it to JSON\n * and hashing the bytes. `hashOfAST` and `hashOfNameAndArgs` in\n * `query-hash.ts` are both built on this, so these digests are the query IDs\n * the client registers and the transformation hashes the server stores.\n *\n * The pipeline this replaced was\n * `h64(JSON.stringify(normalizeAST(ast))).toString(36)`, which materialized\n * the whole AST as a string, UTF-8 encoded it, and only then hashed it — three\n * passes over the data, two of which existed purely to produce bytes to hash.\n *\n * A visitor can fold values into the hash state as it walks, so nothing is\n * materialized at all. The primitives that make that pay off:\n *\n * - Two 32-bit accumulators held in module-level `let`s, so the \"state\" is\n * plain numbers in registers rather than an object being threaded through\n * the walk.\n * - xxHash32's own round and final mix, shared with `shared/src/hash.ts` via\n * `shared/src/xxhash32.ts`. Only the ingestion differs: that one feeds them\n * UTF-8 bytes, this one feeds them words straight out of the structure.\n * - Strings folded straight from `charCodeAt`, two UTF-16 units at a time, into\n * one 32-bit word. No UTF-8 encoding, and half the loop iterations a\n * byte-oriented hash would need over ASCII.\n *\n * These digests do not agree with xxHash32 over the old JSON encoding, and are\n * not meant to: nothing recomputes a hash produced elsewhere and compares it,\n * so the encoding is free to change as long as every writer moves together.\n * What it does have to give is distinct words for structurally distinct\n * queries — a 64-bit digest cannot promise that absolutely, but every field\n * and node kind must at least reach the mixer, and no two of them may be\n * written so as to be confusable. `query-hash-visitor.test.ts` holds that\n * line with a corpus and a per-field mutation test.\n *\n * The walk is deliberately specialized to the AST shape rather than written as\n * a generic JSON-value walk. That is not premature: a generic version was\n * measured alongside this one and came out ~2.4x slower, no better than the\n * `JSON.stringify` it was meant to replace, because `for...in` and the\n * megamorphic property loads cost about what the native stringify costs. Only\n * `visitValue` below stays generic, for the two places an AST holds arbitrary\n * JSON: a literal's value and a bound's row.\n */\nimport type {\n AST,\n Condition,\n CorrelatedSubquery,\n Ordering,\n System,\n ValuePosition,\n} from './ast.ts';\n\n// Two 32-bit lanes, combined into 64 bits at the end. Module-level so the walk\n// mutates registers rather than allocating or threading state through it.\nlet h1 = 0;\nlet h2 = 0;\n\n/**\n * Fold one 32-bit word into both lanes.\n *\n * Both lanes run xxHash32's own round; only their starting values differ, so\n * they diverge immediately and stay diverged. That is the same construction\n * `h64` uses to widen xxHash32 past 32 bits, just fed words taken from a\n * structure rather than bytes taken from a string.\n */\nfunction mix(w: number): void {\n h1 = round32(h1, w);\n h2 = round32(h2, w);\n}\n\n/**\n * Fold a string, two UTF-16 units per word.\n *\n * The leading length keeps `['ab','c']` and `['a','bc']` apart. STR_MARK is\n * folded into that same word rather than mixed separately: it costs nothing,\n * and since every other count written by this file is a small array length, a\n * string can never fold like one.\n */\nfunction mixString(s: string): void {\n const n = s.length;\n mix(n | STR_MARK);\n let i = 0;\n for (; i + 1 < n; i += 2) {\n mix(s.charCodeAt(i) | (s.charCodeAt(i + 1) << 16));\n }\n if (i < n) {\n mix(s.charCodeAt(i));\n }\n}\n\n// A DataView with an explicit byte order, not a Float64Array/Int32Array\n// aliasing pair: typed arrays read the buffer in host byte order, and these\n// digests are persisted, so a big-endian runtime would fold a float's words\n// swapped and disagree with every little-endian peer.\nconst numView = new DataView(new ArrayBuffer(8));\n\n/** Fold a number: one word for an int32, two for anything else. */\nfunction mixNumber(n: number): void {\n if ((n | 0) === n) {\n mix(n);\n } else {\n numView.setFloat64(0, n, true);\n mix(numView.getInt32(0, true));\n mix(numView.getInt32(4, true));\n }\n}\n\n// Structural tags. Distinct constants so that, say, a string \"1\" and the\n// number 1 cannot fold to the same state.\nconst TAG_NULL = 0x1001;\nconst TAG_FALSE = 0x1002;\nconst TAG_TRUE = 0x1003;\nconst TAG_INT = 0x1004;\nconst TAG_FLOAT = 0x1005;\nconst TAG_ARR = 0x1007;\nconst TAG_OBJ = 0x1008;\nconst TAG_END = 0x1009;\nconst TAG_UNDEF = 0x100a;\n\n// Discriminators for the AST's own unions, kept distinct from the value tags\n// above so a node kind can never fold like a value of some other type.\nconst TAG_LITERAL = 0x2001;\nconst TAG_COLUMN = 0x2002;\nconst TAG_STATIC = 0x2003;\nconst TAG_SIMPLE = 0x2004;\nconst TAG_SUBQUERY = 0x2005;\nconst TAG_AND = 0x2006;\nconst TAG_OR = 0x2007;\nconst TAG_FORMAT = 0x2008;\nconst TAG_NAME_ARGS = 0x2009;\n// `System` is a closed set of three, so it folds as one word rather than as a\n// string -- on an AST it appears once per correlated subquery, so this is on\n// the walk's hot path. The switch below is exhaustive, so adding a member is a\n// type error rather than a silent collision with an existing one.\nconst TAG_SYSTEM_PERMISSIONS = 0x200a;\nconst TAG_SYSTEM_CLIENT = 0x200b;\nconst TAG_SYSTEM_TEST = 0x200c;\nconst TAG_JUNCTION = 0x200d;\n\n// Set on a string's length word. High enough that no array length reaches it.\nconst STR_MARK = 0x40000000;\n\nfunction reset(): void {\n h1 = PRIME32_5;\n h2 = PRIME32_1;\n}\n\n/** Collapse the two lanes into one 64-bit value, avalanching each first. */\nfunction finalize(): string {\n return (\n avalanche32(h1).toString(36).padStart(7, '0') +\n avalanche32(h2).toString(36).padStart(7, '0')\n );\n}\n\n// ---------------------------------------------------------------------------\n// The generic part: arbitrary JSON, for literal values and bound rows.\n// ---------------------------------------------------------------------------\n\nfunction visitValue(v: unknown): void {\n switch (typeof v) {\n case 'string':\n mixString(v);\n return;\n case 'number':\n // NaN and Infinity are null by the time they reach the wire, because\n // that is what JSON.stringify writes for them. Two queries identical on\n // the wire must not get different IDs.\n if (!Number.isFinite(v)) {\n mix(TAG_NULL);\n return;\n }\n mix((v | 0) === v ? TAG_INT : TAG_FLOAT);\n mixNumber(v);\n return;\n case 'boolean':\n mix(v ? TAG_TRUE : TAG_FALSE);\n return;\n case 'object': {\n if (v === null) {\n mix(TAG_NULL);\n return;\n }\n if (Array.isArray(v)) {\n mix(TAG_ARR);\n for (let i = 0; i < v.length; i++) {\n // An `undefined` element is `null` by the time it reaches the wire,\n // because that is what JSON.stringify makes of it. Dropping it\n // instead would fold `[undefined]` onto `[]`.\n const e: unknown = v[i];\n visitValue(e === undefined ? null : e);\n }\n mix(TAG_END);\n return;\n }\n mix(TAG_OBJ);\n // Sorted, so the digest is a function of the object's contents and not\n // of its key order. Rows and custom-query args round-trip through\n // Postgres JSONB, which reorders keys; an order-sensitive digest made\n // reloaded query records look changed. (The AST's own fields don't need\n // this: visitAST reads them in a fixed order by name.)\n const keys = Object.keys(v).sort();\n for (const k of keys) {\n const val = (v as Record<string, unknown>)[k];\n if (val === undefined) {\n continue; // as JSON.stringify does\n }\n mixString(k);\n visitValue(val);\n }\n mix(TAG_END);\n return;\n }\n default:\n // `undefined` and functions as an object's value: dropped, as\n // JSON.stringify drops them. Array elements are handled above.\n return;\n }\n}\n\n// ---------------------------------------------------------------------------\n// The specialized part: the AST's own shape.\n// ---------------------------------------------------------------------------\n\nfunction visitOptionalString(s: string | undefined): void {\n if (s === undefined) {\n mix(TAG_UNDEF);\n } else {\n mixString(s);\n }\n}\n\nfunction mixOptionalSystem(system: System | undefined): void {\n if (system === undefined) {\n mix(TAG_UNDEF);\n } else {\n mixSystem(system);\n }\n}\n\nfunction mixSystem(system: System): void {\n switch (system) {\n case 'permissions':\n mix(TAG_SYSTEM_PERMISSIONS);\n break;\n case 'client':\n mix(TAG_SYSTEM_CLIENT);\n break;\n case 'test':\n mix(TAG_SYSTEM_TEST);\n break;\n default:\n unreachable(system);\n }\n}\n\nfunction visitCompoundKey(k: readonly string[]): void {\n mix(k.length);\n for (let i = 0; i < k.length; i++) {\n mixString(k[i]);\n }\n}\n\nfunction visitOrdering(o: Ordering | undefined): void {\n if (o === undefined) {\n mix(TAG_UNDEF);\n return;\n }\n mix(o.length);\n for (let i = 0; i < o.length; i++) {\n const [field, dir] = o[i];\n mixString(field);\n mix(dir === 'asc' ? TAG_TRUE : TAG_FALSE);\n }\n}\n\nfunction visitValuePosition(v: ValuePosition): void {\n switch (v.type) {\n case 'literal':\n mix(TAG_LITERAL);\n visitValue(v.value);\n return;\n case 'column':\n mix(TAG_COLUMN);\n mixString(v.name);\n return;\n case 'static': {\n mix(TAG_STATIC);\n mixString(v.anchor);\n if (typeof v.field === 'string') {\n mixString(v.field);\n } else {\n visitCompoundKey(v.field);\n }\n return;\n }\n default:\n unreachable(v);\n }\n}\n\nfunction visitCondition(c: Condition): void {\n switch (c.type) {\n case 'simple':\n mix(TAG_SIMPLE);\n mixString(c.op);\n visitValuePosition(c.left);\n visitValuePosition(c.right);\n return;\n case 'correlatedSubquery':\n mix(TAG_SUBQUERY);\n mixString(c.op);\n mix(c.flip === undefined ? TAG_UNDEF : c.flip ? TAG_TRUE : TAG_FALSE);\n mix(c.scalar === undefined ? TAG_UNDEF : c.scalar ? TAG_TRUE : TAG_FALSE);\n visitCorrelatedSubquery(c.related);\n return;\n default: {\n c.type satisfies 'and' | 'or';\n mix(c.type === 'and' ? TAG_AND : TAG_OR);\n const conds = c.conditions;\n mix(conds.length);\n for (let i = 0; i < conds.length; i++) {\n visitCondition(conds[i]);\n }\n return;\n }\n }\n}\n\nfunction visitCorrelatedSubquery(csq: CorrelatedSubquery): void {\n visitCompoundKey(csq.correlation.parentField);\n visitCompoundKey(csq.correlation.childField);\n mix(csq.hidden === undefined ? TAG_UNDEF : csq.hidden ? TAG_TRUE : TAG_FALSE);\n mixOptionalSystem(csq.system);\n visitAST(csq.subquery);\n}\n\nfunction visitAST(ast: AST): void {\n mix(TAG_OBJ);\n visitOptionalString(ast.schema);\n mixString(ast.table);\n visitOptionalString(ast.alias);\n\n if (ast.where === undefined) {\n mix(TAG_UNDEF);\n } else {\n visitCondition(ast.where);\n }\n\n const related = ast.related;\n if (related === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(related.length);\n for (let i = 0; i < related.length; i++) {\n visitCorrelatedSubquery(related[i]);\n }\n }\n\n const start = ast.start;\n if (start === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(start.exclusive ? TAG_TRUE : TAG_FALSE);\n visitValue(start.row);\n }\n\n if (ast.limit === undefined) {\n mix(TAG_UNDEF);\n } else {\n // Tagged, because this is the one optional field whose present and absent\n // forms would otherwise both write a single bare word: an untagged\n // `limit: 4106` is the same word as TAG_UNDEF. The other optionals are\n // safe -- a present string carries STR_MARK, a condition or bound leads\n // with its own kind tag, and `related`/`orderBy` write a count followed by\n // that many items, so their streams diverge straight after.\n mix(TAG_INT);\n mixNumber(ast.limit);\n }\n\n visitOrdering(ast.orderBy);\n mix(TAG_END);\n}\n\nexport function hashAST(ast: AST): string {\n // Save and restore the lanes: `visitValue` reads properties of arbitrary\n // runtime objects, and a getter is free to ask for another hash mid-walk.\n // Without this, the inner call's reset() would corrupt the outer digest.\n const s1 = h1;\n const s2 = h2;\n try {\n reset();\n visitAST(ast);\n return finalize();\n } finally {\n h1 = s1;\n h2 = s2;\n }\n}\n\n/**\n * The identity of a custom query: its name and its arguments.\n *\n * Same walk, entered at a different node. `args` is arbitrary JSON, which is\n * what `visitValue` already exists to handle. The leading tag keeps this hash\n * space disjoint from `hashAST`'s -- both produce query IDs that live in the\n * same namespace, so an AST must not be able to fold to the same words as some\n * name and args.\n */\nexport function hashNameAndArgs(\n name: string,\n args: readonly unknown[],\n): string {\n const s1 = h1;\n const s2 = h2;\n try {\n reset();\n mix(TAG_NAME_ARGS);\n mixString(name);\n visitValue(args);\n return finalize();\n } finally {\n h1 = s1;\n h2 = s2;\n }\n}\n\n/**\n * The identity of a query as the client sees it: its AST, the shape it returns,\n * the system it was built for, and -- for a custom query -- the name and\n * arguments it was declared with.\n *\n * Everything past the AST is here because it is part of what makes two queries\n * different while leaving no trace, or an incomplete one, in the AST itself:\n *\n * - **name and args**: `nameAndArgs` reuses the AST it is given and only\n * attaches a `CustomQueryID`, so without these two different named queries\n * over the same table would be indistinguishable.\n * - **system**: a query stamps it onto every `related` entry and every `exists`\n * correlation it builds, so it is already hashed via\n * {@link visitCorrelatedSubquery} -- but a query with neither has nowhere to\n * put it, and would otherwise hash the same whether it was built for the\n * client or for permissions.\n * - **currentJunction**: builder state, set on the sub-query handed to a\n * two-hop relationship's callback, which makes `limit` and `orderBy` throw.\n * It leaves no trace in the AST at all, so two queries that differ only in\n * whether those methods work would otherwise be indistinguishable.\n *\n * The name and args are taken apart rather than as a `CustomQueryID` because\n * that type lives in `zql`, which is above this package; `hashNameAndArgs`\n * splits them the same way.\n */\nexport function hashOfQueryInternals(\n ast: AST,\n format: Format,\n system: System,\n currentJunction: string | undefined,\n customQueryName: string | undefined,\n customQueryArgs: readonly unknown[] | undefined,\n): string {\n const s1 = h1;\n const s2 = h2;\n try {\n reset();\n visitAST(ast);\n mix(TAG_FORMAT);\n visitValue(format);\n mixSystem(system);\n if (currentJunction === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(TAG_JUNCTION);\n mixString(currentJunction);\n }\n if (customQueryName === undefined) {\n mix(TAG_UNDEF);\n } else {\n mix(TAG_NAME_ARGS);\n mixString(customQueryName);\n visitValue(customQueryArgs);\n }\n return finalize();\n } finally {\n h1 = s1;\n h2 = s2;\n }\n}\n"],"mappings":";;;;AAqEA,IAAI,KAAK;AACT,IAAI,KAAK;;;;;;;;;AAUT,SAAS,IAAI,GAAiB;CAC5B,KAAK,QAAQ,IAAI,CAAC;CAClB,KAAK,QAAQ,IAAI,CAAC;AACpB;;;;;;;;;AAUA,SAAS,UAAU,GAAiB;CAClC,MAAM,IAAI,EAAE;CACZ,IAAI,IAAI,QAAQ;CAChB,IAAI,IAAI;CACR,OAAO,IAAI,IAAI,GAAG,KAAK,GACrB,IAAI,EAAE,WAAW,CAAC,IAAK,EAAE,WAAW,IAAI,CAAC,KAAK,EAAG;CAEnD,IAAI,IAAI,GACN,IAAI,EAAE,WAAW,CAAC,CAAC;AAEvB;AAMA,IAAM,0BAA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GAChB,UAAU,eAAe;EAC3B;EACA,IAAI,oBAAoB,KAAA,GACtB,IAAI,SAAS;OACR;GACL,IAAI,aAAa;GACjB,UAAU,eAAe;GACzB,WAAW,eAAe;EAC5B;EACA,OAAO,SAAS;CAClB,UAAU;EACR,KAAK;EACL,KAAK;CACP;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getOrInsertComputed } from "../../shared/src/map.js";
|
|
2
2
|
import { normalizeAST } from "./ast.js";
|
|
3
|
-
import { hashAST } from "./query-hash-visitor.js";
|
|
3
|
+
import { hashAST, hashNameAndArgs } from "./query-hash-visitor.js";
|
|
4
4
|
//#region ../zero-protocol/src/query-hash.ts
|
|
5
5
|
var hashCache = /* @__PURE__ */ new WeakMap();
|
|
6
6
|
function hashOfAST(ast) {
|
|
@@ -14,6 +14,6 @@ function hashOfNormalizedAST(ast) {
|
|
|
14
14
|
return getOrInsertComputed(hashCache, ast, hashAST);
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
|
-
export { hashOfAST };
|
|
17
|
+
export { hashOfAST, hashNameAndArgs as hashOfNameAndArgs, hashOfNormalizedAST };
|
|
18
18
|
|
|
19
19
|
//# sourceMappingURL=query-hash.js.map
|
|
@@ -11,6 +11,6 @@ var querySuccessSchema = valita_exports.object({
|
|
|
11
11
|
});
|
|
12
12
|
var queryResponseSchema = valita_exports.union(querySuccessSchema, transformFailedBodySchema, transformResponseMessageSchema);
|
|
13
13
|
//#endregion
|
|
14
|
-
export { queryResponseSchema };
|
|
14
|
+
export { queryResponseBodySchema, queryResponseSchema, queryResultSchema, querySuccessSchema };
|
|
15
15
|
|
|
16
16
|
//# sourceMappingURL=query-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-server.js","names":[],"sources":["../../../../zero-protocol/src/query-server.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {\n erroredQuerySchema,\n transformedQuerySchema,\n transformResponseMessageSchema,\n} from './custom-queries.ts';\nimport {transformFailedBodySchema} from './error.ts';\n\nexport const queryResultSchema = v.union(\n transformedQuerySchema,\n erroredQuerySchema,\n);\nexport type QueryResult = v.Infer<typeof queryResultSchema>;\n\nexport const queryResponseBodySchema = v.array(queryResultSchema);\nexport type QueryResponseBody = v.Infer<typeof queryResponseBodySchema>;\n\nexport const querySuccessSchema = v.object({\n kind: v.literal('QueryResponse'),\n userID: v.string().nullable().optional(),\n queries: queryResponseBodySchema,\n});\nexport type QuerySuccess = v.Infer<typeof querySuccessSchema>;\n\nexport const queryResponseSchema = v.union(\n querySuccessSchema,\n transformFailedBodySchema,\n // for backwards compatibility\n transformResponseMessageSchema,\n);\nexport type QueryResponse = v.Infer<typeof queryResponseSchema>;\n"],"mappings":";;;;AAQA,IAAa,
|
|
1
|
+
{"version":3,"file":"query-server.js","names":["v"],"sources":["../../../../zero-protocol/src/query-server.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {\n erroredQuerySchema,\n transformedQuerySchema,\n transformResponseMessageSchema,\n} from './custom-queries.ts';\nimport {transformFailedBodySchema} from './error.ts';\n\nexport const queryResultSchema = v.union(\n transformedQuerySchema,\n erroredQuerySchema,\n);\nexport type QueryResult = v.Infer<typeof queryResultSchema>;\n\nexport const queryResponseBodySchema = v.array(queryResultSchema);\nexport type QueryResponseBody = v.Infer<typeof queryResponseBodySchema>;\n\nexport const querySuccessSchema = v.object({\n kind: v.literal('QueryResponse'),\n userID: v.string().nullable().optional(),\n queries: queryResponseBodySchema,\n});\nexport type QuerySuccess = v.Infer<typeof querySuccessSchema>;\n\nexport const queryResponseSchema = v.union(\n querySuccessSchema,\n transformFailedBodySchema,\n // for backwards compatibility\n transformResponseMessageSchema,\n);\nexport type QueryResponse = v.Infer<typeof queryResponseSchema>;\n"],"mappings":";;;;AAQA,IAAa,oBAAoBA,eAAE,MACjC,wBACA,kBACF;AAGA,IAAa,0BAA0BA,eAAE,MAAM,iBAAiB;AAGhE,IAAa,qBAAqBA,eAAE,OAAO;CACzC,MAAMA,eAAE,QAAQ,eAAe;CAC/B,QAAQA,eAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACvC,SAAS;AACX,CAAC;AAGD,IAAa,sBAAsBA,eAAE,MACnC,oBACA,2BAEA,8BACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-patch.js","names":[],"sources":["../../../../zero-protocol/src/row-patch.ts"],"sourcesContent":["import {jsonObjectSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport {rowSchema} from './data.ts';\nimport {primaryKeyValueRecordSchema} from './primary-key.ts';\n\nconst putOpSchema = v.object({\n op: v.literal('put'),\n tableName: v.string(),\n value: rowSchema,\n});\n\nconst updateOpSchema = v.object({\n op: v.literal('update'),\n tableName: v.string(),\n id: primaryKeyValueRecordSchema,\n merge: jsonObjectSchema.optional(),\n constrain: v.array(v.string()).optional(),\n});\n\nconst delOpSchema = v.object({\n op: v.literal('del'),\n tableName: v.string(),\n id: primaryKeyValueRecordSchema,\n});\n\nconst clearOpSchema = v.object({\n op: v.literal('clear'),\n});\n\nconst rowPatchOpSchema = v.union(\n putOpSchema,\n updateOpSchema,\n delOpSchema,\n clearOpSchema,\n);\n\nexport const rowsPatchSchema = v.array(rowPatchOpSchema);\nexport type RowPatchOp = v.Infer<typeof rowPatchOpSchema>;\n"],"mappings":";;;;;AAKA,IAAM,
|
|
1
|
+
{"version":3,"file":"row-patch.js","names":["v"],"sources":["../../../../zero-protocol/src/row-patch.ts"],"sourcesContent":["import {jsonObjectSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport {rowSchema} from './data.ts';\nimport {primaryKeyValueRecordSchema} from './primary-key.ts';\n\nconst putOpSchema = v.object({\n op: v.literal('put'),\n tableName: v.string(),\n value: rowSchema,\n});\n\nconst updateOpSchema = v.object({\n op: v.literal('update'),\n tableName: v.string(),\n id: primaryKeyValueRecordSchema,\n merge: jsonObjectSchema.optional(),\n constrain: v.array(v.string()).optional(),\n});\n\nconst delOpSchema = v.object({\n op: v.literal('del'),\n tableName: v.string(),\n id: primaryKeyValueRecordSchema,\n});\n\nconst clearOpSchema = v.object({\n op: v.literal('clear'),\n});\n\nconst rowPatchOpSchema = v.union(\n putOpSchema,\n updateOpSchema,\n delOpSchema,\n clearOpSchema,\n);\n\nexport const rowsPatchSchema = v.array(rowPatchOpSchema);\nexport type RowPatchOp = v.Infer<typeof rowPatchOpSchema>;\n"],"mappings":";;;;;AAKA,IAAM,cAAcA,eAAE,OAAO;CAC3B,IAAIA,eAAE,QAAQ,KAAK;CACnB,WAAWA,eAAE,OAAO;CACpB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiBA,eAAE,OAAO;CAC9B,IAAIA,eAAE,QAAQ,QAAQ;CACtB,WAAWA,eAAE,OAAO;CACpB,IAAI;CACJ,OAAO,iBAAiB,SAAS;CACjC,WAAWA,eAAE,MAAMA,eAAE,OAAO,CAAC,CAAC,CAAC,SAAS;AAC1C,CAAC;AAED,IAAM,cAAcA,eAAE,OAAO;CAC3B,IAAIA,eAAE,QAAQ,KAAK;CACnB,WAAWA,eAAE,OAAO;CACpB,IAAI;AACN,CAAC;AAED,IAAM,gBAAgBA,eAAE,OAAO,EAC7B,IAAIA,eAAE,QAAQ,OAAO,EACvB,CAAC;AAED,IAAM,mBAAmBA,eAAE,MACzB,aACA,gBACA,aACA,aACF;AAEA,IAAa,kBAAkBA,eAAE,MAAM,gBAAgB"}
|