@livestore/livestore 0.4.0-dev.9 → 0.5.0-dev.0

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 (132) hide show
  1. package/README.md +0 -1
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/QueryCache.js +1 -1
  4. package/dist/QueryCache.js.map +1 -1
  5. package/dist/SqliteDbWrapper.d.ts +5 -5
  6. package/dist/SqliteDbWrapper.d.ts.map +1 -1
  7. package/dist/SqliteDbWrapper.js +15 -13
  8. package/dist/SqliteDbWrapper.js.map +1 -1
  9. package/dist/SqliteDbWrapper.test.js +24 -6
  10. package/dist/SqliteDbWrapper.test.js.map +1 -1
  11. package/dist/effect/LiveStore.d.ts +134 -6
  12. package/dist/effect/LiveStore.d.ts.map +1 -1
  13. package/dist/effect/LiveStore.js +190 -11
  14. package/dist/effect/LiveStore.js.map +1 -1
  15. package/dist/effect/LiveStore.test.d.ts +2 -0
  16. package/dist/effect/LiveStore.test.d.ts.map +1 -0
  17. package/dist/effect/LiveStore.test.js +41 -0
  18. package/dist/effect/LiveStore.test.js.map +1 -0
  19. package/dist/effect/mod.d.ts +1 -1
  20. package/dist/effect/mod.d.ts.map +1 -1
  21. package/dist/effect/mod.js +3 -1
  22. package/dist/effect/mod.js.map +1 -1
  23. package/dist/live-queries/base-class.d.ts +129 -9
  24. package/dist/live-queries/base-class.d.ts.map +1 -1
  25. package/dist/live-queries/base-class.js +30 -4
  26. package/dist/live-queries/base-class.js.map +1 -1
  27. package/dist/live-queries/client-document-get-query.d.ts +1 -1
  28. package/dist/live-queries/client-document-get-query.d.ts.map +1 -1
  29. package/dist/live-queries/client-document-get-query.js +4 -3
  30. package/dist/live-queries/client-document-get-query.js.map +1 -1
  31. package/dist/live-queries/computed.d.ts +56 -0
  32. package/dist/live-queries/computed.d.ts.map +1 -1
  33. package/dist/live-queries/computed.js +62 -6
  34. package/dist/live-queries/computed.js.map +1 -1
  35. package/dist/live-queries/db-query.d.ts +2 -2
  36. package/dist/live-queries/db-query.d.ts.map +1 -1
  37. package/dist/live-queries/db-query.js +41 -30
  38. package/dist/live-queries/db-query.js.map +1 -1
  39. package/dist/live-queries/db-query.test.js +112 -29
  40. package/dist/live-queries/db-query.test.js.map +1 -1
  41. package/dist/live-queries/signal.d.ts +49 -0
  42. package/dist/live-queries/signal.d.ts.map +1 -1
  43. package/dist/live-queries/signal.js +51 -2
  44. package/dist/live-queries/signal.js.map +1 -1
  45. package/dist/live-queries/signal.test.js +4 -4
  46. package/dist/live-queries/signal.test.js.map +1 -1
  47. package/dist/mod.d.ts +3 -3
  48. package/dist/mod.d.ts.map +1 -1
  49. package/dist/mod.js +3 -2
  50. package/dist/mod.js.map +1 -1
  51. package/dist/reactive.d.ts +10 -10
  52. package/dist/reactive.d.ts.map +1 -1
  53. package/dist/reactive.js +29 -27
  54. package/dist/reactive.js.map +1 -1
  55. package/dist/reactive.test.js +2 -2
  56. package/dist/reactive.test.js.map +1 -1
  57. package/dist/store/StoreRegistry.d.ts +215 -0
  58. package/dist/store/StoreRegistry.d.ts.map +1 -0
  59. package/dist/store/StoreRegistry.js +267 -0
  60. package/dist/store/StoreRegistry.js.map +1 -0
  61. package/dist/store/StoreRegistry.test.d.ts +2 -0
  62. package/dist/store/StoreRegistry.test.d.ts.map +1 -0
  63. package/dist/store/StoreRegistry.test.js +384 -0
  64. package/dist/store/StoreRegistry.test.js.map +1 -0
  65. package/dist/store/create-store.d.ts +99 -22
  66. package/dist/store/create-store.d.ts.map +1 -1
  67. package/dist/store/create-store.js +85 -37
  68. package/dist/store/create-store.js.map +1 -1
  69. package/dist/store/devtools.d.ts +6 -18
  70. package/dist/store/devtools.d.ts.map +1 -1
  71. package/dist/store/devtools.js +61 -19
  72. package/dist/store/devtools.js.map +1 -1
  73. package/dist/store/store-eventstream.test.d.ts +2 -0
  74. package/dist/store/store-eventstream.test.d.ts.map +1 -0
  75. package/dist/store/store-eventstream.test.js +65 -0
  76. package/dist/store/store-eventstream.test.js.map +1 -0
  77. package/dist/store/store-types.d.ts +271 -31
  78. package/dist/store/store-types.d.ts.map +1 -1
  79. package/dist/store/store-types.js +41 -1
  80. package/dist/store/store-types.js.map +1 -1
  81. package/dist/store/store-types.test.d.ts +2 -0
  82. package/dist/store/store-types.test.d.ts.map +1 -0
  83. package/dist/store/store-types.test.js +39 -0
  84. package/dist/store/store-types.test.js.map +1 -0
  85. package/dist/store/store.d.ts +255 -68
  86. package/dist/store/store.d.ts.map +1 -1
  87. package/dist/store/store.js +533 -186
  88. package/dist/store/store.js.map +1 -1
  89. package/dist/utils/dev.d.ts.map +1 -1
  90. package/dist/utils/dev.js +1 -1
  91. package/dist/utils/dev.js.map +1 -1
  92. package/dist/utils/stack-info.d.ts.map +1 -1
  93. package/dist/utils/stack-info.js +3 -2
  94. package/dist/utils/stack-info.js.map +1 -1
  95. package/dist/utils/tests/fixture.d.ts +46 -39
  96. package/dist/utils/tests/fixture.d.ts.map +1 -1
  97. package/dist/utils/tests/fixture.js +7 -0
  98. package/dist/utils/tests/fixture.js.map +1 -1
  99. package/dist/utils/tests/otel.d.ts.map +1 -1
  100. package/dist/utils/tests/otel.js +5 -5
  101. package/dist/utils/tests/otel.js.map +1 -1
  102. package/package.json +50 -18
  103. package/src/QueryCache.ts +1 -1
  104. package/src/SqliteDbWrapper.test.ts +30 -6
  105. package/src/SqliteDbWrapper.ts +21 -17
  106. package/src/ambient.d.ts +0 -7
  107. package/src/effect/LiveStore.test.ts +61 -0
  108. package/src/effect/LiveStore.ts +426 -22
  109. package/src/effect/mod.ts +13 -1
  110. package/src/live-queries/__snapshots__/db-query.test.ts.snap +814 -178
  111. package/src/live-queries/base-class.ts +162 -32
  112. package/src/live-queries/client-document-get-query.ts +6 -4
  113. package/src/live-queries/computed.ts +65 -8
  114. package/src/live-queries/db-query.test.ts +168 -30
  115. package/src/live-queries/db-query.ts +58 -43
  116. package/src/live-queries/signal.test.ts +5 -4
  117. package/src/live-queries/signal.ts +52 -3
  118. package/src/mod.ts +19 -2
  119. package/src/reactive.test.ts +3 -2
  120. package/src/reactive.ts +58 -49
  121. package/src/store/StoreRegistry.test.ts +543 -0
  122. package/src/store/StoreRegistry.ts +429 -0
  123. package/src/store/create-store.ts +227 -74
  124. package/src/store/devtools.ts +305 -261
  125. package/src/store/store-eventstream.test.ts +123 -0
  126. package/src/store/store-types.test.ts +52 -0
  127. package/src/store/store-types.ts +318 -44
  128. package/src/store/store.ts +695 -283
  129. package/src/utils/dev.ts +3 -4
  130. package/src/utils/stack-info.ts +5 -2
  131. package/src/utils/tests/fixture.ts +9 -1
  132. package/src/utils/tests/otel.ts +8 -7
