@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.
- package/CHANGELOG.md +8 -0
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/epochTracker.d.ts +8 -4
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +12 -9
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts +9 -6
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +8 -3
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +1 -1
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.js +2 -2
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/lib/compactSnapshotParser.d.ts +2 -2
- package/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/epochTracker.d.ts +8 -4
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js +13 -10
- package/lib/epochTracker.js.map +1 -1
- package/lib/fetchSnapshot.d.ts +9 -6
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js +8 -3
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +1 -1
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
- package/lib/prefetchLatestSnapshot.js +2 -2
- package/lib/prefetchLatestSnapshot.js.map +1 -1
- package/package.json +13 -13
- package/src/compactSnapshotParser.ts +2 -2
- package/src/epochTracker.ts +30 -11
- package/src/fetchSnapshot.ts +13 -7
- package/src/odspDocumentStorageManager.ts +1 -0
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +2 -1
package/src/fetchSnapshot.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
717
|
-
* @param
|
|
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,
|
package/src/packageVersion.ts
CHANGED
|
@@ -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
|
|
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;
|