@fluidframework/driver-base 2.0.0-internal.4.0.5 → 2.0.0-internal.4.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # @fluidframework/driver-base
2
+
3
+ ## 2.0.0-internal.4.1.0
4
+
5
+ Dependency updates only.
package/README.md CHANGED
@@ -3,4 +3,40 @@
3
3
  This package contains an implementation of IDocumentDeltaConnection using websockets. This code is shared by multiple
4
4
  Fluid driver implementations that targeting different services.
5
5
 
6
- See [GitHub](https://github.com/microsoft/FluidFramework) for more details on the Fluid Framework and packages within.
6
+ <!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
7
+
8
+ <!-- prettier-ignore-start -->
9
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
10
+
11
+ ## Using Fluid Framework libraries
12
+
13
+ When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
14
+ While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
15
+ library consumers should always prefer `^`.
16
+
17
+ Note that when depending on a library version of the form 2.0.0-internal.x.y.z, called the Fluid internal version
18
+ scheme, you must use a `>= <` dependency range. Standard `^` and `~` ranges will not work as expected. See the
19
+ [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
20
+ package for more information including tools to convert between version schemes.
21
+
22
+ <!-- prettier-ignore-end -->
23
+
24
+ <!-- AUTO-GENERATED-CONTENT:END -->
25
+
26
+ <!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
27
+
28
+ <!-- prettier-ignore-start -->
29
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
30
+
31
+ ## Trademark
32
+
33
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
34
+
35
+ Use of these trademarks or logos must follow Microsoft's [Trademark & Brand
36
+ Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
37
+
38
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
39
+
40
+ <!-- prettier-ignore-end -->
41
+
42
+ <!-- AUTO-GENERATED-CONTENT:END -->
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Extract and return the w3c data.
7
+ * @param url - request url for which w3c data needs to be reported.
8
+ * @param initiatorType - type of the network call
9
+ */
10
+ export declare function getW3CData(url: string, initiatorType: string): {
11
+ dnsLookupTime: number | undefined;
12
+ w3cStartTime: number | undefined;
13
+ redirectTime: number | undefined;
14
+ tcpHandshakeTime: number | undefined;
15
+ secureConnectionTime: number | undefined;
16
+ responseNetworkTime: number | undefined;
17
+ fetchStartToResponseEndTime: number | undefined;
18
+ reqStartToResponseEndTime: number | undefined;
19
+ };
20
+ //# sourceMappingURL=driverUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;;;;;;EA8E5D"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getW3CData = void 0;
8
+ const common_utils_1 = require("@fluidframework/common-utils");
9
+ /**
10
+ * Extract and return the w3c data.
11
+ * @param url - request url for which w3c data needs to be reported.
12
+ * @param initiatorType - type of the network call
13
+ */
14
+ function getW3CData(url, initiatorType) {
15
+ // From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
16
+ // fetchStart: immediately before the browser starts to fetch the resource.
17
+ // requestStart: immediately before the browser starts requesting the resource from the server
18
+ // responseStart: immediately after the browser receives the first byte of the response from the server.
19
+ // responseEnd: immediately after the browser receives the last byte of the resource
20
+ // or immediately before the transport connection is closed, whichever comes first.
21
+ // secureConnectionStart: immediately before the browser starts the handshake process to secure the
22
+ // current connection. If a secure connection is not used, this property returns zero.
23
+ // startTime: Time when the resource fetch started. This value is equivalent to fetchStart.
24
+ // domainLookupStart: immediately before the browser starts the domain name lookup for the resource.
25
+ // domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.
26
+ // redirectStart: start time of the fetch which that initiates the redirect.
27
+ // redirectEnd: immediately after receiving the last byte of the response of the last redirect.
28
+ var _a, _b;
29
+ // Interval between start and finish of the domain name lookup for the resource.
30
+ let dnsLookupTime; // domainLookupEnd - domainLookupStart
31
+ // Interval between the first fetch until the last byte of the last redirect.
32
+ let redirectTime; // redirectEnd - redirectStart
33
+ // Time to establish the connection to the server to retrieve the resource.
34
+ let tcpHandshakeTime; // connectEnd - connectStart
35
+ // Time from the end of the connection until the inital handshake process to secure the connection.
36
+ // If 0, then no time is spent here.
37
+ let secureConnectionTime; // connectEnd - secureConnectionStart
38
+ // Interval to receive all (first to last) bytes form the server.
39
+ let responseNetworkTime; // responsEnd - responseStart
40
+ // Interval between the initial fetch until the last byte is received.
41
+ // Likely same as fetchTime + receiveContentTime.
42
+ let fetchStartToResponseEndTime; // responseEnd - fetchStart
43
+ // reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>
44
+ // Interval between starting the request for the resource until receiving the last byte.
45
+ let reqStartToResponseEndTime; // responseEnd - requestStart
46
+ let w3cStartTime; // W3C Start time = fetchStart time
47
+ // getEntriesByType is only available in browser performance object
48
+ const resources1 = (_b = (_a = common_utils_1.performance.getEntriesByType) === null || _a === void 0 ? void 0 : _a.call(common_utils_1.performance, "resource")) !== null && _b !== void 0 ? _b : [];
49
+ // Usually the latest fetch call is to the end of resources, so we start from the end.
50
+ for (let i = resources1.length - 1; i > 0; i--) {
51
+ const indResTime = resources1[i];
52
+ const resource_name = indResTime.name.toString();
53
+ const resource_initiatortype = indResTime.initiatorType;
54
+ if (resource_initiatortype.localeCompare(initiatorType) === 0 &&
55
+ resource_name.includes(url)) {
56
+ redirectTime = indResTime.redirectEnd - indResTime.redirectStart;
57
+ w3cStartTime = indResTime.fetchStart;
58
+ dnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;
59
+ tcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;
60
+ secureConnectionTime =
61
+ indResTime.secureConnectionStart > 0
62
+ ? indResTime.connectEnd - indResTime.secureConnectionStart
63
+ : 0;
64
+ responseNetworkTime =
65
+ indResTime.responseStart > 0
66
+ ? indResTime.responseEnd - indResTime.responseStart
67
+ : undefined;
68
+ fetchStartToResponseEndTime =
69
+ indResTime.fetchStart > 0
70
+ ? indResTime.responseEnd - indResTime.fetchStart
71
+ : undefined;
72
+ reqStartToResponseEndTime =
73
+ indResTime.requestStart > 0
74
+ ? indResTime.responseEnd - indResTime.requestStart
75
+ : undefined;
76
+ break;
77
+ }
78
+ }
79
+ return {
80
+ dnsLookupTime,
81
+ w3cStartTime,
82
+ redirectTime,
83
+ tcpHandshakeTime,
84
+ secureConnectionTime,
85
+ responseNetworkTime,
86
+ fetchStartToResponseEndTime,
87
+ reqStartToResponseEndTime,
88
+ };
89
+ }
90
+ exports.getW3CData = getW3CData;
91
+ //# sourceMappingURL=driverUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driverUtils.js","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA2D;AAE3D;;;;GAIG;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,yBAA6C,CAAC,CAAC,6BAA6B;IAChF,IAAI,YAAgC,CAAC,CAAC,mCAAmC;IAEzE,mEAAmE;IACnE,MAAM,UAAU,GAAG,MAAA,MAAA,0BAAW,CAAC,gBAAgB,+CAA5B,0BAAW,EAAoB,UAAU,CAAC,mCAAI,EAAE,CAAC;IACpE,sFAAsF;IACtF,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAA8B,CAAC;QAC9D,MAAM,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACjD,MAAM,sBAAsB,GAAG,UAAU,CAAC,aAAa,CAAC;QACxD,IACC,sBAAsB,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC;YACzD,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC1B;YACD,YAAY,GAAG,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,aAAa,CAAC;YACjE,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC;YACrC,aAAa,GAAG,UAAU,CAAC,eAAe,GAAG,UAAU,CAAC,iBAAiB,CAAC;YAC1E,gBAAgB,GAAG,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC;YACnE,oBAAoB;gBACnB,UAAU,CAAC,qBAAqB,GAAG,CAAC;oBACnC,CAAC,CAAC,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,qBAAqB;oBAC1D,CAAC,CAAC,CAAC,CAAC;YACN,mBAAmB;gBAClB,UAAU,CAAC,aAAa,GAAG,CAAC;oBAC3B,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,aAAa;oBACnD,CAAC,CAAC,SAAS,CAAC;YACd,2BAA2B;gBAC1B,UAAU,CAAC,UAAU,GAAG,CAAC;oBACxB,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,UAAU;oBAChD,CAAC,CAAC,SAAS,CAAC;YACd,yBAAyB;gBACxB,UAAU,CAAC,YAAY,GAAG,CAAC;oBAC1B,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,YAAY;oBAClD,CAAC,CAAC,SAAS,CAAC;YACd,MAAM;SACN;KACD;IACD,OAAO;QACN,aAAa;QACb,YAAY;QACZ,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;QACpB,mBAAmB;QACnB,2BAA2B;QAC3B,yBAAyB;KACzB,CAAC;AACH,CAAC;AA9ED,gCA8EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"@fluidframework/common-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"]}
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { DocumentDeltaConnection } from "./documentDeltaConnection";
6
+ export { getW3CData } from "./driverUtils";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,9 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DocumentDeltaConnection = void 0;
7
+ exports.getW3CData = exports.DocumentDeltaConnection = void 0;
8
8
  var documentDeltaConnection_1 = require("./documentDeltaConnection");
9
9
  Object.defineProperty(exports, "DocumentDeltaConnection", { enumerable: true, get: function () { return documentDeltaConnection_1.DocumentDeltaConnection; } });
10
+ var driverUtils_1 = require("./driverUtils");
11
+ Object.defineProperty(exports, "getW3CData", { enumerable: true, get: function () { return driverUtils_1.getW3CData; } });
10
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DocumentDeltaConnection } from \"./documentDeltaConnection\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,6CAA2C;AAAlC,yGAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DocumentDeltaConnection } from \"./documentDeltaConnection\";\nexport { getW3CData } from \"./driverUtils\";\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.4.0.5";
8
+ export declare const pkgVersion = "2.0.0-internal.4.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.4.0.5";
11
+ exports.pkgVersion = "2.0.0-internal.4.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.4.0.5\";\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.4.1.0\";\n"]}
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Extract and return the w3c data.
7
+ * @param url - request url for which w3c data needs to be reported.
8
+ * @param initiatorType - type of the network call
9
+ */
10
+ export declare function getW3CData(url: string, initiatorType: string): {
11
+ dnsLookupTime: number | undefined;
12
+ w3cStartTime: number | undefined;
13
+ redirectTime: number | undefined;
14
+ tcpHandshakeTime: number | undefined;
15
+ secureConnectionTime: number | undefined;
16
+ responseNetworkTime: number | undefined;
17
+ fetchStartToResponseEndTime: number | undefined;
18
+ reqStartToResponseEndTime: number | undefined;
19
+ };
20
+ //# sourceMappingURL=driverUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;;;;;;EA8E5D"}
@@ -0,0 +1,87 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { performance } from "@fluidframework/common-utils";
6
+ /**
7
+ * Extract and return the w3c data.
8
+ * @param url - request url for which w3c data needs to be reported.
9
+ * @param initiatorType - type of the network call
10
+ */
11
+ export function getW3CData(url, initiatorType) {
12
+ // From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
13
+ // fetchStart: immediately before the browser starts to fetch the resource.
14
+ // requestStart: immediately before the browser starts requesting the resource from the server
15
+ // responseStart: immediately after the browser receives the first byte of the response from the server.
16
+ // responseEnd: immediately after the browser receives the last byte of the resource
17
+ // or immediately before the transport connection is closed, whichever comes first.
18
+ // secureConnectionStart: immediately before the browser starts the handshake process to secure the
19
+ // current connection. If a secure connection is not used, this property returns zero.
20
+ // startTime: Time when the resource fetch started. This value is equivalent to fetchStart.
21
+ // domainLookupStart: immediately before the browser starts the domain name lookup for the resource.
22
+ // domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.
23
+ // redirectStart: start time of the fetch which that initiates the redirect.
24
+ // redirectEnd: immediately after receiving the last byte of the response of the last redirect.
25
+ var _a, _b;
26
+ // Interval between start and finish of the domain name lookup for the resource.
27
+ let dnsLookupTime; // domainLookupEnd - domainLookupStart
28
+ // Interval between the first fetch until the last byte of the last redirect.
29
+ let redirectTime; // redirectEnd - redirectStart
30
+ // Time to establish the connection to the server to retrieve the resource.
31
+ let tcpHandshakeTime; // connectEnd - connectStart
32
+ // Time from the end of the connection until the inital handshake process to secure the connection.
33
+ // If 0, then no time is spent here.
34
+ let secureConnectionTime; // connectEnd - secureConnectionStart
35
+ // Interval to receive all (first to last) bytes form the server.
36
+ let responseNetworkTime; // responsEnd - responseStart
37
+ // Interval between the initial fetch until the last byte is received.
38
+ // Likely same as fetchTime + receiveContentTime.
39
+ let fetchStartToResponseEndTime; // responseEnd - fetchStart
40
+ // reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>
41
+ // Interval between starting the request for the resource until receiving the last byte.
42
+ let reqStartToResponseEndTime; // responseEnd - requestStart
43
+ let w3cStartTime; // W3C Start time = fetchStart time
44
+ // getEntriesByType is only available in browser performance object
45
+ const resources1 = (_b = (_a = performance.getEntriesByType) === null || _a === void 0 ? void 0 : _a.call(performance, "resource")) !== null && _b !== void 0 ? _b : [];
46
+ // Usually the latest fetch call is to the end of resources, so we start from the end.
47
+ for (let i = resources1.length - 1; i > 0; i--) {
48
+ const indResTime = resources1[i];
49
+ const resource_name = indResTime.name.toString();
50
+ const resource_initiatortype = indResTime.initiatorType;
51
+ if (resource_initiatortype.localeCompare(initiatorType) === 0 &&
52
+ resource_name.includes(url)) {
53
+ redirectTime = indResTime.redirectEnd - indResTime.redirectStart;
54
+ w3cStartTime = indResTime.fetchStart;
55
+ dnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;
56
+ tcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;
57
+ secureConnectionTime =
58
+ indResTime.secureConnectionStart > 0
59
+ ? indResTime.connectEnd - indResTime.secureConnectionStart
60
+ : 0;
61
+ responseNetworkTime =
62
+ indResTime.responseStart > 0
63
+ ? indResTime.responseEnd - indResTime.responseStart
64
+ : undefined;
65
+ fetchStartToResponseEndTime =
66
+ indResTime.fetchStart > 0
67
+ ? indResTime.responseEnd - indResTime.fetchStart
68
+ : undefined;
69
+ reqStartToResponseEndTime =
70
+ indResTime.requestStart > 0
71
+ ? indResTime.responseEnd - indResTime.requestStart
72
+ : undefined;
73
+ break;
74
+ }
75
+ }
76
+ return {
77
+ dnsLookupTime,
78
+ w3cStartTime,
79
+ redirectTime,
80
+ tcpHandshakeTime,
81
+ secureConnectionTime,
82
+ responseNetworkTime,
83
+ fetchStartToResponseEndTime,
84
+ reqStartToResponseEndTime,
85
+ };
86
+ }
87
+ //# sourceMappingURL=driverUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driverUtils.js","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;;GAIG;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,MAAA,MAAA,WAAW,CAAC,gBAAgB,+CAA5B,WAAW,EAAoB,UAAU,CAAC,mCAAI,EAAE,CAAC;IACpE,sFAAsF;IACtF,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAA8B,CAAC;QAC9D,MAAM,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACjD,MAAM,sBAAsB,GAAG,UAAU,CAAC,aAAa,CAAC;QACxD,IACC,sBAAsB,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC;YACzD,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC1B;YACD,YAAY,GAAG,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,aAAa,CAAC;YACjE,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC;YACrC,aAAa,GAAG,UAAU,CAAC,eAAe,GAAG,UAAU,CAAC,iBAAiB,CAAC;YAC1E,gBAAgB,GAAG,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC;YACnE,oBAAoB;gBACnB,UAAU,CAAC,qBAAqB,GAAG,CAAC;oBACnC,CAAC,CAAC,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,qBAAqB;oBAC1D,CAAC,CAAC,CAAC,CAAC;YACN,mBAAmB;gBAClB,UAAU,CAAC,aAAa,GAAG,CAAC;oBAC3B,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,aAAa;oBACnD,CAAC,CAAC,SAAS,CAAC;YACd,2BAA2B;gBAC1B,UAAU,CAAC,UAAU,GAAG,CAAC;oBACxB,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,UAAU;oBAChD,CAAC,CAAC,SAAS,CAAC;YACd,yBAAyB;gBACxB,UAAU,CAAC,YAAY,GAAG,CAAC;oBAC1B,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,YAAY;oBAClD,CAAC,CAAC,SAAS,CAAC;YACd,MAAM;SACN;KACD;IACD,OAAO;QACN,aAAa;QACb,YAAY;QACZ,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;QACpB,mBAAmB;QACnB,2BAA2B;QAC3B,yBAAyB;KACzB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"@fluidframework/common-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"]}
package/lib/index.d.ts CHANGED
@@ -3,4 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { DocumentDeltaConnection } from "./documentDeltaConnection";
6
+ export { getW3CData } from "./driverUtils";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
package/lib/index.js CHANGED
@@ -3,4 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { DocumentDeltaConnection } from "./documentDeltaConnection";
6
+ export { getW3CData } from "./driverUtils";
6
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DocumentDeltaConnection } from \"./documentDeltaConnection\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DocumentDeltaConnection } from \"./documentDeltaConnection\";\nexport { getW3CData } from \"./driverUtils\";\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.4.0.5";
8
+ export declare const pkgVersion = "2.0.0-internal.4.1.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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.4.0.5";
8
+ export const pkgVersion = "2.0.0-internal.4.1.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.0.0-internal.4.0.5\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.0.0-internal.4.1.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/driver-base",
3
- "version": "2.0.0-internal.4.0.5",
3
+ "version": "2.0.0-internal.4.1.0",
4
4
  "description": "Shared driver code for Fluid driver implementations",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -17,15 +17,15 @@