@@ -1,6 +1,6 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
3
+ exports[`otel > QueryBuilder subscription - async iterator 1`] = `
4
4
  {
5
5
  "_name": "createStore",
6
6
  "attributes": {
@@ -8,6 +8,9 @@ exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
8
8
  "storeId": "default",
9
9
  },
10
10
  "children": [
11
+ {
12
+ "_name": "makeClientSessionSyncProcessor",
13
+ },
11
14
  {
12
15
  "_name": "livestore.in-memory-db:execute",
13
16
  "attributes": {
@@ -21,22 +24,183 @@ exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
21
24
  },
22
25
  },
23
26
  {
24
- "_name": "@livestore/common:LeaderSyncProcessor:push",
25
- "attributes": {
26
- "batch": "undefined",
27
- "batchSize": 1,
27
+ "_name": "client-session-sync-processor:boot",
28
+ "children": [
29
+ {
30
+ "_name": "client-session-sync-processor:pull",
31
+ "attributes": {
32
+ "span.label": "⚠︎ Interrupted",
33
+ "status.interrupted": true,
34
+ },
35
+ },
36
+ {
37
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
38
+ "attributes": {
39
+ "batch": "undefined",
40
+ "batchSize": 1,
41
+ "span.label": "⚠︎ Interrupted",
42
+ "status.interrupted": true,
43
+ },
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ "_name": "LiveStore:commits",
49
+ },
50
+ {
51
+ "_name": "LiveStore:queries",
52
+ "children": [
53
+ {
54
+ "_name": "LiveStore.subscribe",
55
+ "attributes": {
56
+ "queryLabel": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
57
+ },
58
+ "children": [
59
+ {
60
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
61
+ "attributes": {
62
+ "livestore.debugRefreshReason": "subscribe-initial-run:undefined",
63
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
64
+ "sql.rowsCount": 0,
65
+ },
66
+ "children": [
67
+ {
68
+ "_name": "sql-in-memory-select",
69
+ "attributes": {
70
+ "sql.cached": false,
71
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
72
+ "sql.rowsCount": 0,
73
+ },
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
79
+ "attributes": {
80
+ "livestore.debugRefreshReason": "commit",
81
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
82
+ "sql.rowsCount": 1,
83
+ },
84
+ "children": [
85
+ {
86
+ "_name": "sql-in-memory-select",
87
+ "attributes": {
88
+ "sql.cached": false,
89
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
90
+ "sql.rowsCount": 1,
91
+ },
92
+ },
93
+ ],
94
+ },
95
+ ],
96
+ },
97
+ ],
98
+ },
99
+ ],
100
+ }
101
+ `;
102
+
103
+ exports[`otel > QueryBuilder subscription - async iterator 2`] = `
104
+ [
105
+ {
106
+ "_name": "LiveStore:commit",
107
+ "attributes": {
108
+ "livestore.eventTags": "[
109
+ "todo.created"
110
+ ]",
111
+ "livestore.eventsCount": 1,
112
+ },
113
+ "children": [
114
+ {
115
+ "_name": "client-session-sync-processor:encode-events",
116
+ },
117
+ {
118
+ "_name": "client-session-sync-processor:materialize-events",
119
+ "children": [
120
+ {
121
+ "_name": "client-session-sync-processor:materialize-event",
122
+ "children": [
123
+ {
124
+ "_name": "livestore.in-memory-db:execute",
125
+ "attributes": {
126
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
127
+ },
128
+ },
129
+ {
130
+ "_name": "@livestore/common:execSql",
131
+ "attributes": {
132
+ "bindValueKeys": "[
133
+ "$id",
134
+ "$seqNumGlobal",
135
+ "$seqNumClient",
136
+ "$seqNumRebaseGeneration"
137
+ ]",
138
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
139
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
140
+ },
141
+ },
142
+ ],
143
+ },
144
+ ],
145
+ },
146
+ {
147
+ "_name": "client-session-sync-processor:push",
148
+ "attributes": {
149
+ "batchSize": 1,
150
+ "eventCounts": "{
151
+ "todo.created": 1
152
+ }",
153
+ "mergeResultTag": "advance",
154
+ },
28
155
  },
156
+ ],
157
+ },
158
+ ]
159
+ `;
160
+
161
+ exports[`otel > QueryBuilder subscription - async iterator with skipInitialRun 1`] = `
162
+ {
163
+ "_name": "createStore",
164
+ "attributes": {
165
+ "debugInstanceId": "test",
166
+ "storeId": "default",
167
+ },
168
+ "children": [
169
+ {
170
+ "_name": "makeClientSessionSyncProcessor",
29
171
  },
30
172
  {
31
- "_name": "client-session-sync-processor:pull",
173
+ "_name": "livestore.in-memory-db:execute",
32
174
  "attributes": {
33
- "code.stacktrace": "<STACKTRACE>",
34
- "span.label": "⚠︎ Interrupted",
35
- "status.interrupted": true,
175
+ "sql.query": "
176
+ PRAGMA page_size=32768;
177
+ PRAGMA cache_size=10000;
178
+ PRAGMA synchronous='OFF';
179
+ PRAGMA temp_store='MEMORY';
180
+ PRAGMA foreign_keys='ON'; -- we want foreign key constraints to be enforced
181
+ ",
36
182
  },
37
183
  },
38
184
  {
39
- "_name": "LiveStore:sync",
185
+ "_name": "client-session-sync-processor:boot",
186
+ "children": [
187
+ {
188
+ "_name": "client-session-sync-processor:pull",
189
+ "attributes": {
190
+ "span.label": "⚠︎ Interrupted",
191
+ "status.interrupted": true,
192
+ },
193
+ },
194
+ {
195
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
196
+ "attributes": {
197
+ "batch": "undefined",
198
+ "batchSize": 1,
199
+ "span.label": "⚠︎ Interrupted",
200
+ "status.interrupted": true,
201
+ },
202
+ },
203
+ ],
40
204
  },
41
205
  {
42
206
  "_name": "LiveStore:commits",
@@ -47,14 +211,14 @@ exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
47
211
  {
48
212
  "_name": "LiveStore.subscribe",
49
213
  "attributes": {
50
- "queryLabel": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
214
+ "queryLabel": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
51
215
  },
52
216
  "children": [
53
217
  {
54
- "_name": "db:SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
218
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
55
219
  "attributes": {
56
220
  "livestore.debugRefreshReason": "subscribe-initial-run:undefined",
57
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
221
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
58
222
  "sql.rowsCount": 0,
59
223
  },
60
224
  "children": [
@@ -62,17 +226,17 @@ exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
62
226
  "_name": "sql-in-memory-select",
63
227
  "attributes": {
64
228
  "sql.cached": false,
65
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
229
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
66
230
  "sql.rowsCount": 0,
67
231
  },
68
232
  },
69
233
  ],
70
234
  },
71
235
  {
72
- "_name": "db:SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
236
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
73
237
  "attributes": {
74
238
  "livestore.debugRefreshReason": "commit",
75
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
239
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
76
240
  "sql.rowsCount": 1,
77
241
  },
78
242
  "children": [
@@ -80,7 +244,7 @@ exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
80
244
  "_name": "sql-in-memory-select",
81
245
  "attributes": {
82
246
  "sql.cached": false,
83
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
247
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
84
248
  "sql.rowsCount": 1,
85
249
  },
86
250
  },
@@ -94,7 +258,7 @@ exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
94
258
  }
95
259
  `;
