@livestore/livestore 0.0.58-dev.9 → 0.1.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.
- package/README.md +1 -117
- package/dist/.tsbuildinfo +1 -1
- package/dist/effect/LiveStore.d.ts +6 -6
- package/dist/effect/LiveStore.d.ts.map +1 -1
- package/dist/effect/LiveStore.js +1 -1
- package/dist/effect/LiveStore.js.map +1 -1
- package/dist/global-state.d.ts.map +1 -1
- package/dist/global-state.js +2 -1
- package/dist/global-state.js.map +1 -1
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/reactiveQueries/base-class.d.ts +5 -4
- package/dist/reactiveQueries/base-class.d.ts.map +1 -1
- package/dist/reactiveQueries/base-class.js.map +1 -1
- package/dist/reactiveQueries/computed.d.ts +35 -0
- package/dist/reactiveQueries/computed.d.ts.map +1 -0
- package/dist/reactiveQueries/computed.js +57 -0
- package/dist/reactiveQueries/computed.js.map +1 -0
- package/dist/reactiveQueries/graphql.d.ts +2 -1
- package/dist/reactiveQueries/graphql.d.ts.map +1 -1
- package/dist/reactiveQueries/graphql.js.map +1 -1
- package/dist/reactiveQueries/sql.d.ts +2 -2
- package/dist/reactiveQueries/sql.d.ts.map +1 -1
- package/dist/reactiveQueries/sql.js +3 -3
- package/dist/reactiveQueries/sql.js.map +1 -1
- package/dist/reactiveQueries/sql.test.js +2 -2
- package/dist/reactiveQueries/sql.test.js.map +1 -1
- package/dist/row-query.d.ts +3 -2
- package/dist/row-query.d.ts.map +1 -1
- package/dist/row-query.js +14 -10
- package/dist/row-query.js.map +1 -1
- package/dist/store/create-store.d.ts +28 -0
- package/dist/store/create-store.d.ts.map +1 -0
- package/dist/store/create-store.js +85 -0
- package/dist/store/create-store.js.map +1 -0
- package/dist/store/devtools.d.ts +19 -0
- package/dist/store/devtools.d.ts.map +1 -0
- package/dist/store/devtools.js +141 -0
- package/dist/store/devtools.js.map +1 -0
- package/dist/store/store-context.d.ts +26 -0
- package/dist/store/store-context.d.ts.map +1 -0
- package/dist/store/store-context.js +6 -0
- package/dist/store/store-context.js.map +1 -0
- package/dist/store/store-types.d.ts +98 -0
- package/dist/store/store-types.d.ts.map +1 -0
- package/dist/store/store-types.js +6 -0
- package/dist/store/store-types.js.map +1 -0
- package/dist/store/store.d.ts +88 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +367 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store-devtools.d.ts +2 -2
- package/dist/store-devtools.d.ts.map +1 -1
- package/dist/store-devtools.js +2 -2
- package/dist/store-devtools.js.map +1 -1
- package/dist/store.d.ts +8 -8
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +54 -54
- package/dist/store.js.map +1 -1
- package/dist/utils/dev.d.ts +1 -0
- package/dist/utils/dev.d.ts.map +1 -1
- package/dist/utils/dev.js +5 -0
- package/dist/utils/dev.js.map +1 -1
- package/dist/{react/utils → utils}/stack-info.d.ts +1 -2
- package/dist/utils/stack-info.d.ts.map +1 -0
- package/dist/{react/utils → utils}/stack-info.js +1 -9
- package/dist/utils/stack-info.js.map +1 -0
- package/dist/utils/stack-info.test.d.ts.map +1 -0
- package/dist/{__tests__/react/utils → utils}/stack-info.test.js +1 -1
- package/dist/utils/stack-info.test.js.map +1 -0
- package/dist/utils/tests/fixture.d.ts +259 -0
- package/dist/utils/tests/fixture.d.ts.map +1 -0
- package/dist/utils/tests/fixture.js +32 -0
- package/dist/utils/tests/fixture.js.map +1 -0
- package/dist/utils/tests/mod.d.ts +3 -0
- package/dist/utils/tests/mod.d.ts.map +1 -0
- package/dist/utils/tests/mod.js +3 -0
- package/dist/utils/tests/mod.js.map +1 -0
- package/dist/utils/tests/otel.d.ts.map +1 -0
- package/dist/{__tests__/react/utils → utils/tests}/otel.js +3 -3
- package/dist/utils/tests/otel.js.map +1 -0
- package/package.json +13 -20
- package/src/ambient.d.ts +3 -1
- package/src/effect/LiveStore.ts +7 -7
- package/src/global-state.ts +5 -1
- package/src/index.ts +19 -7
- package/src/reactiveQueries/base-class.ts +5 -4
- package/src/reactiveQueries/{js.ts → computed.ts} +3 -3
- package/src/reactiveQueries/graphql.ts +2 -1
- package/src/reactiveQueries/sql.test.ts +2 -2
- package/src/reactiveQueries/sql.ts +5 -5
- package/src/row-query.ts +33 -17
- package/src/store/create-store.ts +214 -0
- package/src/{store-devtools.ts → store/devtools.ts} +9 -9
- package/src/store/store-types.ts +110 -0
- package/src/{store.ts → store/store.ts} +56 -415
- package/src/utils/dev.ts +6 -0
- package/src/{__tests__/react/utils → utils}/stack-info.test.ts +1 -1
- package/src/{react/utils → utils}/stack-info.ts +2 -12
- package/src/utils/tests/fixture.ts +73 -0
- package/src/utils/tests/mod.ts +2 -0
- package/src/{__tests__/react/utils → utils/tests}/otel.ts +4 -4
- package/tsconfig.json +1 -2
- package/vitest.config.js +0 -8
- package/dist/__tests__/react/fixture.d.ts +0 -461
- package/dist/__tests__/react/fixture.d.ts.map +0 -1
- package/dist/__tests__/react/fixture.js +0 -68
- package/dist/__tests__/react/fixture.js.map +0 -1
- package/dist/__tests__/react/utils/otel.d.ts.map +0 -1
- package/dist/__tests__/react/utils/otel.js.map +0 -1
- package/dist/__tests__/react/utils/stack-info.test.d.ts.map +0 -1
- package/dist/__tests__/react/utils/stack-info.test.js.map +0 -1
- package/dist/react/LiveStoreContext.d.ts +0 -7
- package/dist/react/LiveStoreContext.d.ts.map +0 -1
- package/dist/react/LiveStoreContext.js +0 -13
- package/dist/react/LiveStoreContext.js.map +0 -1
- package/dist/react/LiveStoreProvider.d.ts +0 -49
- package/dist/react/LiveStoreProvider.d.ts.map +0 -1
- package/dist/react/LiveStoreProvider.js +0 -169
- package/dist/react/LiveStoreProvider.js.map +0 -1
- package/dist/react/LiveStoreProvider.test.d.ts +0 -2
- package/dist/react/LiveStoreProvider.test.d.ts.map +0 -1
- package/dist/react/LiveStoreProvider.test.js +0 -62
- package/dist/react/LiveStoreProvider.test.js.map +0 -1
- package/dist/react/components/LiveList.d.ts +0 -21
- package/dist/react/components/LiveList.d.ts.map +0 -1
- package/dist/react/components/LiveList.js +0 -31
- package/dist/react/components/LiveList.js.map +0 -1
- package/dist/react/index.d.ts +0 -11
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js +0 -10
- package/dist/react/index.js.map +0 -1
- package/dist/react/useAtom.d.ts +0 -10
- package/dist/react/useAtom.d.ts.map +0 -1
- package/dist/react/useAtom.js +0 -37
- package/dist/react/useAtom.js.map +0 -1
- package/dist/react/useLocalId.d.ts +0 -10
- package/dist/react/useLocalId.d.ts.map +0 -1
- package/dist/react/useLocalId.js +0 -22
- package/dist/react/useLocalId.js.map +0 -1
- package/dist/react/useQuery.d.ts +0 -9
- package/dist/react/useQuery.d.ts.map +0 -1
- package/dist/react/useQuery.js +0 -70
- package/dist/react/useQuery.js.map +0 -1
- package/dist/react/useQuery.test.d.ts +0 -2
- package/dist/react/useQuery.test.d.ts.map +0 -1
- package/dist/react/useQuery.test.js +0 -51
- package/dist/react/useQuery.test.js.map +0 -1
- package/dist/react/useRow.d.ts +0 -46
- package/dist/react/useRow.d.ts.map +0 -1
- package/dist/react/useRow.js +0 -94
- package/dist/react/useRow.js.map +0 -1
- package/dist/react/useRow.test.d.ts +0 -2
- package/dist/react/useRow.test.d.ts.map +0 -1
- package/dist/react/useRow.test.js +0 -208
- package/dist/react/useRow.test.js.map +0 -1
- package/dist/react/useTemporaryQuery.d.ts +0 -22
- package/dist/react/useTemporaryQuery.d.ts.map +0 -1
- package/dist/react/useTemporaryQuery.js +0 -75
- package/dist/react/useTemporaryQuery.js.map +0 -1
- package/dist/react/useTemporaryQuery.test.d.ts +0 -2
- package/dist/react/useTemporaryQuery.test.d.ts.map +0 -1
- package/dist/react/useTemporaryQuery.test.js +0 -59
- package/dist/react/useTemporaryQuery.test.js.map +0 -1
- package/dist/react/utils/stack-info.d.ts.map +0 -1
- package/dist/react/utils/stack-info.js.map +0 -1
- package/dist/react/utils/useStateRefWithReactiveInput.d.ts +0 -13
- package/dist/react/utils/useStateRefWithReactiveInput.d.ts.map +0 -1
- package/dist/react/utils/useStateRefWithReactiveInput.js +0 -38
- package/dist/react/utils/useStateRefWithReactiveInput.js.map +0 -1
- package/src/__tests__/react/fixture.tsx +0 -126
- package/src/react/LiveStoreContext.ts +0 -20
- package/src/react/LiveStoreProvider.test.tsx +0 -109
- package/src/react/LiveStoreProvider.tsx +0 -291
- package/src/react/__snapshots__/useRow.test.tsx.snap +0 -359
- package/src/react/components/LiveList.tsx +0 -84
- package/src/react/index.ts +0 -19
- package/src/react/useAtom.ts +0 -55
- package/src/react/useLocalId.ts +0 -34
- package/src/react/useQuery.test.tsx +0 -82
- package/src/react/useQuery.ts +0 -106
- package/src/react/useRow.test.tsx +0 -345
- package/src/react/useRow.ts +0 -180
- package/src/react/useTemporaryQuery.test.tsx +0 -98
- package/src/react/useTemporaryQuery.ts +0 -131
- package/src/react/utils/useStateRefWithReactiveInput.ts +0 -51
- package/src/store-context.ts +0 -23
- /package/dist/{__tests__/react/utils → utils}/stack-info.test.d.ts +0 -0
- /package/dist/{__tests__/react/utils → utils/tests}/otel.d.ts +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import type { FromInputSchema } from '@livestore/common/schema';
|
|
2
|
+
import type { Store } from '@livestore/livestore';
|
|
3
|
+
import { DbSchema } from '@livestore/livestore';
|
|
4
|
+
import { Effect } from '@livestore/utils/effect';
|
|
5
|
+
import type * as otel from '@opentelemetry/api';
|
|
6
|
+
export type Todo = {
|
|
7
|
+
id: string;
|
|
8
|
+
text: string;
|
|
9
|
+
completed: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type Filter = 'all' | 'active' | 'completed';
|
|
12
|
+
export type AppState = {
|
|
13
|
+
newTodoText: string;
|
|
14
|
+
filter: Filter;
|
|
15
|
+
};
|
|
16
|
+
export declare const todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
17
|
+
id: {
|
|
18
|
+
columnType: "text";
|
|
19
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
20
|
+
default: import("effect/Option").None<never>;
|
|
21
|
+
nullable: false;
|
|
22
|
+
primaryKey: true;
|
|
23
|
+
};
|
|
24
|
+
text: {
|
|
25
|
+
columnType: "text";
|
|
26
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
27
|
+
default: import("effect/Option").Some<"">;
|
|
28
|
+
nullable: false;
|
|
29
|
+
primaryKey: false;
|
|
30
|
+
};
|
|
31
|
+
completed: {
|
|
32
|
+
columnType: "integer";
|
|
33
|
+
schema: import("effect/Schema").Schema<boolean, number, never>;
|
|
34
|
+
default: import("effect/Option").Some<false>;
|
|
35
|
+
nullable: false;
|
|
36
|
+
primaryKey: false;
|
|
37
|
+
};
|
|
38
|
+
}>, false, {
|
|
39
|
+
isSingleton: false;
|
|
40
|
+
disableAutomaticIdColumn: false;
|
|
41
|
+
deriveMutations: {
|
|
42
|
+
enabled: true;
|
|
43
|
+
localOnly: boolean;
|
|
44
|
+
};
|
|
45
|
+
isSingleColumn: false;
|
|
46
|
+
}, import("effect/Schema").Schema<{
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly text: string;
|
|
49
|
+
readonly completed: boolean;
|
|
50
|
+
}, {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
readonly text: string;
|
|
53
|
+
readonly completed: number;
|
|
54
|
+
}, never>>;
|
|
55
|
+
export declare const app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
|
|
56
|
+
id: {
|
|
57
|
+
columnType: "text";
|
|
58
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
59
|
+
default: import("effect/Option").Some<"static">;
|
|
60
|
+
nullable: false;
|
|
61
|
+
primaryKey: true;
|
|
62
|
+
};
|
|
63
|
+
newTodoText: {
|
|
64
|
+
columnType: "text";
|
|
65
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
66
|
+
default: import("effect/Option").Some<"">;
|
|
67
|
+
nullable: true;
|
|
68
|
+
primaryKey: false;
|
|
69
|
+
};
|
|
70
|
+
filter: {
|
|
71
|
+
columnType: "text";
|
|
72
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
73
|
+
default: import("effect/Option").Some<"all">;
|
|
74
|
+
nullable: false;
|
|
75
|
+
primaryKey: false;
|
|
76
|
+
};
|
|
77
|
+
}>, false, {
|
|
78
|
+
isSingleton: true;
|
|
79
|
+
disableAutomaticIdColumn: false;
|
|
80
|
+
deriveMutations: never;
|
|
81
|
+
isSingleColumn: false;
|
|
82
|
+
}, import("effect/Schema").Schema<{
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly newTodoText: string | null;
|
|
85
|
+
readonly filter: string;
|
|
86
|
+
}, {
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly newTodoText: string | null;
|
|
89
|
+
readonly filter: string;
|
|
90
|
+
}, never>>;
|
|
91
|
+
export declare const tables: {
|
|
92
|
+
todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
93
|
+
id: {
|
|
94
|
+
columnType: "text";
|
|
95
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
96
|
+
default: import("effect/Option").None<never>;
|
|
97
|
+
nullable: false;
|
|
98
|
+
primaryKey: true;
|
|
99
|
+
};
|
|
100
|
+
text: {
|
|
101
|
+
columnType: "text";
|
|
102
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
103
|
+
default: import("effect/Option").Some<"">;
|
|
104
|
+
nullable: false;
|
|
105
|
+
primaryKey: false;
|
|
106
|
+
};
|
|
107
|
+
completed: {
|
|
108
|
+
columnType: "integer";
|
|
109
|
+
schema: import("effect/Schema").Schema<boolean, number, never>;
|
|
110
|
+
default: import("effect/Option").Some<false>;
|
|
111
|
+
nullable: false;
|
|
112
|
+
primaryKey: false;
|
|
113
|
+
};
|
|
114
|
+
}>, false, {
|
|
115
|
+
isSingleton: false;
|
|
116
|
+
disableAutomaticIdColumn: false;
|
|
117
|
+
deriveMutations: {
|
|
118
|
+
enabled: true;
|
|
119
|
+
localOnly: boolean;
|
|
120
|
+
};
|
|
121
|
+
isSingleColumn: false;
|
|
122
|
+
}, import("effect/Schema").Schema<{
|
|
123
|
+
readonly id: string;
|
|
124
|
+
readonly text: string;
|
|
125
|
+
readonly completed: boolean;
|
|
126
|
+
}, {
|
|
127
|
+
readonly id: string;
|
|
128
|
+
readonly text: string;
|
|
129
|
+
readonly completed: number;
|
|
130
|
+
}, never>>;
|
|
131
|
+
app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
|
|
132
|
+
id: {
|
|
133
|
+
columnType: "text";
|
|
134
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
135
|
+
default: import("effect/Option").Some<"static">;
|
|
136
|
+
nullable: false;
|
|
137
|
+
primaryKey: true;
|
|
138
|
+
};
|
|
139
|
+
newTodoText: {
|
|
140
|
+
columnType: "text";
|
|
141
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
142
|
+
default: import("effect/Option").Some<"">;
|
|
143
|
+
nullable: true;
|
|
144
|
+
primaryKey: false;
|
|
145
|
+
};
|
|
146
|
+
filter: {
|
|
147
|
+
columnType: "text";
|
|
148
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
149
|
+
default: import("effect/Option").Some<"all">;
|
|
150
|
+
nullable: false;
|
|
151
|
+
primaryKey: false;
|
|
152
|
+
};
|
|
153
|
+
}>, false, {
|
|
154
|
+
isSingleton: true;
|
|
155
|
+
disableAutomaticIdColumn: false;
|
|
156
|
+
deriveMutations: never;
|
|
157
|
+
isSingleColumn: false;
|
|
158
|
+
}, import("effect/Schema").Schema<{
|
|
159
|
+
readonly id: string;
|
|
160
|
+
readonly newTodoText: string | null;
|
|
161
|
+
readonly filter: string;
|
|
162
|
+
}, {
|
|
163
|
+
readonly id: string;
|
|
164
|
+
readonly newTodoText: string | null;
|
|
165
|
+
readonly filter: string;
|
|
166
|
+
}, never>>;
|
|
167
|
+
};
|
|
168
|
+
export declare const schema: FromInputSchema.DeriveSchema<{
|
|
169
|
+
tables: {
|
|
170
|
+
todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
171
|
+
id: {
|
|
172
|
+
columnType: "text";
|
|
173
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
174
|
+
default: import("effect/Option").None<never>;
|
|
175
|
+
nullable: false;
|
|
176
|
+
primaryKey: true;
|
|
177
|
+
};
|
|
178
|
+
text: {
|
|
179
|
+
columnType: "text";
|
|
180
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
181
|
+
default: import("effect/Option").Some<"">;
|
|
182
|
+
nullable: false;
|
|
183
|
+
primaryKey: false;
|
|
184
|
+
};
|
|
185
|
+
completed: {
|
|
186
|
+
columnType: "integer";
|
|
187
|
+
schema: import("effect/Schema").Schema<boolean, number, never>;
|
|
188
|
+
default: import("effect/Option").Some<false>;
|
|
189
|
+
nullable: false;
|
|
190
|
+
primaryKey: false;
|
|
191
|
+
};
|
|
192
|
+
}>, false, {
|
|
193
|
+
isSingleton: false;
|
|
194
|
+
disableAutomaticIdColumn: false;
|
|
195
|
+
deriveMutations: {
|
|
196
|
+
enabled: true;
|
|
197
|
+
localOnly: boolean;
|
|
198
|
+
};
|
|
199
|
+
isSingleColumn: false;
|
|
200
|
+
}, import("effect/Schema").Schema<{
|
|
201
|
+
readonly id: string;
|
|
202
|
+
readonly text: string;
|
|
203
|
+
readonly completed: boolean;
|
|
204
|
+
}, {
|
|
205
|
+
readonly id: string;
|
|
206
|
+
readonly text: string;
|
|
207
|
+
readonly completed: number;
|
|
208
|
+
}, never>>;
|
|
209
|
+
app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
|
|
210
|
+
id: {
|
|
211
|
+
columnType: "text";
|
|
212
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
213
|
+
default: import("effect/Option").Some<"static">;
|
|
214
|
+
nullable: false;
|
|
215
|
+
primaryKey: true;
|
|
216
|
+
};
|
|
217
|
+
newTodoText: {
|
|
218
|
+
columnType: "text";
|
|
219
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
220
|
+
default: import("effect/Option").Some<"">;
|
|
221
|
+
nullable: true;
|
|
222
|
+
primaryKey: false;
|
|
223
|
+
};
|
|
224
|
+
filter: {
|
|
225
|
+
columnType: "text";
|
|
226
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
227
|
+
default: import("effect/Option").Some<"all">;
|
|
228
|
+
nullable: false;
|
|
229
|
+
primaryKey: false;
|
|
230
|
+
};
|
|
231
|
+
}>, false, {
|
|
232
|
+
isSingleton: true;
|
|
233
|
+
disableAutomaticIdColumn: false;
|
|
234
|
+
deriveMutations: never;
|
|
235
|
+
isSingleColumn: false;
|
|
236
|
+
}, import("effect/Schema").Schema<{
|
|
237
|
+
readonly id: string;
|
|
238
|
+
readonly newTodoText: string | null;
|
|
239
|
+
readonly filter: string;
|
|
240
|
+
}, {
|
|
241
|
+
readonly id: string;
|
|
242
|
+
readonly newTodoText: string | null;
|
|
243
|
+
readonly filter: string;
|
|
244
|
+
}, never>>;
|
|
245
|
+
};
|
|
246
|
+
}>;
|
|
247
|
+
export interface FixtureSchema extends FromInputSchema.DeriveSchema<{
|
|
248
|
+
tables: typeof tables;
|
|
249
|
+
}> {
|
|
250
|
+
}
|
|
251
|
+
export declare const makeTodoMvc: ({ otelTracer, otelContext, useGlobalReactivityGraph, }?: {
|
|
252
|
+
otelTracer?: otel.Tracer;
|
|
253
|
+
otelContext?: otel.Context;
|
|
254
|
+
useGlobalReactivityGraph?: boolean;
|
|
255
|
+
}) => Effect.Effect<{
|
|
256
|
+
store: Store<any, FixtureSchema>;
|
|
257
|
+
reactivityGraph: import("@livestore/livestore").ReactivityGraph;
|
|
258
|
+
}, import("@livestore/common/dist/adapter-types.js").UnexpectedError, import("effect/Scope").Scope>;
|
|
259
|
+
//# sourceMappingURL=fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../../src/utils/tests/fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAe,QAAQ,EAA0D,MAAM,sBAAsB,CAAA;AACpH,OAAO,EAAE,MAAM,EAAY,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAE/C,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQf,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAiB,CAAA;AACpC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyB,CAAA;AAE5C,MAAM,WAAW,aAAc,SAAQ,eAAe,CAAC,YAAY,CAAC;IAAE,MAAM,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;CAAG;AAEjG,eAAO,MAAM,WAAW,4DAIrB;IACD,UAAU,CAAC,EAAE,IAAI,CAAC,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAA;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAA;CACnC;;;mGAmBG,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createStore, DbSchema, globalReactivityGraph, makeReactivityGraph, makeSchema } from '@livestore/livestore';
|
|
2
|
+
import { Effect, FiberSet } from '@livestore/utils/effect';
|
|
3
|
+
import { makeInMemoryAdapter } from '@livestore/web';
|
|
4
|
+
export const todos = DbSchema.table('todos', {
|
|
5
|
+
id: DbSchema.text({ primaryKey: true }),
|
|
6
|
+
text: DbSchema.text({ default: '', nullable: false }),
|
|
7
|
+
completed: DbSchema.boolean({ default: false, nullable: false }),
|
|
8
|
+
}, { deriveMutations: true, isSingleton: false });
|
|
9
|
+
export const app = DbSchema.table('app', {
|
|
10
|
+
id: DbSchema.text({ primaryKey: true, default: 'static' }),
|
|
11
|
+
newTodoText: DbSchema.text({ default: '', nullable: true }),
|
|
12
|
+
filter: DbSchema.text({ default: 'all', nullable: false }),
|
|
13
|
+
}, { isSingleton: true });
|
|
14
|
+
export const tables = { todos, app };
|
|
15
|
+
export const schema = makeSchema({ tables });
|
|
16
|
+
export const makeTodoMvc = ({ otelTracer, otelContext, useGlobalReactivityGraph = true, } = {}) => Effect.gen(function* () {
|
|
17
|
+
const reactivityGraph = useGlobalReactivityGraph ? globalReactivityGraph : makeReactivityGraph();
|
|
18
|
+
const fiberSet = yield* FiberSet.make();
|
|
19
|
+
const store = yield* createStore({
|
|
20
|
+
schema,
|
|
21
|
+
storeId: 'default',
|
|
22
|
+
adapter: makeInMemoryAdapter(),
|
|
23
|
+
reactivityGraph,
|
|
24
|
+
otelOptions: {
|
|
25
|
+
tracer: otelTracer,
|
|
26
|
+
rootSpanContext: otelContext,
|
|
27
|
+
},
|
|
28
|
+
fiberSet,
|
|
29
|
+
});
|
|
30
|
+
return { store, reactivityGraph };
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../../src/utils/tests/fixture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACpH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAgBpD,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,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAC9C,CAAA;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAC/B,KAAK,EACL;IACE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC1D,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3D,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;CAC3D,EACD,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;AACpC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;AAI5C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,UAAU,EACV,WAAW,EACX,wBAAwB,GAAG,IAAI,MAK7B,EAAE,EAAE,EAAE,CACR,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,eAAe,GAAG,wBAAwB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAA;IAEhG,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAEvC,MAAM,KAAK,GAA8B,KAAK,CAAC,CAAC,WAAW,CAAC;QAC1D,MAAM;QACN,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,mBAAmB,EAAE;QAC9B,eAAe;QACf,WAAW,EAAE;YACX,MAAM,EAAE,UAAU;YAClB,eAAe,EAAE,WAAW;SAC7B;QACD,QAAQ;KACT,CAAC,CAAA;IAEF,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAA;AACnC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/utils/tests/mod.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../src/utils/tests/mod.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel.d.ts","sourceRoot":"","sources":["../../../src/utils/tests/otel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,+BAA+B,CAAA;AAEvF,KAAK,oBAAoB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAA;CAAE,CAAA;AAEhG,eAAO,MAAM,qBAAqB,aACtB,oBAAoB,kBACd,CAAC,UAAU,EAAE,UAAU,KAAK,UAAU,KACrD,oBAgCF,CAAA"}
|
|
@@ -10,19 +10,19 @@ export const getSimplifiedRootSpan = (exporter, mapAttributes) => {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
const rootSpan = spansMap.get(spans.find((_) => _.name === 'test').spanContext().spanId);
|
|
13
|
-
const
|
|
13
|
+
const simplifySpanRec = (span) => omitEmpty({
|
|
14
14
|
_name: span.span.name,
|
|
15
15
|
attributes: mapAttributesfn(span.span.attributes),
|
|
16
16
|
children: span.children
|
|
17
17
|
.filter((_) => _.span.name !== 'createStore')
|
|
18
18
|
// .sort((a, b) => compareHrTime(a.span.startTime, b.span.startTime))
|
|
19
|
-
.map(
|
|
19
|
+
.map(simplifySpanRec),
|
|
20
20
|
});
|
|
21
21
|
// console.dir(
|
|
22
22
|
// spans.map((_) => [_.spanContext().spanId, _.name, _.attributes, _.parentSpanId]),
|
|
23
23
|
// { depth: 10 },
|
|
24
24
|
// )
|
|
25
|
-
return
|
|
25
|
+
return simplifySpanRec(rootSpan);
|
|
26
26
|
};
|
|
27
27
|
// const compareHrTime = (a: [number, number], b: [number, number]) => {
|
|
28
28
|
// if (a[0] !== b[0]) return a[0] - b[0]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel.js","sourceRoot":"","sources":["../../../src/utils/tests/otel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAMlD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAA8B,EAC9B,aAAsD,EAChC,EAAE;IACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAAA;IACzC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAqB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAEtH,MAAM,eAAe,GAAG,aAAa,IAAI,QAAQ,CAAA;IAEjD,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QAC9B,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACxG,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,CAAC,CAAA;IAGF,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAE,CAAC,WAAW,EAAE,CAAC,MAAM,CAAE,CAAA;IAE1F,MAAM,eAAe,GAAG,CAAC,IAAgB,EAAwB,EAAE,CACjE,SAAS,CAAC;QACR,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;QACrB,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QACjD,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC;YAC7C,qEAAqE;aACpE,GAAG,CAAC,eAAe,CAAC;KACxB,CAAC,CAAA;IAEJ,eAAe;IACf,sFAAsF;IACtF,mBAAmB;IACnB,IAAI;IAEJ,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAA;AAClC,CAAC,CAAA;AAED,wEAAwE;AACxE,0CAA0C;AAC1C,uBAAuB;AACvB,IAAI;AAEJ,MAAM,SAAS,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC7B,MAAM,MAAM,GAAQ,EAAE,CAAA;IACtB,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,IACE,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;YACtB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAChC,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/livestore",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-dev.0",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
5
6
|
"exports": {
|
|
6
7
|
".": {
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
8
9
|
"default": "./dist/index.js"
|
|
9
10
|
},
|
|
10
|
-
"./
|
|
11
|
-
"types": "./dist/
|
|
12
|
-
"default": "./dist/
|
|
11
|
+
"./internal/testing-utils": {
|
|
12
|
+
"types": "./dist/utils/tests/mod.d.ts",
|
|
13
|
+
"default": "./dist/utils/tests/mod.js"
|
|
13
14
|
},
|
|
14
15
|
"./effect": {
|
|
15
16
|
"types": "./dist/effect/index.d.ts",
|
|
@@ -19,8 +20,8 @@
|
|
|
19
20
|
"types": "./dist/index.d.ts",
|
|
20
21
|
"typesVersions": {
|
|
21
22
|
"*": {
|
|
22
|
-
"
|
|
23
|
-
"./dist/
|
|
23
|
+
"testing-utils": [
|
|
24
|
+
"./dist/utils/tests/mod.d.ts"
|
|
24
25
|
],
|
|
25
26
|
"effect": [
|
|
26
27
|
"./dist/effect/index.d.ts"
|
|
@@ -30,28 +31,20 @@
|
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
32
33
|
"@opentelemetry/api": "^1.9.0",
|
|
33
|
-
"@livestore/common": "0.0
|
|
34
|
-
"@livestore/
|
|
35
|
-
"
|
|
34
|
+
"@livestore/common": "0.1.0-dev.0",
|
|
35
|
+
"@livestore/db-schema": "0.1.0-dev.0",
|
|
36
|
+
"@livestore/utils": "0.1.0-dev.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@opentelemetry/sdk-trace-base": "1.27.0",
|
|
39
|
-
"@tauri-apps/api": "^1.6.0",
|
|
40
|
-
"@testing-library/react": "^16.0.1",
|
|
41
|
-
"@types/react": "^18.3.12",
|
|
42
|
-
"@types/react-dom": "^18.3.1",
|
|
43
40
|
"jsdom": "^25.0.1",
|
|
44
|
-
"react": "^18.3.1",
|
|
45
|
-
"react-dom": "^18.3.1",
|
|
46
|
-
"react-window": "^1.8.10",
|
|
47
41
|
"typescript": "5.6.3",
|
|
48
42
|
"vite": "5.4.10",
|
|
49
43
|
"vitest": "^2.1.4",
|
|
50
|
-
"@livestore/web": "0.0
|
|
44
|
+
"@livestore/web": "0.1.0-dev.0"
|
|
51
45
|
},
|
|
52
46
|
"peerDependencies": {
|
|
53
|
-
"graphql": "16.x"
|
|
54
|
-
"react": "^18"
|
|
47
|
+
"graphql": "16.x"
|
|
55
48
|
},
|
|
56
49
|
"peerDependenciesMeta": {
|
|
57
50
|
"graphql": {
|
|
@@ -63,6 +56,6 @@
|
|
|
63
56
|
},
|
|
64
57
|
"scripts": {
|
|
65
58
|
"build": "tsc",
|
|
66
|
-
"test": "vitest
|
|
59
|
+
"test": "vitest"
|
|
67
60
|
}
|
|
68
61
|
}
|
package/src/ambient.d.ts
CHANGED
package/src/effect/LiveStore.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Adapter, BootStatus, UnexpectedError } from '@livestore/common'
|
|
2
2
|
import type { LiveStoreSchema } from '@livestore/common/schema'
|
|
3
3
|
import type { Cause, Scope } from '@livestore/utils/effect'
|
|
4
4
|
import { Context, Deferred, Duration, Effect, FiberSet, Layer, OtelTracer, pipe } from '@livestore/utils/effect'
|
|
5
5
|
import * as otel from '@opentelemetry/api'
|
|
6
6
|
import type { GraphQLSchema } from 'graphql'
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import type { LiveStoreContextRunning as LiveStoreContextRunning_ } from '../store-
|
|
8
|
+
import { createStore } from '../store/create-store.js'
|
|
9
|
+
import type { Store } from '../store/store.js'
|
|
10
|
+
import type { BaseGraphQLContext, LiveStoreContextRunning as LiveStoreContextRunning_ } from '../store/store-types.js'
|
|
11
11
|
import type { SynchronousDatabaseWrapper } from '../SynchronousDatabaseWrapper.js'
|
|
12
12
|
|
|
13
13
|
export type LiveStoreContextRunning = LiveStoreContextRunning_
|
|
@@ -33,10 +33,10 @@ export type LiveStoreContextProps<GraphQLContext extends BaseGraphQLContext> = {
|
|
|
33
33
|
storeId?: string
|
|
34
34
|
graphQLOptions?: {
|
|
35
35
|
schema: Effect.Effect<GraphQLSchema, never, otel.Tracer>
|
|
36
|
-
makeContext: (db: SynchronousDatabaseWrapper) => GraphQLContext
|
|
36
|
+
makeContext: (db: SynchronousDatabaseWrapper, tracer: otel.Tracer, sessionId: string) => GraphQLContext
|
|
37
37
|
}
|
|
38
|
-
boot?: (
|
|
39
|
-
adapter:
|
|
38
|
+
boot?: (store: Store<GraphQLContext, LiveStoreSchema>) => Effect.Effect<void, unknown, otel.Tracer>
|
|
39
|
+
adapter: Adapter
|
|
40
40
|
disableDevtools?: boolean
|
|
41
41
|
onBootStatus?: (status: BootStatus) => void
|
|
42
42
|
batchUpdates: (run: () => void) => void
|
package/src/global-state.ts
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { GlobalValue } from '@livestore/utils/effect'
|
|
15
|
+
|
|
14
16
|
import { makeReactivityGraph } from './reactiveQueries/base-class.js'
|
|
15
17
|
|
|
16
|
-
export const globalReactivityGraph =
|
|
18
|
+
export const globalReactivityGraph = GlobalValue.globalValue('livestore-global-reactivityGraph', () =>
|
|
19
|
+
makeReactivityGraph(),
|
|
20
|
+
)
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
export { Store
|
|
2
|
-
export
|
|
1
|
+
export { Store } from './store/store.js'
|
|
2
|
+
export { createStore, createStorePromise, type CreateStoreOptions } from './store/create-store.js'
|
|
3
|
+
export type {
|
|
4
|
+
BaseGraphQLContext,
|
|
5
|
+
QueryDebugInfo,
|
|
6
|
+
RefreshReason,
|
|
7
|
+
GraphQLOptions,
|
|
8
|
+
OtelOptions,
|
|
9
|
+
} from './store/store-types.js'
|
|
3
10
|
|
|
4
|
-
export type { LiveStoreContextRunning
|
|
11
|
+
export type { LiveStoreContextRunning } from './effect/LiveStore.js'
|
|
12
|
+
export { StoreAbort, StoreInterrupted, type LiveStoreContext } from './store/store-types.js'
|
|
5
13
|
|
|
6
14
|
export { SynchronousDatabaseWrapper, emptyDebugInfo } from './SynchronousDatabaseWrapper.js'
|
|
7
15
|
|
|
@@ -17,7 +25,7 @@ export type {
|
|
|
17
25
|
Ref,
|
|
18
26
|
Effect,
|
|
19
27
|
} from './reactive.js'
|
|
20
|
-
export { LiveStoreJSQuery, computed } from './reactiveQueries/
|
|
28
|
+
export { LiveStoreJSQuery, computed } from './reactiveQueries/computed.js'
|
|
21
29
|
export { LiveStoreSQLQuery, querySQL } from './reactiveQueries/sql.js'
|
|
22
30
|
export { LiveStoreGraphQLQuery, queryGraphQL } from './reactiveQueries/graphql.js'
|
|
23
31
|
export {
|
|
@@ -25,6 +33,8 @@ export {
|
|
|
25
33
|
type ReactivityGraph,
|
|
26
34
|
makeReactivityGraph,
|
|
27
35
|
type LiveQuery,
|
|
36
|
+
type GetResult,
|
|
37
|
+
type LiveQueryAny,
|
|
28
38
|
} from './reactiveQueries/base-class.js'
|
|
29
39
|
|
|
30
40
|
export { globalReactivityGraph } from './global-state.js'
|
|
@@ -34,7 +44,7 @@ export { type RowResult, type RowResultEncoded, rowQuery, deriveColQuery } from
|
|
|
34
44
|
export * from '@livestore/common/schema'
|
|
35
45
|
export {
|
|
36
46
|
sql,
|
|
37
|
-
|
|
47
|
+
SessionIdSymbol,
|
|
38
48
|
type BootStatus,
|
|
39
49
|
type SynchronousDatabase,
|
|
40
50
|
type DebugInfo,
|
|
@@ -44,8 +54,10 @@ export {
|
|
|
44
54
|
type PreparedBindValues,
|
|
45
55
|
} from '@livestore/common'
|
|
46
56
|
|
|
47
|
-
export { SqliteAst, SqliteDsl } from '
|
|
57
|
+
export { SqliteAst, SqliteDsl } from '@livestore/db-schema'
|
|
48
58
|
|
|
49
59
|
export { deepEqual } from '@livestore/utils'
|
|
50
60
|
|
|
51
|
-
export
|
|
61
|
+
export * from './utils/stack-info.js'
|
|
62
|
+
|
|
63
|
+
export type { ClientSession, Adapter, PreparedStatement } from '@livestore/common'
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { QueryInfo, QueryInfoNone } from '@livestore/common'
|
|
2
2
|
import type * as otel from '@opentelemetry/api'
|
|
3
3
|
|
|
4
|
-
import type { StackInfo } from '../react/utils/stack-info.js'
|
|
5
4
|
import { type Atom, type GetAtom, ReactiveGraph, throwContextNotSetError, type Thunk } from '../reactive.js'
|
|
6
|
-
import type {
|
|
5
|
+
import type { Store } from '../store/store.js'
|
|
6
|
+
import type { QueryDebugInfo, RefreshReason } from '../store/store-types.js'
|
|
7
|
+
import type { StackInfo } from '../utils/stack-info.js'
|
|
7
8
|
|
|
8
9
|
export type ReactivityGraph = ReactiveGraph<RefreshReason, QueryDebugInfo, QueryContext>
|
|
9
10
|
|
|
@@ -28,7 +29,7 @@ export type LiveQueryAny = LiveQuery<any, QueryInfo>
|
|
|
28
29
|
|
|
29
30
|
export interface LiveQuery<TResult, TQueryInfo extends QueryInfo = QueryInfoNone> {
|
|
30
31
|
id: number
|
|
31
|
-
_tag: '
|
|
32
|
+
_tag: 'computed' | 'sql' | 'graphql'
|
|
32
33
|
|
|
33
34
|
/** This should only be used on a type-level and doesn't hold any value during runtime */
|
|
34
35
|
'__result!': TResult
|
|
@@ -64,7 +65,7 @@ export abstract class LiveStoreQueryBase<TResult, TQueryInfo extends QueryInfo>
|
|
|
64
65
|
{
|
|
65
66
|
'__result!'!: TResult
|
|
66
67
|
id = queryIdCounter++
|
|
67
|
-
abstract _tag: '
|
|
68
|
+
abstract _tag: 'computed' | 'sql' | 'graphql'
|
|
68
69
|
|
|
69
70
|
/** Human-readable label for the query for debugging */
|
|
70
71
|
abstract label: string
|
|
@@ -3,7 +3,7 @@ import * as otel from '@opentelemetry/api'
|
|
|
3
3
|
|
|
4
4
|
import { globalReactivityGraph } from '../global-state.js'
|
|
5
5
|
import type { Thunk } from '../reactive.js'
|
|
6
|
-
import type { RefreshReason } from '../store.js'
|
|
6
|
+
import type { RefreshReason } from '../store/store-types.js'
|
|
7
7
|
import { getDurationMsFromSpan } from '../utils/otel.js'
|
|
8
8
|
import type { GetAtomResult, LiveQuery, QueryContext, ReactivityGraph } from './base-class.js'
|
|
9
9
|
import { LiveStoreQueryBase, makeGetAtomResult } from './base-class.js'
|
|
@@ -27,7 +27,7 @@ export class LiveStoreJSQuery<TResult, TQueryInfo extends QueryInfo = QueryInfoN
|
|
|
27
27
|
TResult,
|
|
28
28
|
TQueryInfo
|
|
29
29
|
> {
|
|
30
|
-
_tag: '
|
|
30
|
+
_tag: 'computed' = 'computed'
|
|
31
31
|
|
|
32
32
|
/** A reactive thunk representing the query results */
|
|
33
33
|
results$: Thunk<TResult, QueryContext, RefreshReason>
|
|
@@ -82,7 +82,7 @@ export class LiveStoreJSQuery<TResult, TQueryInfo extends QueryInfo = QueryInfoN
|
|
|
82
82
|
|
|
83
83
|
this.executionTimes.push(durationMs)
|
|
84
84
|
|
|
85
|
-
setDebugInfo({ _tag: '
|
|
85
|
+
setDebugInfo({ _tag: 'computed', label, query: fn.toString(), durationMs })
|
|
86
86
|
|
|
87
87
|
return res
|
|
88
88
|
}),
|
|
@@ -7,7 +7,8 @@ import * as graphql from 'graphql'
|
|
|
7
7
|
|
|
8
8
|
import { globalReactivityGraph } from '../global-state.js'
|
|
9
9
|
import { isThunk, type Thunk } from '../reactive.js'
|
|
10
|
-
import type {
|
|
10
|
+
import type { Store } from '../store/store.js'
|
|
11
|
+
import type { BaseGraphQLContext, RefreshReason } from '../store/store-types.js'
|
|
11
12
|
import { getDurationMsFromSpan } from '../utils/otel.js'
|
|
12
13
|
import type { GetAtomResult, LiveQuery, QueryContext, ReactivityGraph } from './base-class.js'
|
|
13
14
|
import { LiveStoreQueryBase, makeGetAtomResult } from './base-class.js'
|
|
@@ -3,9 +3,9 @@ import * as otel from '@opentelemetry/api'
|
|
|
3
3
|
import { BasicTracerProvider, InMemorySpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base'
|
|
4
4
|
import { describe, expect, it } from 'vitest'
|
|
5
5
|
|
|
6
|
-
import { makeTodoMvc, tables } from '../__tests__/react/fixture.js'
|
|
7
|
-
import { getSimplifiedRootSpan } from '../__tests__/react/utils/otel.js'
|
|
8
6
|
import { computed, querySQL, rawSqlMutation, sql } from '../index.js'
|
|
7
|
+
import { makeTodoMvc, tables } from '../utils/tests/fixture.js'
|
|
8
|
+
import { getSimplifiedRootSpan } from '../utils/tests/otel.js'
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
TODO write tests for:
|