17
17
  "dependencies": {
18
18
  "@fluidframework/common-definitions": "^0.20.1",
19
19
  "@fluidframework/common-utils": "^1.1.1",
20
- "@fluidframework/driver-definitions": ">=2.0.0-internal.4.0.5 <2.0.0-internal.5.0.0",
21
- "@fluidframework/driver-utils": ">=2.0.0-internal.4.0.5 <2.0.0-internal.5.0.0",
20
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.4.1.0 <2.0.0-internal.4.2.0",
21
+ "@fluidframework/driver-utils": ">=2.0.0-internal.4.1.0 <2.0.0-internal.4.2.0",
22
22
  "@fluidframework/protocol-definitions": "^1.1.0",
23
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.4.0.5 <2.0.0-internal.5.0.0"
23
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.4.1.0 <2.0.0-internal.4.2.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@fluid-tools/build-cli": "^0.13.0",
26
+ "@fluid-tools/build-cli": "^0.15.0",
27
27
  "@fluidframework/build-common": "^1.1.0",
28
- "@fluidframework/build-tools": "^0.13.0",
28
+ "@fluidframework/build-tools": "^0.15.0",
29
29
  "@fluidframework/driver-base-previous": "npm:@fluidframework/driver-base@2.0.0-internal.4.0.0",
30
30
  "@fluidframework/eslint-config-fluid": "^2.0.0",
31
31
  "@microsoft/api-extractor": "^7.34.4",
@@ -0,0 +1,91 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { performance } from "@fluidframework/common-utils";
7
+
8
+ /**
9
+ * Extract and return the w3c data.
10
+ * @param url - request url for which w3c data needs to be reported.
11
+ * @param initiatorType - type of the network call
12
+ */
13
+ export function getW3CData(url: string, initiatorType: string) {
14
+ // From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
15
+ // fetchStart: immediately before the browser starts to fetch the resource.
16
+ // requestStart: immediately before the browser starts requesting the resource from the server
17
+ // responseStart: immediately after the browser receives the first byte of the response from the server.
18
+ // responseEnd: immediately after the browser receives the last byte of the resource
19
+ // or immediately before the transport connection is closed, whichever comes first.
20
+ // secureConnectionStart: immediately before the browser starts the handshake process to secure the
21
+ // current connection. If a secure connection is not used, this property returns zero.
22
+ // startTime: Time when the resource fetch started. This value is equivalent to fetchStart.
23
+ // domainLookupStart: immediately before the browser starts the domain name lookup for the resource.
24
+ // domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.
25
+ // redirectStart: start time of the fetch which that initiates the redirect.
26
+ // redirectEnd: immediately after receiving the last byte of the response of the last redirect.
27
+
28
+ // Interval between start and finish of the domain name lookup for the resource.
29
+ let dnsLookupTime: number | undefined; // domainLookupEnd - domainLookupStart
30
+ // Interval between the first fetch until the last byte of the last redirect.
31
+ let redirectTime: number | undefined; // redirectEnd - redirectStart
32
+ // Time to establish the connection to the server to retrieve the resource.
33
+ let tcpHandshakeTime: number | undefined; // connectEnd - connectStart
34
+ // Time from the end of the connection until the inital handshake process to secure the connection.
35
+ // If 0, then no time is spent here.
36
+ let secureConnectionTime: number | undefined; // connectEnd - secureConnectionStart
37
+ // Interval to receive all (first to last) bytes form the server.
38
+ let responseNetworkTime: number | undefined; // responsEnd - responseStart
39
+ // Interval between the initial fetch until the last byte is received.
40
+ // Likely same as fetchTime + receiveContentTime.
41
+ let fetchStartToResponseEndTime: number | undefined; // responseEnd - fetchStart
42
+ // reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>
43
+ // Interval between starting the request for the resource until receiving the last byte.
44
+ let reqStartToResponseEndTime: number | undefined; // responseEnd - requestStart
45
+ let w3cStartTime: number | undefined; // W3C Start time = fetchStart time
46
+
47
+ // getEntriesByType is only available in browser performance object
48
+ const resources1 = performance.getEntriesByType?.("resource") ?? [];
49
+ // Usually the latest fetch call is to the end of resources, so we start from the end.
50
+ for (let i = resources1.length - 1; i > 0; i--) {
51
+ const indResTime = resources1[i] as PerformanceResourceTiming;
52
+ const resource_name = indResTime.name.toString();
53
+ const resource_initiatortype = indResTime.initiatorType;
54
+ if (
55
+ resource_initiatortype.localeCompare(initiatorType) === 0 &&
56
+ resource_name.includes(url)
57
+ ) {
58
+ redirectTime = indResTime.redirectEnd - indResTime.redirectStart;
59
+ w3cStartTime = indResTime.fetchStart;
60
+ dnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;
61
+ tcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;
62
+ secureConnectionTime =
63
+ indResTime.secureConnectionStart > 0
64
+ ? indResTime.connectEnd - indResTime.secureConnectionStart
65
+ : 0;
66
+ responseNetworkTime =
67
+ indResTime.responseStart > 0
68
+ ? indResTime.responseEnd - indResTime.responseStart
69
+ : undefined;
70
+ fetchStartToResponseEndTime =
71
+ indResTime.fetchStart > 0
72
+ ? indResTime.responseEnd - indResTime.fetchStart
73
+ : undefined;
74
+ reqStartToResponseEndTime =
75
+ indResTime.requestStart > 0
76
+ ? indResTime.responseEnd - indResTime.requestStart
77
+ : undefined;
78
+ break;
79
+ }
80
+ }
81
+ return {
82
+ dnsLookupTime,
83
+ w3cStartTime,
84
+ redirectTime,
85
+ tcpHandshakeTime,
86
+ secureConnectionTime,
87
+ responseNetworkTime,
88
+ fetchStartToResponseEndTime,
89
+ reqStartToResponseEndTime,
90
+ };
91
+ }
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@
4
4
  */
5
5
 
6
6
  export { DocumentDeltaConnection } from "./documentDeltaConnection";
7
+ export { getW3CData } from "./driverUtils";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-base";
9
- export const pkgVersion = "2.0.0-internal.4.0.5";
9
+ export const pkgVersion = "2.0.0-internal.4.1.0";