@livestore/adapter-node 0.4.0-dev.17 → 0.4.0-dev.19

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.
@@ -1,4 +1,4 @@
1
- import { Devtools, LeaderAheadError, SyncState, UnexpectedError } from '@livestore/common';
1
+ import { Devtools, LeaderAheadError, SyncState, UnknownError } from '@livestore/common';
2
2
  import { Schema } from '@livestore/utils/effect';
3
3
  export declare const WorkerArgv: Schema.transform<Schema.SchemaClass<unknown, string, never>, Schema.Struct<{
4
4
  clientId: typeof Schema.String;
@@ -49,7 +49,7 @@ declare const LeaderWorkerOuterInitialMessage_base: Schema.TaggedRequestClass<Le
49
49
  readonly _tag: Schema.tag<"InitialMessage">;
50
50
  } & {
51
51
  port: Schema.Schema<MessagePort, MessagePort, never>;
52
- }, typeof Schema.Void, typeof UnexpectedError>;
52
+ }, typeof Schema.Void, typeof UnknownError>;
53
53
  export declare class LeaderWorkerOuterInitialMessage extends LeaderWorkerOuterInitialMessage_base {
54
54
  }
55
55
  declare const LeaderWorkerOuterRequest_base: typeof LeaderWorkerOuterInitialMessage;
@@ -87,7 +87,7 @@ declare const LeaderWorkerInnerInitialMessage_base: Schema.TaggedRequestClass<Le
87
87
  }>, Schema.Struct<{
88
88
  enabled: Schema.Literal<[false]>;
89
89
  }>]>;
90
- }, typeof Schema.Void, typeof UnexpectedError>;
90
+ }, typeof Schema.Void, typeof UnknownError>;
91
91
  export declare class LeaderWorkerInnerInitialMessage extends LeaderWorkerInnerInitialMessage_base {
92
92
  }
93
93
  declare const LeaderWorkerInnerBootStatusStream_base: Schema.TaggedRequestClass<LeaderWorkerInnerBootStatusStream, "BootStatusStream", {
@@ -114,47 +114,66 @@ declare const LeaderWorkerInnerBootStatusStream_base: Schema.TaggedRequestClass<
114
114
  }>;
115
115
  }>, Schema.Struct<{
116
116
  stage: Schema.Literal<["done"]>;
117
- }>]>, typeof UnexpectedError>;
117
+ }>]>, typeof UnknownError>;
118
118
  export declare class LeaderWorkerInnerBootStatusStream extends LeaderWorkerInnerBootStatusStream_base {
119
119
  }
120
120
  declare const LeaderWorkerInnerPullStream_base: Schema.TaggedRequestClass<LeaderWorkerInnerPullStream, "PullStream", {
121
121
  readonly _tag: Schema.tag<"PullStream">;
122
122
  } & {
123
- cursor: Schema.Struct<{
124
- global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
125
- client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
126
- rebaseGeneration: typeof Schema.Int;
127
- }>;
123
+ cursor: Schema.SchemaClass<{
124
+ readonly global: number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">;
125
+ readonly client: number & import("effect/Brand").Brand<"ClientEventSequenceNumber">;
126
+ readonly rebaseGeneration: number;
127
+ }, {
128
+ readonly global: number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">;
129
+ readonly client: number & import("effect/Brand").Brand<"ClientEventSequenceNumber">;
130
+ readonly rebaseGeneration: number;
131
+ }, never>;
128
132
  }, Schema.Struct<{
129
133
  payload: typeof SyncState.PayloadUpstream;
130
- }>, typeof UnexpectedError>;
134
+ }>, typeof UnknownError>;
131
135
  export declare class LeaderWorkerInnerPullStream extends LeaderWorkerInnerPullStream_base {
132
136
  }
133
137
  declare const LeaderWorkerInnerPushToLeader_base: Schema.TaggedRequestClass<LeaderWorkerInnerPushToLeader, "PushToLeader", {
134
138
  readonly _tag: Schema.tag<"PushToLeader">;
135
139
  } & {
136
- batch: Schema.Array$<Schema.Struct<{
137
- name: typeof Schema.String;
138
- args: typeof Schema.Any;
139
- seqNum: Schema.Struct<{
140
- global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
141
- client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
142
- rebaseGeneration: typeof Schema.Int;
143
- }>;
144
- parentSeqNum: Schema.Struct<{
145
- global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
146
- client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
147
- rebaseGeneration: typeof Schema.Int;
148
- }>;
149
- clientId: typeof Schema.String;
150
- sessionId: typeof Schema.String;
151
- }>>;
152
- }, typeof Schema.Void, Schema.Union<[typeof UnexpectedError, typeof LeaderAheadError]>>;
140
+ batch: Schema.Array$<Schema.SchemaClass<{
141
+ readonly clientId: string;
142
+ readonly sessionId: string;
143
+ readonly name: string;
144
+ readonly args: any;
145
+ readonly seqNum: {
146
+ readonly global: any;
147
+ readonly client: any;
148
+ readonly rebaseGeneration: number;
149
+ };
150
+ readonly parentSeqNum: {
151
+ readonly global: any;
152
+ readonly client: any;
153
+ readonly rebaseGeneration: number;
154
+ };
155
+ }, {
156
+ readonly clientId: string;
157
+ readonly sessionId: string;
158
+ readonly name: string;
159
+ readonly args: any;
160
+ readonly seqNum: {
161
+ readonly global: any;
162
+ readonly client: any;
163
+ readonly rebaseGeneration: number;
164
+ };
165
+ readonly parentSeqNum: {
166
+ readonly global: any;
167
+ readonly client: any;
168
+ readonly rebaseGeneration: number;
169
+ };
170
+ }, never>>;
171
+ }, Schema.Schema<void, void, never>, Schema.Union<[typeof UnknownError, typeof LeaderAheadError]>>;
153
172
  export declare class LeaderWorkerInnerPushToLeader extends LeaderWorkerInnerPushToLeader_base {
154
173
  }
