@livestore/solid 0.0.0-snapshot-f2e552007b925ea180db22534afe9d5c076c470f → 0.0.0-snapshot-aed277ba0960f72b8d464508961ab4aec1881230
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 +13 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/mod.d.ts +2 -1
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +2 -1
- package/dist/mod.js.map +1 -1
- package/dist/query.d.ts +4 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +15 -0
- package/dist/query.js.map +1 -0
- package/dist/store.d.ts +4 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +42 -52
- package/dist/store.js.map +1 -1
- package/package.json +12 -13
- package/src/mod.ts +2 -1
- package/src/query.ts +23 -0
- package/src/store.ts +64 -89
- package/tsconfig.json +0 -1
- package/vitest.config.js +0 -17
package/dist/mod.d.ts
CHANGED
package/dist/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/mod.js
CHANGED
package/dist/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/query.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GetResult, LiveQueryDefAny } from '@livestore/livestore';
|
|
2
|
+
import * as Solid from 'solid-js';
|
|
3
|
+
export declare const query: <TQuery extends LiveQueryDefAny>(queryDef: TQuery, initialValue: GetResult<TQuery>) => Solid.Accessor<GetResult<TQuery>>;
|
|
4
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAIjC,eAAO,MAAM,KAAK,GAAI,MAAM,SAAS,eAAe,YACxC,MAAM,gBAEF,SAAS,CAAC,MAAM,CAAC,KAC9B,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAalC,CAAA"}
|
package/dist/query.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Solid from 'solid-js';
|
|
2
|
+
import { storeToExport } from './store.js';
|
|
3
|
+
export const query = (queryDef,
|
|
4
|
+
// TODO do we actually need an `initialValue` at all?
|
|
5
|
+
initialValue) => {
|
|
6
|
+
const [value, setValue] = Solid.createSignal(initialValue);
|
|
7
|
+
const store = storeToExport();
|
|
8
|
+
// TODO avoid null-optionality branching
|
|
9
|
+
const unsubscribe = store?.subscribe(queryDef, { onUpdate: setValue });
|
|
10
|
+
Solid.onCleanup(() => {
|
|
11
|
+
unsubscribe?.();
|
|
12
|
+
});
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,QAAgB;AAChB,qDAAqD;AACrD,YAA+B,EACI,EAAE;IACrC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,CAAA;IAE1D,MAAM,KAAK,GAAG,aAAa,EAAE,CAAA;IAE7B,wCAAwC;IACxC,MAAM,WAAW,GAAG,KAAK,EAAE,SAAS,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEtE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,WAAW,EAAE,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type { BaseGraphQLContext, CreateStoreOptions,
|
|
2
|
-
import
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const row: <TTableDef extends DbSchema.TableDef<DbSchema.DefaultSqliteTableDef, boolean, DbSchema.TableOptions & {
|
|
6
|
-
isSingleton: false;
|
|
7
|
-
deriveMutations: {
|
|
8
|
-
enabled: true;
|
|
9
|
-
};
|
|
10
|
-
}>>(table: TTableDef, id: string) => Accessor<RowResult<TTableDef> | undefined>;
|
|
1
|
+
import type { BaseGraphQLContext, CreateStoreOptions, LiveStoreSchema, Store } from '@livestore/livestore';
|
|
2
|
+
import * as Solid from 'solid-js';
|
|
3
|
+
export declare const storeToExport: Solid.Accessor<Store<BaseGraphQLContext, LiveStoreSchema> | undefined>, setStoreToExport: Solid.Setter<Store<BaseGraphQLContext, LiveStoreSchema> | undefined>;
|
|
4
|
+
export declare const getStore: <Schema extends LiveStoreSchema, GraphQLContext extends BaseGraphQLContext = BaseGraphQLContext>({ adapter, schema, storeId, }: Pick<CreateStoreOptions<GraphQLContext, Schema>, "schema" | "adapter" | "storeId">) => Promise<Solid.Accessor<Store<BaseGraphQLContext, Schema> | undefined>>;
|
|
11
5
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAElB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAElB,kBAAkB,EAGlB,eAAe,EAEf,KAAK,EACN,MAAM,sBAAsB,CAAA;AAI7B,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AA8CjC,eAAO,MAAO,aAAa,0EAAE,gBAAgB,sEAA0D,CAAA;AAsGvG,eAAO,MAAM,QAAQ,GACnB,MAAM,SAAS,eAAe,EAC9B,cAAc,SAAS,kBAAkB,sDAKxC,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,KAAG,OAAO,CAC7F,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,kBAAkB,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAc9D,CAAA"}
|
package/dist/store.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { provideOtel } from '@livestore/common';
|
|
2
|
+
import { createStore, StoreAbort, StoreInterrupted } from '@livestore/livestore';
|
|
3
|
+
import { LS_DEV } from '@livestore/utils';
|
|
4
|
+
import { Deferred, Effect, Exit, identity, Logger, LogLevel, Scope, TaskTracing } from '@livestore/utils/effect';
|
|
5
|
+
import * as Solid from 'solid-js';
|
|
6
|
+
const interrupt = (componentScope, shutdownDeferred, error) => Effect.gen(function* () {
|
|
7
|
+
// console.log('[@livestore/livestore/react] interupting', error)
|
|
8
|
+
yield* Scope.close(componentScope, Exit.fail(error));
|
|
9
|
+
yield* Deferred.fail(shutdownDeferred, error);
|
|
10
|
+
}).pipe(Effect.tapErrorCause((cause) => Effect.logDebug('[@livestore/livestore/solid] interrupting', cause)), Effect.runFork);
|
|
8
11
|
const semaphoreMap = new Map();
|
|
9
12
|
const withSemaphore = (schemaKey) => {
|
|
10
13
|
let semaphore = semaphoreMap.get(schemaKey);
|
|
@@ -16,13 +19,14 @@ const withSemaphore = (schemaKey) => {
|
|
|
16
19
|
};
|
|
17
20
|
const storeValue = {
|
|
18
21
|
value: { stage: 'loading' },
|
|
19
|
-
|
|
22
|
+
shutdownDeferred: undefined,
|
|
23
|
+
componentScope: undefined,
|
|
20
24
|
counter: 0,
|
|
21
25
|
};
|
|
22
|
-
const [, setInternalStore] = createSignal(storeValue);
|
|
23
|
-
const [storeToExport, setStoreToExport] = createSignal();
|
|
24
|
-
const setupStore = async ({ schema, storeId, graphQLOptions,
|
|
25
|
-
createEffect(
|
|
26
|
+
const [, setInternalStore] = Solid.createSignal(storeValue);
|
|
27
|
+
export const [storeToExport, setStoreToExport] = Solid.createSignal();
|
|
28
|
+
const setupStore = async ({ schema, storeId, graphQLOptions, boot, adapter, batchUpdates, disableDevtools, signal, setupDone, }) => {
|
|
29
|
+
Solid.createEffect(() => {
|
|
26
30
|
const counter = storeValue.counter;
|
|
27
31
|
const setContextValue = (value) => {
|
|
28
32
|
if (storeValue.counter !== counter)
|
|
@@ -30,7 +34,8 @@ const setupStore = async ({ schema, storeId, graphQLOptions, otelOptions, boot,
|
|
|
30
34
|
storeValue.value = value;
|
|
31
35
|
setInternalStore({
|
|
32
36
|
value: storeValue.value,
|
|
33
|
-
|
|
37
|
+
shutdownDeferred: storeValue.shutdownDeferred,
|
|
38
|
+
componentScope: storeValue.componentScope,
|
|
34
39
|
counter: counter + 1,
|
|
35
40
|
});
|
|
36
41
|
if (value.stage === 'running') {
|
|
@@ -38,24 +43,24 @@ const setupStore = async ({ schema, storeId, graphQLOptions, otelOptions, boot,
|
|
|
38
43
|
}
|
|
39
44
|
};
|
|
40
45
|
signal?.addEventListener('abort', () => {
|
|
41
|
-
if (storeValue.
|
|
42
|
-
|
|
43
|
-
storeValue.
|
|
46
|
+
if (storeValue.componentScope !== undefined &&
|
|
47
|
+
storeValue.shutdownDeferred !== undefined &&
|
|
48
|
+
storeValue.counter === counter) {
|
|
49
|
+
interrupt(storeValue.componentScope, storeValue.shutdownDeferred, new StoreAbort());
|
|
50
|
+
storeValue.componentScope = undefined;
|
|
51
|
+
storeValue.shutdownDeferred = undefined;
|
|
44
52
|
}
|
|
45
53
|
});
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
54
|
+
Effect.gen(function* () {
|
|
55
|
+
const componentScope = yield* Scope.make();
|
|
56
|
+
const shutdownDeferred = yield* Deferred.make();
|
|
49
57
|
yield* Effect.gen(function* () {
|
|
50
|
-
const
|
|
51
|
-
fiberSet,
|
|
58
|
+
const store = yield* createStore({
|
|
52
59
|
schema,
|
|
53
60
|
storeId,
|
|
54
61
|
graphQLOptions,
|
|
55
|
-
otelOptions,
|
|
56
62
|
boot,
|
|
57
63
|
adapter,
|
|
58
|
-
reactivityGraph,
|
|
59
64
|
batchUpdates,
|
|
60
65
|
disableDevtools,
|
|
61
66
|
onBootStatus: (status) => {
|
|
@@ -63,46 +68,31 @@ const setupStore = async ({ schema, storeId, graphQLOptions, otelOptions, boot,
|
|
|
63
68
|
return;
|
|
64
69
|
setContextValue(status);
|
|
65
70
|
},
|
|
66
|
-
});
|
|
67
|
-
setContextValue({ stage: 'running', store
|
|
68
|
-
|
|
69
|
-
}).pipe(
|
|
71
|
+
}).pipe(Effect.tapErrorCause((cause) => Deferred.failCause(shutdownDeferred, cause)));
|
|
72
|
+
setContextValue({ stage: 'running', store });
|
|
73
|
+
setupDone();
|
|
74
|
+
}).pipe(Scope.extend(componentScope), Effect.forkIn(componentScope));
|
|
70
75
|
const shutdownContext = (cause) => Effect.sync(() => setContextValue({ stage: 'shutdown', cause }));
|
|
71
|
-
yield*
|
|
72
|
-
}).pipe(Effect.scoped, withSemaphore(storeId), Effect.tapCauseLogPretty, Effect.annotateLogs({ thread: 'window' }), Effect.provide(Logger.
|
|
73
|
-
onCleanup(() => {
|
|
74
|
-
if (storeValue.
|
|
75
|
-
interrupt(storeValue.
|
|
76
|
-
storeValue.
|
|
76
|
+
yield* Deferred.await(shutdownDeferred).pipe(Effect.tapErrorCause((cause) => Effect.logDebug('[@livestore/livestore/react] shutdown', cause)), Effect.catchTag('LiveStore.IntentionalShutdownCause', (cause) => shutdownContext(cause)), Effect.catchTag('LiveStore.StoreAbort', (cause) => shutdownContext(cause)), Effect.tapError((error) => Effect.sync(() => setContextValue({ stage: 'error', error }))), Effect.tapDefect((defect) => Effect.sync(() => setContextValue({ stage: 'error', error: defect }))), Effect.exit);
|
|
77
|
+
}).pipe(Effect.scoped, withSemaphore(storeId), Effect.withSpan('@livestore/solid:setupStore'), LS_DEV ? TaskTracing.withAsyncTaggingTracing((name) => console.createTask(name)) : identity, provideOtel({}), Effect.tapCauseLogPretty, Effect.annotateLogs({ thread: 'window' }), Effect.provide(Logger.prettyWithThread('window')), Logger.withMinimumLogLevel(LogLevel.Debug), Effect.runFork);
|
|
78
|
+
Solid.onCleanup(() => {
|
|
79
|
+
if (storeValue.componentScope !== undefined && storeValue.shutdownDeferred !== undefined) {
|
|
80
|
+
interrupt(storeValue.componentScope, storeValue.shutdownDeferred, new StoreInterrupted());
|
|
81
|
+
storeValue.componentScope = undefined;
|
|
82
|
+
storeValue.shutdownDeferred = undefined;
|
|
77
83
|
}
|
|
78
84
|
});
|
|
79
85
|
});
|
|
80
86
|
};
|
|
81
87
|
export const getStore = async ({ adapter, schema, storeId, }) => {
|
|
88
|
+
const setupDone = Promise.withResolvers();
|
|
82
89
|
await setupStore({
|
|
83
90
|
adapter,
|
|
84
91
|
schema,
|
|
85
92
|
storeId,
|
|
93
|
+
setupDone: setupDone.resolve,
|
|
86
94
|
});
|
|
87
|
-
|
|
88
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
89
|
-
}
|
|
95
|
+
await setupDone.promise;
|
|
90
96
|
return storeToExport;
|
|
91
97
|
};
|
|
92
|
-
export const query = (query$, initialValue) => {
|
|
93
|
-
const [value, setValue] = createSignal(initialValue);
|
|
94
|
-
const unsubscribe = storeToExport()?.subscribe(query$, setValue);
|
|
95
|
-
onCleanup(() => {
|
|
96
|
-
unsubscribe?.();
|
|
97
|
-
});
|
|
98
|
-
return value;
|
|
99
|
-
};
|
|
100
|
-
export const row = (table, id) => {
|
|
101
|
-
const [value, setValue] = createSignal();
|
|
102
|
-
const unsubscribe = rowQuery(table, id).subscribe(setValue);
|
|
103
|
-
onCleanup(() => {
|
|
104
|
-
unsubscribe?.();
|
|
105
|
-
});
|
|
106
|
-
return value;
|
|
107
|
-
};
|
|
108
98
|
//# sourceMappingURL=store.js.map
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,WAAW,EAAwB,MAAM,mBAAmB,CAAA;AAWpG,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAChH,OAAO,KAAK,KA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AAC,QAAQ,CAAC,KAAK,CAAC,EAC1C,MAAM,CAAC,OAAO,CACf,CAAA;QAED,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACnB,IAAI,UAAU,CAAC,cAAc,KAAK,SAAS,IAAI,UAAU,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACzF,SAAS,CAAC,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC,gBAAgB,EAAE,IAAI,gBAAgB,EAAE,CAAC,CAAA;gBACzF,UAAU,CAAC,cAAc,GAAG,SAAS,CAAA;gBACrC,UAAU,CAAC,gBAAgB,GAAG,SAAS,CAAA;YACzC,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAG3B,EACA,OAAO,EACP,MAAM,EACN,OAAO,GAC4E,EAEnF,EAAE;IACF,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,EAAQ,CAAA;IAE/C,MAAM,UAAU,CAAC;QACf,OAAO;QACP,MAAM;QACN,OAAO;QACP,SAAS,EAAE,SAAS,CAAC,OAAO;KAC7B,CAAC,CAAA;IAEF,MAAM,SAAS,CAAC,OAAO,CAAA;IAEvB,OAAO,aAA6E,CAAA;AACtF,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/solid",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-aed277ba0960f72b8d464508961ab4aec1881230",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -10,22 +10,21 @@
|
|
|
10
10
|
},
|
|
11
11
|
"types": "./dist/mod.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@opentelemetry/api": "
|
|
14
|
-
"@livestore/common": "0.0.0-snapshot-
|
|
15
|
-
"@livestore/db-schema": "0.0.0-snapshot-
|
|
16
|
-
"@livestore/livestore": "0.0.0-snapshot-
|
|
17
|
-
"@livestore/utils": "0.0.0-snapshot-
|
|
13
|
+
"@opentelemetry/api": "1.9.0",
|
|
14
|
+
"@livestore/common": "0.0.0-snapshot-aed277ba0960f72b8d464508961ab4aec1881230",
|
|
15
|
+
"@livestore/db-schema": "0.0.0-snapshot-aed277ba0960f72b8d464508961ab4aec1881230",
|
|
16
|
+
"@livestore/livestore": "0.0.0-snapshot-aed277ba0960f72b8d464508961ab4aec1881230",
|
|
17
|
+
"@livestore/utils": "0.0.0-snapshot-aed277ba0960f72b8d464508961ab4aec1881230"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@opentelemetry/sdk-trace-base": "1.
|
|
21
|
-
"jsdom": "^
|
|
22
|
-
"typescript": "5.
|
|
23
|
-
"vite": "
|
|
24
|
-
"vitest": "^2.1.4"
|
|
25
|
-
"@livestore/web": "0.0.0-snapshot-f2e552007b925ea180db22534afe9d5c076c470f"
|
|
20
|
+
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
21
|
+
"jsdom": "^26.0.0",
|
|
22
|
+
"typescript": "^5.7.2",
|
|
23
|
+
"vite": "^6.0.11",
|
|
24
|
+
"vitest": "^2.1.4"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
|
-
"solid-js": "
|
|
27
|
+
"solid-js": "~1.9.0"
|
|
29
28
|
},
|
|
30
29
|
"publishConfig": {
|
|
31
30
|
"access": "public"
|
package/src/mod.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { getStore
|
|
1
|
+
export { getStore } from './store.js'
|
|
2
|
+
export { query } from './query.js'
|
package/src/query.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GetResult, LiveQueryDefAny } from '@livestore/livestore'
|
|
2
|
+
import * as Solid from 'solid-js'
|
|
3
|
+
|
|
4
|
+
import { storeToExport } from './store.js'
|
|
5
|
+
|
|
6
|
+
export const query = <TQuery extends LiveQueryDefAny>(
|
|
7
|
+
queryDef: TQuery,
|
|
8
|
+
// TODO do we actually need an `initialValue` at all?
|
|
9
|
+
initialValue: GetResult<TQuery>,
|
|
10
|
+
): Solid.Accessor<GetResult<TQuery>> => {
|
|
11
|
+
const [value, setValue] = Solid.createSignal(initialValue)
|
|
12
|
+
|
|
13
|
+
const store = storeToExport()
|
|
14
|
+
|
|
15
|
+
// TODO avoid null-optionality branching
|
|
16
|
+
const unsubscribe = store?.subscribe(queryDef, { onUpdate: setValue })
|
|
17
|
+
|
|
18
|
+
Solid.onCleanup(() => {
|
|
19
|
+
unsubscribe?.()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
return value
|
|
23
|
+
}
|
package/src/store.ts
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IntentionalShutdownCause, provideOtel, type UnexpectedError } from '@livestore/common'
|
|
2
2
|
import type {
|
|
3
3
|
BaseGraphQLContext,
|
|
4
4
|
BootStatus,
|
|
5
5
|
CreateStoreOptions,
|
|
6
|
-
DbSchema,
|
|
7
|
-
GetResult,
|
|
8
|
-
LiveQueryAny,
|
|
9
6
|
LiveStoreContext as StoreContext_,
|
|
10
7
|
LiveStoreContextRunning,
|
|
11
8
|
LiveStoreSchema,
|
|
12
|
-
|
|
9
|
+
ShutdownDeferred,
|
|
13
10
|
Store,
|
|
14
11
|
} from '@livestore/livestore'
|
|
15
|
-
import { createStore,
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
const interrupt = (
|
|
12
|
+
import { createStore, StoreAbort, StoreInterrupted } from '@livestore/livestore'
|
|
13
|
+
import { LS_DEV } from '@livestore/utils'
|
|
14
|
+
import { Deferred, Effect, Exit, identity, Logger, LogLevel, Scope, TaskTracing } from '@livestore/utils/effect'
|
|
15
|
+
import * as Solid from 'solid-js'
|
|
16
|
+
|
|
17
|
+
const interrupt = (
|
|
18
|
+
componentScope: Scope.CloseableScope,
|
|
19
|
+
shutdownDeferred: ShutdownDeferred,
|
|
20
|
+
error: StoreAbort | StoreInterrupted,
|
|
21
|
+
) =>
|
|
21
22
|
Effect.gen(function* () {
|
|
22
|
-
|
|
23
|
-
yield*
|
|
23
|
+
// console.log('[@livestore/livestore/react] interupting', error)
|
|
24
|
+
yield* Scope.close(componentScope, Exit.fail(error))
|
|
25
|
+
yield* Deferred.fail(shutdownDeferred, error)
|
|
24
26
|
}).pipe(
|
|
25
|
-
Effect.tapErrorCause((cause) => Effect.logDebug(
|
|
27
|
+
Effect.tapErrorCause((cause) => Effect.logDebug('[@livestore/livestore/solid] interrupting', cause)),
|
|
26
28
|
Effect.runFork,
|
|
27
29
|
)
|
|
28
30
|
|
|
@@ -39,35 +41,37 @@ const withSemaphore = (schemaKey: SchemaKey) => {
|
|
|
39
41
|
|
|
40
42
|
const storeValue: {
|
|
41
43
|
value: StoreContext_ | BootStatus
|
|
42
|
-
|
|
44
|
+
shutdownDeferred: ShutdownDeferred | undefined
|
|
45
|
+
componentScope: Scope.CloseableScope | undefined
|
|
43
46
|
counter: number
|
|
44
47
|
} = {
|
|
45
48
|
value: { stage: 'loading' },
|
|
46
|
-
|
|
49
|
+
shutdownDeferred: undefined,
|
|
50
|
+
componentScope: undefined,
|
|
47
51
|
counter: 0,
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
const [, setInternalStore] = createSignal<{
|
|
54
|
+
const [, setInternalStore] = Solid.createSignal<{
|
|
51
55
|
value: StoreContext_ | BootStatus
|
|
52
|
-
|
|
56
|
+
shutdownDeferred: ShutdownDeferred | undefined
|
|
57
|
+
componentScope: Scope.CloseableScope | undefined
|
|
53
58
|
counter: number
|
|
54
59
|
}>(storeValue)
|
|
55
60
|
|
|
56
|
-
const [storeToExport, setStoreToExport] = createSignal<LiveStoreContextRunning['store']>()
|
|
61
|
+
export const [storeToExport, setStoreToExport] = Solid.createSignal<LiveStoreContextRunning['store']>()
|
|
57
62
|
|
|
58
63
|
const setupStore = async <GraphQLContext extends BaseGraphQLContext>({
|
|
59
64
|
schema,
|
|
60
65
|
storeId,
|
|
61
66
|
graphQLOptions,
|
|
62
|
-
otelOptions,
|
|
63
67
|
boot,
|
|
64
68
|
adapter,
|
|
65
69
|
batchUpdates,
|
|
66
70
|
disableDevtools,
|
|
67
|
-
reactivityGraph,
|
|
68
71
|
signal,
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
setupDone,
|
|
73
|
+
}: CreateStoreOptions<GraphQLContext, LiveStoreSchema> & { signal?: AbortSignal; setupDone: () => void }) => {
|
|
74
|
+
Solid.createEffect(() => {
|
|
71
75
|
const counter = storeValue.counter
|
|
72
76
|
|
|
73
77
|
const setContextValue = (value: StoreContext_ | BootStatus) => {
|
|
@@ -75,7 +79,8 @@ const setupStore = async <GraphQLContext extends BaseGraphQLContext>({
|
|
|
75
79
|
storeValue.value = value
|
|
76
80
|
setInternalStore({
|
|
77
81
|
value: storeValue.value,
|
|
78
|
-
|
|
82
|
+
shutdownDeferred: storeValue.shutdownDeferred,
|
|
83
|
+
componentScope: storeValue.componentScope,
|
|
79
84
|
counter: counter + 1,
|
|
80
85
|
})
|
|
81
86
|
if (value.stage === 'running') {
|
|
@@ -84,47 +89,48 @@ const setupStore = async <GraphQLContext extends BaseGraphQLContext>({
|
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
signal?.addEventListener('abort', () => {
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
storeValue.
|
|
92
|
+
if (
|
|
93
|
+
storeValue.componentScope !== undefined &&
|
|
94
|
+
storeValue.shutdownDeferred !== undefined &&
|
|
95
|
+
storeValue.counter === counter
|
|
96
|
+
) {
|
|
97
|
+
interrupt(storeValue.componentScope, storeValue.shutdownDeferred, new StoreAbort())
|
|
98
|
+
storeValue.componentScope = undefined
|
|
99
|
+
storeValue.shutdownDeferred = undefined
|
|
90
100
|
}
|
|
91
101
|
})
|
|
92
102
|
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
103
|
+
Effect.gen(function* () {
|
|
104
|
+
const componentScope = yield* Scope.make()
|
|
105
|
+
const shutdownDeferred = yield* Deferred.make<
|
|
106
|
+
void,
|
|
96
107
|
UnexpectedError | IntentionalShutdownCause | StoreAbort | StoreInterrupted
|
|
97
108
|
>()
|
|
98
109
|
|
|
99
|
-
storeValue.fiberSet = fiberSet
|
|
100
|
-
|
|
101
110
|
yield* Effect.gen(function* () {
|
|
102
|
-
const
|
|
103
|
-
fiberSet,
|
|
111
|
+
const store = yield* createStore({
|
|
104
112
|
schema,
|
|
105
113
|
storeId,
|
|
106
114
|
graphQLOptions,
|
|
107
|
-
otelOptions,
|
|
108
115
|
boot,
|
|
109
116
|
adapter,
|
|
110
|
-
reactivityGraph,
|
|
111
117
|
batchUpdates,
|
|
112
118
|
disableDevtools,
|
|
113
119
|
onBootStatus: (status) => {
|
|
114
120
|
if (storeValue.value.stage === 'running' || storeValue.value.stage === 'error') return
|
|
115
121
|
setContextValue(status)
|
|
116
122
|
},
|
|
117
|
-
})
|
|
123
|
+
}).pipe(Effect.tapErrorCause((cause) => Deferred.failCause(shutdownDeferred, cause)))
|
|
118
124
|
|
|
119
|
-
setContextValue({ stage: 'running', store
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}).pipe(Effect.scoped, FiberSet.run(fiberSet))
|
|
125
|
+
setContextValue({ stage: 'running', store })
|
|
126
|
+
setupDone()
|
|
127
|
+
}).pipe(Scope.extend(componentScope), Effect.forkIn(componentScope))
|
|
123
128
|
|
|
124
129
|
const shutdownContext = (cause: IntentionalShutdownCause | StoreAbort) =>
|
|
125
130
|
Effect.sync(() => setContextValue({ stage: 'shutdown', cause }))
|
|
126
131
|
|
|
127
|
-
yield*
|
|
132
|
+
yield* Deferred.await(shutdownDeferred).pipe(
|
|
133
|
+
Effect.tapErrorCause((cause) => Effect.logDebug('[@livestore/livestore/react] shutdown', cause)),
|
|
128
134
|
Effect.catchTag('LiveStore.IntentionalShutdownCause', (cause) => shutdownContext(cause)),
|
|
129
135
|
Effect.catchTag('LiveStore.StoreAbort', (cause) => shutdownContext(cause)),
|
|
130
136
|
Effect.tapError((error) => Effect.sync(() => setContextValue({ stage: 'error', error }))),
|
|
@@ -134,17 +140,21 @@ const setupStore = async <GraphQLContext extends BaseGraphQLContext>({
|
|
|
134
140
|
}).pipe(
|
|
135
141
|
Effect.scoped,
|
|
136
142
|
withSemaphore(storeId),
|
|
143
|
+
Effect.withSpan('@livestore/solid:setupStore'),
|
|
144
|
+
LS_DEV ? TaskTracing.withAsyncTaggingTracing((name: string) => (console as any).createTask(name)) : identity,
|
|
145
|
+
provideOtel({}),
|
|
137
146
|
Effect.tapCauseLogPretty,
|
|
138
147
|
Effect.annotateLogs({ thread: 'window' }),
|
|
139
|
-
Effect.provide(Logger.
|
|
148
|
+
Effect.provide(Logger.prettyWithThread('window')),
|
|
140
149
|
Logger.withMinimumLogLevel(LogLevel.Debug),
|
|
141
|
-
Effect.
|
|
150
|
+
Effect.runFork,
|
|
142
151
|
)
|
|
143
152
|
|
|
144
|
-
onCleanup(() => {
|
|
145
|
-
if (storeValue.
|
|
146
|
-
interrupt(storeValue.
|
|
147
|
-
storeValue.
|
|
153
|
+
Solid.onCleanup(() => {
|
|
154
|
+
if (storeValue.componentScope !== undefined && storeValue.shutdownDeferred !== undefined) {
|
|
155
|
+
interrupt(storeValue.componentScope, storeValue.shutdownDeferred, new StoreInterrupted())
|
|
156
|
+
storeValue.componentScope = undefined
|
|
157
|
+
storeValue.shutdownDeferred = undefined
|
|
148
158
|
}
|
|
149
159
|
})
|
|
150
160
|
})
|
|
@@ -158,53 +168,18 @@ export const getStore = async <
|
|
|
158
168
|
schema,
|
|
159
169
|
storeId,
|
|
160
170
|
}: Pick<CreateStoreOptions<GraphQLContext, Schema>, 'schema' | 'adapter' | 'storeId'>): Promise<
|
|
161
|
-
Accessor<Store<BaseGraphQLContext, Schema> | undefined>
|
|
171
|
+
Solid.Accessor<Store<BaseGraphQLContext, Schema> | undefined>
|
|
162
172
|
> => {
|
|
173
|
+
const setupDone = Promise.withResolvers<void>()
|
|
174
|
+
|
|
163
175
|
await setupStore({
|
|
164
176
|
adapter,
|
|
165
177
|
schema,
|
|
166
178
|
storeId,
|
|
179
|
+
setupDone: setupDone.resolve,
|
|
167
180
|
})
|
|
168
181
|
|
|
169
|
-
|
|
170
|
-
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return storeToExport as unknown as Accessor<Store<BaseGraphQLContext, Schema>>
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export const query = <TQuery extends LiveQueryAny>(
|
|
177
|
-
query$: TQuery,
|
|
178
|
-
initialValue: GetResult<TQuery>,
|
|
179
|
-
): Accessor<GetResult<TQuery>> => {
|
|
180
|
-
const [value, setValue] = createSignal(initialValue)
|
|
181
|
-
|
|
182
|
-
const unsubscribe = storeToExport()?.subscribe(query$ as any, setValue)
|
|
183
|
-
|
|
184
|
-
onCleanup(() => {
|
|
185
|
-
unsubscribe?.()
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
return value
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export const row = <
|
|
192
|
-
TTableDef extends DbSchema.TableDef<
|
|
193
|
-
DbSchema.DefaultSqliteTableDef,
|
|
194
|
-
boolean,
|
|
195
|
-
DbSchema.TableOptions & { isSingleton: false; deriveMutations: { enabled: true } }
|
|
196
|
-
>,
|
|
197
|
-
>(
|
|
198
|
-
table: TTableDef,
|
|
199
|
-
id: string,
|
|
200
|
-
): Accessor<RowResult<TTableDef> | undefined> => {
|
|
201
|
-
const [value, setValue] = createSignal<RowResult<TTableDef>>()
|
|
202
|
-
|
|
203
|
-
const unsubscribe = rowQuery(table, id).subscribe(setValue)
|
|
204
|
-
|
|
205
|
-
onCleanup(() => {
|
|
206
|
-
unsubscribe?.()
|
|
207
|
-
})
|
|
182
|
+
await setupDone.promise
|
|
208
183
|
|
|
209
|
-
return
|
|
184
|
+
return storeToExport as unknown as Solid.Accessor<Store<BaseGraphQLContext, Schema>>
|
|
210
185
|
}
|
package/tsconfig.json
CHANGED
package/vitest.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
test: {
|
|
5
|
-
// Needed for React hook tests
|
|
6
|
-
environment: 'jsdom',
|
|
7
|
-
},
|
|
8
|
-
esbuild: {
|
|
9
|
-
// TODO remove once `using` keyword supported OOTB with Vite https://github.com/vitejs/vite/issues/15464#issuecomment-1872485703
|
|
10
|
-
target: 'es2020',
|
|
11
|
-
},
|
|
12
|
-
resolve: {
|
|
13
|
-
alias: {
|
|
14
|
-
'@livestore/wa-sqlite/dist/wa-sqlite.mjs': '@livestore/wa-sqlite/dist/wa-sqlite.node.mjs',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
})
|