@livestore/common 0.4.0-dev.24 → 0.4.0-dev.25
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/devtools/devtools-compatibility.test.d.ts +2 -0
- package/dist/devtools/devtools-compatibility.test.d.ts.map +1 -0
- package/dist/devtools/devtools-compatibility.test.js +15 -0
- package/dist/devtools/devtools-compatibility.test.js.map +1 -0
- package/dist/devtools/devtools-messages-client-session.d.ts +8 -2
- package/dist/devtools/devtools-messages-client-session.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-client-session.js +10 -4
- package/dist/devtools/devtools-messages-client-session.js.map +1 -1
- package/dist/devtools/devtools-messages-common.d.ts +2 -4
- package/dist/devtools/devtools-messages-common.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-common.js +2 -4
- package/dist/devtools/devtools-messages-common.js.map +1 -1
- package/dist/devtools/devtools-messages-leader.d.ts +8 -2
- package/dist/devtools/devtools-messages-leader.d.ts.map +1 -1
- package/dist/devtools/devtools-messages-leader.js +10 -4
- package/dist/devtools/devtools-messages-leader.js.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.d.ts.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.js +10 -9
- package/dist/leader-thread/leader-worker-devtools.js.map +1 -1
- package/dist/version.d.ts +6 -3
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +6 -3
- package/dist/version.js.map +1 -1
- package/package.json +4 -4
- package/src/devtools/devtools-compatibility.test.ts +18 -0
- package/src/devtools/devtools-messages-client-session.ts +10 -4
- package/src/devtools/devtools-messages-common.ts +2 -4
- package/src/devtools/devtools-messages-leader.ts +10 -4
- package/src/leader-thread/leader-worker-devtools.ts +18 -9
- package/src/version.ts +14 -3
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { Effect, FiberMap, Option, Stream, SubscriptionRef } from '@livestore/utils/effect'
|
|
2
2
|
import { nanoid } from '@livestore/utils/nanoid'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Devtools,
|
|
6
|
+
devtoolsProtocolVersion,
|
|
7
|
+
IntentionalShutdownCause,
|
|
8
|
+
isDevtoolsProtocolVersionSupported,
|
|
9
|
+
liveStoreVersion,
|
|
10
|
+
resolveDevtoolsProtocolVersion,
|
|
11
|
+
UnknownError,
|
|
12
|
+
} from '../index.ts'
|
|
5
13
|
import { SystemTables } from '../schema/mod.ts'
|
|
6
14
|
import type { DevtoolsOptions, PersistenceInfoPair } from './types.ts'
|
|
7
15
|
import { LeaderThreadCtx } from './types.ts'
|
|
@@ -166,18 +174,19 @@ const listenToDevtools = ({
|
|
|
166
174
|
|
|
167
175
|
switch (decodedEvent._tag) {
|
|
168
176
|
case 'LSD.Leader.Ping': {
|
|
169
|
-
|
|
170
|
-
if (decodedEvent.liveStoreVersion !== liveStoreVersion) {
|
|
177
|
+
if (isDevtoolsProtocolVersionSupported(decodedEvent.devtoolsProtocolVersion) === false) {
|
|
171
178
|
yield* sendMessage(
|
|
172
179
|
Devtools.Leader.VersionMismatch.make({
|
|
173
180
|
...reqPayload,
|
|
174
181
|
appVersion: liveStoreVersion,
|
|
175
182
|
receivedVersion: decodedEvent.liveStoreVersion,
|
|
183
|
+
appDevtoolsProtocolVersion: devtoolsProtocolVersion,
|
|
184
|
+
receivedDevtoolsProtocolVersion: resolveDevtoolsProtocolVersion(decodedEvent.devtoolsProtocolVersion),
|
|
176
185
|
}),
|
|
177
186
|
)
|
|
178
187
|
return
|
|
179
188
|
}
|
|
180
|
-
yield* sendMessage(Devtools.Leader.Pong.make({ ...reqPayload }))
|
|
189
|
+
yield* sendMessage(Devtools.Leader.Pong.make({ ...reqPayload, devtoolsProtocolVersion }))
|
|
181
190
|
return
|
|
182
191
|
}
|
|
183
192
|
case 'LSD.Leader.SnapshotReq': {
|
|
@@ -352,10 +361,10 @@ const listenToDevtools = ({
|
|
|
352
361
|
return
|
|
353
362
|
}
|
|
354
363
|
case 'LSD.Leader.SyncHistoryUnsubscribe': {
|
|
355
|
-
const
|
|
356
|
-
console.log('LSD.SyncHistoryUnsubscribe',
|
|
364
|
+
const unsubscribeRequestId = decodedEvent.requestId
|
|
365
|
+
console.log('LSD.SyncHistoryUnsubscribe', unsubscribeRequestId)
|
|
357
366
|
|
|
358
|
-
yield* FiberMap.remove(subscriptionFiberMap,
|
|
367
|
+
yield* FiberMap.remove(subscriptionFiberMap, unsubscribeRequestId)
|
|
359
368
|
|
|
360
369
|
return
|
|
361
370
|
}
|
|
@@ -408,9 +417,9 @@ const listenToDevtools = ({
|
|
|
408
417
|
return
|
|
409
418
|
}
|
|
410
419
|
case 'LSD.Leader.NetworkStatusUnsubscribe': {
|
|
411
|
-
const
|
|
420
|
+
const unsubscribeRequestId = decodedEvent.requestId
|
|
412
421
|
|
|
413
|
-
yield* FiberMap.remove(subscriptionFiberMap,
|
|
422
|
+
yield* FiberMap.remove(subscriptionFiberMap, unsubscribeRequestId)
|
|
414
423
|
|
|
415
424
|
return
|
|
416
425
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import pkg from '../package.json' with { type: 'json' }
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Current LiveStore version used for
|
|
4
|
+
* Current LiveStore package version used for display, release assets, and install guidance.
|
|
5
5
|
*
|
|
6
|
-
* Can be overridden at runtime via `globalThis.__LIVESTORE_VERSION_OVERRIDE__` for testing
|
|
7
|
-
* This allows Playwright tests to simulate version mismatch scenarios without rebuilding.
|
|
6
|
+
* Can be overridden at runtime via `globalThis.__LIVESTORE_VERSION_OVERRIDE__` for testing display-only version values.
|
|
8
7
|
*/
|
|
9
8
|
export const liveStoreVersion: string = (globalThis as any).__LIVESTORE_VERSION_OVERRIDE__ ?? pkg.version
|
|
10
9
|
|
|
10
|
+
export const devtoolsProtocolVersion: number =
|
|
11
|
+
(globalThis as any).__LIVESTORE_DEVTOOLS_PROTOCOL_VERSION_OVERRIDE__ ?? 1
|
|
12
|
+
|
|
13
|
+
export const supportedDevtoolsProtocolVersions: ReadonlyArray<number> = [devtoolsProtocolVersion]
|
|
14
|
+
|
|
15
|
+
export const resolveDevtoolsProtocolVersion = (version: number | undefined): number => version ?? 1
|
|
16
|
+
|
|
17
|
+
export const isDevtoolsProtocolVersionSupported = (
|
|
18
|
+
version: number | undefined,
|
|
19
|
+
supportedVersions: ReadonlyArray<number> = supportedDevtoolsProtocolVersions,
|
|
20
|
+
): boolean => supportedVersions.includes(resolveDevtoolsProtocolVersion(version))
|
|
21
|
+
|
|
11
22
|
/**
|
|
12
23
|
* CRITICAL: Increment this version whenever you modify client-side EVENTLOG table schemas.
|
|
13
24
|
*
|