@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
|
@@ -16,12 +16,17 @@ import { assert, delay } from "@fluidframework/core-utils";
|
|
|
16
16
|
import { LogLevel } from "@fluidframework/core-interfaces";
|
|
17
17
|
import * as api from "@fluidframework/protocol-definitions";
|
|
18
18
|
import { promiseRaceWithWinner } from "@fluidframework/driver-base";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ISummaryContext,
|
|
21
|
+
FetchSource,
|
|
22
|
+
ISnapshot,
|
|
23
|
+
ISnapshotFetchOptions,
|
|
24
|
+
} from "@fluidframework/driver-definitions";
|
|
20
25
|
import { RateLimiter, NonRetryableError } from "@fluidframework/driver-utils";
|
|
21
26
|
import {
|
|
22
27
|
IOdspResolvedUrl,
|
|
23
28
|
ISnapshotOptions,
|
|
24
|
-
|
|
29
|
+
OdspErrorTypes,
|
|
25
30
|
InstrumentedStorageTokenFetcher,
|
|
26
31
|
getKeyForCacheEntry,
|
|
27
32
|
} from "@fluidframework/odsp-driver-definitions";
|
|
@@ -29,24 +34,33 @@ import {
|
|
|
29
34
|
IDocumentStorageGetVersionsResponse,
|
|
30
35
|
HostStoragePolicyInternal,
|
|
31
36
|
IVersionedValueWithEpoch,
|
|
37
|
+
// eslint-disable-next-line import/no-deprecated
|
|
32
38
|
ISnapshotCachedEntry,
|
|
33
|
-
|
|
39
|
+
ISnapshotCachedEntry2,
|
|
40
|
+
} from "./contracts.js";
|
|
34
41
|
import {
|
|
35
42
|
downloadSnapshot,
|
|
36
43
|
evalBlobsAndTrees,
|
|
37
44
|
fetchSnapshot,
|
|
38
45
|
fetchSnapshotWithRedeem,
|
|
46
|
+
ISnapshotRequestAndResponseOptions,
|
|
39
47
|
SnapshotFormatSupportType,
|
|
40
|
-
} from "./fetchSnapshot";
|
|
41
|
-
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
42
|
-
import { IOdspCache, IPrefetchSnapshotContents } from "./odspCache";
|
|
43
|
-
import {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
} from "./fetchSnapshot.js";
|
|
49
|
+
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.js";
|
|
50
|
+
import { IOdspCache, IPrefetchSnapshotContents } from "./odspCache.js";
|
|
51
|
+
import {
|
|
52
|
+
createCacheSnapshotKey,
|
|
53
|
+
getWithRetryForTokenRefresh,
|
|
54
|
+
IOdspResponse,
|
|
55
|
+
isInstanceOfISnapshot,
|
|
56
|
+
isSnapshotFetchForLoadingGroup,
|
|
57
|
+
useLegacyFlowWithoutGroupsForSnapshotFetch,
|
|
58
|
+
} from "./odspUtils.js";
|
|
59
|
+
import { EpochTracker } from "./epochTracker.js";
|
|
60
|
+
import type { OdspSummaryUploadManager } from "./odspSummaryUploadManager.js";
|
|
61
|
+
import { FlushResult } from "./odspDocumentDeltaConnection.js";
|
|
62
|
+
import { pkgVersion as driverVersion } from "./packageVersion.js";
|
|
63
|
+
import { OdspDocumentStorageServiceBase } from "./odspDocumentStorageServiceBase.js";
|
|
50
64
|
|
|
51
65
|
export const defaultSummarizerCacheExpiryTimeout: number = 60 * 1000; // 60 seconds.
|
|
52
66
|
|
|
@@ -60,7 +74,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
60
74
|
private summaryModuleP: Promise<OdspSummaryUploadManager> | undefined;
|
|
61
75
|
private odspSummaryUploadManager: OdspSummaryUploadManager | undefined;
|
|
62
76
|
|
|
63
|
-
private
|
|
77
|
+
private firstSnapshotFetchCall = true;
|
|
64
78
|
private _isFirstSnapshotFromNetwork: boolean | undefined;
|
|
65
79
|
private readonly documentId: string;
|
|
66
80
|
private readonly snapshotUrl: string | undefined;
|
|
@@ -98,7 +112,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
98
112
|
this.attachmentGETUrl = this.odspResolvedUrl.endpoints.attachmentGETStorageUrl;
|
|
99
113
|
}
|
|
100
114
|
|
|
101
|
-
public get isFirstSnapshotFromNetwork() {
|
|
115
|
+
public get isFirstSnapshotFromNetwork(): boolean | undefined {
|
|
102
116
|
return this._isFirstSnapshotFromNetwork;
|
|
103
117
|
}
|
|
104
118
|
|
|
@@ -163,7 +177,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
163
177
|
eventName: "readDataBlob",
|
|
164
178
|
blobId,
|
|
165
179
|
evicted,
|
|
166
|
-
headers: Object.keys(headers).length
|
|
180
|
+
headers: Object.keys(headers).length > 0 ? true : undefined,
|
|
167
181
|
waitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,
|
|
168
182
|
},
|
|
169
183
|
async (event) => {
|
|
@@ -199,11 +213,233 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
199
213
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
200
214
|
): Promise<api.ISnapshotTree | null> {
|
|
201
215
|
if (!this.snapshotUrl) {
|
|
216
|
+
// eslint-disable-next-line unicorn/no-null
|
|
202
217
|
return null;
|
|
203
218
|
}
|
|
204
219
|
return super.getSnapshotTree(version, scenarioName);
|
|
205
220
|
}
|
|
206
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Fetches and returns the snapshot. If no loadingGroupIds or empty loadingGroupIds is provided, then snapshot for all
|
|
224
|
+
* ungrouped data will be provided.
|
|
225
|
+
* @param snapshotFetchOptions - fetch options for snapshot.
|
|
226
|
+
*/
|
|
227
|
+
public async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {
|
|
228
|
+
// Don't consult cache if request is not for a particular loading group.
|
|
229
|
+
const { snapshot } = await this.fetchSnapshot({
|
|
230
|
+
...snapshotFetchOptions,
|
|
231
|
+
fetchSource: isSnapshotFetchForLoadingGroup(snapshotFetchOptions?.loadingGroupIds)
|
|
232
|
+
? FetchSource.noCache
|
|
233
|
+
: snapshotFetchOptions?.fetchSource,
|
|
234
|
+
loadingGroupIds: snapshotFetchOptions?.loadingGroupIds ?? [],
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
...snapshot,
|
|
239
|
+
snapshotTree: this.combineProtocolAndAppSnapshotTree(snapshot.snapshotTree),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private async fetchSnapshot(
|
|
244
|
+
snapshotFetchOptions: ISnapshotFetchOptions,
|
|
245
|
+
): Promise<{ snapshot: ISnapshot; id: string | undefined }> {
|
|
246
|
+
const hostSnapshotOptions = this.hostPolicy.snapshotOptions;
|
|
247
|
+
const odspSnapshotCacheValue: ISnapshot = await PerformanceEvent.timedExecAsync(
|
|
248
|
+
this.logger,
|
|
249
|
+
{
|
|
250
|
+
eventName: isSnapshotFetchForLoadingGroup(snapshotFetchOptions.loadingGroupIds)
|
|
251
|
+
? "ObtainSnapshotForGroup"
|
|
252
|
+
: "ObtainSnapshot",
|
|
253
|
+
fetchSource: snapshotFetchOptions?.fetchSource,
|
|
254
|
+
},
|
|
255
|
+
async (event: PerformanceEvent) => {
|
|
256
|
+
const props: GetVersionsTelemetryProps = {};
|
|
257
|
+
let cacheLookupTimeInSerialFetch = 0;
|
|
258
|
+
let retrievedSnapshot: ISnapshot | IPrefetchSnapshotContents | undefined;
|
|
259
|
+
|
|
260
|
+
let method: string;
|
|
261
|
+
let prefetchWaitStartTime: number = performance.now();
|
|
262
|
+
if (snapshotFetchOptions.fetchSource === FetchSource.noCache) {
|
|
263
|
+
retrievedSnapshot = await this.fetchSnapshotFromNetwork(
|
|
264
|
+
hostSnapshotOptions,
|
|
265
|
+
snapshotFetchOptions.loadingGroupIds,
|
|
266
|
+
snapshotFetchOptions.scenarioName,
|
|
267
|
+
);
|
|
268
|
+
method = "networkOnly";
|
|
269
|
+
} else {
|
|
270
|
+
// Here's the logic to grab the persistent cache snapshot implemented by the host
|
|
271
|
+
// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions
|
|
272
|
+
const cachedSnapshotP: Promise<ISnapshot | undefined> = this.epochTracker
|
|
273
|
+
.get(createCacheSnapshotKey(this.odspResolvedUrl))
|
|
274
|
+
.then(
|
|
275
|
+
async (
|
|
276
|
+
// eslint-disable-next-line import/no-deprecated
|
|
277
|
+
snapshotCachedEntry: ISnapshotCachedEntry | ISnapshotCachedEntry2,
|
|
278
|
+
) => {
|
|
279
|
+
if (snapshotCachedEntry !== undefined) {
|
|
280
|
+
// If the cached entry does not contain the entry time, then assign it a default of 30 days old.
|
|
281
|
+
const age =
|
|
282
|
+
Date.now() -
|
|
283
|
+
(snapshotCachedEntry.cacheEntryTime ??
|
|
284
|
+
Date.now() - 30 * 24 * 60 * 60 * 1000);
|
|
285
|
+
|
|
286
|
+
// In order to decrease the number of times we have to execute a snapshot refresh,
|
|
287
|
+
// if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,
|
|
288
|
+
// force the network retrieval instead as there might be a more recent snapshot available.
|
|
289
|
+
// See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.
|
|
290
|
+
if (this.hostPolicy.summarizerClient) {
|
|
291
|
+
if (age > defaultSummarizerCacheExpiryTimeout) {
|
|
292
|
+
props.cacheSummarizerExpired = true;
|
|
293
|
+
return undefined;
|
|
294
|
+
} else {
|
|
295
|
+
props.cacheSummarizerExpired = false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Record the cache age
|
|
300
|
+
props.cacheEntryAge = age;
|
|
301
|
+
// Snapshot from cache could be in older format, so transform that before returning.
|
|
302
|
+
if (isInstanceOfISnapshot(snapshotCachedEntry)) {
|
|
303
|
+
return snapshotCachedEntry;
|
|
304
|
+
} else {
|
|
305
|
+
const snapshot: ISnapshot = {
|
|
306
|
+
snapshotTree: snapshotCachedEntry.snapshotTree,
|
|
307
|
+
blobContents: snapshotCachedEntry.blobs,
|
|
308
|
+
ops: snapshotCachedEntry.ops,
|
|
309
|
+
latestSequenceNumber:
|
|
310
|
+
snapshotCachedEntry.latestSequenceNumber,
|
|
311
|
+
sequenceNumber: snapshotCachedEntry.sequenceNumber,
|
|
312
|
+
snapshotFormatV: 1,
|
|
313
|
+
};
|
|
314
|
+
return snapshot;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
);
|
|
319
|
+
// Based on the concurrentSnapshotFetch policy:
|
|
320
|
+
// Either retrieve both the network and cache snapshots concurrently and pick the first to return,
|
|
321
|
+
// or grab the cache value and then the network value if the cache value returns undefined.
|
|
322
|
+
// For summarizer which could call this during refreshing of summary parent, always use the cache
|
|
323
|
+
// first. Also for other clients, if it is not critical path which is determined by firstSnapshotFetchCall,
|
|
324
|
+
// then also check the cache first.
|
|
325
|
+
if (
|
|
326
|
+
this.firstSnapshotFetchCall &&
|
|
327
|
+
this.hostPolicy.concurrentSnapshotFetch &&
|
|
328
|
+
!this.hostPolicy.summarizerClient
|
|
329
|
+
) {
|
|
330
|
+
const networkSnapshotP = this.fetchSnapshotFromNetwork(
|
|
331
|
+
hostSnapshotOptions,
|
|
332
|
+
snapshotFetchOptions.loadingGroupIds,
|
|
333
|
+
snapshotFetchOptions.scenarioName,
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
// Ensure that failures on both paths are ignored initially.
|
|
337
|
+
// I.e. if cache fails for some reason, we will proceed with network result.
|
|
338
|
+
// And vice versa - if (for example) client is offline and network request fails first, we
|
|
339
|
+
// do want to attempt to succeed with cached data!
|
|
340
|
+
const promiseRaceWinner = await promiseRaceWithWinner([
|
|
341
|
+
cachedSnapshotP.catch(() => undefined),
|
|
342
|
+
networkSnapshotP.catch(() => undefined),
|
|
343
|
+
]);
|
|
344
|
+
retrievedSnapshot = promiseRaceWinner.value;
|
|
345
|
+
method = promiseRaceWinner.index === 0 ? "cache" : "network";
|
|
346
|
+
|
|
347
|
+
if (retrievedSnapshot === undefined) {
|
|
348
|
+
// if network failed -> wait for cache ( then return network failure)
|
|
349
|
+
// If cache returned empty or failed -> wait for network (success of failure)
|
|
350
|
+
try {
|
|
351
|
+
if (promiseRaceWinner.index === 1) {
|
|
352
|
+
retrievedSnapshot = await cachedSnapshotP;
|
|
353
|
+
method = "cache";
|
|
354
|
+
}
|
|
355
|
+
if (retrievedSnapshot === undefined) {
|
|
356
|
+
retrievedSnapshot = await networkSnapshotP;
|
|
357
|
+
method = "network";
|
|
358
|
+
}
|
|
359
|
+
} catch (error: unknown) {
|
|
360
|
+
// The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:
|
|
361
|
+
// they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--
|
|
362
|
+
// see https://v8.dev/docs/stack-trace-api#async-stack-traces and the "zero-cost async stack traces" document
|
|
363
|
+
// linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.
|
|
364
|
+
// Regenerating the stack at this level provides more information for logged errors.
|
|
365
|
+
// Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and
|
|
366
|
+
// get similar quality stacks with less hand-crafted code.
|
|
367
|
+
const innerStack = (error as Error).stack;
|
|
368
|
+
const normalizedError = normalizeError(error);
|
|
369
|
+
normalizedError.addTelemetryProperties({ innerStack });
|
|
370
|
+
|
|
371
|
+
const newStack = `<<STACK TRUNCATED: see innerStack property>> \n${generateStack()}`;
|
|
372
|
+
overwriteStack(normalizedError, newStack);
|
|
373
|
+
|
|
374
|
+
throw normalizedError;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
// Note: There's a race condition here - another caller may come past the undefined check
|
|
379
|
+
// while the first caller is awaiting later async code in this block.
|
|
380
|
+
const startTime = performance.now();
|
|
381
|
+
retrievedSnapshot = await cachedSnapshotP;
|
|
382
|
+
cacheLookupTimeInSerialFetch = performance.now() - startTime;
|
|
383
|
+
method = retrievedSnapshot === undefined ? "network" : "cache";
|
|
384
|
+
|
|
385
|
+
if (retrievedSnapshot === undefined) {
|
|
386
|
+
prefetchWaitStartTime = performance.now();
|
|
387
|
+
retrievedSnapshot = await this.fetchSnapshotFromNetwork(
|
|
388
|
+
hostSnapshotOptions,
|
|
389
|
+
snapshotFetchOptions.loadingGroupIds,
|
|
390
|
+
snapshotFetchOptions.scenarioName,
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (method === "network") {
|
|
396
|
+
props.cacheEntryAge = undefined;
|
|
397
|
+
}
|
|
398
|
+
if (this.firstSnapshotFetchCall) {
|
|
399
|
+
this._isFirstSnapshotFromNetwork = method === "cache" ? false : true;
|
|
400
|
+
}
|
|
401
|
+
const prefetchStartTime: number | undefined = (
|
|
402
|
+
retrievedSnapshot as IPrefetchSnapshotContents
|
|
403
|
+
).prefetchStartTime;
|
|
404
|
+
event.end({
|
|
405
|
+
...props,
|
|
406
|
+
method,
|
|
407
|
+
fetchSnapshotForInitialLoad: this.firstSnapshotFetchCall,
|
|
408
|
+
useLegacyFlowWithoutGroups: useLegacyFlowWithoutGroupsForSnapshotFetch(
|
|
409
|
+
snapshotFetchOptions.loadingGroupIds,
|
|
410
|
+
),
|
|
411
|
+
avoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,
|
|
412
|
+
...evalBlobsAndTrees(retrievedSnapshot),
|
|
413
|
+
cacheLookupTimeInSerialFetch,
|
|
414
|
+
prefetchSavedDuration:
|
|
415
|
+
prefetchStartTime !== undefined && method !== "cache"
|
|
416
|
+
? prefetchWaitStartTime - prefetchStartTime
|
|
417
|
+
: undefined,
|
|
418
|
+
});
|
|
419
|
+
return retrievedSnapshot;
|
|
420
|
+
},
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
const stTime = performance.now();
|
|
424
|
+
// Don't override ops which were fetched during initial load, since we could still need them.
|
|
425
|
+
const id = this.initializeFromSnapshot(
|
|
426
|
+
odspSnapshotCacheValue,
|
|
427
|
+
this.firstSnapshotFetchCall,
|
|
428
|
+
snapshotFetchOptions?.cacheSnapshot ?? this.firstSnapshotFetchCall,
|
|
429
|
+
);
|
|
430
|
+
this.logger.sendTelemetryEvent(
|
|
431
|
+
{
|
|
432
|
+
eventName: "SnapshotInitializeTime",
|
|
433
|
+
duration: performance.now() - stTime,
|
|
434
|
+
},
|
|
435
|
+
undefined,
|
|
436
|
+
LogLevel.verbose,
|
|
437
|
+
);
|
|
438
|
+
this.firstSnapshotFetchCall = false;
|
|
439
|
+
|
|
440
|
+
return { snapshot: odspSnapshotCacheValue, id };
|
|
441
|
+
}
|
|
442
|
+
|
|
207
443
|
public async getVersions(
|
|
208
444
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
209
445
|
blobid: string | null,
|
|
@@ -232,170 +468,12 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
232
468
|
|
|
233
469
|
// 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
470
|
if (count === 1 && (blobid === null || blobid === this.documentId)) {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
471
|
+
const { id } = await this.fetchSnapshot({
|
|
472
|
+
cacheSnapshot: true,
|
|
473
|
+
scenarioName,
|
|
474
|
+
versionId: blobid ?? undefined,
|
|
475
|
+
fetchSource,
|
|
476
|
+
});
|
|
399
477
|
return id ? [{ id, treeId: undefined! }] : [];
|
|
400
478
|
}
|
|
401
479
|
|
|
@@ -412,7 +490,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
412
490
|
this.logger,
|
|
413
491
|
{
|
|
414
492
|
eventName: "getVersions",
|
|
415
|
-
headers: Object.keys(headers).length
|
|
493
|
+
headers: Object.keys(headers).length > 0 ? true : undefined,
|
|
416
494
|
},
|
|
417
495
|
async () =>
|
|
418
496
|
this.epochTracker.fetchAndParseAsJSON<IDocumentStorageGetVersionsResponse>(
|
|
@@ -427,14 +505,14 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
427
505
|
if (!versionsResponse) {
|
|
428
506
|
throw new NonRetryableError(
|
|
429
507
|
"No response from /versions endpoint",
|
|
430
|
-
|
|
508
|
+
OdspErrorTypes.genericNetworkError,
|
|
431
509
|
{ driverVersion },
|
|
432
510
|
);
|
|
433
511
|
}
|
|
434
512
|
if (!Array.isArray(versionsResponse.value)) {
|
|
435
513
|
throw new NonRetryableError(
|
|
436
514
|
"Incorrect response from /versions endpoint, expected an array",
|
|
437
|
-
|
|
515
|
+
OdspErrorTypes.genericNetworkError,
|
|
438
516
|
{ driverVersion },
|
|
439
517
|
);
|
|
440
518
|
}
|
|
@@ -447,29 +525,37 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
447
525
|
});
|
|
448
526
|
}
|
|
449
527
|
|
|
450
|
-
private async
|
|
528
|
+
private async fetchSnapshotFromNetwork(
|
|
451
529
|
hostSnapshotOptions: ISnapshotOptions | undefined,
|
|
530
|
+
loadingGroupIds: string[] | undefined,
|
|
452
531
|
scenarioName?: string,
|
|
453
|
-
) {
|
|
454
|
-
return this.
|
|
532
|
+
): Promise<ISnapshot | IPrefetchSnapshotContents> {
|
|
533
|
+
return this.fetchSnapshotFromNetworkCore(
|
|
534
|
+
hostSnapshotOptions,
|
|
535
|
+
loadingGroupIds,
|
|
536
|
+
scenarioName,
|
|
537
|
+
).catch((error) => {
|
|
455
538
|
// Issue #5895:
|
|
456
539
|
// If we are offline, this error is retryable. But that means that RetriableDocumentStorageService
|
|
457
540
|
// will run in circles calling getSnapshotTree, which would result in OdspDocumentStorageService class
|
|
458
541
|
// going getVersions / individual blob download path. This path is very slow, and will not work with
|
|
459
542
|
// delay-loaded data stores and ODSP storage deleting old snapshots and blobs.
|
|
460
543
|
if (typeof error === "object" && error !== null) {
|
|
544
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
461
545
|
error.canRetry = false;
|
|
462
546
|
}
|
|
463
547
|
throw error;
|
|
464
548
|
});
|
|
465
549
|
}
|
|
466
550
|
|
|
467
|
-
private async
|
|
551
|
+
private async fetchSnapshotFromNetworkCore(
|
|
468
552
|
hostSnapshotOptions: ISnapshotOptions | undefined,
|
|
553
|
+
loadingGroupIds: string[] | undefined,
|
|
469
554
|
scenarioName?: string,
|
|
470
|
-
): Promise<
|
|
471
|
-
// Don't look into cache, if the host specifically tells us so.
|
|
472
|
-
|
|
555
|
+
): Promise<ISnapshot | IPrefetchSnapshotContents> {
|
|
556
|
+
// Don't look into cache, if the host specifically tells us so. Also, if request is
|
|
557
|
+
// for initial snapshot, don't consult the prefetch cache.
|
|
558
|
+
if (!this.hostPolicy.avoidPrefetchSnapshotCache && this.firstSnapshotFetchCall) {
|
|
473
559
|
const prefetchCacheKey = getKeyForCacheEntry(
|
|
474
560
|
createCacheSnapshotKey(this.odspResolvedUrl),
|
|
475
561
|
);
|
|
@@ -482,13 +568,13 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
482
568
|
await this.epochTracker.validateEpoch(response.fluidEpoch, "treesLatest");
|
|
483
569
|
return response;
|
|
484
570
|
})
|
|
485
|
-
.catch(async (
|
|
571
|
+
.catch(async (error) => {
|
|
486
572
|
this.logger.sendTelemetryEvent(
|
|
487
573
|
{
|
|
488
574
|
eventName: "PrefetchSnapshotError",
|
|
489
575
|
concurrentSnapshotFetch: this.hostPolicy.concurrentSnapshotFetch,
|
|
490
576
|
},
|
|
491
|
-
|
|
577
|
+
error,
|
|
492
578
|
);
|
|
493
579
|
return undefined;
|
|
494
580
|
});
|
|
@@ -515,13 +601,14 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
515
601
|
const snapshotDownloader = async (
|
|
516
602
|
finalOdspResolvedUrl: IOdspResolvedUrl,
|
|
517
603
|
storageToken: string,
|
|
604
|
+
loadingGroupId: string[] | undefined,
|
|
518
605
|
options: ISnapshotOptions | undefined,
|
|
519
606
|
controller?: AbortController,
|
|
520
|
-
) => {
|
|
607
|
+
): Promise<ISnapshotRequestAndResponseOptions> => {
|
|
521
608
|
return downloadSnapshot(
|
|
522
609
|
finalOdspResolvedUrl,
|
|
523
610
|
storageToken,
|
|
524
|
-
|
|
611
|
+
loadingGroupId,
|
|
525
612
|
options,
|
|
526
613
|
this.snapshotFormatFetchType,
|
|
527
614
|
controller,
|
|
@@ -529,14 +616,14 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
529
616
|
scenarioName,
|
|
530
617
|
);
|
|
531
618
|
};
|
|
532
|
-
const putInCache = async (valueWithEpoch: IVersionedValueWithEpoch) => {
|
|
619
|
+
const putInCache = async (valueWithEpoch: IVersionedValueWithEpoch): Promise<void> => {
|
|
533
620
|
return this.cache.persistedCache.put(
|
|
534
621
|
createCacheSnapshotKey(this.odspResolvedUrl),
|
|
535
622
|
// Epoch tracker will add the epoch and version to the value here. So just send value to cache.
|
|
536
623
|
valueWithEpoch.value,
|
|
537
624
|
);
|
|
538
625
|
};
|
|
539
|
-
const removeEntries = async () => this.cache.persistedCache.removeEntries();
|
|
626
|
+
const removeEntries = async (): Promise<void> => this.cache.persistedCache.removeEntries();
|
|
540
627
|
try {
|
|
541
628
|
const odspSnapshot = await fetchSnapshotWithRedeem(
|
|
542
629
|
this.odspResolvedUrl,
|
|
@@ -547,14 +634,17 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
547
634
|
snapshotDownloader,
|
|
548
635
|
putInCache,
|
|
549
636
|
removeEntries,
|
|
637
|
+
loadingGroupIds,
|
|
550
638
|
this.hostPolicy.enableRedeemFallback,
|
|
551
639
|
);
|
|
552
640
|
return odspSnapshot;
|
|
641
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
553
642
|
} catch (error: any) {
|
|
643
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
554
644
|
const errorType = error.errorType;
|
|
555
645
|
// 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
646
|
if (
|
|
557
|
-
errorType ===
|
|
647
|
+
errorType === OdspErrorTypes.snapshotTooBig &&
|
|
558
648
|
hostSnapshotOptions?.mds !== undefined &&
|
|
559
649
|
this.hostPolicy.summarizerClient !== true
|
|
560
650
|
) {
|
|
@@ -562,12 +652,13 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
562
652
|
}
|
|
563
653
|
// 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
654
|
if (
|
|
565
|
-
(errorType ===
|
|
566
|
-
errorType ===
|
|
655
|
+
(errorType === OdspErrorTypes.snapshotTooBig ||
|
|
656
|
+
errorType === OdspErrorTypes.fetchTimeout) &&
|
|
567
657
|
snapshotOptions.blobs
|
|
568
658
|
) {
|
|
569
659
|
this.logger.sendErrorEvent({
|
|
570
660
|
eventName: "TreeLatest_SecondCall",
|
|
661
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
571
662
|
errorType,
|
|
572
663
|
});
|
|
573
664
|
const snapshotOptionsWithoutBlobs: ISnapshotOptions = {
|
|
@@ -585,6 +676,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
585
676
|
snapshotDownloader,
|
|
586
677
|
putInCache,
|
|
587
678
|
removeEntries,
|
|
679
|
+
loadingGroupIds,
|
|
588
680
|
this.hostPolicy.enableRedeemFallback,
|
|
589
681
|
);
|
|
590
682
|
return odspSnapshot;
|
|
@@ -656,7 +748,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
656
748
|
return id;
|
|
657
749
|
}
|
|
658
750
|
|
|
659
|
-
private async getDelayLoadedSummaryManager() {
|
|
751
|
+
private async getDelayLoadedSummaryManager(): Promise<OdspSummaryUploadManager> {
|
|
660
752
|
assert(this.odspSummaryModuleLoaded === false, 0x56f /* Should be loaded only once */);
|
|
661
753
|
const module = await import(
|
|
662
754
|
/* webpackChunkName: "summaryModule" */ "./odspSummaryUploadManager.js"
|
|
@@ -680,31 +772,31 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
680
772
|
return this.odspSummaryUploadManager;
|
|
681
773
|
}
|
|
682
774
|
|
|
683
|
-
private checkSnapshotUrl() {
|
|
775
|
+
private checkSnapshotUrl(): void {
|
|
684
776
|
if (!this.snapshotUrl) {
|
|
685
777
|
throw new NonRetryableError(
|
|
686
778
|
"Method failed because no snapshot url was available",
|
|
687
|
-
|
|
779
|
+
OdspErrorTypes.genericError,
|
|
688
780
|
{ driverVersion },
|
|
689
781
|
);
|
|
690
782
|
}
|
|
691
783
|
}
|
|
692
784
|
|
|
693
|
-
private checkAttachmentPOSTUrl() {
|
|
785
|
+
private checkAttachmentPOSTUrl(): void {
|
|
694
786
|
if (!this.attachmentPOSTUrl) {
|
|
695
787
|
throw new NonRetryableError(
|
|
696
788
|
"Method failed because no attachment POST url was available",
|
|
697
|
-
|
|
789
|
+
OdspErrorTypes.genericError,
|
|
698
790
|
{ driverVersion },
|
|
699
791
|
);
|
|
700
792
|
}
|
|
701
793
|
}
|
|
702
794
|
|
|
703
|
-
private checkAttachmentGETUrl() {
|
|
795
|
+
private checkAttachmentGETUrl(): void {
|
|
704
796
|
if (!this.attachmentGETUrl) {
|
|
705
797
|
throw new NonRetryableError(
|
|
706
798
|
"Method failed because no attachment GET url was available",
|
|
707
|
-
|
|
799
|
+
OdspErrorTypes.genericError,
|
|
708
800
|
{ driverVersion },
|
|
709
801
|
);
|
|
710
802
|
}
|
|
@@ -718,8 +810,9 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
718
810
|
const storageToken = await this.getStorageToken(options, "ReadCommit");
|
|
719
811
|
const snapshotDownloader = async (
|
|
720
812
|
url: string,
|
|
721
|
-
fetchOptions:
|
|
722
|
-
|
|
813
|
+
fetchOptions: RequestInit,
|
|
814
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
815
|
+
): Promise<IOdspResponse<unknown>> => {
|
|
723
816
|
return this.epochTracker.fetchAndParseAsJSON(
|
|
724
817
|
url,
|
|
725
818
|
fetchOptions,
|
|
@@ -746,8 +839,8 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
746
839
|
treeId = snapshot.snapshotTree.id;
|
|
747
840
|
this.setRootTree(treeId, snapshot.snapshotTree);
|
|
748
841
|
}
|
|
749
|
-
if (snapshot.
|
|
750
|
-
this.initBlobsCache(snapshot.
|
|
842
|
+
if (snapshot.blobContents) {
|
|
843
|
+
this.initBlobsCache(snapshot.blobContents);
|
|
751
844
|
}
|
|
752
845
|
// 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
846
|
// will be the actual id of tree to be fetched.
|