@livestore/adapter-node 0.0.0-snapshot-0d29af8992dee74607cd7767e35f9b1338444edd → 0.0.0-snapshot-13a84f2057a5823fa045fade064685c25519837a

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.
@@ -139,25 +139,27 @@ const makeDevtoolsOptions = ({
139
139
  const { startDevtoolsServer } = yield* Effect.promise(() => import('./devtools/devtools-server.js'))
140
140
 
141
141
  // TODO instead of failing when the port is already in use, we should try to use that WS server instead of starting a new one
142
- yield* startDevtoolsServer({
143
- schemaPath: devtools.schemaPath,
144
- clientSessionInfo: Devtools.SessionInfo.SessionInfo.make({
145
- storeId,
146
- clientId,
147
- sessionId: 'static', // TODO make this dynamic
148
- schemaAlias: devtools.schemaAlias,
149
- isLeader: true,
150
- }),
151
- port: devtools.port,
152
- host: devtools.host,
153
- }).pipe(Effect.tapCauseLogPretty, Effect.forkScoped)
142
+ if (devtools.useExistingDevtoolsServer === false) {
143
+ yield* startDevtoolsServer({
144
+ schemaPath: devtools.schemaPath,
145
+ clientSessionInfo: Devtools.SessionInfo.SessionInfo.make({
146
+ storeId,
147
+ clientId,
148
+ sessionId: 'static', // TODO make this dynamic
149
+ schemaAlias: devtools.schemaAlias,
150
+ isLeader: true,
151
+ }),
152
+ port: devtools.port,
153
+ host: devtools.host,
154
+ }).pipe(Effect.tapCauseLogPretty, Effect.forkScoped)
155
+ }
154
156
 
155
157
  const node = yield* Webmesh.makeMeshNode(Devtools.makeNodeName.client.leader({ storeId, clientId }))
156
158
 
157
159
  yield* Webmesh.connectViaWebSocket({
158
160
  node,
159
161
  url: `http://${devtools.host}:${devtools.port}`,
160
- openTimeout: 50,
162
+ openTimeout: 500,
161
163
  }).pipe(Effect.tapCauseLogPretty, Effect.forkScoped)
162
164
 
163
165
  const persistenceInfo = {
@@ -7,7 +7,7 @@ import {
7
7
  SyncState,
8
8
  UnexpectedError,
9
9
  } from '@livestore/common'
10
- import { EventId, LiveStoreEvent } from '@livestore/common/schema'
10
+ import { EventSequenceNumber, LiveStoreEvent } from '@livestore/common/schema'
11
11
  import { Schema, Transferable } from '@livestore/utils/effect'
12
12
 
13
13
  export const WorkerArgv = Schema.parseJson(
@@ -74,6 +74,7 @@ export namespace LeaderWorkerInner {
74
74
  port: Schema.Number,
75
75
  host: Schema.String,
76
76
  schemaAlias: Schema.String,
77
+ useExistingDevtoolsServer: Schema.Boolean,
77
78
  }),
78
79
  Schema.Struct({ enabled: Schema.Literal(false) }),
79
80
  ),
@@ -130,7 +131,7 @@ export namespace LeaderWorkerInner {
130
131
 
131
132
  export class GetLeaderHead extends Schema.TaggedRequest<GetLeaderHead>()('GetLeaderHead', {
132
133
  payload: {},
133
- success: EventId.EventId,
134
+ success: EventSequenceNumber.EventSequenceNumber,
134
135
  failure: UnexpectedError,
135
136
  }) {}
136
137