@livestore/livestore 0.0.58-dev.5 → 0.0.58-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.
@@ -0,0 +1,359 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`useRow > otel > should update the data based on component key > strictMode=false 1`] = `
4
+ {
5
+ "_name": "test",
6
+ "children": [
7
+ {
8
+ "_name": "livestore.in-memory-db:execute",
9
+ "attributes": {
10
+ "sql.query": "
11
+ PRAGMA page_size=32768;
12
+ PRAGMA cache_size=10000;
13
+ PRAGMA journal_mode='MEMORY'; -- we don't flush to disk before committing a write
14
+ PRAGMA synchronous='OFF';
15
+ PRAGMA temp_store='MEMORY';
16
+ PRAGMA foreign_keys='ON'; -- we want foreign key constraints to be enforced
17
+ ",
18
+ },
19
+ },
20
+ {
21
+ "_name": "sql-in-memory-select",
22
+ "attributes": {
23
+ "sql.cached": false,
24
+ "sql.query": "select 1 from UserInfo where id = 'u1'",
25
+ "sql.rowsCount": 0,
26
+ },
27
+ },
28
+ {
29
+ "_name": "sql-in-memory-select",
30
+ "attributes": {
31
+ "sql.cached": false,
32
+ "sql.query": "select 1 from UserInfo where id = 'u2'",
33
+ "sql.rowsCount": 1,
34
+ },
35
+ },
36
+ {
37
+ "_name": "LiveStore:mutations",
38
+ "children": [
39
+ {
40
+ "_name": "LiveStore:mutate",
41
+ "attributes": {
42
+ "livestore.mutateLabel": "mutate",
43
+ },
44
+ "children": [
45
+ {
46
+ "_name": "LiveStore:processWrites",
47
+ "attributes": {
48
+ "livestore.mutateLabel": "mutate",
49
+ },
50
+ "children": [
51
+ {
52
+ "_name": "LiveStore:mutateWithoutRefresh",
53
+ "attributes": {
54
+ "livestore.args": "{
55
+ "sql": "INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')"
56
+ }",
57
+ "livestore.mutation": "livestore.RawSql",
58
+ },
59
+ "children": [
60
+ {
61
+ "_name": "livestore.in-memory-db:execute",
62
+ "attributes": {
63
+ "sql.query": "INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')",
64
+ },
65
+ },
66
+ ],
67
+ },
68
+ ],
69
+ },
70
+ ],
71
+ },
72
+ ],
73
+ },
74
+ {
75
+ "_name": "LiveStore:queries",
76
+ "children": [
77
+ {
78
+ "_name": "sql:select * from UserInfo where id = 'u1' limit 1",
79
+ "attributes": {
80
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
81
+ "sql.rowsCount": 1,
82
+ },
83
+ "children": [
84
+ {
85
+ "_name": "sql-in-memory-select",
86
+ "attributes": {
87
+ "sql.cached": false,
88
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
89
+ "sql.rowsCount": 1,
90
+ },
91
+ },
92
+ ],
93
+ },
94
+ {
95
+ "_name": "LiveStore:useRow:UserInfo:u1",
96
+ "attributes": {
97
+ "id": "u1",
98
+ },
99
+ "children": [
100
+ {
101
+ "_name": "LiveStore:mutateWithoutRefresh",
102
+ "attributes": {
103
+ "livestore.args": "{
104
+ "id": "u1"
105
+ }",
106
+ "livestore.mutation": "_Derived_Create_UserInfo",
107
+ },
108
+ "children": [
109
+ {
110
+ "_name": "livestore.in-memory-db:execute",
111
+ "attributes": {
112
+ "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
113
+ },
114
+ },
115
+ ],
116
+ },
117
+ {
118
+ "_name": "LiveStore:useQuery:sql(rowQuery:query:UserInfo:u1)",
119
+ "attributes": {
120
+ "label": "sql(rowQuery:query:UserInfo:u1)",
121
+ "stackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
122
+ },
123
+ "children": [
124
+ {
125
+ "_name": "sql:select * from UserInfo where id = 'u1' limit 1",
126
+ "attributes": {
127
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
128
+ "sql.rowsCount": 1,
129
+ },
130
+ "children": [
131
+ {
132
+ "_name": "sql-in-memory-select",
133
+ "attributes": {
134
+ "sql.cached": false,
135
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
136
+ "sql.rowsCount": 1,
137
+ },
138
+ },
139
+ ],
140
+ },
141
+ {
142
+ "_name": "LiveStore.subscribe",
143
+ "attributes": {
144
+ "label": "sql(rowQuery:query:UserInfo:u1)",
145
+ "queryLabel": "sql(rowQuery:query:UserInfo:u1)",
146
+ },
147
+ },
148
+ ],
149
+ },
150
+ ],
151
+ },
152
+ {
153
+ "_name": "LiveStore:useRow:UserInfo:u2",
154
+ "attributes": {
155
+ "id": "u2",
156
+ },
157
+ "children": [
158
+ {
159
+ "_name": "LiveStore:useQuery:sql(rowQuery:query:UserInfo:u2)",
160
+ "attributes": {
161
+ "label": "sql(rowQuery:query:UserInfo:u2)",
162
+ "stackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
163
+ },
164
+ "children": [
165
+ {
166
+ "_name": "sql:select * from UserInfo where id = 'u2' limit 1",
167
+ "attributes": {
168
+ "sql.query": "select * from UserInfo where id = 'u2' limit 1",
169
+ "sql.rowsCount": 1,
170
+ },
171
+ "children": [
172
+ {
173
+ "_name": "sql-in-memory-select",
174
+ "attributes": {
175
+ "sql.cached": false,
176
+ "sql.query": "select * from UserInfo where id = 'u2' limit 1",
177
+ "sql.rowsCount": 1,
178
+ },
179
+ },
180
+ ],
181
+ },
182
+ {
183
+ "_name": "LiveStore.subscribe",
184
+ "attributes": {
185
+ "label": "sql(rowQuery:query:UserInfo:u2)",
186
+ "queryLabel": "sql(rowQuery:query:UserInfo:u2)",
187
+ },
188
+ },
189
+ ],
190
+ },
191
+ ],
192
+ },
193
+ ],
194
+ },
195
+ ],
196
+ }
197
+ `;
198
+
199
+ exports[`useRow > otel > should update the data based on component key > strictMode=true 1`] = `
200
+ {
201
+ "_name": "test",
202
+ "children": [
203
+ {
204
+ "_name": "livestore.in-memory-db:execute",
205
+ "attributes": {
206
+ "sql.query": "
207
+ PRAGMA page_size=32768;
208
+ PRAGMA cache_size=10000;
209
+ PRAGMA journal_mode='MEMORY'; -- we don't flush to disk before committing a write
210
+ PRAGMA synchronous='OFF';
211
+ PRAGMA temp_store='MEMORY';
212
+ PRAGMA foreign_keys='ON'; -- we want foreign key constraints to be enforced
213
+ ",
214
+ },
215
+ },
216
+ {
217
+ "_name": "sql-in-memory-select",
218
+ "attributes": {
219
+ "sql.cached": false,
220
+ "sql.query": "select 1 from UserInfo where id = 'u1'",
221
+ "sql.rowsCount": 0,
222
+ },
223
+ },
224
+ {
225
+ "_name": "sql-in-memory-select",
226
+ "attributes": {
227
+ "sql.cached": false,
228
+ "sql.query": "select 1 from UserInfo where id = 'u2'",
229
+ "sql.rowsCount": 1,
230
+ },
231
+ },
232
+ {
233
+ "_name": "LiveStore:mutations",
234
+ "children": [
235
+ {
236
+ "_name": "LiveStore:mutate",
237
+ "attributes": {
238
+ "livestore.mutateLabel": "mutate",
239
+ },
240
+ "children": [
241
+ {
242
+ "_name": "LiveStore:processWrites",
243
+ "attributes": {
244
+ "livestore.mutateLabel": "mutate",
245
+ },
246
+ "children": [
247
+ {
248
+ "_name": "LiveStore:mutateWithoutRefresh",
249
+ "attributes": {
250
+ "livestore.args": "{
251
+ "sql": "INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')"
252
+ }",
253
+ "livestore.mutation": "livestore.RawSql",
254
+ },
255
+ "children": [
256
+ {
257
+ "_name": "livestore.in-memory-db:execute",
258
+ "attributes": {
259
+ "sql.query": "INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')",
260
+ },
261
+ },
262
+ ],
263
+ },
264
+ ],
265
+ },
266
+ ],
267
+ },
268
+ ],
269
+ },
270
+ {
271
+ "_name": "LiveStore:queries",
272
+ "children": [
273
+ {
274
+ "_name": "sql:select * from UserInfo where id = 'u1' limit 1",
275
+ "attributes": {
276
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
277
+ "sql.rowsCount": 1,
278
+ },
279
+ "children": [
280
+ {
281
+ "_name": "sql-in-memory-select",
282
+ "attributes": {
283
+ "sql.cached": false,
284
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
285
+ "sql.rowsCount": 1,
286
+ },
287
+ },
288
+ ],
289
+ },
290
+ {
291
+ "_name": "LiveStore:useRow:UserInfo:u1",
292
+ "attributes": {
293
+ "id": "u1",
294
+ },
295
+ "children": [
296
+ {
297
+ "_name": "LiveStore:mutateWithoutRefresh",
298
+ "attributes": {
299
+ "livestore.args": "{
300
+ "id": "u1"
301
+ }",
302
+ "livestore.mutation": "_Derived_Create_UserInfo",
303
+ },
304
+ "children": [
305
+ {
306
+ "_name": "livestore.in-memory-db:execute",
307
+ "attributes": {
308
+ "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
309
+ },
310
+ },
311
+ ],
312
+ },
313
+ {
314
+ "_name": "LiveStore:useQuery:sql(rowQuery:query:UserInfo:u1)",
315
+ "attributes": {
316
+ "label": "sql(rowQuery:query:UserInfo:u1)",
317
+ "stackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
318
+ },
319
+ "children": [
320
+ {
321
+ "_name": "sql:select * from UserInfo where id = 'u1' limit 1",
322
+ "attributes": {
323
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
324
+ "sql.rowsCount": 1,
325
+ },
326
+ "children": [
327
+ {
328
+ "_name": "sql-in-memory-select",
329
+ "attributes": {
330
+ "sql.cached": false,
331
+ "sql.query": "select * from UserInfo where id = 'u1' limit 1",
332
+ "sql.rowsCount": 1,
333
+ },
334
+ },
335
+ ],
336
+ },
337
+ {
338
+ "_name": "LiveStore.subscribe",
339
+ "attributes": {
340
+ "label": "sql(rowQuery:query:UserInfo:u1)",
341
+ "queryLabel": "sql(rowQuery:query:UserInfo:u1)",
342
+ },
343
+ },
344
+ {
345
+ "_name": "LiveStore.subscribe",
346
+ "attributes": {
347
+ "label": "sql(rowQuery:query:UserInfo:u1)",
348
+ "queryLabel": "sql(rowQuery:query:UserInfo:u1)",
349
+ },
350
+ },
351
+ ],
352
+ },
353
+ ],
354
+ },
355
+ ],
356
+ },
357
+ ],
358
+ }
359
+ `;