@fluidframework/odsp-driver 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419
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-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/odsp-driver.api.md +310 -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 +497 -0
- package/dist/odsp-driver-beta.d.ts +159 -0
- package/dist/odsp-driver-public.d.ts +159 -0
- package/dist/odsp-driver-untrimmed.d.ts +566 -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 +16 -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.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} +3 -5
- 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} +1 -0
- 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} +3 -4
- 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} +6 -0
- 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} +17 -54
- 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} +15 -0
- 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} +5 -7
- 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} +2 -1
- package/lib/{createOdspUrl.d.ts.map → createOdspUrl.d.mts.map} +1 -1
- package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
- package/lib/createOdspUrl.mjs.map +1 -0
- package/lib/{epochTracker.d.ts → epochTracker.d.mts} +34 -10
- 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} +1 -1
- package/lib/{fetch.d.ts.map → fetch.d.mts.map} +1 -1
- package/lib/{fetch.js → fetch.mjs} +1 -1
- package/lib/fetch.mjs.map +1 -0
- package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +14 -9
- 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} +4 -7
- 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} +0 -4
- 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.map → getUrlAndHeadersWithAuth.d.mts.map} +1 -1
- 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} +3 -2
- 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} +4 -5
- 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} +3 -3
- 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 +497 -0
- package/lib/odsp-driver-beta.d.mts +159 -0
- package/lib/odsp-driver-public.d.mts +159 -0
- package/lib/odsp-driver-untrimmed.d.mts +566 -0
- package/lib/{odspCache.d.ts → odspCache.d.mts} +19 -8
- 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} +9 -7
- 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} +33 -13
- 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} +14 -28
- 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} +5 -1
- 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} +17 -12
- 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} +6 -1
- 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} +17 -11
- 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} +8 -10
- 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} +12 -0
- 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} +6 -4
- 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} +1 -1
- 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} +11 -2
- 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} +6 -0
- 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} +2 -2
- 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} +8 -5
- 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} +5 -0
- 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} +36 -7
- 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} +3 -3
- 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} +1 -1
- package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +13 -8
- 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} +5 -4
- 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} +2 -2
- 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} +6 -6
- 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} +48 -21
- 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 +89 -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 +325 -202
- 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.js.map +0 -1
- package/lib/epochTracker.d.ts.map +0 -1
- package/lib/epochTracker.js.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.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.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/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +0 -0
- /package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +0 -0
|
@@ -3,546 +3,347 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
|
-
import { performance } from "@fluidframework/common-utils";
|
|
8
6
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
MonitoringContext,
|
|
13
|
-
normalizeError,
|
|
7
|
+
ITelemetryLoggerExt,
|
|
8
|
+
createChildMonitoringContext,
|
|
9
|
+
MonitoringContext,
|
|
14
10
|
} from "@fluidframework/telemetry-utils";
|
|
11
|
+
import { assert } from "@fluidframework/core-utils";
|
|
15
12
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
DriverErrorType,
|
|
13
|
+
IDocumentDeltaConnection,
|
|
14
|
+
IDocumentDeltaStorageService,
|
|
15
|
+
IDocumentService,
|
|
16
|
+
IResolvedUrl,
|
|
17
|
+
IDocumentStorageService,
|
|
18
|
+
IDocumentServicePolicies,
|
|
23
19
|
} from "@fluidframework/driver-definitions";
|
|
20
|
+
import { IClient, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
24
21
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import {
|
|
31
|
-
IClient,
|
|
32
|
-
ISequencedDocumentMessage,
|
|
33
|
-
} from "@fluidframework/protocol-definitions";
|
|
34
|
-
import {
|
|
35
|
-
IOdspResolvedUrl,
|
|
36
|
-
TokenFetchOptions,
|
|
37
|
-
IEntry,
|
|
38
|
-
HostStoragePolicy,
|
|
39
|
-
InstrumentedStorageTokenFetcher,
|
|
40
|
-
OdspErrorType,
|
|
22
|
+
IOdspResolvedUrl,
|
|
23
|
+
TokenFetchOptions,
|
|
24
|
+
IEntry,
|
|
25
|
+
HostStoragePolicy,
|
|
26
|
+
InstrumentedStorageTokenFetcher,
|
|
41
27
|
} from "@fluidframework/odsp-driver-definitions";
|
|
42
|
-
import
|
|
43
|
-
import { HostStoragePolicyInternal, ISocketStorageDiscovery } from "./contracts";
|
|
28
|
+
import { HostStoragePolicyInternal } from "./contracts";
|
|
44
29
|
import { IOdspCache } from "./odspCache";
|
|
45
30
|
import { OdspDeltaStorageService, OdspDeltaStorageWithCache } from "./odspDeltaStorageService";
|
|
46
|
-
import { OdspDocumentDeltaConnection } from "./odspDocumentDeltaConnection";
|
|
47
31
|
import { OdspDocumentStorageService } from "./odspDocumentStorageManager";
|
|
48
|
-
import {
|
|
49
|
-
import { fetchJoinSession } from "./vroom";
|
|
32
|
+
import { getOdspResolvedUrl } from "./odspUtils";
|
|
50
33
|
import { isOdcOrigin } from "./odspUrlHelper";
|
|
51
34
|
import { EpochTracker } from "./epochTracker";
|
|
52
35
|
import { OpsCache } from "./opsCaching";
|
|
53
36
|
import { RetryErrorsStorageAdapter } from "./retryErrorsStorageAdapter";
|
|
54
|
-
import {
|
|
37
|
+
import type { OdspDelayLoadedDeltaStream } from "./odspDelayLoadedDeltaStream";
|
|
55
38
|
|
|
56
39
|
/**
|
|
57
40
|
* The DocumentService manages the Socket.IO connection and manages routing requests to connected
|
|
58
41
|
* clients
|
|
59
42
|
*/
|
|
60
43
|
export class OdspDocumentService implements IDocumentService {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
private async joinSessionCore(
|
|
370
|
-
requestSocketToken: boolean,
|
|
371
|
-
options: TokenFetchOptionsEx,
|
|
372
|
-
): Promise<ISocketStorageDiscovery> {
|
|
373
|
-
const disableJoinSessionRefresh = this.mc.config.getBoolean("Fluid.Driver.Odsp.disableJoinSessionRefresh");
|
|
374
|
-
const executeFetch = async () => {
|
|
375
|
-
const joinSessionResponse = await fetchJoinSession(
|
|
376
|
-
this.odspResolvedUrl,
|
|
377
|
-
"opStream/joinSession",
|
|
378
|
-
"POST",
|
|
379
|
-
this.mc.logger,
|
|
380
|
-
this.getStorageToken,
|
|
381
|
-
this.epochTracker,
|
|
382
|
-
requestSocketToken,
|
|
383
|
-
options,
|
|
384
|
-
disableJoinSessionRefresh,
|
|
385
|
-
this.hostPolicy.sessionOptions?.unauthenticatedUserDisplayName,
|
|
386
|
-
);
|
|
387
|
-
return {
|
|
388
|
-
entryTime: Date.now(),
|
|
389
|
-
joinSessionResponse,
|
|
390
|
-
};
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
const getResponseAndRefreshAfterDeltaMs = async () => {
|
|
394
|
-
const _response = await this.cache.sessionJoinCache.addOrGet(this.joinSessionKey, executeFetch);
|
|
395
|
-
// If the response does not contain refreshSessionDurationSeconds, then treat it as old flow and let the
|
|
396
|
-
// cache entry to be treated as expired after 1 hour.
|
|
397
|
-
_response.joinSessionResponse.refreshSessionDurationSeconds =
|
|
398
|
-
_response.joinSessionResponse.refreshSessionDurationSeconds ?? 3600;
|
|
399
|
-
return {
|
|
400
|
-
..._response,
|
|
401
|
-
refreshAfterDeltaMs: this.calculateJoinSessionRefreshDelta(
|
|
402
|
-
_response.entryTime, _response.joinSessionResponse.refreshSessionDurationSeconds),
|
|
403
|
-
};
|
|
404
|
-
};
|
|
405
|
-
let response = await getResponseAndRefreshAfterDeltaMs();
|
|
406
|
-
// This means that the cached entry has expired(This should not be possible if the response is fetched
|
|
407
|
-
// from the network call). In this case we remove the cached entry and fetch the new response.
|
|
408
|
-
if (response.refreshAfterDeltaMs <= 0) {
|
|
409
|
-
this.cache.sessionJoinCache.remove(this.joinSessionKey);
|
|
410
|
-
response = await getResponseAndRefreshAfterDeltaMs();
|
|
411
|
-
}
|
|
412
|
-
if (!disableJoinSessionRefresh) {
|
|
413
|
-
const props = {
|
|
414
|
-
entryTime: response.entryTime,
|
|
415
|
-
refreshSessionDurationSeconds:
|
|
416
|
-
response.joinSessionResponse.refreshSessionDurationSeconds,
|
|
417
|
-
refreshAfterDeltaMs: response.refreshAfterDeltaMs,
|
|
418
|
-
};
|
|
419
|
-
if (response.refreshAfterDeltaMs > 0) {
|
|
420
|
-
this.scheduleJoinSessionRefresh(response.refreshAfterDeltaMs)
|
|
421
|
-
.catch((error) => {
|
|
422
|
-
const canRetry = canRetryOnError(error);
|
|
423
|
-
// Only record error event in case it is non retriable.
|
|
424
|
-
if (!canRetry) {
|
|
425
|
-
this.mc.logger.sendErrorEvent({
|
|
426
|
-
eventName: "JoinSessionRefreshError",
|
|
427
|
-
details: JSON.stringify(props),
|
|
428
|
-
},
|
|
429
|
-
error,
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
} else {
|
|
434
|
-
// Logging just for informational purposes to help with debugging as this is a new feature.
|
|
435
|
-
this.mc.logger.sendTelemetryEvent({
|
|
436
|
-
eventName: "JoinSessionRefreshNotScheduled",
|
|
437
|
-
details: JSON.stringify(props),
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
return response.joinSessionResponse;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
private calculateJoinSessionRefreshDelta(responseFetchTime: number, refreshSessionDurationSeconds: number) {
|
|
445
|
-
// 30 seconds is buffer time to refresh the session.
|
|
446
|
-
return responseFetchTime + ((refreshSessionDurationSeconds * 1000) - 30000) - Date.now();
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Creats a connection to the given delta stream endpoint
|
|
451
|
-
*
|
|
452
|
-
* @param tenantId - the ID of the tenant
|
|
453
|
-
* @param documentId - document ID
|
|
454
|
-
* @param token - authorization token for delta service
|
|
455
|
-
* @param io - websocket library
|
|
456
|
-
* @param client - information about the client
|
|
457
|
-
* @param webSocketUrl - websocket URL
|
|
458
|
-
*/
|
|
459
|
-
private async createDeltaConnection(
|
|
460
|
-
tenantId: string,
|
|
461
|
-
documentId: string,
|
|
462
|
-
token: string | null,
|
|
463
|
-
io: typeof SocketIOClientStatic,
|
|
464
|
-
client: IClient,
|
|
465
|
-
webSocketUrl: string,
|
|
466
|
-
): Promise<OdspDocumentDeltaConnection> {
|
|
467
|
-
const startTime = performance.now();
|
|
468
|
-
const connection = await OdspDocumentDeltaConnection.create(
|
|
469
|
-
tenantId,
|
|
470
|
-
documentId,
|
|
471
|
-
token,
|
|
472
|
-
io,
|
|
473
|
-
client,
|
|
474
|
-
webSocketUrl,
|
|
475
|
-
this.mc.logger,
|
|
476
|
-
60000,
|
|
477
|
-
this.epochTracker,
|
|
478
|
-
this.socketReferenceKeyPrefix,
|
|
479
|
-
);
|
|
480
|
-
const duration = performance.now() - startTime;
|
|
481
|
-
// This event happens rather often, so it adds up to cost of telemetry.
|
|
482
|
-
// Given that most reconnects result in reusing socket and happen very quickly,
|
|
483
|
-
// report event only if it took longer than threshold.
|
|
484
|
-
if (duration >= 2000) {
|
|
485
|
-
this.mc.logger.sendPerformanceEvent({
|
|
486
|
-
eventName: "ConnectionSuccess",
|
|
487
|
-
duration,
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
return connection;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
public dispose(error?: any) {
|
|
494
|
-
// Error might indicate mismatch between client & server knowlege about file
|
|
495
|
-
// (DriverErrorType.fileOverwrittenInStorage).
|
|
496
|
-
// For example, file might have been overwritten in storage without generating new epoch
|
|
497
|
-
// In such case client cached info is stale and has to be removed.
|
|
498
|
-
if (error !== undefined) {
|
|
499
|
-
this.epochTracker.removeEntries().catch(() => {});
|
|
500
|
-
} else {
|
|
501
|
-
this._opsCache?.flushOps();
|
|
502
|
-
}
|
|
503
|
-
this._opsCache?.dispose();
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
protected get opsCache() {
|
|
507
|
-
if (this._opsCache) {
|
|
508
|
-
return this._opsCache;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
const seqNumber = this.storageManager?.snapshotSequenceNumber;
|
|
512
|
-
const batchSize = this.hostPolicy.opsCaching?.batchSize ?? 100;
|
|
513
|
-
if (seqNumber === undefined || batchSize < 1) {
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
const opsKey: Omit<IEntry, "key"> = {
|
|
518
|
-
type: "ops",
|
|
519
|
-
};
|
|
520
|
-
this._opsCache = new OpsCache(
|
|
521
|
-
seqNumber,
|
|
522
|
-
this.mc.logger,
|
|
523
|
-
// ICache
|
|
524
|
-
{
|
|
525
|
-
write: async (key: string, opsData: string) => {
|
|
526
|
-
return this.cache.persistedCache.put({ ...opsKey, key }, opsData);
|
|
527
|
-
},
|
|
528
|
-
read: async (key: string) => this.cache.persistedCache.get({ ...opsKey, key }),
|
|
529
|
-
remove: () => { this.cache.persistedCache.removeEntries().catch(() => {}); },
|
|
530
|
-
},
|
|
531
|
-
batchSize,
|
|
532
|
-
this.hostPolicy.opsCaching?.timerGranularity ?? 5000,
|
|
533
|
-
this.hostPolicy.opsCaching?.totalOpsToCache ?? 5000,
|
|
534
|
-
);
|
|
535
|
-
return this._opsCache;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// Called whenever re receive ops through any channel for this document (snapshot, delta connection, delta storage)
|
|
539
|
-
// We use it to notify caching layer of how stale is snapshot stored in cache.
|
|
540
|
-
protected opsReceived(ops: ISequencedDocumentMessage[]) {
|
|
541
|
-
// No need for two clients to save same ops
|
|
542
|
-
if (ops.length === 0 || this.odspResolvedUrl.summarizer) {
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
this.opsCache?.addOps(ops);
|
|
547
|
-
}
|
|
44
|
+
private readonly _policies: IDocumentServicePolicies;
|
|
45
|
+
|
|
46
|
+
// Promise to load socket module only once.
|
|
47
|
+
private socketModuleP: Promise<OdspDelayLoadedDeltaStream> | undefined;
|
|
48
|
+
|
|
49
|
+
private odspDelayLoadedDeltaStream: OdspDelayLoadedDeltaStream | undefined;
|
|
50
|
+
|
|
51
|
+
private odspSocketModuleLoaded: boolean = false;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param resolvedUrl - resolved url identifying document that will be managed by returned service instance.
|
|
55
|
+
* @param getStorageToken - function that can provide the storage token. This is is also referred to as
|
|
56
|
+
* the "Vroom" token in SPO.
|
|
57
|
+
* @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred
|
|
58
|
+
* to as the "Push" token in SPO. If undefined then websocket token is expected to be returned with joinSession
|
|
59
|
+
* response payload.
|
|
60
|
+
* @param logger - a logger that can capture performance and diagnostic information
|
|
61
|
+
* @param cache - This caches response for joinSession.
|
|
62
|
+
* @param hostPolicy - This host constructed policy which customizes service behavior.
|
|
63
|
+
* @param epochTracker - This helper class which adds epoch to backend calls made by returned service instance.
|
|
64
|
+
* @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache
|
|
65
|
+
*/
|
|
66
|
+
public static async create(
|
|
67
|
+
resolvedUrl: IResolvedUrl,
|
|
68
|
+
getStorageToken: InstrumentedStorageTokenFetcher,
|
|
69
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
70
|
+
getWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined,
|
|
71
|
+
logger: ITelemetryLoggerExt,
|
|
72
|
+
cache: IOdspCache,
|
|
73
|
+
hostPolicy: HostStoragePolicy,
|
|
74
|
+
epochTracker: EpochTracker,
|
|
75
|
+
socketReferenceKeyPrefix?: string,
|
|
76
|
+
clientIsSummarizer?: boolean,
|
|
77
|
+
): Promise<IDocumentService> {
|
|
78
|
+
return new OdspDocumentService(
|
|
79
|
+
getOdspResolvedUrl(resolvedUrl),
|
|
80
|
+
getStorageToken,
|
|
81
|
+
getWebsocketToken,
|
|
82
|
+
logger,
|
|
83
|
+
cache,
|
|
84
|
+
hostPolicy,
|
|
85
|
+
epochTracker,
|
|
86
|
+
socketReferenceKeyPrefix,
|
|
87
|
+
clientIsSummarizer,
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private storageManager?: OdspDocumentStorageService;
|
|
92
|
+
|
|
93
|
+
private readonly mc: MonitoringContext;
|
|
94
|
+
|
|
95
|
+
private readonly hostPolicy: HostStoragePolicyInternal;
|
|
96
|
+
|
|
97
|
+
private _opsCache?: OpsCache;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.
|
|
101
|
+
* @param getStorageToken - function that can provide the storage token. This is is also referred to as
|
|
102
|
+
* the "Vroom" token in SPO.
|
|
103
|
+
* @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred
|
|
104
|
+
* to as the "Push" token in SPO. If undefined then websocket token is expected to be returned with joinSession
|
|
105
|
+
* response payload.
|
|
106
|
+
* @param logger - a logger that can capture performance and diagnostic information
|
|
107
|
+
* @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver
|
|
108
|
+
* @param cache - This caches response for joinSession.
|
|
109
|
+
* @param hostPolicy - host constructed policy which customizes service behavior.
|
|
110
|
+
* @param epochTracker - This helper class which adds epoch to backend calls made by this service instance.
|
|
111
|
+
* @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache
|
|
112
|
+
*/
|
|
113
|
+
private constructor(
|
|
114
|
+
public readonly odspResolvedUrl: IOdspResolvedUrl,
|
|
115
|
+
private readonly getStorageToken: InstrumentedStorageTokenFetcher,
|
|
116
|
+
private readonly getWebsocketToken:
|
|
117
|
+
| ((options: TokenFetchOptions) => Promise<string | null>)
|
|
118
|
+
| undefined,
|
|
119
|
+
logger: ITelemetryLoggerExt,
|
|
120
|
+
private readonly cache: IOdspCache,
|
|
121
|
+
hostPolicy: HostStoragePolicy,
|
|
122
|
+
private readonly epochTracker: EpochTracker,
|
|
123
|
+
private readonly socketReferenceKeyPrefix?: string,
|
|
124
|
+
private readonly clientIsSummarizer?: boolean,
|
|
125
|
+
) {
|
|
126
|
+
this._policies = {
|
|
127
|
+
// load in storage-only mode if a file version is specified
|
|
128
|
+
storageOnly: odspResolvedUrl.fileVersion !== undefined,
|
|
129
|
+
summarizeProtocolTree: true,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
this.mc = createChildMonitoringContext({
|
|
133
|
+
logger,
|
|
134
|
+
properties: {
|
|
135
|
+
all: {
|
|
136
|
+
odc: isOdcOrigin(
|
|
137
|
+
new URL(this.odspResolvedUrl.endpoints.snapshotStorageUrl).origin,
|
|
138
|
+
),
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
this.hostPolicy = hostPolicy;
|
|
144
|
+
if (this.clientIsSummarizer) {
|
|
145
|
+
this.hostPolicy = { ...this.hostPolicy, summarizerClient: true };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public get resolvedUrl(): IResolvedUrl {
|
|
150
|
+
return this.odspResolvedUrl;
|
|
151
|
+
}
|
|
152
|
+
public get policies() {
|
|
153
|
+
return this._policies;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Connects to a storage endpoint for snapshot service.
|
|
158
|
+
*
|
|
159
|
+
* @returns returns the document storage service for sharepoint driver.
|
|
160
|
+
*/
|
|
161
|
+
public async connectToStorage(): Promise<IDocumentStorageService> {
|
|
162
|
+
if (!this.storageManager) {
|
|
163
|
+
this.storageManager = new OdspDocumentStorageService(
|
|
164
|
+
this.odspResolvedUrl,
|
|
165
|
+
this.getStorageToken,
|
|
166
|
+
this.mc.logger,
|
|
167
|
+
true,
|
|
168
|
+
this.cache,
|
|
169
|
+
this.hostPolicy,
|
|
170
|
+
this.epochTracker,
|
|
171
|
+
// flushCallback
|
|
172
|
+
async () => {
|
|
173
|
+
const currentConnection =
|
|
174
|
+
this.odspDelayLoadedDeltaStream?.currentDeltaConnection;
|
|
175
|
+
if (currentConnection !== undefined && !currentConnection.disposed) {
|
|
176
|
+
return currentConnection.flush();
|
|
177
|
+
}
|
|
178
|
+
throw new Error(
|
|
179
|
+
"Disconnected while uploading summary (attempt to perform flush())",
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
() => {
|
|
183
|
+
return this.odspDelayLoadedDeltaStream?.relayServiceTenantAndSessionId;
|
|
184
|
+
},
|
|
185
|
+
this.mc.config.getNumber("Fluid.Driver.Odsp.snapshotFormatFetchType"),
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return new RetryErrorsStorageAdapter(this.storageManager, this.mc.logger);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Connects to a delta storage endpoint for getting ops between a range.
|
|
194
|
+
*
|
|
195
|
+
* @returns returns the document delta storage service for sharepoint driver.
|
|
196
|
+
*/
|
|
197
|
+
public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {
|
|
198
|
+
const snapshotOps = this.storageManager?.ops ?? [];
|
|
199
|
+
const service = new OdspDeltaStorageService(
|
|
200
|
+
this.odspResolvedUrl.endpoints.deltaStorageUrl,
|
|
201
|
+
this.getStorageToken,
|
|
202
|
+
this.epochTracker,
|
|
203
|
+
this.mc.logger,
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
// batch size, please see issue #5211 for data around batch sizing
|
|
207
|
+
const batchSize = this.hostPolicy.opsBatchSize ?? 5000;
|
|
208
|
+
const concurrency = this.hostPolicy.concurrentOpsBatches ?? 1;
|
|
209
|
+
return new OdspDeltaStorageWithCache(
|
|
210
|
+
snapshotOps,
|
|
211
|
+
this.mc.logger,
|
|
212
|
+
batchSize,
|
|
213
|
+
concurrency,
|
|
214
|
+
// Get Ops from storage callback.
|
|
215
|
+
async (from, to, telemetryProps, fetchReason) =>
|
|
216
|
+
service.get(from, to, telemetryProps, fetchReason),
|
|
217
|
+
// Get cachedOps Callback.
|
|
218
|
+
async (from, to) => {
|
|
219
|
+
const res = await this.opsCache?.get(from, to);
|
|
220
|
+
return (res as ISequencedDocumentMessage[]) ?? [];
|
|
221
|
+
},
|
|
222
|
+
// Ops requestFromSocket Callback.
|
|
223
|
+
(from, to) => {
|
|
224
|
+
const currentConnection = this.odspDelayLoadedDeltaStream?.currentDeltaConnection;
|
|
225
|
+
if (currentConnection !== undefined && !currentConnection.disposed) {
|
|
226
|
+
currentConnection.requestOps(from, to);
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
(ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),
|
|
230
|
+
() => this.storageManager,
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Connects to a delta stream endpoint for emitting ops.
|
|
236
|
+
*
|
|
237
|
+
* @returns returns the document delta stream service for onedrive/sharepoint driver.
|
|
238
|
+
*/
|
|
239
|
+
public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {
|
|
240
|
+
if (this.socketModuleP === undefined) {
|
|
241
|
+
this.socketModuleP = this.getDelayLoadedDeltaStream();
|
|
242
|
+
}
|
|
243
|
+
return this.socketModuleP
|
|
244
|
+
.then(async (m) => {
|
|
245
|
+
this.odspSocketModuleLoaded = true;
|
|
246
|
+
return m.connectToDeltaStream(client);
|
|
247
|
+
})
|
|
248
|
+
.catch((error) => {
|
|
249
|
+
// Setting undefined in case someone tries to recover from module failure by calling again.
|
|
250
|
+
this.socketModuleP = undefined;
|
|
251
|
+
this.odspSocketModuleLoaded = false;
|
|
252
|
+
throw error;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* This dynamically imports the module for loading the delta connection. In many cases the delta stream, is not
|
|
258
|
+
* required during the critical load flow. So this way we don't have to bundle this in the initial bundle and can
|
|
259
|
+
* import this later on when required.
|
|
260
|
+
* @returns The delta stream object.
|
|
261
|
+
*/
|
|
262
|
+
private async getDelayLoadedDeltaStream() {
|
|
263
|
+
assert(this.odspSocketModuleLoaded === false, 0x507 /* Should be loaded only once */);
|
|
264
|
+
const module = await import(
|
|
265
|
+
/* webpackChunkName: "socketModule" */ "./odspDelayLoadedDeltaStream.js"
|
|
266
|
+
)
|
|
267
|
+
.then((m) => {
|
|
268
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "SocketModuleLoaded" });
|
|
269
|
+
return m;
|
|
270
|
+
})
|
|
271
|
+
.catch((error) => {
|
|
272
|
+
this.mc.logger.sendErrorEvent({ eventName: "SocketModuleLoadFailed" }, error);
|
|
273
|
+
throw error;
|
|
274
|
+
});
|
|
275
|
+
this.odspDelayLoadedDeltaStream = new module.OdspDelayLoadedDeltaStream(
|
|
276
|
+
this.odspResolvedUrl,
|
|
277
|
+
this._policies,
|
|
278
|
+
this.getStorageToken,
|
|
279
|
+
this.getWebsocketToken,
|
|
280
|
+
this.mc,
|
|
281
|
+
this.cache,
|
|
282
|
+
this.hostPolicy,
|
|
283
|
+
this.epochTracker,
|
|
284
|
+
(ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),
|
|
285
|
+
this.socketReferenceKeyPrefix,
|
|
286
|
+
);
|
|
287
|
+
return this.odspDelayLoadedDeltaStream;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
public dispose(error?: any) {
|
|
291
|
+
// Error might indicate mismatch between client & server knowledge about file
|
|
292
|
+
// (DriverErrorType.fileOverwrittenInStorage).
|
|
293
|
+
// For example, file might have been overwritten in storage without generating new epoch
|
|
294
|
+
// In such case client cached info is stale and has to be removed.
|
|
295
|
+
if (error !== undefined) {
|
|
296
|
+
this.epochTracker.removeEntries().catch(() => {});
|
|
297
|
+
} else {
|
|
298
|
+
this._opsCache?.flushOps();
|
|
299
|
+
}
|
|
300
|
+
this._opsCache?.dispose();
|
|
301
|
+
// Only need to dipose this, if it is already loaded.
|
|
302
|
+
this.odspDelayLoadedDeltaStream?.dispose();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
protected get opsCache() {
|
|
306
|
+
if (this._opsCache) {
|
|
307
|
+
return this._opsCache;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const seqNumber = this.storageManager?.snapshotSequenceNumber;
|
|
311
|
+
const batchSize = this.hostPolicy.opsCaching?.batchSize ?? 100;
|
|
312
|
+
if (seqNumber === undefined || batchSize < 1) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const opsKey: Omit<IEntry, "key"> = {
|
|
317
|
+
type: "ops",
|
|
318
|
+
};
|
|
319
|
+
this._opsCache = new OpsCache(
|
|
320
|
+
seqNumber,
|
|
321
|
+
this.mc.logger,
|
|
322
|
+
// ICache
|
|
323
|
+
{
|
|
324
|
+
write: async (key: string, opsData: string) => {
|
|
325
|
+
return this.cache.persistedCache.put({ ...opsKey, key }, opsData);
|
|
326
|
+
},
|
|
327
|
+
read: async (key: string) => this.cache.persistedCache.get({ ...opsKey, key }),
|
|
328
|
+
remove: () => {
|
|
329
|
+
this.cache.persistedCache.removeEntries().catch(() => {});
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
batchSize,
|
|
333
|
+
this.hostPolicy.opsCaching?.timerGranularity ?? 5000,
|
|
334
|
+
this.hostPolicy.opsCaching?.totalOpsToCache ?? 5000,
|
|
335
|
+
);
|
|
336
|
+
return this._opsCache;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Called whenever re receive ops through any channel for this document (snapshot, delta connection, delta storage)
|
|
340
|
+
// We use it to notify caching layer of how stale is snapshot stored in cache.
|
|
341
|
+
protected opsReceived(ops: ISequencedDocumentMessage[]) {
|
|
342
|
+
// No need for two clients to save same ops
|
|
343
|
+
if (ops.length === 0 || this.odspResolvedUrl.summarizer) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.opsCache?.addOps(ops);
|
|
348
|
+
}
|
|
548
349
|
}
|