@fluidframework/driver-base 2.0.0-rc.1.0.6 → 2.0.0-rc.2.0.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.
Files changed (58) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +4 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +4 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/dist/documentDeltaConnection.d.ts.map +1 -1
  8. package/dist/documentDeltaConnection.js +8 -6
  9. package/dist/documentDeltaConnection.js.map +1 -1
  10. package/dist/driver-base-beta.d.ts +2 -0
  11. package/dist/driver-base-public.d.ts +2 -0
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +6 -6
  15. package/dist/index.js.map +1 -1
  16. package/dist/package.json +3 -0
  17. package/dist/packageVersion.d.ts +1 -1
  18. package/dist/packageVersion.js +1 -1
  19. package/dist/packageVersion.js.map +1 -1
  20. package/dist/tsdoc-metadata.json +1 -1
  21. package/lib/{documentDeltaConnection.d.mts → documentDeltaConnection.d.ts} +1 -1
  22. package/lib/documentDeltaConnection.d.ts.map +1 -0
  23. package/lib/{documentDeltaConnection.mjs → documentDeltaConnection.js} +6 -3
  24. package/lib/documentDeltaConnection.js.map +1 -0
  25. package/lib/{driver-base-beta.d.mts → driver-base-beta.d.ts} +2 -0
  26. package/lib/{driver-base-public.d.mts → driver-base-public.d.ts} +2 -0
  27. package/lib/{driverUtils.d.mts → driverUtils.d.ts} +1 -1
  28. package/lib/driverUtils.d.ts.map +1 -0
  29. package/lib/{driverUtils.mjs → driverUtils.js} +1 -1
  30. package/lib/driverUtils.js.map +1 -0
  31. package/lib/{index.mjs → index.d.ts} +3 -3
  32. package/lib/index.d.ts.map +1 -0
  33. package/lib/{index.d.mts → index.js} +3 -3
  34. package/lib/index.js.map +1 -0
  35. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  36. package/lib/packageVersion.d.ts.map +1 -0
  37. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  38. package/lib/packageVersion.js.map +1 -0
  39. package/lib/test/driverUtilsTests.spec.js +101 -0
  40. package/lib/test/driverUtilsTests.spec.js.map +1 -0
  41. package/lib/test/types/validateDriverBasePrevious.generated.js +10 -0
  42. package/lib/test/types/validateDriverBasePrevious.generated.js.map +1 -0
  43. package/package.json +35 -56
  44. package/src/documentDeltaConnection.ts +6 -4
  45. package/src/index.ts +2 -2
  46. package/src/packageVersion.ts +1 -1
  47. package/tsconfig.cjs.json +7 -0
  48. package/tsconfig.json +2 -5
  49. package/lib/documentDeltaConnection.d.mts.map +0 -1
  50. package/lib/documentDeltaConnection.mjs.map +0 -1
  51. package/lib/driverUtils.d.mts.map +0 -1
  52. package/lib/driverUtils.mjs.map +0 -1
  53. package/lib/index.d.mts.map +0 -1
  54. package/lib/index.mjs.map +0 -1
  55. package/lib/packageVersion.d.mts.map +0 -1
  56. package/lib/packageVersion.mjs.map +0 -1
  57. /package/lib/{driver-base-alpha.d.mts → driver-base-alpha.d.ts} +0 -0
  58. /package/lib/{driver-base-untrimmed.d.mts → driver-base-untrimmed.d.ts} +0 -0
@@ -17,6 +17,8 @@ import type { Socket } from 'socket.io-client';
17
17
 
18
18
  /* Excluded from this release type: DocumentDeltaConnection */
19
19
 
20
+ /* Excluded from this release type: EventEmitterWithErrorHandling */
21
+
20
22
  /* Excluded from this release type: getW3CData */
21
23
 
22
24
  /* Excluded from this release type: IDocumentDeltaConnection */
@@ -17,6 +17,8 @@ import type { Socket } from 'socket.io-client';
17
17
 
18
18
  /* Excluded from this release type: DocumentDeltaConnection */
19
19
 
20
+ /* Excluded from this release type: EventEmitterWithErrorHandling */
21
+
20
22
  /* Excluded from this release type: getW3CData */
21
23
 
