@livestore/common 0.4.0 → 0.5.0-dev.0
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/dist/.tsbuildinfo +1 -1
- package/dist/ClientSessionLeaderThreadProxy.d.ts +1 -1
- package/dist/ClientSessionLeaderThreadProxy.d.ts.map +1 -1
- package/dist/MaterializationJournal.d.ts +44 -0
- package/dist/MaterializationJournal.d.ts.map +1 -0
- package/dist/MaterializationJournal.js +112 -0
- package/dist/MaterializationJournal.js.map +1 -0
- package/dist/StateHead.d.ts +26 -0
- package/dist/StateHead.d.ts.map +1 -0
- package/dist/StateHead.js +50 -0
- package/dist/StateHead.js.map +1 -0
- package/dist/WorkerTransportError.d.ts +3 -3
- package/dist/WorkerTransportError.d.ts.map +1 -1
- package/dist/WorkerTransportError.js +3 -3
- package/dist/WorkerTransportError.js.map +1 -1
- package/dist/__tests__/fixture.d.ts +1 -1
- package/dist/__tests__/fixture.d.ts.map +1 -1
- package/dist/__tests__/fixture.js +3 -3
- package/dist/__tests__/fixture.js.map +1 -1
- package/dist/adapter-types.d.ts +29 -57
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js +20 -37
- package/dist/adapter-types.js.map +1 -1
- package/dist/debug-info.d.ts +56 -56
- package/dist/debug-info.d.ts.map +1 -1
- package/dist/debug-info.js +28 -41
- package/dist/debug-info.js.map +1 -1
- package/dist/defs.d.ts +9 -9
- package/dist/defs.js +2 -2
- package/dist/devtools/devtools-compatibility.test.js +1 -0
- package/dist/devtools/devtools-compatibility.test.js.map +1 -1
- package/dist/devtools/devtools-messages-client-session.d.ts +520 -332
- package/dist/devtools/devtools-messages-client-session.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-client-session.js +76 -74
- package/dist/devtools/devtools-messages-client-session.js.map +1 -1
- package/dist/devtools/devtools-messages-common.d.ts +27 -27
- package/dist/devtools/devtools-messages-common.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-common.js +5 -5
- package/dist/devtools/devtools-messages-common.js.map +1 -1
- package/dist/devtools/devtools-messages-leader.d.ts +405 -343
- package/dist/devtools/devtools-messages-leader.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-leader.js +101 -89
- package/dist/devtools/devtools-messages-leader.js.map +1 -1
- package/dist/devtools/devtools-sessioninfo.d.ts +18 -19
- package/dist/devtools/devtools-sessioninfo.d.ts.map +1 -1
- package/dist/devtools/devtools-sessioninfo.js +8 -5
- package/dist/devtools/devtools-sessioninfo.js.map +1 -1
- package/dist/devtools/mod.d.ts +4 -5
- package/dist/devtools/mod.d.ts.map +1 -1
- package/dist/devtools/mod.js +9 -5
- package/dist/devtools/mod.js.map +1 -1
- package/dist/errors.d.ts +45 -69
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -16
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/leader-thread/LeaderSyncProcessor.d.ts +66 -18
- package/dist/leader-thread/LeaderSyncProcessor.d.ts.map +1 -1
- package/dist/leader-thread/LeaderSyncProcessor.js +519 -461
- package/dist/leader-thread/LeaderSyncProcessor.js.map +1 -1
- package/dist/leader-thread/RejectedPushError.d.ts +67 -36
- package/dist/leader-thread/RejectedPushError.d.ts.map +1 -1
- package/dist/leader-thread/RejectedPushError.js +24 -5
- package/dist/leader-thread/RejectedPushError.js.map +1 -1
- package/dist/leader-thread/connection.d.ts +1 -0
- package/dist/leader-thread/connection.d.ts.map +1 -1
- package/dist/leader-thread/connection.js +9 -8
- package/dist/leader-thread/connection.js.map +1 -1
- package/dist/leader-thread/eventlog.d.ts +4 -4
- package/dist/leader-thread/eventlog.d.ts.map +1 -1
- package/dist/leader-thread/eventlog.js +6 -6
- package/dist/leader-thread/eventlog.js.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.d.ts +1 -1
- package/dist/leader-thread/leader-worker-devtools.d.ts.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.js +33 -17
- package/dist/leader-thread/leader-worker-devtools.js.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.d.ts +9 -5
- package/dist/leader-thread/make-leader-thread-layer.d.ts.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.js +25 -35
- package/dist/leader-thread/make-leader-thread-layer.js.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.test.js +7 -7
- package/dist/leader-thread/make-leader-thread-layer.test.js.map +1 -1
- package/dist/leader-thread/materialize-event.d.ts +2 -1
- package/dist/leader-thread/materialize-event.d.ts.map +1 -1
- package/dist/leader-thread/materialize-event.js +4 -0
- package/dist/leader-thread/materialize-event.js.map +1 -1
- package/dist/leader-thread/recreate-db.d.ts.map +1 -1
- package/dist/leader-thread/recreate-db.js +18 -39
- package/dist/leader-thread/recreate-db.js.map +1 -1
- package/dist/leader-thread/shutdown-channel.d.ts +2 -6
- package/dist/leader-thread/shutdown-channel.d.ts.map +1 -1
- package/dist/leader-thread/shutdown-channel.js +2 -3
- package/dist/leader-thread/shutdown-channel.js.map +1 -1
- package/dist/leader-thread/stream-events.d.ts +4 -7
- package/dist/leader-thread/stream-events.d.ts.map +1 -1
- package/dist/leader-thread/stream-events.js +13 -16
- package/dist/leader-thread/stream-events.js.map +1 -1
- package/dist/leader-thread/types.d.ts +32 -69
- package/dist/leader-thread/types.d.ts.map +1 -1
- package/dist/leader-thread/types.js +5 -5
- package/dist/leader-thread/types.js.map +1 -1
- package/dist/logging.d.ts +5 -30
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +1 -32
- package/dist/logging.js.map +1 -1
- package/dist/make-client-session.d.ts +1 -2
- package/dist/make-client-session.d.ts.map +1 -1
- package/dist/make-client-session.js +3 -3
- package/dist/make-client-session.js.map +1 -1
- package/dist/materializer-helper.d.ts +0 -1
- package/dist/materializer-helper.d.ts.map +1 -1
- package/dist/materializer-helper.js +7 -35
- package/dist/materializer-helper.js.map +1 -1
- package/dist/otel.d.ts +2 -3
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +2 -7
- package/dist/otel.js.map +1 -1
- package/dist/rematerialize-from-eventlog.d.ts.map +1 -1
- package/dist/rematerialize-from-eventlog.js +28 -26
- package/dist/rematerialize-from-eventlog.js.map +1 -1
- package/dist/schema/EventDef/define.d.ts +4 -4
- package/dist/schema/EventDef/define.d.ts.map +1 -1
- package/dist/schema/EventDef/define.js +5 -5
- package/dist/schema/EventDef/define.js.map +1 -1
- package/dist/schema/EventDef/define.test.d.ts +2 -0
- package/dist/schema/EventDef/define.test.d.ts.map +1 -0
- package/dist/schema/EventDef/define.test.js +23 -0
- package/dist/schema/EventDef/define.test.js.map +1 -0
- package/dist/schema/EventDef/deprecated.d.ts +8 -13
- package/dist/schema/EventDef/deprecated.d.ts.map +1 -1
- package/dist/schema/EventDef/deprecated.js +12 -13
- package/dist/schema/EventDef/deprecated.js.map +1 -1
- package/dist/schema/EventDef/deprecated.test.js +1 -1
- package/dist/schema/EventDef/deprecated.test.js.map +1 -1
- package/dist/schema/EventDef/event-def.d.ts +1 -1
- package/dist/schema/EventDef/event-def.d.ts.map +1 -1
- package/dist/schema/EventSequenceNumber/client.d.ts +12 -12
- package/dist/schema/EventSequenceNumber/client.d.ts.map +1 -1
- package/dist/schema/EventSequenceNumber/client.js +8 -9
- package/dist/schema/EventSequenceNumber/client.js.map +1 -1
- package/dist/schema/EventSequenceNumber/global.d.ts +2 -2
- package/dist/schema/EventSequenceNumber/global.d.ts.map +1 -1
- package/dist/schema/EventSequenceNumber/global.js +1 -1
- package/dist/schema/EventSequenceNumber/global.js.map +1 -1
- package/dist/schema/EventSequenceNumber.test.js +5 -5
- package/dist/schema/EventSequenceNumber.test.js.map +1 -1
- package/dist/schema/LiveStoreEvent/client.d.ts +50 -179
- package/dist/schema/LiveStoreEvent/client.d.ts.map +1 -1
- package/dist/schema/LiveStoreEvent/client.js +32 -29
- package/dist/schema/LiveStoreEvent/client.js.map +1 -1
- package/dist/schema/LiveStoreEvent/client.test.js +11 -2
- package/dist/schema/LiveStoreEvent/client.test.js.map +1 -1
- package/dist/schema/LiveStoreEvent/for-event-def.d.ts +7 -7
- package/dist/schema/LiveStoreEvent/for-event-def.d.ts.map +1 -1
- package/dist/schema/LiveStoreEvent/global.d.ts +6 -6
- package/dist/schema/LiveStoreEvent/global.d.ts.map +1 -1
- package/dist/schema/LiveStoreEvent/global.js +1 -1
- package/dist/schema/LiveStoreEvent/global.js.map +1 -1
- package/dist/schema/LiveStoreEvent/input.d.ts +5 -5
- package/dist/schema/LiveStoreEvent/input.d.ts.map +1 -1
- package/dist/schema/LiveStoreEvent/input.js +3 -3
- package/dist/schema/LiveStoreEvent/input.js.map +1 -1
- package/dist/schema/mod.d.ts +1 -0
- package/dist/schema/mod.d.ts.map +1 -1
- package/dist/schema/mod.js +1 -0
- package/dist/schema/mod.js.map +1 -1
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +3 -2
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/state/sqlite/client-document-def.d.ts +12 -17
- package/dist/schema/state/sqlite/client-document-def.d.ts.map +1 -1
- package/dist/schema/state/sqlite/client-document-def.js +23 -20
- package/dist/schema/state/sqlite/client-document-def.js.map +1 -1
- package/dist/schema/state/sqlite/client-document-def.test.js +29 -8
- package/dist/schema/state/sqlite/client-document-def.test.js.map +1 -1
- package/dist/schema/state/sqlite/column-annotations.d.ts +13 -13
- package/dist/schema/state/sqlite/column-annotations.d.ts.map +1 -1
- package/dist/schema/state/sqlite/column-annotations.js +13 -15
- package/dist/schema/state/sqlite/column-annotations.js.map +1 -1
- package/dist/schema/state/sqlite/column-annotations.test.js +19 -43
- package/dist/schema/state/sqlite/column-annotations.test.js.map +1 -1
- package/dist/schema/state/sqlite/column-def.d.ts +1 -1
- package/dist/schema/state/sqlite/column-def.d.ts.map +1 -1
- package/dist/schema/state/sqlite/column-def.js +57 -31
- package/dist/schema/state/sqlite/column-def.js.map +1 -1
- package/dist/schema/state/sqlite/column-def.test.js +118 -72
- package/dist/schema/state/sqlite/column-def.test.js.map +1 -1
- package/dist/schema/state/sqlite/column-spec.js.map +1 -1
- package/dist/schema/state/sqlite/column-spec.test.js +2 -2
- package/dist/schema/state/sqlite/db-schema/ast/sqlite.d.ts +2 -2
- package/dist/schema/state/sqlite/db-schema/ast/sqlite.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/ast/sqlite.js +13 -4
- package/dist/schema/state/sqlite/db-schema/ast/sqlite.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.d.ts +9 -9
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.js +8 -13
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.test.js +27 -16
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.test.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.d.ts +13 -11
- package/dist/schema/state/sqlite/db-schema/dsl/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.js +5 -3
- package/dist/schema/state/sqlite/db-schema/dsl/mod.js.map +1 -1
- package/dist/schema/state/sqlite/mod.d.ts +1 -3
- package/dist/schema/state/sqlite/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/mod.js +1 -1
- package/dist/schema/state/sqlite/mod.js.map +1 -1
- package/dist/schema/state/sqlite/persistence.d.ts +11 -0
- package/dist/schema/state/sqlite/persistence.d.ts.map +1 -0
- package/dist/schema/state/sqlite/persistence.js +10 -0
- package/dist/schema/state/sqlite/persistence.js.map +1 -0
- package/dist/schema/state/sqlite/query-builder/api.d.ts +7 -7
- package/dist/schema/state/sqlite/query-builder/api.d.ts.map +1 -1
- package/dist/schema/state/sqlite/query-builder/astToSql.d.ts.map +1 -1
- package/dist/schema/state/sqlite/query-builder/astToSql.js +27 -23
- package/dist/schema/state/sqlite/query-builder/astToSql.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.d.ts +3 -1
- package/dist/schema/state/sqlite/query-builder/impl.d.ts.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.js +16 -14
- package/dist/schema/state/sqlite/query-builder/impl.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.test.js +362 -596
- package/dist/schema/state/sqlite/query-builder/impl.test.js.map +1 -1
- package/dist/schema/state/sqlite/schema-helpers.js +1 -1
- package/dist/schema/state/sqlite/schema-helpers.js.map +1 -1
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.d.ts +102 -134
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.d.ts.map +1 -1
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.js +2 -2
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.js.map +1 -1
- package/dist/schema/state/sqlite/system-tables/state-tables.d.ts +328 -106
- package/dist/schema/state/sqlite/system-tables/state-tables.d.ts.map +1 -1
- package/dist/schema/state/sqlite/system-tables/state-tables.js +33 -1
- package/dist/schema/state/sqlite/system-tables/state-tables.js.map +1 -1
- package/dist/schema/state/sqlite/table-def.d.ts +16 -19
- package/dist/schema/state/sqlite/table-def.d.ts.map +1 -1
- package/dist/schema/state/sqlite/table-def.js +53 -3
- package/dist/schema/state/sqlite/table-def.js.map +1 -1
- package/dist/schema/state/sqlite/table-def.test.js +153 -36
- package/dist/schema/state/sqlite/table-def.test.js.map +1 -1
- package/dist/schema/unknown-events.d.ts.map +1 -1
- package/dist/schema/unknown-events.js +2 -1
- package/dist/schema/unknown-events.js.map +1 -1
- package/dist/schema-management/__tests__/migrations-autoincrement-quoting.test.js +2 -2
- package/dist/session-id-symbol.d.ts +29 -0
- package/dist/session-id-symbol.d.ts.map +1 -0
- package/dist/session-id-symbol.js +44 -0
- package/dist/session-id-symbol.js.map +1 -0
- package/dist/sql-queries/sql-queries.d.ts.map +1 -1
- package/dist/sql-queries/sql-queries.js +8 -10
- package/dist/sql-queries/sql-queries.js.map +1 -1
- package/dist/sql-queries/types.d.ts +6 -7
- package/dist/sql-queries/types.d.ts.map +1 -1
- package/dist/sql-queries/types.js.map +1 -1
- package/dist/sqlite-db-helper.d.ts +21 -1
- package/dist/sqlite-db-helper.d.ts.map +1 -1
- package/dist/sqlite-db-helper.js +37 -2
- package/dist/sqlite-db-helper.js.map +1 -1
- package/dist/sqlite-types.d.ts +3 -6
- package/dist/sqlite-types.d.ts.map +1 -1
- package/dist/sqlite-types.js +3 -3
- package/dist/sqlite-types.js.map +1 -1
- package/dist/sync/ClientSessionSyncProcessor.d.ts +38 -16
- package/dist/sync/ClientSessionSyncProcessor.d.ts.map +1 -1
- package/dist/sync/ClientSessionSyncProcessor.js +196 -66
- package/dist/sync/ClientSessionSyncProcessor.js.map +1 -1
- package/dist/sync/errors.d.ts +12 -18
- package/dist/sync/errors.d.ts.map +1 -1
- package/dist/sync/errors.js +2 -2
- package/dist/sync/errors.js.map +1 -1
- package/dist/sync/mock-sync-backend.d.ts +2 -3
- package/dist/sync/mock-sync-backend.d.ts.map +1 -1
- package/dist/sync/mock-sync-backend.js +54 -33
- package/dist/sync/mock-sync-backend.js.map +1 -1
- package/dist/sync/mock-sync-backend.test.d.ts +2 -0
- package/dist/sync/mock-sync-backend.test.d.ts.map +1 -0
- package/dist/sync/mock-sync-backend.test.js +49 -0
- package/dist/sync/mock-sync-backend.test.js.map +1 -0
- package/dist/sync/next/history-dag-common.d.ts +4 -0
- package/dist/sync/next/history-dag-common.d.ts.map +1 -1
- package/dist/sync/next/history-dag-common.js +52 -31
- package/dist/sync/next/history-dag-common.js.map +1 -1
- package/dist/sync/next/history-dag.d.ts.map +1 -1
- package/dist/sync/next/history-dag.js +2 -1
- package/dist/sync/next/history-dag.js.map +1 -1
- package/dist/sync/next/test/compact-events.calculator.test.js +2 -2
- package/dist/sync/next/test/event-fixtures.d.ts +7 -7
- package/dist/sync/next/test/event-fixtures.js +1 -1
- package/dist/sync/next/test/event-fixtures.js.map +1 -1
- package/dist/sync/next/test/history-dag-common.test.d.ts +2 -0
- package/dist/sync/next/test/history-dag-common.test.d.ts.map +1 -0
- package/dist/sync/next/test/history-dag-common.test.js +73 -0
- package/dist/sync/next/test/history-dag-common.test.js.map +1 -0
- package/dist/sync/sync-backend-kv.d.ts.map +1 -1
- package/dist/sync/sync-backend-kv.js +4 -2
- package/dist/sync/sync-backend-kv.js.map +1 -1
- package/dist/sync/sync-backend.d.ts +15 -15
- package/dist/sync/sync-backend.d.ts.map +1 -1
- package/dist/sync/sync-backend.js +9 -5
- package/dist/sync/sync-backend.js.map +1 -1
- package/dist/sync/sync.d.ts +1 -1
- package/dist/sync/sync.d.ts.map +1 -1
- package/dist/sync/syncstate.d.ts +97 -173
- package/dist/sync/syncstate.d.ts.map +1 -1
- package/dist/sync/syncstate.js +34 -37
- package/dist/sync/syncstate.js.map +1 -1
- package/dist/sync/syncstate.test.js +100 -61
- package/dist/sync/syncstate.test.js.map +1 -1
- package/dist/sync/transport-chunking.d.ts +15 -16
- package/dist/sync/transport-chunking.d.ts.map +1 -1
- package/dist/sync/transport-chunking.js +23 -32
- package/dist/sync/transport-chunking.js.map +1 -1
- package/dist/util.d.ts +11 -4
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +19 -2
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +19 -37
- package/src/ClientSessionLeaderThreadProxy.ts +1 -1
- package/src/MaterializationJournal.ts +184 -0
- package/src/StateHead.ts +80 -0
- package/src/WorkerTransportError.ts +4 -4
- package/src/__tests__/fixture.ts +3 -3
- package/src/adapter-types.ts +24 -61
- package/src/debug-info.ts +50 -70
- package/src/defs.ts +2 -2
- package/src/devtools/devtools-compatibility.test.ts +1 -0
- package/src/devtools/devtools-messages-client-session.ts +56 -65
- package/src/devtools/devtools-messages-common.ts +12 -11
- package/src/devtools/devtools-messages-leader.ts +71 -69
- package/src/devtools/devtools-sessioninfo.ts +13 -11
- package/src/devtools/mod.ts +4 -5
- package/src/errors.ts +46 -34
- package/src/index.ts +8 -1
- package/src/leader-thread/LeaderSyncProcessor.ts +794 -691
- package/src/leader-thread/RejectedPushError.ts +40 -27
- package/src/leader-thread/connection.ts +12 -8
- package/src/leader-thread/eventlog.ts +7 -7
- package/src/leader-thread/leader-worker-devtools.ts +37 -19
- package/src/leader-thread/make-leader-thread-layer.test.ts +7 -7
- package/src/leader-thread/make-leader-thread-layer.ts +56 -53
- package/src/leader-thread/materialize-event.ts +13 -8
- package/src/leader-thread/recreate-db.ts +24 -59
- package/src/leader-thread/shutdown-channel.ts +3 -14
- package/src/leader-thread/stream-events.ts +104 -101
- package/src/leader-thread/types.ts +24 -62
- package/src/logging.ts +5 -52
- package/src/make-client-session.ts +6 -6
- package/src/materializer-helper.ts +8 -37
- package/src/otel.ts +5 -14
- package/src/rematerialize-from-eventlog.ts +97 -94
- package/src/schema/EventDef/define.test.ts +28 -0
- package/src/schema/EventDef/define.ts +20 -19
- package/src/schema/EventDef/deprecated.test.ts +1 -8
- package/src/schema/EventDef/deprecated.ts +17 -20
- package/src/schema/EventDef/event-def.ts +2 -4
- package/src/schema/EventSequenceNumber/client.ts +8 -9
- package/src/schema/EventSequenceNumber/global.ts +1 -1
- package/src/schema/EventSequenceNumber.test.ts +5 -5
- package/src/schema/LiveStoreEvent/client.test.ts +17 -4
- package/src/schema/LiveStoreEvent/client.ts +36 -35
- package/src/schema/LiveStoreEvent/for-event-def.ts +7 -7
- package/src/schema/LiveStoreEvent/global.ts +1 -1
- package/src/schema/LiveStoreEvent/input.ts +6 -6
- package/src/schema/mod.ts +1 -0
- package/src/schema/schema.ts +3 -2
- package/src/schema/state/sqlite/client-document-def.test.ts +32 -13
- package/src/schema/state/sqlite/client-document-def.ts +95 -80
- package/src/schema/state/sqlite/column-annotations.test.ts +26 -45
- package/src/schema/state/sqlite/column-annotations.ts +26 -30
- package/src/schema/state/sqlite/column-def.test.ts +132 -77
- package/src/schema/state/sqlite/column-def.ts +72 -37
- package/src/schema/state/sqlite/column-spec.test.ts +2 -2
- package/src/schema/state/sqlite/column-spec.ts +3 -2
- package/src/schema/state/sqlite/db-schema/ast/sqlite.ts +15 -5
- package/src/schema/state/sqlite/db-schema/dsl/__snapshots__/field-defs.test.ts.snap +123 -63
- package/src/schema/state/sqlite/db-schema/dsl/field-defs.test.ts +35 -16
- package/src/schema/state/sqlite/db-schema/dsl/field-defs.ts +25 -31
- package/src/schema/state/sqlite/db-schema/dsl/mod.ts +35 -21
- package/src/schema/state/sqlite/mod.ts +2 -4
- package/src/schema/state/sqlite/persistence.ts +11 -0
- package/src/schema/state/sqlite/query-builder/api.ts +9 -9
- package/src/schema/state/sqlite/query-builder/astToSql.ts +31 -26
- package/src/schema/state/sqlite/query-builder/impl.test.ts +433 -669
- package/src/schema/state/sqlite/query-builder/impl.ts +19 -15
- package/src/schema/state/sqlite/schema-helpers.ts +1 -1
- package/src/schema/state/sqlite/system-tables/eventlog-tables.ts +2 -2
- package/src/schema/state/sqlite/system-tables/state-tables.ts +41 -1
- package/src/schema/state/sqlite/table-def.test.ts +204 -66
- package/src/schema/state/sqlite/table-def.ts +96 -45
- package/src/schema/unknown-events.ts +3 -2
- package/src/schema-management/__tests__/migrations-autoincrement-quoting.test.ts +2 -2
- package/src/session-id-symbol.ts +59 -0
- package/src/sql-queries/sql-queries.ts +8 -12
- package/src/sql-queries/types.ts +6 -7
- package/src/sqlite-db-helper.ts +64 -2
- package/src/sqlite-types.ts +5 -8
- package/src/sync/ClientSessionSyncProcessor.ts +303 -119
- package/src/sync/errors.ts +14 -12
- package/src/sync/mock-sync-backend.test.ts +78 -0
- package/src/sync/mock-sync-backend.ts +93 -47
- package/src/sync/next/history-dag-common.ts +60 -34
- package/src/sync/next/history-dag.ts +4 -1
- package/src/sync/next/test/compact-events.calculator.test.ts +2 -2
- package/src/sync/next/test/event-fixtures.ts +1 -1
- package/src/sync/next/test/history-dag-common.test.ts +87 -0
- package/src/sync/sync-backend-kv.ts +4 -2
- package/src/sync/sync-backend.ts +15 -15
- package/src/sync/sync.ts +1 -1
- package/src/sync/syncstate.test.ts +191 -140
- package/src/sync/syncstate.ts +63 -53
- package/src/sync/transport-chunking.ts +34 -39
- package/src/util.ts +18 -9
- package/src/version.ts +1 -2
- package/dist/sql-queries/misc.d.ts +0 -2
- package/dist/sql-queries/misc.d.ts.map +0 -1
- package/dist/sql-queries/misc.js +0 -2
- package/dist/sql-queries/misc.js.map +0 -1
- package/src/sql-queries/misc.ts +0 -2
package/dist/util.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { Schema } from '@livestore/utils/effect';
|
|
1
|
+
import { type Brand, Schema } from '@livestore/utils/effect';
|
|
3
2
|
export type ParamsObject = Record<string, SqlValue>;
|
|
4
3
|
export type SqlValue = string | number | Uint8Array<ArrayBuffer> | null;
|
|
5
4
|
export type Bindable = ReadonlyArray<SqlValue> | ParamsObject;
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Numeric schema for the SQLite `REAL` domain. Unlike `Schema.Finite` it accepts
|
|
7
|
+
* `Infinity`/`NaN`, because SQLite `REAL` columns can legitimately store them and
|
|
8
|
+
* bind values / DEFAULT codecs must round-trip those through the devtools/debug
|
|
9
|
+
* protocol. This is the single carve-out for the SQLite REAL numeric domain — use it
|
|
10
|
+
* instead of a bare `Schema.Number` so the `schemaNumber` exception lives in one place.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SqliteReal: Schema.Number;
|
|
13
|
+
export declare const SqlValueSchema: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Codec<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>, never, never>, Schema.Null]>;
|
|
14
|
+
export declare const PreparedBindValues: Schema.brand<Schema.Union<readonly [Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number, Schema.Codec<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>, never, never>, Schema.Null]>>, Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Codec<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>, never, never>, Schema.Null]>>]>, "PreparedBindValues">;
|
|
8
15
|
export type PreparedBindValues = Brand.Branded<Bindable, 'PreparedBindValues'>;
|
|
9
16
|
/**
|
|
10
17
|
* This is a tag function for tagged literals.
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AACnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAA;AAEvE,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAA;AAE7D;;;;;;GAMG;AAEH,eAAO,MAAM,UAAU,eAAgB,CAAA;AAEvC,eAAO,MAAM,cAAc,kJAKzB,CAAA;AAEF,eAAO,MAAM,kBAAkB,+YAGY,CAAA;AAE3C,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAA;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,GAAG,GAAI,UAAU,oBAAoB,EAAE,GAAG,MAAM,OAAO,EAAE,KAAG,MAQxE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,QAAQ,EAAE,WAAW,MAAM,KAAG,kBAWvE,CAAA"}
|
package/dist/util.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
/// <reference lib="es2022" />
|
|
2
2
|
import { Schema } from '@livestore/utils/effect';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Numeric schema for the SQLite `REAL` domain. Unlike `Schema.Finite` it accepts
|
|
5
|
+
* `Infinity`/`NaN`, because SQLite `REAL` columns can legitimately store them and
|
|
6
|
+
* bind values / DEFAULT codecs must round-trip those through the devtools/debug
|
|
7
|
+
* protocol. This is the single carve-out for the SQLite REAL numeric domain — use it
|
|
8
|
+
* instead of a bare `Schema.Number` so the `schemaNumber` exception lives in one place.
|
|
9
|
+
*/
|
|
10
|
+
// @effect-diagnostics-next-line schemaNumber:off -- see SqliteReal docstring: SQLite REAL permits Infinity/NaN, so Schema.Finite would wrongly reject valid values
|
|
11
|
+
export const SqliteReal = Schema.Number;
|
|
12
|
+
export const SqlValueSchema = Schema.Union([
|
|
13
|
+
Schema.String,
|
|
14
|
+
SqliteReal,
|
|
15
|
+
Schema.Uint8Array,
|
|
16
|
+
Schema.Null,
|
|
17
|
+
]);
|
|
18
|
+
export const PreparedBindValues = Schema.Union([
|
|
19
|
+
Schema.Array(SqlValueSchema),
|
|
20
|
+
Schema.Record(Schema.String, SqlValueSchema),
|
|
21
|
+
]).pipe(Schema.brand('PreparedBindValues'));
|
|
5
22
|
/**
|
|
6
23
|
* This is a tag function for tagged literals.
|
|
7
24
|
* it lets us get syntax highlighting on SQL queries in VSCode, but
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,8BAA8B;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,OAAO,EAAc,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAO5D;;;;;;GAMG;AACH,mKAAmK;AACnK,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;IACzC,MAAM,CAAC,MAAM;IACb,UAAU;IACV,MAAM,CAAC,UAA0D;IACjE,MAAM,CAAC,IAAI;CACZ,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,KAAK,CAAC;IAC7C,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;IAC5B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;CAC7C,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAA;AAI3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,QAA8B,EAAE,GAAG,IAAe,EAAU,EAAE;IAChF,IAAI,GAAG,GAAG,EAAE,CAAA;IAEZ,KAAK,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACtC,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAgB,EAAE,SAAiB,EAAsB,EAAE;IAC3F,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI;QAAE,OAAO,MAAmC,CAAA;IAE9E,MAAM,MAAM,GAAiB,EAAE,CAAA;IAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAA;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,MAA4B,CAAA;AACrC,CAAC,CAAA"}
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAA0E,CAAA;AAEzG,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAA0E,CAAA;AAEzG,eAAO,MAAM,uBAAuB,EAAE,MAAkF,CAAA;AAExH,eAAO,MAAM,iCAAiC,EAAE,aAAa,CAAC,MAAM,CAA6B,CAAA;AAEjG,eAAO,MAAM,8BAA8B,GAAI,SAAS,MAAM,GAAG,SAAS,KAAG,MAAsB,CAAA;AAEnG,eAAO,MAAM,kCAAkC,GAC7C,SAAS,MAAM,GAAG,SAAS,EAC3B,oBAAmB,aAAa,CAAC,MAAM,CAAqC,KAC3E,OAA8E,CAAA;AAEjF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,6BAA6B,IAAI,CAAA"}
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAY,UAAkB,CAAC,8BAA8B,IAAI,GAAG,CAAC,OAAO,CAAA;AAEzG,MAAM,CAAC,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAY,UAAkB,CAAC,8BAA8B,IAAI,GAAG,CAAC,OAAO,CAAA;AAEzG,MAAM,CAAC,MAAM,uBAAuB,GAAY,UAAkB,CAAC,gDAAgD,IAAI,CAAC,CAAA;AAExH,MAAM,CAAC,MAAM,iCAAiC,GAA0B,CAAC,uBAAuB,CAAC,CAAA;AAEjG,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,OAA2B,EAAU,EAAE,CAAC,OAAO,IAAI,CAAC,CAAA;AAEnG,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAChD,OAA2B,EAC3B,oBAA2C,iCAAiC,EACnE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,CAAA;AAEjF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-dev.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,52 +28,34 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@opentelemetry/api": "1.9.0",
|
|
31
|
-
"@livestore/utils": "^0.
|
|
32
|
-
"@livestore/webmesh": "^0.
|
|
31
|
+
"@livestore/utils": "^0.5.0-dev.0",
|
|
32
|
+
"@livestore/webmesh": "^0.5.0-dev.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@effect/
|
|
36
|
-
"@effect/
|
|
37
|
-
"@effect/
|
|
38
|
-
"@effect/
|
|
39
|
-
"@effect/
|
|
40
|
-
"@effect/
|
|
41
|
-
"@effect/platform-browser": "0.76.0",
|
|
42
|
-
"@effect/platform-bun": "0.89.0",
|
|
43
|
-
"@effect/platform-node": "0.106.0",
|
|
44
|
-
"@effect/printer": "0.49.0",
|
|
45
|
-
"@effect/printer-ansi": "0.49.0",
|
|
46
|
-
"@effect/rpc": "0.75.1",
|
|
47
|
-
"@effect/sql": "0.51.1",
|
|
48
|
-
"@effect/typeclass": "0.40.0",
|
|
49
|
-
"@effect/vitest": "0.29.0",
|
|
35
|
+
"@effect/opentelemetry": "4.0.0-rc.111",
|
|
36
|
+
"@effect/platform-browser": "4.0.0-rc.111",
|
|
37
|
+
"@effect/platform-bun": "4.0.0-rc.111",
|
|
38
|
+
"@effect/platform-node": "4.0.0-rc.111",
|
|
39
|
+
"@effect/platform-node-shared": "4.0.0-rc.111",
|
|
40
|
+
"@effect/vitest": "4.0.0-rc.111",
|
|
50
41
|
"@opentelemetry/api": "1.9.0",
|
|
51
42
|
"@opentelemetry/resources": "2.2.0",
|
|
52
43
|
"@standard-schema/spec": "1.1.0",
|
|
53
|
-
"effect": "
|
|
54
|
-
"vitest": "
|
|
55
|
-
"@livestore/utils-dev": "^0.
|
|
44
|
+
"effect": "4.0.0-rc.111",
|
|
45
|
+
"vitest": "4.1.9",
|
|
46
|
+
"@livestore/utils-dev": "^0.5.0-dev.0"
|
|
56
47
|
},
|
|
57
48
|
"peerDependencies": {
|
|
58
|
-
"@effect/
|
|
59
|
-
"@effect/
|
|
60
|
-
"@effect/
|
|
61
|
-
"@effect/
|
|
62
|
-
"@effect/
|
|
63
|
-
"@effect/
|
|
64
|
-
"@effect/platform-browser": "^0.76.0",
|
|
65
|
-
"@effect/platform-bun": "^0.89.0",
|
|
66
|
-
"@effect/platform-node": "^0.106.0",
|
|
67
|
-
"@effect/printer": "^0.49.0",
|
|
68
|
-
"@effect/printer-ansi": "^0.49.0",
|
|
69
|
-
"@effect/rpc": "^0.75.1",
|
|
70
|
-
"@effect/sql": "^0.51.1",
|
|
71
|
-
"@effect/typeclass": "^0.40.0",
|
|
72
|
-
"@effect/vitest": "^0.29.0",
|
|
49
|
+
"@effect/opentelemetry": "^4.0.0-rc.111",
|
|
50
|
+
"@effect/platform-browser": "^4.0.0-rc.111",
|
|
51
|
+
"@effect/platform-bun": "^4.0.0-rc.111",
|
|
52
|
+
"@effect/platform-node": "^4.0.0-rc.111",
|
|
53
|
+
"@effect/platform-node-shared": "^4.0.0-rc.111",
|
|
54
|
+
"@effect/vitest": "^4.0.0-rc.111",
|
|
73
55
|
"@opentelemetry/api": "^1.9.0",
|
|
74
56
|
"@opentelemetry/resources": "^2.2.0",
|
|
75
57
|
"@standard-schema/spec": "^1.1.0",
|
|
76
|
-
"effect": "^
|
|
58
|
+
"effect": "^4.0.0-rc.111"
|
|
77
59
|
},
|
|
78
60
|
"$genie": {
|
|
79
61
|
"source": "package.json.genie.ts",
|
|
@@ -3,10 +3,10 @@ import type { Effect, Stream, Subscribable } from '@livestore/utils/effect'
|
|
|
3
3
|
import type { StorageMode } from './adapter-types.ts'
|
|
4
4
|
import type { MigrationsReport } from './defs.ts'
|
|
5
5
|
import type * as Devtools from './devtools/mod.ts'
|
|
6
|
+
import type { RejectedPushError } from './leader-thread/RejectedPushError.ts'
|
|
6
7
|
import type { StreamEventsOptions } from './leader-thread/types.ts'
|
|
7
8
|
import type * as EventSequenceNumber from './schema/EventSequenceNumber/mod.ts'
|
|
8
9
|
import type { LiveStoreEvent } from './schema/mod.ts'
|
|
9
|
-
import type { RejectedPushError } from './leader-thread/RejectedPushError.ts'
|
|
10
10
|
import type { SyncBackend } from './sync/sync.ts'
|
|
11
11
|
import type { PayloadUpstream, SyncState } from './sync/syncstate.ts'
|
|
12
12
|
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Predicate, ReadonlyArray, Schema } from '@livestore/utils/effect'
|
|
2
|
+
|
|
3
|
+
import { SqliteError, type SqliteDb } from './adapter-types.ts'
|
|
4
|
+
import { execSql, execSqlPrepared } from './leader-thread/connection.ts'
|
|
5
|
+
import * as EventSequenceNumber from './schema/EventSequenceNumber/mod.ts'
|
|
6
|
+
import { SystemTables } from './schema/mod.ts'
|
|
7
|
+
import { findManyRows, insertRow } from './sql-queries/index.ts'
|
|
8
|
+
import * as SqliteDbHelper from './sqlite-db-helper.ts'
|
|
9
|
+
import { prepareBindValues, sql } from './util.ts'
|
|
10
|
+
|
|
11
|
+
export const TypeId = '~@livestore/common/MaterializationJournal' as const
|
|
12
|
+
export type TypeId = typeof TypeId
|
|
13
|
+
|
|
14
|
+
export const MaterializationJournalErrorTypeId = '~@livestore/common/MaterializationJournalError' as const
|
|
15
|
+
|
|
16
|
+
export const isMaterializationJournalError = (u: unknown): u is MaterializationJournalError =>
|
|
17
|
+
Predicate.hasProperty(u, MaterializationJournalErrorTypeId)
|
|
18
|
+
|
|
19
|
+
export class MaterializationJournalError extends Schema.TaggedError<MaterializationJournalError>(
|
|
20
|
+
MaterializationJournalErrorTypeId,
|
|
21
|
+
)('MaterializationJournalError', {
|
|
22
|
+
method: Schema.Literals(['record', 'rollback', 'discardUpTo']),
|
|
23
|
+
cause: Schema.Defect(),
|
|
24
|
+
}) {
|
|
25
|
+
readonly [MaterializationJournalErrorTypeId] = MaterializationJournalErrorTypeId
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type MaterializationChangeset = { _tag: 'changeset'; data: Uint8Array<ArrayBuffer> } | { _tag: 'no-op' }
|
|
29
|
+
|
|
30
|
+
export type MaterializationRecord = {
|
|
31
|
+
key: EventSequenceNumber.Client.Composite
|
|
32
|
+
changeset: MaterializationChangeset
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Service {
|
|
36
|
+
readonly [TypeId]: TypeId
|
|
37
|
+
/** Stores a materialization record, replacing any record at the same key. */
|
|
38
|
+
record: (record: MaterializationRecord) => Effect.Effect<void, MaterializationJournalError>
|
|
39
|
+
/** Reverts the keyed materializations in reverse order, then discards their records. */
|
|
40
|
+
rollback: (
|
|
41
|
+
keys: ReadonlyArray<EventSequenceNumber.Client.Composite>,
|
|
42
|
+
) => Effect.Effect<void, MaterializationJournalError>
|
|
43
|
+
/** Discards records whose key is less than or equal to `key`, ignoring rebase generation. */
|
|
44
|
+
discardUpTo: (key: EventSequenceNumber.Client.Composite) => Effect.Effect<void, MaterializationJournalError>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class MaterializationJournal extends Context.Service<MaterializationJournal, Service>()(
|
|
48
|
+
'@livestore/common/MaterializationJournal',
|
|
49
|
+
) {}
|
|
50
|
+
|
|
51
|
+
interface Options {
|
|
52
|
+
readonly dbState: SqliteDb
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const make = ({ dbState }: Options) => {
|
|
56
|
+
const deleteByKeys = Effect.fnUntraced(function* (keys: ReadonlyArray<EventSequenceNumber.Client.Composite>) {
|
|
57
|
+
// Keep DELETE statements below SQLite's bound-parameter limit.
|
|
58
|
+
const keyChunks = ReadonlyArray.chunksOf(100)(keys)
|
|
59
|
+
|
|
60
|
+
for (const keyChunk of keyChunks) {
|
|
61
|
+
const placeholders = keyChunk.map(() => '(?, ?, ?)').join(', ')
|
|
62
|
+
const bindValues = keyChunk.flatMap((key) => [key.global, key.client, key.rebaseGeneration])
|
|
63
|
+
const statement = sql`DELETE FROM ${SystemTables.MATERIALIZATION_JOURNAL_META_TABLE}
|
|
64
|
+
WHERE (seqNumGlobal, seqNumClient, seqNumRebaseGeneration) IN (${placeholders})`
|
|
65
|
+
|
|
66
|
+
yield* execSqlPrepared(dbState, statement, prepareBindValues(bindValues, statement))
|
|
67
|
+
}
|
|
68
|
+
}, SqliteDbHelper.withSavepoint(dbState))
|
|
69
|
+
|
|
70
|
+
return MaterializationJournal.of({
|
|
71
|
+
[TypeId]: TypeId,
|
|
72
|
+
record: Effect.fnUntraced(
|
|
73
|
+
function* (record: MaterializationRecord) {
|
|
74
|
+
yield* deleteByKeys([record.key])
|
|
75
|
+
|
|
76
|
+
// Generate the parameterized INSERT statement
|
|
77
|
+
const [statement, bindValues] = insertRow({
|
|
78
|
+
tableName: SystemTables.MATERIALIZATION_JOURNAL_META_TABLE,
|
|
79
|
+
columns: SystemTables.materializationJournalMetaTable.sqliteDef.columns,
|
|
80
|
+
values: {
|
|
81
|
+
seqNumGlobal: record.key.global,
|
|
82
|
+
seqNumClient: record.key.client,
|
|
83
|
+
seqNumRebaseGeneration: record.key.rebaseGeneration,
|
|
84
|
+
changeset: record.changeset._tag === 'changeset' ? record.changeset.data : null,
|
|
85
|
+
// Legacy processors still expose this column for development diagnostics.
|
|
86
|
+
debug: null,
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
yield* execSqlPrepared(dbState, statement, prepareBindValues(bindValues, statement))
|
|
91
|
+
},
|
|
92
|
+
SqliteDbHelper.withSavepoint(dbState),
|
|
93
|
+
Effect.mapError((cause) => new MaterializationJournalError({ method: 'record', cause })),
|
|
94
|
+
),
|
|
95
|
+
rollback: Effect.fnUntraced(
|
|
96
|
+
function* (keys: ReadonlyArray<EventSequenceNumber.Client.Composite>) {
|
|
97
|
+
const sortedKeys = keys.toSorted((a, b) => EventSequenceNumber.Client.compare(b, a))
|
|
98
|
+
const rollbackRecords = yield* Effect.forEach(
|
|
99
|
+
sortedKeys,
|
|
100
|
+
Effect.fnUntraced(function* (key) {
|
|
101
|
+
const [statement, bindValues] = findManyRows({
|
|
102
|
+
tableName: SystemTables.MATERIALIZATION_JOURNAL_META_TABLE,
|
|
103
|
+
columns: SystemTables.materializationJournalMetaTable.sqliteDef.columns,
|
|
104
|
+
where: {
|
|
105
|
+
seqNumGlobal: key.global,
|
|
106
|
+
seqNumClient: key.client,
|
|
107
|
+
seqNumRebaseGeneration: key.rebaseGeneration,
|
|
108
|
+
},
|
|
109
|
+
limit: 1,
|
|
110
|
+
})
|
|
111
|
+
const preparedBindValues = prepareBindValues(bindValues, statement)
|
|
112
|
+
const row = yield* Effect.try({
|
|
113
|
+
try: () => dbState.select<SystemTables.MaterializationJournalMetaRow>(statement, preparedBindValues)[0],
|
|
114
|
+
catch: (cause) => new SqliteError({ cause, query: { sql: statement, bindValues: preparedBindValues } }),
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
if (row === undefined) {
|
|
118
|
+
return yield* new MaterializationJournalError({
|
|
119
|
+
method: 'rollback',
|
|
120
|
+
cause: new Error(
|
|
121
|
+
`Missing materialization journal record for ${EventSequenceNumber.Client.toString(key)}`,
|
|
122
|
+
),
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
key,
|
|
128
|
+
changeset:
|
|
129
|
+
row.changeset === null
|
|
130
|
+
? { _tag: 'no-op' as const }
|
|
131
|
+
: { _tag: 'changeset' as const, data: row.changeset },
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
for (const record of rollbackRecords) {
|
|
137
|
+
if (record.changeset._tag === 'changeset') {
|
|
138
|
+
const data = record.changeset.data
|
|
139
|
+
yield* Effect.try({
|
|
140
|
+
try: () => dbState.makeChangeset(data).invert().apply(),
|
|
141
|
+
catch: (cause) => new SqliteError({ cause }),
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
yield* deleteByKeys(sortedKeys)
|
|
147
|
+
},
|
|
148
|
+
SqliteDbHelper.withSavepoint(dbState),
|
|
149
|
+
Effect.mapError((cause) =>
|
|
150
|
+
isMaterializationJournalError(cause) === true
|
|
151
|
+
? cause
|
|
152
|
+
: new MaterializationJournalError({ method: 'rollback', cause }),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
discardUpTo: Effect.fnUntraced(
|
|
156
|
+
function* (key: EventSequenceNumber.Client.Composite) {
|
|
157
|
+
yield* execSql(
|
|
158
|
+
dbState,
|
|
159
|
+
sql`DELETE FROM ${SystemTables.MATERIALIZATION_JOURNAL_META_TABLE}
|
|
160
|
+
WHERE seqNumGlobal < ${key.global}
|
|
161
|
+
OR (
|
|
162
|
+
seqNumGlobal = ${key.global}
|
|
163
|
+
AND seqNumClient <= ${key.client}
|
|
164
|
+
)`,
|
|
165
|
+
{},
|
|
166
|
+
)
|
|
167
|
+
},
|
|
168
|
+
SqliteDbHelper.withSavepoint(dbState),
|
|
169
|
+
Effect.mapError((cause) => new MaterializationJournalError({ method: 'discardUpTo', cause })),
|
|
170
|
+
),
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const layer = (options: Options) => Layer.succeed(MaterializationJournal, make(options))
|
|
175
|
+
|
|
176
|
+
export const layerTest = Layer.succeed(
|
|
177
|
+
MaterializationJournal,
|
|
178
|
+
MaterializationJournal.of({
|
|
179
|
+
[TypeId]: TypeId,
|
|
180
|
+
record: () => Effect.void,
|
|
181
|
+
rollback: () => Effect.void,
|
|
182
|
+
discardUpTo: () => Effect.void,
|
|
183
|
+
}),
|
|
184
|
+
)
|
package/src/StateHead.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from '@livestore/utils/effect'
|
|
2
|
+
|
|
3
|
+
import type { SqliteDb, SqliteError } from './adapter-types.ts'
|
|
4
|
+
import { execSql, selectSql } from './leader-thread/connection.ts'
|
|
5
|
+
import * as EventSequenceNumber from './schema/EventSequenceNumber/mod.ts'
|
|
6
|
+
import { SystemTables } from './schema/mod.ts'
|
|
7
|
+
import { findManyRows, insertRow } from './sql-queries/index.ts'
|
|
8
|
+
|
|
9
|
+
export const TypeId = '~@livestore/common/StateHead' as const
|
|
10
|
+
export type TypeId = typeof TypeId
|
|
11
|
+
|
|
12
|
+
const STATE_HEAD_ROW_ID = 1
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Persists and reads the latest event sequence number reflected by the state database.
|
|
16
|
+
*/
|
|
17
|
+
export interface Service {
|
|
18
|
+
readonly [TypeId]: TypeId
|
|
19
|
+
/** Persists the latest event sequence number reflected by the state database. */
|
|
20
|
+
set: (head: EventSequenceNumber.Client.Composite) => Effect.Effect<void, SqliteError>
|
|
21
|
+
/** Returns the persisted head, or the root when the current-schema table has no row. */
|
|
22
|
+
get: Effect.Effect<EventSequenceNumber.Client.Composite, SqliteError>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class StateHead extends Context.Service<StateHead, Service>()('@livestore/common/StateHead') {}
|
|
26
|
+
|
|
27
|
+
interface Options {
|
|
28
|
+
readonly dbState: SqliteDb
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const make = ({ dbState }: Options) => {
|
|
32
|
+
return StateHead.of({
|
|
33
|
+
[TypeId]: TypeId,
|
|
34
|
+
set: (head) => {
|
|
35
|
+
const [statement, bindValues] = insertRow({
|
|
36
|
+
tableName: SystemTables.STATE_HEAD_META_TABLE,
|
|
37
|
+
columns: SystemTables.stateHeadMetaTable.sqliteDef.columns,
|
|
38
|
+
values: {
|
|
39
|
+
id: STATE_HEAD_ROW_ID,
|
|
40
|
+
seqNumGlobal: head.global,
|
|
41
|
+
seqNumClient: head.client,
|
|
42
|
+
seqNumRebaseGeneration: head.rebaseGeneration,
|
|
43
|
+
},
|
|
44
|
+
options: { orReplace: true },
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return execSql(dbState, statement, bindValues)
|
|
48
|
+
},
|
|
49
|
+
get: Effect.suspend(() => {
|
|
50
|
+
const [statement, bindValues] = findManyRows({
|
|
51
|
+
tableName: SystemTables.STATE_HEAD_META_TABLE,
|
|
52
|
+
columns: SystemTables.stateHeadMetaTable.sqliteDef.columns,
|
|
53
|
+
where: { id: STATE_HEAD_ROW_ID },
|
|
54
|
+
limit: 1,
|
|
55
|
+
})
|
|
56
|
+
return selectSql<SystemTables.StateHeadMetaRow>(dbState, statement, bindValues).pipe(
|
|
57
|
+
Effect.map(([row]) =>
|
|
58
|
+
row === undefined
|
|
59
|
+
? EventSequenceNumber.Client.ROOT
|
|
60
|
+
: EventSequenceNumber.Client.Composite.make({
|
|
61
|
+
global: row.seqNumGlobal,
|
|
62
|
+
client: row.seqNumClient,
|
|
63
|
+
rebaseGeneration: row.seqNumRebaseGeneration,
|
|
64
|
+
}),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
}),
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const layer = (options: Options) => Layer.succeed(StateHead, make(options))
|
|
72
|
+
|
|
73
|
+
export const layerTest = Layer.succeed(
|
|
74
|
+
StateHead,
|
|
75
|
+
StateHead.of({
|
|
76
|
+
[TypeId]: TypeId,
|
|
77
|
+
set: () => Effect.void,
|
|
78
|
+
get: Effect.succeed(EventSequenceNumber.Client.ROOT),
|
|
79
|
+
}),
|
|
80
|
+
)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema, WorkerError } from '@livestore/utils/effect'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Type guard that identifies infrastructure errors from the Effect Worker transport layer.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
*
|
|
8
|
-
* These errors ({@link WorkerError.WorkerError}, {@link
|
|
8
|
+
* These errors ({@link WorkerError.WorkerError}, {@link Schema.SchemaError}) represent communication failures between
|
|
9
9
|
* threads/processes — not application-level failures.
|
|
10
10
|
*/
|
|
11
|
-
export const isWorkerTransportError = (e: unknown): e is WorkerError.WorkerError |
|
|
12
|
-
|
|
11
|
+
export const isWorkerTransportError = (e: unknown): e is WorkerError.WorkerError | Schema.SchemaError =>
|
|
12
|
+
Schema.isSchemaError(e) || WorkerError.isWorkerError(e)
|
package/src/__tests__/fixture.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from '@livestore/utils/effect'
|
|
2
2
|
|
|
3
|
-
import { SessionIdSymbol } from '../adapter-types.ts'
|
|
4
3
|
import { makeSchema, State } from '../schema/mod.ts'
|
|
4
|
+
import { SessionIdSymbol } from '../session-id-symbol.ts'
|
|
5
5
|
|
|
6
6
|
export const UiState = State.SQLite.clientDocument({
|
|
7
7
|
name: 'UiState',
|
|
@@ -14,8 +14,8 @@ export const UiState = State.SQLite.clientDocument({
|
|
|
14
14
|
})
|
|
15
15
|
|
|
16
16
|
const Config = Schema.Struct({
|
|
17
|
-
fontSize: Schema.
|
|
18
|
-
theme: Schema.
|
|
17
|
+
fontSize: Schema.Finite,
|
|
18
|
+
theme: Schema.Literals(['light', 'dark']),
|
|
19
19
|
})
|
|
20
20
|
|
|
21
21
|
export const appConfig = State.SQLite.clientDocument({
|
package/src/adapter-types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
type Effect,
|
|
3
3
|
type Exit,
|
|
4
4
|
type Queue,
|
|
5
|
+
type Latch,
|
|
5
6
|
Schema,
|
|
6
7
|
type Scope,
|
|
7
8
|
type SubscriptionRef,
|
|
@@ -28,16 +29,13 @@ export * from './sqlite-types.ts'
|
|
|
28
29
|
export interface ClientSession {
|
|
29
30
|
/** SQLite database with synchronous API running in the same thread (usually in-memory) */
|
|
30
31
|
sqliteDb: SqliteDb
|
|
31
|
-
devtools: { enabled: false } | { enabled: true; pullLatch:
|
|
32
|
+
devtools: { enabled: false } | { enabled: true; pullLatch: Latch.Latch; pushLatch: Latch.Latch }
|
|
32
33
|
clientId: string
|
|
33
34
|
sessionId: string
|
|
34
35
|
/** Status info whether current session is leader or not */
|
|
35
36
|
lockStatus: SubscriptionRef.SubscriptionRef<LockStatus>
|
|
36
37
|
shutdown: (
|
|
37
|
-
cause: Exit.Exit<
|
|
38
|
-
IntentionalShutdownCause,
|
|
39
|
-
UnknownError | MaterializeError | BackendIdMismatchError
|
|
40
|
-
>,
|
|
38
|
+
cause: Exit.Exit<IntentionalShutdownCause, UnknownError | MaterializeError | BackendIdMismatchError>,
|
|
41
39
|
) => Effect.Effect<void>
|
|
42
40
|
/** A proxy API to communicate with the leader thread */
|
|
43
41
|
leaderThread: ClientSessionLeaderThreadProxy
|
|
@@ -48,8 +46,8 @@ export interface ClientSession {
|
|
|
48
46
|
export type ResetMode = 'all-data' | 'only-app-db'
|
|
49
47
|
|
|
50
48
|
export const BootStateProgress = Schema.Struct({
|
|
51
|
-
done: Schema.
|
|
52
|
-
total: Schema.
|
|
49
|
+
done: Schema.Finite,
|
|
50
|
+
total: Schema.Finite,
|
|
53
51
|
})
|
|
54
52
|
|
|
55
53
|
/**
|
|
@@ -60,7 +58,7 @@ export const BootStateProgress = Schema.Struct({
|
|
|
60
58
|
* - `storage-unavailable`: OPFS access denied for other reasons (permissions, quota)
|
|
61
59
|
* - `unknown`: Unexpected error during storage initialization
|
|
62
60
|
*/
|
|
63
|
-
export const BootWarningReason = Schema.
|
|
61
|
+
export const BootWarningReason = Schema.Literals(['private-browsing', 'storage-unavailable', 'unknown'])
|
|
64
62
|
export type BootWarningReason = typeof BootWarningReason.Type
|
|
65
63
|
|
|
66
64
|
/**
|
|
@@ -70,10 +68,10 @@ export type BootWarningReason = typeof BootWarningReason.Type
|
|
|
70
68
|
* - `persisted`: Data is persisted to disk (e.g., via OPFS)
|
|
71
69
|
* - `in-memory`: Data is only stored in memory and will be lost on page refresh
|
|
72
70
|
*/
|
|
73
|
-
export const StorageMode = Schema.
|
|
71
|
+
export const StorageMode = Schema.Literals(['persisted', 'in-memory'])
|
|
74
72
|
export type StorageMode = typeof StorageMode.Type
|
|
75
73
|
|
|
76
|
-
export const BootStatus = Schema.Union(
|
|
74
|
+
export const BootStatus = Schema.Union([
|
|
77
75
|
Schema.Struct({ stage: Schema.Literal('loading') }),
|
|
78
76
|
Schema.Struct({ stage: Schema.Literal('migrating'), progress: BootStateProgress }),
|
|
79
77
|
Schema.Struct({ stage: Schema.Literal('rehydrating'), progress: BootStateProgress }),
|
|
@@ -88,67 +86,35 @@ export const BootStatus = Schema.Union(
|
|
|
88
86
|
reason: BootWarningReason,
|
|
89
87
|
message: Schema.String,
|
|
90
88
|
}),
|
|
91
|
-
).
|
|
89
|
+
]).annotate({ title: 'BootStatus' })
|
|
92
90
|
|
|
93
91
|
export type BootStatus = typeof BootStatus.Type
|
|
94
92
|
|
|
95
|
-
/**
|
|
96
|
-
* Can be used in queries to refer to the current session id.
|
|
97
|
-
* Will be replaced with the actual session id at runtime
|
|
98
|
-
*
|
|
99
|
-
* In client document table:
|
|
100
|
-
* ```ts
|
|
101
|
-
* const uiState = State.SQLite.clientDocument({
|
|
102
|
-
* name: 'ui_state',
|
|
103
|
-
* schema: Schema.Struct({
|
|
104
|
-
* theme: Schema.Literal('dark', 'light', 'system'),
|
|
105
|
-
* user: Schema.String,
|
|
106
|
-
* showToolbar: Schema.Boolean,
|
|
107
|
-
* }),
|
|
108
|
-
* default: { value: defaultFrontendState, id: SessionIdSymbol },
|
|
109
|
-
* })
|
|
110
|
-
* ```
|
|
111
|
-
*
|
|
112
|
-
* Or in a client document query:
|
|
113
|
-
* ```ts
|
|
114
|
-
* const query$ = queryDb(tables.uiState.get(SessionIdSymbol))
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
export const SessionIdSymbol = Symbol.for('@livestore/session-id')
|
|
118
|
-
export type SessionIdSymbol = typeof SessionIdSymbol
|
|
119
|
-
|
|
120
93
|
export type LockStatus = 'has-lock' | 'no-lock'
|
|
121
94
|
|
|
122
|
-
// TODO possibly allow a combination of these options
|
|
123
95
|
// TODO allow a way to stream the migration progress back to the app
|
|
124
|
-
export type MigrationOptions =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
| {
|
|
133
|
-
strategy: 'manual'
|
|
134
|
-
migrate: (
|
|
135
|
-
oldDb: Uint8Array<ArrayBuffer>,
|
|
136
|
-
) => Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>> | Effect.Effect<Uint8Array<ArrayBuffer>, unknown>
|
|
137
|
-
}
|
|
96
|
+
export type MigrationOptions = {
|
|
97
|
+
hooks?: Partial<MigrationHooks>
|
|
98
|
+
logging?: {
|
|
99
|
+
excludeAffectedRows?: (sqlStmt: string) => boolean
|
|
100
|
+
}
|
|
101
|
+
}
|
|
138
102
|
|
|
139
103
|
export type MigrationHooks = {
|
|
140
104
|
/** Runs on the empty in-memory database with no database schemas applied yet */
|
|
141
105
|
init: MigrationHook
|
|
142
|
-
/** Runs
|
|
106
|
+
/** Runs after table schemas and singleton rows are created, but before rematerializing state from the eventlog */
|
|
143
107
|
pre: MigrationHook
|
|
144
|
-
/** Runs after
|
|
108
|
+
/** Runs after rematerializing state from the eventlog */
|
|
145
109
|
post: MigrationHook
|
|
146
110
|
}
|
|
147
111
|
|
|
148
112
|
export type MigrationHook = (db: SqliteDb) => void | Promise<void> | Effect.Effect<void, unknown>
|
|
149
113
|
|
|
150
|
-
export interface ClientSessionDevtoolsChannel
|
|
151
|
-
|
|
114
|
+
export interface ClientSessionDevtoolsChannel extends WebChannel.WebChannel<
|
|
115
|
+
Devtools.ClientSession.MessageToApp,
|
|
116
|
+
Devtools.ClientSession.MessageFromApp
|
|
117
|
+
> {}
|
|
152
118
|
|
|
153
119
|
export type ConnectDevtoolsToStore = (
|
|
154
120
|
storeDevtoolsChannel: ClientSessionDevtoolsChannel,
|
|
@@ -163,10 +129,7 @@ export interface AdapterArgs {
|
|
|
163
129
|
debugInstanceId: string
|
|
164
130
|
bootStatusQueue: Queue.Queue<BootStatus>
|
|
165
131
|
shutdown: (
|
|
166
|
-
exit: Exit.Exit<
|
|
167
|
-
IntentionalShutdownCause,
|
|
168
|
-
UnknownError | MaterializeError | BackendIdMismatchError
|
|
169
|
-
>,
|
|
132
|
+
exit: Exit.Exit<IntentionalShutdownCause, UnknownError | MaterializeError | BackendIdMismatchError>,
|
|
170
133
|
) => Effect.Effect<void>
|
|
171
134
|
connectDevtoolsToStore: ConnectDevtoolsToStore
|
|
172
135
|
/**
|
|
@@ -174,7 +137,7 @@ export interface AdapterArgs {
|
|
|
174
137
|
*
|
|
175
138
|
* @default undefined
|
|
176
139
|
*/
|
|
177
|
-
syncPayloadSchema: Schema.Schema
|
|
140
|
+
syncPayloadSchema: Schema.Decoder<Schema.Json> | undefined
|
|
178
141
|
/** Encoded representation of the sync payload matching `syncPayloadSchema`. */
|
|
179
|
-
syncPayloadEncoded: Schema.
|
|
142
|
+
syncPayloadEncoded: Schema.Json | undefined
|
|
180
143
|
}
|