@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
package/src/contracts.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ITelemetryProperties,
|
|
8
|
+
} from "@fluidframework/common-definitions";
|
|
9
|
+
import {
|
|
10
|
+
IDeltaQueue,
|
|
11
|
+
ReadOnlyInfo,
|
|
12
|
+
IConnectionDetails,
|
|
13
|
+
} from "@fluidframework/container-definitions";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionMode,
|
|
16
|
+
IDocumentMessage,
|
|
17
|
+
ISequencedDocumentMessage,
|
|
18
|
+
IClientConfiguration,
|
|
19
|
+
IClientDetails,
|
|
20
|
+
ISignalMessage,
|
|
21
|
+
} from "@fluidframework/protocol-definitions";
|
|
22
|
+
|
|
23
|
+
export enum ReconnectMode {
|
|
24
|
+
Never = "Never",
|
|
25
|
+
Disabled = "Disabled",
|
|
26
|
+
Enabled = "Enabled",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Connection manager (implements this interface) is responsible for maintaining connection
|
|
31
|
+
* to relay service.
|
|
32
|
+
*/
|
|
33
|
+
export interface IConnectionManager {
|
|
34
|
+
readonly connected: boolean;
|
|
35
|
+
|
|
36
|
+
readonly clientId: string | undefined;
|
|
37
|
+
|
|
38
|
+
/** The queue of outbound delta messages */
|
|
39
|
+
readonly outbound: IDeltaQueue<IDocumentMessage[]>;
|
|
40
|
+
|
|
41
|
+
/** Details of client */
|
|
42
|
+
readonly clientDetails: IClientDetails;
|
|
43
|
+
|
|
44
|
+
/** Protocol version being used to communicate with the service */
|
|
45
|
+
readonly version: string;
|
|
46
|
+
|
|
47
|
+
/** Max message size allowed to the delta manager */
|
|
48
|
+
readonly maxMessageSize: number;
|
|
49
|
+
|
|
50
|
+
/** Service configuration provided by the service. */
|
|
51
|
+
readonly serviceConfiguration: IClientConfiguration | undefined;
|
|
52
|
+
|
|
53
|
+
readonly readOnlyInfo: ReadOnlyInfo;
|
|
54
|
+
|
|
55
|
+
// Various connectivity propetries for telemetry describing type of current connection
|
|
56
|
+
// Things like connection mode, service info, etc.
|
|
57
|
+
// Called when connection state changes (connect / disconnect)
|
|
58
|
+
readonly connectionProps: ITelemetryProperties;
|
|
59
|
+
|
|
60
|
+
// Verbose information about connection logged to telemetry in case of issues with
|
|
61
|
+
// maintaining healphy connection, including op gaps, not receiving join op in time, etc.
|
|
62
|
+
// Contains details information, like sequence numbers at connection time, initial ops info, etc.
|
|
63
|
+
readonly connectionVerboseProps: ITelemetryProperties;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Prepares message to be sent. Fills in clientSequenceNumber.
|
|
67
|
+
* Called only when active connection is present.
|
|
68
|
+
*/
|
|
69
|
+
prepareMessageToSend(message: Omit<IDocumentMessage, "clientSequenceNumber">): IDocumentMessage | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Called before incomming message is processed. Incomming messages can be comming from connection,
|
|
73
|
+
* but also could come from storage.
|
|
74
|
+
* This call allows connection manager to adjust knowledge about acked ops sent on previous connection.
|
|
75
|
+
* Can be called at any time, including when there is no active connection.
|
|
76
|
+
*/
|
|
77
|
+
beforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Submits signal to relay service.
|
|
81
|
+
* Called only when active connection is present.
|
|
82
|
+
*/
|
|
83
|
+
submitSignal(content: any): void;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Submits messages to relay service.
|
|
87
|
+
* Called only when active connection is present.
|
|
88
|
+
*/
|
|
89
|
+
sendMessages(messages: IDocumentMessage[]): void;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Initiates connection to relay service (noop if already connected).
|
|
93
|
+
*/
|
|
94
|
+
connect(connectionMode?: ConnectionMode): void;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Disposed connection manager
|
|
98
|
+
*/
|
|
99
|
+
dispose(error: any): void;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation
|
|
104
|
+
* IConnectionManager instance will use them to communicate to DeltaManager abour various events.
|
|
105
|
+
*/
|
|
106
|
+
export interface IConnectionManagerFactoryArgs {
|
|
107
|
+
/**
|
|
108
|
+
* Called by connection manager for each incomming op. Some ops maybe delivered before
|
|
109
|
+
* connectHandler is called (initial ops on socket connection)
|
|
110
|
+
*/
|
|
111
|
+
readonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void,
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Called by connection manager for each incoming signals.
|
|
115
|
+
* Maybe called before connectHandler is called (initial signals on socket connection)
|
|
116
|
+
*/
|
|
117
|
+
readonly signalHandler: (message: ISignalMessage) => void,
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Called when connection manager experiences delay in connecting to relay service.
|
|
121
|
+
* This can happen because client is offline, or service is busy and asks to not connect for some time.
|
|
122
|
+
* Can be called many times while not connected.
|
|
123
|
+
* Situation is considered resolved when connection is established and connectHandler is called.
|
|
124
|
+
*/
|
|
125
|
+
readonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Called by connection manager whwnever critical error happens and container should be closed.
|
|
129
|
+
* Expects dispose() call in respose to this call.
|
|
130
|
+
*/
|
|
131
|
+
readonly closeHandler: (error?: any) => void,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Called whenever connection to relay service is lost.
|
|
135
|
+
*/
|
|
136
|
+
readonly disconnectHandler: (reason: string) => void,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Called whenever new connection to rely service is established
|
|
140
|
+
*/
|
|
141
|
+
readonly connectHandler: (connection: IConnectionDetails) => void,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Called whenever ping/pong messages are roundtripped on connection.
|
|
145
|
+
*/
|
|
146
|
+
readonly pongHandler: (latency: number) => void,
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Called whenever connection type changes from writable to read-only or vice versa.
|
|
150
|
+
* Connection can be read-only if user has no edit permissions, or if container forced
|
|
151
|
+
* connection to be read-only.
|
|
152
|
+
* This should not be confused with "read" / "write"connection mode which is internal
|
|
153
|
+
* optimization.
|
|
154
|
+
*/
|
|
155
|
+
readonly readonlyChangeHandler: (readonly?: boolean) => void,
|
|
156
|
+
}
|