@livestore/common 0.3.1 → 0.3.2-dev.1
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 +35 -0
- package/dist/ClientSessionLeaderThreadProxy.d.ts.map +1 -0
- package/dist/ClientSessionLeaderThreadProxy.js +6 -0
- package/dist/ClientSessionLeaderThreadProxy.js.map +1 -0
- package/dist/__tests__/fixture.d.ts +4 -4
- package/dist/__tests__/fixture.js +2 -2
- package/dist/adapter-types.d.ts +11 -162
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js +5 -49
- package/dist/adapter-types.js.map +1 -1
- package/dist/debug-info.d.ts +2 -2
- package/dist/debug-info.js +2 -2
- package/dist/defs.d.ts +20 -0
- package/dist/defs.d.ts.map +1 -0
- package/dist/defs.js +12 -0
- package/dist/defs.js.map +1 -0
- package/dist/devtools/devtools-messages-client-session.d.ts +29 -27
- package/dist/devtools/devtools-messages-client-session.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-client-session.js +4 -4
- package/dist/devtools/devtools-messages-common.d.ts +6 -6
- package/dist/devtools/devtools-messages-common.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-common.js +1 -1
- package/dist/devtools/devtools-messages-leader.d.ts +37 -35
- package/dist/devtools/devtools-messages-leader.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-leader.js +4 -4
- package/dist/devtools/devtools-messages.d.ts +3 -3
- package/dist/devtools/devtools-messages.d.ts.map +1 -1
- package/dist/devtools/devtools-messages.js +3 -3
- package/dist/devtools/devtools-messages.js.map +1 -1
- package/dist/devtools/mod.d.ts +3 -3
- package/dist/devtools/mod.js +3 -3
- package/dist/errors.d.ts +50 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +16 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/leader-thread/LeaderSyncProcessor.d.ts +10 -11
- package/dist/leader-thread/LeaderSyncProcessor.d.ts.map +1 -1
- package/dist/leader-thread/LeaderSyncProcessor.js +122 -132
- package/dist/leader-thread/LeaderSyncProcessor.js.map +1 -1
- package/dist/leader-thread/connection.d.ts +4 -4
- package/dist/leader-thread/connection.js +2 -2
- package/dist/leader-thread/eventlog.d.ts +21 -10
- package/dist/leader-thread/eventlog.d.ts.map +1 -1
- package/dist/leader-thread/eventlog.js +39 -24
- package/dist/leader-thread/eventlog.js.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.d.ts +3 -3
- package/dist/leader-thread/leader-worker-devtools.d.ts.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.js +4 -5
- package/dist/leader-thread/leader-worker-devtools.js.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.d.ts +7 -7
- package/dist/leader-thread/make-leader-thread-layer.d.ts.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.js +44 -14
- package/dist/leader-thread/make-leader-thread-layer.js.map +1 -1
- package/dist/leader-thread/materialize-event.d.ts +4 -4
- package/dist/leader-thread/materialize-event.d.ts.map +1 -1
- package/dist/leader-thread/materialize-event.js +14 -8
- package/dist/leader-thread/materialize-event.js.map +1 -1
- package/dist/leader-thread/mod.d.ts +8 -7
- package/dist/leader-thread/mod.d.ts.map +1 -1
- package/dist/leader-thread/mod.js +8 -7
- package/dist/leader-thread/mod.js.map +1 -1
- package/dist/leader-thread/recreate-db.d.ts +14 -7
- package/dist/leader-thread/recreate-db.d.ts.map +1 -1
- package/dist/leader-thread/recreate-db.js +3 -5
- package/dist/leader-thread/recreate-db.js.map +1 -1
- package/dist/leader-thread/shutdown-channel.d.ts +1 -1
- package/dist/leader-thread/shutdown-channel.js +1 -1
- package/dist/leader-thread/types.d.ts +8 -10
- package/dist/leader-thread/types.d.ts.map +1 -1
- package/dist/make-client-session.d.ts +3 -3
- 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 +5 -5
- package/dist/materializer-helper.js +5 -5
- package/dist/rematerialize-from-eventlog.d.ts +4 -4
- package/dist/rematerialize-from-eventlog.d.ts.map +1 -1
- package/dist/rematerialize-from-eventlog.js +13 -5
- package/dist/rematerialize-from-eventlog.js.map +1 -1
- package/dist/schema/EventDef.d.ts +5 -5
- package/dist/schema/EventDef.d.ts.map +1 -1
- package/dist/schema/EventDef.js +2 -2
- package/dist/schema/EventDef.js.map +1 -1
- package/dist/schema/EventSequenceNumber.d.ts +20 -2
- package/dist/schema/EventSequenceNumber.d.ts.map +1 -1
- package/dist/schema/EventSequenceNumber.js +71 -19
- package/dist/schema/EventSequenceNumber.js.map +1 -1
- package/dist/schema/EventSequenceNumber.test.js +89 -4
- package/dist/schema/EventSequenceNumber.test.js.map +1 -1
- package/dist/schema/LiveStoreEvent.d.ts +26 -12
- package/dist/schema/LiveStoreEvent.d.ts.map +1 -1
- package/dist/schema/LiveStoreEvent.js +13 -5
- package/dist/schema/LiveStoreEvent.js.map +1 -1
- package/dist/schema/events.d.ts +1 -1
- package/dist/schema/events.d.ts.map +1 -1
- package/dist/schema/events.js +1 -1
- package/dist/schema/events.js.map +1 -1
- package/dist/schema/mod.d.ts +9 -9
- package/dist/schema/mod.d.ts.map +1 -1
- package/dist/schema/mod.js +9 -9
- package/dist/schema/mod.js.map +1 -1
- package/dist/schema/schema.d.ts +4 -4
- package/dist/schema/schema.js +3 -3
- package/dist/schema/state/mod.d.ts +2 -2
- package/dist/schema/state/mod.js +2 -2
- package/dist/schema/state/sqlite/client-document-def.d.ts +5 -5
- package/dist/schema/state/sqlite/client-document-def.d.ts.map +1 -1
- package/dist/schema/state/sqlite/client-document-def.js +6 -6
- package/dist/schema/state/sqlite/client-document-def.js.map +1 -1
- package/dist/schema/state/sqlite/client-document-def.test.js +4 -6
- package/dist/schema/state/sqlite/client-document-def.test.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/ast/sqlite.js +1 -1
- package/dist/schema/state/sqlite/db-schema/ast/validate.d.ts +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.js +2 -2
- 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 +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.d.ts +3 -3
- package/dist/schema/state/sqlite/db-schema/dsl/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.js +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/hash.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/hash.js +3 -2
- package/dist/schema/state/sqlite/db-schema/hash.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/mod.d.ts +2 -2
- package/dist/schema/state/sqlite/db-schema/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/mod.js +2 -2
- package/dist/schema/state/sqlite/db-schema/mod.js.map +1 -1
- package/dist/schema/state/sqlite/mod.d.ts +7 -7
- package/dist/schema/state/sqlite/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/mod.js +7 -7
- package/dist/schema/state/sqlite/mod.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/api.d.ts +40 -13
- package/dist/schema/state/sqlite/query-builder/api.d.ts.map +1 -1
- package/dist/schema/state/sqlite/query-builder/api.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/astToSql.d.ts +2 -2
- package/dist/schema/state/sqlite/query-builder/astToSql.js +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.d.ts +2 -2
- package/dist/schema/state/sqlite/query-builder/impl.d.ts.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.js +20 -25
- package/dist/schema/state/sqlite/query-builder/impl.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.test.d.ts +1 -81
- package/dist/schema/state/sqlite/query-builder/impl.test.d.ts.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.test.js +36 -22
- package/dist/schema/state/sqlite/query-builder/impl.test.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/mod.d.ts +2 -2
- package/dist/schema/state/sqlite/query-builder/mod.js +2 -2
- package/dist/schema/state/sqlite/schema-helpers.d.ts +1 -1
- package/dist/schema/state/sqlite/schema-helpers.js +1 -1
- package/dist/schema/state/sqlite/system-tables.d.ts +72 -67
- package/dist/schema/state/sqlite/system-tables.d.ts.map +1 -1
- package/dist/schema/state/sqlite/system-tables.js +11 -20
- package/dist/schema/state/sqlite/system-tables.js.map +1 -1
- package/dist/schema/state/sqlite/table-def.d.ts +3 -3
- package/dist/schema/state/sqlite/table-def.d.ts.map +1 -1
- package/dist/schema/state/sqlite/table-def.js +2 -2
- package/dist/schema-management/common.d.ts +2 -2
- package/dist/schema-management/common.js +1 -1
- package/dist/schema-management/migrations.d.ts +6 -4
- package/dist/schema-management/migrations.d.ts.map +1 -1
- package/dist/schema-management/migrations.js +5 -5
- package/dist/schema-management/migrations.js.map +1 -1
- package/dist/schema-management/validate-schema.d.ts +4 -4
- package/dist/schema-management/validate-schema.js +1 -1
- package/dist/sql-queries/index.d.ts +3 -3
- package/dist/sql-queries/index.js +3 -3
- package/dist/sql-queries/sql-queries.d.ts +2 -2
- package/dist/sql-queries/sql-queries.d.ts.map +1 -1
- package/dist/sql-queries/sql-queries.js +5 -3
- package/dist/sql-queries/sql-queries.js.map +1 -1
- package/dist/sql-queries/sql-query-builder.d.ts +3 -3
- package/dist/sql-queries/sql-query-builder.js +1 -1
- package/dist/sql-queries/types.d.ts +1 -1
- package/dist/sqlite-db-helper.d.ts +2 -2
- package/dist/sqlite-db-helper.js +1 -1
- package/dist/sqlite-types.d.ts +72 -0
- package/dist/sqlite-types.d.ts.map +1 -0
- package/dist/sqlite-types.js +5 -0
- package/dist/sqlite-types.js.map +1 -0
- package/dist/sync/ClientSessionSyncProcessor.d.ts +22 -7
- package/dist/sync/ClientSessionSyncProcessor.d.ts.map +1 -1
- package/dist/sync/ClientSessionSyncProcessor.js +43 -21
- package/dist/sync/ClientSessionSyncProcessor.js.map +1 -1
- package/dist/sync/index.d.ts +3 -3
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +3 -3
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/next/compact-events.d.ts +1 -1
- package/dist/sync/next/compact-events.js +4 -4
- package/dist/sync/next/facts.d.ts +3 -3
- package/dist/sync/next/facts.js +2 -2
- package/dist/sync/next/graphology.d.ts.map +1 -1
- package/dist/sync/next/graphology.js +0 -6
- package/dist/sync/next/graphology.js.map +1 -1
- package/dist/sync/next/graphology_.d.ts +1 -1
- package/dist/sync/next/graphology_.d.ts.map +1 -1
- package/dist/sync/next/graphology_.js +1 -1
- package/dist/sync/next/graphology_.js.map +1 -1
- package/dist/sync/next/history-dag-common.d.ts +3 -3
- package/dist/sync/next/history-dag-common.js +2 -2
- package/dist/sync/next/history-dag.d.ts +2 -2
- package/dist/sync/next/history-dag.js +3 -3
- package/dist/sync/next/mod.d.ts +5 -5
- package/dist/sync/next/mod.d.ts.map +1 -1
- package/dist/sync/next/mod.js +5 -5
- package/dist/sync/next/mod.js.map +1 -1
- package/dist/sync/next/rebase-events.d.ts +4 -4
- package/dist/sync/next/rebase-events.d.ts.map +1 -1
- package/dist/sync/next/rebase-events.js +3 -2
- package/dist/sync/next/rebase-events.js.map +1 -1
- package/dist/sync/next/test/compact-events.calculator.test.js +4 -4
- package/dist/sync/next/test/compact-events.test.js +5 -5
- package/dist/sync/next/test/compact-events.test.js.map +1 -1
- package/dist/sync/next/test/event-fixtures.d.ts +3 -3
- package/dist/sync/next/test/event-fixtures.d.ts.map +1 -1
- package/dist/sync/next/test/event-fixtures.js +17 -8
- package/dist/sync/next/test/event-fixtures.js.map +1 -1
- package/dist/sync/next/test/mod.d.ts +1 -1
- package/dist/sync/next/test/mod.js +1 -1
- package/dist/sync/sync.d.ts +6 -4
- package/dist/sync/sync.d.ts.map +1 -1
- package/dist/sync/sync.js +4 -1
- package/dist/sync/sync.js.map +1 -1
- package/dist/sync/syncstate.d.ts +14 -5
- package/dist/sync/syncstate.d.ts.map +1 -1
- package/dist/sync/syncstate.js +25 -12
- package/dist/sync/syncstate.js.map +1 -1
- package/dist/sync/syncstate.test.js +20 -21
- package/dist/sync/syncstate.test.js.map +1 -1
- package/dist/sync/validate-push-payload.d.ts +2 -2
- package/dist/sync/validate-push-payload.js +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +0 -1
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +6 -5
- package/src/ClientSessionLeaderThreadProxy.ts +40 -0
- package/src/__tests__/fixture.ts +2 -2
- package/src/adapter-types.ts +21 -167
- package/src/debug-info.ts +2 -2
- package/src/defs.ts +17 -0
- package/src/devtools/devtools-messages-client-session.ts +4 -4
- package/src/devtools/devtools-messages-common.ts +1 -1
- package/src/devtools/devtools-messages-leader.ts +4 -4
- package/src/devtools/devtools-messages.ts +3 -3
- package/src/devtools/mod.ts +3 -3
- package/src/errors.ts +49 -0
- package/src/index.ts +16 -16
- package/src/leader-thread/LeaderSyncProcessor.ts +154 -193
- package/src/leader-thread/connection.ts +5 -5
- package/src/leader-thread/eventlog.ts +89 -67
- package/src/leader-thread/leader-worker-devtools.ts +5 -6
- package/src/leader-thread/make-leader-thread-layer.ts +64 -20
- package/src/leader-thread/materialize-event.ts +17 -10
- package/src/leader-thread/mod.ts +8 -7
- package/src/leader-thread/recreate-db.ts +101 -93
- package/src/leader-thread/shutdown-channel.ts +1 -1
- package/src/leader-thread/types.ts +10 -15
- package/src/make-client-session.ts +5 -6
- package/src/materializer-helper.ts +11 -11
- package/src/rematerialize-from-eventlog.ts +16 -8
- package/src/schema/EventDef.ts +8 -6
- package/src/schema/EventSequenceNumber.test.ts +121 -4
- package/src/schema/EventSequenceNumber.ts +95 -23
- package/src/schema/LiveStoreEvent.ts +23 -7
- package/src/schema/events.ts +1 -1
- package/src/schema/mod.ts +9 -9
- package/src/schema/schema.ts +7 -7
- package/src/schema/state/mod.ts +2 -2
- package/src/schema/state/sqlite/client-document-def.test.ts +9 -7
- package/src/schema/state/sqlite/client-document-def.ts +45 -33
- package/src/schema/state/sqlite/db-schema/ast/sqlite.ts +1 -1
- package/src/schema/state/sqlite/db-schema/ast/validate.ts +1 -1
- package/src/schema/state/sqlite/db-schema/dsl/field-defs.test.ts +1 -1
- package/src/schema/state/sqlite/db-schema/dsl/field-defs.ts +2 -2
- package/src/schema/state/sqlite/db-schema/dsl/mod.ts +19 -13
- package/src/schema/state/sqlite/db-schema/hash.ts +3 -4
- package/src/schema/state/sqlite/db-schema/mod.ts +2 -2
- package/src/schema/state/sqlite/mod.ts +13 -13
- package/src/schema/state/sqlite/query-builder/api.ts +43 -13
- package/src/schema/state/sqlite/query-builder/astToSql.ts +4 -4
- package/src/schema/state/sqlite/query-builder/impl.test.ts +63 -23
- package/src/schema/state/sqlite/query-builder/impl.ts +23 -28
- package/src/schema/state/sqlite/query-builder/mod.ts +2 -2
- package/src/schema/state/sqlite/schema-helpers.ts +2 -2
- package/src/schema/state/sqlite/system-tables.ts +12 -25
- package/src/schema/state/sqlite/table-def.ts +4 -4
- package/src/schema-management/common.ts +3 -3
- package/src/schema-management/migrations.ts +11 -9
- package/src/schema-management/validate-schema.ts +4 -4
- package/src/sql-queries/index.ts +3 -3
- package/src/sql-queries/sql-queries.ts +6 -4
- package/src/sql-queries/sql-query-builder.ts +4 -4
- package/src/sql-queries/types.ts +1 -1
- package/src/sqlite-db-helper.ts +3 -3
- package/src/sqlite-types.ts +76 -0
- package/src/sync/ClientSessionSyncProcessor.ts +65 -30
- package/src/sync/index.ts +3 -3
- package/src/sync/next/compact-events.ts +5 -5
- package/src/sync/next/facts.ts +4 -4
- package/src/sync/next/graphology.ts +3 -11
- package/src/sync/next/graphology_.ts +1 -1
- package/src/sync/next/history-dag-common.ts +3 -3
- package/src/sync/next/history-dag.ts +3 -3
- package/src/sync/next/mod.ts +5 -5
- package/src/sync/next/rebase-events.ts +7 -6
- package/src/sync/next/test/compact-events.calculator.test.ts +4 -4
- package/src/sync/next/test/compact-events.test.ts +6 -6
- package/src/sync/next/test/event-fixtures.ts +19 -10
- package/src/sync/next/test/mod.ts +1 -1
- package/src/sync/sync.ts +7 -4
- package/src/sync/syncstate.test.ts +25 -22
- package/src/sync/syncstate.ts +33 -12
- package/src/sync/validate-push-payload.ts +2 -2
- package/src/util.ts +0 -1
- package/src/version.ts +1 -1
@@ -1,9 +1,9 @@
|
|
1
1
|
import { Schema } from '@livestore/utils/effect'
|
2
2
|
import { describe, expect, test } from 'vitest'
|
3
3
|
|
4
|
-
import { tables } from '../../../__tests__/fixture.
|
5
|
-
import type * as LiveStoreEvent from '../../LiveStoreEvent.
|
6
|
-
import {
|
4
|
+
import { tables } from '../../../__tests__/fixture.ts'
|
5
|
+
import type * as LiveStoreEvent from '../../LiveStoreEvent.ts'
|
6
|
+
import { ClientDocumentTableDefSymbol, clientDocument } from './client-document-def.ts'
|
7
7
|
|
8
8
|
describe('client document table', () => {
|
9
9
|
test('set event', () => {
|
@@ -70,8 +70,9 @@ describe('client document table', () => {
|
|
70
70
|
})
|
71
71
|
|
72
72
|
test('struct value (partial set=true)', () => {
|
73
|
-
expect(
|
74
|
-
.
|
73
|
+
expect(
|
74
|
+
forSchema(Schema.Struct({ a: Schema.String }), { a: 'hello' }, 'id1', { partialSet: true }),
|
75
|
+
).toMatchInlineSnapshot(`
|
75
76
|
{
|
76
77
|
"bindValues": [
|
77
78
|
"id1",
|
@@ -92,8 +93,9 @@ describe('client document table', () => {
|
|
92
93
|
})
|
93
94
|
|
94
95
|
test('struct value (partial set=false)', () => {
|
95
|
-
expect(
|
96
|
-
.
|
96
|
+
expect(
|
97
|
+
forSchema(Schema.Struct({ a: Schema.String }), { a: 'hello' }, 'id1', { partialSet: false }),
|
98
|
+
).toMatchInlineSnapshot(`
|
97
99
|
{
|
98
100
|
"bindValues": [
|
99
101
|
"id1",
|
@@ -2,15 +2,15 @@ import { shouldNeverHappen } from '@livestore/utils'
|
|
2
2
|
import type { Option, Types } from '@livestore/utils/effect'
|
3
3
|
import { Schema, SchemaAST } from '@livestore/utils/effect'
|
4
4
|
|
5
|
-
import { SessionIdSymbol } from '../../../adapter-types.
|
6
|
-
import { sql } from '../../../util.
|
7
|
-
import type { EventDef, Materializer } from '../../EventDef.
|
8
|
-
import { defineEvent, defineMaterializer } from '../../EventDef.
|
9
|
-
import { SqliteDsl } from './db-schema/mod.
|
10
|
-
import type { QueryBuilder, QueryBuilderAst } from './query-builder/mod.
|
11
|
-
import { QueryBuilderAstSymbol, QueryBuilderTypeId } from './query-builder/mod.
|
12
|
-
import type { TableDef, TableDefBase } from './table-def.
|
13
|
-
import { table } from './table-def.
|
5
|
+
import { SessionIdSymbol } from '../../../adapter-types.ts'
|
6
|
+
import { sql } from '../../../util.ts'
|
7
|
+
import type { EventDef, Materializer } from '../../EventDef.ts'
|
8
|
+
import { defineEvent, defineMaterializer } from '../../EventDef.ts'
|
9
|
+
import { SqliteDsl } from './db-schema/mod.ts'
|
10
|
+
import type { QueryBuilder, QueryBuilderAst } from './query-builder/mod.ts'
|
11
|
+
import { QueryBuilderAstSymbol, QueryBuilderTypeId } from './query-builder/mod.ts'
|
12
|
+
import type { TableDef, TableDefBase } from './table-def.ts'
|
13
|
+
import { table } from './table-def.ts'
|
14
14
|
|
15
15
|
/**
|
16
16
|
* Special:
|
@@ -386,37 +386,49 @@ export namespace ClientDocumentTableDef {
|
|
386
386
|
}
|
387
387
|
}
|
388
388
|
|
389
|
-
export type GetOptions<TTableDef extends TraitAny> =
|
390
|
-
|
389
|
+
export type GetOptions<TTableDef extends TraitAny> = TTableDef extends ClientDocumentTableDef.Trait<
|
390
|
+
any,
|
391
|
+
any,
|
392
|
+
any,
|
393
|
+
infer TOptions
|
394
|
+
>
|
395
|
+
? TOptions
|
396
|
+
: never
|
391
397
|
|
392
398
|
export type TraitAny = Trait<any, any, any, any>
|
393
399
|
|
394
|
-
export type DefaultIdType<TTableDef extends TraitAny> =
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
400
|
+
export type DefaultIdType<TTableDef extends TraitAny> = TTableDef extends ClientDocumentTableDef.Trait<
|
401
|
+
any,
|
402
|
+
any,
|
403
|
+
any,
|
404
|
+
infer TOptions
|
405
|
+
>
|
406
|
+
? TOptions['default']['id'] extends SessionIdSymbol | string
|
407
|
+
? TOptions['default']['id']
|
399
408
|
: never
|
409
|
+
: never
|
400
410
|
|
401
|
-
export type SetEventDefLike<
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
411
|
+
export type SetEventDefLike<
|
412
|
+
TName extends string,
|
413
|
+
TType,
|
414
|
+
TOptions extends ClientDocumentTableOptions<TType>,
|
415
|
+
> = (TOptions['default']['id'] extends undefined // Helper to create partial event
|
416
|
+
? (
|
417
|
+
args: TOptions['partialSet'] extends false ? TType : Partial<TType>,
|
418
|
+
id: string | SessionIdSymbol,
|
419
|
+
) => { name: `${TName}Set`; args: { id: string; value: TType } }
|
420
|
+
: (
|
421
|
+
args: TOptions['partialSet'] extends false ? TType : Partial<TType>,
|
422
|
+
id?: string | SessionIdSymbol,
|
423
|
+
) => { name: `${TName}Set`; args: { id: string; value: TType } }) & {
|
424
|
+
readonly name: `${TName}Set`
|
425
|
+
readonly schema: Schema.Schema<any>
|
426
|
+
readonly Event: {
|
412
427
|
readonly name: `${TName}Set`
|
413
|
-
readonly
|
414
|
-
readonly Event: {
|
415
|
-
readonly name: `${TName}Set`
|
416
|
-
readonly args: { id: string; value: TType }
|
417
|
-
}
|
418
|
-
readonly options: { derived: true; clientOnly: true; facts: undefined }
|
428
|
+
readonly args: { id: string; value: TType }
|
419
429
|
}
|
430
|
+
readonly options: { derived: true; clientOnly: true; facts: undefined }
|
431
|
+
}
|
420
432
|
|
421
433
|
export type SetEventDef<TName extends string, TType, TOptions extends ClientDocumentTableOptions<TType>> = EventDef<
|
422
434
|
TName,
|
@@ -17,7 +17,7 @@ export const isColumnDefinition = (value: unknown): value is ColumnDefinition<an
|
|
17
17
|
typeof value === 'object' &&
|
18
18
|
value !== null &&
|
19
19
|
'columnType' in value &&
|
20
|
-
validColumnTypes.includes(value
|
20
|
+
validColumnTypes.includes(value.columnType as any)
|
21
21
|
)
|
22
22
|
}
|
23
23
|
|
@@ -36,7 +36,7 @@ export type SqlDefaultValue = {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
export const isSqlDefaultValue = (value: unknown): value is SqlDefaultValue => {
|
39
|
-
return typeof value === 'object' && value !== null && 'sql' in value && typeof value
|
39
|
+
return typeof value === 'object' && value !== null && 'sql' in value && typeof value.sql === 'string'
|
40
40
|
}
|
41
41
|
|
42
42
|
export type ColDefFn<TColumnType extends FieldColumnType> = {
|
@@ -2,10 +2,10 @@ import type { Nullable } from '@livestore/utils'
|
|
2
2
|
import type { Option, Types } from '@livestore/utils/effect'
|
3
3
|
import { Schema } from '@livestore/utils/effect'
|
4
4
|
|
5
|
-
import type * as SqliteAst from '../ast/sqlite.
|
6
|
-
import type { ColumnDefinition } from './field-defs.
|
5
|
+
import type * as SqliteAst from '../ast/sqlite.ts'
|
6
|
+
import type { ColumnDefinition } from './field-defs.ts'
|
7
7
|
|
8
|
-
export * from './field-defs.
|
8
|
+
export * from './field-defs.ts'
|
9
9
|
|
10
10
|
export type DbSchema = {
|
11
11
|
[key: string]: TableDefinition<string, Columns>
|
@@ -19,12 +19,13 @@ export type DbSchemaInput = Record<string, TableDefinition<any, any>> | Readonly
|
|
19
19
|
* - array: we use the table name of each array item (= table definition) as the object key
|
20
20
|
* - object: we discard the keys of the input object and use the table name of each object value (= table definition) as the new object key
|
21
21
|
*/
|
22
|
-
export type DbSchemaFromInputSchema<TSchemaInput extends DbSchemaInput> =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
export type DbSchemaFromInputSchema<TSchemaInput extends DbSchemaInput> = TSchemaInput extends ReadonlyArray<
|
23
|
+
TableDefinition<any, any>
|
24
|
+
>
|
25
|
+
? { [K in TSchemaInput[number] as K['name']]: K }
|
26
|
+
: TSchemaInput extends Record<string, TableDefinition<any, any>>
|
27
|
+
? { [K in keyof TSchemaInput as TSchemaInput[K]['name']]: TSchemaInput[K] }
|
28
|
+
: never
|
28
29
|
|
29
30
|
// TODO ensure via runtime check (possibly even via type-level check) that all index names are unique
|
30
31
|
export const makeDbSchema = <TDbSchemaInput extends DbSchemaInput>(
|
@@ -113,8 +114,12 @@ export type TableDefinition<TName extends string, TColumns extends Columns> = {
|
|
113
114
|
|
114
115
|
export type Columns = Record<string, ColumnDefinition<any, any>>
|
115
116
|
|
116
|
-
export type IsSingleColumn<TColumns extends Columns | ColumnDefinition<any, any>> =
|
117
|
-
|
117
|
+
export type IsSingleColumn<TColumns extends Columns | ColumnDefinition<any, any>> = TColumns extends ColumnDefinition<
|
118
|
+
any,
|
119
|
+
any
|
120
|
+
>
|
121
|
+
? true
|
122
|
+
: false
|
118
123
|
|
119
124
|
/**
|
120
125
|
* NOTE this is only needed to avoid a TS limitation where `StructSchemaForColumns` in the default case
|
@@ -207,8 +212,9 @@ export namespace FromColumns {
|
|
207
212
|
|
208
213
|
export type RequiredInsertColumnNames<TColumns extends Columns> = keyof RequiredInsertColumns<TColumns>
|
209
214
|
|
210
|
-
export type RequiresInsertValues<TColumns extends Columns> =
|
211
|
-
|
215
|
+
export type RequiresInsertValues<TColumns extends Columns> = RequiredInsertColumnNames<TColumns> extends never
|
216
|
+
? false
|
217
|
+
: true
|
212
218
|
|
213
219
|
export type InsertRowDecoded<TColumns extends Columns> = Types.Simplify<
|
214
220
|
Pick<RowDecodedAll<TColumns>, RequiredInsertColumnNames<TColumns>> &
|
@@ -1,11 +1,10 @@
|
|
1
1
|
// Based on https://stackoverflow.com/a/7616484
|
2
2
|
export const hashCode = (str: string) => {
|
3
|
-
let hash = 0
|
4
|
-
|
5
|
-
|
3
|
+
let hash = 0
|
4
|
+
let i: number
|
5
|
+
let chr: number
|
6
6
|
if (str.length === 0) return hash
|
7
7
|
for (i = 0; i < str.length; i++) {
|
8
|
-
// eslint-disable-next-line unicorn/prefer-code-point
|
9
8
|
chr = str.charCodeAt(i)
|
10
9
|
hash = (hash << 5) - hash + chr
|
11
10
|
hash = Math.trunc(hash) // Convert to 32bit integer
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * as
|
2
|
-
export * as
|
1
|
+
export * as SqliteAst from './ast/sqlite.ts'
|
2
|
+
export * as SqliteDsl from './dsl/mod.ts'
|
@@ -1,22 +1,22 @@
|
|
1
1
|
import { shouldNeverHappen } from '@livestore/utils'
|
2
2
|
|
3
|
-
import type { MigrationOptions } from '../../../adapter-types.
|
4
|
-
import { type Materializer, rawSqlEvent, rawSqlMaterializer } from '../../EventDef.
|
5
|
-
import type { InternalState } from '../../schema.
|
6
|
-
import { ClientDocumentTableDefSymbol, tableIsClientDocumentTable } from './client-document-def.
|
7
|
-
import { SqliteAst } from './db-schema/mod.
|
8
|
-
import { stateSystemTables } from './system-tables.
|
9
|
-
import {
|
3
|
+
import type { MigrationOptions } from '../../../adapter-types.ts'
|
4
|
+
import { type Materializer, rawSqlEvent, rawSqlMaterializer } from '../../EventDef.ts'
|
5
|
+
import type { InternalState } from '../../schema.ts'
|
6
|
+
import { ClientDocumentTableDefSymbol, tableIsClientDocumentTable } from './client-document-def.ts'
|
7
|
+
import { SqliteAst } from './db-schema/mod.ts'
|
8
|
+
import { stateSystemTables } from './system-tables.ts'
|
9
|
+
import type { TableDef, TableDefBase } from './table-def.ts'
|
10
10
|
|
11
|
-
export * from '
|
11
|
+
export * from '../../EventDef.ts'
|
12
12
|
export {
|
13
|
-
ClientDocumentTableDefSymbol,
|
14
|
-
tableIsClientDocumentTable,
|
15
|
-
clientDocument,
|
16
13
|
type ClientDocumentTableDef,
|
14
|
+
ClientDocumentTableDefSymbol,
|
17
15
|
type ClientDocumentTableOptions,
|
18
|
-
|
19
|
-
|
16
|
+
clientDocument,
|
17
|
+
tableIsClientDocumentTable,
|
18
|
+
} from './client-document-def.ts'
|
19
|
+
export * from './table-def.ts'
|
20
20
|
|
21
21
|
export const makeState = <TStateInput extends InputState>(inputSchema: TStateInput): InternalState => {
|
22
22
|
const inputTables: ReadonlyArray<TableDef> = Array.isArray(inputSchema.tables)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import type { GetValForKey, SingleOrReadonlyArray } from '@livestore/utils'
|
2
2
|
import { type Option, Predicate, type Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import type { SessionIdSymbol } from '../../../../adapter-types.
|
5
|
-
import type { SqlValue } from '../../../../util.
|
6
|
-
import type { ClientDocumentTableDef } from '../client-document-def.
|
7
|
-
import type { SqliteDsl } from '../db-schema/mod.
|
8
|
-
import type { TableDefBase } from '../table-def.
|
4
|
+
import type { SessionIdSymbol } from '../../../../adapter-types.ts'
|
5
|
+
import type { SqlValue } from '../../../../util.ts'
|
6
|
+
import type { ClientDocumentTableDef } from '../client-document-def.ts'
|
7
|
+
import type { SqliteDsl } from '../db-schema/mod.ts'
|
8
|
+
import type { TableDefBase } from '../table-def.ts'
|
9
9
|
|
10
10
|
export type QueryBuilderAst =
|
11
11
|
| QueryBuilderAst.SelectQuery
|
@@ -19,7 +19,11 @@ export namespace QueryBuilderAst {
|
|
19
19
|
export interface SelectQuery {
|
20
20
|
readonly _tag: 'SelectQuery'
|
21
21
|
readonly columns: string[]
|
22
|
-
readonly pickFirst:
|
22
|
+
readonly pickFirst:
|
23
|
+
| { _tag: 'disabled' }
|
24
|
+
| { _tag: 'enabled'; behaviour: 'undefined' }
|
25
|
+
| { _tag: 'enabled'; behaviour: 'error' }
|
26
|
+
| { _tag: 'enabled'; behaviour: 'fallback'; fallback: () => any }
|
23
27
|
readonly select: {
|
24
28
|
columns: ReadonlyArray<string>
|
25
29
|
}
|
@@ -167,6 +171,21 @@ export namespace QueryBuilder {
|
|
167
171
|
direction: 'asc' | 'desc'
|
168
172
|
}>
|
169
173
|
|
174
|
+
export type FirstQueryBehaviour<TResult, TFallback> =
|
175
|
+
| {
|
176
|
+
/** Will error if no matching row was found */
|
177
|
+
behaviour: 'error'
|
178
|
+
}
|
179
|
+
| {
|
180
|
+
/** Will return `undefined` if no matching row was found */
|
181
|
+
behaviour: 'undefined'
|
182
|
+
}
|
183
|
+
| {
|
184
|
+
/** Will return a fallback value if no matching row was found */
|
185
|
+
behaviour: 'fallback'
|
186
|
+
fallback: () => TResult | TFallback
|
187
|
+
}
|
188
|
+
|
170
189
|
export type ApiFull<TResult, TTableDef extends TableDefBase, TWithout extends ApiFeature> = {
|
171
190
|
/**
|
172
191
|
* `SELECT *` is the default
|
@@ -285,16 +304,27 @@ export namespace QueryBuilder {
|
|
285
304
|
* Example:
|
286
305
|
* ```ts
|
287
306
|
* db.todos.first()
|
288
|
-
* db.todos.where('id', '123').first()
|
307
|
+
* db.todos.where('id', '123').first() // will return `undefined` if no rows are returned
|
308
|
+
* db.todos.where('id', '123').first({ behaviour: 'error' }) // will throw if no rows are returned
|
309
|
+
* db.todos.first({ behaviour: 'fallback', fallback: () => ({ id: '123', text: 'Buy milk', status: 'active' }) })
|
289
310
|
* ```
|
290
311
|
*
|
291
|
-
*
|
312
|
+
* Behaviour:
|
313
|
+
* - `undefined`: Will return `undefined` if no rows are returned (default behaviour)
|
314
|
+
* - `error`: Will throw if no rows are returned
|
315
|
+
* - `fallback`: Will return a fallback value if no rows are returned
|
292
316
|
*/
|
293
|
-
readonly first: <
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
317
|
+
readonly first: <
|
318
|
+
TBehaviour extends QueryBuilder.FirstQueryBehaviour<GetSingle<TResult>, TFallback>,
|
319
|
+
TFallback = never,
|
320
|
+
>(
|
321
|
+
behaviour?: QueryBuilder.FirstQueryBehaviour<GetSingle<TResult>, TFallback> & TBehaviour,
|
322
|
+
) => QueryBuilder<
|
323
|
+
TBehaviour extends { behaviour: 'fallback' }
|
324
|
+
? ReturnType<TBehaviour['fallback']> | GetSingle<TResult>
|
325
|
+
: TBehaviour extends { behaviour: 'undefined' }
|
326
|
+
? undefined | GetSingle<TResult>
|
327
|
+
: GetSingle<TResult>,
|
298
328
|
TTableDef,
|
299
329
|
TWithout | 'row' | 'first' | 'orderBy' | 'select' | 'limit' | 'offset' | 'where' | 'returning' | 'onConflict'
|
300
330
|
>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { shouldNeverHappen } from '@livestore/utils'
|
2
2
|
import { Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import { SessionIdSymbol } from '../../../../adapter-types.
|
5
|
-
import type { SqlValue } from '../../../../util.
|
6
|
-
import type { State } from '../../../mod.
|
7
|
-
import type { QueryBuilderAst } from './api.
|
4
|
+
import { SessionIdSymbol } from '../../../../adapter-types.ts'
|
5
|
+
import type { SqlValue } from '../../../../util.ts'
|
6
|
+
import type { State } from '../../../mod.ts'
|
7
|
+
import type { QueryBuilderAst } from './api.ts'
|
8
8
|
|
9
9
|
// Helper functions for SQL generation
|
10
10
|
const formatWhereClause = (
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { Schema } from '@livestore/utils/effect'
|
2
2
|
import { describe, expect, it } from 'vitest'
|
3
3
|
|
4
|
-
import { State } from '../../../mod.
|
5
|
-
import type { QueryBuilder } from './api.
|
6
|
-
import { getResultSchema } from './impl.
|
4
|
+
import { State } from '../../../mod.ts'
|
5
|
+
import type { QueryBuilder } from './api.ts'
|
6
|
+
import { getResultSchema } from './impl.ts'
|
7
7
|
|
8
8
|
const todos = State.SQLite.table({
|
9
9
|
name: 'todos',
|
@@ -55,7 +55,7 @@ const UiStateWithDefaultId = State.SQLite.clientDocument({
|
|
55
55
|
},
|
56
56
|
})
|
57
57
|
|
58
|
-
|
58
|
+
const issue = State.SQLite.table({
|
59
59
|
name: 'issue',
|
60
60
|
columns: {
|
61
61
|
id: State.SQLite.integer({ primaryKey: true }),
|
@@ -111,6 +111,16 @@ describe('query builder', () => {
|
|
111
111
|
|
112
112
|
it('should handle .first()', () => {
|
113
113
|
expect(dump(db.todos.select('id', 'text').first())).toMatchInlineSnapshot(`
|
114
|
+
{
|
115
|
+
"bindValues": [
|
116
|
+
1,
|
117
|
+
],
|
118
|
+
"query": "SELECT id, text FROM 'todos' LIMIT ?",
|
119
|
+
"schema": "(ReadonlyArray<{ readonly id: string; readonly text: string } | undefined> <-> { readonly id: string; readonly text: string } | undefined)",
|
120
|
+
}
|
121
|
+
`)
|
122
|
+
|
123
|
+
expect(dump(db.todos.select('id', 'text').first({ behaviour: 'error' }))).toMatchInlineSnapshot(`
|
114
124
|
{
|
115
125
|
"bindValues": [
|
116
126
|
1,
|
@@ -120,7 +130,9 @@ describe('query builder', () => {
|
|
120
130
|
}
|
121
131
|
`)
|
122
132
|
|
123
|
-
expect(
|
133
|
+
expect(
|
134
|
+
dump(db.todos.select('id', 'text').first({ behaviour: 'fallback', fallback: () => undefined })),
|
135
|
+
).toMatchInlineSnapshot(`
|
124
136
|
{
|
125
137
|
"bindValues": [
|
126
138
|
1,
|
@@ -166,8 +178,9 @@ describe('query builder', () => {
|
|
166
178
|
"schema": "ReadonlyArray<{ readonly id: string; readonly text: string }>",
|
167
179
|
}
|
168
180
|
`)
|
169
|
-
expect(
|
170
|
-
.
|
181
|
+
expect(
|
182
|
+
dump(db.todos.select('id', 'text').where({ deletedAt: { op: '<=', value: new Date('2024-01-01') } })),
|
183
|
+
).toMatchInlineSnapshot(`
|
171
184
|
{
|
172
185
|
"bindValues": [
|
173
186
|
"2024-01-01T00:00:00.000Z",
|
@@ -176,8 +189,9 @@ describe('query builder', () => {
|
|
176
189
|
"schema": "ReadonlyArray<{ readonly id: string; readonly text: string }>",
|
177
190
|
}
|
178
191
|
`)
|
179
|
-
expect(
|
180
|
-
.
|
192
|
+
expect(
|
193
|
+
dump(db.todos.select('id', 'text').where({ status: { op: 'IN', value: ['active'] } })),
|
194
|
+
).toMatchInlineSnapshot(`
|
181
195
|
{
|
182
196
|
"bindValues": [
|
183
197
|
"active",
|
@@ -186,8 +200,9 @@ describe('query builder', () => {
|
|
186
200
|
"schema": "ReadonlyArray<{ readonly id: string; readonly text: string }>",
|
187
201
|
}
|
188
202
|
`)
|
189
|
-
expect(
|
190
|
-
.
|
203
|
+
expect(
|
204
|
+
dump(db.todos.select('id', 'text').where({ status: { op: 'NOT IN', value: ['active', 'completed'] } })),
|
205
|
+
).toMatchInlineSnapshot(`
|
191
206
|
{
|
192
207
|
"bindValues": [
|
193
208
|
"active",
|
@@ -197,6 +212,25 @@ describe('query builder', () => {
|
|
197
212
|
"schema": "ReadonlyArray<{ readonly id: string; readonly text: string }>",
|
198
213
|
}
|
199
214
|
`)
|
215
|
+
|
216
|
+
expect(
|
217
|
+
dump(
|
218
|
+
db.todos
|
219
|
+
.select('id', 'text')
|
220
|
+
.where({ completed: false })
|
221
|
+
.where({ status: { op: 'IN', value: ['active'] } })
|
222
|
+
.where({ deletedAt: undefined }),
|
223
|
+
),
|
224
|
+
).toMatchInlineSnapshot(`
|
225
|
+
{
|
226
|
+
"bindValues": [
|
227
|
+
0,
|
228
|
+
"active",
|
229
|
+
],
|
230
|
+
"query": "SELECT id, text FROM 'todos' WHERE completed = ? AND status IN (?)",
|
231
|
+
"schema": "ReadonlyArray<{ readonly id: string; readonly text: string }>",
|
232
|
+
}
|
233
|
+
`)
|
200
234
|
})
|
201
235
|
|
202
236
|
it('should handle OFFSET and LIMIT clauses', () => {
|
@@ -375,8 +409,9 @@ describe('query builder', () => {
|
|
375
409
|
})
|
376
410
|
|
377
411
|
it('should handle INSERT queries with undefined values', () => {
|
378
|
-
expect(
|
379
|
-
.
|
412
|
+
expect(
|
413
|
+
dump(db.todos.insert({ id: '123', text: 'Buy milk', status: 'active', completed: undefined })),
|
414
|
+
).toMatchInlineSnapshot(`
|
380
415
|
{
|
381
416
|
"bindValues": [
|
382
417
|
"123",
|
@@ -443,8 +478,9 @@ describe('query builder', () => {
|
|
443
478
|
})
|
444
479
|
|
445
480
|
it('should handle UPDATE queries with undefined values', () => {
|
446
|
-
expect(
|
447
|
-
.
|
481
|
+
expect(
|
482
|
+
dump(db.todos.update({ status: undefined, text: 'some text' }).where({ id: '123' })),
|
483
|
+
).toMatchInlineSnapshot(`
|
448
484
|
{
|
449
485
|
"bindValues": [
|
450
486
|
"some text",
|
@@ -483,8 +519,9 @@ describe('query builder', () => {
|
|
483
519
|
})
|
484
520
|
|
485
521
|
it('should handle INSERT with ON CONFLICT', () => {
|
486
|
-
expect(
|
487
|
-
.
|
522
|
+
expect(
|
523
|
+
dump(db.todos.insert({ id: '123', text: 'Buy milk', status: 'active' }).onConflict('id', 'ignore')),
|
524
|
+
).toMatchInlineSnapshot(`
|
488
525
|
{
|
489
526
|
"bindValues": [
|
490
527
|
"123",
|
@@ -516,8 +553,9 @@ describe('query builder', () => {
|
|
516
553
|
}
|
517
554
|
`)
|
518
555
|
|
519
|
-
expect(
|
520
|
-
.
|
556
|
+
expect(
|
557
|
+
dump(db.todos.insert({ id: '123', text: 'Buy milk', status: 'active' }).onConflict('id', 'replace')),
|
558
|
+
).toMatchInlineSnapshot(`
|
521
559
|
{
|
522
560
|
"bindValues": [
|
523
561
|
"123",
|
@@ -547,8 +585,9 @@ describe('query builder', () => {
|
|
547
585
|
})
|
548
586
|
|
549
587
|
it('should handle RETURNING clause', () => {
|
550
|
-
expect(
|
551
|
-
.
|
588
|
+
expect(
|
589
|
+
dump(db.todos.insert({ id: '123', text: 'Buy milk', status: 'active' }).returning('id')),
|
590
|
+
).toMatchInlineSnapshot(`
|
552
591
|
{
|
553
592
|
"bindValues": [
|
554
593
|
"123",
|
@@ -560,8 +599,9 @@ describe('query builder', () => {
|
|
560
599
|
}
|
561
600
|
`)
|
562
601
|
|
563
|
-
expect(
|
564
|
-
.
|
602
|
+
expect(
|
603
|
+
dump(db.todos.update({ status: 'completed' }).where({ id: '123' }).returning('id')),
|
604
|
+
).toMatchInlineSnapshot(`
|
565
605
|
{
|
566
606
|
"bindValues": [
|
567
607
|
"completed",
|