@fluidframework/odsp-driver 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277
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/.eslintrc.js +12 -12
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +162 -0
- package/README.md +56 -0
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/odsp-driver.api.md +309 -0
- package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +16 -9
- package/dist/ReadBufferUtils.cjs.map +1 -0
- package/dist/ReadBufferUtils.d.ts.map +1 -1
- package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +73 -69
- package/dist/WriteBufferUtils.cjs.map +1 -0
- package/dist/WriteBufferUtils.d.ts +3 -5
- package/dist/WriteBufferUtils.d.ts.map +1 -1
- package/dist/{checkUrl.js → checkUrl.cjs} +7 -6
- package/dist/checkUrl.cjs.map +1 -0
- package/dist/checkUrl.d.ts +1 -0
- package/dist/checkUrl.d.ts.map +1 -1
- package/dist/compactSnapshotParser.cjs +207 -0
- package/dist/compactSnapshotParser.cjs.map +1 -0
- package/dist/compactSnapshotParser.d.ts +12 -3
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +43 -33
- package/dist/compactSnapshotWriter.cjs.map +1 -0
- package/dist/compactSnapshotWriter.d.ts +2 -3
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/{constants.js → constants.cjs} +7 -1
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/{contracts.js → contracts.cjs} +1 -1
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.d.ts +16 -53
- package/dist/contracts.d.ts.map +1 -1
- package/dist/{contractsPublic.js → contractsPublic.cjs} +9 -3
- package/dist/contractsPublic.cjs.map +1 -0
- package/dist/contractsPublic.d.ts +15 -0
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/createFile.cjs +177 -0
- package/dist/createFile.cjs.map +1 -0
- package/dist/createFile.d.ts +6 -10
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createNewContainerOnExistingFile.cjs +60 -0
- package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
- package/dist/createNewContainerOnExistingFile.d.ts +22 -0
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -0
- package/dist/createNewModule.cjs +12 -0
- package/dist/createNewModule.cjs.map +1 -0
- package/dist/createNewModule.d.ts +7 -0
- package/dist/createNewModule.d.ts.map +1 -0
- package/dist/createNewUtils.cjs +203 -0
- package/dist/createNewUtils.cjs.map +1 -0
- package/dist/createNewUtils.d.ts +16 -0
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +8 -4
- package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
- package/dist/createOdspCreateContainerRequest.d.ts +5 -3
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/{createOdspUrl.js → createOdspUrl.cjs} +2 -1
- package/dist/createOdspUrl.cjs.map +1 -0
- package/dist/createOdspUrl.d.ts +1 -0
- package/dist/createOdspUrl.d.ts.map +1 -1
- package/dist/{epochTracker.js → epochTracker.cjs} +102 -48
- package/dist/epochTracker.cjs.map +1 -0
- package/dist/epochTracker.d.ts +32 -8
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/{fetch.js → fetch.cjs} +1 -1
- package/dist/fetch.cjs.map +1 -0
- package/dist/fetch.d.ts +1 -1
- package/dist/fetch.d.ts.map +1 -1
- package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +192 -176
- package/dist/fetchSnapshot.cjs.map +1 -0
- package/dist/fetchSnapshot.d.ts +10 -5
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/{getFileLink.js → getFileLink.cjs} +52 -41
- package/dist/getFileLink.cjs.map +1 -0
- package/dist/getFileLink.d.ts +4 -7
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
- package/dist/getQueryString.cjs.map +1 -0
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +4 -2
- package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
- package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.cjs +35 -0
- package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +17 -0
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
- package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +7 -5
- package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +9 -10
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +2 -3
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +13 -11
- package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -2
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odsp-driver-alpha.d.ts +496 -0
- package/dist/odsp-driver-beta.d.ts +160 -0
- package/dist/odsp-driver-public.d.ts +160 -0
- package/dist/odsp-driver-untrimmed.d.ts +565 -0
- package/dist/{odspCache.js → odspCache.cjs} +9 -10
- package/dist/odspCache.cjs.map +1 -0
- package/dist/odspCache.d.ts +19 -4
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.cjs +291 -0
- package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
- package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +70 -71
- package/dist/odspDeltaStorageService.cjs.map +1 -0
- package/dist/odspDeltaStorageService.d.ts +8 -6
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +224 -113
- package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
- package/dist/odspDocumentDeltaConnection.d.ts +32 -12
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentService.cjs +225 -0
- package/dist/odspDocumentService.cjs.map +1 -0
- package/dist/odspDocumentService.d.ts +11 -25
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +8 -5
- package/dist/odspDocumentServiceFactory.cjs.map +1 -0
- package/dist/odspDocumentServiceFactory.d.ts +4 -0
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.cjs +196 -0
- package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
- package/dist/odspDocumentServiceFactoryCore.d.ts +18 -11
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs +20 -0
- package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +5 -0
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.cjs +490 -0
- package/dist/odspDocumentStorageManager.cjs.map +1 -0
- package/dist/odspDocumentStorageManager.d.ts +11 -5
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +32 -34
- package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
- package/dist/odspDocumentStorageServiceBase.d.ts +7 -9
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +50 -36
- package/dist/odspDriverUrlResolver.cjs.map +1 -0
- package/dist/odspDriverUrlResolver.d.ts +12 -0
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +37 -26
- package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
- package/dist/odspDriverUrlResolverForShareLink.d.ts +5 -3
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/{odspError.js → odspError.cjs} +7 -3
- package/dist/odspError.cjs.map +1 -0
- package/dist/odspError.d.ts.map +1 -1
- package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +25 -18
- package/dist/odspFluidFileLink.cjs.map +1 -0
- package/dist/odspFluidFileLink.d.ts +10 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspLocationRedirection.cjs +24 -0
- package/dist/odspLocationRedirection.cjs.map +1 -0
- package/dist/odspLocationRedirection.d.ts +14 -0
- package/dist/odspLocationRedirection.d.ts.map +1 -0
- package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +7 -4
- package/dist/odspPublicUtils.cjs.map +1 -0
- package/dist/odspPublicUtils.d.ts +6 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +11 -12
- package/dist/odspSnapshotParser.cjs.map +1 -0
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +47 -34
- package/dist/odspSummaryUploadManager.cjs.map +1 -0
- package/dist/odspSummaryUploadManager.d.ts +7 -4
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +9 -3
- package/dist/odspUrlHelper.cjs.map +1 -0
- package/dist/odspUrlHelper.d.ts +5 -0
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/{odspUtils.js → odspUtils.cjs} +118 -30
- package/dist/odspUtils.cjs.map +1 -0
- package/dist/odspUtils.d.ts +35 -6
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/{opsCaching.js → opsCaching.cjs} +25 -9
- package/dist/opsCaching.cjs.map +1 -0
- package/dist/opsCaching.d.ts +3 -3
- package/dist/opsCaching.d.ts.map +1 -1
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.cjs +100 -0
- package/dist/prefetchLatestSnapshot.cjs.map +1 -0
- package/dist/prefetchLatestSnapshot.d.ts +12 -7
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +13 -6
- package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
- package/dist/retryErrorsStorageAdapter.d.ts +5 -4
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/{retryUtils.js → retryUtils.cjs} +30 -14
- package/dist/retryUtils.cjs.map +1 -0
- package/dist/retryUtils.d.ts +2 -2
- package/dist/retryUtils.d.ts.map +1 -1
- package/dist/socketModule.cjs +10 -0
- package/dist/socketModule.cjs.map +1 -0
- package/dist/socketModule.d.ts +7 -0
- package/dist/socketModule.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/{vroom.js → vroom.cjs} +24 -9
- package/dist/vroom.cjs.map +1 -0
- package/dist/vroom.d.ts +4 -4
- package/dist/vroom.d.ts.map +1 -1
- package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +227 -118
- package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
- package/dist/zipItDataRepresentationUtils.d.ts +47 -20
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +1 -1
- package/lib/ReadBufferUtils.d.mts.map +1 -0
- package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +14 -7
- package/lib/ReadBufferUtils.mjs.map +1 -0
- package/lib/{WriteBufferUtils.d.ts → WriteBufferUtils.d.mts} +4 -6
- package/lib/WriteBufferUtils.d.mts.map +1 -0
- package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +68 -64
- package/lib/WriteBufferUtils.mjs.map +1 -0
- package/lib/{checkUrl.d.ts → checkUrl.d.mts} +2 -1
- package/lib/checkUrl.d.mts.map +1 -0
- package/lib/{checkUrl.js → checkUrl.mjs} +7 -6
- package/lib/checkUrl.mjs.map +1 -0
- package/lib/compactSnapshotParser.d.mts +24 -0
- package/lib/compactSnapshotParser.d.mts.map +1 -0
- package/lib/compactSnapshotParser.mjs +203 -0
- package/lib/compactSnapshotParser.mjs.map +1 -0
- package/lib/{compactSnapshotWriter.d.ts → compactSnapshotWriter.d.mts} +4 -5
- package/lib/compactSnapshotWriter.d.mts.map +1 -0
- package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +41 -31
- package/lib/compactSnapshotWriter.mjs.map +1 -0
- package/lib/{constants.d.ts → constants.d.mts} +7 -1
- package/lib/constants.d.mts.map +1 -0
- package/lib/{constants.js → constants.mjs} +7 -1
- package/lib/constants.mjs.map +1 -0
- package/lib/{contracts.d.ts → contracts.d.mts} +18 -55
- package/lib/contracts.d.mts.map +1 -0
- package/lib/{contracts.js → contracts.mjs} +1 -1
- package/lib/contracts.mjs.map +1 -0
- package/lib/{contractsPublic.d.ts → contractsPublic.d.mts} +16 -1
- package/lib/contractsPublic.d.mts.map +1 -0
- package/lib/{contractsPublic.js → contractsPublic.mjs} +7 -1
- package/lib/contractsPublic.mjs.map +1 -0
- package/lib/createFile.d.mts +18 -0
- package/lib/createFile.d.mts.map +1 -0
- package/lib/createFile.mjs +171 -0
- package/lib/createFile.mjs.map +1 -0
- package/lib/createNewContainerOnExistingFile.d.mts +22 -0
- package/lib/createNewContainerOnExistingFile.d.mts.map +1 -0
- package/lib/createNewContainerOnExistingFile.mjs +56 -0
- package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
- package/lib/createNewModule.d.mts +7 -0
- package/lib/createNewModule.d.mts.map +1 -0
- package/lib/createNewModule.mjs +7 -0
- package/lib/createNewModule.mjs.map +1 -0
- package/lib/createNewUtils.d.mts +27 -0
- package/lib/createNewUtils.d.mts.map +1 -0
- package/lib/createNewUtils.mjs +197 -0
- package/lib/createNewUtils.mjs.map +1 -0
- package/lib/{createOdspCreateContainerRequest.d.ts → createOdspCreateContainerRequest.d.mts} +6 -8
- package/lib/createOdspCreateContainerRequest.d.mts.map +1 -0
- package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +8 -4
- package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
- package/lib/{createOdspUrl.d.ts → createOdspUrl.d.mts} +3 -2
- package/lib/createOdspUrl.d.mts.map +1 -0
- package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
- package/lib/createOdspUrl.mjs.map +1 -0
- package/lib/{epochTracker.d.ts → epochTracker.d.mts} +35 -11
- package/lib/epochTracker.d.mts.map +1 -0
- package/lib/{epochTracker.js → epochTracker.mjs} +97 -43
- package/lib/epochTracker.mjs.map +1 -0
- package/lib/{fetch.d.ts → fetch.d.mts} +2 -2
- package/lib/fetch.d.mts.map +1 -0
- package/lib/{fetch.js → fetch.mjs} +1 -1
- package/lib/fetch.mjs.map +1 -0
- package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +15 -10
- package/lib/fetchSnapshot.d.mts.map +1 -0
- package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +185 -167
- package/lib/fetchSnapshot.mjs.map +1 -0
- package/lib/{getFileLink.d.ts → getFileLink.d.mts} +5 -8
- package/lib/getFileLink.d.mts.map +1 -0
- package/lib/{getFileLink.js → getFileLink.mjs} +49 -38
- package/lib/getFileLink.mjs.map +1 -0
- package/lib/{getQueryString.d.ts → getQueryString.d.mts} +1 -5
- package/lib/getQueryString.d.mts.map +1 -0
- package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
- package/lib/getQueryString.mjs.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +1 -1
- package/lib/getUrlAndHeadersWithAuth.d.mts.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +4 -2
- package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
- package/lib/index.d.mts +24 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +22 -0
- package/lib/index.mjs.map +1 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts +17 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +1 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.mjs +31 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.d.ts → localOdspDocumentService.d.mts} +4 -3
- package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +8 -6
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.ts → localOdspDocumentServiceFactory.d.mts} +5 -6
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +9 -10
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.ts → localOdspDocumentStorageManager.d.mts} +4 -4
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +11 -9
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
- package/lib/odsp-driver-alpha.d.mts +496 -0
- package/lib/odsp-driver-beta.d.mts +160 -0
- package/lib/odsp-driver-public.d.mts +160 -0
- package/lib/odsp-driver-untrimmed.d.mts +565 -0
- package/lib/{odspCache.d.ts → odspCache.d.mts} +20 -9
- package/lib/odspCache.d.mts.map +1 -0
- package/lib/{odspCache.js → odspCache.mjs} +6 -11
- package/lib/odspCache.mjs.map +1 -0
- package/lib/odspDelayLoadedDeltaStream.d.mts +75 -0
- package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -0
- package/lib/odspDelayLoadedDeltaStream.mjs +287 -0
- package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
- package/lib/{odspDeltaStorageService.d.ts → odspDeltaStorageService.d.mts} +10 -8
- package/lib/odspDeltaStorageService.d.mts.map +1 -0
- package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +70 -68
- package/lib/odspDeltaStorageService.mjs.map +1 -0
- package/lib/{odspDocumentDeltaConnection.d.ts → odspDocumentDeltaConnection.d.mts} +34 -14
- package/lib/odspDocumentDeltaConnection.d.mts.map +1 -0
- package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +214 -103
- package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
- package/lib/{odspDocumentService.d.ts → odspDocumentService.d.mts} +15 -29
- package/lib/odspDocumentService.d.mts.map +1 -0
- package/lib/odspDocumentService.mjs +221 -0
- package/lib/odspDocumentService.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactory.d.ts → odspDocumentServiceFactory.d.mts} +6 -2
- package/lib/odspDocumentServiceFactory.d.mts.map +1 -0
- package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +8 -6
- package/lib/odspDocumentServiceFactory.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactoryCore.d.ts → odspDocumentServiceFactoryCore.d.mts} +20 -13
- package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -0
- package/lib/odspDocumentServiceFactoryCore.mjs +192 -0
- package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.ts → odspDocumentServiceFactoryWithCodeSplit.d.mts} +7 -2
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +8 -3
- package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
- package/lib/{odspDocumentStorageManager.d.ts → odspDocumentStorageManager.d.mts} +18 -12
- package/lib/odspDocumentStorageManager.d.mts.map +1 -0
- package/lib/odspDocumentStorageManager.mjs +486 -0
- package/lib/odspDocumentStorageManager.mjs.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.d.ts → odspDocumentStorageServiceBase.d.mts} +9 -11
- package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +31 -33
- package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
- package/lib/{odspDriverUrlResolver.d.ts → odspDriverUrlResolver.d.mts} +13 -1
- package/lib/odspDriverUrlResolver.d.mts.map +1 -0
- package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +50 -40
- package/lib/odspDriverUrlResolver.mjs.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.d.ts → odspDriverUrlResolverForShareLink.d.mts} +7 -5
- package/lib/odspDriverUrlResolverForShareLink.d.mts.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +36 -29
- package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
- package/lib/{odspError.d.ts → odspError.d.mts} +2 -2
- package/lib/odspError.d.mts.map +1 -0
- package/lib/{odspError.js → odspError.mjs} +7 -3
- package/lib/odspError.mjs.map +1 -0
- package/lib/{odspFluidFileLink.d.ts → odspFluidFileLink.d.mts} +12 -3
- package/lib/odspFluidFileLink.d.mts.map +1 -0
- package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +23 -16
- package/lib/odspFluidFileLink.mjs.map +1 -0
- package/lib/odspLocationRedirection.d.mts +14 -0
- package/lib/odspLocationRedirection.d.mts.map +1 -0
- package/lib/odspLocationRedirection.mjs +20 -0
- package/lib/odspLocationRedirection.mjs.map +1 -0
- package/lib/{odspPublicUtils.d.ts → odspPublicUtils.d.mts} +7 -1
- package/lib/odspPublicUtils.d.mts.map +1 -0
- package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +5 -2
- package/lib/odspPublicUtils.mjs.map +1 -0
- package/lib/{odspSnapshotParser.d.ts → odspSnapshotParser.d.mts} +3 -3
- package/lib/odspSnapshotParser.d.mts.map +1 -0
- package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +10 -11
- package/lib/odspSnapshotParser.mjs.map +1 -0
- package/lib/{odspSummaryUploadManager.d.ts → odspSummaryUploadManager.d.mts} +9 -6
- package/lib/odspSummaryUploadManager.d.mts.map +1 -0
- package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +41 -32
- package/lib/odspSummaryUploadManager.mjs.map +1 -0
- package/lib/{odspUrlHelper.d.ts → odspUrlHelper.d.mts} +6 -1
- package/lib/odspUrlHelper.d.mts.map +1 -0
- package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +9 -3
- package/lib/odspUrlHelper.mjs.map +1 -0
- package/lib/{odspUtils.d.ts → odspUtils.d.mts} +37 -8
- package/lib/odspUtils.d.mts.map +1 -0
- package/lib/{odspUtils.js → odspUtils.mjs} +109 -27
- package/lib/odspUtils.mjs.map +1 -0
- package/lib/{opsCaching.d.ts → opsCaching.d.mts} +4 -4
- package/lib/opsCaching.d.mts.map +1 -0
- package/lib/{opsCaching.js → opsCaching.mjs} +23 -7
- package/lib/opsCaching.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +14 -9
- package/lib/prefetchLatestSnapshot.d.mts.map +1 -0
- package/lib/prefetchLatestSnapshot.mjs +96 -0
- package/lib/prefetchLatestSnapshot.mjs.map +1 -0
- package/lib/{retryErrorsStorageAdapter.d.ts → retryErrorsStorageAdapter.d.mts} +6 -5
- package/lib/retryErrorsStorageAdapter.d.mts.map +1 -0
- package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +13 -6
- package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
- package/lib/{retryUtils.d.ts → retryUtils.d.mts} +3 -3
- package/lib/retryUtils.d.mts.map +1 -0
- package/lib/{retryUtils.js → retryUtils.mjs} +27 -11
- package/lib/retryUtils.mjs.map +1 -0
- package/lib/socketModule.d.mts +7 -0
- package/lib/socketModule.d.mts.map +1 -0
- package/lib/socketModule.mjs +7 -0
- package/lib/socketModule.mjs.map +1 -0
- package/lib/{vroom.d.ts → vroom.d.mts} +7 -7
- package/lib/vroom.d.mts.map +1 -0
- package/lib/{vroom.js → vroom.mjs} +24 -9
- package/lib/vroom.mjs.map +1 -0
- package/lib/{zipItDataRepresentationUtils.d.ts → zipItDataRepresentationUtils.d.mts} +49 -22
- package/lib/zipItDataRepresentationUtils.d.mts.map +1 -0
- package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +213 -111
- package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
- package/package.json +87 -69
- package/prettier.config.cjs +8 -0
- package/src/ReadBufferUtils.ts +51 -44
- package/src/WriteBufferUtils.ts +203 -181
- package/src/checkUrl.ts +16 -15
- package/src/compactSnapshotParser.ts +219 -103
- package/src/compactSnapshotWriter.ts +118 -97
- package/src/constants.ts +7 -0
- package/src/contracts.ts +96 -136
- package/src/contractsPublic.ts +31 -16
- package/src/createFile.ts +243 -305
- package/src/createNewContainerOnExistingFile.ts +93 -0
- package/src/createNewModule.ts +7 -0
- package/src/createNewUtils.ts +266 -56
- package/src/createOdspCreateContainerRequest.ts +22 -18
- package/src/createOdspUrl.ts +12 -13
- package/src/epochTracker.ts +596 -457
- package/src/fetch.ts +4 -4
- package/src/fetchSnapshot.ts +583 -508
- package/src/getFileLink.ts +194 -155
- package/src/getQueryString.ts +11 -9
- package/src/getUrlAndHeadersWithAuth.ts +34 -33
- package/src/index.ts +42 -18
- package/src/localOdspDriver/localOdspDeltaStorageService.ts +49 -0
- package/src/localOdspDriver/localOdspDocumentService.ts +40 -38
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +46 -43
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +55 -50
- package/src/odspCache.ts +112 -90
- package/src/odspDelayLoadedDeltaStream.ts +459 -0
- package/src/odspDeltaStorageService.ts +232 -221
- package/src/odspDocumentDeltaConnection.ts +751 -563
- package/src/odspDocumentService.ts +324 -523
- package/src/odspDocumentServiceFactory.ts +20 -21
- package/src/odspDocumentServiceFactoryCore.ts +329 -200
- package/src/odspDocumentServiceFactoryWithCodeSplit.ts +20 -20
- package/src/odspDocumentStorageManager.ts +730 -534
- package/src/odspDocumentStorageServiceBase.ts +279 -254
- package/src/odspDriverUrlResolver.ts +230 -188
- package/src/odspDriverUrlResolverForShareLink.ts +223 -203
- package/src/odspError.ts +27 -19
- package/src/odspFluidFileLink.ts +106 -87
- package/src/odspLocationRedirection.ts +26 -0
- package/src/odspPublicUtils.ts +20 -14
- package/src/odspSnapshotParser.ts +53 -46
- package/src/odspSummaryUploadManager.ts +243 -218
- package/src/odspUrlHelper.ts +81 -71
- package/src/odspUtils.ts +401 -259
- package/src/opsCaching.ts +214 -193
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +142 -80
- package/src/retryErrorsStorageAdapter.ts +92 -77
- package/src/retryUtils.ts +80 -57
- package/src/socketModule.ts +8 -0
- package/src/vroom.ts +92 -83
- package/src/zipItDataRepresentationUtils.ts +534 -394
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +11 -13
- package/.editorconfig +0 -7
- package/dist/ReadBufferUtils.js.map +0 -1
- package/dist/WriteBufferUtils.js.map +0 -1
- package/dist/checkUrl.js.map +0 -1
- package/dist/compactSnapshotParser.js +0 -115
- package/dist/compactSnapshotParser.js.map +0 -1
- package/dist/compactSnapshotWriter.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/contracts.js.map +0 -1
- package/dist/contractsPublic.js.map +0 -1
- package/dist/createFile.js +0 -242
- package/dist/createFile.js.map +0 -1
- package/dist/createNewUtils.js +0 -67
- package/dist/createNewUtils.js.map +0 -1
- package/dist/createOdspCreateContainerRequest.js.map +0 -1
- package/dist/createOdspUrl.js.map +0 -1
- package/dist/epochTracker.js.map +0 -1
- package/dist/fetch.js.map +0 -1
- package/dist/fetchSnapshot.js.map +0 -1
- package/dist/getFileLink.js.map +0 -1
- package/dist/getQueryString.js.map +0 -1
- package/dist/getSocketIo.d.ts +0 -11
- package/dist/getSocketIo.d.ts.map +0 -1
- package/dist/getSocketIo.js +0 -20
- package/dist/getSocketIo.js.map +0 -1
- package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
- package/dist/index.js +0 -41
- package/dist/index.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
- package/dist/odspCache.js.map +0 -1
- package/dist/odspDeltaStorageService.js.map +0 -1
- package/dist/odspDocumentDeltaConnection.js.map +0 -1
- package/dist/odspDocumentService.js +0 -364
- package/dist/odspDocumentService.js.map +0 -1
- package/dist/odspDocumentServiceFactory.js.map +0 -1
- package/dist/odspDocumentServiceFactoryCore.js +0 -118
- package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js +0 -34
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
- package/dist/odspDocumentStorageManager.js +0 -356
- package/dist/odspDocumentStorageManager.js.map +0 -1
- package/dist/odspDocumentStorageServiceBase.js.map +0 -1
- package/dist/odspDriverUrlResolver.js.map +0 -1
- package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
- package/dist/odspError.js.map +0 -1
- package/dist/odspFluidFileLink.js.map +0 -1
- package/dist/odspPublicUtils.js.map +0 -1
- package/dist/odspSnapshotParser.js.map +0 -1
- package/dist/odspSummaryUploadManager.js.map +0 -1
- package/dist/odspUrlHelper.js.map +0 -1
- package/dist/odspUtils.js.map +0 -1
- package/dist/opsCaching.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/prefetchLatestSnapshot.js +0 -57
- package/dist/prefetchLatestSnapshot.js.map +0 -1
- package/dist/retryErrorsStorageAdapter.js.map +0 -1
- package/dist/retryUtils.js.map +0 -1
- package/dist/vroom.js.map +0 -1
- package/dist/zipItDataRepresentationUtils.js.map +0 -1
- package/lib/ReadBufferUtils.d.ts.map +0 -1
- package/lib/ReadBufferUtils.js.map +0 -1
- package/lib/WriteBufferUtils.d.ts.map +0 -1
- package/lib/WriteBufferUtils.js.map +0 -1
- package/lib/checkUrl.d.ts.map +0 -1
- package/lib/checkUrl.js.map +0 -1
- package/lib/compactSnapshotParser.d.ts +0 -15
- package/lib/compactSnapshotParser.d.ts.map +0 -1
- package/lib/compactSnapshotParser.js +0 -111
- package/lib/compactSnapshotParser.js.map +0 -1
- package/lib/compactSnapshotWriter.d.ts.map +0 -1
- package/lib/compactSnapshotWriter.js.map +0 -1
- package/lib/constants.d.ts.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/contracts.d.ts.map +0 -1
- package/lib/contracts.js.map +0 -1
- package/lib/contractsPublic.d.ts.map +0 -1
- package/lib/contractsPublic.js.map +0 -1
- package/lib/createFile.d.ts +0 -22
- package/lib/createFile.d.ts.map +0 -1
- package/lib/createFile.js +0 -235
- package/lib/createFile.js.map +0 -1
- package/lib/createNewUtils.d.ts +0 -11
- package/lib/createNewUtils.d.ts.map +0 -1
- package/lib/createNewUtils.js +0 -63
- package/lib/createNewUtils.js.map +0 -1
- package/lib/createOdspCreateContainerRequest.d.ts.map +0 -1
- package/lib/createOdspCreateContainerRequest.js.map +0 -1
- package/lib/createOdspUrl.d.ts.map +0 -1
- package/lib/createOdspUrl.js.map +0 -1
- package/lib/epochTracker.d.ts.map +0 -1
- package/lib/epochTracker.js.map +0 -1
- package/lib/fetch.d.ts.map +0 -1
- package/lib/fetch.js.map +0 -1
- package/lib/fetchSnapshot.d.ts.map +0 -1
- package/lib/fetchSnapshot.js.map +0 -1
- package/lib/getFileLink.d.ts.map +0 -1
- package/lib/getFileLink.js.map +0 -1
- package/lib/getQueryString.d.ts.map +0 -1
- package/lib/getQueryString.js.map +0 -1
- package/lib/getSocketIo.d.ts +0 -11
- package/lib/getSocketIo.d.ts.map +0 -1
- package/lib/getSocketIo.js +0 -13
- package/lib/getSocketIo.js.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.d.ts.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
- package/lib/index.d.ts +0 -21
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -29
- package/lib/index.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
- package/lib/odspCache.d.ts.map +0 -1
- package/lib/odspCache.js.map +0 -1
- package/lib/odspDeltaStorageService.d.ts.map +0 -1
- package/lib/odspDeltaStorageService.js.map +0 -1
- package/lib/odspDocumentDeltaConnection.d.ts.map +0 -1
- package/lib/odspDocumentDeltaConnection.js.map +0 -1
- package/lib/odspDocumentService.d.ts.map +0 -1
- package/lib/odspDocumentService.js +0 -360
- package/lib/odspDocumentService.js.map +0 -1
- package/lib/odspDocumentServiceFactory.d.ts.map +0 -1
- package/lib/odspDocumentServiceFactory.js.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.js +0 -114
- package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
- package/lib/odspDocumentStorageManager.d.ts.map +0 -1
- package/lib/odspDocumentStorageManager.js +0 -352
- package/lib/odspDocumentStorageManager.js.map +0 -1
- package/lib/odspDocumentStorageServiceBase.d.ts.map +0 -1
- package/lib/odspDocumentStorageServiceBase.js.map +0 -1
- package/lib/odspDriverUrlResolver.d.ts.map +0 -1
- package/lib/odspDriverUrlResolver.js.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
- package/lib/odspError.d.ts.map +0 -1
- package/lib/odspError.js.map +0 -1
- package/lib/odspFluidFileLink.d.ts.map +0 -1
- package/lib/odspFluidFileLink.js.map +0 -1
- package/lib/odspPublicUtils.d.ts.map +0 -1
- package/lib/odspPublicUtils.js.map +0 -1
- package/lib/odspSnapshotParser.d.ts.map +0 -1
- package/lib/odspSnapshotParser.js.map +0 -1
- package/lib/odspSummaryUploadManager.d.ts.map +0 -1
- package/lib/odspSummaryUploadManager.js.map +0 -1
- package/lib/odspUrlHelper.d.ts.map +0 -1
- package/lib/odspUrlHelper.js.map +0 -1
- package/lib/odspUtils.d.ts.map +0 -1
- package/lib/odspUtils.js.map +0 -1
- package/lib/opsCaching.d.ts.map +0 -1
- package/lib/opsCaching.js.map +0 -1
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/prefetchLatestSnapshot.d.ts.map +0 -1
- package/lib/prefetchLatestSnapshot.js +0 -53
- package/lib/prefetchLatestSnapshot.js.map +0 -1
- package/lib/retryErrorsStorageAdapter.d.ts.map +0 -1
- package/lib/retryErrorsStorageAdapter.js.map +0 -1
- package/lib/retryUtils.d.ts.map +0 -1
- package/lib/retryUtils.js.map +0 -1
- package/lib/vroom.d.ts.map +0 -1
- package/lib/vroom.js.map +0 -1
- package/lib/zipItDataRepresentationUtils.d.ts.map +0 -1
- package/lib/zipItDataRepresentationUtils.js.map +0 -1
- package/src/getSocketIo.ts +0 -14
- package/tsconfig.esnext.json +0 -7
|
@@ -3,559 +3,755 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { default as AbortController } from "abort-controller";
|
|
7
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
6
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
generateStack,
|
|
8
|
+
ITelemetryLoggerExt,
|
|
9
|
+
loggerToMonitoringContext,
|
|
10
|
+
normalizeError,
|
|
11
|
+
overwriteStack,
|
|
12
|
+
PerformanceEvent,
|
|
14
13
|
} from "@fluidframework/telemetry-utils";
|
|
14
|
+
import { performance } from "@fluid-internal/client-utils";
|
|
15
|
+
import { assert, delay } from "@fluidframework/core-utils";
|
|
16
|
+
import { LogLevel } from "@fluidframework/core-interfaces";
|
|
15
17
|
import * as api from "@fluidframework/protocol-definitions";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
DriverErrorType,
|
|
19
|
-
} from "@fluidframework/driver-definitions";
|
|
18
|
+
import { promiseRaceWithWinner } from "@fluidframework/driver-base";
|
|
19
|
+
import { ISummaryContext, DriverErrorType, FetchSource } from "@fluidframework/driver-definitions";
|
|
20
20
|
import { RateLimiter, NonRetryableError } from "@fluidframework/driver-utils";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
IOdspResolvedUrl,
|
|
23
|
+
ISnapshotOptions,
|
|
24
|
+
OdspErrorType,
|
|
25
|
+
InstrumentedStorageTokenFetcher,
|
|
26
|
+
getKeyForCacheEntry,
|
|
26
27
|
} from "@fluidframework/odsp-driver-definitions";
|
|
27
28
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
IDocumentStorageGetVersionsResponse,
|
|
30
|
+
HostStoragePolicyInternal,
|
|
31
|
+
IVersionedValueWithEpoch,
|
|
32
|
+
ISnapshotCachedEntry,
|
|
32
33
|
} from "./contracts";
|
|
33
|
-
import { downloadSnapshot, fetchSnapshot, fetchSnapshotWithRedeem, SnapshotFormatSupportType } from "./fetchSnapshot";
|
|
34
|
-
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
35
|
-
import { IOdspCache } from "./odspCache";
|
|
36
34
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
downloadSnapshot,
|
|
36
|
+
evalBlobsAndTrees,
|
|
37
|
+
fetchSnapshot,
|
|
38
|
+
fetchSnapshotWithRedeem,
|
|
39
|
+
SnapshotFormatSupportType,
|
|
40
|
+
} from "./fetchSnapshot";
|
|
41
|
+
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
42
|
+
import { IOdspCache, IPrefetchSnapshotContents } from "./odspCache";
|
|
43
|
+
import { createCacheSnapshotKey, getWithRetryForTokenRefresh } from "./odspUtils";
|
|
40
44
|
import { ISnapshotContents } from "./odspPublicUtils";
|
|
41
45
|
import { EpochTracker } from "./epochTracker";
|
|
42
|
-
import { OdspSummaryUploadManager } from "./odspSummaryUploadManager";
|
|
46
|
+
import type { OdspSummaryUploadManager } from "./odspSummaryUploadManager";
|
|
43
47
|
import { FlushResult } from "./odspDocumentDeltaConnection";
|
|
44
48
|
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
45
49
|
import { OdspDocumentStorageServiceBase } from "./odspDocumentStorageServiceBase";
|
|
46
50
|
|
|
47
51
|
export const defaultSummarizerCacheExpiryTimeout: number = 60 * 1000; // 60 seconds.
|
|
48
52
|
|
|
49
|
-
/* eslint-disable max-len */
|
|
50
|
-
|
|
51
|
-
// An implementation of Promise.race that gives you the winner of the promise race
|
|
52
|
-
async function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promise<{ index: number; value: T; }> {
|
|
53
|
-
return new Promise((resolve, reject) => {
|
|
54
|
-
promises.forEach((p, index) => {
|
|
55
|
-
p.then((v) => resolve({ index, value: v })).catch(reject);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
53
|
interface GetVersionsTelemetryProps {
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
cacheEntryAge?: number;
|
|
55
|
+
cacheSummarizerExpired?: boolean;
|
|
63
56
|
}
|
|
64
57
|
|
|
65
58
|
export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
59
|
+
private odspSummaryModuleLoaded: boolean = false;
|
|
60
|
+
private summaryModuleP: Promise<OdspSummaryUploadManager> | undefined;
|
|
61
|
+
private odspSummaryUploadManager: OdspSummaryUploadManager | undefined;
|
|
62
|
+
|
|
63
|
+
private firstVersionCall = true;
|
|
64
|
+
private _isFirstSnapshotFromNetwork: boolean | undefined;
|
|
65
|
+
private readonly documentId: string;
|
|
66
|
+
private readonly snapshotUrl: string | undefined;
|
|
67
|
+
private readonly attachmentPOSTUrl: string | undefined;
|
|
68
|
+
private readonly attachmentGETUrl: string | undefined;
|
|
69
|
+
// Driver specified limits for snapshot size and time.
|
|
70
|
+
/**
|
|
71
|
+
* NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to
|
|
72
|
+
* happen until blob request throttling is implemented. Until then, as a temporary fix we set arbitrarily large
|
|
73
|
+
* snapshot size and timeout limits so that such failures are unlikely to occur.
|
|
74
|
+
*/
|
|
75
|
+
private readonly maxSnapshotSizeLimit = 500000000; // 500 MB
|
|
76
|
+
private readonly maxSnapshotFetchTimeout = 120000; // 2 min
|
|
77
|
+
|
|
78
|
+
// limits the amount of parallel "attachment" blob uploads
|
|
79
|
+
private readonly createBlobRateLimiter = new RateLimiter(1);
|
|
80
|
+
|
|
81
|
+
constructor(
|
|
82
|
+
private readonly odspResolvedUrl: IOdspResolvedUrl,
|
|
83
|
+
private readonly getStorageToken: InstrumentedStorageTokenFetcher,
|
|
84
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
85
|
+
private readonly fetchFullSnapshot: boolean,
|
|
86
|
+
private readonly cache: IOdspCache,
|
|
87
|
+
private readonly hostPolicy: HostStoragePolicyInternal,
|
|
88
|
+
private readonly epochTracker: EpochTracker,
|
|
89
|
+
private readonly flushCallback: () => Promise<FlushResult>,
|
|
90
|
+
private readonly relayServiceTenantAndSessionId: () => string | undefined,
|
|
91
|
+
private readonly snapshotFormatFetchType?: SnapshotFormatSupportType,
|
|
92
|
+
) {
|
|
93
|
+
super(loggerToMonitoringContext(logger).config);
|
|
94
|
+
|
|
95
|
+
this.documentId = this.odspResolvedUrl.hashedDocumentId;
|
|
96
|
+
this.snapshotUrl = this.odspResolvedUrl.endpoints.snapshotStorageUrl;
|
|
97
|
+
this.attachmentPOSTUrl = this.odspResolvedUrl.endpoints.attachmentPOSTStorageUrl;
|
|
98
|
+
this.attachmentGETUrl = this.odspResolvedUrl.endpoints.attachmentGETStorageUrl;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public get isFirstSnapshotFromNetwork() {
|
|
102
|
+
return this._isFirstSnapshotFromNetwork;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {
|
|
106
|
+
this.checkAttachmentPOSTUrl();
|
|
107
|
+
|
|
108
|
+
const response = await getWithRetryForTokenRefresh(async (options) => {
|
|
109
|
+
const storageToken = await this.getStorageToken(options, "CreateBlob");
|
|
110
|
+
const { url, headers } = getUrlAndHeadersWithAuth(
|
|
111
|
+
`${this.attachmentPOSTUrl}/content`,
|
|
112
|
+
storageToken,
|
|
113
|
+
!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
|
|
114
|
+
);
|
|
115
|
+
headers["Content-Type"] = "application/octet-stream";
|
|
116
|
+
|
|
117
|
+
return PerformanceEvent.timedExecAsync(
|
|
118
|
+
this.logger,
|
|
119
|
+
{
|
|
120
|
+
eventName: "createBlob",
|
|
121
|
+
size: file.byteLength,
|
|
122
|
+
waitQueueLength: this.createBlobRateLimiter.waitQueueLength,
|
|
123
|
+
},
|
|
124
|
+
async (event) => {
|
|
125
|
+
const res = await this.createBlobRateLimiter.schedule(async () =>
|
|
126
|
+
this.epochTracker.fetchAndParseAsJSON<api.ICreateBlobResponse>(
|
|
127
|
+
url,
|
|
128
|
+
{
|
|
129
|
+
body: file,
|
|
130
|
+
headers,
|
|
131
|
+
method: "POST",
|
|
132
|
+
},
|
|
133
|
+
"createBlob",
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
event.end({
|
|
137
|
+
blobId: res.content.id,
|
|
138
|
+
...res.propsToLog,
|
|
139
|
+
});
|
|
140
|
+
return res;
|
|
141
|
+
},
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
return response.content;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
protected async fetchBlobFromStorage(blobId: string, evicted: boolean): Promise<ArrayBuffer> {
|
|
149
|
+
this.checkAttachmentGETUrl();
|
|
150
|
+
|
|
151
|
+
const blob = await getWithRetryForTokenRefresh(async (options) => {
|
|
152
|
+
const storageToken = await this.getStorageToken(options, "GetBlob");
|
|
153
|
+
const unAuthedUrl = `${this.attachmentGETUrl}/${encodeURIComponent(blobId)}/content`;
|
|
154
|
+
const { url, headers } = getUrlAndHeadersWithAuth(
|
|
155
|
+
unAuthedUrl,
|
|
156
|
+
storageToken,
|
|
157
|
+
!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
return PerformanceEvent.timedExecAsync(
|
|
161
|
+
this.logger,
|
|
162
|
+
{
|
|
163
|
+
eventName: "readDataBlob",
|
|
164
|
+
blobId,
|
|
165
|
+
evicted,
|
|
166
|
+
headers: Object.keys(headers).length !== 0 ? true : undefined,
|
|
167
|
+
waitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,
|
|
168
|
+
},
|
|
169
|
+
async (event) => {
|
|
170
|
+
const res = await this.epochTracker.fetchArray(url, { headers }, "blob");
|
|
171
|
+
event.end({
|
|
172
|
+
waitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,
|
|
173
|
+
...res.propsToLog,
|
|
174
|
+
attempts: options.refresh ? 2 : 1,
|
|
175
|
+
});
|
|
176
|
+
const cacheControl = res.headers.get("cache-control");
|
|
177
|
+
if (
|
|
178
|
+
cacheControl === undefined ||
|
|
179
|
+
!(cacheControl.includes("private") || cacheControl.includes("public"))
|
|
180
|
+
) {
|
|
181
|
+
this.logger.sendErrorEvent({
|
|
182
|
+
eventName: "NonCacheableBlob",
|
|
183
|
+
cacheControl,
|
|
184
|
+
blobId,
|
|
185
|
+
...res.propsToLog,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return res.content;
|
|
189
|
+
},
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
this.blobCache.setBlob(blobId, blob);
|
|
193
|
+
return blob;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public async getSnapshotTree(
|
|
197
|
+
version?: api.IVersion,
|
|
198
|
+
scenarioName?: string,
|
|
199
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
200
|
+
): Promise<api.ISnapshotTree | null> {
|
|
201
|
+
if (!this.snapshotUrl) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
return super.getSnapshotTree(version, scenarioName);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
public async getVersions(
|
|
208
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
209
|
+
blobid: string | null,
|
|
210
|
+
count: number,
|
|
211
|
+
scenarioName?: string,
|
|
212
|
+
fetchSource?: FetchSource,
|
|
213
|
+
): Promise<api.IVersion[]> {
|
|
214
|
+
// Regular load workflow uses blobId === documentID to indicate "latest".
|
|
215
|
+
if (blobid !== this.documentId && blobid) {
|
|
216
|
+
// FluidFetch & FluidDebugger tools use empty sting to query for versions
|
|
217
|
+
// In such case we need to make a call against SPO to give full picture to the tool.
|
|
218
|
+
// Otherwise, each commit calls getVersions but odsp doesn't have a history for each commit
|
|
219
|
+
// return the blobid as is
|
|
220
|
+
return [
|
|
221
|
+
{
|
|
222
|
+
id: blobid,
|
|
223
|
+
treeId: undefined!,
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Can't really make a call if we do not have URL
|
|
229
|
+
if (!this.snapshotUrl) {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// 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
|
+
if (count === 1 && (blobid === null || blobid === this.documentId)) {
|
|
235
|
+
const hostSnapshotOptions = this.hostPolicy.snapshotOptions;
|
|
236
|
+
const odspSnapshotCacheValue: ISnapshotContents = await PerformanceEvent.timedExecAsync(
|
|
237
|
+
this.logger,
|
|
238
|
+
{ eventName: "ObtainSnapshot", fetchSource },
|
|
239
|
+
async (event: PerformanceEvent) => {
|
|
240
|
+
const props: GetVersionsTelemetryProps = {};
|
|
241
|
+
let cacheLookupTimeInSerialFetch = 0;
|
|
242
|
+
let retrievedSnapshot:
|
|
243
|
+
| ISnapshotContents
|
|
244
|
+
| IPrefetchSnapshotContents
|
|
245
|
+
| undefined;
|
|
246
|
+
|
|
247
|
+
let method: string;
|
|
248
|
+
let prefetchWaitStartTime: number = performance.now();
|
|
249
|
+
if (fetchSource === FetchSource.noCache) {
|
|
250
|
+
retrievedSnapshot = await this.fetchSnapshot(
|
|
251
|
+
hostSnapshotOptions,
|
|
252
|
+
scenarioName,
|
|
253
|
+
);
|
|
254
|
+
method = "networkOnly";
|
|
255
|
+
} else {
|
|
256
|
+
// Here's the logic to grab the persistent cache snapshot implemented by the host
|
|
257
|
+
// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions
|
|
258
|
+
const cachedSnapshotP: Promise<ISnapshotContents | undefined> =
|
|
259
|
+
this.epochTracker
|
|
260
|
+
.get(createCacheSnapshotKey(this.odspResolvedUrl))
|
|
261
|
+
.then(async (snapshotCachedEntry: ISnapshotCachedEntry) => {
|
|
262
|
+
if (snapshotCachedEntry !== undefined) {
|
|
263
|
+
// If the cached entry does not contain the entry time, then assign it a default of 30 days old.
|
|
264
|
+
const age =
|
|
265
|
+
Date.now() -
|
|
266
|
+
(snapshotCachedEntry.cacheEntryTime ??
|
|
267
|
+
Date.now() - 30 * 24 * 60 * 60 * 1000);
|
|
268
|
+
|
|
269
|
+
// In order to decrease the number of times we have to execute a snapshot refresh,
|
|
270
|
+
// if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,
|
|
271
|
+
// force the network retrieval instead as there might be a more recent snapshot available.
|
|
272
|
+
// See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.
|
|
273
|
+
if (this.hostPolicy.summarizerClient) {
|
|
274
|
+
if (age > defaultSummarizerCacheExpiryTimeout) {
|
|
275
|
+
props.cacheSummarizerExpired = true;
|
|
276
|
+
return undefined;
|
|
277
|
+
} else {
|
|
278
|
+
props.cacheSummarizerExpired = false;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Record the cache age
|
|
283
|
+
props.cacheEntryAge = age;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return snapshotCachedEntry;
|
|
287
|
+
});
|
|
288
|
+
// Based on the concurrentSnapshotFetch policy:
|
|
289
|
+
// Either retrieve both the network and cache snapshots concurrently and pick the first to return,
|
|
290
|
+
// or grab the cache value and then the network value if the cache value returns undefined.
|
|
291
|
+
// For summarizer which could call this during refreshing of summary parent, always use the cache
|
|
292
|
+
// first. Also for other clients, if it is not critical path which is determined by firstVersionCall,
|
|
293
|
+
// then also check the cache first.
|
|
294
|
+
if (
|
|
295
|
+
this.firstVersionCall &&
|
|
296
|
+
this.hostPolicy.concurrentSnapshotFetch &&
|
|
297
|
+
!this.hostPolicy.summarizerClient
|
|
298
|
+
) {
|
|
299
|
+
const networkSnapshotP = this.fetchSnapshot(
|
|
300
|
+
hostSnapshotOptions,
|
|
301
|
+
scenarioName,
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
// Ensure that failures on both paths are ignored initially.
|
|
305
|
+
// I.e. if cache fails for some reason, we will proceed with network result.
|
|
306
|
+
// And vice versa - if (for example) client is offline and network request fails first, we
|
|
307
|
+
// do want to attempt to succeed with cached data!
|
|
308
|
+
const promiseRaceWinner = await promiseRaceWithWinner([
|
|
309
|
+
cachedSnapshotP.catch(() => undefined),
|
|
310
|
+
networkSnapshotP.catch(() => undefined),
|
|
311
|
+
]);
|
|
312
|
+
retrievedSnapshot = promiseRaceWinner.value;
|
|
313
|
+
method = promiseRaceWinner.index === 0 ? "cache" : "network";
|
|
314
|
+
|
|
315
|
+
if (retrievedSnapshot === undefined) {
|
|
316
|
+
// if network failed -> wait for cache ( then return network failure)
|
|
317
|
+
// If cache returned empty or failed -> wait for network (success of failure)
|
|
318
|
+
try {
|
|
319
|
+
if (promiseRaceWinner.index === 1) {
|
|
320
|
+
retrievedSnapshot = await cachedSnapshotP;
|
|
321
|
+
method = "cache";
|
|
322
|
+
}
|
|
323
|
+
if (retrievedSnapshot === undefined) {
|
|
324
|
+
retrievedSnapshot = await networkSnapshotP;
|
|
325
|
+
method = "network";
|
|
326
|
+
}
|
|
327
|
+
} catch (err: unknown) {
|
|
328
|
+
// The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:
|
|
329
|
+
// they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--
|
|
330
|
+
// see https://v8.dev/docs/stack-trace-api#async-stack-traces and the "zero-cost async stack traces" document
|
|
331
|
+
// linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.
|
|
332
|
+
// Regenerating the stack at this level provides more information for logged errors.
|
|
333
|
+
// Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and
|
|
334
|
+
// get similar quality stacks with less hand-crafted code.
|
|
335
|
+
const innerStack = (err as Error).stack;
|
|
336
|
+
const normalizedError = normalizeError(err);
|
|
337
|
+
normalizedError.addTelemetryProperties({ innerStack });
|
|
338
|
+
|
|
339
|
+
const newStack = `<<STACK TRUNCATED: see innerStack property>> \n${generateStack()}`;
|
|
340
|
+
overwriteStack(normalizedError, newStack);
|
|
341
|
+
|
|
342
|
+
throw normalizedError;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
// Note: There's a race condition here - another caller may come past the undefined check
|
|
347
|
+
// while the first caller is awaiting later async code in this block.
|
|
348
|
+
const startTime = performance.now();
|
|
349
|
+
retrievedSnapshot = await cachedSnapshotP;
|
|
350
|
+
cacheLookupTimeInSerialFetch = performance.now() - startTime;
|
|
351
|
+
method = retrievedSnapshot !== undefined ? "cache" : "network";
|
|
352
|
+
|
|
353
|
+
if (retrievedSnapshot === undefined) {
|
|
354
|
+
prefetchWaitStartTime = performance.now();
|
|
355
|
+
retrievedSnapshot = await this.fetchSnapshot(
|
|
356
|
+
hostSnapshotOptions,
|
|
357
|
+
scenarioName,
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
if (method === "network") {
|
|
363
|
+
props.cacheEntryAge = undefined;
|
|
364
|
+
}
|
|
365
|
+
if (this.firstVersionCall) {
|
|
366
|
+
this._isFirstSnapshotFromNetwork = method === "cache" ? false : true;
|
|
367
|
+
}
|
|
368
|
+
const prefetchStartTime: number | undefined = (
|
|
369
|
+
retrievedSnapshot as IPrefetchSnapshotContents
|
|
370
|
+
).prefetchStartTime;
|
|
371
|
+
event.end({
|
|
372
|
+
...props,
|
|
373
|
+
method,
|
|
374
|
+
avoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,
|
|
375
|
+
...evalBlobsAndTrees(retrievedSnapshot),
|
|
376
|
+
cacheLookupTimeInSerialFetch,
|
|
377
|
+
prefetchSavedDuration:
|
|
378
|
+
prefetchStartTime !== undefined && method !== "cache"
|
|
379
|
+
? prefetchWaitStartTime - prefetchStartTime
|
|
380
|
+
: undefined,
|
|
381
|
+
});
|
|
382
|
+
return retrievedSnapshot;
|
|
383
|
+
},
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
const stTime = performance.now();
|
|
387
|
+
// Don't override ops which were fetched during initial load, since we could still need them.
|
|
388
|
+
const id = this.initializeFromSnapshot(odspSnapshotCacheValue, this.firstVersionCall);
|
|
389
|
+
this.logger.sendTelemetryEvent(
|
|
390
|
+
{
|
|
391
|
+
eventName: "SnapshotInitializeTime",
|
|
392
|
+
duration: performance.now() - stTime,
|
|
393
|
+
},
|
|
394
|
+
undefined,
|
|
395
|
+
LogLevel.verbose,
|
|
396
|
+
);
|
|
397
|
+
this.firstVersionCall = false;
|
|
398
|
+
|
|
399
|
+
return id ? [{ id, treeId: undefined! }] : [];
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return getWithRetryForTokenRefresh(async (options) => {
|
|
403
|
+
const storageToken = await this.getStorageToken(options, "GetVersions");
|
|
404
|
+
const { url, headers } = getUrlAndHeadersWithAuth(
|
|
405
|
+
`${this.snapshotUrl}/versions?top=${count}`,
|
|
406
|
+
storageToken,
|
|
407
|
+
!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
// Fetch the latest snapshot versions for the document
|
|
411
|
+
const response = await PerformanceEvent.timedExecAsync(
|
|
412
|
+
this.logger,
|
|
413
|
+
{
|
|
414
|
+
eventName: "getVersions",
|
|
415
|
+
headers: Object.keys(headers).length !== 0 ? true : undefined,
|
|
416
|
+
},
|
|
417
|
+
async () =>
|
|
418
|
+
this.epochTracker.fetchAndParseAsJSON<IDocumentStorageGetVersionsResponse>(
|
|
419
|
+
url,
|
|
420
|
+
{ headers },
|
|
421
|
+
"versions",
|
|
422
|
+
undefined,
|
|
423
|
+
scenarioName,
|
|
424
|
+
),
|
|
425
|
+
);
|
|
426
|
+
const versionsResponse = response.content;
|
|
427
|
+
if (!versionsResponse) {
|
|
428
|
+
throw new NonRetryableError(
|
|
429
|
+
"No response from /versions endpoint",
|
|
430
|
+
DriverErrorType.genericNetworkError,
|
|
431
|
+
{ driverVersion },
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
if (!Array.isArray(versionsResponse.value)) {
|
|
435
|
+
throw new NonRetryableError(
|
|
436
|
+
"Incorrect response from /versions endpoint, expected an array",
|
|
437
|
+
DriverErrorType.genericNetworkError,
|
|
438
|
+
{ driverVersion },
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
return versionsResponse.value.map((version) => {
|
|
442
|
+
return {
|
|
443
|
+
id: version.id,
|
|
444
|
+
treeId: undefined!,
|
|
445
|
+
};
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
private async fetchSnapshot(
|
|
451
|
+
hostSnapshotOptions: ISnapshotOptions | undefined,
|
|
452
|
+
scenarioName?: string,
|
|
453
|
+
) {
|
|
454
|
+
return this.fetchSnapshotCore(hostSnapshotOptions, scenarioName).catch((error) => {
|
|
455
|
+
// Issue #5895:
|
|
456
|
+
// If we are offline, this error is retryable. But that means that RetriableDocumentStorageService
|
|
457
|
+
// will run in circles calling getSnapshotTree, which would result in OdspDocumentStorageService class
|
|
458
|
+
// going getVersions / individual blob download path. This path is very slow, and will not work with
|
|
459
|
+
// delay-loaded data stores and ODSP storage deleting old snapshots and blobs.
|
|
460
|
+
if (typeof error === "object" && error !== null) {
|
|
461
|
+
error.canRetry = false;
|
|
462
|
+
}
|
|
463
|
+
throw error;
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
private async fetchSnapshotCore(
|
|
468
|
+
hostSnapshotOptions: ISnapshotOptions | undefined,
|
|
469
|
+
scenarioName?: string,
|
|
470
|
+
): Promise<ISnapshotContents | IPrefetchSnapshotContents> {
|
|
471
|
+
// Don't look into cache, if the host specifically tells us so.
|
|
472
|
+
if (!this.hostPolicy.avoidPrefetchSnapshotCache) {
|
|
473
|
+
const prefetchCacheKey = getKeyForCacheEntry(
|
|
474
|
+
createCacheSnapshotKey(this.odspResolvedUrl),
|
|
475
|
+
);
|
|
476
|
+
const result = await this.cache.snapshotPrefetchResultCache
|
|
477
|
+
?.get(prefetchCacheKey)
|
|
478
|
+
?.then(async (response) => {
|
|
479
|
+
// Remove it from cache once used.
|
|
480
|
+
this.cache.snapshotPrefetchResultCache.remove(prefetchCacheKey);
|
|
481
|
+
// Validate the epoch from the prefetched snapshot result.
|
|
482
|
+
await this.epochTracker.validateEpoch(response.fluidEpoch, "treesLatest");
|
|
483
|
+
return response;
|
|
484
|
+
})
|
|
485
|
+
.catch(async (err) => {
|
|
486
|
+
this.logger.sendTelemetryEvent(
|
|
487
|
+
{
|
|
488
|
+
eventName: "PrefetchSnapshotError",
|
|
489
|
+
concurrentSnapshotFetch: this.hostPolicy.concurrentSnapshotFetch,
|
|
490
|
+
},
|
|
491
|
+
err,
|
|
492
|
+
);
|
|
493
|
+
return undefined;
|
|
494
|
+
});
|
|
495
|
+
// If the prefetch call, is successful, then return the contents otherwise as backup for now, just
|
|
496
|
+
// proceed with the old snapshot fetch flow.
|
|
497
|
+
if (result !== undefined) {
|
|
498
|
+
return result;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const snapshotOptions: ISnapshotOptions = {
|
|
502
|
+
mds: this.maxSnapshotSizeLimit,
|
|
503
|
+
...hostSnapshotOptions,
|
|
504
|
+
timeout: hostSnapshotOptions?.timeout
|
|
505
|
+
? Math.min(hostSnapshotOptions.timeout, this.maxSnapshotFetchTimeout)
|
|
506
|
+
: this.maxSnapshotFetchTimeout,
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
// No limit on size of snapshot or time to fetch, as otherwise we fail all clients to summarize
|
|
510
|
+
if (this.hostPolicy.summarizerClient) {
|
|
511
|
+
snapshotOptions.mds = undefined;
|
|
512
|
+
snapshotOptions.timeout = undefined;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const snapshotDownloader = async (
|
|
516
|
+
finalOdspResolvedUrl: IOdspResolvedUrl,
|
|
517
|
+
storageToken: string,
|
|
518
|
+
options: ISnapshotOptions | undefined,
|
|
519
|
+
controller?: AbortController,
|
|
520
|
+
) => {
|
|
521
|
+
return downloadSnapshot(
|
|
522
|
+
finalOdspResolvedUrl,
|
|
523
|
+
storageToken,
|
|
524
|
+
this.logger,
|
|
525
|
+
options,
|
|
526
|
+
this.snapshotFormatFetchType,
|
|
527
|
+
controller,
|
|
528
|
+
this.epochTracker,
|
|
529
|
+
scenarioName,
|
|
530
|
+
);
|
|
531
|
+
};
|
|
532
|
+
const putInCache = async (valueWithEpoch: IVersionedValueWithEpoch) => {
|
|
533
|
+
return this.cache.persistedCache.put(
|
|
534
|
+
createCacheSnapshotKey(this.odspResolvedUrl),
|
|
535
|
+
// Epoch tracker will add the epoch and version to the value here. So just send value to cache.
|
|
536
|
+
valueWithEpoch.value,
|
|
537
|
+
);
|
|
538
|
+
};
|
|
539
|
+
const removeEntries = async () => this.cache.persistedCache.removeEntries();
|
|
540
|
+
try {
|
|
541
|
+
const odspSnapshot = await fetchSnapshotWithRedeem(
|
|
542
|
+
this.odspResolvedUrl,
|
|
543
|
+
this.getStorageToken,
|
|
544
|
+
snapshotOptions,
|
|
545
|
+
!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
|
|
546
|
+
this.logger,
|
|
547
|
+
snapshotDownloader,
|
|
548
|
+
putInCache,
|
|
549
|
+
removeEntries,
|
|
550
|
+
this.hostPolicy.enableRedeemFallback,
|
|
551
|
+
);
|
|
552
|
+
return odspSnapshot;
|
|
553
|
+
} catch (error: any) {
|
|
554
|
+
const errorType = error.errorType;
|
|
555
|
+
// 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
|
+
if (
|
|
557
|
+
errorType === OdspErrorType.snapshotTooBig &&
|
|
558
|
+
hostSnapshotOptions?.mds !== undefined &&
|
|
559
|
+
this.hostPolicy.summarizerClient !== true
|
|
560
|
+
) {
|
|
561
|
+
throw error;
|
|
562
|
+
}
|
|
563
|
+
// 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
|
+
if (
|
|
565
|
+
(errorType === OdspErrorType.snapshotTooBig ||
|
|
566
|
+
errorType === OdspErrorType.fetchTimeout) &&
|
|
567
|
+
snapshotOptions.blobs
|
|
568
|
+
) {
|
|
569
|
+
this.logger.sendErrorEvent({
|
|
570
|
+
eventName: "TreeLatest_SecondCall",
|
|
571
|
+
errorType,
|
|
572
|
+
});
|
|
573
|
+
const snapshotOptionsWithoutBlobs: ISnapshotOptions = {
|
|
574
|
+
...snapshotOptions,
|
|
575
|
+
blobs: 0,
|
|
576
|
+
mds: undefined,
|
|
577
|
+
timeout: undefined,
|
|
578
|
+
};
|
|
579
|
+
const odspSnapshot = await fetchSnapshotWithRedeem(
|
|
580
|
+
this.odspResolvedUrl,
|
|
581
|
+
this.getStorageToken,
|
|
582
|
+
snapshotOptionsWithoutBlobs,
|
|
583
|
+
!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
|
|
584
|
+
this.logger,
|
|
585
|
+
snapshotDownloader,
|
|
586
|
+
putInCache,
|
|
587
|
+
removeEntries,
|
|
588
|
+
this.hostPolicy.enableRedeemFallback,
|
|
589
|
+
);
|
|
590
|
+
return odspSnapshot;
|
|
591
|
+
}
|
|
592
|
+
throw error;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
public async uploadSummaryWithContext(
|
|
597
|
+
summary: api.ISummaryTree,
|
|
598
|
+
context: ISummaryContext,
|
|
599
|
+
): Promise<string> {
|
|
600
|
+
this.checkSnapshotUrl();
|
|
601
|
+
|
|
602
|
+
// Set the module promise right away, so as to not call it twice.
|
|
603
|
+
if (this.summaryModuleP === undefined) {
|
|
604
|
+
this.summaryModuleP = this.getDelayLoadedSummaryManager();
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Enable flushing only if we have single commit summary and this is not the initial summary for an empty file
|
|
608
|
+
if (".protocol" in summary.tree && context.ackHandle !== undefined) {
|
|
609
|
+
let retry = 1;
|
|
610
|
+
for (;;) {
|
|
611
|
+
const result = await this.flushCallback();
|
|
612
|
+
const seq = result.lastPersistedSequenceNumber;
|
|
613
|
+
if (seq !== undefined && seq >= context.referenceSequenceNumber) {
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (retry > 3) {
|
|
618
|
+
this.logger.sendErrorEvent({
|
|
619
|
+
eventName: "FlushFailure",
|
|
620
|
+
...result,
|
|
621
|
+
retry,
|
|
622
|
+
referenceSequenceNumber: context.referenceSequenceNumber,
|
|
623
|
+
});
|
|
624
|
+
break;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
this.logger.sendPerformanceEvent({
|
|
628
|
+
eventName: "FlushExtraCall",
|
|
629
|
+
...result,
|
|
630
|
+
retry,
|
|
631
|
+
referenceSequenceNumber: context.referenceSequenceNumber,
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
retry++;
|
|
635
|
+
await delay(1000 * (result.retryAfter ?? 1));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
if (!this.odspSummaryUploadManager) {
|
|
640
|
+
this.odspSummaryUploadManager = await this.summaryModuleP
|
|
641
|
+
.then(async (m) => {
|
|
642
|
+
this.odspSummaryModuleLoaded = true;
|
|
643
|
+
return m;
|
|
644
|
+
})
|
|
645
|
+
.catch((error) => {
|
|
646
|
+
this.odspSummaryModuleLoaded = false;
|
|
647
|
+
throw error;
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
assert(
|
|
652
|
+
this.odspSummaryUploadManager !== undefined,
|
|
653
|
+
0x56e /* summary upload manager should have been initialized */,
|
|
654
|
+
);
|
|
655
|
+
const id = await this.odspSummaryUploadManager.writeSummaryTree(summary, context);
|
|
656
|
+
return id;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
private async getDelayLoadedSummaryManager() {
|
|
660
|
+
assert(this.odspSummaryModuleLoaded === false, 0x56f /* Should be loaded only once */);
|
|
661
|
+
const module = await import(
|
|
662
|
+
/* webpackChunkName: "summaryModule" */ "./odspSummaryUploadManager.js"
|
|
663
|
+
)
|
|
664
|
+
.then((m) => {
|
|
665
|
+
this.logger.sendTelemetryEvent({ eventName: "SummaryModuleLoaded" });
|
|
666
|
+
return m;
|
|
667
|
+
})
|
|
668
|
+
.catch((error) => {
|
|
669
|
+
this.logger.sendErrorEvent({ eventName: "SummaryModuleLoadFailed" }, error);
|
|
670
|
+
throw error;
|
|
671
|
+
});
|
|
672
|
+
this.odspSummaryUploadManager = new module.OdspSummaryUploadManager(
|
|
673
|
+
this.odspResolvedUrl.endpoints.snapshotStorageUrl,
|
|
674
|
+
this.getStorageToken,
|
|
675
|
+
this.logger,
|
|
676
|
+
this.epochTracker,
|
|
677
|
+
!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
|
|
678
|
+
this.relayServiceTenantAndSessionId,
|
|
679
|
+
);
|
|
680
|
+
return this.odspSummaryUploadManager;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
private checkSnapshotUrl() {
|
|
684
|
+
if (!this.snapshotUrl) {
|
|
685
|
+
throw new NonRetryableError(
|
|
686
|
+
"Method failed because no snapshot url was available",
|
|
687
|
+
DriverErrorType.genericError,
|
|
688
|
+
{ driverVersion },
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
private checkAttachmentPOSTUrl() {
|
|
694
|
+
if (!this.attachmentPOSTUrl) {
|
|
695
|
+
throw new NonRetryableError(
|
|
696
|
+
"Method failed because no attachment POST url was available",
|
|
697
|
+
DriverErrorType.genericError,
|
|
698
|
+
{ driverVersion },
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
private checkAttachmentGETUrl() {
|
|
704
|
+
if (!this.attachmentGETUrl) {
|
|
705
|
+
throw new NonRetryableError(
|
|
706
|
+
"Method failed because no attachment GET url was available",
|
|
707
|
+
DriverErrorType.genericError,
|
|
708
|
+
{ driverVersion },
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
protected async fetchTreeFromSnapshot(
|
|
714
|
+
id: string,
|
|
715
|
+
scenarioName?: string,
|
|
716
|
+
): Promise<api.ISnapshotTree | undefined> {
|
|
717
|
+
return getWithRetryForTokenRefresh(async (options) => {
|
|
718
|
+
const storageToken = await this.getStorageToken(options, "ReadCommit");
|
|
719
|
+
const snapshotDownloader = async (
|
|
720
|
+
url: string,
|
|
721
|
+
fetchOptions: { [index: string]: any },
|
|
722
|
+
) => {
|
|
723
|
+
return this.epochTracker.fetchAndParseAsJSON(
|
|
724
|
+
url,
|
|
725
|
+
fetchOptions,
|
|
726
|
+
"snapshotTree",
|
|
727
|
+
undefined,
|
|
728
|
+
scenarioName,
|
|
729
|
+
);
|
|
730
|
+
};
|
|
731
|
+
const snapshot = await fetchSnapshot(
|
|
732
|
+
this.snapshotUrl!,
|
|
733
|
+
storageToken,
|
|
734
|
+
id,
|
|
735
|
+
this.fetchFullSnapshot,
|
|
736
|
+
!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
|
|
737
|
+
this.logger,
|
|
738
|
+
snapshotDownloader,
|
|
739
|
+
);
|
|
740
|
+
let treeId = "";
|
|
741
|
+
if (snapshot.snapshotTree) {
|
|
742
|
+
assert(
|
|
743
|
+
snapshot.snapshotTree.id !== undefined,
|
|
744
|
+
0x222 /* "Root tree should contain the id!!" */,
|
|
745
|
+
);
|
|
746
|
+
treeId = snapshot.snapshotTree.id;
|
|
747
|
+
this.setRootTree(treeId, snapshot.snapshotTree);
|
|
748
|
+
}
|
|
749
|
+
if (snapshot.blobs) {
|
|
750
|
+
this.initBlobsCache(snapshot.blobs);
|
|
751
|
+
}
|
|
752
|
+
// 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
|
+
// will be the actual id of tree to be fetched.
|
|
754
|
+
return this.commitCache.get(id) ?? this.commitCache.get(treeId);
|
|
755
|
+
});
|
|
756
|
+
}
|
|
559
757
|
}
|
|
560
|
-
|
|
561
|
-
/* eslint-enable max-len */
|