22
24
  /* Excluded from this release type: IDocumentDeltaConnection */
@@ -33,4 +33,4 @@ export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promis
33
33
  * @internal
34
34
  */
35
35
  export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
36
- //# sourceMappingURL=driverUtils.d.mts.map
36
+ //# sourceMappingURL=driverUtils.d.ts.map
@@ -0,0 +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;;;;;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"}
@@ -137,4 +137,4 @@ export function validateMessages(reason, messages, from, logger, strict = true)
137
137
  }
138
138
  }
139
139
  }
140
- //# sourceMappingURL=driverUtils.mjs.map
140
+ //# 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;AAI3D;;;;;GAKG;AACH,MAAM,UAAU,U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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"]}
@@ -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.mjs";
6
- export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils.mjs";
7
- //# sourceMappingURL=index.mjs.map
5
+ export { DocumentDeltaConnection } from "./documentDeltaConnection.js";
6
+ export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -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.mjs";
6
- export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils.mjs";
7
- //# sourceMappingURL=index.d.mts.map
5
+ export { DocumentDeltaConnection } from "./documentDeltaConnection.js";
6
+ export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DocumentDeltaConnection } from \"./documentDeltaConnection.js\";\nexport { getW3CData, promiseRaceWithWinner, validateMessages } from \"./driverUtils.js\";\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-rc.1.0.6";
9
- //# sourceMappingURL=packageVersion.d.mts.map
8
+ export declare const pkgVersion = "2.0.0-rc.2.0.1";
9
+ //# sourceMappingURL=packageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,gCAAgC,CAAC;AACrD,eAAO,MAAM,UAAU,mBAAmB,CAAC"}
@@ -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-rc.1.0.6";
9
- //# sourceMappingURL=packageVersion.mjs.map
8
+ export const pkgVersion = "2.0.0-rc.2.0.1";
9
+ //# sourceMappingURL=packageVersion.js.map
@@ -0,0 +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,gBAAgB,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-rc.2.0.1\";\n"]}
@@ -0,0 +1,101 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { assert } from "@fluidframework/core-utils";
6
+ import { MockLogger } from "@fluidframework/telemetry-utils";
7
+ import { validateMessages } from "../driverUtils.js";
8
+ describe("driver utils tests", () => {
9
+ describe("validateMessagesTests", () => {
10
+ const mockLogger = new MockLogger();
11
+ const generateOps = (start, count) => {
12
+ const ops = [];
13
+ let i = 0;
14
+ while (i < count) {
15
+ ops.push({ sequenceNumber: start + i });
16
+ i++;
17
+ }
18
+ return ops;
19
+ };
20
+ beforeEach(() => {
21
+ mockLogger.clear();
22
+ });
23
+ it("from not equal to start", () => {
24
+ const ops = generateOps(1, 5);
25
+ validateMessages("test1", ops, 0, mockLogger.toTelemetryLogger(), true);
26
+ assert(ops.length === 0, "no ops should be returned");
27
+ assert(mockLogger.matchEventStrict([
28
+ {
29
+ eventName: "OpsFetchViolation",
30
+ reason: "test1",
31
+ from: 0,
32
+ start: 1,
33
+ last: 5,
34
+ length: 5,
35
+ details: JSON.stringify({
36
+ validLength: 0,
37
+ lastValidOpSeqNumber: undefined,
38
+ strict: true,
39
+ }),
40
+ },
41
+ ]), "Ops fetch violation event not correctly recorded");
42
+ });
43
+ it("contiguous ops", () => {
44
+ const ops = generateOps(1, 5);
45
+ validateMessages("test2", ops, 1, mockLogger.toTelemetryLogger(), true);
46
+ assert(ops.length === 5, "ops should be returned");
47
+ assert(mockLogger.events.length === 0, "no events should be there");
48
+ });
49
+ it("non contiguous ops: strict = true", () => {
50
+ const ops = generateOps(1, 5);
51
+ // Change seq number of last op
52
+ ops[4].sequenceNumber = 7;
53
+ validateMessages("test", ops, 1, mockLogger.toTelemetryLogger(), true);
54
+ assert(ops.length === 0, "no ops should be returned as strict == true");
55
+ assert(mockLogger.matchEventStrict([
56
+ {
57
+ eventName: "OpsFetchViolation",
58
+ reason: "test",
59
+ from: 1,
60
+ start: 1,
61
+ last: 7,
62
+ length: 5,
63
+ details: JSON.stringify({
64
+ validLength: 0,
65
+ lastValidOpSeqNumber: undefined,
66
+ strict: true,
67
+ }),
68
+ },
69
+ ]), "Ops fetch violation event not correctly recorded");
70
+ });
71
+ it("non contiguous ops: strict = false", () => {
72
+ const ops = generateOps(1, 5);
73
+ // Change seq number of last op
74
+ ops[4].sequenceNumber = 7;
75
+ validateMessages("test", ops, 1, mockLogger.toTelemetryLogger(), false);
76
+ assert(ops.length === 4, "some should be returned as strict == false");
77
+ assert(mockLogger.matchEventStrict([
78
+ {
79
+ eventName: "OpsFetchViolation",
80
+ reason: "test",
81
+ from: 1,
82
+ start: 1,
83
+ last: 7,
84
+ length: 5,
85
+ details: JSON.stringify({
86
+ validLength: 4,
87
+ lastValidOpSeqNumber: 4,
88
+ strict: false,
89
+ }),
90
+ },
91
+ ]), "Ops fetch violation event not correctly recorded");
92
+ });
93
+ it("only 1 op: strict = false", () => {
94
+ const ops = generateOps(1, 1);
95
+ validateMessages("test", ops, 1, mockLogger.toTelemetryLogger(), false);
96
+ assert(ops.length === 1, "some should be returned as strict == false");
97
+ assert(mockLogger.events.length === 0, "no events should be there");
98
+ });
99
+ });
100
+ });
101
+ //# sourceMappingURL=driverUtilsTests.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driverUtilsTests.spec.js","sourceRoot":"","sources":["../../src/test/driverUtilsTests.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM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QACrE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { MockLogger } from \"@fluidframework/telemetry-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { validateMessages } from \"../driverUtils.js\";\n\ndescribe(\"driver utils tests\", () => {\n\tdescribe(\"validateMessagesTests\", () => {\n\t\tconst mockLogger = new MockLogger();\n\t\tconst generateOps = (start: number, count: number) => {\n\t\t\tconst ops: ISequencedDocumentMessage[] = [];\n\t\t\tlet i = 0;\n\t\t\twhile (i < count) {\n\t\t\t\tops.push({ sequenceNumber: start + i } as any as ISequencedDocumentMessage);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\treturn ops;\n\t\t};\n\n\t\tbeforeEach(() => {\n\t\t\tmockLogger.clear();\n\t\t});\n\n\t\tit(\"from not equal to start\", () => {\n\t\t\tconst ops = generateOps(1, 5);\n\t\t\tvalidateMessages(\"test1\", ops, 0, mockLogger.toTelemetryLogger(), true);\n\t\t\tassert(ops.length === 0, \"no ops should be returned\");\n\t\t\tassert(\n\t\t\t\tmockLogger.matchEventStrict([\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\t\t\treason: \"test1\",\n\t\t\t\t\t\tfrom: 0,\n\t\t\t\t\t\tstart: 1,\n\t\t\t\t\t\tlast: 5,\n\t\t\t\t\t\tlength: 5,\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\tvalidLength: 0,\n\t\t\t\t\t\t\tlastValidOpSeqNumber: undefined,\n\t\t\t\t\t\t\tstrict: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t]),\n\t\t\t\t\"Ops fetch violation event not correctly recorded\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"contiguous ops\", () => {\n\t\t\tconst ops = generateOps(1, 5);\n\t\t\tvalidateMessages(\"test2\", ops, 1, mockLogger.toTelemetryLogger(), true);\n\t\t\tassert(ops.length === 5, \"ops should be returned\");\n\t\t\tassert(mockLogger.events.length === 0, \"no events should be there\");\n\t\t});\n\n\t\tit(\"non contiguous ops: strict = true\", () => {\n\t\t\tconst ops = generateOps(1, 5);\n\t\t\t// Change seq number of last op\n\t\t\tops[4].sequenceNumber = 7;\n\t\t\tvalidateMessages(\"test\", ops, 1, mockLogger.toTelemetryLogger(), true);\n\t\t\tassert(ops.length === 0, \"no ops should be returned as strict == true\");\n\t\t\tassert(\n\t\t\t\tmockLogger.matchEventStrict([\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\t\t\treason: \"test\",\n\t\t\t\t\t\tfrom: 1,\n\t\t\t\t\t\tstart: 1,\n\t\t\t\t\t\tlast: 7,\n\t\t\t\t\t\tlength: 5,\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\tvalidLength: 0,\n\t\t\t\t\t\t\tlastValidOpSeqNumber: undefined,\n\t\t\t\t\t\t\tstrict: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t]),\n\t\t\t\t\"Ops fetch violation event not correctly recorded\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"non contiguous ops: strict = false\", () => {\n\t\t\tconst ops = generateOps(1, 5);\n\t\t\t// Change seq number of last op\n\t\t\tops[4].sequenceNumber = 7;\n\t\t\tvalidateMessages(\"test\", ops, 1, mockLogger.toTelemetryLogger(), false);\n\t\t\tassert(ops.length === 4, \"some should be returned as strict == false\");\n\t\t\tassert(\n\t\t\t\tmockLogger.matchEventStrict([\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\t\t\treason: \"test\",\n\t\t\t\t\t\tfrom: 1,\n\t\t\t\t\t\tstart: 1,\n\t\t\t\t\t\tlast: 7,\n\t\t\t\t\t\tlength: 5,\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\tvalidLength: 4,\n\t\t\t\t\t\t\tlastValidOpSeqNumber: 4,\n\t\t\t\t\t\t\tstrict: false,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t]),\n\t\t\t\t\"Ops fetch violation event not correctly recorded\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"only 1 op: strict = false\", () => {\n\t\t\tconst ops = generateOps(1, 1);\n\t\t\tvalidateMessages(\"test\", ops, 1, mockLogger.toTelemetryLogger(), false);\n\t\t\tassert(ops.length === 1, \"some should be returned as strict == false\");\n\t\t\tassert(mockLogger.events.length === 0, \"no events should be there\");\n\t\t});\n\t});\n});\n"]}
@@ -0,0 +1,10 @@
1
+ use_current_ClassDeclaration_DocumentDeltaConnection(get_old_ClassDeclaration_DocumentDeltaConnection());
2
+ use_old_ClassDeclaration_DocumentDeltaConnection(get_current_ClassDeclaration_DocumentDeltaConnection());
3
+ use_current_FunctionDeclaration_getW3CData(get_old_FunctionDeclaration_getW3CData());
4
+ use_old_FunctionDeclaration_getW3CData(get_current_FunctionDeclaration_getW3CData());
5
+ use_current_FunctionDeclaration_promiseRaceWithWinner(get_old_FunctionDeclaration_promiseRaceWithWinner());
6
+ use_old_FunctionDeclaration_promiseRaceWithWinner(get_current_FunctionDeclaration_promiseRaceWithWinner());
7
+ use_current_FunctionDeclaration_validateMessages(get_old_FunctionDeclaration_validateMessages());
8
+ use_old_FunctionDeclaration_validateMessages(get_current_FunctionDeclaration_validateMessages());
9
+ export {};
10
+ //# sourceMappingURL=validateDriverBasePrevious.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateDriverBasePrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateDriverBasePrevious.generated.ts"],"names":[],"mappings":"AAgCA,oDAAoD,CAChD,gDAAgD,EAAE,CAAC,CAAC;AAWxD,gDAAgD,CAC5C,oDAAoD,EAAE,CAAC,CAAC;AAW5D,0CAA0C,CACtC,sCAAsC,EAAE,CAAC,CAAC;AAW9C,sCAAsC,CAClC,0CAA0C,EAAE,CAAC,CAAC;AAWlD,qDAAqD,CACjD,iDAAiD,EAAE,CAAC,CAAC;AAWzD,iDAAiD,CAC7C,qDAAqD,EAAE,CAAC,CAAC;AAW7D,gDAAgD,CAC5C,4CAA4C,EAAE,CAAC,CAAC;AAWpD,4CAA4C,CACxC,gDAAgD,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/driver-base-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_DocumentDeltaConnection\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_DocumentDeltaConnection():\n TypeOnly<old.DocumentDeltaConnection>;\ndeclare function use_current_ClassDeclaration_DocumentDeltaConnection(\n use: TypeOnly<current.DocumentDeltaConnection>): void;\nuse_current_ClassDeclaration_DocumentDeltaConnection(\n get_old_ClassDeclaration_DocumentDeltaConnection());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_DocumentDeltaConnection\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_DocumentDeltaConnection():\n TypeOnly<current.DocumentDeltaConnection>;\ndeclare function use_old_ClassDeclaration_DocumentDeltaConnection(\n use: TypeOnly<old.DocumentDeltaConnection>): void;\nuse_old_ClassDeclaration_DocumentDeltaConnection(\n get_current_ClassDeclaration_DocumentDeltaConnection());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_getW3CData\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_getW3CData():\n TypeOnly<typeof old.getW3CData>;\ndeclare function use_current_FunctionDeclaration_getW3CData(\n use: TypeOnly<typeof current.getW3CData>): void;\nuse_current_FunctionDeclaration_getW3CData(\n get_old_FunctionDeclaration_getW3CData());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_getW3CData\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_getW3CData():\n TypeOnly<typeof current.getW3CData>;\ndeclare function use_old_FunctionDeclaration_getW3CData(\n use: TypeOnly<typeof old.getW3CData>): void;\nuse_old_FunctionDeclaration_getW3CData(\n get_current_FunctionDeclaration_getW3CData());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_promiseRaceWithWinner\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_promiseRaceWithWinner():\n TypeOnly<typeof old.promiseRaceWithWinner>;\ndeclare function use_current_FunctionDeclaration_promiseRaceWithWinner(\n use: TypeOnly<typeof current.promiseRaceWithWinner>): void;\nuse_current_FunctionDeclaration_promiseRaceWithWinner(\n get_old_FunctionDeclaration_promiseRaceWithWinner());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_promiseRaceWithWinner\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_promiseRaceWithWinner():\n TypeOnly<typeof current.promiseRaceWithWinner>;\ndeclare function use_old_FunctionDeclaration_promiseRaceWithWinner(\n use: TypeOnly<typeof old.promiseRaceWithWinner>): void;\nuse_old_FunctionDeclaration_promiseRaceWithWinner(\n get_current_FunctionDeclaration_promiseRaceWithWinner());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_validateMessages\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_validateMessages():\n TypeOnly<typeof old.validateMessages>;\ndeclare function use_current_FunctionDeclaration_validateMessages(\n use: TypeOnly<typeof current.validateMessages>): void;\nuse_current_FunctionDeclaration_validateMessages(\n get_old_FunctionDeclaration_validateMessages());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_validateMessages\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_validateMessages():\n TypeOnly<typeof current.validateMessages>;\ndeclare function use_old_FunctionDeclaration_validateMessages(\n use: TypeOnly<typeof old.validateMessages>): void;\nuse_old_FunctionDeclaration_validateMessages(\n get_current_FunctionDeclaration_validateMessages());\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/driver-base",
3
- "version": "2.0.0-rc.1.0.6",
3
+ "version": "2.0.0-rc.2.0.1",
4
4
  "description": "Shared driver code for Fluid driver implementations",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,60 +11,40 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
