@livestore/livestore 0.0.58-dev.13 → 0.0.58-dev.15

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 (77) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/effect/LiveStore.d.ts +4 -4
  3. package/dist/effect/LiveStore.d.ts.map +1 -1
  4. package/dist/effect/LiveStore.js +1 -1
  5. package/dist/effect/LiveStore.js.map +1 -1
  6. package/dist/index.d.ts +6 -5
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +4 -3
  9. package/dist/index.js.map +1 -1
  10. package/dist/reactiveQueries/base-class.d.ts +4 -3
  11. package/dist/reactiveQueries/base-class.d.ts.map +1 -1
  12. package/dist/reactiveQueries/base-class.js.map +1 -1
  13. package/dist/reactiveQueries/computed.d.ts +35 -0
  14. package/dist/reactiveQueries/computed.d.ts.map +1 -0
  15. package/dist/reactiveQueries/computed.js +57 -0
  16. package/dist/reactiveQueries/computed.js.map +1 -0
  17. package/dist/reactiveQueries/graphql.d.ts +2 -1
  18. package/dist/reactiveQueries/graphql.d.ts.map +1 -1
  19. package/dist/reactiveQueries/graphql.js.map +1 -1
  20. package/dist/reactiveQueries/sql.d.ts +1 -1
  21. package/dist/reactiveQueries/sql.d.ts.map +1 -1
  22. package/dist/reactiveQueries/sql.js +1 -1
  23. package/dist/reactiveQueries/sql.js.map +1 -1
  24. package/dist/row-query.d.ts.map +1 -1
  25. package/dist/row-query.js +2 -6
  26. package/dist/row-query.js.map +1 -1
  27. package/dist/store/create-store.d.ts +28 -0
  28. package/dist/store/create-store.d.ts.map +1 -0
  29. package/dist/store/create-store.js +85 -0
  30. package/dist/store/create-store.js.map +1 -0
  31. package/dist/store/devtools.d.ts +19 -0
  32. package/dist/store/devtools.d.ts.map +1 -0
  33. package/dist/store/devtools.js +141 -0
  34. package/dist/store/devtools.js.map +1 -0
  35. package/dist/store/store-context.d.ts +26 -0
  36. package/dist/store/store-context.d.ts.map +1 -0
  37. package/dist/store/store-context.js +6 -0
  38. package/dist/store/store-context.js.map +1 -0
  39. package/dist/store/store-types.d.ts +98 -0
  40. package/dist/store/store-types.d.ts.map +1 -0
  41. package/dist/store/store-types.js +6 -0
  42. package/dist/store/store-types.js.map +1 -0
  43. package/dist/store/store.d.ts +88 -0
  44. package/dist/store/store.d.ts.map +1 -0
  45. package/dist/store/store.js +367 -0
  46. package/dist/store/store.js.map +1 -0
  47. package/dist/store.d.ts.map +1 -1
  48. package/dist/store.js +8 -8
  49. package/dist/store.js.map +1 -1
  50. package/dist/utils/dev.d.ts +1 -0
  51. package/dist/utils/dev.d.ts.map +1 -1
  52. package/dist/utils/dev.js +5 -0
  53. package/dist/utils/dev.js.map +1 -1
  54. package/dist/utils/tests/fixture.d.ts +6 -6
  55. package/dist/utils/tests/fixture.d.ts.map +1 -1
  56. package/dist/utils/tests/fixture.js +3 -4
  57. package/dist/utils/tests/fixture.js.map +1 -1
  58. package/dist/utils/tests/otel.d.ts.map +1 -1
  59. package/dist/utils/tests/otel.js +3 -3
  60. package/dist/utils/tests/otel.js.map +1 -1
  61. package/package.json +6 -5
  62. package/src/ambient.d.ts +3 -1
  63. package/src/effect/LiveStore.ts +5 -5
  64. package/src/index.ts +5 -6
  65. package/src/reactiveQueries/base-class.ts +4 -3
  66. package/src/reactiveQueries/{js.ts → computed.ts} +3 -3
  67. package/src/reactiveQueries/graphql.ts +2 -1
  68. package/src/reactiveQueries/sql.ts +2 -2
  69. package/src/row-query.ts +3 -7
  70. package/src/store/create-store.ts +214 -0
  71. package/src/{store-devtools.ts → store/devtools.ts} +5 -5
  72. package/src/store/store-types.ts +110 -0
  73. package/src/{store.ts → store/store.ts} +23 -392
  74. package/src/utils/dev.ts +6 -0
  75. package/src/utils/tests/fixture.ts +10 -14
  76. package/src/utils/tests/otel.ts +4 -4
  77. package/src/store-context.ts +0 -23
