@rocicorp/zero 0.26.0-canary.0 → 0.26.0-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/out/replicache/src/persist/collect-idb-databases.d.ts +4 -4
- package/out/replicache/src/persist/collect-idb-databases.d.ts.map +1 -1
- package/out/replicache/src/persist/collect-idb-databases.js +22 -19
- package/out/replicache/src/persist/collect-idb-databases.js.map +1 -1
- package/out/replicache/src/persist/refresh.d.ts.map +1 -1
- package/out/replicache/src/persist/refresh.js +0 -8
- package/out/replicache/src/persist/refresh.js.map +1 -1
- package/out/replicache/src/process-scheduler.d.ts +23 -0
- package/out/replicache/src/process-scheduler.d.ts.map +1 -1
- package/out/replicache/src/process-scheduler.js +50 -1
- package/out/replicache/src/process-scheduler.js.map +1 -1
- package/out/replicache/src/replicache-impl.d.ts +8 -0
- package/out/replicache/src/replicache-impl.d.ts.map +1 -1
- package/out/replicache/src/replicache-impl.js +11 -2
- package/out/replicache/src/replicache-impl.js.map +1 -1
- package/out/shared/src/custom-key-map.d.ts +4 -4
- package/out/shared/src/custom-key-map.d.ts.map +1 -1
- package/out/shared/src/custom-key-map.js.map +1 -1
- package/out/shared/src/falsy.d.ts +3 -0
- package/out/shared/src/falsy.d.ts.map +1 -0
- package/out/shared/src/iterables.d.ts +6 -8
- package/out/shared/src/iterables.d.ts.map +1 -1
- package/out/shared/src/iterables.js +13 -7
- package/out/shared/src/iterables.js.map +1 -1
- package/out/shared/src/options.d.ts +1 -0
- package/out/shared/src/options.d.ts.map +1 -1
- package/out/shared/src/options.js +5 -1
- package/out/shared/src/options.js.map +1 -1
- package/out/zero/package.json.js +1 -1
- package/out/zero/src/adapters/drizzle.js +1 -2
- package/out/zero/src/adapters/prisma.d.ts +2 -0
- package/out/zero/src/adapters/prisma.d.ts.map +1 -0
- package/out/zero/src/adapters/prisma.js +6 -0
- package/out/zero/src/adapters/prisma.js.map +1 -0
- package/out/zero/src/pg.js +4 -7
- package/out/zero/src/react.js +3 -1
- package/out/zero/src/react.js.map +1 -1
- package/out/zero/src/server.js +5 -8
- package/out/zero/src/zero-cache-dev.js +7 -3
- package/out/zero/src/zero-cache-dev.js.map +1 -1
- package/out/zero-cache/src/auth/load-permissions.d.ts +3 -2
- package/out/zero-cache/src/auth/load-permissions.d.ts.map +1 -1
- package/out/zero-cache/src/auth/load-permissions.js +14 -8
- package/out/zero-cache/src/auth/load-permissions.js.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.d.ts +6 -0
- package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js +16 -3
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +54 -9
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +80 -20
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/custom/fetch.d.ts +3 -0
- package/out/zero-cache/src/custom/fetch.d.ts.map +1 -1
- package/out/zero-cache/src/custom/fetch.js +26 -0
- package/out/zero-cache/src/custom/fetch.js.map +1 -1
- package/out/zero-cache/src/db/lite-tables.js +1 -1
- package/out/zero-cache/src/db/lite-tables.js.map +1 -1
- package/out/zero-cache/src/db/migration-lite.d.ts.map +1 -1
- package/out/zero-cache/src/db/migration-lite.js +9 -3
- package/out/zero-cache/src/db/migration-lite.js.map +1 -1
- package/out/zero-cache/src/db/migration.d.ts.map +1 -1
- package/out/zero-cache/src/db/migration.js +9 -3
- package/out/zero-cache/src/db/migration.js.map +1 -1
- package/out/zero-cache/src/db/specs.d.ts +4 -3
- package/out/zero-cache/src/db/specs.d.ts.map +1 -1
- package/out/zero-cache/src/db/specs.js +4 -1
- package/out/zero-cache/src/db/specs.js.map +1 -1
- package/out/zero-cache/src/db/transaction-pool.d.ts.map +1 -1
- package/out/zero-cache/src/db/transaction-pool.js +9 -3
- package/out/zero-cache/src/db/transaction-pool.js.map +1 -1
- package/out/zero-cache/src/observability/events.d.ts.map +1 -1
- package/out/zero-cache/src/observability/events.js +15 -5
- package/out/zero-cache/src/observability/events.js.map +1 -1
- package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
- package/out/zero-cache/src/server/change-streamer.js +10 -2
- package/out/zero-cache/src/server/change-streamer.js.map +1 -1
- package/out/zero-cache/src/server/inspector-delegate.d.ts +1 -1
- package/out/zero-cache/src/server/inspector-delegate.d.ts.map +1 -1
- package/out/zero-cache/src/server/inspector-delegate.js +11 -30
- package/out/zero-cache/src/server/inspector-delegate.js.map +1 -1
- package/out/zero-cache/src/server/main.js +1 -1
- package/out/zero-cache/src/server/main.js.map +1 -1
- package/out/zero-cache/src/server/priority-op.d.ts +8 -0
- package/out/zero-cache/src/server/priority-op.d.ts.map +1 -0
- package/out/zero-cache/src/server/priority-op.js +29 -0
- package/out/zero-cache/src/server/priority-op.js.map +1 -0
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +10 -10
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/analyze.js +1 -1
- package/out/zero-cache/src/services/analyze.js.map +1 -1
- package/out/zero-cache/src/services/change-source/custom/change-source.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/custom/change-source.js +4 -7
- package/out/zero-cache/src/services/change-source/custom/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/change-source.js +68 -13
- package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/initial-sync.js +7 -2
- 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/stream.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js +7 -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/schema/ddl.d.ts +125 -180
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.js +1 -10
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/init.js +26 -12
- 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.d.ts +36 -90
- package/out/zero-cache/src/services/change-source/pg/schema/published.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/published.js +51 -14
- package/out/zero-cache/src/services/change-source/pg/schema/published.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts +31 -36
- package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/shard.js +25 -17
- 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.d.ts +2 -2
- package/out/zero-cache/src/services/change-source/pg/schema/validation.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/validation.js +2 -4
- package/out/zero-cache/src/services/change-source/pg/schema/validation.js.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/data.d.ts +158 -53
- package/out/zero-cache/src/services/change-source/protocol/current/data.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current/data.js +55 -10
- 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.d.ts +210 -72
- package/out/zero-cache/src/services/change-source/protocol/current/downstream.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/protocol/current.js +4 -2
- package/out/zero-cache/src/services/change-source/replica-schema.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/replica-schema.js +20 -4
- package/out/zero-cache/src/services/change-source/replica-schema.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-service.js +6 -4
- 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.d.ts +71 -25
- package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts.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/schema/tables.d.ts +1 -0
- package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/schema/tables.js +6 -5
- package/out/zero-cache/src/services/change-streamer/schema/tables.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/storer.d.ts +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 +17 -6
- package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/subscriber.d.ts +2 -0
- package/out/zero-cache/src/services/change-streamer/subscriber.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/subscriber.js +14 -1
- package/out/zero-cache/src/services/change-streamer/subscriber.js.map +1 -1
- package/out/zero-cache/src/services/heapz.d.ts.map +1 -1
- package/out/zero-cache/src/services/heapz.js +1 -0
- package/out/zero-cache/src/services/heapz.js.map +1 -1
- package/out/zero-cache/src/services/life-cycle.d.ts +1 -1
- package/out/zero-cache/src/services/life-cycle.d.ts.map +1 -1
- package/out/zero-cache/src/services/life-cycle.js.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.d.ts.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.js +3 -1
- package/out/zero-cache/src/services/litestream/commands.js.map +1 -1
- package/out/zero-cache/src/services/litestream/config.yml +1 -0
- package/out/zero-cache/src/services/mutagen/error.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/error.js +4 -1
- package/out/zero-cache/src/services/mutagen/error.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.d.ts +4 -4
- package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js +10 -24
- package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +8 -6
- package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js +130 -19
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/replicator/change-processor.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/change-processor.js +24 -31
- package/out/zero-cache/src/services/replicator/change-processor.js.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/change-log.d.ts +4 -4
- 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 +38 -36
- package/out/zero-cache/src/services/replicator/schema/change-log.js.map +1 -1
- package/out/zero-cache/src/services/{change-source → replicator/schema}/column-metadata.d.ts +3 -3
- package/out/zero-cache/src/services/replicator/schema/column-metadata.d.ts.map +1 -0
- package/out/zero-cache/src/services/{change-source → replicator/schema}/column-metadata.js +3 -3
- package/out/zero-cache/src/services/replicator/schema/column-metadata.js.map +1 -0
- package/out/zero-cache/src/services/replicator/schema/replication-state.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/schema/replication-state.js +3 -1
- package/out/zero-cache/src/services/replicator/schema/replication-state.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/statz.d.ts.map +1 -1
- package/out/zero-cache/src/services/statz.js +1 -0
- package/out/zero-cache/src/services/statz.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.d.ts +5 -6
- 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 +5 -23
- package/out/zero-cache/src/services/view-syncer/client-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +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 +65 -44
- package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts +0 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +23 -6
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +14 -22
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +46 -67
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts +1 -1
- package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/row-record-cache.js +22 -11
- package/out/zero-cache/src/services/view-syncer/row-record-cache.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +0 -2
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.js +3 -11
- package/out/zero-cache/src/services/view-syncer/snapshotter.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +6 -4
- 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 +216 -243
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/types/lexi-version.d.ts.map +1 -1
- package/out/zero-cache/src/types/lexi-version.js +4 -1
- package/out/zero-cache/src/types/lexi-version.js.map +1 -1
- package/out/zero-cache/src/types/lite.d.ts.map +1 -1
- package/out/zero-cache/src/types/lite.js +8 -2
- package/out/zero-cache/src/types/lite.js.map +1 -1
- package/out/zero-cache/src/types/shards.js +1 -1
- package/out/zero-cache/src/types/shards.js.map +1 -1
- package/out/zero-cache/src/types/sql.d.ts +5 -0
- package/out/zero-cache/src/types/sql.d.ts.map +1 -1
- package/out/zero-cache/src/types/sql.js +5 -1
- package/out/zero-cache/src/types/sql.js.map +1 -1
- package/out/zero-cache/src/types/subscription.js +1 -1
- package/out/zero-cache/src/types/subscription.js.map +1 -1
- package/out/zero-cache/src/workers/connect-params.d.ts +1 -1
- package/out/zero-cache/src/workers/connect-params.d.ts.map +1 -1
- package/out/zero-cache/src/workers/connect-params.js +2 -3
- package/out/zero-cache/src/workers/connect-params.js.map +1 -1
- package/out/zero-cache/src/workers/replicator.d.ts.map +1 -1
- package/out/zero-cache/src/workers/replicator.js +2 -5
- 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 +15 -10
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-cache/src/workers/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/workers/syncer.js +17 -10
- package/out/zero-cache/src/workers/syncer.js.map +1 -1
- package/out/zero-client/src/client/connection-manager.d.ts +8 -0
- package/out/zero-client/src/client/connection-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/connection-manager.js +33 -0
- package/out/zero-client/src/client/connection-manager.js.map +1 -1
- package/out/zero-client/src/client/connection.d.ts.map +1 -1
- package/out/zero-client/src/client/connection.js +6 -3
- package/out/zero-client/src/client/connection.js.map +1 -1
- package/out/zero-client/src/client/context.js +1 -0
- package/out/zero-client/src/client/context.js.map +1 -1
- package/out/zero-client/src/client/error.js +1 -1
- package/out/zero-client/src/client/error.js.map +1 -1
- package/out/zero-client/src/client/mutator-proxy.d.ts.map +1 -1
- package/out/zero-client/src/client/mutator-proxy.js +15 -1
- package/out/zero-client/src/client/mutator-proxy.js.map +1 -1
- package/out/zero-client/src/client/options.d.ts +11 -1
- package/out/zero-client/src/client/options.d.ts.map +1 -1
- package/out/zero-client/src/client/options.js.map +1 -1
- package/out/zero-client/src/client/query-manager.d.ts +4 -0
- package/out/zero-client/src/client/query-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/query-manager.js +7 -0
- package/out/zero-client/src/client/query-manager.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero.d.ts +5 -5
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.js +53 -8
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-client/src/mod.d.ts +1 -0
- package/out/zero-client/src/mod.d.ts.map +1 -1
- package/out/zero-protocol/src/connect.d.ts +4 -0
- package/out/zero-protocol/src/connect.d.ts.map +1 -1
- package/out/zero-protocol/src/connect.js +3 -1
- package/out/zero-protocol/src/connect.js.map +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
- package/out/zero-protocol/src/protocol-version.js +1 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/push.d.ts +16 -0
- package/out/zero-protocol/src/push.d.ts.map +1 -1
- package/out/zero-protocol/src/push.js +25 -1
- package/out/zero-protocol/src/push.js.map +1 -1
- package/out/zero-protocol/src/up.d.ts +2 -0
- package/out/zero-protocol/src/up.d.ts.map +1 -1
- package/out/zero-react/src/mod.d.ts +3 -1
- package/out/zero-react/src/mod.d.ts.map +1 -1
- package/out/zero-react/src/paging-reducer.d.ts +61 -0
- package/out/zero-react/src/paging-reducer.d.ts.map +1 -0
- package/out/zero-react/src/paging-reducer.js +77 -0
- package/out/zero-react/src/paging-reducer.js.map +1 -0
- package/out/zero-react/src/use-query.d.ts +11 -1
- package/out/zero-react/src/use-query.d.ts.map +1 -1
- package/out/zero-react/src/use-query.js +13 -11
- package/out/zero-react/src/use-query.js.map +1 -1
- package/out/zero-react/src/use-rows.d.ts +39 -0
- package/out/zero-react/src/use-rows.d.ts.map +1 -0
- package/out/zero-react/src/use-rows.js +130 -0
- package/out/zero-react/src/use-rows.js.map +1 -0
- package/out/zero-react/src/use-zero-virtualizer.d.ts +122 -0
- package/out/zero-react/src/use-zero-virtualizer.d.ts.map +1 -0
- package/out/zero-react/src/use-zero-virtualizer.js +342 -0
- package/out/zero-react/src/use-zero-virtualizer.js.map +1 -0
- package/out/zero-react/src/zero-provider.js +1 -1
- package/out/zero-react/src/zero-provider.js.map +1 -1
- package/out/zero-server/src/adapters/drizzle.d.ts +18 -18
- package/out/zero-server/src/adapters/drizzle.d.ts.map +1 -1
- package/out/zero-server/src/adapters/drizzle.js +8 -22
- package/out/zero-server/src/adapters/drizzle.js.map +1 -1
- package/out/zero-server/src/adapters/pg.d.ts +19 -13
- package/out/zero-server/src/adapters/pg.d.ts.map +1 -1
- package/out/zero-server/src/adapters/pg.js.map +1 -1
- package/out/zero-server/src/adapters/postgresjs.d.ts +19 -13
- package/out/zero-server/src/adapters/postgresjs.d.ts.map +1 -1
- package/out/zero-server/src/adapters/postgresjs.js.map +1 -1
- package/out/zero-server/src/adapters/prisma.d.ts +66 -0
- package/out/zero-server/src/adapters/prisma.d.ts.map +1 -0
- package/out/zero-server/src/adapters/prisma.js +63 -0
- package/out/zero-server/src/adapters/prisma.js.map +1 -0
- package/out/zero-server/src/custom.js +1 -15
- package/out/zero-server/src/custom.js.map +1 -1
- package/out/zero-server/src/mod.d.ts +9 -8
- package/out/zero-server/src/mod.d.ts.map +1 -1
- package/out/zero-server/src/process-mutations.d.ts +2 -1
- package/out/zero-server/src/process-mutations.d.ts.map +1 -1
- package/out/zero-server/src/process-mutations.js +39 -4
- package/out/zero-server/src/process-mutations.js.map +1 -1
- package/out/zero-server/src/push-processor.js +1 -1
- package/out/zero-server/src/push-processor.js.map +1 -1
- package/out/zero-server/src/schema.d.ts.map +1 -1
- package/out/zero-server/src/schema.js +4 -1
- package/out/zero-server/src/schema.js.map +1 -1
- package/out/zero-server/src/zql-database.d.ts.map +1 -1
- package/out/zero-server/src/zql-database.js +18 -0
- package/out/zero-server/src/zql-database.js.map +1 -1
- package/out/zero-solid/src/mod.d.ts +1 -1
- package/out/zero-solid/src/mod.d.ts.map +1 -1
- package/out/zero-solid/src/solid-view.js +1 -0
- package/out/zero-solid/src/solid-view.js.map +1 -1
- package/out/zero-solid/src/use-query.d.ts +10 -1
- package/out/zero-solid/src/use-query.d.ts.map +1 -1
- package/out/zero-solid/src/use-query.js +22 -5
- package/out/zero-solid/src/use-query.js.map +1 -1
- package/out/zero-solid/src/use-zero.js +1 -1
- package/out/zero-solid/src/use-zero.js.map +1 -1
- package/out/zql/src/ivm/constraint.d.ts.map +1 -1
- package/out/zql/src/ivm/constraint.js +4 -1
- package/out/zql/src/ivm/constraint.js.map +1 -1
- package/out/zql/src/ivm/exists.d.ts.map +1 -1
- package/out/zql/src/ivm/exists.js +4 -1
- package/out/zql/src/ivm/exists.js.map +1 -1
- package/out/zql/src/ivm/join-utils.d.ts.map +1 -1
- package/out/zql/src/ivm/join-utils.js +8 -2
- package/out/zql/src/ivm/join-utils.js.map +1 -1
- package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
- package/out/zql/src/ivm/memory-source.js +12 -3
- package/out/zql/src/ivm/memory-source.js.map +1 -1
- package/out/zql/src/ivm/push-accumulated.d.ts.map +1 -1
- package/out/zql/src/ivm/push-accumulated.js +25 -2
- package/out/zql/src/ivm/push-accumulated.js.map +1 -1
- package/out/zql/src/ivm/stream.d.ts.map +1 -1
- package/out/zql/src/ivm/stream.js +1 -1
- package/out/zql/src/ivm/stream.js.map +1 -1
- package/out/zql/src/ivm/take.d.ts.map +1 -1
- package/out/zql/src/ivm/take.js +24 -6
- package/out/zql/src/ivm/take.js.map +1 -1
- package/out/zql/src/ivm/union-fan-in.d.ts.map +1 -1
- package/out/zql/src/ivm/union-fan-in.js +12 -3
- package/out/zql/src/ivm/union-fan-in.js.map +1 -1
- package/out/zql/src/mutate/mutator.js +4 -4
- package/out/zql/src/mutate/mutator.js.map +1 -1
- package/out/zql/src/query/create-builder.js +3 -5
- package/out/zql/src/query/create-builder.js.map +1 -1
- package/out/zql/src/query/query-registry.js +4 -4
- package/out/zql/src/query/query-registry.js.map +1 -1
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +1 -2
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +8 -4
- package/out/zero-cache/src/services/change-source/column-metadata.d.ts.map +0 -1
- package/out/zero-cache/src/services/change-source/column-metadata.js.map +0 -1
- package/out/zero-cache/src/types/schema-versions.d.ts +0 -12
- package/out/zero-cache/src/types/schema-versions.d.ts.map +0 -1
- package/out/zero-cache/src/types/schema-versions.js +0 -28
- package/out/zero-cache/src/types/schema-versions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../zero-client/src/mod.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,2BAA2B,EAAC,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,YAAY,EAAC,eAAe,EAAC,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,YAAY,EACV,WAAW,IAAI,aAAa,EAC5B,IAAI,IAAI,MAAM,EACd,KAAK,IAAI,OAAO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M,iCAAiC,CAAC;AAC/D,YAAY,EAAC,KAAK,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACzE,YAAY,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAC,sBAAsB,EAAC,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAC,IAAI,EAAE,KAAK,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC"}
|
|
@@ -42,7 +42,9 @@ declare const initConnectionBodySchema: v.ObjectType<{
|
|
|
42
42
|
readonly clientGroupIDs?: readonly string[] | undefined;
|
|
43
43
|
}>;
|
|
44
44
|
userPushURL: v.Optional<string>;
|
|
45
|
+
userPushHeaders: v.Optional<Record<string, string>>;
|
|
45
46
|
userQueryURL: v.Optional<string>;
|
|
47
|
+
userQueryHeaders: v.Optional<Record<string, string>>;
|
|
46
48
|
/**
|
|
47
49
|
* `activeClients` is an optional array of client IDs that are currently active
|
|
48
50
|
* in the client group. This is used to inform the server about the clients
|
|
@@ -79,7 +81,9 @@ export declare const initConnectionMessageSchema: v.TupleType<[v.Type<"initConne
|
|
|
79
81
|
readonly clientGroupIDs?: readonly string[] | undefined;
|
|
80
82
|
}>;
|
|
81
83
|
userPushURL: v.Optional<string>;
|
|
84
|
+
userPushHeaders: v.Optional<Record<string, string>>;
|
|
82
85
|
userQueryURL: v.Optional<string>;
|
|
86
|
+
userQueryHeaders: v.Optional<Record<string, string>>;
|
|
83
87
|
/**
|
|
84
88
|
* `activeClients` is an optional array of client IDs that are currently active
|
|
85
89
|
* in the client group. This is used to inform the server about the clients
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAKhD;;;;;;GAMG;AAEH,eAAO,MAAM,mBAAmB;;;aAG9B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;eAGjC,CAAC;AAEH,QAAA,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAKhD;;;;;;GAMG;AAEH,eAAO,MAAM,mBAAmB;;;aAG9B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;eAGjC,CAAC;AAEH,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAe5B;;;;;OAKG;;aAEH,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IATtC;;;;;OAKG;;eAOH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,wBAAgB,kBAAkB,CAChC,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,EACxD,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,CAgBR;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG;IACvD,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACzD,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAIA"}
|
|
@@ -2,7 +2,7 @@ import "../../shared/src/valita.js";
|
|
|
2
2
|
import { clientSchemaSchema } from "./client-schema.js";
|
|
3
3
|
import { deleteClientsBodySchema } from "./delete-clients.js";
|
|
4
4
|
import { upQueriesPatchSchema } from "./queries-patch.js";
|
|
5
|
-
import { object, number, string, tuple, literal, array } from "@badrap/valita";
|
|
5
|
+
import { object, number, string, tuple, literal, array, record } from "@badrap/valita";
|
|
6
6
|
const connectedBodySchema = object({
|
|
7
7
|
wsid: string(),
|
|
8
8
|
timestamp: number().optional()
|
|
@@ -21,8 +21,10 @@ const initConnectionBodySchema = object({
|
|
|
21
21
|
deleted: deleteClientsBodySchema.optional(),
|
|
22
22
|
// parameters to configure the mutate endpoint
|
|
23
23
|
userPushURL: string().optional(),
|
|
24
|
+
userPushHeaders: record(string()).optional(),
|
|
24
25
|
// parameters to configure the query endpoint
|
|
25
26
|
userQueryURL: string().optional(),
|
|
27
|
+
userQueryHeaders: record(string()).optional(),
|
|
26
28
|
/**
|
|
27
29
|
* `activeClients` is an optional array of client IDs that are currently active
|
|
28
30
|
* in the client group. This is used to inform the server about the clients
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sources":["../../../../zero-protocol/src/connect.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {clientSchemaSchema} from './client-schema.ts';\nimport {deleteClientsBodySchema} from './delete-clients.ts';\nimport {upQueriesPatchSchema} from './queries-patch.ts';\n\n/**\n * After opening a websocket the client waits for a `connected` message\n * from the server. It then sends an `initConnection` message to the\n * server. The server waits for the `initConnection` message before\n * beginning to send pokes to the newly connected client, so as to avoid\n * syncing lots of queries which are no longer desired by the client.\n */\n\nexport const connectedBodySchema = v.object({\n wsid: v.string(),\n timestamp: v.number().optional(),\n});\n\nexport const connectedMessageSchema = v.tuple([\n v.literal('connected'),\n connectedBodySchema,\n]);\n\nconst initConnectionBodySchema = v.object({\n desiredQueriesPatch: upQueriesPatchSchema,\n // As the schema can be large, client only sends when it does not have a\n // server snapshot (i.e. a snapshot with a cookie). Once it has a server\n // snapshot it will assume the zero-cache already has the schema for this\n // client's client group in the CVR store.\n clientSchema: clientSchemaSchema.optional(),\n deleted: deleteClientsBodySchema.optional(),\n // parameters to configure the mutate endpoint\n userPushURL: v.string().optional(),\n // parameters to configure the query endpoint\n userQueryURL: v.string().optional(),\n\n /**\n * `activeClients` is an optional array of client IDs that are currently active\n * in the client group. This is used to inform the server about the clients\n * that are currently active (aka running, aka alive), so it can inactive\n * queries from inactive clients.\n */\n activeClients: v.array(v.string()).optional(),\n});\n\nexport const initConnectionMessageSchema = v.tuple([\n v.literal('initConnection'),\n initConnectionBodySchema,\n]);\n\nexport type ConnectedBody = v.Infer<typeof connectedBodySchema>;\nexport type ConnectedMessage = v.Infer<typeof connectedMessageSchema>;\nexport type InitConnectionBody = v.Infer<typeof initConnectionBodySchema>;\nexport type InitConnectionMessage = v.Infer<typeof initConnectionMessageSchema>;\n\nexport function encodeSecProtocols(\n initConnectionMessage: InitConnectionMessage | undefined,\n authToken: string | undefined,\n): string {\n const protocols = {\n initConnectionMessage,\n authToken,\n };\n // WS sec protocols needs to be URI encoded. To save space, we base64 encode\n // the JSON before URI encoding it. But InitConnectionMessage can contain\n // arbitrary unicode strings, so we need to encode the JSON as UTF-8 first.\n // Phew!\n const bytes = new TextEncoder().encode(JSON.stringify(protocols));\n\n // Convert bytes to string without spreading all bytes as arguments\n // to avoid \"Maximum call stack size exceeded\" error with large data\n const s = Array.from(bytes, byte => String.fromCharCode(byte)).join('');\n\n return encodeURIComponent(btoa(s));\n}\n\nexport function decodeSecProtocols(secProtocol: string): {\n initConnectionMessage: InitConnectionMessage | undefined;\n authToken: string | undefined;\n} {\n const binString = atob(decodeURIComponent(secProtocol));\n const bytes = Uint8Array.from(binString, c => c.charCodeAt(0));\n return JSON.parse(new TextDecoder().decode(bytes));\n}\n"],"names":["v.object","v.string","v.number","v.tuple","v.literal","v.array"],"mappings":";;;;;AAaO,MAAM,sBAAsBA,OAAS;AAAA,EAC1C,MAAMC,OAAE;AAAA,EACR,WAAWC,OAAE,EAAS,SAAA;AACxB,CAAC;AAEM,MAAM,yBAAyBC,MAAQ;AAAA,EAC5CC,QAAU,WAAW;AAAA,EACrB;AACF,CAAC;AAED,MAAM,2BAA2BJ,OAAS;AAAA,EACxC,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrB,cAAc,mBAAmB,SAAA;AAAA,EACjC,SAAS,wBAAwB,SAAA;AAAA;AAAA,EAEjC,aAAaC,OAAE,EAAS,SAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"connect.js","sources":["../../../../zero-protocol/src/connect.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {clientSchemaSchema} from './client-schema.ts';\nimport {deleteClientsBodySchema} from './delete-clients.ts';\nimport {upQueriesPatchSchema} from './queries-patch.ts';\n\n/**\n * After opening a websocket the client waits for a `connected` message\n * from the server. It then sends an `initConnection` message to the\n * server. The server waits for the `initConnection` message before\n * beginning to send pokes to the newly connected client, so as to avoid\n * syncing lots of queries which are no longer desired by the client.\n */\n\nexport const connectedBodySchema = v.object({\n wsid: v.string(),\n timestamp: v.number().optional(),\n});\n\nexport const connectedMessageSchema = v.tuple([\n v.literal('connected'),\n connectedBodySchema,\n]);\n\nconst initConnectionBodySchema = v.object({\n desiredQueriesPatch: upQueriesPatchSchema,\n // As the schema can be large, client only sends when it does not have a\n // server snapshot (i.e. a snapshot with a cookie). Once it has a server\n // snapshot it will assume the zero-cache already has the schema for this\n // client's client group in the CVR store.\n clientSchema: clientSchemaSchema.optional(),\n deleted: deleteClientsBodySchema.optional(),\n // parameters to configure the mutate endpoint\n userPushURL: v.string().optional(),\n userPushHeaders: v.record(v.string()).optional(),\n // parameters to configure the query endpoint\n userQueryURL: v.string().optional(),\n userQueryHeaders: v.record(v.string()).optional(),\n\n /**\n * `activeClients` is an optional array of client IDs that are currently active\n * in the client group. This is used to inform the server about the clients\n * that are currently active (aka running, aka alive), so it can inactive\n * queries from inactive clients.\n */\n activeClients: v.array(v.string()).optional(),\n});\n\nexport const initConnectionMessageSchema = v.tuple([\n v.literal('initConnection'),\n initConnectionBodySchema,\n]);\n\nexport type ConnectedBody = v.Infer<typeof connectedBodySchema>;\nexport type ConnectedMessage = v.Infer<typeof connectedMessageSchema>;\nexport type InitConnectionBody = v.Infer<typeof initConnectionBodySchema>;\nexport type InitConnectionMessage = v.Infer<typeof initConnectionMessageSchema>;\n\nexport function encodeSecProtocols(\n initConnectionMessage: InitConnectionMessage | undefined,\n authToken: string | undefined,\n): string {\n const protocols = {\n initConnectionMessage,\n authToken,\n };\n // WS sec protocols needs to be URI encoded. To save space, we base64 encode\n // the JSON before URI encoding it. But InitConnectionMessage can contain\n // arbitrary unicode strings, so we need to encode the JSON as UTF-8 first.\n // Phew!\n const bytes = new TextEncoder().encode(JSON.stringify(protocols));\n\n // Convert bytes to string without spreading all bytes as arguments\n // to avoid \"Maximum call stack size exceeded\" error with large data\n const s = Array.from(bytes, byte => String.fromCharCode(byte)).join('');\n\n return encodeURIComponent(btoa(s));\n}\n\nexport function decodeSecProtocols(secProtocol: string): {\n initConnectionMessage: InitConnectionMessage | undefined;\n authToken: string | undefined;\n} {\n const binString = atob(decodeURIComponent(secProtocol));\n const bytes = Uint8Array.from(binString, c => c.charCodeAt(0));\n return JSON.parse(new TextDecoder().decode(bytes));\n}\n"],"names":["v.object","v.string","v.number","v.tuple","v.literal","v.record","v.array"],"mappings":";;;;;AAaO,MAAM,sBAAsBA,OAAS;AAAA,EAC1C,MAAMC,OAAE;AAAA,EACR,WAAWC,OAAE,EAAS,SAAA;AACxB,CAAC;AAEM,MAAM,yBAAyBC,MAAQ;AAAA,EAC5CC,QAAU,WAAW;AAAA,EACrB;AACF,CAAC;AAED,MAAM,2BAA2BJ,OAAS;AAAA,EACxC,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrB,cAAc,mBAAmB,SAAA;AAAA,EACjC,SAAS,wBAAwB,SAAA;AAAA;AAAA,EAEjC,aAAaC,OAAE,EAAS,SAAA;AAAA,EACxB,iBAAiBI,OAASJ,OAAE,CAAQ,EAAE,SAAA;AAAA;AAAA,EAEtC,cAAcA,OAAE,EAAS,SAAA;AAAA,EACzB,kBAAkBI,OAASJ,OAAE,CAAQ,EAAE,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvC,eAAeK,MAAQL,OAAE,CAAQ,EAAE,SAAA;AACrC,CAAC;AAEM,MAAM,8BAA8BE,MAAQ;AAAA,EACjDC,QAAU,gBAAgB;AAAA,EAC1B;AACF,CAAC;AAOM,SAAS,mBACd,uBACA,WACQ;AACR,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,EAAA;AAMF,QAAM,QAAQ,IAAI,YAAA,EAAc,OAAO,KAAK,UAAU,SAAS,CAAC;AAIhE,QAAM,IAAI,MAAM,KAAK,OAAO,CAAA,SAAQ,OAAO,aAAa,IAAI,CAAC,EAAE,KAAK,EAAE;AAEtE,SAAO,mBAAmB,KAAK,CAAC,CAAC;AACnC;AAEO,SAAS,mBAAmB,aAGjC;AACA,QAAM,YAAY,KAAK,mBAAmB,WAAW,CAAC;AACtD,QAAM,QAAQ,WAAW,KAAK,WAAW,OAAK,EAAE,WAAW,CAAC,CAAC;AAC7D,SAAO,KAAK,MAAM,IAAI,cAAc,OAAO,KAAK,CAAC;AACnD;"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* release. The server (`zero-cache`) must be deployed before clients start
|
|
11
11
|
* running the new code.
|
|
12
12
|
*/
|
|
13
|
-
export declare const PROTOCOL_VERSION =
|
|
13
|
+
export declare const PROTOCOL_VERSION = 45;
|
|
14
14
|
/**
|
|
15
15
|
* The minimum server-supported sync protocol version (i.e. the version
|
|
16
16
|
* declared in the "/sync/v{#}/connect" URL). The contract for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-version.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/protocol-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"protocol-version.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/protocol-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAwCH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;;;;GASG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-version.js","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 both components (i.e. IDB and CVR).\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)\nexport const PROTOCOL_VERSION =
|
|
1
|
+
{"version":3,"file":"protocol-version.js","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 both components (i.e. IDB and CVR).\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)\nexport const PROTOCOL_VERSION = 45;\n\n/**\n * The minimum server-supported sync protocol version (i.e. the version\n * declared in the \"/sync/v{#}/connect\" URL). The contract for\n * backwards compatibility is that a `zero-cache` supports the current\n * `PROTOCOL_VERSION` and at least the previous one (i.e. `PROTOCOL_VERSION - 1`)\n * if not earlier ones as well. This corresponds to supporting clients running\n * the current release and the previous (major) release. Any client connections\n * from protocol versions before `MIN_SERVER_SUPPORTED_PROTOCOL_VERSION` are\n * closed with a `VersionNotSupported` error.\n */\nexport const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 30;\n\nassert(MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION);\n"],"names":[],"mappings":";AAqDO,MAAM,mBAAmB;AAYzB,MAAM,qCAAqC;AAElD,OAAO,qCAAqC,gBAAgB;"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import * as v from '../../shared/src/valita.ts';
|
|
2
2
|
import type { NameMapper } from '../../zero-types/src/name-mapper.ts';
|
|
3
3
|
export declare const CRUD_MUTATION_NAME = "_zero_crud";
|
|
4
|
+
export declare const CLEANUP_RESULTS_MUTATION_NAME = "_zero_cleanupResults";
|
|
5
|
+
export declare const cleanupResultsArgSchema: v.UnionType<[v.ObjectType<{
|
|
6
|
+
clientGroupID: v.Type<string>;
|
|
7
|
+
clientID: v.Type<string>;
|
|
8
|
+
upToMutationID: v.Type<number>;
|
|
9
|
+
}, undefined>, v.ObjectType<{
|
|
10
|
+
type: v.Type<"single">;
|
|
11
|
+
clientGroupID: v.Type<string>;
|
|
12
|
+
clientID: v.Type<string>;
|
|
13
|
+
upToMutationID: v.Type<number>;
|
|
14
|
+
}, undefined>, v.ObjectType<{
|
|
15
|
+
type: v.Type<"bulk">;
|
|
16
|
+
clientGroupID: v.Type<string>;
|
|
17
|
+
clientIDs: v.VariadicTupleType<[v.Type<string>], v.Type<string>, []>;
|
|
18
|
+
}, undefined>]>;
|
|
4
19
|
/**
|
|
5
20
|
* Inserts if entity with id does not already exist.
|
|
6
21
|
*/
|
|
@@ -581,6 +596,7 @@ export type PushError = v.Infer<typeof pushErrorSchema>;
|
|
|
581
596
|
export type PushOk = v.Infer<typeof pushOkSchema>;
|
|
582
597
|
export type MutationResult = v.Infer<typeof mutationResultSchema>;
|
|
583
598
|
export type AckMutationMessage = v.Infer<typeof ackMutationResponsesMessageSchema>;
|
|
599
|
+
export type CleanupResultsArg = v.Infer<typeof cleanupResultsArgSchema>;
|
|
584
600
|
export type { MutationID } from './mutation-id.ts';
|
|
585
601
|
export declare function mapCRUD(arg: CRUDMutationArg, map: NameMapper): CRUDMutationArg;
|
|
586
602
|
//# sourceMappingURL=push.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/push.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAC;AAUpE,eAAO,MAAM,kBAAkB,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/push.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAC;AAUpE,eAAO,MAAM,kBAAkB,eAAe,CAAC;AA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GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CACtC,OAAO,iCAAiC,CACzC,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,YAAY,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,wBAAgB,OAAO,CACrB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,UAAU,GACd,eAAe,CAcjB"}
|
|
@@ -5,8 +5,30 @@ import { pushFailedBodySchema } from "./error.js";
|
|
|
5
5
|
import { mutationIDSchema } from "./mutation-id.js";
|
|
6
6
|
import { CRUD, Custom } from "./mutation-type-enum.js";
|
|
7
7
|
import { primaryKeySchema, primaryKeyValueRecordSchema } from "./primary-key.js";
|
|
8
|
-
import {
|
|
8
|
+
import { union, object, number, string, literal, tuple, array } from "@badrap/valita";
|
|
9
9
|
const CRUD_MUTATION_NAME = "_zero_crud";
|
|
10
|
+
const CLEANUP_RESULTS_MUTATION_NAME = "_zero_cleanupResults";
|
|
11
|
+
const cleanupResultsArgSchema = union(
|
|
12
|
+
// Legacy format (no type field) - treat as single
|
|
13
|
+
object({
|
|
14
|
+
clientGroupID: string(),
|
|
15
|
+
clientID: string(),
|
|
16
|
+
upToMutationID: number()
|
|
17
|
+
}),
|
|
18
|
+
// Explicit single: delete up to a specific mutation ID for one client
|
|
19
|
+
object({
|
|
20
|
+
type: literal("single"),
|
|
21
|
+
clientGroupID: string(),
|
|
22
|
+
clientID: string(),
|
|
23
|
+
upToMutationID: number()
|
|
24
|
+
}),
|
|
25
|
+
// Bulk: delete all mutations for multiple clients
|
|
26
|
+
object({
|
|
27
|
+
type: literal("bulk"),
|
|
28
|
+
clientGroupID: string(),
|
|
29
|
+
clientIDs: tuple([string()]).concat(array(string()))
|
|
30
|
+
})
|
|
31
|
+
);
|
|
10
32
|
const insertOpSchema = object({
|
|
11
33
|
op: literal("insert"),
|
|
12
34
|
tableName: string(),
|
|
@@ -170,8 +192,10 @@ function mapCRUD(arg, map) {
|
|
|
170
192
|
};
|
|
171
193
|
}
|
|
172
194
|
export {
|
|
195
|
+
CLEANUP_RESULTS_MUTATION_NAME,
|
|
173
196
|
CRUD_MUTATION_NAME,
|
|
174
197
|
ackMutationResponsesMessageSchema,
|
|
198
|
+
cleanupResultsArgSchema,
|
|
175
199
|
crudMutationSchema,
|
|
176
200
|
customMutationSchema,
|
|
177
201
|
mapCRUD,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sources":["../../../../zero-protocol/src/push.ts"],"sourcesContent":["import {jsonSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport type {NameMapper} from '../../zero-types/src/name-mapper.ts';\nimport {rowSchema} from './data.ts';\nimport {pushFailedBodySchema} from './error.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport * as MutationType from './mutation-type-enum.ts';\nimport {primaryKeySchema, primaryKeyValueRecordSchema} from './primary-key.ts';\n\n// NOTE! If you change this name you must also change the\n// string in `replicache-impl.ts` But CRUD mutators are being\n// deleted soon so this should not happen.\nexport const CRUD_MUTATION_NAME = '_zero_crud';\n\n/**\n * Inserts if entity with id does not already exist.\n */\nconst insertOpSchema = v.object({\n op: v.literal('insert'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n value: rowSchema,\n});\n\n/**\n * Upsert semantics. Inserts if entity with id does not already exist,\n * otherwise updates existing entity with id.\n */\nconst upsertOpSchema = v.object({\n op: v.literal('upsert'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n value: rowSchema,\n});\n\n/**\n * Updates if entity with id exists, otherwise does nothing.\n */\nconst updateOpSchema = v.object({\n op: v.literal('update'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n // Partial value with at least the primary key fields\n value: rowSchema,\n});\n\n/**\n * Deletes entity with id if it exists, otherwise does nothing.\n */\nconst deleteOpSchema = v.object({\n op: v.literal('delete'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n // Partial value representing the primary key\n value: primaryKeyValueRecordSchema,\n});\n\nconst crudOpSchema = v.union(\n insertOpSchema,\n upsertOpSchema,\n updateOpSchema,\n deleteOpSchema,\n);\n\nconst crudArgSchema = v.object({\n ops: v.array(crudOpSchema),\n});\n\nconst crudArgsSchema = v.tuple([crudArgSchema]);\n\nexport const crudMutationSchema = v.object({\n type: v.literal(MutationType.CRUD),\n id: v.number(),\n clientID: v.string(),\n name: v.literal(CRUD_MUTATION_NAME),\n args: crudArgsSchema,\n timestamp: v.number(),\n});\n\nexport const customMutationSchema = v.object({\n type: v.literal(MutationType.Custom),\n id: v.number(),\n clientID: v.string(),\n name: v.string(),\n args: v.array(jsonSchema),\n timestamp: v.number(),\n});\n\nexport const mutationSchema = v.union(crudMutationSchema, customMutationSchema);\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\nexport const pushMessageSchema = v.tuple([v.literal('push'), pushBodySchema]);\n\nconst appErrorSchema = v.object({\n error: v.literal('app'),\n // The user can return any additional data here\n message: v.string().optional(),\n details: jsonSchema.optional(),\n});\nconst zeroErrorSchema = v.object({\n error: v.union(\n /** @deprecated push oooMutation errors are now represented as ['error', { ... }] messages */\n v.literal('oooMutation'),\n v.literal('alreadyProcessed'),\n ),\n details: jsonSchema.optional(),\n});\n\nconst mutationOkSchema = v.object({\n // The user can return any additional data here\n data: jsonSchema.optional(),\n});\nconst mutationErrorSchema = v.union(appErrorSchema, zeroErrorSchema);\n\nexport const mutationResultSchema = v.union(\n mutationOkSchema,\n mutationErrorSchema,\n);\n\nexport const mutationResponseSchema = v.object({\n id: mutationIDSchema,\n result: mutationResultSchema,\n});\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 */\nconst 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\n/**\n * The schema for the querystring parameters of the custom push endpoint.\n */\nexport const pushParamsSchema = v.object({\n schema: v.string(),\n appID: v.string(),\n});\n\nexport type InsertOp = v.Infer<typeof insertOpSchema>;\nexport type UpsertOp = v.Infer<typeof upsertOpSchema>;\nexport type UpdateOp = v.Infer<typeof updateOpSchema>;\nexport type DeleteOp = v.Infer<typeof deleteOpSchema>;\nexport type CRUDOp = v.Infer<typeof crudOpSchema>;\nexport type CRUDOpKind = CRUDOp['op'];\nexport type CRUDMutationArg = v.Infer<typeof crudArgSchema>;\nexport type CRUDMutation = v.Infer<typeof crudMutationSchema>;\nexport type CustomMutation = v.Infer<typeof customMutationSchema>;\nexport type Mutation = v.Infer<typeof mutationSchema>;\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>;\nexport type MutationOk = v.Infer<typeof mutationOkSchema>;\nexport type MutationError = v.Infer<typeof mutationErrorSchema>;\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 MutationResult = v.Infer<typeof mutationResultSchema>;\nexport type AckMutationMessage = v.Infer<\n typeof ackMutationResponsesMessageSchema\n>;\nexport type {MutationID} from './mutation-id.ts';\n\nexport function mapCRUD(\n arg: CRUDMutationArg,\n map: NameMapper,\n): CRUDMutationArg {\n return {\n ops: arg.ops.map(\n ({op, tableName, primaryKey, value}) =>\n ({\n op,\n tableName: map.tableName(tableName),\n primaryKey: map.columns(tableName, primaryKey),\n value: map.row(tableName, value),\n // The cast is necessary because ts objects to the `value` field\n // for \"delete\" ops being different.\n }) as unknown as CRUDOp,\n ),\n };\n}\n"],"names":["v.object","v.literal","v.string","v.union","v.array","v.tuple","MutationType.CRUD","v.number","MutationType.Custom"],"mappings":";;;;;;;;AAYO,MAAM,qBAAqB;AAKlC,MAAM,iBAAiBA,OAAS;AAAA,EAC9B,IAAIC,QAAU,QAAQ;AAAA,EACtB,WAAWC,OAAE;AAAA,EACb,YAAY;AAAA,EACZ,OAAO;AACT,CAAC;AAMD,MAAM,iBAAiBF,OAAS;AAAA,EAC9B,IAAIC,QAAU,QAAQ;AAAA,EACtB,WAAWC,OAAE;AAAA,EACb,YAAY;AAAA,EACZ,OAAO;AACT,CAAC;AAKD,MAAM,iBAAiBF,OAAS;AAAA,EAC9B,IAAIC,QAAU,QAAQ;AAAA,EACtB,WAAWC,OAAE;AAAA,EACb,YAAY;AAAA;AAAA,EAEZ,OAAO;AACT,CAAC;AAKD,MAAM,iBAAiBF,OAAS;AAAA,EAC9B,IAAIC,QAAU,QAAQ;AAAA,EACtB,WAAWC,OAAE;AAAA,EACb,YAAY;AAAA;AAAA,EAEZ,OAAO;AACT,CAAC;AAED,MAAM,eAAeC;AAAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,gBAAgBH,OAAS;AAAA,EAC7B,KAAKI,MAAQ,YAAY;AAC3B,CAAC;AAED,MAAM,iBAAiBC,MAAQ,CAAC,aAAa,CAAC;AAEvC,MAAM,qBAAqBL,OAAS;AAAA,EACzC,MAAMC,QAAUK,IAAiB;AAAA,EACjC,IAAIC,OAAE;AAAA,EACN,UAAUL,OAAE;AAAA,EACZ,MAAMD,QAAU,kBAAkB;AAAA,EAClC,MAAM;AAAA,EACN,WAAWM,OAAE;AACf,CAAC;AAEM,MAAM,uBAAuBP,OAAS;AAAA,EAC3C,MAAMC,QAAUO,MAAmB;AAAA,EACnC,IAAID,OAAE;AAAA,EACN,UAAUL,OAAE;AAAA,EACZ,MAAMA,OAAE;AAAA,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src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport type {NameMapper} from '../../zero-types/src/name-mapper.ts';\nimport {rowSchema} from './data.ts';\nimport {pushFailedBodySchema} from './error.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport * as MutationType from './mutation-type-enum.ts';\nimport {primaryKeySchema, primaryKeyValueRecordSchema} from './primary-key.ts';\n\n// NOTE! If you change this name you must also change the\n// string in `replicache-impl.ts` But CRUD mutators are being\n// deleted soon so this should not happen.\nexport const CRUD_MUTATION_NAME = '_zero_crud';\n\n// Internal mutation name for cleaning up mutation results.\n// This mutation is sent from zero-cache to zero-server to delete\n// acknowledged mutation results from the upstream database.\nexport const CLEANUP_RESULTS_MUTATION_NAME = '_zero_cleanupResults';\n\nexport const cleanupResultsArgSchema = v.union(\n // Legacy format (no type field) - treat as single\n v.object({\n clientGroupID: v.string(),\n clientID: v.string(),\n upToMutationID: v.number(),\n }),\n // Explicit single: delete up to a specific mutation ID for one client\n v.object({\n type: v.literal('single'),\n clientGroupID: v.string(),\n clientID: v.string(),\n upToMutationID: v.number(),\n }),\n // Bulk: delete all mutations for multiple clients\n v.object({\n type: v.literal('bulk'),\n clientGroupID: v.string(),\n clientIDs: v.tuple([v.string()]).concat(v.array(v.string())),\n }),\n);\n\n/**\n * Inserts if entity with id does not already exist.\n */\nconst insertOpSchema = v.object({\n op: v.literal('insert'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n value: rowSchema,\n});\n\n/**\n * Upsert semantics. Inserts if entity with id does not already exist,\n * otherwise updates existing entity with id.\n */\nconst upsertOpSchema = v.object({\n op: v.literal('upsert'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n value: rowSchema,\n});\n\n/**\n * Updates if entity with id exists, otherwise does nothing.\n */\nconst updateOpSchema = v.object({\n op: v.literal('update'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n // Partial value with at least the primary key fields\n value: rowSchema,\n});\n\n/**\n * Deletes entity with id if it exists, otherwise does nothing.\n */\nconst deleteOpSchema = v.object({\n op: v.literal('delete'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n // Partial value representing the primary key\n value: primaryKeyValueRecordSchema,\n});\n\nconst crudOpSchema = v.union(\n insertOpSchema,\n upsertOpSchema,\n updateOpSchema,\n deleteOpSchema,\n);\n\nconst crudArgSchema = v.object({\n ops: v.array(crudOpSchema),\n});\n\nconst crudArgsSchema = v.tuple([crudArgSchema]);\n\nexport const crudMutationSchema = v.object({\n type: v.literal(MutationType.CRUD),\n id: v.number(),\n clientID: v.string(),\n name: v.literal(CRUD_MUTATION_NAME),\n args: crudArgsSchema,\n timestamp: v.number(),\n});\n\nexport const customMutationSchema = v.object({\n type: v.literal(MutationType.Custom),\n id: v.number(),\n clientID: v.string(),\n name: v.string(),\n args: v.array(jsonSchema),\n timestamp: v.number(),\n});\n\nexport const mutationSchema = v.union(crudMutationSchema, customMutationSchema);\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\nexport const pushMessageSchema = v.tuple([v.literal('push'), pushBodySchema]);\n\nconst appErrorSchema = v.object({\n error: v.literal('app'),\n // The user can return any additional data here\n message: v.string().optional(),\n details: jsonSchema.optional(),\n});\nconst zeroErrorSchema = v.object({\n error: v.union(\n /** @deprecated push oooMutation errors are now represented as ['error', { ... }] messages */\n v.literal('oooMutation'),\n v.literal('alreadyProcessed'),\n ),\n details: jsonSchema.optional(),\n});\n\nconst mutationOkSchema = v.object({\n // The user can return any additional data here\n data: jsonSchema.optional(),\n});\nconst mutationErrorSchema = v.union(appErrorSchema, zeroErrorSchema);\n\nexport const mutationResultSchema = v.union(\n mutationOkSchema,\n mutationErrorSchema,\n);\n\nexport const mutationResponseSchema = v.object({\n id: mutationIDSchema,\n result: mutationResultSchema,\n});\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 */\nconst 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\n/**\n * The schema for the querystring parameters of the custom push endpoint.\n */\nexport const pushParamsSchema = v.object({\n schema: v.string(),\n appID: v.string(),\n});\n\nexport type InsertOp = v.Infer<typeof insertOpSchema>;\nexport type UpsertOp = v.Infer<typeof upsertOpSchema>;\nexport type UpdateOp = v.Infer<typeof updateOpSchema>;\nexport type DeleteOp = v.Infer<typeof deleteOpSchema>;\nexport type CRUDOp = v.Infer<typeof crudOpSchema>;\nexport type CRUDOpKind = CRUDOp['op'];\nexport type CRUDMutationArg = v.Infer<typeof crudArgSchema>;\nexport type CRUDMutation = v.Infer<typeof crudMutationSchema>;\nexport type CustomMutation = v.Infer<typeof customMutationSchema>;\nexport type Mutation = v.Infer<typeof mutationSchema>;\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>;\nexport type MutationOk = v.Infer<typeof mutationOkSchema>;\nexport type MutationError = v.Infer<typeof mutationErrorSchema>;\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 MutationResult = v.Infer<typeof mutationResultSchema>;\nexport type AckMutationMessage = v.Infer<\n typeof ackMutationResponsesMessageSchema\n>;\nexport type CleanupResultsArg = v.Infer<typeof cleanupResultsArgSchema>;\nexport type {MutationID} from './mutation-id.ts';\n\nexport function mapCRUD(\n arg: CRUDMutationArg,\n map: NameMapper,\n): CRUDMutationArg {\n return {\n ops: arg.ops.map(\n ({op, tableName, primaryKey, value}) =>\n ({\n op,\n tableName: map.tableName(tableName),\n primaryKey: map.columns(tableName, primaryKey),\n value: map.row(tableName, value),\n // The cast is necessary because ts objects to the `value` field\n // for \"delete\" ops being different.\n }) as unknown as CRUDOp,\n ),\n };\n}\n"],"names":["v.union","v.object","v.string","v.number","v.literal","v.tuple","v.array","MutationType.CRUD","MutationType.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AAS,QACd,KACA,KACiB;AACjB,SAAO;AAAA,IACL,KAAK,IAAI,IAAI;AAAA,MACX,CAAC,EAAC,IAAI,WAAW,YAAY,aAC1B;AAAA,QACC;AAAA,QACA,WAAW,IAAI,UAAU,SAAS;AAAA,QAClC,YAAY,IAAI,QAAQ,WAAW,UAAU;AAAA,QAC7C,OAAO,IAAI,IAAI,WAAW,KAAK;AAAA;AAAA;AAAA,MAAA;AAAA,IAGjC;AAAA,EACJ;AAEJ;"}
|
|
@@ -27,7 +27,9 @@ export declare const upstreamSchema: v.UnionType<[v.TupleType<[v.Type<"initConne
|
|
|
27
27
|
readonly clientGroupIDs?: readonly string[] | undefined;
|
|
28
28
|
}>;
|
|
29
29
|
userPushURL: v.Optional<string>;
|
|
30
|
+
userPushHeaders: v.Optional<Record<string, string>>;
|
|
30
31
|
userQueryURL: v.Optional<string>;
|
|
32
|
+
userQueryHeaders: v.Optional<Record<string, string>>;
|
|
31
33
|
activeClients: v.Optional<string[]>;
|
|
32
34
|
}, undefined>]>, v.TupleType<[v.Type<"ping">, v.ObjectType<{}, undefined>]>, v.TupleType<[v.Type<"deleteClients">, v.UnionType<[v.ObjectType<Readonly<{
|
|
33
35
|
clientIDs: v.Optional<readonly string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAUhD,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAUhD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU1B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { useConnectionState } from './use-connection-state.tsx';
|
|
2
|
-
export { useQuery, useSuspenseQuery, type QueryResult, type UseQueryOptions, } from './use-query.tsx';
|
|
2
|
+
export { useQuery, useSuspenseQuery, type MaybeQueryResult, type QueryResult, type UseQueryOptions, } from './use-query.tsx';
|
|
3
|
+
export type { GetPageQuery, GetQueryReturnType, GetSingleQuery, } from './use-rows.ts';
|
|
3
4
|
export { useZeroOnline } from './use-zero-online.tsx';
|
|
5
|
+
export { useZeroVirtualizer, type PermalinkHistoryState, type UseZeroVirtualizerOptions, type ZeroVirtualizerResult, } from './use-zero-virtualizer.ts';
|
|
4
6
|
export { createUseZero, useZero, ZeroContext, ZeroProvider, type ZeroProviderProps, } from './zero-provider.tsx';
|
|
5
7
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,aAAa,EACb,OAAO,EACP,WAAW,EACX,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,OAAO,EACP,WAAW,EACX,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Anchor } from './use-rows.ts';
|
|
2
|
+
type QueryAnchor<TListContextParams, TStartRow> = {
|
|
3
|
+
readonly anchor: Anchor<TStartRow>;
|
|
4
|
+
/**
|
|
5
|
+
* Associates an anchor with list query params to coordinate state during
|
|
6
|
+
* navigation. When list context params change (e.g., filter/sort changes or
|
|
7
|
+
* browser back/forward navigation), the anchor and scroll position must be
|
|
8
|
+
* updated atomically with the new query results.
|
|
9
|
+
*
|
|
10
|
+
* When `listContextParams !== queryAnchor.listContextParams`:
|
|
11
|
+
* - Use history state to restore previous scroll position and anchor if
|
|
12
|
+
* navigating back
|
|
13
|
+
* - Use permalink anchor if loading a specific item
|
|
14
|
+
* - Otherwise reset to top
|
|
15
|
+
*
|
|
16
|
+
* During the transition (while `!isListContextCurrent`), skip paging logic
|
|
17
|
+
* and count updates to avoid querying with mismatched anchor/params or
|
|
18
|
+
* calculating counts from inconsistent state.
|
|
19
|
+
*/
|
|
20
|
+
readonly listContextParams: TListContextParams;
|
|
21
|
+
};
|
|
22
|
+
export type PagingState<TListContextParams, TStartRow> = {
|
|
23
|
+
estimatedTotal: number;
|
|
24
|
+
hasReachedStart: boolean;
|
|
25
|
+
hasReachedEnd: boolean;
|
|
26
|
+
queryAnchor: QueryAnchor<TListContextParams, TStartRow>;
|
|
27
|
+
pagingPhase: 'idle' | 'adjusting' | 'skipping';
|
|
28
|
+
pendingScrollAdjustment: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function pagingReducer<TListContextParams, TStartRow>(state: PagingState<TListContextParams, TStartRow>, action: PagingAction<TListContextParams, TStartRow>): PagingState<TListContextParams, TStartRow>;
|
|
31
|
+
export type PagingAction<TListContextParams, TStartRow> = {
|
|
32
|
+
type: 'UPDATE_ESTIMATED_TOTAL';
|
|
33
|
+
newTotal: number;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'REACHED_START';
|
|
36
|
+
} | {
|
|
37
|
+
type: 'REACHED_END';
|
|
38
|
+
} | {
|
|
39
|
+
type: 'UPDATE_ANCHOR';
|
|
40
|
+
anchor: Anchor<TStartRow>;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'SHIFT_ANCHOR_DOWN';
|
|
43
|
+
offset: number;
|
|
44
|
+
newAnchor: Anchor<TStartRow>;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'RESET_TO_TOP';
|
|
47
|
+
offset: number;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'SCROLL_ADJUSTED';
|
|
50
|
+
} | {
|
|
51
|
+
type: 'PAGING_COMPLETE';
|
|
52
|
+
} | {
|
|
53
|
+
type: 'RESET_STATE';
|
|
54
|
+
estimatedTotal: number;
|
|
55
|
+
hasReachedStart: boolean;
|
|
56
|
+
hasReachedEnd: boolean;
|
|
57
|
+
anchor: Anchor<TStartRow>;
|
|
58
|
+
listContextParams: TListContextParams;
|
|
59
|
+
};
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=paging-reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paging-reducer.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/paging-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AA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EAAE,iBAAiB,CAAA;CAAC,GACzB;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAC,GACzB;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAC1B,iBAAiB,EAAE,kBAAkB,CAAC;CACvC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
function pagingReducer(state, action) {
|
|
2
|
+
switch (action.type) {
|
|
3
|
+
case "UPDATE_ESTIMATED_TOTAL": {
|
|
4
|
+
const newTotal = Math.max(state.estimatedTotal, action.newTotal);
|
|
5
|
+
if (newTotal === state.estimatedTotal) {
|
|
6
|
+
return state;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
...state,
|
|
10
|
+
estimatedTotal: newTotal
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
case "REACHED_START":
|
|
14
|
+
return { ...state, hasReachedStart: true };
|
|
15
|
+
case "REACHED_END":
|
|
16
|
+
return { ...state, hasReachedEnd: true };
|
|
17
|
+
case "UPDATE_ANCHOR":
|
|
18
|
+
return {
|
|
19
|
+
...state,
|
|
20
|
+
queryAnchor: {
|
|
21
|
+
...state.queryAnchor,
|
|
22
|
+
anchor: action.anchor
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
case "SHIFT_ANCHOR_DOWN":
|
|
26
|
+
return {
|
|
27
|
+
...state,
|
|
28
|
+
queryAnchor: {
|
|
29
|
+
...state.queryAnchor,
|
|
30
|
+
anchor: action.newAnchor
|
|
31
|
+
},
|
|
32
|
+
pendingScrollAdjustment: action.offset,
|
|
33
|
+
pagingPhase: "adjusting"
|
|
34
|
+
};
|
|
35
|
+
case "RESET_TO_TOP":
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
queryAnchor: {
|
|
39
|
+
...state.queryAnchor,
|
|
40
|
+
anchor: { index: 0, kind: "forward", startRow: void 0 }
|
|
41
|
+
},
|
|
42
|
+
pendingScrollAdjustment: action.offset,
|
|
43
|
+
pagingPhase: "adjusting"
|
|
44
|
+
};
|
|
45
|
+
case "SCROLL_ADJUSTED":
|
|
46
|
+
return {
|
|
47
|
+
...state,
|
|
48
|
+
estimatedTotal: state.estimatedTotal + state.pendingScrollAdjustment,
|
|
49
|
+
pendingScrollAdjustment: 0,
|
|
50
|
+
pagingPhase: "skipping"
|
|
51
|
+
};
|
|
52
|
+
case "PAGING_COMPLETE":
|
|
53
|
+
return {
|
|
54
|
+
...state,
|
|
55
|
+
pagingPhase: "idle"
|
|
56
|
+
};
|
|
57
|
+
case "RESET_STATE":
|
|
58
|
+
return {
|
|
59
|
+
...state,
|
|
60
|
+
estimatedTotal: action.estimatedTotal,
|
|
61
|
+
hasReachedStart: action.hasReachedStart,
|
|
62
|
+
hasReachedEnd: action.hasReachedEnd,
|
|
63
|
+
queryAnchor: {
|
|
64
|
+
listContextParams: action.listContextParams,
|
|
65
|
+
anchor: action.anchor
|
|
66
|
+
},
|
|
67
|
+
pagingPhase: "skipping"
|
|
68
|
+
};
|
|
69
|
+
default: {
|
|
70
|
+
return state;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
pagingReducer
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=paging-reducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paging-reducer.js","sources":["../../../../zero-react/src/paging-reducer.ts"],"sourcesContent":["import type {Anchor} from './use-rows.ts';\n\ntype QueryAnchor<TListContextParams, TStartRow> = {\n readonly anchor: Anchor<TStartRow>;\n /**\n * Associates an anchor with list query params to coordinate state during\n * navigation. When list context params change (e.g., filter/sort changes or\n * browser back/forward navigation), the anchor and scroll position must be\n * updated atomically with the new query results.\n *\n * When `listContextParams !== queryAnchor.listContextParams`:\n * - Use history state to restore previous scroll position and anchor if\n * navigating back\n * - Use permalink anchor if loading a specific item\n * - Otherwise reset to top\n *\n * During the transition (while `!isListContextCurrent`), skip paging logic\n * and count updates to avoid querying with mismatched anchor/params or\n * calculating counts from inconsistent state.\n */\n readonly listContextParams: TListContextParams;\n};\n\nexport type PagingState<TListContextParams, TStartRow> = {\n estimatedTotal: number;\n hasReachedStart: boolean;\n hasReachedEnd: boolean;\n queryAnchor: QueryAnchor<TListContextParams, TStartRow>;\n pagingPhase: 'idle' | 'adjusting' | 'skipping';\n pendingScrollAdjustment: number;\n};\n\nexport function pagingReducer<TListContextParams, TStartRow>(\n state: PagingState<TListContextParams, TStartRow>,\n action: PagingAction<TListContextParams, TStartRow>,\n): PagingState<TListContextParams, TStartRow> {\n switch (action.type) {\n case 'UPDATE_ESTIMATED_TOTAL': {\n const newTotal = Math.max(state.estimatedTotal, action.newTotal);\n if (newTotal === state.estimatedTotal) {\n return state;\n }\n return {\n ...state,\n estimatedTotal: newTotal,\n };\n }\n\n case 'REACHED_START':\n return {...state, hasReachedStart: true};\n\n case 'REACHED_END':\n return {...state, hasReachedEnd: true};\n\n case 'UPDATE_ANCHOR':\n return {\n ...state,\n queryAnchor: {\n ...state.queryAnchor,\n anchor: action.anchor,\n },\n };\n\n case 'SHIFT_ANCHOR_DOWN':\n return {\n ...state,\n queryAnchor: {\n ...state.queryAnchor,\n anchor: action.newAnchor,\n },\n pendingScrollAdjustment: action.offset,\n pagingPhase: 'adjusting',\n };\n\n case 'RESET_TO_TOP':\n return {\n ...state,\n queryAnchor: {\n ...state.queryAnchor,\n anchor: {index: 0, kind: 'forward', startRow: undefined},\n },\n pendingScrollAdjustment: action.offset,\n pagingPhase: 'adjusting',\n };\n\n case 'SCROLL_ADJUSTED':\n return {\n ...state,\n estimatedTotal: state.estimatedTotal + state.pendingScrollAdjustment,\n pendingScrollAdjustment: 0,\n pagingPhase: 'skipping',\n };\n\n case 'PAGING_COMPLETE':\n return {\n ...state,\n pagingPhase: 'idle',\n };\n\n case 'RESET_STATE':\n return {\n ...state,\n estimatedTotal: action.estimatedTotal,\n hasReachedStart: action.hasReachedStart,\n hasReachedEnd: action.hasReachedEnd,\n queryAnchor: {\n listContextParams: action.listContextParams,\n anchor: action.anchor,\n },\n pagingPhase: 'skipping',\n };\n\n default: {\n action satisfies never;\n return state;\n }\n }\n}\n\nexport type PagingAction<TListContextParams, TStartRow> =\n | {type: 'UPDATE_ESTIMATED_TOTAL'; newTotal: number}\n | {type: 'REACHED_START'}\n | {type: 'REACHED_END'}\n | {type: 'UPDATE_ANCHOR'; anchor: Anchor<TStartRow>}\n | {\n type: 'SHIFT_ANCHOR_DOWN';\n offset: number;\n newAnchor: Anchor<TStartRow>;\n }\n | {type: 'RESET_TO_TOP'; offset: number}\n | {type: 'SCROLL_ADJUSTED'}\n | {type: 'PAGING_COMPLETE'}\n | {\n type: 'RESET_STATE';\n estimatedTotal: number;\n hasReachedStart: boolean;\n hasReachedEnd: boolean;\n anchor: Anchor<TStartRow>;\n listContextParams: TListContextParams;\n };\n"],"names":[],"mappings":"AAgCO,SAAS,cACd,OACA,QAC4C;AAC5C,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK,0BAA0B;AAC7B,YAAM,WAAW,KAAK,IAAI,MAAM,gBAAgB,OAAO,QAAQ;AAC/D,UAAI,aAAa,MAAM,gBAAgB;AACrC,eAAO;AAAA,MACT;AACA,aAAO;AAAA,QACL,GAAG;AAAA,QACH,gBAAgB;AAAA,MAAA;AAAA,IAEpB;AAAA,IAEA,KAAK;AACH,aAAO,EAAC,GAAG,OAAO,iBAAiB,KAAA;AAAA,IAErC,KAAK;AACH,aAAO,EAAC,GAAG,OAAO,eAAe,KAAA;AAAA,IAEnC,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,aAAa;AAAA,UACX,GAAG,MAAM;AAAA,UACT,QAAQ,OAAO;AAAA,QAAA;AAAA,MACjB;AAAA,IAGJ,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,aAAa;AAAA,UACX,GAAG,MAAM;AAAA,UACT,QAAQ,OAAO;AAAA,QAAA;AAAA,QAEjB,yBAAyB,OAAO;AAAA,QAChC,aAAa;AAAA,MAAA;AAAA,IAGjB,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,aAAa;AAAA,UACX,GAAG,MAAM;AAAA,UACT,QAAQ,EAAC,OAAO,GAAG,MAAM,WAAW,UAAU,OAAA;AAAA,QAAS;AAAA,QAEzD,yBAAyB,OAAO;AAAA,QAChC,aAAa;AAAA,MAAA;AAAA,IAGjB,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,gBAAgB,MAAM,iBAAiB,MAAM;AAAA,QAC7C,yBAAyB;AAAA,QACzB,aAAa;AAAA,MAAA;AAAA,IAGjB,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,aAAa;AAAA,MAAA;AAAA,IAGjB,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,gBAAgB,OAAO;AAAA,QACvB,iBAAiB,OAAO;AAAA,QACxB,eAAe,OAAO;AAAA,QACtB,aAAa;AAAA,UACX,mBAAmB,OAAO;AAAA,UAC1B,QAAQ,OAAO;AAAA,QAAA;AAAA,QAEjB,aAAa;AAAA,MAAA;AAAA,IAGjB,SAAS;AAEP,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import type { CustomMutatorDefs, DefaultContext, DefaultSchema, HumanReadable, PullRow, Query, QueryOrQueryRequest, QueryResultDetails, ReadonlyJSONValue, Schema, TTL, Zero } from './zero.ts';
|
|
1
|
+
import type { CustomMutatorDefs, DefaultContext, DefaultSchema, Falsy, HumanReadable, PullRow, Query, QueryOrQueryRequest, QueryResultDetails, ReadonlyJSONValue, Schema, TTL, Zero } from './zero.ts';
|
|
2
2
|
export type QueryResult<TReturn> = readonly [
|
|
3
3
|
HumanReadable<TReturn>,
|
|
4
4
|
QueryResultDetails & {}
|
|
5
5
|
];
|
|
6
|
+
/**
|
|
7
|
+
* Result type for "maybe queries" - queries that may be falsy.
|
|
8
|
+
* The data value can be undefined when the query is falsy/disabled.
|
|
9
|
+
*/
|
|
10
|
+
export type MaybeQueryResult<TReturn> = readonly [
|
|
11
|
+
HumanReadable<TReturn> | undefined,
|
|
12
|
+
QueryResultDetails & {}
|
|
13
|
+
];
|
|
6
14
|
export type UseQueryOptions = {
|
|
7
15
|
enabled?: boolean | undefined;
|
|
8
16
|
/**
|
|
@@ -28,7 +36,9 @@ export type UseSuspenseQueryOptions = UseQueryOptions & {
|
|
|
28
36
|
suspendUntil?: 'complete' | 'partial';
|
|
29
37
|
};
|
|
30
38
|
export declare function useQuery<TTable extends keyof TSchema['tables'] & string, TInput extends ReadonlyJSONValue | undefined, TOutput extends ReadonlyJSONValue | undefined, TSchema extends Schema = DefaultSchema, TReturn = PullRow<TTable, TSchema>, TContext = DefaultContext>(query: QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>, options?: UseQueryOptions | boolean): QueryResult<TReturn>;
|
|
39
|
+
export declare function useQuery<TTable extends keyof TSchema['tables'] & string, TInput extends ReadonlyJSONValue | undefined, TOutput extends ReadonlyJSONValue | undefined, TSchema extends Schema = DefaultSchema, TReturn = PullRow<TTable, TSchema>, TContext = DefaultContext>(query: QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext> | Falsy, options?: UseQueryOptions | boolean): MaybeQueryResult<TReturn>;
|
|
31
40
|
export declare function useSuspenseQuery<TTable extends keyof TSchema['tables'] & string, TInput extends ReadonlyJSONValue | undefined, TOutput extends ReadonlyJSONValue | undefined, TSchema extends Schema = DefaultSchema, TReturn = PullRow<TTable, TSchema>, TContext = DefaultContext>(query: QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>, options?: UseSuspenseQueryOptions | boolean): QueryResult<TReturn>;
|
|
41
|
+
export declare function useSuspenseQuery<TTable extends keyof TSchema['tables'] & string, TInput extends ReadonlyJSONValue | undefined, TOutput extends ReadonlyJSONValue | undefined, TSchema extends Schema = DefaultSchema, TReturn = PullRow<TTable, TSchema>, TContext = DefaultContext>(query: QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext> | Falsy, options?: UseSuspenseQueryOptions | boolean): MaybeQueryResult<TReturn>;
|
|
32
42
|
export declare function getAllViewsSizeForTesting(store: ViewStore): number;
|
|
33
43
|
/**
|
|
34
44
|
* A global store of all active views.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/use-query.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EACd,aAAa,EAEb,aAAa,EACb,OAAO,EACP,KAAK,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAEjB,MAAM,EACN,GAAG,EAEH,IAAI,EACL,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,WAAW,CAAC,OAAO,IAAI,SAAS;IAC1C,aAAa,CAAC,OAAO,CAAC;IACtB,kBAAkB,GAAG,EAAE;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;OAIG;IACH,GAAG,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IACtD;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACvC,CAAC;
|
|
1
|
+
{"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/use-query.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EACd,aAAa,EAEb,KAAK,EACL,aAAa,EACb,OAAO,EACP,KAAK,EAEL,mBAAmB,EACnB,k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OAAO,GAC1C,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAwK7B,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAKlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBAAa,SAAS;;;IASpB,OAAO,CACL,MAAM,SAAS,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,EAC/C,OAAO,SAAS,MAAM,EACtB,OAAO,EACP,EAAE,SAAS,iBAAiB,GAAG,SAAS,EACxC,QAAQ,EAER,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,CAAC,EACjC,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAClC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,GACP;QACD,WAAW,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QACxC,uBAAuB,EAAE,CAAC,SAAS,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;QAC/D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;QAC9B,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB;CAgCF"}
|
|
@@ -21,12 +21,12 @@ function useQuery(query, options) {
|
|
|
21
21
|
({ enabled = true, ttl = DEFAULT_TTL_MS } = options);
|
|
22
22
|
}
|
|
23
23
|
const zero = useZero();
|
|
24
|
-
const q = addContextToQuery(query, zero.context);
|
|
25
|
-
const view = viewStore.getView(zero, q, enabled, ttl);
|
|
24
|
+
const q = query ? addContextToQuery(query, zero.context) : void 0;
|
|
25
|
+
const view = q ? viewStore.getView(zero, q, enabled, ttl) : void 0;
|
|
26
26
|
return useSyncExternalStore(
|
|
27
|
-
view
|
|
28
|
-
view
|
|
29
|
-
view
|
|
27
|
+
view?.subscribeReactInternals ?? disabledSubscriber,
|
|
28
|
+
view?.getSnapshot ?? getDisabledSnapshot,
|
|
29
|
+
view?.getSnapshot ?? getDisabledSnapshot
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
function useSuspenseQuery(query, options) {
|
|
@@ -43,14 +43,14 @@ function useSuspenseQuery(query, options) {
|
|
|
43
43
|
} = options);
|
|
44
44
|
}
|
|
45
45
|
const zero = useZero();
|
|
46
|
-
const q = addContextToQuery(query, zero.context);
|
|
47
|
-
const view = viewStore.getView(zero, q, enabled, ttl);
|
|
46
|
+
const q = query ? addContextToQuery(query, zero.context) : void 0;
|
|
47
|
+
const view = q ? viewStore.getView(zero, q, enabled, ttl) : void 0;
|
|
48
48
|
const snapshot = useSyncExternalStore(
|
|
49
|
-
view
|
|
50
|
-
view
|
|
51
|
-
view
|
|
49
|
+
view?.subscribeReactInternals ?? disabledSubscriber,
|
|
50
|
+
view?.getSnapshot ?? getDisabledSnapshot,
|
|
51
|
+
view?.getSnapshot ?? getDisabledSnapshot
|
|
52
52
|
);
|
|
53
|
-
if (enabled) {
|
|
53
|
+
if (view && enabled) {
|
|
54
54
|
if (suspendUntil === "complete" && !view.complete) {
|
|
55
55
|
suspend(view.waitForComplete());
|
|
56
56
|
}
|
|
@@ -66,6 +66,8 @@ const disabledSubscriber = () => () => {
|
|
|
66
66
|
const resultTypeUnknown = { type: "unknown" };
|
|
67
67
|
const resultTypeComplete = { type: "complete" };
|
|
68
68
|
const resultTypeError = { type: "error" };
|
|
69
|
+
const disabledQuerySnapshot = [void 0, resultTypeUnknown];
|
|
70
|
+
const getDisabledSnapshot = () => disabledQuerySnapshot;
|
|
69
71
|
const emptySnapshotSingularUnknown = [void 0, resultTypeUnknown];
|
|
70
72
|
const emptySnapshotSingularComplete = [void 0, resultTypeComplete];
|
|
71
73
|
const emptySnapshotSingularErrorUnknown = [void 0, resultTypeError];
|