@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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/QueryCache.d.ts.map +1 -1
- package/dist/SqliteDbWrapper.d.ts.map +1 -1
- package/dist/SqliteDbWrapper.js +32 -25
- package/dist/SqliteDbWrapper.js.map +1 -1
- package/dist/effect/LiveStore.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/live-queries/base-class.d.ts.map +1 -1
- package/dist/live-queries/computed.d.ts.map +1 -1
- package/dist/live-queries/db-query.d.ts.map +1 -1
- package/dist/live-queries/db-query.test.js +12 -4
- package/dist/live-queries/db-query.test.js.map +1 -1
- package/dist/live-queries/graphql.d.ts.map +1 -1
- package/dist/live-queries/make-ref.d.ts.map +1 -1
- package/dist/reactive.d.ts.map +1 -1
- package/dist/row-query-utils.d.ts.map +1 -1
- package/dist/store/create-store.d.ts +7 -1
- package/dist/store/create-store.d.ts.map +1 -1
- package/dist/store/create-store.js +22 -3
- package/dist/store/create-store.js.map +1 -1
- package/dist/store/devtools.d.ts.map +1 -1
- package/dist/store/store-types.d.ts +6 -15
- package/dist/store/store-types.d.ts.map +1 -1
- package/dist/store/store-types.js +1 -5
- package/dist/store/store-types.js.map +1 -1
- package/dist/store/store.d.ts +1 -1
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +7 -8
- package/dist/store/store.js.map +1 -1
- package/dist/utils/data-structures.d.ts.map +1 -1
- package/dist/utils/dev.d.ts.map +1 -1
- package/dist/utils/dev.js +6 -1
- package/dist/utils/dev.js.map +1 -1
- package/dist/utils/function-string.d.ts.map +1 -1
- package/dist/utils/otel.d.ts.map +1 -1
- package/dist/utils/stack-info.d.ts.map +1 -1
- package/dist/utils/tests/fixture.d.ts.map +1 -1
- package/dist/utils/tests/otel.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/SqliteDbWrapper.ts +33 -27
- package/src/index.ts +4 -7
- package/src/live-queries/__snapshots__/db-query.test.ts.snap +24 -0
- package/src/live-queries/db-query.test.ts +13 -4
- package/src/store/create-store.ts +38 -13
- package/src/store/store-types.ts +6 -10
- package/src/store/store.ts +9 -6
- package/src/utils/dev.ts +6 -1
- package/tmp/pack.tgz +0 -0
package/src/store/store.ts
CHANGED
|
@@ -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
|
|
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 = {
|
|
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
|