@fluidframework/driver-utils 2.20.0 → 2.22.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -0
  3. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  4. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -2
  5. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  6. package/dist/packageVersion.d.ts +1 -1
  7. package/dist/packageVersion.js +1 -1
  8. package/dist/packageVersion.js.map +1 -1
  9. package/dist/parallelRequests.js +6 -6
  10. package/dist/parallelRequests.js.map +1 -1
  11. package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
  12. package/dist/prefetchDocumentStorageService.js +3 -4
  13. package/dist/prefetchDocumentStorageService.js.map +1 -1
  14. package/dist/runWithRetry.js +5 -5
  15. package/dist/runWithRetry.js.map +1 -1
  16. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  17. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -2
  18. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  19. package/lib/packageVersion.d.ts +1 -1
  20. package/lib/packageVersion.js +1 -1
  21. package/lib/packageVersion.js.map +1 -1
  22. package/lib/parallelRequests.js +7 -7
  23. package/lib/parallelRequests.js.map +1 -1
  24. package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
  25. package/lib/prefetchDocumentStorageService.js +3 -4
  26. package/lib/prefetchDocumentStorageService.js.map +1 -1
  27. package/lib/runWithRetry.js +6 -6
  28. package/lib/runWithRetry.js.map +1 -1
  29. package/package.json +12 -12
  30. package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +1 -3
  31. package/src/packageVersion.ts +1 -1
  32. package/src/parallelRequests.ts +7 -7
  33. package/src/prefetchDocumentStorageService.ts +3 -4
  34. package/src/runWithRetry.ts +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/driver-utils",
3
- "version": "2.20.0",
3
+ "version": "2.22.0",
4
4
  "description": "Collection of utility functions for Fluid drivers",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,11 +69,11 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "~2.20.0",
73
- "@fluidframework/core-interfaces": "~2.20.0",
74
- "@fluidframework/core-utils": "~2.20.0",
75
- "@fluidframework/driver-definitions": "~2.20.0",
76
- "@fluidframework/telemetry-utils": "~2.20.0",
72
+ "@fluid-internal/client-utils": "~2.22.0",
73
+ "@fluidframework/core-interfaces": "~2.22.0",
74
+ "@fluidframework/core-utils": "~2.22.0",
75
+ "@fluidframework/driver-definitions": "~2.22.0",
76
+ "@fluidframework/telemetry-utils": "~2.22.0",
77
77
  "axios": "^1.7.7",
78
78
  "lz4js": "^0.2.0",
79
79
  "uuid": "^9.0.0"
