@livestore/livestore 0.0.58-dev.0 → 0.0.58-dev.10

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 (157) hide show
  1. package/README.md +1 -117
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/effect/LiveStore.d.ts +3 -3
  4. package/dist/effect/LiveStore.d.ts.map +1 -1
  5. package/dist/effect/LiveStore.js +1 -1
  6. package/dist/effect/LiveStore.js.map +1 -1
  7. package/dist/global-state.d.ts.map +1 -1
  8. package/dist/global-state.js +2 -1
  9. package/dist/global-state.js.map +1 -1
  10. package/dist/index.d.ts +8 -6
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/reactiveQueries/base-class.d.ts +1 -1
  15. package/dist/reactiveQueries/base-class.d.ts.map +1 -1
  16. package/dist/reactiveQueries/base-class.js.map +1 -1
  17. package/dist/reactiveQueries/sql.d.ts +1 -1
  18. package/dist/reactiveQueries/sql.d.ts.map +1 -1
  19. package/dist/reactiveQueries/sql.js +4 -4
  20. package/dist/reactiveQueries/sql.js.map +1 -1
  21. package/dist/reactiveQueries/sql.test.js +2 -2
  22. package/dist/reactiveQueries/sql.test.js.map +1 -1
  23. package/dist/row-query.d.ts +3 -2
  24. package/dist/row-query.d.ts.map +1 -1
  25. package/dist/row-query.js +18 -10
  26. package/dist/row-query.js.map +1 -1
  27. package/dist/store-devtools.d.ts +2 -2
  28. package/dist/store-devtools.d.ts.map +1 -1
  29. package/dist/store-devtools.js +3 -3
  30. package/dist/store-devtools.js.map +1 -1
  31. package/dist/store.d.ts +23 -19
  32. package/dist/store.d.ts.map +1 -1
  33. package/dist/store.js +90 -59
  34. package/dist/store.js.map +1 -1
  35. package/dist/utils/dev.d.ts.map +1 -1
  36. package/dist/utils/dev.js +1 -0
  37. package/dist/utils/dev.js.map +1 -1
  38. package/dist/{react/utils → utils}/stack-info.d.ts +1 -2
  39. package/dist/utils/stack-info.d.ts.map +1 -0
  40. package/dist/{react/utils → utils}/stack-info.js +1 -9
  41. package/dist/utils/stack-info.js.map +1 -0
  42. package/dist/utils/stack-info.test.d.ts.map +1 -0
  43. package/dist/{__tests__/react/utils → utils}/stack-info.test.js +1 -1
  44. package/dist/utils/stack-info.test.js.map +1 -0
  45. package/dist/utils/tests/fixture.d.ts +259 -0
  46. package/dist/utils/tests/fixture.d.ts.map +1 -0
  47. package/dist/utils/tests/fixture.js +33 -0
  48. package/dist/utils/tests/fixture.js.map +1 -0
  49. package/dist/utils/tests/mod.d.ts +3 -0
  50. package/dist/utils/tests/mod.d.ts.map +1 -0
  51. package/dist/utils/tests/mod.js +3 -0
  52. package/dist/utils/tests/mod.js.map +1 -0
  53. package/dist/utils/tests/otel.d.ts.map +1 -0
  54. package/dist/utils/tests/otel.js.map +1 -0
  55. package/package.json +17 -24
  56. package/src/ambient.d.ts +3 -0
  57. package/src/effect/LiveStore.ts +4 -4
  58. package/src/global-state.ts +5 -1
  59. package/src/index.ts +17 -4
  60. package/src/reactiveQueries/base-class.ts +1 -1
  61. package/src/reactiveQueries/sql.test.ts +2 -2
  62. package/src/reactiveQueries/sql.ts +5 -5
  63. package/src/row-query.ts +36 -16
  64. package/src/store-devtools.ts +5 -5
  65. package/src/store.ts +146 -78
  66. package/src/utils/dev.ts +1 -0
  67. package/src/{__tests__/react/utils → utils}/stack-info.test.ts +1 -1
  68. package/src/{react/utils → utils}/stack-info.ts +2 -12
  69. package/src/utils/tests/fixture.ts +77 -0
  70. package/src/utils/tests/mod.ts +2 -0
  71. package/tsconfig.json +1 -2
  72. package/vitest.config.js +0 -8
  73. package/dist/__tests__/react/fixture.d.ts +0 -461
  74. package/dist/__tests__/react/fixture.d.ts.map +0 -1
  75. package/dist/__tests__/react/fixture.js +0 -68
  76. package/dist/__tests__/react/fixture.js.map +0 -1
  77. package/dist/__tests__/react/utils/otel.d.ts.map +0 -1
  78. package/dist/__tests__/react/utils/otel.js.map +0 -1
  79. package/dist/__tests__/react/utils/stack-info.test.d.ts.map +0 -1
  80. package/dist/__tests__/react/utils/stack-info.test.js.map +0 -1
  81. package/dist/react/LiveStoreContext.d.ts +0 -7
  82. package/dist/react/LiveStoreContext.d.ts.map +0 -1
  83. package/dist/react/LiveStoreContext.js +0 -13
  84. package/dist/react/LiveStoreContext.js.map +0 -1
  85. package/dist/react/LiveStoreProvider.d.ts +0 -47
  86. package/dist/react/LiveStoreProvider.d.ts.map +0 -1
  87. package/dist/react/LiveStoreProvider.js +0 -169
  88. package/dist/react/LiveStoreProvider.js.map +0 -1
  89. package/dist/react/LiveStoreProvider.test.d.ts +0 -2
  90. package/dist/react/LiveStoreProvider.test.d.ts.map +0 -1
  91. package/dist/react/LiveStoreProvider.test.js +0 -62
  92. package/dist/react/LiveStoreProvider.test.js.map +0 -1
  93. package/dist/react/components/LiveList.d.ts +0 -21
  94. package/dist/react/components/LiveList.d.ts.map +0 -1
  95. package/dist/react/components/LiveList.js +0 -31
  96. package/dist/react/components/LiveList.js.map +0 -1
  97. package/dist/react/index.d.ts +0 -11
  98. package/dist/react/index.d.ts.map +0 -1
  99. package/dist/react/index.js +0 -10
  100. package/dist/react/index.js.map +0 -1
  101. package/dist/react/useAtom.d.ts +0 -10
  102. package/dist/react/useAtom.d.ts.map +0 -1
  103. package/dist/react/useAtom.js +0 -37
  104. package/dist/react/useAtom.js.map +0 -1
  105. package/dist/react/useLocalId.d.ts +0 -10
  106. package/dist/react/useLocalId.d.ts.map +0 -1
  107. package/dist/react/useLocalId.js +0 -21
  108. package/dist/react/useLocalId.js.map +0 -1
  109. package/dist/react/useQuery.d.ts +0 -9
  110. package/dist/react/useQuery.d.ts.map +0 -1
  111. package/dist/react/useQuery.js +0 -69
  112. package/dist/react/useQuery.js.map +0 -1
  113. package/dist/react/useQuery.test.d.ts +0 -2
  114. package/dist/react/useQuery.test.d.ts.map +0 -1
  115. package/dist/react/useQuery.test.js +0 -51
  116. package/dist/react/useQuery.test.js.map +0 -1
  117. package/dist/react/useRow.d.ts +0 -46
  118. package/dist/react/useRow.d.ts.map +0 -1
  119. package/dist/react/useRow.js +0 -94
  120. package/dist/react/useRow.js.map +0 -1
  121. package/dist/react/useRow.test.d.ts +0 -2
  122. package/dist/react/useRow.test.d.ts.map +0 -1
  123. package/dist/react/useRow.test.js +0 -562
  124. package/dist/react/useRow.test.js.map +0 -1
  125. package/dist/react/useTemporaryQuery.d.ts +0 -22
  126. package/dist/react/useTemporaryQuery.d.ts.map +0 -1
  127. package/dist/react/useTemporaryQuery.js +0 -70
  128. package/dist/react/useTemporaryQuery.js.map +0 -1
  129. package/dist/react/useTemporaryQuery.test.d.ts +0 -2
  130. package/dist/react/useTemporaryQuery.test.d.ts.map +0 -1
  131. package/dist/react/useTemporaryQuery.test.js +0 -37
  132. package/dist/react/useTemporaryQuery.test.js.map +0 -1
  133. package/dist/react/utils/stack-info.d.ts.map +0 -1
  134. package/dist/react/utils/stack-info.js.map +0 -1
  135. package/dist/react/utils/useStateRefWithReactiveInput.d.ts +0 -13
  136. package/dist/react/utils/useStateRefWithReactiveInput.d.ts.map +0 -1
  137. package/dist/react/utils/useStateRefWithReactiveInput.js +0 -38
  138. package/dist/react/utils/useStateRefWithReactiveInput.js.map +0 -1
  139. package/src/__tests__/react/fixture.tsx +0 -126
  140. package/src/react/LiveStoreContext.ts +0 -20
  141. package/src/react/LiveStoreProvider.test.tsx +0 -109
  142. package/src/react/LiveStoreProvider.tsx +0 -289
  143. package/src/react/components/LiveList.tsx +0 -84
  144. package/src/react/index.ts +0 -19
  145. package/src/react/useAtom.ts +0 -55
  146. package/src/react/useLocalId.ts +0 -33
  147. package/src/react/useQuery.test.tsx +0 -82
  148. package/src/react/useQuery.ts +0 -105
  149. package/src/react/useRow.test.tsx +0 -699
  150. package/src/react/useRow.ts +0 -180
  151. package/src/react/useTemporaryQuery.test.tsx +0 -56
  152. package/src/react/useTemporaryQuery.ts +0 -121
  153. package/src/react/utils/useStateRefWithReactiveInput.ts +0 -51
  154. /package/dist/{__tests__/react/utils → utils}/stack-info.test.d.ts +0 -0
  155. /package/dist/{__tests__/react/utils → utils/tests}/otel.d.ts +0 -0
  156. /package/dist/{__tests__/react/utils → utils/tests}/otel.js +0 -0
  157. /package/src/{__tests__/react/utils → utils/tests}/otel.ts +0 -0
