@fluidframework/driver-base 2.0.0-dev.7.4.0.215747 → 2.0.0-dev.7.4.0.216897
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/api-extractor-lint.json +13 -0
- package/api-report/driver-base.api.md +4 -4
- package/dist/documentDeltaConnection.cjs +1 -2
- package/dist/documentDeltaConnection.cjs.map +1 -1
- package/dist/documentDeltaConnection.d.ts +1 -2
- package/dist/documentDeltaConnection.d.ts.map +1 -1
- package/dist/driver-base-alpha.d.ts +16 -200
- package/dist/driver-base-beta.d.ts +16 -200
- package/dist/driver-base-public.d.ts +16 -200
- package/dist/driver-base-untrimmed.d.ts +4 -7
- package/dist/driverUtils.cjs +3 -5
- package/dist/driverUtils.cjs.map +1 -1
- package/dist/driverUtils.d.ts +3 -5
- package/dist/driverUtils.d.ts.map +1 -1
- package/dist/packageVersion.cjs +1 -1
- package/dist/packageVersion.cjs.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/lib/documentDeltaConnection.d.ts +1 -2
- package/lib/documentDeltaConnection.d.ts.map +1 -1
- package/lib/documentDeltaConnection.mjs +1 -2
- package/lib/documentDeltaConnection.mjs.map +1 -1
- package/lib/driver-base-alpha.d.ts +16 -200
- package/lib/driver-base-beta.d.ts +16 -200
- package/lib/driver-base-public.d.ts +16 -200
- package/lib/driver-base-untrimmed.d.ts +4 -7
- package/lib/driverUtils.d.ts +3 -5
- package/lib/driverUtils.d.ts.map +1 -1
- package/lib/driverUtils.mjs +3 -5
- package/lib/driverUtils.mjs.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/package.json +10 -9
- package/src/documentDeltaConnection.ts +1 -2
- package/src/driverUtils.ts +3 -5
- package/src/packageVersion.ts +1 -1
|
@@ -1,216 +1,32 @@
|
|
|
1
1
|
import { ConnectionMode } from '@fluidframework/protocol-definitions';
|
|
2
|
-
import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
|
|
3
|
-
import { IAnyDriverError } from '@fluidframework/driver-definitions';
|
|
4
2
|
import { IClientConfiguration } from '@fluidframework/protocol-definitions';
|
|
5
3
|
import { IConnect } from '@fluidframework/protocol-definitions';
|
|
6
4
|
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
5
|
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
11
6
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
12
7
|
import { ISignalClient } from '@fluidframework/protocol-definitions';
|
|
13
8
|
import { ISignalMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
-
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
15
9
|
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
16
10
|
import type { Socket } from 'socket.io-client';
|
|
17
11
|
|
|
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 content - Content of the signal.
|
|
138
|
-
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
139
|
-
*/
|
|
140
|
-
submitSignal(content: IDocumentMessage, targetClientId?: string): void;
|
|
141
|
-
/**
|
|
142
|
-
* Disconnect from the websocket and close the websocket too.
|
|
143
|
-
*/
|
|
144
|
-
private closeSocket;
|
|
145
|
-
protected closeSocketCore(error: IAnyDriverError): void;
|
|
146
|
-
/**
|
|
147
|
-
* Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.
|
|
148
|
-
* However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no
|
|
149
|
-
* multiplexing here, so we need to close the socket here.
|
|
150
|
-
*/
|
|
151
|
-
dispose(): void;
|
|
152
|
-
protected disconnect(err: IAnyDriverError): void;
|
|
153
|
-
/**
|
|
154
|
-
* Disconnect from the websocket.
|
|
155
|
-
* @param reason - reason for disconnect
|
|
156
|
-
*/
|
|
157
|
-
protected disconnectCore(): void;
|
|
158
|
-
protected initialize(connectMessage: IConnect, timeout: number): Promise<void>;
|
|
159
|
-
private addPropsToError;
|
|
160
|
-
protected getConnectionDetailsProps(): {
|
|
161
|
-
disposed: boolean;
|
|
162
|
-
socketConnected: boolean;
|
|
163
|
-
clientId: string | undefined;
|
|
164
|
-
connectionId: string | undefined;
|
|
165
|
-
};
|
|
166
|
-
protected earlyOpHandler: (documentId: string, msgs: ISequencedDocumentMessage[]) => void;
|
|
167
|
-
protected earlySignalHandler: (msg: ISignalMessage | ISignalMessage[]) => void;
|
|
168
|
-
private removeEarlyOpHandler;
|
|
169
|
-
private removeEarlySignalHandler;
|
|
170
|
-
private addConnectionListener;
|
|
171
|
-
protected addTrackedListener(event: string, listener: (...args: any[]) => void): void;
|
|
172
|
-
private removeTrackedListeners;
|
|
173
|
-
private removeConnectionListeners;
|
|
174
|
-
private getErrorMessage;
|
|
175
|
-
private createErrorObjectWithProps;
|
|
176
|
-
/**
|
|
177
|
-
* Error raising for socket.io issues
|
|
178
|
-
*/
|
|
179
|
-
protected createErrorObject(handler: string, error?: any, canRetry?: boolean): IAnyDriverError;
|
|
180
|
-
}
|
|
12
|
+
/* Excluded from this release type: DocumentDeltaConnection */
|
|
181
13
|
|
|
182
|
-
|
|
183
|
-
* Extract and return the w3c data.
|
|
184
|
-
* @param url - request url for which w3c data needs to be reported.
|
|
185
|
-
* @param initiatorType - type of the network call
|
|
186
|
-
*
|
|
187
|
-
* @public
|
|
188
|
-
*/
|
|
189
|
-
export declare function getW3CData(url: string, initiatorType: string): {
|
|
190
|
-
dnsLookupTime: number | undefined;
|
|
191
|
-
w3cStartTime: number | undefined;
|
|
192
|
-
redirectTime: number | undefined;
|
|
193
|
-
tcpHandshakeTime: number | undefined;
|
|
194
|
-
secureConnectionTime: number | undefined;
|
|
195
|
-
responseNetworkTime: number | undefined;
|
|
196
|
-
fetchStartToResponseEndTime: number | undefined;
|
|
197
|
-
reqStartToResponseEndTime: number | undefined;
|
|
198
|
-
};
|
|
14
|
+
/* Excluded from this release type: EventEmitterWithErrorHandling */
|
|
199
15
|
|
|
200
|
-
|
|
201
|
-
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
202
|
-
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
203
|
-
*
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
|
|
207
|
-
index: number;
|
|
208
|
-
value: T;
|
|
209
|
-
}>;
|
|
16
|
+
/* Excluded from this release type: getW3CData */
|
|
210
17
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
*/
|
|
214
|
-
|
|
18
|
+
/* Excluded from this release type: IAnyDriverError */
|
|
19
|
+
|
|
20
|
+
/* Excluded from this release type: IDisposable */
|
|
21
|
+
|
|
22
|
+
/* Excluded from this release type: IDocumentDeltaConnection */
|
|
23
|
+
|
|
24
|
+
/* Excluded from this release type: IDocumentDeltaConnectionEvents */
|
|
25
|
+
|
|
26
|
+
/* Excluded from this release type: ITelemetryLoggerExt */
|
|
27
|
+
|
|
28
|
+
/* Excluded from this release type: promiseRaceWithWinner */
|
|
29
|
+
|
|
30
|
+
/* Excluded from this release type: validateMessages */
|
|
215
31
|
|
|
216
32
|
export { }
|
|
@@ -1,216 +1,32 @@
|
|
|
1
1
|
import { ConnectionMode } from '@fluidframework/protocol-definitions';
|
|
2
|
-
import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
|
|
3
|
-
import { IAnyDriverError } from '@fluidframework/driver-definitions';
|
|
4
2
|
import { IClientConfiguration } from '@fluidframework/protocol-definitions';
|
|
5
3
|
import { IConnect } from '@fluidframework/protocol-definitions';
|
|
6
4
|
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
5
|
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
11
6
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
12
7
|
import { ISignalClient } from '@fluidframework/protocol-definitions';
|
|
13
8
|
import { ISignalMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
-
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
15
9
|
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
16
10
|
import type { Socket } from 'socket.io-client';
|
|
17
11
|
|
|
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 content - Content of the signal.
|
|
138
|
-
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
139
|
-
*/
|
|
140
|
-
submitSignal(content: IDocumentMessage, targetClientId?: string): void;
|
|
141
|
-
/**
|
|
142
|
-
* Disconnect from the websocket and close the websocket too.
|
|
143
|
-
*/
|
|
144
|
-
private closeSocket;
|
|
145
|
-
protected closeSocketCore(error: IAnyDriverError): void;
|
|
146
|
-
/**
|
|
147
|
-
* Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.
|
|
148
|
-
* However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no
|
|
149
|
-
* multiplexing here, so we need to close the socket here.
|
|
150
|
-
*/
|
|
151
|
-
dispose(): void;
|
|
152
|
-
protected disconnect(err: IAnyDriverError): void;
|
|
153
|
-
/**
|
|
154
|
-
* Disconnect from the websocket.
|
|
155
|
-
* @param reason - reason for disconnect
|
|
156
|
-
*/
|
|
157
|
-
protected disconnectCore(): void;
|
|
158
|
-
protected initialize(connectMessage: IConnect, timeout: number): Promise<void>;
|
|
159
|
-
private addPropsToError;
|
|
160
|
-
protected getConnectionDetailsProps(): {
|
|
161
|
-
disposed: boolean;
|
|
162
|
-
socketConnected: boolean;
|
|
163
|
-
clientId: string | undefined;
|
|
164
|
-
connectionId: string | undefined;
|
|
165
|
-
};
|
|
166
|
-
protected earlyOpHandler: (documentId: string, msgs: ISequencedDocumentMessage[]) => void;
|
|
167
|
-
protected earlySignalHandler: (msg: ISignalMessage | ISignalMessage[]) => void;
|
|
168
|
-
private removeEarlyOpHandler;
|
|
169
|
-
private removeEarlySignalHandler;
|
|
170
|
-
private addConnectionListener;
|
|
171
|
-
protected addTrackedListener(event: string, listener: (...args: any[]) => void): void;
|
|
172
|
-
private removeTrackedListeners;
|
|
173
|
-
private removeConnectionListeners;
|
|
174
|
-
private getErrorMessage;
|
|
175
|
-
private createErrorObjectWithProps;
|
|
176
|
-
/**
|
|
177
|
-
* Error raising for socket.io issues
|
|
178
|
-
*/
|
|
179
|
-
protected createErrorObject(handler: string, error?: any, canRetry?: boolean): IAnyDriverError;
|
|
180
|
-
}
|
|
12
|
+
/* Excluded from this release type: DocumentDeltaConnection */
|
|
181
13
|
|
|
182
|
-
|
|
183
|
-
* Extract and return the w3c data.
|
|
184
|
-
* @param url - request url for which w3c data needs to be reported.
|
|
185
|
-
* @param initiatorType - type of the network call
|
|
186
|
-
*
|
|
187
|
-
* @public
|
|
188
|
-
*/
|
|
189
|
-
export declare function getW3CData(url: string, initiatorType: string): {
|
|
190
|
-
dnsLookupTime: number | undefined;
|
|
191
|
-
w3cStartTime: number | undefined;
|
|
192
|
-
redirectTime: number | undefined;
|
|
193
|
-
tcpHandshakeTime: number | undefined;
|
|
194
|
-
secureConnectionTime: number | undefined;
|
|
195
|
-
responseNetworkTime: number | undefined;
|
|
196
|
-
fetchStartToResponseEndTime: number | undefined;
|
|
197
|
-
reqStartToResponseEndTime: number | undefined;
|
|
198
|
-
};
|
|
14
|
+
/* Excluded from this release type: EventEmitterWithErrorHandling */
|
|
199
15
|
|
|
200
|
-
|
|
201
|
-
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
202
|
-
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
203
|
-
*
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
|
|
207
|
-
index: number;
|
|
208
|
-
value: T;
|
|
209
|
-
}>;
|
|
16
|
+
/* Excluded from this release type: getW3CData */
|
|
210
17
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
*/
|
|
214
|
-
|
|
18
|
+
/* Excluded from this release type: IAnyDriverError */
|
|
19
|
+
|
|
20
|
+
/* Excluded from this release type: IDisposable */
|
|
21
|
+
|
|
22
|
+
/* Excluded from this release type: IDocumentDeltaConnection */
|
|
23
|
+
|
|
24
|
+
/* Excluded from this release type: IDocumentDeltaConnectionEvents */
|
|
25
|
+
|
|
26
|
+
/* Excluded from this release type: ITelemetryLoggerExt */
|
|
27
|
+
|
|
28
|
+
/* Excluded from this release type: promiseRaceWithWinner */
|
|
29
|
+
|
|
30
|
+
/* Excluded from this release type: validateMessages */
|
|
215
31
|
|
|
216
32
|
export { }
|
|
@@ -17,8 +17,7 @@ import type { Socket } from 'socket.io-client';
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Represents a connection to a stream of delta updates.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
20
|
+
* @internal
|
|
22
21
|
*/
|
|
23
22
|
export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
24
23
|
protected readonly socket: Socket;
|
|
@@ -183,8 +182,7 @@ export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandli
|
|
|
183
182
|
* Extract and return the w3c data.
|
|
184
183
|
* @param url - request url for which w3c data needs to be reported.
|
|
185
184
|
* @param initiatorType - type of the network call
|
|
186
|
-
*
|
|
187
|
-
* @public
|
|
185
|
+
* @internal
|
|
188
186
|
*/
|
|
189
187
|
export declare function getW3CData(url: string, initiatorType: string): {
|
|
190
188
|
dnsLookupTime: number | undefined;
|
|
@@ -200,8 +198,7 @@ export declare function getW3CData(url: string, initiatorType: string): {
|
|
|
200
198
|
/**
|
|
201
199
|
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
202
200
|
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
203
|
-
*
|
|
204
|
-
* @public
|
|
201
|
+
* @internal
|
|
205
202
|
*/
|
|
206
203
|
export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
|
|
207
204
|
index: number;
|
|
@@ -209,7 +206,7 @@ export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promis
|
|
|
209
206
|
}>;
|
|
210
207
|
|
|
211
208
|
/**
|
|
212
|
-
* @
|
|
209
|
+
* @internal
|
|
213
210
|
*/
|
|
214
211
|
export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
|
|
215
212
|
|
package/lib/driverUtils.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
|
8
8
|
* Extract and return the w3c data.
|
|
9
9
|
* @param url - request url for which w3c data needs to be reported.
|
|
10
10
|
* @param initiatorType - type of the network call
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
11
|
+
* @internal
|
|
13
12
|
*/
|
|
14
13
|
export declare function getW3CData(url: string, initiatorType: string): {
|
|
15
14
|
dnsLookupTime: number | undefined;
|
|
@@ -24,15 +23,14 @@ export declare function getW3CData(url: string, initiatorType: string): {
|
|
|
24
23
|
/**
|
|
25
24
|
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
26
25
|
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
26
|
+
* @internal
|
|
29
27
|
*/
|
|
30
28
|
export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
|
|
31
29
|
index: number;
|
|
32
30
|
value: T;
|
|
33
31
|
}>;
|
|
34
32
|
/**
|
|
35
|
-
* @
|
|
33
|
+
* @internal
|
|
36
34
|
*/
|
|
37
35
|
export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
|
|
38
36
|
//# sourceMappingURL=driverUtils.d.ts.map
|
package/lib/driverUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;;;;;;EA8E5D;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAC5C,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GACpB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAMtC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,yBAAyB,EAAE,EACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,mBAAmB,EAC3B,MAAM,GAAE,OAAc,QAwCtB"}
|
package/lib/driverUtils.mjs
CHANGED
|
@@ -7,8 +7,7 @@ import { performance } from "@fluid-internal/client-utils";
|
|
|
7
7
|
* Extract and return the w3c data.
|
|
8
8
|
* @param url - request url for which w3c data needs to be reported.
|
|
9
9
|
* @param initiatorType - type of the network call
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
10
|
+
* @internal
|
|
12
11
|
*/
|
|
13
12
|
export function getW3CData(url, initiatorType) {
|
|
14
13
|
// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
|
|
@@ -88,8 +87,7 @@ export function getW3CData(url, initiatorType) {
|
|
|
88
87
|
/**
|
|
89
88
|
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
90
89
|
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
91
|
-
*
|
|
92
|
-
* @public
|
|
90
|
+
* @internal
|
|
93
91
|
*/
|
|
94
92
|
export async function promiseRaceWithWinner(promises) {
|
|
95
93
|
return new Promise((resolve, reject) => {
|
|
@@ -99,7 +97,7 @@ export async function promiseRaceWithWinner(promises) {
|
|
|
99
97
|
});
|
|
100
98
|
}
|
|
101
99
|
/**
|
|
102
|
-
* @
|
|
100
|
+
* @internal
|
|
103
101
|
*/
|
|
104
102
|
export function validateMessages(reason, messages, from, logger, strict = true) {
|
|
105
103
|
if (messages.length !== 0) {
|
package/lib/driverUtils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverUtils.mjs","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,8BAA8B;AAI1D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,aAAqB;IAC5D,mFAAmF;IACnF,2EAA2E;IAC3E,8FAA8F;IAC9F,wGAAwG;IACxG,oFAAoF;IACpF,gGAAgG;IAChG,mGAAmG;IACnG,mGAAmG;IACnG,2FAA2F;IAC3F,oGAAoG;IACpG,mGAAmG;IACnG,4EAA4E;IAC5E,+FAA+F;IAE/F,gFAAgF;IACh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ved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\n\n/**\n * Extract and return the w3c data.\n * @param url - request url for which w3c data needs to be reported.\n * @param initiatorType - type of the network call\n *\n * @public\n */\nexport function getW3CData(url: string, initiatorType: string) {\n\t// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n\t// fetchStart: immediately before the browser starts to fetch the resource.\n\t// requestStart: immediately before the browser starts requesting the resource from the server\n\t// responseStart: immediately after the browser receives the first byte of the response from the server.\n\t// responseEnd: immediately after the browser receives the last byte of the resource\n\t// or immediately before the transport connection is closed, whichever comes first.\n\t// secureConnectionStart: immediately before the browser starts the handshake process to secure the\n\t// current connection. If a secure connection is not used, this property returns zero.\n\t// startTime: Time when the resource fetch started. This value is equivalent to fetchStart.\n\t// domainLookupStart: immediately before the browser starts the domain name lookup for the resource.\n\t// domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.\n\t// redirectStart: start time of the fetch which that initiates the redirect.\n\t// redirectEnd: immediately after receiving the last byte of the response of the last redirect.\n\n\t// Interval between start and finish of the domain name lookup for the resource.\n\tlet dnsLookupTime: number | undefined; // domainLookupEnd - domainLookupStart\n\t// Interval between the first fetch until the last byte of the last redirect.\n\tlet redirectTime: number | undefined; // redirectEnd - redirectStart\n\t// Time to establish the connection to the server to retrieve the resource.\n\tlet tcpHandshakeTime: number | undefined; // connectEnd - connectStart\n\t// Time from the end of the connection until the inital handshake process to secure the connection.\n\t// If 0, then no time is spent here.\n\tlet secureConnectionTime: number | undefined; // connectEnd - secureConnectionStart\n\t// Interval to receive all (first to last) bytes form the server.\n\tlet responseNetworkTime: number | undefined; // responsEnd - responseStart\n\t// Interval between the initial fetch until the last byte is received.\n\t// Likely same as fetchTime + receiveContentTime.\n\tlet fetchStartToResponseEndTime: number | undefined; // responseEnd - fetchStart\n\t// reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>\n\t// Interval between starting the request for the resource until receiving the last byte.\n\tlet reqStartToResponseEndTime: number | undefined; // responseEnd - requestStart\n\tlet w3cStartTime: number | undefined; // W3C Start time = fetchStart time\n\n\t// getEntriesByType is only available in browser performance object\n\tconst resources1 = performance.getEntriesByType?.(\"resource\") ?? [];\n\t// Usually the latest fetch call is to the end of resources, so we start from the end.\n\tfor (let i = resources1.length - 1; i > 0; i--) {\n\t\tconst indResTime = resources1[i] as PerformanceResourceTiming;\n\t\tconst resource_name = indResTime.name.toString();\n\t\tconst resource_initiatortype = indResTime.initiatorType;\n\t\tif (\n\t\t\tresource_initiatortype.localeCompare(initiatorType) === 0 &&\n\t\t\tresource_name.includes(url)\n\t\t) {\n\t\t\tredirectTime = indResTime.redirectEnd - indResTime.redirectStart;\n\t\t\tw3cStartTime = indResTime.fetchStart;\n\t\t\tdnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;\n\t\t\ttcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;\n\t\t\tsecureConnectionTime =\n\t\t\t\tindResTime.secureConnectionStart > 0\n\t\t\t\t\t? indResTime.connectEnd - indResTime.secureConnectionStart\n\t\t\t\t\t: 0;\n\t\t\tresponseNetworkTime =\n\t\t\t\tindResTime.responseStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.responseStart\n\t\t\t\t\t: undefined;\n\t\t\tfetchStartToResponseEndTime =\n\t\t\t\tindResTime.fetchStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.fetchStart\n\t\t\t\t\t: undefined;\n\t\t\treqStartToResponseEndTime =\n\t\t\t\tindResTime.requestStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.requestStart\n\t\t\t\t\t: undefined;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn {\n\t\tdnsLookupTime,\n\t\tw3cStartTime,\n\t\tredirectTime,\n\t\ttcpHandshakeTime,\n\t\tsecureConnectionTime,\n\t\tresponseNetworkTime,\n\t\tfetchStartToResponseEndTime,\n\t\treqStartToResponseEndTime,\n\t};\n}\n\n/**\n * An implementation of Promise.race that gives you the winner of the promise race.\n * If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.\n *\n * @public\n */\nexport async function promiseRaceWithWinner<T>(\n\tpromises: Promise<T>[],\n): Promise<{ index: number; value: T }> {\n\treturn new Promise((resolve, reject) => {\n\t\tpromises.forEach((p, index) => {\n\t\t\tp.then((v) => resolve({ index, value: v })).catch(reject);\n\t\t});\n\t});\n}\n\n/**\n * @public\n */\nexport function validateMessages(\n\treason: string,\n\tmessages: ISequencedDocumentMessage[],\n\tfrom: number,\n\tlogger: ITelemetryLoggerExt,\n\tstrict: boolean = true,\n) {\n\tif (messages.length !== 0) {\n\t\tconst start = messages[0].sequenceNumber;\n\t\tconst length = messages.length;\n\t\tconst last = messages[length - 1].sequenceNumber;\n\t\tif (last + 1 !== from + length) {\n\t\t\t// If not strict, then return the first consecutive sub-block. If strict or start\n\t\t\t// seq number is not what we expected, then return no ops.\n\t\t\tif (strict || from !== start) {\n\t\t\t\tmessages.length = 0;\n\t\t\t} else {\n\t\t\t\tlet validOpsCount = 1;\n\t\t\t\twhile (\n\t\t\t\t\tvalidOpsCount < messages.length &&\n\t\t\t\t\tmessages[validOpsCount].sequenceNumber ===\n\t\t\t\t\t\tmessages[validOpsCount - 1].sequenceNumber + 1\n\t\t\t\t) {\n\t\t\t\t\tvalidOpsCount++;\n\t\t\t\t}\n\t\t\t\tmessages.length = validOpsCount;\n\t\t\t}\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\treason,\n\t\t\t\tfrom,\n\t\t\t\tstart,\n\t\t\t\tlast,\n\t\t\t\tlength,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\tvalidLength: messages.length,\n\t\t\t\t\tlastValidOpSeqNumber:\n\t\t\t\t\t\tmessages.length > 0\n\t\t\t\t\t\t\t? messages[messages.length - 1].sequenceNumber\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tstrict,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"driverUtils.mjs","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,8BAA8B;AAI1D;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,aAAqB;IAC5D,mFAAmF;IACnF,2EAA2E;IAC3E,8FAA8F;IAC9F,wGAAwG;IACxG,oFAAoF;IACpF,gGAAgG;IAChG,mGAAmG;IACnG,mGAAmG;IACnG,2FAA2F;IAC3F,oGAAoG;IACpG,mGAAmG;IACnG,4EAA4E;IAC5E,+FAA+F;IAE/F,gFAAgF;IAChF,IAAI,aAAiC,CAAC,CAAC,sCAAsC;IAC7E,6EAA6E;IAC7E,IAAI,YAAgC,CAAC,CAAC,8BAA8B;IACpE,2EAA2E;IAC3E,IAAI,gBAAoC,CAAC,CAAC,6BAA6B;IACvE,mGAAmG;IACnG,oCAAoC;IACpC,IAAI,oBAAwC,CAAC,CAAC,sCAAsC;IACpF,iEAAiE;IACjE,IAAI,mBAAuC,CAAC,CAAC,6BAA6B;IAC1E,sEAAsE;IACtE,iDAAiD;IACjD,IAAI,2BAA+C,CAAC,CAAC,4BAA4B;IACjF,oFAAoF;IACpF,wFAAwF;IACxF,IAAI,yBAA6C,CAAC,CAAC,6BAA6B;IAChF,IAAI,YAAgC,CAAC,CAAC,mCAAmC;IAEzE,mEAAmE;IACnE,MAAM,UAAU,GAAG,WAAW,CAAC,gBAAgB,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACpE,sFAAsF;IACtF,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC/C,MAA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AE,CAAC;iBAChB;gBACD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC;aAChC;YACD,MAAM,CAAC,cAAc,CAAC;gBACrB,SAAS,EAAE,mBAAmB;gBAC9B,MAAM;gBACN,IAAI;gBACJ,KAAK;gBACL,IAAI;gBACJ,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,WAAW,EAAE,QAAQ,CAAC,MAAM;oBAC5B,oBAAoB,EACnB,QAAQ,CAAC,MAAM,GAAG,CAAC;wBAClB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc;wBAC9C,CAAC,CAAC,SAAS;oBACb,MAAM;iBACN,CAAC;aACF,CAAC,CAAC;SACH;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\n\n/**\n * Extract and return the w3c data.\n * @param url - request url for which w3c data needs to be reported.\n * @param initiatorType - type of the network call\n * @internal\n */\nexport function getW3CData(url: string, initiatorType: string) {\n\t// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n\t// fetchStart: immediately before the browser starts to fetch the resource.\n\t// requestStart: immediately before the browser starts requesting the resource from the server\n\t// responseStart: immediately after the browser receives the first byte of the response from the server.\n\t// responseEnd: immediately after the browser receives the last byte of the resource\n\t// or immediately before the transport connection is closed, whichever comes first.\n\t// secureConnectionStart: immediately before the browser starts the handshake process to secure the\n\t// current connection. If a secure connection is not used, this property returns zero.\n\t// startTime: Time when the resource fetch started. This value is equivalent to fetchStart.\n\t// domainLookupStart: immediately before the browser starts the domain name lookup for the resource.\n\t// domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.\n\t// redirectStart: start time of the fetch which that initiates the redirect.\n\t// redirectEnd: immediately after receiving the last byte of the response of the last redirect.\n\n\t// Interval between start and finish of the domain name lookup for the resource.\n\tlet dnsLookupTime: number | undefined; // domainLookupEnd - domainLookupStart\n\t// Interval between the first fetch until the last byte of the last redirect.\n\tlet redirectTime: number | undefined; // redirectEnd - redirectStart\n\t// Time to establish the connection to the server to retrieve the resource.\n\tlet tcpHandshakeTime: number | undefined; // connectEnd - connectStart\n\t// Time from the end of the connection until the inital handshake process to secure the connection.\n\t// If 0, then no time is spent here.\n\tlet secureConnectionTime: number | undefined; // connectEnd - secureConnectionStart\n\t// Interval to receive all (first to last) bytes form the server.\n\tlet responseNetworkTime: number | undefined; // responsEnd - responseStart\n\t// Interval between the initial fetch until the last byte is received.\n\t// Likely same as fetchTime + receiveContentTime.\n\tlet fetchStartToResponseEndTime: number | undefined; // responseEnd - fetchStart\n\t// reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>\n\t// Interval between starting the request for the resource until receiving the last byte.\n\tlet reqStartToResponseEndTime: number | undefined; // responseEnd - requestStart\n\tlet w3cStartTime: number | undefined; // W3C Start time = fetchStart time\n\n\t// getEntriesByType is only available in browser performance object\n\tconst resources1 = performance.getEntriesByType?.(\"resource\") ?? [];\n\t// Usually the latest fetch call is to the end of resources, so we start from the end.\n\tfor (let i = resources1.length - 1; i > 0; i--) {\n\t\tconst indResTime = resources1[i] as PerformanceResourceTiming;\n\t\tconst resource_name = indResTime.name.toString();\n\t\tconst resource_initiatortype = indResTime.initiatorType;\n\t\tif (\n\t\t\tresource_initiatortype.localeCompare(initiatorType) === 0 &&\n\t\t\tresource_name.includes(url)\n\t\t) {\n\t\t\tredirectTime = indResTime.redirectEnd - indResTime.redirectStart;\n\t\t\tw3cStartTime = indResTime.fetchStart;\n\t\t\tdnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;\n\t\t\ttcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;\n\t\t\tsecureConnectionTime =\n\t\t\t\tindResTime.secureConnectionStart > 0\n\t\t\t\t\t? indResTime.connectEnd - indResTime.secureConnectionStart\n\t\t\t\t\t: 0;\n\t\t\tresponseNetworkTime =\n\t\t\t\tindResTime.responseStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.responseStart\n\t\t\t\t\t: undefined;\n\t\t\tfetchStartToResponseEndTime =\n\t\t\t\tindResTime.fetchStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.fetchStart\n\t\t\t\t\t: undefined;\n\t\t\treqStartToResponseEndTime =\n\t\t\t\tindResTime.requestStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.requestStart\n\t\t\t\t\t: undefined;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn {\n\t\tdnsLookupTime,\n\t\tw3cStartTime,\n\t\tredirectTime,\n\t\ttcpHandshakeTime,\n\t\tsecureConnectionTime,\n\t\tresponseNetworkTime,\n\t\tfetchStartToResponseEndTime,\n\t\treqStartToResponseEndTime,\n\t};\n}\n\n/**\n * An implementation of Promise.race that gives you the winner of the promise race.\n * If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.\n * @internal\n */\nexport async function promiseRaceWithWinner<T>(\n\tpromises: Promise<T>[],\n): Promise<{ index: number; value: T }> {\n\treturn new Promise((resolve, reject) => {\n\t\tpromises.forEach((p, index) => {\n\t\t\tp.then((v) => resolve({ index, value: v })).catch(reject);\n\t\t});\n\t});\n}\n\n/**\n * @internal\n */\nexport function validateMessages(\n\treason: string,\n\tmessages: ISequencedDocumentMessage[],\n\tfrom: number,\n\tlogger: ITelemetryLoggerExt,\n\tstrict: boolean = true,\n) {\n\tif (messages.length !== 0) {\n\t\tconst start = messages[0].sequenceNumber;\n\t\tconst length = messages.length;\n\t\tconst last = messages[length - 1].sequenceNumber;\n\t\tif (last + 1 !== from + length) {\n\t\t\t// If not strict, then return the first consecutive sub-block. If strict or start\n\t\t\t// seq number is not what we expected, then return no ops.\n\t\t\tif (strict || from !== start) {\n\t\t\t\tmessages.length = 0;\n\t\t\t} else {\n\t\t\t\tlet validOpsCount = 1;\n\t\t\t\twhile (\n\t\t\t\t\tvalidOpsCount < messages.length &&\n\t\t\t\t\tmessages[validOpsCount].sequenceNumber ===\n\t\t\t\t\t\tmessages[validOpsCount - 1].sequenceNumber + 1\n\t\t\t\t) {\n\t\t\t\t\tvalidOpsCount++;\n\t\t\t\t}\n\t\t\t\tmessages.length = validOpsCount;\n\t\t\t}\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\treason,\n\t\t\t\tfrom,\n\t\t\t\tstart,\n\t\t\t\tlast,\n\t\t\t\tlength,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\tvalidLength: messages.length,\n\t\t\t\t\tlastValidOpSeqNumber:\n\t\t\t\t\t\tmessages.length > 0\n\t\t\t\t\t\t\t? messages[messages.length - 1].sequenceNumber\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tstrict,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
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-dev.7.4.0.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev.7.4.0.216897";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.mjs
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-dev.7.4.0.
|
|
8
|
+
export const pkgVersion = "2.0.0-dev.7.4.0.216897";
|
|
9
9
|
//# sourceMappingURL=packageVersion.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,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-dev.7.4.0.
|
|
1
|
+
{"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,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-dev.7.4.0.216897\";\n"]}
|