@@ -0,0 +1,19 @@
1
+ import type { ClientSession } from '@livestore/common';
2
+ import { Devtools, UnexpectedError } from '@livestore/common';
3
+ import type { WebChannel } from '@livestore/utils/effect';
4
+ import { Effect } from '@livestore/utils/effect';
5
+ import type { LiveQuery, ReactivityGraph } from '../reactiveQueries/base-class.js';
6
+ import type { SynchronousDatabaseWrapper } from '../SynchronousDatabaseWrapper.js';
7
+ import type { ReferenceCountedSet } from '../utils/data-structures.js';
8
+ type IStore = {
9
+ clientSession: ClientSession;
10
+ reactivityGraph: ReactivityGraph;
11
+ syncDbWrapper: SynchronousDatabaseWrapper;
12
+ activeQueries: ReferenceCountedSet<LiveQuery<any>>;
13
+ };
14
+ export declare const connectDevtoolsToStore: ({ storeDevtoolsChannel, store, }: {
15
+ storeDevtoolsChannel: WebChannel.WebChannel<Devtools.MessageToAppHostStore, Devtools.MessageFromAppHostStore>;
16
+ store: IStore;
17
+ }) => Effect.Effect<void, UnexpectedError, import("effect/Scope").Scope>;
18
+ export {};
19
+ //# sourceMappingURL=devtools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../../src/store/devtools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,mBAAmB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAoB,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAU,MAAM,yBAAyB,CAAA;AAGxD,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAClF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAElF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEtE,KAAK,MAAM,GAAG;IACZ,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,eAAe,CAAA;IAChC,aAAa,EAAE,0BAA0B,CAAA;IACzC,aAAa,EAAE,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;CACnD,CAAA;AAMD,eAAO,MAAM,sBAAsB,qCAGhC;IACD,oBAAoB,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,qBAAqB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAA;IAC7G,KAAK,EAAE,MAAM,CAAA;CACd,uEA2LsG,CAAA"}
@@ -0,0 +1,141 @@
1
+ import { Devtools, liveStoreVersion, UnexpectedError } from '@livestore/common';
2
+ import { throttle } from '@livestore/utils';
3
+ import { Effect, Stream } from '@livestore/utils/effect';
4
+ import { NOT_REFRESHED_YET } from '../reactive.js';
5
+ import { emptyDebugInfo as makeEmptyDebugInfo } from '../SynchronousDatabaseWrapper.js';
6
+ export const connectDevtoolsToStore = ({ storeDevtoolsChannel, store, }) => Effect.gen(function* () {
7
+ const appHostId = store.clientSession.coordinator.devtools.appHostId;
8
+ const reactivityGraphSubcriptions = new Map();
9
+ const liveQueriesSubscriptions = new Map();
10
+ const debugInfoHistorySubscriptions = new Map();
11
+ yield* Effect.addFinalizer(() => Effect.sync(() => {
12
+ reactivityGraphSubcriptions.forEach((unsub) => unsub());
13
+ liveQueriesSubscriptions.forEach((unsub) => unsub());
14
+ debugInfoHistorySubscriptions.forEach((unsub) => unsub());
15
+ }));
16
+ const sendToDevtools = (message) => storeDevtoolsChannel.send(message).pipe(Effect.tapCauseLogPretty, Effect.runSync);
17
+ const onMessage = (decodedMessage) => {
18
+ // console.log('storeMessagePort message', decodedMessage)
19
+ if (decodedMessage.appHostId !== store.clientSession.coordinator.devtools.appHostId) {
20
+ // console.log(`Unknown message`, event)
21
+ return;
22
+ }
23
+ const requestId = decodedMessage.requestId;
24
+ const requestIdleCallback = globalThis.requestIdleCallback ?? ((cb) => cb());
25
+ switch (decodedMessage._tag) {
26
+ case 'LSD.ReactivityGraphSubscribe': {
27
+ const includeResults = decodedMessage.includeResults;
28
+ const send = () =>
29
+ // In order to not add more work to the current tick, we use requestIdleCallback
30
+ // to send the reactivity graph updates to the devtools
31
+ requestIdleCallback(() => sendToDevtools(Devtools.ReactivityGraphRes.make({
32
+ reactivityGraph: store.reactivityGraph.getSnapshot({ includeResults }),
33
+ requestId,
34
+ appHostId,
35
+ liveStoreVersion,
36
+ })), { timeout: 500 });
37
+ send();
38
+ // In some cases, there can be A LOT of reactivity graph updates in a short period of time
39
+ // so we throttle the updates to avoid sending too much data
40
+ // This might need to be tweaked further and possibly be exposed to the user in some way.
41
+ const throttledSend = throttle(send, 20);
42
+ reactivityGraphSubcriptions.set(requestId, store.reactivityGraph.subscribeToRefresh(throttledSend));
43
+ break;
44
+ }
45
+ case 'LSD.DebugInfoReq': {
46
+ sendToDevtools(Devtools.DebugInfoRes.make({
47
+ debugInfo: store.syncDbWrapper.debugInfo,
48
+ requestId,
49
+ appHostId,
50
+ liveStoreVersion,
51
+ }));
52
+ break;
53
+ }
54
+ case 'LSD.DebugInfoHistorySubscribe': {
55
+ const buffer = [];
56
+ let hasStopped = false;
57
+ let rafHandle;
58
+ const tick = () => {
59
+ buffer.push(store.syncDbWrapper.debugInfo);
60
+ // NOTE this resets the debug info, so all other "readers" e.g. in other `requestAnimationFrame` loops,
61
+ // will get the empty debug info
62
+ // TODO We need to come up with a more graceful way to do store. Probably via a single global
63
+ // `requestAnimationFrame` loop that is passed in somehow.
64
+ store.syncDbWrapper.debugInfo = makeEmptyDebugInfo();
65
+ if (buffer.length > 10) {
66
+ sendToDevtools(Devtools.DebugInfoHistoryRes.make({
67
+ debugInfoHistory: buffer,
68
+ requestId,
69
+ appHostId,
70
+ liveStoreVersion,
71
+ }));
72
+ buffer.length = 0;
73
+ }
74
+ if (hasStopped === false) {
75
+ rafHandle = requestAnimationFrame(tick);
76
+ }
77
+ };
78
+ rafHandle = requestAnimationFrame(tick);
79
+ const unsub = () => {
80
+ hasStopped = true;
81
+ if (rafHandle !== undefined) {
82
+ cancelAnimationFrame(rafHandle);
83
+ }
84
+ };
85
+ debugInfoHistorySubscriptions.set(requestId, unsub);
86
+ break;
87
+ }
88
+ case 'LSD.DebugInfoHistoryUnsubscribe': {
89
+ debugInfoHistorySubscriptions.get(requestId)();
90
+ debugInfoHistorySubscriptions.delete(requestId);
91
+ break;
92
+ }
93
+ case 'LSD.DebugInfoResetReq': {
94
+ store.syncDbWrapper.debugInfo.slowQueries.clear();
95
+ sendToDevtools(Devtools.DebugInfoResetRes.make({ requestId, appHostId, liveStoreVersion }));
96
+ break;
97
+ }
98
+ case 'LSD.DebugInfoRerunQueryReq': {
99
+ const { queryStr, bindValues, queriedTables } = decodedMessage;
100
+ store.syncDbWrapper.select(queryStr, { bindValues, queriedTables, skipCache: true });
101
+ sendToDevtools(Devtools.DebugInfoRerunQueryRes.make({ requestId, appHostId, liveStoreVersion }));
102
+ break;
103
+ }
104
+ case 'LSD.ReactivityGraphUnsubscribe': {
105
+ reactivityGraphSubcriptions.get(requestId)();
106
+ break;
107
+ }
108
+ case 'LSD.LiveQueriesSubscribe': {
109
+ const send = () => requestIdleCallback(() => sendToDevtools(Devtools.LiveQueriesRes.make({
110
+ liveQueries: [...store.activeQueries].map((q) => ({
111
+ _tag: q._tag,
112
+ id: q.id,
113
+ label: q.label,
114
+ runs: q.runs,
115
+ executionTimes: q.executionTimes.map((_) => Number(_.toString().slice(0, 5))),
116
+ lastestResult: q.results$.previousResult === NOT_REFRESHED_YET
117
+ ? 'SYMBOL_NOT_REFRESHED_YET'
118
+ : q.results$.previousResult,
119
+ activeSubscriptions: Array.from(q.activeSubscriptions),
120
+ })),
121
+ requestId,
122
+ liveStoreVersion,
123
+ appHostId,
124
+ })), { timeout: 500 });
125
+ send();
126
+ // Same as in the reactivity graph subscription case above, we need to throttle the updates
127
+ const throttledSend = throttle(send, 20);
128
+ liveQueriesSubscriptions.set(requestId, store.reactivityGraph.subscribeToRefresh(throttledSend));
129
+ break;
130
+ }
131
+ case 'LSD.LiveQueriesUnsubscribe': {
132
+ liveQueriesSubscriptions.get(requestId)();
133
+ liveQueriesSubscriptions.delete(requestId);
134
+ break;
135
+ }
136
+ // No default
137
+ }
138
+ };
139
+ yield* storeDevtoolsChannel.listen.pipe(Stream.flatten(), Stream.tapSync((message) => onMessage(message)), Stream.runDrain, Effect.withSpan('LSD.devtools.onMessage'));
140
+ }).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('LSD.devtools.connectStoreToDevtools'));
141
+ //# sourceMappingURL=devtools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.js","sourceRoot":"","sources":["../../src/store/devtools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGlD,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAcvF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,oBAAoB,EACpB,KAAK,GAIN,EAAE,EAAE,CACH,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAA;IAEpE,MAAM,2BAA2B,GAAW,IAAI,GAAG,EAAE,CAAA;IACrD,MAAM,wBAAwB,GAAW,IAAI,GAAG,EAAE,CAAA;IAClD,MAAM,6BAA6B,GAAW,IAAI,GAAG,EAAE,CAAA;IAEvD,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACf,2BAA2B,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAA;Q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AC;YACD,KAAK,4BAA4B,CAAC,CAAC,CAAC;gBAClC,wBAAwB,CAAC,GAAG,CAAC,SAAS,CAAE,EAAE,CAAA;gBAC1C,wBAAwB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;gBAC1C,MAAK;YACP,CAAC;YACD,aAAa;QACf,CAAC;IACH,CAAC,CAAA;IAED,KAAK,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,CACrC,MAAM,CAAC,OAAO,EAAE,EAChB,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAC/C,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAC1C,CAAA;AACH,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import type { IntentionalShutdownCause, UnexpectedError } from '@livestore/common';
2
+ import { Schema } from '@livestore/utils/effect';
3
+ import type { Store } from './store.js';
4
+ export type LiveStoreContext = LiveStoreContextRunning | {
5
+ stage: 'error';
6
+ error: UnexpectedError | unknown;
7
+ } | {
8
+ stage: 'shutdown';
9
+ cause: IntentionalShutdownCause | StoreAbort;
10
+ };
11
+ declare const StoreAbort_base: Schema.TaggedErrorClass<StoreAbort, "LiveStore.StoreAbort", {
12
+ readonly _tag: Schema.tag<"LiveStore.StoreAbort">;
13
+ }>;
14
+ export declare class StoreAbort extends StoreAbort_base {
15
+ }
16
+ declare const StoreInterrupted_base: Schema.TaggedErrorClass<StoreInterrupted, "LiveStore.StoreInterrupted", {
17
+ readonly _tag: Schema.tag<"LiveStore.StoreInterrupted">;
18
+ }>;
19
+ export declare class StoreInterrupted extends StoreInterrupted_base {
20
+ }
21
+ export type LiveStoreContextRunning = {
22
+ stage: 'running';
23
+ store: Store;
24
+ };
25
+ export {};
26
+ //# sourceMappingURL=store-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-context.d.ts","sourceRoot":"","sources":["../../src/store/store-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,MAAM,MAAM,gBAAgB,GACxB,uBAAuB,GACvB;IACE,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,eAAe,GAAG,OAAO,CAAA;CACjC,GACD;IACE,KAAK,EAAE,UAAU,CAAA;IACjB,KAAK,EAAE,wBAAwB,GAAG,UAAU,CAAA;CAC7C,CAAA;;;;AAEL,qBAAa,UAAW,SAAQ,eAA4D;CAAG;;;;AAC/F,qBAAa,gBAAiB,SAAQ,qBAAwE;CAAG;AAEjH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;CACb,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Schema } from '@livestore/utils/effect';
2
+ export class StoreAbort extends Schema.TaggedError()('LiveStore.StoreAbort', {}) {
3
+ }
4
+ export class StoreInterrupted extends Schema.TaggedError()('LiveStore.StoreInterrupted', {}) {
5
+ }
6
+ //# sourceMappingURL=store-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-context.js","sourceRoot":"","sources":["../../src/store/store-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAehD,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,EAAc,CAAC,sBAAsB,EAAE,EAAE,CAAC;CAAG;AAC/F,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,EAAoB,CAAC,4BAA4B,EAAE,EAAE,CAAC;CAAG"}
@@ -0,0 +1,98 @@
1
+ import type { ClientSession, EventId, IntentionalShutdownCause, UnexpectedError } from '@livestore/common';
2
+ import type { LiveStoreSchema, MutationEvent } from '@livestore/common/schema';
3
+ import type { FiberSet, MutableHashMap, Runtime, Scope } from '@livestore/utils/effect';
4
+ import { Schema } from '@livestore/utils/effect';
5
+ import type * as otel from '@opentelemetry/api';
6
+ import type { GraphQLSchema } from 'graphql';
7
+ import type { DebugRefreshReasonBase } from '../reactive.js';
8
+ import type { ReactivityGraph } from '../reactiveQueries/base-class.js';
9
+ import type { SynchronousDatabaseWrapper } from '../SynchronousDatabaseWrapper.js';
10
+ import type { StackInfo } from '../utils/stack-info.js';
11
+ import type { Store } from './store.js';
12
+ export type LiveStoreContext = LiveStoreContextRunning | {
13
+ stage: 'error';
14
+ error: UnexpectedError | unknown;
15
+ } | {
16
+ stage: 'shutdown';
17
+ cause: IntentionalShutdownCause | StoreAbort;
18
+ };
19
+ declare const StoreAbort_base: Schema.TaggedErrorClass<StoreAbort, "LiveStore.StoreAbort", {
20
+ readonly _tag: Schema.tag<"LiveStore.StoreAbort">;
21
+ }>;
22
+ export declare class StoreAbort extends StoreAbort_base {
23
+ }
24
+ declare const StoreInterrupted_base: Schema.TaggedErrorClass<StoreInterrupted, "LiveStore.StoreInterrupted", {
25
+ readonly _tag: Schema.tag<"LiveStore.StoreInterrupted">;
26
+ }>;
27
+ export declare class StoreInterrupted extends StoreInterrupted_base {
28
+ }
29
+ export type LiveStoreContextRunning = {
30
+ stage: 'running';
31
+ store: Store;
32
+ };
33
+ export type BaseGraphQLContext = {
34
+ queriedTables: Set<string>;
35
+ /** Needed by Pothos Otel plugin for resolver tracing to work */
36
+ otelContext?: otel.Context;
37
+ };
38
+ export type GraphQLOptions<TContext> = {
39
+ schema: GraphQLSchema;
40
+ makeContext: (db: SynchronousDatabaseWrapper, tracer: otel.Tracer, sessionId: string) => TContext;
41
+ };
42
+ export type OtelOptions = {
43
+ tracer: otel.Tracer;
44
+ rootSpanContext: otel.Context;
45
+ };
46
+ export type StoreOptions<TGraphQLContext extends BaseGraphQLContext, TSchema extends LiveStoreSchema = LiveStoreSchema> = {
47
+ clientSession: ClientSession;
48
+ schema: TSchema;
49
+ storeId: string;
50
+ graphQLOptions?: GraphQLOptions<TGraphQLContext>;
51
+ otelOptions: OtelOptions;
52
+ reactivityGraph: ReactivityGraph;
53
+ disableDevtools?: boolean;
54
+ fiberSet: FiberSet.FiberSet;
55
+ runtime: Runtime.Runtime<Scope.Scope>;
56
+ batchUpdates: (runUpdates: () => void) => void;
57
+ unsyncedMutationEvents: MutableHashMap.MutableHashMap<EventId, MutationEvent.ForSchema<TSchema>>;
58
+ };
59
+ export type RefreshReason = DebugRefreshReasonBase | {
60
+ _tag: 'mutate';
61
+ /** The mutations that were applied */
62
+ mutations: ReadonlyArray<MutationEvent.Any>;
63
+ /** The tables that were written to by the event */
64
+ writeTables: ReadonlyArray<string>;
65
+ } | {
66
+ _tag: 'react';
67
+ api: string;
68
+ label?: string;
69
+ stackInfo?: StackInfo;
70
+ } | {
71
+ _tag: 'manual';
72
+ label?: string;
73
+ };
74
+ export type QueryDebugInfo = {
75
+ _tag: 'graphql' | 'sql' | 'computed' | 'unknown';
76
+ label: string;
77
+ query: string;
78
+ durationMs: number;
79
+ };
80
+ export type StoreOtel = {
81
+ tracer: otel.Tracer;
82
+ mutationsSpanContext: otel.Context;
83
+ queriesSpanContext: otel.Context;
84
+ };
85
+ export type StoreMutateOptions = {
86
+ label?: string;
87
+ skipRefresh?: boolean;
88
+ wasSyncMessage?: boolean;
89
+ /**
90
+ * When set to `false` the mutation won't be persisted in the mutation log and sync server (but still synced).
91
+ * This can be useful e.g. for fine-granular update events (e.g. position updates during drag & drop)
92
+ *
93
+ * @default true
94
+ */
95
+ persisted?: boolean;
96
+ };
97
+ export {};
98
+ //# sourceMappingURL=store-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-types.d.ts","sourceRoot":"","sources":["../../src/store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M,CAAC,CAAA;CACnC,GACD;IAEE,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtC,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAA;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;IACnB,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAA;IAClC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Schema } from '@livestore/utils/effect';
2
+ export class StoreAbort extends Schema.TaggedError()('LiveStore.StoreAbort', {}) {
3
+ }
4
+ export class StoreInterrupted extends Schema.TaggedError()('LiveStore.StoreInterrupted', {}) {
5
+ }
6
+ //# sourceMappingURL=store-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-types.js","sourceRoot":"","sources":["../../src/store/store-types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAqBhD,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,EAAc,CAAC,sBAAsB,EAAE,EAAE,CAAC;CAAG;AAC/F,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,EAAoB,CAAC,4BAA4B,EAAE,EAAE,CAAC;CAAG"}
@@ -0,0 +1,88 @@
1
+ import type { ClientSession, ParamsObject } from '@livestore/common';
2
+ import type { LiveStoreSchema, MutationEvent } from '@livestore/common/schema';
3
+ import { Inspectable } from '@livestore/utils/effect';
4
+ import * as otel from '@opentelemetry/api';
5
+ import type { GraphQLSchema } from 'graphql';
6
+ import type { Ref } from '../reactive.js';
7
+ import type { LiveQuery, QueryContext, ReactivityGraph } from '../reactiveQueries/base-class.js';
8
+ import { SynchronousDatabaseWrapper } from '../SynchronousDatabaseWrapper.js';
9
+ import { ReferenceCountedSet } from '../utils/data-structures.js';
10
+ import type { BaseGraphQLContext, RefreshReason, StoreMutateOptions, StoreOptions, StoreOtel } from './store-types.js';
11
+ export declare class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLContext, TSchema extends LiveStoreSchema = LiveStoreSchema> extends Inspectable.Class {
12
+ readonly storeId: string;
13
+ reactivityGraph: ReactivityGraph;
14
+ syncDbWrapper: SynchronousDatabaseWrapper;
15
+ clientSession: ClientSession;
16
+ schema: LiveStoreSchema;
17
+ graphQLSchema?: GraphQLSchema;
18
+ graphQLContext?: TGraphQLContext;
19
+ otel: StoreOtel;
20
+ /**
21
+ * Note we're using `Ref<null>` here as we don't care about the value but only about *that* something has changed.
22
+ * This only works in combination with `equal: () => false` which will always trigger a refresh.
23
+ */
24
+ tableRefs: {
25
+ [key: string]: Ref<null, QueryContext, RefreshReason>;
26
+ };
27
+ private fiberSet;
28
+ private runtime;
29
+ /** RC-based set to see which queries are currently subscribed to */
30
+ activeQueries: ReferenceCountedSet<LiveQuery<any>>;
31
+ readonly __mutationEventSchema: import("@livestore/common/schema").MutationEventSchema<TSchema["_MutationDefMapType"]>;
32
+ private unsyncedMutationEvents;
33
+ private constructor();
34
+ static createStore: <TGraphQLContext_1 extends BaseGraphQLContext, TSchema_1 extends LiveStoreSchema = LiveStoreSchema>(storeOptions: StoreOptions<TGraphQLContext_1, TSchema_1>, parentSpan: otel.Span) => Store<TGraphQLContext_1, TSchema_1>;
35
+ get sessionId(): string;
36
+ /**
37
+ * Subscribe to the results of a query
38
+ * Returns a function to cancel the subscription.
39
+ */
40
+ subscribe: <TResult>(query$: LiveQuery<TResult, any>, onNewValue: (value: TResult) => void, onUnsubsubscribe?: () => void, options?: {
41
+ label?: string;
42
+ otelContext?: otel.Context;
43
+ skipInitialRun?: boolean;
44
+ } | undefined) => (() => void);
45
+ mutate: {
46
+ <const TMutationArg extends ReadonlyArray<MutationEvent.PartialForSchema<TSchema>>>(...list: TMutationArg): void;
47
+ (txn: <const TMutationArg extends ReadonlyArray<MutationEvent.PartialForSchema<TSchema>>>(...list: TMutationArg) => void): void;
48
+ <const TMutationArg extends ReadonlyArray<MutationEvent.PartialForSchema<TSchema>>>(options: StoreMutateOptions, ...list: TMutationArg): void;
49
+ (options: StoreMutateOptions, txn: <const TMutationArg extends ReadonlyArray<MutationEvent.PartialForSchema<TSchema>>>(...list: TMutationArg) => void): void;
50
+ };
51
+ /**
52
+ * This can be used in combination with `skipRefresh` when applying mutations.
53
+ * We might need a better solution for this. Let's see.
54
+ */
55
+ manualRefresh: (options?: {
56
+ label?: string;
57
+ }) => void;
58
+ /**
59
+ * Apply a mutation to the store.
60
+ * Returns the tables that were affected by the event.
61
+ * This is an internal method that doesn't trigger a refresh;
62
+ * the caller must refresh queries after calling this method.
63
+ */
64
+ mutateWithoutRefresh: (mutationEventDecoded_: MutationEvent.ForSchema<TSchema> | MutationEvent.PartialForSchema<TSchema>, options: {
65
+ otelContext: otel.Context;
66
+ coordinatorMode: "default" | "skip-coordinator" | "skip-persist";
67
+ }) => {
68
+ writeTables: ReadonlySet<string>;
69
+ durationMs: number;
70
+ };
71
+ /**
72
+ * Directly execute a SQL query on the Store.
73
+ * This should only be used for framework-internal purposes;
74
+ * all app writes should go through mutate.
75
+ */
76
+ __execute: (query: string, params?: ParamsObject, writeTables?: ReadonlySet<string>, otelContext?: otel.Context) => void;
77
+ __select: (query: string, params?: ParamsObject) => readonly any[];
78
+ private makeTableRef;
79
+ __devDownloadDb: () => void;
80
+ __devDownloadMutationLogDb: () => import("effect/Fiber").RuntimeFiber<import("effect/Fiber").RuntimeFiber<void, import("@livestore/common").UnexpectedError>, never>;
81
+ __devCurrentMutationEventId: () => import("@livestore/common").EventId;
82
+ toJSON: () => {
83
+ _tag: string;
84
+ reactivityGraph: import("../reactive.js").ReactiveGraphSnapshot;
85
+ };
86
+ private runEffectFork;
87
+ }
88
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAU9E,OAAO,EAA0B,WAAW,EAA2C,MAAM,yBAAyB,CAAA;AACtH,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAChG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAMtH,qBAAa,KAAK,CAChB,eAAe,SAAS,kBAAkB,GAAG,kBAAkB,EAC/D,OAAO,SAAS,eAAe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