@fluidframework/odsp-driver 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277
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.js +12 -12
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +162 -0
- package/README.md +56 -0
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/odsp-driver.api.md +309 -0
- package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +16 -9
- package/dist/ReadBufferUtils.cjs.map +1 -0
- package/dist/ReadBufferUtils.d.ts.map +1 -1
- package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +73 -69
- package/dist/WriteBufferUtils.cjs.map +1 -0
- package/dist/WriteBufferUtils.d.ts +3 -5
- package/dist/WriteBufferUtils.d.ts.map +1 -1
- package/dist/{checkUrl.js → checkUrl.cjs} +7 -6
- package/dist/checkUrl.cjs.map +1 -0
- package/dist/checkUrl.d.ts +1 -0
- package/dist/checkUrl.d.ts.map +1 -1
- package/dist/compactSnapshotParser.cjs +207 -0
- package/dist/compactSnapshotParser.cjs.map +1 -0
- package/dist/compactSnapshotParser.d.ts +12 -3
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +43 -33
- package/dist/compactSnapshotWriter.cjs.map +1 -0
- package/dist/compactSnapshotWriter.d.ts +2 -3
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/{constants.js → constants.cjs} +7 -1
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/{contracts.js → contracts.cjs} +1 -1
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.d.ts +16 -53
- package/dist/contracts.d.ts.map +1 -1
- package/dist/{contractsPublic.js → contractsPublic.cjs} +9 -3
- package/dist/contractsPublic.cjs.map +1 -0
- package/dist/contractsPublic.d.ts +15 -0
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/createFile.cjs +177 -0
- package/dist/createFile.cjs.map +1 -0
- package/dist/createFile.d.ts +6 -10
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createNewContainerOnExistingFile.cjs +60 -0
- package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
- package/dist/createNewContainerOnExistingFile.d.ts +22 -0
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -0
- package/dist/createNewModule.cjs +12 -0
- package/dist/createNewModule.cjs.map +1 -0
- package/dist/createNewModule.d.ts +7 -0
- package/dist/createNewModule.d.ts.map +1 -0
- package/dist/createNewUtils.cjs +203 -0
- package/dist/createNewUtils.cjs.map +1 -0
- package/dist/createNewUtils.d.ts +16 -0
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +8 -4
- package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
- package/dist/createOdspCreateContainerRequest.d.ts +5 -3
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/{createOdspUrl.js → createOdspUrl.cjs} +2 -1
- package/dist/createOdspUrl.cjs.map +1 -0
- package/dist/createOdspUrl.d.ts +1 -0
- package/dist/createOdspUrl.d.ts.map +1 -1
- package/dist/{epochTracker.js → epochTracker.cjs} +102 -48
- package/dist/epochTracker.cjs.map +1 -0
- package/dist/epochTracker.d.ts +32 -8
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/{fetch.js → fetch.cjs} +1 -1
- package/dist/fetch.cjs.map +1 -0
- package/dist/fetch.d.ts +1 -1
- package/dist/fetch.d.ts.map +1 -1
- package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +192 -176
- package/dist/fetchSnapshot.cjs.map +1 -0
- package/dist/fetchSnapshot.d.ts +10 -5
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/{getFileLink.js → getFileLink.cjs} +52 -41
- package/dist/getFileLink.cjs.map +1 -0
- package/dist/getFileLink.d.ts +4 -7
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
- package/dist/getQueryString.cjs.map +1 -0
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +4 -2
- package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
- package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.cjs +35 -0
- package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +17 -0
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
- package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +7 -5
- package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +9 -10
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +2 -3
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +13 -11
- package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -2
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odsp-driver-alpha.d.ts +496 -0
- package/dist/odsp-driver-beta.d.ts +160 -0
- package/dist/odsp-driver-public.d.ts +160 -0
- package/dist/odsp-driver-untrimmed.d.ts +565 -0
- package/dist/{odspCache.js → odspCache.cjs} +9 -10
- package/dist/odspCache.cjs.map +1 -0
- package/dist/odspCache.d.ts +19 -4
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.cjs +291 -0
- package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
- package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +70 -71
- package/dist/odspDeltaStorageService.cjs.map +1 -0
- package/dist/odspDeltaStorageService.d.ts +8 -6
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +224 -113
- package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
- package/dist/odspDocumentDeltaConnection.d.ts +32 -12
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentService.cjs +225 -0
- package/dist/odspDocumentService.cjs.map +1 -0
- package/dist/odspDocumentService.d.ts +11 -25
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +8 -5
- package/dist/odspDocumentServiceFactory.cjs.map +1 -0
- package/dist/odspDocumentServiceFactory.d.ts +4 -0
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.cjs +196 -0
- package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
- package/dist/odspDocumentServiceFactoryCore.d.ts +18 -11
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs +20 -0
- package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +5 -0
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.cjs +490 -0
- package/dist/odspDocumentStorageManager.cjs.map +1 -0
- package/dist/odspDocumentStorageManager.d.ts +11 -5
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +32 -34
- package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
- package/dist/odspDocumentStorageServiceBase.d.ts +7 -9
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +50 -36
- package/dist/odspDriverUrlResolver.cjs.map +1 -0
- package/dist/odspDriverUrlResolver.d.ts +12 -0
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +37 -26
- package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
- package/dist/odspDriverUrlResolverForShareLink.d.ts +5 -3
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/{odspError.js → odspError.cjs} +7 -3
- package/dist/odspError.cjs.map +1 -0
- package/dist/odspError.d.ts.map +1 -1
- package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +25 -18
- package/dist/odspFluidFileLink.cjs.map +1 -0
- package/dist/odspFluidFileLink.d.ts +10 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspLocationRedirection.cjs +24 -0
- package/dist/odspLocationRedirection.cjs.map +1 -0
- package/dist/odspLocationRedirection.d.ts +14 -0
- package/dist/odspLocationRedirection.d.ts.map +1 -0
- package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +7 -4
- package/dist/odspPublicUtils.cjs.map +1 -0
- package/dist/odspPublicUtils.d.ts +6 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +11 -12
- package/dist/odspSnapshotParser.cjs.map +1 -0
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +47 -34
- package/dist/odspSummaryUploadManager.cjs.map +1 -0
- package/dist/odspSummaryUploadManager.d.ts +7 -4
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +9 -3
- package/dist/odspUrlHelper.cjs.map +1 -0
- package/dist/odspUrlHelper.d.ts +5 -0
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/{odspUtils.js → odspUtils.cjs} +118 -30
- package/dist/odspUtils.cjs.map +1 -0
- package/dist/odspUtils.d.ts +35 -6
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/{opsCaching.js → opsCaching.cjs} +25 -9
- package/dist/opsCaching.cjs.map +1 -0
- package/dist/opsCaching.d.ts +3 -3
- package/dist/opsCaching.d.ts.map +1 -1
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.cjs +100 -0
- package/dist/prefetchLatestSnapshot.cjs.map +1 -0
- package/dist/prefetchLatestSnapshot.d.ts +12 -7
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +13 -6
- package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
- package/dist/retryErrorsStorageAdapter.d.ts +5 -4
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/{retryUtils.js → retryUtils.cjs} +30 -14
- package/dist/retryUtils.cjs.map +1 -0
- package/dist/retryUtils.d.ts +2 -2
- package/dist/retryUtils.d.ts.map +1 -1
- package/dist/socketModule.cjs +10 -0
- package/dist/socketModule.cjs.map +1 -0
- package/dist/socketModule.d.ts +7 -0
- package/dist/socketModule.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/{vroom.js → vroom.cjs} +24 -9
- package/dist/vroom.cjs.map +1 -0
- package/dist/vroom.d.ts +4 -4
- package/dist/vroom.d.ts.map +1 -1
- package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +227 -118
- package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
- package/dist/zipItDataRepresentationUtils.d.ts +47 -20
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +1 -1
- package/lib/ReadBufferUtils.d.mts.map +1 -0
- package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +14 -7
- package/lib/ReadBufferUtils.mjs.map +1 -0
- package/lib/{WriteBufferUtils.d.ts → WriteBufferUtils.d.mts} +4 -6
- package/lib/WriteBufferUtils.d.mts.map +1 -0
- package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +68 -64
- package/lib/WriteBufferUtils.mjs.map +1 -0
- package/lib/{checkUrl.d.ts → checkUrl.d.mts} +2 -1
- package/lib/checkUrl.d.mts.map +1 -0
- package/lib/{checkUrl.js → checkUrl.mjs} +7 -6
- package/lib/checkUrl.mjs.map +1 -0
- package/lib/compactSnapshotParser.d.mts +24 -0
- package/lib/compactSnapshotParser.d.mts.map +1 -0
- package/lib/compactSnapshotParser.mjs +203 -0
- package/lib/compactSnapshotParser.mjs.map +1 -0
- package/lib/{compactSnapshotWriter.d.ts → compactSnapshotWriter.d.mts} +4 -5
- package/lib/compactSnapshotWriter.d.mts.map +1 -0
- package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +41 -31
- package/lib/compactSnapshotWriter.mjs.map +1 -0
- package/lib/{constants.d.ts → constants.d.mts} +7 -1
- package/lib/constants.d.mts.map +1 -0
- package/lib/{constants.js → constants.mjs} +7 -1
- package/lib/constants.mjs.map +1 -0
- package/lib/{contracts.d.ts → contracts.d.mts} +18 -55
- package/lib/contracts.d.mts.map +1 -0
- package/lib/{contracts.js → contracts.mjs} +1 -1
- package/lib/contracts.mjs.map +1 -0
- package/lib/{contractsPublic.d.ts → contractsPublic.d.mts} +16 -1
- package/lib/contractsPublic.d.mts.map +1 -0
- package/lib/{contractsPublic.js → contractsPublic.mjs} +7 -1
- package/lib/contractsPublic.mjs.map +1 -0
- package/lib/createFile.d.mts +18 -0
- package/lib/createFile.d.mts.map +1 -0
- package/lib/createFile.mjs +171 -0
- package/lib/createFile.mjs.map +1 -0
- package/lib/createNewContainerOnExistingFile.d.mts +22 -0
- package/lib/createNewContainerOnExistingFile.d.mts.map +1 -0
- package/lib/createNewContainerOnExistingFile.mjs +56 -0
- package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
- package/lib/createNewModule.d.mts +7 -0
- package/lib/createNewModule.d.mts.map +1 -0
- package/lib/createNewModule.mjs +7 -0
- package/lib/createNewModule.mjs.map +1 -0
- package/lib/createNewUtils.d.mts +27 -0
- package/lib/createNewUtils.d.mts.map +1 -0
- package/lib/createNewUtils.mjs +197 -0
- package/lib/createNewUtils.mjs.map +1 -0
- package/lib/{createOdspCreateContainerRequest.d.ts → createOdspCreateContainerRequest.d.mts} +6 -8
- package/lib/createOdspCreateContainerRequest.d.mts.map +1 -0
- package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +8 -4
- package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
- package/lib/{createOdspUrl.d.ts → createOdspUrl.d.mts} +3 -2
- package/lib/createOdspUrl.d.mts.map +1 -0
- package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
- package/lib/createOdspUrl.mjs.map +1 -0
- package/lib/{epochTracker.d.ts → epochTracker.d.mts} +35 -11
- package/lib/epochTracker.d.mts.map +1 -0
- package/lib/{epochTracker.js → epochTracker.mjs} +97 -43
- package/lib/epochTracker.mjs.map +1 -0
- package/lib/{fetch.d.ts → fetch.d.mts} +2 -2
- package/lib/fetch.d.mts.map +1 -0
- package/lib/{fetch.js → fetch.mjs} +1 -1
- package/lib/fetch.mjs.map +1 -0
- package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +15 -10
- package/lib/fetchSnapshot.d.mts.map +1 -0
- package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +185 -167
- package/lib/fetchSnapshot.mjs.map +1 -0
- package/lib/{getFileLink.d.ts → getFileLink.d.mts} +5 -8
- package/lib/getFileLink.d.mts.map +1 -0
- package/lib/{getFileLink.js → getFileLink.mjs} +49 -38
- package/lib/getFileLink.mjs.map +1 -0
- package/lib/{getQueryString.d.ts → getQueryString.d.mts} +1 -5
- package/lib/getQueryString.d.mts.map +1 -0
- package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
- package/lib/getQueryString.mjs.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +1 -1
- package/lib/getUrlAndHeadersWithAuth.d.mts.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +4 -2
- package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
- package/lib/index.d.mts +24 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +22 -0
- package/lib/index.mjs.map +1 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts +17 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +1 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.mjs +31 -0
- package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.d.ts → localOdspDocumentService.d.mts} +4 -3
- package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +8 -6
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.ts → localOdspDocumentServiceFactory.d.mts} +5 -6
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +9 -10
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.ts → localOdspDocumentStorageManager.d.mts} +4 -4
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +11 -9
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
- package/lib/odsp-driver-alpha.d.mts +496 -0
- package/lib/odsp-driver-beta.d.mts +160 -0
- package/lib/odsp-driver-public.d.mts +160 -0
- package/lib/odsp-driver-untrimmed.d.mts +565 -0
- package/lib/{odspCache.d.ts → odspCache.d.mts} +20 -9
- package/lib/odspCache.d.mts.map +1 -0
- package/lib/{odspCache.js → odspCache.mjs} +6 -11
- package/lib/odspCache.mjs.map +1 -0
- package/lib/odspDelayLoadedDeltaStream.d.mts +75 -0
- package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -0
- package/lib/odspDelayLoadedDeltaStream.mjs +287 -0
- package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
- package/lib/{odspDeltaStorageService.d.ts → odspDeltaStorageService.d.mts} +10 -8
- package/lib/odspDeltaStorageService.d.mts.map +1 -0
- package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +70 -68
- package/lib/odspDeltaStorageService.mjs.map +1 -0
- package/lib/{odspDocumentDeltaConnection.d.ts → odspDocumentDeltaConnection.d.mts} +34 -14
- package/lib/odspDocumentDeltaConnection.d.mts.map +1 -0
- package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +214 -103
- package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
- package/lib/{odspDocumentService.d.ts → odspDocumentService.d.mts} +15 -29
- package/lib/odspDocumentService.d.mts.map +1 -0
- package/lib/odspDocumentService.mjs +221 -0
- package/lib/odspDocumentService.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactory.d.ts → odspDocumentServiceFactory.d.mts} +6 -2
- package/lib/odspDocumentServiceFactory.d.mts.map +1 -0
- package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +8 -6
- package/lib/odspDocumentServiceFactory.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactoryCore.d.ts → odspDocumentServiceFactoryCore.d.mts} +20 -13
- package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -0
- package/lib/odspDocumentServiceFactoryCore.mjs +192 -0
- package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.ts → odspDocumentServiceFactoryWithCodeSplit.d.mts} +7 -2
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +8 -3
- package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
- package/lib/{odspDocumentStorageManager.d.ts → odspDocumentStorageManager.d.mts} +18 -12
- package/lib/odspDocumentStorageManager.d.mts.map +1 -0
- package/lib/odspDocumentStorageManager.mjs +486 -0
- package/lib/odspDocumentStorageManager.mjs.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.d.ts → odspDocumentStorageServiceBase.d.mts} +9 -11
- package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +31 -33
- package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
- package/lib/{odspDriverUrlResolver.d.ts → odspDriverUrlResolver.d.mts} +13 -1
- package/lib/odspDriverUrlResolver.d.mts.map +1 -0
- package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +50 -40
- package/lib/odspDriverUrlResolver.mjs.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.d.ts → odspDriverUrlResolverForShareLink.d.mts} +7 -5
- package/lib/odspDriverUrlResolverForShareLink.d.mts.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +36 -29
- package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
- package/lib/{odspError.d.ts → odspError.d.mts} +2 -2
- package/lib/odspError.d.mts.map +1 -0
- package/lib/{odspError.js → odspError.mjs} +7 -3
- package/lib/odspError.mjs.map +1 -0
- package/lib/{odspFluidFileLink.d.ts → odspFluidFileLink.d.mts} +12 -3
- package/lib/odspFluidFileLink.d.mts.map +1 -0
- package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +23 -16
- package/lib/odspFluidFileLink.mjs.map +1 -0
- package/lib/odspLocationRedirection.d.mts +14 -0
- package/lib/odspLocationRedirection.d.mts.map +1 -0
- package/lib/odspLocationRedirection.mjs +20 -0
- package/lib/odspLocationRedirection.mjs.map +1 -0
- package/lib/{odspPublicUtils.d.ts → odspPublicUtils.d.mts} +7 -1
- package/lib/odspPublicUtils.d.mts.map +1 -0
- package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +5 -2
- package/lib/odspPublicUtils.mjs.map +1 -0
- package/lib/{odspSnapshotParser.d.ts → odspSnapshotParser.d.mts} +3 -3
- package/lib/odspSnapshotParser.d.mts.map +1 -0
- package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +10 -11
- package/lib/odspSnapshotParser.mjs.map +1 -0
- package/lib/{odspSummaryUploadManager.d.ts → odspSummaryUploadManager.d.mts} +9 -6
- package/lib/odspSummaryUploadManager.d.mts.map +1 -0
- package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +41 -32
- package/lib/odspSummaryUploadManager.mjs.map +1 -0
- package/lib/{odspUrlHelper.d.ts → odspUrlHelper.d.mts} +6 -1
- package/lib/odspUrlHelper.d.mts.map +1 -0
- package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +9 -3
- package/lib/odspUrlHelper.mjs.map +1 -0
- package/lib/{odspUtils.d.ts → odspUtils.d.mts} +37 -8
- package/lib/odspUtils.d.mts.map +1 -0
- package/lib/{odspUtils.js → odspUtils.mjs} +109 -27
- package/lib/odspUtils.mjs.map +1 -0
- package/lib/{opsCaching.d.ts → opsCaching.d.mts} +4 -4
- package/lib/opsCaching.d.mts.map +1 -0
- package/lib/{opsCaching.js → opsCaching.mjs} +23 -7
- package/lib/opsCaching.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +14 -9
- package/lib/prefetchLatestSnapshot.d.mts.map +1 -0
- package/lib/prefetchLatestSnapshot.mjs +96 -0
- package/lib/prefetchLatestSnapshot.mjs.map +1 -0
- package/lib/{retryErrorsStorageAdapter.d.ts → retryErrorsStorageAdapter.d.mts} +6 -5
- package/lib/retryErrorsStorageAdapter.d.mts.map +1 -0
- package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +13 -6
- package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
- package/lib/{retryUtils.d.ts → retryUtils.d.mts} +3 -3
- package/lib/retryUtils.d.mts.map +1 -0
- package/lib/{retryUtils.js → retryUtils.mjs} +27 -11
- package/lib/retryUtils.mjs.map +1 -0
- package/lib/socketModule.d.mts +7 -0
- package/lib/socketModule.d.mts.map +1 -0
- package/lib/socketModule.mjs +7 -0
- package/lib/socketModule.mjs.map +1 -0
- package/lib/{vroom.d.ts → vroom.d.mts} +7 -7
- package/lib/vroom.d.mts.map +1 -0
- package/lib/{vroom.js → vroom.mjs} +24 -9
- package/lib/vroom.mjs.map +1 -0
- package/lib/{zipItDataRepresentationUtils.d.ts → zipItDataRepresentationUtils.d.mts} +49 -22
- package/lib/zipItDataRepresentationUtils.d.mts.map +1 -0
- package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +213 -111
- package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
- package/package.json +87 -69
- package/prettier.config.cjs +8 -0
- package/src/ReadBufferUtils.ts +51 -44
- package/src/WriteBufferUtils.ts +203 -181
- package/src/checkUrl.ts +16 -15
- package/src/compactSnapshotParser.ts +219 -103
- package/src/compactSnapshotWriter.ts +118 -97
- package/src/constants.ts +7 -0
- package/src/contracts.ts +96 -136
- package/src/contractsPublic.ts +31 -16
- package/src/createFile.ts +243 -305
- package/src/createNewContainerOnExistingFile.ts +93 -0
- package/src/createNewModule.ts +7 -0
- package/src/createNewUtils.ts +266 -56
- package/src/createOdspCreateContainerRequest.ts +22 -18
- package/src/createOdspUrl.ts +12 -13
- package/src/epochTracker.ts +596 -457
- package/src/fetch.ts +4 -4
- package/src/fetchSnapshot.ts +583 -508
- package/src/getFileLink.ts +194 -155
- package/src/getQueryString.ts +11 -9
- package/src/getUrlAndHeadersWithAuth.ts +34 -33
- package/src/index.ts +42 -18
- package/src/localOdspDriver/localOdspDeltaStorageService.ts +49 -0
- package/src/localOdspDriver/localOdspDocumentService.ts +40 -38
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +46 -43
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +55 -50
- package/src/odspCache.ts +112 -90
- package/src/odspDelayLoadedDeltaStream.ts +459 -0
- package/src/odspDeltaStorageService.ts +232 -221
- package/src/odspDocumentDeltaConnection.ts +751 -563
- package/src/odspDocumentService.ts +324 -523
- package/src/odspDocumentServiceFactory.ts +20 -21
- package/src/odspDocumentServiceFactoryCore.ts +329 -200
- package/src/odspDocumentServiceFactoryWithCodeSplit.ts +20 -20
- package/src/odspDocumentStorageManager.ts +730 -534
- package/src/odspDocumentStorageServiceBase.ts +279 -254
- package/src/odspDriverUrlResolver.ts +230 -188
- package/src/odspDriverUrlResolverForShareLink.ts +223 -203
- package/src/odspError.ts +27 -19
- package/src/odspFluidFileLink.ts +106 -87
- package/src/odspLocationRedirection.ts +26 -0
- package/src/odspPublicUtils.ts +20 -14
- package/src/odspSnapshotParser.ts +53 -46
- package/src/odspSummaryUploadManager.ts +243 -218
- package/src/odspUrlHelper.ts +81 -71
- package/src/odspUtils.ts +401 -259
- package/src/opsCaching.ts +214 -193
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +142 -80
- package/src/retryErrorsStorageAdapter.ts +92 -77
- package/src/retryUtils.ts +80 -57
- package/src/socketModule.ts +8 -0
- package/src/vroom.ts +92 -83
- package/src/zipItDataRepresentationUtils.ts +534 -394
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +11 -13
- package/.editorconfig +0 -7
- package/dist/ReadBufferUtils.js.map +0 -1
- package/dist/WriteBufferUtils.js.map +0 -1
- package/dist/checkUrl.js.map +0 -1
- package/dist/compactSnapshotParser.js +0 -115
- package/dist/compactSnapshotParser.js.map +0 -1
- package/dist/compactSnapshotWriter.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/contracts.js.map +0 -1
- package/dist/contractsPublic.js.map +0 -1
- package/dist/createFile.js +0 -242
- package/dist/createFile.js.map +0 -1
- package/dist/createNewUtils.js +0 -67
- package/dist/createNewUtils.js.map +0 -1
- package/dist/createOdspCreateContainerRequest.js.map +0 -1
- package/dist/createOdspUrl.js.map +0 -1
- package/dist/epochTracker.js.map +0 -1
- package/dist/fetch.js.map +0 -1
- package/dist/fetchSnapshot.js.map +0 -1
- package/dist/getFileLink.js.map +0 -1
- package/dist/getQueryString.js.map +0 -1
- package/dist/getSocketIo.d.ts +0 -11
- package/dist/getSocketIo.d.ts.map +0 -1
- package/dist/getSocketIo.js +0 -20
- package/dist/getSocketIo.js.map +0 -1
- package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
- package/dist/index.js +0 -41
- package/dist/index.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
- package/dist/odspCache.js.map +0 -1
- package/dist/odspDeltaStorageService.js.map +0 -1
- package/dist/odspDocumentDeltaConnection.js.map +0 -1
- package/dist/odspDocumentService.js +0 -364
- package/dist/odspDocumentService.js.map +0 -1
- package/dist/odspDocumentServiceFactory.js.map +0 -1
- package/dist/odspDocumentServiceFactoryCore.js +0 -118
- package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js +0 -34
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
- package/dist/odspDocumentStorageManager.js +0 -356
- package/dist/odspDocumentStorageManager.js.map +0 -1
- package/dist/odspDocumentStorageServiceBase.js.map +0 -1
- package/dist/odspDriverUrlResolver.js.map +0 -1
- package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
- package/dist/odspError.js.map +0 -1
- package/dist/odspFluidFileLink.js.map +0 -1
- package/dist/odspPublicUtils.js.map +0 -1
- package/dist/odspSnapshotParser.js.map +0 -1
- package/dist/odspSummaryUploadManager.js.map +0 -1
- package/dist/odspUrlHelper.js.map +0 -1
- package/dist/odspUtils.js.map +0 -1
- package/dist/opsCaching.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/prefetchLatestSnapshot.js +0 -57
- package/dist/prefetchLatestSnapshot.js.map +0 -1
- package/dist/retryErrorsStorageAdapter.js.map +0 -1
- package/dist/retryUtils.js.map +0 -1
- package/dist/vroom.js.map +0 -1
- package/dist/zipItDataRepresentationUtils.js.map +0 -1
- package/lib/ReadBufferUtils.d.ts.map +0 -1
- package/lib/ReadBufferUtils.js.map +0 -1
- package/lib/WriteBufferUtils.d.ts.map +0 -1
- package/lib/WriteBufferUtils.js.map +0 -1
- package/lib/checkUrl.d.ts.map +0 -1
- package/lib/checkUrl.js.map +0 -1
- package/lib/compactSnapshotParser.d.ts +0 -15
- package/lib/compactSnapshotParser.d.ts.map +0 -1
- package/lib/compactSnapshotParser.js +0 -111
- package/lib/compactSnapshotParser.js.map +0 -1
- package/lib/compactSnapshotWriter.d.ts.map +0 -1
- package/lib/compactSnapshotWriter.js.map +0 -1
- package/lib/constants.d.ts.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/contracts.d.ts.map +0 -1
- package/lib/contracts.js.map +0 -1
- package/lib/contractsPublic.d.ts.map +0 -1
- package/lib/contractsPublic.js.map +0 -1
- package/lib/createFile.d.ts +0 -22
- package/lib/createFile.d.ts.map +0 -1
- package/lib/createFile.js +0 -235
- package/lib/createFile.js.map +0 -1
- package/lib/createNewUtils.d.ts +0 -11
- package/lib/createNewUtils.d.ts.map +0 -1
- package/lib/createNewUtils.js +0 -63
- package/lib/createNewUtils.js.map +0 -1
- package/lib/createOdspCreateContainerRequest.d.ts.map +0 -1
- package/lib/createOdspCreateContainerRequest.js.map +0 -1
- package/lib/createOdspUrl.d.ts.map +0 -1
- package/lib/createOdspUrl.js.map +0 -1
- package/lib/epochTracker.d.ts.map +0 -1
- package/lib/epochTracker.js.map +0 -1
- package/lib/fetch.d.ts.map +0 -1
- package/lib/fetch.js.map +0 -1
- package/lib/fetchSnapshot.d.ts.map +0 -1
- package/lib/fetchSnapshot.js.map +0 -1
- package/lib/getFileLink.d.ts.map +0 -1
- package/lib/getFileLink.js.map +0 -1
- package/lib/getQueryString.d.ts.map +0 -1
- package/lib/getQueryString.js.map +0 -1
- package/lib/getSocketIo.d.ts +0 -11
- package/lib/getSocketIo.d.ts.map +0 -1
- package/lib/getSocketIo.js +0 -13
- package/lib/getSocketIo.js.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.d.ts.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
- package/lib/index.d.ts +0 -21
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -29
- package/lib/index.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
- package/lib/odspCache.d.ts.map +0 -1
- package/lib/odspCache.js.map +0 -1
- package/lib/odspDeltaStorageService.d.ts.map +0 -1
- package/lib/odspDeltaStorageService.js.map +0 -1
- package/lib/odspDocumentDeltaConnection.d.ts.map +0 -1
- package/lib/odspDocumentDeltaConnection.js.map +0 -1
- package/lib/odspDocumentService.d.ts.map +0 -1
- package/lib/odspDocumentService.js +0 -360
- package/lib/odspDocumentService.js.map +0 -1
- package/lib/odspDocumentServiceFactory.d.ts.map +0 -1
- package/lib/odspDocumentServiceFactory.js.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.js +0 -114
- package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
- package/lib/odspDocumentStorageManager.d.ts.map +0 -1
- package/lib/odspDocumentStorageManager.js +0 -352
- package/lib/odspDocumentStorageManager.js.map +0 -1
- package/lib/odspDocumentStorageServiceBase.d.ts.map +0 -1
- package/lib/odspDocumentStorageServiceBase.js.map +0 -1
- package/lib/odspDriverUrlResolver.d.ts.map +0 -1
- package/lib/odspDriverUrlResolver.js.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
- package/lib/odspError.d.ts.map +0 -1
- package/lib/odspError.js.map +0 -1
- package/lib/odspFluidFileLink.d.ts.map +0 -1
- package/lib/odspFluidFileLink.js.map +0 -1
- package/lib/odspPublicUtils.d.ts.map +0 -1
- package/lib/odspPublicUtils.js.map +0 -1
- package/lib/odspSnapshotParser.d.ts.map +0 -1
- package/lib/odspSnapshotParser.js.map +0 -1
- package/lib/odspSummaryUploadManager.d.ts.map +0 -1
- package/lib/odspSummaryUploadManager.js.map +0 -1
- package/lib/odspUrlHelper.d.ts.map +0 -1
- package/lib/odspUrlHelper.js.map +0 -1
- package/lib/odspUtils.d.ts.map +0 -1
- package/lib/odspUtils.js.map +0 -1
- package/lib/opsCaching.d.ts.map +0 -1
- package/lib/opsCaching.js.map +0 -1
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/prefetchLatestSnapshot.d.ts.map +0 -1
- package/lib/prefetchLatestSnapshot.js +0 -53
- package/lib/prefetchLatestSnapshot.js.map +0 -1
- package/lib/retryErrorsStorageAdapter.d.ts.map +0 -1
- package/lib/retryErrorsStorageAdapter.js.map +0 -1
- package/lib/retryUtils.d.ts.map +0 -1
- package/lib/retryUtils.js.map +0 -1
- package/lib/vroom.d.ts.map +0 -1
- package/lib/vroom.js.map +0 -1
- package/lib/zipItDataRepresentationUtils.d.ts.map +0 -1
- package/lib/zipItDataRepresentationUtils.js.map +0 -1
- package/src/getSocketIo.ts +0 -14
- package/tsconfig.esnext.json +0 -7
package/dist/createNewUtils.d.ts
CHANGED
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
6
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
|
+
import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
|
|
8
|
+
import { IOdspSummaryPayload } from "./contracts";
|
|
6
9
|
import { ISnapshotContents } from "./odspPublicUtils";
|
|
10
|
+
import { EpochTracker, FetchType } from "./epochTracker";
|
|
7
11
|
/**
|
|
8
12
|
* Converts a summary(ISummaryTree) taken in detached container to snapshot tree and blobs
|
|
9
13
|
*/
|
|
10
14
|
export declare function convertCreateNewSummaryTreeToTreeAndBlobs(summary: ISummaryTree, treeId: string): ISnapshotContents;
|
|
15
|
+
export declare function convertSummaryIntoContainerSnapshot(createNewSummary: ISummaryTree): IOdspSummaryPayload;
|
|
16
|
+
export declare function createNewFluidContainerCore<T>(args: {
|
|
17
|
+
containerSnapshot: IOdspSummaryPayload;
|
|
18
|
+
getStorageToken: InstrumentedStorageTokenFetcher;
|
|
19
|
+
logger: ITelemetryLoggerExt;
|
|
20
|
+
initialUrl: string;
|
|
21
|
+
forceAccessTokenViaAuthorizationHeader: boolean;
|
|
22
|
+
epochTracker: EpochTracker;
|
|
23
|
+
telemetryName: string;
|
|
24
|
+
fetchType: FetchType;
|
|
25
|
+
validateResponseCallback?: (content: T) => void;
|
|
26
|
+
}): Promise<T>;
|
|
11
27
|
//# sourceMappingURL=createNewUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNewUtils.d.ts","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"createNewUtils.d.ts","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,YAAY,EAGZ,MAAM,sCAAsC,CAAC;AAQ9C,OAAO,EAAE,mBAAmB,EAAoB,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EACN,mBAAmB,EAInB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIzD;;GAEG;AACH,wBAAgB,yCAAyC,CACxD,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,GACZ,iBAAiB,CAgBnB;AA6CD,wBAAgB,mCAAmC,CAAC,gBAAgB,EAAE,YAAY,uBA2BjF;AA6DD,wBAAsB,2BAA2B,CAAC,CAAC,EAAE,IAAI,EAAE;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,eAAe,EAAE,+BAA+B,CAAC;IACjD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC,EAAE,OAAO,CAAC;IAChD,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;CAChD,GAAG,OAAO,CAAC,CAAC,CAAC,CAmFb"}
|
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createOdspCreateContainerRequest = void 0;
|
|
4
4
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
5
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
5
6
|
/**
|
|
6
7
|
* Create the request object with url and headers for creating a new file on OneDrive Sharepoint
|
|
7
8
|
* @param siteUrl - Base url for OneDrive
|
|
8
9
|
* @param driveId - drive identifier
|
|
9
10
|
* @param filePath - path where file needs to be created
|
|
10
11
|
* @param fileName - name of the new file to be created
|
|
11
|
-
* @param
|
|
12
|
+
* @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes
|
|
13
|
+
* will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink
|
|
14
|
+
* @alpha
|
|
12
15
|
*/
|
|
13
|
-
function createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName,
|
|
16
|
+
function createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName, createShareLinkType) {
|
|
17
|
+
const shareLinkRequestParams = (0, odspUtils_1.buildOdspShareLinkReqParams)(createShareLinkType);
|
|
14
18
|
const createNewRequest = {
|
|
15
|
-
url: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(filePath)}${
|
|
19
|
+
url: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(filePath)}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : ""}`,
|
|
16
20
|
headers: {
|
|
17
21
|
[driver_definitions_1.DriverHeader.createNew]: {
|
|
18
22
|
fileName,
|
|
@@ -22,4 +26,4 @@ function createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName,
|
|
|
22
26
|
return createNewRequest;
|
|
23
27
|
}
|
|
24
28
|
exports.createOdspCreateContainerRequest = createOdspCreateContainerRequest;
|
|
25
|
-
//# sourceMappingURL=createOdspCreateContainerRequest.
|
|
29
|
+
//# sourceMappingURL=createOdspCreateContainerRequest.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOdspCreateContainerRequest.cjs","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":";;;AAKA,2EAAkE;AAElE,+CAA0D;AAE1D;;;;;;;;;GASG;AACH,SAAgB,gCAAgC,CAC/C,OAAe,EACf,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,mBAAuD;IAEvD,MAAM,sBAAsB,GAAG,IAAA,uCAA2B,EAAC,mBAAmB,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAa;QAClC,GAAG,EAAE,GAAG,OAAO,YAAY,kBAAkB,CAAC,OAAO,CAAC,SAAS,kBAAkB,CAChF,QAAQ,CACR,GAAG,sBAAsB,CAAC,CAAC,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QAChE,OAAO,EAAE;YACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE;gBACzB,QAAQ;aACR;SACD;KACD,CAAC;IACF,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAnBD,4EAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions\";\nimport { ShareLinkTypes, ISharingLinkKind } from \"@fluidframework/odsp-driver-definitions\";\nimport { buildOdspShareLinkReqParams } from \"./odspUtils\";\n\n/**\n * Create the request object with url and headers for creating a new file on OneDrive Sharepoint\n * @param siteUrl - Base url for OneDrive\n * @param driveId - drive identifier\n * @param filePath - path where file needs to be created\n * @param fileName - name of the new file to be created\n * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes\n * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink\n * @alpha\n */\nexport function createOdspCreateContainerRequest(\n\tsiteUrl: string,\n\tdriveId: string,\n\tfilePath: string,\n\tfileName: string,\n\tcreateShareLinkType?: ShareLinkTypes | ISharingLinkKind,\n): IRequest {\n\tconst shareLinkRequestParams = buildOdspShareLinkReqParams(createShareLinkType);\n\tconst createNewRequest: IRequest = {\n\t\turl: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(\n\t\t\tfilePath,\n\t\t)}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : \"\"}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: {\n\t\t\t\tfileName,\n\t\t\t},\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n"]}
|
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { ShareLinkTypes } from "@fluidframework/odsp-driver-definitions";
|
|
6
|
+
import { ShareLinkTypes, ISharingLinkKind } from "@fluidframework/odsp-driver-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* Create the request object with url and headers for creating a new file on OneDrive Sharepoint
|
|
9
9
|
* @param siteUrl - Base url for OneDrive
|
|
10
10
|
* @param driveId - drive identifier
|
|
11
11
|
* @param filePath - path where file needs to be created
|
|
12
12
|
* @param fileName - name of the new file to be created
|
|
13
|
-
* @param
|
|
13
|
+
* @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes
|
|
14
|
+
* will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink
|
|
15
|
+
* @alpha
|
|
14
16
|
*/
|
|
15
|
-
export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string,
|
|
17
|
+
export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createShareLinkType?: ShareLinkTypes | ISharingLinkKind): IRequest;
|
|
16
18
|
//# sourceMappingURL=createOdspCreateContainerRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOdspCreateContainerRequest.d.ts","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"createOdspCreateContainerRequest.d.ts","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3F;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,cAAc,GAAG,gBAAgB,GACrD,QAAQ,CAaV"}
|
|
@@ -11,6 +11,7 @@ exports.createOdspUrl = void 0;
|
|
|
11
11
|
/**
|
|
12
12
|
* Encodes ODC/SPO information into a URL format that can be handled by the Loader
|
|
13
13
|
* @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it
|
|
14
|
+
* @alpha
|
|
14
15
|
*/
|
|
15
16
|
function createOdspUrl(l) {
|
|
16
17
|
let odspUrl = `${l.siteUrl}?driveId=${encodeURIComponent(l.driveId)}&itemId=${encodeURIComponent(l.itemId)}&path=${encodeURIComponent(l.dataStorePath)}`;
|
|
@@ -23,4 +24,4 @@ function createOdspUrl(l) {
|
|
|
23
24
|
return odspUrl;
|
|
24
25
|
}
|
|
25
26
|
exports.createOdspUrl = createOdspUrl;
|
|
26
|
-
//# sourceMappingURL=createOdspUrl.
|
|
27
|
+
//# sourceMappingURL=createOdspUrl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOdspUrl.cjs","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AAEH;;;;GAIG;AACH,SAAgB,aAAa,CAAC,CAA4B;IACzD,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,YAAY,kBAAkB,CACvD,CAAC,CAAC,OAAO,CACT,WAAW,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;IACvF,IAAI,CAAC,CAAC,oBAAoB,EAAE;QAC3B,OAAO,IAAI,yBAAyB,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC;KACjF;IACD,IAAI,CAAC,CAAC,WAAW,EAAE;QAClB,OAAO,IAAI,gBAAgB,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;KAC/D;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAZD,sCAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { OdspFluidDataStoreLocator } from \"./contractsPublic\";\n\n/*\n * Per https://github.com/microsoft/FluidFramework/issues/1556, isolating createOdspUrl() in its own file.\n */\n\n/**\n * Encodes ODC/SPO information into a URL format that can be handled by the Loader\n * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it\n * @alpha\n */\nexport function createOdspUrl(l: OdspFluidDataStoreLocator): string {\n\tlet odspUrl = `${l.siteUrl}?driveId=${encodeURIComponent(\n\t\tl.driveId,\n\t)}&itemId=${encodeURIComponent(l.itemId)}&path=${encodeURIComponent(l.dataStorePath)}`;\n\tif (l.containerPackageName) {\n\t\todspUrl += `&containerPackageName=${encodeURIComponent(l.containerPackageName)}`;\n\t}\n\tif (l.fileVersion) {\n\t\todspUrl += `&fileVersion=${encodeURIComponent(l.fileVersion)}`;\n\t}\n\n\treturn odspUrl;\n}\n"]}
|
package/dist/createOdspUrl.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { OdspFluidDataStoreLocator } from "./contractsPublic";
|
|
|
6
6
|
/**
|
|
7
7
|
* Encodes ODC/SPO information into a URL format that can be handled by the Loader
|
|
8
8
|
* @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it
|
|
9
|
+
* @alpha
|
|
9
10
|
*/
|
|
10
11
|
export declare function createOdspUrl(l: OdspFluidDataStoreLocator): string;
|
|
11
12
|
//# sourceMappingURL=createOdspUrl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOdspUrl.d.ts","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAM9D
|
|
1
|
+
{"version":3,"file":"createOdspUrl.d.ts","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAM9D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,yBAAyB,GAAG,MAAM,CAYlE"}
|
|
@@ -6,23 +6,34 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.createOdspCacheAndTracker = exports.EpochTrackerWithRedemption = exports.EpochTracker = exports.defaultCacheExpiryTimeoutMs = exports.Odsp409Error = void 0;
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
|
-
const
|
|
9
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
10
11
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
11
12
|
const odsp_driver_definitions_1 = require("@fluidframework/odsp-driver-definitions");
|
|
12
13
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
14
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
15
|
+
const contracts_1 = require("./contracts.cjs");
|
|
16
|
+
const contractsPublic_1 = require("./contractsPublic.cjs");
|
|
17
|
+
const packageVersion_1 = require("./packageVersion.cjs");
|
|
18
|
+
const odspLocationRedirection_1 = require("./odspLocationRedirection.cjs");
|
|
18
19
|
exports.Odsp409Error = "Odsp409Error";
|
|
19
|
-
//
|
|
20
|
-
exports.defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000;
|
|
20
|
+
// Must be less than policy of 5 days
|
|
21
|
+
exports.defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000; // 2 days in ms
|
|
21
22
|
/**
|
|
23
|
+
* In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using
|
|
24
|
+
* version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch
|
|
25
|
+
* value being incremented.
|
|
26
|
+
*
|
|
27
|
+
* The implications of these binary updates is that the Fluid state is disrupted: the sequence number might
|
|
28
|
+
* go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's
|
|
29
|
+
* not safe to continue collaboration across an epoch change. We need to detect these epoch changes and
|
|
30
|
+
* error out from the collaboration.
|
|
31
|
+
*
|
|
22
32
|
* This class is a wrapper around fetch calls. It adds epoch to the request made so that the
|
|
23
33
|
* server can match it with its epoch value in order to match the version.
|
|
24
34
|
* It also validates the epoch value received in response of fetch calls. If the epoch does not match,
|
|
25
35
|
* then it also clears all the cached entries for the given container.
|
|
36
|
+
* @alpha
|
|
26
37
|
*/
|
|
27
38
|
class EpochTracker {
|
|
28
39
|
constructor(cache, fileEntry, logger, clientIsSummarizer) {
|
|
@@ -35,10 +46,14 @@ class EpochTracker {
|
|
|
35
46
|
this.networkCallNumber = 1;
|
|
36
47
|
// Limits the max number of concurrent requests to 24.
|
|
37
48
|
this.rateLimiter = new driver_utils_1.RateLimiter(24);
|
|
49
|
+
// Matches the TestOverride logic for the policy defined in odspDocumentStorageServiceBase.ts
|
|
50
|
+
this.snapshotCacheExpiryTimeoutMs = (0, telemetry_utils_1.loggerToMonitoringContext)(logger).config.getBoolean("Fluid.Driver.Odsp.TestOverride.DisableSnapshotCache")
|
|
51
|
+
? 0
|
|
52
|
+
: exports.defaultCacheExpiryTimeoutMs;
|
|
38
53
|
}
|
|
39
54
|
// public for UT purposes only!
|
|
40
55
|
setEpoch(epoch, fromCache, fetchType) {
|
|
41
|
-
(0,
|
|
56
|
+
(0, core_utils_1.assert)(this._fluidEpoch === undefined, 0x1db /* "epoch exists" */);
|
|
42
57
|
this._fluidEpoch = epoch;
|
|
43
58
|
this.logger.sendTelemetryEvent({
|
|
44
59
|
eventName: "EpochLearnedFirstTime",
|
|
@@ -48,7 +63,6 @@ class EpochTracker {
|
|
|
48
63
|
});
|
|
49
64
|
}
|
|
50
65
|
async get(entry) {
|
|
51
|
-
var _a;
|
|
52
66
|
try {
|
|
53
67
|
// Return undefined so that the ops/snapshots are grabbed from the server instead of the cache
|
|
54
68
|
const value = await this.cache.get(this.fileEntryFromEntry(entry));
|
|
@@ -57,7 +71,7 @@ class EpochTracker {
|
|
|
57
71
|
if (value === undefined || value.version !== contracts_1.persistedCacheValueVersion) {
|
|
58
72
|
return undefined;
|
|
59
73
|
}
|
|
60
|
-
(0,
|
|
74
|
+
(0, core_utils_1.assert)(value.fluidEpoch !== undefined, 0x1dc /* "all entries have to have epoch" */);
|
|
61
75
|
if (this._fluidEpoch === undefined) {
|
|
62
76
|
this.setEpoch(value.fluidEpoch, true, "cache");
|
|
63
77
|
// Epoch mismatch, the cached value is considerably different from what the current state of
|
|
@@ -66,16 +80,17 @@ class EpochTracker {
|
|
|
66
80
|
else if (this._fluidEpoch !== value.fluidEpoch) {
|
|
67
81
|
return undefined;
|
|
68
82
|
}
|
|
69
|
-
// Expire the cached snapshot if it's older than
|
|
83
|
+
// Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately
|
|
70
84
|
// expire all old caches that do not have cacheEntryTime
|
|
71
85
|
if (entry.type === odsp_driver_definitions_1.snapshotKey) {
|
|
72
|
-
const cacheTime =
|
|
86
|
+
const cacheTime = value.value?.cacheEntryTime;
|
|
73
87
|
const currentTime = Date.now();
|
|
74
|
-
if (cacheTime === undefined ||
|
|
88
|
+
if (cacheTime === undefined ||
|
|
89
|
+
currentTime - cacheTime >= this.snapshotCacheExpiryTimeoutMs) {
|
|
75
90
|
this.logger.sendTelemetryEvent({
|
|
76
91
|
eventName: "odspVersionsCacheExpired",
|
|
77
92
|
duration: currentTime - cacheTime,
|
|
78
|
-
maxCacheAgeMs:
|
|
93
|
+
maxCacheAgeMs: this.snapshotCacheExpiryTimeoutMs,
|
|
79
94
|
});
|
|
80
95
|
await this.removeEntries();
|
|
81
96
|
return undefined;
|
|
@@ -90,20 +105,18 @@ class EpochTracker {
|
|
|
90
105
|
}
|
|
91
106
|
}
|
|
92
107
|
async put(entry, value) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
//
|
|
96
|
-
// than the defaultCacheExpiryTimeoutMs.
|
|
108
|
+
(0, core_utils_1.assert)(this._fluidEpoch !== undefined, 0x1dd /* "no epoch" */);
|
|
109
|
+
// For snapshots, the value should have the cacheEntryTime.
|
|
110
|
+
// This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.
|
|
97
111
|
if (entry.type === odsp_driver_definitions_1.snapshotKey) {
|
|
98
|
-
value.cacheEntryTime =
|
|
112
|
+
value.cacheEntryTime = value.cacheEntryTime ?? Date.now();
|
|
99
113
|
}
|
|
100
114
|
const data = {
|
|
101
115
|
value,
|
|
102
116
|
version: contracts_1.persistedCacheValueVersion,
|
|
103
117
|
fluidEpoch: this._fluidEpoch,
|
|
104
118
|
};
|
|
105
|
-
return this.cache.put(this.fileEntryFromEntry(entry), data)
|
|
106
|
-
.catch((error) => {
|
|
119
|
+
return this.cache.put(this.fileEntryFromEntry(entry), data).catch((error) => {
|
|
107
120
|
this.logger.sendErrorEvent({ eventName: "cachePutError", type: entry.type }, error);
|
|
108
121
|
throw error;
|
|
109
122
|
});
|
|
@@ -119,14 +132,13 @@ class EpochTracker {
|
|
|
119
132
|
get fluidEpoch() {
|
|
120
133
|
return this._fluidEpoch;
|
|
121
134
|
}
|
|
122
|
-
async
|
|
123
|
-
|
|
124
|
-
(0, common_utils_1.assert)(epoch !== undefined, 0x09d /* "Connection details should contain epoch" */);
|
|
135
|
+
async validateEpoch(epoch, fetchType) {
|
|
136
|
+
(0, core_utils_1.assert)(epoch !== undefined, 0x584 /* response should contain epoch */);
|
|
125
137
|
try {
|
|
126
|
-
this.validateEpochFromResponse(epoch,
|
|
138
|
+
this.validateEpochFromResponse(epoch, fetchType);
|
|
127
139
|
}
|
|
128
140
|
catch (error) {
|
|
129
|
-
await this.checkForEpochError(error, epoch,
|
|
141
|
+
await this.checkForEpochError(error, epoch, fetchType);
|
|
130
142
|
throw error;
|
|
131
143
|
}
|
|
132
144
|
}
|
|
@@ -157,12 +169,15 @@ class EpochTracker {
|
|
|
157
169
|
// Add epoch in fetch request.
|
|
158
170
|
this.addEpochInRequest(fetchOptions, addInBody, clientCorrelationId);
|
|
159
171
|
let epochFromResponse;
|
|
160
|
-
return this.rateLimiter
|
|
172
|
+
return this.rateLimiter
|
|
173
|
+
.schedule(async () => fetcher(url, fetchOptions))
|
|
174
|
+
.then((response) => {
|
|
161
175
|
epochFromResponse = response.headers.get("x-fluid-epoch");
|
|
162
176
|
this.validateEpochFromResponse(epochFromResponse, fetchType);
|
|
163
177
|
response.propsToLog.XRequestStatsHeader = clientCorrelationId;
|
|
164
178
|
return response;
|
|
165
|
-
})
|
|
179
|
+
})
|
|
180
|
+
.catch(async (error) => {
|
|
166
181
|
// Get the server epoch from error in case we don't have it as if undefined we won't be able
|
|
167
182
|
// to mark it as epoch error.
|
|
168
183
|
if (epochFromResponse === undefined) {
|
|
@@ -170,8 +185,26 @@ class EpochTracker {
|
|
|
170
185
|
}
|
|
171
186
|
await this.checkForEpochError(error, epochFromResponse, fetchType);
|
|
172
187
|
throw error;
|
|
173
|
-
})
|
|
174
|
-
|
|
188
|
+
})
|
|
189
|
+
.catch((error) => {
|
|
190
|
+
// If the error is about location redirection, then we need to generate new resolved url with correct
|
|
191
|
+
// location info.
|
|
192
|
+
if ((0, telemetry_utils_1.isFluidError)(error) &&
|
|
193
|
+
error.errorType === driver_definitions_1.DriverErrorType.fileNotFoundOrAccessDeniedError) {
|
|
194
|
+
const redirectLocation = error.redirectLocation;
|
|
195
|
+
if (redirectLocation !== undefined) {
|
|
196
|
+
const redirectUrl = (0, odspLocationRedirection_1.patchOdspResolvedUrl)(this.fileEntry.resolvedUrl, redirectLocation);
|
|
197
|
+
const locationRedirectionError = new driver_utils_1.LocationRedirectionError(error.message, redirectUrl, { driverVersion: packageVersion_1.pkgVersion, redirectLocation });
|
|
198
|
+
locationRedirectionError.addTelemetryProperties(error.getTelemetryProperties());
|
|
199
|
+
throw locationRedirectionError;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
throw error;
|
|
203
|
+
})
|
|
204
|
+
.catch((error) => {
|
|
205
|
+
const fluidError = (0, telemetry_utils_1.normalizeError)(error, {
|
|
206
|
+
props: { XRequestStatsHeader: clientCorrelationId },
|
|
207
|
+
});
|
|
175
208
|
throw fluidError;
|
|
176
209
|
});
|
|
177
210
|
}
|
|
@@ -201,8 +234,10 @@ class EpochTracker {
|
|
|
201
234
|
}
|
|
202
235
|
else {
|
|
203
236
|
const addHeader = (key, val) => {
|
|
204
|
-
fetchOptions.headers =
|
|
205
|
-
|
|
237
|
+
fetchOptions.headers = {
|
|
238
|
+
...fetchOptions.headers,
|
|
239
|
+
};
|
|
240
|
+
(0, core_utils_1.assert)(fetchOptions.headers !== undefined, 0x282 /* "Headers should be present now" */);
|
|
206
241
|
fetchOptions.headers[key] = val;
|
|
207
242
|
};
|
|
208
243
|
addHeader("X-RequestStats", clientCorrelationId);
|
|
@@ -218,10 +253,10 @@ class EpochTracker {
|
|
|
218
253
|
// We use multi part form request for post body where we want to use this.
|
|
219
254
|
// So extract the form boundary to mark the end of form.
|
|
220
255
|
const body = fetchOptions.body;
|
|
221
|
-
(0,
|
|
256
|
+
(0, core_utils_1.assert)(typeof body === "string", 0x21d /* "body is not string" */);
|
|
222
257
|
const splitBody = body.split("\r\n");
|
|
223
258
|
const firstLine = splitBody.shift();
|
|
224
|
-
(0,
|
|
259
|
+
(0, core_utils_1.assert)(firstLine?.startsWith("--") === true, 0x21e /* "improper boundary format" */);
|
|
225
260
|
const formParams = [firstLine];
|
|
226
261
|
Object.entries(headers).forEach(([key, value]) => {
|
|
227
262
|
formParams.push(`${key}: ${value}`);
|
|
@@ -260,7 +295,6 @@ class EpochTracker {
|
|
|
260
295
|
if (epochError !== undefined) {
|
|
261
296
|
epochError.addTelemetryProperties({
|
|
262
297
|
fromCache,
|
|
263
|
-
clientEpoch: this.fluidEpoch,
|
|
264
298
|
fetchType,
|
|
265
299
|
});
|
|
266
300
|
this.logger.sendErrorEvent({ eventName: "fileOverwrittenInStorage" }, epochError);
|
|
@@ -271,28 +305,40 @@ class EpochTracker {
|
|
|
271
305
|
// If it was categorized as epoch error but the epoch returned in response matches with the client epoch
|
|
272
306
|
// then it was coherency 409, so rethrow it as throttling error so that it can retried. Default throttling
|
|
273
307
|
// time is 1s.
|
|
274
|
-
|
|
308
|
+
const newError = (0, telemetry_utils_1.wrapError)(error, (message) => {
|
|
309
|
+
return new driver_utils_1.ThrottlingError(`Coherency 409: ${message}`, 1 /* retryAfterSeconds */, {
|
|
310
|
+
[exports.Odsp409Error]: true,
|
|
311
|
+
driverVersion: packageVersion_1.pkgVersion,
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
throw newError;
|
|
275
315
|
}
|
|
276
316
|
}
|
|
277
317
|
checkForEpochErrorCore(epochFromResponse) {
|
|
278
318
|
// If epoch is undefined, then don't compare it because initially for createNew or TreesLatest
|
|
279
319
|
// initializes this value. Sometimes response does not contain epoch as it is still in
|
|
280
320
|
// implementation phase at server side. In that case also, don't compare it with our epoch value.
|
|
281
|
-
if (this.fluidEpoch && epochFromResponse &&
|
|
321
|
+
if (this.fluidEpoch && epochFromResponse && this.fluidEpoch !== epochFromResponse) {
|
|
282
322
|
// This is similar in nature to how fluidEpochMismatchError (409) is handled.
|
|
283
323
|
// Difference - client detected mismatch, instead of server detecting it.
|
|
284
|
-
return new driver_utils_1.NonRetryableError("Epoch mismatch", driver_definitions_1.DriverErrorType.fileOverwrittenInStorage, { driverVersion: packageVersion_1.pkgVersion });
|
|
324
|
+
return new driver_utils_1.NonRetryableError("Epoch mismatch", driver_definitions_1.DriverErrorType.fileOverwrittenInStorage, { driverVersion: packageVersion_1.pkgVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch });
|
|
285
325
|
}
|
|
286
326
|
}
|
|
287
327
|
fileEntryFromEntry(entry) {
|
|
288
|
-
return
|
|
328
|
+
return { ...entry, file: this.fileEntry };
|
|
289
329
|
}
|
|
290
330
|
}
|
|
291
331
|
exports.EpochTracker = EpochTracker;
|
|
292
332
|
class EpochTrackerWithRedemption extends EpochTracker {
|
|
293
|
-
constructor() {
|
|
294
|
-
super(
|
|
295
|
-
this.
|
|
333
|
+
constructor(cache, fileEntry, logger, clientIsSummarizer) {
|
|
334
|
+
super(cache, fileEntry, logger, clientIsSummarizer);
|
|
335
|
+
this.cache = cache;
|
|
336
|
+
this.fileEntry = fileEntry;
|
|
337
|
+
this.logger = logger;
|
|
338
|
+
this.clientIsSummarizer = clientIsSummarizer;
|
|
339
|
+
this.treesLatestDeferral = new core_utils_1.Deferred();
|
|
340
|
+
// Handles the rejected promise within treesLatestDeferral.
|
|
341
|
+
this.treesLatestDeferral.promise.catch(() => { });
|
|
296
342
|
}
|
|
297
343
|
validateEpochFromResponse(epochFromResponse, fetchType, fromCache = false) {
|
|
298
344
|
super.validateEpochFromResponse(epochFromResponse, fetchType, fromCache);
|
|
@@ -336,7 +382,10 @@ class EpochTrackerWithRedemption extends EpochTracker {
|
|
|
336
382
|
if (fetchType === "treesLatest") {
|
|
337
383
|
this.treesLatestDeferral.reject(error);
|
|
338
384
|
}
|
|
339
|
-
if (fetchType !== "joinSession" ||
|
|
385
|
+
if (fetchType !== "joinSession" ||
|
|
386
|
+
error.statusCode < 401 ||
|
|
387
|
+
error.statusCode > 404 ||
|
|
388
|
+
completed) {
|
|
340
389
|
throw error;
|
|
341
390
|
}
|
|
342
391
|
}
|
|
@@ -352,12 +401,14 @@ class EpochTrackerWithRedemption extends EpochTracker {
|
|
|
352
401
|
const timeoutRes = 51; // anything will work here
|
|
353
402
|
let timer;
|
|
354
403
|
const timeoutP = new Promise((resolve) => {
|
|
355
|
-
timer = setTimeout(() => {
|
|
404
|
+
timer = setTimeout(() => {
|
|
405
|
+
resolve(timeoutRes);
|
|
406
|
+
}, 15000);
|
|
356
407
|
});
|
|
357
408
|
const res = await Promise.race([
|
|
358
409
|
timeoutP,
|
|
359
410
|
// cancel timeout to unblock UTs (otherwise Node process does not exit for 15 sec)
|
|
360
|
-
this.treesLatestDeferral.promise.finally(() => clearTimeout(timer))
|
|
411
|
+
this.treesLatestDeferral.promise.finally(() => clearTimeout(timer)),
|
|
361
412
|
]);
|
|
362
413
|
if (res === timeoutRes) {
|
|
363
414
|
event.cancel();
|
|
@@ -370,9 +421,12 @@ exports.EpochTrackerWithRedemption = EpochTrackerWithRedemption;
|
|
|
370
421
|
function createOdspCacheAndTracker(persistedCacheArg, nonpersistentCache, fileEntry, logger, clientIsSummarizer) {
|
|
371
422
|
const epochTracker = new EpochTrackerWithRedemption(persistedCacheArg, fileEntry, logger, clientIsSummarizer);
|
|
372
423
|
return {
|
|
373
|
-
cache:
|
|
424
|
+
cache: {
|
|
425
|
+
...nonpersistentCache,
|
|
426
|
+
persistedCache: epochTracker,
|
|
427
|
+
},
|
|
374
428
|
epochTracker,
|
|
375
429
|
};
|
|
376
430
|
}
|
|
377
431
|
exports.createOdspCacheAndTracker = createOdspCacheAndTracker;
|
|
378
|
-
//# sourceMappingURL=epochTracker.
|
|
432
|
+
//# sourceMappingURL=epochTracker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epochTracker.cjs","sourceRoot":"","sources":["../src/epochTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAClC,2DAA8D;AAC9D,qEAOyC;AACzC,+DAKsC;AACtC,qFASiD;AACjD,2EAAqE;AACrE,+CAMqB;AAErB,+CAAmF;AACnF,2DAA0D;AAC1D,yDAA+D;AAC/D,2EAAiE;AAuBpD,QAAA,YAAY,GAAG,cAAc,CAAC;AAE3C,qCAAqC;AACxB,QAAA,2BAA2B,GAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,eAAe;AAE3F;;;;;;;;;;;;;;;GAeG;AACH,MAAa,YAAY;IAQxB,YACoB,KAAsB,EACtB,SAAqB,EACrB,MAA2B,EAC3B,kBAA4B;QAH5B,UAAK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C7C,CAAC;QACF,OAAO,KAAK,CAAC,mBAAmB,CAAI,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC;CACD;AAvHD,gEAuHC;AAUD,SAAgB,yBAAyB,CACxC,iBAAkC,EAClC,kBAAuC,EACvC,SAAqB,EACrB,MAA2B,EAC3B,kBAA4B;IAE5B,MAAM,YAAY,GAAG,IAAI,0BAA0B,CAClD,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,kBAAkB,CAClB,CAAC;IACF,OAAO;QACN,KAAK,EAAE;YACN,GAAG,kBAAkB;YACrB,cAAc,EAAE,YAAY;SAC5B;QACD,YAAY;KACZ,CAAC;AACH,CAAC;AApBD,8DAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tisFluidError,\n\tnormalizeError,\n\tloggerToMonitoringContext,\n\twrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tThrottlingError,\n\tRateLimiter,\n\tNonRetryableError,\n\tLocationRedirectionError,\n} from \"@fluidframework/driver-utils\";\nimport {\n\tsnapshotKey,\n\tICacheEntry,\n\tIEntry,\n\tIFileEntry,\n\tIPersistedCache,\n\tIOdspError,\n\tIOdspErrorAugmentations,\n\tIOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport {\n\tfetchAndParseAsJSONHelper,\n\tfetchArray,\n\tfetchHelper,\n\tgetOdspResolvedUrl,\n\tIOdspResponse,\n} from \"./odspUtils\";\nimport { IOdspCache, INonPersistentCache, IPersistedFileCache } from \"./odspCache\";\nimport { IVersionedValueWithEpoch, persistedCacheValueVersion } from \"./contracts\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { patchOdspResolvedUrl } from \"./odspLocationRedirection\";\n\n/**\n * @alpha\n */\nexport type FetchType =\n\t| \"blob\"\n\t| \"createBlob\"\n\t| \"createFile\"\n\t| \"joinSession\"\n\t| \"ops\"\n\t| \"test\"\n\t| \"snapshotTree\"\n\t| \"treesLatest\"\n\t| \"uploadSummary\"\n\t| \"push\"\n\t| \"versions\";\n\n/**\n * @alpha\n */\nexport type FetchTypeInternal = FetchType | \"cache\";\n\nexport const Odsp409Error = \"Odsp409Error\";\n\n// Must be less than policy of 5 days\nexport const defaultCacheExpiryTimeoutMs: number = 2 * 24 * 60 * 60 * 1000; // 2 days in ms\n\n/**\n * In ODSP, the concept of \"epoch\" refers to binary updates to files. For example, this might include using\n * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch\n * value being incremented.\n *\n * The implications of these binary updates is that the Fluid state is disrupted: the sequence number might\n * go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's\n * not safe to continue collaboration across an epoch change. We need to detect these epoch changes and\n * error out from the collaboration.\n *\n * This class is a wrapper around fetch calls. It adds epoch to the request made so that the\n * server can match it with its epoch value in order to match the version.\n * It also validates the epoch value received in response of fetch calls. If the epoch does not match,\n * then it also clears all the cached entries for the given container.\n * @alpha\n */\nexport class EpochTracker implements IPersistedFileCache {\n\tprivate _fluidEpoch: string | undefined;\n\n\tprivate readonly snapshotCacheExpiryTimeoutMs: number;\n\tpublic readonly rateLimiter: RateLimiter;\n\tprivate readonly driverId = uuid();\n\t// This tracks the request number made by the driver instance.\n\tprivate networkCallNumber = 1;\n\tconstructor(\n\t\tprotected readonly cache: IPersistedCache,\n\t\tprotected readonly fileEntry: IFileEntry,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tprotected readonly clientIsSummarizer?: boolean,\n\t) {\n\t\t// Limits the max number of concurrent requests to 24.\n\t\tthis.rateLimiter = new RateLimiter(24);\n\n\t\t// Matches the TestOverride logic for the policy defined in odspDocumentStorageServiceBase.ts\n\t\tthis.snapshotCacheExpiryTimeoutMs = loggerToMonitoringContext(logger).config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.TestOverride.DisableSnapshotCache\",\n\t\t)\n\t\t\t? 0\n\t\t\t: defaultCacheExpiryTimeoutMs;\n\t}\n\n\t// public for UT purposes only!\n\tpublic setEpoch(epoch: string, fromCache: boolean, fetchType: FetchTypeInternal) {\n\t\tassert(this._fluidEpoch === undefined, 0x1db /* \"epoch exists\" */);\n\t\tthis._fluidEpoch = epoch;\n\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"EpochLearnedFirstTime\",\n\t\t\tepoch,\n\t\t\tfetchType,\n\t\t\tfromCache,\n\t\t});\n\t}\n\n\tpublic async get(entry: IEntry): Promise<any> {\n\t\ttry {\n\t\t\t// Return undefined so that the ops/snapshots are grabbed from the server instead of the cache\n\t\t\tconst value: IVersionedValueWithEpoch = await this.cache.get(\n\t\t\t\tthis.fileEntryFromEntry(entry),\n\t\t\t);\n\t\t\t// Version mismatch between what the runtime expects and what it recieved.\n\t\t\t// The cached value should not be used\n\t\t\tif (value === undefined || value.version !== persistedCacheValueVersion) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tassert(value.fluidEpoch !== undefined, 0x1dc /* \"all entries have to have epoch\" */);\n\t\t\tif (this._fluidEpoch === undefined) {\n\t\t\t\tthis.setEpoch(value.fluidEpoch, true, \"cache\");\n\t\t\t\t// Epoch mismatch, the cached value is considerably different from what the current state of\n\t\t\t\t// the runtime and should not be used\n\t\t\t} else if (this._fluidEpoch !== value.fluidEpoch) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately\n\t\t\t// expire all old caches that do not have cacheEntryTime\n\t\t\tif (entry.type === snapshotKey) {\n\t\t\t\tconst cacheTime = value.value?.cacheEntryTime;\n\t\t\t\tconst currentTime = Date.now();\n\t\t\t\tif (\n\t\t\t\t\tcacheTime === undefined ||\n\t\t\t\t\tcurrentTime - cacheTime >= this.snapshotCacheExpiryTimeoutMs\n\t\t\t\t) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"odspVersionsCacheExpired\",\n\t\t\t\t\t\tduration: currentTime - cacheTime,\n\t\t\t\t\t\tmaxCacheAgeMs: this.snapshotCacheExpiryTimeoutMs,\n\t\t\t\t\t});\n\t\t\t\t\tawait this.removeEntries();\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn value.value;\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"cacheFetchError\", type: entry.type }, error);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tpublic async put(entry: IEntry, value: any) {\n\t\tassert(this._fluidEpoch !== undefined, 0x1dd /* \"no epoch\" */);\n\t\t// For snapshots, the value should have the cacheEntryTime.\n\t\t// This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.\n\t\tif (entry.type === snapshotKey) {\n\t\t\tvalue.cacheEntryTime = value.cacheEntryTime ?? Date.now();\n\t\t}\n\t\tconst data: IVersionedValueWithEpoch = {\n\t\t\tvalue,\n\t\t\tversion: persistedCacheValueVersion,\n\t\t\tfluidEpoch: this._fluidEpoch,\n\t\t};\n\t\treturn this.cache.put(this.fileEntryFromEntry(entry), data).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"cachePutError\", type: entry.type }, error);\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tpublic async removeEntries(): Promise<void> {\n\t\ttry {\n\t\t\treturn await this.cache.removeEntries(this.fileEntry);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"removeCacheEntries\" }, error);\n\t\t}\n\t}\n\n\tpublic get fluidEpoch() {\n\t\treturn this._fluidEpoch;\n\t}\n\n\tpublic async validateEpoch(epoch: string | undefined, fetchType: FetchType) {\n\t\tassert(epoch !== undefined, 0x584 /* response should contain epoch */);\n\t\ttry {\n\t\t\tthis.validateEpochFromResponse(epoch, fetchType);\n\t\t} catch (error) {\n\t\t\tawait this.checkForEpochError(error, epoch, fetchType);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Api to fetch the response for given request and parse it as json.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetchAndParseAsJSON<T>(\n\t\turl: string,\n\t\tfetchOptions: RequestInit,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<T>> {\n\t\treturn this.fetchCore<T>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchAndParseAsJSONHelper,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\t/**\n\t * Api to fetch the response for given request and parse it as json.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetch(\n\t\turl: string,\n\t\tfetchOptions: RequestInit,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t) {\n\t\treturn this.fetchCore<Response>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchHelper,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\tprivate async fetchCore<T>(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: any },\n\t\tfetcher: (url: string, fetchOptions: { [index: string]: any }) => Promise<IOdspResponse<T>>,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t) {\n\t\tconst clientCorrelationId = this.formatClientCorrelationId(fetchReason);\n\t\t// Add epoch in fetch request.\n\t\tthis.addEpochInRequest(fetchOptions, addInBody, clientCorrelationId);\n\t\tlet epochFromResponse: string | undefined;\n\t\treturn this.rateLimiter\n\t\t\t.schedule(async () => fetcher(url, fetchOptions))\n\t\t\t.then((response) => {\n\t\t\t\tepochFromResponse = response.headers.get(\"x-fluid-epoch\");\n\t\t\t\tthis.validateEpochFromResponse(epochFromResponse, fetchType);\n\t\t\t\tresponse.propsToLog.XRequestStatsHeader = clientCorrelationId;\n\t\t\t\treturn response;\n\t\t\t})\n\t\t\t.catch(async (error) => {\n\t\t\t\t// Get the server epoch from error in case we don't have it as if undefined we won't be able\n\t\t\t\t// to mark it as epoch error.\n\t\t\t\tif (epochFromResponse === undefined) {\n\t\t\t\t\tepochFromResponse = (error as IOdspError).serverEpoch;\n\t\t\t\t}\n\t\t\t\tawait this.checkForEpochError(error, epochFromResponse, fetchType);\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\t// If the error is about location redirection, then we need to generate new resolved url with correct\n\t\t\t\t// location info.\n\t\t\t\tif (\n\t\t\t\t\tisFluidError(error) &&\n\t\t\t\t\terror.errorType === DriverErrorType.fileNotFoundOrAccessDeniedError\n\t\t\t\t) {\n\t\t\t\t\tconst redirectLocation = (error as IOdspErrorAugmentations).redirectLocation;\n\t\t\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\t\t\tconst redirectUrl: IOdspResolvedUrl = patchOdspResolvedUrl(\n\t\t\t\t\t\t\tthis.fileEntry.resolvedUrl,\n\t\t\t\t\t\t\tredirectLocation,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst locationRedirectionError = new LocationRedirectionError(\n\t\t\t\t\t\t\terror.message,\n\t\t\t\t\t\t\tredirectUrl,\n\t\t\t\t\t\t\t{ driverVersion, redirectLocation },\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlocationRedirectionError.addTelemetryProperties(\n\t\t\t\t\t\t\terror.getTelemetryProperties(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow locationRedirectionError;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tconst fluidError = normalizeError(error, {\n\t\t\t\t\tprops: { XRequestStatsHeader: clientCorrelationId },\n\t\t\t\t});\n\t\t\t\tthrow fluidError;\n\t\t\t});\n\t}\n\n\t/**\n\t * Api to fetch the response as it is for given request.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetchArray(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: any },\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t) {\n\t\treturn this.fetchCore<ArrayBuffer>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchArray,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\tprivate addEpochInRequest(\n\t\tfetchOptions: RequestInit,\n\t\taddInBody: boolean,\n\t\tclientCorrelationId: string,\n\t) {\n\t\tconst isClpCompliantApp = getOdspResolvedUrl(this.fileEntry.resolvedUrl).isClpCompliantApp;\n\t\tif (addInBody) {\n\t\t\tconst headers: { [key: string]: string } = {};\n\t\t\theaders[\"X-RequestStats\"] = clientCorrelationId;\n\t\t\tif (this.fluidEpoch !== undefined) {\n\t\t\t\theaders[\"x-fluid-epoch\"] = this.fluidEpoch;\n\t\t\t}\n\t\t\tif (isClpCompliantApp) {\n\t\t\t\theaders[ClpCompliantAppHeader.isClpCompliantApp] = isClpCompliantApp.toString();\n\t\t\t}\n\t\t\tthis.addParamInBody(fetchOptions, headers);\n\t\t} else {\n\t\t\tconst addHeader = (key: string, val: string) => {\n\t\t\t\tfetchOptions.headers = {\n\t\t\t\t\t...fetchOptions.headers,\n\t\t\t\t};\n\t\t\t\tassert(\n\t\t\t\t\tfetchOptions.headers !== undefined,\n\t\t\t\t\t0x282 /* \"Headers should be present now\" */,\n\t\t\t\t);\n\t\t\t\tfetchOptions.headers[key] = val;\n\t\t\t};\n\t\t\taddHeader(\"X-RequestStats\", clientCorrelationId);\n\t\t\tif (this.fluidEpoch !== undefined) {\n\t\t\t\taddHeader(\"x-fluid-epoch\", this.fluidEpoch);\n\t\t\t}\n\t\t\tif (isClpCompliantApp) {\n\t\t\t\taddHeader(ClpCompliantAppHeader.isClpCompliantApp, isClpCompliantApp.toString());\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addParamInBody(fetchOptions: RequestInit, headers: { [key: string]: string }) {\n\t\t// We use multi part form request for post body where we want to use this.\n\t\t// So extract the form boundary to mark the end of form.\n\t\tconst body = fetchOptions.body;\n\t\tassert(typeof body === \"string\", 0x21d /* \"body is not string\" */);\n\t\tconst splitBody = body.split(\"\\r\\n\");\n\t\tconst firstLine = splitBody.shift();\n\t\tassert(firstLine?.startsWith(\"--\") === true, 0x21e /* \"improper boundary format\" */);\n\t\tconst formParams = [firstLine];\n\t\tObject.entries(headers).forEach(([key, value]) => {\n\t\t\tformParams.push(`${key}: ${value}`);\n\t\t});\n\t\tsplitBody.forEach((value: string) => {\n\t\t\tformParams.push(value);\n\t\t});\n\t\tfetchOptions.body = formParams.join(\"\\r\\n\");\n\t}\n\n\tprivate formatClientCorrelationId(fetchReason?: string) {\n\t\tconst items: string[] = [\n\t\t\t`driverId=${this.driverId}`,\n\t\t\t`RequestNumber=${this.networkCallNumber++}`,\n\t\t\t`driverVersion=${driverVersion}`,\n\t\t\t`isSummarizer=${this.clientIsSummarizer}`,\n\t\t];\n\t\tif (fetchReason !== undefined) {\n\t\t\titems.push(`fetchReason=${fetchReason}`);\n\t\t}\n\t\treturn items.join(\", \");\n\t}\n\n\tprotected validateEpochFromResponse(\n\t\tepochFromResponse: string | undefined,\n\t\tfetchType: FetchTypeInternal,\n\t\tfromCache: boolean = false,\n\t) {\n\t\tconst error = this.checkForEpochErrorCore(epochFromResponse);\n\t\tif (error !== undefined) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (epochFromResponse !== undefined) {\n\t\t\tif (this._fluidEpoch === undefined) {\n\t\t\t\tthis.setEpoch(epochFromResponse, fromCache, fetchType);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async checkForEpochError(\n\t\terror: unknown,\n\t\tepochFromResponse: string | null | undefined,\n\t\tfetchType: FetchTypeInternal,\n\t\tfromCache: boolean = false,\n\t) {\n\t\tif (isFluidError(error) && error.errorType === DriverErrorType.fileOverwrittenInStorage) {\n\t\t\tconst epochError = this.checkForEpochErrorCore(epochFromResponse);\n\t\t\tif (epochError !== undefined) {\n\t\t\t\tepochError.addTelemetryProperties({\n\t\t\t\t\tfromCache,\n\t\t\t\t\tfetchType,\n\t\t\t\t});\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"fileOverwrittenInStorage\" }, epochError);\n\t\t\t\t// If the epoch mismatches, then clear all entries for such file entry from cache.\n\t\t\t\tawait this.removeEntries();\n\t\t\t\tthrow epochError;\n\t\t\t}\n\t\t\t// If it was categorized as epoch error but the epoch returned in response matches with the client epoch\n\t\t\t// then it was coherency 409, so rethrow it as throttling error so that it can retried. Default throttling\n\t\t\t// time is 1s.\n\t\t\tconst newError = wrapError(error, (message: string) => {\n\t\t\t\treturn new ThrottlingError(`Coherency 409: ${message}`, 1 /* retryAfterSeconds */, {\n\t\t\t\t\t[Odsp409Error]: true,\n\t\t\t\t\tdriverVersion,\n\t\t\t\t});\n\t\t\t});\n\t\t\tthrow newError;\n\t\t}\n\t}\n\n\tprivate checkForEpochErrorCore(epochFromResponse: string | null | undefined) {\n\t\t// If epoch is undefined, then don't compare it because initially for createNew or TreesLatest\n\t\t// initializes this value. Sometimes response does not contain epoch as it is still in\n\t\t// implementation phase at server side. In that case also, don't compare it with our epoch value.\n\t\tif (this.fluidEpoch && epochFromResponse && this.fluidEpoch !== epochFromResponse) {\n\t\t\t// This is similar in nature to how fluidEpochMismatchError (409) is handled.\n\t\t\t// Difference - client detected mismatch, instead of server detecting it.\n\t\t\treturn new NonRetryableError(\n\t\t\t\t\"Epoch mismatch\",\n\t\t\t\tDriverErrorType.fileOverwrittenInStorage,\n\t\t\t\t{ driverVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate fileEntryFromEntry(entry: IEntry): ICacheEntry {\n\t\treturn { ...entry, file: this.fileEntry };\n\t}\n}\n\nexport class EpochTrackerWithRedemption extends EpochTracker {\n\tprivate readonly treesLatestDeferral = new Deferred<void>();\n\n\tconstructor(\n\t\tprotected readonly cache: IPersistedCache,\n\t\tprotected readonly fileEntry: IFileEntry,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tprotected readonly clientIsSummarizer?: boolean,\n\t) {\n\t\tsuper(cache, fileEntry, logger, clientIsSummarizer);\n\t\t// Handles the rejected promise within treesLatestDeferral.\n\t\tthis.treesLatestDeferral.promise.catch(() => {});\n\t}\n\n\tprotected validateEpochFromResponse(\n\t\tepochFromResponse: string | undefined,\n\t\tfetchType: FetchType,\n\t\tfromCache: boolean = false,\n\t) {\n\t\tsuper.validateEpochFromResponse(epochFromResponse, fetchType, fromCache);\n\n\t\t// Any successful call means we have access to a file, i.e. any redemption that was required already happened.\n\t\t// That covers cases of \"treesLatest\" as well as \"getVersions\" or \"createFile\" - all the ways we can start\n\t\t// exploring a file.\n\t\tthis.treesLatestDeferral.resolve();\n\t}\n\n\tpublic async get(entry: IEntry): Promise<any> {\n\t\tlet result = super.get(entry);\n\n\t\t// equivalence of what happens in fetchAndParseAsJSON()\n\t\tif (entry.type === snapshotKey) {\n\t\t\tresult = result\n\t\t\t\t.then((value) => {\n\t\t\t\t\t// If there is nothing in cache, we need to wait for network call to complete (and do redemption)\n\t\t\t\t\t// Otherwise file was redeemed in prior session, so if joinSession failed, we should not retry\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\tthis.treesLatestDeferral.resolve();\n\t\t\t\t\t}\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\t\t\treturn value;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.treesLatestDeferral.reject(error);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic async fetchAndParseAsJSON<T>(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: any },\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<T>> {\n\t\t// Optimize the flow if we know that treesLatestDeferral was already completed by the timer we started\n\t\t// joinSession call. If we did - there is no reason to repeat the call as it will fail with same error.\n\t\tconst completed = this.treesLatestDeferral.isCompleted;\n\n\t\ttry {\n\t\t\treturn await super.fetchAndParseAsJSON<T>(\n\t\t\t\turl,\n\t\t\t\tfetchOptions,\n\t\t\t\tfetchType,\n\t\t\t\taddInBody,\n\t\t\t\tfetchReason,\n\t\t\t);\n\t\t} catch (error: any) {\n\t\t\t// Only handling here treesLatest. If createFile failed, we should never try to do joinSession.\n\t\t\t// Similar, if getVersions failed, we should not do any further storage calls.\n\t\t\t// So treesLatest is the only call that can have parallel joinSession request.\n\t\t\tif (fetchType === \"treesLatest\") {\n\t\t\t\tthis.treesLatestDeferral.reject(error);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfetchType !== \"joinSession\" ||\n\t\t\t\terror.statusCode < 401 ||\n\t\t\t\terror.statusCode > 404 ||\n\t\t\t\tcompleted\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\t// It is joinSession failing with 401..404 error\n\t\t// Repeat after waiting for treeLatest succeeding (or fail if it failed).\n\t\t// No special handling after first call - if file has been deleted, then it's game over.\n\n\t\t// Ensure we have some safety here - we do not want to deadlock if we got logic somewhere wrong.\n\t\t// If we waited too long, we will log error event and proceed with call.\n\t\t// It may result in failure for user, but refreshing document would address it.\n\t\t// Thus we use rather long timeout (not to get these failures as much as possible), but not large enough\n\t\t// to unblock the process.\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{ eventName: \"JoinSessionSyncWait\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst timeoutRes = 51; // anything will work here\n\t\t\t\tlet timer: ReturnType<typeof setTimeout>;\n\t\t\t\tconst timeoutP = new Promise<number>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\t\tresolve(timeoutRes);\n\t\t\t\t\t}, 15000);\n\t\t\t\t});\n\t\t\t\tconst res = await Promise.race([\n\t\t\t\t\ttimeoutP,\n\t\t\t\t\t// cancel timeout to unblock UTs (otherwise Node process does not exit for 15 sec)\n\t\t\t\t\tthis.treesLatestDeferral.promise.finally(() => clearTimeout(timer)),\n\t\t\t\t]);\n\t\t\t\tif (res === timeoutRes) {\n\t\t\t\t\tevent.cancel();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t\treturn super.fetchAndParseAsJSON<T>(url, fetchOptions, fetchType, addInBody);\n\t}\n}\n\n/**\n * @alpha\n */\nexport interface ICacheAndTracker {\n\tcache: IOdspCache;\n\tepochTracker: EpochTracker;\n}\n\nexport function createOdspCacheAndTracker(\n\tpersistedCacheArg: IPersistedCache,\n\tnonpersistentCache: INonPersistentCache,\n\tfileEntry: IFileEntry,\n\tlogger: ITelemetryLoggerExt,\n\tclientIsSummarizer?: boolean,\n): ICacheAndTracker {\n\tconst epochTracker = new EpochTrackerWithRedemption(\n\t\tpersistedCacheArg,\n\t\tfileEntry,\n\t\tlogger,\n\t\tclientIsSummarizer,\n\t);\n\treturn {\n\t\tcache: {\n\t\t\t...nonpersistentCache,\n\t\t\tpersistedCache: epochTracker,\n\t\t},\n\t\tepochTracker,\n\t};\n}\n"]}
|
package/dist/epochTracker.d.ts
CHANGED
|
@@ -2,38 +2,54 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
6
|
import { RateLimiter } from "@fluidframework/driver-utils";
|
|
7
|
-
import { IConnected } from "@fluidframework/protocol-definitions";
|
|
8
7
|
import { IEntry, IFileEntry, IPersistedCache } from "@fluidframework/odsp-driver-definitions";
|
|
9
8
|
import { IOdspResponse } from "./odspUtils";
|
|
10
9
|
import { IOdspCache, INonPersistentCache, IPersistedFileCache } from "./odspCache";
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export type FetchType = "blob" | "createBlob" | "createFile" | "joinSession" | "ops" | "test" | "snapshotTree" | "treesLatest" | "uploadSummary" | "push" | "versions";
|
|
14
|
+
/**
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export type FetchTypeInternal = FetchType | "cache";
|
|
13
18
|
export declare const Odsp409Error = "Odsp409Error";
|
|
14
19
|
export declare const defaultCacheExpiryTimeoutMs: number;
|
|
15
20
|
/**
|
|
21
|
+
* In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using
|
|
22
|
+
* version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch
|
|
23
|
+
* value being incremented.
|
|
24
|
+
*
|
|
25
|
+
* The implications of these binary updates is that the Fluid state is disrupted: the sequence number might
|
|
26
|
+
* go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's
|
|
27
|
+
* not safe to continue collaboration across an epoch change. We need to detect these epoch changes and
|
|
28
|
+
* error out from the collaboration.
|
|
29
|
+
*
|
|
16
30
|
* This class is a wrapper around fetch calls. It adds epoch to the request made so that the
|
|
17
31
|
* server can match it with its epoch value in order to match the version.
|
|
18
32
|
* It also validates the epoch value received in response of fetch calls. If the epoch does not match,
|
|
19
33
|
* then it also clears all the cached entries for the given container.
|
|
34
|
+
* @alpha
|
|
20
35
|
*/
|
|
21
36
|
export declare class EpochTracker implements IPersistedFileCache {
|
|
22
37
|
protected readonly cache: IPersistedCache;
|
|
23
38
|
protected readonly fileEntry: IFileEntry;
|
|
24
|
-
protected readonly logger:
|
|
39
|
+
protected readonly logger: ITelemetryLoggerExt;
|
|
25
40
|
protected readonly clientIsSummarizer?: boolean | undefined;
|
|
26
41
|
private _fluidEpoch;
|
|
42
|
+
private readonly snapshotCacheExpiryTimeoutMs;
|
|
27
43
|
readonly rateLimiter: RateLimiter;
|
|
28
44
|
private readonly driverId;
|
|
29
45
|
private networkCallNumber;
|
|
30
|
-
constructor(cache: IPersistedCache, fileEntry: IFileEntry, logger:
|
|
46
|
+
constructor(cache: IPersistedCache, fileEntry: IFileEntry, logger: ITelemetryLoggerExt, clientIsSummarizer?: boolean | undefined);
|
|
31
47
|
setEpoch(epoch: string, fromCache: boolean, fetchType: FetchTypeInternal): void;
|
|
32
48
|
get(entry: IEntry): Promise<any>;
|
|
33
49
|
put(entry: IEntry, value: any): Promise<void>;
|
|
34
50
|
removeEntries(): Promise<void>;
|
|
35
51
|
get fluidEpoch(): string | undefined;
|
|
36
|
-
|
|
52
|
+
validateEpoch(epoch: string | undefined, fetchType: FetchType): Promise<void>;
|
|
37
53
|
/**
|
|
38
54
|
* Api to fetch the response for given request and parse it as json.
|
|
39
55
|
* @param url - url of the request
|
|
@@ -73,16 +89,24 @@ export declare class EpochTracker implements IPersistedFileCache {
|
|
|
73
89
|
private fileEntryFromEntry;
|
|
74
90
|
}
|
|
75
91
|
export declare class EpochTrackerWithRedemption extends EpochTracker {
|
|
92
|
+
protected readonly cache: IPersistedCache;
|
|
93
|
+
protected readonly fileEntry: IFileEntry;
|
|
94
|
+
protected readonly logger: ITelemetryLoggerExt;
|
|
95
|
+
protected readonly clientIsSummarizer?: boolean | undefined;
|
|
76
96
|
private readonly treesLatestDeferral;
|
|
97
|
+
constructor(cache: IPersistedCache, fileEntry: IFileEntry, logger: ITelemetryLoggerExt, clientIsSummarizer?: boolean | undefined);
|
|
77
98
|
protected validateEpochFromResponse(epochFromResponse: string | undefined, fetchType: FetchType, fromCache?: boolean): void;
|
|
78
99
|
get(entry: IEntry): Promise<any>;
|
|
79
100
|
fetchAndParseAsJSON<T>(url: string, fetchOptions: {
|
|
80
101
|
[index: string]: any;
|
|
81
102
|
}, fetchType: FetchType, addInBody?: boolean, fetchReason?: string): Promise<IOdspResponse<T>>;
|
|
82
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @alpha
|
|
106
|
+
*/
|
|
83
107
|
export interface ICacheAndTracker {
|
|
84
108
|
cache: IOdspCache;
|
|
85
109
|
epochTracker: EpochTracker;
|
|
86
110
|
}
|
|
87
|
-
export declare function createOdspCacheAndTracker(persistedCacheArg: IPersistedCache, nonpersistentCache: INonPersistentCache, fileEntry: IFileEntry, logger:
|
|
111
|
+
export declare function createOdspCacheAndTracker(persistedCacheArg: IPersistedCache, nonpersistentCache: INonPersistentCache, fileEntry: IFileEntry, logger: ITelemetryLoggerExt, clientIsSummarizer?: boolean): ICacheAndTracker;
|
|
88
112
|
//# sourceMappingURL=epochTracker.d.ts.map
|