@livestore/livestore 0.0.58-dev.1 → 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.
- package/README.md +1 -117
- package/dist/.tsbuildinfo +1 -1
- package/dist/effect/LiveStore.d.ts +3 -3
- 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 +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/reactiveQueries/base-class.d.ts +1 -1
- package/dist/reactiveQueries/base-class.d.ts.map +1 -1
- package/dist/reactiveQueries/base-class.js.map +1 -1
- package/dist/reactiveQueries/sql.d.ts +1 -1
- package/dist/reactiveQueries/sql.d.ts.map +1 -1
- package/dist/reactiveQueries/sql.js +4 -4
- 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 +18 -10
- package/dist/row-query.js.map +1 -1
- package/dist/store-devtools.d.ts +2 -2
- package/dist/store-devtools.d.ts.map +1 -1
- package/dist/store-devtools.js +3 -3
- package/dist/store-devtools.js.map +1 -1
- package/dist/store.d.ts +23 -19
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +90 -59
- package/dist/store.js.map +1 -1
- package/dist/utils/dev.d.ts.map +1 -1
- package/dist/utils/dev.js +1 -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 +33 -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/utils/tests/otel.js.map +1 -0
- package/package.json +17 -24
- package/src/ambient.d.ts +3 -0
- package/src/effect/LiveStore.ts +4 -4
- package/src/global-state.ts +5 -1
- package/src/index.ts +17 -4
- package/src/reactiveQueries/base-class.ts +1 -1
- package/src/reactiveQueries/sql.test.ts +2 -2
- package/src/reactiveQueries/sql.ts +5 -5
- package/src/row-query.ts +36 -16
- package/src/store-devtools.ts +5 -5
- package/src/store.ts +146 -78
- package/src/utils/dev.ts +1 -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 +77 -0
- package/src/utils/tests/mod.ts +2 -0
- 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 -47
- 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 -21
- 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 -69
- 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 -562
- 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 -70
- 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 -37
- 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 -289
- 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 -33
- package/src/react/useQuery.test.tsx +0 -82
- package/src/react/useQuery.ts +0 -105
- package/src/react/useRow.test.tsx +0 -699
- package/src/react/useRow.ts +0 -180
- package/src/react/useTemporaryQuery.test.tsx +0 -56
- package/src/react/useTemporaryQuery.ts +0 -121
- package/src/react/utils/useStateRefWithReactiveInput.ts +0 -51
- /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
- /package/dist/{__tests__/react/utils → utils/tests}/otel.js +0 -0
- /package/src/{__tests__/react/utils → utils/tests}/otel.ts +0 -0
package/dist/utils/dev.js
CHANGED
package/dist/utils/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/utils/dev.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAgC,E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AAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IAE/E,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IAE5C,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAE1B,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAA;AACzD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAE;IAC5D,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAA;IACb,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACrB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;IACxB,CAAC,CAAC,KAAK,EAAE,CAAA;IACT,CAAC,CAAC,MAAM,EAAE,CAAA;AACZ,CAAC,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const originalStackLimit: number;
|
|
2
1
|
export type StackInfo = {
|
|
3
2
|
frames: StackFrame[];
|
|
4
3
|
};
|
|
@@ -7,5 +6,5 @@ export type StackFrame = {
|
|
|
7
6
|
filePath: string;
|
|
8
7
|
};
|
|
9
8
|
export declare const extractStackInfoFromStackTrace: (stackTrace: string) => StackInfo;
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const stackInfoToString: (stackInfo: StackInfo) => string;
|
|
11
10
|
//# sourceMappingURL=stack-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-info.d.ts","sourceRoot":"","sources":["../../src/utils/stack-info.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,UAAU,EAAE,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAqBD,eAAO,MAAM,8BAA8B,eAAgB,MAAM,KAAG,SAsBnE,CAAA;AAED,eAAO,MAAM,iBAAiB,cAAe,SAAS,KAAG,MACY,CAAA"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export const originalStackLimit = Error.stackTraceLimit;
|
|
3
1
|
/*
|
|
4
2
|
Example stack trace:
|
|
5
3
|
|
|
@@ -39,11 +37,5 @@ export const extractStackInfoFromStackTrace = (stackTrace) => {
|
|
|
39
37
|
}
|
|
40
38
|
return { frames };
|
|
41
39
|
};
|
|
42
|
-
export const
|
|
43
|
-
Error.stackTraceLimit = 10;
|
|
44
|
-
// eslint-disable-next-line unicorn/error-message
|
|
45
|
-
const stack = new Error().stack;
|
|
46
|
-
Error.stackTraceLimit = originalStackLimit;
|
|
47
|
-
return extractStackInfoFromStackTrace(stack);
|
|
48
|
-
}, []);
|
|
40
|
+
export const stackInfoToString = (stackInfo) => stackInfo.frames.map((f) => `${f.name} (${f.filePath})`).join('\n');
|
|
49
41
|
//# sourceMappingURL=stack-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-info.js","sourceRoot":"","sources":["../../src/utils/stack-info.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,UAAkB,EAAa,EAAE;IAC9E,MAAM,WAAW,GAAG,oBAAoB,CAAA;IACxC,IAAI,KAA6B,CAAA;IACjC,MAAM,MAAM,GAAiB,EAAE,CAAA;IAC/B,IAAI,eAAe,GAAG,KAAK,CAAA;IAE3B,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACvD,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,KAAwC,CAAA;QAEnE,wEAAwE;QACxE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,CAAC;YACrG,eAAe,GAAG,IAAI,CAAA;YAEtB,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;QACnE,CAAC;aAAM,IAAI,eAAe,EAAE,CAAC;YAC3B,6FAA6F;YAC7F,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;YAClC,MAAK;QACP,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,CAAA;AACnB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAoB,EAAU,EAAE,CAChE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-info.test.d.ts","sourceRoot":"","sources":["../../src/utils/stack-info.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-info.test.js","sourceRoot":"","sources":["../../src/utils/stack-info.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAA;AAEhE,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"}
|
|
@@ -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").None<never>;
|
|
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: false;
|
|
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").None<never>;
|
|
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: false;
|
|
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").None<never>;
|
|
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: false;
|
|
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,EAEL,QAAQ,EAKT,MAAM,sBAAsB,CAAA;AAC7B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAId,CAAA;AAEF,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;;;mGAoBG,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createStore, DbSchema, globalReactivityGraph, makeReactivityGraph, makeSchema, sql, } 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 }),
|
|
11
|
+
newTodoText: DbSchema.text({ default: '', nullable: true }),
|
|
12
|
+
filter: DbSchema.text({ default: 'all', nullable: false }),
|
|
13
|
+
});
|
|
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
|
+
boot: (db) => db.execute(sql `INSERT OR IGNORE INTO app (id, newTodoText, filter) VALUES ('static', '', 'all');`),
|
|
23
|
+
adapter: makeInMemoryAdapter(),
|
|
24
|
+
reactivityGraph,
|
|
25
|
+
otelOptions: {
|
|
26
|
+
tracer: otelTracer,
|
|
27
|
+
rootSpanContext: otelContext,
|
|
28
|
+
},
|
|
29
|
+
fiberSet,
|
|
30
|
+
});
|
|
31
|
+
return { store, reactivityGraph };
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../../src/utils/tests/fixture.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,QAAQ,EACR,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,GAAG,GACJ,MAAM,sBAAsB,CAAA;AAC7B,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,CAAC,KAAK,EAAE;IACvC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvC,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAA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|
|
@@ -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,yBAiCvD,CAAA"}
|
|
@@ -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,EACtD,EAAE;IACF,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,EA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,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,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/livestore",
|
|
3
|
-
"version": "0.0.58-dev.
|
|
3
|
+
"version": "0.0.58-dev.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"default": "./dist/index.js"
|
|
9
9
|
},
|
|
10
|
-
"./
|
|
11
|
-
"types": "./dist/
|
|
12
|
-
"default": "./dist/
|
|
10
|
+
"./internal/testing-utils": {
|
|
11
|
+
"types": "./dist/utils/tests/mod.d.ts",
|
|
12
|
+
"default": "./dist/utils/tests/mod.js"
|
|
13
13
|
},
|
|
14
14
|
"./effect": {
|
|
15
15
|
"types": "./dist/effect/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"typesVersions": {
|
|
21
21
|
"*": {
|
|
22
|
-
"
|
|
23
|
-
"./dist/
|
|
22
|
+
"testing-utils": [
|
|
23
|
+
"./dist/utils/tests/mod.d.ts"
|
|
24
24
|
],
|
|
25
25
|
"effect": [
|
|
26
26
|
"./dist/effect/index.d.ts"
|
|
@@ -30,27 +30,20 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
32
32
|
"@opentelemetry/api": "^1.9.0",
|
|
33
|
-
"@livestore/common": "0.0.58-dev.
|
|
34
|
-
"@livestore/
|
|
35
|
-
"
|
|
33
|
+
"@livestore/common": "0.0.58-dev.10",
|
|
34
|
+
"@livestore/db-schema": "0.0.58-dev.10",
|
|
35
|
+
"@livestore/utils": "0.0.58-dev.10"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@opentelemetry/sdk-trace-base": "1.
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"react": "^18.3.1",
|
|
45
|
-
"react-dom": "^18.3.1",
|
|
46
|
-
"typescript": "5.5.4",
|
|
47
|
-
"vite": "5.4.3",
|
|
48
|
-
"vitest": "^2.0.4",
|
|
49
|
-
"@livestore/web": "0.0.58-dev.1"
|
|
38
|
+
"@opentelemetry/sdk-trace-base": "1.27.0",
|
|
39
|
+
"jsdom": "^25.0.1",
|
|
40
|
+
"typescript": "5.6.3",
|
|
41
|
+
"vite": "5.4.10",
|
|
42
|
+
"vitest": "^2.1.4",
|
|
43
|
+
"@livestore/web": "0.0.58-dev.10"
|
|
50
44
|
},
|
|
51
45
|
"peerDependencies": {
|
|
52
|
-
"graphql": "16.x"
|
|
53
|
-
"react": "^18"
|
|
46
|
+
"graphql": "16.x"
|
|
54
47
|
},
|
|
55
48
|
"peerDependenciesMeta": {
|
|
56
49
|
"graphql": {
|
|
@@ -62,6 +55,6 @@
|
|
|
62
55
|
},
|
|
63
56
|
"scripts": {
|
|
64
57
|
"build": "tsc",
|
|
65
|
-
"test": "vitest
|
|
58
|
+
"test": "vitest"
|
|
66
59
|
}
|
|
67
60
|
}
|
package/src/ambient.d.ts
CHANGED
package/src/effect/LiveStore.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BootDb, BootStatus,
|
|
1
|
+
import type { Adapter, BootDb, 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'
|
|
@@ -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
38
|
boot?: (db: BootDb) => Effect.Effect<void, unknown, otel.Tracer>
|
|
39
|
-
adapter:
|
|
39
|
+
adapter: Adapter
|
|
40
40
|
disableDevtools?: boolean
|
|
41
41
|
onBootStatus?: (status: BootStatus) => void
|
|
42
42
|
batchUpdates: (run: () => void) => void
|
|
@@ -98,7 +98,7 @@ export const makeLiveStoreContext = <GraphQLContext extends BaseGraphQLContext>(
|
|
|
98
98
|
batchUpdates,
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
globalThis.__debugLiveStore ??= {}
|
|
102
102
|
// window.__debugLiveStore[schema.key] = store
|
|
103
103
|
|
|
104
104
|
return { stage: 'running', store } satisfies LiveStoreContextRunning
|
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
1
|
export { Store, createStorePromise, createStore } from './store.js'
|
|
2
|
-
export type {
|
|
2
|
+
export type {
|
|
3
|
+
BaseGraphQLContext,
|
|
4
|
+
QueryDebugInfo,
|
|
5
|
+
RefreshReason,
|
|
6
|
+
CreateStoreOptions,
|
|
7
|
+
GraphQLOptions,
|
|
8
|
+
OtelOptions,
|
|
9
|
+
} from './store.js'
|
|
3
10
|
|
|
4
|
-
export type { LiveStoreContextRunning
|
|
11
|
+
export type { LiveStoreContextRunning } from './effect/LiveStore.js'
|
|
12
|
+
export { StoreAbort, StoreInterrupted, type LiveStoreContext } from './store-context.js'
|
|
5
13
|
|
|
6
14
|
export { SynchronousDatabaseWrapper, emptyDebugInfo } from './SynchronousDatabaseWrapper.js'
|
|
7
15
|
|
|
@@ -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,6 +44,7 @@ export { type RowResult, type RowResultEncoded, rowQuery, deriveColQuery } from
|
|
|
34
44
|
export * from '@livestore/common/schema'
|
|
35
45
|
export {
|
|
36
46
|
sql,
|
|
47
|
+
SessionIdSymbol,
|
|
37
48
|
type BootDb,
|
|
38
49
|
type BootStatus,
|
|
39
50
|
type SynchronousDatabase,
|
|
@@ -44,8 +55,10 @@ export {
|
|
|
44
55
|
type PreparedBindValues,
|
|
45
56
|
} from '@livestore/common'
|
|
46
57
|
|
|
47
|
-
export { SqliteAst, SqliteDsl } from '
|
|
58
|
+
export { SqliteAst, SqliteDsl } from '@livestore/db-schema'
|
|
48
59
|
|
|
49
60
|
export { deepEqual } from '@livestore/utils'
|
|
50
61
|
|
|
51
|
-
export
|
|
62
|
+
export * from './utils/stack-info.js'
|
|
63
|
+
|
|
64
|
+
export type { ClientSession, Adapter, PreparedStatement } from '@livestore/common'
|
|
@@ -1,9 +1,9 @@
|
|
|
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
5
|
import type { QueryDebugInfo, RefreshReason, Store } from '../store.js'
|
|
6
|
+
import type { StackInfo } from '../utils/stack-info.js'
|
|
7
7
|
|
|
8
8
|
export type ReactivityGraph = ReactiveGraph<RefreshReason, QueryDebugInfo, QueryContext>
|
|
9
9
|
|
|
@@ -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:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Bindable, prepareBindValues, type QueryInfo, type QueryInfoNone } from '@livestore/common'
|
|
2
2
|
import { shouldNeverHappen } from '@livestore/utils'
|
|
3
|
-
import { Schema,
|
|
3
|
+
import { Schema, TreeFormatter } from '@livestore/utils/effect'
|
|
4
4
|
import * as otel from '@opentelemetry/api'
|
|
5
5
|
|
|
6
6
|
import { globalReactivityGraph } from '../global-state.js'
|
|
@@ -79,7 +79,7 @@ export class LiveStoreSQLQuery<
|
|
|
79
79
|
queryInfo,
|
|
80
80
|
}: {
|
|
81
81
|
label?: string
|
|
82
|
-
genQueryString: string | ((get: GetAtomResult) => string)
|
|
82
|
+
genQueryString: string | ((get: GetAtomResult, ctx: QueryContext) => string)
|
|
83
83
|
queriedTables?: Set<string>
|
|
84
84
|
bindValues?: Bindable
|
|
85
85
|
reactivityGraph?: ReactivityGraph
|
|
@@ -101,9 +101,9 @@ export class LiveStoreSQLQuery<
|
|
|
101
101
|
let queryString$OrQueryString: string | Thunk<string, QueryContext, RefreshReason>
|
|
102
102
|
if (typeof genQueryString === 'function') {
|
|
103
103
|
queryString$OrQueryString = this.reactivityGraph.makeThunk(
|
|
104
|
-
(get, setDebugInfo,
|
|
104
|
+
(get, setDebugInfo, ctx, otelContext) => {
|
|
105
105
|
const startMs = performance.now()
|
|
106
|
-
const queryString = genQueryString(makeGetAtomResult(get, otelContext ?? rootOtelContext))
|
|
106
|
+
const queryString = genQueryString(makeGetAtomResult(get, otelContext ?? ctx.rootOtelContext), ctx)
|
|
107
107
|
const durationMs = performance.now() - startMs
|
|
108
108
|
setDebugInfo({ _tag: 'js', label: `${label}:queryString`, query: queryString, durationMs })
|
|
109
109
|
return queryString
|
|
@@ -124,7 +124,7 @@ export class LiveStoreSQLQuery<
|
|
|
124
124
|
|
|
125
125
|
const queriedTablesRef = { current: queriedTables }
|
|
126
126
|
|
|
127
|
-
const schemaEqual =
|
|
127
|
+
const schemaEqual = Schema.equivalence(schema)
|
|
128
128
|
// TODO also support derived equality for `map` (probably will depend on having an easy way to transform a schema without an `encode` step)
|
|
129
129
|
// This would mean dropping the `map` option
|
|
130
130
|
const equal =
|