@fluidframework/odsp-driver 2.93.0 → 2.100.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 (50) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/compactSnapshotParser.d.ts +2 -2
  3. package/dist/compactSnapshotParser.d.ts.map +1 -1
  4. package/dist/compactSnapshotParser.js.map +1 -1
  5. package/dist/epochTracker.d.ts +8 -4
  6. package/dist/epochTracker.d.ts.map +1 -1
  7. package/dist/epochTracker.js +12 -9
  8. package/dist/epochTracker.js.map +1 -1
  9. package/dist/fetchSnapshot.d.ts +9 -6
  10. package/dist/fetchSnapshot.d.ts.map +1 -1
  11. package/dist/fetchSnapshot.js +8 -3
  12. package/dist/fetchSnapshot.js.map +1 -1
  13. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  14. package/dist/odspDocumentStorageManager.js +1 -1
  15. package/dist/odspDocumentStorageManager.js.map +1 -1
  16. package/dist/packageVersion.d.ts +1 -1
  17. package/dist/packageVersion.d.ts.map +1 -1
  18. package/dist/packageVersion.js +1 -1
  19. package/dist/packageVersion.js.map +1 -1
  20. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  21. package/dist/prefetchLatestSnapshot.js +2 -2
  22. package/dist/prefetchLatestSnapshot.js.map +1 -1
  23. package/lib/compactSnapshotParser.d.ts +2 -2
  24. package/lib/compactSnapshotParser.d.ts.map +1 -1
  25. package/lib/compactSnapshotParser.js.map +1 -1
  26. package/lib/epochTracker.d.ts +8 -4
  27. package/lib/epochTracker.d.ts.map +1 -1
  28. package/lib/epochTracker.js +13 -10
  29. package/lib/epochTracker.js.map +1 -1
  30. package/lib/fetchSnapshot.d.ts +9 -6
  31. package/lib/fetchSnapshot.d.ts.map +1 -1
  32. package/lib/fetchSnapshot.js +8 -3
  33. package/lib/fetchSnapshot.js.map +1 -1
  34. package/lib/odspDocumentStorageManager.d.ts.map +1 -1
  35. package/lib/odspDocumentStorageManager.js +1 -1
  36. package/lib/odspDocumentStorageManager.js.map +1 -1
  37. package/lib/packageVersion.d.ts +1 -1
  38. package/lib/packageVersion.d.ts.map +1 -1
  39. package/lib/packageVersion.js +1 -1
  40. package/lib/packageVersion.js.map +1 -1
  41. package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
  42. package/lib/prefetchLatestSnapshot.js +2 -2
  43. package/lib/prefetchLatestSnapshot.js.map +1 -1
  44. package/package.json +13 -13
  45. package/src/compactSnapshotParser.ts +2 -2
  46. package/src/epochTracker.ts +30 -11
  47. package/src/fetchSnapshot.ts +13 -7
  48. package/src/odspDocumentStorageManager.ts +1 -0
  49. package/src/packageVersion.ts +1 -1
  50. package/src/prefetchLatestSnapshot.ts +2 -1
@@ -28,8 +28,8 @@ import {
28
28
  type InstrumentedStorageTokenFetcher,
29
29
  OdspErrorTypes,
30
30
  } from "@fluidframework/odsp-driver-definitions/internal";
