@livestore/common 0.3.0-dev.7 → 0.3.0-dev.9

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.
Files changed (67) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/devtools/devtools-messages.d.ts +47 -47
  3. package/dist/index.d.ts +0 -4
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/leader-thread/LeaderSyncProcessor.d.ts +37 -0
  6. package/dist/leader-thread/LeaderSyncProcessor.d.ts.map +1 -0
  7. package/dist/leader-thread/LeaderSyncProcessor.js +421 -0
  8. package/dist/leader-thread/LeaderSyncProcessor.js.map +1 -0
  9. package/dist/leader-thread/apply-mutation.js +1 -1
  10. package/dist/leader-thread/apply-mutation.js.map +1 -1
  11. package/dist/leader-thread/leader-sync-processor.d.ts +2 -2
  12. package/dist/leader-thread/leader-sync-processor.d.ts.map +1 -1
  13. package/dist/leader-thread/leader-sync-processor.js.map +1 -1
  14. package/dist/leader-thread/leader-worker-devtools.d.ts +1 -1
  15. package/dist/leader-thread/make-leader-thread-layer.d.ts +5 -6
  16. package/dist/leader-thread/make-leader-thread-layer.d.ts.map +1 -1
  17. package/dist/leader-thread/make-leader-thread-layer.js +7 -4
  18. package/dist/leader-thread/make-leader-thread-layer.js.map +1 -1
  19. package/dist/leader-thread/pull-queue-set.d.ts.map +1 -1
  20. package/dist/leader-thread/types.d.ts +11 -5
  21. package/dist/leader-thread/types.d.ts.map +1 -1
  22. package/dist/leader-thread/types.js.map +1 -1
  23. package/dist/schema/EventId.test.d.ts +2 -0
  24. package/dist/schema/EventId.test.d.ts.map +1 -0
  25. package/dist/schema/EventId.test.js +11 -0
  26. package/dist/schema/EventId.test.js.map +1 -0
  27. package/dist/schema/MutationEvent.d.ts +6 -5
  28. package/dist/schema/MutationEvent.d.ts.map +1 -1
  29. package/dist/schema/MutationEvent.js +2 -2
  30. package/dist/schema/MutationEvent.js.map +1 -1
  31. package/dist/schema/MutationEvent.test.d.ts +2 -0
  32. package/dist/schema/MutationEvent.test.d.ts.map +1 -0
  33. package/dist/schema/MutationEvent.test.js +2 -0
  34. package/dist/schema/MutationEvent.test.js.map +1 -0
  35. package/dist/sync/ClientSessionSyncProcessor.d.ts +45 -0
  36. package/dist/sync/ClientSessionSyncProcessor.d.ts.map +1 -0
  37. package/dist/sync/ClientSessionSyncProcessor.js +133 -0
  38. package/dist/sync/ClientSessionSyncProcessor.js.map +1 -0
  39. package/dist/sync/index.d.ts +1 -1
  40. package/dist/sync/index.d.ts.map +1 -1
  41. package/dist/sync/index.js +1 -1
  42. package/dist/sync/index.js.map +1 -1
  43. package/dist/sync/sync.d.ts +15 -5
  44. package/dist/sync/sync.d.ts.map +1 -1
  45. package/dist/sync/sync.js.map +1 -1
  46. package/dist/sync/syncstate.d.ts +39 -17
  47. package/dist/sync/syncstate.d.ts.map +1 -1
  48. package/dist/sync/syncstate.js +56 -12
  49. package/dist/sync/syncstate.js.map +1 -1
  50. package/dist/sync/syncstate.test.js +123 -63
  51. package/dist/sync/syncstate.test.js.map +1 -1
  52. package/dist/version.d.ts +1 -1
  53. package/dist/version.js +1 -1
  54. package/package.json +3 -3
  55. package/src/index.ts +0 -6
  56. package/src/leader-thread/{leader-sync-processor.ts → LeaderSyncProcessor.ts} +205 -212
  57. package/src/leader-thread/apply-mutation.ts +1 -1
  58. package/src/leader-thread/make-leader-thread-layer.ts +9 -8
  59. package/src/leader-thread/types.ts +12 -4
  60. package/src/schema/EventId.test.ts +12 -0
  61. package/src/schema/MutationEvent.ts +7 -3
  62. package/src/sync/{client-session-sync-processor.ts → ClientSessionSyncProcessor.ts} +6 -5
  63. package/src/sync/index.ts +1 -1
  64. package/src/sync/sync.ts +15 -4
  65. package/src/sync/syncstate.test.ts +123 -63
  66. package/src/sync/syncstate.ts +21 -19
  67. package/src/version.ts +1 -1
