@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
|
@@ -12,19 +12,19 @@ import { SqliteDsl } from './db-schema/mod.ts'
|
|
|
12
12
|
* Fields with both null and undefined will emit a warning as this is a lossy conversion.
|
|
13
13
|
*/
|
|
14
14
|
export const getColumnDefForSchema = (
|
|
15
|
-
schema: Schema.
|
|
15
|
+
schema: Schema.Top,
|
|
16
16
|
propertySignature?: SchemaAST.PropertySignature,
|
|
17
17
|
forceNullable = false,
|
|
18
18
|
): SqliteDsl.ColumnDefinition.Any => {
|
|
19
19
|
const ast = schema.ast
|
|
20
20
|
|
|
21
21
|
// Extract annotations
|
|
22
|
-
const getAnnotation = <T>(annotationId:
|
|
22
|
+
const getAnnotation = <T>(annotationId: string): Option.Option<T> =>
|
|
23
23
|
propertySignature !== undefined
|
|
24
24
|
? hasPropertyAnnotation<T>(propertySignature, annotationId)
|
|
25
|
-
: SchemaAST.
|
|
25
|
+
: Option.fromUndefinedOr(SchemaAST.resolveAt<T>(annotationId)(ast))
|
|
26
26
|
|
|
27
|
-
const columnType = SchemaAST.
|
|
27
|
+
const columnType = Option.fromUndefinedOr(SchemaAST.resolveAt<SqliteDsl.FieldColumnType>(ColumnType)(ast))
|
|
28
28
|
|
|
29
29
|
// Check if schema has null (e.g., Schema.NullOr) or undefined or if it's forced nullable (optional field)
|
|
30
30
|
const isNullable = forceNullable === true || hasNull(ast) === true || hasUndefined(ast) === true
|
|
@@ -50,13 +50,13 @@ export const getColumnDefForSchema = (
|
|
|
50
50
|
|
|
51
51
|
const hasPropertyAnnotation = <T>(
|
|
52
52
|
propertySignature: SchemaAST.PropertySignature,
|
|
53
|
-
annotationId:
|
|
53
|
+
annotationId: string,
|
|
54
54
|
): Option.Option<T> => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const keyAnnotation = propertySignature.type.context?.annotations?.[annotationId] as T | undefined
|
|
56
|
+
if (keyAnnotation !== undefined) {
|
|
57
|
+
return Option.some(keyAnnotation)
|
|
58
58
|
}
|
|
59
|
-
return SchemaAST.
|
|
59
|
+
return Option.fromUndefinedOr(SchemaAST.resolveAt<T>(annotationId)(propertySignature.type))
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -72,10 +72,11 @@ export const schemaFieldsToColumns = (
|
|
|
72
72
|
for (const prop of propertySignatures) {
|
|
73
73
|
if (typeof prop.name !== 'string') continue
|
|
74
74
|
|
|
75
|
-
const
|
|
75
|
+
const isOptional = SchemaAST.isOptional(prop.type)
|
|
76
|
+
const fieldSchema = Schema.make<Schema.Top>(prop.type)
|
|
76
77
|
|
|
77
78
|
// Warn about lossy conversion for fields with both null and undefined
|
|
78
|
-
if (
|
|
79
|
+
if (isOptional === true) {
|
|
79
80
|
const { hasNull, hasUndefined } = checkNullUndefined(fieldSchema.ast)
|
|
80
81
|
if (hasNull === true && hasUndefined === true) {
|
|
81
82
|
console.warn(`Field '${prop.name}' has both null and undefined - treating | undefined as | null`)
|
|
@@ -83,7 +84,7 @@ export const schemaFieldsToColumns = (
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
// Get column definition - pass nullable flag for optional fields
|
|
86
|
-
const columnDef = getColumnDefForSchema(fieldSchema, prop,
|
|
87
|
+
const columnDef = getColumnDefForSchema(fieldSchema, prop, isOptional === true)
|
|
87
88
|
|
|
88
89
|
// Check for primary key and unique annotations
|
|
89
90
|
const hasPrimaryKey = hasPropertyAnnotation<boolean>(prop, PrimaryKeyId).pipe(Option.getOrElse(() => false))
|
|
@@ -112,8 +113,8 @@ const checkNullUndefined = (ast: SchemaAST.AST): { hasNull: boolean; hasUndefine
|
|
|
112
113
|
let hasUndefined = false
|
|
113
114
|
|
|
114
115
|
const visit = (type: SchemaAST.AST): void => {
|
|
115
|
-
if (SchemaAST.
|
|
116
|
-
else if (SchemaAST.
|
|
116
|
+
if (SchemaAST.isUndefined(type) === true) hasUndefined = true
|
|
117
|
+
else if (SchemaAST.isNull(type) === true) hasNull = true
|
|
117
118
|
else if (SchemaAST.isUnion(type) === true) type.types.forEach(visit)
|
|
118
119
|
}
|
|
119
120
|
|
|
@@ -122,7 +123,7 @@ const checkNullUndefined = (ast: SchemaAST.AST): { hasNull: boolean; hasUndefine
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
const hasNull = (ast: SchemaAST.AST): boolean => {
|
|
125
|
-
if (SchemaAST.
|
|
126
|
+
if (SchemaAST.isNull(ast) === true) return true
|
|
126
127
|
if (SchemaAST.isUnion(ast) === true) {
|
|
127
128
|
return ast.types.some((type) => hasNull(type))
|
|
128
129
|
}
|
|
@@ -130,7 +131,7 @@ const hasNull = (ast: SchemaAST.AST): boolean => {
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
const hasUndefined = (ast: SchemaAST.AST): boolean => {
|
|
133
|
-
if (SchemaAST.
|
|
134
|
+
if (SchemaAST.isUndefined(ast) === true) return true
|
|
134
135
|
if (SchemaAST.isUnion(ast) === true) {
|
|
135
136
|
return ast.types.some((type) => hasUndefined(type))
|
|
136
137
|
}
|
|
@@ -152,36 +153,34 @@ const getColumnForType = (columnType: string, nullable = false): SqliteDsl.Colum
|
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
const getColumnForSchema = (schema: Schema.
|
|
156
|
+
const getColumnForSchema = (schema: Schema.Top, nullable = false): SqliteDsl.ColumnDefinition.Any => {
|
|
156
157
|
const ast = schema.ast
|
|
157
158
|
// Strip nullable wrapper to get core type
|
|
158
159
|
const coreAst = stripNullable(ast)
|
|
159
|
-
const coreSchema = stripNullable(ast) === ast ? schema : Schema.make(coreAst)
|
|
160
|
+
const coreSchema = (stripNullable(ast) === ast ? schema : Schema.make(coreAst)) as Schema.Codec<any, any>
|
|
160
161
|
|
|
161
162
|
// Special case: Boolean is transformed to integer in SQLite
|
|
162
|
-
if (SchemaAST.
|
|
163
|
+
if (SchemaAST.isBoolean(coreAst) === true) {
|
|
163
164
|
return SqliteDsl.boolean({ nullable })
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
// Get the encoded AST - what actually gets stored in SQLite
|
|
167
|
-
const encodedAst = Schema.
|
|
168
|
+
const encodedAst = Schema.toEncoded(coreSchema).ast
|
|
168
169
|
|
|
169
170
|
// Check if the encoded type matches SQLite native types
|
|
170
|
-
if (SchemaAST.
|
|
171
|
+
if (SchemaAST.isString(encodedAst) === true) {
|
|
171
172
|
return SqliteDsl.text({ schema: coreSchema, nullable })
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
if (SchemaAST.
|
|
175
|
-
|
|
176
|
-
const id = SchemaAST.getIdentifierAnnotation(coreAst).pipe(Option.getOrElse(() => ''))
|
|
177
|
-
if (id === 'Int' || id === 'DateFromNumber') {
|
|
175
|
+
if (SchemaAST.isNumber(encodedAst) === true) {
|
|
176
|
+
if (hasCheck(coreAst.checks, 'effect/schema/isInt') === true || hasDateRepresentation(coreAst) === true) {
|
|
178
177
|
return SqliteDsl.integer({ schema: coreSchema, nullable })
|
|
179
178
|
}
|
|
180
179
|
return SqliteDsl.real({ schema: coreSchema, nullable })
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
if (isUint8ArraySchema(coreAst) === true || isUint8ArraySchema(encodedAst) === true) {
|
|
184
|
-
return SqliteDsl.blob({ schema:
|
|
183
|
+
return SqliteDsl.blob({ schema: coreSchema, nullable })
|
|
185
184
|
}
|
|
186
185
|
|
|
187
186
|
const literalColumn = getLiteralColumnDefinition(encodedAst, coreSchema, nullable, coreAst)
|
|
@@ -200,7 +199,7 @@ const stripNullable = (ast: SchemaAST.AST): SchemaAST.AST => {
|
|
|
200
199
|
|
|
201
200
|
// Filter out null/undefined members while preserving any annotations on the union
|
|
202
201
|
const coreTypes = ast.types.filter(
|
|
203
|
-
(type) =>
|
|
202
|
+
(type) => SchemaAST.isNull(type) === false && SchemaAST.isUndefined(type) === false,
|
|
204
203
|
)
|
|
205
204
|
|
|
206
205
|
if (coreTypes.length === 0 || coreTypes.length === ast.types.length) {
|
|
@@ -211,12 +210,12 @@ const stripNullable = (ast: SchemaAST.AST): SchemaAST.AST => {
|
|
|
211
210
|
return coreTypes[0]!
|
|
212
211
|
}
|
|
213
212
|
|
|
214
|
-
return SchemaAST.Union
|
|
213
|
+
return new SchemaAST.Union(coreTypes, ast.mode, ast.annotations)
|
|
215
214
|
}
|
|
216
215
|
|
|
217
216
|
const getLiteralColumnDefinition = (
|
|
218
217
|
ast: SchemaAST.AST,
|
|
219
|
-
schema: Schema.
|
|
218
|
+
schema: Schema.Codec<any, any>,
|
|
220
219
|
nullable: boolean,
|
|
221
220
|
sourceAst: SchemaAST.AST,
|
|
222
221
|
): SqliteDsl.ColumnDefinition.Any | null => {
|
|
@@ -228,8 +227,7 @@ const getLiteralColumnDefinition = (
|
|
|
228
227
|
case 'string':
|
|
229
228
|
return SqliteDsl.text({ schema, nullable })
|
|
230
229
|
case 'number': {
|
|
231
|
-
|
|
232
|
-
if (id === 'Int' || id === 'DateFromNumber') {
|
|
230
|
+
if (hasCheck(sourceAst.checks, 'effect/schema/isInt') === true || hasDateRepresentation(sourceAst) === true) {
|
|
233
231
|
return SqliteDsl.integer({ schema, nullable })
|
|
234
232
|
}
|
|
235
233
|
|
|
@@ -247,6 +245,9 @@ const getLiteralColumnDefinition = (
|
|
|
247
245
|
}
|
|
248
246
|
}
|
|
249
247
|
|
|
248
|
+
/** Effect's built-in date codecs expose their semantic type through the Date representation annotation. */
|
|
249
|
+
const hasDateRepresentation = (ast: SchemaAST.AST): boolean => hasRepresentation(ast, 'effect/schema/Date')
|
|
250
|
+
|
|
250
251
|
const extractLiteralValues = (ast: SchemaAST.AST): ReadonlyArray<SchemaAST.LiteralValue> | null => {
|
|
251
252
|
if (SchemaAST.isLiteral(ast) === true) return [ast.literal]
|
|
252
253
|
|
|
@@ -255,7 +256,7 @@ const extractLiteralValues = (ast: SchemaAST.AST): ReadonlyArray<SchemaAST.Liter
|
|
|
255
256
|
ast.types.length > 0 &&
|
|
256
257
|
ast.types.every((type) => SchemaAST.isLiteral(type)) === true
|
|
257
258
|
) {
|
|
258
|
-
return ast.types.map((type) =>
|
|
259
|
+
return ast.types.map((type) => type.literal)
|
|
259
260
|
}
|
|
260
261
|
|
|
261
262
|
return null
|
|
@@ -264,7 +265,7 @@ const extractLiteralValues = (ast: SchemaAST.AST): ReadonlyArray<SchemaAST.Liter
|
|
|
264
265
|
const getLiteralValueType = (
|
|
265
266
|
literals: ReadonlyArray<SchemaAST.LiteralValue>,
|
|
266
267
|
): 'string' | 'number' | 'boolean' | 'bigint' | null => {
|
|
267
|
-
const literalTypes = new Set(literals.map((value) =>
|
|
268
|
+
const literalTypes = new Set(literals.map((value) => typeof value))
|
|
268
269
|
if (literalTypes.size !== 1) return null
|
|
269
270
|
|
|
270
271
|
const [literalType] = literalTypes
|
|
@@ -273,15 +274,49 @@ const getLiteralValueType = (
|
|
|
273
274
|
: null
|
|
274
275
|
}
|
|
275
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Recursively checks for Effect built-in check metadata.
|
|
279
|
+
*
|
|
280
|
+
* Checks can be attached directly as `Filter`s or nested in `FilterGroup`s when
|
|
281
|
+
* schemas compose multiple refinements, e.g. `Schema.Int.check(...)`.
|
|
282
|
+
*
|
|
283
|
+
* Effect rc.109 replaced the closed `meta` annotation with the open `representation`
|
|
284
|
+
* identity, so built-in checks are matched by their representation id.
|
|
285
|
+
*/
|
|
286
|
+
const hasCheck = (checks: ReadonlyArray<SchemaAST.Check<unknown>> | undefined, representationId: string): boolean => {
|
|
287
|
+
return (
|
|
288
|
+
checks?.some((check) => {
|
|
289
|
+
switch (check._tag) {
|
|
290
|
+
case 'Filter':
|
|
291
|
+
return check.annotations?.representation?.id === representationId
|
|
292
|
+
case 'FilterGroup':
|
|
293
|
+
return hasCheck(check.checks, representationId)
|
|
294
|
+
}
|
|
295
|
+
}) === true
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
|
|
276
299
|
const isUint8ArraySchema = (ast: SchemaAST.AST): boolean => {
|
|
277
|
-
|
|
278
|
-
if (
|
|
300
|
+
// `resolveAt` reads the last check's annotations, which can mask the declaration's representation.
|
|
301
|
+
if (hasRepresentation(ast, 'effect/schema/Uint8Array') === true) {
|
|
302
|
+
return true
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const identifier = SchemaAST.resolveIdentifier(ast)
|
|
306
|
+
if (identifier !== undefined && identifier.includes('Uint8Array') === true) {
|
|
279
307
|
return true
|
|
280
308
|
}
|
|
281
309
|
|
|
282
|
-
if (SchemaAST.
|
|
283
|
-
return ast.elements.length === 0 && ast.rest.length === 1 && SchemaAST.
|
|
310
|
+
if (SchemaAST.isArrays(ast) === true) {
|
|
311
|
+
return ast.elements.length === 0 && ast.rest.length === 1 && SchemaAST.isNumber(ast.rest[0]!)
|
|
284
312
|
}
|
|
285
313
|
|
|
286
314
|
return false
|
|
287
315
|
}
|
|
316
|
+
|
|
317
|
+
const hasRepresentation = (ast: SchemaAST.AST, id: string): boolean => {
|
|
318
|
+
const representation = ast.annotations?.representation
|
|
319
|
+
return (
|
|
320
|
+
typeof representation === 'object' && representation !== null && 'id' in representation && representation.id === id
|
|
321
|
+
)
|
|
322
|
+
}
|
|
@@ -28,9 +28,9 @@ const createColumn = (
|
|
|
28
28
|
case 'text':
|
|
29
29
|
return Schema.String
|
|
30
30
|
case 'integer':
|
|
31
|
-
return options.defaultValue === true || options.defaultValue === false ? Schema.Boolean : Schema.
|
|
31
|
+
return options.defaultValue === true || options.defaultValue === false ? Schema.Boolean : Schema.Finite
|
|
32
32
|
case 'real':
|
|
33
|
-
return Schema.
|
|
33
|
+
return Schema.Finite
|
|
34
34
|
case 'blob':
|
|
35
35
|
return Schema.Uint8ArrayFromBase64
|
|
36
36
|
default:
|
|
@@ -19,7 +19,7 @@ export const makeColumnSpec = (tableAst: SqliteAst.Table) => {
|
|
|
19
19
|
// is only valid on a single column declared as INTEGER PRIMARY KEY (column-level).
|
|
20
20
|
const columnDefStrs = tableAst.columns.map((column) =>
|
|
21
21
|
toSqliteColumnSpec(column, {
|
|
22
|
-
inlinePrimaryKey: hasSinglePk && column === pkColumn &&
|
|
22
|
+
inlinePrimaryKey: hasSinglePk && column === pkColumn && column.primaryKey,
|
|
23
23
|
}),
|
|
24
24
|
)
|
|
25
25
|
|
|
@@ -40,7 +40,8 @@ const toSqliteColumnSpec = (column: SqliteAst.Column, opts: { inlinePrimaryKey:
|
|
|
40
40
|
const nullableStr = opts.inlinePrimaryKey === true ? '' : column.nullable === false ? 'not null' : ''
|
|
41
41
|
|
|
42
42
|
// Only include AUTOINCREMENT when it's valid: single-column INTEGER PRIMARY KEY
|
|
43
|
-
const includeAutoIncrement =
|
|
43
|
+
const includeAutoIncrement =
|
|
44
|
+
opts.inlinePrimaryKey === true && column.type._tag === 'integer' && column.autoIncrement === true
|
|
44
45
|
|
|
45
46
|
const pkStr = opts.inlinePrimaryKey === true ? 'primary key' : ''
|
|
46
47
|
const autoIncrementStr = includeAutoIncrement === true ? 'autoincrement' : ''
|
|
@@ -25,7 +25,7 @@ export type Column = {
|
|
|
25
25
|
nullable: boolean
|
|
26
26
|
autoIncrement: boolean
|
|
27
27
|
default: Option.Option<any>
|
|
28
|
-
schema: Schema.
|
|
28
|
+
schema: Schema.Codec<any, any>
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export const column = (props: Omit<Column, '_tag'>): Column => ({ _tag: 'column', ...props })
|
|
@@ -84,14 +84,24 @@ export type DbSchema = {
|
|
|
84
84
|
export const dbSchema = (tables: Table[]): DbSchema => ({ _tag: 'dbSchema', tables })
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Helper to detect if a column is a JSON column (
|
|
87
|
+
* Helper to detect if a column is a JSON column (encoded as a JSON string)
|
|
88
88
|
*/
|
|
89
89
|
const isJsonColumn = (column: Column): boolean => {
|
|
90
90
|
if (column.type._tag !== 'text') return false
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
return hasJsonStringEncoding(column.schema.ast)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* `SchemaTransformation.fromJsonString` is a factory since Effect rc.109, so encoding links can no
|
|
97
|
+
* longer be matched by identity. `Schema.fromJsonString` annotates its encoded side as
|
|
98
|
+
* `application/json`, which identifies the link regardless of the reviver/replacer/space options.
|
|
99
|
+
*/
|
|
100
|
+
const hasJsonStringEncoding = (ast: SchemaAST.AST): boolean => {
|
|
101
|
+
if (ast.encoding?.some((link) => link.to.annotations?.contentMediaType === 'application/json') === true) {
|
|
102
|
+
return true
|
|
103
|
+
}
|
|
104
|
+
return SchemaAST.isUnion(ast) === true && ast.types.some(hasJsonStringEncoding)
|
|
95
105
|
}
|
|
96
106
|
|
|
97
107
|
/**
|
|
@@ -3,77 +3,77 @@
|
|
|
3
3
|
exports[`FieldDefs > boolean 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"autoIncrement": false,
|
|
6
|
-
"columnType": "
|
|
6
|
+
"columnType": "integer",
|
|
7
7
|
"default": {
|
|
8
8
|
"_id": "Option",
|
|
9
9
|
"_tag": "None",
|
|
10
10
|
},
|
|
11
11
|
"nullable": false,
|
|
12
12
|
"primaryKey": false,
|
|
13
|
-
"schema":
|
|
13
|
+
"schema": {
|
|
14
|
+
"ast": "Boolean",
|
|
15
|
+
"decodedAst": "Boolean",
|
|
16
|
+
"encodedAst": "Union",
|
|
17
|
+
},
|
|
14
18
|
}
|
|
15
19
|
`;
|
|
16
20
|
|
|
17
21
|
exports[`FieldDefs > boolean 2`] = `
|
|
18
22
|
{
|
|
19
23
|
"autoIncrement": false,
|
|
20
|
-
"columnType": "
|
|
24
|
+
"columnType": "integer",
|
|
21
25
|
"default": {
|
|
22
26
|
"_id": "Option",
|
|
23
27
|
"_tag": "None",
|
|
24
28
|
},
|
|
25
29
|
"nullable": false,
|
|
26
30
|
"primaryKey": false,
|
|
27
|
-
"schema":
|
|
31
|
+
"schema": {
|
|
32
|
+
"ast": "Boolean",
|
|
33
|
+
"decodedAst": "Boolean",
|
|
34
|
+
"encodedAst": "Union",
|
|
35
|
+
},
|
|
28
36
|
}
|
|
29
37
|
`;
|
|
30
38
|
|
|
31
39
|
exports[`FieldDefs > boolean 3`] = `
|
|
32
40
|
{
|
|
33
41
|
"autoIncrement": false,
|
|
34
|
-
"columnType": "
|
|
42
|
+
"columnType": "integer",
|
|
35
43
|
"default": {
|
|
36
44
|
"_id": "Option",
|
|
37
45
|
"_tag": "Some",
|
|
38
|
-
"value":
|
|
46
|
+
"value": false,
|
|
39
47
|
},
|
|
40
|
-
"nullable":
|
|
48
|
+
"nullable": false,
|
|
41
49
|
"primaryKey": false,
|
|
42
|
-
"schema":
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
exports[`FieldDefs > boolean 4`] = `
|
|
47
|
-
{
|
|
48
|
-
"autoIncrement": false,
|
|
49
|
-
"columnType": "text",
|
|
50
|
-
"default": {
|
|
51
|
-
"_id": "Option",
|
|
52
|
-
"_tag": "Some",
|
|
53
|
-
"value": "foo",
|
|
50
|
+
"schema": {
|
|
51
|
+
"ast": "Boolean",
|
|
52
|
+
"decodedAst": "Boolean",
|
|
53
|
+
"encodedAst": "Union",
|
|
54
54
|
},
|
|
55
|
-
"nullable": true,
|
|
56
|
-
"primaryKey": false,
|
|
57
|
-
"schema": [Function],
|
|
58
55
|
}
|
|
59
56
|
`;
|
|
60
57
|
|
|
61
|
-
exports[`FieldDefs >
|
|
58
|
+
exports[`FieldDefs > datetime 1`] = `
|
|
62
59
|
{
|
|
63
60
|
"autoIncrement": false,
|
|
64
61
|
"columnType": "text",
|
|
65
62
|
"default": {
|
|
66
63
|
"_id": "Option",
|
|
67
|
-
"_tag": "
|
|
68
|
-
"value": "foo",
|
|
64
|
+
"_tag": "None",
|
|
69
65
|
},
|
|
70
|
-
"nullable":
|
|
66
|
+
"nullable": false,
|
|
71
67
|
"primaryKey": false,
|
|
72
|
-
"schema":
|
|
68
|
+
"schema": {
|
|
69
|
+
"ast": "Declaration",
|
|
70
|
+
"decodedAst": "Declaration",
|
|
71
|
+
"encodedAst": "String",
|
|
72
|
+
},
|
|
73
73
|
}
|
|
74
74
|
`;
|
|
75
75
|
|
|
76
|
-
exports[`FieldDefs >
|
|
76
|
+
exports[`FieldDefs > datetime 2`] = `
|
|
77
77
|
{
|
|
78
78
|
"autoIncrement": false,
|
|
79
79
|
"columnType": "text",
|
|
@@ -83,11 +83,15 @@ exports[`FieldDefs > boolean 6`] = `
|
|
|
83
83
|
},
|
|
84
84
|
"nullable": false,
|
|
85
85
|
"primaryKey": false,
|
|
86
|
-
"schema":
|
|
86
|
+
"schema": {
|
|
87
|
+
"ast": "Declaration",
|
|
88
|
+
"decodedAst": "Declaration",
|
|
89
|
+
"encodedAst": "String",
|
|
90
|
+
},
|
|
87
91
|
}
|
|
88
92
|
`;
|
|
89
93
|
|
|
90
|
-
exports[`FieldDefs >
|
|
94
|
+
exports[`FieldDefs > datetime 3`] = `
|
|
91
95
|
{
|
|
92
96
|
"autoIncrement": false,
|
|
93
97
|
"columnType": "text",
|
|
@@ -98,28 +102,34 @@ exports[`FieldDefs > boolean 7`] = `
|
|
|
98
102
|
},
|
|
99
103
|
"nullable": true,
|
|
100
104
|
"primaryKey": false,
|
|
101
|
-
"schema":
|
|
105
|
+
"schema": {
|
|
106
|
+
"ast": "Union",
|
|
107
|
+
"decodedAst": "Union",
|
|
108
|
+
"encodedAst": "Union",
|
|
109
|
+
},
|
|
102
110
|
}
|
|
103
111
|
`;
|
|
104
112
|
|
|
105
|
-
exports[`FieldDefs >
|
|
113
|
+
exports[`FieldDefs > datetime 4`] = `
|
|
106
114
|
{
|
|
107
115
|
"autoIncrement": false,
|
|
108
116
|
"columnType": "text",
|
|
109
117
|
"default": {
|
|
110
118
|
"_id": "Option",
|
|
111
119
|
"_tag": "Some",
|
|
112
|
-
"value":
|
|
113
|
-
"name": "Bob",
|
|
114
|
-
},
|
|
120
|
+
"value": 2022-02-02T00:00:00.000Z,
|
|
115
121
|
},
|
|
116
|
-
"nullable":
|
|
122
|
+
"nullable": false,
|
|
117
123
|
"primaryKey": false,
|
|
118
|
-
"schema":
|
|
124
|
+
"schema": {
|
|
125
|
+
"ast": "Declaration",
|
|
126
|
+
"decodedAst": "Declaration",
|
|
127
|
+
"encodedAst": "String",
|
|
128
|
+
},
|
|
119
129
|
}
|
|
120
130
|
`;
|
|
121
131
|
|
|
122
|
-
exports[`FieldDefs >
|
|
132
|
+
exports[`FieldDefs > json 1`] = `
|
|
123
133
|
{
|
|
124
134
|
"autoIncrement": false,
|
|
125
135
|
"columnType": "text",
|
|
@@ -129,93 +139,143 @@ exports[`FieldDefs > boolean 9`] = `
|
|
|
129
139
|
},
|
|
130
140
|
"nullable": false,
|
|
131
141
|
"primaryKey": false,
|
|
132
|
-
"schema":
|
|
142
|
+
"schema": {
|
|
143
|
+
"ast": "Any",
|
|
144
|
+
"decodedAst": "Any",
|
|
145
|
+
"encodedAst": "String",
|
|
146
|
+
},
|
|
133
147
|
}
|
|
134
148
|
`;
|
|
135
149
|
|
|
136
|
-
exports[`FieldDefs >
|
|
150
|
+
exports[`FieldDefs > json 2`] = `
|
|
137
151
|
{
|
|
138
152
|
"autoIncrement": false,
|
|
139
153
|
"columnType": "text",
|
|
140
154
|
"default": {
|
|
141
155
|
"_id": "Option",
|
|
142
|
-
"_tag": "
|
|
156
|
+
"_tag": "Some",
|
|
157
|
+
"value": null,
|
|
143
158
|
},
|
|
144
|
-
"nullable":
|
|
159
|
+
"nullable": true,
|
|
145
160
|
"primaryKey": false,
|
|
146
|
-
"schema":
|
|
161
|
+
"schema": {
|
|
162
|
+
"ast": "Union",
|
|
163
|
+
"decodedAst": "Union",
|
|
164
|
+
"encodedAst": "Union",
|
|
165
|
+
},
|
|
147
166
|
}
|
|
148
167
|
`;
|
|
149
168
|
|
|
150
|
-
exports[`FieldDefs >
|
|
169
|
+
exports[`FieldDefs > json 3`] = `
|
|
151
170
|
{
|
|
152
171
|
"autoIncrement": false,
|
|
153
172
|
"columnType": "text",
|
|
154
173
|
"default": {
|
|
155
174
|
"_id": "Option",
|
|
156
175
|
"_tag": "Some",
|
|
157
|
-
"value":
|
|
176
|
+
"value": {
|
|
177
|
+
"name": "Bob",
|
|
178
|
+
},
|
|
158
179
|
},
|
|
159
180
|
"nullable": true,
|
|
160
181
|
"primaryKey": false,
|
|
161
|
-
"schema":
|
|
182
|
+
"schema": {
|
|
183
|
+
"ast": "Union",
|
|
184
|
+
"decodedAst": "Union",
|
|
185
|
+
"encodedAst": "Union",
|
|
186
|
+
},
|
|
162
187
|
}
|
|
163
188
|
`;
|
|
164
189
|
|
|
165
|
-
exports[`FieldDefs >
|
|
190
|
+
exports[`FieldDefs > text 1`] = `
|
|
166
191
|
{
|
|
167
192
|
"autoIncrement": false,
|
|
168
193
|
"columnType": "text",
|
|
169
194
|
"default": {
|
|
170
195
|
"_id": "Option",
|
|
171
|
-
"_tag": "
|
|
172
|
-
"value": 2022-02-02T00:00:00.000Z,
|
|
196
|
+
"_tag": "None",
|
|
173
197
|
},
|
|
174
198
|
"nullable": false,
|
|
175
199
|
"primaryKey": false,
|
|
176
|
-
"schema":
|
|
200
|
+
"schema": {
|
|
201
|
+
"ast": "String",
|
|
202
|
+
"decodedAst": "String",
|
|
203
|
+
"encodedAst": "String",
|
|
204
|
+
},
|
|
177
205
|
}
|
|
178
206
|
`;
|
|
179
207
|
|
|
180
|
-
exports[`FieldDefs >
|
|
208
|
+
exports[`FieldDefs > text 2`] = `
|
|
181
209
|
{
|
|
182
210
|
"autoIncrement": false,
|
|
183
|
-
"columnType": "
|
|
211
|
+
"columnType": "text",
|
|
184
212
|
"default": {
|
|
185
213
|
"_id": "Option",
|
|
186
214
|
"_tag": "None",
|
|
187
215
|
},
|
|
188
216
|
"nullable": false,
|
|
189
217
|
"primaryKey": false,
|
|
190
|
-
"schema":
|
|
218
|
+
"schema": {
|
|
219
|
+
"ast": "String",
|
|
220
|
+
"decodedAst": "String",
|
|
221
|
+
"encodedAst": "String",
|
|
222
|
+
},
|
|
191
223
|
}
|
|
192
224
|
`;
|
|
193
225
|
|
|
194
|
-
exports[`FieldDefs >
|
|
226
|
+
exports[`FieldDefs > text 3`] = `
|
|
195
227
|
{
|
|
196
228
|
"autoIncrement": false,
|
|
197
|
-
"columnType": "
|
|
229
|
+
"columnType": "text",
|
|
198
230
|
"default": {
|
|
199
231
|
"_id": "Option",
|
|
200
|
-
"_tag": "
|
|
232
|
+
"_tag": "Some",
|
|
233
|
+
"value": null,
|
|
201
234
|
},
|
|
202
|
-
"nullable":
|
|
235
|
+
"nullable": true,
|
|
203
236
|
"primaryKey": false,
|
|
204
|
-
"schema":
|
|
237
|
+
"schema": {
|
|
238
|
+
"ast": "Union",
|
|
239
|
+
"decodedAst": "Union",
|
|
240
|
+
"encodedAst": "Union",
|
|
241
|
+
},
|
|
205
242
|
}
|
|
206
243
|
`;
|
|
207
244
|
|
|
208
|
-
exports[`FieldDefs >
|
|
245
|
+
exports[`FieldDefs > text 4`] = `
|
|
209
246
|
{
|
|
210
247
|
"autoIncrement": false,
|
|
211
|
-
"columnType": "
|
|
248
|
+
"columnType": "text",
|
|
212
249
|
"default": {
|
|
213
250
|
"_id": "Option",
|
|
214
251
|
"_tag": "Some",
|
|
215
|
-
"value":
|
|
252
|
+
"value": "foo",
|
|
216
253
|
},
|
|
217
|
-
"nullable":
|
|
254
|
+
"nullable": true,
|
|
218
255
|
"primaryKey": false,
|
|
219
|
-
"schema":
|
|
256
|
+
"schema": {
|
|
257
|
+
"ast": "Union",
|
|
258
|
+
"decodedAst": "Union",
|
|
259
|
+
"encodedAst": "Union",
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
`;
|
|
263
|
+
|
|
264
|
+
exports[`FieldDefs > text 5`] = `
|
|
265
|
+
{
|
|
266
|
+
"autoIncrement": false,
|
|
267
|
+
"columnType": "text",
|
|
268
|
+
"default": {
|
|
269
|
+
"_id": "Option",
|
|
270
|
+
"_tag": "Some",
|
|
271
|
+
"value": "foo",
|
|
272
|
+
},
|
|
273
|
+
"nullable": true,
|
|
274
|
+
"primaryKey": false,
|
|
275
|
+
"schema": {
|
|
276
|
+
"ast": "Union",
|
|
277
|
+
"decodedAst": "Union",
|
|
278
|
+
"encodedAst": "Union",
|
|
279
|
+
},
|
|
220
280
|
}
|
|
221
281
|
`;
|