+ "type": "module",
14
15
  "exports": {
15
16
  ".": {
16
17
  "import": {
17
- "types": "./lib/index.d.mts",
18
- "default": "./lib/index.mjs"
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
19
20
  },
20
21
  "require": {
21
22
  "types": "./dist/index.d.ts",
22
23
  "default": "./dist/index.js"
23
24
  }
24
25
  },
25
- "./alpha": {
26
- "import": {
27
- "types": "./lib/driver-base-alpha.d.mts",
28
- "default": "./lib/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/driver-base-alpha.d.ts",
32
- "default": "./dist/index.js"
33
- }
34
- },
35
- "./beta": {
26
+ "./public": {
36
27
  "import": {
37
- "types": "./lib/driver-base-beta.d.mts",
38
- "default": "./lib/index.mjs"
28
+ "types": "./lib/driver-base-public.d.ts",
29
+ "default": "./lib/index.js"
39
30
  },
40
31
  "require": {
41
- "types": "./dist/driver-base-beta.d.ts",
32
+ "types": "./dist/driver-base-public.d.ts",
42
33
  "default": "./dist/index.js"
43
34
  }
44
35
  },
45
36
  "./internal": {
46
37
  "import": {
47
- "types": "./lib/index.d.mts",
48
- "default": "./lib/index.mjs"
38
+ "types": "./lib/index.d.ts",
39
+ "default": "./lib/index.js"
49
40
  },
50
41
  "require": {
51
42
  "types": "./dist/index.d.ts",
52
43
  "default": "./dist/index.js"
53
44
  }
54
- },
55
- "./public": {
56
- "import": {
57
- "types": "./lib/driver-base-public.d.mts",
58
- "default": "./lib/index.mjs"
59
- },
60
- "require": {
61
- "types": "./dist/driver-base-public.d.ts",
62
- "default": "./dist/index.js"
63
- }
64
45
  }
65
46
  },
66
47
  "main": "dist/index.js",
67
- "module": "lib/index.mjs",
68
48
  "types": "dist/index.d.ts",
69
49
  "c8": {
70
50
  "all": true,
@@ -87,37 +67,36 @@
87
67
  "temp-directory": "nyc/.nyc_output"
88
68
  },
89
69
  "dependencies": {
90
- "@fluid-internal/client-utils": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
91
- "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
92
- "@fluidframework/core-utils": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
93
- "@fluidframework/driver-definitions": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
94
- "@fluidframework/driver-utils": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
95
- "@fluidframework/protocol-definitions": "^3.1.0",
96
- "@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0"
70
+ "@fluid-internal/client-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
71
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
72
+ "@fluidframework/core-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
73
+ "@fluidframework/driver-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
74
+ "@fluidframework/driver-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
75
+ "@fluidframework/protocol-definitions": "^3.2.0",
76
+ "@fluidframework/telemetry-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0"
97
77
  },
98
78
  "devDependencies": {
99
79
  "@arethetypeswrong/cli": "^0.13.3",
100
- "@fluid-tools/build-cli": "^0.29.0",
80
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
81
+ "@fluid-tools/build-cli": "^0.34.0",
101
82
  "@fluidframework/build-common": "^2.0.3",
102
- "@fluidframework/build-tools": "^0.29.0",
83
+ "@fluidframework/build-tools": "^0.34.0",
103
84
  "@fluidframework/driver-base-previous": "npm:@fluidframework/driver-base@2.0.0-internal.8.0.0",
104
- "@fluidframework/eslint-config-fluid": "^3.2.0",
105
- "@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
106
- "@microsoft/api-extractor": "^7.38.3",
85
+ "@fluidframework/eslint-config-fluid": "^4.0.0",
86
+ "@microsoft/api-extractor": "^7.42.3",
107
87
  "@types/mocha": "^9.1.1",
108
88
  "@types/node": "^18.19.0",
109
89
  "c8": "^8.0.1",
110
90
  "copyfiles": "^2.4.1",
111
91
  "cross-env": "^7.0.3",
112
- "eslint": "~8.50.0",
92
+ "eslint": "~8.55.0",
113
93
  "mocha": "^10.2.0",
114
94
  "mocha-json-output-reporter": "^2.0.1",
115
95
  "mocha-multi-reporters": "^1.5.1",
116
96
  "moment": "^2.21.0",
117
97
  "prettier": "~3.0.3",
118
98
  "rimraf": "^4.4.0",
119
- "socket.io-client": "^4.6.1",
120
- "tsc-multi": "^1.1.0",
99
+ "socket.io-client": "^4.7.3",
121
100
  "typescript": "~5.1.6"
122
101
  },
123
102
  "fluidBuild": {
@@ -129,11 +108,7 @@
129
108
  "api-extractor:esnext"
130
109
  ],
131
110
  "script": false
132
- },
133
- "tsc": [
134
- "...",
135
- "typetests:gen"
136
- ]
111
+ }
137
112
  }
