@livestore/common 0.3.0-dev.5 → 0.3.0-dev.7
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/derived-mutations.d.ts +4 -4
- package/dist/derived-mutations.d.ts.map +1 -1
- package/dist/derived-mutations.test.js.map +1 -1
- package/dist/devtools/devtools-messages.d.ts +39 -39
- package/dist/leader-thread/apply-mutation.d.ts +5 -2
- package/dist/leader-thread/apply-mutation.d.ts.map +1 -1
- package/dist/leader-thread/apply-mutation.js +37 -25
- package/dist/leader-thread/apply-mutation.js.map +1 -1
- package/dist/leader-thread/leader-sync-processor.js +10 -5
- package/dist/leader-thread/leader-sync-processor.js.map +1 -1
- package/dist/leader-thread/recreate-db.d.ts.map +1 -1
- package/dist/leader-thread/recreate-db.js +9 -3
- package/dist/leader-thread/recreate-db.js.map +1 -1
- package/dist/mutation.d.ts +9 -2
- package/dist/mutation.d.ts.map +1 -1
- package/dist/mutation.js +5 -5
- package/dist/mutation.js.map +1 -1
- package/dist/query-builder/impl.d.ts +1 -1
- package/dist/rehydrate-from-mutationlog.d.ts +2 -2
- package/dist/rehydrate-from-mutationlog.d.ts.map +1 -1
- package/dist/rehydrate-from-mutationlog.js +13 -19
- package/dist/rehydrate-from-mutationlog.js.map +1 -1
- package/dist/schema/MutationEvent.d.ts +6 -6
- package/dist/schema/MutationEvent.d.ts.map +1 -1
- package/dist/schema/MutationEvent.js.map +1 -1
- package/dist/schema/system-tables.d.ts +11 -11
- package/dist/schema/system-tables.d.ts.map +1 -1
- package/dist/schema/system-tables.js +6 -5
- package/dist/schema/system-tables.js.map +1 -1
- package/dist/sync/client-session-sync-processor.d.ts +2 -2
- package/dist/sync/client-session-sync-processor.d.ts.map +1 -1
- package/dist/sync/next/rebase-events.d.ts +2 -2
- package/dist/sync/next/rebase-events.d.ts.map +1 -1
- package/dist/sync/next/test/mutation-fixtures.d.ts +7 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -5
- package/src/derived-mutations.test.ts +1 -1
- package/src/derived-mutations.ts +9 -5
- package/src/leader-thread/apply-mutation.ts +48 -30
- package/src/leader-thread/leader-sync-processor.ts +12 -5
- package/src/leader-thread/recreate-db.ts +9 -5
- package/src/mutation.ts +17 -7
- package/src/rehydrate-from-mutationlog.ts +15 -23
- package/src/schema/MutationEvent.ts +4 -3
- package/src/schema/system-tables.ts +6 -5
- package/src/sync/client-session-sync-processor.ts +2 -2
- package/src/sync/next/rebase-events.ts +2 -2
- package/src/version.ts +1 -1
@@ -95,14 +95,14 @@ export type DerivedMutationHelperFns<TColumns extends SqliteDsl.ConstraintColumn
|
|
95
95
|
delete: DerivedMutationHelperFns.DeleteMutationFn<TColumns, TOptions>;
|
96
96
|
};
|
97
97
|
export declare namespace DerivedMutationHelperFns {
|
98
|
-
export type InsertMutationFn<TColumns extends SqliteDsl.ConstraintColumns, TOptions extends DbSchema.TableOptions> = SqliteDsl.AnyIfConstained<TColumns, UseShortcut<TOptions> extends true ? (values?: GetValForKey<SqliteDsl.FromColumns.InsertRowDecoded<TColumns>, 'value'>) => MutationEvent.
|
99
|
-
export type UpdateMutationFn<TColumns extends SqliteDsl.ConstraintColumns, TOptions extends DbSchema.TableOptions> = SqliteDsl.AnyIfConstained<TColumns, UseShortcut<TOptions> extends true ? (values: Partial<GetValForKey<SqliteDsl.FromColumns.RowDecoded<TColumns>, 'value'>>) => MutationEvent.
|
98
|
+
export type InsertMutationFn<TColumns extends SqliteDsl.ConstraintColumns, TOptions extends DbSchema.TableOptions> = SqliteDsl.AnyIfConstained<TColumns, UseShortcut<TOptions> extends true ? (values?: GetValForKey<SqliteDsl.FromColumns.InsertRowDecoded<TColumns>, 'value'>) => MutationEvent.PartialAnyDecoded : (values: SqliteDsl.FromColumns.InsertRowDecoded<TColumns>) => MutationEvent.PartialAnyDecoded>;
|
99
|
+
export type UpdateMutationFn<TColumns extends SqliteDsl.ConstraintColumns, TOptions extends DbSchema.TableOptions> = SqliteDsl.AnyIfConstained<TColumns, UseShortcut<TOptions> extends true ? (values: Partial<GetValForKey<SqliteDsl.FromColumns.RowDecoded<TColumns>, 'value'>>) => MutationEvent.PartialAnyDecoded : (args: {
|
100
100
|
where: Partial<SqliteDsl.FromColumns.RowDecoded<TColumns>>;
|
101
101
|
values: Partial<SqliteDsl.FromColumns.RowDecoded<TColumns>>;
|
102
|
-
}) => MutationEvent.
|
102
|
+
}) => MutationEvent.PartialAnyDecoded>;
|
103
103
|
export type DeleteMutationFn<TColumns extends SqliteDsl.ConstraintColumns, _TOptions extends DbSchema.TableOptions> = (args: {
|
104
104
|
where: Partial<SqliteDsl.FromColumns.RowDecoded<TColumns>>;
|
105
|
-
}) => MutationEvent.
|
105
|
+
}) => MutationEvent.PartialAnyDecoded;
|
106
106
|
type UseShortcut<TOptions extends DbSchema.TableOptions> = TOptions['isSingleColumn'] extends true ? TOptions['isSingleton'] extends true ? true : false : false;
|
107
107
|
export {};
|
108
108
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"derived-mutations.d.ts","sourceRoot":"","sources":["../src/derived-mutations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGpD,OAAO,KAAK,KAAK,aAAa,MAAM,2BAA2B,CAAA;AAG/D,OAAO,KAAK,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAGtD,eAAO,MAAM,+BAA+B,GAC1C,SAAS,SAAS,QAAQ,CAAC,YAAY,CACrC,QAAQ,CAAC,gCAAgC,EACzC,QAAQ,CAAC,YAAY,GAAG;IAAE,eAAe,EAAE;QAAE,OAAO,EAAE,IAAI,CAAA;KAAE,CAAA;CAAE,CAC/D,SAEM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKhB,CAAA;AAEF,eAAO,M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;;;;;;;KAezE,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,MAAM,OAAO,GAAG,CAAC,YAA6C,EAAE,EAAE;IAChE,2BAA2B;IAC3B,MAAM,EAAE,GAAG,sCAAsC,CAAA;IACjD,OAAO,EAAE,GAAG,YAAY,EAAE,EAAE,EAAE,CAAA;AAChC,CAAC,CAAA"}
|
@@ -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.
|
5
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
14
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
25
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
36
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
47
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
58
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
59
59
|
} & {
|
60
60
|
clientId: typeof Schema.String;
|
61
61
|
sessionId: typeof Schema.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.
|
118
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
129
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
130
130
|
} & {
|
131
131
|
clientId: typeof Schema.String;
|
132
132
|
sessionId: typeof Schema.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.
|
189
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
200
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
211
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
222
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
237
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
248
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
268
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
285
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
294
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
303
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
314
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
327
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
338
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
351
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
362
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
389
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
402
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
413
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
422
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
442
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
454
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
463
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
472
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
486
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
501
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
512
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
521
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
530
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
547
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
557
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
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.
|
566
|
+
liveStoreVersion: Schema.Literal<["0.3.0-dev.7"]>;
|
567
567
|
} & {
|
568
568
|
requestId: typeof Schema.String;
|
569
569
|
}>;
|
@@ -1,8 +1,11 @@
|
|
1
1
|
import type { Scope } from '@livestore/utils/effect';
|
2
2
|
import { Effect } from '@livestore/utils/effect';
|
3
3
|
import type { SqliteError, UnexpectedError } from '../index.js';
|
4
|
-
import type
|
4
|
+
import { type MutationEvent } from '../schema/mod.js';
|
5
5
|
import { LeaderThreadCtx } from './types.js';
|
6
|
-
export type ApplyMutation = (mutationEventEncoded: MutationEvent.AnyEncoded
|
6
|
+
export type ApplyMutation = (mutationEventEncoded: MutationEvent.AnyEncoded, options?: {
|
7
|
+
/** Needed for rehydrateFromMutationLog */
|
8
|
+
skipMutationLog?: boolean;
|
9
|
+
}) => Effect.Effect<void, SqliteError | UnexpectedError>;
|
7
10
|
export declare const makeApplyMutation: Effect.Effect<ApplyMutation, never, Scope.Scope | LeaderThreadCtx>;
|
8
11
|
//# sourceMappingURL=apply-mutation.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"apply-mutation.d.ts","sourceRoot":"","sources":["../../src/leader-thread/apply-mutation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAkB,MAAM,yBAAyB,CAAA;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAuB,eAAe,EAAE,MAAM,aAAa,CAAA;
|
1
|
+
{"version":3,"file":"apply-mutation.d.ts","sourceRoot":"","sources":["../../src/leader-thread/apply-mutation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAkB,MAAM,yBAAyB,CAAA;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAuB,eAAe,EAAE,MAAM,aAAa,CAAA;AAEpF,OAAO,EAGL,KAAK,aAAa,EAInB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,MAAM,aAAa,GAAG,CAC1B,oBAAoB,EAAE,aAAa,CAAC,UAAU,EAC9C,OAAO,CAAC,EAAE;IACR,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,KACE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,CAAC,CAAA;AAEvD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,eAAe,CAmFhG,CAAA"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { memoizeByRef, shouldNeverHappen } from '@livestore/utils';
|
2
2
|
import { Effect, Option, Schema } from '@livestore/utils/effect';
|
3
|
-
import { getExecArgsFromMutation
|
3
|
+
import { getExecArgsFromMutation } from '../mutation.js';
|
4
|
+
import { MUTATION_LOG_META_TABLE, mutationLogMetaTable, SESSION_CHANGESET_META_TABLE, sessionChangesetMetaTable, } from '../schema/mod.js';
|
4
5
|
import { insertRow } from '../sql-queries/index.js';
|
5
6
|
import { execSql, execSqlPrepared } from './connection.js';
|
6
7
|
import { LeaderThreadCtx } from './types.js';
|
@@ -12,12 +13,23 @@ export const makeApplyMutation = Effect.gen(function* () {
|
|
12
13
|
// at build time and lookup the pre-computed hash at runtime.
|
13
14
|
// Also see https://github.com/Effect-TS/effect/issues/2719
|
14
15
|
[...leaderThreadCtx.schema.mutations.entries()].map(([k, v]) => [k, Schema.hash(v.schema)]));
|
15
|
-
return (mutationEventEncoded) => Effect.gen(function* () {
|
16
|
-
const {
|
17
|
-
const
|
18
|
-
const mutationName =
|
16
|
+
return (mutationEventEncoded, options) => Effect.gen(function* () {
|
17
|
+
const { schema, db, dbLog } = leaderThreadCtx;
|
18
|
+
const skipMutationLog = options?.skipMutationLog ?? false;
|
19
|
+
const mutationName = mutationEventEncoded.mutation;
|
19
20
|
const mutationDef = schema.mutations.get(mutationName) ?? shouldNeverHappen(`Unknown mutation: ${mutationName}`);
|
20
|
-
const execArgsArr = getExecArgsFromMutation({
|
21
|
+
const execArgsArr = getExecArgsFromMutation({
|
22
|
+
mutationDef,
|
23
|
+
mutationEvent: { decoded: undefined, encoded: mutationEventEncoded },
|
24
|
+
});
|
25
|
+
// NOTE we might want to bring this back if we want to debug no-op mutations
|
26
|
+
// const makeExecuteOptions = (statementSql: string, bindValues: any) => ({
|
27
|
+
// onRowsChanged: (rowsChanged: number) => {
|
28
|
+
// if (rowsChanged === 0) {
|
29
|
+
// console.warn(`Mutation "${mutationDef.name}" did not affect any rows:`, statementSql, bindValues)
|
30
|
+
// }
|
31
|
+
// },
|
32
|
+
// })
|
21
33
|
// console.group('[@livestore/common:leader-thread:applyMutation]', { mutationName })
|
22
34
|
const session = db.session();
|
23
35
|
for (const { statementSql, bindValues } of execArgsArr) {
|
@@ -27,25 +39,22 @@ export const makeApplyMutation = Effect.gen(function* () {
|
|
27
39
|
}
|
28
40
|
const changeset = session.changeset();
|
29
41
|
session.finish();
|
30
|
-
//
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
},
|
43
|
-
}));
|
44
|
-
}
|
42
|
+
// TODO use prepared statements
|
43
|
+
yield* execSql(db, ...insertRow({
|
44
|
+
tableName: SESSION_CHANGESET_META_TABLE,
|
45
|
+
columns: sessionChangesetMetaTable.sqliteDef.columns,
|
46
|
+
values: {
|
47
|
+
idGlobal: mutationEventEncoded.id.global,
|
48
|
+
idLocal: mutationEventEncoded.id.local,
|
49
|
+
// NOTE the changeset will be empty (i.e. null) for no-op mutations
|
50
|
+
changeset: changeset ?? null,
|
51
|
+
debug: execArgsArr,
|
52
|
+
},
|
53
|
+
}));
|
45
54
|
// console.groupEnd()
|
46
55
|
// write to mutation_log
|
47
|
-
const excludeFromMutationLog = shouldExcludeMutationFromLog(mutationName,
|
48
|
-
if (excludeFromMutationLog === false) {
|
56
|
+
const excludeFromMutationLog = shouldExcludeMutationFromLog(mutationName, mutationEventEncoded);
|
57
|
+
if (skipMutationLog === false && excludeFromMutationLog === false) {
|
49
58
|
yield* insertIntoMutationLog(mutationEventEncoded, dbLog, mutationDefSchemaHashMap);
|
50
59
|
}
|
51
60
|
else {
|
@@ -84,11 +93,14 @@ const makeShouldExcludeMutationFromLog = memoizeByRef((schema) => {
|
|
84
93
|
const mutationLogExclude = migrationOptions.strategy === 'from-mutation-log'
|
85
94
|
? (migrationOptions.excludeMutations ?? new Set(['livestore.RawSql']))
|
86
95
|
: new Set(['livestore.RawSql']);
|
87
|
-
return (mutationName,
|
96
|
+
return (mutationName, mutationEventEncoded) => {
|
88
97
|
if (mutationLogExclude.has(mutationName))
|
89
98
|
return true;
|
90
99
|
const mutationDef = schema.mutations.get(mutationName) ?? shouldNeverHappen(`Unknown mutation: ${mutationName}`);
|
91
|
-
const execArgsArr = getExecArgsFromMutation({
|
100
|
+
const execArgsArr = getExecArgsFromMutation({
|
101
|
+
mutationDef,
|
102
|
+
mutationEvent: { decoded: undefined, encoded: mutationEventEncoded },
|
103
|
+
});
|
92
104
|
return execArgsArr.some((_) => _.statementSql.includes('__livestore'));
|
93
105
|
};
|
94
106
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"apply-mutation.js","sourceRoot":"","sources":["../../src/leader-thread/apply-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAA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endPulling = ({ dbReady, initialBackendHead, isLocalEvent, r
|
|
328
328
|
remaining,
|
329
329
|
});
|
330
330
|
}
|
331
|
-
|
332
|
-
|
333
|
-
}).pipe(Effect.fork);
|
331
|
+
trimChangesetRows(db, newBackendHead);
|
332
|
+
const fiber = yield* applyMutationItemsRef.current({ batchItems: updateResult.newEvents }).pipe(Effect.fork);
|
334
333
|
yield* Ref.set(stateRef, {
|
335
334
|
_tag: 'applying-syncstate-advance',
|
336
335
|
origin: 'pull',
|
337
336
|
syncState: updateResult.newSyncState,
|
338
337
|
fiber,
|
339
338
|
});
|
340
|
-
// console.log('setRef:applying-syncstate-advance after backgroundBackendPulling', -1)
|
341
339
|
});
|
342
340
|
yield* syncBackend.pull(cursorInfo).pipe(
|
343
341
|
// TODO only take from queue while connected
|
@@ -366,7 +364,9 @@ const rollback = ({ db, dbLog, eventIdsToRollback, }) => Effect.gen(function* ()
|
|
366
364
|
// Apply changesets in reverse order
|
367
365
|
for (let i = rollbackEvents.length - 1; i >= 0; i--) {
|
368
366
|
const { changeset } = rollbackEvents[i];
|
369
|
-
|
367
|
+
if (changeset !== null) {
|
368
|
+
db.makeChangeset(changeset).invert().apply();
|
369
|
+
}
|
370
370
|
}
|
371
371
|
// Delete the changeset rows
|
372
372
|
db.execute(sql `DELETE FROM ${SESSION_CHANGESET_META_TABLE} WHERE (idGlobal, idLocal) IN (${eventIdsToRollback.map((id) => `(${id.global}, ${id.local})`).join(', ')})`);
|
@@ -422,4 +422,9 @@ const backgroundBackendPushing = ({ dbReady, syncBackendQueue, span, }) => Effec
|
|
422
422
|
}
|
423
423
|
}
|
424
424
|
}).pipe(Effect.interruptible, Effect.withSpan('@livestore/common:leader-thread:syncing:backend-pushing'));
|
425
|
+
const trimChangesetRows = (db, newHead) => {
|
426
|
+
// Since we're using the session changeset rows to query for the current head,
|
427
|
+
// we're keeping at least one row for the current head, and thus are using `<` instead of `<=`
|
428
|
+
db.execute(sql `DELETE FROM ${SESSION_CHANGESET_META_TABLE} WHERE idGlobal < ${newHead.global}`);
|
429
|
+
};
|
425
430
|
//# sourceMappingURL=leader-sync-processor.js.map
|