@fluidframework/driver-base 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.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-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- 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 +26 -0
- package/dist/driver-base-beta.d.ts +38 -0
- package/dist/driver-base-public.d.ts +38 -0
- package/dist/driver-base-untrimmed.d.ts +213 -0
- 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 +26 -0
- package/lib/driver-base-beta.d.ts +38 -0
- package/lib/driver-base-public.d.ts +38 -0
- package/lib/driver-base-untrimmed.d.ts +213 -0
- 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/index.d.ts +2 -2
- package/lib/index.d.ts.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 +28 -25
- package/src/documentDeltaConnection.ts +1 -2
- package/src/driverUtils.ts +3 -5
- package/src/packageVersion.ts +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
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
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
23
|
+
protected readonly socket: Socket;
|
|
24
|
+
documentId: string;
|
|
25
|
+
private readonly enableLongPollingDowngrades;
|
|
26
|
+
protected readonly connectionId?: string | undefined;
|
|
27
|
+
static readonly eventsToForward: string[];
|
|
28
|
+
static readonly eventsAlwaysForwarded: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Last known sequence number to ordering service at the time of connection
|
|
31
|
+
* It may lap actual last sequence number (quite a bit, if container is very active).
|
|
32
|
+
* But it's best information for client to figure out how far it is behind, at least
|
|
33
|
+
* for "read" connections. "write" connections may use own "join" op to similar information,
|
|
34
|
+
* that is likely to be more up-to-date.
|
|
35
|
+
*/
|
|
36
|
+
checkpointSequenceNumber: number | undefined;
|
|
37
|
+
protected readonly queuedMessages: ISequencedDocumentMessage[];
|
|
38
|
+
protected readonly queuedSignals: ISignalMessage[];
|
|
39
|
+
/**
|
|
40
|
+
* A flag to indicate whether we have our handler attached. If it's attached, we're queueing incoming ops
|
|
41
|
+
* to later be retrieved via initialMessages.
|
|
42
|
+
*/
|
|
43
|
+
private earlyOpHandlerAttached;
|
|
44
|
+
private socketConnectionTimeout;
|
|
45
|
+
private _details;
|
|
46
|
+
private trackLatencyTimeout;
|
|
47
|
+
private readonly connectionListeners;
|
|
48
|
+
private readonly trackedListeners;
|
|
49
|
+
protected get hasDetails(): boolean;
|
|
50
|
+
get disposed(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages.
|
|
53
|
+
* After disconnection, we flip this to prevent any stale messages from being emitted.
|
|
54
|
+
*/
|
|
55
|
+
protected _disposed: boolean;
|
|
56
|
+
private readonly mc;
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated Implementors should manage their own logger or monitoring context
|
|
59
|
+
*/
|
|
60
|
+
protected get logger(): ITelemetryLoggerExt;
|
|
61
|
+
get details(): IConnected;
|
|
62
|
+
/**
|
|
63
|
+
* @param socket - websocket to be used
|
|
64
|
+
* @param documentId - ID of the document
|
|
65
|
+
* @param logger - for reporting telemetry events
|
|
66
|
+
* @param enableLongPollingDowngrades - allow connection to be downgraded to long-polling on websocket failure
|
|
67
|
+
*/
|
|
68
|
+
protected constructor(socket: Socket, documentId: string, logger: ITelemetryLoggerExt, enableLongPollingDowngrades?: boolean, connectionId?: string | undefined);
|
|
69
|
+
/**
|
|
70
|
+
* Get the ID of the client who is sending the message
|
|
71
|
+
*
|
|
72
|
+
* @returns the client ID
|
|
73
|
+
*/
|
|
74
|
+
get clientId(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Get the mode of the client
|
|
77
|
+
*
|
|
78
|
+
* @returns the client mode
|
|
79
|
+
*/
|
|
80
|
+
get mode(): ConnectionMode;
|
|
81
|
+
/**
|
|
82
|
+
* Get the claims of the client who is sending the message
|
|
83
|
+
*
|
|
84
|
+
* @returns client claims
|
|
85
|
+
*/
|
|
86
|
+
get claims(): ITokenClaims;
|
|
87
|
+
/**
|
|
88
|
+
* Get whether or not this is an existing document
|
|
89
|
+
*
|
|
90
|
+
* @returns true if the document exists
|
|
91
|
+
*/
|
|
92
|
+
get existing(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Get the maximum size of a message before chunking is required
|
|
95
|
+
*
|
|
96
|
+
* @returns the maximum size of a message before chunking is required
|
|
97
|
+
*/
|
|
98
|
+
get maxMessageSize(): number;
|
|
99
|
+
/**
|
|
100
|
+
* Semver of protocol being used with the service
|
|
101
|
+
*/
|
|
102
|
+
get version(): string;
|
|
103
|
+
/**
|
|
104
|
+
* Configuration details provided by the service
|
|
105
|
+
*/
|
|
106
|
+
get serviceConfiguration(): IClientConfiguration;
|
|
107
|
+
private checkNotDisposed;
|
|
108
|
+
/**
|
|
109
|
+
* Get messages sent during the connection
|
|
110
|
+
*
|
|
111
|
+
* @returns messages sent during the connection
|
|
112
|
+
*/
|
|
113
|
+
get initialMessages(): ISequencedDocumentMessage[];
|
|
114
|
+
/**
|
|
115
|
+
* Get signals sent during the connection
|
|
116
|
+
*
|
|
117
|
+
* @returns signals sent during the connection
|
|
118
|
+
*/
|
|
119
|
+
get initialSignals(): ISignalMessage[];
|
|
120
|
+
/**
|
|
121
|
+
* Get initial client list
|
|
122
|
+
*
|
|
123
|
+
* @returns initial client list sent during the connection
|
|
124
|
+
*/
|
|
125
|
+
get initialClients(): ISignalClient[];
|
|
126
|
+
protected emitMessages(type: string, messages: IDocumentMessage[][]): void;
|
|
127
|
+
/**
|
|
128
|
+
* Submits a new delta operation to the server
|
|
129
|
+
*
|
|
130
|
+
* @param message - delta operation to submit
|
|
131
|
+
*/
|
|
132
|
+
submit(messages: IDocumentMessage[]): void;
|
|
133
|
+
/**
|
|
134
|
+
* Submits a new signal to the server
|
|
135
|
+
*
|
|
136
|
+
* @param content - Content of the signal.
|
|
137
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
138
|
+
*/
|
|
139
|
+
submitSignal(content: IDocumentMessage, targetClientId?: string): 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
|
+
* @internal
|
|
186
|
+
*/
|
|
187
|
+
export declare function getW3CData(url: string, initiatorType: string): {
|
|
188
|
+
dnsLookupTime: number | undefined;
|
|
189
|
+
w3cStartTime: number | undefined;
|
|
190
|
+
redirectTime: number | undefined;
|
|
191
|
+
tcpHandshakeTime: number | undefined;
|
|
192
|
+
secureConnectionTime: number | undefined;
|
|
193
|
+
responseNetworkTime: number | undefined;
|
|
194
|
+
fetchStartToResponseEndTime: number | undefined;
|
|
195
|
+
reqStartToResponseEndTime: number | undefined;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
200
|
+
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
201
|
+
* @internal
|
|
202
|
+
*/
|
|
203
|
+
export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{
|
|
204
|
+
index: number;
|
|
205
|
+
value: T;
|
|
206
|
+
}>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
211
|
+
export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
|
|
212
|
+
|
|
213
|
+
export { }
|
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;
|
|
1
|
+
{"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,yBAAyB,EAAE,MAAM,sCAAsC;OACzE,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;AAErE;;;;;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/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Ac,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 *\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;IAC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AAM,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC;QACjD,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM,EAAE;YAC/B,iFAAiF;YACjF,0DAA0D;YAC1D,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","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/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { DocumentDeltaConnection } from "./documentDeltaConnection";
|
|
6
|
-
export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils";
|
|
5
|
+
export { DocumentDeltaConnection } from "./documentDeltaConnection.mjs";
|
|
6
|
+
export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils.mjs";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,uBAAuB,EAAE;OAC3B,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,EAAE"}
|
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.4.1";
|
|
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-internal.7.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.7.4.1";
|
|
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,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.mjs","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.4.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.4.1",
|
|
4
4
|
"description": "Shared driver code for Fluid driver implementations",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -11,18 +11,6 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Microsoft and contributors",
|
|
13
13
|
"sideEffects": false,
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"import": {
|
|
17
|
-
"types": "./lib/index.d.ts",
|
|
18
|
-
"default": "./lib/index.mjs"
|
|
19
|
-
},
|
|
20
|
-
"require": {
|
|
21
|
-
"types": "./dist/index.d.ts",
|
|
22
|
-
"default": "./dist/index.cjs"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
14
|
"main": "dist/index.cjs",
|
|
27
15
|
"module": "lib/index.mjs",
|
|
28
16
|
"types": "dist/index.d.ts",
|
|
@@ -47,25 +35,27 @@
|
|
|
47
35
|
"temp-directory": "nyc/.nyc_output"
|
|
48
36
|
},
|
|
49
37
|
"dependencies": {
|
|
50
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
51
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
52
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
53
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
54
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
39
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
40
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
41
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
42
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
55
43
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
56
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
44
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0"
|
|
57
45
|
},
|
|
58
46
|
"devDependencies": {
|
|
47
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
59
48
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
60
49
|
"@fluidframework/build-common": "^2.0.3",
|
|
61
50
|
"@fluidframework/build-tools": "^0.28.0",
|
|
62
51
|
"@fluidframework/driver-base-previous": "npm:@fluidframework/driver-base@2.0.0-internal.7.2.0",
|
|
63
52
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
64
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
53
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
65
54
|
"@microsoft/api-extractor": "^7.38.3",
|
|
66
55
|
"@types/mocha": "^9.1.1",
|
|
67
|
-
"@types/node": "^
|
|
56
|
+
"@types/node": "^18.19.0",
|
|
68
57
|
"c8": "^7.7.1",
|
|
58
|
+
"copyfiles": "^2.4.1",
|
|
69
59
|
"cross-env": "^7.0.3",
|
|
70
60
|
"eslint": "~8.50.0",
|
|
71
61
|
"mocha": "^10.2.0",
|
|
@@ -80,6 +70,14 @@
|
|
|
80
70
|
},
|
|
81
71
|
"fluidBuild": {
|
|
82
72
|
"tasks": {
|
|
73
|
+
"build:docs": {
|
|
74
|
+
"dependsOn": [
|
|
75
|
+
"...",
|
|
76
|
+
"api-extractor:commonjs",
|
|
77
|
+
"api-extractor:esnext"
|
|
78
|
+
],
|
|
79
|
+
"script": false
|
|
80
|
+
},
|
|
83
81
|
"tsc": [
|
|
84
82
|
"...",
|
|
85
83
|
"typetests:gen"
|
|
@@ -90,22 +88,27 @@
|
|
|
90
88
|
"broken": {}
|
|
91
89
|
},
|
|
92
90
|
"scripts": {
|
|
91
|
+
"api": "fluid-build . --task api",
|
|
92
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
93
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
93
94
|
"build": "fluid-build . --task build",
|
|
94
95
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
95
96
|
"build:compile": "fluid-build . --task compile",
|
|
96
|
-
"build:docs": "
|
|
97
|
+
"build:docs": "fluid-build . --task api",
|
|
97
98
|
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
98
99
|
"build:genver": "gen-version",
|
|
99
100
|
"build:test": "tsc-multi --config ./tsc-multi.test.json",
|
|
101
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
102
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
100
103
|
"ci:build:docs": "api-extractor run",
|
|
101
104
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
102
105
|
"eslint": "eslint --format stylish src",
|
|
103
106
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
104
107
|
"format": "npm run prettier:fix",
|
|
105
|
-
"lint": "npm run prettier && npm run eslint",
|
|
108
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
106
109
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
107
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
108
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
110
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
111
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
109
112
|
"test": "npm run test:mocha",
|
|
110
113
|
"test:coverage": "c8 npm test",
|
|
111
114
|
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
@@ -38,8 +38,7 @@ import { pkgVersion as driverVersion } from "./packageVersion";
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Represents a connection to a stream of delta updates.
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
41
|
+
* @internal
|
|
43
42
|
*/
|
|
44
43
|
export class DocumentDeltaConnection
|
|
45
44
|
extends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents>
|
package/src/driverUtils.ts
CHANGED
|
@@ -11,8 +11,7 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
|
11
11
|
* Extract and return the w3c data.
|
|
12
12
|
* @param url - request url for which w3c data needs to be reported.
|
|
13
13
|
* @param initiatorType - type of the network call
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
14
|
+
* @internal
|
|
16
15
|
*/
|
|
17
16
|
export function getW3CData(url: string, initiatorType: string) {
|
|
18
17
|
// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
|
|
@@ -97,8 +96,7 @@ export function getW3CData(url: string, initiatorType: string) {
|
|
|
97
96
|
/**
|
|
98
97
|
* An implementation of Promise.race that gives you the winner of the promise race.
|
|
99
98
|
* If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.
|
|
100
|
-
*
|
|
101
|
-
* @public
|
|
99
|
+
* @internal
|
|
102
100
|
*/
|
|
103
101
|
export async function promiseRaceWithWinner<T>(
|
|
104
102
|
promises: Promise<T>[],
|
|
@@ -111,7 +109,7 @@ export async function promiseRaceWithWinner<T>(
|
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
/**
|
|
114
|
-
* @
|
|
112
|
+
* @internal
|
|
115
113
|
*/
|
|
116
114
|
export function validateMessages(
|
|
117
115
|
reason: string,
|
package/src/packageVersion.ts
CHANGED