@fluidframework/driver-base 2.0.0-internal.7.1.1 → 2.0.0-internal.7.2.1
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/CHANGELOG.md +4 -0
- package/api-report/driver-base.api.md +1 -1
- package/dist/documentDeltaConnection.d.ts +3 -2
- package/dist/documentDeltaConnection.d.ts.map +1 -1
- package/dist/documentDeltaConnection.js +12 -3
- package/dist/documentDeltaConnection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/documentDeltaConnection.d.ts +3 -2
- package/lib/documentDeltaConnection.d.ts.map +1 -1
- package/lib/documentDeltaConnection.js +13 -4
- package/lib/documentDeltaConnection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +12 -13
- package/src/documentDeltaConnection.ts +20 -5
- package/src/packageVersion.ts +1 -1
- package/dist/driver-base-alpha.d.ts +0 -215
- package/dist/driver-base-beta.d.ts +0 -215
- package/dist/driver-base-public.d.ts +0 -215
- package/dist/driver-base.d.ts +0 -215
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/driver-base";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.7.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.7.2.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/driver-base";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.7.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.7.2.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.0.0-internal.7.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.0.0-internal.7.2.1\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-base",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.2.1",
|
|
4
4
|
"description": "Shared driver code for Fluid driver implementations",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,26 +35,25 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
42
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
39
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
40
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
41
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
42
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
43
43
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
44
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
44
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@fluid-tools/build-cli": "^0.
|
|
48
|
-
"@fluidframework/build-common": "^2.0.
|
|
49
|
-
"@fluidframework/build-tools": "^0.
|
|
47
|
+
"@fluid-tools/build-cli": "^0.26.1",
|
|
48
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
49
|
+
"@fluidframework/build-tools": "^0.26.1",
|
|
50
50
|
"@fluidframework/driver-base-previous": "npm:@fluidframework/driver-base@2.0.0-internal.7.1.0",
|
|
51
51
|
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
52
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
52
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
53
53
|
"@microsoft/api-extractor": "^7.37.0",
|
|
54
54
|
"@types/mocha": "^9.1.1",
|
|
55
55
|
"@types/node": "^16.18.38",
|
|
56
56
|
"c8": "^7.7.1",
|
|
57
|
-
"copyfiles": "^2.4.1",
|
|
58
57
|
"cross-env": "^7.0.3",
|
|
59
58
|
"eslint": "~8.50.0",
|
|
60
59
|
"mocha": "^10.2.0",
|
|
@@ -86,7 +85,7 @@
|
|
|
86
85
|
"build:genver": "gen-version",
|
|
87
86
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
88
87
|
"ci:build:docs": "api-extractor run",
|
|
89
|
-
"clean": "rimraf --glob
|
|
88
|
+
"clean": "rimraf --glob dist lib \"*.tsbuildinfo\" \"*.build.log\" _api-extractor-temp nyc",
|
|
90
89
|
"eslint": "eslint --format stylish src",
|
|
91
90
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
92
91
|
"format": "npm run prettier:fix",
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
IDocumentDeltaConnection,
|
|
10
10
|
IDocumentDeltaConnectionEvents,
|
|
11
11
|
} from "@fluidframework/driver-definitions";
|
|
12
|
-
import { createGenericNetworkError } from "@fluidframework/driver-utils";
|
|
12
|
+
import { UsageError, createGenericNetworkError } from "@fluidframework/driver-utils";
|
|
13
13
|
import {
|
|
14
14
|
ConnectionMode,
|
|
15
15
|
IClientConfiguration,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
ITokenClaims,
|
|
23
23
|
ScopeType,
|
|
24
24
|
} from "@fluidframework/protocol-definitions";
|
|
25
|
-
import { IDisposable, ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
25
|
+
import { IDisposable, ITelemetryProperties, LogLevel } from "@fluidframework/core-interfaces";
|
|
26
26
|
import {
|
|
27
27
|
ITelemetryLoggerExt,
|
|
28
28
|
extractLogSafeErrorProperties,
|
|
@@ -331,11 +331,17 @@ export class DocumentDeltaConnection
|
|
|
331
331
|
/**
|
|
332
332
|
* Submits a new signal to the server
|
|
333
333
|
*
|
|
334
|
-
* @param
|
|
334
|
+
* @param content - Content of the signal.
|
|
335
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
335
336
|
*/
|
|
336
|
-
public submitSignal(
|
|
337
|
+
public submitSignal(content: IDocumentMessage, targetClientId?: string): void {
|
|
337
338
|
this.checkNotDisposed();
|
|
338
|
-
|
|
339
|
+
|
|
340
|
+
if (targetClientId && this.details.supportedFeatures?.submit_signals_v2 !== true) {
|
|
341
|
+
throw new UsageError("Sending signals to specific client ids is not supported.");
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
this.emitMessages("submitSignal", [[content]]);
|
|
339
345
|
}
|
|
340
346
|
|
|
341
347
|
/**
|
|
@@ -571,6 +577,15 @@ export class DocumentDeltaConnection
|
|
|
571
577
|
}
|
|
572
578
|
}
|
|
573
579
|
|
|
580
|
+
this.logger.sendTelemetryEvent(
|
|
581
|
+
{
|
|
582
|
+
eventName: "ConnectDocumentSuccess",
|
|
583
|
+
pendingClientId: response.clientId,
|
|
584
|
+
},
|
|
585
|
+
undefined,
|
|
586
|
+
LogLevel.verbose,
|
|
587
|
+
);
|
|
588
|
+
|
|
574
589
|
this.checkpointSequenceNumber = response.checkpointSequenceNumber;
|
|
575
590
|
|
|
576
591
|
this.removeConnectionListeners();
|
package/src/packageVersion.ts
CHANGED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { ConnectionMode } from '@fluidframework/protocol-definitions';
|
|
2
|
-
import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
|
|
3
|
-
import { IAnyDriverError } from '@fluidframework/driver-definitions';
|
|
4
|
-
import { IClientConfiguration } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { IConnect } from '@fluidframework/protocol-definitions';
|
|
6
|
-
import { IConnected } from '@fluidframework/protocol-definitions';
|
|
7
|
-
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
8
|
-
import { IDocumentDeltaConnection } from '@fluidframework/driver-definitions';
|
|
9
|
-
import { IDocumentDeltaConnectionEvents } from '@fluidframework/driver-definitions';
|
|
10
|
-
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
11
|
-
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
12
|
-
import { ISignalClient } from '@fluidframework/protocol-definitions';
|
|
13
|
-
import { ISignalMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
-
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
15
|
-
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
16
|
-
import type { Socket } from 'socket.io-client';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents a connection to a stream of delta updates.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
24
|
-
protected readonly socket: Socket;
|
|
25
|
-
documentId: string;
|
|
26
|
-
private readonly enableLongPollingDowngrades;
|
|
27
|
-
protected readonly connectionId?: string | undefined;
|
|
28
|
-
static readonly eventsToForward: string[];
|
|
29
|
-
static readonly eventsAlwaysForwarded: string[];
|
|
30
|
-
/**
|
|
31
|
-
* Last known sequence number to ordering service at the time of connection
|
|
32
|
-
* It may lap actual last sequence number (quite a bit, if container is very active).
|
|
33
|
-
* But it's best information for client to figure out how far it is behind, at least
|
|
34
|
-
* for "read" connections. "write" connections may use own "join" op to similar information,
|
|
35
|
-
* that is likely to be more up-to-date.
|
|
36
|
-
*/
|
|
37
|
-
checkpointSequenceNumber: number | undefined;
|
|
38
|
-
protected readonly queuedMessages: ISequencedDocumentMessage[];
|
|
39
|
-
protected readonly queuedSignals: ISignalMessage[];
|
|
40
|
-
/**
|
|
41
|
-
* A flag to indicate whether we have our handler attached. If it's attached, we're queueing incoming ops
|
|
42
|
-
* to later be retrieved via initialMessages.
|
|
43
|
-
*/
|
|
44
|
-
private earlyOpHandlerAttached;
|
|
45
|
-
private socketConnectionTimeout;
|
|
46
|
-
private _details;
|
|
47
|
-
private trackLatencyTimeout;
|
|
48
|
-
private readonly connectionListeners;
|
|
49
|
-
private readonly trackedListeners;
|
|
50
|
-
protected get hasDetails(): boolean;
|
|
51
|
-
get disposed(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages.
|
|
54
|
-
* After disconnection, we flip this to prevent any stale messages from being emitted.
|
|
55
|
-
*/
|
|
56
|
-
protected _disposed: boolean;
|
|
57
|
-
private readonly mc;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated Implementors should manage their own logger or monitoring context
|
|
60
|
-
*/
|
|
61
|
-
protected get logger(): ITelemetryLoggerExt;
|
|
62
|
-
get details(): IConnected;
|
|
63
|
-
/**
|
|
64
|
-
* @param socket - websocket to be used
|
|
65
|
-
* @param documentId - ID of the document
|
|
66
|
-
* @param logger - for reporting telemetry events
|
|
67
|
-
* @param enableLongPollingDowngrades - allow connection to be downgraded to long-polling on websocket failure
|
|
68
|
-
*/
|
|
69
|
-
protected constructor(socket: Socket, documentId: string, logger: ITelemetryLoggerExt, enableLongPollingDowngrades?: boolean, connectionId?: string | undefined);
|
|
70
|
-
/**
|
|
71
|
-
* Get the ID of the client who is sending the message
|
|
72
|
-
*
|
|
73
|
-
* @returns the client ID
|
|
74
|
-
*/
|
|
75
|
-
get clientId(): string;
|
|
76
|
-
/**
|
|
77
|
-
* Get the mode of the client
|
|
78
|
-
*
|
|
79
|
-
* @returns the client mode
|
|
80
|
-
*/
|
|
81
|
-
get mode(): ConnectionMode;
|
|
82
|
-
/**
|
|
83
|
-
* Get the claims of the client who is sending the message
|
|
84
|
-
*
|
|
85
|
-
* @returns client claims
|
|
86
|
-
*/
|
|
87
|
-
get claims(): ITokenClaims;
|
|
88
|
-
/**
|
|
89
|
-
* Get whether or not this is an existing document
|
|
90
|
-
*
|
|
91
|
-
* @returns true if the document exists
|
|
92
|
-
*/
|
|
93
|
-
get existing(): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Get the maximum size of a message before chunking is required
|
|
96
|
-
*
|
|
97
|
-
* @returns the maximum size of a message before chunking is required
|
|
98
|
-
*/
|
|
99
|
-
get maxMessageSize(): number;
|
|
100
|
-
/**
|
|
101
|
-
* Semver of protocol being used with the service
|
|
102
|
-
*/
|
|
103
|
-
get version(): string;
|
|
104
|
-
/**
|
|
105
|
-
* Configuration details provided by the service
|
|
106
|
-
*/
|
|
107
|
-
get serviceConfiguration(): IClientConfiguration;
|
|
108
|
-
private checkNotDisposed;
|
|
109
|
-
/**
|
|
110
|
-
* Get messages sent during the connection
|
|
111
|
-
*
|
|
112
|
-
* @returns messages sent during the connection
|
|
113
|
-
*/
|
|
114
|
-
get initialMessages(): ISequencedDocumentMessage[];
|
|
115
|
-
/**
|
|
116
|
-
* Get signals sent during the connection
|
|
117
|
-
*
|
|
118
|
-
* @returns signals sent during the connection
|
|
119
|
-
*/
|
|
120
|
-
get initialSignals(): ISignalMessage[];
|
|
121
|
-
/**
|
|
122
|
-
* Get initial client list
|
|
123
|
-
*
|
|
124
|
-
* @returns initial client list sent during the connection
|
|
125
|
-
*/
|
|
126
|
-
get initialClients(): ISignalClient[];
|
|
127
|
-
protected emitMessages(type: string, messages: IDocumentMessage[][]): void;
|
|
128
|
-
/**
|
|
129
|
-
* Submits a new delta operation to the server
|
|
130
|
-
*
|
|
131
|
-
* @param message - delta operation to submit
|
|
132
|
-
*/
|
|
133
|
-
submit(messages: IDocumentMessage[]): void;
|
|
134
|
-
/**
|
|
135
|
-
* Submits a new signal to the server
|
|
136
|
-
*
|
|
137
|
-
* @param message - signal to submit
|
|
138
|
-
*/
|
|
139
|
-
submitSignal(message: IDocumentMessage): void;
|
|
140
|
-
/**
|
|
141
|
-
* Disconnect from the websocket and close the websocket too.
|
|
142
|
-
*/
|
|
143
|
-
private closeSocket;
|
|
144
|
-
protected closeSocketCore(error: IAnyDriverError): void;
|
|
145
|
-
/**
|
|
146
|
-
* Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.
|
|
147
|
-
* However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no
|
|
148
|
-
* multiplexing here, so we need to close the socket here.
|
|
149
|
-
*/
|
|
150
|
-
dispose(): void;
|
|
151
|
-
protected disconnect(err: IAnyDriverError): void;
|
|
152
|
-
/**
|
|
153
|
-
* Disconnect from the websocket.
|
|
154
|
-
* @param reason - reason for disconnect
|
|
155
|
-
*/
|
|
156
|
-
protected disconnectCore(): void;
|
|
157
|
-
protected initialize(connectMessage: IConnect, timeout: number): Promise<void>;
|
|
158
|
-
private addPropsToError;
|
|
159
|
-
protected getConnectionDetailsProps(): {
|
|
160
|
-
disposed: boolean;
|
|
161
|
-
socketConnected: boolean;
|
|
162
|
-
clientId: string | undefined;
|
|
163
|
-
connectionId: string | undefined;
|
|
164
|
-
};
|
|
165
|
-
protected earlyOpHandler: (documentId: string, msgs: ISequencedDocumentMessage[]) => void;
|
|
166
|
-
protected earlySignalHandler: (msg: ISignalMessage | ISignalMessage[]) => void;
|
|
167
|
-
private removeEarlyOpHandler;
|
|
168
|
-
private removeEarlySignalHandler;
|
|
169
|
-
private addConnectionListener;
|
|
170
|
-
protected addTrackedListener(event: string, listener: (...args: any[]) => void): void;
|
|
171
|
-
private removeTrackedListeners;
|
|
172
|
-
private removeConnectionListeners;
|
|
173
|
-
private getErrorMessage;
|
|
174
|
-
private createErrorObjectWithProps;
|
|
175
|
-
/**
|
|
176
|
-
* Error raising for socket.io issues
|
|
177
|
-
*/
|
|
178
|
-
protected createErrorObject(handler: string, error?: any, canRetry?: boolean): IAnyDriverError;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Extract and return the w3c data.
|
|
183
|
-
* @param url - request url for which w3c data needs to be reported.
|
|
184
|
-
* @param initiatorType - type of the network call
|
|
185
|
-
*
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
export declare function getW3CData(url: string, initiatorType: string): {
|
|
189
|
-
dnsLookupTime: number | undefined;
|
|
190
|
-
w3cStartTime: number | undefined;
|
|
191
|
-
redirectTime: number | undefined;
|
|
192
|
-
tcpHandshakeTime: number | undefined;
|
|
193
|
-
secureConnectionTime: number | undefined;
|
|
194
|
-
responseNetworkTime: number | undefined;
|
|
195
|
-
fetchStartToResponseEndTime: number | undefined;
|
|
196
|
-
reqStartToResponseEndTime: number | undefined;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
201
|
-
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
202
|
-
*
|
|
203
|
-
* @public
|
|
204
|
-
*/
|
|
205
|
-
export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
|
|
206
|
-
index: number;
|
|
207
|
-
value: T;
|
|
208
|
-
}>;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @public
|
|
212
|
-
*/
|
|
213
|
-
export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
|
|
214
|
-
|
|
215
|
-
export { }
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { ConnectionMode } from '@fluidframework/protocol-definitions';
|
|
2
|
-
import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
|
|
3
|
-
import { IAnyDriverError } from '@fluidframework/driver-definitions';
|
|
4
|
-
import { IClientConfiguration } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { IConnect } from '@fluidframework/protocol-definitions';
|
|
6
|
-
import { IConnected } from '@fluidframework/protocol-definitions';
|
|
7
|
-
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
8
|
-
import { IDocumentDeltaConnection } from '@fluidframework/driver-definitions';
|
|
9
|
-
import { IDocumentDeltaConnectionEvents } from '@fluidframework/driver-definitions';
|
|
10
|
-
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
11
|
-
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
12
|
-
import { ISignalClient } from '@fluidframework/protocol-definitions';
|
|
13
|
-
import { ISignalMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
-
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
15
|
-
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
16
|
-
import type { Socket } from 'socket.io-client';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents a connection to a stream of delta updates.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
24
|
-
protected readonly socket: Socket;
|
|
25
|
-
documentId: string;
|
|
26
|
-
private readonly enableLongPollingDowngrades;
|
|
27
|
-
protected readonly connectionId?: string | undefined;
|
|
28
|
-
static readonly eventsToForward: string[];
|
|
29
|
-
static readonly eventsAlwaysForwarded: string[];
|
|
30
|
-
/**
|
|
31
|
-
* Last known sequence number to ordering service at the time of connection
|
|
32
|
-
* It may lap actual last sequence number (quite a bit, if container is very active).
|
|
33
|
-
* But it's best information for client to figure out how far it is behind, at least
|
|
34
|
-
* for "read" connections. "write" connections may use own "join" op to similar information,
|
|
35
|
-
* that is likely to be more up-to-date.
|
|
36
|
-
*/
|
|
37
|
-
checkpointSequenceNumber: number | undefined;
|
|
38
|
-
protected readonly queuedMessages: ISequencedDocumentMessage[];
|
|
39
|
-
protected readonly queuedSignals: ISignalMessage[];
|
|
40
|
-
/**
|
|
41
|
-
* A flag to indicate whether we have our handler attached. If it's attached, we're queueing incoming ops
|
|
42
|
-
* to later be retrieved via initialMessages.
|
|
43
|
-
*/
|
|
44
|
-
private earlyOpHandlerAttached;
|
|
45
|
-
private socketConnectionTimeout;
|
|
46
|
-
private _details;
|
|
47
|
-
private trackLatencyTimeout;
|
|
48
|
-
private readonly connectionListeners;
|
|
49
|
-
private readonly trackedListeners;
|
|
50
|
-
protected get hasDetails(): boolean;
|
|
51
|
-
get disposed(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages.
|
|
54
|
-
* After disconnection, we flip this to prevent any stale messages from being emitted.
|
|
55
|
-
*/
|
|
56
|
-
protected _disposed: boolean;
|
|
57
|
-
private readonly mc;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated Implementors should manage their own logger or monitoring context
|
|
60
|
-
*/
|
|
61
|
-
protected get logger(): ITelemetryLoggerExt;
|
|
62
|
-
get details(): IConnected;
|
|
63
|
-
/**
|
|
64
|
-
* @param socket - websocket to be used
|
|
65
|
-
* @param documentId - ID of the document
|
|
66
|
-
* @param logger - for reporting telemetry events
|
|
67
|
-
* @param enableLongPollingDowngrades - allow connection to be downgraded to long-polling on websocket failure
|
|
68
|
-
*/
|
|
69
|
-
protected constructor(socket: Socket, documentId: string, logger: ITelemetryLoggerExt, enableLongPollingDowngrades?: boolean, connectionId?: string | undefined);
|
|
70
|
-
/**
|
|
71
|
-
* Get the ID of the client who is sending the message
|
|
72
|
-
*
|
|
73
|
-
* @returns the client ID
|
|
74
|
-
*/
|
|
75
|
-
get clientId(): string;
|
|
76
|
-
/**
|
|
77
|
-
* Get the mode of the client
|
|
78
|
-
*
|
|
79
|
-
* @returns the client mode
|
|
80
|
-
*/
|
|
81
|
-
get mode(): ConnectionMode;
|
|
82
|
-
/**
|
|
83
|
-
* Get the claims of the client who is sending the message
|
|
84
|
-
*
|
|
85
|
-
* @returns client claims
|
|
86
|
-
*/
|
|
87
|
-
get claims(): ITokenClaims;
|
|
88
|
-
/**
|
|
89
|
-
* Get whether or not this is an existing document
|
|
90
|
-
*
|
|
91
|
-
* @returns true if the document exists
|
|
92
|
-
*/
|
|
93
|
-
get existing(): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Get the maximum size of a message before chunking is required
|
|
96
|
-
*
|
|
97
|
-
* @returns the maximum size of a message before chunking is required
|
|
98
|
-
*/
|
|
99
|
-
get maxMessageSize(): number;
|
|
100
|
-
/**
|
|
101
|
-
* Semver of protocol being used with the service
|
|
102
|
-
*/
|
|
103
|
-
get version(): string;
|
|
104
|
-
/**
|
|
105
|
-
* Configuration details provided by the service
|
|
106
|
-
*/
|
|
107
|
-
get serviceConfiguration(): IClientConfiguration;
|
|
108
|
-
private checkNotDisposed;
|
|
109
|
-
/**
|
|
110
|
-
* Get messages sent during the connection
|
|
111
|
-
*
|
|
112
|
-
* @returns messages sent during the connection
|
|
113
|
-
*/
|
|
114
|
-
get initialMessages(): ISequencedDocumentMessage[];
|
|
115
|
-
/**
|
|
116
|
-
* Get signals sent during the connection
|
|
117
|
-
*
|
|
118
|
-
* @returns signals sent during the connection
|
|
119
|
-
*/
|
|
120
|
-
get initialSignals(): ISignalMessage[];
|
|
121
|
-
/**
|
|
122
|
-
* Get initial client list
|
|
123
|
-
*
|
|
124
|
-
* @returns initial client list sent during the connection
|
|
125
|
-
*/
|
|
126
|
-
get initialClients(): ISignalClient[];
|
|
127
|
-
protected emitMessages(type: string, messages: IDocumentMessage[][]): void;
|
|
128
|
-
/**
|
|
129
|
-
* Submits a new delta operation to the server
|
|
130
|
-
*
|
|
131
|
-
* @param message - delta operation to submit
|
|
132
|
-
*/
|
|
133
|
-
submit(messages: IDocumentMessage[]): void;
|
|
134
|
-
/**
|
|
135
|
-
* Submits a new signal to the server
|
|
136
|
-
*
|
|
137
|
-
* @param message - signal to submit
|
|
138
|
-
*/
|
|
139
|
-
submitSignal(message: IDocumentMessage): void;
|
|
140
|
-
/**
|
|
141
|
-
* Disconnect from the websocket and close the websocket too.
|
|
142
|
-
*/
|
|
143
|
-
private closeSocket;
|
|
144
|
-
protected closeSocketCore(error: IAnyDriverError): void;
|
|
145
|
-
/**
|
|
146
|
-
* Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.
|
|
147
|
-
* However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no
|
|
148
|
-
* multiplexing here, so we need to close the socket here.
|
|
149
|
-
*/
|
|
150
|
-
dispose(): void;
|
|
151
|
-
protected disconnect(err: IAnyDriverError): void;
|
|
152
|
-
/**
|
|
153
|
-
* Disconnect from the websocket.
|
|
154
|
-
* @param reason - reason for disconnect
|
|
155
|
-
*/
|
|
156
|
-
protected disconnectCore(): void;
|
|
157
|
-
protected initialize(connectMessage: IConnect, timeout: number): Promise<void>;
|
|
158
|
-
private addPropsToError;
|
|
159
|
-
protected getConnectionDetailsProps(): {
|
|
160
|
-
disposed: boolean;
|
|
161
|
-
socketConnected: boolean;
|
|
162
|
-
clientId: string | undefined;
|
|
163
|
-
connectionId: string | undefined;
|
|
164
|
-
};
|
|
165
|
-
protected earlyOpHandler: (documentId: string, msgs: ISequencedDocumentMessage[]) => void;
|
|
166
|
-
protected earlySignalHandler: (msg: ISignalMessage | ISignalMessage[]) => void;
|
|
167
|
-
private removeEarlyOpHandler;
|
|
168
|
-
private removeEarlySignalHandler;
|
|
169
|
-
private addConnectionListener;
|
|
170
|
-
protected addTrackedListener(event: string, listener: (...args: any[]) => void): void;
|
|
171
|
-
private removeTrackedListeners;
|
|
172
|
-
private removeConnectionListeners;
|
|
173
|
-
private getErrorMessage;
|
|
174
|
-
private createErrorObjectWithProps;
|
|
175
|
-
/**
|
|
176
|
-
* Error raising for socket.io issues
|
|
177
|
-
*/
|
|
178
|
-
protected createErrorObject(handler: string, error?: any, canRetry?: boolean): IAnyDriverError;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Extract and return the w3c data.
|
|
183
|
-
* @param url - request url for which w3c data needs to be reported.
|
|
184
|
-
* @param initiatorType - type of the network call
|
|
185
|
-
*
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
export declare function getW3CData(url: string, initiatorType: string): {
|
|
189
|
-
dnsLookupTime: number | undefined;
|
|
190
|
-
w3cStartTime: number | undefined;
|
|
191
|
-
redirectTime: number | undefined;
|
|
192
|
-
tcpHandshakeTime: number | undefined;
|
|
193
|
-
secureConnectionTime: number | undefined;
|
|
194
|
-
responseNetworkTime: number | undefined;
|
|
195
|
-
fetchStartToResponseEndTime: number | undefined;
|
|
196
|
-
reqStartToResponseEndTime: number | undefined;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
201
|
-
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
202
|
-
*
|
|
203
|
-
* @public
|
|
204
|
-
*/
|
|
205
|
-
export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
|
|
206
|
-
index: number;
|
|
207
|
-
value: T;
|
|
208
|
-
}>;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @public
|
|
212
|
-
*/
|
|
213
|
-
export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
|
|
214
|
-
|
|
215
|
-
export { }
|