@livestore/livestore 0.3.0-dev.16 → 0.3.0-dev.18

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 (51) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/QueryCache.d.ts.map +1 -1
  3. package/dist/SqliteDbWrapper.d.ts.map +1 -1
  4. package/dist/SqliteDbWrapper.js +32 -25
  5. package/dist/SqliteDbWrapper.js.map +1 -1
  6. package/dist/effect/LiveStore.d.ts.map +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/live-queries/base-class.d.ts.map +1 -1
  12. package/dist/live-queries/computed.d.ts.map +1 -1
  13. package/dist/live-queries/db-query.d.ts.map +1 -1
  14. package/dist/live-queries/db-query.test.js +12 -4
  15. package/dist/live-queries/db-query.test.js.map +1 -1
  16. package/dist/live-queries/graphql.d.ts.map +1 -1
  17. package/dist/live-queries/make-ref.d.ts.map +1 -1
  18. package/dist/reactive.d.ts.map +1 -1
  19. package/dist/row-query-utils.d.ts.map +1 -1
  20. package/dist/store/create-store.d.ts +7 -1
  21. package/dist/store/create-store.d.ts.map +1 -1
  22. package/dist/store/create-store.js +22 -3
  23. package/dist/store/create-store.js.map +1 -1
  24. package/dist/store/devtools.d.ts.map +1 -1
  25. package/dist/store/store-types.d.ts +6 -15
  26. package/dist/store/store-types.d.ts.map +1 -1
  27. package/dist/store/store-types.js +1 -5
  28. package/dist/store/store-types.js.map +1 -1
  29. package/dist/store/store.d.ts +1 -1
  30. package/dist/store/store.d.ts.map +1 -1
  31. package/dist/store/store.js +7 -8
  32. package/dist/store/store.js.map +1 -1
  33. package/dist/utils/data-structures.d.ts.map +1 -1
  34. package/dist/utils/dev.d.ts.map +1 -1
  35. package/dist/utils/dev.js +6 -1
  36. package/dist/utils/dev.js.map +1 -1
  37. package/dist/utils/function-string.d.ts.map +1 -1
  38. package/dist/utils/otel.d.ts.map +1 -1
  39. package/dist/utils/stack-info.d.ts.map +1 -1
  40. package/dist/utils/tests/fixture.d.ts.map +1 -1
  41. package/dist/utils/tests/otel.d.ts.map +1 -1
  42. package/package.json +5 -5
  43. package/src/SqliteDbWrapper.ts +33 -27
  44. package/src/index.ts +4 -7
  45. package/src/live-queries/__snapshots__/db-query.test.ts.snap +24 -0
  46. package/src/live-queries/db-query.test.ts +13 -4
  47. package/src/store/create-store.ts +38 -13
  48. package/src/store/store-types.ts +6 -10
  49. package/src/store/store.ts +9 -6
  50. package/src/utils/dev.ts +6 -1
  51. package/tmp/pack.tgz +0 -0
@@ -20,6 +20,7 @@ import {
20
20
  } from '@livestore/common'
21
21
  import type { LiveStoreSchema } from '@livestore/common/schema'
22
22
  import {
23
+ getMutationDef,
23
24
  MutationEvent,
24
25
  SCHEMA_META_TABLE,
25
26
  SCHEMA_MUTATIONS_META_TABLE,
@@ -113,6 +114,7 @@ export class Store<
113
114
  storeId,
114
115
  lifetimeScope,
115
116
  runtime,
117
+ params,
116
118
  }: StoreOptions<TGraphQLContext, TSchema>) {
117
119
  super()
118
120
 
@@ -135,7 +137,8 @@ export class Store<
135
137
  clientSession,
136
138
  runtime,
137
139
  applyMutation: (mutationEventDecoded, { otelContext, withChangeset }) => {
138
- const mutationDef = schema.mutations.get(mutationEventDecoded.mutation)!
140
+ const mutationDef = getMutationDef(schema, mutationEventDecoded.mutation)
141
+
139
142
  const execArgsArr = getExecArgsFromMutation({
140
143
  mutationDef,
141
144
  mutationEvent: { decoded: mutationEventDecoded, encoded: undefined },
@@ -178,6 +181,9 @@ export class Store<
178
181
  reactivityGraph.setRefs(tablesToUpdate)
179
182
  },
180
183
  span: syncSpan,
184
+ params: {
185
+ leaderPushBatchSize: params.leaderPushBatchSize,
186
+ },
181
187
  })
182
188
 
183
189
  this.__mutationEventSchema = MutationEvent.makeMutationEventSchemaMemo(schema)
@@ -614,11 +620,8 @@ export class Store<
614
620
  }).pipe(this.runEffectFork)
615
621
  },
616
622
 
617
- shutdown: (cause?: Cause.Cause<UnexpectedError>) => {
618
- this.clientSession
619
- .shutdown(cause ?? Cause.fail(IntentionalShutdownCause.make({ reason: 'manual' })))
620
- .pipe(Effect.tapCauseLogPretty, Effect.provide(this.runtime), Effect.runFork)
621
- },
623
+ shutdown: (cause?: Cause.Cause<UnexpectedError>) =>
624
+ this.clientSession.shutdown(cause ?? Cause.fail(IntentionalShutdownCause.make({ reason: 'manual' }))),
622
625
 
623
626
  version: liveStoreVersion,
624
627
  }
package/src/utils/dev.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { isDevEnv } from '@livestore/utils'
2
+ import { Effect } from '@livestore/utils/effect'
2
3
 
3
4
  /* eslint-disable unicorn/prefer-global-this */
4
5
  export const downloadBlob = (
@@ -27,6 +28,10 @@ export const downloadURL = (data: string, fileName: string) => {
27
28
 
28
29
  export const exposeDebugUtils = () => {
29
30
  if (isDevEnv()) {
30
- globalThis.__debugLiveStoreUtils = { downloadBlob }
31
+ globalThis.__debugLiveStoreUtils = {
32
+ downloadBlob,
33
+ runSync: (effect: Effect.Effect<any, any, never>) => Effect.runSync(effect),
34
+ runFork: (effect: Effect.Effect<any, any, never>) => Effect.runFork(effect),
35
+ }
31
36
  }
32
37
  }
package/tmp/pack.tgz ADDED
Binary file