@fluidframework/driver-base 2.0.0-internal.6.4.0 → 2.0.0-internal.7.1.0

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.
@@ -0,0 +1,215 @@
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 { }
@@ -8,6 +8,8 @@ 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
13
  */
12
14
  export declare function getW3CData(url: string, initiatorType: string): {
13
15
  dnsLookupTime: number | undefined;
@@ -19,9 +21,18 @@ export declare function getW3CData(url: string, initiatorType: string): {
19
21
  fetchStartToResponseEndTime: number | undefined;
20
22
  reqStartToResponseEndTime: number | undefined;
21
23
  };
24
+ /**
25
+ * An implementation of Promise.race that gives you the winner of the promise race.
26
+ * 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
29
+ */
22
30
  export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
23
31
  index: number;
24
32
  value: T;
25
33
  }>;
34
+ /**
35
+ * @public
36
+ */
26
37
  export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
27
38
  //# sourceMappingURL=driverUtils.d.ts.map
@@ -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;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;;;;;;EA8E5D;AAMD,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,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"}
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;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;;;;;;EA8E5D;AAED;;;;;GAKG;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"}
@@ -10,6 +10,8 @@ const client_utils_1 = require("@fluid-internal/client-utils");
10
10
  * Extract and return the w3c data.
11
11
  * @param url - request url for which w3c data needs to be reported.
12
12
  * @param initiatorType - type of the network call
13
+ *
14
+ * @public
13
15
  */
14
16
  function getW3CData(url, initiatorType) {
15
17
  // From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
@@ -87,9 +89,11 @@ function getW3CData(url, initiatorType) {
87
89
  };
88
90
  }
89
91
  exports.getW3CData = getW3CData;
90
- /*
92
+ /**
91
93
  * An implementation of Promise.race that gives you the winner of the promise race.
92
94
  * If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
95
+ *
96
+ * @public
93
97
  */