96
260
 
97
- exports[`otel > QueryBuilder subscription - basic functionality 2`] = `
261
+ exports[`otel > QueryBuilder subscription - async iterator with skipInitialRun 2`] = `
98
262
  [
99
263
  {
100
264
  "_name": "LiveStore:commit",
@@ -105,6 +269,38 @@ exports[`otel > QueryBuilder subscription - basic functionality 2`] = `
105
269
  "livestore.eventsCount": 1,
106
270
  },
107
271
  "children": [
272
+ {
273
+ "_name": "client-session-sync-processor:encode-events",
274
+ },
275
+ {
276
+ "_name": "client-session-sync-processor:materialize-events",
277
+ "children": [
278
+ {
279
+ "_name": "client-session-sync-processor:materialize-event",
280
+ "children": [
281
+ {
282
+ "_name": "livestore.in-memory-db:execute",
283
+ "attributes": {
284
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
285
+ },
286
+ },
287
+ {
288
+ "_name": "@livestore/common:execSql",
289
+ "attributes": {
290
+ "bindValueKeys": "[
291
+ "$id",
292
+ "$seqNumGlobal",
293
+ "$seqNumClient",
294
+ "$seqNumRebaseGeneration"
295
+ ]",
296
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
297
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
298
+ },
299
+ },
300
+ ],
301
+ },
302
+ ],
303
+ },
108
304
  {
109
305
  "_name": "client-session-sync-processor:push",
110
306
  "attributes": {
@@ -114,6 +310,128 @@ exports[`otel > QueryBuilder subscription - basic functionality 2`] = `
114
310
  }",
115
311
  "mergeResultTag": "advance",
116
312
  },
