@livestore/livestore 0.0.58-dev.9 → 0.1.0-dev.0
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 +1 -117
- package/dist/.tsbuildinfo +1 -1
- package/dist/effect/LiveStore.d.ts +6 -6
- package/dist/effect/LiveStore.d.ts.map +1 -1
- package/dist/effect/LiveStore.js +1 -1
- package/dist/effect/LiveStore.js.map +1 -1
- package/dist/global-state.d.ts.map +1 -1
- package/dist/global-state.js +2 -1
- package/dist/global-state.js.map +1 -1
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/reactiveQueries/base-class.d.ts +5 -4
- package/dist/reactiveQueries/base-class.d.ts.map +1 -1
- package/dist/reactiveQueries/base-class.js.map +1 -1
- package/dist/reactiveQueries/computed.d.ts +35 -0
- package/dist/reactiveQueries/computed.d.ts.map +1 -0
- package/dist/reactiveQueries/computed.js +57 -0
- package/dist/reactiveQueries/computed.js.map +1 -0
- package/dist/reactiveQueries/graphql.d.ts +2 -1
- package/dist/reactiveQueries/graphql.d.ts.map +1 -1
- package/dist/reactiveQueries/graphql.js.map +1 -1
- package/dist/reactiveQueries/sql.d.ts +2 -2
- package/dist/reactiveQueries/sql.d.ts.map +1 -1
- package/dist/reactiveQueries/sql.js +3 -3
- package/dist/reactiveQueries/sql.js.map +1 -1
- package/dist/reactiveQueries/sql.test.js +2 -2
- package/dist/reactiveQueries/sql.test.js.map +1 -1
- package/dist/row-query.d.ts +3 -2
- package/dist/row-query.d.ts.map +1 -1
- package/dist/row-query.js +14 -10
- package/dist/row-query.js.map +1 -1
- package/dist/store/create-store.d.ts +28 -0
- package/dist/store/create-store.d.ts.map +1 -0
- package/dist/store/create-store.js +85 -0
- package/dist/store/create-store.js.map +1 -0
- package/dist/store/devtools.d.ts +19 -0
- package/dist/store/devtools.d.ts.map +1 -0
- package/dist/store/devtools.js +141 -0
- package/dist/store/devtools.js.map +1 -0
- package/dist/store/store-context.d.ts +26 -0
- package/dist/store/store-context.d.ts.map +1 -0
- package/dist/store/store-context.js +6 -0
- package/dist/store/store-context.js.map +1 -0
- package/dist/store/store-types.d.ts +98 -0
- package/dist/store/store-types.d.ts.map +1 -0
- package/dist/store/store-types.js +6 -0
- package/dist/store/store-types.js.map +1 -0
- package/dist/store/store.d.ts +88 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +367 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store-devtools.d.ts +2 -2
- package/dist/store-devtools.d.ts.map +1 -1
- package/dist/store-devtools.js +2 -2
- package/dist/store-devtools.js.map +1 -1
- package/dist/store.d.ts +8 -8
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +54 -54
- package/dist/store.js.map +1 -1
- package/dist/utils/dev.d.ts +1 -0
- package/dist/utils/dev.d.ts.map +1 -1
- package/dist/utils/dev.js +5 -0
- package/dist/utils/dev.js.map +1 -1
- package/dist/{react/utils → utils}/stack-info.d.ts +1 -2
- package/dist/utils/stack-info.d.ts.map +1 -0
- package/dist/{react/utils → utils}/stack-info.js +1 -9
- package/dist/utils/stack-info.js.map +1 -0
- package/dist/utils/stack-info.test.d.ts.map +1 -0
- package/dist/{__tests__/react/utils → utils}/stack-info.test.js +1 -1
- package/dist/utils/stack-info.test.js.map +1 -0
- package/dist/utils/tests/fixture.d.ts +259 -0
- package/dist/utils/tests/fixture.d.ts.map +1 -0
- package/dist/utils/tests/fixture.js +32 -0
- package/dist/utils/tests/fixture.js.map +1 -0
- package/dist/utils/tests/mod.d.ts +3 -0
- package/dist/utils/tests/mod.d.ts.map +1 -0
- package/dist/utils/tests/mod.js +3 -0
- package/dist/utils/tests/mod.js.map +1 -0
- package/dist/utils/tests/otel.d.ts.map +1 -0
- package/dist/{__tests__/react/utils → utils/tests}/otel.js +3 -3
- package/dist/utils/tests/otel.js.map +1 -0
- package/package.json +13 -20
- package/src/ambient.d.ts +3 -1
- package/src/effect/LiveStore.ts +7 -7
- package/src/global-state.ts +5 -1
- package/src/index.ts +19 -7
- package/src/reactiveQueries/base-class.ts +5 -4
- package/src/reactiveQueries/{js.ts → computed.ts} +3 -3
- package/src/reactiveQueries/graphql.ts +2 -1
- package/src/reactiveQueries/sql.test.ts +2 -2
- package/src/reactiveQueries/sql.ts +5 -5
- package/src/row-query.ts +33 -17
- package/src/store/create-store.ts +214 -0
- package/src/{store-devtools.ts → store/devtools.ts} +9 -9
- package/src/store/store-types.ts +110 -0
- package/src/{store.ts → store/store.ts} +56 -415
- package/src/utils/dev.ts +6 -0
- package/src/{__tests__/react/utils → utils}/stack-info.test.ts +1 -1
- package/src/{react/utils → utils}/stack-info.ts +2 -12
- package/src/utils/tests/fixture.ts +73 -0
- package/src/utils/tests/mod.ts +2 -0
- package/src/{__tests__/react/utils → utils/tests}/otel.ts +4 -4
- package/tsconfig.json +1 -2
- package/vitest.config.js +0 -8
- package/dist/__tests__/react/fixture.d.ts +0 -461
- package/dist/__tests__/react/fixture.d.ts.map +0 -1
- package/dist/__tests__/react/fixture.js +0 -68
- package/dist/__tests__/react/fixture.js.map +0 -1
- package/dist/__tests__/react/utils/otel.d.ts.map +0 -1
- package/dist/__tests__/react/utils/otel.js.map +0 -1
- package/dist/__tests__/react/utils/stack-info.test.d.ts.map +0 -1
- package/dist/__tests__/react/utils/stack-info.test.js.map +0 -1
- package/dist/react/LiveStoreContext.d.ts +0 -7
- package/dist/react/LiveStoreContext.d.ts.map +0 -1
- package/dist/react/LiveStoreContext.js +0 -13
- package/dist/react/LiveStoreContext.js.map +0 -1
- package/dist/react/LiveStoreProvider.d.ts +0 -49
- package/dist/react/LiveStoreProvider.d.ts.map +0 -1
- package/dist/react/LiveStoreProvider.js +0 -169
- package/dist/react/LiveStoreProvider.js.map +0 -1
- package/dist/react/LiveStoreProvider.test.d.ts +0 -2
- package/dist/react/LiveStoreProvider.test.d.ts.map +0 -1
- package/dist/react/LiveStoreProvider.test.js +0 -62
- package/dist/react/LiveStoreProvider.test.js.map +0 -1
- package/dist/react/components/LiveList.d.ts +0 -21
- package/dist/react/components/LiveList.d.ts.map +0 -1
- package/dist/react/components/LiveList.js +0 -31
- package/dist/react/components/LiveList.js.map +0 -1
- package/dist/react/index.d.ts +0 -11
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js +0 -10
- package/dist/react/index.js.map +0 -1
- package/dist/react/useAtom.d.ts +0 -10
- package/dist/react/useAtom.d.ts.map +0 -1
- package/dist/react/useAtom.js +0 -37
- package/dist/react/useAtom.js.map +0 -1
- package/dist/react/useLocalId.d.ts +0 -10
- package/dist/react/useLocalId.d.ts.map +0 -1
- package/dist/react/useLocalId.js +0 -22
- package/dist/react/useLocalId.js.map +0 -1
- package/dist/react/useQuery.d.ts +0 -9
- package/dist/react/useQuery.d.ts.map +0 -1
- package/dist/react/useQuery.js +0 -70
- package/dist/react/useQuery.js.map +0 -1
- package/dist/react/useQuery.test.d.ts +0 -2
- package/dist/react/useQuery.test.d.ts.map +0 -1
- package/dist/react/useQuery.test.js +0 -51
- package/dist/react/useQuery.test.js.map +0 -1
- package/dist/react/useRow.d.ts +0 -46
- package/dist/react/useRow.d.ts.map +0 -1
- package/dist/react/useRow.js +0 -94
- package/dist/react/useRow.js.map +0 -1
- package/dist/react/useRow.test.d.ts +0 -2
- package/dist/react/useRow.test.d.ts.map +0 -1
- package/dist/react/useRow.test.js +0 -208
- package/dist/react/useRow.test.js.map +0 -1
- package/dist/react/useTemporaryQuery.d.ts +0 -22
- package/dist/react/useTemporaryQuery.d.ts.map +0 -1
- package/dist/react/useTemporaryQuery.js +0 -75
- package/dist/react/useTemporaryQuery.js.map +0 -1
- package/dist/react/useTemporaryQuery.test.d.ts +0 -2
- package/dist/react/useTemporaryQuery.test.d.ts.map +0 -1
- package/dist/react/useTemporaryQuery.test.js +0 -59
- package/dist/react/useTemporaryQuery.test.js.map +0 -1
- package/dist/react/utils/stack-info.d.ts.map +0 -1
- package/dist/react/utils/stack-info.js.map +0 -1
- package/dist/react/utils/useStateRefWithReactiveInput.d.ts +0 -13
- package/dist/react/utils/useStateRefWithReactiveInput.d.ts.map +0 -1
- package/dist/react/utils/useStateRefWithReactiveInput.js +0 -38
- package/dist/react/utils/useStateRefWithReactiveInput.js.map +0 -1
- package/src/__tests__/react/fixture.tsx +0 -126
- package/src/react/LiveStoreContext.ts +0 -20
- package/src/react/LiveStoreProvider.test.tsx +0 -109
- package/src/react/LiveStoreProvider.tsx +0 -291
- package/src/react/__snapshots__/useRow.test.tsx.snap +0 -359
- package/src/react/components/LiveList.tsx +0 -84
- package/src/react/index.ts +0 -19
- package/src/react/useAtom.ts +0 -55
- package/src/react/useLocalId.ts +0 -34
- package/src/react/useQuery.test.tsx +0 -82
- package/src/react/useQuery.ts +0 -106
- package/src/react/useRow.test.tsx +0 -345
- package/src/react/useRow.ts +0 -180
- package/src/react/useTemporaryQuery.test.tsx +0 -98
- package/src/react/useTemporaryQuery.ts +0 -131
- package/src/react/utils/useStateRefWithReactiveInput.ts +0 -51
- package/src/store-context.ts +0 -23
- /package/dist/{__tests__/react/utils → utils}/stack-info.test.d.ts +0 -0
- /package/dist/{__tests__/react/utils → utils/tests}/otel.d.ts +0 -0
package/dist/row-query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-query.js","sourceRoot":"","sources":["../src/row-query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"row-query.js","sourceRoot":"","sources":["../src/row-query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAUhD,OAAO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AAK,CAAC,SAAS,CAAC,IAAI,gBAAgB,KAAK,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAA;IAExG,IAAI,SAAS;QAAE,OAAM;IAErB,qDAAqD;IACrD,IAAI,QAAQ,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC;QACvD,OAAO,iBAAiB,CACtB,gCAAgC,KAAK,CAAC,SAAS,CAAC,IAAI,mDAAmD,CACxG,CAAA;IACH,CAAC;IACD,6GAA6G;IAC7G,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,qBAAqB,EAAE,CAAC,EAAE;QACzE,WAAW;QACX,eAAe,EAAE,SAAS;KAC3B,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Adapter, BootStatus } from '@livestore/common';
|
|
2
|
+
import { UnexpectedError } from '@livestore/common';
|
|
3
|
+
import type { LiveStoreSchema } from '@livestore/common/schema';
|
|
4
|
+
import { Effect, FiberSet, Scope } from '@livestore/utils/effect';
|
|
5
|
+
import * as otel from '@opentelemetry/api';
|
|
6
|
+
import type { ReactivityGraph } from '../reactiveQueries/base-class.js';
|
|
7
|
+
import { Store } from './store.js';
|
|
8
|
+
import type { BaseGraphQLContext, GraphQLOptions, OtelOptions } from './store-types.js';
|
|
9
|
+
export type CreateStoreOptions<TGraphQLContext extends BaseGraphQLContext, TSchema extends LiveStoreSchema> = {
|
|
10
|
+
schema: TSchema;
|
|
11
|
+
adapter: Adapter;
|
|
12
|
+
storeId: string;
|
|
13
|
+
reactivityGraph?: ReactivityGraph;
|
|
14
|
+
graphQLOptions?: GraphQLOptions<TGraphQLContext>;
|
|
15
|
+
otelOptions?: Partial<OtelOptions>;
|
|
16
|
+
boot?: (store: Store<TGraphQLContext, TSchema>, parentSpan: otel.Span) => void | Promise<void> | Effect.Effect<void, unknown, otel.Tracer>;
|
|
17
|
+
batchUpdates?: (run: () => void) => void;
|
|
18
|
+
disableDevtools?: boolean;
|
|
19
|
+
onBootStatus?: (status: BootStatus) => void;
|
|
20
|
+
};
|
|
21
|
+
/** Create a new LiveStore Store */
|
|
22
|
+
export declare const createStorePromise: <TGraphQLContext extends BaseGraphQLContext, TSchema extends LiveStoreSchema = LiveStoreSchema>({ signal, ...options }: CreateStoreOptions<TGraphQLContext, TSchema> & {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}) => Promise<Store<TGraphQLContext, TSchema>>;
|
|
25
|
+
export declare const createStore: <TGraphQLContext extends BaseGraphQLContext, TSchema extends LiveStoreSchema = LiveStoreSchema>({ schema, adapter, storeId, graphQLOptions, otelOptions, boot, reactivityGraph, batchUpdates, disableDevtools, onBootStatus, fiberSet, }: CreateStoreOptions<TGraphQLContext, TSchema> & {
|
|
26
|
+
fiberSet: FiberSet.FiberSet;
|
|
27
|
+
}) => Effect.Effect<Store<TGraphQLContext, TSchema>, UnexpectedError, Scope.Scope>;
|
|
28
|
+
//# sourceMappingURL=create-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-store.d.ts","sourceRoot":"","sources":["../../src/store/create-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EAKX,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,0BAA0B,CAAA;AAE9E,OAAO,EAIL,MAAM,EAEN,QAAQ,EAQR,KAAK,EACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE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F,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,EAC/B,eAAe,EACf,KAAK,CAAC,KAAK,CAiHZ,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { UnexpectedError } from '@livestore/common';
|
|
2
|
+
import { makeNoopTracer } from '@livestore/utils';
|
|
3
|
+
import { Cause, Deferred, Duration, Effect, Exit, FiberSet, Layer, Logger, LogLevel, MutableHashMap, OtelTracer, Queue, Runtime, Scope, } from '@livestore/utils/effect';
|
|
4
|
+
import * as otel from '@opentelemetry/api';
|
|
5
|
+
import { globalReactivityGraph } from '../global-state.js';
|
|
6
|
+
import { connectDevtoolsToStore } from './devtools.js';
|
|
7
|
+
import { Store } from './store.js';
|
|
8
|
+
/** Create a new LiveStore Store */
|
|
9
|
+
export const createStorePromise = async ({ signal, ...options }) => Effect.gen(function* () {
|
|
10
|
+
const scope = yield* Scope.make();
|
|
11
|
+
const runtime = yield* Effect.runtime();
|
|
12
|
+
if (signal !== undefined) {
|
|
13
|
+
signal.addEventListener('abort', () => {
|
|
14
|
+
Scope.close(scope, Exit.void).pipe(Effect.tapCauseLogPretty, Runtime.runFork(runtime));
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return yield* FiberSet.make().pipe(Effect.andThen((fiberSet) => createStore({ ...options, fiberSet })), Scope.extend(scope));
|
|
18
|
+
}).pipe(Effect.withSpan('createStore'), Effect.tapCauseLogPretty, Effect.annotateLogs({ thread: 'window' }), Effect.provide(Logger.pretty), Logger.withMinimumLogLevel(LogLevel.Debug), Effect.runPromise);
|
|
19
|
+
export const createStore = ({ schema, adapter, storeId, graphQLOptions, otelOptions, boot, reactivityGraph = globalReactivityGraph, batchUpdates, disableDevtools, onBootStatus, fiberSet, }) => {
|
|
20
|
+
const otelTracer = otelOptions?.tracer ?? makeNoopTracer();
|
|
21
|
+
const otelRootSpanContext = otelOptions?.rootSpanContext ?? otel.context.active();
|
|
22
|
+
const TracingLive = Layer.unwrapEffect(Effect.map(OtelTracer.make, Layer.setTracer)).pipe(Layer.provide(Layer.sync(OtelTracer.Tracer, () => otelTracer)));
|
|
23
|
+
return Effect.gen(function* () {
|
|
24
|
+
const span = yield* OtelTracer.currentOtelSpan.pipe(Effect.orDie);
|
|
25
|
+
const bootStatusQueue = yield* Queue.unbounded().pipe(Effect.acquireRelease(Queue.shutdown));
|
|
26
|
+
yield* Queue.take(bootStatusQueue).pipe(Effect.tapSync((status) => onBootStatus?.(status)), Effect.tap((status) => (status.stage === 'done' ? Queue.shutdown(bootStatusQueue) : Effect.void)), Effect.forever, Effect.tapCauseLogPretty, Effect.forkScoped);
|
|
27
|
+
const storeDeferred = yield* Deferred.make();
|
|
28
|
+
const connectDevtoolsToStore_ = (storeDevtoolsChannel) => Effect.gen(function* () {
|
|
29
|
+
const store = yield* Deferred.await(storeDeferred);
|
|
30
|
+
yield* connectDevtoolsToStore({ storeDevtoolsChannel, store });
|
|
31
|
+
});
|
|
32
|
+
const runtime = yield* Effect.runtime();
|
|
33
|
+
// TODO close parent scope? (Needs refactor with Mike Arnaldi)
|
|
34
|
+
const shutdown = (cause) => Effect.gen(function* () {
|
|
35
|
+
// NOTE we're calling `cause.toString()` here to avoid triggering a `console.error` in the grouped log
|
|
36
|
+
const logCause = Cause.isFailType(cause) && cause.error._tag === 'LiveStore.IntentionalShutdownCause'
|
|
37
|
+
? cause.toString()
|
|
38
|
+
: cause;
|
|
39
|
+
yield* Effect.logDebug(`Shutting down LiveStore`, logCause);
|
|
40
|
+
FiberSet.clear(fiberSet).pipe(Effect.andThen(() => FiberSet.run(fiberSet, Effect.failCause(cause))), Effect.timeout(Duration.seconds(1)), Effect.logWarnIfTakesLongerThan({ label: '@livestore/livestore:shutdown:clear-fiber-set', duration: 500 }), Effect.catchTag('TimeoutException', (err) => Effect.logError('Store shutdown timed out. Forcing shutdown.', err).pipe(Effect.andThen(FiberSet.run(fiberSet, Effect.failCause(cause))))), Runtime.runFork(runtime));
|
|
41
|
+
}).pipe(Effect.withSpan('livestore:shutdown'));
|
|
42
|
+
const clientSession = yield* adapter({
|
|
43
|
+
schema,
|
|
44
|
+
storeId,
|
|
45
|
+
devtoolsEnabled: disableDevtools !== true,
|
|
46
|
+
bootStatusQueue,
|
|
47
|
+
shutdown,
|
|
48
|
+
connectDevtoolsToStore: connectDevtoolsToStore_,
|
|
49
|
+
}).pipe(Effect.withPerformanceMeasure('livestore:makeAdapter'), Effect.withSpan('createStore:makeAdapter'));
|
|
50
|
+
// TODO fill up with unsynced mutation events from the client session
|
|
51
|
+
const unsyncedMutationEvents = MutableHashMap.empty();
|
|
52
|
+
const store = Store.createStore({
|
|
53
|
+
clientSession,
|
|
54
|
+
schema,
|
|
55
|
+
graphQLOptions,
|
|
56
|
+
otelOptions: { tracer: otelTracer, rootSpanContext: otelRootSpanContext },
|
|
57
|
+
reactivityGraph,
|
|
58
|
+
disableDevtools,
|
|
59
|
+
unsyncedMutationEvents,
|
|
60
|
+
fiberSet,
|
|
61
|
+
runtime,
|
|
62
|
+
// NOTE during boot we're not yet executing mutations in a batched context
|
|
63
|
+
// but only set the provided `batchUpdates` function after boot
|
|
64
|
+
batchUpdates: (run) => run(),
|
|
65
|
+
storeId,
|
|
66
|
+
}, span);
|
|
67
|
+
if (boot !== undefined) {
|
|
68
|
+
// TODO also incorporate `boot` function progress into `bootStatusQueue`
|
|
69
|
+
yield* Effect.tryAll(() => boot(store, span)).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('createStore:boot'));
|
|
70
|
+
}
|
|
71
|
+
// NOTE it's important to yield here to allow the forked Effect in the store constructor to run
|
|
72
|
+
yield* Effect.yieldNow();
|
|
73
|
+
if (batchUpdates !== undefined) {
|
|
74
|
+
// Replacing the default batchUpdates function with the provided one after boot
|
|
75
|
+
store.reactivityGraph.context.effectsWrapper = batchUpdates;
|
|
76
|
+
}
|
|
77
|
+
yield* Deferred.succeed(storeDeferred, store);
|
|
78
|
+
return store;
|
|
79
|
+
}).pipe(Effect.withSpan('createStore', {
|
|
80
|
+
parent: otelOptions?.rootSpanContext
|
|
81
|
+
? OtelTracer.makeExternalSpan(otel.trace.getSpanContext(otelOptions.rootSpanContext))
|
|
82
|
+
: undefined,
|
|
83
|
+
}), Effect.provide(TracingLive));
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=create-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-store.js","sourceRoot":"","sources":["../../src/store/create-store.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,cAAc,EACd,UAAU,EACV,KAAK,EACL,OAAO,EACP,KAAK,GACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAmBlC,mCAAmC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAGrC,EACA,MAAM,EACN,GAAG,OAAO,EAC8D,EAA4C,EAAE,CACtH,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACjC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IAEvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACpC,KAAK,CAAC,KAAK,CAAC,KAA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AAQ,CAAC,OAAO,CAAC,aAAa,EAAE,KAAqB,CAAC,CAAA;QAE7D,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE;QAC7B,MAAM,EAAE,WAAW,EAAE,eAAe;YAClC,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,eAAe,CAAE,CAAC;YACtF,CAAC,CAAC,SAAS;KACd,CAAC,EACF,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAC5B,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -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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;wBAC/B,mBAAmB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC;qBACvD,CAAC,CAAC;oBACH,SAAS;oBACT,gBAAgB;oBAChB,SAAS;iBACV,CAAC,CACH,EACH,EAAE,OAAO,EAAE,GAAG,EAAE,CACjB,CAAA;gBAEH,IAAI,EAAE,CAAA;gBAEN,2FAA2F;gBAC3F,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;gBAExC,wBAAwB,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAA;gBAEhG,MAAK;YACP,CAAC;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/store-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC1G,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,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,q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A;CACjG,CAAA;AAED,MAAM,MAAM,aAAa,GACrB,sBAAsB,GACtB;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,sCAAsC;IACtC,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAE3C,mDAAmD;IACnD,WAAW,EAAE,aAAa,CAAC,MAAM,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,GAAG,eAAe,CACjD,SAAQ,WAAW,CAAC,KAAK;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,eAAe,CAAA;IAChC,aAAa,EAAE,0BAA0B,CAAA;IACzC,aAAa,EAAE,aAAa,CAAA;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,cAAc,CAAC,EAAE,eAAe,CAAA;IAChC,IA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