@livestore/livestore 0.3.0-dev.11 → 0.3.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/SynchronousDatabaseWrapper.d.ts +5 -14
- package/dist/SynchronousDatabaseWrapper.d.ts.map +1 -1
- package/dist/SynchronousDatabaseWrapper.js +4 -24
- package/dist/SynchronousDatabaseWrapper.js.map +1 -1
- package/dist/effect/LiveStore.d.ts +8 -12
- package/dist/effect/LiveStore.d.ts.map +1 -1
- package/dist/effect/LiveStore.js +3 -13
- package/dist/effect/LiveStore.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/live-queries/base-class.d.ts +21 -64
- package/dist/live-queries/base-class.d.ts.map +1 -1
- package/dist/live-queries/base-class.js +13 -56
- package/dist/live-queries/base-class.js.map +1 -1
- package/dist/live-queries/computed.d.ts +7 -7
- package/dist/live-queries/computed.d.ts.map +1 -1
- package/dist/live-queries/computed.js +11 -35
- package/dist/live-queries/computed.js.map +1 -1
- package/dist/live-queries/db.d.ts +15 -12
- package/dist/live-queries/db.d.ts.map +1 -1
- package/dist/live-queries/db.js +25 -44
- package/dist/live-queries/db.js.map +1 -1
- package/dist/live-queries/db.test.js +14 -16
- package/dist/live-queries/db.test.js.map +1 -1
- package/dist/live-queries/graphql.d.ts +8 -8
- package/dist/live-queries/graphql.d.ts.map +1 -1
- package/dist/live-queries/graphql.js +9 -35
- package/dist/live-queries/graphql.js.map +1 -1
- package/dist/reactive.d.ts +13 -15
- package/dist/reactive.d.ts.map +1 -1
- package/dist/reactive.js +9 -15
- package/dist/reactive.js.map +1 -1
- package/dist/row-query-utils.d.ts +4 -4
- package/dist/row-query-utils.d.ts.map +1 -1
- package/dist/row-query-utils.js +10 -14
- package/dist/row-query-utils.js.map +1 -1
- package/dist/store/create-store.d.ts +4 -3
- package/dist/store/create-store.d.ts.map +1 -1
- package/dist/store/create-store.js +7 -7
- package/dist/store/create-store.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 +15 -15
- package/dist/store/devtools.js.map +1 -1
- package/dist/store/store-types.d.ts +5 -10
- package/dist/store/store-types.d.ts.map +1 -1
- package/dist/store/store-types.js.map +1 -1
- package/dist/store/store.d.ts +16 -34
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +77 -129
- package/dist/store/store.js.map +1 -1
- package/dist/utils/stack-info.d.ts.map +1 -1
- package/dist/utils/stack-info.js +1 -6
- package/dist/utils/stack-info.js.map +1 -1
- package/dist/utils/stack-info.test.js +1 -54
- package/dist/utils/stack-info.test.js.map +1 -1
- package/dist/utils/tests/fixture.d.ts +6 -2
- package/dist/utils/tests/fixture.d.ts.map +1 -1
- package/dist/utils/tests/fixture.js +5 -3
- package/dist/utils/tests/fixture.js.map +1 -1
- package/dist/utils/tests/mod.d.ts +0 -1
- package/dist/utils/tests/mod.d.ts.map +1 -1
- package/dist/utils/tests/mod.js +0 -1
- package/dist/utils/tests/mod.js.map +1 -1
- package/package.json +12 -12
- package/src/{SqliteDbWrapper.ts → SynchronousDatabaseWrapper.ts} +11 -41
- package/src/effect/LiveStore.ts +15 -26
- package/src/global-state.ts +20 -0
- package/src/index.ts +7 -14
- package/src/live-queries/__snapshots__/{db-query.test.ts.snap → db.test.ts.snap} +42 -196
- package/src/live-queries/base-class.ts +40 -160
- package/src/live-queries/computed.ts +19 -45
- package/src/live-queries/{db-query.test.ts → db.test.ts} +11 -21
- package/src/live-queries/{db-query.ts → db.ts} +39 -97
- package/src/live-queries/graphql.ts +21 -47
- package/src/reactive.ts +27 -52
- package/src/row-query-utils.ts +18 -29
- package/src/store/create-store.ts +23 -20
- package/src/store/devtools.ts +17 -17
- package/src/store/store-types.ts +5 -7
- package/src/store/store.ts +122 -231
- package/src/utils/stack-info.test.ts +1 -58
- package/src/utils/stack-info.ts +1 -6
- package/src/utils/tests/fixture.ts +7 -2
- package/src/utils/tests/mod.ts +0 -1
- package/dist/SqliteDbWrapper.d.ts +0 -54
- package/dist/SqliteDbWrapper.d.ts.map +0 -1
- package/dist/SqliteDbWrapper.js +0 -212
- package/dist/SqliteDbWrapper.js.map +0 -1
- package/dist/__tests__/fixture.d.ts +0 -252
- package/dist/__tests__/fixture.d.ts.map +0 -1
- package/dist/__tests__/fixture.js +0 -18
- package/dist/__tests__/fixture.js.map +0 -1
- package/dist/live-queries/db-query.d.ts +0 -67
- package/dist/live-queries/db-query.d.ts.map +0 -1
- package/dist/live-queries/db-query.js +0 -244
- package/dist/live-queries/db-query.js.map +0 -1
- package/dist/live-queries/db-query.test.d.ts +0 -2
- package/dist/live-queries/db-query.test.d.ts.map +0 -1
- package/dist/live-queries/db-query.test.js +0 -123
- package/dist/live-queries/db-query.test.js.map +0 -1
- package/dist/live-queries/make-ref.d.ts +0 -20
- package/dist/live-queries/make-ref.d.ts.map +0 -1
- package/dist/live-queries/make-ref.js +0 -33
- package/dist/live-queries/make-ref.js.map +0 -1
- package/dist/store/store.test.d.ts +0 -2
- package/dist/store/store.test.d.ts.map +0 -1
- package/dist/store/store.test.js +0 -27
- package/dist/store/store.test.js.map +0 -1
- package/dist/utils/expo.d.ts +0 -2
- package/dist/utils/expo.d.ts.map +0 -1
- package/dist/utils/expo.js +0 -8
- package/dist/utils/expo.js.map +0 -1
- package/dist/utils/function-string.d.ts +0 -7
- package/dist/utils/function-string.d.ts.map +0 -1
- package/dist/utils/function-string.js +0 -9
- package/dist/utils/function-string.js.map +0 -1
- package/src/live-queries/make-ref.ts +0 -47
- package/src/utils/function-string.ts +0 -12
@@ -1 +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
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/utils/tests/mod.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
package/dist/utils/tests/mod.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../src/utils/tests/mod.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../src/utils/tests/mod.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@livestore/livestore",
|
3
|
-
"version": "0.3.0-dev.
|
3
|
+
"version": "0.3.0-dev.5",
|
4
4
|
"type": "module",
|
5
5
|
"sideEffects": false,
|
6
6
|
"exports": {
|
@@ -29,22 +29,22 @@
|
|
29
29
|
}
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@graphql-typed-document-node/core": "3.2.0",
|
33
|
-
"@opentelemetry/api": "1.9.0",
|
34
|
-
"@livestore/
|
35
|
-
"@livestore/db-schema": "0.3.0-dev.
|
36
|
-
"@livestore/
|
32
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
33
|
+
"@opentelemetry/api": "^1.9.0",
|
34
|
+
"@livestore/utils": "0.3.0-dev.5",
|
35
|
+
"@livestore/db-schema": "0.3.0-dev.5",
|
36
|
+
"@livestore/common": "0.3.0-dev.5"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@opentelemetry/sdk-trace-base": "
|
40
|
-
"jsdom": "^
|
41
|
-
"typescript": "
|
42
|
-
"vite": "
|
39
|
+
"@opentelemetry/sdk-trace-base": "1.30.0",
|
40
|
+
"jsdom": "^25.0.1",
|
41
|
+
"typescript": "5.7.2",
|
42
|
+
"vite": "5.4.10",
|
43
43
|
"vitest": "^2.1.4",
|
44
|
-
"@livestore/web": "0.3.0-dev.
|
44
|
+
"@livestore/web": "0.3.0-dev.5"
|
45
45
|
},
|
46
46
|
"peerDependencies": {
|
47
|
-
"graphql": "
|
47
|
+
"graphql": "16.x"
|
48
48
|
},
|
49
49
|
"peerDependenciesMeta": {
|
50
50
|
"graphql": {
|
@@ -5,9 +5,7 @@ import type {
|
|
5
5
|
MutableDebugInfo,
|
6
6
|
PreparedBindValues,
|
7
7
|
PreparedStatement,
|
8
|
-
|
9
|
-
SqliteDbChangeset,
|
10
|
-
SqliteDbSession,
|
8
|
+
SynchronousDatabase,
|
11
9
|
} from '@livestore/common'
|
12
10
|
import { BoundArray, BoundMap, sql } from '@livestore/common'
|
13
11
|
import { isDevEnv } from '@livestore/utils'
|
@@ -23,17 +21,12 @@ export const emptyDebugInfo = (): DebugInfo => ({
|
|
23
21
|
events: new BoundArray(1000),
|
24
22
|
})
|
25
23
|
|
26
|
-
|
27
|
-
* This class is mostly adding result caching around a SqliteDb which is used to speed up
|
28
|
-
* SQLite queries when used through the reactivity graph.
|
29
|
-
*/
|
30
|
-
export class SqliteDbWrapper implements SqliteDb {
|
31
|
-
_tag = 'SqliteDb' as const
|
24
|
+
export class SynchronousDatabaseWrapper {
|
32
25
|
// TODO: how many unique active statements are expected?
|
33
26
|
private cachedStmts = new BoundMap<string, PreparedStatement>(200)
|
34
27
|
private tablesUsedCache = new BoundMap<string, Set<string>>(200)
|
35
28
|
private resultCache = new QueryCache()
|
36
|
-
private db:
|
29
|
+
private db: SynchronousDatabase
|
37
30
|
private otelTracer: otel.Tracer
|
38
31
|
private otelRootSpanContext: otel.Context
|
39
32
|
private tablesUsedStmt
|
@@ -43,7 +36,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
43
36
|
db,
|
44
37
|
otel,
|
45
38
|
}: {
|
46
|
-
db:
|
39
|
+
db: SynchronousDatabase
|
47
40
|
otel: {
|
48
41
|
tracer: otel.Tracer
|
49
42
|
rootSpanContext: otel.Context
|
@@ -61,25 +54,6 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
61
54
|
|
62
55
|
configureSQLite(this)
|
63
56
|
}
|
64
|
-
metadata: any
|
65
|
-
prepare(queryStr: string): PreparedStatement {
|
66
|
-
return this.db.prepare(queryStr)
|
67
|
-
}
|
68
|
-
import(data: Uint8Array<ArrayBufferLike> | SqliteDb<any, any>) {
|
69
|
-
return this.db.import(data)
|
70
|
-
}
|
71
|
-
close(): void {
|
72
|
-
return this.db.close()
|
73
|
-
}
|
74
|
-
destroy(): void {
|
75
|
-
return this.db.destroy()
|
76
|
-
}
|
77
|
-
session(): SqliteDbSession {
|
78
|
-
return this.db.session()
|
79
|
-
}
|
80
|
-
makeChangeset(data: Uint8Array): SqliteDbChangeset {
|
81
|
-
return this.db.makeChangeset(data)
|
82
|
-
}
|
83
57
|
|
84
58
|
txn<TRes>(callback: () => TRes): TRes {
|
85
59
|
this.execute(sql`begin transaction;`)
|
@@ -147,13 +121,9 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
147
121
|
|
148
122
|
execute(
|
149
123
|
queryStr: string,
|
150
|
-
bindValues?: PreparedBindValues
|
151
|
-
|
152
|
-
|
153
|
-
otelContext?: otel.Context
|
154
|
-
writeTables?: ReadonlySet<string>
|
155
|
-
onRowsChanged?: (rowsChanged: number) => void
|
156
|
-
},
|
124
|
+
bindValues?: PreparedBindValues,
|
125
|
+
writeTables?: ReadonlySet<string>,
|
126
|
+
options?: { hasNoEffects?: boolean; otelContext?: otel.Context },
|
157
127
|
): { durationMs: number } {
|
158
128
|
// console.debug('in-memory-db:execute', query, bindValues)
|
159
129
|
|
@@ -174,7 +144,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
174
144
|
if (options?.hasNoEffects !== true && !this.resultCache.ignoreQuery(queryStr)) {
|
175
145
|
// TODO use write tables instead
|
176
146
|
// check what queries actually end up here.
|
177
|
-
this.resultCache.invalidate(
|
147
|
+
this.resultCache.invalidate(writeTables ?? this.getTablesUsed(queryStr))
|
178
148
|
}
|
179
149
|
|
180
150
|
span.end()
|
@@ -202,14 +172,14 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
202
172
|
|
203
173
|
select<T = any>(
|
204
174
|
queryStr: string,
|
205
|
-
bindValues?: PreparedBindValues | undefined,
|
206
175
|
options?: {
|
207
176
|
queriedTables?: ReadonlySet<string>
|
177
|
+
bindValues?: PreparedBindValues
|
208
178
|
skipCache?: boolean
|
209
179
|
otelContext?: otel.Context
|
210
180
|
},
|
211
181
|
): ReadonlyArray<T> {
|
212
|
-
const { queriedTables, skipCache = false, otelContext } = options ?? {}
|
182
|
+
const { queriedTables, bindValues, skipCache = false, otelContext } = options ?? {}
|
213
183
|
|
214
184
|
// console.debug('in-memory-db:select', query, bindValues)
|
215
185
|
|
@@ -282,7 +252,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
282
252
|
}
|
283
253
|
|
284
254
|
/** Set up SQLite performance; hasn't been super carefully optimized yet. */
|
285
|
-
const configureSQLite = (db:
|
255
|
+
const configureSQLite = (db: SynchronousDatabaseWrapper) => {
|
286
256
|
db.execute(
|
287
257
|
// TODO: revisit these tuning parameters for max performance
|
288
258
|
sql`
|
package/src/effect/LiveStore.ts
CHANGED
@@ -5,26 +5,20 @@ import { Context, Deferred, Duration, Effect, Layer, pipe } from '@livestore/uti
|
|
5
5
|
import type * as otel from '@opentelemetry/api'
|
6
6
|
import type { GraphQLSchema } from 'graphql'
|
7
7
|
|
8
|
-
import type { SqliteDbWrapper } from '../SqliteDbWrapper.js'
|
9
8
|
import { createStore } from '../store/create-store.js'
|
10
9
|
import type { Store } from '../store/store.js'
|
11
10
|
import type { BaseGraphQLContext, LiveStoreContextRunning as LiveStoreContextRunning_ } from '../store/store-types.js'
|
11
|
+
import type { SynchronousDatabaseWrapper } from '../SynchronousDatabaseWrapper.js'
|
12
12
|
|
13
|
-
export
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
static fromDeferred = Effect.gen(function* () {
|
18
|
-
const deferred = yield* DeferredStoreContext
|
19
|
-
const ctx = yield* deferred
|
20
|
-
return Layer.succeed(LiveStoreContextRunning, ctx)
|
21
|
-
}).pipe(Layer.unwrapScoped)
|
22
|
-
}
|
13
|
+
export type LiveStoreContextRunning = LiveStoreContextRunning_
|
14
|
+
export const LiveStoreContextRunning = Context.GenericTag<LiveStoreContextRunning>(
|
15
|
+
'@livestore/livestore/effect/LiveStoreContextRunning',
|
16
|
+
)
|
23
17
|
|
24
|
-
export
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
export type DeferredStoreContext = Deferred.Deferred<LiveStoreContextRunning, UnexpectedError>
|
19
|
+
export const DeferredStoreContext = Context.GenericTag<DeferredStoreContext>(
|
20
|
+
'@livestore/livestore/effect/DeferredStoreContext',
|
21
|
+
)
|
28
22
|
|
29
23
|
export type LiveStoreContextProps<GraphQLContext extends BaseGraphQLContext> = {
|
30
24
|
schema: LiveStoreSchema
|
@@ -39,11 +33,9 @@ export type LiveStoreContextProps<GraphQLContext extends BaseGraphQLContext> = {
|
|
39
33
|
storeId?: string
|
40
34
|
graphQLOptions?: {
|
41
35
|
schema: Effect.Effect<GraphQLSchema, never, OtelTracer.OtelTracer>
|
42
|
-
makeContext: (db:
|
36
|
+
makeContext: (db: SynchronousDatabaseWrapper, tracer: otel.Tracer, sessionId: string) => GraphQLContext
|
43
37
|
}
|
44
|
-
boot?: (
|
45
|
-
store: Store<GraphQLContext, LiveStoreSchema>,
|
46
|
-
) => Effect.Effect<void, unknown, OtelTracer.OtelTracer | LiveStoreContextRunning>
|
38
|
+
boot?: (store: Store<GraphQLContext, LiveStoreSchema>) => Effect.Effect<void, unknown, OtelTracer.OtelTracer>
|
47
39
|
adapter: Adapter
|
48
40
|
disableDevtools?: boolean
|
49
41
|
onBootStatus?: (status: BootStatus) => void
|
@@ -60,7 +52,7 @@ export const LiveStoreContextLayer = <GraphQLContext extends BaseGraphQLContext>
|
|
60
52
|
|
61
53
|
export const LiveStoreContextDeferred = Layer.effect(
|
62
54
|
DeferredStoreContext,
|
63
|
-
Deferred.make<LiveStoreContextRunning
|
55
|
+
Deferred.make<LiveStoreContextRunning, UnexpectedError>(),
|
64
56
|
)
|
65
57
|
|
66
58
|
export const makeLiveStoreContext = <GraphQLContext extends BaseGraphQLContext>({
|
@@ -73,7 +65,7 @@ export const makeLiveStoreContext = <GraphQLContext extends BaseGraphQLContext>(
|
|
73
65
|
onBootStatus,
|
74
66
|
batchUpdates,
|
75
67
|
}: LiveStoreContextProps<GraphQLContext>): Effect.Effect<
|
76
|
-
LiveStoreContextRunning
|
68
|
+
LiveStoreContextRunning,
|
77
69
|
UnexpectedError | Cause.TimeoutException,
|
78
70
|
DeferredStoreContext | Scope.Scope | OtelTracer.OtelTracer
|
79
71
|
> =>
|
@@ -95,12 +87,9 @@ export const makeLiveStoreContext = <GraphQLContext extends BaseGraphQLContext>(
|
|
95
87
|
})
|
96
88
|
|
97
89
|
globalThis.__debugLiveStore ??= {}
|
98
|
-
|
99
|
-
globalThis.__debugLiveStore['_'] = store
|
100
|
-
}
|
101
|
-
globalThis.__debugLiveStore[storeId] = store
|
90
|
+
// window.__debugLiveStore[schema.key] = store
|
102
91
|
|
103
|
-
return { stage: 'running', store } satisfies LiveStoreContextRunning
|
92
|
+
return { stage: 'running', store } satisfies LiveStoreContextRunning
|
104
93
|
}),
|
105
94
|
Effect.tapErrorCause((cause) => Effect.flatMap(DeferredStoreContext, (def) => Deferred.failCause(def, cause))),
|
106
95
|
Effect.tap((storeCtx) => Effect.flatMap(DeferredStoreContext, (def) => Deferred.succeed(def, storeCtx))),
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
*
|
3
|
+
* LiveStore currently relies on some global state in order to simplify the end-user API.
|
4
|
+
* This however also has the downside that LiveStore can't be used in multiple instances in the same app.
|
5
|
+
* It could possibly also lead to some other problems.
|
6
|
+
*
|
7
|
+
* We should find some better way to do this and ideally remove this global state.
|
8
|
+
*
|
9
|
+
* Another approach could be to use the global state by default but provide an additional way to let the user
|
10
|
+
* explicitly pass instances of state below into the LiveStore constructors.
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
import { GlobalValue } from '@livestore/utils/effect'
|
15
|
+
|
16
|
+
import { makeReactivityGraph } from './live-queries/base-class.js'
|
17
|
+
|
18
|
+
export const globalReactivityGraph = GlobalValue.globalValue('livestore-global-reactivityGraph', () =>
|
19
|
+
makeReactivityGraph(),
|
20
|
+
)
|
package/src/index.ts
CHANGED
@@ -8,15 +8,10 @@ export type {
|
|
8
8
|
OtelOptions,
|
9
9
|
} from './store/store-types.js'
|
10
10
|
|
11
|
-
export {
|
12
|
-
|
13
|
-
StoreInterrupted,
|
14
|
-
type LiveStoreContext,
|
15
|
-
type ShutdownDeferred,
|
16
|
-
type LiveStoreContextRunning,
|
17
|
-
} from './store/store-types.js'
|
11
|
+
export type { LiveStoreContextRunning } from './effect/LiveStore.js'
|
12
|
+
export { StoreAbort, StoreInterrupted, type LiveStoreContext, type ShutdownDeferred } from './store/store-types.js'
|
18
13
|
|
19
|
-
export {
|
14
|
+
export { SynchronousDatabaseWrapper, emptyDebugInfo } from './SynchronousDatabaseWrapper.js'
|
20
15
|
|
21
16
|
export type {
|
22
17
|
GetAtom,
|
@@ -31,9 +26,8 @@ export type {
|
|
31
26
|
Effect,
|
32
27
|
} from './reactive.js'
|
33
28
|
export { LiveStoreComputedQuery, computed } from './live-queries/computed.js'
|
34
|
-
export { LiveStoreDbQuery, queryDb } from './live-queries/db
|
29
|
+
export { LiveStoreDbQuery, queryDb } from './live-queries/db.js'
|
35
30
|
export { LiveStoreGraphQLQuery, queryGraphQL } from './live-queries/graphql.js'
|
36
|
-
export { makeRef, type LiveQueryRef } from './live-queries/make-ref.js'
|
37
31
|
export {
|
38
32
|
type GetAtomResult,
|
39
33
|
type ReactivityGraph,
|
@@ -41,11 +35,10 @@ export {
|
|
41
35
|
type LiveQuery,
|
42
36
|
type GetResult,
|
43
37
|
type LiveQueryAny,
|
44
|
-
type LiveQueryDef,
|
45
|
-
type LiveQueryDefAny,
|
46
|
-
type RcRef,
|
47
38
|
} from './live-queries/base-class.js'
|
48
39
|
|
40
|
+
export { globalReactivityGraph } from './global-state.js'
|
41
|
+
|
49
42
|
export { deriveColQuery } from './row-query-utils.js'
|
50
43
|
|
51
44
|
export * from '@livestore/common/schema'
|
@@ -53,7 +46,7 @@ export {
|
|
53
46
|
sql,
|
54
47
|
SessionIdSymbol,
|
55
48
|
type BootStatus,
|
56
|
-
type
|
49
|
+
type SynchronousDatabase,
|
57
50
|
type DebugInfo,
|
58
51
|
type MutableDebugInfo,
|
59
52
|
prepareBindValues,
|
@@ -21,6 +21,9 @@ exports[`otel > otel 3`] = `
|
|
21
21
|
",
|
22
22
|
},
|
23
23
|
},
|
24
|
+
{
|
25
|
+
"_name": "LiveStore:createStore",
|
26
|
+
},
|
24
27
|
{
|
25
28
|
"_name": "LiveStore:sync",
|
26
29
|
},
|
@@ -30,17 +33,22 @@ exports[`otel > otel 3`] = `
|
|
30
33
|
{
|
31
34
|
"_name": "LiveStore:mutate",
|
32
35
|
"attributes": {
|
33
|
-
"livestore.
|
34
|
-
"livestore.RawSql",
|
35
|
-
],
|
36
|
-
"livestore.mutationEventsCount": 1,
|
36
|
+
"livestore.mutateLabel": "mutate",
|
37
37
|
},
|
38
38
|
"children": [
|
39
39
|
{
|
40
|
-
"_name": "
|
40
|
+
"_name": "LiveStore:mutate:applyMutations",
|
41
41
|
"attributes": {
|
42
|
-
"
|
42
|
+
"livestore.mutateLabel": "mutate",
|
43
43
|
},
|
44
|
+
"children": [
|
45
|
+
{
|
46
|
+
"_name": "livestore.in-memory-db:execute",
|
47
|
+
"attributes": {
|
48
|
+
"sql.query": "INSERT INTO todos (id, text, completed) VALUES ('t1', 'buy milk', 0)",
|
49
|
+
},
|
50
|
+
},
|
51
|
+
],
|
44
52
|
},
|
45
53
|
],
|
46
54
|
},
|
@@ -89,179 +97,7 @@ exports[`otel > otel 3`] = `
|
|
89
97
|
}
|
90
98
|
`;
|
91
99
|
|
92
|
-
exports[`otel > with thunks 1`] = `
|
93
|
-
{
|
94
|
-
"atoms": [
|
95
|
-
{
|
96
|
-
"_tag": "ref",
|
97
|
-
"id": "node-1",
|
98
|
-
"isDestroyed": false,
|
99
|
-
"isDirty": false,
|
100
|
-
"label": "tableRef:todos",
|
101
|
-
"meta": {
|
102
|
-
"liveStoreRefType": "table",
|
103
|
-
},
|
104
|
-
"previousResult": {
|
105
|
-
"_tag": "Some",
|
106
|
-
"value": "null",
|
107
|
-
},
|
108
|
-
"refreshes": 0,
|
109
|
-
"sub": [],
|
110
|
-
"super": [],
|
111
|
-
},
|
112
|
-
{
|
113
|
-
"_tag": "ref",
|
114
|
-
"id": "node-2",
|
115
|
-
"isDestroyed": false,
|
116
|
-
"isDirty": false,
|
117
|
-
"label": "tableRef:app",
|
118
|
-
"meta": {
|
119
|
-
"liveStoreRefType": "table",
|
120
|
-
},
|
121
|
-
"previousResult": {
|
122
|
-
"_tag": "Some",
|
123
|
-
"value": "null",
|
124
|
-
},
|
125
|
-
"refreshes": 0,
|
126
|
-
"sub": [],
|
127
|
-
"super": [],
|
128
|
-
},
|
129
|
-
],
|
130
|
-
"deferredEffects": [],
|
131
|
-
"effects": [],
|
132
|
-
}
|
133
|
-
`;
|
134
|
-
|
135
100
|
exports[`otel > with thunks 3`] = `
|
136
|
-
{
|
137
|
-
"atoms": [
|
138
|
-
{
|
139
|
-
"_tag": "ref",
|
140
|
-
"id": "node-1",
|
141
|
-
"isDestroyed": false,
|
142
|
-
"isDirty": false,
|
143
|
-
"label": "tableRef:todos",
|
144
|
-
"meta": {
|
145
|
-
"liveStoreRefType": "table",
|
146
|
-
},
|
147
|
-
"previousResult": {
|
148
|
-
"_tag": "Some",
|
149
|
-
"value": "null",
|
150
|
-
},
|
151
|
-
"refreshes": 0,
|
152
|
-
"sub": [],
|
153
|
-
"super": [],
|
154
|
-
},
|
155
|
-
{
|
156
|
-
"_tag": "ref",
|
157
|
-
"id": "node-2",
|
158
|
-
"isDestroyed": false,
|
159
|
-
"isDirty": false,
|
160
|
-
"label": "tableRef:app",
|
161
|
-
"meta": {
|
162
|
-
"liveStoreRefType": "table",
|
163
|
-
},
|
164
|
-
"previousResult": {
|
165
|
-
"_tag": "Some",
|
166
|
-
"value": "null",
|
167
|
-
},
|
168
|
-
"refreshes": 0,
|
169
|
-
"sub": [],
|
170
|
-
"super": [],
|
171
|
-
},
|
172
|
-
],
|
173
|
-
"deferredEffects": [],
|
174
|
-
"effects": [],
|
175
|
-
}
|
176
|
-
`;
|
177
|
-
|
178
|
-
exports[`otel > with thunks 4`] = `
|
179
|
-
{
|
180
|
-
"atoms": [
|
181
|
-
{
|
182
|
-
"_tag": "ref",
|
183
|
-
"id": "node-1",
|
184
|
-
"isDestroyed": false,
|
185
|
-
"isDirty": false,
|
186
|
-
"label": "tableRef:todos",
|
187
|
-
"meta": {
|
188
|
-
"liveStoreRefType": "table",
|
189
|
-
},
|
190
|
-
"previousResult": {
|
191
|
-
"_tag": "Some",
|
192
|
-
"value": "null",
|
193
|
-
},
|
194
|
-
"refreshes": 1,
|
195
|
-
"sub": [],
|
196
|
-
"super": [],
|
197
|
-
},
|
198
|
-
{
|
199
|
-
"_tag": "ref",
|
200
|
-
"id": "node-2",
|
201
|
-
"isDestroyed": false,
|
202
|
-
"isDirty": false,
|
203
|
-
"label": "tableRef:app",
|
204
|
-
"meta": {
|
205
|
-
"liveStoreRefType": "table",
|
206
|
-
},
|
207
|
-
"previousResult": {
|
208
|
-
"_tag": "Some",
|
209
|
-
"value": "null",
|
210
|
-
},
|
211
|
-
"refreshes": 0,
|
212
|
-
"sub": [],
|
213
|
-
"super": [],
|
214
|
-
},
|
215
|
-
],
|
216
|
-
"deferredEffects": [],
|
217
|
-
"effects": [],
|
218
|
-
}
|
219
|
-
`;
|
220
|
-
|
221
|
-
exports[`otel > with thunks 6`] = `
|
222
|
-
{
|
223
|
-
"atoms": [
|
224
|
-
{
|
225
|
-
"_tag": "ref",
|
226
|
-
"id": "node-1",
|
227
|
-
"isDestroyed": false,
|
228
|
-
"isDirty": false,
|
229
|
-
"label": "tableRef:todos",
|
230
|
-
"meta": {
|
231
|
-
"liveStoreRefType": "table",
|
232
|
-
},
|
233
|
-
"previousResult": {
|
234
|
-
"_tag": "Some",
|
235
|
-
"value": "null",
|
236
|
-
},
|
237
|
-
"refreshes": 1,
|
238
|
-
"sub": [],
|
239
|
-
"super": [],
|
240
|
-
},
|
241
|
-
{
|
242
|
-
"_tag": "ref",
|
243
|
-
"id": "node-2",
|
244
|
-
"isDestroyed": false,
|
245
|
-
"isDirty": false,
|
246
|
-
"label": "tableRef:app",
|
247
|
-
"meta": {
|
248
|
-
"liveStoreRefType": "table",
|
249
|
-
},
|
250
|
-
"previousResult": {
|
251
|
-
"_tag": "Some",
|
252
|
-
"value": "null",
|
253
|
-
},
|
254
|
-
"refreshes": 0,
|
255
|
-
"sub": [],
|
256
|
-
"super": [],
|
257
|
-
},
|
258
|
-
],
|
259
|
-
"deferredEffects": [],
|
260
|
-
"effects": [],
|
261
|
-
}
|
262
|
-
`;
|
263
|
-
|
264
|
-
exports[`otel > with thunks 7`] = `
|
265
101
|
{
|
266
102
|
"_name": "createStore",
|
267
103
|
"attributes": {
|
@@ -282,6 +118,9 @@ exports[`otel > with thunks 7`] = `
|
|
282
118
|
",
|
283
119
|
},
|
284
120
|
},
|
121
|
+
{
|
122
|
+
"_name": "LiveStore:createStore",
|
123
|
+
},
|
285
124
|
{
|
286
125
|
"_name": "LiveStore:sync",
|
287
126
|
},
|
@@ -291,17 +130,22 @@ exports[`otel > with thunks 7`] = `
|
|
291
130
|
{
|
292
131
|
"_name": "LiveStore:mutate",
|
293
132
|
"attributes": {
|
294
|
-
"livestore.
|
295
|
-
"livestore.RawSql",
|
296
|
-
],
|
297
|
-
"livestore.mutationEventsCount": 1,
|
133
|
+
"livestore.mutateLabel": "mutate",
|
298
134
|
},
|
299
135
|
"children": [
|
300
136
|
{
|
301
|
-
"_name": "
|
137
|
+
"_name": "LiveStore:mutate:applyMutations",
|
302
138
|
"attributes": {
|
303
|
-
"
|
139
|
+
"livestore.mutateLabel": "mutate",
|
304
140
|
},
|
141
|
+
"children": [
|
142
|
+
{
|
143
|
+
"_name": "livestore.in-memory-db:execute",
|
144
|
+
"attributes": {
|
145
|
+
"sql.query": "INSERT INTO todos (id, text, completed) VALUES ('t1', 'buy milk', 0)",
|
146
|
+
},
|
147
|
+
},
|
148
|
+
],
|
305
149
|
},
|
306
150
|
],
|
307
151
|
},
|
@@ -337,9 +181,6 @@ exports[`otel > with thunks 7`] = `
|
|
337
181
|
"sql.rowsCount": 1,
|
338
182
|
},
|
339
183
|
"children": [
|
340
|
-
{
|
341
|
-
"_name": "js:where-filter",
|
342
|
-
},
|
343
184
|
{
|
344
185
|
"_name": "sql-in-memory-select",
|
345
186
|
"attributes": {
|
@@ -377,6 +218,9 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
|
|
377
218
|
",
|
378
219
|
},
|
379
220
|
},
|
221
|
+
{
|
222
|
+
"_name": "LiveStore:createStore",
|
223
|
+
},
|
380
224
|
{
|
381
225
|
"_name": "LiveStore:sync",
|
382
226
|
},
|
@@ -386,17 +230,22 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
|
|
386
230
|
{
|
387
231
|
"_name": "LiveStore:mutate",
|
388
232
|
"attributes": {
|
389
|
-
"livestore.
|
390
|
-
"livestore.RawSql",
|
391
|
-
],
|
392
|
-
"livestore.mutationEventsCount": 1,
|
233
|
+
"livestore.mutateLabel": "mutate",
|
393
234
|
},
|
394
235
|
"children": [
|
395
236
|
{
|
396
|
-
"_name": "
|
237
|
+
"_name": "LiveStore:mutate:applyMutations",
|
397
238
|
"attributes": {
|
398
|
-
"
|
239
|
+
"livestore.mutateLabel": "mutate",
|
399
240
|
},
|
241
|
+
"children": [
|
242
|
+
{
|
243
|
+
"_name": "livestore.in-memory-db:execute",
|
244
|
+
"attributes": {
|
245
|
+
"sql.query": "INSERT INTO todos (id, text, completed) VALUES ('t1', 'buy milk', 0)",
|
246
|
+
},
|
247
|
+
},
|
248
|
+
],
|
400
249
|
},
|
401
250
|
],
|
402
251
|
},
|
@@ -432,9 +281,6 @@ exports[`otel > with thunks with query builder and without labels 3`] = `
|
|
432
281
|
"sql.rowsCount": 1,
|
433
282
|
},
|
434
283
|
"children": [
|
435
|
-
{
|
436
|
-
"_name": "js:() => ({ completed: false })",
|
437
|
-
},
|
438
284
|
{
|
439
285
|
"_name": "sql-in-memory-select",
|
440
286
|
"attributes": {
|