@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488
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 +18 -3
- 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 +11 -12
- 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.map +1 -1
- package/dist/compactSnapshotParser.js +87 -69
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +25 -19
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +10 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createFile.d.ts +3 -3
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createFile.js +30 -27
- 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 +2 -2
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +12 -8
- package/dist/createNewUtils.js.map +1 -1
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/createOdspCreateContainerRequest.js +6 -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 +66 -43
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts +11 -8
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +79 -58
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js +24 -17
- package/dist/getFileLink.js.map +1 -1
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/getQueryString.js +6 -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 +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.js +5 -5
- 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 +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js +6 -6
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/dist/odsp-driver-alpha.d.ts +27 -12
- package/dist/odsp-driver-beta.d.ts +1 -2
- package/dist/odsp-driver-public.d.ts +1 -2
- package/dist/odsp-driver-untrimmed.d.ts +29 -12
- package/dist/odspCache.d.ts +3 -3
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js +3 -4
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +7 -5
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +41 -28
- 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 +6 -4
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js +19 -16
- 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 +26 -22
- 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 +15 -9
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +219 -181
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +2 -4
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +32 -29
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +5 -1
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +27 -24
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +17 -6
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +49 -39
- 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 +5 -5
- 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 +3 -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 +1 -1
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js +3 -2
- 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 +19 -7
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +61 -31
- 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 +0 -1
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js +2 -5
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.d.ts.map +1 -1
- package/dist/retryUtils.js +6 -2
- 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 +15 -11
- 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} +1 -1
- package/lib/compactSnapshotParser.d.ts.map +1 -0
- package/lib/{compactSnapshotParser.mjs → compactSnapshotParser.js} +61 -43
- package/lib/compactSnapshotParser.js.map +1 -0
- package/lib/{compactSnapshotWriter.d.mts → compactSnapshotWriter.d.ts} +1 -1
- package/lib/compactSnapshotWriter.d.ts.map +1 -0
- package/lib/{compactSnapshotWriter.mjs → compactSnapshotWriter.js} +13 -7
- 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} +11 -5
- package/lib/contracts.d.ts.map +1 -0
- package/lib/{contracts.mjs → contracts.js} +1 -1
- 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} +4 -4
- package/lib/createFile.d.ts.map +1 -0
- package/lib/{createFile.mjs → createFile.js} +15 -12
- 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} +3 -3
- package/lib/createNewUtils.d.ts.map +1 -0
- package/lib/{createNewUtils.mjs → createNewUtils.js} +9 -5
- package/lib/createNewUtils.js.map +1 -0
- package/lib/{createOdspCreateContainerRequest.d.mts → createOdspCreateContainerRequest.d.ts} +5 -1
- package/lib/createOdspCreateContainerRequest.d.ts.map +1 -0
- package/lib/{createOdspCreateContainerRequest.mjs → createOdspCreateContainerRequest.js} +6 -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} +56 -33
- 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} +12 -9
- package/lib/fetchSnapshot.d.ts.map +1 -0
- package/lib/{fetchSnapshot.mjs → fetchSnapshot.js} +61 -40
- 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} +14 -7
- 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} +7 -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} +2 -2
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.mjs → localOdspDocumentService.js} +4 -4
- 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} +2 -2
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.mjs → localOdspDocumentStorageManager.js} +4 -4
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
- package/lib/{odsp-driver-alpha.d.mts → odsp-driver-alpha.d.ts} +27 -12
- package/lib/{odsp-driver-public.d.mts → odsp-driver-beta.d.ts} +1 -2
- package/lib/{odsp-driver-beta.d.mts → odsp-driver-public.d.ts} +1 -2
- package/lib/{odsp-driver-untrimmed.d.mts → odsp-driver-untrimmed.d.ts} +29 -12
- package/lib/{odspCache.d.mts → odspCache.d.ts} +8 -4
- 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} +8 -6
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -0
- package/lib/{odspDelayLoadedDeltaStream.mjs → odspDelayLoadedDeltaStream.js} +33 -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} +7 -5
- package/lib/odspDocumentService.d.ts.map +1 -0
- package/lib/{odspDocumentService.mjs → odspDocumentService.js} +16 -11
- 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} +23 -17
- 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} +16 -10
- package/lib/odspDocumentStorageManager.d.ts.map +1 -0
- package/lib/{odspDocumentStorageManager.mjs → odspDocumentStorageManager.js} +207 -167
- package/lib/odspDocumentStorageManager.js.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.d.mts → odspDocumentStorageServiceBase.d.ts} +3 -5
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.mjs → odspDocumentStorageServiceBase.js} +32 -29
- package/lib/odspDocumentStorageServiceBase.js.map +1 -0
- package/lib/{odspDriverUrlResolver.d.mts → odspDriverUrlResolver.d.ts} +6 -2
- package/lib/odspDriverUrlResolver.d.ts.map +1 -0
- package/lib/{odspDriverUrlResolver.mjs → odspDriverUrlResolver.js} +24 -17
- package/lib/odspDriverUrlResolver.js.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.d.mts → odspDriverUrlResolverForShareLink.d.ts} +18 -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} +4 -4
- 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} +4 -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} +2 -2
- package/lib/odspSnapshotParser.d.ts.map +1 -0
- package/lib/{odspSnapshotParser.mjs → odspSnapshotParser.js} +4 -3
- 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} +20 -8
- package/lib/odspUtils.d.ts.map +1 -0
- package/lib/{odspUtils.mjs → odspUtils.js} +45 -17
- 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} +1 -2
- package/lib/retryErrorsStorageAdapter.d.ts.map +1 -0
- package/lib/{retryErrorsStorageAdapter.mjs → retryErrorsStorageAdapter.js} +2 -5
- 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} +6 -2
- 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} +17 -9
- package/lib/zipItDataRepresentationUtils.js.map +1 -0
- package/package.json +90 -31
- package/src/ReadBufferUtils.ts +7 -7
- package/src/WriteBufferUtils.ts +13 -9
- package/src/checkUrl.ts +4 -2
- package/src/compactSnapshotParser.ts +87 -52
- package/src/compactSnapshotWriter.ts +19 -12
- package/src/contracts.ts +16 -4
- package/src/createFile.ts +16 -13
- package/src/createNewContainerOnExistingFile.ts +8 -8
- package/src/createNewModule.ts +2 -2
- package/src/createNewUtils.ts +19 -9
- package/src/createOdspCreateContainerRequest.ts +2 -1
- package/src/createOdspUrl.ts +1 -1
- package/src/epochTracker.ts +90 -55
- package/src/fetchSnapshot.ts +104 -47
- package/src/getFileLink.ts +21 -13
- package/src/getQueryString.ts +3 -0
- package/src/index.ts +27 -19
- package/src/localOdspDriver/localOdspDocumentService.ts +3 -3
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +12 -11
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +5 -5
- package/src/odspCache.ts +13 -9
- package/src/odspDelayLoadedDeltaStream.ts +54 -33
- package/src/odspDeltaStorageService.ts +17 -16
- package/src/odspDocumentDeltaConnection.ts +52 -34
- package/src/odspDocumentService.ts +23 -20
- package/src/odspDocumentServiceFactory.ts +7 -2
- package/src/odspDocumentServiceFactoryCore.ts +25 -18
- package/src/odspDocumentServiceFactoryWithCodeSplit.ts +1 -1
- package/src/odspDocumentStorageManager.ts +276 -216
- package/src/odspDocumentStorageServiceBase.ts +45 -43
- package/src/odspDriverUrlResolver.ts +39 -24
- package/src/odspDriverUrlResolverForShareLink.ts +51 -31
- package/src/odspError.ts +4 -4
- package/src/odspFluidFileLink.ts +3 -3
- package/src/odspLocationRedirection.ts +1 -1
- package/src/odspPublicUtils.ts +3 -0
- package/src/odspSnapshotParser.ts +4 -3
- package/src/odspSummaryUploadManager.ts +21 -9
- package/src/odspUrlHelper.ts +2 -3
- package/src/odspUtils.ts +73 -30
- package/src/opsCaching.ts +13 -12
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +24 -15
- package/src/retryErrorsStorageAdapter.ts +4 -8
- package/src/retryUtils.ts +6 -2
- package/src/socketModule.ts +2 -0
- package/src/vroom.ts +6 -6
- package/src/zipItDataRepresentationUtils.ts +63 -35
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- 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.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
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
IOdspSummaryTreeBaseEntry,
|
|
24
24
|
OdspSummaryTreeEntry,
|
|
25
25
|
OdspSummaryTreeValue,
|
|
26
|
-
} from "./contracts";
|
|
27
|
-
import { EpochTracker } from "./epochTracker";
|
|
28
|
-
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
29
|
-
import { getWithRetryForTokenRefresh } from "./odspUtils";
|
|
26
|
+
} from "./contracts.js";
|
|
27
|
+
import { EpochTracker } from "./epochTracker.js";
|
|
28
|
+
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.js";
|
|
29
|
+
import { getWithRetryForTokenRefresh } from "./odspUtils.js";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* This class manages a summary upload. When it receives a call to upload summary, it converts the summary tree into
|
|
@@ -48,7 +48,10 @@ export class OdspSummaryUploadManager {
|
|
|
48
48
|
this.mc = loggerToMonitoringContext(logger);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
public async writeSummaryTree(
|
|
51
|
+
public async writeSummaryTree(
|
|
52
|
+
tree: api.ISummaryTree,
|
|
53
|
+
context: ISummaryContext,
|
|
54
|
+
): Promise<string> {
|
|
52
55
|
// If the last proposed handle is not the proposed handle of the acked summary(could happen when the last summary get nacked),
|
|
53
56
|
// then re-initialize the caches with the previous ones else just update the previous caches with the caches from acked summary.
|
|
54
57
|
// Don't bother logging if lastSummaryProposalHandle hasn't been set before; only log on a positive mismatch.
|
|
@@ -122,7 +125,7 @@ export class OdspSummaryUploadManager {
|
|
|
122
125
|
attempt: options.refresh ? 2 : 1,
|
|
123
126
|
hasClaims: !!options.claims,
|
|
124
127
|
hasTenantId: !!options.tenantId,
|
|
125
|
-
headers: Object.keys(headers).length
|
|
128
|
+
headers: Object.keys(headers).length > 0 ? true : undefined,
|
|
126
129
|
blobs,
|
|
127
130
|
size: postBody.length,
|
|
128
131
|
referenceSequenceNumber,
|
|
@@ -163,7 +166,10 @@ export class OdspSummaryUploadManager {
|
|
|
163
166
|
markUnreferencedNodes: boolean = this.mc.config.getBoolean(
|
|
164
167
|
"Fluid.Driver.Odsp.MarkUnreferencedNodes",
|
|
165
168
|
) ?? true,
|
|
166
|
-
) {
|
|
169
|
+
): Promise<{
|
|
170
|
+
snapshotTree: IOdspSummaryTree;
|
|
171
|
+
blobs: number;
|
|
172
|
+
}> {
|
|
167
173
|
const snapshotTree: IOdspSummaryTree = {
|
|
168
174
|
type: "tree",
|
|
169
175
|
entries: [] as OdspSummaryTreeEntry[],
|
|
@@ -181,6 +187,7 @@ export class OdspSummaryUploadManager {
|
|
|
181
187
|
// property is not present, the tree entry is considered referenced. If the property is present and is
|
|
182
188
|
// true (which is the only value it can have), the tree entry is considered unreferenced.
|
|
183
189
|
let unreferenced: true | undefined;
|
|
190
|
+
let groupId: string | undefined;
|
|
184
191
|
switch (summaryObject.type) {
|
|
185
192
|
case api.SummaryType.Tree: {
|
|
186
193
|
const result = await this.convertSummaryToSnapshotTree(
|
|
@@ -190,6 +197,7 @@ export class OdspSummaryUploadManager {
|
|
|
190
197
|
);
|
|
191
198
|
value = result.snapshotTree;
|
|
192
199
|
unreferenced = markUnreferencedNodes ? summaryObject.unreferenced : undefined;
|
|
200
|
+
groupId = summaryObject.groupId;
|
|
193
201
|
blobs += result.blobs;
|
|
194
202
|
break;
|
|
195
203
|
}
|
|
@@ -211,7 +219,7 @@ export class OdspSummaryUploadManager {
|
|
|
211
219
|
}
|
|
212
220
|
case api.SummaryType.Handle: {
|
|
213
221
|
if (!parentHandle) {
|
|
214
|
-
throw Error("Parent summary does not exist to reference by handle.");
|
|
222
|
+
throw new Error("Parent summary does not exist to reference by handle.");
|
|
215
223
|
}
|
|
216
224
|
let handlePath = summaryObject.handle;
|
|
217
225
|
if (handlePath.length > 0 && !handlePath.startsWith("/")) {
|
|
@@ -226,7 +234,10 @@ export class OdspSummaryUploadManager {
|
|
|
226
234
|
break;
|
|
227
235
|
}
|
|
228
236
|
default: {
|
|
229
|
-
unreachableCase(
|
|
237
|
+
unreachableCase(
|
|
238
|
+
summaryObject,
|
|
239
|
+
`Unknown type: ${(summaryObject as api.SummaryObject).type}`,
|
|
240
|
+
);
|
|
230
241
|
}
|
|
231
242
|
}
|
|
232
243
|
|
|
@@ -246,6 +257,7 @@ export class OdspSummaryUploadManager {
|
|
|
246
257
|
value,
|
|
247
258
|
...baseEntry,
|
|
248
259
|
unreferenced,
|
|
260
|
+
groupId,
|
|
249
261
|
};
|
|
250
262
|
} else if (id) {
|
|
251
263
|
entry = {
|
package/src/odspUrlHelper.ts
CHANGED
|
@@ -49,7 +49,7 @@ export function isSpoUrl(url: string): boolean {
|
|
|
49
49
|
|
|
50
50
|
// Format: foo.sharepoint.com/_api/v2.1./drives/bar/items/baz and foo.sharepoint-df.com/...
|
|
51
51
|
const spoRegex = /(.*\.sharepoint(-df)*\.com)\/_api\/v2.1\/drives\/([^/]*)\/items\/([^/]*)/;
|
|
52
|
-
return
|
|
52
|
+
return spoRegex.test(urlLower);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -88,7 +88,7 @@ export async function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefin
|
|
|
88
88
|
// Joinsession like URL
|
|
89
89
|
// Pick a regex based on the hostname
|
|
90
90
|
// TODO This will only support ODC using api.onedrive.com, update to handle the future (share links etc)
|
|
91
|
-
let joinSessionMatch;
|
|
91
|
+
let joinSessionMatch: RegExpExecArray | null;
|
|
92
92
|
if (isOdcOrigin(url.origin)) {
|
|
93
93
|
// Capture groups:
|
|
94
94
|
// 0: match
|
|
@@ -97,7 +97,6 @@ export async function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefin
|
|
|
97
97
|
// 3: optional captured drive ID
|
|
98
98
|
// 4: Item ID
|
|
99
99
|
// 5: Drive ID portion of Item ID
|
|
100
|
-
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
101
100
|
joinSessionMatch = /(.*)\/v2\.1\/drive(s\/([\dA-Za-z]+))?\/items\/(([\dA-Za-z]+)!\d+)/.exec(
|
|
102
101
|
pathname,
|
|
103
102
|
);
|
package/src/odspUtils.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryBaseProperties, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { IResolvedUrl, ISnapshot } from "@fluidframework/driver-definitions";
|
|
8
8
|
import {
|
|
9
9
|
isOnline,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
RetryableError,
|
|
12
12
|
NonRetryableError,
|
|
13
13
|
NetworkErrorBasic,
|
|
14
|
+
type AuthorizationError,
|
|
14
15
|
} from "@fluidframework/driver-utils";
|
|
15
16
|
import { performance } from "@fluid-internal/client-utils";
|
|
16
17
|
import { assert } from "@fluidframework/core-utils";
|
|
@@ -20,12 +21,13 @@ import {
|
|
|
20
21
|
TelemetryDataTag,
|
|
21
22
|
createChildLogger,
|
|
22
23
|
wrapError,
|
|
24
|
+
type IFluidErrorBase,
|
|
23
25
|
} from "@fluidframework/telemetry-utils";
|
|
24
26
|
import {
|
|
25
27
|
fetchIncorrectResponse,
|
|
26
28
|
throwOdspNetworkError,
|
|
27
29
|
getSPOAndGraphRequestIdsFromResponse,
|
|
28
|
-
} from "@fluidframework/odsp-doclib-utils";
|
|
30
|
+
} from "@fluidframework/odsp-doclib-utils/internal";
|
|
29
31
|
import {
|
|
30
32
|
IOdspResolvedUrl,
|
|
31
33
|
TokenFetchOptions,
|
|
@@ -40,15 +42,18 @@ import {
|
|
|
40
42
|
InstrumentedStorageTokenFetcher,
|
|
41
43
|
IOdspUrlParts,
|
|
42
44
|
} from "@fluidframework/odsp-driver-definitions";
|
|
43
|
-
import { fetch } from "./fetch";
|
|
44
|
-
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
45
|
-
import { IOdspSnapshot } from "./contracts";
|
|
46
|
-
|
|
45
|
+
import { fetch } from "./fetch.js";
|
|
46
|
+
import { pkgVersion as driverVersion } from "./packageVersion.js";
|
|
47
|
+
import { IOdspSnapshot } from "./contracts.js";
|
|
48
|
+
// eslint-disable-next-line import/no-deprecated
|
|
49
|
+
import { ISnapshotContents } from "./odspPublicUtils.js";
|
|
47
50
|
|
|
48
51
|
export const getWithRetryForTokenRefreshRepeat = "getWithRetryForTokenRefreshRepeat";
|
|
49
52
|
|
|
50
|
-
/**
|
|
51
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Parse the given url and return the origin (host name)
|
|
55
|
+
*/
|
|
56
|
+
export const getOrigin = (url: string): string => new URL(url).origin;
|
|
52
57
|
|
|
53
58
|
/**
|
|
54
59
|
* @alpha
|
|
@@ -56,16 +61,18 @@ export const getOrigin = (url: string) => new URL(url).origin;
|
|
|
56
61
|
export interface IOdspResponse<T> {
|
|
57
62
|
content: T;
|
|
58
63
|
headers: Map<string, string>;
|
|
59
|
-
propsToLog:
|
|
64
|
+
propsToLog: ITelemetryBaseProperties;
|
|
60
65
|
duration: number;
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
export interface TokenFetchOptionsEx extends TokenFetchOptions {
|
|
64
|
-
/**
|
|
65
|
-
|
|
69
|
+
/**
|
|
70
|
+
* The previous error we hit in {@link getWithRetryForTokenRefresh}.
|
|
71
|
+
*/
|
|
72
|
+
previousError?: unknown;
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
function headersToMap(headers: Headers) {
|
|
75
|
+
function headersToMap(headers: Headers): Map<string, string> {
|
|
69
76
|
const newHeaders = new Map<string, string>();
|
|
70
77
|
for (const [key, value] of headers.entries()) {
|
|
71
78
|
newHeaders.set(key, value);
|
|
@@ -81,24 +88,30 @@ function headersToMap(headers: Headers) {
|
|
|
81
88
|
*/
|
|
82
89
|
export async function getWithRetryForTokenRefresh<T>(
|
|
83
90
|
get: (options: TokenFetchOptionsEx) => Promise<T>,
|
|
84
|
-
) {
|
|
85
|
-
return get({ refresh: false }).catch(async (
|
|
86
|
-
const options: TokenFetchOptionsEx = { refresh: true, previousError:
|
|
87
|
-
switch (
|
|
91
|
+
): Promise<T> {
|
|
92
|
+
return get({ refresh: false }).catch(async (error) => {
|
|
93
|
+
const options: TokenFetchOptionsEx = { refresh: true, previousError: error };
|
|
94
|
+
switch ((error as Partial<IFluidErrorBase>).errorType) {
|
|
88
95
|
// If the error is 401 or 403 refresh the token and try once more.
|
|
89
|
-
case OdspErrorTypes.authorizationError:
|
|
90
|
-
|
|
96
|
+
case OdspErrorTypes.authorizationError: {
|
|
97
|
+
const authError = error as AuthorizationError;
|
|
98
|
+
return get({ ...options, claims: authError.claims, tenantId: authError.tenantId });
|
|
99
|
+
}
|
|
91
100
|
|
|
92
101
|
case OdspErrorTypes.incorrectServerResponse: // some error on the wire, retry once
|
|
93
|
-
case OdspErrorTypes.fetchTokenError:
|
|
102
|
+
case OdspErrorTypes.fetchTokenError: {
|
|
103
|
+
// If the token was null, then retry once.
|
|
94
104
|
return get(options);
|
|
105
|
+
}
|
|
95
106
|
|
|
96
|
-
default:
|
|
107
|
+
default: {
|
|
97
108
|
// Caller may determine that it wants one retry
|
|
98
|
-
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any
|
|
110
|
+
if ((error as any)[getWithRetryForTokenRefreshRepeat] === true) {
|
|
99
111
|
return get(options);
|
|
100
112
|
}
|
|
101
|
-
throw
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
102
115
|
}
|
|
103
116
|
});
|
|
104
117
|
}
|
|
@@ -112,7 +125,7 @@ export async function fetchHelper(
|
|
|
112
125
|
// Node-fetch and dom have conflicting typing, force them to work by casting for now
|
|
113
126
|
return fetch(requestInfo, requestInit).then(
|
|
114
127
|
async (fetchResponse) => {
|
|
115
|
-
const response = fetchResponse as
|
|
128
|
+
const response = fetchResponse as unknown as Response;
|
|
116
129
|
// Let's assume we can retry.
|
|
117
130
|
if (!response) {
|
|
118
131
|
throw new NonRetryableError(
|
|
@@ -153,6 +166,7 @@ export async function fetchHelper(
|
|
|
153
166
|
const redactedErrorText = taggedErrorMessage.value.replace(urlRegex, "REDACTED_URL");
|
|
154
167
|
|
|
155
168
|
// This error is thrown by fetch() when AbortSignal is provided and it gets cancelled
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
156
170
|
if (error.name === "AbortError") {
|
|
157
171
|
throw new RetryableError(
|
|
158
172
|
"Fetch Timeout (AbortError)",
|
|
@@ -210,7 +224,7 @@ export async function fetchArray(
|
|
|
210
224
|
let arrayBuffer: ArrayBuffer;
|
|
211
225
|
try {
|
|
212
226
|
arrayBuffer = await content.arrayBuffer();
|
|
213
|
-
} catch
|
|
227
|
+
} catch {
|
|
214
228
|
// Parsing can fail and message could contain full request URI, including
|
|
215
229
|
// tokens, etc. So do not log error object itself.
|
|
216
230
|
throwOdspNetworkError(
|
|
@@ -244,7 +258,7 @@ export async function fetchAndParseAsJSONHelper<T>(
|
|
|
244
258
|
let text: string | undefined;
|
|
245
259
|
try {
|
|
246
260
|
text = await content.text();
|
|
247
|
-
} catch
|
|
261
|
+
} catch {
|
|
248
262
|
// JSON.parse() can fail and message would container full request URI, including
|
|
249
263
|
// tokens... It fails for me with "Unexpected end of JSON input" quite often - an attempt to download big file
|
|
250
264
|
// (many ops) almost always ends up with this error - I'd guess 1% of op request end up here... It always
|
|
@@ -263,7 +277,7 @@ export async function fetchAndParseAsJSONHelper<T>(
|
|
|
263
277
|
propsToLog.bodySize = text.length;
|
|
264
278
|
const res = {
|
|
265
279
|
headers,
|
|
266
|
-
content: JSON.parse(text),
|
|
280
|
+
content: JSON.parse(text) as T,
|
|
267
281
|
propsToLog,
|
|
268
282
|
duration,
|
|
269
283
|
};
|
|
@@ -307,13 +321,15 @@ export function getOdspResolvedUrl(resolvedUrl: IResolvedUrl): IOdspResolvedUrl
|
|
|
307
321
|
}
|
|
308
322
|
|
|
309
323
|
/**
|
|
324
|
+
* Type narrowing utility to determine if the provided {@link @fluidframework/driver-definitions#IResolvedUrl}
|
|
325
|
+
* is an {@link @fluidframework/odsp-driver-definitions#IOdspResolvedUrl}.
|
|
310
326
|
* @internal
|
|
311
327
|
*/
|
|
312
328
|
export function isOdspResolvedUrl(resolvedUrl: IResolvedUrl): resolvedUrl is IOdspResolvedUrl {
|
|
313
329
|
return "odspResolvedUrl" in resolvedUrl && resolvedUrl.odspResolvedUrl === true;
|
|
314
330
|
}
|
|
315
331
|
|
|
316
|
-
export const createOdspLogger = (logger?: ITelemetryBaseLogger) =>
|
|
332
|
+
export const createOdspLogger = (logger?: ITelemetryBaseLogger): ITelemetryLoggerExt =>
|
|
317
333
|
createChildLogger({
|
|
318
334
|
logger,
|
|
319
335
|
namespace: "OdspDriver",
|
|
@@ -324,7 +340,12 @@ export const createOdspLogger = (logger?: ITelemetryBaseLogger) =>
|
|
|
324
340
|
},
|
|
325
341
|
});
|
|
326
342
|
|
|
327
|
-
export function evalBlobsAndTrees(snapshot: IOdspSnapshot) {
|
|
343
|
+
export function evalBlobsAndTrees(snapshot: IOdspSnapshot): {
|
|
344
|
+
numTrees: number;
|
|
345
|
+
numBlobs: number;
|
|
346
|
+
encodedBlobsSize: number;
|
|
347
|
+
decodedBlobsSize: number;
|
|
348
|
+
} {
|
|
328
349
|
let numTrees = 0;
|
|
329
350
|
let numBlobs = 0;
|
|
330
351
|
let encodedBlobsSize = 0;
|
|
@@ -401,6 +422,7 @@ export function toInstrumentedOdspTokenFetcher(
|
|
|
401
422
|
(error) => {
|
|
402
423
|
// There is an important but unofficial contract here where token providers can set canRetry: true
|
|
403
424
|
// to hook into the driver's retry logic (e.g. the retry loop when initiating a connection)
|
|
425
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
404
426
|
const rawCanRetry = error?.canRetry;
|
|
405
427
|
const tokenError = wrapError(
|
|
406
428
|
error,
|
|
@@ -444,7 +466,9 @@ export const maxUmpPostBodySize = 79872;
|
|
|
444
466
|
* @param shareLinkType - Kind of sharing link requested
|
|
445
467
|
* @returns A string of request parameters that can be concatenated with the base URI
|
|
446
468
|
*/
|
|
447
|
-
export function buildOdspShareLinkReqParams(
|
|
469
|
+
export function buildOdspShareLinkReqParams(
|
|
470
|
+
shareLinkType: ISharingLinkKind | undefined,
|
|
471
|
+
): string | undefined {
|
|
448
472
|
if (!shareLinkType) {
|
|
449
473
|
return;
|
|
450
474
|
}
|
|
@@ -471,7 +495,7 @@ export async function measureP<T>(callback: () => Promise<T>): Promise<[T, numbe
|
|
|
471
495
|
return [result, time];
|
|
472
496
|
}
|
|
473
497
|
|
|
474
|
-
export function getJoinSessionCacheKey(odspResolvedUrl: IOdspResolvedUrl) {
|
|
498
|
+
export function getJoinSessionCacheKey(odspResolvedUrl: IOdspResolvedUrl): string {
|
|
475
499
|
return `${odspResolvedUrl.hashedDocumentId}/joinsession`;
|
|
476
500
|
}
|
|
477
501
|
|
|
@@ -481,7 +505,26 @@ export function getJoinSessionCacheKey(odspResolvedUrl: IOdspResolvedUrl) {
|
|
|
481
505
|
* @param obj - obj whose type needs to be identified.
|
|
482
506
|
*/
|
|
483
507
|
export function isInstanceOfISnapshot(
|
|
508
|
+
// eslint-disable-next-line import/no-deprecated
|
|
484
509
|
obj: ISnapshotContents | ISnapshot | undefined,
|
|
485
510
|
): obj is ISnapshot {
|
|
486
511
|
return obj !== undefined && "snapshotFormatV" in obj && obj.snapshotFormatV === 1;
|
|
487
512
|
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* This tells whether request if for a specific loading group or not. The snapshot which
|
|
516
|
+
* we fetch on initial load, fetches all ungrouped content.
|
|
517
|
+
*/
|
|
518
|
+
export function isSnapshotFetchForLoadingGroup(loadingGroupIds: string[] | undefined): boolean {
|
|
519
|
+
return loadingGroupIds !== undefined && loadingGroupIds.length > 0;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/*
|
|
523
|
+
* This tells whether we are using legacy flow for fetching snapshot where we don't use
|
|
524
|
+
* groupId query param in the trees latest network call.
|
|
525
|
+
*/
|
|
526
|
+
export function useLegacyFlowWithoutGroupsForSnapshotFetch(
|
|
527
|
+
loadingGroupIds: string[] | undefined,
|
|
528
|
+
): boolean {
|
|
529
|
+
return loadingGroupIds === undefined;
|
|
530
|
+
}
|
package/src/opsCaching.ts
CHANGED
|
@@ -37,8 +37,8 @@ export class OpsCache {
|
|
|
37
37
|
private readonly logger: ITelemetryLoggerExt,
|
|
38
38
|
private readonly cache: ICache,
|
|
39
39
|
private readonly batchSize: number,
|
|
40
|
-
private readonly timerGranularity,
|
|
41
|
-
private totalOpsToCache,
|
|
40
|
+
private readonly timerGranularity: number,
|
|
41
|
+
private totalOpsToCache: number,
|
|
42
42
|
) {
|
|
43
43
|
/**
|
|
44
44
|
* Initial batch is a special case because it will never be full - all ops prior (inclusive) to
|
|
@@ -55,7 +55,7 @@ export class OpsCache {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
public dispose() {
|
|
58
|
+
public dispose(): void {
|
|
59
59
|
this.batches.clear();
|
|
60
60
|
if (this.timer !== undefined) {
|
|
61
61
|
clearTimeout(this.timer);
|
|
@@ -63,7 +63,7 @@ export class OpsCache {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
public flushOps() {
|
|
66
|
+
public flushOps(): void {
|
|
67
67
|
for (const [key, value] of this.batches) {
|
|
68
68
|
// Don't flush if the batch has no ops, already flushed or has empty slots at both beginning and end.
|
|
69
69
|
if (
|
|
@@ -80,7 +80,7 @@ export class OpsCache {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
public addOps(ops: IMessage[]) {
|
|
83
|
+
public addOps(ops: IMessage[]): void {
|
|
84
84
|
if (this.totalOpsToCache <= 0) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
@@ -114,6 +114,7 @@ export class OpsCache {
|
|
|
114
114
|
if (currentBatch.remainingSlots === 0) {
|
|
115
115
|
// batch is full, flush to cache
|
|
116
116
|
this.write(batchNumber, currentBatch);
|
|
117
|
+
// eslint-disable-next-line unicorn/no-null
|
|
117
118
|
this.batches.set(batchNumber, null);
|
|
118
119
|
} else {
|
|
119
120
|
this.scheduleTimer();
|
|
@@ -144,7 +145,7 @@ export class OpsCache {
|
|
|
144
145
|
if (res === undefined) {
|
|
145
146
|
return messages;
|
|
146
147
|
}
|
|
147
|
-
const result: CacheEntry = JSON.parse(res);
|
|
148
|
+
const result: CacheEntry = JSON.parse(res) as CacheEntry;
|
|
148
149
|
const prevMessagesLength = messages.length;
|
|
149
150
|
for (const op of result) {
|
|
150
151
|
// Note that we write out undefined, but due to JSON.stringify, it turns into null!
|
|
@@ -160,7 +161,7 @@ export class OpsCache {
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
messages.push(op);
|
|
163
|
-
} else if (messages.length
|
|
164
|
+
} else if (messages.length > 0) {
|
|
164
165
|
// If there is any gap, return the messages till now.
|
|
165
166
|
return messages;
|
|
166
167
|
}
|
|
@@ -199,7 +200,7 @@ export class OpsCache {
|
|
|
199
200
|
return messages;
|
|
200
201
|
}
|
|
201
202
|
|
|
202
|
-
protected write(batchNumber: number, payload: IBatch) {
|
|
203
|
+
protected write(batchNumber: number, payload: IBatch): void {
|
|
203
204
|
// Errors are caught and logged by PersistedCacheWithErrorHandling that sits
|
|
204
205
|
// in the adapter chain of cache adapters
|
|
205
206
|
this.cache
|
|
@@ -209,7 +210,7 @@ export class OpsCache {
|
|
|
209
210
|
});
|
|
210
211
|
}
|
|
211
212
|
|
|
212
|
-
protected scheduleTimer() {
|
|
213
|
+
protected scheduleTimer(): void {
|
|
213
214
|
if (!this.timer && this.timerGranularity > 0) {
|
|
214
215
|
this.timer = setTimeout(() => {
|
|
215
216
|
this.timer = undefined;
|
|
@@ -218,15 +219,15 @@ export class OpsCache {
|
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
|
|
221
|
-
private getBatchNumber(sequenceNumber: number) {
|
|
222
|
+
private getBatchNumber(sequenceNumber: number): number {
|
|
222
223
|
return Math.floor(sequenceNumber / this.batchSize);
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
private getPositionInBatchArray(sequenceNumber: number) {
|
|
226
|
+
private getPositionInBatchArray(sequenceNumber: number): number {
|
|
226
227
|
return sequenceNumber % this.batchSize;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
private initializeNewBatchDataArray() {
|
|
230
|
+
private initializeNewBatchDataArray(): IMessage[] {
|
|
230
231
|
const tempArray: IMessage[] = [];
|
|
231
232
|
tempArray.length = this.batchSize; // fill with empty, undefined elements
|
|
232
233
|
return tempArray;
|
package/src/packageVersion.ts
CHANGED
|
@@ -16,21 +16,22 @@ import {
|
|
|
16
16
|
IOdspUrlParts,
|
|
17
17
|
getKeyForCacheEntry,
|
|
18
18
|
} from "@fluidframework/odsp-driver-definitions";
|
|
19
|
-
import {
|
|
19
|
+
import { createChildMonitoringContext, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
20
20
|
import {
|
|
21
21
|
createCacheSnapshotKey,
|
|
22
22
|
createOdspLogger,
|
|
23
23
|
getOdspResolvedUrl,
|
|
24
24
|
toInstrumentedOdspTokenFetcher,
|
|
25
|
-
} from "./odspUtils";
|
|
25
|
+
} from "./odspUtils.js";
|
|
26
26
|
import {
|
|
27
27
|
downloadSnapshot,
|
|
28
28
|
fetchSnapshotWithRedeem,
|
|
29
|
+
ISnapshotRequestAndResponseOptions,
|
|
29
30
|
SnapshotFormatSupportType,
|
|
30
|
-
} from "./fetchSnapshot";
|
|
31
|
-
import { IVersionedValueWithEpoch } from "./contracts";
|
|
32
|
-
import { IPrefetchSnapshotContents } from "./odspCache";
|
|
33
|
-
import { OdspDocumentServiceFactory } from "./odspDocumentServiceFactory";
|
|
31
|
+
} from "./fetchSnapshot.js";
|
|
32
|
+
import { IVersionedValueWithEpoch } from "./contracts.js";
|
|
33
|
+
import { IPrefetchSnapshotContents } from "./odspCache.js";
|
|
34
|
+
import { OdspDocumentServiceFactory } from "./odspDocumentServiceFactory.js";
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Function to prefetch the snapshot and cached it in the persistant cache, so that when the container is loaded
|
|
@@ -66,9 +67,14 @@ export async function prefetchLatestSnapshot(
|
|
|
66
67
|
snapshotFormatFetchType?: SnapshotFormatSupportType,
|
|
67
68
|
odspDocumentServiceFactory?: OdspDocumentServiceFactory,
|
|
68
69
|
): Promise<boolean> {
|
|
69
|
-
const
|
|
70
|
-
|
|
70
|
+
const mc = createChildMonitoringContext({ logger, namespace: "PrefetchSnapshot" });
|
|
71
|
+
const odspLogger = createOdspLogger(mc.logger);
|
|
72
|
+
const useGroupIdsForSnapshotFetch = mc.config.getBoolean(
|
|
73
|
+
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch",
|
|
71
74
|
);
|
|
75
|
+
// For prefetch, we just want to fetch the ungrouped data and want to use the new API if the
|
|
76
|
+
// feature gate is set, so provide an empty array.
|
|
77
|
+
const loadingGroupIds = useGroupIdsForSnapshotFetch ? [] : undefined;
|
|
72
78
|
const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
|
|
73
79
|
|
|
74
80
|
const resolvedUrlData: IOdspUrlParts = {
|
|
@@ -86,13 +92,14 @@ export async function prefetchLatestSnapshot(
|
|
|
86
92
|
const snapshotDownloader = async (
|
|
87
93
|
finalOdspResolvedUrl: IOdspResolvedUrl,
|
|
88
94
|
storageToken: string,
|
|
95
|
+
loadingGroupId: string[] | undefined,
|
|
89
96
|
snapshotOptions: ISnapshotOptions | undefined,
|
|
90
97
|
controller?: AbortController,
|
|
91
|
-
) => {
|
|
98
|
+
): Promise<ISnapshotRequestAndResponseOptions> => {
|
|
92
99
|
return downloadSnapshot(
|
|
93
100
|
finalOdspResolvedUrl,
|
|
94
101
|
storageToken,
|
|
95
|
-
|
|
102
|
+
loadingGroupId,
|
|
96
103
|
snapshotOptions,
|
|
97
104
|
undefined,
|
|
98
105
|
controller,
|
|
@@ -101,12 +108,13 @@ export async function prefetchLatestSnapshot(
|
|
|
101
108
|
const snapshotKey = createCacheSnapshotKey(odspResolvedUrl);
|
|
102
109
|
let cacheP: Promise<void> | undefined;
|
|
103
110
|
let snapshotEpoch: string | undefined;
|
|
104
|
-
const putInCache = async (valueWithEpoch: IVersionedValueWithEpoch) => {
|
|
111
|
+
const putInCache = async (valueWithEpoch: IVersionedValueWithEpoch): Promise<void> => {
|
|
105
112
|
snapshotEpoch = valueWithEpoch.fluidEpoch;
|
|
106
113
|
cacheP = persistedCache.put(snapshotKey, valueWithEpoch);
|
|
107
114
|
return cacheP;
|
|
108
115
|
};
|
|
109
|
-
|
|
116
|
+
|
|
117
|
+
const removeEntries = async (): Promise<void> => persistedCache.removeEntries(snapshotKey.file);
|
|
110
118
|
return PerformanceEvent.timedExecAsync(
|
|
111
119
|
odspLogger,
|
|
112
120
|
{ eventName: "PrefetchLatestSnapshot" },
|
|
@@ -130,6 +138,7 @@ export async function prefetchLatestSnapshot(
|
|
|
130
138
|
snapshotDownloader,
|
|
131
139
|
putInCache,
|
|
132
140
|
removeEntries,
|
|
141
|
+
loadingGroupIds,
|
|
133
142
|
enableRedeemFallback,
|
|
134
143
|
)
|
|
135
144
|
.then(async (value) => {
|
|
@@ -157,11 +166,11 @@ export async function prefetchLatestSnapshot(
|
|
|
157
166
|
snapshotNonPersistentCache?.remove(nonPersistentCacheKey);
|
|
158
167
|
}, 5000);
|
|
159
168
|
})
|
|
160
|
-
.catch((
|
|
169
|
+
.catch((error) => {
|
|
161
170
|
// Remove it from the non persistent cache if an error occured.
|
|
162
171
|
snapshotNonPersistentCache?.remove(nonPersistentCacheKey);
|
|
163
|
-
snapshotContentsWithEpochP.reject(
|
|
164
|
-
throw
|
|
172
|
+
snapshotContentsWithEpochP.reject(error);
|
|
173
|
+
throw error;
|
|
165
174
|
});
|
|
166
175
|
return true;
|
|
167
176
|
},
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
IVersion,
|
|
21
21
|
} from "@fluidframework/protocol-definitions";
|
|
22
22
|
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
23
|
-
import { runWithRetry } from "./retryUtils";
|
|
23
|
+
import { runWithRetry } from "./retryUtils.js";
|
|
24
24
|
|
|
25
25
|
export class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisposable {
|
|
26
26
|
private _disposed = false;
|
|
@@ -32,17 +32,13 @@ export class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisp
|
|
|
32
32
|
public get policies(): IDocumentStorageServicePolicies | undefined {
|
|
33
33
|
return this.internalStorageService.policies;
|
|
34
34
|
}
|
|
35
|
-
public get disposed() {
|
|
35
|
+
public get disposed(): boolean {
|
|
36
36
|
return this._disposed;
|
|
37
37
|
}
|
|
38
|
-
public dispose() {
|
|
38
|
+
public dispose(): void {
|
|
39
39
|
this._disposed = true;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
public get repositoryUrl(): string {
|
|
43
|
-
return this.internalStorageService.repositoryUrl;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
42
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
47
43
|
public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {
|
|
48
44
|
return this.runWithRetry(
|
|
@@ -111,7 +107,7 @@ export class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisp
|
|
|
111
107
|
);
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
private checkStorageDisposed() {
|
|
110
|
+
private checkStorageDisposed(): void {
|
|
115
111
|
if (this._disposed) {
|
|
116
112
|
// pre-0.58 error message: storageServiceDisposedCannotRetry
|
|
117
113
|
throw new LoggingError("Storage Service is disposed. Cannot retry", {
|
package/src/retryUtils.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { performance } from "@fluid-internal/client-utils";
|
|
|
8
8
|
import { delay } from "@fluidframework/core-utils";
|
|
9
9
|
import { canRetryOnError, getRetryDelayFromError } from "@fluidframework/driver-utils";
|
|
10
10
|
import { OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
|
|
11
|
-
import { Odsp409Error } from "./epochTracker";
|
|
11
|
+
import { Odsp409Error } from "./epochTracker.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* This method retries only for retriable coherency and service read only errors.
|
|
@@ -21,7 +21,7 @@ export async function runWithRetry<T>(
|
|
|
21
21
|
): Promise<T> {
|
|
22
22
|
let retryAfter = 1000;
|
|
23
23
|
const start = performance.now();
|
|
24
|
-
let lastError:
|
|
24
|
+
let lastError: unknown;
|
|
25
25
|
for (let attempts = 1; ; attempts++) {
|
|
26
26
|
if (checkDisposed !== undefined) {
|
|
27
27
|
checkDisposed();
|
|
@@ -40,10 +40,13 @@ export async function runWithRetry<T>(
|
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
return result;
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
44
|
} catch (error: any) {
|
|
44
45
|
const canRetry = canRetryOnError(error);
|
|
45
46
|
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
46
48
|
const coherencyError = error?.[Odsp409Error] === true;
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
47
50
|
const serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;
|
|
48
51
|
|
|
49
52
|
// logging the first failed retry instead of every attempt. We want to avoid filling telemetry
|
|
@@ -84,6 +87,7 @@ export async function runWithRetry<T>(
|
|
|
84
87
|
error,
|
|
85
88
|
);
|
|
86
89
|
// Fail hard.
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
87
91
|
error.canRetry = false;
|
|
88
92
|
throw error;
|
|
89
93
|
}
|