138
113
  },
139
114
  "typeValidation": {
@@ -141,15 +116,17 @@
141
116
  },
142
117
  "scripts": {
143
118
  "api": "fluid-build . --task api",
144
- "api-extractor:commonjs": "api-extractor run --local",
145
- "api-extractor:esnext": "api-extractor run --config ./api-extractor-esm.json",
119
+ "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
120
+ "api-extractor:esnext": "api-extractor run --local",
146
121
  "build": "fluid-build . --task build",
147
122
  "build:commonjs": "fluid-build . --task commonjs",
148
123
  "build:compile": "fluid-build . --task compile",
149
124
  "build:docs": "fluid-build . --task api",
150
- "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
125
+ "build:esnext": "tsc --project ./tsconfig.json",
151
126
  "build:genver": "gen-version",
152
- "build:test": "tsc --project ./src/test/tsconfig.json",
127
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
128
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
129
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
153
130
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
154
131
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
155
132
  "ci:build:docs": "api-extractor run",
@@ -163,9 +140,11 @@
163
140
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
164
141
  "test": "npm run test:mocha",
165
142
  "test:coverage": "c8 npm test",
166
- "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
143
+ "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
144
+ "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
145
+ "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
167
146
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
168
- "tsc": "tsc",
147
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
169
148
  "typetests:gen": "fluid-type-test-generator",
170
149
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
171
150
  }
