@fluidframework/container-loader 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277
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/.eslintrc.js +18 -21
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +364 -0
- package/README.md +152 -56
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/container-loader.api.md +143 -0
- package/dist/{audience.js → audience.cjs} +15 -13
- package/dist/audience.cjs.map +1 -0
- package/dist/audience.d.ts +4 -6
- package/dist/audience.d.ts.map +1 -1
- package/dist/catchUpMonitor.cjs +43 -0
- package/dist/catchUpMonitor.cjs.map +1 -0
- package/dist/catchUpMonitor.d.ts +29 -0
- package/dist/catchUpMonitor.d.ts.map +1 -0
- package/dist/{connectionManager.js → connectionManager.cjs} +397 -240
- package/dist/connectionManager.cjs.map +1 -0
- package/dist/connectionManager.d.ts +23 -33
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/{connectionState.js → connectionState.cjs} +5 -7
- package/dist/connectionState.cjs.map +1 -0
- package/dist/connectionState.d.ts +3 -5
- package/dist/connectionState.d.ts.map +1 -1
- package/dist/connectionStateHandler.cjs +474 -0
- package/dist/connectionStateHandler.cjs.map +1 -0
- package/dist/connectionStateHandler.d.ts +127 -29
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/container-loader-alpha.d.ts +274 -0
- package/dist/container-loader-beta.d.ts +75 -0
- package/dist/container-loader-public.d.ts +75 -0
- package/dist/container-loader-untrimmed.d.ts +331 -0
- package/dist/container.cjs +1585 -0
- package/dist/container.cjs.map +1 -0
- package/dist/container.d.ts +227 -83
- package/dist/container.d.ts.map +1 -1
- package/dist/containerContext.cjs +74 -0
- package/dist/containerContext.cjs.map +1 -0
- package/dist/containerContext.d.ts +33 -59
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerStorageAdapter.cjs +234 -0
- package/dist/containerStorageAdapter.cjs.map +1 -0
- package/dist/containerStorageAdapter.d.ts +48 -23
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/{contracts.js → contracts.cjs} +5 -5
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.d.ts +45 -17
- package/dist/contracts.d.ts.map +1 -1
- package/dist/debugLogger.cjs +101 -0
- package/dist/debugLogger.cjs.map +1 -0
- package/dist/debugLogger.d.ts +30 -0
- package/dist/debugLogger.d.ts.map +1 -0
- package/dist/{deltaManager.js → deltaManager.cjs} +379 -186
- package/dist/deltaManager.cjs.map +1 -0
- package/dist/deltaManager.d.ts +54 -18
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/{deltaQueue.js → deltaQueue.cjs} +29 -28
- package/dist/deltaQueue.cjs.map +1 -0
- package/dist/deltaQueue.d.ts +3 -4
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/disposal.cjs +25 -0
- package/dist/disposal.cjs.map +1 -0
- package/dist/disposal.d.ts +13 -0
- package/dist/disposal.d.ts.map +1 -0
- package/dist/error.cjs +32 -0
- package/dist/error.cjs.map +1 -0
- package/dist/error.d.ts +23 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/loader.cjs +148 -0
- package/dist/loader.cjs.map +1 -0
- package/dist/loader.d.ts +38 -19
- package/dist/loader.d.ts.map +1 -1
- package/dist/location-redirection-utilities/index.cjs +11 -0
- package/dist/location-redirection-utilities/index.cjs.map +1 -0
- package/dist/location-redirection-utilities/index.d.ts +6 -0
- package/dist/location-redirection-utilities/index.d.ts.map +1 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.cjs +53 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.cjs.map +1 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +24 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
- package/dist/{collabWindowTracker.js → noopHeuristic.cjs} +37 -39
- package/dist/noopHeuristic.cjs.map +1 -0
- package/dist/noopHeuristic.d.ts +23 -0
- package/dist/noopHeuristic.d.ts.map +1 -0
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/protocol.cjs +99 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.ts +38 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/{protocolTreeDocumentStorageService.js → protocolTreeDocumentStorageService.cjs} +8 -5
- package/dist/protocolTreeDocumentStorageService.cjs.map +1 -0
- package/dist/protocolTreeDocumentStorageService.d.ts +8 -4
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/quorum.cjs +16 -0
- package/dist/quorum.cjs.map +1 -0
- package/dist/quorum.d.ts +1 -14
- package/dist/quorum.d.ts.map +1 -1
- package/dist/{retriableDocumentStorageService.js → retriableDocumentStorageService.cjs} +36 -21
- package/dist/retriableDocumentStorageService.cjs.map +1 -0
- package/dist/retriableDocumentStorageService.d.ts +7 -5
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/{utils.js → utils.cjs} +52 -14
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +34 -1
- package/dist/utils.d.ts.map +1 -1
- package/lib/{audience.d.ts → audience.d.mts} +5 -11
- package/lib/audience.d.mts.map +1 -0
- package/lib/{audience.js → audience.mjs} +15 -17
- package/lib/audience.mjs.map +1 -0
- package/lib/catchUpMonitor.d.mts +29 -0
- package/lib/catchUpMonitor.d.mts.map +1 -0
- package/lib/catchUpMonitor.mjs +39 -0
- package/lib/catchUpMonitor.mjs.map +1 -0
- package/lib/{connectionManager.d.ts → connectionManager.d.mts} +24 -34
- package/lib/connectionManager.d.mts.map +1 -0
- package/lib/{connectionManager.js → connectionManager.mjs} +378 -218
- package/lib/connectionManager.mjs.map +1 -0
- package/lib/{connectionState.d.ts → connectionState.d.mts} +4 -6
- package/lib/connectionState.d.mts.map +1 -0
- package/lib/{connectionState.js → connectionState.mjs} +4 -6
- package/lib/connectionState.mjs.map +1 -0
- package/lib/connectionStateHandler.d.mts +179 -0
- package/lib/connectionStateHandler.d.mts.map +1 -0
- package/lib/connectionStateHandler.mjs +469 -0
- package/lib/connectionStateHandler.mjs.map +1 -0
- package/lib/container-loader-alpha.d.mts +274 -0
- package/lib/container-loader-beta.d.mts +75 -0
- package/lib/container-loader-public.d.mts +75 -0
- package/lib/container-loader-untrimmed.d.mts +331 -0
- package/lib/container.d.mts +382 -0
- package/lib/container.d.mts.map +1 -0
- package/lib/container.mjs +1579 -0
- package/lib/container.mjs.map +1 -0
- package/lib/containerContext.d.mts +58 -0
- package/lib/containerContext.d.mts.map +1 -0
- package/lib/containerContext.mjs +70 -0
- package/lib/containerContext.mjs.map +1 -0
- package/lib/containerStorageAdapter.d.mts +73 -0
- package/lib/containerStorageAdapter.d.mts.map +1 -0
- package/lib/containerStorageAdapter.mjs +228 -0
- package/lib/containerStorageAdapter.mjs.map +1 -0
- package/lib/{contracts.d.ts → contracts.d.mts} +46 -18
- package/lib/contracts.d.mts.map +1 -0
- package/lib/{contracts.js → contracts.mjs} +4 -4
- package/lib/contracts.mjs.map +1 -0
- package/lib/debugLogger.d.mts +30 -0
- package/lib/debugLogger.d.mts.map +1 -0
- package/lib/debugLogger.mjs +93 -0
- package/lib/debugLogger.mjs.map +1 -0
- package/lib/{deltaManager.d.ts → deltaManager.d.mts} +55 -19
- package/lib/deltaManager.d.mts.map +1 -0
- package/lib/{deltaManager.js → deltaManager.mjs} +361 -165
- package/lib/deltaManager.mjs.map +1 -0
- package/lib/{deltaQueue.d.ts → deltaQueue.d.mts} +4 -5
- package/lib/deltaQueue.d.mts.map +1 -0
- package/lib/{deltaQueue.js → deltaQueue.mjs} +25 -24
- package/lib/deltaQueue.mjs.map +1 -0
- package/lib/disposal.d.mts +13 -0
- package/lib/disposal.d.mts.map +1 -0
- package/lib/disposal.mjs +21 -0
- package/lib/disposal.mjs.map +1 -0
- package/lib/error.d.mts +23 -0
- package/lib/error.d.mts.map +1 -0
- package/lib/error.mjs +28 -0
- package/lib/error.mjs.map +1 -0
- package/lib/index.d.mts +11 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +10 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{loader.d.ts → loader.d.mts} +40 -21
- package/lib/loader.d.mts.map +1 -0
- package/lib/loader.mjs +143 -0
- package/lib/loader.mjs.map +1 -0
- package/lib/location-redirection-utilities/index.d.mts +6 -0
- package/lib/location-redirection-utilities/index.d.mts.map +1 -0
- package/lib/location-redirection-utilities/index.mjs +6 -0
- package/lib/location-redirection-utilities/index.mjs.map +1 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts +24 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts.map +1 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs +48 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +1 -0
- package/lib/noopHeuristic.d.mts +23 -0
- package/lib/noopHeuristic.d.mts.map +1 -0
- package/lib/{collabWindowTracker.js → noopHeuristic.mjs} +33 -35
- package/lib/noopHeuristic.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/protocol.d.mts +38 -0
- package/lib/protocol.d.mts.map +1 -0
- package/lib/protocol.mjs +94 -0
- package/lib/protocol.mjs.map +1 -0
- package/lib/{protocolTreeDocumentStorageService.d.ts → protocolTreeDocumentStorageService.d.mts} +9 -5
- package/lib/protocolTreeDocumentStorageService.d.mts.map +1 -0
- package/lib/{protocolTreeDocumentStorageService.js → protocolTreeDocumentStorageService.mjs} +8 -5
- package/lib/protocolTreeDocumentStorageService.mjs.map +1 -0
- package/lib/quorum.d.mts +4 -0
- package/lib/quorum.d.mts.map +1 -0
- package/lib/quorum.mjs +12 -0
- package/lib/quorum.mjs.map +1 -0
- package/lib/{retriableDocumentStorageService.d.ts → retriableDocumentStorageService.d.mts} +8 -6
- package/lib/retriableDocumentStorageService.d.mts.map +1 -0
- package/lib/{retriableDocumentStorageService.js → retriableDocumentStorageService.mjs} +35 -20
- package/lib/retriableDocumentStorageService.mjs.map +1 -0
- package/lib/utils.d.mts +67 -0
- package/lib/utils.d.mts.map +1 -0
- package/lib/{utils.js → utils.mjs} +47 -11
- package/lib/utils.mjs.map +1 -0
- package/package.json +189 -69
- package/prettier.config.cjs +8 -0
- package/src/audience.ts +59 -49
- package/src/catchUpMonitor.ts +61 -0
- package/src/connectionManager.ts +1154 -910
- package/src/connectionState.ts +22 -25
- package/src/connectionStateHandler.ts +689 -319
- package/src/container.ts +2476 -1792
- package/src/containerContext.ts +98 -330
- package/src/containerStorageAdapter.ts +301 -105
- package/src/contracts.ts +184 -146
- package/src/debugLogger.ts +123 -0
- package/src/deltaManager.ts +1165 -900
- package/src/deltaQueue.ts +156 -152
- package/src/disposal.ts +25 -0
- package/src/error.ts +44 -0
- package/src/index.ts +14 -15
- package/src/loader.ts +356 -427
- package/src/location-redirection-utilities/index.ts +9 -0
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +61 -0
- package/src/noopHeuristic.ts +107 -0
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +150 -0
- package/src/protocolTreeDocumentStorageService.ts +35 -35
- package/src/quorum.ts +11 -50
- package/src/retriableDocumentStorageService.ts +135 -95
- package/src/utils.ts +159 -86
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +10 -12
- package/dist/audience.js.map +0 -1
- package/dist/collabWindowTracker.d.ts +0 -19
- package/dist/collabWindowTracker.d.ts.map +0 -1
- package/dist/collabWindowTracker.js.map +0 -1
- package/dist/connectionManager.js.map +0 -1
- package/dist/connectionState.js.map +0 -1
- package/dist/connectionStateHandler.js +0 -280
- package/dist/connectionStateHandler.js.map +0 -1
- package/dist/container.js +0 -1284
- package/dist/container.js.map +0 -1
- package/dist/containerContext.js +0 -217
- package/dist/containerContext.js.map +0 -1
- package/dist/containerStorageAdapter.js +0 -104
- package/dist/containerStorageAdapter.js.map +0 -1
- package/dist/contracts.js.map +0 -1
- package/dist/deltaManager.js.map +0 -1
- package/dist/deltaManagerProxy.d.ts +0 -54
- package/dist/deltaManagerProxy.d.ts.map +0 -1
- package/dist/deltaManagerProxy.js +0 -115
- package/dist/deltaManagerProxy.js.map +0 -1
- package/dist/deltaQueue.js.map +0 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +0 -1
- package/dist/loader.js +0 -241
- package/dist/loader.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/protocolTreeDocumentStorageService.js.map +0 -1
- package/dist/quorum.js +0 -44
- package/dist/quorum.js.map +0 -1
- package/dist/retriableDocumentStorageService.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/lib/audience.d.ts.map +0 -1
- package/lib/audience.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/connectionManager.d.ts.map +0 -1
- package/lib/connectionManager.js.map +0 -1
- package/lib/connectionState.d.ts.map +0 -1
- package/lib/connectionState.js.map +0 -1
- package/lib/connectionStateHandler.d.ts +0 -81
- package/lib/connectionStateHandler.d.ts.map +0 -1
- package/lib/connectionStateHandler.js +0 -276
- package/lib/connectionStateHandler.js.map +0 -1
- package/lib/container.d.ts +0 -238
- package/lib/container.d.ts.map +0 -1
- package/lib/container.js +0 -1276
- package/lib/container.js.map +0 -1
- package/lib/containerContext.d.ts +0 -84
- package/lib/containerContext.d.ts.map +0 -1
- package/lib/containerContext.js +0 -213
- package/lib/containerContext.js.map +0 -1
- package/lib/containerStorageAdapter.d.ts +0 -48
- package/lib/containerStorageAdapter.d.ts.map +0 -1
- package/lib/containerStorageAdapter.js +0 -99
- package/lib/containerStorageAdapter.js.map +0 -1
- package/lib/contracts.d.ts.map +0 -1
- package/lib/contracts.js.map +0 -1
- package/lib/deltaManager.d.ts.map +0 -1
- package/lib/deltaManager.js.map +0 -1
- package/lib/deltaManagerProxy.d.ts +0 -54
- package/lib/deltaManagerProxy.d.ts.map +0 -1
- package/lib/deltaManagerProxy.js +0 -110
- package/lib/deltaManagerProxy.js.map +0 -1
- package/lib/deltaQueue.d.ts.map +0 -1
- package/lib/deltaQueue.js.map +0 -1
- package/lib/index.d.ts +0 -8
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/loader.d.ts.map +0 -1
- package/lib/loader.js +0 -236
- package/lib/loader.js.map +0 -1
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/protocolTreeDocumentStorageService.d.ts.map +0 -1
- package/lib/protocolTreeDocumentStorageService.js.map +0 -1
- package/lib/quorum.d.ts +0 -21
- package/lib/quorum.d.ts.map +0 -1
- package/lib/quorum.js +0 -38
- package/lib/quorum.js.map +0 -1
- package/lib/retriableDocumentStorageService.d.ts.map +0 -1
- package/lib/retriableDocumentStorageService.js.map +0 -1
- package/lib/utils.d.ts +0 -34
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
- package/src/collabWindowTracker.ts +0 -102
- package/src/deltaManagerProxy.ts +0 -158
- package/tsconfig.esnext.json +0 -7
package/src/containerContext.ts
CHANGED
|
@@ -3,341 +3,109 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { assert, LazyPromise } from "@fluidframework/common-utils";
|
|
6
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
7
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
IProvideRuntimeFactory,
|
|
19
|
-
IFluidCodeDetails,
|
|
20
|
-
IFluidCodeDetailsComparer,
|
|
21
|
-
IProvideFluidCodeDetailsComparer,
|
|
22
|
-
ICodeDetailsLoader,
|
|
23
|
-
IFluidModuleWithDetails,
|
|
24
|
-
ISnapshotTreeWithBlobContents,
|
|
8
|
+
IAudience,
|
|
9
|
+
IContainerContext,
|
|
10
|
+
IDeltaManager,
|
|
11
|
+
ILoader,
|
|
12
|
+
ICriticalContainerError,
|
|
13
|
+
AttachState,
|
|
14
|
+
ILoaderOptions,
|
|
15
|
+
IFluidCodeDetails,
|
|
16
|
+
IBatchMessage,
|
|
25
17
|
} from "@fluidframework/container-definitions";
|
|
26
|
-
import {
|
|
27
|
-
IRequest,
|
|
28
|
-
IResponse,
|
|
29
|
-
FluidObject,
|
|
30
|
-
} from "@fluidframework/core-interfaces";
|
|
18
|
+
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
31
19
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
32
|
-
import { isFluidResolvedUrl } from "@fluidframework/driver-utils";
|
|
33
20
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ISummaryTree,
|
|
43
|
-
IVersion,
|
|
44
|
-
MessageType,
|
|
21
|
+
IClientDetails,
|
|
22
|
+
IDocumentMessage,
|
|
23
|
+
IQuorumClients,
|
|
24
|
+
ISequencedDocumentMessage,
|
|
25
|
+
ISnapshotTree,
|
|
26
|
+
IVersion,
|
|
27
|
+
MessageType,
|
|
28
|
+
ISummaryContent,
|
|
45
29
|
} from "@fluidframework/protocol-definitions";
|
|
46
|
-
import { PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
47
|
-
import { Container } from "./container";
|
|
48
|
-
|
|
49
|
-
const PackageNotFactoryError = "Code package does not implement IRuntimeFactory";
|
|
50
30
|
|
|
31
|
+
/**
|
|
32
|
+
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
33
|
+
*/
|
|
51
34
|
export class ContainerContext implements IContainerContext {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public get baseSnapshot() {
|
|
131
|
-
return this._baseSnapshot;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public get storage(): IDocumentStorageService {
|
|
135
|
-
return this.container.storage;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private _runtime: IRuntime | undefined;
|
|
139
|
-
private get runtime() {
|
|
140
|
-
if (this._runtime === undefined) {
|
|
141
|
-
throw new Error("Attempted to access runtime before it was defined");
|
|
142
|
-
}
|
|
143
|
-
return this._runtime;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
private _disposed = false;
|
|
147
|
-
|
|
148
|
-
public get disposed() {
|
|
149
|
-
return this._disposed;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
public get codeDetails() { return this._codeDetails; }
|
|
153
|
-
|
|
154
|
-
private readonly _quorum: IQuorum;
|
|
155
|
-
public get quorum(): IQuorumClients { return this._quorum; }
|
|
156
|
-
|
|
157
|
-
private readonly _fluidModuleP: Promise<IFluidModuleWithDetails>;
|
|
158
|
-
|
|
159
|
-
constructor(
|
|
160
|
-
private readonly container: Container,
|
|
161
|
-
public readonly scope: FluidObject,
|
|
162
|
-
private readonly codeLoader: ICodeDetailsLoader,
|
|
163
|
-
private readonly _codeDetails: IFluidCodeDetails,
|
|
164
|
-
private _baseSnapshot: ISnapshotTree | undefined,
|
|
165
|
-
public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
166
|
-
quorum: IQuorum,
|
|
167
|
-
public readonly loader: ILoader,
|
|
168
|
-
public readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number,
|
|
169
|
-
public readonly submitSignalFn: (contents: any) => void,
|
|
170
|
-
public readonly closeFn: (error?: ICriticalContainerError) => void,
|
|
171
|
-
public readonly version: string,
|
|
172
|
-
public readonly updateDirtyContainerState: (dirty: boolean) => void,
|
|
173
|
-
public readonly existing: boolean,
|
|
174
|
-
public readonly pendingLocalState?: unknown,
|
|
175
|
-
|
|
176
|
-
) {
|
|
177
|
-
this._quorum = quorum;
|
|
178
|
-
this.taggedLogger = container.subLogger;
|
|
179
|
-
this._fluidModuleP = new LazyPromise<IFluidModuleWithDetails>(
|
|
180
|
-
async () => this.loadCodeModule(_codeDetails),
|
|
181
|
-
);
|
|
182
|
-
this.attachListener();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @deprecated - Temporary migratory API, to be removed when customers no longer need it. When removed,
|
|
187
|
-
* ContainerContext should only take an IQuorumClients rather than an IQuorum. See IContainerContext for more
|
|
188
|
-
* details.
|
|
189
|
-
*/
|
|
190
|
-
public getSpecifiedCodeDetails(): IFluidCodeDetails | undefined {
|
|
191
|
-
return (this._quorum.get("code") ?? this._quorum.get("code2")) as IFluidCodeDetails | undefined;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public dispose(error?: Error): void {
|
|
195
|
-
if (this._disposed) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
this._disposed = true;
|
|
199
|
-
|
|
200
|
-
this.runtime.dispose(error);
|
|
201
|
-
this._quorum.dispose();
|
|
202
|
-
this.deltaManager.dispose();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
public getLoadedFromVersion(): IVersion | undefined {
|
|
206
|
-
return this.container.loadedFromVersion;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
public get attachState(): AttachState {
|
|
210
|
-
return this.container.attachState;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Create a summary. Used when attaching or serializing a detached container.
|
|
215
|
-
*
|
|
216
|
-
* @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
|
|
217
|
-
* using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
|
|
218
|
-
* new storage IDs so requests can be redirected.
|
|
219
|
-
*/
|
|
220
|
-
public createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree {
|
|
221
|
-
return this.runtime.createSummary(blobRedirectTable);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
public setConnectionState(connected: boolean, clientId?: string) {
|
|
225
|
-
const runtime = this.runtime;
|
|
226
|
-
|
|
227
|
-
assert(connected === this.connected, 0x0de /* "Mismatch in connection state while setting" */);
|
|
228
|
-
|
|
229
|
-
runtime.setConnectionState(connected, clientId);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
public process(message: ISequencedDocumentMessage, local: boolean, context: any) {
|
|
233
|
-
this.runtime.process(message, local, context);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
public processSignal(message: ISignalMessage, local: boolean) {
|
|
237
|
-
this.runtime.processSignal(message, local);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
public async request(path: IRequest): Promise<IResponse> {
|
|
241
|
-
return this.runtime.request(path);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
public async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {
|
|
245
|
-
return this.container.getAbsoluteUrl(relativeUrl);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
public getPendingLocalState(): unknown {
|
|
249
|
-
return this.runtime.getPendingLocalState();
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Determines if the current code details of the context
|
|
254
|
-
* satisfy the incoming constraint code details
|
|
255
|
-
*/
|
|
256
|
-
public async satisfies(constraintCodeDetails: IFluidCodeDetails) {
|
|
257
|
-
const comparers: IFluidCodeDetailsComparer[] = [];
|
|
258
|
-
|
|
259
|
-
const maybeCompareCodeLoader = this.codeLoader;
|
|
260
|
-
if (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {
|
|
261
|
-
comparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const moduleWithDetails = await this._fluidModuleP;
|
|
265
|
-
const maybeCompareExport: Partial<IProvideFluidCodeDetailsComparer> | undefined =
|
|
266
|
-
moduleWithDetails.module?.fluidExport;
|
|
267
|
-
if (maybeCompareExport?.IFluidCodeDetailsComparer !== undefined) {
|
|
268
|
-
comparers.push(maybeCompareExport.IFluidCodeDetailsComparer);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// if there are not comparers it is not possible to know
|
|
272
|
-
// if the current satisfy the incoming, so return false,
|
|
273
|
-
// as assuming they do not satisfy is safer .e.g we will
|
|
274
|
-
// reload, rather than potentially running with
|
|
275
|
-
// incompatible code
|
|
276
|
-
if (comparers.length === 0) {
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
for (const comparer of comparers) {
|
|
281
|
-
const satisfies = await comparer.satisfies(
|
|
282
|
-
moduleWithDetails.details,
|
|
283
|
-
constraintCodeDetails,
|
|
284
|
-
);
|
|
285
|
-
if (satisfies === false) {
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return true;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
public notifyAttaching(snapshot: ISnapshotTreeWithBlobContents) {
|
|
293
|
-
this._baseSnapshot = snapshot;
|
|
294
|
-
this.runtime.notifyAttaching?.(snapshot);
|
|
295
|
-
this.runtime.setAttachState(AttachState.Attaching);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// #region private
|
|
299
|
-
|
|
300
|
-
private async getRuntimeFactory(): Promise<IRuntimeFactory> {
|
|
301
|
-
const fluidExport: FluidObject<IProvideRuntimeFactory> | undefined =
|
|
302
|
-
(await this._fluidModuleP).module?.fluidExport;
|
|
303
|
-
const runtimeFactory = fluidExport?.IRuntimeFactory;
|
|
304
|
-
if (runtimeFactory === undefined) {
|
|
305
|
-
throw new Error(PackageNotFactoryError);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
return runtimeFactory;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
private async instantiateRuntime(existing: boolean) {
|
|
312
|
-
const runtimeFactory = await this.getRuntimeFactory();
|
|
313
|
-
this._runtime = await runtimeFactory.instantiateRuntime(this, existing);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
private attachListener() {
|
|
317
|
-
this.container.once("attached", () => {
|
|
318
|
-
this.runtime.setAttachState(AttachState.Attached);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
private async loadCodeModule(codeDetails: IFluidCodeDetails): Promise<IFluidModuleWithDetails> {
|
|
323
|
-
const loadCodeResult = await PerformanceEvent.timedExecAsync(
|
|
324
|
-
this.taggedLogger,
|
|
325
|
-
{ eventName: "CodeLoad" },
|
|
326
|
-
async () => this.codeLoader.load(codeDetails),
|
|
327
|
-
);
|
|
328
|
-
|
|
329
|
-
if ("module" in loadCodeResult) {
|
|
330
|
-
const { module, details } = loadCodeResult;
|
|
331
|
-
return {
|
|
332
|
-
module,
|
|
333
|
-
details: details ?? codeDetails,
|
|
334
|
-
};
|
|
335
|
-
} else {
|
|
336
|
-
// If "module" is not in the result, we are using a legacy ICodeLoader. Fix the result up with details.
|
|
337
|
-
// Once usage drops to 0 we can remove this compat path.
|
|
338
|
-
this.taggedLogger.sendTelemetryEvent({ eventName: "LegacyCodeLoader" });
|
|
339
|
-
return loadCodeResult;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
// #endregion
|
|
35
|
+
public readonly supportedFeatures: ReadonlyMap<string, unknown> = new Map([
|
|
36
|
+
/**
|
|
37
|
+
* This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,
|
|
38
|
+
* as a parameter to the `submitBatchFn` and `submitSummaryFn` functions.
|
|
39
|
+
* This is then used to set the reference sequence numbers of the submitted ops in the DeltaManager.
|
|
40
|
+
*/
|
|
41
|
+
["referenceSequenceNumbers", true],
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
public get clientId(): string | undefined {
|
|
45
|
+
return this._getClientId();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.
|
|
50
|
+
*/
|
|
51
|
+
public get id(): string {
|
|
52
|
+
return this._getContainerDiagnosticId() ?? "";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* When true, ops are free to flow
|
|
57
|
+
* When false, ops should be kept as pending or rejected
|
|
58
|
+
*/
|
|
59
|
+
public get connected(): boolean {
|
|
60
|
+
return this._getConnected();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
constructor(
|
|
64
|
+
public readonly options: ILoaderOptions,
|
|
65
|
+
public readonly scope: FluidObject,
|
|
66
|
+
public readonly baseSnapshot: ISnapshotTree | undefined,
|
|
67
|
+
private readonly _version: IVersion | undefined,
|
|
68
|
+
public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
69
|
+
public readonly storage: IDocumentStorageService,
|
|
70
|
+
public readonly quorum: IQuorumClients,
|
|
71
|
+
public readonly audience: IAudience,
|
|
72
|
+
public readonly loader: ILoader,
|
|
73
|
+
public readonly submitFn: (
|
|
74
|
+
type: MessageType,
|
|
75
|
+
contents: any,
|
|
76
|
+
batch: boolean,
|
|
77
|
+
appData: any,
|
|
78
|
+
) => number,
|
|
79
|
+
public readonly submitSummaryFn: (
|
|
80
|
+
summaryOp: ISummaryContent,
|
|
81
|
+
referenceSequenceNumber?: number,
|
|
82
|
+
) => number,
|
|
83
|
+
/** @returns clientSequenceNumber of last message in a batch */
|
|
84
|
+
public readonly submitBatchFn: (
|
|
85
|
+
batch: IBatchMessage[],
|
|
86
|
+
referenceSequenceNumber?: number,
|
|
87
|
+
) => number,
|
|
88
|
+
public readonly submitSignalFn: (content: any, targetClientId?: string) => void,
|
|
89
|
+
public readonly disposeFn: (error?: ICriticalContainerError) => void,
|
|
90
|
+
public readonly closeFn: (error?: ICriticalContainerError) => void,
|
|
91
|
+
public readonly updateDirtyContainerState: (dirty: boolean) => void,
|
|
92
|
+
public readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>,
|
|
93
|
+
private readonly _getContainerDiagnosticId: () => string | undefined,
|
|
94
|
+
private readonly _getClientId: () => string | undefined,
|
|
95
|
+
private readonly _getAttachState: () => AttachState,
|
|
96
|
+
private readonly _getConnected: () => boolean,
|
|
97
|
+
public readonly getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined,
|
|
98
|
+
public readonly clientDetails: IClientDetails,
|
|
99
|
+
public readonly existing: boolean,
|
|
100
|
+
public readonly taggedLogger: ITelemetryLoggerExt,
|
|
101
|
+
public readonly pendingLocalState?: unknown,
|
|
102
|
+
) {}
|
|
103
|
+
|
|
104
|
+
public getLoadedFromVersion(): IVersion | undefined {
|
|
105
|
+
return this._version;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public get attachState(): AttachState {
|
|
109
|
+
return this._getAttachState();
|
|
110
|
+
}
|
|
343
111
|
}
|