@fluidframework/container-loader 0.52.0 → 0.54.0-47413
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/dist/connectionManager.d.ts +153 -0
- package/dist/connectionManager.d.ts.map +1 -0
- package/dist/connectionManager.js +664 -0
- package/dist/connectionManager.js.map +1 -0
- package/dist/connectionStateHandler.d.ts +1 -0
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +6 -0
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +2 -22
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +121 -151
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +1 -0
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +4 -0
- package/dist/containerContext.js.map +1 -1
- package/dist/contracts.d.ts +112 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +14 -0
- package/dist/contracts.js.map +1 -0
- package/dist/deltaManager.d.ts +26 -142
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +143 -770
- package/dist/deltaManager.js.map +1 -1
- package/dist/loader.d.ts +14 -4
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +10 -4
- package/dist/loader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/connectionManager.d.ts +153 -0
- package/lib/connectionManager.d.ts.map +1 -0
- package/lib/connectionManager.js +660 -0
- package/lib/connectionManager.js.map +1 -0
- package/lib/connectionStateHandler.d.ts +1 -0
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +6 -0
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +2 -22
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +122 -152
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +1 -0
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +4 -0
- package/lib/containerContext.js.map +1 -1
- package/lib/contracts.d.ts +112 -0
- package/lib/contracts.d.ts.map +1 -0
- package/lib/contracts.js +11 -0
- package/lib/contracts.js.map +1 -0
- package/lib/deltaManager.d.ts +26 -142
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +147 -774
- package/lib/deltaManager.js.map +1 -1
- package/lib/loader.d.ts +14 -4
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +11 -5
- package/lib/loader.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/connectionManager.ts +892 -0
- package/src/connectionStateHandler.ts +8 -0
- package/src/container.ts +165 -187
- package/src/containerContext.ts +4 -0
- package/src/contracts.ts +156 -0
- package/src/deltaManager.ts +181 -978
- package/src/loader.ts +59 -27
- package/src/packageVersion.ts +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ITelemetryLogger, ITelemetryProperties } from "@fluidframework/common-definitions";
|
|
6
|
+
import { IDeltaQueue, ReadOnlyInfo } from "@fluidframework/container-definitions";
|
|
7
|
+
import { IDocumentService } from "@fluidframework/driver-definitions";
|
|
8
|
+
import { ConnectionMode, IClient, IClientConfiguration, IClientDetails, IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
9
|
+
import { ReconnectMode, IConnectionManager, IConnectionManagerFactoryArgs } from "./contracts";
|
|
10
|
+
/**
|
|
11
|
+
* Implementation of IConnectionManager, used by Container class
|
|
12
|
+
* Implements constant connectivity to relay service, by reconnecting in case of loast connection or error.
|
|
13
|
+
* Exposes various controls to influecen this process, including manual reconnects, forced read-only mode, etc.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ConnectionManager implements IConnectionManager {
|
|
16
|
+
private readonly serviceProvider;
|
|
17
|
+
private client;
|
|
18
|
+
private readonly logger;
|
|
19
|
+
private readonly props;
|
|
20
|
+
/** Connection mode used when reconnecting on error or disconnect. */
|
|
21
|
+
private readonly defaultReconnectionMode;
|
|
22
|
+
private pendingConnection;
|
|
23
|
+
private connection;
|
|
24
|
+
/** file ACL - whether user has only read-only access to a file */
|
|
25
|
+
private _readonlyPermissions;
|
|
26
|
+
/** tracks host requiring read-only mode. */
|
|
27
|
+
private _forceReadonly;
|
|
28
|
+
/**
|
|
29
|
+
* Controls whether the DeltaManager will automatically reconnect to the delta stream after receiving a disconnect.
|
|
30
|
+
*/
|
|
31
|
+
private _reconnectMode;
|
|
32
|
+
/** True if there is pending (async) reconnection from "read" to "write" */
|
|
33
|
+
private pendingReconnect;
|
|
34
|
+
/** downgrade "write" connection to "read" */
|
|
35
|
+
private downgradedConnection;
|
|
36
|
+
private clientSequenceNumber;
|
|
37
|
+
private clientSequenceNumberObserved;
|
|
38
|
+
/** Counts the number of noops sent by the client which may not be acked. */
|
|
39
|
+
private trailingNoopCount;
|
|
40
|
+
/** track clientId used last time when we sent any ops */
|
|
41
|
+
private lastSubmittedClientId;
|
|
42
|
+
private connectFirstConnection;
|
|
43
|
+
private _connectionVerboseProps;
|
|
44
|
+
private _connectionProps;
|
|
45
|
+
private closed;
|
|
46
|
+
private readonly _outbound;
|
|
47
|
+
get connectionVerboseProps(): Record<string, string | number>;
|
|
48
|
+
readonly clientDetails: IClientDetails;
|
|
49
|
+
/**
|
|
50
|
+
* The current connection mode, initially read.
|
|
51
|
+
*/
|
|
52
|
+
get connectionMode(): ConnectionMode;
|
|
53
|
+
get connected(): boolean;
|
|
54
|
+
get clientId(): string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Automatic reconnecting enabled or disabled.
|
|
57
|
+
* If set to Never, then reconnecting will never be allowed.
|
|
58
|
+
*/
|
|
59
|
+
get reconnectMode(): ReconnectMode;
|
|
60
|
+
get maxMessageSize(): number;
|
|
61
|
+
get version(): string;
|
|
62
|
+
get serviceConfiguration(): IClientConfiguration | undefined;
|
|
63
|
+
get scopes(): string[] | undefined;
|
|
64
|
+
get outbound(): IDeltaQueue<IDocumentMessage[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns set of props that can be logged in telemetry that provide some insights / statistics
|
|
67
|
+
* about current or last connection (if there is no connection at the moment)
|
|
68
|
+
*/
|
|
69
|
+
get connectionProps(): ITelemetryProperties;
|
|
70
|
+
shouldJoinWrite(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Tells if container is in read-only mode.
|
|
73
|
+
* Data stores should listen for "readonly" notifications and disallow user
|
|
74
|
+
* making changes to data stores.
|
|
75
|
+
* Readonly state can be because of no storage write permission,
|
|
76
|
+
* or due to host forcing readonly mode for container.
|
|
77
|
+
* It is undefined if we have not yet established websocket connection
|
|
78
|
+
* and do not know if user has write access to a file.
|
|
79
|
+
*/
|
|
80
|
+
private get readonly();
|
|
81
|
+
get readOnlyInfo(): ReadOnlyInfo;
|
|
82
|
+
private static detailsFromConnection;
|
|
83
|
+
constructor(serviceProvider: () => IDocumentService | undefined, client: IClient, reconnectAllowed: boolean, logger: ITelemetryLogger, props: IConnectionManagerFactoryArgs);
|
|
84
|
+
dispose(error: any): void;
|
|
85
|
+
/**
|
|
86
|
+
* Enables or disables automatic reconnecting.
|
|
87
|
+
* Will throw an error if reconnectMode set to Never.
|
|
88
|
+
*/
|
|
89
|
+
setAutoReconnect(mode: ReconnectMode): void;
|
|
90
|
+
/**
|
|
91
|
+
* Sends signal to runtime (and data stores) to be read-only.
|
|
92
|
+
* Hosts may have read only views, indicating to data stores that no edits are allowed.
|
|
93
|
+
* This is independent from this._readonlyPermissions (permissions) and this.connectionMode
|
|
94
|
+
* (server can return "write" mode even when asked for "read")
|
|
95
|
+
* Leveraging same "readonly" event as runtime & data stores should behave the same in such case
|
|
96
|
+
* as in read-only permissions.
|
|
97
|
+
* But this.active can be used by some DDSes to figure out if ops can be sent
|
|
98
|
+
* (for example, read-only view still participates in code proposals / upgrades decisions)
|
|
99
|
+
*
|
|
100
|
+
* Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
|
|
101
|
+
* the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
|
|
102
|
+
* there are pending in the outbound queue, it will stop sending until force readonly is
|
|
103
|
+
* cleared.
|
|
104
|
+
*
|
|
105
|
+
* @param readonly - set or clear force readonly.
|
|
106
|
+
*/
|
|
107
|
+
forceReadonly(readonly: boolean): void;
|
|
108
|
+
private set_readonlyPermissions;
|
|
109
|
+
connect(connectionMode?: ConnectionMode): void;
|
|
110
|
+
private connectCore;
|
|
111
|
+
/**
|
|
112
|
+
* Start the connection. Any error should result in container being close.
|
|
113
|
+
* And report the error if it excape for any reason.
|
|
114
|
+
* @param args - The connection arguments
|
|
115
|
+
*/
|
|
116
|
+
private triggerConnect;
|
|
117
|
+
/**
|
|
118
|
+
* Disconnect the current connection.
|
|
119
|
+
* @param reason - Text description of disconnect reason to emit with disconnect event
|
|
120
|
+
*/
|
|
121
|
+
private disconnectFromDeltaStream;
|
|
122
|
+
/**
|
|
123
|
+
* Once we've successfully gotten a connection, we need to set up state, attach event listeners, and process
|
|
124
|
+
* initial messages.
|
|
125
|
+
* @param connection - The newly established connection
|
|
126
|
+
*/
|
|
127
|
+
private setupNewSuccessfulConnection;
|
|
128
|
+
/**
|
|
129
|
+
* Disconnect the current connection and reconnect.
|
|
130
|
+
* @param connection - The connection that wants to reconnect - no-op if it's different from this.connection
|
|
131
|
+
* @param requestedMode - Read or write
|
|
132
|
+
* @param error - Error reconnect information including whether or not to reconnect
|
|
133
|
+
* @returns A promise that resolves when the connection is reestablished or we stop trying
|
|
134
|
+
*/
|
|
135
|
+
private reconnectOnError;
|
|
136
|
+
/**
|
|
137
|
+
* Disconnect the current connection and reconnect.
|
|
138
|
+
* @param connection - The connection that wants to reconnect - no-op if it's different from this.connection
|
|
139
|
+
* @param requestedMode - Read or write
|
|
140
|
+
* @param error - Error reconnect information including whether or not to reconnect
|
|
141
|
+
* @returns A promise that resolves when the connection is reestablished or we stop trying
|
|
142
|
+
*/
|
|
143
|
+
private reconnectOnErrorCore;
|
|
144
|
+
prepareMessageToSend(message: Omit<IDocumentMessage, "clientSequenceNumber">): IDocumentMessage | undefined;
|
|
145
|
+
submitSignal(content: any): void;
|
|
146
|
+
sendMessages(messages: IDocumentMessage[]): void;
|
|
147
|
+
beforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;
|
|
148
|
+
private readonly opHandler;
|
|
149
|
+
private readonly nackHandler;
|
|
150
|
+
private readonly disconnectHandlerInternal;
|
|
151
|
+
private readonly errorHandler;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=connectionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,gBAAgB,EAChB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,WAAW,EACX,YAAY,EAEf,MAAM,uCAAuC,CAAC;AAO/C,OAAO,EACH,gBAAgB,EAInB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,cAAc,EACd,OAAO,EACP,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAGhB,yBAAyB,EAO5B,MAAM,sCAAsC,CAAC;AAe9C,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,6BAA6B,EAChC,MAAM,aAAa,CAAC;AAmErB;;;;GAIG;AACH,q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