package/tsconfig.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "./dist",
5
5
  "rootDir": "./src",
6
- "jsx": "react",
7
6
  "skipLibCheck": true,
8
7
  "resolveJsonModule": true,
9
8
  // "jsx": "preserve",
@@ -11,7 +10,7 @@
11
10
  },
12
11
  "include": ["./src"],
13
12
  "references": [
14
- { "path": "../../effect-db-schema" },
13
+ { "path": "../db-schema" },
15
14
  { "path": "../common" },
16
15
  { "path": "../web" },
17
16
  { "path": "../utils" }
package/vitest.config.js CHANGED
@@ -1,14 +1,6 @@
1
1
  import { defineConfig } from 'vite'
2
2
 
3
3
  export default defineConfig({
4
- test: {
5
- // Needed for React hook tests
6
- environment: 'jsdom',
7
- },
8
- esbuild: {
9
- // TODO remove once `using` keyword supported OOTB with Vite https://github.com/vitejs/vite/issues/15464#issuecomment-1872485703
10
- target: 'es2020',
11
- },
12
4
  resolve: {
13
5
  alias: {
14
6
  '@livestore/wa-sqlite/dist/wa-sqlite.mjs': '@livestore/wa-sqlite/dist/wa-sqlite.node.mjs',
@@ -1,461 +0,0 @@
1
- import { Effect, Schema as __Schema } from '@livestore/utils/effect';
2
- import type * as otel from '@opentelemetry/api';
3
- import React from 'react';
4
- import { DbSchema } from '../../index.js';
5
- export type Todo = {
6
- id: string;
7
- text: string;
8
- completed: boolean;
9
- };
10
- export type Filter = 'all' | 'active' | 'completed';
11
- export type AppState = {
12
- newTodoText: string;
13
- filter: Filter;
14
- };
15
- export declare const todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
16
- id: {
17
- columnType: "text";
18
- schema: __Schema.Schema<string, string, never>;
19
- default: import("effect/Option").None<never>;
20
- nullable: false;
21
- primaryKey: true;
22
- };
23
- text: {
24
- columnType: "text";
25
- schema: __Schema.Schema<string, string, never>;
26
- default: import("effect/Option").Some<"">;
27
- nullable: false;
28
- primaryKey: false;
29
- };
30
- completed: {
31
- columnType: "integer";
32
- schema: __Schema.Schema<boolean, number, never>;
33
- default: import("effect/Option").Some<false>;
34
- nullable: false;
35
- primaryKey: false;
36
- };
37
- }>, false, {
38
- isSingleton: false;
39
- disableAutomaticIdColumn: false;
40
- deriveMutations: {
41
- enabled: true;
42
- localOnly: boolean;
43
- };
44
- isSingleColumn: false;
45
- }, __Schema.Schema<{
46
- readonly id: string;
47
- readonly text: string;
48
- readonly completed: boolean;
49
- }, {
50
- readonly id: string;
51
- readonly text: string;
52
- readonly completed: number;
53
- }, never>>;
54
- export declare const app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
55
- id: {
56
- columnType: "text";
57
- schema: __Schema.Schema<string, string, never>;
58
- default: import("effect/Option").None<never>;
59
- nullable: false;
60
- primaryKey: true;
61
- };
62
- newTodoText: {
63
- columnType: "text";
64
- schema: __Schema.Schema<string | null, string | null, never>;
65
- default: import("effect/Option").Some<"">;
66
- nullable: true;
67
- primaryKey: false;
68
- };
69
- filter: {
70
- columnType: "text";
71
- schema: __Schema.Schema<string, string, never>;
72
- default: import("effect/Option").Some<"all">;
73
- nullable: false;
74
- primaryKey: false;
75
- };
76
- }>, false, {
77
- isSingleton: false;
78
- disableAutomaticIdColumn: false;
79
- deriveMutations: never;
80
- isSingleColumn: false;
81
- }, __Schema.Schema<{
82
- readonly id: string;
83
- readonly newTodoText: string | null;
84
- readonly filter: string;
85
- }, {
86
- readonly id: string;
87
- readonly newTodoText: string | null;
88
- readonly filter: string;
89
- }, never>>;
90
- export declare const tables: {
91
- todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
92
- id: {
93
- columnType: "text";
94
- schema: __Schema.Schema<string, string, never>;
95
- default: import("effect/Option").None<never>;
96
- nullable: false;
97
- primaryKey: true;
98
- };
99
- text: {
100
- columnType: "text";
101
- schema: __Schema.Schema<string, string, never>;
102
- default: import("effect/Option").Some<"">;
103
- nullable: false;
104
- primaryKey: false;
105
- };
106
- completed: {
107
- columnType: "integer";
108
- schema: __Schema.Schema<boolean, number, never>;
109
- default: import("effect/Option").Some<false>;
110
- nullable: false;
111
- primaryKey: false;
112
- };
113
- }>, false, {
114
- isSingleton: false;
115
- disableAutomaticIdColumn: false;
116
- deriveMutations: {
117
- enabled: true;
118
- localOnly: boolean;
119
- };
120
- isSingleColumn: false;
121
- }, __Schema.Schema<{
122
- readonly id: string;
123
- readonly text: string;
124
- readonly completed: boolean;
125
- }, {
126
- readonly id: string;
127
- readonly text: string;
128
- readonly completed: number;
129
- }, never>>;
130
- app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
131
- id: {
132
- columnType: "text";
133
- schema: __Schema.Schema<string, string, never>;
134
- default: import("effect/Option").None<never>;
135
- nullable: false;
136
- primaryKey: true;
137
- };
138
- newTodoText: {
139
- columnType: "text";
140
- schema: __Schema.Schema<string | null, string | null, never>;
141
- default: import("effect/Option").Some<"">;
142
- nullable: true;
143
- primaryKey: false;
144
- };
145
- filter: {
146
- columnType: "text";
147
- schema: __Schema.Schema<string, string, never>;
148
- default: import("effect/Option").Some<"all">;
149
- nullable: false;
150
- primaryKey: false;
151
- };
152
- }>, false, {
153
- isSingleton: false;
154
- disableAutomaticIdColumn: false;
155
- deriveMutations: never;
156
- isSingleColumn: false;
157
- }, __Schema.Schema<{
158
- readonly id: string;
159
- readonly newTodoText: string | null;
160
- readonly filter: string;
161
- }, {
162
- readonly id: string;
163
- readonly newTodoText: string | null;
164
- readonly filter: string;
165
- }, never>>;
166
- userInfo: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
167
- username: {
168
- columnType: "text";
169
- schema: __Schema.Schema<string, string, never>;
170
- default: import("effect/Option").Some<"">;
171
- nullable: false;
172
- primaryKey: false;
173
- };
174
- text: {
175
- columnType: "text";
176
- schema: __Schema.Schema<string, string, never>;
177
- default: import("effect/Option").Some<"">;
178
- nullable: false;
179
- primaryKey: false;
180
- };
181
- id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
182
- }>, false, {
183
- isSingleton: false;
184
- disableAutomaticIdColumn: false;
185
- deriveMutations: {
186
- enabled: true;
187
- localOnly: boolean;
188
- };
189
- isSingleColumn: false;
190
- }, __Schema.Schema<{
191
- readonly username: string;
192
- readonly text: string;
193
- readonly id: string;
194
- }, {
195
- readonly username: string;
196
- readonly text: string;
197
- readonly id: string;
198
- }, never>>;
199
- AppRouterSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
200
- currentTaskId: {
201
- columnType: "text";
202
- schema: __Schema.Schema<string | null, string | null, never>;
203
- default: import("effect/Option").Some<null>;
204
- nullable: true;
205
- primaryKey: false;
206
- };
207
- id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
208
- }>, false, {
209
- isSingleton: true;
210
- disableAutomaticIdColumn: false;
211
- deriveMutations: {
212
- enabled: true;
213
- localOnly: boolean;
214
- };
215
- isSingleColumn: false;
216
- }, __Schema.Schema<{
217
- readonly currentTaskId: string | null;
218
- readonly id: "singleton";
219
- }, {
220
- readonly currentTaskId: string | null;
221
- readonly id: "singleton";
222
- }, never>>;
223
- };
224
- export declare const schema: {
225
- readonly _Type: import("@livestore/common/dist/schema/index.js").LiveStoreSchemaSymbol;
226
- readonly _DbSchemaType: {
227
- todos: DbSchema.SqliteDsl.TableDefinition<"todos", {
228
- id: {
229
- columnType: "text";
230
- schema: __Schema.Schema<string, string, never>;
231
- default: import("effect/Option").None<never>;
232
- nullable: false;
233
- primaryKey: true;
234
- };
235
- text: {
236
- columnType: "text";
237
- schema: __Schema.Schema<string, string, never>;
238
- default: import("effect/Option").Some<"">;
239
- nullable: false;
240
- primaryKey: false;
241
- };
242
- completed: {
243
- columnType: "integer";
244
- schema: __Schema.Schema<boolean, number, never>;
245
- default: import("effect/Option").Some<false>;
246
- nullable: false;
247
- primaryKey: false;
248
- };
249
- }>;
250
- app: DbSchema.SqliteDsl.TableDefinition<"app", {
251
- id: {
252
- columnType: "text";
253
- schema: __Schema.Schema<string, string, never>;
254
- default: import("effect/Option").None<never>;
255
- nullable: false;
256
- primaryKey: true;
257
- };
258
- newTodoText: {
259
- columnType: "text";
260
- schema: __Schema.Schema<string | null, string | null, never>;
261
- default: import("effect/Option").Some<"">;
262
- nullable: true;
263
- primaryKey: false;
264
- };
265
- filter: {
266
- columnType: "text";
267
- schema: __Schema.Schema<string, string, never>;
268
- default: import("effect/Option").Some<"all">;
269
- nullable: false;
270
- primaryKey: false;
271
- };
272
- }>;
273
- UserInfo: DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
274
- username: {
275
- columnType: "text";
276
- schema: __Schema.Schema<string, string, never>;
277
- default: import("effect/Option").Some<"">;
278
- nullable: false;
279
- primaryKey: false;
280
- };
281
- text: {
282
- columnType: "text";
283
- schema: __Schema.Schema<string, string, never>;
284
- default: import("effect/Option").Some<"">;
285
- nullable: false;
286
- primaryKey: false;
287
- };
288
- id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
289
- }>;
290
- AppRouter: DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
291
- currentTaskId: {
292
- columnType: "text";
293
- schema: __Schema.Schema<string | null, string | null, never>;
294
- default: import("effect/Option").Some<null>;
295
- nullable: true;
296
- primaryKey: false;
297
- };
298
- id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
299
- }>;
300
- };
301
- readonly _MutationDefMapType: never;
302
- readonly tables: Map<string, DbSchema.TableDef>;
303
- readonly mutations: import("@livestore/common/dist/schema/mutations.js").MutationDefMap;
304
- readonly hash: number;
305
- migrationOptions: import("@livestore/common/dist/adapter-types.js").MigrationOptions;
306
- };
307
- export declare const makeTodoMvc: ({ otelTracer, otelContext, useGlobalReactivityGraph, strictMode, }?: {
308
- otelTracer?: otel.Tracer;
309
- otelContext?: otel.Context;
310
- useGlobalReactivityGraph?: boolean;
311
- strictMode?: boolean;
312
- }) => Effect.Effect<{
313
- wrapper: ({ children }: any) => React.JSX.Element;
314
- AppComponentSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
315
- username: {
316
- columnType: "text";
317
- schema: __Schema.Schema<string, string, never>;
318
- default: import("effect/Option").Some<"">;
319
- nullable: false;
320
- primaryKey: false;
321
- };
322
- text: {
323
- columnType: "text";
324
- schema: __Schema.Schema<string, string, never>;
325
- default: import("effect/Option").Some<"">;
326
- nullable: false;
327
- primaryKey: false;
328
- };
329
- id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
330
- }>, false, {
331
- isSingleton: false;
332
- disableAutomaticIdColumn: false;
333
- deriveMutations: {
334
- enabled: true;
335
- localOnly: boolean;
336
- };
337
- isSingleColumn: false;
338
- }, __Schema.Schema<{
339
- readonly username: string;
340
- readonly text: string;
341
- readonly id: string;
342
- }, {
343
- readonly username: string;
344
- readonly text: string;
345
- readonly id: string;
346
- }, never>>;
347
- AppRouterSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
348
- currentTaskId: {
349
- columnType: "text";
350
- schema: __Schema.Schema<string | null, string | null, never>;
351
- default: import("effect/Option").Some<null>;
352
- nullable: true;
353
- primaryKey: false;
354
- };
355
- id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
356
- }>, false, {
357
- isSingleton: true;
358
- disableAutomaticIdColumn: false;
359
- deriveMutations: {
360
- enabled: true;
361
- localOnly: boolean;
362
- };
363
- isSingleColumn: false;
364
- }, __Schema.Schema<{
365
- readonly currentTaskId: string | null;
366
- readonly id: "singleton";
367
- }, {
368
- readonly currentTaskId: string | null;
369
- readonly id: "singleton";
370
- }, never>>;
371
- store: import("../../store.js").Store<import("../../store.js").BaseGraphQLContext, {
372
- readonly _Type: import("@livestore/common/dist/schema/index.js").LiveStoreSchemaSymbol;
373
- readonly _DbSchemaType: {
374
- todos: DbSchema.SqliteDsl.TableDefinition<"todos", {
375
- id: {
376
- columnType: "text";
377
- schema: __Schema.Schema<string, string, never>;
378
- default: import("effect/Option").None<never>;
379
- nullable: false;
380
- primaryKey: true;
381
- };
382
- text: {
383
- columnType: "text";
384
- schema: __Schema.Schema<string, string, never>;
385
- default: import("effect/Option").Some<"">;
386
- nullable: false;
387
- primaryKey: false;
388
- };
389
- completed: {
390
- columnType: "integer";
391
- schema: __Schema.Schema<boolean, number, never>;
392
- default: import("effect/Option").Some<false>;
393
- nullable: false;
394
- primaryKey: false;
395
- };
396
- }>;
397
- app: DbSchema.SqliteDsl.TableDefinition<"app", {
398
- id: {
399
- columnType: "text";
400
- schema: __Schema.Schema<string, string, never>;
401
- default: import("effect/Option").None<never>;
402
- nullable: false;
403
- primaryKey: true;
404
- };
405
- newTodoText: {
406
- columnType: "text";
407
- schema: __Schema.Schema<string | null, string | null, never>;
408
- default: import("effect/Option").Some<"">;
409
- nullable: true;
410
- primaryKey: false;
411
- };
412
- filter: {
413
- columnType: "text";
414
- schema: __Schema.Schema<string, string, never>;
415
- default: import("effect/Option").Some<"all">;
416
- nullable: false;
417
- primaryKey: false;
418
- };
419
- }>;
420
- UserInfo: DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
421
- username: {
422
- columnType: "text";
423
- schema: __Schema.Schema<string, string, never>;
424
- default: import("effect/Option").Some<"">;
425
- nullable: false;
426
- primaryKey: false;
427
- };
428
- text: {
429
- columnType: "text";
430
- schema: __Schema.Schema<string, string, never>;
431
- default: import("effect/Option").Some<"">;
432
- nullable: false;
433
- primaryKey: false;
434
- };
435
- id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
436
- }>;
437
- AppRouter: DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
438
- currentTaskId: {
439
- columnType: "text";
440
- schema: __Schema.Schema<string | null, string | null, never>;
441
- default: import("effect/Option").Some<null>;
442
- nullable: true;
443
- primaryKey: false;
444
- };
445
- id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
446
- }>;
447
- };
448
- readonly _MutationDefMapType: never;
449
- readonly tables: Map<string, DbSchema.TableDef>;
450
- readonly mutations: import("@livestore/common/dist/schema/mutations.js").MutationDefMap;
451
- readonly hash: number;
452
- migrationOptions: import("@livestore/common/dist/adapter-types.js").MigrationOptions;
453
- }>;
454
- reactivityGraph: import("../../index.js").ReactivityGraph;
455
- makeRenderCount: () => {
456
- readonly val: number;
457
- inc: () => void;
458
- };
459
- strictMode: boolean;
460
- }, import("@livestore/common/dist/adapter-types.js").UnexpectedError, import("effect/Scope").Scope>;
461
- //# sourceMappingURL=fixture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../../src/__tests__/react/fixture.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAE9E,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAe,QAAQ,EAAwC,MAAM,gBAAgB,CAAA;AAG5F,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,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQjB,CAAA;AAED,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAId,CAAA;AAmBF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA4C,CAAA;AAC/D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAyB,CAAA;AAE5C,eAAO,MAAM,WAAW,wEAKrB;IACD,UAAU,CAAC,EAAE,IAAI,CAAC,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAA;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;4BAuCkC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mGAiBlC,CAAA"}
@@ -1,68 +0,0 @@
1
- import { Effect, FiberSet } from '@livestore/utils/effect';
2
- import { makeInMemoryAdapter } from '@livestore/web';
3
- import React from 'react';
4
- import { globalReactivityGraph } from '../../global-state.js';
5
- import { createStore, DbSchema, makeReactivityGraph, makeSchema, sql } from '../../index.js';
6
- import * as LiveStoreReact from '../../react/index.js';
7
- export const todos = DbSchema.table('todos', {
8
- id: DbSchema.text({ primaryKey: true }),
9
- text: DbSchema.text({ default: '', nullable: false }),
10
- completed: DbSchema.boolean({ default: false, nullable: false }),
11
- }, { deriveMutations: true, isSingleton: false });
12
- export const app = DbSchema.table('app', {
13
- id: DbSchema.text({ primaryKey: true }),
14
- newTodoText: DbSchema.text({ default: '', nullable: true }),
15
- filter: DbSchema.text({ default: 'all', nullable: false }),
16
- });
17
- const userInfo = DbSchema.table('UserInfo', {
18
- username: DbSchema.text({ default: '' }),
19
- text: DbSchema.text({ default: '' }),
20
- }, { deriveMutations: true });
21
- const AppRouterSchema = DbSchema.table('AppRouter', {
22
- currentTaskId: DbSchema.text({ default: null, nullable: true }),
23
- }, { isSingleton: true, deriveMutations: true });
24
- export const tables = { todos, app, userInfo, AppRouterSchema };
25
- export const schema = makeSchema({ tables });
26
- export const makeTodoMvc = ({ otelTracer, otelContext, useGlobalReactivityGraph = true, strictMode = process.env.REACT_STRICT_MODE !== undefined, } = {}) => Effect.gen(function* () {
27
- const reactivityGraph = useGlobalReactivityGraph ? globalReactivityGraph : makeReactivityGraph();
28
- const makeRenderCount = () => {
29
- let val = 0;
30
- const inc = () => {
31
- val += strictMode ? 0.5 : 1;
32
- };
33
- return {
34
- get val() {
35
- return val;
36
- },
37
- inc,
38
- };
39
- };
40
- const fiberSet = yield* FiberSet.make();
41
- const store = yield* createStore({
42
- schema,
43
- storeId: 'default',
44
- boot: (db) => db.execute(sql `INSERT OR IGNORE INTO app (id, newTodoText, filter) VALUES ('static', '', 'all');`),
45
- adapter: makeInMemoryAdapter(),
46
- reactivityGraph,
47
- otelOptions: {
48
- tracer: otelTracer,
49
- rootSpanContext: otelContext,
50
- },
51
- fiberSet,
52
- });
53
- // TODO improve typing of `LiveStoreContext`
54
- const storeContext = { stage: 'running', store };
55
- const MaybeStrictMode = strictMode ? React.StrictMode : React.Fragment;
56
- const wrapper = ({ children }) => (React.createElement(MaybeStrictMode, null,
57
- React.createElement(LiveStoreReact.LiveStoreContext.Provider, { value: storeContext }, children)));
58
- return {
59
- wrapper,
60
- AppComponentSchema: userInfo,
61
- AppRouterSchema,
62
- store,
63
- reactivityGraph,
64
- makeRenderCount,
65
- strictMode,
66
- };
67
- });
68
- //# sourceMappingURL=fixture.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../../src/__tests__/react/fixture.tsx"],"names":[],"mappings":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ils/stack-info.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"stack-info.test.js","sourceRoot":"","sources":["../../../../src/__tests__/react/utils/stack-info.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAA;AAEnF,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;IACpC,MAAM,UAAU,GAAG;;;;;;;;;;;;CAYpB,CAAA;IAEC,MAAM,SAAS,GAAG,8BAA8B,CAAC,UAAU,CAAC,CAAA;IAC5D,mEAAmE;IACnE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,2BAA2B,CAAC,CAAC,CAAA;IAC3E,MAAM,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;GAqBvC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;IACrC,MAAM,UAAU,GAAG;;;;;;;;;;;;CAYpB,CAAA;IAEC,MAAM,SAAS,GAAG,8BAA8B,CAAC,UAAU,CAAC,CAAA;IAC5D,mEAAmE;IACnE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,2BAA2B,CAAC,CAAC,CAAA;IAC3E,MAAM,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;GAavC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { Store } from '../store.js';
3
- export declare const LiveStoreContext: React.Context<import("../store-context.js").LiveStoreContextRunning | undefined>;
4
- export declare const useStore: () => {
5
- store: Store;
6
- };
7
- //# sourceMappingURL=LiveStoreContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveStoreContext.d.ts","sourceRoot":"","sources":["../../src/react/LiveStoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,gBAAgB,kFAAgE,CAAA;AAE7F,eAAO,MAAM,QAAQ,QAAO;IAAE,KAAK,EAAE,KAAK,CAAA;CAYzC,CAAA"}
@@ -1,13 +0,0 @@
1
- import React, { useContext } from 'react';
2
- export const LiveStoreContext = React.createContext(undefined);
3
- export const useStore = () => {
4
- const storeContext = useContext(LiveStoreContext);
5
- if (storeContext === undefined) {
6
- throw new Error(`useStore can only be used inside StoreContext.Provider`);
7
- }
8
- if (storeContext.stage !== 'running') {
9
- throw new Error(`useStore can only be used after the store is running`);
10
- }
11
- return storeContext;
12
- };
13
- //# sourceMappingURL=LiveStoreContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveStoreContext.js","sourceRoot":"","sources":["../../src/react/LiveStoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAKzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAgC,SAAS,CAAC,CAAA;AAE7F,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAqB,EAAE;IAC7C,MAAM,YAAY,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAEjD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;IAC3E,CAAC;IAED,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA"}
@@ -1,47 +0,0 @@
1
- import type { BootDb, BootStatus, IntentionalShutdownCause, StoreAdapterFactory } from '@livestore/common';
2
- import { UnexpectedError } from '@livestore/common';
3
- import type { LiveStoreSchema } from '@livestore/common/schema';
4
- import { Effect } from '@livestore/utils/effect';
5
- import type * as otel from '@opentelemetry/api';
6
- import type { ReactElement, ReactNode } from 'react';
7
- import type { BaseGraphQLContext, GraphQLOptions, OtelOptions } from '../store.js';
8
- import { StoreAbort } from '../store-context.js';
9
- interface LiveStoreProviderProps<GraphQLContext> {
10
- schema: LiveStoreSchema;
11
- /**
12
- * The `storeId` can be used to isolate multiple stores from each other.
13
- * So it can be useful for multi-tenancy scenarios.
14
- *
15
- * The `storeId` is also used for persistence.
16
- *
17
- * @default 'default'
18
- */
19
- storeId?: string;
20
- boot?: (db: BootDb, parentSpan: otel.Span) => void | Promise<void> | Effect.Effect<void, unknown, otel.Tracer>;
21
- graphQLOptions?: GraphQLOptions<GraphQLContext>;
22
- otelOptions?: OtelOptions;
23
- renderLoading: (status: BootStatus) => ReactElement;
24
- renderError?: (error: UnexpectedError | unknown) => ReactElement;
25
- renderShutdown?: (cause: IntentionalShutdownCause | StoreAbort) => ReactElement;
26
- adapter: StoreAdapterFactory;
27
- /**
28
- * In order for LiveStore to apply multiple mutations in a single render,
29
- * you need to pass the `batchUpdates` function from either `react-dom` or `react-native`.
30
- *
31
- * ```ts
32
- * // With React DOM
33
- * import { unstable_batchedUpdates as batchUpdates } from 'react-dom'
34
- *
35
- * // With React Native
36
- * import { unstable_batchedUpdates as batchUpdates } from 'react-native'
37
- * ```
38
- */
39
- batchUpdates: (run: () => void) => void;
40
- disableDevtools?: boolean;
41
- signal?: AbortSignal;
42
- }
43
- export declare const LiveStoreProvider: <GraphQLContext extends BaseGraphQLContext>({ renderLoading, renderError, renderShutdown, graphQLOptions, otelOptions, children, schema, storeId, boot, adapter, batchUpdates, disableDevtools, signal, }: LiveStoreProviderProps<GraphQLContext> & {
44
- children?: ReactNode;
45
- }) => JSX.Element;
46
- export {};
47
- //# sourceMappingURL=LiveStoreProvider.d.ts.map