155
174
  declare const LeaderWorkerInnerExport_base: Schema.TaggedRequestClass<LeaderWorkerInnerExport, "Export", {
156
175
  readonly _tag: Schema.tag<"Export">;
157
- }, Schema.Schema<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>, never>, typeof UnexpectedError>;
176
+ }, Schema.Schema<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>, never>, typeof UnknownError>;
158
177
  export declare class LeaderWorkerInnerExport extends LeaderWorkerInnerExport_base {
159
178
  }
160
179
  declare const LeaderWorkerInnerGetRecreateSnapshot_base: Schema.TaggedRequestClass<LeaderWorkerInnerGetRecreateSnapshot, "GetRecreateSnapshot", {
@@ -170,31 +189,35 @@ declare const LeaderWorkerInnerGetRecreateSnapshot_base: Schema.TaggedRequestCla
170
189
  }>;
171
190
  }>>;
172
191
  }>;
173
- }>, typeof UnexpectedError>;
192
+ }>, typeof UnknownError>;
174
193
  export declare class LeaderWorkerInnerGetRecreateSnapshot extends LeaderWorkerInnerGetRecreateSnapshot_base {
175
194
  }
176
195
  declare const LeaderWorkerInnerExportEventlog_base: Schema.TaggedRequestClass<LeaderWorkerInnerExportEventlog, "ExportEventlog", {
177
196
  readonly _tag: Schema.tag<"ExportEventlog">;
178
- }, Schema.Schema<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>, never>, typeof UnexpectedError>;
197
+ }, Schema.Schema<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>, never>, typeof UnknownError>;
179
198
  export declare class LeaderWorkerInnerExportEventlog extends LeaderWorkerInnerExportEventlog_base {
180
199
  }
181
200
  declare const LeaderWorkerInnerGetLeaderHead_base: Schema.TaggedRequestClass<LeaderWorkerInnerGetLeaderHead, "GetLeaderHead", {
182
201
  readonly _tag: Schema.tag<"GetLeaderHead">;
183
- }, Schema.Struct<{
184
- global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
185
- client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
186
- rebaseGeneration: typeof Schema.Int;
187
- }>, typeof UnexpectedError>;
202
+ }, Schema.SchemaClass<{
203
+ readonly global: number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">;
204
+ readonly client: number & import("effect/Brand").Brand<"ClientEventSequenceNumber">;
205
+ readonly rebaseGeneration: number;
206
+ }, {
207
+ readonly global: number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">;
208
+ readonly client: number & import("effect/Brand").Brand<"ClientEventSequenceNumber">;
209
+ readonly rebaseGeneration: number;
210
+ }, never>, typeof UnknownError>;
188
211
  export declare class LeaderWorkerInnerGetLeaderHead extends LeaderWorkerInnerGetLeaderHead_base {
189
212
  }
190
213
  declare const LeaderWorkerInnerGetLeaderSyncState_base: Schema.TaggedRequestClass<LeaderWorkerInnerGetLeaderSyncState, "GetLeaderSyncState", {
191
214
  readonly _tag: Schema.tag<"GetLeaderSyncState">;
192
- }, typeof SyncState.SyncState, typeof UnexpectedError>;
215
+ }, typeof SyncState.SyncState, typeof UnknownError>;
193
216
  export declare class LeaderWorkerInnerGetLeaderSyncState extends LeaderWorkerInnerGetLeaderSyncState_base {
194
217
  }
195
218
  declare const LeaderWorkerInnerSyncStateStream_base: Schema.TaggedRequestClass<LeaderWorkerInnerSyncStateStream, "SyncStateStream", {
196
219
  readonly _tag: Schema.tag<"SyncStateStream">;
197
- }, typeof SyncState.SyncState, typeof UnexpectedError>;
220
+ }, typeof SyncState.SyncState, typeof UnknownError>;
198
221
  export declare class LeaderWorkerInnerSyncStateStream extends LeaderWorkerInnerSyncStateStream_base {
199
222
  }
