@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.2.0.0.245554
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +33 -0
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +44 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/odsp-driver.api.md +16 -17
- package/dist/ReadBufferUtils.d.ts.map +1 -1
- package/dist/ReadBufferUtils.js.map +1 -1
- package/dist/WriteBufferUtils.d.ts +1 -1
- package/dist/WriteBufferUtils.d.ts.map +1 -1
- package/dist/WriteBufferUtils.js +12 -12
- package/dist/WriteBufferUtils.js.map +1 -1
- package/dist/checkUrl.d.ts.map +1 -1
- package/dist/checkUrl.js +5 -3
- package/dist/checkUrl.js.map +1 -1
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +94 -75
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts +2 -2
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +26 -20
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +24 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +5 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createFile.d.ts +4 -4
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createFile.js +36 -52
- package/dist/createFile.js.map +1 -1
- package/dist/createNewContainerOnExistingFile.d.ts +2 -2
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/createNewContainerOnExistingFile.js +14 -14
- package/dist/createNewContainerOnExistingFile.js.map +1 -1
- package/dist/createNewModule.d.ts +2 -2
- package/dist/createNewModule.d.ts.map +1 -1
- package/dist/createNewModule.js +4 -4
- package/dist/createNewModule.js.map +1 -1
- package/dist/createNewUtils.d.ts +4 -4
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +16 -11
- package/dist/createNewUtils.js.map +1 -1
- package/dist/createOdspCreateContainerRequest.d.ts +2 -2
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/createOdspCreateContainerRequest.js +2 -2
- package/dist/createOdspCreateContainerRequest.js.map +1 -1
- package/dist/createOdspUrl.d.ts +1 -1
- package/dist/createOdspUrl.d.ts.map +1 -1
- package/dist/createOdspUrl.js.map +1 -1
- package/dist/epochTracker.d.ts +10 -9
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +67 -45
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts +14 -11
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +91 -71
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js +25 -18
- package/dist/getFileLink.js.map +1 -1
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/getQueryString.js +2 -0
- package/dist/getQueryString.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -3
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.js +8 -6
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +8 -6
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +10 -9
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -2
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js +9 -6
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/dist/odsp-driver-alpha.d.ts +31 -15
- package/dist/odsp-driver-beta.d.ts +4 -5
- package/dist/odsp-driver-public.d.ts +4 -5
- package/dist/odsp-driver-untrimmed.d.ts +34 -16
- package/dist/odspCache.d.ts +5 -5
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js +1 -2
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +12 -6
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +89 -25
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDeltaStorageService.d.ts +7 -7
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/odspDeltaStorageService.js +5 -5
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +41 -23
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts +9 -6
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js +25 -19
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.d.ts +6 -1
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js +9 -4
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +4 -4
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +27 -30
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js +2 -2
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +17 -10
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +226 -169
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +4 -6
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +34 -31
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +1 -1
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +26 -32
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +13 -6
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +47 -37
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspError.d.ts +1 -1
- package/dist/odspError.d.ts.map +1 -1
- package/dist/odspError.js +6 -6
- package/dist/odspError.js.map +1 -1
- package/dist/odspFluidFileLink.d.ts +1 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspFluidFileLink.js +2 -2
- package/dist/odspFluidFileLink.js.map +1 -1
- package/dist/odspLocationRedirection.js +2 -2
- package/dist/odspLocationRedirection.js.map +1 -1
- package/dist/odspPublicUtils.d.ts +4 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/odspPublicUtils.js +3 -0
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts +3 -3
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js +5 -3
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspSummaryUploadManager.d.ts +1 -1
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/odspSummaryUploadManager.js +9 -6
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/odspUrlHelper.js +1 -2
- package/dist/odspUrlHelper.js.map +1 -1
- package/dist/odspUtils.d.ts +29 -13
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +75 -41
- package/dist/odspUtils.js.map +1 -1
- package/dist/opsCaching.d.ts +1 -1
- package/dist/opsCaching.d.ts.map +1 -1
- package/dist/opsCaching.js +2 -1
- package/dist/opsCaching.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/prefetchLatestSnapshot.d.ts +2 -2
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.js +17 -12
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/dist/retryErrorsStorageAdapter.d.ts +2 -2
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js +10 -5
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.d.ts.map +1 -1
- package/dist/retryUtils.js +7 -3
- package/dist/retryUtils.js.map +1 -1
- package/dist/socketModule.d.ts.map +1 -1
- package/dist/socketModule.js +2 -0
- package/dist/socketModule.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/vroom.d.ts +2 -2
- package/dist/vroom.d.ts.map +1 -1
- package/dist/vroom.js +5 -5
- package/dist/vroom.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js +17 -13
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/{ReadBufferUtils.d.mts → ReadBufferUtils.d.ts} +1 -1
- package/lib/ReadBufferUtils.d.ts.map +1 -0
- package/lib/{ReadBufferUtils.mjs → ReadBufferUtils.js} +1 -1
- package/lib/ReadBufferUtils.js.map +1 -0
- package/lib/{WriteBufferUtils.d.mts → WriteBufferUtils.d.ts} +2 -2
- package/lib/WriteBufferUtils.d.ts.map +1 -0
- package/lib/{WriteBufferUtils.mjs → WriteBufferUtils.js} +2 -2
- package/lib/WriteBufferUtils.js.map +1 -0
- package/lib/{checkUrl.d.mts → checkUrl.d.ts} +1 -1
- package/lib/checkUrl.d.ts.map +1 -0
- package/lib/{checkUrl.mjs → checkUrl.js} +5 -3
- package/lib/checkUrl.js.map +1 -0
- package/lib/{compactSnapshotParser.d.mts → compactSnapshotParser.d.ts} +3 -3
- package/lib/compactSnapshotParser.d.ts.map +1 -0
- package/lib/{compactSnapshotParser.mjs → compactSnapshotParser.js} +69 -50
- package/lib/compactSnapshotParser.js.map +1 -0
- package/lib/{compactSnapshotWriter.d.mts → compactSnapshotWriter.d.ts} +3 -3
- package/lib/compactSnapshotWriter.d.ts.map +1 -0
- package/lib/{compactSnapshotWriter.mjs → compactSnapshotWriter.js} +14 -8
- package/lib/compactSnapshotWriter.js.map +1 -0
- package/lib/{constants.d.mts → constants.d.ts} +1 -1
- package/lib/constants.d.ts.map +1 -0
- package/lib/{constants.mjs → constants.js} +1 -1
- package/lib/constants.js.map +1 -0
- package/lib/{contracts.d.mts → contracts.d.ts} +25 -5
- package/lib/contracts.d.ts.map +1 -0
- package/lib/contracts.js +10 -0
- package/lib/contracts.js.map +1 -0
- package/lib/{contractsPublic.d.mts → contractsPublic.d.ts} +1 -1
- package/lib/contractsPublic.d.ts.map +1 -0
- package/lib/{contractsPublic.mjs → contractsPublic.js} +1 -1
- package/lib/contractsPublic.js.map +1 -0
- package/lib/{createFile.d.mts → createFile.d.ts} +5 -5
- package/lib/createFile.d.ts.map +1 -0
- package/lib/{createFile.mjs → createFile.js} +25 -41
- package/lib/createFile.js.map +1 -0
- package/lib/{createNewContainerOnExistingFile.d.mts → createNewContainerOnExistingFile.d.ts} +3 -3
- package/lib/createNewContainerOnExistingFile.d.ts.map +1 -0
- package/lib/{createNewContainerOnExistingFile.mjs → createNewContainerOnExistingFile.js} +7 -7
- package/lib/createNewContainerOnExistingFile.js.map +1 -0
- package/lib/{createNewModule.mjs → createNewModule.d.ts} +3 -3
- package/lib/createNewModule.d.ts.map +1 -0
- package/lib/{createNewModule.d.mts → createNewModule.js} +3 -3
- package/lib/createNewModule.js.map +1 -0
- package/lib/{createNewUtils.d.mts → createNewUtils.d.ts} +5 -5
- package/lib/createNewUtils.d.ts.map +1 -0
- package/lib/{createNewUtils.mjs → createNewUtils.js} +13 -8
- package/lib/createNewUtils.js.map +1 -0
- package/lib/{createOdspCreateContainerRequest.d.mts → createOdspCreateContainerRequest.d.ts} +7 -3
- package/lib/createOdspCreateContainerRequest.d.ts.map +1 -0
- package/lib/{createOdspCreateContainerRequest.mjs → createOdspCreateContainerRequest.js} +2 -2
- package/lib/createOdspCreateContainerRequest.js.map +1 -0
- package/lib/{createOdspUrl.d.mts → createOdspUrl.d.ts} +2 -2
- package/lib/createOdspUrl.d.ts.map +1 -0
- package/lib/{createOdspUrl.mjs → createOdspUrl.js} +1 -1
- package/lib/createOdspUrl.js.map +1 -0
- package/lib/{epochTracker.d.mts → epochTracker.d.ts} +11 -10
- package/lib/epochTracker.d.ts.map +1 -0
- package/lib/{epochTracker.mjs → epochTracker.js} +58 -36
- package/lib/epochTracker.js.map +1 -0
- package/lib/{fetch.d.mts → fetch.d.ts} +1 -1
- package/lib/fetch.d.ts.map +1 -0
- package/lib/{fetch.mjs → fetch.js} +1 -1
- package/lib/fetch.js.map +1 -0
- package/lib/{fetchSnapshot.d.mts → fetchSnapshot.d.ts} +15 -12
- package/lib/fetchSnapshot.d.ts.map +1 -0
- package/lib/{fetchSnapshot.mjs → fetchSnapshot.js} +74 -54
- package/lib/fetchSnapshot.js.map +1 -0
- package/lib/{getFileLink.d.mts → getFileLink.d.ts} +1 -1
- package/lib/getFileLink.d.ts.map +1 -0
- package/lib/{getFileLink.mjs → getFileLink.js} +17 -10
- package/lib/getFileLink.js.map +1 -0
- package/lib/{getQueryString.d.mts → getQueryString.d.ts} +5 -1
- package/lib/getQueryString.d.ts.map +1 -0
- package/lib/{getQueryString.mjs → getQueryString.js} +3 -1
- package/lib/getQueryString.js.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.d.mts → getUrlAndHeadersWithAuth.d.ts} +1 -1
- package/lib/getUrlAndHeadersWithAuth.d.ts.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.mjs → getUrlAndHeadersWithAuth.js} +1 -1
- package/lib/getUrlAndHeadersWithAuth.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +20 -20
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +29 -0
- package/lib/index.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDeltaStorageService.d.mts → localOdspDeltaStorageService.d.ts} +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDeltaStorageService.mjs → localOdspDeltaStorageService.js} +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.d.mts → localOdspDocumentService.d.ts} +5 -4
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.mjs → localOdspDocumentService.js} +7 -5
- package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.mts → localOdspDocumentServiceFactory.d.ts} +9 -7
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.mjs → localOdspDocumentServiceFactory.js} +9 -8
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.mts → localOdspDocumentStorageManager.d.ts} +4 -3
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.mjs → localOdspDocumentStorageManager.js} +7 -4
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
- package/lib/{odsp-driver-alpha.d.mts → odsp-driver-alpha.d.ts} +31 -15
- package/lib/{odsp-driver-beta.d.mts → odsp-driver-beta.d.ts} +4 -5
- package/lib/{odsp-driver-public.d.mts → odsp-driver-public.d.ts} +4 -5
- package/lib/{odsp-driver-untrimmed.d.mts → odsp-driver-untrimmed.d.ts} +34 -16
- package/lib/{odspCache.d.mts → odspCache.d.ts} +10 -6
- package/lib/odspCache.d.ts.map +1 -0
- package/lib/{odspCache.mjs → odspCache.js} +6 -3
- package/lib/odspCache.js.map +1 -0
- package/lib/{odspDelayLoadedDeltaStream.d.mts → odspDelayLoadedDeltaStream.d.ts} +13 -7
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -0
- package/lib/{odspDelayLoadedDeltaStream.mjs → odspDelayLoadedDeltaStream.js} +84 -20
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -0
- package/lib/{odspDeltaStorageService.d.mts → odspDeltaStorageService.d.ts} +8 -8
- package/lib/odspDeltaStorageService.d.ts.map +1 -0
- package/lib/{odspDeltaStorageService.mjs → odspDeltaStorageService.js} +5 -5
- package/lib/odspDeltaStorageService.js.map +1 -0
- package/lib/{odspDocumentDeltaConnection.d.mts → odspDocumentDeltaConnection.d.ts} +2 -2
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -0
- package/lib/{odspDocumentDeltaConnection.mjs → odspDocumentDeltaConnection.js} +34 -16
- package/lib/odspDocumentDeltaConnection.js.map +1 -0
- package/lib/{odspDocumentService.d.mts → odspDocumentService.d.ts} +10 -7
- package/lib/odspDocumentService.d.ts.map +1 -0
- package/lib/{odspDocumentService.mjs → odspDocumentService.js} +22 -14
- package/lib/odspDocumentService.js.map +1 -0
- package/lib/{odspDocumentServiceFactory.d.mts → odspDocumentServiceFactory.d.ts} +7 -2
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -0
- package/lib/{odspDocumentServiceFactory.mjs → odspDocumentServiceFactory.js} +9 -3
- package/lib/odspDocumentServiceFactory.js.map +1 -0
- package/lib/{odspDocumentServiceFactoryCore.d.mts → odspDocumentServiceFactoryCore.d.ts} +5 -5
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -0
- package/lib/{odspDocumentServiceFactoryCore.mjs → odspDocumentServiceFactoryCore.js} +25 -26
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.mts → odspDocumentServiceFactoryWithCodeSplit.d.ts} +2 -2
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.mjs → odspDocumentServiceFactoryWithCodeSplit.js} +2 -2
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -0
- package/lib/{odspDocumentStorageManager.d.mts → odspDocumentStorageManager.d.ts} +18 -11
- package/lib/odspDocumentStorageManager.d.ts.map +1 -0
- package/lib/{odspDocumentStorageManager.mjs → odspDocumentStorageManager.js} +221 -162
- package/lib/odspDocumentStorageManager.js.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.d.mts → odspDocumentStorageServiceBase.d.ts} +5 -7
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.mjs → odspDocumentStorageServiceBase.js} +34 -31
- package/lib/odspDocumentStorageServiceBase.js.map +1 -0
- package/lib/{odspDriverUrlResolver.d.mts → odspDriverUrlResolver.d.ts} +2 -2
- package/lib/odspDriverUrlResolver.d.ts.map +1 -0
- package/lib/{odspDriverUrlResolver.mjs → odspDriverUrlResolver.js} +27 -29
- package/lib/odspDriverUrlResolver.js.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.d.mts → odspDriverUrlResolverForShareLink.d.ts} +14 -7
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.mjs → odspDriverUrlResolverForShareLink.js} +41 -27
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -0
- package/lib/{odspError.d.mts → odspError.d.ts} +2 -2
- package/lib/odspError.d.ts.map +1 -0
- package/lib/{odspError.mjs → odspError.js} +6 -6
- package/lib/odspError.js.map +1 -0
- package/lib/{odspFluidFileLink.d.mts → odspFluidFileLink.d.ts} +2 -2
- package/lib/odspFluidFileLink.d.ts.map +1 -0
- package/lib/{odspFluidFileLink.mjs → odspFluidFileLink.js} +2 -2
- package/lib/odspFluidFileLink.js.map +1 -0
- package/lib/{odspLocationRedirection.d.mts → odspLocationRedirection.d.ts} +1 -1
- package/lib/odspLocationRedirection.d.ts.map +1 -0
- package/lib/{odspLocationRedirection.mjs → odspLocationRedirection.js} +2 -2
- package/lib/odspLocationRedirection.js.map +1 -0
- package/lib/{odspPublicUtils.d.mts → odspPublicUtils.d.ts} +5 -1
- package/lib/odspPublicUtils.d.ts.map +1 -0
- package/lib/{odspPublicUtils.mjs → odspPublicUtils.js} +4 -1
- package/lib/odspPublicUtils.js.map +1 -0
- package/lib/{odspSnapshotParser.d.mts → odspSnapshotParser.d.ts} +4 -4
- package/lib/odspSnapshotParser.d.ts.map +1 -0
- package/lib/{odspSnapshotParser.mjs → odspSnapshotParser.js} +6 -4
- package/lib/odspSnapshotParser.js.map +1 -0
- package/lib/{odspSummaryUploadManager.d.mts → odspSummaryUploadManager.d.ts} +2 -2
- package/lib/odspSummaryUploadManager.d.ts.map +1 -0
- package/lib/{odspSummaryUploadManager.mjs → odspSummaryUploadManager.js} +8 -5
- package/lib/odspSummaryUploadManager.js.map +1 -0
- package/lib/{odspUrlHelper.d.mts → odspUrlHelper.d.ts} +1 -1
- package/lib/odspUrlHelper.d.ts.map +1 -0
- package/lib/{odspUrlHelper.mjs → odspUrlHelper.js} +2 -3
- package/lib/odspUrlHelper.js.map +1 -0
- package/lib/{odspUtils.d.mts → odspUtils.d.ts} +30 -14
- package/lib/odspUtils.d.ts.map +1 -0
- package/lib/{odspUtils.mjs → odspUtils.js} +61 -30
- package/lib/odspUtils.js.map +1 -0
- package/lib/{opsCaching.d.mts → opsCaching.d.ts} +2 -2
- package/lib/opsCaching.d.ts.map +1 -0
- package/lib/{opsCaching.mjs → opsCaching.js} +3 -2
- package/lib/opsCaching.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{prefetchLatestSnapshot.d.mts → prefetchLatestSnapshot.d.ts} +3 -3
- package/lib/prefetchLatestSnapshot.d.ts.map +1 -0
- package/lib/{prefetchLatestSnapshot.mjs → prefetchLatestSnapshot.js} +16 -11
- package/lib/prefetchLatestSnapshot.js.map +1 -0
- package/lib/{retryErrorsStorageAdapter.d.mts → retryErrorsStorageAdapter.d.ts} +3 -3
- package/lib/retryErrorsStorageAdapter.d.ts.map +1 -0
- package/lib/{retryErrorsStorageAdapter.mjs → retryErrorsStorageAdapter.js} +11 -6
- package/lib/retryErrorsStorageAdapter.js.map +1 -0
- package/lib/{retryUtils.d.mts → retryUtils.d.ts} +1 -1
- package/lib/retryUtils.d.ts.map +1 -0
- package/lib/{retryUtils.mjs → retryUtils.js} +8 -4
- package/lib/retryUtils.js.map +1 -0
- package/lib/{socketModule.d.mts → socketModule.d.ts} +1 -1
- package/lib/socketModule.d.ts.map +1 -0
- package/lib/{socketModule.mjs → socketModule.js} +3 -1
- package/lib/socketModule.js.map +1 -0
- package/lib/test/buildOdspShareLinkReqParams.spec.js +25 -0
- package/lib/test/buildOdspShareLinkReqParams.spec.js.map +1 -0
- package/lib/test/createNewUtilsTests.spec.js +221 -0
- package/lib/test/createNewUtilsTests.spec.js.map +1 -0
- package/lib/test/deltaStorageService.spec.js +176 -0
- package/lib/test/deltaStorageService.spec.js.map +1 -0
- package/lib/test/epochTests.spec.js +340 -0
- package/lib/test/epochTests.spec.js.map +1 -0
- package/lib/test/epochTestsWithRedemption.spec.js +119 -0
- package/lib/test/epochTestsWithRedemption.spec.js.map +1 -0
- package/lib/test/fetchSnapshot.spec.js +412 -0
- package/lib/test/fetchSnapshot.spec.js.map +1 -0
- package/lib/test/getFileLink.spec.js +62 -0
- package/lib/test/getFileLink.spec.js.map +1 -0
- package/lib/test/getUrlAndHeadersWithAuth.spec.js +66 -0
- package/lib/test/getUrlAndHeadersWithAuth.spec.js.map +1 -0
- package/lib/test/getVersions.spec.js +284 -0
- package/lib/test/getVersions.spec.js.map +1 -0
- package/lib/test/joinSessionCacheTests.spec.js +53 -0
- package/lib/test/joinSessionCacheTests.spec.js.map +1 -0
- package/lib/test/joinSessionPeriodicCall.spec.js +158 -0
- package/lib/test/joinSessionPeriodicCall.spec.js.map +1 -0
- package/lib/test/jsonSnapshotFormatTests.spec.js +107 -0
- package/lib/test/jsonSnapshotFormatTests.spec.js.map +1 -0
- package/lib/test/localOdspDriver.spec.js +177 -0
- package/lib/test/localOdspDriver.spec.js.map +1 -0
- package/lib/test/mockFetch.js +61 -0
- package/lib/test/mockFetch.js.map +1 -0
- package/lib/test/odspCreateContainer.spec.js +116 -0
- package/lib/test/odspCreateContainer.spec.js.map +1 -0
- package/lib/test/odspDriverResolverTest.spec.js +289 -0
- package/lib/test/odspDriverResolverTest.spec.js.map +1 -0
- package/lib/test/odspDriverUrlResolverForShareLink.spec.js +287 -0
- package/lib/test/odspDriverUrlResolverForShareLink.spec.js.map +1 -0
- package/lib/test/odspError.spec.js +299 -0
- package/lib/test/odspError.spec.js.map +1 -0
- package/lib/test/opsCaching.spec.js +357 -0
- package/lib/test/opsCaching.spec.js.map +1 -0
- package/lib/test/prefetchSnapshotTests.spec.js +420 -0
- package/lib/test/prefetchSnapshotTests.spec.js.map +1 -0
- package/lib/test/snapshotFormatTests.spec.js +218 -0
- package/lib/test/snapshotFormatTests.spec.js.map +1 -0
- package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js +152 -0
- package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js.map +1 -0
- package/lib/test/socketTests/socketMock.js +109 -0
- package/lib/test/socketTests/socketMock.js.map +1 -0
- package/lib/test/socketTests/socketTests.spec.js +256 -0
- package/lib/test/socketTests/socketTests.spec.js.map +1 -0
- package/lib/test/tokenFetch.spec.js +39 -0
- package/lib/test/tokenFetch.spec.js.map +1 -0
- package/lib/test/types/validateOdspDriverPrevious.generated.js +96 -0
- package/lib/test/types/validateOdspDriverPrevious.generated.js.map +1 -0
- package/lib/test/zipItDataRepresentationTests.spec.js +207 -0
- package/lib/test/zipItDataRepresentationTests.spec.js.map +1 -0
- package/lib/{vroom.d.mts → vroom.d.ts} +3 -3
- package/lib/vroom.d.ts.map +1 -0
- package/lib/{vroom.mjs → vroom.js} +4 -4
- package/lib/vroom.js.map +1 -0
- package/lib/{zipItDataRepresentationUtils.d.mts → zipItDataRepresentationUtils.d.ts} +2 -2
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -0
- package/lib/{zipItDataRepresentationUtils.mjs → zipItDataRepresentationUtils.js} +19 -11
- package/lib/zipItDataRepresentationUtils.js.map +1 -0
- package/package.json +100 -32
- package/src/ReadBufferUtils.ts +7 -7
- package/src/WriteBufferUtils.ts +13 -9
- package/src/checkUrl.ts +4 -2
- package/src/compactSnapshotParser.ts +97 -61
- package/src/compactSnapshotWriter.ts +22 -15
- package/src/contracts.ts +33 -4
- package/src/createFile.ts +26 -51
- package/src/createNewContainerOnExistingFile.ts +10 -10
- package/src/createNewModule.ts +2 -2
- package/src/createNewUtils.ts +26 -15
- package/src/createOdspCreateContainerRequest.ts +3 -3
- package/src/createOdspUrl.ts +1 -1
- package/src/epochTracker.ts +93 -58
- package/src/fetchSnapshot.ts +122 -66
- package/src/getFileLink.ts +24 -16
- package/src/getQueryString.ts +2 -0
- package/src/index.ts +27 -19
- package/src/localOdspDriver/localOdspDocumentService.ts +12 -5
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +12 -11
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +15 -8
- package/src/odspCache.ts +14 -11
- package/src/odspDelayLoadedDeltaStream.ts +113 -31
- package/src/odspDeltaStorageService.ts +17 -16
- package/src/odspDocumentDeltaConnection.ts +52 -34
- package/src/odspDocumentService.ts +33 -22
- package/src/odspDocumentServiceFactory.ts +7 -2
- package/src/odspDocumentServiceFactoryCore.ts +28 -29
- package/src/odspDocumentServiceFactoryWithCodeSplit.ts +1 -1
- package/src/odspDocumentStorageManager.ts +303 -210
- package/src/odspDocumentStorageServiceBase.ts +52 -47
- package/src/odspDriverUrlResolver.ts +41 -41
- package/src/odspDriverUrlResolverForShareLink.ts +50 -31
- package/src/odspError.ts +6 -7
- package/src/odspFluidFileLink.ts +3 -3
- package/src/odspLocationRedirection.ts +1 -1
- package/src/odspPublicUtils.ts +4 -0
- package/src/odspSnapshotParser.ts +9 -9
- package/src/odspSummaryUploadManager.ts +21 -9
- package/src/odspUrlHelper.ts +2 -3
- package/src/odspUtils.ts +102 -53
- package/src/opsCaching.ts +13 -12
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +24 -15
- package/src/retryErrorsStorageAdapter.ts +16 -9
- package/src/retryUtils.ts +8 -4
- package/src/socketModule.ts +2 -0
- package/src/vroom.ts +6 -6
- package/src/zipItDataRepresentationUtils.ts +65 -37
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/.eslintrc.js +0 -18
- package/lib/ReadBufferUtils.d.mts.map +0 -1
- package/lib/ReadBufferUtils.mjs.map +0 -1
- package/lib/WriteBufferUtils.d.mts.map +0 -1
- package/lib/WriteBufferUtils.mjs.map +0 -1
- package/lib/checkUrl.d.mts.map +0 -1
- package/lib/checkUrl.mjs.map +0 -1
- package/lib/compactSnapshotParser.d.mts.map +0 -1
- package/lib/compactSnapshotParser.mjs.map +0 -1
- package/lib/compactSnapshotWriter.d.mts.map +0 -1
- package/lib/compactSnapshotWriter.mjs.map +0 -1
- package/lib/constants.d.mts.map +0 -1
- package/lib/constants.mjs.map +0 -1
- package/lib/contracts.d.mts.map +0 -1
- package/lib/contracts.mjs +0 -6
- package/lib/contracts.mjs.map +0 -1
- package/lib/contractsPublic.d.mts.map +0 -1
- package/lib/contractsPublic.mjs.map +0 -1
- package/lib/createFile.d.mts.map +0 -1
- package/lib/createFile.mjs.map +0 -1
- package/lib/createNewContainerOnExistingFile.d.mts.map +0 -1
- package/lib/createNewContainerOnExistingFile.mjs.map +0 -1
- package/lib/createNewModule.d.mts.map +0 -1
- package/lib/createNewModule.mjs.map +0 -1
- package/lib/createNewUtils.d.mts.map +0 -1
- package/lib/createNewUtils.mjs.map +0 -1
- package/lib/createOdspCreateContainerRequest.d.mts.map +0 -1
- package/lib/createOdspCreateContainerRequest.mjs.map +0 -1
- package/lib/createOdspUrl.d.mts.map +0 -1
- package/lib/createOdspUrl.mjs.map +0 -1
- package/lib/epochTracker.d.mts.map +0 -1
- package/lib/epochTracker.mjs.map +0 -1
- package/lib/fetch.d.mts.map +0 -1
- package/lib/fetch.mjs.map +0 -1
- package/lib/fetchSnapshot.d.mts.map +0 -1
- package/lib/fetchSnapshot.mjs.map +0 -1
- package/lib/getFileLink.d.mts.map +0 -1
- package/lib/getFileLink.mjs.map +0 -1
- package/lib/getQueryString.d.mts.map +0 -1
- package/lib/getQueryString.mjs.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.d.mts.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -22
- package/lib/index.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +0 -1
- package/lib/odspCache.d.mts.map +0 -1
- package/lib/odspCache.mjs.map +0 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts.map +0 -1
- package/lib/odspDelayLoadedDeltaStream.mjs.map +0 -1
- package/lib/odspDeltaStorageService.d.mts.map +0 -1
- package/lib/odspDeltaStorageService.mjs.map +0 -1
- package/lib/odspDocumentDeltaConnection.d.mts.map +0 -1
- package/lib/odspDocumentDeltaConnection.mjs.map +0 -1
- package/lib/odspDocumentService.d.mts.map +0 -1
- package/lib/odspDocumentService.mjs.map +0 -1
- package/lib/odspDocumentServiceFactory.d.mts.map +0 -1
- package/lib/odspDocumentServiceFactory.mjs.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.d.mts.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.mjs.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +0 -1
- package/lib/odspDocumentStorageManager.d.mts.map +0 -1
- package/lib/odspDocumentStorageManager.mjs.map +0 -1
- package/lib/odspDocumentStorageServiceBase.d.mts.map +0 -1
- package/lib/odspDocumentStorageServiceBase.mjs.map +0 -1
- package/lib/odspDriverUrlResolver.d.mts.map +0 -1
- package/lib/odspDriverUrlResolver.mjs.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.d.mts.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.mjs.map +0 -1
- package/lib/odspError.d.mts.map +0 -1
- package/lib/odspError.mjs.map +0 -1
- package/lib/odspFluidFileLink.d.mts.map +0 -1
- package/lib/odspFluidFileLink.mjs.map +0 -1
- package/lib/odspLocationRedirection.d.mts.map +0 -1
- package/lib/odspLocationRedirection.mjs.map +0 -1
- package/lib/odspPublicUtils.d.mts.map +0 -1
- package/lib/odspPublicUtils.mjs.map +0 -1
- package/lib/odspSnapshotParser.d.mts.map +0 -1
- package/lib/odspSnapshotParser.mjs.map +0 -1
- package/lib/odspSummaryUploadManager.d.mts.map +0 -1
- package/lib/odspSummaryUploadManager.mjs.map +0 -1
- package/lib/odspUrlHelper.d.mts.map +0 -1
- package/lib/odspUrlHelper.mjs.map +0 -1
- package/lib/odspUtils.d.mts.map +0 -1
- package/lib/odspUtils.mjs.map +0 -1
- package/lib/opsCaching.d.mts.map +0 -1
- package/lib/opsCaching.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/prefetchLatestSnapshot.d.mts.map +0 -1
- package/lib/prefetchLatestSnapshot.mjs.map +0 -1
- package/lib/retryErrorsStorageAdapter.d.mts.map +0 -1
- package/lib/retryErrorsStorageAdapter.mjs.map +0 -1
- package/lib/retryUtils.d.mts.map +0 -1
- package/lib/retryUtils.mjs.map +0 -1
- package/lib/socketModule.d.mts.map +0 -1
- package/lib/socketModule.mjs.map +0 -1
- package/lib/vroom.d.mts.map +0 -1
- package/lib/vroom.mjs.map +0 -1
- package/lib/zipItDataRepresentationUtils.d.mts.map +0 -1
- package/lib/zipItDataRepresentationUtils.mjs.map +0 -1
package/src/fetchSnapshot.ts
CHANGED
|
@@ -13,12 +13,13 @@ import {
|
|
|
13
13
|
import { fromUtf8ToBase64 } from "@fluid-internal/client-utils";
|
|
14
14
|
import { assert } from "@fluidframework/core-utils";
|
|
15
15
|
import { getW3CData } from "@fluidframework/driver-base";
|
|
16
|
-
import {
|
|
16
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
17
17
|
import {
|
|
18
18
|
IOdspResolvedUrl,
|
|
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,33 +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
|
-
|
|
48
|
-
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "./odspSnapshotParser";
|
|
51
|
+
useLegacyFlowWithoutGroupsForSnapshotFetch,
|
|
52
|
+
} from "./odspUtils.js";
|
|
53
|
+
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "./odspSnapshotParser.js";
|
|
49
54
|
import {
|
|
50
55
|
currentReadVersion,
|
|
51
56
|
ISnapshotContentsWithProps,
|
|
52
57
|
parseCompactSnapshotResponse,
|
|
53
|
-
} from "./compactSnapshotParser";
|
|
54
|
-
import { EpochTracker } from "./epochTracker";
|
|
55
|
-
import { pkgVersion } from "./packageVersion";
|
|
58
|
+
} from "./compactSnapshotParser.js";
|
|
59
|
+
import { EpochTracker } from "./epochTracker.js";
|
|
60
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
56
61
|
|
|
57
62
|
/**
|
|
58
63
|
* Enum to support different types of snapshot formats.
|
|
@@ -84,14 +89,14 @@ export async function fetchSnapshot(
|
|
|
84
89
|
logger: ITelemetryLoggerExt,
|
|
85
90
|
snapshotDownloader: (
|
|
86
91
|
url: string,
|
|
87
|
-
fetchOptions: { [index: string]:
|
|
92
|
+
fetchOptions: { [index: string]: RequestInit },
|
|
88
93
|
) => Promise<IOdspResponse<unknown>>,
|
|
89
|
-
): Promise<
|
|
94
|
+
): Promise<ISnapshot> {
|
|
90
95
|
const path = `/trees/${versionId}`;
|
|
91
96
|
let queryParams: ISnapshotOptions = {};
|
|
92
97
|
|
|
93
98
|
if (fetchFullSnapshot) {
|
|
94
|
-
queryParams = versionId
|
|
99
|
+
queryParams = versionId === "latest" ? { deltas: 1, blobs: 2 } : { blobs: 2 };
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
const queryString = getQueryString(queryParams);
|
|
@@ -104,7 +109,7 @@ export async function fetchSnapshot(
|
|
|
104
109
|
logger,
|
|
105
110
|
{
|
|
106
111
|
eventName: "fetchSnapshot",
|
|
107
|
-
headers: Object.keys(headers).length
|
|
112
|
+
headers: Object.keys(headers).length > 0 ? true : undefined,
|
|
108
113
|
},
|
|
109
114
|
async () => snapshotDownloader(url, { headers }),
|
|
110
115
|
)) as IOdspResponse<IOdspSnapshot>;
|
|
@@ -120,16 +125,20 @@ export async function fetchSnapshotWithRedeem(
|
|
|
120
125
|
snapshotDownloader: (
|
|
121
126
|
finalOdspResolvedUrl: IOdspResolvedUrl,
|
|
122
127
|
storageToken: string,
|
|
128
|
+
loadingGroupIds: string[] | undefined,
|
|
123
129
|
snapshotOptions: ISnapshotOptions | undefined,
|
|
124
130
|
controller?: AbortController,
|
|
125
131
|
) => Promise<ISnapshotRequestAndResponseOptions>,
|
|
126
132
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
127
133
|
removeEntries: () => Promise<void>,
|
|
134
|
+
loadingGroupIds: string[] | undefined,
|
|
128
135
|
enableRedeemFallback?: boolean,
|
|
129
|
-
): Promise<
|
|
136
|
+
): Promise<ISnapshot> {
|
|
130
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
|
|
131
139
|
const sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;
|
|
132
140
|
if (sharingLinkToRedeem) {
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
133
142
|
odspResolvedUrl.shareLinkInfo = { ...odspResolvedUrl.shareLinkInfo, sharingLinkToRedeem };
|
|
134
143
|
}
|
|
135
144
|
|
|
@@ -140,9 +149,11 @@ export async function fetchSnapshotWithRedeem(
|
|
|
140
149
|
logger,
|
|
141
150
|
snapshotDownloader,
|
|
142
151
|
putInCache,
|
|
152
|
+
loadingGroupIds,
|
|
143
153
|
enableRedeemFallback,
|
|
144
154
|
)
|
|
145
155
|
.catch(async (error) => {
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
146
157
|
if (enableRedeemFallback && isRedeemSharingLinkError(odspResolvedUrl, error)) {
|
|
147
158
|
// Execute the redeem fallback
|
|
148
159
|
|
|
@@ -167,6 +178,7 @@ export async function fetchSnapshotWithRedeem(
|
|
|
167
178
|
logger.sendTelemetryEvent(
|
|
168
179
|
{
|
|
169
180
|
eventName: "RedeemFallback",
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
170
182
|
errorType: error.errorType,
|
|
171
183
|
},
|
|
172
184
|
error,
|
|
@@ -179,6 +191,7 @@ export async function fetchSnapshotWithRedeem(
|
|
|
179
191
|
logger,
|
|
180
192
|
snapshotDownloader,
|
|
181
193
|
putInCache,
|
|
194
|
+
loadingGroupIds,
|
|
182
195
|
);
|
|
183
196
|
} else {
|
|
184
197
|
throw error;
|
|
@@ -191,8 +204,10 @@ export async function fetchSnapshotWithRedeem(
|
|
|
191
204
|
if (
|
|
192
205
|
(typeof error === "object" &&
|
|
193
206
|
error !== null &&
|
|
194
|
-
|
|
195
|
-
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
208
|
+
error.errorType === OdspErrorTypes.authorizationError) ||
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
210
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError
|
|
196
211
|
) {
|
|
197
212
|
await removeEntries();
|
|
198
213
|
}
|
|
@@ -205,7 +220,7 @@ async function redeemSharingLink(
|
|
|
205
220
|
storageTokenFetcher: InstrumentedStorageTokenFetcher,
|
|
206
221
|
logger: ITelemetryLoggerExt,
|
|
207
222
|
forceAccessTokenViaAuthorizationHeader: boolean,
|
|
208
|
-
) {
|
|
223
|
+
): Promise<IOdspResponse<unknown>> {
|
|
209
224
|
return PerformanceEvent.timedExecAsync(
|
|
210
225
|
logger,
|
|
211
226
|
{
|
|
@@ -244,29 +259,34 @@ async function fetchLatestSnapshotCore(
|
|
|
244
259
|
snapshotDownloader: (
|
|
245
260
|
finalOdspResolvedUrl: IOdspResolvedUrl,
|
|
246
261
|
storageToken: string,
|
|
262
|
+
loadingGroupIds: string[] | undefined,
|
|
247
263
|
snapshotOptions: ISnapshotOptions | undefined,
|
|
248
264
|
controller?: AbortController,
|
|
249
265
|
) => Promise<ISnapshotRequestAndResponseOptions>,
|
|
250
266
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
267
|
+
loadingGroupIds: string[] | undefined,
|
|
251
268
|
enableRedeemFallback?: boolean,
|
|
252
|
-
): Promise<
|
|
269
|
+
): Promise<ISnapshot> {
|
|
253
270
|
return getWithRetryForTokenRefresh(async (tokenFetchOptions) => {
|
|
254
|
-
const
|
|
271
|
+
const fetchSnapshotForLoadingGroup = isSnapshotFetchForLoadingGroup(loadingGroupIds);
|
|
272
|
+
const eventName = fetchSnapshotForLoadingGroup ? "TreesLatestForGroup" : "TreesLatest";
|
|
273
|
+
const storageToken = await storageTokenFetcher(tokenFetchOptions, eventName, true);
|
|
255
274
|
assert(storageToken !== null, 0x1e5 /* "Storage token should not be null" */);
|
|
256
275
|
|
|
257
276
|
const perfEvent = {
|
|
258
|
-
eventName
|
|
277
|
+
eventName,
|
|
259
278
|
attempts: tokenFetchOptions.refresh ? 2 : 1,
|
|
260
279
|
shareLinkPresent: odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined,
|
|
261
280
|
isSummarizer: odspResolvedUrl.summarizer,
|
|
262
281
|
redeemFallbackEnabled: enableRedeemFallback,
|
|
263
282
|
};
|
|
264
283
|
if (snapshotOptions !== undefined) {
|
|
265
|
-
|
|
284
|
+
for (const [key, value] of Object.entries(snapshotOptions)) {
|
|
266
285
|
if (value !== undefined) {
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
267
287
|
perfEvent[`snapshotOption_${key}`] = value;
|
|
268
288
|
}
|
|
269
|
-
}
|
|
289
|
+
}
|
|
270
290
|
}
|
|
271
291
|
// This event measures only successful cases of getLatest call (no tokens, no retries).
|
|
272
292
|
return PerformanceEvent.timedExecAsync(logger, perfEvent, async (event) => {
|
|
@@ -278,7 +298,13 @@ async function fetchLatestSnapshotCore(
|
|
|
278
298
|
}
|
|
279
299
|
|
|
280
300
|
const [response, fetchTime] = await measureP(async () =>
|
|
281
|
-
snapshotDownloader(
|
|
301
|
+
snapshotDownloader(
|
|
302
|
+
odspResolvedUrl,
|
|
303
|
+
storageToken,
|
|
304
|
+
loadingGroupIds,
|
|
305
|
+
snapshotOptions,
|
|
306
|
+
controller,
|
|
307
|
+
),
|
|
282
308
|
).finally(() => {
|
|
283
309
|
// Clear the fetchTimeout once the response is fetched.
|
|
284
310
|
if (fetchTimeout !== undefined) {
|
|
@@ -312,7 +338,7 @@ async function fetchLatestSnapshotCore(
|
|
|
312
338
|
case "application/json": {
|
|
313
339
|
let text: string;
|
|
314
340
|
[text, receiveContentTime] = await measureP(async () =>
|
|
315
|
-
odspResponse.content.text().catch((
|
|
341
|
+
odspResponse.content.text().catch((error) =>
|
|
316
342
|
// Parsing can fail and message could contain full request URI, including
|
|
317
343
|
// tokens, etc. So do not log error object itself.
|
|
318
344
|
throwOdspNetworkError(
|
|
@@ -328,7 +354,7 @@ async function fetchLatestSnapshotCore(
|
|
|
328
354
|
let content: IOdspSnapshot;
|
|
329
355
|
[content, parseTime] = measure(() => JSON.parse(text) as IOdspSnapshot);
|
|
330
356
|
validateBlobsAndTrees(content);
|
|
331
|
-
const snapshotContents:
|
|
357
|
+
const snapshotContents: ISnapshot =
|
|
332
358
|
convertOdspSnapshotToSnapshotTreeAndBlobs(content);
|
|
333
359
|
parsedSnapshotContents = {
|
|
334
360
|
...odspResponse,
|
|
@@ -342,7 +368,7 @@ async function fetchLatestSnapshotCore(
|
|
|
342
368
|
case "application/ms-fluid": {
|
|
343
369
|
let content: ArrayBuffer;
|
|
344
370
|
[content, receiveContentTime] = await measureP(async () =>
|
|
345
|
-
odspResponse.content.arrayBuffer().catch((
|
|
371
|
+
odspResponse.content.arrayBuffer().catch((error) =>
|
|
346
372
|
// Parsing can fail and message could contain full request URI, including
|
|
347
373
|
// tokens, etc. So do not log error object itself.
|
|
348
374
|
throwOdspNetworkError(
|
|
@@ -365,7 +391,7 @@ async function fetchLatestSnapshotCore(
|
|
|
365
391
|
) {
|
|
366
392
|
throw new NonRetryableError(
|
|
367
393
|
"Returned odsp snapshot is malformed. No trees or blobs!",
|
|
368
|
-
|
|
394
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
369
395
|
propsToLog,
|
|
370
396
|
);
|
|
371
397
|
}
|
|
@@ -383,12 +409,13 @@ async function fetchLatestSnapshotCore(
|
|
|
383
409
|
parsedSnapshotContents = { ...odspResponse, content: snapshotContents };
|
|
384
410
|
break;
|
|
385
411
|
}
|
|
386
|
-
default:
|
|
412
|
+
default: {
|
|
387
413
|
throw new NonRetryableError(
|
|
388
414
|
"Unknown snapshot content type",
|
|
389
|
-
|
|
415
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
390
416
|
propsToLog,
|
|
391
417
|
);
|
|
418
|
+
}
|
|
392
419
|
}
|
|
393
420
|
} catch (error) {
|
|
394
421
|
if (isFluidError(error)) {
|
|
@@ -400,7 +427,7 @@ async function fetchLatestSnapshotCore(
|
|
|
400
427
|
(errorMessage) =>
|
|
401
428
|
new NonRetryableError(
|
|
402
429
|
`Error parsing snapshot response: ${errorMessage}`,
|
|
403
|
-
|
|
430
|
+
OdspErrorTypes.genericError,
|
|
404
431
|
propsToLog,
|
|
405
432
|
),
|
|
406
433
|
);
|
|
@@ -412,9 +439,10 @@ async function fetchLatestSnapshotCore(
|
|
|
412
439
|
const { trees, numBlobs, encodedBlobsSize } = evalBlobsAndTrees(snapshot);
|
|
413
440
|
|
|
414
441
|
// There are some scenarios in ODSP where we cannot cache, trees/latest will explicitly tell us when we
|
|
415
|
-
// 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.
|
|
416
443
|
const canCache =
|
|
417
|
-
odspResponse.headers.get("disablebrowsercachingofusercontent") !== "true"
|
|
444
|
+
odspResponse.headers.get("disablebrowsercachingofusercontent") !== "true" &&
|
|
445
|
+
!fetchSnapshotForLoadingGroup;
|
|
418
446
|
const sequenceNumber: number = snapshot.sequenceNumber ?? 0;
|
|
419
447
|
const seqNumberFromOps =
|
|
420
448
|
snapshot.ops && snapshot.ops.length > 0
|
|
@@ -437,7 +465,7 @@ async function fetchLatestSnapshotCore(
|
|
|
437
465
|
fluidEpoch !== undefined,
|
|
438
466
|
0x1e6 /* "Epoch should be present in response" */,
|
|
439
467
|
);
|
|
440
|
-
const value:
|
|
468
|
+
const value: ISnapshotCachedEntry2 = {
|
|
441
469
|
...snapshot,
|
|
442
470
|
cacheEntryTime: Date.now(),
|
|
443
471
|
};
|
|
@@ -452,13 +480,16 @@ async function fetchLatestSnapshotCore(
|
|
|
452
480
|
|
|
453
481
|
event.end({
|
|
454
482
|
trees,
|
|
455
|
-
blobs: snapshot.
|
|
483
|
+
blobs: snapshot.blobContents?.size ?? 0,
|
|
456
484
|
leafNodes: numBlobs,
|
|
457
485
|
encodedBlobsSize,
|
|
458
486
|
sequenceNumber,
|
|
459
487
|
ops: snapshot.ops?.length ?? 0,
|
|
488
|
+
fetchSnapshotForLoadingGroup,
|
|
489
|
+
useLegacyFlowWithoutGroups:
|
|
490
|
+
useLegacyFlowWithoutGroupsForSnapshotFetch(loadingGroupIds),
|
|
460
491
|
userOps: snapshot.ops?.filter((op) => isRuntimeMessage(op)).length ?? 0,
|
|
461
|
-
headers: Object.keys(response.requestHeaders).length
|
|
492
|
+
headers: Object.keys(response.requestHeaders).length > 0 ? true : undefined,
|
|
462
493
|
// Measures time to make fetch call. Should be similar to
|
|
463
494
|
// fetchStartToResponseEndTime - receiveContentTime, i.e. it looks like it's time till first byte /
|
|
464
495
|
// end of response headers
|
|
@@ -490,9 +521,10 @@ async function fetchLatestSnapshotCore(
|
|
|
490
521
|
if (
|
|
491
522
|
typeof error === "object" &&
|
|
492
523
|
error !== null &&
|
|
493
|
-
(error.errorType ===
|
|
494
|
-
error.errorType ===
|
|
524
|
+
((error as Partial<IOdspError>).errorType === OdspErrorTypes.fetchFailure ||
|
|
525
|
+
(error as Partial<IOdspError>).errorType === OdspErrorTypes.fetchTimeout)
|
|
495
526
|
) {
|
|
527
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
496
528
|
error[getWithRetryForTokenRefreshRepeat] = true;
|
|
497
529
|
}
|
|
498
530
|
throw error;
|
|
@@ -503,50 +535,60 @@ async function fetchLatestSnapshotCore(
|
|
|
503
535
|
export interface ISnapshotRequestAndResponseOptions {
|
|
504
536
|
odspResponse: IOdspResponse<Response>;
|
|
505
537
|
requestUrl: string;
|
|
506
|
-
requestHeaders: { [index: string]:
|
|
538
|
+
requestHeaders: { [index: string]: string };
|
|
507
539
|
}
|
|
508
540
|
|
|
509
541
|
function getFormBodyAndHeaders(
|
|
510
542
|
odspResolvedUrl: IOdspResolvedUrl,
|
|
511
543
|
storageToken: string,
|
|
512
544
|
headers?: { [index: string]: string },
|
|
513
|
-
) {
|
|
545
|
+
): {
|
|
546
|
+
body: string;
|
|
547
|
+
headers: {
|
|
548
|
+
[index: string]: string;
|
|
549
|
+
};
|
|
550
|
+
} {
|
|
514
551
|
const formBoundary = uuid();
|
|
515
552
|
const formParams: string[] = [];
|
|
516
|
-
formParams.push(
|
|
517
|
-
|
|
518
|
-
|
|
553
|
+
formParams.push(
|
|
554
|
+
`--${formBoundary}`,
|
|
555
|
+
`Authorization: Bearer ${storageToken}`,
|
|
556
|
+
`X-HTTP-Method-Override: GET`,
|
|
557
|
+
);
|
|
519
558
|
|
|
520
559
|
if (headers !== undefined) {
|
|
521
|
-
|
|
560
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
522
561
|
if (value !== undefined) {
|
|
523
562
|
formParams.push(`${key}: ${value}`);
|
|
524
563
|
}
|
|
525
|
-
}
|
|
564
|
+
}
|
|
526
565
|
}
|
|
527
566
|
if (odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem) {
|
|
528
567
|
formParams.push(`sl: ${odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem}`);
|
|
529
568
|
}
|
|
530
|
-
formParams.push(`_post: 1
|
|
531
|
-
formParams.push(`\r\n--${formBoundary}--`);
|
|
569
|
+
formParams.push(`_post: 1`, `\r\n--${formBoundary}--`);
|
|
532
570
|
const postBody = formParams.join("\r\n");
|
|
533
|
-
const header: { [index: string]:
|
|
571
|
+
const header: { [index: string]: string } = {
|
|
534
572
|
"Content-Type": `multipart/form-data;boundary=${formBoundary}`,
|
|
535
573
|
};
|
|
536
574
|
return { body: postBody, headers: header };
|
|
537
575
|
}
|
|
538
576
|
|
|
539
|
-
export function evalBlobsAndTrees(snapshot:
|
|
577
|
+
export function evalBlobsAndTrees(snapshot: ISnapshot): {
|
|
578
|
+
trees: number;
|
|
579
|
+
numBlobs: number;
|
|
580
|
+
encodedBlobsSize: number;
|
|
581
|
+
} {
|
|
540
582
|
const trees = countTreesInSnapshotTree(snapshot.snapshotTree);
|
|
541
|
-
const numBlobs = snapshot.
|
|
583
|
+
const numBlobs = snapshot.blobContents.size;
|
|
542
584
|
let encodedBlobsSize = 0;
|
|
543
|
-
for (const [_, blobContent] of snapshot.
|
|
585
|
+
for (const [_, blobContent] of snapshot.blobContents) {
|
|
544
586
|
encodedBlobsSize += blobContent.byteLength;
|
|
545
587
|
}
|
|
546
588
|
return { trees, numBlobs, encodedBlobsSize };
|
|
547
589
|
}
|
|
548
590
|
|
|
549
|
-
export function validateBlobsAndTrees(snapshot: IOdspSnapshot) {
|
|
591
|
+
export function validateBlobsAndTrees(snapshot: IOdspSnapshot): void {
|
|
550
592
|
assert(
|
|
551
593
|
snapshot.trees !== undefined,
|
|
552
594
|
0x200 /* "Returned odsp snapshot is malformed. No trees!" */,
|
|
@@ -571,7 +613,10 @@ function countTreesInSnapshotTree(snapshotTree: ISnapshotTree): number {
|
|
|
571
613
|
* @param odspResolvedUrl - resolved odsp url.
|
|
572
614
|
* @param storageToken - token to do the auth for network request.
|
|
573
615
|
* @param snapshotOptions - Options used to specify how and what to fetch in the snapshot.
|
|
574
|
-
* @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.
|
|
575
620
|
* @param snapshotFormatFetchType - Snapshot format to fetch.
|
|
576
621
|
* @param controller - abort controller if caller needs to abort the network call.
|
|
577
622
|
* @param epochTracker - epoch tracker used to add/validate epoch in the network call.
|
|
@@ -580,7 +625,7 @@ function countTreesInSnapshotTree(snapshotTree: ISnapshotTree): number {
|
|
|
580
625
|
export async function downloadSnapshot(
|
|
581
626
|
odspResolvedUrl: IOdspResolvedUrl,
|
|
582
627
|
storageToken: string,
|
|
583
|
-
|
|
628
|
+
loadingGroupIds: string[] | undefined,
|
|
584
629
|
snapshotOptions: ISnapshotOptions | undefined,
|
|
585
630
|
snapshotFormatFetchType?: SnapshotFormatSupportType,
|
|
586
631
|
controller?: AbortController,
|
|
@@ -588,21 +633,27 @@ export async function downloadSnapshot(
|
|
|
588
633
|
scenarioName?: string,
|
|
589
634
|
): Promise<ISnapshotRequestAndResponseOptions> {
|
|
590
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
|
|
591
637
|
const sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;
|
|
592
638
|
if (sharingLinkToRedeem) {
|
|
639
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
593
640
|
odspResolvedUrl.shareLinkInfo = { ...odspResolvedUrl.shareLinkInfo, sharingLinkToRedeem };
|
|
594
641
|
}
|
|
595
642
|
|
|
596
643
|
const snapshotUrl = odspResolvedUrl.endpoints.snapshotStorageUrl;
|
|
597
644
|
|
|
598
|
-
const queryParams = { ump: 1 };
|
|
645
|
+
const queryParams: Record<string, unknown> = { ump: 1 };
|
|
599
646
|
if (snapshotOptions !== undefined) {
|
|
600
|
-
|
|
647
|
+
for (const [key, value] of Object.entries(snapshotOptions)) {
|
|
601
648
|
// Exclude "timeout" from query string
|
|
602
649
|
if (value !== undefined && key !== "timeout") {
|
|
603
650
|
queryParams[key] = value;
|
|
604
651
|
}
|
|
605
|
-
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
if (loadingGroupIds !== undefined) {
|
|
656
|
+
queryParams.groupId = loadingGroupIds.join(",");
|
|
606
657
|
}
|
|
607
658
|
|
|
608
659
|
const queryString = getQueryString(queryParams);
|
|
@@ -610,7 +661,7 @@ export async function downloadSnapshot(
|
|
|
610
661
|
// The location of file can move on Spo in which case server returns 308(Permanent Redirect) error.
|
|
611
662
|
// Adding below header will make VROOM API return 404 instead of 308 and browser can intercept it.
|
|
612
663
|
// This error thrown by server will contain the new redirect location. Look at the 404 error parsing
|
|
613
|
-
// for
|
|
664
|
+
// for further reference here: \packages\utils\odsp-doclib-utils\src\odspErrorUtils.ts
|
|
614
665
|
const header = { prefer: "manualredirect" };
|
|
615
666
|
const { body, headers } = getFormBodyAndHeaders(odspResolvedUrl, storageToken, header);
|
|
616
667
|
const fetchOptions = {
|
|
@@ -621,12 +672,14 @@ export async function downloadSnapshot(
|
|
|
621
672
|
};
|
|
622
673
|
// Decide what snapshot format to fetch as per the feature gate.
|
|
623
674
|
switch (snapshotFormatFetchType) {
|
|
624
|
-
case SnapshotFormatSupportType.Binary:
|
|
675
|
+
case SnapshotFormatSupportType.Binary: {
|
|
625
676
|
headers.accept = `application/ms-fluid; v=${currentReadVersion}`;
|
|
626
677
|
break;
|
|
627
|
-
|
|
678
|
+
}
|
|
679
|
+
default: {
|
|
628
680
|
// By default ask both versions and let the server decide the format.
|
|
629
681
|
headers.accept = `application/json, application/ms-fluid; v=${currentReadVersion}`;
|
|
682
|
+
}
|
|
630
683
|
}
|
|
631
684
|
|
|
632
685
|
const odspResponse = await (epochTracker?.fetch(
|
|
@@ -644,13 +697,16 @@ export async function downloadSnapshot(
|
|
|
644
697
|
};
|
|
645
698
|
}
|
|
646
699
|
|
|
647
|
-
function isRedeemSharingLinkError(
|
|
700
|
+
function isRedeemSharingLinkError(
|
|
701
|
+
odspResolvedUrl: IOdspResolvedUrl,
|
|
702
|
+
error: Partial<IOdspError>,
|
|
703
|
+
): boolean {
|
|
648
704
|
if (
|
|
649
705
|
odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined &&
|
|
650
706
|
typeof error === "object" &&
|
|
651
707
|
error !== null &&
|
|
652
|
-
(error.errorType ===
|
|
653
|
-
error.errorType ===
|
|
708
|
+
(error.errorType === OdspErrorTypes.authorizationError ||
|
|
709
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError)
|
|
654
710
|
) {
|
|
655
711
|
return true;
|
|
656
712
|
}
|
package/src/getFileLink.ts
CHANGED
|
@@ -3,23 +3,24 @@
|
|
|
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";
|
|
9
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
10
10
|
import {
|
|
11
11
|
IOdspUrlParts,
|
|
12
|
+
OdspErrorTypes,
|
|
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,18 +148,21 @@ 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
|
|
151
157
|
throw new NonRetryableError(
|
|
152
158
|
"Malformed GetSharingInformation response",
|
|
153
|
-
|
|
159
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
154
160
|
{ driverVersion },
|
|
155
161
|
);
|
|
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,12 +232,12 @@ 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(
|
|
231
239
|
"Malformed getFileItemLite response",
|
|
232
|
-
|
|
240
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
233
241
|
{ driverVersion },
|
|
234
242
|
);
|
|
235
243
|
}
|
package/src/getQueryString.ts
CHANGED
|
@@ -15,6 +15,8 @@ export function getQueryString(
|
|
|
15
15
|
for (const key of Object.keys(queryParams)) {
|
|
16
16
|
if (queryParams[key] !== undefined) {
|
|
17
17
|
const startChar = queryString === "" ? "?" : "&";
|
|
18
|
+
// False-positive
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
18
20
|
queryString += `${startChar}${key}=${encodeURIComponent(queryParams[key])}`;
|
|
19
21
|
}
|
|
20
22
|
}
|