94
98
  async function promiseRaceWithWinner(promises) {
95
99
  return new Promise((resolve, reject) => {
@@ -99,6 +103,9 @@ async function promiseRaceWithWinner(promises) {
99
103
  });
100
104
  }
101
105
  exports.promiseRaceWithWinner = promiseRaceWithWinner;
106
+ /**
107
+ * @public
108
+ */
102
109
  function validateMessages(reason, messages, from, logger, strict = true) {
103
110
  if (messages.length !== 0) {
104
111
  const start = messages[0].sequenceNumber;
@@ -1 +1 @@
1
- {"version":3,"file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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;AA7CD,4CA6CC","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 */\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 */\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\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.js","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA2D;AAI3D;;;;;;GAMG;AACH,SAAgB,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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D,IAAI,MAAM,IAAI,IAAI,KAAK,KAAK,EAAE;gBAC7B,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;aACpB;iBAAM;gBACN,IAAI,aAAa,GAAG,CAAC,CAAC;gBACtB,OACC,aAAa,GAAG,QAAQ,CAAC,MAAM;oBAC/B,QAAQ,CAAC,aAAa,CAAC,CAAC,cAAc;wBACrC,QAAQ,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,EAC9C;oBACD,aAAa,EAAE,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;AA7CD,4CA6CC","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 *\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"]}
@@ -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.6.4.0";
8
+ export declare const pkgVersion = "2.0.0-internal.7.1.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/driver-base";
11
- exports.pkgVersion = "2.0.0-internal.6.4.0";
11
+ exports.pkgVersion = "2.0.0-internal.7.1.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,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.6.4.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,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.0\";\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.34.9"
8
+ "packageVersion": "7.38.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -8,7 +8,9 @@ import { IDisposable } from "@fluidframework/core-interfaces";
8
8
  import { ITelemetryLoggerExt, EventEmitterWithErrorHandling } from "@fluidframework/telemetry-utils";
9
9
  import type { Socket } from "socket.io-client";
10
10
  /**
11
- * Represents a connection to a stream of delta updates
11
+ * Represents a connection to a stream of delta updates.
12
+ *
13
+ * @public
12
14
  */
13
15
  export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
14
16
  protected readonly socket: Socket;
@@ -153,7 +155,7 @@ export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandli
153
155
  connectionId: string | undefined;
154
156
  };
155
157
  protected earlyOpHandler: (documentId: string, msgs: ISequencedDocumentMessage[]) => void;
156
- protected earlySignalHandler: (msg: ISignalMessage) => void;
158
+ protected earlySignalHandler: (msg: ISignalMessage | ISignalMessage[]) => void;
157
159
  private removeEarlyOpHandler;
158
160
  private removeEarlySignalHandler;
159
161
  private addConnectionListener;
@@ -1 +1 @@
1
- {"version":3,"file":"documentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,YAAY,EAEZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAwB,MAAM,iCAAiC,CAAC;AACpF,OAAO,EACN,mBAAmB,EAInB,6BAA6B,EAG7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,qBAAa,uBACZ,SAAQ,6BAA6B,CAAC,8BAA8B,CACpE,YAAW,wBAAwB,EAAE,WAAW;IA8E/C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAC1B,UAAU,EAAE,MAAM;IAEzB,OAAO,CA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AAa,EAAE,CAG3C;IAED,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE;IASnE;;;;OAIG;IACI,MAAM,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,IAAI;IAKjD;;;;OAIG;IACI,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAKpD;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,eAAe;IAIhD;;;;OAIG;IACI,OAAO;IAkBd,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe;IAgCzC;;;OAGG;IACH,SAAS,CAAC,cAAc;cAIR,UAAU,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM;IA0MpE,OAAO,CAAC,eAAe;IAWvB,SAAS,CAAC,yBAAyB;;;;;;IASnC,SAAS,CAAC,cAAc,eAAgB,MAAM,QAAQ,yBAAyB,EAAE,UAE/E;IAEF,SAAS,CAAC,kBAAkB,QAAS,cAAc,GAAG,cAAc,EAAE,UAMpE;IAEF,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,qBAAqB;IAc7B,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI;IAM9E,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,0BAA0B;IAmBlC;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,UAAO,GAAG,eAAe;CAY3F"}
@@ -9,9 +9,30 @@ import { extractLogSafeErrorProperties, getCircularReplacer, EventEmitterWithErr
9
9
  // For now, this package is versioned and released in unison with the specific drivers
10
10
  import { pkgVersion as driverVersion } from "./packageVersion";
11
11
  /**
12
- * Represents a connection to a stream of delta updates
12
+ * Represents a connection to a stream of delta updates.
13
+ *
14
+ * @public
13
15
  */
14
16
  export class DocumentDeltaConnection extends EventEmitterWithErrorHandling {
17
+ get hasDetails() {
18
+ return !!this._details;
19
+ }
20
+ get disposed() {
21
+ assert(this._disposed || this.socket.connected, 0x244 /* "Socket is closed, but connection is not!" */);
22
+ return this._disposed;
23
+ }
24
+ /**
25
+ * @deprecated Implementors should manage their own logger or monitoring context
26
+ */
27
+ get logger() {
28
+ return this.mc.logger;
29
+ }
30
+ get details() {
31
+ if (!this._details) {
32
+ throw new Error("Internal error: calling method before _details is initialized!");
33
+ }
34
+ return this._details;
35
+ }
15
36
  /**
16
37
  * @param socket - websocket to be used
17
38
  * @param documentId - ID of the document
@@ -51,7 +72,12 @@ export class DocumentDeltaConnection extends EventEmitterWithErrorHandling {
51
72
  this.queuedMessages.push(...msgs);
52
73
  };
53
74
  this.earlySignalHandler = (msg) => {
54
- this.queuedSignals.push(msg);
75
+ if (Array.isArray(msg)) {
76
+ this.queuedSignals.push(...msg);
77
+ }
78
+ else {
79
+ this.queuedSignals.push(msg);
80
+ }
55
81
  };
56
82
  this.mc = createChildMonitoringContext({ logger, namespace: "DeltaConnection" });
57
83
  this.on("newListener", (event, _listener) => {
@@ -94,25 +120,6 @@ export class DocumentDeltaConnection extends EventEmitterWithErrorHandling {
94
120
  }
95
121
  });
96
122
  }
97
- get hasDetails() {
98
- return !!this._details;
99
- }
100
- get disposed() {
101
- assert(this._disposed || this.socket.connected, 0x244 /* "Socket is closed, but connection is not!" */);
102
- return this._disposed;
103
- }
104
- /**
105
- * @deprecated Implementors should manage their own logger or monitoring context
106
- */
107
- get logger() {
108
- return this.mc.logger;
109
- }
110
- get details() {
111
- if (!this._details) {
112
- throw new Error("Internal error: calling method before _details is initialized!");
113
- }
114
- return this._details;
115
- }
116
123
  /**
117
124
  * Get the ID of the client who is sending the message
118
125
  *