@fluidframework/container-loader 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419
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-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 +3 -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} +3 -10
- 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} +23 -33
- 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} +3 -5
- 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} +45 -17
- 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} +54 -18
- 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} +3 -4
- 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} +39 -20
- 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} +1 -1
- package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
- 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} +8 -4
- 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} +7 -5
- 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 +163 -70
- 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.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/dist/contracts.d.ts
CHANGED
|
@@ -2,15 +2,28 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryProperties } from "@fluidframework/
|
|
6
|
-
import {
|
|
7
|
-
import { ConnectionMode, IDocumentMessage, ISequencedDocumentMessage,
|
|
5
|
+
import { IErrorBase, ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IConnectionDetails, ICriticalContainerError, IDeltaQueue, IFluidCodeDetails, ReadOnlyInfo } from "@fluidframework/container-definitions";
|
|
7
|
+
import { ConnectionMode, IClientConfiguration, IClientDetails, IDocumentMessage, ISequencedDocumentMessage, ISignalClient, ISignalMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { IContainerPackageInfo } from "@fluidframework/driver-definitions";
|
|
9
9
|
export declare enum ReconnectMode {
|
|
10
10
|
Never = "Never",
|
|
11
11
|
Disabled = "Disabled",
|
|
12
12
|
Enabled = "Enabled"
|
|
13
13
|
}
|
|
14
|
+
export interface IConnectionStateChangeReason<T extends IErrorBase = IErrorBase> {
|
|
15
|
+
text: string;
|
|
16
|
+
error?: T;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Internal version of IConnectionDetails with props are only exposed internally
|
|
20
|
+
*/
|
|
21
|
+
export interface IConnectionDetailsInternal extends IConnectionDetails {
|
|
22
|
+
mode: ConnectionMode;
|
|
23
|
+
version: string;
|
|
24
|
+
initialClients: ISignalClient[];
|
|
25
|
+
reason: IConnectionStateChangeReason;
|
|
26
|
+
}
|
|
14
27
|
/**
|
|
15
28
|
* Connection manager (implements this interface) is responsible for maintaining connection
|
|
16
29
|
* to relay service.
|
|
@@ -37,7 +50,7 @@ export interface IConnectionManager {
|
|
|
37
50
|
*/
|
|
38
51
|
prepareMessageToSend(message: Omit<IDocumentMessage, "clientSequenceNumber">): IDocumentMessage | undefined;
|
|
39
52
|
/**
|
|
40
|
-
* Called before
|
|
53
|
+
* Called before incoming message is processed. Incoming messages can be combing from connection,
|
|
41
54
|
* but also could come from storage.
|
|
42
55
|
* This call allows connection manager to adjust knowledge about acked ops sent on previous connection.
|
|
43
56
|
* Can be called at any time, including when there is no active connection.
|
|
@@ -47,7 +60,7 @@ export interface IConnectionManager {
|
|
|
47
60
|
* Submits signal to relay service.
|
|
48
61
|
* Called only when active connection is present.
|
|
49
62
|
*/
|
|
50
|
-
submitSignal(content: any): void;
|
|
63
|
+
submitSignal(content: any, targetClientId?: string): void;
|
|
51
64
|
/**
|
|
52
65
|
* Submits messages to relay service.
|
|
53
66
|
* Called only when active connection is present.
|
|
@@ -56,28 +69,28 @@ export interface IConnectionManager {
|
|
|
56
69
|
/**
|
|
57
70
|
* Initiates connection to relay service (noop if already connected).
|
|
58
71
|
*/
|
|
59
|
-
connect(connectionMode?: ConnectionMode): void;
|
|
72
|
+
connect(reason: IConnectionStateChangeReason, connectionMode?: ConnectionMode): void;
|
|
60
73
|
/**
|
|
61
74
|
* Disposed connection manager
|
|
62
75
|
*/
|
|
63
|
-
dispose(error?: ICriticalContainerError): void;
|
|
76
|
+
dispose(error?: ICriticalContainerError, switchToReadonly?: boolean): void;
|
|
64
77
|
get connectionMode(): ConnectionMode;
|
|
65
78
|
}
|
|
66
79
|
/**
|
|
67
80
|
* This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation
|
|
68
|
-
* IConnectionManager instance will use them to communicate to DeltaManager
|
|
81
|
+
* IConnectionManager instance will use them to communicate to DeltaManager about various events.
|
|
69
82
|
*/
|
|
70
83
|
export interface IConnectionManagerFactoryArgs {
|
|
71
84
|
/**
|
|
72
|
-
* Called by connection manager for each
|
|
85
|
+
* Called by connection manager for each incoming op. Some ops maybe delivered before
|
|
73
86
|
* connectHandler is called (initial ops on socket connection)
|
|
74
87
|
*/
|
|
75
88
|
readonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;
|
|
76
89
|
/**
|
|
77
|
-
* Called by connection manager for each incoming
|
|
78
|
-
*
|
|
90
|
+
* Called by connection manager for each incoming signal.
|
|
91
|
+
* May be called before connectHandler is called (due to initial signals on socket connection)
|
|
79
92
|
*/
|
|
80
|
-
readonly signalHandler: (
|
|
93
|
+
readonly signalHandler: (signals: ISignalMessage[]) => void;
|
|
81
94
|
/**
|
|
82
95
|
* Called when connection manager experiences delay in connecting to relay service.
|
|
83
96
|
* This can happen because client is offline, or service is busy and asks to not connect for some time.
|
|
@@ -86,30 +99,45 @@ export interface IConnectionManagerFactoryArgs {
|
|
|
86
99
|
*/
|
|
87
100
|
readonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;
|
|
88
101
|
/**
|
|
89
|
-
* Called by connection manager
|
|
90
|
-
* Expects dispose() call in
|
|
102
|
+
* Called by connection manager whenever critical error happens and container should be closed.
|
|
103
|
+
* Expects dispose() call in response to this call.
|
|
91
104
|
*/
|
|
92
105
|
readonly closeHandler: (error?: any) => void;
|
|
93
106
|
/**
|
|
94
107
|
* Called whenever connection to relay service is lost.
|
|
95
108
|
*/
|
|
96
|
-
readonly disconnectHandler: (reason:
|
|
109
|
+
readonly disconnectHandler: (reason: IConnectionStateChangeReason) => void;
|
|
97
110
|
/**
|
|
98
111
|
* Called whenever new connection to rely service is established
|
|
99
112
|
*/
|
|
100
|
-
readonly connectHandler: (connection:
|
|
113
|
+
readonly connectHandler: (connection: IConnectionDetailsInternal) => void;
|
|
101
114
|
/**
|
|
102
115
|
* Called whenever ping/pong messages are roundtripped on connection.
|
|
103
116
|
*/
|
|
104
117
|
readonly pongHandler: (latency: number) => void;
|
|
105
118
|
/**
|
|
106
119
|
* Called whenever connection type changes from writable to read-only or vice versa.
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
*
|
|
107
123
|
* Connection can be read-only if user has no edit permissions, or if container forced
|
|
108
124
|
* connection to be read-only.
|
|
109
125
|
* This should not be confused with "read" / "write"connection mode which is internal
|
|
110
126
|
* optimization.
|
|
127
|
+
*
|
|
128
|
+
* @param readonly - Whether or not the container is now read-only.
|
|
129
|
+
* `undefined` indicates that user permissions are not yet known.
|
|
130
|
+
* @param readonlyConnectionReason - reason/error if any for the change
|
|
131
|
+
*/
|
|
132
|
+
readonly readonlyChangeHandler: (readonly?: boolean, readonlyConnectionReason?: IConnectionStateChangeReason) => void;
|
|
133
|
+
/**
|
|
134
|
+
* Called whenever we try to start establishing a new connection.
|
|
135
|
+
*/
|
|
136
|
+
readonly establishConnectionHandler: (reason: IConnectionStateChangeReason) => void;
|
|
137
|
+
/**
|
|
138
|
+
* Called whenever we cancel the connection in progress.
|
|
111
139
|
*/
|
|
112
|
-
readonly
|
|
140
|
+
readonly cancelConnectionHandler: (reason: IConnectionStateChangeReason) => void;
|
|
113
141
|
}
|
|
114
142
|
/**
|
|
115
143
|
*
|
package/dist/contracts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,oBAAY,aAAa;IACxB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,OAAO,YAAY;CACnB;AAED,MAAM,WAAW,4BAA4B,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,CAAC,CAAC;CACV;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACrE,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,aAAa,EAAE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
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.DebugLogger = void 0;
|
|
11
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
12
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
13
|
+
// This import style is necessary to ensure the emitted JS code works in both CJS and ESM.
|
|
14
|
+
const debug_1 = __importDefault(require("debug"));
|
|
15
|
+
const { debug: registerDebug } = debug_1.default;
|
|
16
|
+
/**
|
|
17
|
+
* Implementation of debug logger
|
|
18
|
+
*/
|
|
19
|
+
class DebugLogger {
|
|
20
|
+
/**
|
|
21
|
+
* Mix in debug logger with another logger.
|
|
22
|
+
* Returned logger will output events to both newly created debug logger, as well as base logger
|
|
23
|
+
* @param namespace - Telemetry event name prefix to add to all events
|
|
24
|
+
* @param properties - Base properties to add to all events
|
|
25
|
+
* @param propertyGetters - Getters to add additional properties to all events
|
|
26
|
+
* @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.
|
|
27
|
+
*/
|
|
28
|
+
static mixinDebugLogger(namespace, baseLogger, properties) {
|
|
29
|
+
// Setup base logger upfront, such that host can disable it (if needed)
|
|
30
|
+
const debug = registerDebug(namespace);
|
|
31
|
+
// Create one for errors that is always enabled
|
|
32
|
+
// It can be silenced by replacing console.error if the debug namespace is not enabled.
|
|
33
|
+
const debugErr = registerDebug(namespace);
|
|
34
|
+
debugErr.log = function (...args) {
|
|
35
|
+
if (debug.enabled === true) {
|
|
36
|
+
// if the namespace is enabled, just use the default logger
|
|
37
|
+
registerDebug.log(...args);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// other wise, use the console logger (which could be replaced and silenced)
|
|
41
|
+
console.error(...args);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
debugErr.enabled = true;
|
|
45
|
+
return (0, telemetry_utils_1.createMultiSinkLogger)({
|
|
46
|
+
namespace,
|
|
47
|
+
loggers: [baseLogger, new DebugLogger(debug, debugErr)],
|
|
48
|
+
properties,
|
|
49
|
+
tryInheritProperties: true,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
constructor(debug, debugErr) {
|
|
53
|
+
this.debug = debug;
|
|
54
|
+
this.debugErr = debugErr;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Send an event to debug loggers
|
|
58
|
+
*
|
|
59
|
+
* @param event - the event to send
|
|
60
|
+
*/
|
|
61
|
+
send(event) {
|
|
62
|
+
const newEvent = { ...event };
|
|
63
|
+
const isError = newEvent.category === "error";
|
|
64
|
+
let logger = isError ? this.debugErr : this.debug;
|
|
65
|
+
// Use debug's coloring schema for base of the event
|
|
66
|
+
const index = event.eventName.lastIndexOf(telemetry_utils_1.eventNamespaceSeparator);
|
|
67
|
+
const name = event.eventName.substring(index + 1);
|
|
68
|
+
if (index > 0) {
|
|
69
|
+
logger = logger.extend(event.eventName.substring(0, index));
|
|
70
|
+
}
|
|
71
|
+
newEvent.eventName = undefined;
|
|
72
|
+
let tick = "";
|
|
73
|
+
tick = `tick=${(0, telemetry_utils_1.formatTick)(client_utils_1.performance.now())}`;
|
|
74
|
+
// Extract stack to put it last, but also to avoid escaping '\n' in it by JSON.stringify below
|
|
75
|
+
const stack = newEvent.stack ?? "";
|
|
76
|
+
newEvent.stack = undefined;
|
|
77
|
+
// Watch out for circular references - they can come from two sources
|
|
78
|
+
// 1) error object - we do not control it and should remove it and retry
|
|
79
|
+
// 2) properties supplied by telemetry caller - that's a bug that should be addressed!
|
|
80
|
+
let payload;
|
|
81
|
+
try {
|
|
82
|
+
payload = JSON.stringify(newEvent);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
newEvent.error = undefined;
|
|
86
|
+
payload = JSON.stringify(newEvent);
|
|
87
|
+
}
|
|
88
|
+
if (payload === "{}") {
|
|
89
|
+
payload = "";
|
|
90
|
+
}
|
|
91
|
+
// Force errors out, to help with diagnostics
|
|
92
|
+
if (isError) {
|
|
93
|
+
logger.enabled = true;
|
|
94
|
+
}
|
|
95
|
+
// Print multi-line.
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
97
|
+
logger(`${name} ${payload} ${tick} ${stack}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.DebugLogger = DebugLogger;
|
|
101
|
+
//# sourceMappingURL=debugLogger.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugLogger.cjs","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAOH,+DAA2D;AAE3D,qEAMyC;AAEzC,0FAA0F;AAC1F,kDAA6B;AAC7B,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,eAAQ,CAAC;AAI1C;;GAEG;AACH,MAAa,WAAW;IACvB;;;;;;;OAOG;IACI,MAAM,CAAC,gBAAgB,CAC7B,SAAiB,EACjB,UAAiC,EACjC,UAAyC;QAEzC,uEAAuE;QACvE,MAAM,KAAK,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAEvC,+CAA+C;QAC/C,uFAAuF;QACvF,MAAM,QAAQ,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAC1C,QAAQ,CAAC,GAAG,GAAG,UAAU,GAAG,IAAI;YAC/B,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE;gBAC3B,2DAA2D;gBAC3D,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;aAC3B;iBAAM;gBACN,4EAA4E;gBAC5E,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC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;QACnC,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC;QAE3B,qEAAqE;QACrE,wEAAwE;QACxE,sFAAsF;QACtF,IAAI,OAAe,CAAC;QACpB,IAAI;YACH,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACnC;QAAC,OAAO,KAAK,EAAE;YACf,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC;YAC3B,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACnC;QAED,IAAI,OAAO,KAAK,IAAI,EAAE;YACrB,OAAO,GAAG,EAAE,CAAC;SACb;QAED,6CAA6C;QAC7C,IAAI,OAAO,EAAE;YACZ,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;SACtB;QAED,oBAAoB;QACpB,gEAAgE;QAChE,MAAM,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC;CACD;AA7FD,kCA6FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n\tITelemetryProperties,\n} from \"@fluidframework/core-interfaces\";\nimport { performance } from \"@fluid-internal/client-utils\";\n\nimport {\n\tITelemetryLoggerExt,\n\tITelemetryLoggerPropertyBags,\n\tcreateMultiSinkLogger,\n\teventNamespaceSeparator,\n\tformatTick,\n} from \"@fluidframework/telemetry-utils\";\n\n// This import style is necessary to ensure the emitted JS code works in both CJS and ESM.\nimport debugPkg from \"debug\";\nconst { debug: registerDebug } = debugPkg;\n\nimport type { IDebugger } from \"debug\";\n\n/**\n * Implementation of debug logger\n */\nexport class DebugLogger implements ITelemetryBaseLogger {\n\t/**\n\t * Mix in debug logger with another logger.\n\t * Returned logger will output events to both newly created debug logger, as well as base logger\n\t * @param namespace - Telemetry event name prefix to add to all events\n\t * @param properties - Base properties to add to all events\n\t * @param propertyGetters - Getters to add additional properties to all events\n\t * @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.\n\t */\n\tpublic static mixinDebugLogger(\n\t\tnamespace: string,\n\t\tbaseLogger?: ITelemetryBaseLogger,\n\t\tproperties?: ITelemetryLoggerPropertyBags,\n\t): ITelemetryLoggerExt {\n\t\t// Setup base logger upfront, such that host can disable it (if needed)\n\t\tconst debug = registerDebug(namespace);\n\n\t\t// Create one for errors that is always enabled\n\t\t// It can be silenced by replacing console.error if the debug namespace is not enabled.\n\t\tconst debugErr = registerDebug(namespace);\n\t\tdebugErr.log = function (...args) {\n\t\t\tif (debug.enabled === true) {\n\t\t\t\t// if the namespace is enabled, just use the default logger\n\t\t\t\tregisterDebug.log(...args);\n\t\t\t} else {\n\t\t\t\t// other wise, use the console logger (which could be replaced and silenced)\n\t\t\t\tconsole.error(...args);\n\t\t\t}\n\t\t};\n\t\tdebugErr.enabled = true;\n\n\t\treturn createMultiSinkLogger({\n\t\t\tnamespace,\n\t\t\tloggers: [baseLogger, new DebugLogger(debug, debugErr)],\n\t\t\tproperties,\n\t\t\ttryInheritProperties: true,\n\t\t});\n\t}\n\n\tprivate constructor(\n\t\tprivate readonly debug: IDebugger,\n\t\tprivate readonly debugErr: IDebugger,\n\t) {}\n\n\t/**\n\t * Send an event to debug loggers\n\t *\n\t * @param event - the event to send\n\t */\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\tconst newEvent: ITelemetryProperties = { ...event };\n\t\tconst isError = newEvent.category === \"error\";\n\t\tlet logger = isError ? this.debugErr : this.debug;\n\n\t\t// Use debug's coloring schema for base of the event\n\t\tconst index = event.eventName.lastIndexOf(eventNamespaceSeparator);\n\t\tconst name = event.eventName.substring(index + 1);\n\t\tif (index > 0) {\n\t\t\tlogger = logger.extend(event.eventName.substring(0, index));\n\t\t}\n\t\tnewEvent.eventName = undefined;\n\n\t\tlet tick = \"\";\n\t\ttick = `tick=${formatTick(performance.now())}`;\n\n\t\t// Extract stack to put it last, but also to avoid escaping '\\n' in it by JSON.stringify below\n\t\tconst stack = newEvent.stack ?? \"\";\n\t\tnewEvent.stack = undefined;\n\n\t\t// Watch out for circular references - they can come from two sources\n\t\t// 1) error object - we do not control it and should remove it and retry\n\t\t// 2) properties supplied by telemetry caller - that's a bug that should be addressed!\n\t\tlet payload: string;\n\t\ttry {\n\t\t\tpayload = JSON.stringify(newEvent);\n\t\t} catch (error) {\n\t\t\tnewEvent.error = undefined;\n\t\t\tpayload = JSON.stringify(newEvent);\n\t\t}\n\n\t\tif (payload === \"{}\") {\n\t\t\tpayload = \"\";\n\t\t}\n\n\t\t// Force errors out, to help with diagnostics\n\t\tif (isError) {\n\t\t\tlogger.enabled = true;\n\t\t}\n\n\t\t// Print multi-line.\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tlogger(`${name} ${payload} ${tick} ${stack}`);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { ITelemetryLoggerExt, ITelemetryLoggerPropertyBags } from "@fluidframework/telemetry-utils";
|
|
7
|
+
/**
|
|
8
|
+
* Implementation of debug logger
|
|
9
|
+
*/
|
|
10
|
+
export declare class DebugLogger implements ITelemetryBaseLogger {
|
|
11
|
+
private readonly debug;
|
|
12
|
+
private readonly debugErr;
|
|
13
|
+
/**
|
|
14
|
+
* Mix in debug logger with another logger.
|
|
15
|
+
* Returned logger will output events to both newly created debug logger, as well as base logger
|
|
16
|
+
* @param namespace - Telemetry event name prefix to add to all events
|
|
17
|
+
* @param properties - Base properties to add to all events
|
|
18
|
+
* @param propertyGetters - Getters to add additional properties to all events
|
|
19
|
+
* @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.
|
|
20
|
+
*/
|
|
21
|
+
static mixinDebugLogger(namespace: string, baseLogger?: ITelemetryBaseLogger, properties?: ITelemetryLoggerPropertyBags): ITelemetryLoggerExt;
|
|
22
|
+
private constructor();
|
|
23
|
+
/**
|
|
24
|
+
* Send an event to debug loggers
|
|
25
|
+
*
|
|
26
|
+
* @param event - the event to send
|
|
27
|
+
*/
|
|
28
|
+
send(event: ITelemetryBaseEvent): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=debugLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugLogger.d.ts","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EAEpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAI5B,MAAM,iCAAiC,CAAC;AAQzC;;GAEG;AACH,qBAAa,WAAY,YAAW,oBAAoB;IAwCtD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAxC1B;;;;;;;OAOG;WACW,gBAAgB,CAC7B,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,oBAAoB,EACjC,UAAU,CAAC,EAAE,4BAA4B,GACvC,mBAAmB;IA0BtB,OAAO;IAKP;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CA4C7C"}
|