313
+ },
314
+ ],
315
+ },
316
+ ]
317
+ `;
318
+
319
+ exports[`otel > QueryBuilder subscription - basic functionality 1`] = `
320
+ {
321
+ "_name": "createStore",
322
+ "attributes": {
323
+ "debugInstanceId": "test",
324
+ "storeId": "default",
325
+ },
326
+ "children": [
327
+ {
328
+ "_name": "makeClientSessionSyncProcessor",
329
+ },
330
+ {
331
+ "_name": "livestore.in-memory-db:execute",
332
+ "attributes": {
333
+ "sql.query": "
334
+ PRAGMA page_size=32768;
335
+ PRAGMA cache_size=10000;
336
+ PRAGMA synchronous='OFF';
337
+ PRAGMA temp_store='MEMORY';
338
+ PRAGMA foreign_keys='ON'; -- we want foreign key constraints to be enforced
339
+ ",
340
+ },
341
+ },
342
+ {
343
+ "_name": "client-session-sync-processor:boot",
344
+ "children": [
345
+ {
346
+ "_name": "client-session-sync-processor:pull",
347
+ "attributes": {
348
+ "span.label": "⚠︎ Interrupted",
349
+ "status.interrupted": true,
350
+ },
351
+ },
352
+ {
353
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
354
+ "attributes": {
355
+ "batch": "undefined",
356
+ "batchSize": 1,
357
+ "span.label": "⚠︎ Interrupted",
358
+ "status.interrupted": true,
359
+ },
360
+ },
361
+ ],
362
+ },
363
+ {
364
+ "_name": "LiveStore:commits",
365
+ },
366
+ {
367
+ "_name": "LiveStore:queries",
368
+ "children": [
369
+ {
370
+ "_name": "LiveStore.subscribe",
371
+ "attributes": {
372
+ "queryLabel": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
373
+ },
374
+ "children": [
375
+ {
376
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
377
+ "attributes": {
378
+ "livestore.debugRefreshReason": "subscribe-initial-run:undefined",
379
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
380
+ "sql.rowsCount": 0,
381
+ },
382
+ "children": [
383
+ {
384
+ "_name": "sql-in-memory-select",
385
+ "attributes": {
386
+ "sql.cached": false,
387
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
388
+ "sql.rowsCount": 0,
389
+ },
390
+ },
391
+ ],
392
+ },
393
+ {
394
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
395
+ "attributes": {
396
+ "livestore.debugRefreshReason": "commit",
397
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
398
+ "sql.rowsCount": 1,
399
+ },
400
+ "children": [
401
+ {
402
+ "_name": "sql-in-memory-select",
403
+ "attributes": {
404
+ "sql.cached": false,
405
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
406
+ "sql.rowsCount": 1,
407
+ },
408
+ },
409
+ ],
410
+ },
411
+ ],
412
+ },
413
+ ],
414
+ },
415
+ ],
416
+ }
417
+ `;
418
+
419
+ exports[`otel > QueryBuilder subscription - basic functionality 2`] = `
420
+ [
421
+ {
422
+ "_name": "LiveStore:commit",
423
+ "attributes": {
424
+ "livestore.eventTags": "[
425
+ "todo.created"
426
+ ]",
427
+ "livestore.eventsCount": 1,
428
+ },
429
+ "children": [
430
+ {
431
+ "_name": "client-session-sync-processor:encode-events",
432
+ },
433
+ {
434
+ "_name": "client-session-sync-processor:materialize-events",
117
435
  "children": [
118
436
  {
119
437
  "_name": "client-session-sync-processor:materialize-event",
@@ -121,13 +439,36 @@ exports[`otel > QueryBuilder subscription - basic functionality 2`] = `
121
439
  {
122
440
  "_name": "livestore.in-memory-db:execute",
123
441
  "attributes": {
124
- "sql.query": "INSERT INTO 'todos' (id, text, completed) VALUES (?, ?, ?)",
442
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
443
+ },
444
+ },
445
+ {
446
+ "_name": "@livestore/common:execSql",
447
+ "attributes": {
448
+ "bindValueKeys": "[
449
+ "$id",
450
+ "$seqNumGlobal",
451
+ "$seqNumClient",
452
+ "$seqNumRebaseGeneration"
453
+ ]",
454
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
455
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
125
456
  },
126
457
  },
127
458
  ],
128
459
  },
129
460
  ],
130
461
  },
462
+ {
463
+ "_name": "client-session-sync-processor:push",
464
+ "attributes": {
465
+ "batchSize": 1,
466
+ "eventCounts": "{
467
+ "todo.created": 1
468
+ }",
469
+ "mergeResultTag": "advance",
470
+ },
471
+ },
131
472
  ],
132
473
  },
133
474
  ]
@@ -141,6 +482,9 @@ exports[`otel > QueryBuilder subscription - direct table subscription 1`] = `
141
482
  "storeId": "default",
142
483
  },
143
484
  "children": [
485
+ {
486
+ "_name": "makeClientSessionSyncProcessor",
487
+ },
144
488
  {
145
489
  "_name": "livestore.in-memory-db:execute",
146
490
  "attributes": {
@@ -154,22 +498,183 @@ exports[`otel > QueryBuilder subscription - direct table subscription 1`] = `
154
498
  },
155
499
  },
156
500
  {
157
- "_name": "@livestore/common:LeaderSyncProcessor:push",
158
- "attributes": {
159
- "batch": "undefined",
160
- "batchSize": 1,
501
+ "_name": "client-session-sync-processor:boot",
502
+ "children": [
503
+ {
504
+ "_name": "client-session-sync-processor:pull",
505
+ "attributes": {
506
+ "span.label": "⚠︎ Interrupted",
507
+ "status.interrupted": true,
508
+ },
509
+ },
510
+ {
511
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
512
+ "attributes": {
513
+ "batch": "undefined",
514
+ "batchSize": 1,
515
+ "span.label": "⚠︎ Interrupted",
516
+ "status.interrupted": true,
517
+ },
518
+ },
519
+ ],
520
+ },
521
+ {
522
+ "_name": "LiveStore:commits",
523
+ },
524
+ {
525
+ "_name": "LiveStore:queries",
526
+ "children": [
527
+ {
528
+ "_name": "LiveStore.subscribe",
529
+ "attributes": {
530
+ "queryLabel": "SELECT * FROM 'todos'",
531
+ },
532
+ "children": [
533
+ {
534
+ "_name": "db:SELECT * FROM 'todos'",
535
+ "attributes": {
536
+ "livestore.debugRefreshReason": "subscribe-initial-run:undefined",
537
+ "sql.query": "SELECT * FROM 'todos'",
538
+ "sql.rowsCount": 0,
539
+ },
540
+ "children": [
541
+ {
542
+ "_name": "sql-in-memory-select",
543
+ "attributes": {
544
+ "sql.cached": false,
545
+ "sql.query": "SELECT * FROM 'todos'",
546
+ "sql.rowsCount": 0,
547
+ },
548
+ },
549
+ ],
550
+ },
551
+ {
552
+ "_name": "db:SELECT * FROM 'todos'",
553
+ "attributes": {
554
+ "livestore.debugRefreshReason": "commit",
555
+ "sql.query": "SELECT * FROM 'todos'",
556
+ "sql.rowsCount": 1,
557
+ },
558
+ "children": [
559
+ {
560
+ "_name": "sql-in-memory-select",
561
+ "attributes": {
562
+ "sql.cached": false,
563
+ "sql.query": "SELECT * FROM 'todos'",
564
+ "sql.rowsCount": 1,
565
+ },
566
+ },
567
+ ],
568
+ },
569
+ ],
570
+ },
571
+ ],
572
+ },
573
+ ],
574
+ }
575
+ `;
576
+
577
+ exports[`otel > QueryBuilder subscription - direct table subscription 2`] = `
578
+ [
579
+ {
580
+ "_name": "LiveStore:commit",
581
+ "attributes": {
582
+ "livestore.eventTags": "[
583
+ "todo.created"
584
+ ]",
585
+ "livestore.eventsCount": 1,
586
+ },
587
+ "children": [
588
+ {
589
+ "_name": "client-session-sync-processor:encode-events",
590
+ },
591
+ {
592
+ "_name": "client-session-sync-processor:materialize-events",
593
+ "children": [
594
+ {
595
+ "_name": "client-session-sync-processor:materialize-event",
596
+ "children": [
597
+ {
598
+ "_name": "livestore.in-memory-db:execute",
599
+ "attributes": {
600
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
601
+ },
602
+ },
603
+ {
604
+ "_name": "@livestore/common:execSql",
605
+ "attributes": {
606
+ "bindValueKeys": "[
607
+ "$id",
608
+ "$seqNumGlobal",
609
+ "$seqNumClient",
610
+ "$seqNumRebaseGeneration"
611
+ ]",
612
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
613
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
614
+ },
615
+ },
616
+ ],
617
+ },
618
+ ],
619
+ },
620
+ {
621
+ "_name": "client-session-sync-processor:push",
622
+ "attributes": {
623
+ "batchSize": 1,
624
+ "eventCounts": "{
625
+ "todo.created": 1
626
+ }",
627
+ "mergeResultTag": "advance",
628
+ },
161
629
  },
630
+ ],
631
+ },
632
+ ]
633
+ `;
634
+
635
+ exports[`otel > QueryBuilder subscription - skipInitialRun 1`] = `
636
+ {
637
+ "_name": "createStore",
638
+ "attributes": {
639
+ "debugInstanceId": "test",
640
+ "storeId": "default",
641
+ },
642
+ "children": [
643
+ {
644
+ "_name": "makeClientSessionSyncProcessor",
162
645
  },
163
646
  {
164
- "_name": "client-session-sync-processor:pull",
647
+ "_name": "livestore.in-memory-db:execute",
165
648
  "attributes": {
166
- "code.stacktrace": "<STACKTRACE>",
167
- "span.label": "⚠︎ Interrupted",
168
- "status.interrupted": true,
649
+ "sql.query": "
650
+ PRAGMA page_size=32768;
651
+ PRAGMA cache_size=10000;
652
+ PRAGMA synchronous='OFF';
653
+ PRAGMA temp_store='MEMORY';
654
+ PRAGMA foreign_keys='ON'; -- we want foreign key constraints to be enforced
655
+ ",
169
656
  },
170
657
  },
171
658
  {
172
- "_name": "LiveStore:sync",
659
+ "_name": "client-session-sync-processor:boot",
660
+ "children": [
661
+ {
662
+ "_name": "client-session-sync-processor:pull",
663
+ "attributes": {
664
+ "span.label": "⚠︎ Interrupted",
665
+ "status.interrupted": true,
666
+ },
667
+ },
668
+ {
669
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
670
+ "attributes": {
671
+ "batch": "undefined",
672
+ "batchSize": 1,
673
+ "span.label": "⚠︎ Interrupted",
674
+ "status.interrupted": true,
675
+ },
676
+ },
677
+ ],
173
678
  },
174
679
  {
175
680
  "_name": "LiveStore:commits",
@@ -180,14 +685,14 @@ exports[`otel > QueryBuilder subscription - direct table subscription 1`] = `
180
685
  {
181
686
  "_name": "LiveStore.subscribe",
182
687
  "attributes": {
183
- "queryLabel": "SELECT * FROM 'todos'",
688
+ "queryLabel": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
184
689
  },
185
690
  "children": [
186
691
  {
187
- "_name": "db:SELECT * FROM 'todos'",
692
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
188
693
  "attributes": {
189
694
  "livestore.debugRefreshReason": "subscribe-initial-run:undefined",
190
- "sql.query": "SELECT * FROM 'todos'",
695
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
191
696
  "sql.rowsCount": 0,
192
697
  },
193
698
  "children": [
@@ -195,17 +700,17 @@ exports[`otel > QueryBuilder subscription - direct table subscription 1`] = `
195
700
  "_name": "sql-in-memory-select",
196
701
  "attributes": {
197
702
  "sql.cached": false,
198
- "sql.query": "SELECT * FROM 'todos'",
703
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
199
704
  "sql.rowsCount": 0,
200
705
  },
201
706
  },
202
707
  ],
203
708
  },
204
709
  {
205
- "_name": "db:SELECT * FROM 'todos'",
710
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
206
711
  "attributes": {
207
712
  "livestore.debugRefreshReason": "commit",
208
- "sql.query": "SELECT * FROM 'todos'",
713
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
209
714
  "sql.rowsCount": 1,
210
715
  },
211
716
  "children": [
@@ -213,7 +718,7 @@ exports[`otel > QueryBuilder subscription - direct table subscription 1`] = `
213
718
  "_name": "sql-in-memory-select",
214
719
  "attributes": {
215
720
  "sql.cached": false,
216
- "sql.query": "SELECT * FROM 'todos'",
721
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
217
722
  "sql.rowsCount": 1,
218
723
  },
219
724
  },
@@ -227,7 +732,7 @@ exports[`otel > QueryBuilder subscription - direct table subscription 1`] = `
227
732
  }
228
733
  `;
229
734
 
230
- exports[`otel > QueryBuilder subscription - direct table subscription 2`] = `
735
+ exports[`otel > QueryBuilder subscription - skipInitialRun 2`] = `
231
736
  [
232
737
  {
233
738
  "_name": "LiveStore:commit",
@@ -239,14 +744,10 @@ exports[`otel > QueryBuilder subscription - direct table subscription 2`] = `
239
744
  },
240
745
  "children": [
241
746
  {
242
- "_name": "client-session-sync-processor:push",
243
- "attributes": {
244
- "batchSize": 1,
245
- "eventCounts": "{
246
- "todo.created": 1
247
- }",
248
- "mergeResultTag": "advance",
249
- },
747
+ "_name": "client-session-sync-processor:encode-events",
748
+ },
749
+ {
750
+ "_name": "client-session-sync-processor:materialize-events",
250
751
  "children": [
251
752
  {
252
753
  "_name": "client-session-sync-processor:materialize-event",
@@ -254,13 +755,36 @@ exports[`otel > QueryBuilder subscription - direct table subscription 2`] = `
254
755
  {
255
756
  "_name": "livestore.in-memory-db:execute",
256
757
  "attributes": {
257
- "sql.query": "INSERT INTO 'todos' (id, text, completed) VALUES (?, ?, ?)",
758
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
759
+ },
760
+ },
761
+ {
762
+ "_name": "@livestore/common:execSql",
763
+ "attributes": {
764
+ "bindValueKeys": "[
765
+ "$id",
766
+ "$seqNumGlobal",
767
+ "$seqNumClient",
768
+ "$seqNumRebaseGeneration"
769
+ ]",
770
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
771
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
258
772
  },
259
773
  },
260
774
  ],
261
775
  },
262
776
  ],
263
777
  },
778
+ {
779
+ "_name": "client-session-sync-processor:push",
780
+ "attributes": {
781
+ "batchSize": 1,
782
+ "eventCounts": "{
783
+ "todo.created": 1
784
+ }",
785
+ "mergeResultTag": "advance",
786
+ },
787
+ },
264
788
  ],
265
789
  },
266
790
  ]
@@ -274,6 +798,9 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 1`] = `
274
798
  "storeId": "default",
275
799
  },
276
800
  "children": [
801
+ {
802
+ "_name": "makeClientSessionSyncProcessor",
803
+ },
277
804
  {
278
805
  "_name": "livestore.in-memory-db:execute",
279
806
  "attributes": {
@@ -287,29 +814,25 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 1`] = `
287
814
  },
288
815
  },
289
816
  {
290
- "_name": "@livestore/common:LeaderSyncProcessor:push",
291
- "attributes": {
292
- "batch": "undefined",
293
- "batchSize": 1,
294
- },
295
- },
296
- {
297
- "_name": "@livestore/common:LeaderSyncProcessor:push",
298
- "attributes": {
299
- "batch": "undefined",
300
- "batchSize": 1,
301
- },
302
- },
303
- {
304
- "_name": "client-session-sync-processor:pull",
305
- "attributes": {
306
- "code.stacktrace": "<STACKTRACE>",
307
- "span.label": "⚠︎ Interrupted",
308
- "status.interrupted": true,
309
- },
310
- },
311
- {
312
- "_name": "LiveStore:sync",
817
+ "_name": "client-session-sync-processor:boot",
818
+ "children": [
819
+ {
820
+ "_name": "client-session-sync-processor:pull",
821
+ "attributes": {
822
+ "span.label": "⚠︎ Interrupted",
823
+ "status.interrupted": true,
824
+ },
825
+ },
826
+ {
827
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
828
+ "attributes": {
829
+ "batch": "undefined",
830
+ "batchSize": 1,
831
+ "span.label": "⚠︎ Interrupted",
832
+ "status.interrupted": true,
833
+ },
834
+ },
835
+ ],
313
836
  },
314
837
  {
315
838
  "_name": "LiveStore:commits",
@@ -320,14 +843,14 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 1`] = `
320
843
  {
321
844
  "_name": "LiveStore.subscribe",
322
845
  "attributes": {
323
- "queryLabel": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
846
+ "queryLabel": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
324
847
  },
325
848
  "children": [
326
849
  {
327
- "_name": "db:SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
850
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
328
851
  "attributes": {
329
852
  "livestore.debugRefreshReason": "subscribe-initial-run:undefined",
330
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
853
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
331
854
  "sql.rowsCount": 0,
332
855
  },
333
856
  "children": [
@@ -335,17 +858,17 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 1`] = `
335
858
  "_name": "sql-in-memory-select",
336
859
  "attributes": {
337
860
  "sql.cached": false,
338
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
861
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
339
862
  "sql.rowsCount": 0,
340
863
  },
341
864
  },
342
865
  ],
343
866
  },
344
867
  {
345
- "_name": "db:SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
868
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
346
869
  "attributes": {
347
870
  "livestore.debugRefreshReason": "commit",
348
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
871
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
349
872
  "sql.rowsCount": 1,
350
873
  },
351
874
  "children": [
@@ -353,7 +876,7 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 1`] = `
353
876
  "_name": "sql-in-memory-select",
354
877
  "attributes": {
355
878
  "sql.cached": false,
356
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
879
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
357
880
  "sql.rowsCount": 1,
358
881
  },
359
882
  },
@@ -364,14 +887,14 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 1`] = `
364
887
  {
365
888
  "_name": "LiveStore.subscribe",
366
889
  "attributes": {
367
- "queryLabel": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
890
+ "queryLabel": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
368
891
  },
369
892
  "children": [
370
893
  {
371
- "_name": "db:SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
894
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
372
895
  "attributes": {
373
896
  "livestore.debugRefreshReason": "commit",
374
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
897
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
375
898
  "sql.rowsCount": 1,
376
899
  },
377
900
  "children": [
@@ -379,7 +902,7 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 1`] = `
379
902
  "_name": "sql-in-memory-select",
380
903
  "attributes": {
381
904
  "sql.cached": false,
382
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
905
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
383
906
  "sql.rowsCount": 1,
384
907
  },
385
908
  },
@@ -405,14 +928,10 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 2`] = `
405
928
  },
406
929
  "children": [
407
930
  {
408
- "_name": "client-session-sync-processor:push",
409
- "attributes": {
410
- "batchSize": 1,
411
- "eventCounts": "{
412
- "todo.created": 1
413
- }",
414
- "mergeResultTag": "advance",
415
- },
931
+ "_name": "client-session-sync-processor:encode-events",
932
+ },
933
+ {
934
+ "_name": "client-session-sync-processor:materialize-events",
416
935
  "children": [
417
936
  {
418
937
  "_name": "client-session-sync-processor:materialize-event",
@@ -420,13 +939,36 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 2`] = `
420
939
  {
421
940
  "_name": "livestore.in-memory-db:execute",
422
941
  "attributes": {
423
- "sql.query": "INSERT INTO 'todos' (id, text, completed) VALUES (?, ?, ?)",
942
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
943
+ },
944
+ },
945
+ {
946
+ "_name": "@livestore/common:execSql",
947
+ "attributes": {
948
+ "bindValueKeys": "[
949
+ "$id",
950
+ "$seqNumGlobal",
951
+ "$seqNumClient",
952
+ "$seqNumRebaseGeneration"
953
+ ]",
954
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
955
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
424
956
  },
425
957
  },
426
958
  ],
427
959
  },
428
960
  ],
429
961
  },
962
+ {
963
+ "_name": "client-session-sync-processor:push",
964
+ "attributes": {
965
+ "batchSize": 1,
966
+ "eventCounts": "{
967
+ "todo.created": 1
968
+ }",
969
+ "mergeResultTag": "advance",
970
+ },
971
+ },
430
972
  ],
431
973
  },
432
974
  {
@@ -439,14 +981,10 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 2`] = `
439
981
  },
440
982
  "children": [
441
983
  {
442
- "_name": "client-session-sync-processor:push",
443
- "attributes": {
444
- "batchSize": 1,
445
- "eventCounts": "{
446
- "todo.created": 1
447
- }",
448
- "mergeResultTag": "advance",
449
- },
984
+ "_name": "client-session-sync-processor:encode-events",
985
+ },
986
+ {
987
+ "_name": "client-session-sync-processor:materialize-events",
450
988
  "children": [
451
989
  {
452
990
  "_name": "client-session-sync-processor:materialize-event",
@@ -454,13 +992,36 @@ exports[`otel > QueryBuilder subscription - unsubscribe functionality 2`] = `
454
992
  {
455
993
  "_name": "livestore.in-memory-db:execute",
456
994
  "attributes": {
457
- "sql.query": "INSERT INTO 'todos' (id, text, completed) VALUES (?, ?, ?)",
995
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
996
+ },
997
+ },
998
+ {
999
+ "_name": "@livestore/common:execSql",
1000
+ "attributes": {
1001
+ "bindValueKeys": "[
1002
+ "$id",
1003
+ "$seqNumGlobal",
1004
+ "$seqNumClient",
1005
+ "$seqNumRebaseGeneration"
1006
+ ]",
1007
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
1008
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
458
1009
  },
459
1010
  },
460
1011
  ],
461
1012
  },
462
1013
  ],
463
1014
  },
1015
+ {
1016
+ "_name": "client-session-sync-processor:push",
1017
+ "attributes": {
1018
+ "batchSize": 1,
1019
+ "eventCounts": "{
1020
+ "todo.created": 1
1021
+ }",
1022
+ "mergeResultTag": "advance",
1023
+ },
1024
+ },
464
1025
  ],
465
1026
  },
466
1027
  ]
@@ -474,6 +1035,9 @@ exports[`otel > otel 3`] = `
474
1035
  "storeId": "default",
475
1036
  },
476
1037
  "children": [
1038
+ {
1039
+ "_name": "makeClientSessionSyncProcessor",
1040
+ },
477
1041
  {
478
1042
  "_name": "livestore.in-memory-db:execute",
479
1043
  "attributes": {
@@ -487,22 +1051,25 @@ exports[`otel > otel 3`] = `
487
1051
  },
488
1052
  },
489
1053
  {
490
- "_name": "@livestore/common:LeaderSyncProcessor:push",
491
- "attributes": {
492
- "batch": "undefined",
493
- "batchSize": 1,
494
- },
495
- },
496
- {
497
- "_name": "client-session-sync-processor:pull",
498
- "attributes": {
499
- "code.stacktrace": "<STACKTRACE>",
500
- "span.label": "⚠︎ Interrupted",
501
- "status.interrupted": true,
502
- },
503
- },
504
- {
505
- "_name": "LiveStore:sync",
1054
+ "_name": "client-session-sync-processor:boot",
1055
+ "children": [
1056
+ {
1057
+ "_name": "client-session-sync-processor:pull",
1058
+ "attributes": {
1059
+ "span.label": "⚠︎ Interrupted",
1060
+ "status.interrupted": true,
1061
+ },
1062
+ },
1063
+ {
1064
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
1065
+ "attributes": {
1066
+ "batch": "undefined",
1067
+ "batchSize": 1,
1068
+ "span.label": "⚠︎ Interrupted",
1069
+ "status.interrupted": true,
1070
+ },
1071
+ },
1072
+ ],
506
1073
  },
507
1074
  {
508
1075
  "_name": "LiveStore:commits",
@@ -562,14 +1129,10 @@ exports[`otel > otel 4`] = `
562
1129
  },
563
1130
  "children": [
564
1131
  {
565
- "_name": "client-session-sync-processor:push",
566
- "attributes": {
567
- "batchSize": 1,
568
- "eventCounts": "{
569
- "todo.created": 1
570
- }",
571
- "mergeResultTag": "advance",
572
- },
1132
+ "_name": "client-session-sync-processor:encode-events",
1133
+ },
1134
+ {
1135
+ "_name": "client-session-sync-processor:materialize-events",
573
1136
  "children": [
574
1137
  {
575
1138
  "_name": "client-session-sync-processor:materialize-event",
@@ -577,13 +1140,36 @@ exports[`otel > otel 4`] = `
577
1140
  {
578
1141
  "_name": "livestore.in-memory-db:execute",
579
1142
  "attributes": {
580
- "sql.query": "INSERT INTO 'todos' (id, text, completed) VALUES (?, ?, ?)",
1143
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
1144
+ },
1145
+ },
1146
+ {
1147
+ "_name": "@livestore/common:execSql",
1148
+ "attributes": {
1149
+ "bindValueKeys": "[
1150
+ "$id",
1151
+ "$seqNumGlobal",
1152
+ "$seqNumClient",
1153
+ "$seqNumRebaseGeneration"
1154
+ ]",
1155
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
1156
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
581
1157
  },
582
1158
  },
583
1159
  ],
584
1160
  },
585
1161
  ],
586
1162
  },
1163
+ {
1164
+ "_name": "client-session-sync-processor:push",
1165
+ "attributes": {
1166
+ "batchSize": 1,
1167
+ "eventCounts": "{
1168
+ "todo.created": 1
1169
+ }",
1170
+ "mergeResultTag": "advance",
1171
+ },
1172
+ },
587
1173
  ],
588
1174
  },
589
1175
  ]
@@ -769,6 +1355,9 @@ exports[`otel > with thunks 7`] = `
769
1355
  "storeId": "default",
770
1356
  },
771
1357
  "children": [
1358
+ {
1359
+ "_name": "makeClientSessionSyncProcessor",
1360
+ },
772
1361
  {
773
1362
  "_name": "livestore.in-memory-db:execute",
774
1363
  "attributes": {
@@ -782,22 +1371,25 @@ exports[`otel > with thunks 7`] = `
782
1371
  },
783
1372
  },
784
1373
  {
785
- "_name": "@livestore/common:LeaderSyncProcessor:push",
786
- "attributes": {
787
- "batch": "undefined",
788
- "batchSize": 1,
789
- },
790
- },
791
- {
792
- "_name": "client-session-sync-processor:pull",
793
- "attributes": {
794
- "code.stacktrace": "<STACKTRACE>",
795
- "span.label": "⚠︎ Interrupted",
796
- "status.interrupted": true,
797
- },
798
- },
799
- {
800
- "_name": "LiveStore:sync",
1374
+ "_name": "client-session-sync-processor:boot",
1375
+ "children": [
1376
+ {
1377
+ "_name": "client-session-sync-processor:pull",
1378
+ "attributes": {
1379
+ "span.label": "⚠︎ Interrupted",
1380
+ "status.interrupted": true,
1381
+ },
1382
+ },
1383
+ {
1384
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
1385
+ "attributes": {
1386
+ "batch": "undefined",
1387
+ "batchSize": 1,
1388
+ "span.label": "⚠︎ Interrupted",
1389
+ "status.interrupted": true,
1390
+ },
1391
+ },
1392
+ ],
801
1393
  },
802
1394
  {
803
1395
  "_name": "LiveStore:commits",
@@ -863,14 +1455,10 @@ exports[`otel > with thunks 8`] = `
863
1455
  },
864
1456
  "children": [
865
1457
  {
866
- "_name": "client-session-sync-processor:push",
867
- "attributes": {
868
- "batchSize": 1,
869
- "eventCounts": "{
870
- "todo.created": 1
871
- }",
872
- "mergeResultTag": "advance",
873
- },
1458
+ "_name": "client-session-sync-processor:encode-events",
1459
+ },
1460
+ {
1461
+ "_name": "client-session-sync-processor:materialize-events",
874
1462
  "children": [
875
1463
  {
876
1464
  "_name": "client-session-sync-processor:materialize-event",
@@ -878,13 +1466,36 @@ exports[`otel > with thunks 8`] = `
878
1466
  {
879
1467
  "_name": "livestore.in-memory-db:execute",
880
1468
  "attributes": {
881
- "sql.query": "INSERT INTO 'todos' (id, text, completed) VALUES (?, ?, ?)",
1469
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
1470
+ },
1471
+ },
1472
+ {
1473
+ "_name": "@livestore/common:execSql",
1474
+ "attributes": {
1475
+ "bindValueKeys": "[
1476
+ "$id",
1477
+ "$seqNumGlobal",
1478
+ "$seqNumClient",
1479
+ "$seqNumRebaseGeneration"
1480
+ ]",
1481
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
1482
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
882
1483
  },
883
1484
  },
884
1485
  ],
885
1486
  },
886
1487
  ],
887
1488
  },
1489
+ {
1490
+ "_name": "client-session-sync-processor:push",
1491
+ "attributes": {
1492
+ "batchSize": 1,
1493
+ "eventCounts": "{
1494
+ "todo.created": 1
1495
+ }",
1496
+ "mergeResultTag": "advance",
1497
+ },
1498
+ },
888
1499
  ],
889
1500
  },
890
1501
  ]
@@ -898,6 +1509,9 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
898
1509
  "storeId": "default",
899
1510
  },
900
1511
  "children": [
1512
+ {
1513
+ "_name": "makeClientSessionSyncProcessor",
1514
+ },
901
1515
  {
902
1516
  "_name": "livestore.in-memory-db:execute",
903
1517
  "attributes": {
@@ -911,22 +1525,25 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
911
1525
  },
912
1526
  },
913
1527
  {
914
- "_name": "@livestore/common:LeaderSyncProcessor:push",
915
- "attributes": {
916
- "batch": "undefined",
917
- "batchSize": 1,
918
- },
919
- },
920
- {
921
- "_name": "client-session-sync-processor:pull",
922
- "attributes": {
923
- "code.stacktrace": "<STACKTRACE>",
924
- "span.label": "⚠︎ Interrupted",
925
- "status.interrupted": true,
926
- },
927
- },
928
- {
929
- "_name": "LiveStore:sync",
1528
+ "_name": "client-session-sync-processor:boot",
1529
+ "children": [
1530
+ {
1531
+ "_name": "client-session-sync-processor:pull",
1532
+ "attributes": {
1533
+ "span.label": "⚠︎ Interrupted",
1534
+ "status.interrupted": true,
1535
+ },
1536
+ },
1537
+ {
1538
+ "_name": "@livestore/common:LeaderSyncProcessor:push",
1539
+ "attributes": {
1540
+ "batch": "undefined",
1541
+ "batchSize": 1,
1542
+ "span.label": "⚠︎ Interrupted",
1543
+ "status.interrupted": true,
1544
+ },
1545
+ },
1546
+ ],
930
1547
  },
931
1548
  {
932
1549
  "_name": "LiveStore:commits",
@@ -935,9 +1552,9 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
935
1552
  "_name": "LiveStore:queries",
936
1553
  "children": [
937
1554
  {
938
- "_name": "db:SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
1555
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
939
1556
  "attributes": {
940
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
1557
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
941
1558
  "sql.rowsCount": 0,
942
1559
  },
943
1560
  "children": [
@@ -948,16 +1565,16 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
948
1565
  "_name": "sql-in-memory-select",
949
1566
  "attributes": {
950
1567
  "sql.cached": false,
951
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
1568
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
952
1569
  "sql.rowsCount": 0,
953
1570
  },
954
1571
  },
955
1572
  ],
956
1573
  },
957
1574
  {
958
- "_name": "db:SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
1575
+ "_name": "db:SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ",
959
1576
  "attributes": {
960
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
1577
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
961
1578
  "sql.rowsCount": 1,
962
1579
  },
963
1580
  "children": [
@@ -968,7 +1585,7 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
968
1585
  "_name": "sql-in-memory-select",
969
1586
  "attributes": {
970
1587
  "sql.cached": false,
971
- "sql.query": "SELECT * FROM 'todos' WHERE completed = ? LIMIT ?",
1588
+ "sql.query": "SELECT * FROM 'todos' WHERE "completed" = ? LIMIT ?",
972
1589
  "sql.rowsCount": 1,
973
1590
  },
974
1591
  },
@@ -992,14 +1609,10 @@ exports[`otel > with thunks with query builder and without labels 4`] = `
992
1609
  },
993
1610
  "children": [
994
1611
  {
995
- "_name": "client-session-sync-processor:push",
996
- "attributes": {
997
- "batchSize": 1,
998
- "eventCounts": "{
999
- "todo.created": 1
1000
- }",
1001
- "mergeResultTag": "advance",
1002
- },
1612
+ "_name": "client-session-sync-processor:encode-events",
1613
+ },
1614
+ {
1615
+ "_name": "client-session-sync-processor:materialize-events",
1003
1616
  "children": [
1004
1617
  {
1005
1618
  "_name": "client-session-sync-processor:materialize-event",
@@ -1007,13 +1620,36 @@ exports[`otel > with thunks with query builder and without labels 4`] = `
1007
1620
  {
1008
1621
  "_name": "livestore.in-memory-db:execute",
1009
1622
  "attributes": {
1010
- "sql.query": "INSERT INTO 'todos' (id, text, completed) VALUES (?, ?, ?)",
1623
+ "sql.query": "INSERT INTO 'todos' ("id", "text", "completed") VALUES (?, ?, ?)",
1624
+ },
1625
+ },
1626
+ {
1627
+ "_name": "@livestore/common:execSql",
1628
+ "attributes": {
1629
+ "bindValueKeys": "[
1630
+ "$id",
1631
+ "$seqNumGlobal",
1632
+ "$seqNumClient",
1633
+ "$seqNumRebaseGeneration"
1634
+ ]",
1635
+ "span.label": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
1636
+ "sql": "INSERT OR REPLACE INTO __livestore_state_head (id, seqNumGlobal, seqNumClient, seqNumRebaseGeneration) VALUES ($id, $seqNumGlobal, $seqNumClient, $seqNumRebaseGeneration)",
1011
1637
  },
1012
1638
  },
1013
1639
  ],
1014
1640
  },
1015
1641
  ],
1016
1642
  },
1643
+ {
1644
+ "_name": "client-session-sync-processor:push",
1645
+ "attributes": {
1646
+ "batchSize": 1,
1647
+ "eventCounts": "{
1648
+ "todo.created": 1
1649
+ }",
1650
+ "mergeResultTag": "advance",
1651
+ },
1652
+ },
1017
1653
  ],
1018
1654
  },
1019
1655
  ]