@livestore/common 0.3.0-dev.22 → 0.3.0-dev.23
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/adapter-types.d.ts +6 -0
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js.map +1 -1
- package/dist/devtools/devtools-messages-client-session.d.ts +21 -21
- package/dist/devtools/devtools-messages-common.d.ts +6 -6
- package/dist/devtools/devtools-messages-leader.d.ts +24 -24
- package/dist/leader-thread/make-leader-thread-layer.d.ts +3 -2
- package/dist/leader-thread/make-leader-thread-layer.d.ts.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.js +4 -2
- package/dist/leader-thread/make-leader-thread-layer.js.map +1 -1
- package/dist/sync/sync.d.ts +2 -1
- package/dist/sync/sync.d.ts.map +1 -1
- package/dist/sync/sync.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/src/adapter-types.ts +6 -0
- package/src/leader-thread/make-leader-thread-layer.ts +6 -2
- package/src/sync/sync.ts +4 -1
- package/src/version.ts +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@livestore/common",
|
3
|
-
"version": "0.3.0-dev.
|
3
|
+
"version": "0.3.0-dev.23",
|
4
4
|
"type": "module",
|
5
5
|
"sideEffects": false,
|
6
6
|
"exports": {
|
@@ -54,7 +54,7 @@
|
|
54
54
|
"graphology": "0.26.0-alpha1",
|
55
55
|
"graphology-dag": "0.4.1",
|
56
56
|
"graphology-types": "0.24.8",
|
57
|
-
"@livestore/utils": "0.3.0-dev.
|
57
|
+
"@livestore/utils": "0.3.0-dev.23"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
60
|
"vitest": "^3.0.8"
|
package/src/adapter-types.ts
CHANGED
@@ -239,6 +239,12 @@ export type Adapter = (opts: {
|
|
239
239
|
bootStatusQueue: Queue.Queue<BootStatus>
|
240
240
|
shutdown: (cause: Cause.Cause<any>) => void
|
241
241
|
connectDevtoolsToStore: ConnectDevtoolsToStore
|
242
|
+
/**
|
243
|
+
* Payload that will be passed to the sync backend when connecting
|
244
|
+
*
|
245
|
+
* @default undefined
|
246
|
+
*/
|
247
|
+
syncPayload: Schema.JsonValue | undefined
|
242
248
|
}) => Effect.Effect<ClientSession, UnexpectedError, Scope.Scope>
|
243
249
|
|
244
250
|
export const MigrationsReportEntry = Schema.Struct({
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { HttpClient, Scope } from '@livestore/utils/effect'
|
1
|
+
import type { HttpClient, Schema, Scope } from '@livestore/utils/effect'
|
2
2
|
import { Deferred, Effect, Layer, Queue, SubscriptionRef } from '@livestore/utils/effect'
|
3
3
|
|
4
4
|
import type { BootStatus, MakeSqliteDb, MigrationsReport, SqliteError } from '../adapter-types.js'
|
@@ -28,6 +28,7 @@ export const makeLeaderThreadLayer = ({
|
|
28
28
|
schema,
|
29
29
|
storeId,
|
30
30
|
clientId,
|
31
|
+
syncPayload,
|
31
32
|
makeSqliteDb,
|
32
33
|
syncOptions,
|
33
34
|
dbReadModel,
|
@@ -36,6 +37,7 @@ export const makeLeaderThreadLayer = ({
|
|
36
37
|
shutdownChannel,
|
37
38
|
}: {
|
38
39
|
storeId: string
|
40
|
+
syncPayload: Schema.JsonValue | undefined
|
39
41
|
clientId: string
|
40
42
|
schema: LiveStoreSchema
|
41
43
|
makeSqliteDb: MakeSqliteDb
|
@@ -54,7 +56,9 @@ export const makeLeaderThreadLayer = ({
|
|
54
56
|
dbReadModel.select<{ count: number }>(sql`select count(*) as count from sqlite_master`)[0]!.count === 0
|
55
57
|
|
56
58
|
const syncBackend =
|
57
|
-
syncOptions?.makeBackend === undefined
|
59
|
+
syncOptions?.makeBackend === undefined
|
60
|
+
? undefined
|
61
|
+
: yield* syncOptions.makeBackend({ storeId, clientId, payload: syncPayload })
|
58
62
|
|
59
63
|
const initialBlockingSyncContext = yield* makeInitialBlockingSyncContext({
|
60
64
|
initialSyncOptions: syncOptions?.initialSyncOptions ?? { _tag: 'Skip' },
|
package/src/sync/sync.ts
CHANGED
@@ -12,10 +12,13 @@ import type * as MutationEvent from '../schema/MutationEvent.js'
|
|
12
12
|
export type MakeBackendArgs = {
|
13
13
|
storeId: string
|
14
14
|
clientId: string
|
15
|
+
payload: Schema.JsonValue | undefined
|
15
16
|
}
|
16
17
|
|
17
18
|
export type SyncOptions = {
|
18
|
-
makeBackend?: (
|
19
|
+
makeBackend?: (
|
20
|
+
args: MakeBackendArgs,
|
21
|
+
) => Effect.Effect<SyncBackend<any>, UnexpectedError, Scope.Scope | HttpClient.HttpClient>
|
19
22
|
/** @default { _tag: 'Skip' } */
|
20
23
|
initialSyncOptions?: InitialSyncOptions
|
21
24
|
}
|
package/src/version.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
// import packageJson from '../package.json' with { type: 'json' }
|
3
3
|
// export const liveStoreVersion = packageJson.version
|
4
4
|
|
5
|
-
export const liveStoreVersion = '0.3.0-dev.
|
5
|
+
export const liveStoreVersion = '0.3.0-dev.23' as const
|
6
6
|
|
7
7
|
/**
|
8
8
|
* This version number is incremented whenever the internal storage format changes in a breaking way.
|