@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.2.0.0.245554
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.cjs +33 -0
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +44 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/odsp-driver.api.md +16 -17
- package/dist/ReadBufferUtils.d.ts.map +1 -1
- package/dist/ReadBufferUtils.js.map +1 -1
- package/dist/WriteBufferUtils.d.ts +1 -1
- package/dist/WriteBufferUtils.d.ts.map +1 -1
- package/dist/WriteBufferUtils.js +12 -12
- package/dist/WriteBufferUtils.js.map +1 -1
- package/dist/checkUrl.d.ts.map +1 -1
- package/dist/checkUrl.js +5 -3
- package/dist/checkUrl.js.map +1 -1
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +94 -75
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts +2 -2
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +26 -20
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +24 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +5 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createFile.d.ts +4 -4
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createFile.js +36 -52
- package/dist/createFile.js.map +1 -1
- package/dist/createNewContainerOnExistingFile.d.ts +2 -2
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/createNewContainerOnExistingFile.js +14 -14
- package/dist/createNewContainerOnExistingFile.js.map +1 -1
- package/dist/createNewModule.d.ts +2 -2
- package/dist/createNewModule.d.ts.map +1 -1
- package/dist/createNewModule.js +4 -4
- package/dist/createNewModule.js.map +1 -1
- package/dist/createNewUtils.d.ts +4 -4
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +16 -11
- package/dist/createNewUtils.js.map +1 -1
- package/dist/createOdspCreateContainerRequest.d.ts +2 -2
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/createOdspCreateContainerRequest.js +2 -2
- package/dist/createOdspCreateContainerRequest.js.map +1 -1
- package/dist/createOdspUrl.d.ts +1 -1
- package/dist/createOdspUrl.d.ts.map +1 -1
- package/dist/createOdspUrl.js.map +1 -1
- package/dist/epochTracker.d.ts +10 -9
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +67 -45
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts +14 -11
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +91 -71
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js +25 -18
- package/dist/getFileLink.js.map +1 -1
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/getQueryString.js +2 -0
- package/dist/getQueryString.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -3
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.js +8 -6
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +8 -6
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +10 -9
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -2
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js +9 -6
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/dist/odsp-driver-alpha.d.ts +31 -15
- package/dist/odsp-driver-beta.d.ts +4 -5
- package/dist/odsp-driver-public.d.ts +4 -5
- package/dist/odsp-driver-untrimmed.d.ts +34 -16
- package/dist/odspCache.d.ts +5 -5
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js +1 -2
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +12 -6
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +89 -25
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDeltaStorageService.d.ts +7 -7
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/odspDeltaStorageService.js +5 -5
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +41 -23
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts +9 -6
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js +25 -19
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.d.ts +6 -1
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js +9 -4
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +4 -4
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +27 -30
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js +2 -2
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +17 -10
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +226 -169
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +4 -6
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +34 -31
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +1 -1
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +26 -32
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +13 -6
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +47 -37
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspError.d.ts +1 -1
- package/dist/odspError.d.ts.map +1 -1
- package/dist/odspError.js +6 -6
- package/dist/odspError.js.map +1 -1
- package/dist/odspFluidFileLink.d.ts +1 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspFluidFileLink.js +2 -2
- package/dist/odspFluidFileLink.js.map +1 -1
- package/dist/odspLocationRedirection.js +2 -2
- package/dist/odspLocationRedirection.js.map +1 -1
- package/dist/odspPublicUtils.d.ts +4 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/odspPublicUtils.js +3 -0
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts +3 -3
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js +5 -3
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspSummaryUploadManager.d.ts +1 -1
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/odspSummaryUploadManager.js +9 -6
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/odspUrlHelper.js +1 -2
- package/dist/odspUrlHelper.js.map +1 -1
- package/dist/odspUtils.d.ts +29 -13
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +75 -41
- package/dist/odspUtils.js.map +1 -1
- package/dist/opsCaching.d.ts +1 -1
- package/dist/opsCaching.d.ts.map +1 -1
- package/dist/opsCaching.js +2 -1
- package/dist/opsCaching.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/prefetchLatestSnapshot.d.ts +2 -2
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.js +17 -12
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/dist/retryErrorsStorageAdapter.d.ts +2 -2
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js +10 -5
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.d.ts.map +1 -1
- package/dist/retryUtils.js +7 -3
- package/dist/retryUtils.js.map +1 -1
- package/dist/socketModule.d.ts.map +1 -1
- package/dist/socketModule.js +2 -0
- package/dist/socketModule.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/vroom.d.ts +2 -2
- package/dist/vroom.d.ts.map +1 -1
- package/dist/vroom.js +5 -5
- package/dist/vroom.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js +17 -13
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/{ReadBufferUtils.d.mts → ReadBufferUtils.d.ts} +1 -1
- package/lib/ReadBufferUtils.d.ts.map +1 -0
- package/lib/{ReadBufferUtils.mjs → ReadBufferUtils.js} +1 -1
- package/lib/ReadBufferUtils.js.map +1 -0
- package/lib/{WriteBufferUtils.d.mts → WriteBufferUtils.d.ts} +2 -2
- package/lib/WriteBufferUtils.d.ts.map +1 -0
- package/lib/{WriteBufferUtils.mjs → WriteBufferUtils.js} +2 -2
- package/lib/WriteBufferUtils.js.map +1 -0
- package/lib/{checkUrl.d.mts → checkUrl.d.ts} +1 -1
- package/lib/checkUrl.d.ts.map +1 -0
- package/lib/{checkUrl.mjs → checkUrl.js} +5 -3
- package/lib/checkUrl.js.map +1 -0
- package/lib/{compactSnapshotParser.d.mts → compactSnapshotParser.d.ts} +3 -3
- package/lib/compactSnapshotParser.d.ts.map +1 -0
- package/lib/{compactSnapshotParser.mjs → compactSnapshotParser.js} +69 -50
- package/lib/compactSnapshotParser.js.map +1 -0
- package/lib/{compactSnapshotWriter.d.mts → compactSnapshotWriter.d.ts} +3 -3
- package/lib/compactSnapshotWriter.d.ts.map +1 -0
- package/lib/{compactSnapshotWriter.mjs → compactSnapshotWriter.js} +14 -8
- package/lib/compactSnapshotWriter.js.map +1 -0
- package/lib/{constants.d.mts → constants.d.ts} +1 -1
- package/lib/constants.d.ts.map +1 -0
- package/lib/{constants.mjs → constants.js} +1 -1
- package/lib/constants.js.map +1 -0
- package/lib/{contracts.d.mts → contracts.d.ts} +25 -5
- package/lib/contracts.d.ts.map +1 -0
- package/lib/contracts.js +10 -0
- package/lib/contracts.js.map +1 -0
- package/lib/{contractsPublic.d.mts → contractsPublic.d.ts} +1 -1
- package/lib/contractsPublic.d.ts.map +1 -0
- package/lib/{contractsPublic.mjs → contractsPublic.js} +1 -1
- package/lib/contractsPublic.js.map +1 -0
- package/lib/{createFile.d.mts → createFile.d.ts} +5 -5
- package/lib/createFile.d.ts.map +1 -0
- package/lib/{createFile.mjs → createFile.js} +25 -41
- package/lib/createFile.js.map +1 -0
- package/lib/{createNewContainerOnExistingFile.d.mts → createNewContainerOnExistingFile.d.ts} +3 -3
- package/lib/createNewContainerOnExistingFile.d.ts.map +1 -0
- package/lib/{createNewContainerOnExistingFile.mjs → createNewContainerOnExistingFile.js} +7 -7
- package/lib/createNewContainerOnExistingFile.js.map +1 -0
- package/lib/{createNewModule.mjs → createNewModule.d.ts} +3 -3
- package/lib/createNewModule.d.ts.map +1 -0
- package/lib/{createNewModule.d.mts → createNewModule.js} +3 -3
- package/lib/createNewModule.js.map +1 -0
- package/lib/{createNewUtils.d.mts → createNewUtils.d.ts} +5 -5
- package/lib/createNewUtils.d.ts.map +1 -0
- package/lib/{createNewUtils.mjs → createNewUtils.js} +13 -8
- package/lib/createNewUtils.js.map +1 -0
- package/lib/{createOdspCreateContainerRequest.d.mts → createOdspCreateContainerRequest.d.ts} +7 -3
- package/lib/createOdspCreateContainerRequest.d.ts.map +1 -0
- package/lib/{createOdspCreateContainerRequest.mjs → createOdspCreateContainerRequest.js} +2 -2
- package/lib/createOdspCreateContainerRequest.js.map +1 -0
- package/lib/{createOdspUrl.d.mts → createOdspUrl.d.ts} +2 -2
- package/lib/createOdspUrl.d.ts.map +1 -0
- package/lib/{createOdspUrl.mjs → createOdspUrl.js} +1 -1
- package/lib/createOdspUrl.js.map +1 -0
- package/lib/{epochTracker.d.mts → epochTracker.d.ts} +11 -10
- package/lib/epochTracker.d.ts.map +1 -0
- package/lib/{epochTracker.mjs → epochTracker.js} +58 -36
- package/lib/epochTracker.js.map +1 -0
- package/lib/{fetch.d.mts → fetch.d.ts} +1 -1
- package/lib/fetch.d.ts.map +1 -0
- package/lib/{fetch.mjs → fetch.js} +1 -1
- package/lib/fetch.js.map +1 -0
- package/lib/{fetchSnapshot.d.mts → fetchSnapshot.d.ts} +15 -12
- package/lib/fetchSnapshot.d.ts.map +1 -0
- package/lib/{fetchSnapshot.mjs → fetchSnapshot.js} +74 -54
- package/lib/fetchSnapshot.js.map +1 -0
- package/lib/{getFileLink.d.mts → getFileLink.d.ts} +1 -1
- package/lib/getFileLink.d.ts.map +1 -0
- package/lib/{getFileLink.mjs → getFileLink.js} +17 -10
- package/lib/getFileLink.js.map +1 -0
- package/lib/{getQueryString.d.mts → getQueryString.d.ts} +5 -1
- package/lib/getQueryString.d.ts.map +1 -0
- package/lib/{getQueryString.mjs → getQueryString.js} +3 -1
- package/lib/getQueryString.js.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.d.mts → getUrlAndHeadersWithAuth.d.ts} +1 -1
- package/lib/getUrlAndHeadersWithAuth.d.ts.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.mjs → getUrlAndHeadersWithAuth.js} +1 -1
- package/lib/getUrlAndHeadersWithAuth.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +20 -20
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +29 -0
- package/lib/index.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDeltaStorageService.d.mts → localOdspDeltaStorageService.d.ts} +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDeltaStorageService.mjs → localOdspDeltaStorageService.js} +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.d.mts → localOdspDocumentService.d.ts} +5 -4
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.mjs → localOdspDocumentService.js} +7 -5
- package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.mts → localOdspDocumentServiceFactory.d.ts} +9 -7
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.mjs → localOdspDocumentServiceFactory.js} +9 -8
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.mts → localOdspDocumentStorageManager.d.ts} +4 -3
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.mjs → localOdspDocumentStorageManager.js} +7 -4
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
- package/lib/{odsp-driver-alpha.d.mts → odsp-driver-alpha.d.ts} +31 -15
- package/lib/{odsp-driver-beta.d.mts → odsp-driver-beta.d.ts} +4 -5
- package/lib/{odsp-driver-public.d.mts → odsp-driver-public.d.ts} +4 -5
- package/lib/{odsp-driver-untrimmed.d.mts → odsp-driver-untrimmed.d.ts} +34 -16
- package/lib/{odspCache.d.mts → odspCache.d.ts} +10 -6
- package/lib/odspCache.d.ts.map +1 -0
- package/lib/{odspCache.mjs → odspCache.js} +6 -3
- package/lib/odspCache.js.map +1 -0
- package/lib/{odspDelayLoadedDeltaStream.d.mts → odspDelayLoadedDeltaStream.d.ts} +13 -7
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -0
- package/lib/{odspDelayLoadedDeltaStream.mjs → odspDelayLoadedDeltaStream.js} +84 -20
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -0
- package/lib/{odspDeltaStorageService.d.mts → odspDeltaStorageService.d.ts} +8 -8
- package/lib/odspDeltaStorageService.d.ts.map +1 -0
- package/lib/{odspDeltaStorageService.mjs → odspDeltaStorageService.js} +5 -5
- package/lib/odspDeltaStorageService.js.map +1 -0
- package/lib/{odspDocumentDeltaConnection.d.mts → odspDocumentDeltaConnection.d.ts} +2 -2
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -0
- package/lib/{odspDocumentDeltaConnection.mjs → odspDocumentDeltaConnection.js} +34 -16
- package/lib/odspDocumentDeltaConnection.js.map +1 -0
- package/lib/{odspDocumentService.d.mts → odspDocumentService.d.ts} +10 -7
- package/lib/odspDocumentService.d.ts.map +1 -0
- package/lib/{odspDocumentService.mjs → odspDocumentService.js} +22 -14
- package/lib/odspDocumentService.js.map +1 -0
- package/lib/{odspDocumentServiceFactory.d.mts → odspDocumentServiceFactory.d.ts} +7 -2
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -0
- package/lib/{odspDocumentServiceFactory.mjs → odspDocumentServiceFactory.js} +9 -3
- package/lib/odspDocumentServiceFactory.js.map +1 -0
- package/lib/{odspDocumentServiceFactoryCore.d.mts → odspDocumentServiceFactoryCore.d.ts} +5 -5
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -0
- package/lib/{odspDocumentServiceFactoryCore.mjs → odspDocumentServiceFactoryCore.js} +25 -26
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.mts → odspDocumentServiceFactoryWithCodeSplit.d.ts} +2 -2
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.mjs → odspDocumentServiceFactoryWithCodeSplit.js} +2 -2
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -0
- package/lib/{odspDocumentStorageManager.d.mts → odspDocumentStorageManager.d.ts} +18 -11
- package/lib/odspDocumentStorageManager.d.ts.map +1 -0
- package/lib/{odspDocumentStorageManager.mjs → odspDocumentStorageManager.js} +221 -162
- package/lib/odspDocumentStorageManager.js.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.d.mts → odspDocumentStorageServiceBase.d.ts} +5 -7
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.mjs → odspDocumentStorageServiceBase.js} +34 -31
- package/lib/odspDocumentStorageServiceBase.js.map +1 -0
- package/lib/{odspDriverUrlResolver.d.mts → odspDriverUrlResolver.d.ts} +2 -2
- package/lib/odspDriverUrlResolver.d.ts.map +1 -0
- package/lib/{odspDriverUrlResolver.mjs → odspDriverUrlResolver.js} +27 -29
- package/lib/odspDriverUrlResolver.js.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.d.mts → odspDriverUrlResolverForShareLink.d.ts} +14 -7
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.mjs → odspDriverUrlResolverForShareLink.js} +41 -27
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -0
- package/lib/{odspError.d.mts → odspError.d.ts} +2 -2
- package/lib/odspError.d.ts.map +1 -0
- package/lib/{odspError.mjs → odspError.js} +6 -6
- package/lib/odspError.js.map +1 -0
- package/lib/{odspFluidFileLink.d.mts → odspFluidFileLink.d.ts} +2 -2
- package/lib/odspFluidFileLink.d.ts.map +1 -0
- package/lib/{odspFluidFileLink.mjs → odspFluidFileLink.js} +2 -2
- package/lib/odspFluidFileLink.js.map +1 -0
- package/lib/{odspLocationRedirection.d.mts → odspLocationRedirection.d.ts} +1 -1
- package/lib/odspLocationRedirection.d.ts.map +1 -0
- package/lib/{odspLocationRedirection.mjs → odspLocationRedirection.js} +2 -2
- package/lib/odspLocationRedirection.js.map +1 -0
- package/lib/{odspPublicUtils.d.mts → odspPublicUtils.d.ts} +5 -1
- package/lib/odspPublicUtils.d.ts.map +1 -0
- package/lib/{odspPublicUtils.mjs → odspPublicUtils.js} +4 -1
- package/lib/odspPublicUtils.js.map +1 -0
- package/lib/{odspSnapshotParser.d.mts → odspSnapshotParser.d.ts} +4 -4
- package/lib/odspSnapshotParser.d.ts.map +1 -0
- package/lib/{odspSnapshotParser.mjs → odspSnapshotParser.js} +6 -4
- package/lib/odspSnapshotParser.js.map +1 -0
- package/lib/{odspSummaryUploadManager.d.mts → odspSummaryUploadManager.d.ts} +2 -2
- package/lib/odspSummaryUploadManager.d.ts.map +1 -0
- package/lib/{odspSummaryUploadManager.mjs → odspSummaryUploadManager.js} +8 -5
- package/lib/odspSummaryUploadManager.js.map +1 -0
- package/lib/{odspUrlHelper.d.mts → odspUrlHelper.d.ts} +1 -1
- package/lib/odspUrlHelper.d.ts.map +1 -0
- package/lib/{odspUrlHelper.mjs → odspUrlHelper.js} +2 -3
- package/lib/odspUrlHelper.js.map +1 -0
- package/lib/{odspUtils.d.mts → odspUtils.d.ts} +30 -14
- package/lib/odspUtils.d.ts.map +1 -0
- package/lib/{odspUtils.mjs → odspUtils.js} +61 -30
- package/lib/odspUtils.js.map +1 -0
- package/lib/{opsCaching.d.mts → opsCaching.d.ts} +2 -2
- package/lib/opsCaching.d.ts.map +1 -0
- package/lib/{opsCaching.mjs → opsCaching.js} +3 -2
- package/lib/opsCaching.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{prefetchLatestSnapshot.d.mts → prefetchLatestSnapshot.d.ts} +3 -3
- package/lib/prefetchLatestSnapshot.d.ts.map +1 -0
- package/lib/{prefetchLatestSnapshot.mjs → prefetchLatestSnapshot.js} +16 -11
- package/lib/prefetchLatestSnapshot.js.map +1 -0
- package/lib/{retryErrorsStorageAdapter.d.mts → retryErrorsStorageAdapter.d.ts} +3 -3
- package/lib/retryErrorsStorageAdapter.d.ts.map +1 -0
- package/lib/{retryErrorsStorageAdapter.mjs → retryErrorsStorageAdapter.js} +11 -6
- package/lib/retryErrorsStorageAdapter.js.map +1 -0
- package/lib/{retryUtils.d.mts → retryUtils.d.ts} +1 -1
- package/lib/retryUtils.d.ts.map +1 -0
- package/lib/{retryUtils.mjs → retryUtils.js} +8 -4
- package/lib/retryUtils.js.map +1 -0
- package/lib/{socketModule.d.mts → socketModule.d.ts} +1 -1
- package/lib/socketModule.d.ts.map +1 -0
- package/lib/{socketModule.mjs → socketModule.js} +3 -1
- package/lib/socketModule.js.map +1 -0
- package/lib/test/buildOdspShareLinkReqParams.spec.js +25 -0
- package/lib/test/buildOdspShareLinkReqParams.spec.js.map +1 -0
- package/lib/test/createNewUtilsTests.spec.js +221 -0
- package/lib/test/createNewUtilsTests.spec.js.map +1 -0
- package/lib/test/deltaStorageService.spec.js +176 -0
- package/lib/test/deltaStorageService.spec.js.map +1 -0
- package/lib/test/epochTests.spec.js +340 -0
- package/lib/test/epochTests.spec.js.map +1 -0
- package/lib/test/epochTestsWithRedemption.spec.js +119 -0
- package/lib/test/epochTestsWithRedemption.spec.js.map +1 -0
- package/lib/test/fetchSnapshot.spec.js +412 -0
- package/lib/test/fetchSnapshot.spec.js.map +1 -0
- package/lib/test/getFileLink.spec.js +62 -0
- package/lib/test/getFileLink.spec.js.map +1 -0
- package/lib/test/getUrlAndHeadersWithAuth.spec.js +66 -0
- package/lib/test/getUrlAndHeadersWithAuth.spec.js.map +1 -0
- package/lib/test/getVersions.spec.js +284 -0
- package/lib/test/getVersions.spec.js.map +1 -0
- package/lib/test/joinSessionCacheTests.spec.js +53 -0
- package/lib/test/joinSessionCacheTests.spec.js.map +1 -0
- package/lib/test/joinSessionPeriodicCall.spec.js +158 -0
- package/lib/test/joinSessionPeriodicCall.spec.js.map +1 -0
- package/lib/test/jsonSnapshotFormatTests.spec.js +107 -0
- package/lib/test/jsonSnapshotFormatTests.spec.js.map +1 -0
- package/lib/test/localOdspDriver.spec.js +177 -0
- package/lib/test/localOdspDriver.spec.js.map +1 -0
- package/lib/test/mockFetch.js +61 -0
- package/lib/test/mockFetch.js.map +1 -0
- package/lib/test/odspCreateContainer.spec.js +116 -0
- package/lib/test/odspCreateContainer.spec.js.map +1 -0
- package/lib/test/odspDriverResolverTest.spec.js +289 -0
- package/lib/test/odspDriverResolverTest.spec.js.map +1 -0
- package/lib/test/odspDriverUrlResolverForShareLink.spec.js +287 -0
- package/lib/test/odspDriverUrlResolverForShareLink.spec.js.map +1 -0
- package/lib/test/odspError.spec.js +299 -0
- package/lib/test/odspError.spec.js.map +1 -0
- package/lib/test/opsCaching.spec.js +357 -0
- package/lib/test/opsCaching.spec.js.map +1 -0
- package/lib/test/prefetchSnapshotTests.spec.js +420 -0
- package/lib/test/prefetchSnapshotTests.spec.js.map +1 -0
- package/lib/test/snapshotFormatTests.spec.js +218 -0
- package/lib/test/snapshotFormatTests.spec.js.map +1 -0
- package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js +152 -0
- package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js.map +1 -0
- package/lib/test/socketTests/socketMock.js +109 -0
- package/lib/test/socketTests/socketMock.js.map +1 -0
- package/lib/test/socketTests/socketTests.spec.js +256 -0
- package/lib/test/socketTests/socketTests.spec.js.map +1 -0
- package/lib/test/tokenFetch.spec.js +39 -0
- package/lib/test/tokenFetch.spec.js.map +1 -0
- package/lib/test/types/validateOdspDriverPrevious.generated.js +96 -0
- package/lib/test/types/validateOdspDriverPrevious.generated.js.map +1 -0
- package/lib/test/zipItDataRepresentationTests.spec.js +207 -0
- package/lib/test/zipItDataRepresentationTests.spec.js.map +1 -0
- package/lib/{vroom.d.mts → vroom.d.ts} +3 -3
- package/lib/vroom.d.ts.map +1 -0
- package/lib/{vroom.mjs → vroom.js} +4 -4
- package/lib/vroom.js.map +1 -0
- package/lib/{zipItDataRepresentationUtils.d.mts → zipItDataRepresentationUtils.d.ts} +2 -2
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -0
- package/lib/{zipItDataRepresentationUtils.mjs → zipItDataRepresentationUtils.js} +19 -11
- package/lib/zipItDataRepresentationUtils.js.map +1 -0
- package/package.json +100 -32
- package/src/ReadBufferUtils.ts +7 -7
- package/src/WriteBufferUtils.ts +13 -9
- package/src/checkUrl.ts +4 -2
- package/src/compactSnapshotParser.ts +97 -61
- package/src/compactSnapshotWriter.ts +22 -15
- package/src/contracts.ts +33 -4
- package/src/createFile.ts +26 -51
- package/src/createNewContainerOnExistingFile.ts +10 -10
- package/src/createNewModule.ts +2 -2
- package/src/createNewUtils.ts +26 -15
- package/src/createOdspCreateContainerRequest.ts +3 -3
- package/src/createOdspUrl.ts +1 -1
- package/src/epochTracker.ts +93 -58
- package/src/fetchSnapshot.ts +122 -66
- package/src/getFileLink.ts +24 -16
- package/src/getQueryString.ts +2 -0
- package/src/index.ts +27 -19
- package/src/localOdspDriver/localOdspDocumentService.ts +12 -5
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +12 -11
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +15 -8
- package/src/odspCache.ts +14 -11
- package/src/odspDelayLoadedDeltaStream.ts +113 -31
- package/src/odspDeltaStorageService.ts +17 -16
- package/src/odspDocumentDeltaConnection.ts +52 -34
- package/src/odspDocumentService.ts +33 -22
- package/src/odspDocumentServiceFactory.ts +7 -2
- package/src/odspDocumentServiceFactoryCore.ts +28 -29
- package/src/odspDocumentServiceFactoryWithCodeSplit.ts +1 -1
- package/src/odspDocumentStorageManager.ts +303 -210
- package/src/odspDocumentStorageServiceBase.ts +52 -47
- package/src/odspDriverUrlResolver.ts +41 -41
- package/src/odspDriverUrlResolverForShareLink.ts +50 -31
- package/src/odspError.ts +6 -7
- package/src/odspFluidFileLink.ts +3 -3
- package/src/odspLocationRedirection.ts +1 -1
- package/src/odspPublicUtils.ts +4 -0
- package/src/odspSnapshotParser.ts +9 -9
- package/src/odspSummaryUploadManager.ts +21 -9
- package/src/odspUrlHelper.ts +2 -3
- package/src/odspUtils.ts +102 -53
- package/src/opsCaching.ts +13 -12
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +24 -15
- package/src/retryErrorsStorageAdapter.ts +16 -9
- package/src/retryUtils.ts +8 -4
- package/src/socketModule.ts +2 -0
- package/src/vroom.ts +6 -6
- package/src/zipItDataRepresentationUtils.ts +65 -37
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/.eslintrc.js +0 -18
- package/lib/ReadBufferUtils.d.mts.map +0 -1
- package/lib/ReadBufferUtils.mjs.map +0 -1
- package/lib/WriteBufferUtils.d.mts.map +0 -1
- package/lib/WriteBufferUtils.mjs.map +0 -1
- package/lib/checkUrl.d.mts.map +0 -1
- package/lib/checkUrl.mjs.map +0 -1
- package/lib/compactSnapshotParser.d.mts.map +0 -1
- package/lib/compactSnapshotParser.mjs.map +0 -1
- package/lib/compactSnapshotWriter.d.mts.map +0 -1
- package/lib/compactSnapshotWriter.mjs.map +0 -1
- package/lib/constants.d.mts.map +0 -1
- package/lib/constants.mjs.map +0 -1
- package/lib/contracts.d.mts.map +0 -1
- package/lib/contracts.mjs +0 -6
- package/lib/contracts.mjs.map +0 -1
- package/lib/contractsPublic.d.mts.map +0 -1
- package/lib/contractsPublic.mjs.map +0 -1
- package/lib/createFile.d.mts.map +0 -1
- package/lib/createFile.mjs.map +0 -1
- package/lib/createNewContainerOnExistingFile.d.mts.map +0 -1
- package/lib/createNewContainerOnExistingFile.mjs.map +0 -1
- package/lib/createNewModule.d.mts.map +0 -1
- package/lib/createNewModule.mjs.map +0 -1
- package/lib/createNewUtils.d.mts.map +0 -1
- package/lib/createNewUtils.mjs.map +0 -1
- package/lib/createOdspCreateContainerRequest.d.mts.map +0 -1
- package/lib/createOdspCreateContainerRequest.mjs.map +0 -1
- package/lib/createOdspUrl.d.mts.map +0 -1
- package/lib/createOdspUrl.mjs.map +0 -1
- package/lib/epochTracker.d.mts.map +0 -1
- package/lib/epochTracker.mjs.map +0 -1
- package/lib/fetch.d.mts.map +0 -1
- package/lib/fetch.mjs.map +0 -1
- package/lib/fetchSnapshot.d.mts.map +0 -1
- package/lib/fetchSnapshot.mjs.map +0 -1
- package/lib/getFileLink.d.mts.map +0 -1
- package/lib/getFileLink.mjs.map +0 -1
- package/lib/getQueryString.d.mts.map +0 -1
- package/lib/getQueryString.mjs.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.d.mts.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -22
- package/lib/index.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +0 -1
- package/lib/odspCache.d.mts.map +0 -1
- package/lib/odspCache.mjs.map +0 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts.map +0 -1
- package/lib/odspDelayLoadedDeltaStream.mjs.map +0 -1
- package/lib/odspDeltaStorageService.d.mts.map +0 -1
- package/lib/odspDeltaStorageService.mjs.map +0 -1
- package/lib/odspDocumentDeltaConnection.d.mts.map +0 -1
- package/lib/odspDocumentDeltaConnection.mjs.map +0 -1
- package/lib/odspDocumentService.d.mts.map +0 -1
- package/lib/odspDocumentService.mjs.map +0 -1
- package/lib/odspDocumentServiceFactory.d.mts.map +0 -1
- package/lib/odspDocumentServiceFactory.mjs.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.d.mts.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.mjs.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +0 -1
- package/lib/odspDocumentStorageManager.d.mts.map +0 -1
- package/lib/odspDocumentStorageManager.mjs.map +0 -1
- package/lib/odspDocumentStorageServiceBase.d.mts.map +0 -1
- package/lib/odspDocumentStorageServiceBase.mjs.map +0 -1
- package/lib/odspDriverUrlResolver.d.mts.map +0 -1
- package/lib/odspDriverUrlResolver.mjs.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.d.mts.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.mjs.map +0 -1
- package/lib/odspError.d.mts.map +0 -1
- package/lib/odspError.mjs.map +0 -1
- package/lib/odspFluidFileLink.d.mts.map +0 -1
- package/lib/odspFluidFileLink.mjs.map +0 -1
- package/lib/odspLocationRedirection.d.mts.map +0 -1
- package/lib/odspLocationRedirection.mjs.map +0 -1
- package/lib/odspPublicUtils.d.mts.map +0 -1
- package/lib/odspPublicUtils.mjs.map +0 -1
- package/lib/odspSnapshotParser.d.mts.map +0 -1
- package/lib/odspSnapshotParser.mjs.map +0 -1
- package/lib/odspSummaryUploadManager.d.mts.map +0 -1
- package/lib/odspSummaryUploadManager.mjs.map +0 -1
- package/lib/odspUrlHelper.d.mts.map +0 -1
- package/lib/odspUrlHelper.mjs.map +0 -1
- package/lib/odspUtils.d.mts.map +0 -1
- package/lib/odspUtils.mjs.map +0 -1
- package/lib/opsCaching.d.mts.map +0 -1
- package/lib/opsCaching.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/prefetchLatestSnapshot.d.mts.map +0 -1
- package/lib/prefetchLatestSnapshot.mjs.map +0 -1
- package/lib/retryErrorsStorageAdapter.d.mts.map +0 -1
- package/lib/retryErrorsStorageAdapter.mjs.map +0 -1
- package/lib/retryUtils.d.mts.map +0 -1
- package/lib/retryUtils.mjs.map +0 -1
- package/lib/socketModule.d.mts.map +0 -1
- package/lib/socketModule.mjs.map +0 -1
- package/lib/vroom.d.mts.map +0 -1
- package/lib/vroom.mjs.map +0 -1
- package/lib/zipItDataRepresentationUtils.d.mts.map +0 -1
- package/lib/zipItDataRepresentationUtils.mjs.map +0 -1
|
@@ -13,13 +13,13 @@ const driver_base_1 = require("@fluidframework/driver-base");
|
|
|
13
13
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
14
14
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
15
15
|
const odsp_driver_definitions_1 = require("@fluidframework/odsp-driver-definitions");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
16
|
+
const fetchSnapshot_js_1 = require("./fetchSnapshot.js");
|
|
17
|
+
const getUrlAndHeadersWithAuth_js_1 = require("./getUrlAndHeadersWithAuth.js");
|
|
18
|
+
const odspUtils_js_1 = require("./odspUtils.js");
|
|
19
|
+
const packageVersion_js_1 = require("./packageVersion.js");
|
|
20
|
+
const odspDocumentStorageServiceBase_js_1 = require("./odspDocumentStorageServiceBase.js");
|
|
21
21
|
exports.defaultSummarizerCacheExpiryTimeout = 60 * 1000; // 60 seconds.
|
|
22
|
-
class OdspDocumentStorageService extends
|
|
22
|
+
class OdspDocumentStorageService extends odspDocumentStorageServiceBase_js_1.OdspDocumentStorageServiceBase {
|
|
23
23
|
constructor(odspResolvedUrl, getStorageToken, logger, fetchFullSnapshot, cache, hostPolicy, epochTracker, flushCallback, relayServiceTenantAndSessionId, snapshotFormatFetchType) {
|
|
24
24
|
super((0, telemetry_utils_1.loggerToMonitoringContext)(logger).config);
|
|
25
25
|
this.odspResolvedUrl = odspResolvedUrl;
|
|
@@ -33,7 +33,7 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
33
33
|
this.relayServiceTenantAndSessionId = relayServiceTenantAndSessionId;
|
|
34
34
|
this.snapshotFormatFetchType = snapshotFormatFetchType;
|
|
35
35
|
this.odspSummaryModuleLoaded = false;
|
|
36
|
-
this.
|
|
36
|
+
this.firstSnapshotFetchCall = true;
|
|
37
37
|
// Driver specified limits for snapshot size and time.
|
|
38
38
|
/**
|
|
39
39
|
* NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to
|
|
@@ -54,9 +54,9 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
54
54
|
}
|
|
55
55
|
async createBlob(file) {
|
|
56
56
|
this.checkAttachmentPOSTUrl();
|
|
57
|
-
const response = await (0,
|
|
57
|
+
const response = await (0, odspUtils_js_1.getWithRetryForTokenRefresh)(async (options) => {
|
|
58
58
|
const storageToken = await this.getStorageToken(options, "CreateBlob");
|
|
59
|
-
const { url, headers } = (0,
|
|
59
|
+
const { url, headers } = (0, getUrlAndHeadersWithAuth_js_1.getUrlAndHeadersWithAuth)(`${this.attachmentPOSTUrl}/content`, storageToken, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader);
|
|
60
60
|
headers["Content-Type"] = "application/octet-stream";
|
|
61
61
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, {
|
|
62
62
|
eventName: "createBlob",
|
|
@@ -79,15 +79,15 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
79
79
|
}
|
|
80
80
|
async fetchBlobFromStorage(blobId, evicted) {
|
|
81
81
|
this.checkAttachmentGETUrl();
|
|
82
|
-
const blob = await (0,
|
|
82
|
+
const blob = await (0, odspUtils_js_1.getWithRetryForTokenRefresh)(async (options) => {
|
|
83
83
|
const storageToken = await this.getStorageToken(options, "GetBlob");
|
|
84
84
|
const unAuthedUrl = `${this.attachmentGETUrl}/${encodeURIComponent(blobId)}/content`;
|
|
85
|
-
const { url, headers } = (0,
|
|
85
|
+
const { url, headers } = (0, getUrlAndHeadersWithAuth_js_1.getUrlAndHeadersWithAuth)(unAuthedUrl, storageToken, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader);
|
|
86
86
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, {
|
|
87
87
|
eventName: "readDataBlob",
|
|
88
88
|
blobId,
|
|
89
89
|
evicted,
|
|
90
|
-
headers: Object.keys(headers).length
|
|
90
|
+
headers: Object.keys(headers).length > 0 ? true : undefined,
|
|
91
91
|
waitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,
|
|
92
92
|
}, async (event) => {
|
|
93
93
|
const res = await this.epochTracker.fetchArray(url, { headers }, "blob");
|
|
@@ -114,10 +114,186 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
114
114
|
}
|
|
115
115
|
async getSnapshotTree(version, scenarioName) {
|
|
116
116
|
if (!this.snapshotUrl) {
|
|
117
|
+
// eslint-disable-next-line unicorn/no-null
|
|
117
118
|
return null;
|
|
118
119
|
}
|
|
119
120
|
return super.getSnapshotTree(version, scenarioName);
|
|
120
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Fetches and returns the snapshot. If no loadingGroupIds or empty loadingGroupIds is provided, then snapshot for all
|
|
124
|
+
* ungrouped data will be provided.
|
|
125
|
+
* @param snapshotFetchOptions - fetch options for snapshot.
|
|
126
|
+
*/
|
|
127
|
+
async getSnapshot(snapshotFetchOptions) {
|
|
128
|
+
// Don't consult cache if request is not for a particular loading group.
|
|
129
|
+
const { snapshot } = await this.fetchSnapshot({
|
|
130
|
+
...snapshotFetchOptions,
|
|
131
|
+
fetchSource: (0, odspUtils_js_1.isSnapshotFetchForLoadingGroup)(snapshotFetchOptions?.loadingGroupIds)
|
|
132
|
+
? driver_definitions_1.FetchSource.noCache
|
|
133
|
+
: snapshotFetchOptions?.fetchSource,
|
|
134
|
+
loadingGroupIds: snapshotFetchOptions?.loadingGroupIds ?? [],
|
|
135
|
+
});
|
|
136
|
+
return {
|
|
137
|
+
...snapshot,
|
|
138
|
+
snapshotTree: this.combineProtocolAndAppSnapshotTree(snapshot.snapshotTree),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async fetchSnapshot(snapshotFetchOptions) {
|
|
142
|
+
const hostSnapshotOptions = this.hostPolicy.snapshotOptions;
|
|
143
|
+
const odspSnapshotCacheValue = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, {
|
|
144
|
+
eventName: (0, odspUtils_js_1.isSnapshotFetchForLoadingGroup)(snapshotFetchOptions.loadingGroupIds)
|
|
145
|
+
? "ObtainSnapshotForGroup"
|
|
146
|
+
: "ObtainSnapshot",
|
|
147
|
+
fetchSource: snapshotFetchOptions?.fetchSource,
|
|
148
|
+
}, async (event) => {
|
|
149
|
+
const props = {};
|
|
150
|
+
let cacheLookupTimeInSerialFetch = 0;
|
|
151
|
+
let retrievedSnapshot;
|
|
152
|
+
let method;
|
|
153
|
+
let prefetchWaitStartTime = client_utils_1.performance.now();
|
|
154
|
+
if (snapshotFetchOptions.fetchSource === driver_definitions_1.FetchSource.noCache) {
|
|
155
|
+
retrievedSnapshot = await this.fetchSnapshotFromNetwork(hostSnapshotOptions, snapshotFetchOptions.loadingGroupIds, snapshotFetchOptions.scenarioName);
|
|
156
|
+
method = "networkOnly";
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// Here's the logic to grab the persistent cache snapshot implemented by the host
|
|
160
|
+
// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions
|
|
161
|
+
const cachedSnapshotP = this.epochTracker
|
|
162
|
+
.get((0, odspUtils_js_1.createCacheSnapshotKey)(this.odspResolvedUrl))
|
|
163
|
+
.then(async (
|
|
164
|
+
// eslint-disable-next-line import/no-deprecated
|
|
165
|
+
snapshotCachedEntry) => {
|
|
166
|
+
if (snapshotCachedEntry !== undefined) {
|
|
167
|
+
// If the cached entry does not contain the entry time, then assign it a default of 30 days old.
|
|
168
|
+
const age = Date.now() -
|
|
169
|
+
(snapshotCachedEntry.cacheEntryTime ??
|
|
170
|
+
Date.now() - 30 * 24 * 60 * 60 * 1000);
|
|
171
|
+
// In order to decrease the number of times we have to execute a snapshot refresh,
|
|
172
|
+
// if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,
|
|
173
|
+
// force the network retrieval instead as there might be a more recent snapshot available.
|
|
174
|
+
// See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.
|
|
175
|
+
if (this.hostPolicy.summarizerClient) {
|
|
176
|
+
if (age > exports.defaultSummarizerCacheExpiryTimeout) {
|
|
177
|
+
props.cacheSummarizerExpired = true;
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
props.cacheSummarizerExpired = false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Record the cache age
|
|
185
|
+
props.cacheEntryAge = age;
|
|
186
|
+
// Snapshot from cache could be in older format, so transform that before returning.
|
|
187
|
+
if ((0, odspUtils_js_1.isInstanceOfISnapshot)(snapshotCachedEntry)) {
|
|
188
|
+
return snapshotCachedEntry;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const snapshot = {
|
|
192
|
+
snapshotTree: snapshotCachedEntry.snapshotTree,
|
|
193
|
+
blobContents: snapshotCachedEntry.blobs,
|
|
194
|
+
ops: snapshotCachedEntry.ops,
|
|
195
|
+
latestSequenceNumber: snapshotCachedEntry.latestSequenceNumber,
|
|
196
|
+
sequenceNumber: snapshotCachedEntry.sequenceNumber,
|
|
197
|
+
snapshotFormatV: 1,
|
|
198
|
+
};
|
|
199
|
+
return snapshot;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
// Based on the concurrentSnapshotFetch policy:
|
|
204
|
+
// Either retrieve both the network and cache snapshots concurrently and pick the first to return,
|
|
205
|
+
// or grab the cache value and then the network value if the cache value returns undefined.
|
|
206
|
+
// For summarizer which could call this during refreshing of summary parent, always use the cache
|
|
207
|
+
// first. Also for other clients, if it is not critical path which is determined by firstSnapshotFetchCall,
|
|
208
|
+
// then also check the cache first.
|
|
209
|
+
if (this.firstSnapshotFetchCall &&
|
|
210
|
+
this.hostPolicy.concurrentSnapshotFetch &&
|
|
211
|
+
!this.hostPolicy.summarizerClient) {
|
|
212
|
+
const networkSnapshotP = this.fetchSnapshotFromNetwork(hostSnapshotOptions, snapshotFetchOptions.loadingGroupIds, snapshotFetchOptions.scenarioName);
|
|
213
|
+
// Ensure that failures on both paths are ignored initially.
|
|
214
|
+
// I.e. if cache fails for some reason, we will proceed with network result.
|
|
215
|
+
// And vice versa - if (for example) client is offline and network request fails first, we
|
|
216
|
+
// do want to attempt to succeed with cached data!
|
|
217
|
+
const promiseRaceWinner = await (0, driver_base_1.promiseRaceWithWinner)([
|
|
218
|
+
cachedSnapshotP.catch(() => undefined),
|
|
219
|
+
networkSnapshotP.catch(() => undefined),
|
|
220
|
+
]);
|
|
221
|
+
retrievedSnapshot = promiseRaceWinner.value;
|
|
222
|
+
method = promiseRaceWinner.index === 0 ? "cache" : "network";
|
|
223
|
+
if (retrievedSnapshot === undefined) {
|
|
224
|
+
// if network failed -> wait for cache ( then return network failure)
|
|
225
|
+
// If cache returned empty or failed -> wait for network (success of failure)
|
|
226
|
+
try {
|
|
227
|
+
if (promiseRaceWinner.index === 1) {
|
|
228
|
+
retrievedSnapshot = await cachedSnapshotP;
|
|
229
|
+
method = "cache";
|
|
230
|
+
}
|
|
231
|
+
if (retrievedSnapshot === undefined) {
|
|
232
|
+
retrievedSnapshot = await networkSnapshotP;
|
|
233
|
+
method = "network";
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
// The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:
|
|
238
|
+
// they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--
|
|
239
|
+
// see https://v8.dev/docs/stack-trace-api#async-stack-traces and the "zero-cost async stack traces" document
|
|
240
|
+
// linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.
|
|
241
|
+
// Regenerating the stack at this level provides more information for logged errors.
|
|
242
|
+
// Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and
|
|
243
|
+
// get similar quality stacks with less hand-crafted code.
|
|
244
|
+
const innerStack = error.stack;
|
|
245
|
+
const normalizedError = (0, telemetry_utils_1.normalizeError)(error);
|
|
246
|
+
normalizedError.addTelemetryProperties({ innerStack });
|
|
247
|
+
const newStack = `<<STACK TRUNCATED: see innerStack property>> \n${(0, telemetry_utils_1.generateStack)()}`;
|
|
248
|
+
(0, telemetry_utils_1.overwriteStack)(normalizedError, newStack);
|
|
249
|
+
throw normalizedError;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
// Note: There's a race condition here - another caller may come past the undefined check
|
|
255
|
+
// while the first caller is awaiting later async code in this block.
|
|
256
|
+
const startTime = client_utils_1.performance.now();
|
|
257
|
+
retrievedSnapshot = await cachedSnapshotP;
|
|
258
|
+
cacheLookupTimeInSerialFetch = client_utils_1.performance.now() - startTime;
|
|
259
|
+
method = retrievedSnapshot === undefined ? "network" : "cache";
|
|
260
|
+
if (retrievedSnapshot === undefined) {
|
|
261
|
+
prefetchWaitStartTime = client_utils_1.performance.now();
|
|
262
|
+
retrievedSnapshot = await this.fetchSnapshotFromNetwork(hostSnapshotOptions, snapshotFetchOptions.loadingGroupIds, snapshotFetchOptions.scenarioName);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (method === "network") {
|
|
267
|
+
props.cacheEntryAge = undefined;
|
|
268
|
+
}
|
|
269
|
+
if (this.firstSnapshotFetchCall) {
|
|
270
|
+
this._isFirstSnapshotFromNetwork = method === "cache" ? false : true;
|
|
271
|
+
}
|
|
272
|
+
const prefetchStartTime = retrievedSnapshot.prefetchStartTime;
|
|
273
|
+
event.end({
|
|
274
|
+
...props,
|
|
275
|
+
method,
|
|
276
|
+
fetchSnapshotForInitialLoad: this.firstSnapshotFetchCall,
|
|
277
|
+
useLegacyFlowWithoutGroups: (0, odspUtils_js_1.useLegacyFlowWithoutGroupsForSnapshotFetch)(snapshotFetchOptions.loadingGroupIds),
|
|
278
|
+
avoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,
|
|
279
|
+
...(0, fetchSnapshot_js_1.evalBlobsAndTrees)(retrievedSnapshot),
|
|
280
|
+
cacheLookupTimeInSerialFetch,
|
|
281
|
+
prefetchSavedDuration: prefetchStartTime !== undefined && method !== "cache"
|
|
282
|
+
? prefetchWaitStartTime - prefetchStartTime
|
|
283
|
+
: undefined,
|
|
284
|
+
});
|
|
285
|
+
return retrievedSnapshot;
|
|
286
|
+
});
|
|
287
|
+
const stTime = client_utils_1.performance.now();
|
|
288
|
+
// Don't override ops which were fetched during initial load, since we could still need them.
|
|
289
|
+
const id = this.initializeFromSnapshot(odspSnapshotCacheValue, this.firstSnapshotFetchCall, snapshotFetchOptions?.cacheSnapshot ?? this.firstSnapshotFetchCall);
|
|
290
|
+
this.logger.sendTelemetryEvent({
|
|
291
|
+
eventName: "SnapshotInitializeTime",
|
|
292
|
+
duration: client_utils_1.performance.now() - stTime,
|
|
293
|
+
}, undefined, core_interfaces_1.LogLevel.verbose);
|
|
294
|
+
this.firstSnapshotFetchCall = false;
|
|
295
|
+
return { snapshot: odspSnapshotCacheValue, id };
|
|
296
|
+
}
|
|
121
297
|
async getVersions(
|
|
122
298
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
123
299
|
blobid, count, scenarioName, fetchSource) {
|
|
@@ -140,152 +316,28 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
140
316
|
}
|
|
141
317
|
// 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
|
|
142
318
|
if (count === 1 && (blobid === null || blobid === this.documentId)) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
let method;
|
|
149
|
-
let prefetchWaitStartTime = client_utils_1.performance.now();
|
|
150
|
-
if (fetchSource === driver_definitions_1.FetchSource.noCache) {
|
|
151
|
-
retrievedSnapshot = await this.fetchSnapshot(hostSnapshotOptions, scenarioName);
|
|
152
|
-
method = "networkOnly";
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
// Here's the logic to grab the persistent cache snapshot implemented by the host
|
|
156
|
-
// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions
|
|
157
|
-
const cachedSnapshotP = this.epochTracker
|
|
158
|
-
.get((0, odspUtils_1.createCacheSnapshotKey)(this.odspResolvedUrl))
|
|
159
|
-
.then(async (snapshotCachedEntry) => {
|
|
160
|
-
if (snapshotCachedEntry !== undefined) {
|
|
161
|
-
// If the cached entry does not contain the entry time, then assign it a default of 30 days old.
|
|
162
|
-
const age = Date.now() -
|
|
163
|
-
(snapshotCachedEntry.cacheEntryTime ??
|
|
164
|
-
Date.now() - 30 * 24 * 60 * 60 * 1000);
|
|
165
|
-
// In order to decrease the number of times we have to execute a snapshot refresh,
|
|
166
|
-
// if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,
|
|
167
|
-
// force the network retrieval instead as there might be a more recent snapshot available.
|
|
168
|
-
// See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.
|
|
169
|
-
if (this.hostPolicy.summarizerClient) {
|
|
170
|
-
if (age > exports.defaultSummarizerCacheExpiryTimeout) {
|
|
171
|
-
props.cacheSummarizerExpired = true;
|
|
172
|
-
return undefined;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
props.cacheSummarizerExpired = false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
// Record the cache age
|
|
179
|
-
props.cacheEntryAge = age;
|
|
180
|
-
}
|
|
181
|
-
return snapshotCachedEntry;
|
|
182
|
-
});
|
|
183
|
-
// Based on the concurrentSnapshotFetch policy:
|
|
184
|
-
// Either retrieve both the network and cache snapshots concurrently and pick the first to return,
|
|
185
|
-
// or grab the cache value and then the network value if the cache value returns undefined.
|
|
186
|
-
// For summarizer which could call this during refreshing of summary parent, always use the cache
|
|
187
|
-
// first. Also for other clients, if it is not critical path which is determined by firstVersionCall,
|
|
188
|
-
// then also check the cache first.
|
|
189
|
-
if (this.firstVersionCall &&
|
|
190
|
-
this.hostPolicy.concurrentSnapshotFetch &&
|
|
191
|
-
!this.hostPolicy.summarizerClient) {
|
|
192
|
-
const networkSnapshotP = this.fetchSnapshot(hostSnapshotOptions, scenarioName);
|
|
193
|
-
// Ensure that failures on both paths are ignored initially.
|
|
194
|
-
// I.e. if cache fails for some reason, we will proceed with network result.
|
|
195
|
-
// And vice versa - if (for example) client is offline and network request fails first, we
|
|
196
|
-
// do want to attempt to succeed with cached data!
|
|
197
|
-
const promiseRaceWinner = await (0, driver_base_1.promiseRaceWithWinner)([
|
|
198
|
-
cachedSnapshotP.catch(() => undefined),
|
|
199
|
-
networkSnapshotP.catch(() => undefined),
|
|
200
|
-
]);
|
|
201
|
-
retrievedSnapshot = promiseRaceWinner.value;
|
|
202
|
-
method = promiseRaceWinner.index === 0 ? "cache" : "network";
|
|
203
|
-
if (retrievedSnapshot === undefined) {
|
|
204
|
-
// if network failed -> wait for cache ( then return network failure)
|
|
205
|
-
// If cache returned empty or failed -> wait for network (success of failure)
|
|
206
|
-
try {
|
|
207
|
-
if (promiseRaceWinner.index === 1) {
|
|
208
|
-
retrievedSnapshot = await cachedSnapshotP;
|
|
209
|
-
method = "cache";
|
|
210
|
-
}
|
|
211
|
-
if (retrievedSnapshot === undefined) {
|
|
212
|
-
retrievedSnapshot = await networkSnapshotP;
|
|
213
|
-
method = "network";
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
catch (err) {
|
|
217
|
-
// The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:
|
|
218
|
-
// they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--
|
|
219
|
-
// see https://v8.dev/docs/stack-trace-api#async-stack-traces and the "zero-cost async stack traces" document
|
|
220
|
-
// linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.
|
|
221
|
-
// Regenerating the stack at this level provides more information for logged errors.
|
|
222
|
-
// Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and
|
|
223
|
-
// get similar quality stacks with less hand-crafted code.
|
|
224
|
-
const innerStack = err.stack;
|
|
225
|
-
const normalizedError = (0, telemetry_utils_1.normalizeError)(err);
|
|
226
|
-
normalizedError.addTelemetryProperties({ innerStack });
|
|
227
|
-
const newStack = `<<STACK TRUNCATED: see innerStack property>> \n${(0, telemetry_utils_1.generateStack)()}`;
|
|
228
|
-
(0, telemetry_utils_1.overwriteStack)(normalizedError, newStack);
|
|
229
|
-
throw normalizedError;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
// Note: There's a race condition here - another caller may come past the undefined check
|
|
235
|
-
// while the first caller is awaiting later async code in this block.
|
|
236
|
-
const startTime = client_utils_1.performance.now();
|
|
237
|
-
retrievedSnapshot = await cachedSnapshotP;
|
|
238
|
-
cacheLookupTimeInSerialFetch = client_utils_1.performance.now() - startTime;
|
|
239
|
-
method = retrievedSnapshot !== undefined ? "cache" : "network";
|
|
240
|
-
if (retrievedSnapshot === undefined) {
|
|
241
|
-
prefetchWaitStartTime = client_utils_1.performance.now();
|
|
242
|
-
retrievedSnapshot = await this.fetchSnapshot(hostSnapshotOptions, scenarioName);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
if (method === "network") {
|
|
247
|
-
props.cacheEntryAge = undefined;
|
|
248
|
-
}
|
|
249
|
-
if (this.firstVersionCall) {
|
|
250
|
-
this._isFirstSnapshotFromNetwork = method === "cache" ? false : true;
|
|
251
|
-
}
|
|
252
|
-
const prefetchStartTime = retrievedSnapshot.prefetchStartTime;
|
|
253
|
-
event.end({
|
|
254
|
-
...props,
|
|
255
|
-
method,
|
|
256
|
-
avoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,
|
|
257
|
-
...(0, fetchSnapshot_1.evalBlobsAndTrees)(retrievedSnapshot),
|
|
258
|
-
cacheLookupTimeInSerialFetch,
|
|
259
|
-
prefetchSavedDuration: prefetchStartTime !== undefined && method !== "cache"
|
|
260
|
-
? prefetchWaitStartTime - prefetchStartTime
|
|
261
|
-
: undefined,
|
|
262
|
-
});
|
|
263
|
-
return retrievedSnapshot;
|
|
319
|
+
const { id } = await this.fetchSnapshot({
|
|
320
|
+
cacheSnapshot: true,
|
|
321
|
+
scenarioName,
|
|
322
|
+
versionId: blobid ?? undefined,
|
|
323
|
+
fetchSource,
|
|
264
324
|
});
|
|
265
|
-
const stTime = client_utils_1.performance.now();
|
|
266
|
-
// Don't override ops which were fetched during initial load, since we could still need them.
|
|
267
|
-
const id = this.initializeFromSnapshot(odspSnapshotCacheValue, this.firstVersionCall);
|
|
268
|
-
this.logger.sendTelemetryEvent({
|
|
269
|
-
eventName: "SnapshotInitializeTime",
|
|
270
|
-
duration: client_utils_1.performance.now() - stTime,
|
|
271
|
-
}, undefined, core_interfaces_1.LogLevel.verbose);
|
|
272
|
-
this.firstVersionCall = false;
|
|
273
325
|
return id ? [{ id, treeId: undefined }] : [];
|
|
274
326
|
}
|
|
275
|
-
return (0,
|
|
327
|
+
return (0, odspUtils_js_1.getWithRetryForTokenRefresh)(async (options) => {
|
|
276
328
|
const storageToken = await this.getStorageToken(options, "GetVersions");
|
|
277
|
-
const { url, headers } = (0,
|
|
329
|
+
const { url, headers } = (0, getUrlAndHeadersWithAuth_js_1.getUrlAndHeadersWithAuth)(`${this.snapshotUrl}/versions?top=${count}`, storageToken, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader);
|
|
278
330
|
// Fetch the latest snapshot versions for the document
|
|
279
331
|
const response = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, {
|
|
280
332
|
eventName: "getVersions",
|
|
281
|
-
headers: Object.keys(headers).length
|
|
333
|
+
headers: Object.keys(headers).length > 0 ? true : undefined,
|
|
282
334
|
}, async () => this.epochTracker.fetchAndParseAsJSON(url, { headers }, "versions", undefined, scenarioName));
|
|
283
335
|
const versionsResponse = response.content;
|
|
284
336
|
if (!versionsResponse) {
|
|
285
|
-
throw new driver_utils_1.NonRetryableError("No response from /versions endpoint",
|
|
337
|
+
throw new driver_utils_1.NonRetryableError("No response from /versions endpoint", odsp_driver_definitions_1.OdspErrorTypes.genericNetworkError, { driverVersion: packageVersion_js_1.pkgVersion });
|
|
286
338
|
}
|
|
287
339
|
if (!Array.isArray(versionsResponse.value)) {
|
|
288
|
-
throw new driver_utils_1.NonRetryableError("Incorrect response from /versions endpoint, expected an array",
|
|
340
|
+
throw new driver_utils_1.NonRetryableError("Incorrect response from /versions endpoint, expected an array", odsp_driver_definitions_1.OdspErrorTypes.genericNetworkError, { driverVersion: packageVersion_js_1.pkgVersion });
|
|
289
341
|
}
|
|
290
342
|
return versionsResponse.value.map((version) => {
|
|
291
343
|
return {
|
|
@@ -295,23 +347,25 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
295
347
|
});
|
|
296
348
|
});
|
|
297
349
|
}
|
|
298
|
-
async
|
|
299
|
-
return this.
|
|
350
|
+
async fetchSnapshotFromNetwork(hostSnapshotOptions, loadingGroupIds, scenarioName) {
|
|
351
|
+
return this.fetchSnapshotFromNetworkCore(hostSnapshotOptions, loadingGroupIds, scenarioName).catch((error) => {
|
|
300
352
|
// Issue #5895:
|
|
301
353
|
// If we are offline, this error is retryable. But that means that RetriableDocumentStorageService
|
|
302
354
|
// will run in circles calling getSnapshotTree, which would result in OdspDocumentStorageService class
|
|
303
355
|
// going getVersions / individual blob download path. This path is very slow, and will not work with
|
|
304
356
|
// delay-loaded data stores and ODSP storage deleting old snapshots and blobs.
|
|
305
357
|
if (typeof error === "object" && error !== null) {
|
|
358
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
306
359
|
error.canRetry = false;
|
|
307
360
|
}
|
|
308
361
|
throw error;
|
|
309
362
|
});
|
|
310
363
|
}
|
|
311
|
-
async
|
|
312
|
-
// Don't look into cache, if the host specifically tells us so.
|
|
313
|
-
|
|
314
|
-
|
|
364
|
+
async fetchSnapshotFromNetworkCore(hostSnapshotOptions, loadingGroupIds, scenarioName) {
|
|
365
|
+
// Don't look into cache, if the host specifically tells us so. Also, if request is
|
|
366
|
+
// for initial snapshot, don't consult the prefetch cache.
|
|
367
|
+
if (!this.hostPolicy.avoidPrefetchSnapshotCache && this.firstSnapshotFetchCall) {
|
|
368
|
+
const prefetchCacheKey = (0, odsp_driver_definitions_1.getKeyForCacheEntry)((0, odspUtils_js_1.createCacheSnapshotKey)(this.odspResolvedUrl));
|
|
315
369
|
const result = await this.cache.snapshotPrefetchResultCache
|
|
316
370
|
?.get(prefetchCacheKey)
|
|
317
371
|
?.then(async (response) => {
|
|
@@ -321,11 +375,11 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
321
375
|
await this.epochTracker.validateEpoch(response.fluidEpoch, "treesLatest");
|
|
322
376
|
return response;
|
|
323
377
|
})
|
|
324
|
-
.catch(async (
|
|
378
|
+
.catch(async (error) => {
|
|
325
379
|
this.logger.sendTelemetryEvent({
|
|
326
380
|
eventName: "PrefetchSnapshotError",
|
|
327
381
|
concurrentSnapshotFetch: this.hostPolicy.concurrentSnapshotFetch,
|
|
328
|
-
},
|
|
382
|
+
}, error);
|
|
329
383
|
return undefined;
|
|
330
384
|
});
|
|
331
385
|
// If the prefetch call, is successful, then return the contents otherwise as backup for now, just
|
|
@@ -346,33 +400,36 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
346
400
|
snapshotOptions.mds = undefined;
|
|
347
401
|
snapshotOptions.timeout = undefined;
|
|
348
402
|
}
|
|
349
|
-
const snapshotDownloader = async (finalOdspResolvedUrl, storageToken, options, controller) => {
|
|
350
|
-
return (0,
|
|
403
|
+
const snapshotDownloader = async (finalOdspResolvedUrl, storageToken, loadingGroupId, options, controller) => {
|
|
404
|
+
return (0, fetchSnapshot_js_1.downloadSnapshot)(finalOdspResolvedUrl, storageToken, loadingGroupId, options, this.snapshotFormatFetchType, controller, this.epochTracker, scenarioName);
|
|
351
405
|
};
|
|
352
406
|
const putInCache = async (valueWithEpoch) => {
|
|
353
|
-
return this.cache.persistedCache.put((0,
|
|
407
|
+
return this.cache.persistedCache.put((0, odspUtils_js_1.createCacheSnapshotKey)(this.odspResolvedUrl),
|
|
354
408
|
// Epoch tracker will add the epoch and version to the value here. So just send value to cache.
|
|
355
409
|
valueWithEpoch.value);
|
|
356
410
|
};
|
|
357
411
|
const removeEntries = async () => this.cache.persistedCache.removeEntries();
|
|
358
412
|
try {
|
|
359
|
-
const odspSnapshot = await (0,
|
|
413
|
+
const odspSnapshot = await (0, fetchSnapshot_js_1.fetchSnapshotWithRedeem)(this.odspResolvedUrl, this.getStorageToken, snapshotOptions, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader, this.logger, snapshotDownloader, putInCache, removeEntries, loadingGroupIds, this.hostPolicy.enableRedeemFallback);
|
|
360
414
|
return odspSnapshot;
|
|
415
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
361
416
|
}
|
|
362
417
|
catch (error) {
|
|
418
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
363
419
|
const errorType = error.errorType;
|
|
364
420
|
// 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.
|
|
365
|
-
if (errorType === odsp_driver_definitions_1.
|
|
421
|
+
if (errorType === odsp_driver_definitions_1.OdspErrorTypes.snapshotTooBig &&
|
|
366
422
|
hostSnapshotOptions?.mds !== undefined &&
|
|
367
423
|
this.hostPolicy.summarizerClient !== true) {
|
|
368
424
|
throw error;
|
|
369
425
|
}
|
|
370
426
|
// 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.
|
|
371
|
-
if ((errorType === odsp_driver_definitions_1.
|
|
372
|
-
errorType === odsp_driver_definitions_1.
|
|
427
|
+
if ((errorType === odsp_driver_definitions_1.OdspErrorTypes.snapshotTooBig ||
|
|
428
|
+
errorType === odsp_driver_definitions_1.OdspErrorTypes.fetchTimeout) &&
|
|
373
429
|
snapshotOptions.blobs) {
|
|
374
430
|
this.logger.sendErrorEvent({
|
|
375
431
|
eventName: "TreeLatest_SecondCall",
|
|
432
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
376
433
|
errorType,
|
|
377
434
|
});
|
|
378
435
|
const snapshotOptionsWithoutBlobs = {
|
|
@@ -381,7 +438,7 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
381
438
|
mds: undefined,
|
|
382
439
|
timeout: undefined,
|
|
383
440
|
};
|
|
384
|
-
const odspSnapshot = await (0,
|
|
441
|
+
const odspSnapshot = await (0, fetchSnapshot_js_1.fetchSnapshotWithRedeem)(this.odspResolvedUrl, this.getStorageToken, snapshotOptionsWithoutBlobs, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader, this.logger, snapshotDownloader, putInCache, removeEntries, loadingGroupIds, this.hostPolicy.enableRedeemFallback);
|
|
385
442
|
return odspSnapshot;
|
|
386
443
|
}
|
|
387
444
|
throw error;
|
|
@@ -453,34 +510,34 @@ class OdspDocumentStorageService extends odspDocumentStorageServiceBase_1.OdspDo
|
|
|
453
510
|
}
|
|
454
511
|
checkSnapshotUrl() {
|
|
455
512
|
if (!this.snapshotUrl) {
|
|
456
|
-
throw new driver_utils_1.NonRetryableError("Method failed because no snapshot url was available",
|
|
513
|
+
throw new driver_utils_1.NonRetryableError("Method failed because no snapshot url was available", odsp_driver_definitions_1.OdspErrorTypes.genericError, { driverVersion: packageVersion_js_1.pkgVersion });
|
|
457
514
|
}
|
|
458
515
|
}
|
|
459
516
|
checkAttachmentPOSTUrl() {
|
|
460
517
|
if (!this.attachmentPOSTUrl) {
|
|
461
|
-
throw new driver_utils_1.NonRetryableError("Method failed because no attachment POST url was available",
|
|
518
|
+
throw new driver_utils_1.NonRetryableError("Method failed because no attachment POST url was available", odsp_driver_definitions_1.OdspErrorTypes.genericError, { driverVersion: packageVersion_js_1.pkgVersion });
|
|
462
519
|
}
|
|
463
520
|
}
|
|
464
521
|
checkAttachmentGETUrl() {
|
|
465
522
|
if (!this.attachmentGETUrl) {
|
|
466
|
-
throw new driver_utils_1.NonRetryableError("Method failed because no attachment GET url was available",
|
|
523
|
+
throw new driver_utils_1.NonRetryableError("Method failed because no attachment GET url was available", odsp_driver_definitions_1.OdspErrorTypes.genericError, { driverVersion: packageVersion_js_1.pkgVersion });
|
|
467
524
|
}
|
|
468
525
|
}
|
|
469
526
|
async fetchTreeFromSnapshot(id, scenarioName) {
|
|
470
|
-
return (0,
|
|
527
|
+
return (0, odspUtils_js_1.getWithRetryForTokenRefresh)(async (options) => {
|
|
471
528
|
const storageToken = await this.getStorageToken(options, "ReadCommit");
|
|
472
529
|
const snapshotDownloader = async (url, fetchOptions) => {
|
|
473
530
|
return this.epochTracker.fetchAndParseAsJSON(url, fetchOptions, "snapshotTree", undefined, scenarioName);
|
|
474
531
|
};
|
|
475
|
-
const snapshot = await (0,
|
|
532
|
+
const snapshot = await (0, fetchSnapshot_js_1.fetchSnapshot)(this.snapshotUrl, storageToken, id, this.fetchFullSnapshot, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader, this.logger, snapshotDownloader);
|
|
476
533
|
let treeId = "";
|
|
477
534
|
if (snapshot.snapshotTree) {
|
|
478
535
|
(0, core_utils_1.assert)(snapshot.snapshotTree.id !== undefined, 0x222 /* "Root tree should contain the id!!" */);
|
|
479
536
|
treeId = snapshot.snapshotTree.id;
|
|
480
537
|
this.setRootTree(treeId, snapshot.snapshotTree);
|
|
481
538
|
}
|
|
482
|
-
if (snapshot.
|
|
483
|
-
this.initBlobsCache(snapshot.
|
|
539
|
+
if (snapshot.blobContents) {
|
|
540
|
+
this.initBlobsCache(snapshot.blobContents);
|
|
484
541
|
}
|
|
485
542
|
// If the version id doesn't match with the id of the tree, then use the id of first tree which in that case
|
|
486
543
|
// will be the actual id of tree to be fetched.
|