@livestore/common 0.3.2-dev.0 → 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 +7 -7
- package/dist/__tests__/fixture.d.ts +4 -4
- package/dist/__tests__/fixture.js +2 -2
- package/dist/adapter-types.d.ts +9 -9
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js +4 -4
- 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/devtools/devtools-messages-client-session.d.ts +27 -27
- 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.js +1 -1
- package/dist/devtools/devtools-messages-leader.d.ts +35 -35
- 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/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 +5 -5
- package/dist/leader-thread/LeaderSyncProcessor.js +11 -11
- 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 +7 -7
- package/dist/leader-thread/eventlog.js +8 -8
- 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.js +3 -3
- package/dist/leader-thread/make-leader-thread-layer.d.ts +7 -7
- package/dist/leader-thread/make-leader-thread-layer.js +10 -10
- package/dist/leader-thread/materialize-event.d.ts +4 -4
- package/dist/leader-thread/materialize-event.js +7 -7
- package/dist/leader-thread/mod.d.ts +8 -8
- package/dist/leader-thread/mod.d.ts.map +1 -1
- package/dist/leader-thread/mod.js +8 -8
- package/dist/leader-thread/mod.js.map +1 -1
- package/dist/leader-thread/recreate-db.d.ts +5 -5
- package/dist/leader-thread/recreate-db.js +2 -2
- 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 +6 -6
- package/dist/make-client-session.d.ts +2 -2
- package/dist/make-client-session.d.ts.map +1 -1
- package/dist/make-client-session.js +2 -2
- 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.js +3 -3
- package/dist/schema/EventDef.d.ts +3 -3
- package/dist/schema/EventSequenceNumber.test.js +1 -1
- package/dist/schema/LiveStoreEvent.d.ts +5 -5
- package/dist/schema/LiveStoreEvent.js +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.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 +0 -1
- 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 +5 -5
- 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 +4 -14
- package/dist/schema/state/sqlite/query-builder/impl.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.test.js +3 -3
- 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 +10 -10
- package/dist/schema/state/sqlite/system-tables.js +3 -3
- package/dist/schema/state/sqlite/table-def.d.ts +2 -2
- 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 -6
- package/dist/schema-management/migrations.js +5 -5
- 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.js +3 -3
- 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 +4 -4
- package/dist/sync/ClientSessionSyncProcessor.d.ts +17 -6
- package/dist/sync/ClientSessionSyncProcessor.d.ts.map +1 -1
- package/dist/sync/ClientSessionSyncProcessor.js +30 -11
- 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.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 +2 -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 +4 -4
- package/dist/sync/next/test/event-fixtures.d.ts +3 -3
- package/dist/sync/next/test/event-fixtures.js +5 -5
- 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 +4 -4
- package/dist/sync/sync.js +1 -1
- package/dist/sync/syncstate.d.ts +1 -1
- package/dist/sync/syncstate.js +2 -2
- package/dist/sync/syncstate.test.js +3 -4
- 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.js +1 -1
- package/package.json +6 -6
- package/src/ClientSessionLeaderThreadProxy.ts +7 -7
- package/src/__tests__/fixture.ts +2 -2
- package/src/adapter-types.ts +10 -9
- package/src/debug-info.ts +2 -2
- 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/index.ts +16 -16
- package/src/leader-thread/LeaderSyncProcessor.ts +14 -14
- package/src/leader-thread/connection.ts +5 -5
- package/src/leader-thread/eventlog.ts +12 -12
- package/src/leader-thread/leader-worker-devtools.ts +4 -4
- package/src/leader-thread/make-leader-thread-layer.ts +16 -16
- package/src/leader-thread/materialize-event.ts +9 -9
- package/src/leader-thread/mod.ts +8 -8
- package/src/leader-thread/recreate-db.ts +6 -6
- package/src/leader-thread/shutdown-channel.ts +1 -1
- package/src/leader-thread/types.ts +6 -6
- package/src/make-client-session.ts +3 -4
- package/src/materializer-helper.ts +11 -11
- package/src/rematerialize-from-eventlog.ts +6 -6
- package/src/schema/EventDef.ts +3 -3
- package/src/schema/EventSequenceNumber.test.ts +1 -1
- package/src/schema/LiveStoreEvent.ts +3 -3
- 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/mod.ts +19 -13
- package/src/schema/state/sqlite/db-schema/hash.ts +0 -1
- 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 +5 -5
- package/src/schema/state/sqlite/query-builder/astToSql.ts +4 -4
- package/src/schema/state/sqlite/query-builder/impl.test.ts +4 -4
- package/src/schema/state/sqlite/query-builder/impl.ts +8 -16
- 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 +3 -3
- package/src/schema/state/sqlite/table-def.ts +3 -3
- package/src/schema-management/common.ts +3 -3
- package/src/schema-management/migrations.ts +11 -11
- package/src/schema-management/validate-schema.ts +4 -4
- package/src/sql-queries/index.ts +3 -3
- package/src/sql-queries/sql-queries.ts +4 -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 +4 -4
- package/src/sync/ClientSessionSyncProcessor.ts +50 -12
- 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 +2 -4
- 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 +6 -6
- package/src/sync/next/test/compact-events.calculator.test.ts +4 -4
- package/src/sync/next/test/compact-events.test.ts +5 -5
- package/src/sync/next/test/event-fixtures.ts +7 -7
- package/src/sync/next/test/mod.ts +1 -1
- package/src/sync/sync.ts +4 -4
- package/src/sync/syncstate.test.ts +9 -6
- package/src/sync/syncstate.ts +2 -2
- 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, Transferable } from '@livestore/utils/effect'
|
2
2
|
|
3
|
-
import * as LiveStoreEvent from '../schema/LiveStoreEvent.
|
4
|
-
import { EventSequenceNumber } from '../schema/mod.
|
5
|
-
import * as SyncState from '../sync/syncstate.
|
6
|
-
import { LeaderReqResMessage, LSDMessage, LSDReqResMessage, NetworkStatus } from './devtools-messages-common.
|
3
|
+
import * as LiveStoreEvent from '../schema/LiveStoreEvent.ts'
|
4
|
+
import { EventSequenceNumber } from '../schema/mod.ts'
|
5
|
+
import * as SyncState from '../sync/syncstate.ts'
|
6
|
+
import { LeaderReqResMessage, LSDMessage, LSDReqResMessage, NetworkStatus } from './devtools-messages-common.ts'
|
7
7
|
|
8
8
|
export class ResetAllDataReq extends LSDReqResMessage('LSD.Leader.ResetAllDataReq', {
|
9
9
|
mode: Schema.Literal('all-data', 'only-app-db'),
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export * as ClientSession from './devtools-messages-client-session.
|
2
|
-
export *
|
3
|
-
export * from './devtools-messages-
|
1
|
+
export * as ClientSession from './devtools-messages-client-session.ts'
|
2
|
+
export * from './devtools-messages-common.ts'
|
3
|
+
export * as Leader from './devtools-messages-leader.ts'
|
package/src/devtools/mod.ts
CHANGED
@@ -3,10 +3,10 @@ import { Schema } from '@livestore/utils/effect'
|
|
3
3
|
import { nanoid } from '@livestore/utils/nanoid'
|
4
4
|
import type { MeshNode } from '@livestore/webmesh'
|
5
5
|
|
6
|
-
import * as SessionInfo from './devtools-sessioninfo.
|
6
|
+
import * as SessionInfo from './devtools-sessioninfo.ts'
|
7
7
|
|
8
|
-
export * from './devtools-messages.
|
9
|
-
export * as SessionInfo from './devtools-sessioninfo.
|
8
|
+
export * from './devtools-messages.ts'
|
9
|
+
export * as SessionInfo from './devtools-sessioninfo.ts'
|
10
10
|
|
11
11
|
export const DevtoolsMode = Schema.Union(
|
12
12
|
Schema.TaggedStruct('node', {
|
package/src/index.ts
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
export * from './
|
2
|
-
export * from './
|
3
|
-
export * from './
|
4
|
-
export * from './
|
5
|
-
export * from './
|
6
|
-
export * from './
|
7
|
-
export * from './
|
8
|
-
export *
|
9
|
-
export * from './
|
10
|
-
export * from './
|
11
|
-
export * from './
|
12
|
-
export * from './
|
13
|
-
export *
|
14
|
-
export * from './
|
15
|
-
export * from './
|
16
|
-
export *
|
1
|
+
export * from './adapter-types.ts'
|
2
|
+
export * from './bounded-collections.ts'
|
3
|
+
export * from './debug-info.ts'
|
4
|
+
export * as Devtools from './devtools/mod.ts'
|
5
|
+
export * from './make-client-session.ts'
|
6
|
+
export * from './materializer-helper.ts'
|
7
|
+
export * from './otel.ts'
|
8
|
+
export * from './rematerialize-from-eventlog.ts'
|
9
|
+
export * from './schema/state/sqlite/query-builder/mod.ts'
|
10
|
+
export * from './schema/state/sqlite/system-tables.ts'
|
11
|
+
export * from './schema-management/migrations.ts'
|
12
|
+
export * as SqliteDbHelper from './sqlite-db-helper.ts'
|
13
|
+
export * from './sync/index.ts'
|
14
|
+
export * as SyncState from './sync/syncstate.ts'
|
15
|
+
export * from './util.ts'
|
16
|
+
export * from './version.ts'
|
@@ -17,18 +17,18 @@ import {
|
|
17
17
|
} from '@livestore/utils/effect'
|
18
18
|
import type * as otel from '@opentelemetry/api'
|
19
19
|
|
20
|
-
import type { SqliteDb } from '../adapter-types.
|
21
|
-
import { SyncError, UnexpectedError } from '../adapter-types.
|
22
|
-
import { makeMaterializerHash } from '../materializer-helper.
|
23
|
-
import type { LiveStoreSchema } from '../schema/mod.
|
24
|
-
import { EventSequenceNumber, getEventDef, LiveStoreEvent, SystemTables } from '../schema/mod.
|
25
|
-
import { LeaderAheadError } from '../sync/sync.
|
26
|
-
import * as SyncState from '../sync/syncstate.
|
27
|
-
import { sql } from '../util.
|
28
|
-
import * as Eventlog from './eventlog.
|
29
|
-
import { rollback } from './materialize-event.
|
30
|
-
import type { InitialBlockingSyncContext, LeaderSyncProcessor } from './types.
|
31
|
-
import { LeaderThreadCtx } from './types.
|
20
|
+
import type { SqliteDb } from '../adapter-types.ts'
|
21
|
+
import { SyncError, UnexpectedError } from '../adapter-types.ts'
|
22
|
+
import { makeMaterializerHash } from '../materializer-helper.ts'
|
23
|
+
import type { LiveStoreSchema } from '../schema/mod.ts'
|
24
|
+
import { EventSequenceNumber, getEventDef, LiveStoreEvent, SystemTables } from '../schema/mod.ts'
|
25
|
+
import { LeaderAheadError } from '../sync/sync.ts'
|
26
|
+
import * as SyncState from '../sync/syncstate.ts'
|
27
|
+
import { sql } from '../util.ts'
|
28
|
+
import * as Eventlog from './eventlog.ts'
|
29
|
+
import { rollback } from './materialize-event.ts'
|
30
|
+
import type { InitialBlockingSyncContext, LeaderSyncProcessor } from './types.ts'
|
31
|
+
import { LeaderThreadCtx } from './types.ts'
|
32
32
|
|
33
33
|
type LocalPushQueueItem = [
|
34
34
|
event: LiveStoreEvent.EncodedWithMeta,
|
@@ -98,8 +98,8 @@ export const makeLeaderSyncProcessor = ({
|
|
98
98
|
}): Effect.Effect<LeaderSyncProcessor, UnexpectedError, Scope.Scope> =>
|
99
99
|
Effect.gen(function* () {
|
100
100
|
const syncBackendPushQueue = yield* BucketQueue.make<LiveStoreEvent.EncodedWithMeta>()
|
101
|
-
const localPushBatchSize = params.localPushBatchSize ??
|
102
|
-
const backendPushBatchSize = params.backendPushBatchSize ??
|
101
|
+
const localPushBatchSize = params.localPushBatchSize ?? 1
|
102
|
+
const backendPushBatchSize = params.backendPushBatchSize ?? 2
|
103
103
|
|
104
104
|
const syncStateSref = yield* SubscriptionRef.make<SyncState.SyncState | undefined>(undefined)
|
105
105
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// import type { WaSqlite } from '@livestore/sqlite-wasm'
|
2
2
|
import { Effect } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import type { SqliteDb } from '../adapter-types.
|
5
|
-
import { SqliteError } from '../adapter-types.
|
6
|
-
import type { BindValues } from '../sql-queries/index.
|
7
|
-
import type { PreparedBindValues } from '../util.
|
8
|
-
import { prepareBindValues, sql } from '../util.
|
4
|
+
import type { SqliteDb } from '../adapter-types.ts'
|
5
|
+
import { SqliteError } from '../adapter-types.ts'
|
6
|
+
import type { BindValues } from '../sql-queries/index.ts'
|
7
|
+
import type { PreparedBindValues } from '../util.ts'
|
8
|
+
import { prepareBindValues, sql } from '../util.ts'
|
9
9
|
|
10
10
|
// TODO
|
11
11
|
namespace WaSqlite {
|
@@ -1,23 +1,23 @@
|
|
1
1
|
import { LS_DEV, shouldNeverHappen } from '@livestore/utils'
|
2
2
|
import { Effect, Option, Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import type { SqliteDb } from '../adapter-types.
|
5
|
-
import * as EventSequenceNumber from '../schema/EventSequenceNumber.
|
6
|
-
import * as LiveStoreEvent from '../schema/LiveStoreEvent.
|
4
|
+
import type { SqliteDb } from '../adapter-types.ts'
|
5
|
+
import * as EventSequenceNumber from '../schema/EventSequenceNumber.ts'
|
6
|
+
import * as LiveStoreEvent from '../schema/LiveStoreEvent.ts'
|
7
7
|
import {
|
8
8
|
EVENTLOG_META_TABLE,
|
9
9
|
eventlogMetaTable,
|
10
10
|
eventlogSystemTables,
|
11
|
-
sessionChangesetMetaTable,
|
12
11
|
SYNC_STATUS_TABLE,
|
13
|
-
|
14
|
-
|
15
|
-
import {
|
16
|
-
import
|
17
|
-
import {
|
18
|
-
import {
|
19
|
-
import
|
20
|
-
import {
|
12
|
+
sessionChangesetMetaTable,
|
13
|
+
} from '../schema/state/sqlite/system-tables.ts'
|
14
|
+
import { migrateTable } from '../schema-management/migrations.ts'
|
15
|
+
import { insertRow, updateRows } from '../sql-queries/sql-queries.ts'
|
16
|
+
import type { PreparedBindValues } from '../util.ts'
|
17
|
+
import { sql } from '../util.ts'
|
18
|
+
import { execSql } from './connection.ts'
|
19
|
+
import type { InitialSyncInfo } from './types.ts'
|
20
|
+
import { LeaderThreadCtx } from './types.ts'
|
21
21
|
|
22
22
|
export const initEventlogDb = (dbEventlog: SqliteDb) =>
|
23
23
|
Effect.gen(function* () {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { Effect, FiberMap, Option, Stream, SubscriptionRef } from '@livestore/utils/effect'
|
2
2
|
import { nanoid } from '@livestore/utils/nanoid'
|
3
3
|
|
4
|
-
import { Devtools, IntentionalShutdownCause, liveStoreVersion, UnexpectedError } from '../index.
|
5
|
-
import { SystemTables } from '../schema/mod.
|
6
|
-
import type { DevtoolsOptions, PersistenceInfoPair } from './types.
|
7
|
-
import { LeaderThreadCtx } from './types.
|
4
|
+
import { Devtools, IntentionalShutdownCause, liveStoreVersion, UnexpectedError } from '../index.ts'
|
5
|
+
import { SystemTables } from '../schema/mod.ts'
|
6
|
+
import type { DevtoolsOptions, PersistenceInfoPair } from './types.ts'
|
7
|
+
import { LeaderThreadCtx } from './types.ts'
|
8
8
|
|
9
9
|
type SendMessageToDevtools = (message: Devtools.Leader.MessageFromApp) => Effect.Effect<void>
|
10
10
|
|
@@ -2,28 +2,28 @@ import { shouldNeverHappen } from '@livestore/utils'
|
|
2
2
|
import type { HttpClient, Schema, Scope } from '@livestore/utils/effect'
|
3
3
|
import { Deferred, Effect, Layer, Queue, SubscriptionRef } from '@livestore/utils/effect'
|
4
4
|
|
5
|
-
import type { BootStatus, MakeSqliteDb, SqliteDb, SqliteError } from '../adapter-types.
|
6
|
-
import { UnexpectedError } from '../adapter-types.
|
7
|
-
import type * as Devtools from '../devtools/mod.
|
8
|
-
import type { LiveStoreSchema } from '../schema/mod.
|
9
|
-
import { EventSequenceNumber, LiveStoreEvent } from '../schema/mod.
|
10
|
-
import type { InvalidPullError, IsOfflineError, SyncOptions } from '../sync/sync.
|
11
|
-
import { SyncState } from '../sync/syncstate.
|
12
|
-
import { sql } from '../util.
|
13
|
-
import * as Eventlog from './eventlog.
|
14
|
-
import { makeLeaderSyncProcessor } from './LeaderSyncProcessor.
|
15
|
-
import { bootDevtools } from './leader-worker-devtools.
|
16
|
-
import { makeMaterializeEvent } from './materialize-event.
|
17
|
-
import { recreateDb } from './recreate-db.
|
18
|
-
import type { ShutdownChannel } from './shutdown-channel.
|
5
|
+
import type { BootStatus, MakeSqliteDb, SqliteDb, SqliteError } from '../adapter-types.ts'
|
6
|
+
import { UnexpectedError } from '../adapter-types.ts'
|
7
|
+
import type * as Devtools from '../devtools/mod.ts'
|
8
|
+
import type { LiveStoreSchema } from '../schema/mod.ts'
|
9
|
+
import { EventSequenceNumber, LiveStoreEvent } from '../schema/mod.ts'
|
10
|
+
import type { InvalidPullError, IsOfflineError, SyncOptions } from '../sync/sync.ts'
|
11
|
+
import { SyncState } from '../sync/syncstate.ts'
|
12
|
+
import { sql } from '../util.ts'
|
13
|
+
import * as Eventlog from './eventlog.ts'
|
14
|
+
import { makeLeaderSyncProcessor } from './LeaderSyncProcessor.ts'
|
15
|
+
import { bootDevtools } from './leader-worker-devtools.ts'
|
16
|
+
import { makeMaterializeEvent } from './materialize-event.ts'
|
17
|
+
import { recreateDb } from './recreate-db.ts'
|
18
|
+
import type { ShutdownChannel } from './shutdown-channel.ts'
|
19
19
|
import type {
|
20
20
|
DevtoolsOptions,
|
21
21
|
InitialBlockingSyncContext,
|
22
22
|
InitialSyncOptions,
|
23
23
|
LeaderSqliteDb,
|
24
24
|
ShutdownState,
|
25
|
-
} from './types.
|
26
|
-
import { LeaderThreadCtx } from './types.
|
25
|
+
} from './types.ts'
|
26
|
+
import { LeaderThreadCtx } from './types.ts'
|
27
27
|
|
28
28
|
export interface MakeLeaderThreadLayerParams {
|
29
29
|
storeId: string
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { isDevEnv, LS_DEV, shouldNeverHappen } from '@livestore/utils'
|
2
2
|
import { Effect, Option, ReadonlyArray, Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import { type SqliteDb, UnexpectedError } from '../adapter-types.
|
5
|
-
import { getExecStatementsFromMaterializer, hashMaterializerResults } from '../materializer-helper.
|
6
|
-
import type { LiveStoreSchema } from '../schema/mod.
|
7
|
-
import { EventSequenceNumber, getEventDef, SystemTables } from '../schema/mod.
|
8
|
-
import { insertRow } from '../sql-queries/index.
|
9
|
-
import { sql } from '../util.
|
10
|
-
import { execSql, execSqlPrepared } from './connection.
|
11
|
-
import * as Eventlog from './eventlog.
|
12
|
-
import type { MaterializeEvent } from './types.
|
4
|
+
import { type SqliteDb, UnexpectedError } from '../adapter-types.ts'
|
5
|
+
import { getExecStatementsFromMaterializer, hashMaterializerResults } from '../materializer-helper.ts'
|
6
|
+
import type { LiveStoreSchema } from '../schema/mod.ts'
|
7
|
+
import { EventSequenceNumber, getEventDef, SystemTables } from '../schema/mod.ts'
|
8
|
+
import { insertRow } from '../sql-queries/index.ts'
|
9
|
+
import { sql } from '../util.ts'
|
10
|
+
import { execSql, execSqlPrepared } from './connection.ts'
|
11
|
+
import * as Eventlog from './eventlog.ts'
|
12
|
+
import type { MaterializeEvent } from './types.ts'
|
13
13
|
|
14
14
|
export const makeMaterializeEvent = ({
|
15
15
|
schema,
|
package/src/leader-thread/mod.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
export * from './connection.
|
2
|
-
export * from './
|
3
|
-
export *
|
4
|
-
export * from './leader-
|
5
|
-
export * from './
|
6
|
-
export *
|
7
|
-
export * from './
|
8
|
-
export * from './
|
1
|
+
export * from './connection.ts'
|
2
|
+
export * as Eventlog from './eventlog.ts'
|
3
|
+
export * from './leader-worker-devtools.ts'
|
4
|
+
export * from './make-leader-thread-layer.ts'
|
5
|
+
export * from './materialize-event.ts'
|
6
|
+
export * from './recreate-db.ts'
|
7
|
+
export * as ShutdownChannel from './shutdown-channel.ts'
|
8
|
+
export * from './types.ts'
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { casesHandled } from '@livestore/utils'
|
2
2
|
import { Effect, Queue } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import type { MigrationsReport } from '../defs.
|
5
|
-
import type { BootStatus, MigrationHooks, SqliteDb, SqliteError } from '../index.
|
6
|
-
import { migrateDb, rematerializeFromEventlog, UnexpectedError } from '../index.
|
7
|
-
import type { LiveStoreSchema } from '../schema/mod.
|
8
|
-
import { configureConnection } from './connection.
|
9
|
-
import type { MaterializeEvent } from './types.
|
4
|
+
import type { MigrationsReport } from '../defs.ts'
|
5
|
+
import type { BootStatus, MigrationHooks, SqliteDb, SqliteError } from '../index.ts'
|
6
|
+
import { migrateDb, rematerializeFromEventlog, UnexpectedError } from '../index.ts'
|
7
|
+
import type { LiveStoreSchema } from '../schema/mod.ts'
|
8
|
+
import { configureConnection } from './connection.ts'
|
9
|
+
import type { MaterializeEvent } from './types.ts'
|
10
10
|
|
11
11
|
export const recreateDb = ({
|
12
12
|
dbState,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { WebChannel } from '@livestore/utils/effect'
|
2
2
|
import { Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import { IntentionalShutdownCause, UnexpectedError } from '../index.
|
4
|
+
import { IntentionalShutdownCause, UnexpectedError } from '../index.ts'
|
5
5
|
|
6
6
|
export class All extends Schema.Union(IntentionalShutdownCause, UnexpectedError) {}
|
7
7
|
|
@@ -12,8 +12,8 @@ import type {
|
|
12
12
|
import { Context, Schema } from '@livestore/utils/effect'
|
13
13
|
import type { MeshNode } from '@livestore/webmesh'
|
14
14
|
|
15
|
-
import type { MigrationsReport } from '../defs.
|
16
|
-
import type { SqliteError } from '../errors.
|
15
|
+
import type { MigrationsReport } from '../defs.ts'
|
16
|
+
import type { SqliteError } from '../errors.ts'
|
17
17
|
import type {
|
18
18
|
BootStatus,
|
19
19
|
Devtools,
|
@@ -23,10 +23,10 @@ import type {
|
|
23
23
|
SqliteDb,
|
24
24
|
SyncBackend,
|
25
25
|
UnexpectedError,
|
26
|
-
} from '../index.
|
27
|
-
import type { EventSequenceNumber, LiveStoreEvent, LiveStoreSchema } from '../schema/mod.
|
28
|
-
import type * as SyncState from '../sync/syncstate.
|
29
|
-
import type { ShutdownChannel } from './shutdown-channel.
|
26
|
+
} from '../index.ts'
|
27
|
+
import type { EventSequenceNumber, LiveStoreEvent, LiveStoreSchema } from '../schema/mod.ts'
|
28
|
+
import type * as SyncState from '../sync/syncstate.ts'
|
29
|
+
import type { ShutdownChannel } from './shutdown-channel.ts'
|
30
30
|
|
31
31
|
export type ShutdownState = 'running' | 'shutting-down'
|
32
32
|
|
@@ -9,12 +9,11 @@ import type {
|
|
9
9
|
LockStatus,
|
10
10
|
SqliteDb,
|
11
11
|
UnexpectedError,
|
12
|
-
} from './adapter-types.
|
13
|
-
import * as Devtools from './devtools/mod.
|
14
|
-
import { liveStoreVersion } from './version.
|
12
|
+
} from './adapter-types.ts'
|
13
|
+
import * as Devtools from './devtools/mod.ts'
|
14
|
+
import { liveStoreVersion } from './version.ts'
|
15
15
|
|
16
16
|
declare global {
|
17
|
-
// eslint-disable-next-line no-var
|
18
17
|
var __debugWebmeshNode: any
|
19
18
|
}
|
20
19
|
|
@@ -1,17 +1,17 @@
|
|
1
1
|
import { isDevEnv, isNil, isReadonlyArray } from '@livestore/utils'
|
2
2
|
import { Hash, Option, Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import type { SqliteDb } from './adapter-types.
|
5
|
-
import { SessionIdSymbol } from './adapter-types.
|
6
|
-
import type { EventDef, Materializer, MaterializerContextQuery, MaterializerResult } from './schema/EventDef.
|
7
|
-
import type * as LiveStoreEvent from './schema/LiveStoreEvent.
|
8
|
-
import { getEventDef, type LiveStoreSchema } from './schema/schema.
|
9
|
-
import type { QueryBuilder } from './schema/state/sqlite/query-builder/api.
|
10
|
-
import { isQueryBuilder } from './schema/state/sqlite/query-builder/api.
|
11
|
-
import { getResultSchema } from './schema/state/sqlite/query-builder/impl.
|
12
|
-
import type { BindValues } from './sql-queries/sql-queries.
|
13
|
-
import type { ParamsObject, PreparedBindValues } from './util.
|
14
|
-
import { prepareBindValues } from './util.
|
4
|
+
import type { SqliteDb } from './adapter-types.ts'
|
5
|
+
import { SessionIdSymbol } from './adapter-types.ts'
|
6
|
+
import type { EventDef, Materializer, MaterializerContextQuery, MaterializerResult } from './schema/EventDef.ts'
|
7
|
+
import type * as LiveStoreEvent from './schema/LiveStoreEvent.ts'
|
8
|
+
import { getEventDef, type LiveStoreSchema } from './schema/schema.ts'
|
9
|
+
import type { QueryBuilder } from './schema/state/sqlite/query-builder/api.ts'
|
10
|
+
import { isQueryBuilder } from './schema/state/sqlite/query-builder/api.ts'
|
11
|
+
import { getResultSchema } from './schema/state/sqlite/query-builder/impl.ts'
|
12
|
+
import type { BindValues } from './sql-queries/sql-queries.ts'
|
13
|
+
import type { ParamsObject, PreparedBindValues } from './util.ts'
|
14
|
+
import { prepareBindValues } from './util.ts'
|
15
15
|
|
16
16
|
export const getExecStatementsFromMaterializer = ({
|
17
17
|
eventDef,
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { memoizeByRef } from '@livestore/utils'
|
2
2
|
import { Chunk, Effect, Option, Schema, Stream } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import { type SqliteDb, UnexpectedError } from './adapter-types.
|
5
|
-
import type { MaterializeEvent } from './leader-thread/mod.
|
6
|
-
import type { EventDef, LiveStoreSchema } from './schema/mod.
|
7
|
-
import { EventSequenceNumber, getEventDef, LiveStoreEvent, SystemTables } from './schema/mod.
|
8
|
-
import type { PreparedBindValues } from './util.
|
9
|
-
import { sql } from './util.
|
4
|
+
import { type SqliteDb, UnexpectedError } from './adapter-types.ts'
|
5
|
+
import type { MaterializeEvent } from './leader-thread/mod.ts'
|
6
|
+
import type { EventDef, LiveStoreSchema } from './schema/mod.ts'
|
7
|
+
import { EventSequenceNumber, getEventDef, LiveStoreEvent, SystemTables } from './schema/mod.ts'
|
8
|
+
import type { PreparedBindValues } from './util.ts'
|
9
|
+
import { sql } from './util.ts'
|
10
10
|
|
11
11
|
export const rematerializeFromEventlog = ({
|
12
12
|
dbEventlog,
|
package/src/schema/EventDef.ts
CHANGED
@@ -2,9 +2,9 @@ import type { SingleOrReadonlyArray } from '@livestore/utils'
|
|
2
2
|
import { shouldNeverHappen } from '@livestore/utils'
|
3
3
|
import { Schema } from '@livestore/utils/effect'
|
4
4
|
|
5
|
-
import type { BindValues } from '../sql-queries/sql-queries.
|
6
|
-
import type { ParamsObject } from '../util.
|
7
|
-
import type { QueryBuilder } from './state/sqlite/query-builder/mod.
|
5
|
+
import type { BindValues } from '../sql-queries/sql-queries.ts'
|
6
|
+
import type { ParamsObject } from '../util.ts'
|
7
|
+
import type { QueryBuilder } from './state/sqlite/query-builder/mod.ts'
|
8
8
|
|
9
9
|
export type EventDefMap = {
|
10
10
|
map: Map<string | 'livestore.RawSql', EventDef.Any>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Vitest } from '@livestore/utils-dev/node-vitest'
|
2
2
|
import { expect } from 'vitest'
|
3
3
|
|
4
|
-
import { EventSequenceNumber } from './mod.
|
4
|
+
import { EventSequenceNumber } from './mod.ts'
|
5
5
|
|
6
6
|
Vitest.describe('EventSequenceNumber', () => {
|
7
7
|
Vitest.test('nextPair (no rebase)', () => {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { memoizeByRef } from '@livestore/utils'
|
2
2
|
import { Option, Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import type { EventDef, EventDefRecord } from './EventDef.
|
5
|
-
import * as EventSequenceNumber from './EventSequenceNumber.
|
6
|
-
import type { LiveStoreSchema } from './schema.
|
4
|
+
import type { EventDef, EventDefRecord } from './EventDef.ts'
|
5
|
+
import * as EventSequenceNumber from './EventSequenceNumber.ts'
|
6
|
+
import type { LiveStoreSchema } from './schema.ts'
|
7
7
|
|
8
8
|
export namespace ForEventDef {
|
9
9
|
export type PartialDecoded<TEventDef extends EventDef.Any> = {
|
package/src/schema/events.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { defineEvent, synced
|
1
|
+
export { clientOnly, defineEvent, synced } from './EventDef.ts'
|
package/src/schema/mod.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export *
|
2
|
-
export
|
3
|
-
export * from './
|
4
|
-
export * from './
|
5
|
-
export * from './schema.
|
6
|
-
export * as State from './state/mod.
|
7
|
-
export
|
8
|
-
export *
|
9
|
-
export * as
|
1
|
+
export * from './EventDef.ts'
|
2
|
+
export * as EventSequenceNumber from './EventSequenceNumber.ts'
|
3
|
+
export * as Events from './events.ts'
|
4
|
+
export * as LiveStoreEvent from './LiveStoreEvent.ts'
|
5
|
+
export * from './schema.ts'
|
6
|
+
export * as State from './state/mod.ts'
|
7
|
+
export { SqliteAst, SqliteDsl } from './state/sqlite/db-schema/mod.ts'
|
8
|
+
export * from './state/sqlite/schema-helpers.ts'
|
9
|
+
export * as SystemTables from './state/sqlite/system-tables.ts'
|
package/src/schema/schema.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { isReadonlyArray, shouldNeverHappen } from '@livestore/utils'
|
2
2
|
|
3
|
-
import type { MigrationOptions } from '../adapter-types.
|
4
|
-
import type { EventDef, EventDefRecord, Materializer, RawSqlEvent } from './EventDef.
|
5
|
-
import { rawSqlEvent } from './EventDef.
|
6
|
-
import { tableIsClientDocumentTable } from './state/sqlite/client-document-def.
|
7
|
-
import type { SqliteDsl } from './state/sqlite/db-schema/mod.
|
8
|
-
import { stateSystemTables } from './state/sqlite/system-tables.
|
9
|
-
import type { TableDef } from './state/sqlite/table-def.
|
3
|
+
import type { MigrationOptions } from '../adapter-types.ts'
|
4
|
+
import type { EventDef, EventDefRecord, Materializer, RawSqlEvent } from './EventDef.ts'
|
5
|
+
import { rawSqlEvent } from './EventDef.ts'
|
6
|
+
import { tableIsClientDocumentTable } from './state/sqlite/client-document-def.ts'
|
7
|
+
import type { SqliteDsl } from './state/sqlite/db-schema/mod.ts'
|
8
|
+
import { stateSystemTables } from './state/sqlite/system-tables.ts'
|
9
|
+
import type { TableDef } from './state/sqlite/table-def.ts'
|
10
10
|
|
11
11
|
export const LiveStoreSchemaSymbol = Symbol.for('livestore.LiveStoreSchema')
|
12
12
|
export type LiveStoreSchemaSymbol = typeof LiveStoreSchemaSymbol
|
package/src/schema/state/mod.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * as SQLite from './sqlite/mod.
|
2
|
-
export { QueryBuilderAstSymbol, QueryBuilderTypeId } from './sqlite/query-builder/mod.
|
1
|
+
export * as SQLite from './sqlite/mod.ts'
|
2
|
+
export { QueryBuilderAstSymbol, QueryBuilderTypeId } from './sqlite/query-builder/mod.ts'
|
@@ -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",
|