@livestore/react 0.0.0-snapshot-a2ca318cc053b3d24df8cc4e8ee8d02736ac62ee → 0.0.0-snapshot-60f3756dd4d7a44aeb731db7db666dd8689c6000
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/LiveStoreProvider.test.js +1 -1
- package/dist/LiveStoreProvider.test.js.map +1 -1
- package/dist/__tests__/fixture.d.ts +52 -52
- package/dist/__tests__/fixture.d.ts.map +1 -1
- package/dist/__tests__/fixture.js +4 -4
- package/dist/__tests__/fixture.js.map +1 -1
- package/dist/useAtom.d.ts.map +1 -1
- package/dist/useAtom.js.map +1 -1
- package/dist/useRow.d.ts +11 -0
- package/dist/useRow.d.ts.map +1 -1
- package/dist/useRow.js +17 -3
- package/dist/useRow.js.map +1 -1
- package/package.json +5 -6
- package/src/LiveStoreProvider.test.tsx +1 -1
- package/src/__tests__/fixture.tsx +4 -4
- package/src/useAtom.ts +1 -2
- package/src/useRow.ts +29 -9
- package/tsconfig.json +1 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { makeInMemoryAdapter } from '@livestore/adapter-web';
|
|
1
2
|
import { sql } from '@livestore/common';
|
|
2
3
|
import { rawSqlMutation } from '@livestore/common/schema';
|
|
3
4
|
import { queryDb } from '@livestore/livestore';
|
|
4
5
|
import { Schema } from '@livestore/utils/effect';
|
|
5
|
-
import { makeInMemoryAdapter } from '@livestore/web';
|
|
6
6
|
import { render, screen, waitFor, waitForElementToBeRemoved } from '@testing-library/react';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { unstable_batchedUpdates as batchUpdates } from 'react-dom';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveStoreProvider.test.js","sourceRoot":"","sources":["../src/LiveStoreProvider.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AACvC,OAAO,E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AAC,CAAA;YAC7E,OAAO,CACL,oBAAC,iBAAiB,IAChB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;;oBAAyB,MAAM,CAAC,KAAK,CAAO,EACvE,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,YAAY;gBAE1B,oBAAC,GAAG,OAAG,CACW,CACrB,CAAA;QACH,CAAC,CAAA;QAED,MAAM,CAAC,oBAAC,IAAI,IAAC,WAAW,EAAE,CAAC,GAAI,CAAC,CAAA;QAEhC,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAE9B,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAA;IACzF,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -37,14 +37,14 @@ export declare const todos: DbSchema.TableDef<{
|
|
|
37
37
|
primaryKey: false;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
indexes?: ReadonlyArray<
|
|
41
|
-
ast: import("@livestore/db-schema/
|
|
40
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
41
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
42
42
|
}, {
|
|
43
43
|
isSingleton: false;
|
|
44
44
|
disableAutomaticIdColumn: false;
|
|
45
45
|
deriveMutations: {
|
|
46
46
|
enabled: true;
|
|
47
|
-
clientOnly:
|
|
47
|
+
clientOnly: true;
|
|
48
48
|
};
|
|
49
49
|
isSingleColumn: false;
|
|
50
50
|
requiredInsertColumnNames: "id";
|
|
@@ -82,8 +82,8 @@ export declare const app: DbSchema.TableDef<{
|
|
|
82
82
|
primaryKey: false;
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
indexes?: ReadonlyArray<
|
|
86
|
-
ast: import("@livestore/db-schema/
|
|
85
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
86
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
87
87
|
}, {
|
|
88
88
|
isSingleton: true;
|
|
89
89
|
disableAutomaticIdColumn: false;
|
|
@@ -116,16 +116,16 @@ export declare const userInfo: DbSchema.TableDef<{
|
|
|
116
116
|
nullable: false;
|
|
117
117
|
primaryKey: false;
|
|
118
118
|
};
|
|
119
|
-
id:
|
|
119
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<string, string>;
|
|
120
120
|
};
|
|
121
|
-
indexes?: ReadonlyArray<
|
|
122
|
-
ast: import("@livestore/db-schema/
|
|
121
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
122
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
123
123
|
}, {
|
|
124
124
|
isSingleton: false;
|
|
125
125
|
disableAutomaticIdColumn: false;
|
|
126
126
|
deriveMutations: {
|
|
127
127
|
enabled: true;
|
|
128
|
-
clientOnly:
|
|
128
|
+
clientOnly: true;
|
|
129
129
|
};
|
|
130
130
|
isSingleColumn: false;
|
|
131
131
|
requiredInsertColumnNames: never;
|
|
@@ -148,16 +148,16 @@ export declare const AppRouterSchema: DbSchema.TableDef<{
|
|
|
148
148
|
nullable: true;
|
|
149
149
|
primaryKey: false;
|
|
150
150
|
};
|
|
151
|
-
id:
|
|
151
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<"singleton", "singleton">;
|
|
152
152
|
};
|
|
153
|
-
indexes?: ReadonlyArray<
|
|
154
|
-
ast: import("@livestore/db-schema/
|
|
153
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
154
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
155
155
|
}, {
|
|
156
156
|
isSingleton: true;
|
|
157
157
|
disableAutomaticIdColumn: false;
|
|
158
158
|
deriveMutations: {
|
|
159
159
|
enabled: true;
|
|
160
|
-
clientOnly:
|
|
160
|
+
clientOnly: true;
|
|
161
161
|
};
|
|
162
162
|
isSingleColumn: false;
|
|
163
163
|
requiredInsertColumnNames: never;
|
|
@@ -194,14 +194,14 @@ export declare const tables: {
|
|
|
194
194
|
primaryKey: false;
|
|
195
195
|
};
|
|
196
196
|
};
|
|
197
|
-
indexes?: ReadonlyArray<
|
|
198
|
-
ast: import("@livestore/db-schema/
|
|
197
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
198
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
199
199
|
}, {
|
|
200
200
|
isSingleton: false;
|
|
201
201
|
disableAutomaticIdColumn: false;
|
|
202
202
|
deriveMutations: {
|
|
203
203
|
enabled: true;
|
|
204
|
-
clientOnly:
|
|
204
|
+
clientOnly: true;
|
|
205
205
|
};
|
|
206
206
|
isSingleColumn: false;
|
|
207
207
|
requiredInsertColumnNames: "id";
|
|
@@ -239,8 +239,8 @@ export declare const tables: {
|
|
|
239
239
|
primaryKey: false;
|
|
240
240
|
};
|
|
241
241
|
};
|
|
242
|
-
indexes?: ReadonlyArray<
|
|
243
|
-
ast: import("@livestore/db-schema/
|
|
242
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
243
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
244
244
|
}, {
|
|
245
245
|
isSingleton: true;
|
|
246
246
|
disableAutomaticIdColumn: false;
|
|
@@ -273,16 +273,16 @@ export declare const tables: {
|
|
|
273
273
|
nullable: false;
|
|
274
274
|
primaryKey: false;
|
|
275
275
|
};
|
|
276
|
-
id:
|
|
276
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<string, string>;
|
|
277
277
|
};
|
|
278
|
-
indexes?: ReadonlyArray<
|
|
279
|
-
ast: import("@livestore/db-schema/
|
|
278
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
279
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
280
280
|
}, {
|
|
281
281
|
isSingleton: false;
|
|
282
282
|
disableAutomaticIdColumn: false;
|
|
283
283
|
deriveMutations: {
|
|
284
284
|
enabled: true;
|
|
285
|
-
clientOnly:
|
|
285
|
+
clientOnly: true;
|
|
286
286
|
};
|
|
287
287
|
isSingleColumn: false;
|
|
288
288
|
requiredInsertColumnNames: never;
|
|
@@ -305,16 +305,16 @@ export declare const tables: {
|
|
|
305
305
|
nullable: true;
|
|
306
306
|
primaryKey: false;
|
|
307
307
|
};
|
|
308
|
-
id:
|
|
308
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<"singleton", "singleton">;
|
|
309
309
|
};
|
|
310
|
-
indexes?: ReadonlyArray<
|
|
311
|
-
ast: import("@livestore/db-schema/
|
|
310
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
311
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
312
312
|
}, {
|
|
313
313
|
isSingleton: true;
|
|
314
314
|
disableAutomaticIdColumn: false;
|
|
315
315
|
deriveMutations: {
|
|
316
316
|
enabled: true;
|
|
317
|
-
clientOnly:
|
|
317
|
+
clientOnly: true;
|
|
318
318
|
};
|
|
319
319
|
isSingleColumn: false;
|
|
320
320
|
requiredInsertColumnNames: never;
|
|
@@ -353,14 +353,14 @@ export declare const schema: import("@livestore/common/schema").FromInputSchema.
|
|
|
353
353
|
primaryKey: false;
|
|
354
354
|
};
|
|
355
355
|
};
|
|
356
|
-
indexes?: ReadonlyArray<
|
|
357
|
-
ast: import("@livestore/db-schema/
|
|
356
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
357
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
358
358
|
}, {
|
|
359
359
|
isSingleton: false;
|
|
360
360
|
disableAutomaticIdColumn: false;
|
|
361
361
|
deriveMutations: {
|
|
362
362
|
enabled: true;
|
|
363
|
-
clientOnly:
|
|
363
|
+
clientOnly: true;
|
|
364
364
|
};
|
|
365
365
|
isSingleColumn: false;
|
|
366
366
|
requiredInsertColumnNames: "id";
|
|
@@ -398,8 +398,8 @@ export declare const schema: import("@livestore/common/schema").FromInputSchema.
|
|
|
398
398
|
primaryKey: false;
|
|
399
399
|
};
|
|
400
400
|
};
|
|
401
|
-
indexes?: ReadonlyArray<
|
|
402
|
-
ast: import("@livestore/db-schema/
|
|
401
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
402
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
403
403
|
}, {
|
|
404
404
|
isSingleton: true;
|
|
405
405
|
disableAutomaticIdColumn: false;
|
|
@@ -432,16 +432,16 @@ export declare const schema: import("@livestore/common/schema").FromInputSchema.
|
|
|
432
432
|
nullable: false;
|
|
433
433
|
primaryKey: false;
|
|
434
434
|
};
|
|
435
|
-
id:
|
|
435
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<string, string>;
|
|
436
436
|
};
|
|
437
|
-
indexes?: ReadonlyArray<
|
|
438
|
-
ast: import("@livestore/db-schema/
|
|
437
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
438
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
439
439
|
}, {
|
|
440
440
|
isSingleton: false;
|
|
441
441
|
disableAutomaticIdColumn: false;
|
|
442
442
|
deriveMutations: {
|
|
443
443
|
enabled: true;
|
|
444
|
-
clientOnly:
|
|
444
|
+
clientOnly: true;
|
|
445
445
|
};
|
|
446
446
|
isSingleColumn: false;
|
|
447
447
|
requiredInsertColumnNames: never;
|
|
@@ -464,16 +464,16 @@ export declare const schema: import("@livestore/common/schema").FromInputSchema.
|
|
|
464
464
|
nullable: true;
|
|
465
465
|
primaryKey: false;
|
|
466
466
|
};
|
|
467
|
-
id:
|
|
467
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<"singleton", "singleton">;
|
|
468
468
|
};
|
|
469
|
-
indexes?: ReadonlyArray<
|
|
470
|
-
ast: import("@livestore/db-schema/
|
|
469
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
470
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
471
471
|
}, {
|
|
472
472
|
isSingleton: true;
|
|
473
473
|
disableAutomaticIdColumn: false;
|
|
474
474
|
deriveMutations: {
|
|
475
475
|
enabled: true;
|
|
476
|
-
clientOnly:
|
|
476
|
+
clientOnly: true;
|
|
477
477
|
};
|
|
478
478
|
isSingleColumn: false;
|
|
479
479
|
requiredInsertColumnNames: never;
|
|
@@ -519,14 +519,14 @@ export declare const makeTodoMvcReact: ({ otelTracer, otelContext, strictMode, }
|
|
|
519
519
|
primaryKey: false;
|
|
520
520
|
};
|
|
521
521
|
};
|
|
522
|
-
indexes?: ReadonlyArray<
|
|
523
|
-
ast: import("@livestore/db-schema/
|
|
522
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
523
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
524
524
|
}, {
|
|
525
525
|
isSingleton: false;
|
|
526
526
|
disableAutomaticIdColumn: false;
|
|
527
527
|
deriveMutations: {
|
|
528
528
|
enabled: true;
|
|
529
|
-
clientOnly:
|
|
529
|
+
clientOnly: true;
|
|
530
530
|
};
|
|
531
531
|
isSingleColumn: false;
|
|
532
532
|
requiredInsertColumnNames: "id";
|
|
@@ -564,8 +564,8 @@ export declare const makeTodoMvcReact: ({ otelTracer, otelContext, strictMode, }
|
|
|
564
564
|
primaryKey: false;
|
|
565
565
|
};
|
|
566
566
|
};
|
|
567
|
-
indexes?: ReadonlyArray<
|
|
568
|
-
ast: import("@livestore/db-schema/
|
|
567
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
568
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
569
569
|
}, {
|
|
570
570
|
isSingleton: true;
|
|
571
571
|
disableAutomaticIdColumn: false;
|
|
@@ -598,16 +598,16 @@ export declare const makeTodoMvcReact: ({ otelTracer, otelContext, strictMode, }
|
|
|
598
598
|
nullable: false;
|
|
599
599
|
primaryKey: false;
|
|
600
600
|
};
|
|
601
|
-
id:
|
|
601
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<string, string>;
|
|
602
602
|
};
|
|
603
|
-
indexes?: ReadonlyArray<
|
|
604
|
-
ast: import("@livestore/db-schema/
|
|
603
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
604
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
605
605
|
}, {
|
|
606
606
|
isSingleton: false;
|
|
607
607
|
disableAutomaticIdColumn: false;
|
|
608
608
|
deriveMutations: {
|
|
609
609
|
enabled: true;
|
|
610
|
-
clientOnly:
|
|
610
|
+
clientOnly: true;
|
|
611
611
|
};
|
|
612
612
|
isSingleColumn: false;
|
|
613
613
|
requiredInsertColumnNames: never;
|
|
@@ -630,16 +630,16 @@ export declare const makeTodoMvcReact: ({ otelTracer, otelContext, strictMode, }
|
|
|
630
630
|
nullable: true;
|
|
631
631
|
primaryKey: false;
|
|
632
632
|
};
|
|
633
|
-
id:
|
|
633
|
+
id: import("@livestore/common/dist/schema/db-schema/dsl/field-defs.js").ColumnDefinition<"singleton", "singleton">;
|
|
634
634
|
};
|
|
635
|
-
indexes?: ReadonlyArray<
|
|
636
|
-
ast: import("@livestore/db-schema/
|
|
635
|
+
indexes?: ReadonlyArray<import("@livestore/common/dist/schema/db-schema/dsl/mod.js").Index>;
|
|
636
|
+
ast: import("@livestore/common/dist/schema/db-schema/ast/sqlite.js").Table;
|
|
637
637
|
}, {
|
|
638
638
|
isSingleton: true;
|
|
639
639
|
disableAutomaticIdColumn: false;
|
|
640
640
|
deriveMutations: {
|
|
641
641
|
enabled: true;
|
|
642
|
-
clientOnly:
|
|
642
|
+
clientOnly: true;
|
|
643
643
|
};
|
|
644
644
|
isSingleColumn: false;
|
|
645
645
|
requiredInsertColumnNames: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixture.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixture.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAc,MAAM,0BAA0B,CAAA;AAG/D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEnD,MAAM,MAAM,QAAQ,GAAG;IACrB,WAA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CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { makeInMemoryAdapter } from '@livestore/adapter-web';
|
|
1
2
|
import { provideOtel } from '@livestore/common';
|
|
2
3
|
import { DbSchema, makeSchema } from '@livestore/common/schema';
|
|
3
4
|
import { createStore } from '@livestore/livestore';
|
|
4
5
|
import { Effect } from '@livestore/utils/effect';
|
|
5
|
-
import { makeInMemoryAdapter } from '@livestore/web';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import * as LiveStoreReact from '../mod.js';
|
|
8
8
|
export const todos = DbSchema.table('todos', {
|
|
9
9
|
id: DbSchema.text({ primaryKey: true }),
|
|
10
10
|
text: DbSchema.text({ default: '', nullable: false }),
|
|
11
11
|
completed: DbSchema.boolean({ default: false, nullable: false }),
|
|
12
|
-
}, { deriveMutations: true, isSingleton: false });
|
|
12
|
+
}, { deriveMutations: { clientOnly: true }, isSingleton: false });
|
|
13
13
|
export const app = DbSchema.table('app', {
|
|
14
14
|
id: DbSchema.text({ primaryKey: true, default: 'static' }),
|
|
15
15
|
newTodoText: DbSchema.text({ default: '', nullable: true }),
|
|
@@ -18,10 +18,10 @@ export const app = DbSchema.table('app', {
|
|
|
18
18
|
export const userInfo = DbSchema.table('UserInfo', {
|
|
19
19
|
username: DbSchema.text({ default: '' }),
|
|
20
20
|
text: DbSchema.text({ default: '' }),
|
|
21
|
-
}, { deriveMutations: true });
|
|
21
|
+
}, { deriveMutations: { clientOnly: true } });
|
|
22
22
|
export const AppRouterSchema = DbSchema.table('AppRouter', {
|
|
23
23
|
currentTaskId: DbSchema.text({ default: null, nullable: true }),
|
|
24
|
-
}, { isSingleton: true, deriveMutations: true });
|
|
24
|
+
}, { isSingleton: true, deriveMutations: { clientOnly: true } });
|
|
25
25
|
export const tables = { todos, app, userInfo, AppRouterSchema };
|
|
26
26
|
export const schema = makeSchema({ tables });
|
|
27
27
|
export const makeTodoMvcReact = ({ otelTracer, otelContext, strictMode, } = {}) => Effect.gen(function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../src/__tests__/fixture.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../src/__tests__/fixture.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,cAAc,MAAM,WAAW,CAAA;AAe3C,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CACjC,OAAO,EACP;IACE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACrD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;CACjE,EACD,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAC9D,CAAA;AAED,MAAM,CAAC,M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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAtom.d.ts","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,SAAS,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"useAtom.d.ts","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAM1E,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE3D,eAAO,MAAM,OAAO,GAElB,MAAM,SAAS,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,YAErD,MAAM,YACN;IACR,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,KACA,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CA2C3F,CAAA"}
|
package/dist/useAtom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAtom.js","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAtom.js","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,MAAM,CAAC,MAAM,OAAO,GAAG,CAIrB,QAAgB,EACh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AAM,CAAC;gBACN,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;YACtF,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;gBAC9D,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;YACrE,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,MAAM,CACV,KAAK,CAAC,MAAM,CAAC;oBACX,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE;oBAClC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE;iBAChD,CAAC,CACH,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAC7C,CAAA;IAED,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC,CAAA"}
|
package/dist/useRow.d.ts
CHANGED
|
@@ -14,6 +14,14 @@ export type UseRowResult<TTableDef extends DbSchema.TableDefBase> = [
|
|
|
14
14
|
* - `setRow` is a function that can be used to update the row (values will be encoded according to the table schema)
|
|
15
15
|
* - `query$` is a `LiveQuery` that e.g. can be used to subscribe to changes to the row
|
|
16
16
|
*
|
|
17
|
+
* `useRow` only works with for tables with client-only derived mutations,
|
|
18
|
+
* i.e. requires the following table options to be set:
|
|
19
|
+
* ```ts
|
|
20
|
+
* const myTable = DbSchema.table('myTable', {
|
|
21
|
+
* // fields ...
|
|
22
|
+
* }, { deriveMutations: { clientOnly: true } })
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
17
25
|
* If the table is a singleton table, `useRow` can be called without an `id` argument. Otherwise, the `id` argument is required.
|
|
18
26
|
*/
|
|
19
27
|
export declare const useRow: {
|
|
@@ -21,6 +29,7 @@ export declare const useRow: {
|
|
|
21
29
|
isSingleton: true;
|
|
22
30
|
deriveMutations: {
|
|
23
31
|
enabled: true;
|
|
32
|
+
clientOnly: true;
|
|
24
33
|
};
|
|
25
34
|
}>>(table: TTableDef, options?: {
|
|
26
35
|
store?: Store;
|
|
@@ -30,6 +39,7 @@ export declare const useRow: {
|
|
|
30
39
|
requiredInsertColumnNames: 'id';
|
|
31
40
|
deriveMutations: {
|
|
32
41
|
enabled: true;
|
|
42
|
+
clientOnly: true;
|
|
33
43
|
};
|
|
34
44
|
}>>(table: TTableDef, id: string | SessionIdSymbol | number, options?: Partial<RowQuery.RequiredColumnsOptions<TTableDef>> & {
|
|
35
45
|
store?: Store;
|
|
@@ -38,6 +48,7 @@ export declare const useRow: {
|
|
|
38
48
|
isSingleton: false;
|
|
39
49
|
deriveMutations: {
|
|
40
50
|
enabled: true;
|
|
51
|
+
clientOnly: true;
|
|
41
52
|
};
|
|
42
53
|
}>>(table: TTableDef, id: string | SessionIdSymbol | number, options: RowQuery.RequiredColumnsOptions<TTableDef> & {
|
|
43
54
|
store?: Store;
|
package/dist/useRow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRow.d.ts","sourceRoot":"","sources":["../src/useRow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"useRow.d.ts","sourceRoot":"","sources":["../src/useRow.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CAAC,CAAC,CAAC,CAAC;CACjG,GAAG;IACF,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;CACvE,CAAA"}
|
package/dist/useRow.js
CHANGED
|
@@ -13,6 +13,14 @@ import { useQueryRef } from './useQuery.js';
|
|
|
13
13
|
* - `setRow` is a function that can be used to update the row (values will be encoded according to the table schema)
|
|
14
14
|
* - `query$` is a `LiveQuery` that e.g. can be used to subscribe to changes to the row
|
|
15
15
|
*
|
|
16
|
+
* `useRow` only works with for tables with client-only derived mutations,
|
|
17
|
+
* i.e. requires the following table options to be set:
|
|
18
|
+
* ```ts
|
|
19
|
+
* const myTable = DbSchema.table('myTable', {
|
|
20
|
+
* // fields ...
|
|
21
|
+
* }, { deriveMutations: { clientOnly: true } })
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
16
24
|
* If the table is a singleton table, `useRow` can be called without an `id` argument. Otherwise, the `id` argument is required.
|
|
17
25
|
*/
|
|
18
26
|
export const useRow = (table, idOrOptions, options_) => {
|
|
@@ -24,10 +32,8 @@ export const useRow = (table, idOrOptions, options_) => {
|
|
|
24
32
|
? options_
|
|
25
33
|
: idOrOptions;
|
|
26
34
|
const { insertValues } = options ?? {};
|
|
35
|
+
React.useMemo(() => validateTableOptions(table), [table]);
|
|
27
36
|
const tableName = table.sqliteDef.name;
|
|
28
|
-
if (DbSchema.tableHasDerivedMutations(table) === false) {
|
|
29
|
-
shouldNeverHappen(`useRow called on table "${tableName}" which does not have 'deriveMutations: true' set`);
|
|
30
|
-
}
|
|
31
37
|
const { store } = useStore({ store: options?.store });
|
|
32
38
|
if (store.schema.tables.has(table.sqliteDef.name) === false &&
|
|
33
39
|
table.sqliteDef.name.startsWith('__livestore') === false) {
|
|
@@ -91,4 +97,12 @@ export const useRow = (table, idOrOptions, options_) => {
|
|
|
91
97
|
}, [id, queryRef.valueRef, sqliteTableDef.columns, store, table]);
|
|
92
98
|
return [queryRef.valueRef.current, setState, queryRef.queryRcRef.value];
|
|
93
99
|
};
|
|
100
|
+
const validateTableOptions = (table) => {
|
|
101
|
+
if (table.options.deriveMutations.clientOnly === false) {
|
|
102
|
+
return shouldNeverHappen(`useRow called on table "${table.sqliteDef.name}" which does not have 'deriveMutations: { clientOnly: true }' set`);
|
|
103
|
+
}
|
|
104
|
+
if (table.options.deriveMutations.enabled === false) {
|
|
105
|
+
return shouldNeverHappen(`useRow called on table "${table.sqliteDef.name}" which does not have 'deriveMutations: { clientOnly: true }' set`);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
94
108
|
//# sourceMappingURL=useRow.js.map
|
package/dist/useRow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRow.js","sourceRoot":"","sources":["../src/useRow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"useRow.js","sourceRoot":"","sources":["../src/useRow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAQ3C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,MAAM,GAyCf,CAMF,KAAgB,EAChB,WAAmE,EACnE,QAAkF,EACzD,EAAE;IAC3B,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,CAAA;I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CAAC;oBACD,OAAM;gBACR,CAAC;gBAED,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,WAAW,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAA;gBACtF,4EAA4E;YAC9E,CAAC,CAAA;YAED,OAAO,QAAe,CAAA;QACxB,CAAC;IACH,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;IAEjE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AACzE,CAAC,CAAA;AAaD,MAAM,oBAAoB,GAAG,CAAC,KAAkC,EAAE,EAAE;IAClE,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;QACvD,OAAO,iBAAiB,CACtB,2BAA2B,KAAK,CAAC,SAAS,CAAC,IAAI,mEAAmE,CACnH,CAAA;IACH,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QACpD,OAAO,iBAAiB,CACtB,2BAA2B,KAAK,CAAC,SAAS,CAAC,IAAI,mEAAmE,CACnH,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/react",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-60f3756dd4d7a44aeb731db7db666dd8689c6000",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -23,10 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@opentelemetry/api": "1.9.0",
|
|
26
|
-
"@livestore/
|
|
27
|
-
"@livestore/
|
|
28
|
-
"@livestore/
|
|
29
|
-
"@livestore/utils": "0.0.0-snapshot-a2ca318cc053b3d24df8cc4e8ee8d02736ac62ee"
|
|
26
|
+
"@livestore/livestore": "0.0.0-snapshot-60f3756dd4d7a44aeb731db7db666dd8689c6000",
|
|
27
|
+
"@livestore/utils": "0.0.0-snapshot-60f3756dd4d7a44aeb731db7db666dd8689c6000",
|
|
28
|
+
"@livestore/common": "0.0.0-snapshot-60f3756dd4d7a44aeb731db7db666dd8689c6000"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
"typescript": "^5.7.2",
|
|
41
40
|
"vite": "^6.1.0",
|
|
42
41
|
"vitest": "^2.1.4",
|
|
43
|
-
"@livestore/web": "0.0.0-snapshot-
|
|
42
|
+
"@livestore/adapter-web": "0.0.0-snapshot-60f3756dd4d7a44aeb731db7db666dd8689c6000"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
45
|
"react": "~19.0.0"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { makeInMemoryAdapter } from '@livestore/adapter-web'
|
|
1
2
|
import { sql } from '@livestore/common'
|
|
2
3
|
import { rawSqlMutation } from '@livestore/common/schema'
|
|
3
4
|
import { queryDb, type Store } from '@livestore/livestore'
|
|
4
5
|
import { Schema } from '@livestore/utils/effect'
|
|
5
|
-
import { makeInMemoryAdapter } from '@livestore/web'
|
|
6
6
|
import { render, screen, waitFor, waitForElementToBeRemoved } from '@testing-library/react'
|
|
7
7
|
import React from 'react'
|
|
8
8
|
import { unstable_batchedUpdates as batchUpdates } from 'react-dom'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { makeInMemoryAdapter } from '@livestore/adapter-web'
|
|
1
2
|
import { provideOtel } from '@livestore/common'
|
|
2
3
|
import { DbSchema, makeSchema } from '@livestore/common/schema'
|
|
3
4
|
import type { LiveStoreContextRunning } from '@livestore/livestore'
|
|
4
5
|
import { createStore } from '@livestore/livestore'
|
|
5
6
|
import { Effect } from '@livestore/utils/effect'
|
|
6
|
-
import { makeInMemoryAdapter } from '@livestore/web'
|
|
7
7
|
import type * as otel from '@opentelemetry/api'
|
|
8
8
|
import React from 'react'
|
|
9
9
|
|
|
@@ -29,7 +29,7 @@ export const todos = DbSchema.table(
|
|
|
29
29
|
text: DbSchema.text({ default: '', nullable: false }),
|
|
30
30
|
completed: DbSchema.boolean({ default: false, nullable: false }),
|
|
31
31
|
},
|
|
32
|
-
{ deriveMutations: true, isSingleton: false },
|
|
32
|
+
{ deriveMutations: { clientOnly: true }, isSingleton: false },
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
export const app = DbSchema.table(
|
|
@@ -48,7 +48,7 @@ export const userInfo = DbSchema.table(
|
|
|
48
48
|
username: DbSchema.text({ default: '' }),
|
|
49
49
|
text: DbSchema.text({ default: '' }),
|
|
50
50
|
},
|
|
51
|
-
{ deriveMutations: true },
|
|
51
|
+
{ deriveMutations: { clientOnly: true } },
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
export const AppRouterSchema = DbSchema.table(
|
|
@@ -56,7 +56,7 @@ export const AppRouterSchema = DbSchema.table(
|
|
|
56
56
|
{
|
|
57
57
|
currentTaskId: DbSchema.text({ default: null, nullable: true }),
|
|
58
58
|
},
|
|
59
|
-
{ isSingleton: true, deriveMutations: true },
|
|
59
|
+
{ isSingleton: true, deriveMutations: { clientOnly: true } },
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
export const tables = { todos, app, userInfo, AppRouterSchema }
|
package/src/useAtom.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DerivedMutationHelperFns, QueryInfo } from '@livestore/common'
|
|
2
|
-
import type { DbSchema } from '@livestore/common/schema'
|
|
3
|
-
import type { SqliteDsl } from '@livestore/db-schema'
|
|
2
|
+
import type { DbSchema, SqliteDsl } from '@livestore/common/schema'
|
|
4
3
|
import type { GetResult, LiveQueryDef, Store } from '@livestore/livestore'
|
|
5
4
|
import { shouldNeverHappen } from '@livestore/utils'
|
|
6
5
|
import React from 'react'
|