31
+ import type { TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
31
32
  import {
32
- type ITelemetryLoggerExt,
33
33
  PerformanceEvent,
34
34
  isFluidError,
35
35
  wrapError,
@@ -94,7 +94,7 @@ export async function fetchSnapshot(
94
94
  versionId: string,
95
95
  fetchFullSnapshot: boolean,
96
96
  forceAccessTokenViaAuthorizationHeader: boolean,
97
- logger: ITelemetryLoggerExt,
97
+ logger: TelemetryLoggerExt,
98
98
  snapshotDownloader: (url: string) => Promise<IOdspResponse<unknown>>,
99
99
  ): Promise<ISnapshot> {
100
100
  const path = `/trees/${versionId}`;
@@ -121,7 +121,7 @@ export async function fetchSnapshotWithRedeem(
121
121
  storageTokenFetcher: InstrumentedStorageTokenFetcher,
122
122
  snapshotOptions: ISnapshotOptions | undefined,
123
123
  forceAccessTokenViaAuthorizationHeader: boolean,
124
- logger: ITelemetryLoggerExt,
124
+ logger: TelemetryLoggerExt,
125
125
  snapshotDownloader: (
126
126
  finalOdspResolvedUrl: IOdspResolvedUrl,
127
127
  getAuthHeader: InstrumentedStorageTokenFetcher,
@@ -239,7 +239,7 @@ export async function fetchSnapshotWithRedeem(
239
239
  async function redeemSharingLink(
240
240
  odspResolvedUrl: IOdspResolvedUrl,
241
241
  getAuthHeader: InstrumentedStorageTokenFetcher,
242
- logger: ITelemetryLoggerExt,
242
+ logger: TelemetryLoggerExt,
243
243
  ): Promise<void> {
244
244
  await PerformanceEvent.timedExecAsync(
245
245
  logger,
@@ -306,7 +306,7 @@ async function fetchLatestSnapshotCore(
306
306
  odspResolvedUrl: IOdspResolvedUrl,
307
307
  getAuthHeader: InstrumentedStorageTokenFetcher,
308
308
  snapshotOptions: ISnapshotOptions | undefined,
309
- logger: ITelemetryLoggerExt,
309
+ logger: TelemetryLoggerExt,
310
310
  snapshotDownloader: (
311
311
  finalOdspResolvedUrl: IOdspResolvedUrl,
312
312
  getAuthHeader: InstrumentedStorageTokenFetcher,
@@ -713,15 +713,18 @@ function getTreeStatsCore(snapshotTree: ISnapshotTree, stats: ITreeStats): void
713
713
  /**
714
714
  * This function fetches the snapshot and parse it according to what is mentioned in response headers.
715
715
  * @param odspResolvedUrl - resolved odsp url.
716
- * @param storageToken - token to do the auth for network request.
717
- * @param snapshotOptions - Options used to specify how and what to fetch in the snapshot.
716
+ * @param getAuthHeader - function to fetch the auth header for the network request.
717
+ * @param tokenFetchOptions - options for fetching the token.
718
718
  * @param loadingGroupIds - loadingGroupIds for which snapshot needs to be downloaded. Note:
719
719
  * 1.) If undefined, then legacy trees latest call will be used where no groupId query param would be specified.
720
720
  * 2.) If [] is passed, then snapshot with all ungrouped data will be fetched.
721
721
  * 3.) If any groupId is specified like ["g1"], then snapshot for g1 group will be fetched.
722
+ * @param snapshotOptions - Options used to specify how and what to fetch in the snapshot.
723
+ * @param logger - logger for sending telemetry events.
722
724
  * @param snapshotFormatFetchType - Snapshot format to fetch.
723
725
  * @param controller - abort controller if caller needs to abort the network call.
724
726
  * @param epochTracker - epoch tracker used to add/validate epoch in the network call.
727
+ * @param scenarioName - scenario name for telemetry.
725
728
  * @returns fetched snapshot.
726
729
  */
727
730
  export const downloadSnapshot = mockify(
@@ -731,6 +734,7 @@ export const downloadSnapshot = mockify(
731
734
  tokenFetchOptions: TokenFetchOptionsEx,
732
735
  loadingGroupIds: string[] | undefined,
733
736
  snapshotOptions: ISnapshotOptions | undefined,
737
+ logger?: TelemetryLoggerExt,
734
738
  snapshotFormatFetchType?: SnapshotFormatSupportType,
735
739
  controller?: AbortController,
736
740
  epochTracker?: EpochTracker,
@@ -787,6 +791,7 @@ export const downloadSnapshot = mockify(
787
791
  "downloadSnapshot",
788
792
  );
789
793
  assert(authHeader !== null, 0x1e5 /* "Storage token should not be null" */);
794
+ logger?.sendTelemetryEvent({ eventName: "SnapshotAuthHeaderObtained" });
790
795
  const { body, headers } = getFormBodyAndHeaders(odspResolvedUrl, authHeader, header);
791
796
  const fetchOptions = {
792
797
  body,
@@ -813,6 +818,7 @@ export const downloadSnapshot = mockify(
813
818
  true,
814
819
  scenarioName,
815
820
  ) ?? fetchHelper(url, fetchOptions));
821
+ logger?.sendTelemetryEvent({ eventName: "SnapshotFetchResponseReceived" });
816
822
 
817
823
  return {
818
824
  odspResponse,
@@ -639,6 +639,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
639
639
  tokenFetchOptions,
640
640
  loadingGroupId,
641
641
  options,
642
+ this.logger,
642
643
  this.snapshotFormatFetchType,
643
644
  controller,
644
645
  this.epochTracker,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/odsp-driver";
9
- export const pkgVersion = "2.93.0";
9
+ export const pkgVersion = "2.100.0";
@@ -110,6 +110,7 @@ export async function prefetchLatestSnapshot(
110
110
  tokenFetchOptions,
111
111
  loadingGroupId,
112
112
  snapshotOptions,
113
+ odspLogger,
113
114
  undefined,
114
115
  controller,
115
116
  );
@@ -174,7 +175,7 @@ export async function prefetchLatestSnapshot(
174
175
  }, 5000);
175
176
  })
176
177
  .catch((error) => {
177
- // Remove it from the non persistent cache if an error occured.
178
+ // Remove it from the non persistent cache if an error occurred.
178
179
  snapshotNonPersistentCache?.remove(nonPersistentCacheKey);
179
180
  snapshotContentsWithEpochP.reject(error);
180
181
  throw error;