@molecule/app-query-solid 0.0.0-stage → 0.0.1-stage

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.
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Observe one document from the shared cache — the Solid counterpart of
3
+ * `useQuery` in `@molecule/app-query-react`.
4
+ *
5
+ * @module
6
+ */
7
+ import { type Accessor } from 'solid-js';
8
+ import type { QueryOptions } from '@molecule/app-query';
9
+ import type { UseQueryResult } from './types.js';
10
+ /** The options a query may arrive in: plain values, or an accessor of them. */
11
+ type QueryOptionsSource<T> = QueryOptions<T> | null | Accessor<QueryOptions<T> | null>;
12
+ /**
13
+ * The document for the options' key, kept current: cached data is read on the
14
+ * very first render (so a warmed page never flashes a loading state), a stale
15
+ * or missing document is fetched, and every change re-renders what reads the
16
+ * result. Pass `null` to observe nothing. A key change resets to that key's
17
+ * state; the hook never hands a caller another key's document — unless the
18
+ * caller opts into {@link QueryOptions.keepPreviousData}, and then only within
19
+ * one {@link QueryOptions.principal}.
20
+ *
21
+ * The request is stable across re-renders — a parent state change neither
22
+ * restarts it nor cancels it, so a response that arrives after one still
23
+ * lands. It is aborted only when the key changes or the component unmounts
24
+ * (the `signal` given to `options.fetch`). Use this instead of a hand-written
25
+ * `createEffect` + `fetch`: an effect whose `onCleanup` sets a `cancelled`
26
+ * flag, and whose tracked dependencies include a function rebuilt each run,
27
+ * cancels its own request on every run and then skips the refetch.
28
+ * An explicit `refetch()` is an awaited cache fetch; it can finish after the
29
+ * observer unmounts, like an explicit `client.fetch(options)` caller.
30
+ *
31
+ * A component body runs once in Solid, so pass the options as an accessor when
32
+ * any part of them can change (`() => packageQuery(props.name)`): a changed
33
+ * key — or principal, or `keepPreviousData` flag — is then followed on the SAME
34
+ * mounted hook, the way React re-renders `useQuery` with a new options object.
35
+ *
36
+ * For a LIST, put the route's page, filter and selected view in the key and
37
+ * pass `keepPreviousData` with a `principal`: a Next/Previous or filter change
38
+ * then keeps the rows already on screen until the new page answers, instead of
39
+ * rendering a loading state over an empty list. The key names everything the
40
+ * answer depends on, and the app's HTTP client sends the session, so a list the
41
+ * server can filter or personalize per viewer puts the viewer in its key and
42
+ * passes the same value as `principal` (`'anonymous'` when signed out): an
43
+ * account switch then drops the previous account's document immediately. Only
44
+ * an endpoint that answers every viewer the same takes a viewer-free key with
45
+ * `principal: 'public'`.
46
+ *
47
+ * For custom mutation handlers, `setData(saved)` publishes the server's response to this
48
+ * key and every observer. Use `setData(current => next)` for a local cache update. Render
49
+ * `data` directly; a component-local copy stops observing later server responses. Prefer
50
+ * `createQueryResource` when the API's reads and writes can share one resource definition.
51
+ * Mount record-dependent actions inside `QueryContent` (or an explicit non-null data branch),
52
+ * so a visible action cannot return early because its initial record is still missing.
53
+ * Keep loaded actions mounted during refreshes. Server-backed toggles use `useOptimisticValue`
54
+ * from `@molecule/app-solid` or `OptimisticToggleButton` from `@molecule/app-ui-solid` to keep
55
+ * their displayed label and queued clicks on the same state while a save finishes.
56
+ *
57
+ * @param options - Key, fetch, freshness, and optionally `principal` with
58
+ * `keepPreviousData`; or `null`; or an accessor of either (the options a
59
+ * component recomputes from its props — every change is followed on the same
60
+ * instance).
61
+ * @returns The document's state, `setData()` and `refetch()`. `isPreviousData` is `true` while
62
+ * `data` is the previous key's document for the same principal.
63
+ * @throws {Error} When `keepPreviousData` is set without `principal` — the
64
+ * hook cannot tell a route change from a principal switch, so it refuses
65
+ * rather than risk showing one principal's document to another.
66
+ */
67
+ export declare function useQuery<T>(options: QueryOptionsSource<T>): UseQueryResult<T>;
68
+ export {};
69
+ //# sourceMappingURL=use-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../src/use-query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,QAAQ,EAAsD,MAAM,UAAU,CAAA;AAE5F,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAA;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAuBhD,+EAA+E;AAC/E,KAAK,kBAAkB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CA0M7E"}
@@ -0,0 +1,259 @@
1
+ /**
2
+ * Observe one document from the shared cache — the Solid counterpart of
3
+ * `useQuery` in `@molecule/app-query-react`.
4
+ *
5
+ * @module
6
+ */
7
+ import { createEffect, createSignal, on, onCleanup, untrack } from 'solid-js';
8
+ import { getQueryClient, hashQueryKey } from '@molecule/app-query';
9
+ const IDLE = {
10
+ data: undefined,
11
+ status: 'idle',
12
+ error: undefined,
13
+ isFetching: false,
14
+ updatedAt: undefined,
15
+ };
16
+ /**
17
+ * The document for the options' key, kept current: cached data is read on the
18
+ * very first render (so a warmed page never flashes a loading state), a stale
19
+ * or missing document is fetched, and every change re-renders what reads the
20
+ * result. Pass `null` to observe nothing. A key change resets to that key's
21
+ * state; the hook never hands a caller another key's document — unless the
22
+ * caller opts into {@link QueryOptions.keepPreviousData}, and then only within
23
+ * one {@link QueryOptions.principal}.
24
+ *
25
+ * The request is stable across re-renders — a parent state change neither
26
+ * restarts it nor cancels it, so a response that arrives after one still
27
+ * lands. It is aborted only when the key changes or the component unmounts
28
+ * (the `signal` given to `options.fetch`). Use this instead of a hand-written
29
+ * `createEffect` + `fetch`: an effect whose `onCleanup` sets a `cancelled`
30
+ * flag, and whose tracked dependencies include a function rebuilt each run,
31
+ * cancels its own request on every run and then skips the refetch.
32
+ * An explicit `refetch()` is an awaited cache fetch; it can finish after the
33
+ * observer unmounts, like an explicit `client.fetch(options)` caller.
34
+ *
35
+ * A component body runs once in Solid, so pass the options as an accessor when
36
+ * any part of them can change (`() => packageQuery(props.name)`): a changed
37
+ * key — or principal, or `keepPreviousData` flag — is then followed on the SAME
38
+ * mounted hook, the way React re-renders `useQuery` with a new options object.
39
+ *
40
+ * For a LIST, put the route's page, filter and selected view in the key and
41
+ * pass `keepPreviousData` with a `principal`: a Next/Previous or filter change
42
+ * then keeps the rows already on screen until the new page answers, instead of
43
+ * rendering a loading state over an empty list. The key names everything the
44
+ * answer depends on, and the app's HTTP client sends the session, so a list the
45
+ * server can filter or personalize per viewer puts the viewer in its key and
46
+ * passes the same value as `principal` (`'anonymous'` when signed out): an
47
+ * account switch then drops the previous account's document immediately. Only
48
+ * an endpoint that answers every viewer the same takes a viewer-free key with
49
+ * `principal: 'public'`.
50
+ *
51
+ * For custom mutation handlers, `setData(saved)` publishes the server's response to this
52
+ * key and every observer. Use `setData(current => next)` for a local cache update. Render
53
+ * `data` directly; a component-local copy stops observing later server responses. Prefer
54
+ * `createQueryResource` when the API's reads and writes can share one resource definition.
55
+ * Mount record-dependent actions inside `QueryContent` (or an explicit non-null data branch),
56
+ * so a visible action cannot return early because its initial record is still missing.
57
+ * Keep loaded actions mounted during refreshes. Server-backed toggles use `useOptimisticValue`
58
+ * from `@molecule/app-solid` or `OptimisticToggleButton` from `@molecule/app-ui-solid` to keep
59
+ * their displayed label and queued clicks on the same state while a save finishes.
60
+ *
61
+ * @param options - Key, fetch, freshness, and optionally `principal` with
62
+ * `keepPreviousData`; or `null`; or an accessor of either (the options a
63
+ * component recomputes from its props — every change is followed on the same
64
+ * instance).
65
+ * @returns The document's state, `setData()` and `refetch()`. `isPreviousData` is `true` while
66
+ * `data` is the previous key's document for the same principal.
67
+ * @throws {Error} When `keepPreviousData` is set without `principal` — the
68
+ * hook cannot tell a route change from a principal switch, so it refuses
69
+ * rather than risk showing one principal's document to another.
70
+ */
71
+ export function useQuery(options) {
72
+ const readOptions = () => typeof options === 'function' ? options() : options;
73
+ const validate = (value) => {
74
+ if (value?.keepPreviousData === true && value.principal === undefined) {
75
+ throw new Error('useQuery: keepPreviousData requires principal — the viewer the document is for (the signed-in id, "anonymous" while signed out, or "public" for an endpoint that answers every viewer the same) so a viewer switch never shows the previous document.');
76
+ }
77
+ };
78
+ const initial = untrack(readOptions);
79
+ validate(initial);
80
+ // `current` is the latest options (the render's principal/keep flags come from it);
81
+ // `bound` is what the subscription and the actions are bound to, updated only when the
82
+ // key changes, exactly like React's `useMemo(() => options, [hash])`: a fresh `fetch`
83
+ // closure with the same key must not resubscribe, and a saved action stays bound to
84
+ // its original key.
85
+ let current = initial;
86
+ let bound = initial;
87
+ let hash = initial ? hashQueryKey(initial.key) : '';
88
+ let stateValue = initial
89
+ ? getQueryClient().getState(initial.key)
90
+ : IDLE;
91
+ let stateHash = hash;
92
+ // The previous document is remembered ACROSS updates, so the update that first
93
+ // observes a new key still has the rows a person is looking at.
94
+ let loaded = null;
95
+ // A key's document belongs to the principal that was current when the hook
96
+ // started observing that key: a principal change the key does not reflect
97
+ // never relabels the document on screen as the new principal's.
98
+ let observed = null;
99
+ let unsubscribe = null;
100
+ /** The state the observer shows right now (the retained previous document folded in). */
101
+ const renderValue = () => {
102
+ const state = stateHash === hash
103
+ ? stateValue
104
+ : bound
105
+ ? getQueryClient().getState(bound.key)
106
+ : IDLE;
107
+ const principal = current?.principal;
108
+ const previous = current?.keepPreviousData === true ? loaded : null;
109
+ if (previous !== null &&
110
+ previous.principal === principal &&
111
+ previous.hash !== hash &&
112
+ state.data === undefined &&
113
+ (state.status === 'idle' || state.status === 'loading')) {
114
+ return {
115
+ ...state,
116
+ data: previous.value.data,
117
+ updatedAt: previous.value.updatedAt,
118
+ isPreviousData: true,
119
+ };
120
+ }
121
+ return state;
122
+ };
123
+ /**
124
+ * Remembers the document just shown, under the principal it was observed for.
125
+ * A retained previous document survives (it is what makes it survive the
126
+ * fetch); anything else (no principal, a switch, a failure, a key observed
127
+ * under another principal) clears the memory, so a later key change can never
128
+ * fall back to another principal's document.
129
+ */
130
+ const remember = (value) => {
131
+ const principal = current?.principal;
132
+ if (observed?.hash !== hash)
133
+ observed = { hash, principal };
134
+ if (value.isPreviousData === true)
135
+ return;
136
+ loaded =
137
+ principal !== undefined &&
138
+ observed.principal === principal &&
139
+ value.data !== undefined &&
140
+ value.status === 'success'
141
+ ? { hash, principal, value }
142
+ : null;
143
+ };
144
+ /** The state the component reads; every field getter tracks this signal. */
145
+ const [display, setDisplay] = createSignal(renderValue());
146
+ /** The observer's fields, read as plain values through the state signal. */
147
+ const result = {
148
+ get data() {
149
+ return display().data;
150
+ },
151
+ get status() {
152
+ return display().status;
153
+ },
154
+ get error() {
155
+ return display().error;
156
+ },
157
+ get isFetching() {
158
+ return display().isFetching;
159
+ },
160
+ get updatedAt() {
161
+ return display().updatedAt;
162
+ },
163
+ get isPreviousData() {
164
+ return display().isPreviousData;
165
+ },
166
+ setData: () => { },
167
+ refetch: async () => IDLE,
168
+ };
169
+ /** Applies one state: publishes it and re-derives the previous-document memory. */
170
+ const apply = (value) => {
171
+ setDisplay(value);
172
+ remember(value);
173
+ };
174
+ /** The subscription's listener: the cache announces the observed key's new state. */
175
+ const onState = (value) => {
176
+ stateValue = value;
177
+ stateHash = hash;
178
+ apply(renderValue());
179
+ };
180
+ /** Rebuilds `setData`/`refetch` bound to one options object (one per key). */
181
+ const buildActions = (actionsBound) => {
182
+ const setData = (value) => {
183
+ if (!actionsBound)
184
+ return;
185
+ const client = getQueryClient();
186
+ const next = typeof value === 'function'
187
+ ? value(client.get(actionsBound.key))
188
+ : value;
189
+ if (next !== undefined)
190
+ client.set(actionsBound.key, next);
191
+ };
192
+ const refetch = async () => {
193
+ if (!actionsBound)
194
+ return IDLE;
195
+ const client = getQueryClient();
196
+ client.invalidate(actionsBound.key);
197
+ try {
198
+ await client.fetch(actionsBound);
199
+ }
200
+ catch (_error) {
201
+ // The cache publishes the failure to every observer. Return that state just as the
202
+ // initial subscription does, so an event handler can safely use `void query.refetch()`.
203
+ }
204
+ return client.getState(actionsBound.key);
205
+ };
206
+ result.setData = setData;
207
+ result.refetch = refetch;
208
+ };
209
+ /**
210
+ * Follows one options value — the initial one (from the call itself) or a
211
+ * later one (the options accessor changed): renders with the new key, updates
212
+ * the previous-document memory, and resubscribes only when the key changed.
213
+ */
214
+ const applyOptions = (next) => {
215
+ validate(next);
216
+ const hashAtEntry = hash;
217
+ const nextHash = next ? hashQueryKey(next.key) : '';
218
+ if (nextHash !== hashAtEntry) {
219
+ bound = next;
220
+ buildActions(next);
221
+ }
222
+ current = next;
223
+ hash = nextHash;
224
+ apply(renderValue());
225
+ if (nextHash !== hashAtEntry) {
226
+ unsubscribe?.();
227
+ unsubscribe = null;
228
+ if (next) {
229
+ unsubscribe = getQueryClient().subscribe(next, onState);
230
+ }
231
+ else {
232
+ stateValue = IDLE;
233
+ stateHash = '';
234
+ }
235
+ }
236
+ apply(renderValue());
237
+ };
238
+ // First observation, in React's order: render, remember, subscribe (whose
239
+ // synchronous emit applies the fetched-or-loading state), and the actions
240
+ // bound to this first key.
241
+ apply(renderValue());
242
+ buildActions(bound);
243
+ if (initial) {
244
+ unsubscribe = getQueryClient().subscribe(initial, onState);
245
+ }
246
+ // New options reach the observer as React's re-render does; a changed key is
247
+ // a subscription change, and a principal/flag-only change re-renders only.
248
+ if (typeof options === 'function') {
249
+ createEffect(on(options, (next) => untrack(() => applyOptions(next)), {
250
+ defer: true,
251
+ }));
252
+ }
253
+ onCleanup(() => {
254
+ unsubscribe?.();
255
+ unsubscribe = null;
256
+ });
257
+ return result;
258
+ }
259
+ //# sourceMappingURL=use-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-query.js","sourceRoot":"","sources":["../src/use-query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAiB,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,C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AE;YAC3F,KAAK,EAAE,IAAI;SACZ,CAAC,CACH,CAAA;IACH,CAAC;IACD,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,EAAE,EAAE,CAAA;QACf,WAAW,GAAG,IAAI,CAAA;IACpB,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,68 @@
1
1
  {
2
2
  "name": "@molecule/app-query-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-stage",
4
+ "description": "Solid hooks for @molecule/app-query — read a cached document synchronously, observe it, and prefetch on intent",
5
+ "homepage": "https://www.molecule.dev/packages/app-query-solid",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "query",
28
+ "cache",
29
+ "prefetch",
30
+ "solid",
31
+ "hooks"
32
+ ],
33
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
34
+ "license": "Apache-2.0",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/molecule-dev/molecule.git",
38
+ "directory": "packages/app/features/query-solid"
39
+ },
40
+ "engines": {
41
+ "node": ">=20"
42
+ },
43
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "peerDependencies": {
48
+ "@molecule/app-query": "^1.2.0",
49
+ "solid-js": "^1.8.0"
50
+ },
51
+ "devDependencies": {
52
+ "@molecule/app-framework-conformance": "0.0.0",
53
+ "@molecule/app-i18n": "1.2.1",
54
+ "@molecule/app-icons": "1.0.4",
55
+ "@molecule/app-query": "1.2.0",
56
+ "@molecule/app-query-memory": "1.0.5",
57
+ "@molecule/app-query-tanstack": "1.0.5",
58
+ "@molecule/app-solid": "3.5.0",
59
+ "@molecule/app-ui": "1.3.11",
60
+ "@molecule/app-ui-solid": "1.1.1",
61
+ "@types/node": "26.6.5",
62
+ "jsdom": "30.1.3",
63
+ "solid-js": "1.9.17",
64
+ "typescript": "6.0.3",
65
+ "vite-plugin-solid": "2.11.15",
66
+ "vitest": "4.1.12"
67
+ }
68
+ }