@makerx/graphql-core 3.0.0-beta.7 → 3.0.0-beta.8
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 +28 -0
- package/package.json +1 -1
- package/subscriptions/index.d.cts +1 -0
- package/subscriptions/index.d.mts +1 -0
- package/subscriptions/index.d.ts +1 -0
- package/subscriptions/index.js +2 -0
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/index.mjs +1 -0
- package/subscriptions/index.mjs.map +1 -1
- package/subscriptions/subscription-iterator.d.cts +21 -0
- package/subscriptions/subscription-iterator.d.mts +21 -0
- package/subscriptions/subscription-iterator.d.ts +21 -0
- package/subscriptions/subscription-iterator.js +56 -0
- package/subscriptions/subscription-iterator.js.map +1 -0
- package/subscriptions/subscription-iterator.mjs +54 -0
- package/subscriptions/subscription-iterator.mjs.map +1 -0
package/README.md
CHANGED
|
@@ -366,6 +366,34 @@ This library includes a `subscriptions` module to provide simple setup using the
|
|
|
366
366
|
|
|
367
367
|
1. For authorisation, clients can include a connection parameter named `authorization` or `Authorization` using the HTTP header format `Bearer <token>`. Note: [Apollo Sandbox](https://studio.apollographql.com/sandbox/explorer) will include an `Authorization` connection parameter when you specify an HTTP `Authorization` header via the UI.
|
|
368
368
|
|
|
369
|
+
### wrapSubscriptionIterator
|
|
370
|
+
|
|
371
|
+
Wraps an `AsyncIterableIterator` (e.g. one returned by a pubsub `asyncIterableIterator(...)` call) with two optional behaviours:
|
|
372
|
+
|
|
373
|
+
- `initialPayload` — a single event or array of events yielded before the wrapped iterator's events. Useful when a client subscribes after a state change has already happened, so they don't miss the current state while waiting for the next event.
|
|
374
|
+
- `eventIsFinal` — a predicate that ends iteration eagerly when it returns `true` for an event. The final event is still yielded, then `wrapped.return()` is called to release resources. Only applied to events from the wrapped iterator, not to entries in `initialPayload`.
|
|
375
|
+
|
|
376
|
+
Typical use is in a subscription resolver that needs to bridge a "current state" (cache or other persisted state lookup) with a live event stream, and close the subscription once a terminal event arrives:
|
|
377
|
+
|
|
378
|
+
```ts
|
|
379
|
+
const eventIsFinal = (data: BackgroundJobTopicData) =>
|
|
380
|
+
[BackgroundJobStatus.Completed, BackgroundJobStatus.Failed].includes(data.event.status)
|
|
381
|
+
|
|
382
|
+
export const subscribeToBackgroundJobEvents = async (
|
|
383
|
+
args: SubscriptionBackgroundJobEventArgs,
|
|
384
|
+
): Promise<AsyncIterator<BackgroundJobTopicData> & AsyncIterable<BackgroundJobTopicData>> => {
|
|
385
|
+
const initialPayload = await getJobFinishedEventFromCache(args.jobId)
|
|
386
|
+
const iterator = pubsub().asyncIterableIterator<BackgroundJobTopicData>(`${BACKGROUND_JOB_TOPIC}.${args.jobId}`)
|
|
387
|
+
return wrapSubscriptionIterator({
|
|
388
|
+
iterator,
|
|
389
|
+
initialPayload: initialPayload ? [initialPayload] : undefined,
|
|
390
|
+
eventIsFinal,
|
|
391
|
+
})
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
The returned value is both an `AsyncIterator` and `AsyncIterable`, so it can be consumed via `for await` or by manual `next()` calls. `return()` and `throw()` are forwarded to the wrapped iterator when present.
|
|
396
|
+
|
|
369
397
|
## Utils
|
|
370
398
|
|
|
371
399
|
- `isIntrospectionQuery`: indicates whether the query is an introspection query, based on the operation name or query content.
|
package/package.json
CHANGED
package/subscriptions/index.d.ts
CHANGED
package/subscriptions/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var context = require('./context.js');
|
|
4
|
+
var subscriptionIterator = require('./subscription-iterator.js');
|
|
4
5
|
var server = require('./server.js');
|
|
5
6
|
var utils = require('./utils.js');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
exports.createSubscriptionContextFactory = context.createSubscriptionContextFactory;
|
|
11
|
+
exports.wrapSubscriptionIterator = subscriptionIterator.wrapSubscriptionIterator;
|
|
10
12
|
exports.useSubscriptionsServer = server.useSubscriptionsServer;
|
|
11
13
|
exports.extractTokenFromConnectionParams = utils.extractTokenFromConnectionParams;
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/subscriptions/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createSubscriptionContextFactory } from './context.mjs';
|
|
2
|
+
export { wrapSubscriptionIterator } from './subscription-iterator.mjs';
|
|
2
3
|
export { useSubscriptionsServer } from './server.mjs';
|
|
3
4
|
export { extractTokenFromConnectionParams } from './utils.mjs';
|
|
4
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps an async iterator with options for:
|
|
3
|
+
* - returning an initial payload (e.g. current state)
|
|
4
|
+
* - eagerly ending iteration when a final event is received
|
|
5
|
+
*
|
|
6
|
+
* Providing an initial payload helps avoid race conditions when clients subscribe to events but miss recent state changes,
|
|
7
|
+
* by providing an initial payload to be immediately returned, before subsequent events stream in.
|
|
8
|
+
*
|
|
9
|
+
* Eagerly ending iteration when a final event ensures subscriptions do not continue unnecessarily.
|
|
10
|
+
*
|
|
11
|
+
* @param iterator The async iterator to wrap.
|
|
12
|
+
* @param initialPayload An optional initial payload to return on the first iteration. May be a single event or an array.
|
|
13
|
+
* @param eventIsFinal An optional function to determine if an event is final (and iteration should end).
|
|
14
|
+
* Note: only applied to events from the wrapped iterator, not to entries in `initialPayload`.
|
|
15
|
+
* @returns An async iterator for the event data.
|
|
16
|
+
*/
|
|
17
|
+
export declare function wrapSubscriptionIterator<TEventData>({ iterator: wrapped, initialPayload, eventIsFinal, }: {
|
|
18
|
+
iterator: AsyncIterableIterator<TEventData>;
|
|
19
|
+
initialPayload?: TEventData | TEventData[];
|
|
20
|
+
eventIsFinal?: (event: TEventData) => boolean;
|
|
21
|
+
}): AsyncIterator<TEventData> & AsyncIterable<TEventData>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps an async iterator with options for:
|
|
3
|
+
* - returning an initial payload (e.g. current state)
|
|
4
|
+
* - eagerly ending iteration when a final event is received
|
|
5
|
+
*
|
|
6
|
+
* Providing an initial payload helps avoid race conditions when clients subscribe to events but miss recent state changes,
|
|
7
|
+
* by providing an initial payload to be immediately returned, before subsequent events stream in.
|
|
8
|
+
*
|
|
9
|
+
* Eagerly ending iteration when a final event ensures subscriptions do not continue unnecessarily.
|
|
10
|
+
*
|
|
11
|
+
* @param iterator The async iterator to wrap.
|
|
12
|
+
* @param initialPayload An optional initial payload to return on the first iteration. May be a single event or an array.
|
|
13
|
+
* @param eventIsFinal An optional function to determine if an event is final (and iteration should end).
|
|
14
|
+
* Note: only applied to events from the wrapped iterator, not to entries in `initialPayload`.
|
|
15
|
+
* @returns An async iterator for the event data.
|
|
16
|
+
*/
|
|
17
|
+
export declare function wrapSubscriptionIterator<TEventData>({ iterator: wrapped, initialPayload, eventIsFinal, }: {
|
|
18
|
+
iterator: AsyncIterableIterator<TEventData>;
|
|
19
|
+
initialPayload?: TEventData | TEventData[];
|
|
20
|
+
eventIsFinal?: (event: TEventData) => boolean;
|
|
21
|
+
}): AsyncIterator<TEventData> & AsyncIterable<TEventData>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps an async iterator with options for:
|
|
3
|
+
* - returning an initial payload (e.g. current state)
|
|
4
|
+
* - eagerly ending iteration when a final event is received
|
|
5
|
+
*
|
|
6
|
+
* Providing an initial payload helps avoid race conditions when clients subscribe to events but miss recent state changes,
|
|
7
|
+
* by providing an initial payload to be immediately returned, before subsequent events stream in.
|
|
8
|
+
*
|
|
9
|
+
* Eagerly ending iteration when a final event ensures subscriptions do not continue unnecessarily.
|
|
10
|
+
*
|
|
11
|
+
* @param iterator The async iterator to wrap.
|
|
12
|
+
* @param initialPayload An optional initial payload to return on the first iteration. May be a single event or an array.
|
|
13
|
+
* @param eventIsFinal An optional function to determine if an event is final (and iteration should end).
|
|
14
|
+
* Note: only applied to events from the wrapped iterator, not to entries in `initialPayload`.
|
|
15
|
+
* @returns An async iterator for the event data.
|
|
16
|
+
*/
|
|
17
|
+
export declare function wrapSubscriptionIterator<TEventData>({ iterator: wrapped, initialPayload, eventIsFinal, }: {
|
|
18
|
+
iterator: AsyncIterableIterator<TEventData>;
|
|
19
|
+
initialPayload?: TEventData | TEventData[];
|
|
20
|
+
eventIsFinal?: (event: TEventData) => boolean;
|
|
21
|
+
}): AsyncIterator<TEventData> & AsyncIterable<TEventData>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wraps an async iterator with options for:
|
|
5
|
+
* - returning an initial payload (e.g. current state)
|
|
6
|
+
* - eagerly ending iteration when a final event is received
|
|
7
|
+
*
|
|
8
|
+
* Providing an initial payload helps avoid race conditions when clients subscribe to events but miss recent state changes,
|
|
9
|
+
* by providing an initial payload to be immediately returned, before subsequent events stream in.
|
|
10
|
+
*
|
|
11
|
+
* Eagerly ending iteration when a final event ensures subscriptions do not continue unnecessarily.
|
|
12
|
+
*
|
|
13
|
+
* @param iterator The async iterator to wrap.
|
|
14
|
+
* @param initialPayload An optional initial payload to return on the first iteration. May be a single event or an array.
|
|
15
|
+
* @param eventIsFinal An optional function to determine if an event is final (and iteration should end).
|
|
16
|
+
* Note: only applied to events from the wrapped iterator, not to entries in `initialPayload`.
|
|
17
|
+
* @returns An async iterator for the event data.
|
|
18
|
+
*/
|
|
19
|
+
function wrapSubscriptionIterator({ iterator: wrapped, initialPayload, eventIsFinal, }) {
|
|
20
|
+
let done = false;
|
|
21
|
+
const initialQueue = initialPayload === undefined ? [] : Array.isArray(initialPayload) ? [...initialPayload] : [initialPayload];
|
|
22
|
+
const iterator = {
|
|
23
|
+
next: async () => {
|
|
24
|
+
if (done)
|
|
25
|
+
return { done: true, value: undefined };
|
|
26
|
+
if (initialQueue.length > 0) {
|
|
27
|
+
const value = initialQueue.shift();
|
|
28
|
+
return { done: false, value };
|
|
29
|
+
}
|
|
30
|
+
const next = await wrapped.next();
|
|
31
|
+
if (!next.done && eventIsFinal && eventIsFinal(next.value)) {
|
|
32
|
+
done = true;
|
|
33
|
+
await wrapped.return?.();
|
|
34
|
+
}
|
|
35
|
+
return next;
|
|
36
|
+
},
|
|
37
|
+
return: async (value) => {
|
|
38
|
+
done = true;
|
|
39
|
+
initialQueue.length = 0;
|
|
40
|
+
if (wrapped.return)
|
|
41
|
+
return wrapped.return(value);
|
|
42
|
+
return { done: true, value: value };
|
|
43
|
+
},
|
|
44
|
+
throw: async (err) => {
|
|
45
|
+
done = true;
|
|
46
|
+
initialQueue.length = 0;
|
|
47
|
+
if (wrapped.throw)
|
|
48
|
+
return wrapped.throw(err);
|
|
49
|
+
throw err;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
return { ...iterator, [Symbol.asyncIterator]: () => iterator };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.wrapSubscriptionIterator = wrapSubscriptionIterator;
|
|
56
|
+
//# sourceMappingURL=subscription-iterator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-iterator.js","sources":["../../src/subscriptions/subscription-iterator.ts"],"sourcesContent":["/**\n * Wraps an async iterator with options for:\n * - returning an initial payload (e.g. current state)\n * - eagerly ending iteration when a final event is received\n *\n * Providing an initial payload helps avoid race conditions when clients subscribe to events but miss recent state changes,\n * by providing an initial payload to be immediately returned, before subsequent events stream in.\n *\n * Eagerly ending iteration when a final event ensures subscriptions do not continue unnecessarily.\n *\n * @param iterator The async iterator to wrap.\n * @param initialPayload An optional initial payload to return on the first iteration. May be a single event or an array.\n * @param eventIsFinal An optional function to determine if an event is final (and iteration should end).\n * Note: only applied to events from the wrapped iterator, not to entries in `initialPayload`.\n * @returns An async iterator for the event data.\n */\nexport function wrapSubscriptionIterator<TEventData>({\n iterator: wrapped,\n initialPayload,\n eventIsFinal,\n}: {\n iterator: AsyncIterableIterator<TEventData>\n initialPayload?: TEventData | TEventData[]\n eventIsFinal?: (event: TEventData) => boolean\n}): AsyncIterator<TEventData> & AsyncIterable<TEventData> {\n let done = false\n const initialQueue: TEventData[] =\n initialPayload === undefined ? [] : Array.isArray(initialPayload) ? [...initialPayload] : [initialPayload]\n\n const iterator: AsyncIterator<TEventData> = {\n next: async () => {\n if (done) return { done: true, value: undefined }\n\n if (initialQueue.length > 0) {\n const value = initialQueue.shift() as TEventData\n return { done: false, value }\n }\n\n const next = await wrapped.next()\n if (!next.done && eventIsFinal && eventIsFinal(next.value)) {\n done = true\n await wrapped.return?.()\n }\n return next\n },\n return: async (value) => {\n done = true\n initialQueue.length = 0\n if (wrapped.return) return wrapped.return(value)\n return { done: true, value: value as TEventData }\n },\n throw: async (err) => {\n done = true\n initialQueue.length = 0\n if (wrapped.throw) return wrapped.throw(err)\n throw err\n },\n }\n\n return { ...iterator, [Symbol.asyncIterator]: () => iterator }\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;AAeG;AACG,SAAU,wBAAwB,CAAa,EACnD,QAAQ,EAAE,OAAO,EACjB,cAAc,EACd,YAAY,GAKb,EAAA;IACC,IAAI,IAAI,GAAG,KAAK;AAChB,IAAA,MAAM,YAAY,GAChB,cAAc,KAAK,SAAS,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC;AAE5G,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|
1
|
+
/**
|
|
2
|
+
* Wraps an async iterator with options for:
|
|
3
|
+
* - returning an initial payload (e.g. current state)
|
|
4
|
+
* - eagerly ending iteration when a final event is received
|
|
5
|
+
*
|
|
6
|
+
* Providing an initial payload helps avoid race conditions when clients subscribe to events but miss recent state changes,
|
|
7
|
+
* by providing an initial payload to be immediately returned, before subsequent events stream in.
|
|
8
|
+
*
|
|
9
|
+
* Eagerly ending iteration when a final event ensures subscriptions do not continue unnecessarily.
|
|
10
|
+
*
|
|
11
|
+
* @param iterator The async iterator to wrap.
|
|
12
|
+
* @param initialPayload An optional initial payload to return on the first iteration. May be a single event or an array.
|
|
13
|
+
* @param eventIsFinal An optional function to determine if an event is final (and iteration should end).
|
|
14
|
+
* Note: only applied to events from the wrapped iterator, not to entries in `initialPayload`.
|
|
15
|
+
* @returns An async iterator for the event data.
|
|
16
|
+
*/
|
|
17
|
+
function wrapSubscriptionIterator({ iterator: wrapped, initialPayload, eventIsFinal, }) {
|
|
18
|
+
let done = false;
|
|
19
|
+
const initialQueue = initialPayload === undefined ? [] : Array.isArray(initialPayload) ? [...initialPayload] : [initialPayload];
|
|
20
|
+
const iterator = {
|
|
21
|
+
next: async () => {
|
|
22
|
+
if (done)
|
|
23
|
+
return { done: true, value: undefined };
|
|
24
|
+
if (initialQueue.length > 0) {
|
|
25
|
+
const value = initialQueue.shift();
|
|
26
|
+
return { done: false, value };
|
|
27
|
+
}
|
|
28
|
+
const next = await wrapped.next();
|
|
29
|
+
if (!next.done && eventIsFinal && eventIsFinal(next.value)) {
|
|
30
|
+
done = true;
|
|
31
|
+
await wrapped.return?.();
|
|
32
|
+
}
|
|
33
|
+
return next;
|
|
34
|
+
},
|
|
35
|
+
return: async (value) => {
|
|
36
|
+
done = true;
|
|
37
|
+
initialQueue.length = 0;
|
|
38
|
+
if (wrapped.return)
|
|
39
|
+
return wrapped.return(value);
|
|
40
|
+
return { done: true, value: value };
|
|
41
|
+
},
|
|
42
|
+
throw: async (err) => {
|
|
43
|
+
done = true;
|
|
44
|
+
initialQueue.length = 0;
|
|
45
|
+
if (wrapped.throw)
|
|
46
|
+
return wrapped.throw(err);
|
|
47
|
+
throw err;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
return { ...iterator, [Symbol.asyncIterator]: () => iterator };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { wrapSubscriptionIterator };
|
|
54
|
+
//# sourceMappingURL=subscription-iterator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-iterator.mjs","sources":["../../src/subscriptions/subscription-iterator.ts"],"sourcesContent":["/**\n * Wraps an async iterator with options for:\n * - returning an initial payload (e.g. current state)\n * - eagerly ending iteration when a final event is received\n *\n * Providing an initial payload helps avoid race conditions when clients subscribe to events but miss recent state changes,\n * by providing an initial payload to be immediately returned, before subsequent events stream in.\n *\n * Eagerly ending iteration when a final event ensures subscriptions do not continue unnecessarily.\n *\n * @param iterator The async iterator to wrap.\n * @param initialPayload An optional initial payload to return on the first iteration. May be a single event or an array.\n * @param eventIsFinal An optional function to determine if an event is final (and iteration should end).\n * Note: only applied to events from the wrapped iterator, not to entries in `initialPayload`.\n * @returns An async iterator for the event data.\n */\nexport function wrapSubscriptionIterator<TEventData>({\n iterator: wrapped,\n initialPayload,\n eventIsFinal,\n}: {\n iterator: AsyncIterableIterator<TEventData>\n initialPayload?: TEventData | TEventData[]\n eventIsFinal?: (event: TEventData) => boolean\n}): AsyncIterator<TEventData> & AsyncIterable<TEventData> {\n let done = false\n const initialQueue: TEventData[] =\n initialPayload === undefined ? [] : Array.isArray(initialPayload) ? [...initialPayload] : [initialPayload]\n\n const iterator: AsyncIterator<TEventData> = {\n next: async () => {\n if (done) return { done: true, value: undefined }\n\n if (initialQueue.length > 0) {\n const value = initialQueue.shift() as TEventData\n return { done: false, value }\n }\n\n const next = await wrapped.next()\n if (!next.done && eventIsFinal && eventIsFinal(next.value)) {\n done = true\n await wrapped.return?.()\n }\n return next\n },\n return: async (value) => {\n done = true\n initialQueue.length = 0\n if (wrapped.return) return wrapped.return(value)\n return { done: true, value: value as TEventData }\n },\n throw: async (err) => {\n done = true\n initialQueue.length = 0\n if (wrapped.throw) return wrapped.throw(err)\n throw err\n },\n }\n\n return { ...iterator, [Symbol.asyncIterator]: () => iterator }\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;AAeG;AACG,SAAU,wBAAwB,CAAa,EACnD,QAAQ,EAAE,OAAO,EACjB,cAAc,EACd,YAAY,GAKb,EAAA;IACC,IAAI,IAAI,GAAG,KAAK;AAChB,IAAA,MAAM,YAAY,GAChB,cAAc,KAAK,SAAS,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC;AAE5G,IAAA,MAAM,QAAQ,GAA8B;QAC1C,IAAI,EAAE,YAAW;AACf,YAAA,IAAI,IAAI;gBAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;AAEjD,YAAA,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;AAC3B,gBAAA,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,EAAgB;AAChD,gBAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;YAC/B;AAEA,YAAA,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACjC,YAAA,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,YAAY,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBAC1D,IAAI,GAAG,IAAI;AACX,gBAAA,MAAM,OAAO,CAAC,MAAM,IAAI;YAC1B;AACA,YAAA,OAAO,IAAI;QACb,CAAC;AACD,QAAA,MAAM,EAAE,OAAO,KAAK,KAAI;YACtB,IAAI,GAAG,IAAI;AACX,YAAA,YAAY,CAAC,MAAM,GAAG,CAAC;YACvB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