@molecule/app-http-axios 1.0.3 → 1.0.4
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 +52 -11
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +7 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +19 -8
- package/dist/provider.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,20 +3,20 @@ 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-10-
|
|
6
|
+
Generated: 2026-10-17T00:20:54.724Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-http-axios
|
|
10
10
|
|
|
11
|
-
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
-
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
-
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
-
|
|
15
11
|
Axios HTTP client provider for `@molecule/app-http`.
|
|
16
12
|
|
|
17
13
|
This package provides an Axios-based implementation of the molecule HttpClient interface,
|
|
18
14
|
allowing you to use molecule's HTTP abstractions with Axios.
|
|
19
15
|
|
|
16
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
17
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
18
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
19
|
+
|
|
20
20
|
## Quick Start
|
|
21
21
|
|
|
22
22
|
```ts
|
|
@@ -76,6 +76,17 @@ interface AxiosHttpClientConfig {
|
|
|
76
76
|
*/
|
|
77
77
|
withCredentials?: boolean
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The scheme of the `Authorization` header the auth token is sent with:
|
|
81
|
+
* `Bearer` (default), or what your API expects, e.g. `Token` for an API that
|
|
82
|
+
* reads `Authorization: Token <jwt>`. Pass it to this config, at construction —
|
|
83
|
+
* `setClient(createAxiosClient({ baseURL, authScheme: 'Token' }))` — never as a
|
|
84
|
+
* property of the client it returns. Same option as `@molecule/app-http`'s
|
|
85
|
+
* `HttpClientConfig.authScheme`, so the config reads the same whichever
|
|
86
|
+
* transport is bonded.
|
|
87
|
+
*/
|
|
88
|
+
authScheme?: string
|
|
89
|
+
|
|
79
90
|
/**
|
|
80
91
|
* Existing Axios instance to wrap (optional).
|
|
81
92
|
*/
|
|
@@ -185,7 +196,10 @@ interface HttpClientConfig {
|
|
|
185
196
|
/**
|
|
186
197
|
* The scheme of the `Authorization` header the auth token is sent with:
|
|
187
198
|
* `Bearer` (default), or what your API expects, e.g. `Token` for an API that
|
|
188
|
-
* reads `Authorization: Token <jwt>`.
|
|
199
|
+
* reads `Authorization: Token <jwt>`. It is an option of the client's
|
|
200
|
+
* CONSTRUCTOR (`createFetchClient({ baseURL, authScheme: 'Token' })`, or the
|
|
201
|
+
* bonded provider's `createAxiosClient({ … })`), never a property of the client
|
|
202
|
+
* it returns.
|
|
189
203
|
*/
|
|
190
204
|
authScheme?: string
|
|
191
205
|
}
|
|
@@ -195,7 +209,7 @@ interface HttpClientConfig {
|
|
|
195
209
|
|
|
196
210
|
HTTP request options (headers, query params, timeout, credentials, response type, abort signal).
|
|
197
211
|
|
|
198
|
-
|
|
212
|
+
````typescript
|
|
199
213
|
interface RequestConfig {
|
|
200
214
|
/**
|
|
201
215
|
* Request headers.
|
|
@@ -213,6 +227,25 @@ interface RequestConfig {
|
|
|
213
227
|
* Whether to include credentials (cookies).
|
|
214
228
|
*/
|
|
215
229
|
withCredentials?: boolean
|
|
230
|
+
/**
|
|
231
|
+
* Send this request WITHOUT waiting for the session restore (the auth gate).
|
|
232
|
+
*
|
|
233
|
+
* A request the gate itself depends on must set this. A gate registered with
|
|
234
|
+
* `setAuthGate` that waits for a session restore whose own request goes through this
|
|
235
|
+
* client otherwise waits on itself: the gate holds the restore's request, the restore's
|
|
236
|
+
* promise never settles, and every request on the page stalls until the gate times out —
|
|
237
|
+
* so pass `skipAuthGate: true` on the restore's own request:
|
|
238
|
+
*
|
|
239
|
+
* ```typescript
|
|
240
|
+
* // the request the gate's restore makes, through the same client the gate holds back
|
|
241
|
+
* await http.get(currentUserEndpoint, { skipAuthGate: true })
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* `@molecule/app-auth`'s own restore does not need it — it sends its request with
|
|
245
|
+
* `fetch`, not through this client. An app with its own session store that registers a
|
|
246
|
+
* gate with `setAuthGate` does.
|
|
247
|
+
*/
|
|
248
|
+
skipAuthGate?: boolean
|
|
216
249
|
/**
|
|
217
250
|
* Response type.
|
|
218
251
|
*/
|
|
@@ -230,7 +263,7 @@ interface RequestConfig {
|
|
|
230
263
|
*/
|
|
231
264
|
options?: Record<string, unknown>
|
|
232
265
|
}
|
|
233
|
-
|
|
266
|
+
````
|
|
234
267
|
|
|
235
268
|
#### `FullRequestConfig`
|
|
236
269
|
|
|
@@ -358,7 +391,7 @@ Supports request/response/error interceptors, auth token management, and 401 err
|
|
|
358
391
|
function createAxiosClient(config?: AxiosHttpClientConfig): HttpClient
|
|
359
392
|
```
|
|
360
393
|
|
|
361
|
-
- `config` — Axios client configuration (base URL, headers, timeout, credentials, or an existing Axios instance).
|
|
394
|
+
- `config` — Axios client configuration (base URL, headers, timeout, credentials, auth scheme, or an existing Axios instance).
|
|
362
395
|
|
|
363
396
|
**Returns:** An `HttpClient` backed by Axios with interceptor and auth token support.
|
|
364
397
|
|
|
@@ -381,11 +414,11 @@ Implements `@molecule/app-http` interface.
|
|
|
381
414
|
Setup function to register this provider with the core interface:
|
|
382
415
|
|
|
383
416
|
```typescript
|
|
384
|
-
import {
|
|
417
|
+
import { setClient } from '@molecule/app-http'
|
|
385
418
|
import { provider } from '@molecule/app-http-axios'
|
|
386
419
|
|
|
387
420
|
export function setupHttpAxios(): void {
|
|
388
|
-
|
|
421
|
+
setClient(provider)
|
|
389
422
|
}
|
|
390
423
|
```
|
|
391
424
|
|
|
@@ -412,6 +445,14 @@ Peer dependencies:
|
|
|
412
445
|
- The exported `provider` constant is a pre-built default client (no baseURL,
|
|
413
446
|
30 s timeout); prefer `createAxiosClient({...})` so baseURL/credentials are
|
|
414
447
|
explicit.
|
|
448
|
+
- An API whose scheme is not `Bearer` (`Authorization: Token <jwt>`) passes
|
|
449
|
+
`authScheme: 'Token'` to THIS package's constructor —
|
|
450
|
+
`setClient(createAxiosClient({ baseURL, authScheme: 'Token' }))` — and the auth
|
|
451
|
+
token is then sent with that scheme. It is NOT a property of the client
|
|
452
|
+
`setClient()`/`getClient()` hands around: that is a built `HttpClient`, and
|
|
453
|
+
`client.authScheme = 'Token'` is a type error that changes no header. The option
|
|
454
|
+
name is the same one `@molecule/app-http`'s `HttpClientConfig` declares, so the
|
|
455
|
+
config reads the same whichever transport is bonded.
|
|
415
456
|
- `instance`/`axiosConfig` accept raw Axios options — anything the app sets
|
|
416
457
|
there couples it to Axios; keep app code on the `@molecule/app-http`
|
|
417
458
|
interface so the bond stays swappable.
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
* - The exported `provider` constant is a pre-built default client (no baseURL,
|
|
35
35
|
* 30 s timeout); prefer `createAxiosClient({...})` so baseURL/credentials are
|
|
36
36
|
* explicit.
|
|
37
|
+
* - An API whose scheme is not `Bearer` (`Authorization: Token <jwt>`) passes
|
|
38
|
+
* `authScheme: 'Token'` to THIS package's constructor —
|
|
39
|
+
* `setClient(createAxiosClient({ baseURL, authScheme: 'Token' }))` — and the auth
|
|
40
|
+
* token is then sent with that scheme. It is NOT a property of the client
|
|
41
|
+
* `setClient()`/`getClient()` hands around: that is a built `HttpClient`, and
|
|
42
|
+
* `client.authScheme = 'Token'` is a type error that changes no header. The option
|
|
43
|
+
* name is the same one `@molecule/app-http`'s `HttpClientConfig` declares, so the
|
|
44
|
+
* config reads the same whichever transport is bonded.
|
|
37
45
|
* - `instance`/`axiosConfig` accept raw Axios options — anything the app sets
|
|
38
46
|
* there couples it to Axios; keep app code on the `@molecule/app-http`
|
|
39
47
|
* interface so the bond stays swappable.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
* - The exported `provider` constant is a pre-built default client (no baseURL,
|
|
35
35
|
* 30 s timeout); prefer `createAxiosClient({...})` so baseURL/credentials are
|
|
36
36
|
* explicit.
|
|
37
|
+
* - An API whose scheme is not `Bearer` (`Authorization: Token <jwt>`) passes
|
|
38
|
+
* `authScheme: 'Token'` to THIS package's constructor —
|
|
39
|
+
* `setClient(createAxiosClient({ baseURL, authScheme: 'Token' }))` — and the auth
|
|
40
|
+
* token is then sent with that scheme. It is NOT a property of the client
|
|
41
|
+
* `setClient()`/`getClient()` hands around: that is a built `HttpClient`, and
|
|
42
|
+
* `client.authScheme = 'Token'` is a type error that changes no header. The option
|
|
43
|
+
* name is the same one `@molecule/app-http`'s `HttpClientConfig` declares, so the
|
|
44
|
+
* config reads the same whichever transport is bonded.
|
|
37
45
|
* - `instance`/`axiosConfig` accept raw Axios options — anything the app sets
|
|
38
46
|
* there couples it to Axios; keep app code on the `@molecule/app-http`
|
|
39
47
|
* interface so the bond stays swappable.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/provider.d.ts
CHANGED
|
@@ -22,7 +22,13 @@ import type { AxiosHttpClientConfig, HttpClient } from './types.js';
|
|
|
22
22
|
* const response = await client.get('/users')
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* An API that reads another scheme than `Bearer` (`Authorization: Token <jwt>`) passes
|
|
26
|
+
* `authScheme: 'Token'` HERE, in this constructor —
|
|
27
|
+
* `setClient(createAxiosClient({ baseURL, authScheme: 'Token' }))` — and the auth token is
|
|
28
|
+
* then sent with that scheme. It is the same option `@molecule/app-http`'s own client
|
|
29
|
+
* takes, and not a property of the client you pass to `setClient()`.
|
|
30
|
+
*
|
|
31
|
+
* @param config - Axios client configuration (base URL, headers, timeout, credentials, auth scheme, or an existing Axios instance).
|
|
26
32
|
* @returns An `HttpClient` backed by Axios with interceptor and auth token support.
|
|
27
33
|
*/
|
|
28
34
|
export declare function createAxiosClient(config?: AxiosHttpClientConfig): HttpClient;
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EACV,qBAAqB,EAGrB,UAAU,EAKX,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EACV,qBAAqB,EAGrB,UAAU,EAKX,MAAM,YAAY,CAAA;AA8DnB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,qBAA0B,GAAG,UAAU,CA2QhF;AAED,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,YAAsB,CAAA"}
|
package/dist/provider.js
CHANGED
|
@@ -21,6 +21,8 @@ function toAxiosConfig(config) {
|
|
|
21
21
|
signal: config.signal,
|
|
22
22
|
data: config.data,
|
|
23
23
|
...config.options,
|
|
24
|
+
// After `config.options`, so the documented option wins over an implementation-specific one.
|
|
25
|
+
skipAuthGate: config.skipAuthGate,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
@@ -69,11 +71,17 @@ function toHttpResponse(response, config) {
|
|
|
69
71
|
* const response = await client.get('/users')
|
|
70
72
|
* ```
|
|
71
73
|
*
|
|
72
|
-
*
|
|
74
|
+
* An API that reads another scheme than `Bearer` (`Authorization: Token <jwt>`) passes
|
|
75
|
+
* `authScheme: 'Token'` HERE, in this constructor —
|
|
76
|
+
* `setClient(createAxiosClient({ baseURL, authScheme: 'Token' }))` — and the auth token is
|
|
77
|
+
* then sent with that scheme. It is the same option `@molecule/app-http`'s own client
|
|
78
|
+
* takes, and not a property of the client you pass to `setClient()`.
|
|
79
|
+
*
|
|
80
|
+
* @param config - Axios client configuration (base URL, headers, timeout, credentials, auth scheme, or an existing Axios instance).
|
|
73
81
|
* @returns An `HttpClient` backed by Axios with interceptor and auth token support.
|
|
74
82
|
*/
|
|
75
83
|
export function createAxiosClient(config = {}) {
|
|
76
|
-
const { baseURL = '', defaultHeaders = {}, timeout = 30000, withCredentials = false, instance: existingInstance, axiosConfig = {}, } = config;
|
|
84
|
+
const { baseURL = '', defaultHeaders = {}, timeout = 30000, withCredentials = false, authScheme = 'Bearer', instance: existingInstance, axiosConfig = {}, } = config;
|
|
77
85
|
// Create or use existing Axios instance
|
|
78
86
|
const axiosInstance = existingInstance ??
|
|
79
87
|
axios.create({
|
|
@@ -92,10 +100,6 @@ export function createAxiosClient(config = {}) {
|
|
|
92
100
|
const currentDefaultHeaders = { ...defaultHeaders };
|
|
93
101
|
// Add Axios request interceptor to run molecule interceptors
|
|
94
102
|
axiosInstance.interceptors.request.use(async (axiosConfig) => {
|
|
95
|
-
// Wait for the session restore first — every method on this client goes through
|
|
96
|
-
// here, so a request fired by a page effect before the restore settled cannot
|
|
97
|
-
// leave unauthenticated (see `@molecule/app-http` `auth-gate.ts`).
|
|
98
|
-
await awaitAuthGate();
|
|
99
103
|
let config = {
|
|
100
104
|
method: axiosConfig.method?.toUpperCase() ?? 'GET',
|
|
101
105
|
url: axiosConfig.url ?? '',
|
|
@@ -104,7 +108,14 @@ export function createAxiosClient(config = {}) {
|
|
|
104
108
|
timeout: axiosConfig.timeout,
|
|
105
109
|
withCredentials: axiosConfig.withCredentials,
|
|
106
110
|
data: axiosConfig.data,
|
|
111
|
+
skipAuthGate: axiosConfig.skipAuthGate,
|
|
107
112
|
};
|
|
113
|
+
// Wait for the session restore first — every method on this client goes through
|
|
114
|
+
// here, so a request fired by a page effect before the restore settled cannot
|
|
115
|
+
// leave unauthenticated (see `@molecule/app-http` `auth-gate.ts`). The config goes with
|
|
116
|
+
// it so a request the gate itself depends on can opt out (`skipAuthGate`) and a stalled
|
|
117
|
+
// gate can name what it held.
|
|
118
|
+
await awaitAuthGate(config);
|
|
108
119
|
// Run request interceptors
|
|
109
120
|
for (const interceptor of requestInterceptors) {
|
|
110
121
|
config = await interceptor(config);
|
|
@@ -261,8 +272,8 @@ export function createAxiosClient(config = {}) {
|
|
|
261
272
|
setAuthToken(token) {
|
|
262
273
|
authToken = token;
|
|
263
274
|
if (token) {
|
|
264
|
-
axiosInstance.defaults.headers.common['Authorization'] =
|
|
265
|
-
currentDefaultHeaders['Authorization'] =
|
|
275
|
+
axiosInstance.defaults.headers.common['Authorization'] = `${authScheme} ${token}`;
|
|
276
|
+
currentDefaultHeaders['Authorization'] = `${authScheme} ${token}`;
|
|
266
277
|
}
|
|
267
278
|
else {
|
|
268
279
|
delete axiosInstance.defaults.headers.common['Authorization'];
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAMN,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAYlD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAMN,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAYlD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAWtC;;;;GAIG;AACH,SAAS,aAAa,CAAC,MAAqB;IAC1C,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,MAAM,CAAC,OAAO;QACjB,6FAA6F;QAC7F,YAAY,EAAE,MAAM,CAAC,YAAY;KAClC,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,cAAc,CAAI,QAA0B,EAAE,MAAyB;IAC9E,MAAM,OAAO,GAA2B,EAAE,CAAA;IAE1C,uCAAuC;IACvC,IAAI,QAAQ,CAAC,OAAO,EAA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*/
|
|
28
28
|
withCredentials?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The scheme of the `Authorization` header the auth token is sent with:
|
|
31
|
+
* `Bearer` (default), or what your API expects, e.g. `Token` for an API that
|
|
32
|
+
* reads `Authorization: Token <jwt>`. Pass it to this config, at construction —
|
|
33
|
+
* `setClient(createAxiosClient({ baseURL, authScheme: 'Token' }))` — never as a
|
|
34
|
+
* property of the client it returns. Same option as `@molecule/app-http`'s
|
|
35
|
+
* `HttpClientConfig.authScheme`, so the config reads the same whichever
|
|
36
|
+
* transport is bonded.
|
|
37
|
+
*/
|
|
38
|
+
authScheme?: string;
|
|
29
39
|
/**
|
|
30
40
|
* Existing Axios instance to wrap (optional).
|
|
31
41
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAG9D,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEvC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAA;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAA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