@@ -22,7 +22,7 @@ import {
22
22
  ITokenClaims,
23
23
  ScopeType,
24
24
  } from "@fluidframework/protocol-definitions";
25
- import { IDisposable, ITelemetryProperties, LogLevel } from "@fluidframework/core-interfaces";
25
+ import { IDisposable, ITelemetryBaseProperties, LogLevel } from "@fluidframework/core-interfaces";
26
26
  import {
27
27
  ITelemetryLoggerExt,
28
28
  extractLogSafeErrorProperties,
@@ -34,7 +34,7 @@ import {
34
34
  } from "@fluidframework/telemetry-utils";
35
35
  import type { Socket } from "socket.io-client";
36
36
  // For now, this package is versioned and released in unison with the specific drivers
37
- import { pkgVersion as driverVersion } from "./packageVersion";
37
+ import { pkgVersion as driverVersion } from "./packageVersion.js";
38
38
 
39
39
  /**
40
40
  * Represents a connection to a stream of delta updates.
@@ -131,7 +131,9 @@ export class DocumentDeltaConnection
131
131
  logger.sendErrorEvent(
132
132
  {
133
133
  eventName: "DeltaConnection:EventException",
134
- name: name as string,
134
+ // Coerce to string as past typings also allowed symbols and number, but
135
+ // we want telemtry properties to be consistently string.
136
+ name: String(name),
135
137
  },
136
138
  error,
137
139
  );
@@ -733,7 +735,7 @@ export class DocumentDeltaConnection
733
735
  private createErrorObjectWithProps(
734
736
  handler: string,
735
737
  error?: any,
736
- props?: ITelemetryProperties,
738
+ props?: ITelemetryBaseProperties,
737
739
  canRetry = true,
738
740
  ): IAnyDriverError {
739
741
  return createGenericNetworkError(
package/src/index.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export { DocumentDeltaConnection } from "./documentDeltaConnection";
7
- export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils";
6
+ export { DocumentDeltaConnection } from "./documentDeltaConnection.js";
7
+ export { getW3CData, promiseRaceWithWinner, validateMessages } from "./driverUtils.js";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-base";
9
- export const pkgVersion = "2.0.0-rc.1.0.6";
9
+ export const pkgVersion = "2.0.0-rc.2.0.1";
@@ -0,0 +1,7 @@
1
+ {
2
+ // This config must be used in a "type": "commonjs" environment. (Use fluid-tsc commonjs.)
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
- "extends": [
3
- "../../../common/build/build-common/tsconfig.base.json",
4
- "../../../common/build/build-common/tsconfig.cjs.json",
5
- ],
2
+ "extends": "../../../common/build/build-common/tsconfig.node16.json",
6
3
  "include": ["src/**/*"],
7
4
  "exclude": ["src/test/**/*"],
8
5
  "compilerOptions": {
9
6
  "rootDir": "./src",
10
- "outDir": "./dist",
7
+ "outDir": "./lib",
11
8
  },
12
9
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"documentDeltaConnection.d.mts","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,MAAM,oCAAoC;OAEpC,EACN,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,cAAc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