@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
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { LoggingError } from "@fluidframework/telemetry-utils";
|
|
6
|
-
import { runWithRetry } from "./retryUtils.
|
|
5
|
+
import { LoggingError, UsageError } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { runWithRetry } from "./retryUtils.js";
|
|
7
7
|
export class RetryErrorsStorageAdapter {
|
|
8
8
|
constructor(internalStorageService, logger) {
|
|
9
9
|
this.internalStorageService = internalStorageService;
|
|
@@ -19,13 +19,18 @@ export class RetryErrorsStorageAdapter {
|
|
|
19
19
|
dispose() {
|
|
20
20
|
this._disposed = true;
|
|
21
21
|
}
|
|
22
|
-
get repositoryUrl() {
|
|
23
|
-
return this.internalStorageService.repositoryUrl;
|
|
24
|
-
}
|
|
25
22
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
26
23
|
async getSnapshotTree(version) {
|
|
27
24
|
return this.runWithRetry(async () => this.internalStorageService.getSnapshotTree(version), "storage_getSnapshotTree");
|
|
28
25
|
}
|
|
26
|
+
async getSnapshot(snapshotFetchOptions) {
|
|
27
|
+
return this.runWithRetry(async () => {
|
|
28
|
+
if (this.internalStorageService.getSnapshot !== undefined) {
|
|
29
|
+
return this.internalStorageService.getSnapshot(snapshotFetchOptions);
|
|
30
|
+
}
|
|
31
|
+
throw new UsageError("getSnapshot should exist in storage adapter in ODSP driver");
|
|
32
|
+
}, "storage_getSnapshot");
|
|
33
|
+
}
|
|
29
34
|
async readBlob(id) {
|
|
30
35
|
return this.runWithRetry(async () => this.internalStorageService.readBlob(id), "storage_readBlob");
|
|
31
36
|
}
|
|
@@ -56,4 +61,4 @@ export class RetryErrorsStorageAdapter {
|
|
|
56
61
|
return runWithRetry(api, callName, this.logger, () => this.checkStorageDisposed());
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
|
-
//# sourceMappingURL=retryErrorsStorageAdapter.
|
|
64
|
+
//# sourceMappingURL=retryErrorsStorageAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retryErrorsStorageAdapter.js","sourceRoot":"","sources":["../src/retryErrorsStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAuB,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAiBhG,OAAO,EAAE,YAAY,EAAE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zB,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CACV,IAAI,CAAC,sBAAsB,CAAC,WAAW,CACtC,SAAS,EACT,KAAK,EACL,YAAY,EACZ,WAAW,CACX,EACF,qBAAqB,CACrB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,wBAAwB,CACpC,OAAqB,EACrB,OAAwB;QAExB,4DAA4D;QAC5D,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClF,kCAAkC,CAClC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,EAC/D,yBAAyB,CACzB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,EACxD,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC3B,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,4DAA4D;YAC5D,MAAM,IAAI,YAAY,CAAC,2CAA2C,EAAE;gBACnE,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;SACH;IACF,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACpF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LoggingError, ITelemetryLoggerExt, UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { runWithRetry } from \"./retryUtils.js\";\n\nexport class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose(): void {\n\t\tthis._disposed = true;\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.getSnapshotTree(version),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\treturn this.runWithRetry(async () => {\n\t\t\tif (this.internalStorageService.getSnapshot !== undefined) {\n\t\t\t\treturn this.internalStorageService.getSnapshot(snapshotFetchOptions);\n\t\t\t}\n\t\t\tthrow new UsageError(\"getSnapshot should exist in storage adapter in ODSP driver\");\n\t\t}, \"storage_getSnapshot\");\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.readBlob(id),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageService.getVersions(\n\t\t\t\t\tversionId,\n\t\t\t\t\tcount,\n\t\t\t\t\tscenarioName,\n\t\t\t\t\tfetchSource,\n\t\t\t\t),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.uploadSummaryWithContext(summary, context),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.downloadSummary(handle),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.createBlob(file),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed(): void {\n\t\tif (this._disposed) {\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new LoggingError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, () => this.checkStorageDisposed());\n\t}\n}\n"]}
|
|
@@ -7,4 +7,4 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
|
7
7
|
* This method retries only for retriable coherency and service read only errors.
|
|
8
8
|
*/
|
|
9
9
|
export declare function runWithRetry<T>(api: () => Promise<T>, callName: string, logger: ITelemetryLoggerExt, checkDisposed?: () => void): Promise<T>;
|
|
10
|
-
//# sourceMappingURL=retryUtils.d.
|
|
10
|
+
//# sourceMappingURL=retryUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retryUtils.d.ts","sourceRoot":"","sources":["../src/retryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAOtE;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EACnC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,mBAAmB,EAC3B,aAAa,CAAC,EAAE,MAAM,IAAI,GACxB,OAAO,CAAC,CAAC,CAAC,CAgFZ"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { performance } from "@fluid-internal/client-utils";
|
|
6
6
|
import { delay } from "@fluidframework/core-utils";
|
|
7
7
|
import { canRetryOnError, getRetryDelayFromError } from "@fluidframework/driver-utils";
|
|
8
|
-
import {
|
|
9
|
-
import { Odsp409Error } from "./epochTracker.
|
|
8
|
+
import { OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
|
|
9
|
+
import { Odsp409Error } from "./epochTracker.js";
|
|
10
10
|
/**
|
|
11
11
|
* This method retries only for retriable coherency and service read only errors.
|
|
12
12
|
*/
|
|
@@ -29,11 +29,14 @@ export async function runWithRetry(api, callName, logger, checkDisposed) {
|
|
|
29
29
|
}, lastError);
|
|
30
30
|
}
|
|
31
31
|
return result;
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
33
|
}
|
|
33
34
|
catch (error) {
|
|
34
35
|
const canRetry = canRetryOnError(error);
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
35
37
|
const coherencyError = error?.[Odsp409Error] === true;
|
|
36
|
-
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
39
|
+
const serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;
|
|
37
40
|
// logging the first failed retry instead of every attempt. We want to avoid filling telemetry
|
|
38
41
|
// when we have tight loop of retrying in offline mode, but we also want to know what caused
|
|
39
42
|
// the failure in the first place
|
|
@@ -64,6 +67,7 @@ export async function runWithRetry(api, callName, logger, checkDisposed) {
|
|
|
64
67
|
duration: performance.now() - start, // record total wait time.
|
|
65
68
|
}, error);
|
|
66
69
|
// Fail hard.
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
67
71
|
error.canRetry = false;
|
|
68
72
|
throw error;
|
|
69
73
|
}
|
|
@@ -74,4 +78,4 @@ export async function runWithRetry(api, callName, logger, checkDisposed) {
|
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
|
-
//# sourceMappingURL=retryUtils.
|
|
81
|
+
//# sourceMappingURL=retryUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retryUtils.js","sourceRoot":"","sources":["../src/retryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,GAAqB,EACrB,QAAgB,EAChB,MAA2B,EAC3B,aAA0B;IAE1B,IAAI,UAAU,GAAG,IAAI,CAAC;IAC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+E;YAC/E,oFAAoF;YACpF,uEAAuE;YACvE,IAAI,QAAQ,KAAK,CAAC,EAAE;gBACnB,MAAM,CAAC,cAAc,CACpB;oBACC,SAAS,EAAE,cAAc;wBACxB,CAAC,CAAC,8BAA8B;wBAChC,CAAC,CAAC,oCAAoC;oBACvC,QAAQ;oBACR,QAAQ;oBACR,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,0BAA0B;iBAC/D,EACD,KAAK,CACL,CAAC;gBACF,aAAa;gBACb,sEAAsE;gBACtE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACvB,MAAM,KAAK,CAAC;aACZ;YAED,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC;YACzD,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;YACpC,UAAU,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACrD,SAAS,GAAG,KAAK,CAAC;SAClB;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { delay } from \"@fluidframework/core-utils\";\nimport { canRetryOnError, getRetryDelayFromError } from \"@fluidframework/driver-utils\";\nimport { OdspErrorTypes } from \"@fluidframework/odsp-driver-definitions\";\nimport { Odsp409Error } from \"./epochTracker.js\";\n\n/**\n * This method retries only for retriable coherency and service read only errors.\n */\nexport async function runWithRetry<T>(\n\tapi: () => Promise<T>,\n\tcallName: string,\n\tlogger: ITelemetryLoggerExt,\n\tcheckDisposed?: () => void,\n): Promise<T> {\n\tlet retryAfter = 1000;\n\tconst start = performance.now();\n\tlet lastError: unknown;\n\tfor (let attempts = 1; ; attempts++) {\n\t\tif (checkDisposed !== undefined) {\n\t\t\tcheckDisposed();\n\t\t}\n\t\ttry {\n\t\t\tconst result = await api();\n\t\t\tif (attempts > 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"MultipleRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start,\n\t\t\t\t\t},\n\t\t\t\t\tlastError,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn result;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tconst canRetry = canRetryOnError(error);\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst coherencyError = error?.[Odsp409Error] === true;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;\n\n\t\t\t// logging the first failed retry instead of every attempt. We want to avoid filling telemetry\n\t\t\t// when we have tight loop of retrying in offline mode, but we also want to know what caused\n\t\t\t// the failure in the first place\n\t\t\tif (attempts === 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${callName}_firstFailed`,\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Retry for retriable 409 coherency errors or serviceReadOnly errors. These errors are always retriable\n\t\t\t// unless someone specifically set canRetry = false on the error like in fetchSnapshot() flow. So in\n\t\t\t// that case don't retry.\n\t\t\tif (!((coherencyError || serviceReadonlyError) && canRetry)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// SPO itself does number of retries internally before returning 409 to client.\n\t\t\t// That multiplied to 5 suggests need to reconsider current design, as client spends\n\t\t\t// too much time / bandwidth doing the same thing without any progress.\n\t\t\tif (attempts === 5) {\n\t\t\t\tlogger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: coherencyError\n\t\t\t\t\t\t\t? \"CoherencyErrorTooManyRetries\"\n\t\t\t\t\t\t\t: \"ServiceReadonlyErrorTooManyRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\t// Fail hard.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\terror.canRetry = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tretryAfter = getRetryDelayFromError(error) ?? retryAfter;\n\t\t\tawait delay(Math.floor(retryAfter));\n\t\t\tretryAfter += (retryAfter / 4) * (1 + Math.random());\n\t\t\tlastError = error;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketModule.d.ts","sourceRoot":"","sources":["../src/socketModule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAItC,eAAO,MAAM,oBAAoB,WAAK,CAAC"}
|
|
@@ -3,5 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { io } from "socket.io-client";
|
|
6
|
+
// Import is required for side-effects.
|
|
7
|
+
// eslint-disable-next-line unicorn/prefer-export-from
|
|
6
8
|
export const SocketIOClientStatic = io;
|
|
7
|
-
//# sourceMappingURL=socketModule.
|
|
9
|
+
//# sourceMappingURL=socketModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketModule.js","sourceRoot":"","sources":["../src/socketModule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,uCAAuC;AACvC,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { io } from \"socket.io-client\";\n\n// Import is required for side-effects.\n// eslint-disable-next-line unicorn/prefer-export-from\nexport const SocketIOClientStatic = io;\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { strict as assert } from "node:assert";
|
|
6
|
+
import { SharingLinkRole, SharingLinkScope } from "@fluidframework/odsp-driver-definitions";
|
|
7
|
+
import { buildOdspShareLinkReqParams } from "../odspUtils.js";
|
|
8
|
+
describe("buildOdspShareLinkReqParams", () => {
|
|
9
|
+
it("Should return appropriate query parameters when only scope is provided", async () => {
|
|
10
|
+
const result = buildOdspShareLinkReqParams({ scope: SharingLinkScope.organization });
|
|
11
|
+
assert.strictEqual(result, `createLinkScope=${SharingLinkScope.organization}`);
|
|
12
|
+
});
|
|
13
|
+
it("Should return appropriate query parameters when both scope and link role are provided", async () => {
|
|
14
|
+
const result = buildOdspShareLinkReqParams({
|
|
15
|
+
scope: SharingLinkScope.organization,
|
|
16
|
+
role: SharingLinkRole.view,
|
|
17
|
+
});
|
|
18
|
+
assert.strictEqual(result, `createLinkScope=${SharingLinkScope.organization}&createLinkRole=${SharingLinkRole.view}`);
|
|
19
|
+
});
|
|
20
|
+
it("Should return undefined when the input is undefined", async () => {
|
|
21
|
+
const result = buildOdspShareLinkReqParams(undefined);
|
|
22
|
+
assert.strictEqual(result, undefined);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=buildOdspShareLinkReqParams.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildOdspShareLinkReqParams.spec.js","sourceRoot":"","sources":["../../src/test/buildOdspShareLinkReqParams.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,wEAAwE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,MAAM,GAAG,2BAA2B,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAC;QACrF,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,mBAAmB,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uFAAuF,EAAE,KAAK,IAAI,EAAE;QACtG,MAAM,MAAM,GAAG,2BAA2B,CAAC;YAC1C,KAAK,EAAE,gBAAgB,CAAC,YAAY;YACpC,IAAI,EAAE,eAAe,CAAC,IAAI;SAC1B,CAAC,CAAC;QACH,MAAM,CAAC,WAAW,CACjB,MAAM,EACN,mBAAmB,gBAAgB,CAAC,YAAY,mBAAmB,eAAe,CAAC,IAAI,EAAE,CACzF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;QACpE,MAAM,MAAM,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;QACtD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { SharingLinkRole, SharingLinkScope } from \"@fluidframework/odsp-driver-definitions\";\nimport { buildOdspShareLinkReqParams } from \"../odspUtils.js\";\n\ndescribe(\"buildOdspShareLinkReqParams\", () => {\n\tit(\"Should return appropriate query parameters when only scope is provided\", async () => {\n\t\tconst result = buildOdspShareLinkReqParams({ scope: SharingLinkScope.organization });\n\t\tassert.strictEqual(result, `createLinkScope=${SharingLinkScope.organization}`);\n\t});\n\n\tit(\"Should return appropriate query parameters when both scope and link role are provided\", async () => {\n\t\tconst result = buildOdspShareLinkReqParams({\n\t\t\tscope: SharingLinkScope.organization,\n\t\t\trole: SharingLinkRole.view,\n\t\t});\n\t\tassert.strictEqual(\n\t\t\tresult,\n\t\t\t`createLinkScope=${SharingLinkScope.organization}&createLinkRole=${SharingLinkRole.view}`,\n\t\t);\n\t});\n\n\tit(\"Should return undefined when the input is undefined\", async () => {\n\t\tconst result = buildOdspShareLinkReqParams(undefined);\n\t\tassert.strictEqual(result, undefined);\n\t});\n});\n"]}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { strict as assert } from "node:assert";
|
|
6
|
+
import * as api from "@fluidframework/protocol-definitions";
|
|
7
|
+
import { bufferToString } from "@fluid-internal/client-utils";
|
|
8
|
+
import { SharingLinkRole, SharingLinkScope, } from "@fluidframework/odsp-driver-definitions";
|
|
9
|
+
import { createChildLogger } from "@fluidframework/telemetry-utils";
|
|
10
|
+
import { convertCreateNewSummaryTreeToTreeAndBlobs } from "../createNewUtils.js";
|
|
11
|
+
import { createNewFluidFile } from "../createFile.js";
|
|
12
|
+
import { createNewContainerOnExistingFile } from "../createNewContainerOnExistingFile.js";
|
|
13
|
+
import { EpochTracker } from "../epochTracker.js";
|
|
14
|
+
import { getHashedDocumentId } from "../odspPublicUtils.js";
|
|
15
|
+
import { createCacheSnapshotKey } from "../odspUtils.js";
|
|
16
|
+
import { LocalPersistentCache } from "../odspCache.js";
|
|
17
|
+
import { mockFetchOk } from "./mockFetch.js";
|
|
18
|
+
const createUtLocalCache = () => new LocalPersistentCache();
|
|
19
|
+
describe("Create New Utils Tests", () => {
|
|
20
|
+
const documentAttributes = {
|
|
21
|
+
minimumSequenceNumber: 0,
|
|
22
|
+
sequenceNumber: 0,
|
|
23
|
+
};
|
|
24
|
+
const blobContent = "testing";
|
|
25
|
+
const createSummary = () => {
|
|
26
|
+
const summary = {
|
|
27
|
+
type: api.SummaryType.Tree,
|
|
28
|
+
tree: {},
|
|
29
|
+
};
|
|
30
|
+
summary.tree[".app"] = {
|
|
31
|
+
type: api.SummaryType.Tree,
|
|
32
|
+
tree: {
|
|
33
|
+
attributes: {
|
|
34
|
+
type: api.SummaryType.Blob,
|
|
35
|
+
content: blobContent,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
summary.tree[".protocol"] = {
|
|
40
|
+
type: api.SummaryType.Tree,
|
|
41
|
+
tree: {
|
|
42
|
+
attributes: {
|
|
43
|
+
type: api.SummaryType.Blob,
|
|
44
|
+
content: JSON.stringify(documentAttributes),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
return summary;
|
|
49
|
+
};
|
|
50
|
+
const siteUrl = "https://microsoft.sharepoint-df.com/siteUrl";
|
|
51
|
+
const driveId = "driveId";
|
|
52
|
+
const itemId = "itemId";
|
|
53
|
+
const resolvedUrl = {
|
|
54
|
+
siteUrl,
|
|
55
|
+
driveId,
|
|
56
|
+
itemId,
|
|
57
|
+
odspResolvedUrl: true,
|
|
58
|
+
};
|
|
59
|
+
const filePath = "path";
|
|
60
|
+
let newFileParams;
|
|
61
|
+
let hashedDocumentId;
|
|
62
|
+
let localCache;
|
|
63
|
+
let fileEntry;
|
|
64
|
+
let epochTracker;
|
|
65
|
+
before(async () => {
|
|
66
|
+
hashedDocumentId = await getHashedDocumentId(driveId, itemId);
|
|
67
|
+
fileEntry = {
|
|
68
|
+
docId: hashedDocumentId,
|
|
69
|
+
resolvedUrl,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
beforeEach(async () => {
|
|
73
|
+
localCache = createUtLocalCache();
|
|
74
|
+
// use null logger here as we expect errors
|
|
75
|
+
epochTracker = new EpochTracker(localCache, {
|
|
76
|
+
docId: hashedDocumentId,
|
|
77
|
+
resolvedUrl,
|
|
78
|
+
}, createChildLogger());
|
|
79
|
+
newFileParams = {
|
|
80
|
+
type: "New",
|
|
81
|
+
driveId,
|
|
82
|
+
siteUrl,
|
|
83
|
+
filePath,
|
|
84
|
+
filename: "filename",
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
afterEach(async () => {
|
|
88
|
+
await epochTracker.removeEntries().catch(() => { });
|
|
89
|
+
});
|
|
90
|
+
const test = (snapshot) => {
|
|
91
|
+
const snapshotTree = snapshot.snapshotTree;
|
|
92
|
+
assert.strictEqual(Object.entries(snapshotTree.trees).length, 2, "app and protocol should be there");
|
|
93
|
+
assert.strictEqual(snapshot.blobContents.size, 2, "2 blobs should be there");
|
|
94
|
+
const appTree = snapshotTree.trees[".app"];
|
|
95
|
+
const protocolTree = snapshotTree.trees[".protocol"];
|
|
96
|
+
assert(appTree !== undefined, "App tree should be there");
|
|
97
|
+
assert(protocolTree !== undefined, "Protocol tree should be there");
|
|
98
|
+
const appTreeBlobId = appTree.blobs.attributes;
|
|
99
|
+
const appTreeBlobValBuffer = snapshot.blobContents.get(appTreeBlobId);
|
|
100
|
+
assert(appTreeBlobValBuffer !== undefined, "app blob value should exist");
|
|
101
|
+
const appTreeBlobVal = bufferToString(appTreeBlobValBuffer, "utf8");
|
|
102
|
+
assert(appTreeBlobVal === blobContent, "Blob content should match");
|
|
103
|
+
const docAttributesBlobId = protocolTree.blobs.attributes;
|
|
104
|
+
const docAttributesBuffer = snapshot.blobContents.get(docAttributesBlobId);
|
|
105
|
+
assert(docAttributesBuffer !== undefined, "protocol attributes blob value should exist");
|
|
106
|
+
const docAttributesBlobValue = bufferToString(docAttributesBuffer, "utf8");
|
|
107
|
+
assert(docAttributesBlobValue === JSON.stringify(documentAttributes), "Blob content should match");
|
|
108
|
+
assert(snapshot.ops.length === 0, "No ops should be there");
|
|
109
|
+
assert(snapshot.sequenceNumber === 0, "Seq number should be 0");
|
|
110
|
+
};
|
|
111
|
+
it("Should convert as expected and check contents", async () => {
|
|
112
|
+
const snapshot = convertCreateNewSummaryTreeToTreeAndBlobs(createSummary(), "");
|
|
113
|
+
test(snapshot);
|
|
114
|
+
});
|
|
115
|
+
it("Should cache converted summary during createNewFluidFile", async () => {
|
|
116
|
+
const odspResolvedUrl = await mockFetchOk(async () => createNewFluidFile(async (_options) => "token", newFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, true /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */), { itemId: "itemId1", id: "Summary handle" }, { "x-fluid-epoch": "epoch1" });
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
118
|
+
const snapshot = await epochTracker.get(createCacheSnapshotKey(odspResolvedUrl));
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
120
|
+
test(snapshot);
|
|
121
|
+
await epochTracker.removeEntries().catch(() => { });
|
|
122
|
+
});
|
|
123
|
+
it("Should cache converted summary during createNewContainerOnExistingFile", async () => {
|
|
124
|
+
const existingFileParams = {
|
|
125
|
+
type: "Existing",
|
|
126
|
+
itemId: "itemId1",
|
|
127
|
+
siteUrl,
|
|
128
|
+
driveId,
|
|
129
|
+
};
|
|
130
|
+
const odspResolvedUrl = await mockFetchOk(async () => createNewContainerOnExistingFile(async (_options) => "token", existingFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, true /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */), { itemId: "itemId1", id: "Summary handle" }, { "x-fluid-epoch": "epoch1" });
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
132
|
+
const snapshot = await epochTracker.get(createCacheSnapshotKey(odspResolvedUrl));
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
134
|
+
test(snapshot);
|
|
135
|
+
await epochTracker.removeEntries().catch(() => { });
|
|
136
|
+
});
|
|
137
|
+
it("Should save 'sharing' information received during createNewFluidFile", async () => {
|
|
138
|
+
const createLinkType = {
|
|
139
|
+
scope: SharingLinkScope.users,
|
|
140
|
+
role: SharingLinkRole.edit,
|
|
141
|
+
};
|
|
142
|
+
newFileParams.createLinkType = createLinkType;
|
|
143
|
+
// Test that sharing link is set appropriately when it is received in the response from ODSP
|
|
144
|
+
const mockSharingLinkData = {
|
|
145
|
+
localizedDescription: "Specific users with the link can view",
|
|
146
|
+
iconUrl: "https://mock.icon.url",
|
|
147
|
+
scope: "organization",
|
|
148
|
+
type: "view",
|
|
149
|
+
webUrl: "https://mock.url",
|
|
150
|
+
blocksDownload: false,
|
|
151
|
+
createOnly: false,
|
|
152
|
+
status: "Created",
|
|
153
|
+
createdDateTime: "2022-05-18T02:58:17.0256105Z",
|
|
154
|
+
};
|
|
155
|
+
const mockSharingData = {
|
|
156
|
+
shareId: "c40e6f0a-666e-48bf-9509-066900a73b2b",
|
|
157
|
+
sharingLink: mockSharingLinkData,
|
|
158
|
+
};
|
|
159
|
+
let odspResolvedUrl = await mockFetchOk(async () => createNewFluidFile(async (_options) => "token", newFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, false /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */, undefined /* isClpCompliantApp */, true /* enableSingleRequestForShareLinkWithCreate */), {
|
|
160
|
+
itemId: "mockItemId",
|
|
161
|
+
id: "mockId",
|
|
162
|
+
sharing: mockSharingData,
|
|
163
|
+
sharingLinkErrorReason: undefined,
|
|
164
|
+
}, { "x-fluid-epoch": "epoch1" });
|
|
165
|
+
assert.deepStrictEqual(odspResolvedUrl.shareLinkInfo?.createLink, {
|
|
166
|
+
shareId: mockSharingData.shareId,
|
|
167
|
+
link: {
|
|
168
|
+
role: mockSharingData.sharingLink.type,
|
|
169
|
+
...mockSharingData.sharingLink,
|
|
170
|
+
},
|
|
171
|
+
error: undefined,
|
|
172
|
+
});
|
|
173
|
+
// Test that error message is set appropriately when it is received in the response from ODSP
|
|
174
|
+
const mockSharingError = {
|
|
175
|
+
error: {
|
|
176
|
+
code: "invalidRequest",
|
|
177
|
+
message: "Invalid request",
|
|
178
|
+
innerError: {
|
|
179
|
+
code: "invalidRequest",
|
|
180
|
+
errorType: "expected",
|
|
181
|
+
message: "The CreateLinkScope 'asdf' is not valid or supported.",
|
|
182
|
+
stackTrace: "Exceptions.InvalidRequestException",
|
|
183
|
+
throwSite: "",
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
odspResolvedUrl = await mockFetchOk(async () => createNewFluidFile(async (_options) => "token", newFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, false /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */, undefined /* isClpCompliantApp */, true /* enableSingleRequestForShareLinkWithCreate */), {
|
|
188
|
+
itemId: "mockItemId",
|
|
189
|
+
id: "mockId",
|
|
190
|
+
sharingLinkErrorReason: "mockError",
|
|
191
|
+
sharing: mockSharingError,
|
|
192
|
+
}, { "x-fluid-epoch": "epoch1" });
|
|
193
|
+
assert.deepStrictEqual(odspResolvedUrl.shareLinkInfo?.createLink, {
|
|
194
|
+
shareId: undefined,
|
|
195
|
+
link: undefined,
|
|
196
|
+
error: mockSharingError.error,
|
|
197
|
+
});
|
|
198
|
+
await epochTracker.removeEntries().catch(() => { });
|
|
199
|
+
});
|
|
200
|
+
it("Should set the isClpCompliantApp prop on resolved url if already present when createNewFluidFile", async () => {
|
|
201
|
+
const odspResolvedUrl1 = await mockFetchOk(async () => createNewFluidFile(async (_options) => "token", newFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, true /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */, true /* isClpCompliantApp */), { itemId: "itemId1", id: "Summary handle" }, { "x-fluid-epoch": "epoch1" });
|
|
202
|
+
assert(odspResolvedUrl1.isClpCompliantApp, "isClpCompliantApp should be set");
|
|
203
|
+
const odspResolvedUrl2 = await mockFetchOk(async () => createNewFluidFile(async (_options) => "token", newFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, true /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */, undefined /* isClpCompliantApp */), { itemId: "itemId1", id: "Summary handle" }, { "x-fluid-epoch": "epoch1" });
|
|
204
|
+
assert(!odspResolvedUrl2.isClpCompliantApp, "isClpCompliantApp should be falsy");
|
|
205
|
+
await epochTracker.removeEntries().catch(() => { });
|
|
206
|
+
});
|
|
207
|
+
it("Should set the isClpCompliantApp prop on resolved url if already present when createNewContainerOnExistingFile", async () => {
|
|
208
|
+
const existingFileParams = {
|
|
209
|
+
type: "Existing",
|
|
210
|
+
itemId: "itemId1",
|
|
211
|
+
siteUrl,
|
|
212
|
+
driveId,
|
|
213
|
+
};
|
|
214
|
+
const odspResolvedUrl1 = await mockFetchOk(async () => createNewContainerOnExistingFile(async (_options) => "token", existingFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, true /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */, true /* isClpCompliantApp */), { itemId: "itemId1", id: "Summary handle" }, { "x-fluid-epoch": "epoch1" });
|
|
215
|
+
assert(odspResolvedUrl1.isClpCompliantApp, "isClpCompliantApp should be set");
|
|
216
|
+
const odspResolvedUrl2 = await mockFetchOk(async () => createNewFluidFile(async (_options) => "token", newFileParams, createChildLogger(), createSummary(), epochTracker, fileEntry, true /* createNewCaching */, false /* forceAccessTokenViaAuthorizationHeader */, undefined /* isClpCompliantApp */), { itemId: "itemId1", id: "Summary handle" }, { "x-fluid-epoch": "epoch1" });
|
|
217
|
+
assert(!odspResolvedUrl2.isClpCompliantApp, "isClpCompliantApp should be falsy");
|
|
218
|
+
await epochTracker.removeEntries().catch(() => { });
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
//# sourceMappingURL=createNewUtilsTests.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNewUtilsTests.spec.js","sourceRoot":"","sources":["../../src/test/createNewUtilsTests.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAIN,eAAe,EACf,gBAAgB,GAChB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,yCAAyC,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAgB,sBAAsB,EAAqB,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,kBAAkB,GAAG,GAAyB,EAAE,CAAC,IAAI,oBAAoB,EAAE,CAAC;AAElF,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,MAAM,kBAAkB,GAA4B;QACnD,qBAAqB,EAAE,CAAC;QACxB,cAAc,EAAE,CAAC;KACjB,CAAC;IACF,MAAM,WAAW,GAAG,SAAS,CAAC;IAC9B,MAAM,aAAa,GAAG,GAAq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AC3B,kBAAkB,EAClB,iBAAiB,EAAE,EACnB,aAAa,EAAE,EACf,YAAY,EACZ,SAAS,EACT,IAAI,CAAC,sBAAsB,EAC3B,KAAK,CAAC,4CAA4C,EAClD,IAAI,CAAC,uBAAuB,CAC5B,EACF,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAC3C,EAAE,eAAe,EAAE,QAAQ,EAAE,CAC7B,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAAC;QAE9E,MAAM,gBAAgB,GAAG,MAAM,WAAW,CACzC,KAAK,IAAI,EAAE,CACV,kBAAkB,CACjB,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,EAC3B,aAAa,EACb,iBAAiB,EAAE,EACnB,aAAa,EAAE,EACf,YAAY,EACZ,SAAS,EACT,IAAI,CAAC,sBAAsB,EAC3B,KAAK,CAAC,4CAA4C,EAClD,SAAS,CAAC,uBAAuB,CACjC,EACF,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAC3C,EAAE,eAAe,EAAE,QAAQ,EAAE,CAC7B,CAAC;QACF,MAAM,CAAC,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,mCAAmC,CAAC,CAAC;QACjF,MAAM,YAAY,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { ISnapshot } from \"@fluidframework/driver-definitions\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport {\n\tIFileEntry,\n\tIOdspResolvedUrl,\n\tISharingLinkKind,\n\tSharingLinkRole,\n\tSharingLinkScope,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { convertCreateNewSummaryTreeToTreeAndBlobs } from \"../createNewUtils.js\";\nimport { createNewFluidFile } from \"../createFile.js\";\nimport { createNewContainerOnExistingFile } from \"../createNewContainerOnExistingFile.js\";\nimport { EpochTracker } from \"../epochTracker.js\";\nimport { getHashedDocumentId } from \"../odspPublicUtils.js\";\nimport { INewFileInfo, createCacheSnapshotKey, IExistingFileInfo } from \"../odspUtils.js\";\nimport { LocalPersistentCache } from \"../odspCache.js\";\nimport { mockFetchOk } from \"./mockFetch.js\";\n\nconst createUtLocalCache = (): LocalPersistentCache => new LocalPersistentCache();\n\ndescribe(\"Create New Utils Tests\", () => {\n\tconst documentAttributes: api.IDocumentAttributes = {\n\t\tminimumSequenceNumber: 0,\n\t\tsequenceNumber: 0,\n\t};\n\tconst blobContent = \"testing\";\n\tconst createSummary = (): api.ISummaryTree => {\n\t\tconst summary: api.ISummaryTree = {\n\t\t\ttype: api.SummaryType.Tree,\n\t\t\ttree: {},\n\t\t};\n\n\t\tsummary.tree[\".app\"] = {\n\t\t\ttype: api.SummaryType.Tree,\n\t\t\ttree: {\n\t\t\t\tattributes: {\n\t\t\t\t\ttype: api.SummaryType.Blob,\n\t\t\t\t\tcontent: blobContent,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t\tsummary.tree[\".protocol\"] = {\n\t\t\ttype: api.SummaryType.Tree,\n\t\t\ttree: {\n\t\t\t\tattributes: {\n\t\t\t\t\ttype: api.SummaryType.Blob,\n\t\t\t\t\tcontent: JSON.stringify(documentAttributes),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t\treturn summary;\n\t};\n\n\tconst siteUrl = \"https://microsoft.sharepoint-df.com/siteUrl\";\n\tconst driveId = \"driveId\";\n\tconst itemId = \"itemId\";\n\tconst resolvedUrl = {\n\t\tsiteUrl,\n\t\tdriveId,\n\t\titemId,\n\t\todspResolvedUrl: true,\n\t} as unknown as IOdspResolvedUrl;\n\tconst filePath = \"path\";\n\tlet newFileParams: INewFileInfo;\n\tlet hashedDocumentId: string;\n\tlet localCache: LocalPersistentCache;\n\tlet fileEntry: IFileEntry;\n\tlet epochTracker: EpochTracker;\n\n\tbefore(async () => {\n\t\thashedDocumentId = await getHashedDocumentId(driveId, itemId);\n\t\tfileEntry = {\n\t\t\tdocId: hashedDocumentId,\n\t\t\tresolvedUrl,\n\t\t};\n\t});\n\n\tbeforeEach(async () => {\n\t\tlocalCache = createUtLocalCache();\n\t\t// use null logger here as we expect errors\n\t\tepochTracker = new EpochTracker(\n\t\t\tlocalCache,\n\t\t\t{\n\t\t\t\tdocId: hashedDocumentId,\n\t\t\t\tresolvedUrl,\n\t\t\t},\n\t\t\tcreateChildLogger(),\n\t\t);\n\t\tnewFileParams = {\n\t\t\ttype: \"New\",\n\t\t\tdriveId,\n\t\t\tsiteUrl,\n\t\t\tfilePath,\n\t\t\tfilename: \"filename\",\n\t\t};\n\t});\n\n\tafterEach(async () => {\n\t\tawait epochTracker.removeEntries().catch(() => {});\n\t});\n\n\tconst test = (snapshot: ISnapshot): void => {\n\t\tconst snapshotTree = snapshot.snapshotTree;\n\t\tassert.strictEqual(\n\t\t\tObject.entries(snapshotTree.trees).length,\n\t\t\t2,\n\t\t\t\"app and protocol should be there\",\n\t\t);\n\t\tassert.strictEqual(snapshot.blobContents.size, 2, \"2 blobs should be there\");\n\n\t\tconst appTree = snapshotTree.trees[\".app\"];\n\t\tconst protocolTree = snapshotTree.trees[\".protocol\"];\n\t\tassert(appTree !== undefined, \"App tree should be there\");\n\t\tassert(protocolTree !== undefined, \"Protocol tree should be there\");\n\n\t\tconst appTreeBlobId = appTree.blobs.attributes;\n\t\tconst appTreeBlobValBuffer = snapshot.blobContents.get(appTreeBlobId);\n\t\tassert(appTreeBlobValBuffer !== undefined, \"app blob value should exist\");\n\t\tconst appTreeBlobVal = bufferToString(appTreeBlobValBuffer, \"utf8\");\n\t\tassert(appTreeBlobVal === blobContent, \"Blob content should match\");\n\n\t\tconst docAttributesBlobId = protocolTree.blobs.attributes;\n\t\tconst docAttributesBuffer = snapshot.blobContents.get(docAttributesBlobId);\n\t\tassert(docAttributesBuffer !== undefined, \"protocol attributes blob value should exist\");\n\t\tconst docAttributesBlobValue = bufferToString(docAttributesBuffer, \"utf8\");\n\t\tassert(\n\t\t\tdocAttributesBlobValue === JSON.stringify(documentAttributes),\n\t\t\t\"Blob content should match\",\n\t\t);\n\n\t\tassert(snapshot.ops.length === 0, \"No ops should be there\");\n\t\tassert(snapshot.sequenceNumber === 0, \"Seq number should be 0\");\n\t};\n\n\tit(\"Should convert as expected and check contents\", async () => {\n\t\tconst snapshot = convertCreateNewSummaryTreeToTreeAndBlobs(createSummary(), \"\");\n\t\ttest(snapshot);\n\t});\n\n\tit(\"Should cache converted summary during createNewFluidFile\", async () => {\n\t\tconst odspResolvedUrl = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewFluidFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\tnewFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\ttrue /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t),\n\t\t\t{ itemId: \"itemId1\", id: \"Summary handle\" },\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst snapshot = await epochTracker.get(createCacheSnapshotKey(odspResolvedUrl));\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\ttest(snapshot);\n\t\tawait epochTracker.removeEntries().catch(() => {});\n\t});\n\n\tit(\"Should cache converted summary during createNewContainerOnExistingFile\", async () => {\n\t\tconst existingFileParams: IExistingFileInfo = {\n\t\t\ttype: \"Existing\",\n\t\t\titemId: \"itemId1\",\n\t\t\tsiteUrl,\n\t\t\tdriveId,\n\t\t};\n\t\tconst odspResolvedUrl = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewContainerOnExistingFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\texistingFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\ttrue /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t),\n\t\t\t{ itemId: \"itemId1\", id: \"Summary handle\" },\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst snapshot = await epochTracker.get(createCacheSnapshotKey(odspResolvedUrl));\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\ttest(snapshot);\n\t\tawait epochTracker.removeEntries().catch(() => {});\n\t});\n\n\tit(\"Should save 'sharing' information received during createNewFluidFile\", async () => {\n\t\tconst createLinkType: ISharingLinkKind = {\n\t\t\tscope: SharingLinkScope.users,\n\t\t\trole: SharingLinkRole.edit,\n\t\t};\n\t\tnewFileParams.createLinkType = createLinkType;\n\n\t\t// Test that sharing link is set appropriately when it is received in the response from ODSP\n\t\tconst mockSharingLinkData = {\n\t\t\tlocalizedDescription: \"Specific users with the link can view\",\n\t\t\ticonUrl: \"https://mock.icon.url\",\n\t\t\tscope: \"organization\",\n\t\t\ttype: \"view\",\n\t\t\twebUrl: \"https://mock.url\",\n\t\t\tblocksDownload: false,\n\t\t\tcreateOnly: false,\n\t\t\tstatus: \"Created\",\n\t\t\tcreatedDateTime: \"2022-05-18T02:58:17.0256105Z\",\n\t\t};\n\t\tconst mockSharingData = {\n\t\t\tshareId: \"c40e6f0a-666e-48bf-9509-066900a73b2b\",\n\t\t\tsharingLink: mockSharingLinkData,\n\t\t};\n\t\tlet odspResolvedUrl = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewFluidFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\tnewFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\tfalse /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t\tundefined /* isClpCompliantApp */,\n\t\t\t\t\ttrue /* enableSingleRequestForShareLinkWithCreate */,\n\t\t\t\t),\n\t\t\t{\n\t\t\t\titemId: \"mockItemId\",\n\t\t\t\tid: \"mockId\",\n\t\t\t\tsharing: mockSharingData,\n\t\t\t\tsharingLinkErrorReason: undefined,\n\t\t\t},\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\tassert.deepStrictEqual(odspResolvedUrl.shareLinkInfo?.createLink, {\n\t\t\tshareId: mockSharingData.shareId,\n\t\t\tlink: {\n\t\t\t\trole: mockSharingData.sharingLink.type,\n\t\t\t\t...mockSharingData.sharingLink,\n\t\t\t},\n\t\t\terror: undefined,\n\t\t});\n\n\t\t// Test that error message is set appropriately when it is received in the response from ODSP\n\t\tconst mockSharingError = {\n\t\t\terror: {\n\t\t\t\tcode: \"invalidRequest\",\n\t\t\t\tmessage: \"Invalid request\",\n\t\t\t\tinnerError: {\n\t\t\t\t\tcode: \"invalidRequest\",\n\t\t\t\t\terrorType: \"expected\",\n\t\t\t\t\tmessage: \"The CreateLinkScope 'asdf' is not valid or supported.\",\n\t\t\t\t\tstackTrace: \"Exceptions.InvalidRequestException\",\n\t\t\t\t\tthrowSite: \"\",\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t\todspResolvedUrl = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewFluidFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\tnewFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\tfalse /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t\tundefined /* isClpCompliantApp */,\n\t\t\t\t\ttrue /* enableSingleRequestForShareLinkWithCreate */,\n\t\t\t\t),\n\t\t\t{\n\t\t\t\titemId: \"mockItemId\",\n\t\t\t\tid: \"mockId\",\n\t\t\t\tsharingLinkErrorReason: \"mockError\",\n\t\t\t\tsharing: mockSharingError,\n\t\t\t},\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\tassert.deepStrictEqual(odspResolvedUrl.shareLinkInfo?.createLink, {\n\t\t\tshareId: undefined,\n\t\t\tlink: undefined,\n\t\t\terror: mockSharingError.error,\n\t\t});\n\t\tawait epochTracker.removeEntries().catch(() => {});\n\t});\n\n\tit(\"Should set the isClpCompliantApp prop on resolved url if already present when createNewFluidFile\", async () => {\n\t\tconst odspResolvedUrl1 = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewFluidFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\tnewFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\ttrue /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t\ttrue /* isClpCompliantApp */,\n\t\t\t\t),\n\t\t\t{ itemId: \"itemId1\", id: \"Summary handle\" },\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\tassert(odspResolvedUrl1.isClpCompliantApp, \"isClpCompliantApp should be set\");\n\n\t\tconst odspResolvedUrl2 = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewFluidFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\tnewFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\ttrue /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t\tundefined /* isClpCompliantApp */,\n\t\t\t\t),\n\t\t\t{ itemId: \"itemId1\", id: \"Summary handle\" },\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\tassert(!odspResolvedUrl2.isClpCompliantApp, \"isClpCompliantApp should be falsy\");\n\t\tawait epochTracker.removeEntries().catch(() => {});\n\t});\n\n\tit(\"Should set the isClpCompliantApp prop on resolved url if already present when createNewContainerOnExistingFile\", async () => {\n\t\tconst existingFileParams: IExistingFileInfo = {\n\t\t\ttype: \"Existing\",\n\t\t\titemId: \"itemId1\",\n\t\t\tsiteUrl,\n\t\t\tdriveId,\n\t\t};\n\t\tconst odspResolvedUrl1 = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewContainerOnExistingFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\texistingFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\ttrue /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t\ttrue /* isClpCompliantApp */,\n\t\t\t\t),\n\t\t\t{ itemId: \"itemId1\", id: \"Summary handle\" },\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\tassert(odspResolvedUrl1.isClpCompliantApp, \"isClpCompliantApp should be set\");\n\n\t\tconst odspResolvedUrl2 = await mockFetchOk(\n\t\t\tasync () =>\n\t\t\t\tcreateNewFluidFile(\n\t\t\t\t\tasync (_options) => \"token\",\n\t\t\t\t\tnewFileParams,\n\t\t\t\t\tcreateChildLogger(),\n\t\t\t\t\tcreateSummary(),\n\t\t\t\t\tepochTracker,\n\t\t\t\t\tfileEntry,\n\t\t\t\t\ttrue /* createNewCaching */,\n\t\t\t\t\tfalse /* forceAccessTokenViaAuthorizationHeader */,\n\t\t\t\t\tundefined /* isClpCompliantApp */,\n\t\t\t\t),\n\t\t\t{ itemId: \"itemId1\", id: \"Summary handle\" },\n\t\t\t{ \"x-fluid-epoch\": \"epoch1\" },\n\t\t);\n\t\tassert(!odspResolvedUrl2.isClpCompliantApp, \"isClpCompliantApp should be falsy\");\n\t\tawait epochTracker.removeEntries().catch(() => {});\n\t});\n});\n"]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { strict as assert } from "node:assert";
|
|
6
|
+
import { MockLogger } from "@fluidframework/telemetry-utils";
|
|
7
|
+
import { OdspDeltaStorageService, OdspDeltaStorageWithCache } from "../odspDeltaStorageService.js";
|
|
8
|
+
import { LocalPersistentCache } from "../odspCache.js";
|
|
9
|
+
import { EpochTracker } from "../epochTracker.js";
|
|
10
|
+
import { mockFetchOk } from "./mockFetch.js";
|
|
11
|
+
const createUtLocalCache = () => new LocalPersistentCache(2000);
|
|
12
|
+
const createUtEpochTracker = (fileEntry, logger) => new EpochTracker(createUtLocalCache(), fileEntry, logger);
|
|
13
|
+
describe("DeltaStorageService", () => {
|
|
14
|
+
/*
|
|
15
|
+
* Use fake urls so we don't accidental make real calls that make our tests flakey.
|
|
16
|
+
* Using microsoft.com as the domain so we don't send traffic somewhere hostile on accident.
|
|
17
|
+
*/
|
|
18
|
+
const deltaStorageBasePath = "https://fake.microsoft.com";
|
|
19
|
+
const deltaStorageRelativePath = "/drives/testdrive/items/testitem/opStream";
|
|
20
|
+
const testDeltaStorageUrl = `${deltaStorageBasePath}${deltaStorageRelativePath}`;
|
|
21
|
+
const siteUrl = "https://fake.microsoft.com";
|
|
22
|
+
const driveId = "testdrive";
|
|
23
|
+
const itemId = "testitem";
|
|
24
|
+
const resolvedUrl = {
|
|
25
|
+
siteUrl,
|
|
26
|
+
driveId,
|
|
27
|
+
itemId,
|
|
28
|
+
odspResolvedUrl: true,
|
|
29
|
+
};
|
|
30
|
+
const fileEntry = { docId: "docId", resolvedUrl };
|
|
31
|
+
it("Should build the correct sharepoint delta url with auth", async () => {
|
|
32
|
+
const logger = new MockLogger();
|
|
33
|
+
const deltaStorageService = new OdspDeltaStorageService(testDeltaStorageUrl, async (_refresh) => "?access_token=123", createUtEpochTracker(fileEntry, logger), logger.toTelemetryLogger());
|
|
34
|
+
const actualDeltaUrl = deltaStorageService.buildUrl(3, 8);
|
|
35
|
+
const expectedDeltaUrl = `${deltaStorageBasePath}/drives/testdrive/items/testitem/opStream?ump=1&filter=sequenceNumber%20ge%203%20and%20sequenceNumber%20le%207`;
|
|
36
|
+
assert.equal(actualDeltaUrl, expectedDeltaUrl, "The constructed delta url is invalid");
|
|
37
|
+
logger.assertMatchNone([{ category: "error" }]);
|
|
38
|
+
});
|
|
39
|
+
describe("Get Returns Response With Op Envelope", () => {
|
|
40
|
+
const expectedDeltaFeedResponse = {
|
|
41
|
+
value: [
|
|
42
|
+
{
|
|
43
|
+
op: {
|
|
44
|
+
clientId: "present-place",
|
|
45
|
+
clientSequenceNumber: 71,
|
|
46
|
+
contents: null,
|
|
47
|
+
minimumSequenceNumber: 1,
|
|
48
|
+
referenceSequenceNumber: 1,
|
|
49
|
+
sequenceNumber: 1,
|
|
50
|
+
text: "",
|
|
51
|
+
user: {
|
|
52
|
+
id: "Unruffled Bose",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
sequenceNumber: 1,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
op: {
|
|
59
|
+
clientId: "present-place",
|
|
60
|
+
clientSequenceNumber: 71,
|
|
61
|
+
contents: null,
|
|
62
|
+
minimumSequenceNumber: 1,
|
|
63
|
+
referenceSequenceNumber: 1,
|
|
64
|
+
sequenceNumber: 2,
|
|
65
|
+
type: "noop",
|
|
66
|
+
user: {
|
|
67
|
+
id: "Unruffled Bose",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
sequenceNumber: 2,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
let deltaStorageService;
|
|
75
|
+
const logger = new MockLogger();
|
|
76
|
+
before(() => {
|
|
77
|
+
deltaStorageService = new OdspDeltaStorageService(testDeltaStorageUrl, async (_refresh) => "", createUtEpochTracker(fileEntry, logger), logger.toTelemetryLogger());
|
|
78
|
+
});
|
|
79
|
+
afterEach(() => {
|
|
80
|
+
logger.assertMatchNone([{ category: "error" }]);
|
|
81
|
+
});
|
|
82
|
+
it("Should deserialize the delta feed response correctly", async () => {
|
|
83
|
+
const { messages, partialResult } = await mockFetchOk(async () => deltaStorageService.get(2, 8, {}), expectedDeltaFeedResponse);
|
|
84
|
+
assert(!partialResult, "partialResult === false");
|
|
85
|
+
assert.equal(messages.length, 2, "Deserialized feed response is not of expected length");
|
|
86
|
+
assert.equal(messages[0].sequenceNumber, 1, "First element of feed response has invalid sequence number");
|
|
87
|
+
assert.equal(messages[1].sequenceNumber, 2, "Second element of feed response has invalid sequence number");
|
|
88
|
+
assert.equal(messages[1].type, "noop", "Second element of feed response has invalid op type");
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe("Get Returns Response With Op Envelope", () => {
|
|
92
|
+
const expectedDeltaFeedResponse = {
|
|
93
|
+
value: [
|
|
94
|
+
{
|
|
95
|
+
clientId: "present-place",
|
|
96
|
+
clientSequenceNumber: 71,
|
|
97
|
+
contents: null,
|
|
98
|
+
minimumSequenceNumber: 1,
|
|
99
|
+
referenceSequenceNumber: 1,
|
|
100
|
+
sequenceNumber: 1,
|
|
101
|
+
text: "",
|
|
102
|
+
user: {
|
|
103
|
+
id: "Unruffled Bose",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
clientId: "present-place",
|
|
108
|
+
clientSequenceNumber: 71,
|
|
109
|
+
contents: null,
|
|
110
|
+
minimumSequenceNumber: 1,
|
|
111
|
+
referenceSequenceNumber: 1,
|
|
112
|
+
sequenceNumber: 2,
|
|
113
|
+
type: "noop",
|
|
114
|
+
user: {
|
|
115
|
+
id: "Unruffled Bose",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
let deltaStorageService;
|
|
121
|
+
const logger = new MockLogger();
|
|
122
|
+
before(() => {
|
|
123
|
+
deltaStorageService = new OdspDeltaStorageService(testDeltaStorageUrl, async (_refresh) => "", createUtEpochTracker(fileEntry, logger), logger.toTelemetryLogger());
|
|
124
|
+
});
|
|
125
|
+
afterEach(() => {
|
|
126
|
+
logger.assertMatchNone([{ category: "error" }]);
|
|
127
|
+
});
|
|
128
|
+
it("Should deserialize the delta feed response correctly", async () => {
|
|
129
|
+
const { messages, partialResult } = await mockFetchOk(async () => deltaStorageService.get(2, 8, {}), expectedDeltaFeedResponse);
|
|
130
|
+
assert(!partialResult, "partialResult === false");
|
|
131
|
+
assert.equal(messages.length, 2, "Deserialized feed response is not of expected length");
|
|
132
|
+
assert.equal(messages[0].sequenceNumber, 1, "First element of feed response has invalid sequence number");
|
|
133
|
+
assert.equal(messages[1].sequenceNumber, 2, "Second element of feed response has invalid sequence number");
|
|
134
|
+
assert.equal(messages[1].type, "noop", "Second element of feed response has invalid op type");
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe("DeltaStorageServiceWith Cache Tests", () => {
|
|
138
|
+
const logger = new MockLogger();
|
|
139
|
+
afterEach(() => {
|
|
140
|
+
logger.assertMatchNone([{ category: "error" }]);
|
|
141
|
+
});
|
|
142
|
+
it("FirstCacheMiss should update to first miss op seq number correctly", async () => {
|
|
143
|
+
const deltasFetchResult = { messages: [], partialResult: false };
|
|
144
|
+
let count = 0;
|
|
145
|
+
const getCached = async (from, to) => {
|
|
146
|
+
if (count === 0) {
|
|
147
|
+
count += 1;
|
|
148
|
+
return [
|
|
149
|
+
{
|
|
150
|
+
clientId: "present-place",
|
|
151
|
+
clientSequenceNumber: 71,
|
|
152
|
+
contents: null,
|
|
153
|
+
minimumSequenceNumber: 1,
|
|
154
|
+
referenceSequenceNumber: 1,
|
|
155
|
+
sequenceNumber: from,
|
|
156
|
+
type: "dds",
|
|
157
|
+
timestamp: Date.now(),
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
count += 1;
|
|
162
|
+
assert.fail("Should not reach here");
|
|
163
|
+
};
|
|
164
|
+
const odspDeltaStorageServiceWithCache = new OdspDeltaStorageWithCache([], logger.toTelemetryLogger(), 1000, 1, async (from, to, props, reason) => deltasFetchResult, async (from, to) => getCached(from, to), (from, to) => [], (ops) => { }, () => ({
|
|
165
|
+
isFirstSnapshotFromNetwork: false,
|
|
166
|
+
}));
|
|
167
|
+
const messages = odspDeltaStorageServiceWithCache.fetchMessages(1, undefined);
|
|
168
|
+
const batch1 = await messages.read();
|
|
169
|
+
const batch2 = await messages.read();
|
|
170
|
+
assert(count === 1, "There should be only 1 cache access");
|
|
171
|
+
assert(batch1.done === false, "Firt batch should have returned 1 op");
|
|
172
|
+
assert(batch2.done === true, "No ops should be present in second batch");
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
//# sourceMappingURL=deltaStorageService.spec.js.map
|