@interop/was-react 0.20.1 → 0.22.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.
- package/README.md +28 -2
- package/dist/auth/loginFlow.d.ts.map +1 -1
- package/dist/auth/loginFlow.js +5 -5
- package/dist/auth/loginFlow.js.map +1 -1
- package/dist/auth/verifyResponse.d.ts.map +1 -1
- package/dist/auth/verifyResponse.js +7 -4
- package/dist/auth/verifyResponse.js.map +1 -1
- package/dist/dev/provisionDevGrants.js +1 -1
- package/dist/dev/provisionDevGrants.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +48 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +52 -0
- package/dist/log.js.map +1 -0
- package/dist/session/authStore.d.ts.map +1 -1
- package/dist/session/authStore.js +12 -10
- package/dist/session/authStore.js.map +1 -1
- package/dist/session/localWipe.d.ts.map +1 -1
- package/dist/session/localWipe.js +5 -4
- package/dist/session/localWipe.js.map +1 -1
- package/dist/storage/adopt.d.ts.map +1 -1
- package/dist/storage/adopt.js +2 -1
- package/dist/storage/adopt.js.map +1 -1
- package/dist/storage/descriptorManager.d.ts.map +1 -1
- package/dist/storage/descriptorManager.js +5 -4
- package/dist/storage/descriptorManager.js.map +1 -1
- package/dist/{sync → storage}/docCipher.d.ts +3 -29
- package/dist/storage/docCipher.d.ts.map +1 -0
- package/dist/{sync → storage}/docCipher.js +0 -20
- package/dist/storage/docCipher.js.map +1 -0
- package/dist/storage/entityStore.d.ts.map +1 -1
- package/dist/storage/entityStore.js +2 -1
- package/dist/storage/entityStore.js.map +1 -1
- package/dist/storage/localStore.d.ts +1 -1
- package/dist/storage/localStore.d.ts.map +1 -1
- package/dist/storage/localStore.js +15 -2
- package/dist/storage/localStore.js.map +1 -1
- package/dist/storage/sharedCollectionReader.d.ts +1 -1
- package/dist/storage/sharedCollectionReader.d.ts.map +1 -1
- package/dist/storage/sharedCollectionReader.js +11 -11
- package/dist/storage/sharedCollectionReader.js.map +1 -1
- package/dist/storage/storageContext.d.ts +1 -2
- package/dist/storage/storageContext.d.ts.map +1 -1
- package/dist/storage/storageContext.js.map +1 -1
- package/dist/storage/storageManager.d.ts +1 -1
- package/dist/storage/storageManager.d.ts.map +1 -1
- package/dist/storage/syncController.d.ts +30 -19
- package/dist/storage/syncController.d.ts.map +1 -1
- package/dist/storage/syncController.js +86 -157
- package/dist/storage/syncController.js.map +1 -1
- package/dist/storage/syncStatusStore.d.ts +8 -7
- package/dist/storage/syncStatusStore.d.ts.map +1 -1
- package/dist/storage/syncStatusStore.js.map +1 -1
- package/dist/storage/wasRemoteStore.d.ts.map +1 -1
- package/dist/storage/wasRemoteStore.js +6 -2
- package/dist/storage/wasRemoteStore.js.map +1 -1
- package/dist/storage/wasSync.d.ts +1 -1
- package/dist/storage/wasSync.d.ts.map +1 -1
- package/dist/storage/wasSync.js +28 -15
- package/dist/storage/wasSync.js.map +1 -1
- package/dist/{sync → storage}/wasSyncPort.d.ts +14 -8
- package/dist/storage/wasSyncPort.d.ts.map +1 -0
- package/dist/storage/wasSyncPort.js.map +1 -0
- package/dist/storage/writerId.d.ts +7 -13
- package/dist/storage/writerId.d.ts.map +1 -1
- package/dist/storage/writerId.js +30 -46
- package/dist/storage/writerId.js.map +1 -1
- package/package.json +16 -11
- package/dist/sync/changesQuery.d.ts +0 -44
- package/dist/sync/changesQuery.d.ts.map +0 -1
- package/dist/sync/changesQuery.js +0 -54
- package/dist/sync/changesQuery.js.map +0 -1
- package/dist/sync/docCipher.d.ts.map +0 -1
- package/dist/sync/docCipher.js.map +0 -1
- package/dist/sync/feedMasterPort.d.ts +0 -38
- package/dist/sync/feedMasterPort.d.ts.map +0 -1
- package/dist/sync/feedMasterPort.js +0 -116
- package/dist/sync/feedMasterPort.js.map +0 -1
- package/dist/sync/index.d.ts +0 -23
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -27
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/lww.d.ts +0 -50
- package/dist/sync/lww.d.ts.map +0 -1
- package/dist/sync/lww.js +0 -69
- package/dist/sync/lww.js.map +0 -1
- package/dist/sync/lwwConflictHandler.d.ts +0 -83
- package/dist/sync/lwwConflictHandler.d.ts.map +0 -1
- package/dist/sync/lwwConflictHandler.js +0 -114
- package/dist/sync/lwwConflictHandler.js.map +0 -1
- package/dist/sync/pushWrites.d.ts +0 -76
- package/dist/sync/pushWrites.d.ts.map +0 -1
- package/dist/sync/pushWrites.js +0 -221
- package/dist/sync/pushWrites.js.map +0 -1
- package/dist/sync/syncedDocSchema.d.ts +0 -22
- package/dist/sync/syncedDocSchema.d.ts.map +0 -1
- package/dist/sync/syncedDocSchema.js +0 -29
- package/dist/sync/syncedDocSchema.js.map +0 -1
- package/dist/sync/types.d.ts +0 -319
- package/dist/sync/types.d.ts.map +0 -1
- package/dist/sync/types.js +0 -58
- package/dist/sync/types.js.map +0 -1
- package/dist/sync/wasReplication.d.ts +0 -47
- package/dist/sync/wasReplication.d.ts.map +0 -1
- package/dist/sync/wasReplication.js +0 -92
- package/dist/sync/wasReplication.js.map +0 -1
- package/dist/sync/wasSyncPort.d.ts.map +0 -1
- package/dist/sync/wasSyncPort.js.map +0 -1
- /package/dist/{sync → storage}/wasSyncPort.js +0 -0
|
@@ -37,8 +37,9 @@
|
|
|
37
37
|
*/
|
|
38
38
|
import { NotImplementedError } from '@interop/was-client';
|
|
39
39
|
import { createRefreshingEdvDocCipher } from '@interop/wallet-core/descriptors';
|
|
40
|
-
import {
|
|
40
|
+
import { isEncryptedEnvelope } from '@interop/was-client/sync';
|
|
41
41
|
import { remoteDescriptorSource } from './wasRemoteStore.js';
|
|
42
|
+
import { log } from '../log.js';
|
|
42
43
|
/**
|
|
43
44
|
* Default page size for the `changes`-feed walk. The server clamps its own
|
|
44
45
|
* maximum, and a page shorter than what was asked for is the feed's end-of-walk
|
|
@@ -148,9 +149,9 @@ export class SharedCollectionReader {
|
|
|
148
149
|
}
|
|
149
150
|
if (!this.#warnedSlowPath) {
|
|
150
151
|
this.#warnedSlowPath = true;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
log.warn('A shared collection is being read the slow way (one request per ' +
|
|
153
|
+
'resource): its backend does not support the "changes-query" ' +
|
|
154
|
+
'feature the paged read path needs.', { collectionId: this.collectionId });
|
|
154
155
|
}
|
|
155
156
|
return await this.#listViaResources(collection);
|
|
156
157
|
}
|
|
@@ -258,8 +259,8 @@ export class SharedCollectionReader {
|
|
|
258
259
|
return undefined;
|
|
259
260
|
}
|
|
260
261
|
if (!isEncryptedEnvelope(body)) {
|
|
261
|
-
|
|
262
|
-
|
|
262
|
+
log.warn('Skipping a resource of a shared collection: its body is not an EDV ' +
|
|
263
|
+
'envelope.', { resourceId: id, collectionId: this.collectionId });
|
|
263
264
|
return undefined;
|
|
264
265
|
}
|
|
265
266
|
try {
|
|
@@ -277,11 +278,10 @@ export class SharedCollectionReader {
|
|
|
277
278
|
* expected rather than corruption, so it is called out by name.
|
|
278
279
|
*/
|
|
279
280
|
#skipUndecryptable({ id, err }) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
`never re-encrypted). ${errorMessage(err)}`);
|
|
281
|
+
log.warn('Skipping a resource of a shared collection: this app is not a ' +
|
|
282
|
+
'recipient of its envelope (expected for legacy resources written ' +
|
|
283
|
+
'before the collection had an epoch roster -- those stay sealed to ' +
|
|
284
|
+
'the owner alone and are never re-encrypted).', { resourceId: id, collectionId: this.collectionId, err });
|
|
285
285
|
return undefined;
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedCollectionReader.js","sourceRoot":"","sources":["../../src/storage/sharedCollectionReader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,YAAY,uCAAuC;YACvE,uEAAuE;YACvE,yCAAyC,CAC5C,CAAA;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { StoreRegistry } from '../config.js';
|
|
2
|
-
import type { Json } from '
|
|
3
|
-
import type { LwwFields } from '../sync/lww.js';
|
|
2
|
+
import type { Json, LwwFields } from '@interop/was-sync';
|
|
4
3
|
import type { LocalStore } from './localStore.js';
|
|
5
4
|
import { type SyncStatusStore } from './syncStatusStore.js';
|
|
6
5
|
import type { WasRemoteStore } from './wasRemoteStore.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageContext.d.ts","sourceRoot":"","sources":["../../src/storage/storageContext.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"storageContext.d.ts","sourceRoot":"","sources":["../../src/storage/storageContext.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAKjD,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAOzD,qBAAa,cAAc;;IACzB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,eAAe,CAA0B;IAU9D;;;;;OAKG;gBACS,EACV,QAAQ,EACR,QAAQ,EACT,EAAE;QACD,QAAQ,EAAE,aAAa,CAAA;QACvB,QAAQ,EAAE,MAAM,CAAA;KACjB;IAK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,MAAM,GAAG,IAAI;CAqB/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageContext.js","sourceRoot":"","sources":["../../src/storage/storageContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"storageContext.js","sourceRoot":"","sources":["../../src/storage/storageContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAI/B,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,qBAAqB,EAEtB,MAAM,sBAAsB,CAAA;AAG7B;;GAEG;AACH,MAAM,qBAAqB,GAAG,EAAE,CAAA;AAEhC,MAAM,OAAO,cAAc;IACzB;;;OAGG;IACM,QAAQ,CAAe;IAChC;;OAEG;IACM,UAAU,GAAoB,qBAAqB,EAAE,CAAA;IAC9D,SAAS,CAAQ;IACjB,WAAW,GAAsB,IAAI,CAAA;IACrC,YAAY,GAA0B,IAAI,CAAA;IAC1C,WAAW,GAAG,CAAC,CAAA;IACf;;OAEG;IACM,gBAAgB,GAAG,IAAI,GAAG,EAAyC,CAAA;IAE5E;;;;;OAKG;IACH,YAAY,EACV,QAAQ,EACR,QAAQ,EAIT;QACC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;IAC3B,CAAC;IAED;;;;;OAKG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa;QACX,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,CAAA;QACzB,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAED;;;;;;;;O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"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* down) is inert and is replaced without complaint, which is what a React
|
|
19
19
|
* dev-mode double `useState` initializer or a test's sequence of stores needs.
|
|
20
20
|
*/
|
|
21
|
-
import type { LwwFields } from '
|
|
21
|
+
import type { LwwFields } from '@interop/was-sync';
|
|
22
22
|
import type { LocalStore } from './localStore.js';
|
|
23
23
|
import type { StorageContext } from './storageContext.js';
|
|
24
24
|
import type { WasRemoteStore } from './wasRemoteStore.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageManager.d.ts","sourceRoot":"","sources":["../../src/storage/storageManager.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"storageManager.d.ts","sourceRoot":"","sources":["../../src/storage/storageManager.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIzD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAQpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAItE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,cAAc,CAOtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,UAAU,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAElC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAE5E"}
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* SyncController: this library's session binding over the replication
|
|
6
|
+
* controller core in `@interop/was-sync/rxdb`.
|
|
7
|
+
*
|
|
8
|
+
* The core owns the lifecycle -- the serialized start/stop queue, one
|
|
9
|
+
* `replicateRxCollection` state machine per collection, the per-collection
|
|
10
|
+
* capability skip, the status and auth-error callbacks, the poll timer, and the
|
|
11
|
+
* failed-bring-up unwind. What this binding owns is everything app-shaped: the
|
|
12
|
+
* port built from the session's {@link WasRemoteStore} and {@link LocalStore},
|
|
13
|
+
* the browser reachability source, the poll interval from the app's
|
|
14
|
+
* {@link WasSyncConfig}, and the Zustand {@link SyncStatusStore} the statuses
|
|
15
|
+
* are written into (keyed by the registry's LOGICAL collection key, which is
|
|
16
|
+
* the first argument the core delivers).
|
|
17
|
+
*
|
|
18
|
+
* A controller is single-use per session, which is the core's own rule: `stop()`
|
|
19
|
+
* is terminal for a core instance, so the binding builds a fresh one inside
|
|
20
|
+
* `start()` and resets the status store on stop.
|
|
21
|
+
*/
|
|
1
22
|
import type { RxChangeEvent } from 'rxdb/plugins/core';
|
|
2
|
-
import {
|
|
23
|
+
import type { SyncedDoc } from '@interop/was-sync';
|
|
3
24
|
import { type WasCollectionConfig, type WasSyncConfig } from '../config.js';
|
|
4
25
|
import type { LocalStore } from './localStore.js';
|
|
5
26
|
import type { WasRemoteStore } from './wasRemoteStore.js';
|
|
6
27
|
import type { SyncStatusStore } from './syncStatusStore.js';
|
|
7
|
-
|
|
8
|
-
* Whether a replication error signals expired/revoked storage access. Every WAS
|
|
9
|
-
* request the replication makes funnels through the sync port, which maps a
|
|
10
|
-
* `401` / `403` to a typed {@link WasSyncAuthError} at the boundary. RxDB then
|
|
11
|
-
* wraps that thrown error inside an RxError (nested under `cause` / `errors` /
|
|
12
|
-
* `parameters.errors`), so this walks the error graph looking for a
|
|
13
|
-
* `WasSyncAuthError` rather than re-extracting raw status codes. RxDB's
|
|
14
|
-
* wrapping serializes the handler's thrown error to plain JSON (name, message,
|
|
15
|
-
* stack -- `errorToPlainJson`), so the walk matches the serialized `name`
|
|
16
|
-
* alongside a live instance; an instance only ever appears when a caller hands
|
|
17
|
-
* the port error over directly.
|
|
18
|
-
*
|
|
19
|
-
* @param err {unknown}
|
|
20
|
-
* @returns {boolean}
|
|
21
|
-
*/
|
|
22
|
-
export declare function isAuthError(err: unknown): boolean;
|
|
28
|
+
export { isAuthError } from '@interop/was-sync/rxdb';
|
|
23
29
|
/**
|
|
24
30
|
* A per-session controller around background replication.
|
|
25
31
|
*/
|
|
@@ -39,7 +45,12 @@ export declare class SyncController {
|
|
|
39
45
|
});
|
|
40
46
|
/**
|
|
41
47
|
* Starts background replication for every entity collection covered by the
|
|
42
|
-
* grant set. Idempotent (a no-op if already running)
|
|
48
|
+
* grant set. Idempotent (a no-op if already running, or if `stop()` has
|
|
49
|
+
* already run: `stop()` is terminal, so a logout that raced an in-flight
|
|
50
|
+
* session bootstrap never spins up replications against a closed database).
|
|
51
|
+
*
|
|
52
|
+
* A failed bring-up rethrows, with every collection's status left at `error`,
|
|
53
|
+
* so the caller's bootstrap can surface it.
|
|
43
54
|
*
|
|
44
55
|
* @param options {object}
|
|
45
56
|
* @param options.remoteStore {WasRemoteStore}
|
|
@@ -66,7 +77,7 @@ export declare class SyncController {
|
|
|
66
77
|
reSync(): void;
|
|
67
78
|
/**
|
|
68
79
|
* Stops replication and releases resources (the database is owned by the
|
|
69
|
-
* caller). Idempotent.
|
|
80
|
+
* caller). Idempotent, and terminal: a later `start()` is refused.
|
|
70
81
|
*
|
|
71
82
|
* @returns {Promise<void>}
|
|
72
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncController.d.ts","sourceRoot":"","sources":["../../src/storage/syncController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"syncController.d.ts","sourceRoot":"","sources":["../../src/storage/syncController.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AA0BpD;;GAEG;AACH,qBAAa,cAAc;;IAOzB;;;;;;OAMG;gBACS,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACL,EAAE;QACD,WAAW,EAAE,mBAAmB,EAAE,CAAA;QAClC,UAAU,EAAE,eAAe,CAAA;QAC3B,IAAI,CAAC,EAAE,aAAa,CAAA;KACrB;IAMD;;;;;;;;;;;;;;;;;;OAkBG;IACG,KAAK,CAAC,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,WAAW,EACZ,EAAE;QACD,WAAW,EAAE,cAAc,CAAA;QAC3B,UAAU,EAAE,UAAU,CAAA;QACtB,cAAc,CAAC,EAAE,CACf,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,KAC5B,IAAI,CAAA;QACT,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;KACzB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuEjB;;;;;OAKG;IACH,MAAM,IAAI,IAAI;IAId;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5B"}
|
|
@@ -1,45 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createSyncController } from '@interop/was-sync/rxdb';
|
|
2
2
|
import { DEFAULT_SYNC_POLL_MS } from '../config.js';
|
|
3
|
+
import { log } from '../log.js';
|
|
4
|
+
export { isAuthError } from '@interop/was-sync/rxdb';
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* wraps that thrown error inside an RxError (nested under `cause` / `errors` /
|
|
8
|
-
* `parameters.errors`), so this walks the error graph looking for a
|
|
9
|
-
* `WasSyncAuthError` rather than re-extracting raw status codes. RxDB's
|
|
10
|
-
* wrapping serializes the handler's thrown error to plain JSON (name, message,
|
|
11
|
-
* stack -- `errorToPlainJson`), so the walk matches the serialized `name`
|
|
12
|
-
* alongside a live instance; an instance only ever appears when a caller hands
|
|
13
|
-
* the port error over directly.
|
|
6
|
+
* The browser reachability source the core polls and subscribes through. An
|
|
7
|
+
* `isOnline` that cannot answer reports `true`, since a platform with no
|
|
8
|
+
* reachability signal must still poll.
|
|
14
9
|
*
|
|
15
|
-
* @
|
|
16
|
-
* @returns {boolean}
|
|
10
|
+
* @returns {object} the core's `onlineSource` port
|
|
17
11
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (current instanceof WasSyncAuthError ||
|
|
28
|
-
current.name === 'WasSyncAuthError') {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
const candidate = current;
|
|
32
|
-
if (candidate.cause) {
|
|
33
|
-
queue.push(candidate.cause);
|
|
34
|
-
}
|
|
35
|
-
if (Array.isArray(candidate.errors)) {
|
|
36
|
-
queue.push(...candidate.errors);
|
|
37
|
-
}
|
|
38
|
-
if (Array.isArray(candidate.parameters?.errors)) {
|
|
39
|
-
queue.push(...candidate.parameters.errors);
|
|
12
|
+
function browserOnlineSource() {
|
|
13
|
+
return {
|
|
14
|
+
isOnline: () => typeof navigator === 'undefined' || navigator.onLine !== false,
|
|
15
|
+
subscribe: onOnline => {
|
|
16
|
+
if (typeof window === 'undefined') {
|
|
17
|
+
return () => { };
|
|
18
|
+
}
|
|
19
|
+
window.addEventListener('online', onOnline);
|
|
20
|
+
return () => window.removeEventListener('online', onOnline);
|
|
40
21
|
}
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
22
|
+
};
|
|
43
23
|
}
|
|
44
24
|
/**
|
|
45
25
|
* A per-session controller around background replication.
|
|
@@ -48,10 +28,7 @@ export class SyncController {
|
|
|
48
28
|
#collections;
|
|
49
29
|
#sync;
|
|
50
30
|
#syncStatus;
|
|
51
|
-
#
|
|
52
|
-
#onlineHandler;
|
|
53
|
-
#pollTimer;
|
|
54
|
-
#started = false;
|
|
31
|
+
#core;
|
|
55
32
|
#stopped = false;
|
|
56
33
|
/**
|
|
57
34
|
* @param options {object}
|
|
@@ -67,7 +44,12 @@ export class SyncController {
|
|
|
67
44
|
}
|
|
68
45
|
/**
|
|
69
46
|
* Starts background replication for every entity collection covered by the
|
|
70
|
-
* grant set. Idempotent (a no-op if already running)
|
|
47
|
+
* grant set. Idempotent (a no-op if already running, or if `stop()` has
|
|
48
|
+
* already run: `stop()` is terminal, so a logout that raced an in-flight
|
|
49
|
+
* session bootstrap never spins up replications against a closed database).
|
|
50
|
+
*
|
|
51
|
+
* A failed bring-up rethrows, with every collection's status left at `error`,
|
|
52
|
+
* so the caller's bootstrap can surface it.
|
|
71
53
|
*
|
|
72
54
|
* @param options {object}
|
|
73
55
|
* @param options.remoteStore {WasRemoteStore}
|
|
@@ -80,123 +62,73 @@ export class SyncController {
|
|
|
80
62
|
* @returns {Promise<void>}
|
|
81
63
|
*/
|
|
82
64
|
async start({ remoteStore, localStore, onRemoteChange, onAuthError }) {
|
|
83
|
-
|
|
84
|
-
// that raced an in-flight session bootstrap) must never spin up
|
|
85
|
-
// replications against the now-closed database.
|
|
86
|
-
if (this.#started || this.#stopped) {
|
|
65
|
+
if (this.#core || this.#stopped) {
|
|
87
66
|
return;
|
|
88
67
|
}
|
|
89
|
-
this.#started = true;
|
|
90
68
|
const setStatus = this.#syncStatus.getState().setStatus;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
setStatus(key, 'idle');
|
|
107
|
-
// Wrap the verbatim port so the 412 conflict re-read resolves `version`
|
|
108
|
-
// from the changes-feed body (CORS hides the `GET` ETag cross-origin).
|
|
109
|
-
const wasPort = withFeedMasterRead(createWasSyncPort({
|
|
110
|
-
was: remoteStore.was,
|
|
111
|
-
spaceId: remoteStore.spaceId,
|
|
112
|
-
collectionId: id,
|
|
113
|
-
capability
|
|
114
|
-
}));
|
|
115
|
-
const state = createWasReplication({
|
|
116
|
-
rxCollection: localStore.rxCollection(key),
|
|
117
|
-
wasPort,
|
|
118
|
-
replicationIdentifier: `was-sync:${remoteStore.serverUrl}:${remoteStore.spaceId}:${id}`,
|
|
119
|
-
...(batchSize !== undefined && { batchSize }),
|
|
120
|
-
...(retryMs !== undefined && { retryTime: retryMs })
|
|
121
|
-
});
|
|
122
|
-
const subscriptions = [
|
|
123
|
-
state.active$.subscribe(active => {
|
|
124
|
-
setStatus(key, active ? 'syncing' : 'synced');
|
|
125
|
-
}),
|
|
126
|
-
state.error$.subscribe(err => {
|
|
127
|
-
console.error(`Sync error for "${id}":`, err);
|
|
128
|
-
setStatus(key, 'error');
|
|
129
|
-
if (onAuthError && isAuthError(err)) {
|
|
130
|
-
onAuthError();
|
|
131
|
-
}
|
|
132
|
-
})
|
|
133
|
-
];
|
|
134
|
-
if (onRemoteChange) {
|
|
135
|
-
subscriptions.push(localStore
|
|
136
|
-
.rxCollection(key)
|
|
137
|
-
.$.subscribe(event => onRemoteChange(key, event)));
|
|
138
|
-
}
|
|
139
|
-
this.#replications.push({ state, subscriptions });
|
|
69
|
+
// A collection the grant set does not cover would otherwise sync with no
|
|
70
|
+
// capability and draw a fail-closed 403, tripping the session-wide
|
|
71
|
+
// "storage access expired" banner. Flag it and keep it out of the port
|
|
72
|
+
// instead, so an uncovered collection never masquerades as expired access.
|
|
73
|
+
// The core makes the same call, but only for a port whose OTHER entries
|
|
74
|
+
// carry a capability: it cannot tell an all-uncovered delegated port from
|
|
75
|
+
// a wallet's root-capability port, and every session here is delegated.
|
|
76
|
+
const covered = [];
|
|
77
|
+
for (const { key, id } of this.#collections) {
|
|
78
|
+
const capability = remoteStore.collectionCapability(id);
|
|
79
|
+
if (!capability) {
|
|
80
|
+
log.warn('Skipping sync for a collection: no delegated capability ' +
|
|
81
|
+
'covers it.', { collectionId: id });
|
|
82
|
+
setStatus(key, 'error');
|
|
83
|
+
continue;
|
|
140
84
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
85
|
+
covered.push({ key, id, capability });
|
|
86
|
+
}
|
|
87
|
+
this.#core = createSyncController({
|
|
88
|
+
port: {
|
|
89
|
+
wasClient: remoteStore.was,
|
|
90
|
+
spaceId: remoteStore.spaceId,
|
|
91
|
+
serverUrl: remoteStore.serverUrl,
|
|
92
|
+
collections: covered,
|
|
93
|
+
rxCollection: key => localStore.rxCollection(key),
|
|
94
|
+
// The 412 conflict re-read resolves `version` from the changes-feed
|
|
95
|
+
// body: CORS hides the `GET` ETag cross-origin, which is this
|
|
96
|
+
// library's deployment shape.
|
|
97
|
+
feedPrimaryRead: true,
|
|
98
|
+
// A `401` / `403` / the server's masked `404` must arrive typed, or
|
|
99
|
+
// `onAuthError` could never fire.
|
|
100
|
+
mapAuthErrors: true,
|
|
101
|
+
...(this.#sync.batchSize !== undefined && {
|
|
102
|
+
batchSize: this.#sync.batchSize
|
|
103
|
+
}),
|
|
104
|
+
...(this.#sync.retryMs !== undefined && {
|
|
105
|
+
retryTime: this.#sync.retryMs
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
// The core delivers the logical key first and the WAS id second; the
|
|
109
|
+
// status store is keyed on the logical key, since two registry entries
|
|
110
|
+
// may share one WAS id.
|
|
111
|
+
onStatus: (key, _collectionId, status) => setStatus(key, status),
|
|
112
|
+
...(onAuthError && { onAuthError }),
|
|
113
|
+
...(onRemoteChange && { onRemoteChange }),
|
|
114
|
+
onlineSource: browserOnlineSource(),
|
|
115
|
+
pollMs: this.#sync.pollMs ?? DEFAULT_SYNC_POLL_MS,
|
|
116
|
+
log: {
|
|
117
|
+
warn: (message, meta) => log.warn(message, meta),
|
|
118
|
+
error: (message, meta) => log.error(message, meta)
|
|
149
119
|
}
|
|
120
|
+
});
|
|
121
|
+
try {
|
|
122
|
+
await this.#core.start();
|
|
150
123
|
}
|
|
151
124
|
catch (err) {
|
|
152
|
-
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
// wallet-connected session that failed to start replicating. Instead the
|
|
157
|
-
// per-collection statuses are left at `error` (visible in the rollup)
|
|
158
|
-
// and the error RETHROWS so the caller's bootstrap promise rejects and
|
|
159
|
-
// the session can surface it.
|
|
160
|
-
await this.#teardownReplications();
|
|
161
|
-
this.#started = false;
|
|
162
|
-
for (const { key } of this.#collections) {
|
|
163
|
-
setStatus(key, 'error');
|
|
164
|
-
}
|
|
125
|
+
// The core already unwound and flagged every collection; drop the
|
|
126
|
+
// instance so this session's controller is not left holding a core it
|
|
127
|
+
// can neither start nor usefully stop, and rethrow.
|
|
128
|
+
this.#core = undefined;
|
|
165
129
|
throw err;
|
|
166
130
|
}
|
|
167
131
|
}
|
|
168
|
-
/**
|
|
169
|
-
* The shared release path behind the failed-bring-up unwind and {@link stop}:
|
|
170
|
-
* drops the `online` listener, clears the poll timer, unsubscribes every
|
|
171
|
-
* per-collection subscription, and cancels every replication. What each caller
|
|
172
|
-
* does AFTER this differs (the unwind leaves the per-collection statuses at
|
|
173
|
-
* `error` and rethrows; `stop()` resets the status store behind its terminal
|
|
174
|
-
* latch), so the divergence stays at the call sites.
|
|
175
|
-
*
|
|
176
|
-
* @returns {Promise<void>}
|
|
177
|
-
*/
|
|
178
|
-
async #teardownReplications() {
|
|
179
|
-
if (this.#onlineHandler) {
|
|
180
|
-
window.removeEventListener('online', this.#onlineHandler);
|
|
181
|
-
this.#onlineHandler = undefined;
|
|
182
|
-
}
|
|
183
|
-
if (this.#pollTimer) {
|
|
184
|
-
clearInterval(this.#pollTimer);
|
|
185
|
-
this.#pollTimer = undefined;
|
|
186
|
-
}
|
|
187
|
-
for (const { state, subscriptions } of this.#replications) {
|
|
188
|
-
for (const subscription of subscriptions) {
|
|
189
|
-
subscription.unsubscribe();
|
|
190
|
-
}
|
|
191
|
-
try {
|
|
192
|
-
await state.cancel();
|
|
193
|
-
}
|
|
194
|
-
catch (err) {
|
|
195
|
-
console.error('Error cancelling replication:', err);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
this.#replications = [];
|
|
199
|
-
}
|
|
200
132
|
/**
|
|
201
133
|
* Triggers an immediate replication cycle on every running collection, rather
|
|
202
134
|
* than waiting for RxDB's next scheduled tick. Fire-and-forget.
|
|
@@ -204,23 +136,20 @@ export class SyncController {
|
|
|
204
136
|
* @returns {void}
|
|
205
137
|
*/
|
|
206
138
|
reSync() {
|
|
207
|
-
|
|
208
|
-
state.reSync();
|
|
209
|
-
}
|
|
139
|
+
this.#core?.reSync();
|
|
210
140
|
}
|
|
211
141
|
/**
|
|
212
142
|
* Stops replication and releases resources (the database is owned by the
|
|
213
|
-
* caller). Idempotent.
|
|
143
|
+
* caller). Idempotent, and terminal: a later `start()` is refused.
|
|
214
144
|
*
|
|
215
145
|
* @returns {Promise<void>}
|
|
216
146
|
*/
|
|
217
147
|
async stop() {
|
|
218
|
-
// Latch first so a concurrent `start()` (a logout racing the session
|
|
219
|
-
// bootstrap) sees the controller as terminally stopped and bails.
|
|
220
148
|
this.#stopped = true;
|
|
221
|
-
|
|
149
|
+
const core = this.#core;
|
|
150
|
+
this.#core = undefined;
|
|
151
|
+
await core?.stop();
|
|
222
152
|
this.#syncStatus.getState().reset();
|
|
223
|
-
this.#started = false;
|
|
224
153
|
}
|
|
225
154
|
}
|
|
226
155
|
//# sourceMappingURL=syncController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncController.js","sourceRoot":"","sources":["../../src/storage/syncController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"syncController.js","sourceRoot":"","sources":["../../src/storage/syncController.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAI7D,OAAO,EACL,oBAAoB,EAGrB,MAAM,cAAc,CAAA;AAIrB,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;;;;;GAMG;AACH,SAAS,mBAAmB;IAI1B,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE,CACb,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,MAAM,KAAK,KAAK;QAChE,SAAS,EAAE,QAAQ,CAAC,EAAE;YACpB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;YACjB,CAAC;YACD,MAA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EAAE;gBACH,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;gBAChD,KAAK,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;aACnD;SACF,CAAC,CAAA;QACF,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAC1B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,kEAAkE;YAClE,sEAAsE;YACtE,oDAAoD;YACpD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;YACtB,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAA;IACtB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;QACtB,MAAM,IAAI,EAAE,IAAI,EAAE,CAAA;QAClB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAA;IACrC,CAAC;CACF"}
|
|
@@ -10,14 +10,16 @@
|
|
|
10
10
|
* provider. In-memory only, like the session -- reset on logout.
|
|
11
11
|
*/
|
|
12
12
|
import { type StoreApi } from 'zustand/vanilla';
|
|
13
|
+
import type { SyncStatus } from '@interop/was-client/sync';
|
|
13
14
|
/**
|
|
14
|
-
* A single collection's replication status
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* A single collection's replication status, re-exported from the client's
|
|
16
|
+
* closed vocabulary (`idle` -- configured but no cycle has run yet; `syncing`
|
|
17
|
+
* -- a pull/push cycle is in flight; `synced` -- last cycle completed without
|
|
18
|
+
* error; `error` -- last cycle failed and RxDB is backing off). The client owns
|
|
19
|
+
* the type so the replication driver and the wallets' own sync engine report
|
|
20
|
+
* the same four strings.
|
|
19
21
|
*/
|
|
20
|
-
export type SyncStatus
|
|
22
|
+
export type { SyncStatus };
|
|
21
23
|
interface SyncStatusState {
|
|
22
24
|
/**
|
|
23
25
|
* Keyed by the registry's LOGICAL collection key (`WasCollectionConfig.key`,
|
|
@@ -61,5 +63,4 @@ export declare function deriveSyncRollup(statuses: SyncStatus[]): {
|
|
|
61
63
|
label: string;
|
|
62
64
|
title: string;
|
|
63
65
|
};
|
|
64
|
-
export {};
|
|
65
66
|
//# sourceMappingURL=syncStatusStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncStatusStore.d.ts","sourceRoot":"","sources":["../../src/storage/syncStatusStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"syncStatusStore.d.ts","sourceRoot":"","sources":["../../src/storage/syncStatusStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D;;;;;;;GAOG;AACH,YAAY,EAAE,UAAU,EAAE,CAAA;AAE1B,UAAU,eAAe;IACvB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,SAAS,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IAC9D,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAA;AAEvD;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CASvD;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAA;AAEnE;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG;IACxD,KAAK,EAAE,UAAU,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CA2BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncStatusStore.js","sourceRoot":"","sources":["../../src/storage/syncStatusStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAiB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"syncStatusStore.js","sourceRoot":"","sources":["../../src/storage/syncStatusStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAiB,MAAM,iBAAiB,CAAA;AA4B5D;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,WAAW,EAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5C,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,CACnC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACZ,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE;SACzD,CAAC,CAAC;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;KACnC,CAAC,CAAC,CAAA;AACL,CAAC;AASD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAg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