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