@livestore/livestore 0.3.0-dev.10 → 0.3.0-dev.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/SqliteDbWrapper.d.ts +54 -0
  3. package/dist/SqliteDbWrapper.d.ts.map +1 -0
  4. package/dist/SqliteDbWrapper.js +212 -0
  5. package/dist/SqliteDbWrapper.js.map +1 -0
  6. package/dist/SynchronousDatabaseWrapper.d.ts +14 -5
  7. package/dist/SynchronousDatabaseWrapper.d.ts.map +1 -1
  8. package/dist/SynchronousDatabaseWrapper.js +24 -4
  9. package/dist/SynchronousDatabaseWrapper.js.map +1 -1
  10. package/dist/effect/LiveStore.d.ts +12 -8
  11. package/dist/effect/LiveStore.d.ts.map +1 -1
  12. package/dist/effect/LiveStore.js +9 -2
  13. package/dist/effect/LiveStore.js.map +1 -1
  14. package/dist/index.d.ts +6 -7
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +4 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/live-queries/base-class.d.ts +64 -21
  19. package/dist/live-queries/base-class.d.ts.map +1 -1
  20. package/dist/live-queries/base-class.js +56 -13
  21. package/dist/live-queries/base-class.js.map +1 -1
  22. package/dist/live-queries/computed.d.ts +7 -7
  23. package/dist/live-queries/computed.d.ts.map +1 -1
  24. package/dist/live-queries/computed.js +35 -11
  25. package/dist/live-queries/computed.js.map +1 -1
  26. package/dist/live-queries/db-query.d.ts +67 -0
  27. package/dist/live-queries/db-query.d.ts.map +1 -0
  28. package/dist/live-queries/db-query.js +244 -0
  29. package/dist/live-queries/db-query.js.map +1 -0
  30. package/dist/live-queries/db-query.test.d.ts +2 -0
  31. package/dist/live-queries/db-query.test.d.ts.map +1 -0
  32. package/dist/live-queries/db-query.test.js +123 -0
  33. package/dist/live-queries/db-query.test.js.map +1 -0
  34. package/dist/live-queries/db.d.ts +12 -15
  35. package/dist/live-queries/db.d.ts.map +1 -1
  36. package/dist/live-queries/db.js +44 -25
  37. package/dist/live-queries/db.js.map +1 -1
  38. package/dist/live-queries/db.test.js +16 -14
  39. package/dist/live-queries/db.test.js.map +1 -1
  40. package/dist/live-queries/graphql.d.ts +8 -8
  41. package/dist/live-queries/graphql.d.ts.map +1 -1
  42. package/dist/live-queries/graphql.js +35 -9
  43. package/dist/live-queries/graphql.js.map +1 -1
  44. package/dist/live-queries/make-ref.d.ts +20 -0
  45. package/dist/live-queries/make-ref.d.ts.map +1 -0
  46. package/dist/live-queries/make-ref.js +33 -0
  47. package/dist/live-queries/make-ref.js.map +1 -0
  48. package/dist/reactive.d.ts +15 -13
  49. package/dist/reactive.d.ts.map +1 -1
  50. package/dist/reactive.js +15 -9
  51. package/dist/reactive.js.map +1 -1
  52. package/dist/row-query-utils.d.ts +4 -4
  53. package/dist/row-query-utils.d.ts.map +1 -1
  54. package/dist/row-query-utils.js +14 -10
  55. package/dist/row-query-utils.js.map +1 -1
  56. package/dist/store/create-store.d.ts +3 -4
  57. package/dist/store/create-store.d.ts.map +1 -1
  58. package/dist/store/create-store.js +7 -7
  59. package/dist/store/create-store.js.map +1 -1
  60. package/dist/store/devtools.d.ts +2 -2
  61. package/dist/store/devtools.d.ts.map +1 -1
  62. package/dist/store/devtools.js +15 -15
  63. package/dist/store/devtools.js.map +1 -1
  64. package/dist/store/store-types.d.ts +9 -4
  65. package/dist/store/store-types.d.ts.map +1 -1
  66. package/dist/store/store-types.js.map +1 -1
  67. package/dist/store/store.d.ts +34 -16
  68. package/dist/store/store.d.ts.map +1 -1
  69. package/dist/store/store.js +125 -75
  70. package/dist/store/store.js.map +1 -1
  71. package/dist/utils/expo.d.ts +2 -0
  72. package/dist/utils/expo.d.ts.map +1 -0
  73. package/dist/utils/expo.js +8 -0
  74. package/dist/utils/expo.js.map +1 -0
  75. package/dist/utils/function-string.d.ts +7 -0
  76. package/dist/utils/function-string.d.ts.map +1 -0
  77. package/dist/utils/function-string.js +9 -0
  78. package/dist/utils/function-string.js.map +1 -0
  79. package/dist/utils/stack-info.d.ts.map +1 -1
  80. package/dist/utils/stack-info.js +6 -1
  81. package/dist/utils/stack-info.js.map +1 -1
  82. package/dist/utils/stack-info.test.js +54 -1
  83. package/dist/utils/stack-info.test.js.map +1 -1
  84. package/dist/utils/tests/fixture.d.ts +2 -6
  85. package/dist/utils/tests/fixture.d.ts.map +1 -1
  86. package/dist/utils/tests/fixture.js +3 -5
  87. package/dist/utils/tests/fixture.js.map +1 -1
  88. package/dist/utils/tests/mod.d.ts +1 -0
  89. package/dist/utils/tests/mod.d.ts.map +1 -1
  90. package/dist/utils/tests/mod.js +1 -0
  91. package/dist/utils/tests/mod.js.map +1 -1
  92. package/package.json +5 -5
  93. package/src/{SynchronousDatabaseWrapper.ts → SqliteDbWrapper.ts} +41 -11
  94. package/src/effect/LiveStore.ts +22 -14
  95. package/src/index.ts +14 -7
  96. package/src/live-queries/__snapshots__/{db.test.ts.snap → db-query.test.ts.snap} +196 -42
  97. package/src/live-queries/base-class.ts +160 -40
  98. package/src/live-queries/computed.ts +45 -19
  99. package/src/live-queries/{db.test.ts → db-query.test.ts} +21 -11
  100. package/src/live-queries/{db.ts → db-query.ts} +97 -39
  101. package/src/live-queries/graphql.ts +47 -21
  102. package/src/live-queries/make-ref.ts +47 -0
  103. package/src/reactive.ts +52 -27
  104. package/src/row-query-utils.ts +29 -18
  105. package/src/store/create-store.ts +20 -23
  106. package/src/store/devtools.ts +17 -17
  107. package/src/store/store-types.ts +6 -4
  108. package/src/store/store.ts +227 -120
  109. package/src/utils/function-string.ts +12 -0
  110. package/src/utils/stack-info.test.ts +58 -1
  111. package/src/utils/stack-info.ts +6 -1
  112. package/src/utils/tests/fixture.ts +2 -7
  113. package/src/utils/tests/mod.ts +1 -0
  114. package/src/global-state.ts +0 -20
