@livestore/livestore 0.4.0-dev.22 → 0.4.0-dev.23
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 +0 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/QueryCache.js +1 -1
- package/dist/QueryCache.js.map +1 -1
- package/dist/SqliteDbWrapper.d.ts +5 -5
- package/dist/SqliteDbWrapper.d.ts.map +1 -1
- package/dist/SqliteDbWrapper.js +8 -8
- package/dist/SqliteDbWrapper.js.map +1 -1
- package/dist/SqliteDbWrapper.test.js +2 -2
- package/dist/SqliteDbWrapper.test.js.map +1 -1
- package/dist/effect/LiveStore.d.ts +14 -7
- package/dist/effect/LiveStore.d.ts.map +1 -1
- package/dist/effect/LiveStore.js +0 -15
- package/dist/effect/LiveStore.js.map +1 -1
- package/dist/effect/LiveStore.test.d.ts +2 -0
- package/dist/effect/LiveStore.test.d.ts.map +1 -0
- package/dist/effect/LiveStore.test.js +42 -0
- package/dist/effect/LiveStore.test.js.map +1 -0
- package/dist/live-queries/base-class.d.ts +3 -3
- package/dist/live-queries/base-class.d.ts.map +1 -1
- package/dist/live-queries/base-class.js +2 -2
- package/dist/live-queries/base-class.js.map +1 -1
- package/dist/live-queries/client-document-get-query.d.ts +1 -1
- package/dist/live-queries/client-document-get-query.d.ts.map +1 -1
- package/dist/live-queries/client-document-get-query.js +1 -1
- package/dist/live-queries/client-document-get-query.js.map +1 -1
- package/dist/live-queries/computed.d.ts.map +1 -1
- package/dist/live-queries/computed.js +2 -2
- package/dist/live-queries/computed.js.map +1 -1
- package/dist/live-queries/db-query.js +14 -14
- package/dist/live-queries/db-query.js.map +1 -1
- package/dist/live-queries/db-query.test.js +2 -2
- package/dist/live-queries/db-query.test.js.map +1 -1
- package/dist/live-queries/signal.test.js +2 -2
- package/dist/live-queries/signal.test.js.map +1 -1
- package/dist/mod.d.ts +1 -1
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js.map +1 -1
- package/dist/reactive.d.ts +9 -9
- package/dist/reactive.d.ts.map +1 -1
- package/dist/reactive.js +9 -26
- package/dist/reactive.js.map +1 -1
- package/dist/reactive.test.js +2 -2
- package/dist/reactive.test.js.map +1 -1
- package/dist/store/StoreRegistry.d.ts +30 -5
- package/dist/store/StoreRegistry.d.ts.map +1 -1
- package/dist/store/StoreRegistry.js +54 -31
- package/dist/store/StoreRegistry.js.map +1 -1
- package/dist/store/StoreRegistry.test.js +251 -250
- package/dist/store/StoreRegistry.test.js.map +1 -1
- package/dist/store/create-store.d.ts +6 -2
- package/dist/store/create-store.d.ts.map +1 -1
- package/dist/store/create-store.js +13 -7
- package/dist/store/create-store.js.map +1 -1
- package/dist/store/devtools.d.ts +1 -1
- 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/store-eventstream.test.js +2 -2
- package/dist/store/store-eventstream.test.js.map +1 -1
- package/dist/store/store-types.d.ts +70 -5
- package/dist/store/store-types.d.ts.map +1 -1
- package/dist/store/store-types.js.map +1 -1
- package/dist/store/store-types.test.js +1 -1
- package/dist/store/store-types.test.js.map +1 -1
- package/dist/store/store.d.ts +81 -2
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +128 -45
- package/dist/store/store.js.map +1 -1
- package/dist/utils/dev.js.map +1 -1
- package/dist/utils/stack-info.js +2 -2
- package/dist/utils/stack-info.js.map +1 -1
- package/dist/utils/tests/fixture.d.ts +1 -1
- package/dist/utils/tests/fixture.d.ts.map +1 -1
- package/dist/utils/tests/fixture.js.map +1 -1
- package/dist/utils/tests/otel.d.ts.map +1 -1
- package/dist/utils/tests/otel.js +5 -5
- package/dist/utils/tests/otel.js.map +1 -1
- package/package.json +58 -17
- package/src/QueryCache.ts +1 -1
- package/src/SqliteDbWrapper.test.ts +4 -2
- package/src/SqliteDbWrapper.ts +12 -11
- package/src/ambient.d.ts +0 -7
- package/src/effect/LiveStore.test.ts +61 -0
- package/src/effect/LiveStore.ts +17 -26
- package/src/live-queries/__snapshots__/db-query.test.ts.snap +336 -231
- package/src/live-queries/base-class.ts +7 -6
- package/src/live-queries/client-document-get-query.ts +4 -2
- package/src/live-queries/computed.ts +3 -2
- package/src/live-queries/db-query.test.ts +3 -2
- package/src/live-queries/db-query.ts +15 -15
- package/src/live-queries/signal.test.ts +3 -2
- package/src/mod.ts +1 -0
- package/src/reactive.test.ts +3 -2
- package/src/reactive.ts +22 -23
- package/src/store/StoreRegistry.test.ts +317 -293
- package/src/store/StoreRegistry.ts +63 -38
- package/src/store/create-store.ts +26 -11
- package/src/store/devtools.ts +5 -6
- package/src/store/store-eventstream.test.ts +4 -2
- package/src/store/store-types.test.ts +3 -1
- package/src/store/store-types.ts +47 -8
- package/src/store/store.ts +172 -55
- package/src/utils/dev.ts +2 -2
- package/src/utils/stack-info.ts +2 -2
- package/src/utils/tests/fixture.ts +2 -1
- package/src/utils/tests/otel.ts +8 -7
- package/docs/api/index.md +0 -3
- package/docs/building-with-livestore/complex-ui-state/index.md +0 -3
- package/docs/building-with-livestore/crud/index.md +0 -3
- package/docs/building-with-livestore/data-modeling/index.md +0 -30
- package/docs/building-with-livestore/debugging/index.md +0 -17
- package/docs/building-with-livestore/devtools/index.md +0 -79
- package/docs/building-with-livestore/events/index.md +0 -355
- package/docs/building-with-livestore/examples/ai-agent/index.md +0 -5
- package/docs/building-with-livestore/examples/todo-workspaces/index.md +0 -885
- package/docs/building-with-livestore/examples/turnbased-game/index.md +0 -7
- package/docs/building-with-livestore/opentelemetry/index.md +0 -227
- package/docs/building-with-livestore/production-checklist/index.md +0 -5
- package/docs/building-with-livestore/reactivity-system/index.md +0 -202
- package/docs/building-with-livestore/rules-for-ai-agents/index.md +0 -9
- package/docs/building-with-livestore/state/materializers/index.md +0 -300
- package/docs/building-with-livestore/state/sql-queries/index.md +0 -94
- package/docs/building-with-livestore/state/sqlite/index.md +0 -45
- package/docs/building-with-livestore/state/sqlite-schema/index.md +0 -306
- package/docs/building-with-livestore/state/sqlite-schema-effect/index.md +0 -300
- package/docs/building-with-livestore/store/index.md +0 -625
- package/docs/building-with-livestore/syncing/index.md +0 -136
- package/docs/building-with-livestore/tools/cli/index.md +0 -177
- package/docs/building-with-livestore/tools/mcp/index.md +0 -187
- package/docs/examples/cloudflare-adapter/index.md +0 -44
- package/docs/examples/expo-adapter/index.md +0 -44
- package/docs/examples/index.md +0 -55
- package/docs/examples/node-adapter/index.md +0 -44
- package/docs/examples/web-adapter/index.md +0 -52
- package/docs/framework-integrations/custom-elements/index.md +0 -142
- package/docs/framework-integrations/react-integration/index.md +0 -937
- package/docs/framework-integrations/solid-integration/index.md +0 -293
- package/docs/framework-integrations/svelte-integration/index.md +0 -42
- package/docs/framework-integrations/vue-integration/index.md +0 -294
- package/docs/getting-started/expo/index.md +0 -882
- package/docs/getting-started/node/index.md +0 -115
- package/docs/getting-started/react-web/index.md +0 -626
- package/docs/getting-started/solid/index.md +0 -3
- package/docs/getting-started/vue/index.md +0 -471
- package/docs/index.md +0 -208
- package/docs/llms.txt +0 -146
- package/docs/misc/CODE_OF_CONDUCT/index.md +0 -133
- package/docs/misc/FAQ/index.md +0 -37
- package/docs/misc/community/index.md +0 -88
- package/docs/misc/credits/index.md +0 -14
- package/docs/misc/design-partners/index.md +0 -13
- package/docs/misc/package-management/index.md +0 -21
- package/docs/misc/performance/index.md +0 -25
- package/docs/misc/resources/index.md +0 -46
- package/docs/misc/state-of-the-project/index.md +0 -37
- package/docs/misc/troubleshooting/index.md +0 -82
- package/docs/overview/concepts/index.md +0 -78
- package/docs/overview/how-livestore-works/index.md +0 -56
- package/docs/overview/introduction/index.md +0 -413
- package/docs/overview/technology-comparison/index.md +0 -40
- package/docs/overview/when-livestore/index.md +0 -81
- package/docs/overview/why-livestore/index.md +0 -111
- package/docs/patterns/ai/index.md +0 -15
- package/docs/patterns/anonymous-user-transition/index.md +0 -10
- package/docs/patterns/app-evolution/index.md +0 -72
- package/docs/patterns/auth/index.md +0 -377
- package/docs/patterns/effect/index.md +0 -1505
- package/docs/patterns/encryption/index.md +0 -6
- package/docs/patterns/external-data/index.md +0 -5
- package/docs/patterns/file-management/index.md +0 -11
- package/docs/patterns/file-structure/index.md +0 -14
- package/docs/patterns/list-ordering/index.md +0 -369
- package/docs/patterns/offline/index.md +0 -32
- package/docs/patterns/orm/index.md +0 -18
- package/docs/patterns/presence/index.md +0 -11
- package/docs/patterns/rich-text-editing/index.md +0 -11
- package/docs/patterns/server-side-clients/index.md +0 -97
- package/docs/patterns/side-effects/index.md +0 -11
- package/docs/patterns/state-machines/index.md +0 -11
- package/docs/patterns/storybook/index.md +0 -209
- package/docs/patterns/undo-redo/index.md +0 -9
- package/docs/patterns/version-control/index.md +0 -8
- package/docs/platform-adapters/cloudflare-durable-object-adapter/index.md +0 -453
- package/docs/platform-adapters/electron-adapter/index.md +0 -15
- package/docs/platform-adapters/expo-adapter/index.md +0 -262
- package/docs/platform-adapters/node-adapter/index.md +0 -160
- package/docs/platform-adapters/tauri-adapter/index.md +0 -15
- package/docs/platform-adapters/web-adapter/index.md +0 -287
- package/docs/sustainable-open-source/contributing/docs/index.md +0 -94
- package/docs/sustainable-open-source/contributing/info/index.md +0 -63
- package/docs/sustainable-open-source/contributing/monorepo/index.md +0 -195
- package/docs/sustainable-open-source/sponsoring/index.md +0 -104
- package/docs/sync-providers/cloudflare/index.md +0 -773
- package/docs/sync-providers/custom/index.md +0 -65
- package/docs/sync-providers/electricsql/index.md +0 -159
- package/docs/sync-providers/s2/index.md +0 -230
- package/docs/tutorial/0-welcome/index.md +0 -48
- package/docs/tutorial/1-setup-starter-project/index.md +0 -105
- package/docs/tutorial/2-deploy-to-cloudflare/index.md +0 -195
- package/docs/tutorial/3-read-and-write-todos-via-livestore/index.md +0 -530
- package/docs/tutorial/4-sync-data-via-cloudflare/index.md +0 -210
- package/docs/tutorial/5-expand-business-logic/index.md +0 -174
- package/docs/tutorial/6-persist-ui-state/index.md +0 -453
- package/docs/tutorial/7-next-steps/index.md +0 -22
- package/docs/understanding-livestore/design-decisions/index.md +0 -33
- package/docs/understanding-livestore/event-sourcing/index.md +0 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otel.js","sourceRoot":"","sources":["../../../src/utils/tests/otel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"otel.js","sourceRoot":"","sources":["../../../src/utils/tests/otel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAMlD,MAAM,wBAAwB,GAAG,CAC/B,QAA8B,EAC9B,YAAoB,EACpB,aAAsD,EAC9B,EAAE;IAC1B,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,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAA;QAC1D,MAAM,UAAU,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAC9E,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAA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AAK,CAAC,EAAE;6BACjD,CAAC,CAAC;4BACH,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,IAAI,CAAC;4BACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,IAAI,CAAC;4BAChD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,CAAC;4BAC9C,MAAM,EAAE;gCACN,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;gCACtB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE;6BACnC;yBACF,CAAC,CAAC;wBACH,sBAAsB,EAAE;4BACtB,IAAI,EAAE,WAAW;4BACjB,OAAO,EAAE,EAAE;yBACZ;qBACF;iBACF;aACF;SACF;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/livestore",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.23",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/livestorejs/livestore.git"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"package.json",
|
|
12
|
+
"src",
|
|
13
|
+
"docs"
|
|
14
|
+
],
|
|
4
15
|
"type": "module",
|
|
5
16
|
"sideEffects": false,
|
|
6
17
|
"exports": {
|
|
@@ -9,29 +20,59 @@
|
|
|
9
20
|
"./internal/testing-utils": "./dist/utils/tests/mod.js",
|
|
10
21
|
"./effect": "./dist/effect/mod.js"
|
|
11
22
|
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
12
26
|
"dependencies": {
|
|
13
27
|
"@opentelemetry/api": "1.9.0",
|
|
14
|
-
"@livestore/common": "0.4.0-dev.
|
|
15
|
-
"@livestore/utils": "0.4.0-dev.
|
|
28
|
+
"@livestore/common": "^0.4.0-dev.23",
|
|
29
|
+
"@livestore/utils": "^0.4.0-dev.23"
|
|
16
30
|
},
|
|
17
31
|
"devDependencies": {
|
|
18
32
|
"@opentelemetry/sdk-trace-base": "2.2.0",
|
|
19
|
-
"jsdom": "
|
|
20
|
-
"typescript": "5.9.
|
|
21
|
-
"vite": "7.
|
|
33
|
+
"jsdom": "26.1.0",
|
|
34
|
+
"typescript": "5.9.3",
|
|
35
|
+
"vite": "7.3.1",
|
|
22
36
|
"vitest": "3.2.4",
|
|
23
|
-
"@livestore/
|
|
24
|
-
"@livestore/
|
|
37
|
+
"@livestore/adapter-web": "^0.4.0-dev.23",
|
|
38
|
+
"@livestore/utils-dev": "^0.4.0-dev.23"
|
|
25
39
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@effect/ai": "^0.35.0",
|
|
42
|
+
"@effect/cli": "^0.75.1",
|
|
43
|
+
"@effect/cluster": "^0.58.2",
|
|
44
|
+
"@effect/experimental": "^0.60.0",
|
|
45
|
+
"@effect/opentelemetry": "^0.63.0",
|
|
46
|
+
"@effect/platform": "^0.96.1",
|
|
47
|
+
"@effect/platform-browser": "^0.76.0",
|
|
48
|
+
"@effect/platform-bun": "^0.89.0",
|
|
49
|
+
"@effect/platform-node": "^0.106.0",
|
|
50
|
+
"@effect/printer": "^0.49.0",
|
|
51
|
+
"@effect/printer-ansi": "^0.49.0",
|
|
52
|
+
"@effect/rpc": "^0.75.1",
|
|
53
|
+
"@effect/sql": "^0.51.1",
|
|
54
|
+
"@effect/typeclass": "^0.40.0",
|
|
55
|
+
"@effect/vitest": "^0.29.0",
|
|
56
|
+
"@opentelemetry/api": "^1.9.0",
|
|
57
|
+
"@opentelemetry/resources": "^2.2.0",
|
|
58
|
+
"@standard-schema/spec": "^1.1.0",
|
|
59
|
+
"effect": "^3.21.2"
|
|
60
|
+
},
|
|
61
|
+
"$genie": {
|
|
62
|
+
"source": "package.json.genie.ts",
|
|
63
|
+
"warning": "DO NOT EDIT - changes will be overwritten",
|
|
64
|
+
"workspaceClosureDirs": [
|
|
65
|
+
"packages/@livestore/adapter-web",
|
|
66
|
+
"packages/@livestore/common",
|
|
67
|
+
"packages/@livestore/common-cf",
|
|
68
|
+
"packages/@livestore/devtools-web-common",
|
|
69
|
+
"packages/@livestore/livestore",
|
|
70
|
+
"packages/@livestore/sqlite-wasm",
|
|
71
|
+
"packages/@livestore/utils",
|
|
72
|
+
"packages/@livestore/utils-dev",
|
|
73
|
+
"packages/@livestore/wa-sqlite",
|
|
74
|
+
"packages/@livestore/webmesh"
|
|
75
|
+
]
|
|
35
76
|
},
|
|
36
77
|
"scripts": {
|
|
37
78
|
"build": "tsc",
|
package/src/QueryCache.ts
CHANGED
|
@@ -27,7 +27,7 @@ export default class QueryCache {
|
|
|
27
27
|
|
|
28
28
|
const formatValue = (value: any) => (value === SessionIdSymbol ? 'SessionIdSymbol' : String(value))
|
|
29
29
|
|
|
30
|
-
if (Array.isArray(bindValues)) {
|
|
30
|
+
if (Array.isArray(bindValues) === true) {
|
|
31
31
|
return `${sql}\n${bindValues.map(formatValue).join('\n')}` as CacheKey
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Effect } from '@livestore/utils/effect'
|
|
2
|
-
import { Vitest } from '@livestore/utils-dev/node-vitest'
|
|
3
1
|
import { expect } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { Vitest } from '@livestore/utils-dev/node-vitest'
|
|
4
|
+
import { Effect } from '@livestore/utils/effect'
|
|
5
|
+
|
|
4
6
|
import { StoreInternalsSymbol } from './store/store-types.ts'
|
|
5
7
|
import { makeTodoMvc } from './utils/tests/fixture.ts'
|
|
6
8
|
|
package/src/SqliteDbWrapper.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type * as otel from '@opentelemetry/api'
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
BoundArray,
|
|
3
5
|
BoundMap,
|
|
@@ -15,7 +17,6 @@ import {
|
|
|
15
17
|
sql,
|
|
16
18
|
} from '@livestore/common'
|
|
17
19
|
import { isDevEnv, LS_DEV } from '@livestore/utils'
|
|
18
|
-
import type * as otel from '@opentelemetry/api'
|
|
19
20
|
|
|
20
21
|
import QueryCache from './QueryCache.ts'
|
|
21
22
|
|
|
@@ -103,7 +104,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
103
104
|
throw e
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
if (
|
|
107
|
+
if (errored === false) {
|
|
107
108
|
this.execute(sql`commit;`)
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -122,7 +123,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
122
123
|
|
|
123
124
|
return {
|
|
124
125
|
result,
|
|
125
|
-
changeset: changeset ? { _tag: 'sessionChangeset', data: changeset, debug: null } : { _tag: 'no-op' },
|
|
126
|
+
changeset: changeset !== undefined ? { _tag: 'sessionChangeset', data: changeset, debug: null } : { _tag: 'no-op' },
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
|
|
@@ -140,7 +141,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
const cached = this.tablesUsedCache.get(query)
|
|
143
|
-
if (cached) {
|
|
144
|
+
if (cached !== undefined) {
|
|
144
145
|
return cached
|
|
145
146
|
}
|
|
146
147
|
const stmt = this.tablesUsedStmt
|
|
@@ -161,7 +162,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
161
162
|
|
|
162
163
|
cachedExecute(
|
|
163
164
|
queryStr: string,
|
|
164
|
-
bindValues?: PreparedBindValues
|
|
165
|
+
bindValues?: PreparedBindValues ,
|
|
165
166
|
options?: {
|
|
166
167
|
hasNoEffects?: boolean
|
|
167
168
|
otelContext?: otel.Context
|
|
@@ -186,7 +187,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
186
187
|
|
|
187
188
|
stmt.execute(bindValues)
|
|
188
189
|
|
|
189
|
-
if (options?.hasNoEffects !== true &&
|
|
190
|
+
if (options?.hasNoEffects !== true && this.resultCache.ignoreQuery(queryStr) === false) {
|
|
190
191
|
// TODO use write tables instead
|
|
191
192
|
// check what queries actually end up here.
|
|
192
193
|
this.resultCache.invalidate(options?.writeTables ?? this.getTablesUsed(queryStr))
|
|
@@ -199,7 +200,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
199
200
|
this.debugInfo.queryFrameDuration += durationMs
|
|
200
201
|
this.debugInfo.queryFrameCount++
|
|
201
202
|
|
|
202
|
-
if (durationMs > 5 && isDevEnv()) {
|
|
203
|
+
if (durationMs > 5 && isDevEnv() === true) {
|
|
203
204
|
this.debugInfo.slowQueries.push({
|
|
204
205
|
queryStr,
|
|
205
206
|
bindValues,
|
|
@@ -214,8 +215,8 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
214
215
|
} catch (cause: any) {
|
|
215
216
|
span.recordException(cause)
|
|
216
217
|
span.end()
|
|
217
|
-
if (LS_DEV) {
|
|
218
|
-
//
|
|
218
|
+
if (LS_DEV === true) {
|
|
219
|
+
// oxlint-disable-next-line eslint(no-debugger) -- intentional breakpoint for SQL errors during development
|
|
219
220
|
debugger
|
|
220
221
|
}
|
|
221
222
|
throw new SqliteError({ cause, query: { bindValues: bindValues ?? {}, sql: queryStr } })
|
|
@@ -230,7 +231,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
230
231
|
|
|
231
232
|
cachedSelect<T = any>(
|
|
232
233
|
queryStr: string,
|
|
233
|
-
bindValues?: PreparedBindValues
|
|
234
|
+
bindValues?: PreparedBindValues ,
|
|
234
235
|
options?: {
|
|
235
236
|
queriedTables?: ReadonlySet<string>
|
|
236
237
|
skipCache?: boolean
|
|
@@ -280,7 +281,7 @@ export class SqliteDbWrapper implements SqliteDb {
|
|
|
280
281
|
this.debugInfo.queryFrameCount++
|
|
281
282
|
|
|
282
283
|
// TODO also enable in non-dev mode
|
|
283
|
-
if (durationMs > 5 && isDevEnv()) {
|
|
284
|
+
if (durationMs > 5 && isDevEnv() === true) {
|
|
284
285
|
this.debugInfo.slowQueries.push({
|
|
285
286
|
queryStr,
|
|
286
287
|
bindValues,
|
package/src/ambient.d.ts
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, it } from 'vitest'
|
|
2
|
+
import { Effect, Layer } from '@livestore/utils/effect'
|
|
3
|
+
import type { OtelTracer } from '@livestore/utils/effect'
|
|
4
|
+
import { schema } from '../utils/tests/fixture.ts'
|
|
5
|
+
import { Store, type StoreTagClass } from './LiveStore.ts'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Regression test for https://github.com/livestorejs/livestore/issues/1103
|
|
9
|
+
*
|
|
10
|
+
* `yield* MyStore` and `MyStore.query(...)` must produce the same R channel type
|
|
11
|
+
* so that a single layer provision satisfies both.
|
|
12
|
+
*/
|
|
13
|
+
describe('Store.Tag R channel consistency', () => {
|
|
14
|
+
class MainStore extends Store.Tag(schema, 'main') {}
|
|
15
|
+
|
|
16
|
+
const storeLayer = MainStore.layer({ adapter: {} as any, batchUpdates: (_: () => void) => {} })
|
|
17
|
+
|
|
18
|
+
it('yield* and method R channels unify so layer provision eliminates all requirements', () => {
|
|
19
|
+
const prog = Effect.gen(function* () {
|
|
20
|
+
const { store } = yield* MainStore
|
|
21
|
+
void store
|
|
22
|
+
|
|
23
|
+
const _queryResult = yield* MainStore.query({ get: () => 42 } as any)
|
|
24
|
+
void _queryResult
|
|
25
|
+
|
|
26
|
+
yield* MainStore.commit()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
/** Providing the store layer must fully eliminate MainStore from R */
|
|
30
|
+
const _provided: Effect.Effect<void, unknown, OtelTracer.OtelTracer> = prog.pipe(
|
|
31
|
+
Effect.provide(storeLayer),
|
|
32
|
+
)
|
|
33
|
+
void _provided
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('use() helper R channel is satisfied by the same layer', () => {
|
|
37
|
+
const prog = MainStore.use(({ store }) => Effect.succeed(store))
|
|
38
|
+
|
|
39
|
+
const _provided: Effect.Effect<unknown, unknown, OtelTracer.OtelTracer> = prog.pipe(
|
|
40
|
+
Effect.provide(storeLayer),
|
|
41
|
+
)
|
|
42
|
+
void _provided
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('fromDeferred layer output satisfies the same R channel', () => {
|
|
46
|
+
const prog = Effect.gen(function* () {
|
|
47
|
+
yield* MainStore
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
/** fromDeferred + DeferredLayer should satisfy MainStore in R */
|
|
51
|
+
const _provided = prog.pipe(
|
|
52
|
+
Effect.provide(Layer.merge(MainStore.fromDeferred, MainStore.DeferredLayer)),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
type _R = Effect.Effect.Context<typeof _provided>
|
|
56
|
+
/** MainStore should not be in R after providing fromDeferred */
|
|
57
|
+
type _MainStoreNotInR = StoreTagClass<typeof schema, 'main'> extends _R ? false : true
|
|
58
|
+
const _check: _MainStoreNotInR = true
|
|
59
|
+
void _check
|
|
60
|
+
})
|
|
61
|
+
})
|
package/src/effect/LiveStore.ts
CHANGED
|
@@ -3,10 +3,11 @@ import type { LiveStoreEvent, LiveStoreSchema } from '@livestore/common/schema'
|
|
|
3
3
|
import { omitUndefineds } from '@livestore/utils'
|
|
4
4
|
import type { Cause, OtelTracer, Scope } from '@livestore/utils/effect'
|
|
5
5
|
import { Context, Deferred, Duration, Effect, Layer, pipe } from '@livestore/utils/effect'
|
|
6
|
+
|
|
6
7
|
import type { LiveStoreContextProps } from '../store/create-store.ts'
|
|
7
8
|
import { createStore, DeferredStoreContext, LiveStoreContextRunning } from '../store/create-store.ts'
|
|
8
|
-
import type { Store as StoreClass } from '../store/store.ts'
|
|
9
9
|
import type { LiveStoreContextRunning as LiveStoreContextRunningType, Queryable } from '../store/store-types.ts'
|
|
10
|
+
import type { Store as StoreClass } from '../store/store.ts'
|
|
10
11
|
|
|
11
12
|
export const makeLiveStoreContext = <TSchema extends LiveStoreSchema, TContext = {}>({
|
|
12
13
|
schema,
|
|
@@ -34,12 +35,6 @@ export const makeLiveStoreContext = <TSchema extends LiveStoreSchema, TContext =
|
|
|
34
35
|
...omitUndefineds({ context, boot, disableDevtools, onBootStatus, syncPayload, syncPayloadSchema }),
|
|
35
36
|
})
|
|
36
37
|
|
|
37
|
-
globalThis.__debugLiveStore ??= {}
|
|
38
|
-
if (Object.keys(globalThis.__debugLiveStore).length === 0) {
|
|
39
|
-
globalThis.__debugLiveStore._ = store
|
|
40
|
-
}
|
|
41
|
-
globalThis.__debugLiveStore[storeId] = store
|
|
42
|
-
|
|
43
38
|
return { stage: 'running', store } as any as LiveStoreContextRunning['Type']
|
|
44
39
|
}),
|
|
45
40
|
Effect.tapErrorCause((cause) => Effect.flatMap(DeferredStoreContext, (def) => Deferred.failCause(def, cause))),
|
|
@@ -115,12 +110,20 @@ export type StoreLayerProps<TSchema extends LiveStoreSchema, TContext = {}> = Om
|
|
|
115
110
|
*
|
|
116
111
|
* Note: This uses a type alias with a new() signature to make it extendable.
|
|
117
112
|
*/
|
|
118
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Type for a Store.Tag class. Uses self-referential identifier so that `yield*`
|
|
115
|
+
* and method R channels resolve to the same type, enabling proper layer composition.
|
|
116
|
+
*
|
|
117
|
+
* Uses `interface` (not `type`) to allow the self-referential identifier without
|
|
118
|
+
* triggering TS2456 (circular type alias).
|
|
119
|
+
*/
|
|
120
|
+
export interface StoreTagClass<TSchema extends LiveStoreSchema, TStoreId extends string>
|
|
121
|
+
extends Context.Tag<StoreTagClass<TSchema, TStoreId>, LiveStoreContextRunningType<TSchema>> {
|
|
119
122
|
/** Constructor signature (makes the type extendable as a class) */
|
|
120
|
-
new (): Context.Tag<
|
|
123
|
+
new (): Context.Tag<StoreTagClass<TSchema, TStoreId>, LiveStoreContextRunningType<TSchema>>
|
|
121
124
|
|
|
122
125
|
/** Tag identity type (from Context.Tag) */
|
|
123
|
-
readonly Id:
|
|
126
|
+
readonly Id: StoreTagClass<TSchema, TStoreId>
|
|
124
127
|
|
|
125
128
|
/** Service type (from Context.Tag) */
|
|
126
129
|
readonly Type: LiveStoreContextRunningType<TSchema>
|
|
@@ -132,7 +135,7 @@ export type StoreTagClass<TSchema extends LiveStoreSchema, TStoreId extends stri
|
|
|
132
135
|
readonly storeId: TStoreId
|
|
133
136
|
|
|
134
137
|
/** Creates a layer that initializes the store */
|
|
135
|
-
layer<TContext
|
|
138
|
+
layer<TContext>(
|
|
136
139
|
props: StoreLayerProps<TSchema, TContext>,
|
|
137
140
|
): Layer.Layer<StoreTagClass<TSchema, TStoreId>, UnknownError | Cause.TimeoutException, OtelTracer.OtelTracer>
|
|
138
141
|
|
|
@@ -143,7 +146,7 @@ export type StoreTagClass<TSchema extends LiveStoreSchema, TStoreId extends stri
|
|
|
143
146
|
>
|
|
144
147
|
|
|
145
148
|
/** Layer that provides the Deferred tag */
|
|
146
|
-
readonly DeferredLayer: Layer.Layer<DeferredContextId<TStoreId
|
|
149
|
+
readonly DeferredLayer: Layer.Layer<DeferredContextId<TStoreId>>
|
|
147
150
|
|
|
148
151
|
/** Layer that waits for Deferred and provides the running store */
|
|
149
152
|
readonly fromDeferred: Layer.Layer<StoreTagClass<TSchema, TStoreId>, UnknownError, DeferredContextId<TStoreId>>
|
|
@@ -160,7 +163,7 @@ export type StoreTagClass<TSchema extends LiveStoreSchema, TStoreId extends stri
|
|
|
160
163
|
use<A, E, R>(
|
|
161
164
|
f: (ctx: LiveStoreContextRunningType<TSchema>) => Effect.Effect<A, E, R>,
|
|
162
165
|
): Effect.Effect<A, E, R | StoreTagClass<TSchema, TStoreId>>
|
|
163
|
-
}
|
|
166
|
+
}
|
|
164
167
|
|
|
165
168
|
/**
|
|
166
169
|
* Create a typed store context class for use with Effect.
|
|
@@ -249,12 +252,6 @@ const makeStoreTag = <TSchema extends LiveStoreSchema, TStoreId extends string>(
|
|
|
249
252
|
}),
|
|
250
253
|
})
|
|
251
254
|
|
|
252
|
-
globalThis.__debugLiveStore ??= {}
|
|
253
|
-
if (Object.keys(globalThis.__debugLiveStore).length === 0) {
|
|
254
|
-
globalThis.__debugLiveStore._ = store
|
|
255
|
-
}
|
|
256
|
-
globalThis.__debugLiveStore[storeId] = store
|
|
257
|
-
|
|
258
255
|
const ctx: RunningType = { stage: 'running', store: store as StoreClass<TSchema> }
|
|
259
256
|
|
|
260
257
|
// Also fulfill the deferred if it exists in context
|
|
@@ -349,7 +346,7 @@ export interface StoreContext<TSchema extends LiveStoreSchema, TStoreId extends
|
|
|
349
346
|
readonly Layer: <TContext = {}>(
|
|
350
347
|
props: Omit<LiveStoreContextProps<TSchema, TContext>, 'storeId'>,
|
|
351
348
|
) => Layer.Layer<StoreContextId<TSchema, TStoreId>, UnknownError | Cause.TimeoutException, OtelTracer.OtelTracer>
|
|
352
|
-
readonly DeferredLayer: Layer.Layer<DeferredContextId<TStoreId
|
|
349
|
+
readonly DeferredLayer: Layer.Layer<DeferredContextId<TStoreId>>
|
|
353
350
|
readonly fromDeferred: Layer.Layer<StoreContextId<TSchema, TStoreId>, UnknownError, DeferredContextId<TStoreId>>
|
|
354
351
|
}
|
|
355
352
|
|
|
@@ -399,12 +396,6 @@ export const makeStoreContext =
|
|
|
399
396
|
}),
|
|
400
397
|
})
|
|
401
398
|
|
|
402
|
-
globalThis.__debugLiveStore ??= {}
|
|
403
|
-
if (Object.keys(globalThis.__debugLiveStore).length === 0) {
|
|
404
|
-
globalThis.__debugLiveStore._ = store
|
|
405
|
-
}
|
|
406
|
-
globalThis.__debugLiveStore[storeId] = store
|
|
407
|
-
|
|
408
399
|
const ctx: RunningType = { stage: 'running', store: store as StoreClass<TSchema> }
|
|
409
400
|
|
|
410
401
|
// Also fulfill the deferred if it exists in context
|