200
223
  declare const LeaderWorkerInnerGetNetworkStatus_base: Schema.TaggedRequestClass<LeaderWorkerInnerGetNetworkStatus, "GetNetworkStatus", {
@@ -205,7 +228,7 @@ declare const LeaderWorkerInnerGetNetworkStatus_base: Schema.TaggedRequestClass<
205
228
  devtools: Schema.Struct<{
206
229
  latchClosed: typeof Schema.Boolean;
207
230
  }>;
208
- }>, typeof UnexpectedError>;
231
+ }>, typeof UnknownError>;
209
232
  export declare class LeaderWorkerInnerGetNetworkStatus extends LeaderWorkerInnerGetNetworkStatus_base {
210
233
  }
211
234
  declare const LeaderWorkerInnerNetworkStatusStream_base: Schema.TaggedRequestClass<LeaderWorkerInnerNetworkStatusStream, "NetworkStatusStream", {
@@ -216,12 +239,12 @@ declare const LeaderWorkerInnerNetworkStatusStream_base: Schema.TaggedRequestCla
216
239
  devtools: Schema.Struct<{
217
240
  latchClosed: typeof Schema.Boolean;
218
241
  }>;
219
- }>, typeof UnexpectedError>;
242
+ }>, typeof UnknownError>;
220
243
  export declare class LeaderWorkerInnerNetworkStatusStream extends LeaderWorkerInnerNetworkStatusStream_base {
221
244
  }
222
245
  declare const LeaderWorkerInnerShutdown_base: Schema.TaggedRequestClass<LeaderWorkerInnerShutdown, "Shutdown", {
223
246
  readonly _tag: Schema.tag<"Shutdown">;
224
- }, typeof Schema.Void, typeof UnexpectedError>;
247
+ }, typeof Schema.Void, typeof UnknownError>;
225
248
  export declare class LeaderWorkerInnerShutdown extends LeaderWorkerInnerShutdown_base {
226
249
  }
227
250
  declare const LeaderWorkerInnerExtraDevtoolsMessage_base: Schema.TaggedRequestClass<LeaderWorkerInnerExtraDevtoolsMessage, "ExtraDevtoolsMessage", {
@@ -231,22 +254,22 @@ declare const LeaderWorkerInnerExtraDevtoolsMessage_base: Schema.TaggedRequestCl
231
254
  data: Schema.Schema<Uint8Array<ArrayBuffer>>;
232
255
  } & {
233
256
  readonly requestId: typeof Schema.String;
234
- readonly liveStoreVersion: Schema.Literal<["0.4.0-dev.16"]>;
257
+ readonly liveStoreVersion: Schema.Literal<["0.4.0-dev.18"]>;
235
258
  readonly clientId: typeof Schema.String;
236
259
  }>, typeof Devtools.Leader.EventlogReq, Schema.TaggedStruct<"LSD.Leader.ResetAllData.Request", {
237
260
  mode: Schema.Literal<["all-data", "only-app-db"]>;
238
261
  } & {
239
262
  readonly requestId: typeof Schema.String;
240
- readonly liveStoreVersion: Schema.Literal<["0.4.0-dev.16"]>;
263
+ readonly liveStoreVersion: Schema.Literal<["0.4.0-dev.18"]>;
241
264
  readonly clientId: typeof Schema.String;
242
265
  }>, typeof Devtools.Leader.NetworkStatusSubscribe, typeof Devtools.Leader.NetworkStatusUnsubscribe, typeof Devtools.Leader.Disconnect, typeof Devtools.Leader.CommitEventReq, typeof Devtools.Leader.Ping, typeof Devtools.Leader.DatabaseFileInfoReq, typeof Devtools.Leader.SyncHistorySubscribe, typeof Devtools.Leader.SyncHistoryUnsubscribe, typeof Devtools.Leader.SyncingInfoReq, typeof Devtools.Leader.SyncHeadSubscribe, typeof Devtools.Leader.SyncHeadUnsubscribe, Schema.TaggedStruct<"LSD.Leader.SetSyncLatch.Request", {
243
266
  closeLatch: typeof Schema.Boolean;
244
267
  } & {
245
268
  readonly requestId: typeof Schema.String;
246
- readonly liveStoreVersion: Schema.Literal<["0.4.0-dev.16"]>;
269
+ readonly liveStoreVersion: Schema.Literal<["0.4.0-dev.18"]>;
247
270
  readonly clientId: typeof Schema.String;
248
271
  }>]>;
249
- }, typeof Schema.Void, typeof UnexpectedError>;
272
+ }, typeof Schema.Void, typeof UnknownError>;
250
273
  export declare class LeaderWorkerInnerExtraDevtoolsMessage extends LeaderWorkerInnerExtraDevtoolsMessage_base {
251
274
  }