@@ -1,7 +1,7 @@
1
1
  import { provideOtel } from '@livestore/common'
2
2
  import type { FromInputSchema } from '@livestore/common/schema'
3
3
  import type { Store } from '@livestore/livestore'
4
- import { createStore, DbSchema, globalReactivityGraph, makeReactivityGraph, makeSchema } from '@livestore/livestore'
4
+ import { createStore, DbSchema, makeSchema } from '@livestore/livestore'
5
5
  import { Effect } from '@livestore/utils/effect'
6
6
  import { makeInMemoryAdapter } from '@livestore/web'
7
7
  import type * as otel from '@opentelemetry/api'
@@ -47,22 +47,17 @@ export interface FixtureSchema extends FromInputSchema.DeriveSchema<{ tables: ty
47
47
  export const makeTodoMvc = ({
48
48
  otelTracer,
49
49
  otelContext,
50
- useGlobalReactivityGraph = true,
51
50
  }: {
52
51
  otelTracer?: otel.Tracer
53
52
  otelContext?: otel.Context
54
- useGlobalReactivityGraph?: boolean
55
53
  } = {}) =>
56
54
  Effect.gen(function* () {
57
- const reactivityGraph = useGlobalReactivityGraph ? globalReactivityGraph : makeReactivityGraph()
58
-
59
55
  const store: Store<any, FixtureSchema> = yield* createStore({
60
56
  schema,
61
57
  storeId: 'default',
62
58
  adapter: makeInMemoryAdapter(),
63
- reactivityGraph,
64
59
  debug: { instanceId: 'test' },
65
60
  })
66
61
 
67
- return { store, reactivityGraph }
62
+ return store
68
63
  }).pipe(provideOtel({ parentSpanContext: otelContext, otelTracer: otelTracer }))
@@ -1,2 +1,3 @@
1
1
  export * from './fixture.js'
2
2
  export * from './otel.js'
3
+ export * as RG from '../../reactive.js'
@@ -1,20 +0,0 @@
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
- )