@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/contracts.ts
CHANGED
|
@@ -3,31 +3,45 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { IErrorBase, ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
6
7
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ICriticalContainerError,
|
|
14
|
-
IFluidCodeDetails,
|
|
15
|
-
isFluidPackage,
|
|
8
|
+
IConnectionDetails,
|
|
9
|
+
ICriticalContainerError,
|
|
10
|
+
IDeltaQueue,
|
|
11
|
+
IFluidCodeDetails,
|
|
12
|
+
isFluidPackage,
|
|
13
|
+
ReadOnlyInfo,
|
|
16
14
|
} from "@fluidframework/container-definitions";
|
|
17
15
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
ConnectionMode,
|
|
17
|
+
IClientConfiguration,
|
|
18
|
+
IClientDetails,
|
|
19
|
+
IDocumentMessage,
|
|
20
|
+
ISequencedDocumentMessage,
|
|
21
|
+
ISignalClient,
|
|
22
|
+
ISignalMessage,
|
|
24
23
|
} from "@fluidframework/protocol-definitions";
|
|
25
24
|
import { IContainerPackageInfo } from "@fluidframework/driver-definitions";
|
|
26
25
|
|
|
27
26
|
export enum ReconnectMode {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
Never = "Never",
|
|
28
|
+
Disabled = "Disabled",
|
|
29
|
+
Enabled = "Enabled",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface IConnectionStateChangeReason<T extends IErrorBase = IErrorBase> {
|
|
33
|
+
text: string;
|
|
34
|
+
error?: T;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Internal version of IConnectionDetails with props are only exposed internally
|
|
39
|
+
*/
|
|
40
|
+
export interface IConnectionDetailsInternal extends IConnectionDetails {
|
|
41
|
+
mode: ConnectionMode;
|
|
42
|
+
version: string;
|
|
43
|
+
initialClients: ISignalClient[];
|
|
44
|
+
reason: IConnectionStateChangeReason;
|
|
31
45
|
}
|
|
32
46
|
|
|
33
47
|
/**
|
|
@@ -35,130 +49,152 @@ export enum ReconnectMode {
|
|
|
35
49
|
* to relay service.
|
|
36
50
|
*/
|
|
37
51
|
export interface IConnectionManager {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
52
|
+
readonly connected: boolean;
|
|
53
|
+
|
|
54
|
+
readonly clientId: string | undefined;
|
|
55
|
+
|
|
56
|
+
/** The queue of outbound delta messages */
|
|
57
|
+
readonly outbound: IDeltaQueue<IDocumentMessage[]>;
|
|
58
|
+
|
|
59
|
+
/** Details of client */
|
|
60
|
+
readonly clientDetails: IClientDetails;
|
|
61
|
+
|
|
62
|
+
/** Protocol version being used to communicate with the service */
|
|
63
|
+
readonly version: string;
|
|
64
|
+
|
|
65
|
+
/** Max message size allowed to the delta manager */
|
|
66
|
+
readonly maxMessageSize: number;
|
|
67
|
+
|
|
68
|
+
/** Service configuration provided by the service. */
|
|
69
|
+
readonly serviceConfiguration: IClientConfiguration | undefined;
|
|
70
|
+
|
|
71
|
+
readonly readOnlyInfo: ReadOnlyInfo;
|
|
72
|
+
|
|
73
|
+
// Various connectivity properties for telemetry describing type of current connection
|
|
74
|
+
// Things like connection mode, service info, etc.
|
|
75
|
+
// Called when connection state changes (connect / disconnect)
|
|
76
|
+
readonly connectionProps: ITelemetryProperties;
|
|
77
|
+
|
|
78
|
+
// Verbose information about connection logged to telemetry in case of issues with
|
|
79
|
+
// maintaining healthy connection, including op gaps, not receiving join op in time, etc.
|
|
80
|
+
// Contains details information, like sequence numbers at connection time, initial ops info, etc.
|
|
81
|
+
readonly connectionVerboseProps: ITelemetryProperties;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Prepares message to be sent. Fills in clientSequenceNumber.
|
|
85
|
+
* Called only when active connection is present.
|
|
86
|
+
*/
|
|
87
|
+
prepareMessageToSend(
|
|
88
|
+
message: Omit<IDocumentMessage, "clientSequenceNumber">,
|
|
89
|
+
): IDocumentMessage | undefined;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Called before incoming message is processed. Incoming messages can be combing from connection,
|
|
93
|
+
* but also could come from storage.
|
|
94
|
+
* This call allows connection manager to adjust knowledge about acked ops sent on previous connection.
|
|
95
|
+
* Can be called at any time, including when there is no active connection.
|
|
96
|
+
*/
|
|
97
|
+
beforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Submits signal to relay service.
|
|
101
|
+
* Called only when active connection is present.
|
|
102
|
+
*/
|
|
103
|
+
submitSignal(content: any, targetClientId?: string): void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Submits messages to relay service.
|
|
107
|
+
* Called only when active connection is present.
|
|
108
|
+
*/
|
|
109
|
+
sendMessages(messages: IDocumentMessage[]): void;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Initiates connection to relay service (noop if already connected).
|
|
113
|
+
*/
|
|
114
|
+
connect(reason: IConnectionStateChangeReason, connectionMode?: ConnectionMode): void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Disposed connection manager
|
|
118
|
+
*/
|
|
119
|
+
dispose(error?: ICriticalContainerError, switchToReadonly?: boolean): void;
|
|
120
|
+
|
|
121
|
+
get connectionMode(): ConnectionMode;
|
|
106
122
|
}
|
|
107
123
|
|
|
108
124
|
/**
|
|
109
125
|
* This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation
|
|
110
|
-
* IConnectionManager instance will use them to communicate to DeltaManager
|
|
126
|
+
* IConnectionManager instance will use them to communicate to DeltaManager about various events.
|
|
111
127
|
*/
|
|
112
128
|
export interface IConnectionManagerFactoryArgs {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Called by connection manager for each incoming op. Some ops maybe delivered before
|
|
131
|
+
* connectHandler is called (initial ops on socket connection)
|
|
132
|
+
*/
|
|
133
|
+
readonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Called by connection manager for each incoming signal.
|
|
137
|
+
* May be called before connectHandler is called (due to initial signals on socket connection)
|
|
138
|
+
*/
|
|
139
|
+
readonly signalHandler: (signals: ISignalMessage[]) => void;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Called when connection manager experiences delay in connecting to relay service.
|
|
143
|
+
* This can happen because client is offline, or service is busy and asks to not connect for some time.
|
|
144
|
+
* Can be called many times while not connected.
|
|
145
|
+
* Situation is considered resolved when connection is established and connectHandler is called.
|
|
146
|
+
*/
|
|
147
|
+
readonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Called by connection manager whenever critical error happens and container should be closed.
|
|
151
|
+
* Expects dispose() call in response to this call.
|
|
152
|
+
*/
|
|
153
|
+
readonly closeHandler: (error?: any) => void;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Called whenever connection to relay service is lost.
|
|
157
|
+
*/
|
|
158
|
+
readonly disconnectHandler: (reason: IConnectionStateChangeReason) => void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Called whenever new connection to rely service is established
|
|
162
|
+
*/
|
|
163
|
+
readonly connectHandler: (connection: IConnectionDetailsInternal) => void;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Called whenever ping/pong messages are roundtripped on connection.
|
|
167
|
+
*/
|
|
168
|
+
readonly pongHandler: (latency: number) => void;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Called whenever connection type changes from writable to read-only or vice versa.
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
*
|
|
175
|
+
* Connection can be read-only if user has no edit permissions, or if container forced
|
|
176
|
+
* connection to be read-only.
|
|
177
|
+
* This should not be confused with "read" / "write"connection mode which is internal
|
|
178
|
+
* optimization.
|
|
179
|
+
*
|
|
180
|
+
* @param readonly - Whether or not the container is now read-only.
|
|
181
|
+
* `undefined` indicates that user permissions are not yet known.
|
|
182
|
+
* @param readonlyConnectionReason - reason/error if any for the change
|
|
183
|
+
*/
|
|
184
|
+
readonly readonlyChangeHandler: (
|
|
185
|
+
readonly?: boolean,
|
|
186
|
+
readonlyConnectionReason?: IConnectionStateChangeReason,
|
|
187
|
+
) => void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Called whenever we try to start establishing a new connection.
|
|
191
|
+
*/
|
|
192
|
+
readonly establishConnectionHandler: (reason: IConnectionStateChangeReason) => void;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Called whenever we cancel the connection in progress.
|
|
196
|
+
*/
|
|
197
|
+
readonly cancelConnectionHandler: (reason: IConnectionStateChangeReason) => void;
|
|
162
198
|
}
|
|
163
199
|
|
|
164
200
|
/**
|
|
@@ -166,14 +202,16 @@ export interface IConnectionManagerFactoryArgs {
|
|
|
166
202
|
* @param codeDetails- - Data structure used to describe the code to load on the Fluid document
|
|
167
203
|
* @returns The name of the Fluid package
|
|
168
204
|
*/
|
|
169
|
-
export const getPackageName = (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
205
|
+
export const getPackageName = (
|
|
206
|
+
codeDetails: IFluidCodeDetails | undefined,
|
|
207
|
+
): IContainerPackageInfo => {
|
|
208
|
+
let containerPackageName;
|
|
209
|
+
if (codeDetails && "name" in codeDetails) {
|
|
210
|
+
containerPackageName = codeDetails;
|
|
211
|
+
} else if (isFluidPackage(codeDetails?.package)) {
|
|
212
|
+
containerPackageName = codeDetails?.package.name;
|
|
213
|
+
} else {
|
|
214
|
+
containerPackageName = codeDetails?.package;
|
|
215
|
+
}
|
|
216
|
+
return { name: containerPackageName };
|
|
179
217
|
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ITelemetryBaseEvent,
|
|
8
|
+
ITelemetryBaseLogger,
|
|
9
|
+
ITelemetryProperties,
|
|
10
|
+
} from "@fluidframework/core-interfaces";
|
|
11
|
+
import { performance } from "@fluid-internal/client-utils";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
ITelemetryLoggerExt,
|
|
15
|
+
ITelemetryLoggerPropertyBags,
|
|
16
|
+
createMultiSinkLogger,
|
|
17
|
+
eventNamespaceSeparator,
|
|
18
|
+
formatTick,
|
|
19
|
+
} from "@fluidframework/telemetry-utils";
|
|
20
|
+
|
|
21
|
+
// This import style is necessary to ensure the emitted JS code works in both CJS and ESM.
|
|
22
|
+
import debugPkg from "debug";
|
|
23
|
+
const { debug: registerDebug } = debugPkg;
|
|
24
|
+
|
|
25
|
+
import type { IDebugger } from "debug";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Implementation of debug logger
|
|
29
|
+
*/
|
|
30
|
+
export class DebugLogger implements ITelemetryBaseLogger {
|
|
31
|
+
/**
|
|
32
|
+
* Mix in debug logger with another logger.
|
|
33
|
+
* Returned logger will output events to both newly created debug logger, as well as base logger
|
|
34
|
+
* @param namespace - Telemetry event name prefix to add to all events
|
|
35
|
+
* @param properties - Base properties to add to all events
|
|
36
|
+
* @param propertyGetters - Getters to add additional properties to all events
|
|
37
|
+
* @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.
|
|
38
|
+
*/
|
|
39
|
+
public static mixinDebugLogger(
|
|
40
|
+
namespace: string,
|
|
41
|
+
baseLogger?: ITelemetryBaseLogger,
|
|
42
|
+
properties?: ITelemetryLoggerPropertyBags,
|
|
43
|
+
): ITelemetryLoggerExt {
|
|
44
|
+
// Setup base logger upfront, such that host can disable it (if needed)
|
|
45
|
+
const debug = registerDebug(namespace);
|
|
46
|
+
|
|
47
|
+
// Create one for errors that is always enabled
|
|
48
|
+
// It can be silenced by replacing console.error if the debug namespace is not enabled.
|
|
49
|
+
const debugErr = registerDebug(namespace);
|
|
50
|
+
debugErr.log = function (...args) {
|
|
51
|
+
if (debug.enabled === true) {
|
|
52
|
+
// if the namespace is enabled, just use the default logger
|
|
53
|
+
registerDebug.log(...args);
|
|
54
|
+
} else {
|
|
55
|
+
// other wise, use the console logger (which could be replaced and silenced)
|
|
56
|
+
console.error(...args);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
debugErr.enabled = true;
|
|
60
|
+
|
|
61
|
+
return createMultiSinkLogger({
|
|
62
|
+
namespace,
|
|
63
|
+
loggers: [baseLogger, new DebugLogger(debug, debugErr)],
|
|
64
|
+
properties,
|
|
65
|
+
tryInheritProperties: true,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private constructor(
|
|
70
|
+
private readonly debug: IDebugger,
|
|
71
|
+
private readonly debugErr: IDebugger,
|
|
72
|
+
) {}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Send an event to debug loggers
|
|
76
|
+
*
|
|
77
|
+
* @param event - the event to send
|
|
78
|
+
*/
|
|
79
|
+
public send(event: ITelemetryBaseEvent): void {
|
|
80
|
+
const newEvent: ITelemetryProperties = { ...event };
|
|
81
|
+
const isError = newEvent.category === "error";
|
|
82
|
+
let logger = isError ? this.debugErr : this.debug;
|
|
83
|
+
|
|
84
|
+
// Use debug's coloring schema for base of the event
|
|
85
|
+
const index = event.eventName.lastIndexOf(eventNamespaceSeparator);
|
|
86
|
+
const name = event.eventName.substring(index + 1);
|
|
87
|
+
if (index > 0) {
|
|
88
|
+
logger = logger.extend(event.eventName.substring(0, index));
|
|
89
|
+
}
|
|
90
|
+
newEvent.eventName = undefined;
|
|
91
|
+
|
|
92
|
+
let tick = "";
|
|
93
|
+
tick = `tick=${formatTick(performance.now())}`;
|
|
94
|
+
|
|
95
|
+
// Extract stack to put it last, but also to avoid escaping '\n' in it by JSON.stringify below
|
|
96
|
+
const stack = newEvent.stack ?? "";
|
|
97
|
+
newEvent.stack = undefined;
|
|
98
|
+
|
|
99
|
+
// Watch out for circular references - they can come from two sources
|
|
100
|
+
// 1) error object - we do not control it and should remove it and retry
|
|
101
|
+
// 2) properties supplied by telemetry caller - that's a bug that should be addressed!
|
|
102
|
+
let payload: string;
|
|
103
|
+
try {
|
|
104
|
+
payload = JSON.stringify(newEvent);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
newEvent.error = undefined;
|
|
107
|
+
payload = JSON.stringify(newEvent);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (payload === "{}") {
|
|
111
|
+
payload = "";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Force errors out, to help with diagnostics
|
|
115
|
+
if (isError) {
|
|
116
|
+
logger.enabled = true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Print multi-line.
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
121
|
+
logger(`${name} ${payload} ${tick} ${stack}`);
|
|
122
|
+
}
|
|
123
|
+
}
|