252
275
  export declare const LeaderWorkerInnerRequest: Schema.Union<[typeof LeaderWorkerInnerInitialMessage, typeof LeaderWorkerInnerBootStatusStream, typeof LeaderWorkerInnerPullStream, typeof LeaderWorkerInnerPushToLeader, typeof LeaderWorkerInnerExport, typeof LeaderWorkerInnerGetRecreateSnapshot, typeof LeaderWorkerInnerExportEventlog, typeof LeaderWorkerInnerGetLeaderHead, typeof LeaderWorkerInnerGetLeaderSyncState, typeof LeaderWorkerInnerSyncStateStream, typeof LeaderWorkerInnerGetNetworkStatus, typeof LeaderWorkerInnerNetworkStatusStream, typeof LeaderWorkerInnerShutdown, typeof LeaderWorkerInnerExtraDevtoolsMessage]>;
@@ -1 +1 @@
1
- {"version":3,"file":"worker-schema.d.ts","sourceRoot":"","sources":["../src/worker-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,gBAAgB,EAGhB,SAAS,EACT,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,MAAM,EAAgB,MAAM,yBAAyB,CAAA;AAE9D,eAAO,MAAM,UAAU;;;;;GAOtB,CAAA;AAED,eAAO,MAAM,mBAAmB;;IAE9B;;;OAGG;;EAEH,CAAA;AAEF,MAAM,MA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ackend, SyncState, UnknownError, } from '@livestore/common';
2
2
  import { EventSequenceNumber, LiveStoreEvent } from '@livestore/common/schema';
3
3
  import { Schema, Transferable } from '@livestore/utils/effect';
4
4
  export const WorkerArgv = Schema.parseJson(Schema.Struct({
@@ -35,7 +35,7 @@ export const SyncBackendOptions = Schema.Record({ key: Schema.String, value: Sch
35
35
  export class LeaderWorkerOuterInitialMessage extends Schema.TaggedRequest()('InitialMessage', {
36
36
  payload: { port: Transferable.MessagePort },
37
37
  success: Schema.Void,
38
- failure: UnexpectedError,
38
+ failure: UnknownError,
39
39
  }) {
40
40
  }
41
41
  export class LeaderWorkerOuterRequest extends Schema.Union(LeaderWorkerOuterInitialMessage) {
@@ -56,37 +56,37 @@ export class LeaderWorkerInnerInitialMessage extends Schema.TaggedRequest()('Ini
56
56
  }), Schema.Struct({ enabled: Schema.Literal(false) })),
57
57
  },
58
58
  success: Schema.Void,
59
- failure: UnexpectedError,
59
+ failure: UnknownError,
60
60
  }) {
61
61
  }
62
62
  export class LeaderWorkerInnerBootStatusStream extends Schema.TaggedRequest()('BootStatusStream', {
63
63
  payload: {},
64
64
  success: BootStatus,
65
- failure: UnexpectedError,
65
+ failure: UnknownError,
66
66
  }) {
67
67
  }
68
68
  export class LeaderWorkerInnerPullStream extends Schema.TaggedRequest()('PullStream', {
69
69
  payload: {
70
- cursor: EventSequenceNumber.EventSequenceNumber,
70
+ cursor: Schema.typeSchema(EventSequenceNumber.Client.Composite),
71
71
  },
72
72
  success: Schema.Struct({
73
73
  payload: SyncState.PayloadUpstream,
74
74
  }),
75
- failure: UnexpectedError,
75
+ failure: UnknownError,
76
76
  }) {
77
77
  }
78
78
  export class LeaderWorkerInnerPushToLeader extends Schema.TaggedRequest()('PushToLeader', {
79
79
  payload: {
80
- batch: Schema.Array(LiveStoreEvent.AnyEncoded),
80
+ batch: Schema.Array(Schema.typeSchema(LiveStoreEvent.Client.Encoded)),
81
81
  },
82
82
  success: Schema.Void,
83
- failure: Schema.Union(UnexpectedError, LeaderAheadError),
83
+ failure: Schema.Union(UnknownError, LeaderAheadError),
84
84
  }) {
85
85
  }
86
86
  export class LeaderWorkerInnerExport extends Schema.TaggedRequest()('Export', {
87
87
  payload: {},
88
88
  success: Transferable.Uint8Array,
89
- failure: UnexpectedError,
89
+ failure: UnknownError,
90
90
  }) {
91
91
  }
92
92
  export class LeaderWorkerInnerGetRecreateSnapshot extends Schema.TaggedRequest()('GetRecreateSnapshot', {
@@ -95,49 +95,49 @@ export class LeaderWorkerInnerGetRecreateSnapshot extends Schema.TaggedRequest()
95
95
  snapshot: Transferable.Uint8Array,
96
96
  migrationsReport: MigrationsReport,
97
97
  }),
98
- failure: UnexpectedError,
98
+ failure: UnknownError,
99
99
  }) {
100
100
  }
101
101
  export class LeaderWorkerInnerExportEventlog extends Schema.TaggedRequest()('ExportEventlog', {
102
102
  payload: {},
103
103
  success: Transferable.Uint8Array,
104
- failure: UnexpectedError,
104
+ failure: UnknownError,
105
105
  }) {
106
106
  }
107
107
  export class LeaderWorkerInnerGetLeaderHead extends Schema.TaggedRequest()('GetLeaderHead', {
108
108
  payload: {},
109
- success: EventSequenceNumber.EventSequenceNumber,
110
- failure: UnexpectedError,
109
+ success: Schema.typeSchema(EventSequenceNumber.Client.Composite),
110
+ failure: UnknownError,
111
111
  }) {
112
112
  }
113
113
  export class LeaderWorkerInnerGetLeaderSyncState extends Schema.TaggedRequest()('GetLeaderSyncState', {
114
114
  payload: {},
115
115
  success: SyncState.SyncState,
116
- failure: UnexpectedError,
116
+ failure: UnknownError,
117
117
  }) {
118
118
  }
119
119
  export class LeaderWorkerInnerSyncStateStream extends Schema.TaggedRequest()('SyncStateStream', {
120
120
  payload: {},
121
121
  success: SyncState.SyncState,
122
- failure: UnexpectedError,
122
+ failure: UnknownError,
123
123
  }) {
124
124
  }
125
125
  export class LeaderWorkerInnerGetNetworkStatus extends Schema.TaggedRequest()('GetNetworkStatus', {
126
126
  payload: {},
127
127
  success: SyncBackend.NetworkStatus,
128
- failure: UnexpectedError,
128
+ failure: UnknownError,
129
129
  }) {
130
130
  }
131
131
  export class LeaderWorkerInnerNetworkStatusStream extends Schema.TaggedRequest()('NetworkStatusStream', {
132
132
  payload: {},
133
133
  success: SyncBackend.NetworkStatus,
134
- failure: UnexpectedError,
134
+ failure: UnknownError,
135
135
  }) {
136
136
  }
137
137
  export class LeaderWorkerInnerShutdown extends Schema.TaggedRequest()('Shutdown', {
138
138
  payload: {},
139
139
  success: Schema.Void,
140
- failure: UnexpectedError,
140
+ failure: UnknownError,
141
141
  }) {
142
142
  }
143
143
  export class LeaderWorkerInnerExtraDevtoolsMessage extends Schema.TaggedRequest()('ExtraDevtoolsMessage', {
@@ -145,7 +145,7 @@ export class LeaderWorkerInnerExtraDevtoolsMessage extends Schema.TaggedRequest(
145
145
  message: Devtools.Leader.MessageToApp,
146
146
  },
147
147
  success: Schema.Void,
148
- failure: UnexpectedError,
148
+ failure: UnknownError,
149
149
  }) {
150
150
  }
151
151
  export const LeaderWorkerInnerRequest = Schema.Union(LeaderWorkerInnerInitialMessage, LeaderWorkerInnerBootStatusStream, LeaderWorkerInnerPullStream, LeaderWorkerInnerPushToLeader, LeaderWorkerInnerExport, LeaderWorkerInnerGetRecreateSnapshot, LeaderWorkerInnerExportEventlog, LeaderWorkerInnerGetLeaderHead, LeaderWorkerInnerGetLeaderSyncState, LeaderWorkerInnerSyncStateStream, LeaderWorkerInnerGetNetworkStatus, LeaderWorkerInnerNetworkStatusStream, LeaderWorkerInnerShutdown, LeaderWorkerInnerExtraDevtoolsMessage);
@@ -1 +1 @@
1
- {"version":3,"file":"worker-schema.js","sourceRoot":"","sources":["../src/worker-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;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E,EAAE;IACX,OAAO,EAAE,WAAW,CAAC,aAAa;IAClC,OAAO,EAAE,YAAY;CACtB,CACF;CAAG;AAEJ,MAAM,OAAO,yBAA0B,SAAQ,MAAM,CAAC,aAAa,EAA6B,CAAC,UAAU,EAAE;IAC3G,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,MAAM,CAAC,IAAI;IACpB,OAAO,EAAE,YAAY;CACtB,CAAC;CAAG;AAEL,MAAM,OAAO,qCAAsC,SAAQ,MAAM,CAAC,aAAa,EAAyC,CACtH,sBAAsB,EACtB;IACE,OAAO,EAAE;QACP,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY;KACtC;IACD,OAAO,EAAE,MAAM,CAAC,IAAI;IACpB,OAAO,EAAE,YAAY;CACtB,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,KAAK,CAClD,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,oCAAoC,EACpC,+BAA+B,EAC/B,8BAA8B,EAC9B,mCAAmC,EACnC,gCAAgC,EAChC,iCAAiC,EACjC,oCAAoC,EACpC,yBAAyB,EACzB,qCAAqC,CACtC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/adapter-node",
3
- "version": "0.4.0-dev.17",
3
+ "version": "0.4.0-dev.19",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -9,13 +9,13 @@
9
9
  "./worker": "./dist/make-leader-worker.js"
10
10
  },
11
11
  "dependencies": {
12
- "@livestore/devtools-vite": "0.4.0-dev.17",
12
+ "@livestore/devtools-vite": "0.4.0-dev.19",
13
13
  "@opentelemetry/api": "1.9.0",
14
- "vite": "7.1.7",
15
- "@livestore/common": "0.4.0-dev.17",
16
- "@livestore/webmesh": "0.4.0-dev.17",
17
- "@livestore/utils": "0.4.0-dev.17",
18
- "@livestore/sqlite-wasm": "0.4.0-dev.17"
14
+ "vite": "7.2.4",
15
+ "@livestore/common": "0.4.0-dev.19",
16
+ "@livestore/utils": "0.4.0-dev.19",
17
+ "@livestore/sqlite-wasm": "0.4.0-dev.19",
18
+ "@livestore/webmesh": "0.4.0-dev.19"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@rollup/plugin-commonjs": "^28.0.6",
@@ -11,7 +11,7 @@ import {
11
11
  makeClientSession,
12
12
  type SyncError,
13
13
  type SyncOptions,
14
- UnexpectedError,
14
+ UnknownError,
15
15
  } from '@livestore/common'
16
16
  import { Eventlog, LeaderThreadCtx } from '@livestore/common/leader-thread'
17
17
  import type { LiveStoreSchema } from '@livestore/common/schema'
@@ -159,7 +159,7 @@ const makeAdapterImpl = ({
159
159
  if (resetPersistence === true) {
160
160
  yield* shutdownChannel
161
161
  .send(IntentionalShutdownCause.make({ reason: 'adapter-reset' }))
162
- .pipe(UnexpectedError.mapToUnexpectedError)
162
+ .pipe(UnknownError.mapToUnknownError)
163
163
 
164
164
  yield* resetNodePersistence({ storage, storeId })
165
165
  }
@@ -210,7 +210,7 @@ const makeAdapterImpl = ({
210
210
  syncPayloadSchema,
211
211
  testing,
212
212
  }),
213
- }).pipe(UnexpectedError.mapToUnexpectedError)
213
+ }).pipe(UnknownError.mapToUnknownError)
214
214
  : yield* makeWorkerLeaderThread({
215
215
  shutdown,
216
216
  storeId,
@@ -262,7 +262,7 @@ const resetNodePersistence = ({
262
262
  }: {
263
263
  storage: WorkerSchema.StorageType
264
264
  storeId: string
265
- }): Effect.Effect<void, UnexpectedError, FileSystem.FileSystem> => {
265
+ }): Effect.Effect<void, UnknownError, FileSystem.FileSystem> => {
266
266
  if (storage.type !== 'fs') {
267
267
  return Effect.void
268
268
  }
@@ -272,13 +272,13 @@ const resetNodePersistence = ({
272
272
  return Effect.gen(function* () {
273
273
  const fs = yield* FileSystem.FileSystem
274
274
 
275
- const directoryExists = yield* fs.exists(directory).pipe(UnexpectedError.mapToUnexpectedError)
275
+ const directoryExists = yield* fs.exists(directory).pipe(UnknownError.mapToUnknownError)
276
276
 
277
277
  if (directoryExists === false) {
278
278
  return
279
279
  }
280
280
 
281
- yield* fs.remove(directory, { recursive: true }).pipe(UnexpectedError.mapToUnexpectedError)
281
+ yield* fs.remove(directory, { recursive: true }).pipe(UnknownError.mapToUnknownError)
282
282
  }).pipe(
283
283
  Effect.retry({ schedule: Schedule.exponentialBackoff10Sec }),
284
284
  Effect.withSpan('@livestore/adapter-node:resetPersistence', { attributes: { directory } }),
@@ -338,7 +338,7 @@ const makeLocalLeaderThread = ({
338
338
  pull: ({ cursor }) => syncProcessor.pull({ cursor }),
339
339
  push: (batch) =>
340
340
  syncProcessor.push(
341
- batch.map((item) => new LiveStoreEvent.EncodedWithMeta(item)),
341
+ batch.map((item) => new LiveStoreEvent.Client.EncodedWithMeta(item)),
342
342
  { waitForProcessing: true },
343
343
  ),
344
344
  },
@@ -371,7 +371,7 @@ const makeWorkerLeaderThread = ({
371
371
  syncPayloadEncoded,
372
372
  testing,
373
373
  }: {
374
- shutdown: (cause: Exit.Exit<IntentionalShutdownCause, UnexpectedError | SyncError>) => Effect.Effect<void>
374
+ shutdown: (cause: Exit.Exit<IntentionalShutdownCause, UnknownError | SyncError>) => Effect.Effect<void>
375
375
  storeId: string
376
376
  clientId: string
377
377
  sessionId: string
@@ -405,7 +405,7 @@ const makeWorkerLeaderThread = ({
405
405
  }),
406
406
  }).pipe(
407
407
  Effect.provide(nodeWorkerLayer),
408
- UnexpectedError.mapToUnexpectedError,
408
+ UnknownError.mapToUnknownError,
409
409
  Effect.tapErrorCause((cause) => shutdown(Exit.failCause(cause))),
410
410
  Effect.withSpan('@livestore/adapter-node:adapter:setupLeaderThread'),
411
411
  )
@@ -413,7 +413,7 @@ const makeWorkerLeaderThread = ({
413
413
  const runInWorker = <TReq extends typeof WorkerSchema.LeaderWorkerInnerRequest.Type>(
414
414
  req: TReq,
415
415
  ): TReq extends Schema.WithResult<infer A, infer _I, infer _E, infer _EI, infer R>
416
- ? Effect.Effect<A, UnexpectedError, R>
416
+ ? Effect.Effect<A, UnknownError, R>
417
417
  : never =>
418
418
  (worker.executeEffect(req) as any).pipe(
419
419
  Effect.logWarnIfTakesLongerThan({
@@ -422,26 +422,26 @@ const makeWorkerLeaderThread = ({
422
422
  }),
423
423
  Effect.withSpan(`@livestore/adapter-node:client-session:runInWorker:${req._tag}`),
424
424
  Effect.mapError((cause) =>
425
- Schema.is(UnexpectedError)(cause)
425
+ Schema.is(UnknownError)(cause)
426
426
  ? cause
427
427
  : ParseResult.isParseError(cause) || Schema.is(WorkerError.WorkerError)(cause)
428
- ? new UnexpectedError({ cause })
428
+ ? new UnknownError({ cause })
429
429
  : cause,
430
430
  ),
431
- Effect.catchAllDefect((cause) => new UnexpectedError({ cause })),
431
+ Effect.catchAllDefect((cause) => new UnknownError({ cause })),
432
432
  ) as any
433
433
 
434
434
  const runInWorkerStream = <TReq extends typeof WorkerSchema.LeaderWorkerInnerRequest.Type>(
435
435
  req: TReq,
436
436
  ): TReq extends Schema.WithResult<infer A, infer _I, infer _E, infer _EI, infer R>
437
- ? Stream.Stream<A, UnexpectedError, R>
437
+ ? Stream.Stream<A, UnknownError, R>
438
438
  : never =>
439
439
  worker.execute(req as any).pipe(
440
440
  Stream.mapError((cause) =>
441
- Schema.is(UnexpectedError)(cause)
441
+ Schema.is(UnknownError)(cause)
442
442
  ? cause
443
443
  : ParseResult.isParseError(cause) || Schema.is(WorkerError.WorkerError)(cause)
444
- ? new UnexpectedError({ cause })
444
+ ? new UnknownError({ cause })
445
445
  : cause,
446
446
  ),
447
447
  Stream.withSpan(`@livestore/adapter-node:client-session:runInWorkerStream:${req._tag}`),
@@ -466,7 +466,7 @@ const makeWorkerLeaderThread = ({
466
466
 
467
467
  const bootResult = yield* runInWorker(new WorkerSchema.LeaderWorkerInnerGetRecreateSnapshot()).pipe(
468
468
  Effect.timeout(10_000),
469
- UnexpectedError.mapToUnexpectedError,
469
+ UnknownError.mapToUnknownError,
470
470
  Effect.withSpan('@livestore/adapter-node:client-session:export'),
471
471
  )
472
472
 
@@ -488,20 +488,20 @@ const makeWorkerLeaderThread = ({
488
488
  },
489
489
  export: runInWorker(new WorkerSchema.LeaderWorkerInnerExport()).pipe(
490
490
  Effect.timeout(10_000),
491
- UnexpectedError.mapToUnexpectedError,
491
+ UnknownError.mapToUnknownError,
492
492
  Effect.withSpan('@livestore/adapter-node:client-session:export'),
493
493
  ),
494
494
  getEventlogData: Effect.dieMessage('Not implemented'),
495
495
  syncState: Subscribable.make({
496
496
  get: runInWorker(new WorkerSchema.LeaderWorkerInnerGetLeaderSyncState()).pipe(
497
- UnexpectedError.mapToUnexpectedError,
497
+ UnknownError.mapToUnknownError,
498
498
  Effect.withSpan('@livestore/adapter-node:client-session:getLeaderSyncState'),
499
499
  ),
500
500
  changes: runInWorkerStream(new WorkerSchema.LeaderWorkerInnerSyncStateStream()).pipe(Stream.orDie),
501
501
  }),
502
502
  sendDevtoolsMessage: (message) =>
503
503
  runInWorker(new WorkerSchema.LeaderWorkerInnerExtraDevtoolsMessage({ message })).pipe(
504
- UnexpectedError.mapToUnexpectedError,
504
+ UnknownError.mapToUnknownError,
505
505
  Effect.withSpan('@livestore/adapter-node:client-session:devtoolsMessageForLeader'),
506
506
  ),
507
507
  networkStatus: Subscribable.make({
@@ -1,7 +1,7 @@
1
1
  import path from 'node:path'
2
2
 
3
3
  import type { Devtools } from '@livestore/common'
4
- import { UnexpectedError } from '@livestore/common'
4
+ import { UnknownError } from '@livestore/common'
5
5
  import { livestoreDevtoolsPlugin } from '@livestore/devtools-vite'
6
6
  import { isReadonlyArray } from '@livestore/utils'
7
7
  import { Effect } from '@livestore/utils/effect'
@@ -26,11 +26,11 @@ export type ViteDevtoolsOptions = {
26
26
  }
27
27
 
28
28
  // NOTE this is currently also used in @livestore/devtools-expo
29
- export const makeViteMiddleware = (options: ViteDevtoolsOptions): Effect.Effect<Vite.ViteDevServer, UnexpectedError> =>
29
+ export const makeViteMiddleware = (options: ViteDevtoolsOptions): Effect.Effect<Vite.ViteDevServer, UnknownError> =>
30
30
  Effect.gen(function* () {
31
31
  const cwd = process.cwd()
32
32
 
33
- const hmrPort = yield* getFreePort.pipe(UnexpectedError.mapToUnexpectedError)
33
+ const hmrPort = yield* getFreePort.pipe(UnknownError.mapToUnknownError)
34
34
 
35
35
  const defaultViteConfig = Vite.defineConfig({
36
36
  server: {
@@ -58,9 +58,7 @@ export const makeViteMiddleware = (options: ViteDevtoolsOptions): Effect.Effect<
58
58
 
59
59
  const viteConfig = options.viteConfig?.(defaultViteConfig) ?? defaultViteConfig
60
60
 
61
- const viteServer = yield* Effect.promise(() => Vite.createServer(viteConfig)).pipe(
62
- UnexpectedError.mapToUnexpectedError,
63
- )
61
+ const viteServer = yield* Effect.promise(() => Vite.createServer(viteConfig)).pipe(UnknownError.mapToUnknownError)
64
62
 
65
63
  return viteServer
66
64
  }).pipe(Effect.withSpan('@livestore/adapter-node:devtools:makeViteServer'))
@@ -7,7 +7,7 @@ if (process.execArgv.includes('--inspect')) {
7
7
  }
8
8
 
9
9
  import type { ClientSessionLeaderThreadProxy, MakeSqliteDb, SqliteDb, SyncOptions } from '@livestore/common'
10
- import { Devtools, liveStoreStorageFormatVersion, migrateDb, UnexpectedError } from '@livestore/common'
10
+ import { Devtools, liveStoreStorageFormatVersion, migrateDb, UnknownError } from '@livestore/common'
11
11
  import type { DevtoolsOptions, LeaderSqliteDb, LeaderThreadCtx } from '@livestore/common/leader-thread'
12
12
  import { configureConnection, makeLeaderThreadLayer } from '@livestore/common/leader-thread'
13
13
  import type { LiveStoreSchema } from '@livestore/common/schema'
@@ -30,7 +30,7 @@ export type TestingOverrides = {
30
30
  dbEventlog: SqliteDb
31
31
  dbState: SqliteDb
32
32
  },
33
- UnexpectedError
33
+ UnknownError
34
34
  >
35
35
  }
36
36
 
@@ -59,8 +59,8 @@ export const makeLeaderThread = ({
59
59
  syncPayloadSchema,
60
60
  testing,
61
61
  }: MakeLeaderThreadArgs): Effect.Effect<
62
- Layer.Layer<LeaderThreadCtx, UnexpectedError, Scope.Scope | HttpClient.HttpClient | FileSystem.FileSystem>,
63
- UnexpectedError,
62
+ Layer.Layer<LeaderThreadCtx, UnknownError, Scope.Scope | HttpClient.HttpClient | FileSystem.FileSystem>,
63
+ UnknownError,
64
64
  Scope.Scope
65
65
  > =>
66
66
  Effect.gen(function* () {
@@ -120,7 +120,7 @@ export const makeLeaderThread = ({
120
120
  })
121
121
  }).pipe(
122
122
  Effect.tapCauseLogPretty,
123
- UnexpectedError.mapToUnexpectedError,
123
+ UnknownError.mapToUnknownError,
124
124
  Effect.withSpan('@livestore/adapter-node:makeLeaderThread', {
125
125
  attributes: { storeId, clientId, storage, devtools, syncOptions },
126
126
  }),
@@ -140,7 +140,7 @@ const makeDevtoolsOptions = ({
140
140
  storeId: string
141
141
  clientId: string
142
142
  devtools: WorkerSchema.LeaderWorkerInnerInitialMessage['devtools']
143
- }): Effect.Effect<DevtoolsOptions, UnexpectedError, Scope.Scope> =>
143
+ }): Effect.Effect<DevtoolsOptions, UnknownError, Scope.Scope> =>
144
144
  Effect.gen(function* () {
145
145
  if (devtools.enabled === false) {
146
146
  return {