@@ -81,12 +81,12 @@
81
81
  "devDependencies": {
82
82
  "@arethetypeswrong/cli": "^0.17.1",
83
83
  "@biomejs/biome": "~1.9.3",
84
- "@fluid-internal/mocha-test-setup": "~2.20.0",
84
+ "@fluid-internal/mocha-test-setup": "~2.22.0",
85
85
  "@fluid-tools/build-cli": "^0.51.0",
86
86
  "@fluidframework/build-common": "^2.0.3",
87
87
  "@fluidframework/build-tools": "^0.51.0",
88
- "@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.13.0",
89
- "@fluidframework/eslint-config-fluid": "^5.6.0",
88
+ "@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.21.0",
89
+ "@fluidframework/eslint-config-fluid": "^5.7.3",
90
90
  "@microsoft/api-extractor": "7.47.8",
91
91
  "@types/mocha": "^10.0.10",
92
92
  "@types/node": "^18.19.0",
@@ -139,7 +139,7 @@
139
139
  "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
140
140
  "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
141
141
  "ci:build:docs": "api-extractor run",
142
- "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
142
+ "clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
143
143
  "eslint": "eslint --format stylish src",
144
144
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
145
145
  "format": "npm run format:biome",
@@ -150,8 +150,8 @@
150
150
  "test": "npm run test:mocha",
151
151
  "test:coverage": "c8 npm test",
152
152
  "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
153
- "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
154
- "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
153
+ "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\"",
154
+ "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\"",
155
155
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
156
156
  "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
157
157
  "typetests:gen": "flub generate typetests --dir . -v",
@@ -291,9 +291,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
291
291
  */
292
292
  private static findMetadataHolderSummary(summary: ISummaryTree): ISummaryTree | undefined {
293
293
  assert(typeof summary === "object", 0x6f7 /* summary must be a non-null object */);
294
- for (const key of Object.keys(summary.tree)) {
295
- const value = summary.tree[key];
296
-
294
+ for (const [key, value] of Object.entries(summary.tree)) {
297
295
  if (Boolean(value) && value.type === SummaryType.Tree) {
298
296
  const found = this.findMetadataHolderSummary(value);
299
297
  if (found) {
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-utils";
9
- export const pkgVersion = "2.20.0";
9
+ export const pkgVersion = "2.22.0";
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { performance } from "@fluid-internal/client-utils";
6
+ import { performanceNow } from "@fluid-internal/client-utils";
7
7
  import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
8
8
  import { assert, Deferred } from "@fluidframework/core-utils/internal";
9
9
  import {
@@ -436,7 +436,7 @@ async function getSingleOpBatch(
436
436
  while (signal?.aborted !== true) {
437
437
  retry++;
438
438
  let lastError: unknown;
439
- const startTime = performance.now();
439
+ const startTime = performanceNow();
440
440
 
441
441
  try {
442
442
  // Issue async request for deltas
@@ -459,8 +459,8 @@ async function getSingleOpBatch(
459
459
  if (lastSuccessTime === undefined) {
460
460
  // Take timestamp of the first time server responded successfully, even though it wasn't with the ops we asked for.
461
461
  // If we keep getting empty responses we'll eventually fail out below.
462
- lastSuccessTime = performance.now();
463
- } else if (performance.now() - lastSuccessTime > 30000) {
462
+ lastSuccessTime = performanceNow();
463
+ } else if (performanceNow() - lastSuccessTime > 30000) {
464
464
  // If we are connected and receiving proper responses from server, but can't get any ops back,
465
465
  // then give up after some time. This likely indicates the issue with ordering service not flushing
466
466
  // ops to storage quick enough, and possibly waiting for summaries, while summarizer can't get
@@ -489,7 +489,7 @@ async function getSingleOpBatch(
489
489
  eventName: "GetDeltas_Error",
490
490
  ...props,
491
491
  retry,
492
- duration: performance.now() - startTime,
492
+ duration: performanceNow() - startTime,
493
493
  retryAfter,
494
494
  reason: scenarioName,
495
495
  },
@@ -503,7 +503,7 @@ async function getSingleOpBatch(
503
503
  }
504
504
 
505
505
  if (telemetryEvent === undefined) {
506
- waitStartTime = performance.now();
506
+ waitStartTime = performanceNow();
507
507
  telemetryEvent = PerformanceEvent.start(logger, {
508
508
  eventName: "GetDeltasWaitTime",
509
509
  });
@@ -521,7 +521,7 @@ async function getSingleOpBatch(
521
521
  // NOTE: This isn't strictly true for drivers that don't require network (e.g. local driver). Really this logic
522
522
  // should probably live in the driver.
523
523
  await waitForOnline();
524
- totalRetryAfterTime += performance.now() - waitStartTime;
524
+ totalRetryAfterTime += performanceNow() - waitStartTime;
525
525
  }
526
526
 
527
527
  return nothing;
@@ -82,8 +82,7 @@ export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy
82
82
  }
83
83
 
84
84
  private prefetchTreeCore(tree: ISnapshotTree, secondary: string[]) {
85
- for (const blobKey of Object.keys(tree.blobs)) {
86
- const blob = tree.blobs[blobKey];
85
+ for (const [blobKey, blob] of Object.entries(tree.blobs)) {
87
86
  if (blobKey.startsWith(".") || blobKey === "header" || blobKey.startsWith("quorum")) {
88
87
  if (blob !== null) {
89
88
  // We don't care if the prefetch succeeds
@@ -96,8 +95,8 @@ export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy
96
95
  }
97
96
  }
98
97
 
99
- for (const subTree of Object.keys(tree.trees)) {
100
- this.prefetchTreeCore(tree.trees[subTree], secondary);
98
+ for (const subTree of Object.values(tree.trees)) {
99
+ this.prefetchTreeCore(subTree, secondary);
101
100
  }
102
101
  }
103
102
  }
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { performance } from "@fluid-internal/client-utils";
6
+ import { performanceNow } from "@fluid-internal/client-utils";
7
7
  import { delay } from "@fluidframework/core-utils/internal";
8
8
  import { DriverErrorTypes } from "@fluidframework/driver-definitions/internal";
9
9
  import { ITelemetryLoggerExt, isFluidError } from "@fluidframework/telemetry-utils/internal";
@@ -58,7 +58,7 @@ export async function runWithRetry<T>(
58
58
  // We double this value in first try in when we calculate time to wait for in "calculateMaxWaitTime" function.
59
59
  let retryAfterMs = 500; // has to be positive!
60
60
  let numRetries = 0;
61
- const startTime = performance.now();
61
+ const startTime = performanceNow();
62
62
  let lastError: any;
63
63
  do {
64
64
  try {
@@ -71,7 +71,7 @@ export async function runWithRetry<T>(
71
71
  {
72
72
  eventName: `${fetchCallName}_cancel`,
73
73
  retry: numRetries,
74
- duration: performance.now() - startTime,
74
+ duration: performanceNow() - startTime,
75
75
  fetchCallName,
76
76
  },
77
77
  err,
@@ -84,7 +84,7 @@ export async function runWithRetry<T>(
84
84
  {
85
85
  eventName: `${fetchCallName}_runWithRetryAborted`,
86
86
  retry: numRetries,
87
- duration: performance.now() - startTime,
87
+ duration: performanceNow() - startTime,
88
88
  fetchCallName,
89
89
  reason: progress.cancel.reason,
90
90
  },
@@ -108,7 +108,7 @@ export async function runWithRetry<T>(
108
108
  logger.sendTelemetryEvent(
109
109
  {
110
110
  eventName: `${fetchCallName}_firstFailed`,
111
- duration: performance.now() - startTime,
111
+ duration: performanceNow() - startTime,
112
112
  fetchCallName,
113
113
  },
114
114
  err,
@@ -130,7 +130,7 @@ export async function runWithRetry<T>(
130
130
  {
131
131
  eventName: `${fetchCallName}_lastError`,
132
132
  retry: numRetries,
133
- duration: performance.now() - startTime,
133
+ duration: performanceNow() - startTime,
134
134
  fetchCallName,
135
135
  },
136
136
  lastError,