@fluidframework/container-loader 2.0.0-dev.5.2.0.169897 → 2.0.0-dev.6.4.0.191258
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/CHANGELOG.md +162 -0
- package/README.md +10 -6
- package/dist/audience.d.ts +1 -0
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js +5 -3
- package/dist/audience.js.map +1 -1
- package/dist/catchUpMonitor.d.ts +1 -1
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/catchUpMonitor.js +2 -2
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts +6 -6
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +97 -93
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +19 -15
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +59 -59
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +48 -38
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +447 -325
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +22 -70
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +24 -221
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +47 -16
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +21 -10
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +3 -3
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts +30 -0
- package/dist/debugLogger.d.ts.map +1 -0
- package/dist/debugLogger.js +95 -0
- package/dist/debugLogger.js.map +1 -0
- package/dist/deltaManager.d.ts +21 -9
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +114 -66
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts +1 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +10 -10
- package/dist/deltaQueue.js.map +1 -1
- package/dist/disposal.d.ts +13 -0
- package/dist/disposal.d.ts.map +1 -0
- package/dist/disposal.js +25 -0
- package/dist/disposal.js.map +1 -0
- package/dist/error.d.ts +23 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +32 -0
- package/dist/error.js.map +1 -0
- package/dist/loader.d.ts +23 -5
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +82 -51
- package/dist/loader.js.map +1 -1
- package/dist/noopHeuristic.d.ts +23 -0
- package/dist/noopHeuristic.d.ts.map +1 -0
- package/dist/noopHeuristic.js +90 -0
- package/dist/noopHeuristic.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol.d.ts +9 -12
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +26 -7
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts +1 -14
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js +1 -29
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +1 -1
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +4 -4
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/utils.d.ts +8 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +30 -11
- package/dist/utils.js.map +1 -1
- package/lib/audience.d.ts +1 -0
- package/lib/audience.d.ts.map +1 -1
- package/lib/audience.js +4 -2
- package/lib/audience.js.map +1 -1
- package/lib/catchUpMonitor.d.ts +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/catchUpMonitor.js +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts +6 -6
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +74 -67
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +19 -15
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +36 -36
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +48 -38
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +414 -292
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +22 -70
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +24 -221
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +43 -12
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +21 -10
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js +3 -3
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts +30 -0
- package/lib/debugLogger.d.ts.map +1 -0
- package/lib/debugLogger.js +91 -0
- package/lib/debugLogger.js.map +1 -0
- package/lib/deltaManager.d.ts +21 -9
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +88 -37
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +3 -3
- package/lib/deltaQueue.js.map +1 -1
- package/lib/disposal.d.ts +13 -0
- package/lib/disposal.d.ts.map +1 -0
- package/lib/disposal.js +21 -0
- package/lib/disposal.js.map +1 -0
- package/lib/error.d.ts +23 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +28 -0
- package/lib/error.js.map +1 -0
- package/lib/loader.d.ts +23 -5
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +82 -51
- package/lib/loader.js.map +1 -1
- package/lib/noopHeuristic.d.ts +23 -0
- package/lib/noopHeuristic.d.ts.map +1 -0
- package/lib/{collabWindowTracker.js → noopHeuristic.js} +31 -42
- package/lib/noopHeuristic.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol.d.ts +9 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +24 -6
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts +1 -14
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js +0 -26
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +1 -1
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +2 -2
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/utils.d.ts +8 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +25 -7
- package/lib/utils.js.map +1 -1
- package/package.json +26 -28
- package/src/audience.ts +7 -1
- package/src/catchUpMonitor.ts +2 -2
- package/src/connectionManager.ts +76 -52
- package/src/connectionStateHandler.ts +46 -48
- package/src/container.ts +561 -326
- package/src/containerContext.ts +31 -349
- package/src/containerStorageAdapter.ts +49 -6
- package/src/contracts.ts +27 -13
- package/src/debugLogger.ts +113 -0
- package/src/deltaManager.ts +93 -36
- package/src/deltaQueue.ts +2 -1
- package/src/disposal.ts +25 -0
- package/src/error.ts +44 -0
- package/src/loader.ts +84 -36
- package/src/{collabWindowTracker.ts → noopHeuristic.ts} +38 -47
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +26 -16
- package/src/protocolTreeDocumentStorageService.ts +1 -1
- package/src/quorum.ts +1 -40
- package/src/retriableDocumentStorageService.ts +3 -4
- package/src/utils.ts +33 -8
- package/dist/collabWindowTracker.d.ts +0 -19
- package/dist/collabWindowTracker.d.ts.map +0 -1
- package/dist/collabWindowTracker.js +0 -101
- package/dist/collabWindowTracker.js.map +0 -1
- package/dist/deltaManagerProxy.d.ts +0 -42
- package/dist/deltaManagerProxy.d.ts.map +0 -1
- package/dist/deltaManagerProxy.js +0 -79
- package/dist/deltaManagerProxy.js.map +0 -1
- package/lib/collabWindowTracker.d.ts +0 -19
- package/lib/collabWindowTracker.d.ts.map +0 -1
- package/lib/collabWindowTracker.js.map +0 -1
- package/lib/deltaManagerProxy.d.ts +0 -42
- package/lib/deltaManagerProxy.d.ts.map +0 -1
- package/lib/deltaManagerProxy.js +0 -74
- package/lib/deltaManagerProxy.js.map +0 -1
- package/src/deltaManagerProxy.ts +0 -109
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
|
-
import { IAudience, IContainerContext, IDeltaManager, ILoader, ICriticalContainerError, AttachState, ILoaderOptions, IFluidCodeDetails,
|
|
7
|
-
import {
|
|
6
|
+
import { IAudience, IContainerContext, IDeltaManager, ILoader, ICriticalContainerError, AttachState, ILoaderOptions, IFluidCodeDetails, IBatchMessage } from "@fluidframework/container-definitions";
|
|
7
|
+
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
8
8
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISnapshotTree, IVersion, MessageType, ISummaryContent } from "@fluidframework/protocol-definitions";
|
|
10
|
+
/**
|
|
11
|
+
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
12
|
+
*/
|
|
11
13
|
export declare class ContainerContext implements IContainerContext {
|
|
12
|
-
|
|
14
|
+
readonly options: ILoaderOptions;
|
|
13
15
|
readonly scope: FluidObject;
|
|
14
|
-
|
|
15
|
-
private readonly
|
|
16
|
-
private readonly _baseSnapshot;
|
|
16
|
+
readonly baseSnapshot: ISnapshotTree | undefined;
|
|
17
|
+
private readonly _version;
|
|
17
18
|
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
19
|
+
readonly storage: IDocumentStorageService;
|
|
20
|
+
readonly quorum: IQuorumClients;
|
|
21
|
+
readonly audience: IAudience;
|
|
18
22
|
readonly loader: ILoader;
|
|
19
23
|
readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number;
|
|
20
24
|
readonly submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number;
|
|
@@ -23,84 +27,32 @@ export declare class ContainerContext implements IContainerContext {
|
|
|
23
27
|
readonly submitSignalFn: (contents: any) => void;
|
|
24
28
|
readonly disposeFn: (error?: ICriticalContainerError) => void;
|
|
25
29
|
readonly closeFn: (error?: ICriticalContainerError) => void;
|
|
26
|
-
readonly version: string;
|
|
27
30
|
readonly updateDirtyContainerState: (dirty: boolean) => void;
|
|
31
|
+
readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;
|
|
32
|
+
private readonly _getContainerDiagnosticId;
|
|
33
|
+
private readonly _getClientId;
|
|
34
|
+
private readonly _getAttachState;
|
|
35
|
+
private readonly _getConnected;
|
|
36
|
+
readonly getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined;
|
|
37
|
+
readonly clientDetails: IClientDetails;
|
|
28
38
|
readonly existing: boolean;
|
|
29
|
-
readonly pendingLocalState?: unknown;
|
|
30
|
-
static createOrLoad(container: Container, scope: FluidObject, codeLoader: ICodeDetailsLoader, codeDetails: IFluidCodeDetails, baseSnapshot: ISnapshotTree | undefined, deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, quorum: IQuorum, loader: ILoader, submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number, submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number, submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number, submitSignalFn: (contents: any) => void, disposeFn: (error?: ICriticalContainerError) => void, closeFn: (error?: ICriticalContainerError) => void, version: string, updateDirtyContainerState: (dirty: boolean) => void, existing: boolean, pendingLocalState?: unknown): Promise<ContainerContext>;
|
|
31
39
|
readonly taggedLogger: ITelemetryLoggerExt;
|
|
40
|
+
readonly pendingLocalState?: unknown;
|
|
32
41
|
readonly supportedFeatures: ReadonlyMap<string, unknown>;
|
|
33
42
|
get clientId(): string | undefined;
|
|
34
43
|
/**
|
|
35
44
|
* DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.
|
|
36
45
|
*/
|
|
37
46
|
get id(): string;
|
|
38
|
-
get clientDetails(): IClientDetails;
|
|
39
|
-
private _connected;
|
|
40
47
|
/**
|
|
41
48
|
* When true, ops are free to flow
|
|
42
49
|
* When false, ops should be kept as pending or rejected
|
|
43
50
|
*/
|
|
44
51
|
get connected(): boolean;
|
|
45
|
-
|
|
46
|
-
get serviceConfiguration(): IClientConfiguration | undefined;
|
|
47
|
-
get audience(): IAudience;
|
|
48
|
-
get options(): ILoaderOptions;
|
|
49
|
-
get baseSnapshot(): ISnapshotTree | undefined;
|
|
50
|
-
get storage(): IDocumentStorageService;
|
|
51
|
-
private _runtime;
|
|
52
|
-
private get runtime();
|
|
53
|
-
private _disposed;
|
|
54
|
-
get disposed(): boolean;
|
|
55
|
-
get codeDetails(): IFluidCodeDetails;
|
|
56
|
-
private readonly _quorum;
|
|
57
|
-
get quorum(): IQuorumClients;
|
|
58
|
-
private readonly _fluidModuleP;
|
|
59
|
-
/**
|
|
60
|
-
* {@inheritDoc @fluidframework/container-definitions#IContainerContext.getEntryPoint}
|
|
61
|
-
*/
|
|
62
|
-
getEntryPoint?(): Promise<FluidObject | undefined>;
|
|
63
|
-
/**
|
|
64
|
-
* Emits events about the container context's lifecycle.
|
|
65
|
-
* Use it to coordinate things inside the ContainerContext class.
|
|
66
|
-
*/
|
|
67
|
-
private readonly lifecycleEvents;
|
|
68
|
-
constructor(container: Container, scope: FluidObject, codeLoader: ICodeDetailsLoader, _codeDetails: IFluidCodeDetails, _baseSnapshot: ISnapshotTree | undefined, deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, quorum: IQuorum, loader: ILoader, submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number, submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number,
|
|
52
|
+
constructor(options: ILoaderOptions, scope: FluidObject, baseSnapshot: ISnapshotTree | undefined, _version: IVersion | undefined, deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, storage: IDocumentStorageService, quorum: IQuorumClients, audience: IAudience, loader: ILoader, submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number, submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number,
|
|
69
53
|
/** @returns clientSequenceNumber of last message in a batch */
|
|
70
|
-
submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number, submitSignalFn: (contents: any) => void, disposeFn: (error?: ICriticalContainerError) => void, closeFn: (error?: ICriticalContainerError) => void,
|
|
71
|
-
/**
|
|
72
|
-
* @deprecated Temporary migratory API, to be removed when customers no longer need it.
|
|
73
|
-
* When removed, `ContainerContext` should only take an {@link @fluidframework/container-definitions#IQuorumClients}
|
|
74
|
-
* rather than an {@link @fluidframework/protocol-definitions#IQuorum}.
|
|
75
|
-
* See {@link @fluidframework/container-definitions#IContainerContext} for more details.
|
|
76
|
-
*/
|
|
77
|
-
getSpecifiedCodeDetails(): IFluidCodeDetails | undefined;
|
|
78
|
-
dispose(error?: Error): void;
|
|
54
|
+
submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number, submitSignalFn: (contents: any) => void, disposeFn: (error?: ICriticalContainerError) => void, closeFn: (error?: ICriticalContainerError) => void, updateDirtyContainerState: (dirty: boolean) => void, getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>, _getContainerDiagnosticId: () => string | undefined, _getClientId: () => string | undefined, _getAttachState: () => AttachState, _getConnected: () => boolean, getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined, clientDetails: IClientDetails, existing: boolean, taggedLogger: ITelemetryLoggerExt, pendingLocalState?: unknown);
|
|
79
55
|
getLoadedFromVersion(): IVersion | undefined;
|
|
80
56
|
get attachState(): AttachState;
|
|
81
|
-
/**
|
|
82
|
-
* Create a summary. Used when attaching or serializing a detached container.
|
|
83
|
-
*
|
|
84
|
-
* @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
|
|
85
|
-
* using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
|
|
86
|
-
* new storage IDs so requests can be redirected.
|
|
87
|
-
*/
|
|
88
|
-
createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;
|
|
89
|
-
setConnectionState(connected: boolean, clientId?: string): void;
|
|
90
|
-
process(message: ISequencedDocumentMessage, local: boolean): void;
|
|
91
|
-
processSignal(message: ISignalMessage, local: boolean): void;
|
|
92
|
-
request(path: IRequest): Promise<IResponse>;
|
|
93
|
-
getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
|
|
94
|
-
getPendingLocalState(): unknown;
|
|
95
|
-
/**
|
|
96
|
-
* Determines if the current code details of the context
|
|
97
|
-
* satisfy the incoming constraint code details
|
|
98
|
-
*/
|
|
99
|
-
satisfies(constraintCodeDetails: IFluidCodeDetails): Promise<boolean>;
|
|
100
|
-
notifyOpReplay(message: ISequencedDocumentMessage): Promise<void>;
|
|
101
|
-
private getRuntimeFactory;
|
|
102
|
-
private instantiateRuntime;
|
|
103
|
-
private attachListener;
|
|
104
|
-
private loadCodeModule;
|
|
105
57
|
}
|
|
106
58
|
//# sourceMappingURL=containerContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerContext.d.ts","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"containerContext.d.ts","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,uBAAuB,EACvB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,QAAQ,EACR,WAAW,EACX,eAAe,EACf,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;aA8BxC,OAAO,EAAE,cAAc;aACvB,KAAK,EAAE,WAAW;aAClB,YAAY,EAAE,aAAa,GAAG,SAAS;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ;aACT,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC;aACxE,OAAO,EAAE,uBAAuB;aAChC,MAAM,EAAE,cAAc;aACtB,QAAQ,EAAE,SAAS;aACnB,MAAM,EAAE,OAAO;aACf,QAAQ,EAAE,CACzB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,GAAG,KACR,MAAM;aACK,eAAe,EAAE,CAChC,SAAS,EAAE,eAAe,EAC1B,uBAAuB,CAAC,EAAE,MAAM,KAC5B,MAAM;IACX,+DAA+D;aAC/C,aAAa,EAAE,CAC9B,KAAK,EAAE,aAAa,EAAE,EACtB,uBAAuB,CAAC,EAAE,MAAM,KA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AO,EAAE,GAAG,KACR,MAAM,EACK,eAAe,EAAE,CAChC,SAAS,EAAE,eAAe,EAC1B,uBAAuB,CAAC,EAAE,MAAM,KAC5B,MAAM;IACX,+DAA+D;IAC/C,aAAa,EAAE,CAC9B,KAAK,EAAE,aAAa,EAAE,EACtB,uBAAuB,CAAC,EAAE,MAAM,KAC5B,MAAM,EACK,cAAc,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,EACvC,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,uBAAuB,KAAK,IAAI,EACpD,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,uBAAuB,KAAK,IAAI,EAClD,yBAAyB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EACnD,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,EACnE,yBAAyB,EAAE,MAAM,MAAM,GAAG,SAAS,EACnD,YAAY,EAAE,MAAM,MAAM,GAAG,SAAS,EACtC,eAAe,EAAE,MAAM,WAAW,EAClC,aAAa,EAAE,MAAM,OAAO,EAC7B,uBAAuB,EAAE,MAAM,iBAAiB,GAAG,SAAS,EAC5D,aAAa,EAAE,cAAc,EAC7B,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,mBAAmB,EACjC,iBAAiB,CAAC,SAAS;IAGrC,oBAAoB,IAAI,QAAQ,GAAG,SAAS;IAInD,IAAW,WAAW,IAAI,WAAW,CAEpC;CACD"}
|
package/dist/containerContext.js
CHANGED
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ContainerContext = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const container_utils_1 = require("@fluidframework/container-utils");
|
|
12
|
-
const PackageNotFactoryError = "Code package does not implement IRuntimeFactory";
|
|
8
|
+
/**
|
|
9
|
+
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
10
|
+
*/
|
|
13
11
|
class ContainerContext {
|
|
14
|
-
constructor(
|
|
12
|
+
constructor(options, scope, baseSnapshot, _version, deltaManager, storage, quorum, audience, loader, submitFn, submitSummaryFn,
|
|
15
13
|
/** @returns clientSequenceNumber of last message in a batch */
|
|
16
|
-
submitBatchFn, submitSignalFn, disposeFn, closeFn,
|
|
17
|
-
this.
|
|
14
|
+
submitBatchFn, submitSignalFn, disposeFn, closeFn, updateDirtyContainerState, getAbsoluteUrl, _getContainerDiagnosticId, _getClientId, _getAttachState, _getConnected, getSpecifiedCodeDetails, clientDetails, existing, taggedLogger, pendingLocalState) {
|
|
15
|
+
this.options = options;
|
|
18
16
|
this.scope = scope;
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this._baseSnapshot = _baseSnapshot;
|
|
17
|
+
this.baseSnapshot = baseSnapshot;
|
|
18
|
+
this._version = _version;
|
|
22
19
|
this.deltaManager = deltaManager;
|
|
20
|
+
this.storage = storage;
|
|
21
|
+
this.quorum = quorum;
|
|
22
|
+
this.audience = audience;
|
|
23
23
|
this.loader = loader;
|
|
24
24
|
this.submitFn = submitFn;
|
|
25
25
|
this.submitSummaryFn = submitSummaryFn;
|
|
@@ -27,20 +27,17 @@ class ContainerContext {
|
|
|
27
27
|
this.submitSignalFn = submitSignalFn;
|
|
28
28
|
this.disposeFn = disposeFn;
|
|
29
29
|
this.closeFn = closeFn;
|
|
30
|
-
this.version = version;
|
|
31
30
|
this.updateDirtyContainerState = updateDirtyContainerState;
|
|
31
|
+
this.getAbsoluteUrl = getAbsoluteUrl;
|
|
32
|
+
this._getContainerDiagnosticId = _getContainerDiagnosticId;
|
|
33
|
+
this._getClientId = _getClientId;
|
|
34
|
+
this._getAttachState = _getAttachState;
|
|
35
|
+
this._getConnected = _getConnected;
|
|
36
|
+
this.getSpecifiedCodeDetails = getSpecifiedCodeDetails;
|
|
37
|
+
this.clientDetails = clientDetails;
|
|
32
38
|
this.existing = existing;
|
|
39
|
+
this.taggedLogger = taggedLogger;
|
|
33
40
|
this.pendingLocalState = pendingLocalState;
|
|
34
|
-
this._disposed = false;
|
|
35
|
-
/**
|
|
36
|
-
* Emits events about the container context's lifecycle.
|
|
37
|
-
* Use it to coordinate things inside the ContainerContext class.
|
|
38
|
-
*/
|
|
39
|
-
this.lifecycleEvents = new common_utils_1.TypedEventEmitter();
|
|
40
|
-
this._connected = this.container.connected;
|
|
41
|
-
this._quorum = quorum;
|
|
42
|
-
this.taggedLogger = container.subLogger;
|
|
43
|
-
this._fluidModuleP = new common_utils_1.LazyPromise(async () => this.loadCodeModule(_codeDetails));
|
|
44
41
|
this.supportedFeatures = new Map([
|
|
45
42
|
/**
|
|
46
43
|
* This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,
|
|
@@ -49,222 +46,28 @@ class ContainerContext {
|
|
|
49
46
|
*/
|
|
50
47
|
["referenceSequenceNumbers", true],
|
|
51
48
|
]);
|
|
52
|
-
this.attachListener();
|
|
53
|
-
}
|
|
54
|
-
static async createOrLoad(container, scope, codeLoader, codeDetails, baseSnapshot, deltaManager, quorum, loader, submitFn, submitSummaryFn, submitBatchFn, submitSignalFn, disposeFn, closeFn, version, updateDirtyContainerState, existing, pendingLocalState) {
|
|
55
|
-
const context = new ContainerContext(container, scope, codeLoader, codeDetails, baseSnapshot, deltaManager, quorum, loader, submitFn, submitSummaryFn, submitBatchFn, submitSignalFn, disposeFn, closeFn, version, updateDirtyContainerState, existing, pendingLocalState);
|
|
56
|
-
await context.instantiateRuntime(existing);
|
|
57
|
-
return context;
|
|
58
49
|
}
|
|
59
50
|
get clientId() {
|
|
60
|
-
return this.
|
|
51
|
+
return this._getClientId();
|
|
61
52
|
}
|
|
62
53
|
/**
|
|
63
54
|
* DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.
|
|
64
55
|
*/
|
|
65
56
|
get id() {
|
|
66
|
-
|
|
67
|
-
return (_b = (_a = this.container.resolvedUrl) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : "";
|
|
68
|
-
}
|
|
69
|
-
get clientDetails() {
|
|
70
|
-
return this.container.clientDetails;
|
|
57
|
+
return this._getContainerDiagnosticId() ?? "";
|
|
71
58
|
}
|
|
72
59
|
/**
|
|
73
60
|
* When true, ops are free to flow
|
|
74
61
|
* When false, ops should be kept as pending or rejected
|
|
75
62
|
*/
|
|
76
63
|
get connected() {
|
|
77
|
-
return this.
|
|
78
|
-
}
|
|
79
|
-
get canSummarize() {
|
|
80
|
-
return "summarize" in this.runtime;
|
|
81
|
-
}
|
|
82
|
-
get serviceConfiguration() {
|
|
83
|
-
return this.container.serviceConfiguration;
|
|
84
|
-
}
|
|
85
|
-
get audience() {
|
|
86
|
-
return this.container.audience;
|
|
87
|
-
}
|
|
88
|
-
get options() {
|
|
89
|
-
return this.container.options;
|
|
90
|
-
}
|
|
91
|
-
get baseSnapshot() {
|
|
92
|
-
return this._baseSnapshot;
|
|
93
|
-
}
|
|
94
|
-
get storage() {
|
|
95
|
-
return this.container.storage;
|
|
96
|
-
}
|
|
97
|
-
get runtime() {
|
|
98
|
-
if (this._runtime === undefined) {
|
|
99
|
-
throw new Error("Attempted to access runtime before it was defined");
|
|
100
|
-
}
|
|
101
|
-
return this._runtime;
|
|
102
|
-
}
|
|
103
|
-
get disposed() {
|
|
104
|
-
return this._disposed;
|
|
105
|
-
}
|
|
106
|
-
get codeDetails() {
|
|
107
|
-
return this._codeDetails;
|
|
108
|
-
}
|
|
109
|
-
get quorum() {
|
|
110
|
-
return this._quorum;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* {@inheritDoc @fluidframework/container-definitions#IContainerContext.getEntryPoint}
|
|
114
|
-
*/
|
|
115
|
-
async getEntryPoint() {
|
|
116
|
-
var _a, _b;
|
|
117
|
-
if (this._disposed) {
|
|
118
|
-
throw new container_utils_1.UsageError("The context is already disposed");
|
|
119
|
-
}
|
|
120
|
-
if (this._runtime !== undefined) {
|
|
121
|
-
return (_b = (_a = this._runtime) === null || _a === void 0 ? void 0 : _a.getEntryPoint) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
122
|
-
}
|
|
123
|
-
return new Promise((resolve, reject) => {
|
|
124
|
-
const runtimeInstantiatedHandler = () => {
|
|
125
|
-
var _a, _b;
|
|
126
|
-
(0, common_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
|
|
127
|
-
resolve((_b = (_a = this._runtime).getEntryPoint) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
128
|
-
this.lifecycleEvents.off("disposed", disposedHandler);
|
|
129
|
-
};
|
|
130
|
-
const disposedHandler = () => {
|
|
131
|
-
reject(new Error("ContainerContext was disposed"));
|
|
132
|
-
this.lifecycleEvents.off("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
133
|
-
};
|
|
134
|
-
this.lifecycleEvents.once("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
135
|
-
this.lifecycleEvents.once("disposed", disposedHandler);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Temporary migratory API, to be removed when customers no longer need it.
|
|
140
|
-
* When removed, `ContainerContext` should only take an {@link @fluidframework/container-definitions#IQuorumClients}
|
|
141
|
-
* rather than an {@link @fluidframework/protocol-definitions#IQuorum}.
|
|
142
|
-
* See {@link @fluidframework/container-definitions#IContainerContext} for more details.
|
|
143
|
-
*/
|
|
144
|
-
getSpecifiedCodeDetails() {
|
|
145
|
-
var _a;
|
|
146
|
-
return ((_a = this._quorum.get("code")) !== null && _a !== void 0 ? _a : this._quorum.get("code2"));
|
|
147
|
-
}
|
|
148
|
-
dispose(error) {
|
|
149
|
-
if (this._disposed) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
this._disposed = true;
|
|
153
|
-
this.lifecycleEvents.emit("disposed");
|
|
154
|
-
this.runtime.dispose(error);
|
|
155
|
-
this._quorum.dispose();
|
|
156
|
-
this.deltaManager.dispose();
|
|
64
|
+
return this._getConnected();
|
|
157
65
|
}
|
|
158
66
|
getLoadedFromVersion() {
|
|
159
|
-
return this.
|
|
67
|
+
return this._version;
|
|
160
68
|
}
|
|
161
69
|
get attachState() {
|
|
162
|
-
return this.
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Create a summary. Used when attaching or serializing a detached container.
|
|
166
|
-
*
|
|
167
|
-
* @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
|
|
168
|
-
* using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
|
|
169
|
-
* new storage IDs so requests can be redirected.
|
|
170
|
-
*/
|
|
171
|
-
createSummary(blobRedirectTable) {
|
|
172
|
-
return this.runtime.createSummary(blobRedirectTable);
|
|
173
|
-
}
|
|
174
|
-
setConnectionState(connected, clientId) {
|
|
175
|
-
const runtime = this.runtime;
|
|
176
|
-
this._connected = connected;
|
|
177
|
-
runtime.setConnectionState(connected, clientId);
|
|
178
|
-
}
|
|
179
|
-
process(message, local) {
|
|
180
|
-
this.runtime.process(message, local);
|
|
181
|
-
}
|
|
182
|
-
processSignal(message, local) {
|
|
183
|
-
this.runtime.processSignal(message, local);
|
|
184
|
-
}
|
|
185
|
-
async request(path) {
|
|
186
|
-
return this.runtime.request(path);
|
|
187
|
-
}
|
|
188
|
-
async getAbsoluteUrl(relativeUrl) {
|
|
189
|
-
return this.container.getAbsoluteUrl(relativeUrl);
|
|
190
|
-
}
|
|
191
|
-
getPendingLocalState() {
|
|
192
|
-
return this.runtime.getPendingLocalState();
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Determines if the current code details of the context
|
|
196
|
-
* satisfy the incoming constraint code details
|
|
197
|
-
*/
|
|
198
|
-
async satisfies(constraintCodeDetails) {
|
|
199
|
-
var _a;
|
|
200
|
-
const comparers = [];
|
|
201
|
-
const maybeCompareCodeLoader = this.codeLoader;
|
|
202
|
-
if (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {
|
|
203
|
-
comparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);
|
|
204
|
-
}
|
|
205
|
-
const moduleWithDetails = await this._fluidModuleP;
|
|
206
|
-
const maybeCompareExport = (_a = moduleWithDetails.module) === null || _a === void 0 ? void 0 : _a.fluidExport;
|
|
207
|
-
if ((maybeCompareExport === null || maybeCompareExport === void 0 ? void 0 : maybeCompareExport.IFluidCodeDetailsComparer) !== undefined) {
|
|
208
|
-
comparers.push(maybeCompareExport.IFluidCodeDetailsComparer);
|
|
209
|
-
}
|
|
210
|
-
// if there are not comparers it is not possible to know
|
|
211
|
-
// if the current satisfy the incoming, so return false,
|
|
212
|
-
// as assuming they do not satisfy is safer .e.g we will
|
|
213
|
-
// reload, rather than potentially running with
|
|
214
|
-
// incompatible code
|
|
215
|
-
if (comparers.length === 0) {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
for (const comparer of comparers) {
|
|
219
|
-
const satisfies = await comparer.satisfies(moduleWithDetails.details, constraintCodeDetails);
|
|
220
|
-
if (satisfies === false) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
async notifyOpReplay(message) {
|
|
227
|
-
var _a, _b;
|
|
228
|
-
return (_b = (_a = this.runtime).notifyOpReplay) === null || _b === void 0 ? void 0 : _b.call(_a, message);
|
|
229
|
-
}
|
|
230
|
-
// #region private
|
|
231
|
-
async getRuntimeFactory() {
|
|
232
|
-
var _a;
|
|
233
|
-
const fluidExport = (_a = (await this._fluidModuleP).module) === null || _a === void 0 ? void 0 : _a.fluidExport;
|
|
234
|
-
const runtimeFactory = fluidExport === null || fluidExport === void 0 ? void 0 : fluidExport.IRuntimeFactory;
|
|
235
|
-
if (runtimeFactory === undefined) {
|
|
236
|
-
throw new Error(PackageNotFactoryError);
|
|
237
|
-
}
|
|
238
|
-
return runtimeFactory;
|
|
239
|
-
}
|
|
240
|
-
async instantiateRuntime(existing) {
|
|
241
|
-
const runtimeFactory = await this.getRuntimeFactory();
|
|
242
|
-
this._runtime = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.taggedLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(this, existing));
|
|
243
|
-
this.lifecycleEvents.emit("runtimeInstantiated");
|
|
244
|
-
}
|
|
245
|
-
attachListener() {
|
|
246
|
-
this.container.once("attaching", () => {
|
|
247
|
-
this.runtime.setAttachState(container_definitions_1.AttachState.Attaching);
|
|
248
|
-
});
|
|
249
|
-
this.container.once("attached", () => {
|
|
250
|
-
this.runtime.setAttachState(container_definitions_1.AttachState.Attached);
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
async loadCodeModule(codeDetails) {
|
|
254
|
-
const loadCodeResult = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.taggedLogger, { eventName: "CodeLoad" }, async () => this.codeLoader.load(codeDetails));
|
|
255
|
-
if ("module" in loadCodeResult) {
|
|
256
|
-
const { module, details } = loadCodeResult;
|
|
257
|
-
return {
|
|
258
|
-
module,
|
|
259
|
-
details: details !== null && details !== void 0 ? details : codeDetails,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
// If "module" is not in the result, we are using a legacy ICodeLoader. Fix the result up with details.
|
|
264
|
-
// Once usage drops to 0 we can remove this compat path.
|
|
265
|
-
this.taggedLogger.sendTelemetryEvent({ eventName: "LegacyCodeLoader" });
|
|
266
|
-
return loadCodeResult;
|
|
267
|
-
}
|
|
70
|
+
return this._getAttachState();
|
|
268
71
|
}
|
|
269
72
|
}
|
|
270
73
|
exports.ContainerContext = ContainerContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerContext.js","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAwF;AACxF,+DAAsF;AACtF,iFAiB+C;AAiB/C,qEAA6D;AAG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ED;AApXD,4CAoXC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { assert, LazyPromise, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n\tIAudience,\n\tIContainerContext,\n\tIDeltaManager,\n\tILoader,\n\tIRuntime,\n\tICriticalContainerError,\n\tAttachState,\n\tILoaderOptions,\n\tIRuntimeFactory,\n\tIProvideRuntimeFactory,\n\tIFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIProvideFluidCodeDetailsComparer,\n\tICodeDetailsLoader,\n\tIFluidModuleWithDetails,\n\tIBatchMessage,\n} from \"@fluidframework/container-definitions\";\nimport { IRequest, IResponse, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tIQuorum,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n\tISnapshotTree,\n\tISummaryTree,\n\tIVersion,\n\tMessageType,\n\tISummaryContent,\n} from \"@fluidframework/protocol-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { Container } from \"./container\";\n\nconst PackageNotFactoryError = \"Code package does not implement IRuntimeFactory\";\n\n/**\n * Events that {@link ContainerContext} can emit through its lifecycle.\n *\n * \"runtimeInstantiated\" - When an {@link @fluidframework/container-definitions#IRuntime} has been instantiated (by\n * calling instantiateRuntime() on the runtime factory), and this._runtime is set.\n *\n * \"disposed\" - When its dispose() method is called. The {@link ContainerContext} is no longer usable at that point.\n */\ntype ContextLifecycleEvents = \"runtimeInstantiated\" | \"disposed\";\n\nexport class ContainerContext implements IContainerContext {\n\tpublic static async createOrLoad(\n\t\tcontainer: Container,\n\t\tscope: FluidObject,\n\t\tcodeLoader: ICodeDetailsLoader,\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tbaseSnapshot: ISnapshotTree | undefined,\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorum,\n\t\tloader: ILoader,\n\t\tsubmitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number,\n\t\tsubmitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number,\n\t\tsubmitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number,\n\t\tsubmitSignalFn: (contents: any) => void,\n\t\tdisposeFn: (error?: ICriticalContainerError) => void,\n\t\tcloseFn: (error?: ICriticalContainerError) => void,\n\t\tversion: string,\n\t\tupdateDirtyContainerState: (dirty: boolean) => void,\n\t\texisting: boolean,\n\t\tpendingLocalState?: unknown,\n\t): Promise<ContainerContext> {\n\t\tconst context = new ContainerContext(\n\t\t\tcontainer,\n\t\t\tscope,\n\t\t\tcodeLoader,\n\t\t\tcodeDetails,\n\t\t\tbaseSnapshot,\n\t\t\tdeltaManager,\n\t\t\tquorum,\n\t\t\tloader,\n\t\t\tsubmitFn,\n\t\t\tsubmitSummaryFn,\n\t\t\tsubmitBatchFn,\n\t\t\tsubmitSignalFn,\n\t\t\tdisposeFn,\n\t\t\tcloseFn,\n\t\t\tversion,\n\t\t\tupdateDirtyContainerState,\n\t\t\texisting,\n\t\t\tpendingLocalState,\n\t\t);\n\t\tawait context.instantiateRuntime(existing);\n\t\treturn context;\n\t}\n\n\tpublic readonly taggedLogger: ITelemetryLoggerExt;\n\tpublic readonly supportedFeatures: ReadonlyMap<string, unknown>;\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this.container.clientId;\n\t}\n\n\t/**\n\t * DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.\n\t */\n\tpublic get id(): string {\n\t\treturn this.container.resolvedUrl?.id ?? \"\";\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.container.clientDetails;\n\t}\n\n\tprivate _connected: boolean;\n\t/**\n\t * When true, ops are free to flow\n\t * When false, ops should be kept as pending or rejected\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\tpublic get canSummarize(): boolean {\n\t\treturn \"summarize\" in this.runtime;\n\t}\n\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.container.serviceConfiguration;\n\t}\n\n\tpublic get audience(): IAudience {\n\t\treturn this.container.audience;\n\t}\n\n\tpublic get options(): ILoaderOptions {\n\t\treturn this.container.options;\n\t}\n\n\tpublic get baseSnapshot() {\n\t\treturn this._baseSnapshot;\n\t}\n\n\tpublic get storage(): IDocumentStorageService {\n\t\treturn this.container.storage;\n\t}\n\n\tprivate _runtime: IRuntime | undefined;\n\tprivate get runtime() {\n\t\tif (this._runtime === undefined) {\n\t\t\tthrow new Error(\"Attempted to access runtime before it was defined\");\n\t\t}\n\t\treturn this._runtime;\n\t}\n\n\tprivate _disposed = false;\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tpublic get codeDetails() {\n\t\treturn this._codeDetails;\n\t}\n\n\tprivate readonly _quorum: IQuorum;\n\tpublic get quorum(): IQuorumClients {\n\t\treturn this._quorum;\n\t}\n\n\tprivate readonly _fluidModuleP: Promise<IFluidModuleWithDetails>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/container-definitions#IContainerContext.getEntryPoint}\n\t */\n\tpublic async getEntryPoint?(): Promise<FluidObject | undefined> {\n\t\tif (this._disposed) {\n\t\t\tthrow new UsageError(\"The context is already disposed\");\n\t\t}\n\t\tif (this._runtime !== undefined) {\n\t\t\treturn this._runtime?.getEntryPoint?.();\n\t\t}\n\t\treturn new Promise<FluidObject | undefined>((resolve, reject) => {\n\t\t\tconst runtimeInstantiatedHandler = () => {\n\t\t\t\tassert(\n\t\t\t\t\tthis._runtime !== undefined,\n\t\t\t\t\t0x5a3 /* runtimeInstantiated fired but runtime is still undefined */,\n\t\t\t\t);\n\t\t\t\tresolve(this._runtime.getEntryPoint?.());\n\t\t\t\tthis.lifecycleEvents.off(\"disposed\", disposedHandler);\n\t\t\t};\n\t\t\tconst disposedHandler = () => {\n\t\t\t\treject(new Error(\"ContainerContext was disposed\"));\n\t\t\t\tthis.lifecycleEvents.off(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\t};\n\t\t\tthis.lifecycleEvents.once(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\tthis.lifecycleEvents.once(\"disposed\", disposedHandler);\n\t\t});\n\t}\n\n\t/**\n\t * Emits events about the container context's lifecycle.\n\t * Use it to coordinate things inside the ContainerContext class.\n\t */\n\tprivate readonly lifecycleEvents = new TypedEventEmitter<ContextLifecycleEvents>();\n\n\tconstructor(\n\t\tprivate readonly container: Container,\n\t\tpublic readonly scope: FluidObject,\n\t\tprivate readonly codeLoader: ICodeDetailsLoader,\n\t\tprivate readonly _codeDetails: IFluidCodeDetails,\n\t\tprivate readonly _baseSnapshot: ISnapshotTree | undefined,\n\t\tpublic readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorum,\n\t\tpublic readonly loader: ILoader,\n\t\tpublic readonly submitFn: (\n\t\t\ttype: MessageType,\n\t\t\tcontents: any,\n\t\t\tbatch: boolean,\n\t\t\tappData: any,\n\t\t) => number,\n\t\tpublic readonly submitSummaryFn: (\n\t\t\tsummaryOp: ISummaryContent,\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\t/** @returns clientSequenceNumber of last message in a batch */\n\t\tpublic readonly submitBatchFn: (\n\t\t\tbatch: IBatchMessage[],\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\tpublic readonly submitSignalFn: (contents: any) => void,\n\t\tpublic readonly disposeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly closeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly version: string,\n\t\tpublic readonly updateDirtyContainerState: (dirty: boolean) => void,\n\t\tpublic readonly existing: boolean,\n\t\tpublic readonly pendingLocalState?: unknown,\n\t) {\n\t\tthis._connected = this.container.connected;\n\t\tthis._quorum = quorum;\n\t\tthis.taggedLogger = container.subLogger;\n\t\tthis._fluidModuleP = new LazyPromise<IFluidModuleWithDetails>(async () =>\n\t\t\tthis.loadCodeModule(_codeDetails),\n\t\t);\n\n\t\tthis.supportedFeatures = new Map([\n\t\t\t/**\n\t\t\t * This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,\n\t\t\t * as a parameter to the `submitBatchFn` and `submitSummaryFn` functions.\n\t\t\t * This is then used to set the reference sequence numbers of the submitted ops in the DeltaManager.\n\t\t\t */\n\t\t\t[\"referenceSequenceNumbers\", true],\n\t\t]);\n\t\tthis.attachListener();\n\t}\n\n\t/**\n\t * @deprecated Temporary migratory API, to be removed when customers no longer need it.\n\t * When removed, `ContainerContext` should only take an {@link @fluidframework/container-definitions#IQuorumClients}\n\t * rather than an {@link @fluidframework/protocol-definitions#IQuorum}.\n\t * See {@link @fluidframework/container-definitions#IContainerContext} for more details.\n\t */\n\tpublic getSpecifiedCodeDetails(): IFluidCodeDetails | undefined {\n\t\treturn (this._quorum.get(\"code\") ?? this._quorum.get(\"code2\")) as\n\t\t\t| IFluidCodeDetails\n\t\t\t| undefined;\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.lifecycleEvents.emit(\"disposed\");\n\t\tthis.runtime.dispose(error);\n\t\tthis._quorum.dispose();\n\t\tthis.deltaManager.dispose();\n\t}\n\n\tpublic getLoadedFromVersion(): IVersion | undefined {\n\t\treturn this.container.loadedFromVersion;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this.container.attachState;\n\t}\n\n\t/**\n\t * Create a summary. Used when attaching or serializing a detached container.\n\t *\n\t * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n\t * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n\t * new storage IDs so requests can be redirected.\n\t */\n\tpublic createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree {\n\t\treturn this.runtime.createSummary(blobRedirectTable);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tconst runtime = this.runtime;\n\t\tthis._connected = connected;\n\t\truntime.setConnectionState(connected, clientId);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean) {\n\t\tthis.runtime.process(message, local);\n\t}\n\n\tpublic processSignal(message: ISignalMessage, local: boolean) {\n\t\tthis.runtime.processSignal(message, local);\n\t}\n\n\tpublic async request(path: IRequest): Promise<IResponse> {\n\t\treturn this.runtime.request(path);\n\t}\n\n\tpublic async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n\t\treturn this.container.getAbsoluteUrl(relativeUrl);\n\t}\n\n\tpublic getPendingLocalState(): unknown {\n\t\treturn this.runtime.getPendingLocalState();\n\t}\n\n\t/**\n\t * Determines if the current code details of the context\n\t * satisfy the incoming constraint code details\n\t */\n\tpublic async satisfies(constraintCodeDetails: IFluidCodeDetails) {\n\t\tconst comparers: IFluidCodeDetailsComparer[] = [];\n\n\t\tconst maybeCompareCodeLoader = this.codeLoader;\n\t\tif (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\tconst moduleWithDetails = await this._fluidModuleP;\n\t\tconst maybeCompareExport: Partial<IProvideFluidCodeDetailsComparer> | undefined =\n\t\t\tmoduleWithDetails.module?.fluidExport;\n\t\tif (maybeCompareExport?.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareExport.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\t// if there are not comparers it is not possible to know\n\t\t// if the current satisfy the incoming, so return false,\n\t\t// as assuming they do not satisfy is safer .e.g we will\n\t\t// reload, rather than potentially running with\n\t\t// incompatible code\n\t\tif (comparers.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const comparer of comparers) {\n\t\t\tconst satisfies = await comparer.satisfies(\n\t\t\t\tmoduleWithDetails.details,\n\t\t\t\tconstraintCodeDetails,\n\t\t\t);\n\t\t\tif (satisfies === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic async notifyOpReplay(message: ISequencedDocumentMessage): Promise<void> {\n\t\treturn this.runtime.notifyOpReplay?.(message);\n\t}\n\n\t// #region private\n\n\tprivate async getRuntimeFactory(): Promise<IRuntimeFactory> {\n\t\tconst fluidExport: FluidObject<IProvideRuntimeFactory> | undefined = (\n\t\t\tawait this._fluidModuleP\n\t\t).module?.fluidExport;\n\t\tconst runtimeFactory = fluidExport?.IRuntimeFactory;\n\t\tif (runtimeFactory === undefined) {\n\t\t\tthrow new Error(PackageNotFactoryError);\n\t\t}\n\n\t\treturn runtimeFactory;\n\t}\n\n\tprivate async instantiateRuntime(existing: boolean) {\n\t\tconst runtimeFactory = await this.getRuntimeFactory();\n\t\tthis._runtime = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.taggedLogger,\n\t\t\t{ eventName: \"InstantiateRuntime\" },\n\t\t\tasync () => runtimeFactory.instantiateRuntime(this, existing),\n\t\t);\n\t\tthis.lifecycleEvents.emit(\"runtimeInstantiated\");\n\t}\n\n\tprivate attachListener() {\n\t\tthis.container.once(\"attaching\", () => {\n\t\t\tthis.runtime.setAttachState(AttachState.Attaching);\n\t\t});\n\t\tthis.container.once(\"attached\", () => {\n\t\t\tthis.runtime.setAttachState(AttachState.Attached);\n\t\t});\n\t}\n\n\tprivate async loadCodeModule(codeDetails: IFluidCodeDetails): Promise<IFluidModuleWithDetails> {\n\t\tconst loadCodeResult = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.taggedLogger,\n\t\t\t{ eventName: \"CodeLoad\" },\n\t\t\tasync () => this.codeLoader.load(codeDetails),\n\t\t);\n\n\t\tif (\"module\" in loadCodeResult) {\n\t\t\tconst { module, details } = loadCodeResult;\n\t\t\treturn {\n\t\t\t\tmodule,\n\t\t\t\tdetails: details ?? codeDetails,\n\t\t\t};\n\t\t} else {\n\t\t\t// If \"module\" is not in the result, we are using a legacy ICodeLoader. Fix the result up with details.\n\t\t\t// Once usage drops to 0 we can remove this compat path.\n\t\t\tthis.taggedLogger.sendTelemetryEvent({ eventName: \"LegacyCodeLoader\" });\n\t\t\treturn loadCodeResult;\n\t\t}\n\t}\n\t// #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"containerContext.js","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2BH;;GAEG;AACH,MAAa,gBAAgB;IA6B5B,YACiB,OAAuB,EACvB,KAAkB,EAClB,YAAuC,EACtC,QAA8B,EAC/B,YAAwE,EACxE,OAAgC,EAChC,MAAsB,EACtB,QAAmB,EACnB,MAAe,EACf,QAKL,EACK,eAGL;IACX,+DAA+D;IAC/C,aAGL,EACK,cAAuC,EACvC,SAAoD,EACpD,OAAkD,EAClD,yBAAmD,EACnD,cAAoE,EACnE,yBAAmD,EACnD,YAAsC,EACtC,eAAkC,EAClC,aAA4B,EAC7B,uBAA4D,EAC5D,aAA6B,EAC7B,QAAiB,EACjB,YAAiC,EACjC,iBAA2B;QArC3B,YAAO,GAAP,OAAO,CAAgB;QACvB,UAAK,GAAL,KAAK,CAAa;QAClB,iBAAY,GAAZ,YAAY,CAA2B;QACtC,aAAQ,GAAR,QAAQ,CAAsB;QAC/B,iBAAY,GAAZ,YAAY,CAA4D;QACxE,YAAO,GAAP,OAAO,CAAyB;QAChC,WAAM,GAAN,MAAM,CAAgB;QACtB,aAAQ,GAAR,QAAQ,CAAW;QACnB,WAAM,GAAN,MAAM,CAAS;QACf,aAAQ,GAAR,QAAQ,CAKb;QACK,oBAAe,GAAf,eAAe,CAGpB;QAEK,kBAAa,GAAb,aAAa,CAGlB;QACK,mBAAc,GAAd,cAAc,CAAyB;QACvC,cAAS,GAAT,SAAS,CAA2C;QACpD,YAAO,GAAP,OAAO,CAA2C;QAClD,8BAAyB,GAAzB,yBAAyB,CAA0B;QACnD,mBAAc,GAAd,cAAc,CAAsD;QACnE,8BAAyB,GAAzB,yBAAyB,CAA0B;QACnD,iBAAY,GAAZ,YAAY,CAA0B;QACtC,oBAAe,GAAf,eAAe,CAAmB;QAClC,kBAAa,GAAb,aAAa,CAAe;QAC7B,4BAAuB,GAAvB,uBAAuB,CAAqC;QAC5D,kBAAa,GAAb,aAAa,CAAgB;QAC7B,aAAQ,GAAR,QAAQ,CAAS;QACjB,iBAAY,GAAZ,YAAY,CAAqB;QACjC,sBAAiB,GAAjB,iBAAiB,CAAU;QAlE5B,sBAAiB,GAAiC,IAAI,GAAG,CAAC;YACzE;;;;eAIG;YACH,CAAC,0BAA0B,EAAE,IAAI,CAAC;SAClC,CAAC,CAAC;IA4DA,CAAC;IA1DJ,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,EAAE;QACZ,OAAO,IAAI,CAAC,yBAAyB,EAAE,IAAI,EAAE,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;IAC7B,CAAC;IA2CM,oBAAoB;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;CACD;AA7ED,4CA6EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIAudience,\n\tIContainerContext,\n\tIDeltaManager,\n\tILoader,\n\tICriticalContainerError,\n\tAttachState,\n\tILoaderOptions,\n\tIFluidCodeDetails,\n\tIBatchMessage,\n} from \"@fluidframework/container-definitions\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n\tIClientDetails,\n\tIDocumentMessage,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n\tIVersion,\n\tMessageType,\n\tISummaryContent,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * {@inheritDoc @fluidframework/container-definitions#IContainerContext}\n */\nexport class ContainerContext implements IContainerContext {\n\tpublic readonly supportedFeatures: ReadonlyMap<string, unknown> = new Map([\n\t\t/**\n\t\t * This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,\n\t\t * as a parameter to the `submitBatchFn` and `submitSummaryFn` functions.\n\t\t * This is then used to set the reference sequence numbers of the submitted ops in the DeltaManager.\n\t\t */\n\t\t[\"referenceSequenceNumbers\", true],\n\t]);\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this._getClientId();\n\t}\n\n\t/**\n\t * DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.\n\t */\n\tpublic get id(): string {\n\t\treturn this._getContainerDiagnosticId() ?? \"\";\n\t}\n\n\t/**\n\t * When true, ops are free to flow\n\t * When false, ops should be kept as pending or rejected\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._getConnected();\n\t}\n\n\tconstructor(\n\t\tpublic readonly options: ILoaderOptions,\n\t\tpublic readonly scope: FluidObject,\n\t\tpublic readonly baseSnapshot: ISnapshotTree | undefined,\n\t\tprivate readonly _version: IVersion | undefined,\n\t\tpublic readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tpublic readonly storage: IDocumentStorageService,\n\t\tpublic readonly quorum: IQuorumClients,\n\t\tpublic readonly audience: IAudience,\n\t\tpublic readonly loader: ILoader,\n\t\tpublic readonly submitFn: (\n\t\t\ttype: MessageType,\n\t\t\tcontents: any,\n\t\t\tbatch: boolean,\n\t\t\tappData: any,\n\t\t) => number,\n\t\tpublic readonly submitSummaryFn: (\n\t\t\tsummaryOp: ISummaryContent,\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\t/** @returns clientSequenceNumber of last message in a batch */\n\t\tpublic readonly submitBatchFn: (\n\t\t\tbatch: IBatchMessage[],\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\tpublic readonly submitSignalFn: (contents: any) => void,\n\t\tpublic readonly disposeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly closeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly updateDirtyContainerState: (dirty: boolean) => void,\n\t\tpublic readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>,\n\t\tprivate readonly _getContainerDiagnosticId: () => string | undefined,\n\t\tprivate readonly _getClientId: () => string | undefined,\n\t\tprivate readonly _getAttachState: () => AttachState,\n\t\tprivate readonly _getConnected: () => boolean,\n\t\tpublic readonly getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined,\n\t\tpublic readonly clientDetails: IClientDetails,\n\t\tpublic readonly existing: boolean,\n\t\tpublic readonly taggedLogger: ITelemetryLoggerExt,\n\t\tpublic readonly pendingLocalState?: unknown,\n\t) {}\n\n\tpublic getLoadedFromVersion(): IVersion | undefined {\n\t\treturn this._version;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this._getAttachState();\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IDisposable } from "@fluidframework/
|
|
5
|
+
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions";
|
|
8
8
|
import { FetchSource, IDocumentService, IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerStorageAdapter.d.ts","sourceRoot":"","sources":["../src/containerStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"containerStorageAdapter.d.ts","sourceRoot":"","sources":["../src/containerStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIhD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,uBAAuB,EAAE,WAAW;IAsBlF,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IA1B7C,OAAO,CAAC,eAAe,CAAiD;IAExE,OAAO,CAAC,sBAAsB,CAAsB;IACpD;;OAEG;IACH,IAAW,qBAAqB,YAE/B;IAED;;;;;;;;OAQG;gBAEF,mBAAmB,EAAE,oBAAoB,GAAG,SAAS,EACpC,MAAM,EAAE,mBAAmB;IAC5C;;OAEG;IACc,YAAY,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,G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