@molecule/app-angular 3.6.0 → 3.7.2
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 +300 -36
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-ai-models.d.ts +4 -1
- package/dist/hooks/use-ai-models.d.ts.map +1 -1
- package/dist/hooks/use-ai-models.js +7 -1
- package/dist/hooks/use-ai-models.js.map +1 -1
- package/dist/hooks/use-auth.d.ts.map +1 -1
- package/dist/hooks/use-auth.js +1 -1
- package/dist/hooks/use-auth.js.map +1 -1
- package/dist/hooks/use-forms.d.ts +2 -2
- package/dist/hooks/use-forms.d.ts.map +1 -1
- package/dist/hooks/use-forms.js +1 -1
- package/dist/hooks/use-forms.js.map +1 -1
- package/dist/hooks/use-http.d.ts.map +1 -1
- package/dist/hooks/use-http.js +1 -1
- package/dist/hooks/use-http.js.map +1 -1
- package/dist/hooks/use-ide.d.ts.map +1 -1
- package/dist/hooks/use-ide.js +3 -3
- package/dist/hooks/use-ide.js.map +1 -1
- package/dist/hooks/use-logger.d.ts.map +1 -1
- package/dist/hooks/use-logger.js +1 -1
- package/dist/hooks/use-logger.js.map +1 -1
- package/dist/hooks/use-optimistic-toggle.d.ts +65 -0
- package/dist/hooks/use-optimistic-toggle.d.ts.map +1 -0
- package/dist/hooks/use-optimistic-toggle.js +51 -0
- package/dist/hooks/use-optimistic-toggle.js.map +1 -0
- package/dist/hooks/use-router.d.ts.map +1 -1
- package/dist/hooks/use-router.js +1 -1
- package/dist/hooks/use-router.js.map +1 -1
- package/dist/hooks/use-storage.d.ts.map +1 -1
- package/dist/hooks/use-storage.js +1 -1
- package/dist/hooks/use-storage.js.map +1 -1
- package/dist/hooks/use-theme.d.ts.map +1 -1
- package/dist/hooks/use-theme.js +1 -1
- package/dist/hooks/use-theme.js.map +1 -1
- package/dist/inject.d.ts +7 -2
- package/dist/inject.d.ts.map +1 -1
- package/dist/inject.js +51 -5
- package/dist/inject.js.map +1 -1
- package/dist/session-ready.d.ts +4 -3
- package/dist/session-ready.d.ts.map +1 -1
- package/dist/session-ready.js +5 -4
- package/dist/session-ready.js.map +1 -1
- package/dist/types.d.ts +4 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-18T16:19:43.667Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-angular
|
|
@@ -142,55 +142,143 @@ interface AuthClient<
|
|
|
142
142
|
T = UserProfile,
|
|
143
143
|
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
144
144
|
> {
|
|
145
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* Returns the current authentication state snapshot.
|
|
147
|
+
*
|
|
148
|
+
* READING the state starts the client's one session restore when nobody has called
|
|
149
|
+
* {@link initialize} yet — lazily and exactly once, sharing the promise an explicit
|
|
150
|
+
* `initialize()` returns. A hook (`useAuth()`), a subscriber, `isAuthenticated()` and
|
|
151
|
+
* `getUser()` are reads too, so a client whose entry file dropped the template's
|
|
152
|
+
* `authClient.initialize()` line still restores instead of reporting `'loading'`
|
|
153
|
+
* forever.
|
|
154
|
+
*/
|
|
146
155
|
getState(): AuthState<T>
|
|
147
156
|
|
|
148
|
-
/**
|
|
157
|
+
/**
|
|
158
|
+
* Returns whether the user is currently authenticated.
|
|
159
|
+
*/
|
|
149
160
|
isAuthenticated(): boolean
|
|
150
161
|
|
|
151
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* Gets the current user.
|
|
164
|
+
*/
|
|
152
165
|
getUser(): T | null
|
|
153
166
|
|
|
154
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* Optional ownership marker for the current session. Compare values only within
|
|
169
|
+
* this client: replacing or ending a session changes it, including re-adopting
|
|
170
|
+
* the same token and user. Profile updates and same-session refreshes keep it.
|
|
171
|
+
* Consumers can use it to discard stale async work without treating editable
|
|
172
|
+
* user fields as an immutable account identifier. Providers without this
|
|
173
|
+
* capability require the consumer's own stable identity check.
|
|
174
|
+
*/
|
|
155
175
|
getSessionRevision?(): number
|
|
156
176
|
|
|
157
177
|
/** Updates the cached user object (state + persistent storage) without hitting the network. */
|
|
158
178
|
setUser(user: T | null): void
|
|
159
179
|
|
|
160
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* Gets the current access token.
|
|
182
|
+
*/
|
|
161
183
|
getAccessToken(): string | null
|
|
162
184
|
|
|
163
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* Stores the access token in the configured token storage adapter (in a
|
|
187
|
+
* browser, Web Storage; `'memory'` where no browser store exists). Use this
|
|
188
|
+
* to seed the token after an out-of-band exchange (e.g. the OAuth
|
|
189
|
+
* code→token redirect) instead of writing to `localStorage` directly,
|
|
190
|
+
* which would violate the storage contract and make a stored bearer token
|
|
191
|
+
* JS-readable (XSS-exfiltratable). Pass `null` to clear it.
|
|
192
|
+
*
|
|
193
|
+
* Passing `null` does not by itself sign a signed-in client out: use
|
|
194
|
+
* {@link logout} to end a session, or {@link setUser} with `null` for
|
|
195
|
+
* local-only sign-out. A non-null token on a client that is not signed in is
|
|
196
|
+
* the first or second half of the app's own sign-in pair: together with
|
|
197
|
+
* {@link setUser} it adopts the session (see there). Prefer {@link setSession}
|
|
198
|
+
* with the token and user, or {@link login} / {@link register} for a
|
|
199
|
+
* credential exchange.
|
|
200
|
+
*/
|
|
164
201
|
setAccessToken(token: string | null): void
|
|
165
202
|
|
|
166
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* Adopts a session an out-of-band exchange already established: stores the
|
|
205
|
+
* access token (and the refresh token when given), caches the user, and
|
|
206
|
+
* sets the COMPLETE state — `initialized`, `authenticated`, `status:
|
|
207
|
+
* 'authenticated'`, no error — in one update, with one subscriber
|
|
208
|
+
* notification. Every hook reading the shared client sees the user as
|
|
209
|
+
* signed in immediately.
|
|
210
|
+
*
|
|
211
|
+
* This is the way to seed an OAuth/custom sign-in. The field-setter pair
|
|
212
|
+
* ({@link setAccessToken} then {@link setUser}, or the reverse) on a client
|
|
213
|
+
* that is not signed in adopts the session the same way.
|
|
214
|
+
*/
|
|
167
215
|
setSession(session: AuthSessionSeed<T>): void
|
|
168
216
|
|
|
169
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Gets the refresh token.
|
|
219
|
+
*/
|
|
170
220
|
getRefreshToken(): string | null
|
|
171
221
|
|
|
172
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* Logs in with credentials.
|
|
224
|
+
*/
|
|
173
225
|
login(credentials: LoginCredentials): Promise<AuthResult<T>>
|
|
174
226
|
|
|
175
|
-
/**
|
|
227
|
+
/**
|
|
228
|
+
* Logs out the current user. The server request is best-effort: a missing
|
|
229
|
+
* logout route (404), any other HTTP failure, or a network error never makes
|
|
230
|
+
* this method reject. It always clears the access token, refresh token and
|
|
231
|
+
* cached user, stops automatic refresh, and publishes one settled
|
|
232
|
+
* `authenticated: false`, `status: 'unauthenticated'` transition. Every pending
|
|
233
|
+
* session operation loses ownership; a persistent marker prevents reload from
|
|
234
|
+
* restoring an older session, and late credentials are revoked best-effort.
|
|
235
|
+
*
|
|
236
|
+
* When the API has no logout route, set {@link AuthClientConfigOptions.logoutEndpoint}
|
|
237
|
+
* to `null` (or `''`) to skip the request. Local sign-out still happens.
|
|
238
|
+
*/
|
|
176
239
|
logout(): Promise<void>
|
|
177
240
|
|
|
178
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* Registers a new user. Accepts the base fields plus the app's own fields
|
|
243
|
+
* (`TRegister`) at the top level — see {@link RegisterData}.
|
|
244
|
+
*/
|
|
179
245
|
register(data: RegisterData<TRegister>): Promise<AuthResult<T>>
|
|
180
246
|
|
|
181
|
-
/**
|
|
247
|
+
/**
|
|
248
|
+
* Exchanges a stored refresh token, or re-reads `currentUserEndpoint` with the
|
|
249
|
+
* existing access token/session cookie when the API has no refresh credential.
|
|
250
|
+
* That fallback maps, stores and publishes the server user without renewing
|
|
251
|
+
* the access token. Failures reject. A 401/403 ends the session, as does an
|
|
252
|
+
* additional {@link AuthClientConfigOptions.currentUserRejectionStatuses}
|
|
253
|
+
* code from the fallback. Transient failures retain it as unavailable. Use {@link updateProfile} for a profile
|
|
254
|
+
* save, or {@link setUser} with the canonical row from an app-owned mutation.
|
|
255
|
+
*/
|
|
182
256
|
refresh(): Promise<AuthResult<T>>
|
|
183
257
|
|
|
184
|
-
/**
|
|
258
|
+
/**
|
|
259
|
+
* Requests a password reset.
|
|
260
|
+
*/
|
|
185
261
|
requestPasswordReset(data: PasswordResetRequest): Promise<void>
|
|
186
262
|
|
|
187
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* Confirms a password reset.
|
|
265
|
+
*/
|
|
188
266
|
confirmPasswordReset(data: PasswordResetConfirm): Promise<void>
|
|
189
267
|
|
|
190
|
-
/**
|
|
268
|
+
/**
|
|
269
|
+
* Updates the current user's profile.
|
|
270
|
+
* Returns the saved profile: the answer applied onto the signed-in user field
|
|
271
|
+
* by field, with or without an `id` — a field it carries replaces the value
|
|
272
|
+
* (`null` clears it), one it omits or leaves `undefined` is kept, so a field
|
|
273
|
+
* cleared by omission must arrive as `null`. A non-object answer is returned
|
|
274
|
+
* as it came. An answer for a replaced or ended session leaves the current one
|
|
275
|
+
* untouched.
|
|
276
|
+
*/
|
|
191
277
|
updateProfile(data: Partial<T>): Promise<T>
|
|
192
278
|
|
|
193
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Changes the current user's password.
|
|
281
|
+
*/
|
|
194
282
|
changePassword(oldPassword: string, newPassword: string): Promise<void>
|
|
195
283
|
|
|
196
284
|
/** Initializes auth state (e.g., from stored tokens). */
|
|
@@ -202,24 +290,48 @@ interface AuthClient<
|
|
|
202
290
|
/** Resolves when the session restore started by `initialize()` has settled — the point after which the client knows whether this visitor is signed in. */
|
|
203
291
|
whenRestored?(): Promise<void>
|
|
204
292
|
|
|
205
|
-
/**
|
|
293
|
+
/**
|
|
294
|
+
* Subscribes to auth state changes.
|
|
295
|
+
*/
|
|
206
296
|
subscribe(callback: (state: AuthState<T>) => void): () => void
|
|
207
297
|
|
|
208
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* Subscribes to auth state changes (alias for subscribe).
|
|
300
|
+
*/
|
|
209
301
|
onAuthChange(callback: (state: AuthState<T>) => void): () => void
|
|
210
302
|
|
|
211
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* Gets the current access token (alias for getAccessToken).
|
|
305
|
+
*/
|
|
212
306
|
getToken?(): string | null
|
|
213
307
|
|
|
214
|
-
/**
|
|
308
|
+
/**
|
|
309
|
+
* Adds an auth event listener.
|
|
310
|
+
*
|
|
311
|
+
* The listener is typed by this client's profile: one signature,
|
|
312
|
+
* `AuthEventListener<T>`, so an inline arrow is contextually typed and `event`
|
|
313
|
+
* is never implicitly `any`. A client whose profile extends
|
|
314
|
+
* {@link UserProfile} also accepts a default {@link AuthEventListener}: when
|
|
315
|
+
* `T` extends `UserProfile`, `AuthEvent<T>` is assignable to
|
|
316
|
+
* `AuthEvent<UserProfile>`, so a listener that takes the wider default event
|
|
317
|
+
* accepts every event this client emits and keeps compiling. (`UserProfile`
|
|
318
|
+
* is the wider type here — it has fewer required fields — and the assignable
|
|
319
|
+
* direction runs from the client's `AuthEvent<T>` to the listener's
|
|
320
|
+
* `AuthEvent<UserProfile>`.) A profile that does not extend `UserProfile`
|
|
321
|
+
* (no `id`) rejects the default listener: an `AuthEvent<UserProfile>` would
|
|
322
|
+
* promise an `id` the runtime user does not have, and the narrower-typed
|
|
323
|
+
* event is not assignable to it.
|
|
324
|
+
*/
|
|
215
325
|
addEventListener(listener: AuthEventListener<T>): () => void
|
|
216
326
|
|
|
217
|
-
/**
|
|
327
|
+
/**
|
|
328
|
+
* Destroys the auth client.
|
|
329
|
+
*/
|
|
218
330
|
destroy(): void
|
|
219
331
|
}
|
|
220
332
|
```
|
|
221
333
|
|
|
222
|
-
_(
|
|
334
|
+
_(The 4 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/@molecule/app-auth/dist/types.d.ts`.)_
|
|
223
335
|
|
|
224
336
|
#### `EditorProvider`
|
|
225
337
|
|
|
@@ -379,9 +491,10 @@ interface FormController<T extends FormValuesConstraint<T> = Record<string, unkn
|
|
|
379
491
|
* record, never a merge of earlier records. With `keepDirtyValues`, edited
|
|
380
492
|
* fields retain their values while pristine fields take the loaded values.
|
|
381
493
|
* A changed non-null `id` still replaces the record and cancels a pending
|
|
382
|
-
* submit. Equal-content baselines cause no update.
|
|
494
|
+
* submit. Equal-content baselines cause no update. `keepOmittedValues` opts
|
|
495
|
+
* into incremental top-level field fills using the current clean baseline.
|
|
383
496
|
*/
|
|
384
|
-
updateValues(values: Partial<T>, resetOptions?:
|
|
497
|
+
updateValues(values: Partial<T>, resetOptions?: FormUpdateOptions): void
|
|
385
498
|
|
|
386
499
|
/**
|
|
387
500
|
* Handles form submission.
|
|
@@ -459,6 +572,15 @@ interface FormOptions<T extends FormValuesConstraint<T>> {
|
|
|
459
572
|
HTTP client interface.
|
|
460
573
|
|
|
461
574
|
All HTTP providers must implement this interface.
|
|
575
|
+
An explicit text, blob or arraybuffer parser determines the data type even when
|
|
576
|
+
a JSON generic is supplied. Keep JSON as the default for mutations returning a
|
|
577
|
+
record. A successful DELETE with no body already resolves with null data.
|
|
578
|
+
|
|
579
|
+
Every verb also takes a URL alone, through a signature with the same three parameters on every
|
|
580
|
+
verb, so a verb chosen at runtime (`client[verb](url)`) type-checks and a wrapper can implement
|
|
581
|
+
a verb with an arrow (`get: (url, config) => inner.get(url, config)`). With a body or a config,
|
|
582
|
+
choose the verb through `request({ method, url, data })` instead: the second argument is the
|
|
583
|
+
body for post/put/patch but the config for get/delete, so one call cannot serve both.
|
|
462
584
|
|
|
463
585
|
```typescript
|
|
464
586
|
interface HttpClient {
|
|
@@ -476,11 +598,33 @@ interface HttpClient {
|
|
|
476
598
|
* Makes a generic HTTP request. `data` is a field of THIS config object — the same body
|
|
477
599
|
* `post(url, data, config)` takes as its second argument.
|
|
478
600
|
*/
|
|
601
|
+
request<T = unknown>(
|
|
602
|
+
config: FullRequestConfig & { responseType: 'text' },
|
|
603
|
+
): Promise<HttpResponse<string>>
|
|
604
|
+
request<T = unknown>(
|
|
605
|
+
config: FullRequestConfig & { responseType: 'blob' },
|
|
606
|
+
): Promise<HttpResponse<Blob>>
|
|
607
|
+
request<T = unknown>(
|
|
608
|
+
config: FullRequestConfig & { responseType: 'arraybuffer' },
|
|
609
|
+
): Promise<HttpResponse<ArrayBuffer>>
|
|
479
610
|
request<T = unknown>(config: FullRequestConfig): Promise<HttpResponse<T>>
|
|
480
611
|
|
|
481
612
|
/**
|
|
482
613
|
* Makes a GET request.
|
|
483
614
|
*/
|
|
615
|
+
get<T = unknown>(
|
|
616
|
+
url: string,
|
|
617
|
+
config: RequestConfig & { responseType: 'text' },
|
|
618
|
+
): Promise<HttpResponse<string>>
|
|
619
|
+
get<T = unknown>(
|
|
620
|
+
url: string,
|
|
621
|
+
config: RequestConfig & { responseType: 'blob' },
|
|
622
|
+
): Promise<HttpResponse<Blob>>
|
|
623
|
+
get<T = unknown>(
|
|
624
|
+
url: string,
|
|
625
|
+
config: RequestConfig & { responseType: 'arraybuffer' },
|
|
626
|
+
): Promise<HttpResponse<ArrayBuffer>>
|
|
627
|
+
get<T = unknown>(url: string, config?: undefined, unused?: undefined): Promise<HttpResponse<T>>
|
|
484
628
|
get<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
485
629
|
|
|
486
630
|
/**
|
|
@@ -488,23 +632,84 @@ interface HttpClient {
|
|
|
488
632
|
* `data` itself, so `post(url, { data: body })` sends `{"data":body}` — pass `body` directly.
|
|
489
633
|
* A config (headers, params) is the THIRD argument.
|
|
490
634
|
*/
|
|
635
|
+
post<T = unknown>(
|
|
636
|
+
url: string,
|
|
637
|
+
data: unknown,
|
|
638
|
+
config: RequestConfig & { responseType: 'text' },
|
|
639
|
+
): Promise<HttpResponse<string>>
|
|
640
|
+
post<T = unknown>(
|
|
641
|
+
url: string,
|
|
642
|
+
data: unknown,
|
|
643
|
+
config: RequestConfig & { responseType: 'blob' },
|
|
644
|
+
): Promise<HttpResponse<Blob>>
|
|
645
|
+
post<T = unknown>(
|
|
646
|
+
url: string,
|
|
647
|
+
data: unknown,
|
|
648
|
+
config: RequestConfig & { responseType: 'arraybuffer' },
|
|
649
|
+
): Promise<HttpResponse<ArrayBuffer>>
|
|
650
|
+
post<T = unknown>(url: string, data?: undefined, config?: undefined): Promise<HttpResponse<T>>
|
|
491
651
|
post<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
492
652
|
|
|
493
653
|
/**
|
|
494
654
|
* Makes a PUT request. `data` is the request BODY (second argument) — never `{ data: body }`,
|
|
495
655
|
* which sends `{"data":body}`; a config is the THIRD argument.
|
|
496
656
|
*/
|
|
657
|
+
put<T = unknown>(
|
|
658
|
+
url: string,
|
|
659
|
+
data: unknown,
|
|
660
|
+
config: RequestConfig & { responseType: 'text' },
|
|
661
|
+
): Promise<HttpResponse<string>>
|
|
662
|
+
put<T = unknown>(
|
|
663
|
+
url: string,
|
|
664
|
+
data: unknown,
|
|
665
|
+
config: RequestConfig & { responseType: 'blob' },
|
|
666
|
+
): Promise<HttpResponse<Blob>>
|
|
667
|
+
put<T = unknown>(
|
|
668
|
+
url: string,
|
|
669
|
+
data: unknown,
|
|
670
|
+
config: RequestConfig & { responseType: 'arraybuffer' },
|
|
671
|
+
): Promise<HttpResponse<ArrayBuffer>>
|
|
672
|
+
put<T = unknown>(url: string, data?: undefined, config?: undefined): Promise<HttpResponse<T>>
|
|
497
673
|
put<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
498
674
|
|
|
499
675
|
/**
|
|
500
676
|
* Makes a PATCH request. `data` is the request BODY (second argument) — never `{ data: body }`,
|
|
501
677
|
* which sends `{"data":body}`; a config is the THIRD argument.
|
|
502
678
|
*/
|
|
679
|
+
patch<T = unknown>(
|
|
680
|
+
url: string,
|
|
681
|
+
data: unknown,
|
|
682
|
+
config: RequestConfig & { responseType: 'text' },
|
|
683
|
+
): Promise<HttpResponse<string>>
|
|
684
|
+
patch<T = unknown>(
|
|
685
|
+
url: string,
|
|
686
|
+
data: unknown,
|
|
687
|
+
config: RequestConfig & { responseType: 'blob' },
|
|
688
|
+
): Promise<HttpResponse<Blob>>
|
|
689
|
+
patch<T = unknown>(
|
|
690
|
+
url: string,
|
|
691
|
+
data: unknown,
|
|
692
|
+
config: RequestConfig & { responseType: 'arraybuffer' },
|
|
693
|
+
): Promise<HttpResponse<ArrayBuffer>>
|
|
694
|
+
patch<T = unknown>(url: string, data?: undefined, config?: undefined): Promise<HttpResponse<T>>
|
|
503
695
|
patch<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
504
696
|
|
|
505
697
|
/**
|
|
506
698
|
* Makes a DELETE request.
|
|
507
699
|
*/
|
|
700
|
+
delete<T = unknown>(
|
|
701
|
+
url: string,
|
|
702
|
+
config: RequestConfig & { responseType: 'text' },
|
|
703
|
+
): Promise<HttpResponse<string>>
|
|
704
|
+
delete<T = unknown>(
|
|
705
|
+
url: string,
|
|
706
|
+
config: RequestConfig & { responseType: 'blob' },
|
|
707
|
+
): Promise<HttpResponse<Blob>>
|
|
708
|
+
delete<T = unknown>(
|
|
709
|
+
url: string,
|
|
710
|
+
config: RequestConfig & { responseType: 'arraybuffer' },
|
|
711
|
+
): Promise<HttpResponse<ArrayBuffer>>
|
|
712
|
+
delete<T = unknown>(url: string, config?: undefined, unused?: undefined): Promise<HttpResponse<T>>
|
|
508
713
|
delete<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
509
714
|
|
|
510
715
|
/**
|
|
@@ -1370,7 +1575,10 @@ Result returned by {@link useAIModels}: every field as a signal.
|
|
|
1370
1575
|
|
|
1371
1576
|
```typescript
|
|
1372
1577
|
interface UseAIModelsResult {
|
|
1373
|
-
/**
|
|
1578
|
+
/**
|
|
1579
|
+
* Available models, or an empty array while loading or after a failed fetch. The list keeps its identity
|
|
1580
|
+
* until the catalog changes, the empty one included, so it can key a computed or an effect.
|
|
1581
|
+
*/
|
|
1374
1582
|
readonly models: Signal<AppModelDefinition[]>
|
|
1375
1583
|
/**
|
|
1376
1584
|
* Per-mode server default model ids for the requester's tier, or `undefined`
|
|
@@ -1771,7 +1979,7 @@ interface UseFormResult<T extends FormValuesConstraint<T>> {
|
|
|
1771
1979
|
* @param values - The values to apply.
|
|
1772
1980
|
* @param resetOptions - Whether edits survive.
|
|
1773
1981
|
*/
|
|
1774
|
-
updateValues: (values: Partial<T>, resetOptions?:
|
|
1982
|
+
updateValues: (values: Partial<T>, resetOptions?: FormUpdateOptions) => void
|
|
1775
1983
|
/**
|
|
1776
1984
|
* Whole-form state tuple: edits mark only changed fields dirty; fills
|
|
1777
1985
|
* preserve them.
|
|
@@ -2180,6 +2388,39 @@ interface UsePushResult {
|
|
|
2180
2388
|
}
|
|
2181
2389
|
```
|
|
2182
2390
|
|
|
2391
|
+
#### `UseOptimisticToggleOptions`
|
|
2392
|
+
|
|
2393
|
+
Options for {@link useOptimisticToggle}.
|
|
2394
|
+
|
|
2395
|
+
```typescript
|
|
2396
|
+
interface UseOptimisticToggleOptions {
|
|
2397
|
+
/** The loaded server value. Mount the control only after its record exists. */
|
|
2398
|
+
value: boolean
|
|
2399
|
+
/** Saves the DESIRED value and returns the server-confirmed value; reject on failure. */
|
|
2400
|
+
commit: (desired: boolean) => Promise<boolean>
|
|
2401
|
+
/** Receives the newest failed save and the confirmed value restored by the controller. */
|
|
2402
|
+
onError?: (error: unknown, value: boolean) => void
|
|
2403
|
+
}
|
|
2404
|
+
```
|
|
2405
|
+
|
|
2406
|
+
#### `UseOptimisticToggleResult`
|
|
2407
|
+
|
|
2408
|
+
What {@link useOptimisticToggle} returns: the boolean to render (as signals, the same
|
|
2409
|
+
fields React's result carries as plain values) and an argument-free action.
|
|
2410
|
+
|
|
2411
|
+
```typescript
|
|
2412
|
+
interface UseOptimisticToggleResult {
|
|
2413
|
+
/** The newest chosen value, or the server's value when nothing is saving. */
|
|
2414
|
+
readonly value: Signal<boolean>
|
|
2415
|
+
/** Whether a save is running or waiting to run. */
|
|
2416
|
+
readonly pending: Signal<boolean>
|
|
2417
|
+
/** The failure of the newest change, after the value went back; `null` otherwise. */
|
|
2418
|
+
readonly error: Signal<unknown>
|
|
2419
|
+
/** Flips the value shown now and saves it; the same function for the component's life. */
|
|
2420
|
+
toggle: () => void
|
|
2421
|
+
}
|
|
2422
|
+
```
|
|
2423
|
+
|
|
2183
2424
|
#### `UseProfileFormOptions`
|
|
2184
2425
|
|
|
2185
2426
|
Configuration for a profile form; transport stays in the auth bond.
|
|
@@ -2896,13 +3137,12 @@ interface MoleculeModuleConfig {
|
|
|
2896
3137
|
auth?: AuthClient<unknown>
|
|
2897
3138
|
/**
|
|
2898
3139
|
* Hold bootstrap (and so every page's first render) until `auth` has decided the
|
|
2899
|
-
* session.
|
|
2900
|
-
*
|
|
2901
|
-
*
|
|
2902
|
-
* treats a signed-in visitor as signed out. With this set, Angular's app initializer
|
|
3140
|
+
* session. A token-only or cookie-only restore makes a current-user request.
|
|
3141
|
+
* Until it answers, a public page's signed-in action (`if (!user) return`, a
|
|
3142
|
+
* redirect to `/login`) can treat a signed-in visitor as signed out. Angular's app initializer
|
|
2903
3143
|
* waits only while status is `'loading'`, so a cached session can render while its
|
|
2904
3144
|
* verification continues in the background. `'unavailable'` also renders and may have a
|
|
2905
|
-
* null user.
|
|
3145
|
+
* null user. A visitor with no session candidate settles synchronously without
|
|
2906
3146
|
* a request. Ignored without `auth`.
|
|
2907
3147
|
*/
|
|
2908
3148
|
awaitSession?: boolean
|
|
@@ -4325,8 +4565,9 @@ signed out, or `'unavailable'`), and the `[slot=fallback]` content until
|
|
|
4325
4565
|
then. It never redirects. An unavailable session is unconfirmed and may
|
|
4326
4566
|
still have `user === null`; handle that status separately from sign-out.
|
|
4327
4567
|
|
|
4328
|
-
|
|
4329
|
-
|
|
4568
|
+
With the bundled JWT client, a stored token and cached user restore synchronously.
|
|
4569
|
+
Token-only and cookie-only sessions need an asynchronous current-user request.
|
|
4570
|
+
Until it answers, `useAuth().user` is `null` everywhere, so a
|
|
4330
4571
|
public page that renders a signed-in action at once lets that action run
|
|
4331
4572
|
against "signed out": a Follow button whose handler starts with
|
|
4332
4573
|
`if (!user) return` ignores the click, one that redirects to `/login` signs
|
|
@@ -4334,7 +4575,7 @@ the visitor out of the flow. Wrapping the routes (or passing `awaitSession`
|
|
|
4334
4575
|
to `provideMolecule`) makes every page's first render read the restored user
|
|
4335
4576
|
when restoration succeeds.
|
|
4336
4577
|
|
|
4337
|
-
A visitor with no session
|
|
4578
|
+
A visitor with no session candidate settles synchronously without a
|
|
4338
4579
|
request. Must render inside the auth registration (`provideMolecule` with
|
|
4339
4580
|
`auth`). A client that nobody initialized starts its restore on this first
|
|
4340
4581
|
read. The bundled JWT client bounds each auth request (default 10 seconds)
|
|
@@ -5041,6 +5282,29 @@ function usePush(options?: MaybeSignal<UsePushOptions>): UsePushResult
|
|
|
5041
5282
|
|
|
5042
5283
|
**Returns:** The permission and token as signals and the action functions.
|
|
5043
5284
|
|
|
5285
|
+
#### `useOptimisticToggle(options)`
|
|
5286
|
+
|
|
5287
|
+
Owns the state and save ordering of a follow, favorite, star or subscription control
|
|
5288
|
+
while all markup stays in the component's template. Bind `toggle` straight to the click
|
|
5289
|
+
handler: it takes no argument and flips the value shown now. `commit(desired)` receives
|
|
5290
|
+
the value to SAVE, never the old one, and returns the server's boolean answer. Only the
|
|
5291
|
+
newest failure rolls the shown value back. Call it in an injection context.
|
|
5292
|
+
|
|
5293
|
+
Saves run one at a time; clicks during a save coalesce to the newest desired value. Use
|
|
5294
|
+
`pending` for feedback, not to disable the control or drop a click. Create it only after
|
|
5295
|
+
the record loads, one per record, and keep it through refetches. For a flag with a
|
|
5296
|
+
related count, use `useOptimisticValue` with both fields in one value.
|
|
5297
|
+
|
|
5298
|
+
```typescript
|
|
5299
|
+
function useOptimisticToggle(
|
|
5300
|
+
options: MaybeSignal<UseOptimisticToggleOptions>,
|
|
5301
|
+
): UseOptimisticToggleResult
|
|
5302
|
+
```
|
|
5303
|
+
|
|
5304
|
+
- `options` — The server value, the save and an optional error callback (or a signal of them: a new `value` syncs in while nothing is saving).
|
|
5305
|
+
|
|
5306
|
+
**Returns:** The value, pending and error state as signals, and the stable `toggle`.
|
|
5307
|
+
|
|
5044
5308
|
#### `useProfileForm(options)`
|
|
5045
5309
|
|
|
5046
5310
|
Owns load → edit → submit → publish for the signed-in user's profile. Call
|
|
@@ -6076,7 +6340,7 @@ Peer dependencies:
|
|
|
6076
6340
|
- `@molecule/app-auth` ^3.0.0
|
|
6077
6341
|
- `@molecule/app-code-editor` ^1.0.1
|
|
6078
6342
|
- `@molecule/app-device` ^1.0.1
|
|
6079
|
-
- `@molecule/app-forms` ^2.
|
|
6343
|
+
- `@molecule/app-forms` ^2.4.0
|
|
6080
6344
|
- `@molecule/app-http` ^1.0.1
|
|
6081
6345
|
- `@molecule/app-i18n` ^1.0.1
|
|
6082
6346
|
- `@molecule/app-ide` ^1.0.1
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './use-http.js';
|
|
|
13
13
|
export * from './use-ide.js';
|
|
14
14
|
export * from './use-logger.js';
|
|
15
15
|
export * from './use-native.js';
|
|
16
|
+
export * from './use-optimistic-toggle.js';
|
|
16
17
|
export * from './use-profile-form.js';
|
|
17
18
|
export * from './use-router.js';
|
|
18
19
|
export * from './use-storage.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from './use-http.js';
|
|
|
13
13
|
export * from './use-ide.js';
|
|
14
14
|
export * from './use-logger.js';
|
|
15
15
|
export * from './use-native.js';
|
|
16
|
+
export * from './use-optimistic-toggle.js';
|
|
16
17
|
export * from './use-profile-form.js';
|
|
17
18
|
export * from './use-router.js';
|
|
18
19
|
export * from './use-storage.js';
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA"}
|
|
@@ -20,7 +20,10 @@ export declare function resetAIModelsCache(): void;
|
|
|
20
20
|
* Result returned by {@link useAIModels}: every field as a signal.
|
|
21
21
|
*/
|
|
22
22
|
export interface UseAIModelsResult {
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Available models, or an empty array while loading or after a failed fetch. The list keeps its identity
|
|
25
|
+
* until the catalog changes, the empty one included, so it can key a computed or an effect.
|
|
26
|
+
*/
|
|
24
27
|
readonly models: Signal<AppModelDefinition[]>;
|
|
25
28
|
/**
|
|
26
29
|
* Per-mode server default model ids for the requester's tier, or `undefined`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ai-models.d.ts","sourceRoot":"","sources":["../../src/hooks/use-ai-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAwC,KAAK,MAAM,EAAqB,MAAM,eAAe,CAAA;AAEpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAIvF,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"use-ai-models.d.ts","sourceRoot":"","sources":["../../src/hooks/use-ai-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAwC,KAAK,MAAM,EAAqB,MAAM,eAAe,CAAA;AAEpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAIvF,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,oBAAoB,CAAA;AAsGtE;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CASzC;AAcD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAA;IAC7C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAA;IAC3D,gEAAgE;IAChE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAA;IAC9D,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;CACrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,iBAAiB,CAmD1F"}
|
|
@@ -12,6 +12,12 @@ import { computed, DestroyRef, effect, inject, signal, untracked } from '@angula
|
|
|
12
12
|
import { loadAIModelCatalog, pickFreeTierModel } from '@molecule/app-ai-models';
|
|
13
13
|
import { readMaybeSignal } from '../maybe-signal.js';
|
|
14
14
|
import { useHttpClient } from './use-http.js';
|
|
15
|
+
/**
|
|
16
|
+
* The list returned while the catalog loads or after it fails. One module-level array, like the catalog's
|
|
17
|
+
* own lists, which every caller on a scope shares: a new `[]` per read would change the identity of an
|
|
18
|
+
* unchanged catalog.
|
|
19
|
+
*/
|
|
20
|
+
const NO_MODELS = [];
|
|
15
21
|
/** One cache entry per scope — `''` for the unscoped catalog, else the projectId. */
|
|
16
22
|
const caches = new Map();
|
|
17
23
|
/**
|
|
@@ -154,7 +160,7 @@ export function useAIModels(projectId) {
|
|
|
154
160
|
destroyRef.onDestroy(() => {
|
|
155
161
|
listenersFor(scope).delete(listener);
|
|
156
162
|
});
|
|
157
|
-
const models = computed(() => snapshot().models ??
|
|
163
|
+
const models = computed(() => snapshot().models ?? NO_MODELS, /* @ts-ignore */
|
|
158
164
|
...(ngDevMode ? [{ debugName: "models" }] : /* istanbul ignore next */ []));
|
|
159
165
|
return {
|
|
160
166
|
models,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ai-models.js","sourceRoot":"","sources":["../../src/hooks/use-ai-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGpG,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAG/E,OAAO,EAAoB,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"use-ai-models.js","sourceRoot":"","sources":["../../src/hooks/use-ai-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGpG,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAG/E,OAAO,EAAoB,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7C;;;;GAIG;AACH,MAAM,SAAS,GAAyB,EAAE,CAAA;AAS1C,qFAAqF;AACrF,MAAM,MAAM,GAAG,IAAI,GAAG,EAAsB,CAAA;AAE5C;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAa;IAC7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AC,EACtE,OAAO,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,SAAS,CAAC,CAmDpE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,KAAK,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,OAAO,CAAC,CAEpD"}
|
package/dist/hooks/use-auth.js
CHANGED
|
@@ -17,7 +17,7 @@ import { AUTH_CLIENT } from '../tokens.js';
|
|
|
17
17
|
* @throws {Error} When no auth client is registered.
|
|
18
18
|
*/
|
|
19
19
|
export function useAuthClient() {
|
|
20
|
-
return injectProvider(AUTH_CLIENT, 'useAuthOutsideProvider'
|
|
20
|
+
return injectProvider(AUTH_CLIENT, 'useAuthOutsideProvider');
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Authentication state and actions. Call it in an injection context (a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-auth.js","sourceRoot":"","sources":["../../src/hooks/use-auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAYpG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAoB,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa;IAI3B,OAAO,cAAc,
|
|
1
|
+
{"version":3,"file":"use-auth.js","sourceRoot":"","sources":["../../src/hooks/use-auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,EAA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