@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.225277 → 2.0.0-dev-rc.1.0.0.232845
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 +34 -0
- package/README.md +0 -6
- package/api-report/odsp-driver.api.md +5 -5
- package/dist/{ReadBufferUtils.cjs → ReadBufferUtils.js} +1 -1
- package/dist/ReadBufferUtils.js.map +1 -0
- package/dist/{WriteBufferUtils.cjs → WriteBufferUtils.js} +2 -2
- package/dist/WriteBufferUtils.js.map +1 -0
- package/dist/{checkUrl.cjs → checkUrl.js} +2 -2
- package/dist/checkUrl.js.map +1 -0
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/{compactSnapshotParser.cjs → compactSnapshotParser.js} +12 -11
- package/dist/compactSnapshotParser.js.map +1 -0
- package/dist/compactSnapshotWriter.d.ts +2 -2
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/{compactSnapshotWriter.cjs → compactSnapshotWriter.js} +5 -5
- package/dist/compactSnapshotWriter.js.map +1 -0
- package/dist/{constants.cjs → constants.js} +1 -1
- package/dist/constants.js.map +1 -0
- package/dist/contracts.d.ts +14 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +13 -0
- package/dist/contracts.js.map +1 -0
- package/dist/{contractsPublic.cjs → contractsPublic.js} +1 -1
- package/dist/contractsPublic.js.map +1 -0
- package/dist/createFile.d.ts +1 -1
- package/dist/createFile.d.ts.map +1 -1
- package/dist/{createFile.cjs → createFile.js} +19 -38
- package/dist/createFile.js.map +1 -0
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/{createNewContainerOnExistingFile.cjs → createNewContainerOnExistingFile.js} +7 -7
- package/dist/createNewContainerOnExistingFile.js.map +1 -0
- package/dist/{createNewModule.cjs → createNewModule.js} +3 -3
- package/dist/createNewModule.js.map +1 -0
- package/dist/createNewUtils.d.ts +2 -2
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/{createNewUtils.cjs → createNewUtils.js} +8 -7
- package/dist/createNewUtils.js.map +1 -0
- package/dist/createOdspCreateContainerRequest.d.ts +2 -2
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/{createOdspCreateContainerRequest.cjs → createOdspCreateContainerRequest.js} +2 -2
- package/dist/createOdspCreateContainerRequest.js.map +1 -0
- package/dist/{createOdspUrl.cjs → createOdspUrl.js} +1 -1
- package/dist/createOdspUrl.js.map +1 -0
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/{epochTracker.cjs → epochTracker.js} +9 -10
- package/dist/epochTracker.js.map +1 -0
- package/dist/{fetch.cjs → fetch.js} +1 -1
- package/dist/fetch.js.map +1 -0
- package/dist/fetchSnapshot.d.ts +4 -4
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/{fetchSnapshot.cjs → fetchSnapshot.js} +20 -21
- package/dist/fetchSnapshot.js.map +1 -0
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/{getFileLink.cjs → getFileLink.js} +8 -8
- package/dist/getFileLink.js.map +1 -0
- package/dist/{getQueryString.cjs → getQueryString.js} +1 -1
- package/dist/getQueryString.js.map +1 -0
- package/dist/{getUrlAndHeadersWithAuth.cjs → getUrlAndHeadersWithAuth.js} +1 -1
- package/dist/getUrlAndHeadersWithAuth.js.map +1 -0
- package/dist/{index.cjs → index.js} +18 -18
- package/dist/index.js.map +1 -0
- package/dist/localOdspDriver/{localOdspDeltaStorageService.cjs → localOdspDeltaStorageService.js} +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentService.cjs → localOdspDocumentService.js} +6 -4
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -0
- package/dist/localOdspDriver/{localOdspDocumentServiceFactory.cjs → localOdspDocumentServiceFactory.js} +4 -4
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentStorageManager.cjs → localOdspDocumentStorageManager.js} +7 -4
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
- package/dist/odsp-driver-alpha.d.ts +4 -3
- package/dist/odsp-driver-beta.d.ts +3 -3
- package/dist/odsp-driver-public.d.ts +3 -3
- package/dist/odsp-driver-untrimmed.d.ts +5 -4
- package/dist/odspCache.d.ts +2 -2
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/{odspCache.cjs → odspCache.js} +1 -1
- package/dist/odspCache.js.map +1 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts +5 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/{odspDelayLoadedDeltaStream.cjs → odspDelayLoadedDeltaStream.js} +61 -10
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -0
- package/dist/{odspDeltaStorageService.cjs → odspDeltaStorageService.js} +2 -2
- package/dist/odspDeltaStorageService.js.map +1 -0
- package/dist/{odspDocumentDeltaConnection.cjs → odspDocumentDeltaConnection.js} +4 -4
- package/dist/odspDocumentDeltaConnection.js.map +1 -0
- package/dist/odspDocumentService.d.ts +3 -2
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/{odspDocumentService.cjs → odspDocumentService.js} +16 -11
- package/dist/odspDocumentService.js.map +1 -0
- package/dist/{odspDocumentServiceFactory.cjs → odspDocumentServiceFactory.js} +3 -3
- package/dist/odspDocumentServiceFactory.js.map +1 -0
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/{odspDocumentServiceFactoryCore.cjs → odspDocumentServiceFactoryCore.js} +9 -14
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -0
- package/dist/{odspDocumentServiceFactoryWithCodeSplit.cjs → odspDocumentServiceFactoryWithCodeSplit.js} +2 -2
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -0
- package/dist/odspDocumentStorageManager.d.ts +2 -1
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/{odspDocumentStorageManager.cjs → odspDocumentStorageManager.js} +39 -18
- package/dist/odspDocumentStorageManager.js.map +1 -0
- package/dist/odspDocumentStorageServiceBase.d.ts +3 -3
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/{odspDocumentStorageServiceBase.cjs → odspDocumentStorageServiceBase.js} +4 -4
- package/dist/odspDocumentStorageServiceBase.js.map +1 -0
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/{odspDriverUrlResolver.cjs → odspDriverUrlResolver.js} +9 -18
- package/dist/odspDriverUrlResolver.js.map +1 -0
- package/dist/{odspDriverUrlResolverForShareLink.cjs → odspDriverUrlResolverForShareLink.js} +7 -7
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -0
- package/dist/odspError.d.ts.map +1 -1
- package/dist/{odspError.cjs → odspError.js} +4 -4
- package/dist/odspError.js.map +1 -0
- package/dist/{odspFluidFileLink.cjs → odspFluidFileLink.js} +2 -2
- package/dist/odspFluidFileLink.js.map +1 -0
- package/dist/{odspLocationRedirection.cjs → odspLocationRedirection.js} +2 -2
- package/dist/odspLocationRedirection.js.map +1 -0
- package/dist/odspPublicUtils.d.ts +1 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/{odspPublicUtils.cjs → odspPublicUtils.js} +1 -1
- package/dist/odspPublicUtils.js.map +1 -0
- package/dist/odspSnapshotParser.d.ts +2 -2
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/{odspSnapshotParser.cjs → odspSnapshotParser.js} +3 -2
- package/dist/odspSnapshotParser.js.map +1 -0
- package/dist/{odspSummaryUploadManager.cjs → odspSummaryUploadManager.js} +3 -3
- package/dist/odspSummaryUploadManager.js.map +1 -0
- package/dist/{odspUrlHelper.cjs → odspUrlHelper.js} +1 -1
- package/dist/odspUrlHelper.js.map +1 -0
- package/dist/odspUtils.d.ts +11 -7
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/{odspUtils.cjs → odspUtils.js} +23 -19
- package/dist/odspUtils.js.map +1 -0
- package/dist/{opsCaching.cjs → opsCaching.js} +1 -1
- package/dist/opsCaching.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/{packageVersion.cjs → packageVersion.js} +2 -2
- package/dist/packageVersion.js.map +1 -0
- package/dist/{prefetchLatestSnapshot.cjs → prefetchLatestSnapshot.js} +3 -3
- package/dist/prefetchLatestSnapshot.js.map +1 -0
- package/dist/retryErrorsStorageAdapter.d.ts +2 -1
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/{retryErrorsStorageAdapter.cjs → retryErrorsStorageAdapter.js} +10 -2
- package/dist/retryErrorsStorageAdapter.js.map +1 -0
- package/dist/{retryUtils.cjs → retryUtils.js} +3 -3
- package/dist/retryUtils.js.map +1 -0
- package/dist/{socketModule.cjs → socketModule.js} +1 -1
- package/dist/socketModule.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vroom.cjs → vroom.js} +4 -4
- package/dist/vroom.js.map +1 -0
- package/dist/{zipItDataRepresentationUtils.cjs → zipItDataRepresentationUtils.js} +5 -5
- package/dist/zipItDataRepresentationUtils.js.map +1 -0
- package/lib/compactSnapshotParser.d.mts +2 -2
- package/lib/compactSnapshotParser.d.mts.map +1 -1
- package/lib/compactSnapshotParser.mjs +8 -7
- package/lib/compactSnapshotParser.mjs.map +1 -1
- package/lib/compactSnapshotWriter.d.mts +2 -2
- package/lib/compactSnapshotWriter.d.mts.map +1 -1
- package/lib/compactSnapshotWriter.mjs +1 -1
- package/lib/compactSnapshotWriter.mjs.map +1 -1
- package/lib/contracts.d.mts +14 -0
- package/lib/contracts.d.mts.map +1 -1
- package/lib/contracts.mjs +4 -0
- package/lib/contracts.mjs.map +1 -1
- package/lib/createFile.d.mts +1 -1
- package/lib/createFile.d.mts.map +1 -1
- package/lib/createFile.mjs +10 -29
- package/lib/createFile.mjs.map +1 -1
- package/lib/createNewContainerOnExistingFile.d.mts.map +1 -1
- package/lib/createNewContainerOnExistingFile.mjs.map +1 -1
- package/lib/createNewUtils.d.mts +2 -2
- package/lib/createNewUtils.d.mts.map +1 -1
- package/lib/createNewUtils.mjs +4 -3
- package/lib/createNewUtils.mjs.map +1 -1
- package/lib/createOdspCreateContainerRequest.d.mts +2 -2
- package/lib/createOdspCreateContainerRequest.d.mts.map +1 -1
- package/lib/createOdspCreateContainerRequest.mjs.map +1 -1
- package/lib/epochTracker.d.mts.map +1 -1
- package/lib/epochTracker.mjs +4 -5
- package/lib/epochTracker.mjs.map +1 -1
- package/lib/fetchSnapshot.d.mts +4 -4
- package/lib/fetchSnapshot.d.mts.map +1 -1
- package/lib/fetchSnapshot.mjs +13 -14
- package/lib/fetchSnapshot.mjs.map +1 -1
- package/lib/getFileLink.d.mts.map +1 -1
- package/lib/getFileLink.mjs +3 -3
- package/lib/getFileLink.mjs.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.mts +3 -2
- package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs +3 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts +2 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs +3 -0
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -1
- package/lib/odsp-driver-alpha.d.mts +4 -3
- package/lib/odsp-driver-beta.d.mts +3 -3
- package/lib/odsp-driver-public.d.mts +3 -3
- package/lib/odsp-driver-untrimmed.d.mts +5 -4
- package/lib/odspCache.d.mts +2 -2
- package/lib/odspCache.d.mts.map +1 -1
- package/lib/odspCache.mjs.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts +5 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.mjs +57 -6
- package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -1
- package/lib/odspDocumentService.d.mts +3 -2
- package/lib/odspDocumentService.d.mts.map +1 -1
- package/lib/odspDocumentService.mjs +6 -3
- package/lib/odspDocumentService.mjs.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.mjs +2 -9
- package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -1
- package/lib/odspDocumentStorageManager.d.mts +2 -1
- package/lib/odspDocumentStorageManager.d.mts.map +1 -1
- package/lib/odspDocumentStorageManager.mjs +33 -14
- package/lib/odspDocumentStorageManager.mjs.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.mts +3 -3
- package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.mjs +3 -3
- package/lib/odspDocumentStorageServiceBase.mjs.map +1 -1
- package/lib/odspDriverUrlResolver.d.mts.map +1 -1
- package/lib/odspDriverUrlResolver.mjs +4 -13
- package/lib/odspDriverUrlResolver.mjs.map +1 -1
- package/lib/odspError.d.mts.map +1 -1
- package/lib/odspError.mjs +2 -2
- package/lib/odspError.mjs.map +1 -1
- package/lib/odspPublicUtils.d.mts +1 -0
- package/lib/odspPublicUtils.d.mts.map +1 -1
- package/lib/odspPublicUtils.mjs.map +1 -1
- package/lib/odspSnapshotParser.d.mts +2 -2
- package/lib/odspSnapshotParser.d.mts.map +1 -1
- package/lib/odspSnapshotParser.mjs +2 -1
- package/lib/odspSnapshotParser.mjs.map +1 -1
- package/lib/odspUtils.d.mts +11 -7
- package/lib/odspUtils.d.mts.map +1 -1
- package/lib/odspUtils.mjs +19 -16
- package/lib/odspUtils.mjs.map +1 -1
- package/lib/packageVersion.d.mts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/retryErrorsStorageAdapter.d.mts +2 -1
- package/lib/retryErrorsStorageAdapter.d.mts.map +1 -1
- package/lib/retryErrorsStorageAdapter.mjs +9 -1
- package/lib/retryErrorsStorageAdapter.mjs.map +1 -1
- package/lib/retryUtils.mjs +2 -2
- package/lib/retryUtils.mjs.map +1 -1
- package/lib/zipItDataRepresentationUtils.mjs +2 -2
- package/lib/zipItDataRepresentationUtils.mjs.map +1 -1
- package/package.json +30 -21
- package/src/compactSnapshotParser.ts +10 -9
- package/src/compactSnapshotWriter.ts +3 -3
- package/src/contracts.ts +17 -0
- package/src/createFile.ts +10 -38
- package/src/createNewContainerOnExistingFile.ts +2 -2
- package/src/createNewUtils.ts +7 -6
- package/src/createOdspCreateContainerRequest.ts +2 -2
- package/src/epochTracker.ts +4 -4
- package/src/fetchSnapshot.ts +21 -22
- package/src/getFileLink.ts +3 -3
- package/src/localOdspDriver/localOdspDocumentService.ts +9 -2
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +10 -3
- package/src/odspCache.ts +2 -2
- package/src/odspDelayLoadedDeltaStream.ts +67 -6
- package/src/odspDocumentService.ts +10 -2
- package/src/odspDocumentServiceFactoryCore.ts +3 -11
- package/src/odspDocumentStorageManager.ts +60 -27
- package/src/odspDocumentStorageServiceBase.ts +8 -5
- package/src/odspDriverUrlResolver.ts +3 -17
- package/src/odspError.ts +2 -3
- package/src/odspPublicUtils.ts +1 -0
- package/src/odspSnapshotParser.ts +5 -6
- package/src/odspUtils.ts +34 -28
- package/src/packageVersion.ts +1 -1
- package/src/retryErrorsStorageAdapter.ts +12 -1
- package/src/retryUtils.ts +2 -2
- package/src/zipItDataRepresentationUtils.ts +2 -2
- package/dist/ReadBufferUtils.cjs.map +0 -1
- package/dist/WriteBufferUtils.cjs.map +0 -1
- package/dist/checkUrl.cjs.map +0 -1
- package/dist/compactSnapshotParser.cjs.map +0 -1
- package/dist/compactSnapshotWriter.cjs.map +0 -1
- package/dist/constants.cjs.map +0 -1
- package/dist/contracts.cjs +0 -9
- package/dist/contracts.cjs.map +0 -1
- package/dist/contractsPublic.cjs.map +0 -1
- package/dist/createFile.cjs.map +0 -1
- package/dist/createNewContainerOnExistingFile.cjs.map +0 -1
- package/dist/createNewModule.cjs.map +0 -1
- package/dist/createNewUtils.cjs.map +0 -1
- package/dist/createOdspCreateContainerRequest.cjs.map +0 -1
- package/dist/createOdspUrl.cjs.map +0 -1
- package/dist/epochTracker.cjs.map +0 -1
- package/dist/fetch.cjs.map +0 -1
- package/dist/fetchSnapshot.cjs.map +0 -1
- package/dist/getFileLink.cjs.map +0 -1
- package/dist/getQueryString.cjs.map +0 -1
- package/dist/getUrlAndHeadersWithAuth.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentService.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +0 -1
- package/dist/odspCache.cjs.map +0 -1
- package/dist/odspDelayLoadedDeltaStream.cjs.map +0 -1
- package/dist/odspDeltaStorageService.cjs.map +0 -1
- package/dist/odspDocumentDeltaConnection.cjs.map +0 -1
- package/dist/odspDocumentService.cjs.map +0 -1
- package/dist/odspDocumentServiceFactory.cjs.map +0 -1
- package/dist/odspDocumentServiceFactoryCore.cjs.map +0 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +0 -1
- package/dist/odspDocumentStorageManager.cjs.map +0 -1
- package/dist/odspDocumentStorageServiceBase.cjs.map +0 -1
- package/dist/odspDriverUrlResolver.cjs.map +0 -1
- package/dist/odspDriverUrlResolverForShareLink.cjs.map +0 -1
- package/dist/odspError.cjs.map +0 -1
- package/dist/odspFluidFileLink.cjs.map +0 -1
- package/dist/odspLocationRedirection.cjs.map +0 -1
- package/dist/odspPublicUtils.cjs.map +0 -1
- package/dist/odspSnapshotParser.cjs.map +0 -1
- package/dist/odspSummaryUploadManager.cjs.map +0 -1
- package/dist/odspUrlHelper.cjs.map +0 -1
- package/dist/odspUtils.cjs.map +0 -1
- package/dist/opsCaching.cjs.map +0 -1
- package/dist/packageVersion.cjs.map +0 -1
- package/dist/prefetchLatestSnapshot.cjs.map +0 -1
- package/dist/retryErrorsStorageAdapter.cjs.map +0 -1
- package/dist/retryUtils.cjs.map +0 -1
- package/dist/socketModule.cjs.map +0 -1
- package/dist/vroom.cjs.map +0 -1
- package/dist/zipItDataRepresentationUtils.cjs.map +0 -1
- package/tsc-multi.test.json +0 -4
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
|
@@ -16,12 +16,17 @@ import { assert, delay } from "@fluidframework/core-utils";
|
|
|
16
16
|
import { LogLevel } from "@fluidframework/core-interfaces";
|
|
17
17
|
import * as api from "@fluidframework/protocol-definitions";
|
|
18
18
|
import { promiseRaceWithWinner } from "@fluidframework/driver-base";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ISummaryContext,
|
|
21
|
+
FetchSource,
|
|
22
|
+
ISnapshot,
|
|
23
|
+
ISnapshotFetchOptions,
|
|
24
|
+
} from "@fluidframework/driver-definitions";
|
|
20
25
|
import { RateLimiter, NonRetryableError } from "@fluidframework/driver-utils";
|
|
21
26
|
import {
|
|
22
27
|
IOdspResolvedUrl,
|
|
23
28
|
ISnapshotOptions,
|
|
24
|
-
|
|
29
|
+
OdspErrorTypes,
|
|
25
30
|
InstrumentedStorageTokenFetcher,
|
|
26
31
|
getKeyForCacheEntry,
|
|
27
32
|
} from "@fluidframework/odsp-driver-definitions";
|
|
@@ -30,6 +35,7 @@ import {
|
|
|
30
35
|
HostStoragePolicyInternal,
|
|
31
36
|
IVersionedValueWithEpoch,
|
|
32
37
|
ISnapshotCachedEntry,
|
|
38
|
+
ISnapshotCachedEntry2,
|
|
33
39
|
} from "./contracts";
|
|
34
40
|
import {
|
|
35
41
|
downloadSnapshot,
|
|
@@ -40,8 +46,11 @@ import {
|
|
|
40
46
|
} from "./fetchSnapshot";
|
|
41
47
|
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
42
48
|
import { IOdspCache, IPrefetchSnapshotContents } from "./odspCache";
|
|
43
|
-
import {
|
|
44
|
-
|
|
49
|
+
import {
|
|
50
|
+
createCacheSnapshotKey,
|
|
51
|
+
getWithRetryForTokenRefresh,
|
|
52
|
+
isInstanceOfISnapshot,
|
|
53
|
+
} from "./odspUtils";
|
|
45
54
|
import { EpochTracker } from "./epochTracker";
|
|
46
55
|
import type { OdspSummaryUploadManager } from "./odspSummaryUploadManager";
|
|
47
56
|
import { FlushResult } from "./odspDocumentDeltaConnection";
|
|
@@ -204,6 +213,15 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
204
213
|
return super.getSnapshotTree(version, scenarioName);
|
|
205
214
|
}
|
|
206
215
|
|
|
216
|
+
public async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {
|
|
217
|
+
assert(this.hostPolicy.supportGetSnapshotApi !== true, "api should not be called yet");
|
|
218
|
+
// This is just temporary as this api is not yet enabled in service policies.
|
|
219
|
+
return this.fetchSnapshot(
|
|
220
|
+
this.hostPolicy.snapshotOptions,
|
|
221
|
+
snapshotFetchOptions?.scenarioName,
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
207
225
|
public async getVersions(
|
|
208
226
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
209
227
|
blobid: string | null,
|
|
@@ -233,16 +251,13 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
233
251
|
// If count is one, we can use the trees/latest API, which returns the latest version and trees in a single request for better performance
|
|
234
252
|
if (count === 1 && (blobid === null || blobid === this.documentId)) {
|
|
235
253
|
const hostSnapshotOptions = this.hostPolicy.snapshotOptions;
|
|
236
|
-
const odspSnapshotCacheValue:
|
|
254
|
+
const odspSnapshotCacheValue: ISnapshot = await PerformanceEvent.timedExecAsync(
|
|
237
255
|
this.logger,
|
|
238
256
|
{ eventName: "ObtainSnapshot", fetchSource },
|
|
239
257
|
async (event: PerformanceEvent) => {
|
|
240
258
|
const props: GetVersionsTelemetryProps = {};
|
|
241
259
|
let cacheLookupTimeInSerialFetch = 0;
|
|
242
|
-
let retrievedSnapshot:
|
|
243
|
-
| ISnapshotContents
|
|
244
|
-
| IPrefetchSnapshotContents
|
|
245
|
-
| undefined;
|
|
260
|
+
let retrievedSnapshot: ISnapshot | IPrefetchSnapshotContents | undefined;
|
|
246
261
|
|
|
247
262
|
let method: string;
|
|
248
263
|
let prefetchWaitStartTime: number = performance.now();
|
|
@@ -255,10 +270,14 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
255
270
|
} else {
|
|
256
271
|
// Here's the logic to grab the persistent cache snapshot implemented by the host
|
|
257
272
|
// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions
|
|
258
|
-
const cachedSnapshotP: Promise<
|
|
259
|
-
this.
|
|
260
|
-
|
|
261
|
-
|
|
273
|
+
const cachedSnapshotP: Promise<ISnapshot | undefined> = this.epochTracker
|
|
274
|
+
.get(createCacheSnapshotKey(this.odspResolvedUrl))
|
|
275
|
+
.then(
|
|
276
|
+
async (
|
|
277
|
+
snapshotCachedEntry:
|
|
278
|
+
| ISnapshotCachedEntry
|
|
279
|
+
| ISnapshotCachedEntry2,
|
|
280
|
+
) => {
|
|
262
281
|
if (snapshotCachedEntry !== undefined) {
|
|
263
282
|
// If the cached entry does not contain the entry time, then assign it a default of 30 days old.
|
|
264
283
|
const age =
|
|
@@ -281,10 +300,24 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
281
300
|
|
|
282
301
|
// Record the cache age
|
|
283
302
|
props.cacheEntryAge = age;
|
|
303
|
+
// Snapshot from cache could be in older format, so transform that before returning.
|
|
304
|
+
if (isInstanceOfISnapshot(snapshotCachedEntry)) {
|
|
305
|
+
return snapshotCachedEntry;
|
|
306
|
+
} else {
|
|
307
|
+
const snapshot: ISnapshot = {
|
|
308
|
+
snapshotTree: snapshotCachedEntry.snapshotTree,
|
|
309
|
+
blobContents: snapshotCachedEntry.blobs,
|
|
310
|
+
ops: snapshotCachedEntry.ops,
|
|
311
|
+
latestSequenceNumber:
|
|
312
|
+
snapshotCachedEntry.latestSequenceNumber,
|
|
313
|
+
sequenceNumber: snapshotCachedEntry.sequenceNumber,
|
|
314
|
+
snapshotFormatV: 1,
|
|
315
|
+
};
|
|
316
|
+
return snapshot;
|
|
317
|
+
}
|
|
284
318
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
});
|
|
319
|
+
},
|
|
320
|
+
);
|
|
288
321
|
// Based on the concurrentSnapshotFetch policy:
|
|
289
322
|
// Either retrieve both the network and cache snapshots concurrently and pick the first to return,
|
|
290
323
|
// or grab the cache value and then the network value if the cache value returns undefined.
|
|
@@ -427,14 +460,14 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
427
460
|
if (!versionsResponse) {
|
|
428
461
|
throw new NonRetryableError(
|
|
429
462
|
"No response from /versions endpoint",
|
|
430
|
-
|
|
463
|
+
OdspErrorTypes.genericNetworkError,
|
|
431
464
|
{ driverVersion },
|
|
432
465
|
);
|
|
433
466
|
}
|
|
434
467
|
if (!Array.isArray(versionsResponse.value)) {
|
|
435
468
|
throw new NonRetryableError(
|
|
436
469
|
"Incorrect response from /versions endpoint, expected an array",
|
|
437
|
-
|
|
470
|
+
OdspErrorTypes.genericNetworkError,
|
|
438
471
|
{ driverVersion },
|
|
439
472
|
);
|
|
440
473
|
}
|
|
@@ -467,7 +500,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
467
500
|
private async fetchSnapshotCore(
|
|
468
501
|
hostSnapshotOptions: ISnapshotOptions | undefined,
|
|
469
502
|
scenarioName?: string,
|
|
470
|
-
): Promise<
|
|
503
|
+
): Promise<ISnapshot | IPrefetchSnapshotContents> {
|
|
471
504
|
// Don't look into cache, if the host specifically tells us so.
|
|
472
505
|
if (!this.hostPolicy.avoidPrefetchSnapshotCache) {
|
|
473
506
|
const prefetchCacheKey = getKeyForCacheEntry(
|
|
@@ -554,7 +587,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
554
587
|
const errorType = error.errorType;
|
|
555
588
|
// If the snapshot size is too big and the host specified the size limitation(specified in hostSnapshotOptions), then don't try to fetch the snapshot again.
|
|
556
589
|
if (
|
|
557
|
-
errorType ===
|
|
590
|
+
errorType === OdspErrorTypes.snapshotTooBig &&
|
|
558
591
|
hostSnapshotOptions?.mds !== undefined &&
|
|
559
592
|
this.hostPolicy.summarizerClient !== true
|
|
560
593
|
) {
|
|
@@ -562,8 +595,8 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
562
595
|
}
|
|
563
596
|
// If the first snapshot request was with blobs and we either timed out or the size was too big, then try to fetch without blobs.
|
|
564
597
|
if (
|
|
565
|
-
(errorType ===
|
|
566
|
-
errorType ===
|
|
598
|
+
(errorType === OdspErrorTypes.snapshotTooBig ||
|
|
599
|
+
errorType === OdspErrorTypes.fetchTimeout) &&
|
|
567
600
|
snapshotOptions.blobs
|
|
568
601
|
) {
|
|
569
602
|
this.logger.sendErrorEvent({
|
|
@@ -684,7 +717,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
684
717
|
if (!this.snapshotUrl) {
|
|
685
718
|
throw new NonRetryableError(
|
|
686
719
|
"Method failed because no snapshot url was available",
|
|
687
|
-
|
|
720
|
+
OdspErrorTypes.genericError,
|
|
688
721
|
{ driverVersion },
|
|
689
722
|
);
|
|
690
723
|
}
|
|
@@ -694,7 +727,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
694
727
|
if (!this.attachmentPOSTUrl) {
|
|
695
728
|
throw new NonRetryableError(
|
|
696
729
|
"Method failed because no attachment POST url was available",
|
|
697
|
-
|
|
730
|
+
OdspErrorTypes.genericError,
|
|
698
731
|
{ driverVersion },
|
|
699
732
|
);
|
|
700
733
|
}
|
|
@@ -704,7 +737,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
704
737
|
if (!this.attachmentGETUrl) {
|
|
705
738
|
throw new NonRetryableError(
|
|
706
739
|
"Method failed because no attachment GET url was available",
|
|
707
|
-
|
|
740
|
+
OdspErrorTypes.genericError,
|
|
708
741
|
{ driverVersion },
|
|
709
742
|
);
|
|
710
743
|
}
|
|
@@ -746,8 +779,8 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
746
779
|
treeId = snapshot.snapshotTree.id;
|
|
747
780
|
this.setRootTree(treeId, snapshot.snapshotTree);
|
|
748
781
|
}
|
|
749
|
-
if (snapshot.
|
|
750
|
-
this.initBlobsCache(snapshot.
|
|
782
|
+
if (snapshot.blobContents) {
|
|
783
|
+
this.initBlobsCache(snapshot.blobContents);
|
|
751
784
|
}
|
|
752
785
|
// If the version id doesn't match with the id of the tree, then use the id of first tree which in that case
|
|
753
786
|
// will be the actual id of tree to be fetched.
|
|
@@ -11,10 +11,11 @@ import {
|
|
|
11
11
|
LoaderCachingPolicy,
|
|
12
12
|
FiveDaysMs,
|
|
13
13
|
FetchSource,
|
|
14
|
+
ISnapshot,
|
|
15
|
+
ISnapshotFetchOptions,
|
|
14
16
|
} from "@fluidframework/driver-definitions";
|
|
15
17
|
import * as api from "@fluidframework/protocol-definitions";
|
|
16
18
|
import { IConfigProvider } from "@fluidframework/telemetry-utils";
|
|
17
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
18
19
|
|
|
19
20
|
const maximumCacheDurationMs: FiveDaysMs = 432000000; // 5 * 24 * 60 * 60 * 1000 = 5 days in ms
|
|
20
21
|
|
|
@@ -208,6 +209,8 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
208
209
|
return this.combineProtocolAndAppSnapshotTree(appTree, protocolTree);
|
|
209
210
|
}
|
|
210
211
|
|
|
212
|
+
public abstract getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
|
|
213
|
+
|
|
211
214
|
public abstract getVersions(
|
|
212
215
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
213
216
|
blobid: string | null,
|
|
@@ -267,11 +270,11 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
267
270
|
}
|
|
268
271
|
|
|
269
272
|
protected initializeFromSnapshot(
|
|
270
|
-
odspSnapshotCacheValue:
|
|
273
|
+
odspSnapshotCacheValue: ISnapshot,
|
|
271
274
|
cacheOps: boolean = true,
|
|
272
275
|
): string | undefined {
|
|
273
276
|
this._snapshotSequenceNumber = odspSnapshotCacheValue.sequenceNumber;
|
|
274
|
-
const { snapshotTree,
|
|
277
|
+
const { snapshotTree, blobContents, ops } = odspSnapshotCacheValue;
|
|
275
278
|
|
|
276
279
|
// id should be undefined in case of just ops in snapshot.
|
|
277
280
|
let id: string | undefined;
|
|
@@ -281,8 +284,8 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
281
284
|
this.setRootTree(id, snapshotTree);
|
|
282
285
|
}
|
|
283
286
|
|
|
284
|
-
if (
|
|
285
|
-
this.initBlobsCache(
|
|
287
|
+
if (blobContents) {
|
|
288
|
+
this.initBlobsCache(blobContents);
|
|
286
289
|
}
|
|
287
290
|
|
|
288
291
|
if (cacheOps) {
|
|
@@ -5,17 +5,12 @@
|
|
|
5
5
|
import { assert } from "@fluidframework/core-utils";
|
|
6
6
|
import { IRequest } from "@fluidframework/core-interfaces";
|
|
7
7
|
import {
|
|
8
|
-
DriverErrorType,
|
|
9
8
|
DriverHeader,
|
|
10
9
|
IContainerPackageInfo,
|
|
11
10
|
IResolvedUrl,
|
|
12
11
|
IUrlResolver,
|
|
13
12
|
} from "@fluidframework/driver-definitions";
|
|
14
|
-
import {
|
|
15
|
-
IOdspResolvedUrl,
|
|
16
|
-
ShareLinkTypes,
|
|
17
|
-
ShareLinkInfoType,
|
|
18
|
-
} from "@fluidframework/odsp-driver-definitions";
|
|
13
|
+
import { IOdspResolvedUrl, OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
|
|
19
14
|
import { NonRetryableError } from "@fluidframework/driver-utils";
|
|
20
15
|
import { createOdspUrl } from "./createOdspUrl";
|
|
21
16
|
import { getApiRoot } from "./odspUrlHelper";
|
|
@@ -97,23 +92,14 @@ export class OdspDriverUrlResolver implements IUrlResolver {
|
|
|
97
92
|
const driveID = searchParams.get("driveId");
|
|
98
93
|
const filePath = searchParams.get("path");
|
|
99
94
|
const packageName = searchParams.get("containerPackageName");
|
|
100
|
-
const createLinkType = searchParams.get("createLinkType");
|
|
101
95
|
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- false positive
|
|
102
96
|
if (!(fileName && siteURL && driveID && filePath !== null && filePath !== undefined)) {
|
|
103
97
|
throw new NonRetryableError(
|
|
104
98
|
"Proper new file params should be there!!",
|
|
105
|
-
|
|
99
|
+
OdspErrorTypes.genericError,
|
|
106
100
|
{ driverVersion: pkgVersion },
|
|
107
101
|
);
|
|
108
102
|
}
|
|
109
|
-
let shareLinkInfo: ShareLinkInfoType | undefined;
|
|
110
|
-
if (createLinkType && createLinkType in ShareLinkTypes) {
|
|
111
|
-
shareLinkInfo = {
|
|
112
|
-
createLink: {
|
|
113
|
-
type: ShareLinkTypes[createLinkType],
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
103
|
return {
|
|
118
104
|
endpoints: {
|
|
119
105
|
snapshotStorageUrl: "",
|
|
@@ -136,7 +122,7 @@ export class OdspDriverUrlResolver implements IUrlResolver {
|
|
|
136
122
|
containerPackageName: packageName ?? undefined,
|
|
137
123
|
},
|
|
138
124
|
fileVersion: undefined,
|
|
139
|
-
shareLinkInfo,
|
|
125
|
+
shareLinkInfo: undefined,
|
|
140
126
|
isClpCompliantApp: request.headers?.[ClpCompliantAppHeader.isClpCompliantApp],
|
|
141
127
|
};
|
|
142
128
|
}
|
package/src/odspError.ts
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { createOdspNetworkError } from "@fluidframework/odsp-doclib-utils";
|
|
7
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
8
7
|
import { NonRetryableError } from "@fluidframework/driver-utils";
|
|
9
|
-
import { OdspError } from "@fluidframework/odsp-driver-definitions";
|
|
8
|
+
import { OdspError, OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
|
|
10
9
|
import { getCircularReplacer, IFluidErrorBase } from "@fluidframework/telemetry-utils";
|
|
11
10
|
import { IOdspSocketError } from "./contracts";
|
|
12
11
|
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
@@ -37,7 +36,7 @@ export function errorObjectFromSocketError(
|
|
|
37
36
|
} catch (error) {
|
|
38
37
|
return new NonRetryableError(
|
|
39
38
|
"Internal error: errorObjectFromSocketError",
|
|
40
|
-
|
|
39
|
+
OdspErrorTypes.fileNotFoundOrAccessDeniedError,
|
|
41
40
|
{ driverVersion },
|
|
42
41
|
);
|
|
43
42
|
}
|
package/src/odspPublicUtils.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import { stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils";
|
|
8
8
|
import * as api from "@fluidframework/protocol-definitions";
|
|
9
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
9
10
|
import { IOdspSnapshot, IOdspSnapshotCommit } from "./contracts";
|
|
10
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Build a tree hierarchy base on a flat tree
|
|
@@ -51,9 +51,7 @@ function buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {
|
|
|
51
51
|
* Converts existing IOdspSnapshot to snapshot tree, blob array and ops
|
|
52
52
|
* @param odspSnapshot - snapshot
|
|
53
53
|
*/
|
|
54
|
-
export function convertOdspSnapshotToSnapshotTreeAndBlobs(
|
|
55
|
-
odspSnapshot: IOdspSnapshot,
|
|
56
|
-
): ISnapshotContents {
|
|
54
|
+
export function convertOdspSnapshotToSnapshotTreeAndBlobs(odspSnapshot: IOdspSnapshot): ISnapshot {
|
|
57
55
|
const blobsWithBufferContent = new Map<string, ArrayBuffer>();
|
|
58
56
|
if (odspSnapshot.blobs) {
|
|
59
57
|
odspSnapshot.blobs.forEach((blob) => {
|
|
@@ -70,8 +68,8 @@ export function convertOdspSnapshotToSnapshotTreeAndBlobs(
|
|
|
70
68
|
|
|
71
69
|
const sequenceNumber = odspSnapshot?.trees[0].sequenceNumber;
|
|
72
70
|
|
|
73
|
-
const val:
|
|
74
|
-
|
|
71
|
+
const val: ISnapshot = {
|
|
72
|
+
blobContents: blobsWithBufferContent,
|
|
75
73
|
ops: odspSnapshot.ops?.map((op) => op.op) ?? [],
|
|
76
74
|
sequenceNumber,
|
|
77
75
|
snapshotTree: buildHierarchy(odspSnapshot.trees[0]),
|
|
@@ -79,6 +77,7 @@ export function convertOdspSnapshotToSnapshotTreeAndBlobs(
|
|
|
79
77
|
odspSnapshot.ops && odspSnapshot.ops.length > 0
|
|
80
78
|
? odspSnapshot.ops[odspSnapshot.ops.length - 1].sequenceNumber
|
|
81
79
|
: sequenceNumber,
|
|
80
|
+
snapshotFormatV: 1,
|
|
82
81
|
};
|
|
83
82
|
return val;
|
|
84
83
|
}
|
package/src/odspUtils.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ITelemetryProperties, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { IResolvedUrl,
|
|
7
|
+
import { IResolvedUrl, ISnapshot } from "@fluidframework/driver-definitions";
|
|
8
8
|
import {
|
|
9
9
|
isOnline,
|
|
10
10
|
OnlineStatus,
|
|
@@ -29,11 +29,10 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
IOdspResolvedUrl,
|
|
31
31
|
TokenFetchOptions,
|
|
32
|
-
|
|
32
|
+
OdspErrorTypes,
|
|
33
33
|
tokenFromResponse,
|
|
34
34
|
isTokenFromCache,
|
|
35
35
|
OdspResourceTokenFetchOptions,
|
|
36
|
-
ShareLinkTypes,
|
|
37
36
|
ISharingLinkKind,
|
|
38
37
|
TokenFetcher,
|
|
39
38
|
ICacheEntry,
|
|
@@ -44,6 +43,7 @@ import {
|
|
|
44
43
|
import { fetch } from "./fetch";
|
|
45
44
|
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
46
45
|
import { IOdspSnapshot } from "./contracts";
|
|
46
|
+
import { ISnapshotContents } from "./odspPublicUtils";
|
|
47
47
|
|
|
48
48
|
export const getWithRetryForTokenRefreshRepeat = "getWithRetryForTokenRefreshRepeat";
|
|
49
49
|
|
|
@@ -86,11 +86,11 @@ export async function getWithRetryForTokenRefresh<T>(
|
|
|
86
86
|
const options: TokenFetchOptionsEx = { refresh: true, previousError: e };
|
|
87
87
|
switch (e.errorType) {
|
|
88
88
|
// If the error is 401 or 403 refresh the token and try once more.
|
|
89
|
-
case
|
|
89
|
+
case OdspErrorTypes.authorizationError:
|
|
90
90
|
return get({ ...options, claims: e.claims, tenantId: e.tenantId });
|
|
91
91
|
|
|
92
|
-
case
|
|
93
|
-
case
|
|
92
|
+
case OdspErrorTypes.incorrectServerResponse: // some error on the wire, retry once
|
|
93
|
+
case OdspErrorTypes.fetchTokenError: // If the token was null, then retry once.
|
|
94
94
|
return get(options);
|
|
95
95
|
|
|
96
96
|
default:
|
|
@@ -118,7 +118,7 @@ export async function fetchHelper(
|
|
|
118
118
|
throw new NonRetryableError(
|
|
119
119
|
// pre-0.58 error message: No response from fetch call
|
|
120
120
|
"No response from ODSP fetch call",
|
|
121
|
-
|
|
121
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
122
122
|
{ driverVersion },
|
|
123
123
|
);
|
|
124
124
|
}
|
|
@@ -154,13 +154,17 @@ export async function fetchHelper(
|
|
|
154
154
|
|
|
155
155
|
// This error is thrown by fetch() when AbortSignal is provided and it gets cancelled
|
|
156
156
|
if (error.name === "AbortError") {
|
|
157
|
-
throw new RetryableError(
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
throw new RetryableError(
|
|
158
|
+
"Fetch Timeout (AbortError)",
|
|
159
|
+
OdspErrorTypes.fetchTimeout,
|
|
160
|
+
{
|
|
161
|
+
driverVersion,
|
|
162
|
+
},
|
|
163
|
+
);
|
|
160
164
|
}
|
|
161
165
|
// TCP/IP timeout
|
|
162
166
|
if (redactedErrorText.includes("ETIMEDOUT")) {
|
|
163
|
-
throw new RetryableError("Fetch Timeout (ETIMEDOUT)",
|
|
167
|
+
throw new RetryableError("Fetch Timeout (ETIMEDOUT)", OdspErrorTypes.fetchTimeout, {
|
|
164
168
|
driverVersion,
|
|
165
169
|
});
|
|
166
170
|
}
|
|
@@ -170,7 +174,7 @@ export async function fetchHelper(
|
|
|
170
174
|
throw new RetryableError(
|
|
171
175
|
// pre-0.58 error message prefix: Offline
|
|
172
176
|
`ODSP fetch failure (Offline): ${redactedErrorText}`,
|
|
173
|
-
|
|
177
|
+
OdspErrorTypes.offlineError,
|
|
174
178
|
{
|
|
175
179
|
driverVersion,
|
|
176
180
|
rawErrorMessage: taggedErrorMessage,
|
|
@@ -182,7 +186,7 @@ export async function fetchHelper(
|
|
|
182
186
|
throw new RetryableError(
|
|
183
187
|
// pre-0.58 error message prefix: Fetch error
|
|
184
188
|
`ODSP fetch failure: ${redactedErrorText}`,
|
|
185
|
-
|
|
189
|
+
OdspErrorTypes.fetchFailure,
|
|
186
190
|
{
|
|
187
191
|
driverVersion,
|
|
188
192
|
rawErrorMessage: taggedErrorMessage,
|
|
@@ -279,11 +283,8 @@ export interface INewFileInfo extends IFileInfoBase {
|
|
|
279
283
|
/**
|
|
280
284
|
* application can request creation of a share link along with the creation of a new file
|
|
281
285
|
* by passing in an optional param to specify the kind of sharing link
|
|
282
|
-
* (at the time of adding this comment Sept/2021), odsp only supports csl
|
|
283
|
-
* ShareLinkTypes will deprecated in future. Use ISharingLinkKind instead which specifies both
|
|
284
|
-
* share link type and the role type.
|
|
285
286
|
*/
|
|
286
|
-
createLinkType?:
|
|
287
|
+
createLinkType?: ISharingLinkKind;
|
|
287
288
|
}
|
|
288
289
|
|
|
289
290
|
export interface IExistingFileInfo extends IFileInfoBase {
|
|
@@ -391,7 +392,7 @@ export function toInstrumentedOdspTokenFetcher(
|
|
|
391
392
|
throw new NonRetryableError(
|
|
392
393
|
// pre-0.58 error message: Token is null for ${name} call
|
|
393
394
|
`The Host-provided token fetcher returned null`,
|
|
394
|
-
|
|
395
|
+
OdspErrorTypes.fetchTokenError,
|
|
395
396
|
{ method: name, driverVersion },
|
|
396
397
|
);
|
|
397
398
|
}
|
|
@@ -406,7 +407,7 @@ export function toInstrumentedOdspTokenFetcher(
|
|
|
406
407
|
(errorMessage) =>
|
|
407
408
|
new NetworkErrorBasic(
|
|
408
409
|
`The Host-provided token fetcher threw an error`,
|
|
409
|
-
|
|
410
|
+
OdspErrorTypes.fetchTokenError,
|
|
410
411
|
typeof rawCanRetry === "boolean"
|
|
411
412
|
? rawCanRetry
|
|
412
413
|
: false /* canRetry */,
|
|
@@ -443,19 +444,13 @@ export const maxUmpPostBodySize = 79872;
|
|
|
443
444
|
* @param shareLinkType - Kind of sharing link requested
|
|
444
445
|
* @returns A string of request parameters that can be concatenated with the base URI
|
|
445
446
|
*/
|
|
446
|
-
export function buildOdspShareLinkReqParams(
|
|
447
|
-
shareLinkType: ShareLinkTypes | ISharingLinkKind | undefined,
|
|
448
|
-
) {
|
|
447
|
+
export function buildOdspShareLinkReqParams(shareLinkType: ISharingLinkKind | undefined) {
|
|
449
448
|
if (!shareLinkType) {
|
|
450
449
|
return;
|
|
451
450
|
}
|
|
452
|
-
const scope =
|
|
453
|
-
if (!scope) {
|
|
454
|
-
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
455
|
-
return `createLinkType=${shareLinkType}`;
|
|
456
|
-
}
|
|
451
|
+
const scope = shareLinkType.scope;
|
|
457
452
|
let shareLinkRequestParams = `createLinkScope=${scope}`;
|
|
458
|
-
const role =
|
|
453
|
+
const role = shareLinkType.role;
|
|
459
454
|
shareLinkRequestParams = role
|
|
460
455
|
? `${shareLinkRequestParams}&createLinkRole=${role}`
|
|
461
456
|
: shareLinkRequestParams;
|
|
@@ -479,3 +474,14 @@ export async function measureP<T>(callback: () => Promise<T>): Promise<[T, numbe
|
|
|
479
474
|
export function getJoinSessionCacheKey(odspResolvedUrl: IOdspResolvedUrl) {
|
|
480
475
|
return `${odspResolvedUrl.hashedDocumentId}/joinsession`;
|
|
481
476
|
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Utility API to check if the type of snapshot contents is `ISnapshot`.
|
|
480
|
+
* @internal
|
|
481
|
+
* @param obj - obj whose type needs to be identified.
|
|
482
|
+
*/
|
|
483
|
+
export function isInstanceOfISnapshot(
|
|
484
|
+
obj: ISnapshotContents | ISnapshot | undefined,
|
|
485
|
+
): obj is ISnapshot {
|
|
486
|
+
return obj !== undefined && "snapshotFormatV" in obj && obj.snapshotFormatV === 1;
|
|
487
|
+
}
|
package/src/packageVersion.ts
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { LoggingError, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { LoggingError, ITelemetryLoggerExt, UsageError } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import {
|
|
8
8
|
FetchSource,
|
|
9
9
|
IDocumentStorageService,
|
|
10
10
|
IDocumentStorageServicePolicies,
|
|
11
|
+
ISnapshot,
|
|
12
|
+
ISnapshotFetchOptions,
|
|
11
13
|
ISummaryContext,
|
|
12
14
|
} from "@fluidframework/driver-definitions";
|
|
13
15
|
import {
|
|
@@ -49,6 +51,15 @@ export class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisp
|
|
|
49
51
|
);
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
public async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {
|
|
55
|
+
return this.runWithRetry(async () => {
|
|
56
|
+
if (this.internalStorageService.getSnapshot !== undefined) {
|
|
57
|
+
return this.internalStorageService.getSnapshot(snapshotFetchOptions);
|
|
58
|
+
}
|
|
59
|
+
throw new UsageError("getSnapshot should exist in storage adapter in ODSP driver");
|
|
60
|
+
}, "storage_getSnapshot");
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
public async readBlob(id: string): Promise<ArrayBufferLike> {
|
|
53
64
|
return this.runWithRetry(
|
|
54
65
|
async () => this.internalStorageService.readBlob(id),
|
package/src/retryUtils.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
|
7
7
|
import { performance } from "@fluid-internal/client-utils";
|
|
8
8
|
import { delay } from "@fluidframework/core-utils";
|
|
9
9
|
import { canRetryOnError, getRetryDelayFromError } from "@fluidframework/driver-utils";
|
|
10
|
-
import {
|
|
10
|
+
import { OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
|
|
11
11
|
import { Odsp409Error } from "./epochTracker";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -44,7 +44,7 @@ export async function runWithRetry<T>(
|
|
|
44
44
|
const canRetry = canRetryOnError(error);
|
|
45
45
|
|
|
46
46
|
const coherencyError = error?.[Odsp409Error] === true;
|
|
47
|
-
const serviceReadonlyError = error?.errorType ===
|
|
47
|
+
const serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;
|
|
48
48
|
|
|
49
49
|
// logging the first failed retry instead of every attempt. We want to avoid filling telemetry
|
|
50
50
|
// when we have tight loop of retrying in offline mode, but we also want to know what caused
|
|
@@ -12,7 +12,7 @@ import { Uint8ArrayToArrayBuffer, Uint8ArrayToString } from "@fluid-internal/cli
|
|
|
12
12
|
import { assert } from "@fluidframework/core-utils";
|
|
13
13
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
14
14
|
import { NonRetryableError } from "@fluidframework/driver-utils";
|
|
15
|
-
import {
|
|
15
|
+
import { OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
|
|
16
16
|
import { ReadBuffer } from "./ReadBufferUtils";
|
|
17
17
|
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
18
18
|
import { measure } from "./odspUtils";
|
|
@@ -620,7 +620,7 @@ function throwBufferParseException(
|
|
|
620
620
|
): never {
|
|
621
621
|
throw new NonRetryableError(
|
|
622
622
|
`Buffer parsing exception: ${message}`,
|
|
623
|
-
|
|
623
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
624
624
|
{
|
|
625
625
|
nodeType: getNodeType(node),
|
|
626
626
|
expectedNodeType,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReadBufferUtils.cjs","sourceRoot":"","sources":["../src/ReadBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD;;;GAGG;AACH,MAAa,UAAU;IAGtB,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED,YAA+B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QANrC,UAAK,GAAG,CAAC,CAAC;QAOnB,4DAA4D;QAC5D,+DAA+D;QAC/D,8DAA8D;QAC9D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,IAAW,GAAG;QACb,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IACxC,CAAC;IACD,IAAW,GAAG;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IACD,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,KAAa,EAAE,GAAW;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IAChB,CAAC;IAEM,IAAI,CAAC,SAAS,GAAG,CAAC;QACxB,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,MAAM,GAAG,SAAS,CAAC;QACvB,OAAO,MAAM,GAAG,CAAC,EAAE;YAClB,IAAA,mBAAM,EAAC,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAC1D,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;YAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,UAAU,IAAI,GAAG,CAAC;YAClB,MAAM,EAAE,CAAC;SACT;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAEM,IAAI,CAAC,MAAc;QACzB,IAAA,mBAAM,EAAC,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC;QACrB,IAAA,mBAAM,EAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAClF,CAAC;CACD;AAnDD,gCAmDC","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\";\n\n/**\n * Buffer class, used to sequentially read data.\n * Used by tree code to reconstruct a tree from binary representation.\n */\nexport class ReadBuffer {\n\tprotected index = 0;\n\n\tpublic get buffer() {\n\t\treturn this.data;\n\t}\n\n\tconstructor(protected readonly data: Uint8Array) {\n\t\t// BlobShallowCopy will return to users parts of this array.\n\t\t// We need to ensure that nobody can change it, as it will have\n\t\t// catastrophic result and will be really hard to investigate.\n\t\tObject.freeze(data.buffer);\n\t}\n\n\tpublic get eof() {\n\t\treturn this.index === this.data.length;\n\t}\n\tpublic get pos() {\n\t\treturn this.index;\n\t}\n\tpublic get length() {\n\t\treturn this.data.length;\n\t}\n\n\tpublic slice(start: number, end: number) {\n\t\treturn this.data.slice(start, end);\n\t}\n\n\tpublic reset() {\n\t\tthis.index = 0;\n\t}\n\n\tpublic read(lengthArg = 1): number {\n\t\tlet res = 0;\n\t\tlet multiplier = 1;\n\t\tlet length = lengthArg;\n\t\twhile (length > 0) {\n\t\t\tassert(!this.eof, 0x223 /* \"unexpected end of buffer\" */);\n\t\t\tres += this.data[this.index] * multiplier;\n\t\t\tthis.index++;\n\t\t\tmultiplier *= 256;\n\t\t\tlength--;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic skip(length: number) {\n\t\tassert(length >= 0, 0x224 /* \"Skip length should be positive\" */);\n\t\tthis.index += length;\n\t\tassert(this.index <= this.data.length, 0x3dc /* skipping past size of buffer */);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WriteBufferUtils.cjs","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,2DAAoD;AACpD,qFAQwC;AAExC;;;GAGG;AACH,MAAa,WAAW;IAAxB;QACW,SAAI,GAAgB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,UAAK,GAAG,CAAC,CAAC;IAsCrB,CAAC;IApCU,IA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2B,CAAC,CAAC;YAChE,IAAI,KAAK,CAAC,UAAU,EAAE;gBACrB,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;aAC7D;iBAAM;gBACN,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACvC;SACD;KACD;AACF,CAAC;AAED,MAAM,kBAAmB,SAAQ,uCAAQ;IACxC;QACC,KAAK,EAAE,CAAC;IACT,CAAC;IAEM,SAAS,CAAC,MAAmB;QACnC,iBAAiB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC5D,CAAC;CACD;AAED,MAAa,qBAAsB,SAAQ,kBAAkB;IAC5D;QACC,KAAK,EAAE,CAAC;IACT,CAAC;IAEM,SAAS;QACf,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;CACD;AAVD,sDAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tBlobCore,\n\tcodeToBytesMap,\n\tgetValueSafely,\n\tMarkerCodes,\n\tMarkerCodesEnd,\n\tMarkerCodesStart,\n\tNodeCore,\n} from \"./zipItDataRepresentationUtils\";\n\n/**\n * Buffer class, used to sequentially writ data.\n * Used by tree code to serialize tree into binary representation.\n */\nexport class WriteBuffer {\n\tprotected data?: Uint8Array = new Uint8Array(4096);\n\tprotected index = 0;\n\n\tprotected push(code: number) {\n\t\tassert(this.data !== undefined, 0x225 /* \"Data should be there\" */);\n\t\tconst length = this.data.length;\n\t\tif (this.index === length) {\n\t\t\tconst newData = new Uint8Array(length * 1.2 + 4096);\n\t\t\tlet index = 0;\n\t\t\tconst oldData = this.data;\n\t\t\twhile (index < length) {\n\t\t\t\tnewData[index] = oldData[index];\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tthis.data = newData;\n\t\t}\n\t\tthis.data[this.index] = code % 256;\n\t\tthis.index++;\n\t}\n\n\tpublic write(codeArg: number, lengthArg = 1) {\n\t\tlet code = codeArg;\n\t\tlet length = lengthArg;\n\t\twhile (length > 0) {\n\t\t\tthis.push(code % 256);\n\t\t\tcode = Math.floor(code / 256);\n\t\t\tlength--;\n\t\t}\n\t\tassert(code === 0, 0x226 /* Should write complete data */);\n\t}\n\n\tpublic done(): Uint8Array {\n\t\tassert(this.data !== undefined, 0x227 /* \"Data should be there\" */);\n\t\t// We can slice it to have smaller memory representation.\n\t\t// But it will be way more expensive in terms of CPU cycles!\n\t\tconst buffer = this.data.subarray(0, this.index);\n\t\tthis.data = undefined;\n\t\treturn buffer;\n\t}\n}\n\n// This list of maps below is reverse mapping of Marker Codes specified in zipItDataRepresentationUtils.ts file.\n// We can also found them on server filestore code.\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n\n/**\n * This contains mapping of number of bytes representing the corresponding string length to Marker Codes.\n */\nconst utf8StringBytesToCodeMap = {\n\t0: 13,\n\t1: 14,\n\t2: 15,\n\t4: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding length in which actual data(base64 string)\n * will be stored to Marker Codes.\n */\nconst binaryBytesToCodeMap = {\n\t0: 32,\n\t1: 33,\n\t2: 34,\n\t4: 35,\n\t8: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding const string id to Marker Codes.\n */\nconst constStringBytesToCodeMap = {\n\t1: 17,\n\t2: 18,\n\t4: 19,\n};\n\n/**\n * This contains mapping of number of bytes to Marker Codes representing the corresponding Integer.\n */\nconst integerBytesToCodeMap = {\n\t0: 1,\n\t1: 3,\n\t2: 5,\n\t4: 7,\n\t8: 9,\n};\n\n/**\n * This contains mapping of boolean to Marker Codes representing the corresponding bool value.\n */\nconst boolToCodeMap = [\n\t12, // false\n\t11, // true\n];\n\n/**\n * Calculate how many bytes are required to encode an integer. This is always power of 2.\n * So if 6 bytes are required to store an integer than it will return 8. 0 is a special case for which we\n * return 0 as it is usually just represented by marker code and we don't store the actual data.\n * @param num - number to encode.\n */\nexport function calcLength(numArg: number) {\n\tif (numArg === 0) {\n\t\treturn 0;\n\t}\n\tlet num = numArg;\n\tlet lengthLen = 0;\n\twhile (num > 0) {\n\t\tnum = Math.floor(num / 256);\n\t\tlengthLen++;\n\t}\n\tlet res = 1;\n\twhile (res < lengthLen) {\n\t\tres *= 2;\n\t}\n\treturn res;\n}\n\n/**\n * Implementation of serialization of blobs in buffer with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param content - string to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeDictionaryString(\n\tbuffer: WriteBuffer,\n\tcontent: string,\n\tdictionary: Map<string, number>,\n) {\n\tlet id = dictionary.get(content);\n\tlet idLength: number;\n\tif (id === undefined) {\n\t\tconst data = IsoBuffer.from(content, \"utf8\");\n\t\tconst lengthOfDataLen = calcLength(data.length);\n\n\t\tid = dictionary.size + 1;\n\t\tidLength = calcLength(id);\n\t\tdictionary.set(content, id);\n\t\tconst code =\n\t\t\tlengthOfDataLen > 1 || idLength > 1\n\t\t\t\t? MarkerCodes.ConstStringDeclareBig\n\t\t\t\t: MarkerCodes.ConstStringDeclare;\n\t\t// Write marker code for const string.\n\t\tbuffer.write(code);\n\t\tconst bytes = getValueSafely(codeToBytesMap, code);\n\t\tassert(\n\t\t\tbytes >= lengthOfDataLen,\n\t\t\t0x283 /* \"Length of data len should fit in the bytes from the map\" */,\n\t\t);\n\t\tassert(bytes >= idLength, 0x284 /* \"Length of id should fit in the bytes from the map\" */);\n\t\t// Assign and write id for const string.\n\t\tbuffer.write(id, bytes);\n\t\t// Write length of const string.\n\t\tbuffer.write(data.length, bytes);\n\t\t// Write const string data.\n\t\tfor (const element of data) {\n\t\t\tbuffer.write(element);\n\t\t}\n\t} else {\n\t\tidLength = calcLength(id);\n\t}\n\t// Write Marker Code\n\tbuffer.write(getValueSafely(constStringBytesToCodeMap, idLength));\n\t// Write id of const string\n\tbuffer.write(id, idLength);\n}\n\nfunction serializeString(buffer: WriteBuffer, content: string, codeMap = binaryBytesToCodeMap) {\n\tserializeBlob(buffer, IsoBuffer.from(content, \"utf8\"), utf8StringBytesToCodeMap);\n}\n\n/**\n * Implementation of serialization of blobs in buffer with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param blob - blob to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeBlob(\n\tbuffer: WriteBuffer,\n\tdata: Uint8Array,\n\tcodeMap: Record<number, number> = binaryBytesToCodeMap,\n) {\n\tconst lengthOfDataLen = calcLength(data.length);\n\t// Write Marker code.\n\tbuffer.write(getValueSafely(codeMap, lengthOfDataLen));\n\t// Write actual data if length greater than 0, otherwise Marker Code is enough.\n\tif (lengthOfDataLen > 0) {\n\t\tbuffer.write(data.length, lengthOfDataLen);\n\t\tfor (const element of data) {\n\t\t\tbuffer.write(element);\n\t\t}\n\t}\n}\n\n/**\n * Implementation of serialization of nodes with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param nodeCore - Node to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeNodeCore(\n\tbuffer: WriteBuffer,\n\tnodeCore: NodeCore,\n\tdictionary: Map<string, number>,\n) {\n\tfor (const child of nodeCore.nodes) {\n\t\tif (child instanceof NodeCore) {\n\t\t\t// For a tree node start and end with set/list start and end marker codes.\n\t\t\tconst startCode = MarkerCodesStart[child.type];\n\t\t\tconst endCode = MarkerCodesEnd[child.type];\n\t\t\tassert(startCode !== undefined, 0x285 /* \"Start code should not undefined\" */);\n\t\t\tassert(endCode !== undefined, 0x286 /* \"End code should not undefined\" */);\n\t\t\tbuffer.write(startCode);\n\t\t\tserializeNodeCore(buffer, child, dictionary);\n\t\t\tbuffer.write(endCode);\n\t\t} else if (child instanceof BlobCore) {\n\t\t\tserializeBlob(buffer, child.buffer);\n\t\t} else if (typeof child === \"number\") {\n\t\t\t// Calculate length in which integer will be stored\n\t\t\tconst len = calcLength(child);\n\t\t\t// Write corresponding Marker code for length of integer.\n\t\t\tbuffer.write(getValueSafely(integerBytesToCodeMap, len));\n\t\t\t// Write actual number if greater than 0, otherwise Marker Code is enough.\n\t\t\tif (len > 0) {\n\t\t\t\tbuffer.write(child, len);\n\t\t\t}\n\t\t} else if (typeof child === \"boolean\") {\n\t\t\tbuffer.write(boolToCodeMap[child ? 1 : 0]);\n\t\t} else {\n\t\t\tassert(child._stringElement, 0x3dd /* Unsupported node type */);\n\t\t\tif (child.dictionary) {\n\t\t\t\tserializeDictionaryString(buffer, child.content, dictionary);\n\t\t\t} else {\n\t\t\t\tserializeString(buffer, child.content);\n\t\t\t}\n\t\t}\n\t}\n}\n\nclass NodeCoreSerializer extends NodeCore {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tpublic serialize(buffer: WriteBuffer) {\n\t\tserializeNodeCore(buffer, this, new Map<string, number>());\n\t}\n}\n\nexport class TreeBuilderSerializer extends NodeCoreSerializer {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tpublic serialize(): Uint8Array {\n\t\tconst buffer = new WriteBuffer();\n\t\tsuper.serialize(buffer);\n\t\treturn buffer.done();\n\t}\n}\n"]}
|
package/dist/checkUrl.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkUrl.cjs","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA4D;AAE5D;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACxC,MAAM,OAAO,GAAG,IAAA,yCAAqB,EAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE;QACb,OAAO,SAAS,CAAC;KACjB;IAED,IAAI,UAA8B,CAAC;IACnC,IAAI;QACH,IAAI,OAAO,EAAE,OAAO,EAAE;YACrB,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;SAC9C;KACD;IAAC,MAAM,GAAE;IAEV,OAAO;QACN,eAAe,EAAE,OAAO,EAAE,oBAAoB;QAC9C,uEAAuE;QACvE,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAC;AACH,CAAC;AAnBD,4BAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DriverPreCheckInfo } from \"@fluidframework/driver-definitions\";\nimport { getLocatorFromOdspUrl } from \"./odspFluidFileLink\";\n\n/**\n * A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.\n * Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.\n * Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs\n * before the entire Fluid loading process needs to be kicked off.\n * @alpha\n */\nexport function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined {\n\tconst locator = getLocatorFromOdspUrl(documentUrl);\n\n\tif (!locator) {\n\t\treturn undefined;\n\t}\n\n\tlet siteOrigin: string | undefined;\n\ttry {\n\t\tif (locator?.siteUrl) {\n\t\t\tsiteOrigin = new URL(locator?.siteUrl).origin;\n\t\t}\n\t} catch {}\n\n\treturn {\n\t\tcodeDetailsHint: locator?.containerPackageName,\n\t\t// Add the snapshot endpoint, which has the same domain as the site URL\n\t\tcriticalBootDomains: siteOrigin ? [siteOrigin] : undefined,\n\t};\n}\n"]}
|