@@ -2,7 +2,7 @@ import { Schema } from '@livestore/utils/effect';
2
2
  declare const SnapshotReq_base: Schema.Struct<{
3
3
  _tag: Schema.tag<"LSD.Leader.SnapshotReq">;
4
4
  } & {
5
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
5
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
6
6
  } & {
7
7
  requestId: typeof Schema.String;
8
8
  }>;
@@ -11,7 +11,7 @@ export declare class SnapshotReq extends SnapshotReq_base {
11
11
  declare const SnapshotRes_base: Schema.Struct<{
12
12
  _tag: Schema.tag<"LSD.Leader.SnapshotRes">;
13
13
  } & {
14
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
14
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
15
15
  } & {
16
16
  requestId: typeof Schema.String;
17
17
  } & {
@@ -22,7 +22,7 @@ export declare class SnapshotRes extends SnapshotRes_base {
22
22
  declare const LoadDatabaseFileReq_base: Schema.Struct<{
23
23
  _tag: Schema.tag<"LSD.Leader.LoadDatabaseFileReq">;
24
24
  } & {
25
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
25
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
26
26
  } & {
27
27
  requestId: typeof Schema.String;
28
28
  } & {
@@ -33,7 +33,7 @@ export declare class LoadDatabaseFileReq extends LoadDatabaseFileReq_base {
33
33
  declare const LoadDatabaseFileRes_base: Schema.Struct<{
34
34
  _tag: Schema.tag<"LSD.Leader.LoadDatabaseFileRes">;
35
35
  } & {
36
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
36
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
37
37
  } & {
38
38
  requestId: typeof Schema.String;
39
39
  } & {
@@ -44,7 +44,7 @@ export declare class LoadDatabaseFileRes extends LoadDatabaseFileRes_base {
44
44
  declare const DebugInfoReq_base: Schema.Struct<{
45
45
  _tag: Schema.tag<"LSD.DebugInfoReq">;
46
46
  } & {
47
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
47
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
48
48
  } & {
49
49
  clientId: typeof Schema.String;
50
50
  sessionId: typeof Schema.String;
@@ -55,7 +55,7 @@ export declare class DebugInfoReq extends DebugInfoReq_base {
55
55
  declare const DebugInfoRes_base: Schema.Struct<{
56
56
  _tag: Schema.tag<"LSD.DebugInfoRes">;
57
57
  } & {
58
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
58
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
59
59
  } & {
60
60
  clientId: typeof Schema.String;
61
61
  sessionId: typeof Schema.String;
@@ -65,38 +65,38 @@ declare const DebugInfoRes_base: Schema.Struct<{
65
65
  slowQueries: Schema.transform<Schema.Struct<{
66
66
  size: typeof Schema.Number;
67
67
  items: Schema.Array$<Schema.Schema<{
68
- readonly queryStr: string;
69
68
  readonly bindValues: ((readonly (string | number | Uint8Array<ArrayBufferLike> | null)[] | {
70
69
  readonly [x: string]: string | number | Uint8Array<ArrayBufferLike> | null;
71
70
  }) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
71
+ readonly queryStr: string;
72
72
  readonly durationMs: number;
73
73
  readonly rowsCount: number | undefined;
74
74
  readonly queriedTables: ReadonlySet<string>;
75
75
  readonly startTimePerfNow: number;
76
76
  }, {
77
- readonly queryStr: string;
78
77
  readonly bindValues: readonly (string | number | readonly number[] | null)[] | {
79
78
  readonly [x: string]: string | number | readonly number[] | null;
80
79
  } | undefined;
80
+ readonly queryStr: string;
81
81
  readonly durationMs: number;
82
82
  readonly rowsCount: number | undefined;
83
83
  readonly queriedTables: readonly string[];
84
84
  readonly startTimePerfNow: number;
85
85
  }, never>>;
86
86
  }>, Schema.Schema<import("../bounded-collections.js").BoundArray<{
87
- readonly queryStr: string;
88
87
  readonly bindValues: ((readonly (string | number | Uint8Array<ArrayBufferLike> | null)[] | {
89
88
  readonly [x: string]: string | number | Uint8Array<ArrayBufferLike> | null;
90
89
  }) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
90
+ readonly queryStr: string;
91
91
  readonly durationMs: number;
92
92
  readonly rowsCount: number | undefined;
93
93
  readonly queriedTables: ReadonlySet<string>;
94
94
  readonly startTimePerfNow: number;
95
95
  }>, import("../bounded-collections.js").BoundArray<{
96
- readonly queryStr: string;
97
96
  readonly bindValues: ((readonly (string | number | Uint8Array<ArrayBufferLike> | null)[] | {
98
97
  readonly [x: string]: string | number | Uint8Array<ArrayBufferLike> | null;
99
98
  }) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
99
+ readonly queryStr: string;
100
100
  readonly durationMs: number;
101
101
  readonly rowsCount: number | undefined;
102
102
  readonly queriedTables: ReadonlySet<string>;
@@ -115,7 +115,7 @@ export declare class DebugInfoRes extends DebugInfoRes_base {
115
115
  declare const DebugInfoHistorySubscribe_base: Schema.Struct<{
116
116
  _tag: Schema.tag<"LSD.DebugInfoHistorySubscribe">;
117
117
  } & {
118
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
118
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
119
119
  } & {
120
120
  clientId: typeof Schema.String;
121
121
  sessionId: typeof Schema.String;
@@ -126,7 +126,7 @@ export declare class DebugInfoHistorySubscribe extends DebugInfoHistorySubscribe
126
126
  declare const DebugInfoHistoryRes_base: Schema.Struct<{
127
127
  _tag: Schema.tag<"LSD.DebugInfoHistoryRes">;
128
128
  } & {
129
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
129
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
130
130
  } & {
131
131
  clientId: typeof Schema.String;
132
132
  sessionId: typeof Schema.String;
@@ -136,38 +136,38 @@ declare const DebugInfoHistoryRes_base: Schema.Struct<{
136
136
  slowQueries: Schema.transform<Schema.Struct<{
137
137
  size: typeof Schema.Number;
138
138
  items: Schema.Array$<Schema.Schema<{
139
- readonly queryStr: string;
140
139
  readonly bindValues: ((readonly (string | number | Uint8Array<ArrayBufferLike> | null)[] | {
141
140
  readonly [x: string]: string | number | Uint8Array<ArrayBufferLike> | null;
142
141
  }) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
142
+ readonly queryStr: string;
143
143
  readonly durationMs: number;
144
144
  readonly rowsCount: number | undefined;
145
145
  readonly queriedTables: ReadonlySet<string>;
146
146
  readonly startTimePerfNow: number;
147
147
  }, {
148
- readonly queryStr: string;
149
148
  readonly bindValues: readonly (string | number | readonly number[] | null)[] | {
150
149
  readonly [x: string]: string | number | readonly number[] | null;
151
150
  } | undefined;
151
+ readonly queryStr: string;
152
152
  readonly durationMs: number;
153
153
  readonly rowsCount: number | undefined;
154
154
  readonly queriedTables: readonly string[];
155
155
  readonly startTimePerfNow: number;
156
156
  }, never>>;
157
157
  }>, Schema.Schema<import("../bounded-collections.js").BoundArray<{
158
- readonly queryStr: string;
159
158
  readonly bindValues: ((readonly (string | number | Uint8Array<ArrayBufferLike> | null)[] | {
160
159
  readonly [x: string]: string | number | Uint8Array<ArrayBufferLike> | null;
161
160
  }) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
161
+ readonly queryStr: string;
162
162
  readonly durationMs: number;
163
163
  readonly rowsCount: number | undefined;
164
164
  readonly queriedTables: ReadonlySet<string>;
165
165
  readonly startTimePerfNow: number;
166
166
  }>, import("../bounded-collections.js").BoundArray<{
167
- readonly queryStr: string;
168
167
  readonly bindValues: ((readonly (string | number | Uint8Array<ArrayBufferLike> | null)[] | {
169
168
  readonly [x: string]: string | number | Uint8Array<ArrayBufferLike> | null;
170
169
  }) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
170
+ readonly queryStr: string;
171
171
  readonly durationMs: number;
172
172
  readonly rowsCount: number | undefined;
173
173
  readonly queriedTables: ReadonlySet<string>;
@@ -186,7 +186,7 @@ export declare class DebugInfoHistoryRes extends DebugInfoHistoryRes_base {
186
186
  declare const DebugInfoHistoryUnsubscribe_base: Schema.Struct<{
187
187
  _tag: Schema.tag<"LSD.DebugInfoHistoryUnsubscribe">;
188
188
  } & {
189
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
189
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
190
190
  } & {
191
191
  clientId: typeof Schema.String;
192
192
  sessionId: typeof Schema.String;
@@ -197,7 +197,7 @@ export declare class DebugInfoHistoryUnsubscribe extends DebugInfoHistoryUnsubsc
197
197
  declare const DebugInfoResetReq_base: Schema.Struct<{
198
198
  _tag: Schema.tag<"LSD.DebugInfoResetReq">;
199
199
  } & {
200
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
200
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
201
201
  } & {
202
202
  clientId: typeof Schema.String;
203
203
  sessionId: typeof Schema.String;
@@ -208,7 +208,7 @@ export declare class DebugInfoResetReq extends DebugInfoResetReq_base {
208
208
  declare const DebugInfoResetRes_base: Schema.Struct<{
209
209
  _tag: Schema.tag<"LSD.DebugInfoResetRes">;
210
210
  } & {
211
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
211
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
212
212
  } & {
213
213
  clientId: typeof Schema.String;
214
214
  sessionId: typeof Schema.String;
@@ -219,7 +219,7 @@ export declare class DebugInfoResetRes extends DebugInfoResetRes_base {
219
219
  declare const DebugInfoRerunQueryReq_base: Schema.Struct<{
220
220
  _tag: Schema.tag<"LSD.DebugInfoRerunQueryReq">;
221
221
  } & {
222
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
222
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
223
223
  } & {
224
224
  clientId: typeof Schema.String;
225
225
  sessionId: typeof Schema.String;
@@ -234,7 +234,7 @@ export declare class DebugInfoRerunQueryReq extends DebugInfoRerunQueryReq_base
234
234
  declare const DebugInfoRerunQueryRes_base: Schema.Struct<{
235
235
  _tag: Schema.tag<"LSD.DebugInfoRerunQueryRes">;
236
236
  } & {
237
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
237
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
238
238
  } & {
239
239
  clientId: typeof Schema.String;
240
240
  sessionId: typeof Schema.String;
@@ -245,7 +245,7 @@ export declare class DebugInfoRerunQueryRes extends DebugInfoRerunQueryRes_base
245
245
  declare const MutationBroadcast_base: Schema.Struct<{
246
246
  _tag: Schema.tag<"LSD.Leader.MutationBroadcast">;
247
247
  } & {
248
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
248
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
249
249
  } & {
250
250
  mutationEventEncoded: Schema.Struct<{
251
251
  mutation: typeof Schema.String;
@@ -265,7 +265,7 @@ export declare class MutationBroadcast extends MutationBroadcast_base {
265
265
  declare const RunMutationReq_base: Schema.Struct<{
266
266
  _tag: Schema.tag<"LSD.Leader.RunMutationReq">;
267
267
  } & {
268
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
268
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
269
269
  } & {
270
270
  requestId: typeof Schema.String;
271
271
  } & {
@@ -282,7 +282,7 @@ export declare class RunMutationReq extends RunMutationReq_base {
282
282
  declare const RunMutationRes_base: Schema.Struct<{
283
283
  _tag: Schema.tag<"LSD.Leader.RunMutationRes">;
284
284
  } & {
285
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
285
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
286
286
  } & {
287
287
  requestId: typeof Schema.String;
288
288
  }>;
@@ -291,7 +291,7 @@ export declare class RunMutationRes extends RunMutationRes_base {
291
291
  declare const MutationLogReq_base: Schema.Struct<{
292
292
  _tag: Schema.tag<"LSD.Leader.MutationLogReq">;
293
293
  } & {
294
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
294
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
295
295
  } & {
296
296
  requestId: typeof Schema.String;
297
297
  }>;
@@ -300,7 +300,7 @@ export declare class MutationLogReq extends MutationLogReq_base {
300
300
  declare const MutationLogRes_base: Schema.Struct<{
301
301
  _tag: Schema.tag<"LSD.Leader.MutationLogRes">;
302
302
  } & {
303
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
303
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
304
304
  } & {
305
305
  requestId: typeof Schema.String;
306
306
  } & {
@@ -311,7 +311,7 @@ export declare class MutationLogRes extends MutationLogRes_base {
311
311
  declare const ReactivityGraphSubscribe_base: Schema.Struct<{
312
312
  _tag: Schema.tag<"LSD.ReactivityGraphSubscribe">;
313
313
  } & {
314
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
314
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
315
315
  } & {
316
316
  clientId: typeof Schema.String;
317
317
  sessionId: typeof Schema.String;
@@ -324,7 +324,7 @@ export declare class ReactivityGraphSubscribe extends ReactivityGraphSubscribe_b
324
324
  declare const ReactivityGraphUnsubscribe_base: Schema.Struct<{
325
325
  _tag: Schema.tag<"LSD.ReactivityGraphUnsubscribe">;
326
326
  } & {
327
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
327
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
328
328
  } & {
329
329
  clientId: typeof Schema.String;
330
330
  sessionId: typeof Schema.String;
@@ -335,7 +335,7 @@ export declare class ReactivityGraphUnsubscribe extends ReactivityGraphUnsubscri
335
335
  declare const ReactivityGraphRes_base: Schema.Struct<{
336
336
  _tag: Schema.tag<"LSD.ReactivityGraphRes">;
337
337
  } & {
338
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
338
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
339
339
  } & {
340
340
  clientId: typeof Schema.String;
341
341
  sessionId: typeof Schema.String;
@@ -348,7 +348,7 @@ export declare class ReactivityGraphRes extends ReactivityGraphRes_base {
348
348
  declare const LiveQueriesSubscribe_base: Schema.Struct<{
349
349
  _tag: Schema.tag<"LSD.LiveQueriesSubscribe">;
350
350
  } & {
351
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
351
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
352
352
  } & {
353
353
  clientId: typeof Schema.String;
354
354
  sessionId: typeof Schema.String;
@@ -359,7 +359,7 @@ export declare class LiveQueriesSubscribe extends LiveQueriesSubscribe_base {
359
359
  declare const LiveQueriesUnsubscribe_base: Schema.Struct<{
360
360
  _tag: Schema.tag<"LSD.LiveQueriesUnsubscribe">;
361
361
  } & {
362
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
362
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
363
363
  } & {
364
364
  clientId: typeof Schema.String;
365
365
  sessionId: typeof Schema.String;
@@ -386,7 +386,7 @@ export declare class SerializedLiveQuery extends SerializedLiveQuery_base {
386
386
  declare const LiveQueriesRes_base: Schema.Struct<{
387
387
  _tag: Schema.tag<"LSD.LiveQueriesRes">;
388
388
  } & {
389
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
389
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
390
390
  } & {
391
391
  clientId: typeof Schema.String;
392
392
  sessionId: typeof Schema.String;
@@ -399,7 +399,7 @@ export declare class LiveQueriesRes extends LiveQueriesRes_base {
399
399
  declare const ResetAllDataReq_base: Schema.Struct<{
400
400
  _tag: Schema.tag<"LSD.Leader.ResetAllDataReq">;
401
401
  } & {
402
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
402
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
403
403
  } & {
404
404
  requestId: typeof Schema.String;
405
405
  } & {
@@ -410,7 +410,7 @@ export declare class ResetAllDataReq extends ResetAllDataReq_base {
410
410
  declare const ResetAllDataRes_base: Schema.Struct<{
411
411
  _tag: Schema.tag<"LSD.Leader.ResetAllDataRes">;
412
412
  } & {
413
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
413
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
414
414
  } & {
415
415
  requestId: typeof Schema.String;
416
416
  }>;
@@ -419,7 +419,7 @@ export declare class ResetAllDataRes extends ResetAllDataRes_base {
419
419
  declare const DatabaseFileInfoReq_base: Schema.Struct<{
420
420
  _tag: Schema.tag<"LSD.Leader.DatabaseFileInfoReq">;
421
421
  } & {
422
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
422
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
423
423
  } & {
424
424
  requestId: typeof Schema.String;
425
425
  }>;
@@ -439,7 +439,7 @@ export declare class DatabaseFileInfo extends DatabaseFileInfo_base {
439
439
  declare const DatabaseFileInfoRes_base: Schema.Struct<{
440
440
  _tag: Schema.tag<"LSD.Leader.DatabaseFileInfoRes">;
441
441
  } & {
442
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
442
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
443
443
  } & {
444
444
  requestId: typeof Schema.String;
445
445
  } & {
@@ -451,7 +451,7 @@ export declare class DatabaseFileInfoRes extends DatabaseFileInfoRes_base {
451
451
  declare const NetworkStatusSubscribe_base: Schema.Struct<{
452
452
  _tag: Schema.tag<"LSD.Leader.NetworkStatusSubscribe">;
453
453
  } & {
454
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
454
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
455
455
  } & {
456
456
  requestId: typeof Schema.String;
457
457
  }>;
@@ -460,7 +460,7 @@ export declare class NetworkStatusSubscribe extends NetworkStatusSubscribe_base
460
460
  declare const NetworkStatusUnsubscribe_base: Schema.Struct<{
461
461
  _tag: Schema.tag<"LSD.Leader.NetworkStatusUnsubscribe">;
462
462
  } & {
463
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
463
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
464
464
  } & {
465
465
  requestId: typeof Schema.String;
466
466
  }>;
@@ -469,7 +469,7 @@ export declare class NetworkStatusUnsubscribe extends NetworkStatusUnsubscribe_b
469
469
  declare const NetworkStatusRes_base: Schema.Struct<{
470
470
  _tag: Schema.tag<"LSD.Leader.NetworkStatusRes">;
471
471
  } & {
472
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
472
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
473
473
  } & {
474
474
  requestId: typeof Schema.String;
475
475
  } & {
@@ -483,7 +483,7 @@ export declare class NetworkStatusRes extends NetworkStatusRes_base {
483
483
  declare const SyncingInfoReq_base: Schema.Struct<{
484
484
  _tag: Schema.tag<"LSD.Leader.SyncingInfoReq">;
485
485
  } & {
486
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
486
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
487
487
  } & {
488
488
  requestId: typeof Schema.String;
489
489
  }>;
@@ -498,7 +498,7 @@ export declare class SyncingInfo extends SyncingInfo_base {
498
498
  declare const SyncingInfoRes_base: Schema.Struct<{
499
499
  _tag: Schema.tag<"LSD.Leader.SyncingInfoRes">;
500
500
  } & {
501
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
501
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
502
502
  } & {
503
503
  requestId: typeof Schema.String;
504
504
  } & {
@@ -509,7 +509,7 @@ export declare class SyncingInfoRes extends SyncingInfoRes_base {
509
509
  declare const SyncHistorySubscribe_base: Schema.Struct<{
510
510
  _tag: Schema.tag<"LSD.Leader.SyncHistorySubscribe">;
511
511
  } & {
512
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
512
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
513
513
  } & {
514
514
  requestId: typeof Schema.String;
515
515
  }>;
@@ -518,7 +518,7 @@ export declare class SyncHistorySubscribe extends SyncHistorySubscribe_base {
518
518
  declare const SyncHistoryUnsubscribe_base: Schema.Struct<{
519
519
  _tag: Schema.tag<"LSD.Leader.SyncHistoryUnsubscribe">;
520
520
  } & {
521
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
521
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
522
522
  } & {
523
523
  requestId: typeof Schema.String;
524
524
  }>;
@@ -527,7 +527,7 @@ export declare class SyncHistoryUnsubscribe extends SyncHistoryUnsubscribe_base
527
527
  declare const SyncHistoryRes_base: Schema.Struct<{
528
528
  _tag: Schema.tag<"LSD.Leader.SyncHistoryRes">;
529
529
  } & {
530
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
530
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
531
531
  } & {
532
532
  requestId: typeof Schema.String;
533
533
  } & {
@@ -544,7 +544,7 @@ export declare class SyncHistoryRes extends SyncHistoryRes_base {
544
544
  declare const Disconnect_base: Schema.Struct<{
545
545
  _tag: Schema.tag<"LSD.Disconnect">;
546
546
  } & {
547
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
547
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
548
548
  } & {
549
549
  clientId: typeof Schema.String;
550
550
  sessionId: typeof Schema.String;
@@ -554,7 +554,7 @@ export declare class Disconnect extends Disconnect_base {
554
554
  declare const Ping_base: Schema.Struct<{
555
555
  _tag: Schema.tag<"LSD.Ping">;
556
556
  } & {
557
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
557
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
558
558
  } & {
559
559
  requestId: typeof Schema.String;
560
560
  }>;
@@ -563,7 +563,7 @@ export declare class Ping extends Ping_base {
563
563
  declare const Pong_base: Schema.Struct<{
564
564
  _tag: Schema.tag<"LSD.Pong">;
565
565
  } & {
566
- liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
566
+ liveStoreVersion: Schema.Literal<["0.3.0-dev.9"]>;
567
567
  } & {
568
568
  requestId: typeof Schema.String;
569
569
  }>;
package/dist/index.d.ts CHANGED
@@ -15,8 +15,4 @@ export * from './version.js';
15
15
  export * from './query-builder/mod.js';
16
16
  export * from './sync/syncstate.js';
17
17
  export * from './otel.js';
18
- declare global {
19
- interface LiveStoreGlobal {
20
- }
21
- }
22
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA;AAEzB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,eAAe;KAExB;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA"}
@@ -0,0 +1,37 @@
1
+ import type { Scope } from '@livestore/utils/effect';
2
+ import { Effect } from '@livestore/utils/effect';
3
+ import type { SynchronousDatabase } from '../adapter-types.js';
4
+ import { UnexpectedError } from '../adapter-types.js';
5
+ import type { LiveStoreSchema } from '../schema/mod.js';
6
+ import type { InitialBlockingSyncContext, LeaderSyncProcessor } from './types.js';
7
+ /**
8
+ * The LeaderSyncProcessor manages synchronization of mutations between
9
+ * the local state and the sync backend, ensuring efficient and orderly processing.
10
+ *
11
+ * In the LeaderSyncProcessor, pulling always has precedence over pushing.
12
+ *
13
+ * Responsibilities:
14
+ * - Queueing incoming local mutations in a localPushMailbox.
15
+ * - Broadcasting mutations to client sessions via pull queues.
16
+ * - Pushing mutations to the sync backend.
17
+ *
18
+ * Notes:
19
+ *
20
+ * local push processing:
21
+ * - localPushMailbox:
22
+ * - Maintains events in ascending order.
23
+ * - Uses `Deferred` objects to resolve/reject events based on application success.
24
+ * - Processes events from the mailbox, applying mutations in batches.
25
+ * - Controlled by a `Latch` to manage execution flow.
26
+ * - The latch closes on pull receipt and re-opens post-pull completion.
27
+ * - Processes up to `maxBatchSize` events per cycle.
28
+ *
29
+ */
30
+ export declare const makeLeaderSyncProcessor: ({ schema, dbMissing, dbLog, initialBlockingSyncContext, }: {
31
+ schema: LiveStoreSchema;
32
+ /** Only used to know whether we can safely query dbLog during setup execution */
33
+ dbMissing: boolean;
34
+ dbLog: SynchronousDatabase;
35
+ initialBlockingSyncContext: InitialBlockingSyncContext;
36
+ }) => Effect.Effect<LeaderSyncProcessor, UnexpectedError, Scope.Scope>;
37
+ //# sourceMappingURL=LeaderSyncProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeaderSyncProcessor.d.ts","sourceRoot":"","sources":["../../src/leader-thread/LeaderSyncProcessor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAGL,MAAM,EAUP,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAA2B,MAAM,kBAAkB,CAAA;AAehF,OAAO,KAAK,EAAE,0BAA0B,EAAmB,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGlG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,uBAAuB,8DAKjC;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,iFAAiF;IACjF,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,mBAAmB,CAAA;IAC1B,0BAA0B,EAAE,0BAA0B,CAAA;CACvD,KAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,CA2K/D,CAAA"}