@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
package/src/fetchSnapshot.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
ISnapshotOptions,
|
|
20
20
|
OdspErrorTypes,
|
|
21
21
|
InstrumentedStorageTokenFetcher,
|
|
22
|
+
type IOdspError,
|
|
22
23
|
} from "@fluidframework/odsp-driver-definitions";
|
|
23
24
|
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
24
25
|
import {
|
|
@@ -26,32 +27,37 @@ import {
|
|
|
26
27
|
isRuntimeMessage,
|
|
27
28
|
NonRetryableError,
|
|
28
29
|
} from "@fluidframework/driver-utils";
|
|
29
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
fetchIncorrectResponse,
|
|
32
|
+
throwOdspNetworkError,
|
|
33
|
+
} from "@fluidframework/odsp-doclib-utils/internal";
|
|
30
34
|
import {
|
|
31
35
|
IOdspSnapshot,
|
|
32
36
|
ISnapshotCachedEntry2,
|
|
33
37
|
IVersionedValueWithEpoch,
|
|
34
38
|
persistedCacheValueVersion,
|
|
35
|
-
} from "./contracts";
|
|
36
|
-
import { getQueryString } from "./getQueryString";
|
|
37
|
-
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
39
|
+
} from "./contracts.js";
|
|
40
|
+
import { getQueryString } from "./getQueryString.js";
|
|
41
|
+
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.js";
|
|
38
42
|
import {
|
|
39
43
|
fetchAndParseAsJSONHelper,
|
|
40
44
|
fetchHelper,
|
|
41
45
|
getWithRetryForTokenRefresh,
|
|
42
46
|
getWithRetryForTokenRefreshRepeat,
|
|
43
47
|
IOdspResponse,
|
|
48
|
+
isSnapshotFetchForLoadingGroup,
|
|
44
49
|
measure,
|
|
45
50
|
measureP,
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
useLegacyFlowWithoutGroupsForSnapshotFetch,
|
|
52
|
+
} from "./odspUtils.js";
|
|
53
|
+
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "./odspSnapshotParser.js";
|
|
48
54
|
import {
|
|
49
55
|
currentReadVersion,
|
|
50
56
|
ISnapshotContentsWithProps,
|
|
51
57
|
parseCompactSnapshotResponse,
|
|
52
|
-
} from "./compactSnapshotParser";
|
|
53
|
-
import { EpochTracker } from "./epochTracker";
|
|
54
|
-
import { pkgVersion } from "./packageVersion";
|
|
58
|
+
} from "./compactSnapshotParser.js";
|
|
59
|
+
import { EpochTracker } from "./epochTracker.js";
|
|
60
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
55
61
|
|
|
56
62
|
/**
|
|
57
63
|
* Enum to support different types of snapshot formats.
|
|
@@ -83,14 +89,14 @@ export async function fetchSnapshot(
|
|
|
83
89
|
logger: ITelemetryLoggerExt,
|
|
84
90
|
snapshotDownloader: (
|
|
85
91
|
url: string,
|
|
86
|
-
fetchOptions: { [index: string]:
|
|
92
|
+
fetchOptions: { [index: string]: RequestInit },
|
|
87
93
|
) => Promise<IOdspResponse<unknown>>,
|
|
88
94
|
): Promise<ISnapshot> {
|
|
89
95
|
const path = `/trees/${versionId}`;
|
|
90
96
|
let queryParams: ISnapshotOptions = {};
|
|
91
97
|
|
|
92
98
|
if (fetchFullSnapshot) {
|
|
93
|
-
queryParams = versionId
|
|
99
|
+
queryParams = versionId === "latest" ? { deltas: 1, blobs: 2 } : { blobs: 2 };
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
const queryString = getQueryString(queryParams);
|
|
@@ -103,7 +109,7 @@ export async function fetchSnapshot(
|
|
|
103
109
|
logger,
|
|
104
110
|
{
|
|
105
111
|
eventName: "fetchSnapshot",
|
|
106
|
-
headers: Object.keys(headers).length
|
|
112
|
+
headers: Object.keys(headers).length > 0 ? true : undefined,
|
|
107
113
|
},
|
|
108
114
|
async () => snapshotDownloader(url, { headers }),
|
|
109
115
|
)) as IOdspResponse<IOdspSnapshot>;
|
|
@@ -119,16 +125,20 @@ export async function fetchSnapshotWithRedeem(
|
|
|
119
125
|
snapshotDownloader: (
|
|
120
126
|
finalOdspResolvedUrl: IOdspResolvedUrl,
|
|
121
127
|
storageToken: string,
|
|
128
|
+
loadingGroupIds: string[] | undefined,
|
|
122
129
|
snapshotOptions: ISnapshotOptions | undefined,
|
|
123
130
|
controller?: AbortController,
|
|
124
131
|
) => Promise<ISnapshotRequestAndResponseOptions>,
|
|
125
132
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
126
133
|
removeEntries: () => Promise<void>,
|
|
134
|
+
loadingGroupIds: string[] | undefined,
|
|
127
135
|
enableRedeemFallback?: boolean,
|
|
128
136
|
): Promise<ISnapshot> {
|
|
129
137
|
// back-compat: This block to be removed with #8784 when we only consume/consider odsp resolvers that are >= 0.51
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
|
130
139
|
const sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;
|
|
131
140
|
if (sharingLinkToRedeem) {
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
132
142
|
odspResolvedUrl.shareLinkInfo = { ...odspResolvedUrl.shareLinkInfo, sharingLinkToRedeem };
|
|
133
143
|
}
|
|
134
144
|
|
|
@@ -139,9 +149,11 @@ export async function fetchSnapshotWithRedeem(
|
|
|
139
149
|
logger,
|
|
140
150
|
snapshotDownloader,
|
|
141
151
|
putInCache,
|
|
152
|
+
loadingGroupIds,
|
|
142
153
|
enableRedeemFallback,
|
|
143
154
|
)
|
|
144
155
|
.catch(async (error) => {
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
145
157
|
if (enableRedeemFallback && isRedeemSharingLinkError(odspResolvedUrl, error)) {
|
|
146
158
|
// Execute the redeem fallback
|
|
147
159
|
|
|
@@ -166,6 +178,7 @@ export async function fetchSnapshotWithRedeem(
|
|
|
166
178
|
logger.sendTelemetryEvent(
|
|
167
179
|
{
|
|
168
180
|
eventName: "RedeemFallback",
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
169
182
|
errorType: error.errorType,
|
|
170
183
|
},
|
|
171
184
|
error,
|
|
@@ -178,6 +191,7 @@ export async function fetchSnapshotWithRedeem(
|
|
|
178
191
|
logger,
|
|
179
192
|
snapshotDownloader,
|
|
180
193
|
putInCache,
|
|
194
|
+
loadingGroupIds,
|
|
181
195
|
);
|
|
182
196
|
} else {
|
|
183
197
|
throw error;
|
|
@@ -190,7 +204,9 @@ export async function fetchSnapshotWithRedeem(
|
|
|
190
204
|
if (
|
|
191
205
|
(typeof error === "object" &&
|
|
192
206
|
error !== null &&
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
193
208
|
error.errorType === OdspErrorTypes.authorizationError) ||
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
194
210
|
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError
|
|
195
211
|
) {
|
|
196
212
|
await removeEntries();
|
|
@@ -204,7 +220,7 @@ async function redeemSharingLink(
|
|
|
204
220
|
storageTokenFetcher: InstrumentedStorageTokenFetcher,
|
|
205
221
|
logger: ITelemetryLoggerExt,
|
|
206
222
|
forceAccessTokenViaAuthorizationHeader: boolean,
|
|
207
|
-
) {
|
|
223
|
+
): Promise<IOdspResponse<unknown>> {
|
|
208
224
|
return PerformanceEvent.timedExecAsync(
|
|
209
225
|
logger,
|
|
210
226
|
{
|
|
@@ -243,29 +259,34 @@ async function fetchLatestSnapshotCore(
|
|
|
243
259
|
snapshotDownloader: (
|
|
244
260
|
finalOdspResolvedUrl: IOdspResolvedUrl,
|
|
245
261
|
storageToken: string,
|
|
262
|
+
loadingGroupIds: string[] | undefined,
|
|
246
263
|
snapshotOptions: ISnapshotOptions | undefined,
|
|
247
264
|
controller?: AbortController,
|
|
248
265
|
) => Promise<ISnapshotRequestAndResponseOptions>,
|
|
249
266
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
267
|
+
loadingGroupIds: string[] | undefined,
|
|
250
268
|
enableRedeemFallback?: boolean,
|
|
251
269
|
): Promise<ISnapshot> {
|
|
252
270
|
return getWithRetryForTokenRefresh(async (tokenFetchOptions) => {
|
|
253
|
-
const
|
|
271
|
+
const fetchSnapshotForLoadingGroup = isSnapshotFetchForLoadingGroup(loadingGroupIds);
|
|
272
|
+
const eventName = fetchSnapshotForLoadingGroup ? "TreesLatestForGroup" : "TreesLatest";
|
|
273
|
+
const storageToken = await storageTokenFetcher(tokenFetchOptions, eventName, true);
|
|
254
274
|
assert(storageToken !== null, 0x1e5 /* "Storage token should not be null" */);
|
|
255
275
|
|
|
256
276
|
const perfEvent = {
|
|
257
|
-
eventName
|
|
277
|
+
eventName,
|
|
258
278
|
attempts: tokenFetchOptions.refresh ? 2 : 1,
|
|
259
279
|
shareLinkPresent: odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined,
|
|
260
280
|
isSummarizer: odspResolvedUrl.summarizer,
|
|
261
281
|
redeemFallbackEnabled: enableRedeemFallback,
|
|
262
282
|
};
|
|
263
283
|
if (snapshotOptions !== undefined) {
|
|
264
|
-
|
|
284
|
+
for (const [key, value] of Object.entries(snapshotOptions)) {
|
|
265
285
|
if (value !== undefined) {
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
266
287
|
perfEvent[`snapshotOption_${key}`] = value;
|
|
267
288
|
}
|
|
268
|
-
}
|
|
289
|
+
}
|
|
269
290
|
}
|
|
270
291
|
// This event measures only successful cases of getLatest call (no tokens, no retries).
|
|
271
292
|
return PerformanceEvent.timedExecAsync(logger, perfEvent, async (event) => {
|
|
@@ -277,7 +298,13 @@ async function fetchLatestSnapshotCore(
|
|
|
277
298
|
}
|
|
278
299
|
|
|
279
300
|
const [response, fetchTime] = await measureP(async () =>
|
|
280
|
-
snapshotDownloader(
|
|
301
|
+
snapshotDownloader(
|
|
302
|
+
odspResolvedUrl,
|
|
303
|
+
storageToken,
|
|
304
|
+
loadingGroupIds,
|
|
305
|
+
snapshotOptions,
|
|
306
|
+
controller,
|
|
307
|
+
),
|
|
281
308
|
).finally(() => {
|
|
282
309
|
// Clear the fetchTimeout once the response is fetched.
|
|
283
310
|
if (fetchTimeout !== undefined) {
|
|
@@ -311,7 +338,7 @@ async function fetchLatestSnapshotCore(
|
|
|
311
338
|
case "application/json": {
|
|
312
339
|
let text: string;
|
|
313
340
|
[text, receiveContentTime] = await measureP(async () =>
|
|
314
|
-
odspResponse.content.text().catch((
|
|
341
|
+
odspResponse.content.text().catch((error) =>
|
|
315
342
|
// Parsing can fail and message could contain full request URI, including
|
|
316
343
|
// tokens, etc. So do not log error object itself.
|
|
317
344
|
throwOdspNetworkError(
|
|
@@ -341,7 +368,7 @@ async function fetchLatestSnapshotCore(
|
|
|
341
368
|
case "application/ms-fluid": {
|
|
342
369
|
let content: ArrayBuffer;
|
|
343
370
|
[content, receiveContentTime] = await measureP(async () =>
|
|
344
|
-
odspResponse.content.arrayBuffer().catch((
|
|
371
|
+
odspResponse.content.arrayBuffer().catch((error) =>
|
|
345
372
|
// Parsing can fail and message could contain full request URI, including
|
|
346
373
|
// tokens, etc. So do not log error object itself.
|
|
347
374
|
throwOdspNetworkError(
|
|
@@ -382,12 +409,13 @@ async function fetchLatestSnapshotCore(
|
|
|
382
409
|
parsedSnapshotContents = { ...odspResponse, content: snapshotContents };
|
|
383
410
|
break;
|
|
384
411
|
}
|
|
385
|
-
default:
|
|
412
|
+
default: {
|
|
386
413
|
throw new NonRetryableError(
|
|
387
414
|
"Unknown snapshot content type",
|
|
388
415
|
OdspErrorTypes.incorrectServerResponse,
|
|
389
416
|
propsToLog,
|
|
390
417
|
);
|
|
418
|
+
}
|
|
391
419
|
}
|
|
392
420
|
} catch (error) {
|
|
393
421
|
if (isFluidError(error)) {
|
|
@@ -411,9 +439,10 @@ async function fetchLatestSnapshotCore(
|
|
|
411
439
|
const { trees, numBlobs, encodedBlobsSize } = evalBlobsAndTrees(snapshot);
|
|
412
440
|
|
|
413
441
|
// There are some scenarios in ODSP where we cannot cache, trees/latest will explicitly tell us when we
|
|
414
|
-
// cannot cache using an HTTP response header.
|
|
442
|
+
// cannot cache using an HTTP response header. Only cache snapshot if it is not for a loading group.
|
|
415
443
|
const canCache =
|
|
416
|
-
odspResponse.headers.get("disablebrowsercachingofusercontent") !== "true"
|
|
444
|
+
odspResponse.headers.get("disablebrowsercachingofusercontent") !== "true" &&
|
|
445
|
+
!fetchSnapshotForLoadingGroup;
|
|
417
446
|
const sequenceNumber: number = snapshot.sequenceNumber ?? 0;
|
|
418
447
|
const seqNumberFromOps =
|
|
419
448
|
snapshot.ops && snapshot.ops.length > 0
|
|
@@ -456,8 +485,11 @@ async function fetchLatestSnapshotCore(
|
|
|
456
485
|
encodedBlobsSize,
|
|
457
486
|
sequenceNumber,
|
|
458
487
|
ops: snapshot.ops?.length ?? 0,
|
|
488
|
+
fetchSnapshotForLoadingGroup,
|
|
489
|
+
useLegacyFlowWithoutGroups:
|
|
490
|
+
useLegacyFlowWithoutGroupsForSnapshotFetch(loadingGroupIds),
|
|
459
491
|
userOps: snapshot.ops?.filter((op) => isRuntimeMessage(op)).length ?? 0,
|
|
460
|
-
headers: Object.keys(response.requestHeaders).length
|
|
492
|
+
headers: Object.keys(response.requestHeaders).length > 0 ? true : undefined,
|
|
461
493
|
// Measures time to make fetch call. Should be similar to
|
|
462
494
|
// fetchStartToResponseEndTime - receiveContentTime, i.e. it looks like it's time till first byte /
|
|
463
495
|
// end of response headers
|
|
@@ -489,9 +521,10 @@ async function fetchLatestSnapshotCore(
|
|
|
489
521
|
if (
|
|
490
522
|
typeof error === "object" &&
|
|
491
523
|
error !== null &&
|
|
492
|
-
(error.errorType === OdspErrorTypes.fetchFailure ||
|
|
493
|
-
error.errorType === OdspErrorTypes.fetchTimeout)
|
|
524
|
+
((error as Partial<IOdspError>).errorType === OdspErrorTypes.fetchFailure ||
|
|
525
|
+
(error as Partial<IOdspError>).errorType === OdspErrorTypes.fetchTimeout)
|
|
494
526
|
) {
|
|
527
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
495
528
|
error[getWithRetryForTokenRefreshRepeat] = true;
|
|
496
529
|
}
|
|
497
530
|
throw error;
|
|
@@ -502,40 +535,50 @@ async function fetchLatestSnapshotCore(
|
|
|
502
535
|
export interface ISnapshotRequestAndResponseOptions {
|
|
503
536
|
odspResponse: IOdspResponse<Response>;
|
|
504
537
|
requestUrl: string;
|
|
505
|
-
requestHeaders: { [index: string]:
|
|
538
|
+
requestHeaders: { [index: string]: string };
|
|
506
539
|
}
|
|
507
540
|
|
|
508
541
|
function getFormBodyAndHeaders(
|
|
509
542
|
odspResolvedUrl: IOdspResolvedUrl,
|
|
510
543
|
storageToken: string,
|
|
511
544
|
headers?: { [index: string]: string },
|
|
512
|
-
) {
|
|
545
|
+
): {
|
|
546
|
+
body: string;
|
|
547
|
+
headers: {
|
|
548
|
+
[index: string]: string;
|
|
549
|
+
};
|
|
550
|
+
} {
|
|
513
551
|
const formBoundary = uuid();
|
|
514
552
|
const formParams: string[] = [];
|
|
515
|
-
formParams.push(
|
|
516
|
-
|
|
517
|
-
|
|
553
|
+
formParams.push(
|
|
554
|
+
`--${formBoundary}`,
|
|
555
|
+
`Authorization: Bearer ${storageToken}`,
|
|
556
|
+
`X-HTTP-Method-Override: GET`,
|
|
557
|
+
);
|
|
518
558
|
|
|
519
559
|
if (headers !== undefined) {
|
|
520
|
-
|
|
560
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
521
561
|
if (value !== undefined) {
|
|
522
562
|
formParams.push(`${key}: ${value}`);
|
|
523
563
|
}
|
|
524
|
-
}
|
|
564
|
+
}
|
|
525
565
|
}
|
|
526
566
|
if (odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem) {
|
|
527
567
|
formParams.push(`sl: ${odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem}`);
|
|
528
568
|
}
|
|
529
|
-
formParams.push(`_post: 1
|
|
530
|
-
formParams.push(`\r\n--${formBoundary}--`);
|
|
569
|
+
formParams.push(`_post: 1`, `\r\n--${formBoundary}--`);
|
|
531
570
|
const postBody = formParams.join("\r\n");
|
|
532
|
-
const header: { [index: string]:
|
|
571
|
+
const header: { [index: string]: string } = {
|
|
533
572
|
"Content-Type": `multipart/form-data;boundary=${formBoundary}`,
|
|
534
573
|
};
|
|
535
574
|
return { body: postBody, headers: header };
|
|
536
575
|
}
|
|
537
576
|
|
|
538
|
-
export function evalBlobsAndTrees(snapshot: ISnapshot) {
|
|
577
|
+
export function evalBlobsAndTrees(snapshot: ISnapshot): {
|
|
578
|
+
trees: number;
|
|
579
|
+
numBlobs: number;
|
|
580
|
+
encodedBlobsSize: number;
|
|
581
|
+
} {
|
|
539
582
|
const trees = countTreesInSnapshotTree(snapshot.snapshotTree);
|
|
540
583
|
const numBlobs = snapshot.blobContents.size;
|
|
541
584
|
let encodedBlobsSize = 0;
|
|
@@ -545,7 +588,7 @@ export function evalBlobsAndTrees(snapshot: ISnapshot) {
|
|
|
545
588
|
return { trees, numBlobs, encodedBlobsSize };
|
|
546
589
|
}
|
|
547
590
|
|
|
548
|
-
export function validateBlobsAndTrees(snapshot: IOdspSnapshot) {
|
|
591
|
+
export function validateBlobsAndTrees(snapshot: IOdspSnapshot): void {
|
|
549
592
|
assert(
|
|
550
593
|
snapshot.trees !== undefined,
|
|
551
594
|
0x200 /* "Returned odsp snapshot is malformed. No trees!" */,
|
|
@@ -570,7 +613,10 @@ function countTreesInSnapshotTree(snapshotTree: ISnapshotTree): number {
|
|
|
570
613
|
* @param odspResolvedUrl - resolved odsp url.
|
|
571
614
|
* @param storageToken - token to do the auth for network request.
|
|
572
615
|
* @param snapshotOptions - Options used to specify how and what to fetch in the snapshot.
|
|
573
|
-
* @param
|
|
616
|
+
* @param loadingGroupIds - loadingGroupIds for which snapshot needs to be downloaded. Note:
|
|
617
|
+
* 1.) If undefined, then legacy trees latest call will be used where no groupId query param would be specified.
|
|
618
|
+
* 2.) If [] is passed, then snapshot with all ungrouped data will be fetched.
|
|
619
|
+
* 3.) If any groupId is specified like ["g1"], then snapshot for g1 group will be fetched.
|
|
574
620
|
* @param snapshotFormatFetchType - Snapshot format to fetch.
|
|
575
621
|
* @param controller - abort controller if caller needs to abort the network call.
|
|
576
622
|
* @param epochTracker - epoch tracker used to add/validate epoch in the network call.
|
|
@@ -579,7 +625,7 @@ function countTreesInSnapshotTree(snapshotTree: ISnapshotTree): number {
|
|
|
579
625
|
export async function downloadSnapshot(
|
|
580
626
|
odspResolvedUrl: IOdspResolvedUrl,
|
|
581
627
|
storageToken: string,
|
|
582
|
-
|
|
628
|
+
loadingGroupIds: string[] | undefined,
|
|
583
629
|
snapshotOptions: ISnapshotOptions | undefined,
|
|
584
630
|
snapshotFormatFetchType?: SnapshotFormatSupportType,
|
|
585
631
|
controller?: AbortController,
|
|
@@ -587,21 +633,27 @@ export async function downloadSnapshot(
|
|
|
587
633
|
scenarioName?: string,
|
|
588
634
|
): Promise<ISnapshotRequestAndResponseOptions> {
|
|
589
635
|
// back-compat: This block to be removed with #8784 when we only consume/consider odsp resolvers that are >= 0.51
|
|
636
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
|
590
637
|
const sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;
|
|
591
638
|
if (sharingLinkToRedeem) {
|
|
639
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
592
640
|
odspResolvedUrl.shareLinkInfo = { ...odspResolvedUrl.shareLinkInfo, sharingLinkToRedeem };
|
|
593
641
|
}
|
|
594
642
|
|
|
595
643
|
const snapshotUrl = odspResolvedUrl.endpoints.snapshotStorageUrl;
|
|
596
644
|
|
|
597
|
-
const queryParams = { ump: 1 };
|
|
645
|
+
const queryParams: Record<string, unknown> = { ump: 1 };
|
|
598
646
|
if (snapshotOptions !== undefined) {
|
|
599
|
-
|
|
647
|
+
for (const [key, value] of Object.entries(snapshotOptions)) {
|
|
600
648
|
// Exclude "timeout" from query string
|
|
601
649
|
if (value !== undefined && key !== "timeout") {
|
|
602
650
|
queryParams[key] = value;
|
|
603
651
|
}
|
|
604
|
-
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
if (loadingGroupIds !== undefined) {
|
|
656
|
+
queryParams.groupId = loadingGroupIds.join(",");
|
|
605
657
|
}
|
|
606
658
|
|
|
607
659
|
const queryString = getQueryString(queryParams);
|
|
@@ -609,7 +661,7 @@ export async function downloadSnapshot(
|
|
|
609
661
|
// The location of file can move on Spo in which case server returns 308(Permanent Redirect) error.
|
|
610
662
|
// Adding below header will make VROOM API return 404 instead of 308 and browser can intercept it.
|
|
611
663
|
// This error thrown by server will contain the new redirect location. Look at the 404 error parsing
|
|
612
|
-
// for
|
|
664
|
+
// for further reference here: \packages\utils\odsp-doclib-utils\src\odspErrorUtils.ts
|
|
613
665
|
const header = { prefer: "manualredirect" };
|
|
614
666
|
const { body, headers } = getFormBodyAndHeaders(odspResolvedUrl, storageToken, header);
|
|
615
667
|
const fetchOptions = {
|
|
@@ -620,12 +672,14 @@ export async function downloadSnapshot(
|
|
|
620
672
|
};
|
|
621
673
|
// Decide what snapshot format to fetch as per the feature gate.
|
|
622
674
|
switch (snapshotFormatFetchType) {
|
|
623
|
-
case SnapshotFormatSupportType.Binary:
|
|
675
|
+
case SnapshotFormatSupportType.Binary: {
|
|
624
676
|
headers.accept = `application/ms-fluid; v=${currentReadVersion}`;
|
|
625
677
|
break;
|
|
626
|
-
|
|
678
|
+
}
|
|
679
|
+
default: {
|
|
627
680
|
// By default ask both versions and let the server decide the format.
|
|
628
681
|
headers.accept = `application/json, application/ms-fluid; v=${currentReadVersion}`;
|
|
682
|
+
}
|
|
629
683
|
}
|
|
630
684
|
|
|
631
685
|
const odspResponse = await (epochTracker?.fetch(
|
|
@@ -643,7 +697,10 @@ export async function downloadSnapshot(
|
|
|
643
697
|
};
|
|
644
698
|
}
|
|
645
699
|
|
|
646
|
-
function isRedeemSharingLinkError(
|
|
700
|
+
function isRedeemSharingLinkError(
|
|
701
|
+
odspResolvedUrl: IOdspResolvedUrl,
|
|
702
|
+
error: Partial<IOdspError>,
|
|
703
|
+
): boolean {
|
|
647
704
|
if (
|
|
648
705
|
odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined &&
|
|
649
706
|
typeof error === "object" &&
|
package/src/getFileLink.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import type { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
7
|
import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
7
8
|
import { assert } from "@fluidframework/core-utils";
|
|
8
9
|
import { NonRetryableError, runWithRetry } from "@fluidframework/driver-utils";
|
|
@@ -12,14 +13,14 @@ import {
|
|
|
12
13
|
OdspResourceTokenFetchOptions,
|
|
13
14
|
TokenFetcher,
|
|
14
15
|
} from "@fluidframework/odsp-driver-definitions";
|
|
15
|
-
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
16
|
+
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.js";
|
|
16
17
|
import {
|
|
17
18
|
fetchHelper,
|
|
18
19
|
getWithRetryForTokenRefresh,
|
|
19
20
|
toInstrumentedOdspTokenFetcher,
|
|
20
|
-
} from "./odspUtils";
|
|
21
|
-
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
22
|
-
import { runWithRetry as runWithRetryForCoherencyAndServiceReadOnlyErrors } from "./retryUtils";
|
|
21
|
+
} from "./odspUtils.js";
|
|
22
|
+
import { pkgVersion as driverVersion } from "./packageVersion.js";
|
|
23
|
+
import { runWithRetry as runWithRetryForCoherencyAndServiceReadOnlyErrors } from "./retryUtils.js";
|
|
23
24
|
|
|
24
25
|
// Store cached responses for the lifetime of web session as file link remains the same for given file item
|
|
25
26
|
const fileLinkCache = new Map<string, Promise<string>>();
|
|
@@ -46,7 +47,7 @@ export async function getFileLink(
|
|
|
46
47
|
return maybeFileLinkCacheEntry;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
const fileLinkGenerator = async function () {
|
|
50
|
+
const fileLinkGenerator = async function (): Promise<string> {
|
|
50
51
|
let fileLinkCore: string;
|
|
51
52
|
try {
|
|
52
53
|
let retryCount = 0;
|
|
@@ -60,10 +61,13 @@ export async function getFileLink(
|
|
|
60
61
|
"getShareLink",
|
|
61
62
|
logger,
|
|
62
63
|
{
|
|
64
|
+
// TODO: use a stronger type
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
66
|
onRetry(delayInMs: number, error: any) {
|
|
64
67
|
retryCount++;
|
|
65
68
|
if (retryCount === 5) {
|
|
66
69
|
if (error !== undefined && typeof error === "object") {
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
67
71
|
error.canRetry = false;
|
|
68
72
|
throw error;
|
|
69
73
|
}
|
|
@@ -72,10 +76,10 @@ export async function getFileLink(
|
|
|
72
76
|
},
|
|
73
77
|
},
|
|
74
78
|
);
|
|
75
|
-
} catch (
|
|
79
|
+
} catch (error) {
|
|
76
80
|
// Delete from the cache to permit retrying later.
|
|
77
81
|
fileLinkCache.delete(cacheKey);
|
|
78
|
-
throw
|
|
82
|
+
throw error;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
// We are guaranteed to run the getFileLinkCore at least once with successful result (which must be a string)
|
|
@@ -144,7 +148,9 @@ async function getFileLinkCore(
|
|
|
144
148
|
const response = await fetchHelper(url, requestInit);
|
|
145
149
|
additionalProps = response.propsToLog;
|
|
146
150
|
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
147
152
|
const sharingInfo = await response.content.json();
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
148
154
|
const directUrl = sharingInfo?.d?.directUrl;
|
|
149
155
|
if (typeof directUrl !== "string") {
|
|
150
156
|
// This will retry once in getWithRetryForTokenRefresh
|
|
@@ -156,6 +162,7 @@ async function getFileLinkCore(
|
|
|
156
162
|
}
|
|
157
163
|
return directUrl;
|
|
158
164
|
});
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
159
166
|
event.end({ ...additionalProps, attempts });
|
|
160
167
|
return fileLink;
|
|
161
168
|
},
|
|
@@ -183,10 +190,11 @@ interface FileItemLite {
|
|
|
183
190
|
sharepointIds: IGraphSharepointIds;
|
|
184
191
|
}
|
|
185
192
|
|
|
186
|
-
const isFileItemLite = (maybeFileItemLite:
|
|
187
|
-
typeof maybeFileItemLite.webUrl === "string" &&
|
|
188
|
-
typeof maybeFileItemLite.webDavUrl === "string" &&
|
|
189
|
-
|
|
193
|
+
const isFileItemLite = (maybeFileItemLite: unknown): maybeFileItemLite is FileItemLite =>
|
|
194
|
+
typeof (maybeFileItemLite as Partial<FileItemLite>).webUrl === "string" &&
|
|
195
|
+
typeof (maybeFileItemLite as Partial<FileItemLite>).webDavUrl === "string" &&
|
|
196
|
+
// TODO: stronger check
|
|
197
|
+
typeof (maybeFileItemLite as Partial<FileItemLite>).sharepointIds === "object";
|
|
190
198
|
|
|
191
199
|
async function getFileItemLite(
|
|
192
200
|
getToken: TokenFetcher<OdspResourceTokenFetchOptions>,
|
|
@@ -199,7 +207,7 @@ async function getFileItemLite(
|
|
|
199
207
|
{ eventName: "odspFileLink", requestName: "getFileItemLite" },
|
|
200
208
|
async (event) => {
|
|
201
209
|
let attempts = 0;
|
|
202
|
-
let additionalProps;
|
|
210
|
+
let additionalProps: ITelemetryBaseProperties | undefined;
|
|
203
211
|
const fileItem = await getWithRetryForTokenRefresh(async (options) => {
|
|
204
212
|
attempts++;
|
|
205
213
|
const { siteUrl, driveId, itemId } = odspUrlParts;
|
|
@@ -224,7 +232,7 @@ async function getFileItemLite(
|
|
|
224
232
|
const response = await fetchHelper(url, requestInit);
|
|
225
233
|
additionalProps = response.propsToLog;
|
|
226
234
|
|
|
227
|
-
const responseJson = await response.content.json();
|
|
235
|
+
const responseJson: unknown = await response.content.json();
|
|
228
236
|
if (!isFileItemLite(responseJson)) {
|
|
229
237
|
// This will retry once in getWithRetryForTokenRefresh
|
|
230
238
|
throw new NonRetryableError(
|
package/src/getQueryString.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
import { ISnapshotOptions } from "@fluidframework/odsp-driver-definitions";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -15,6 +16,8 @@ export function getQueryString(
|
|
|
15
16
|
for (const key of Object.keys(queryParams)) {
|
|
16
17
|
if (queryParams[key] !== undefined) {
|
|
17
18
|
const startChar = queryString === "" ? "?" : "&";
|
|
19
|
+
// False-positive
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
18
21
|
queryString += `${startChar}${key}=${encodeURIComponent(queryParams[key])}`;
|
|
19
22
|
}
|
|
20
23
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Constants
|
|
7
|
-
export { OdcApiSiteOrigin, OdcFileSiteOrigin } from "./constants";
|
|
7
|
+
export { OdcApiSiteOrigin, OdcFileSiteOrigin } from "./constants.js";
|
|
8
8
|
|
|
9
9
|
export {
|
|
10
10
|
ClpCompliantAppHeader,
|
|
@@ -12,34 +12,34 @@ export {
|
|
|
12
12
|
ISharingLinkHeader,
|
|
13
13
|
OdspFluidDataStoreLocator,
|
|
14
14
|
SharingLinkHeader,
|
|
15
|
-
} from "./contractsPublic";
|
|
15
|
+
} from "./contractsPublic.js";
|
|
16
16
|
|
|
17
17
|
// public utils
|
|
18
|
-
export { checkUrl } from "./checkUrl";
|
|
19
|
-
export { createOdspUrl } from "./createOdspUrl";
|
|
20
|
-
export { getHashedDocumentId, ISnapshotContents } from "./odspPublicUtils";
|
|
21
|
-
export { getApiRoot, getOdspUrlParts, isOdcOrigin, isOdcUrl, isSpoUrl } from "./odspUrlHelper";
|
|
18
|
+
export { checkUrl } from "./checkUrl.js";
|
|
19
|
+
export { createOdspUrl } from "./createOdspUrl.js";
|
|
20
|
+
export { getHashedDocumentId, ISnapshotContents } from "./odspPublicUtils.js";
|
|
21
|
+
export { getApiRoot, getOdspUrlParts, isOdcOrigin, isOdcUrl, isSpoUrl } from "./odspUrlHelper.js";
|
|
22
22
|
|
|
23
23
|
// prefetch latest snapshot before container load
|
|
24
|
-
export { prefetchLatestSnapshot } from "./prefetchLatestSnapshot";
|
|
24
|
+
export { prefetchLatestSnapshot } from "./prefetchLatestSnapshot.js";
|
|
25
25
|
|
|
26
26
|
// Factory
|
|
27
27
|
export {
|
|
28
28
|
createLocalOdspDocumentServiceFactory,
|
|
29
29
|
OdspDocumentServiceFactory,
|
|
30
|
-
} from "./odspDocumentServiceFactory";
|
|
31
|
-
export { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore";
|
|
32
|
-
export { OdspDocumentServiceFactoryWithCodeSplit } from "./odspDocumentServiceFactoryWithCodeSplit";
|
|
30
|
+
} from "./odspDocumentServiceFactory.js";
|
|
31
|
+
export { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore.js";
|
|
32
|
+
export { OdspDocumentServiceFactoryWithCodeSplit } from "./odspDocumentServiceFactoryWithCodeSplit.js";
|
|
33
33
|
|
|
34
34
|
// File creation
|
|
35
|
-
export { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest";
|
|
35
|
+
export { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest.js";
|
|
36
36
|
|
|
37
37
|
// URI Resolver functionality, URI management
|
|
38
|
-
export { OdspDriverUrlResolver } from "./odspDriverUrlResolver";
|
|
38
|
+
export { OdspDriverUrlResolver } from "./odspDriverUrlResolver.js";
|
|
39
39
|
export {
|
|
40
40
|
OdspDriverUrlResolverForShareLink,
|
|
41
41
|
ShareLinkFetcherProps,
|
|
42
|
-
} from "./odspDriverUrlResolverForShareLink";
|
|
42
|
+
} from "./odspDriverUrlResolverForShareLink.js";
|
|
43
43
|
|
|
44
44
|
// It's used by URL resolve code, but also has some public functions
|
|
45
45
|
export {
|
|
@@ -47,15 +47,23 @@ export {
|
|
|
47
47
|
getLocatorFromOdspUrl,
|
|
48
48
|
locatorQueryParamName,
|
|
49
49
|
storeLocatorInOdspUrl,
|
|
50
|
-
} from "./odspFluidFileLink";
|
|
50
|
+
} from "./odspFluidFileLink.js";
|
|
51
51
|
|
|
52
52
|
export {
|
|
53
53
|
IOdspCache,
|
|
54
54
|
IPersistedFileCache,
|
|
55
55
|
INonPersistentCache,
|
|
56
56
|
IPrefetchSnapshotContents,
|
|
57
|
-
} from "./odspCache";
|
|
58
|
-
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
} from "./odspCache.js";
|
|
58
|
+
export {
|
|
59
|
+
ICacheAndTracker,
|
|
60
|
+
type EpochTracker,
|
|
61
|
+
FetchType,
|
|
62
|
+
FetchTypeInternal,
|
|
63
|
+
} from "./epochTracker.js";
|
|
64
|
+
export { IOdspResponse, isOdspResolvedUrl } from "./odspUtils.js";
|
|
65
|
+
export { SnapshotFormatSupportType } from "./fetchSnapshot.js";
|
|
66
|
+
export {
|
|
67
|
+
ISnapshotContentsWithProps,
|
|
68
|
+
parseCompactSnapshotResponse,
|
|
69
|
+
} from "./compactSnapshotParser.js";
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
import { UsageError } from "@fluidframework/driver-utils";
|
|
16
16
|
import { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions";
|
|
17
17
|
import { IClient } from "@fluidframework/protocol-definitions";
|
|
18
|
-
import { LocalOdspDeltaStorageService } from "./localOdspDeltaStorageService";
|
|
19
|
-
import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManager";
|
|
18
|
+
import { LocalOdspDeltaStorageService } from "./localOdspDeltaStorageService.js";
|
|
19
|
+
import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManager.js";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* IDocumentService implementation that provides explicit snapshot to the document storage service.
|
|
@@ -57,7 +57,7 @@ export class LocalOdspDocumentService
|
|
|
57
57
|
throw toThrow;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
public dispose(
|
|
60
|
+
public dispose(error?: unknown): void {
|
|
61
61
|
// Do nothing
|
|
62
62
|
}
|
|
63
63
|
}
|