@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
|
@@ -5,51 +5,27 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.OdspDocumentDeltaConnection = void 0;
|
|
8
|
-
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
|
-
const driver_base_1 = require("@fluidframework/driver-base");
|
|
10
8
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
9
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
10
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
11
|
+
const driver_base_1 = require("@fluidframework/driver-base");
|
|
11
12
|
const uuid_1 = require("uuid");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
13
|
+
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
14
|
+
const odspError_1 = require("./odspError.cjs");
|
|
15
|
+
const socketModule_1 = require("./socketModule.cjs");
|
|
16
|
+
const packageVersion_1 = require("./packageVersion.cjs");
|
|
14
17
|
const protocolVersions = ["^0.4.0", "^0.3.0", "^0.2.0", "^0.1.0"];
|
|
15
18
|
const feature_get_ops = "api_get_ops";
|
|
16
19
|
const feature_flush_ops = "api_flush_ops";
|
|
20
|
+
const feature_submit_signals_v2 = "submit_signals_v2";
|
|
17
21
|
// How long to wait before disconnecting the socket after the last reference is removed
|
|
18
22
|
// This allows reconnection after receiving a nack to be smooth
|
|
19
23
|
const socketReferenceBufferTime = 2000;
|
|
20
|
-
class SocketReference extends
|
|
21
|
-
constructor(key, socket) {
|
|
22
|
-
super();
|
|
23
|
-
this.key = key;
|
|
24
|
-
this.references = 1;
|
|
25
|
-
// When making decisions about socket reuse, we do not reuse disconnected socket.
|
|
26
|
-
// But we want to differentiate the following case from disconnected case:
|
|
27
|
-
// Socket that never connected and never failed, it's in "attempting to connect" mode
|
|
28
|
-
// such sockets should be reused, despite socket.disconnected === true
|
|
29
|
-
this.isPendingInitialConnection = true;
|
|
30
|
-
this._socket = socket;
|
|
31
|
-
(0, common_utils_1.assert)(!SocketReference.socketIoSockets.has(key), 0x220 /* "socket key collision" */);
|
|
32
|
-
SocketReference.socketIoSockets.set(key, this);
|
|
33
|
-
// The server always closes the socket after sending this message
|
|
34
|
-
// fully remove the socket reference now
|
|
35
|
-
socket.on("server_disconnect", (socketError) => {
|
|
36
|
-
// Treat all errors as recoverable, and rely on joinSession / reconnection flow to
|
|
37
|
-
// filter out retryable vs. non-retryable cases.
|
|
38
|
-
const error = (0, odspError_1.errorObjectFromSocketError)(socketError, "server_disconnect");
|
|
39
|
-
error.canRetry = true;
|
|
40
|
-
// see comment in disconnected() getter
|
|
41
|
-
// Setting it here to ensure socket reuse does not happen if new request to connect
|
|
42
|
-
// comes in from "disconnect" listener below, before we close socket.
|
|
43
|
-
this.isPendingInitialConnection = false;
|
|
44
|
-
// Explicitly cast error to the specified event args type to ensure type compatibility
|
|
45
|
-
this.emit("server_disconnect", error);
|
|
46
|
-
this.closeSocket();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
24
|
+
class SocketReference extends client_utils_1.TypedEventEmitter {
|
|
49
25
|
static find(key, logger) {
|
|
50
26
|
const socketReference = SocketReference.socketIoSockets.get(key);
|
|
51
27
|
// Verify the socket is healthy before reusing it
|
|
52
|
-
if (socketReference
|
|
28
|
+
if (socketReference?.disconnected) {
|
|
53
29
|
// The socket is in a bad state. fully remove the reference
|
|
54
30
|
socketReference.closeSocket();
|
|
55
31
|
return undefined;
|
|
@@ -64,22 +40,20 @@ class SocketReference extends common_utils_1.TypedEventEmitter {
|
|
|
64
40
|
/**
|
|
65
41
|
* Removes a reference for the given key
|
|
66
42
|
* Once the ref count hits 0, the socket is disconnected and removed
|
|
67
|
-
* @param key - socket reference key
|
|
68
|
-
* @param isFatalError - true if the socket reference should be removed immediately due to a fatal error
|
|
69
43
|
*/
|
|
70
|
-
removeSocketIoReference(
|
|
71
|
-
(0,
|
|
44
|
+
removeSocketIoReference() {
|
|
45
|
+
(0, core_utils_1.assert)(this.references > 0, 0x09f /* "No more socketIO refs to remove!" */);
|
|
72
46
|
this.references--;
|
|
73
47
|
// see comment in disconnected() getter
|
|
74
48
|
this.isPendingInitialConnection = false;
|
|
75
|
-
if (
|
|
49
|
+
if (this.disconnected) {
|
|
76
50
|
this.closeSocket();
|
|
77
51
|
return;
|
|
78
52
|
}
|
|
79
53
|
if (this.references === 0 && this.delayDeleteTimeout === undefined) {
|
|
80
54
|
this.delayDeleteTimeout = setTimeout(() => {
|
|
81
55
|
// We should not get here with active users.
|
|
82
|
-
(0,
|
|
56
|
+
(0, core_utils_1.assert)(this.references === 0, 0x0a0 /* "Unexpected socketIO references on timeout" */);
|
|
83
57
|
this.closeSocket();
|
|
84
58
|
}, socketReferenceBufferTime);
|
|
85
59
|
}
|
|
@@ -90,27 +64,68 @@ class SocketReference extends common_utils_1.TypedEventEmitter {
|
|
|
90
64
|
}
|
|
91
65
|
return this._socket;
|
|
92
66
|
}
|
|
67
|
+
constructor(key, socket) {
|
|
68
|
+
super();
|
|
69
|
+
this.key = key;
|
|
70
|
+
this.references = 1;
|
|
71
|
+
// When making decisions about socket reuse, we do not reuse disconnected socket.
|
|
72
|
+
// But we want to differentiate the following case from disconnected case:
|
|
73
|
+
// Socket that never connected and never failed, it's in "attempting to connect" mode
|
|
74
|
+
// such sockets should be reused, despite socket.disconnected === true
|
|
75
|
+
this.isPendingInitialConnection = true;
|
|
76
|
+
this.serverDisconnectEventHandler = (socketError, clientId) => {
|
|
77
|
+
// Treat all errors as recoverable, and rely on joinSession / reconnection flow to
|
|
78
|
+
// filter out retryable vs. non-retryable cases.
|
|
79
|
+
const error = (0, odspError_1.errorObjectFromSocketError)(socketError, "server_disconnect");
|
|
80
|
+
error.addTelemetryProperties({ disconnectClientId: clientId });
|
|
81
|
+
error.canRetry = true;
|
|
82
|
+
// see comment in disconnected() getter
|
|
83
|
+
// Setting it here to ensure socket reuse does not happen if new request to connect
|
|
84
|
+
// comes in from "disconnect" listener below, before we close socket.
|
|
85
|
+
this.isPendingInitialConnection = false;
|
|
86
|
+
if (clientId === undefined) {
|
|
87
|
+
// We could first raise "disconnect" event, but that may result in socket reuse due to
|
|
88
|
+
// new connection comming in. So, it's better to have more explicit flow to make it impossible.
|
|
89
|
+
this.closeSocket(error);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.emit("disconnect", error, clientId);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
this._socket = socket;
|
|
96
|
+
(0, core_utils_1.assert)(!SocketReference.socketIoSockets.has(key), 0x220 /* "socket key collision" */);
|
|
97
|
+
SocketReference.socketIoSockets.set(key, this);
|
|
98
|
+
// Server sends this event when it wants to disconnect a particular client in which case the client id would
|
|
99
|
+
// be present or if it wants to disconnect all the clients. The server always closes the socket in case all
|
|
100
|
+
// clients needs to be disconnected. So fully remove the socket reference in this case.
|
|
101
|
+
socket.on("server_disconnect", this.serverDisconnectEventHandler);
|
|
102
|
+
}
|
|
93
103
|
clearTimer() {
|
|
94
104
|
if (this.delayDeleteTimeout !== undefined) {
|
|
95
105
|
clearTimeout(this.delayDeleteTimeout);
|
|
96
106
|
this.delayDeleteTimeout = undefined;
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
|
-
closeSocket() {
|
|
109
|
+
closeSocket(error) {
|
|
100
110
|
if (!this._socket) {
|
|
101
111
|
return;
|
|
102
112
|
}
|
|
113
|
+
this._socket.off("server_disconnect", this.serverDisconnectEventHandler);
|
|
103
114
|
this.clearTimer();
|
|
104
|
-
(0,
|
|
115
|
+
(0, core_utils_1.assert)(SocketReference.socketIoSockets.get(this.key) === this, 0x0a1 /* "Socket reference set unexpectedly does not point to this socket!" */);
|
|
116
|
+
// First, remove socket to ensure no socket reuse is possible.
|
|
105
117
|
SocketReference.socketIoSockets.delete(this.key);
|
|
118
|
+
// Block access to socket. From now on, calls like flush() or requestOps()
|
|
119
|
+
// Disconnect flow should be synchronous and result in system fully forgetting about this connection / socket.
|
|
106
120
|
const socket = this._socket;
|
|
107
121
|
this._socket = undefined;
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
|
|
122
|
+
// Let all connections know they need to go through disconnect flow.
|
|
123
|
+
this.emit("disconnect", error ??
|
|
124
|
+
(0, driver_utils_1.createGenericNetworkError)("Socket closed without error", { canRetry: true }, { driverVersion: packageVersion_1.pkgVersion }), undefined /* clientId */);
|
|
125
|
+
// We should not have any users now, assuming synchronous disconnect flow in response to
|
|
126
|
+
// "disconnect" event
|
|
127
|
+
(0, core_utils_1.assert)(this.references === 0, 0x412 /* Nobody should be connected to this socket at this point! */);
|
|
128
|
+
socket.disconnect();
|
|
114
129
|
}
|
|
115
130
|
get disconnected() {
|
|
116
131
|
if (this._socket === undefined) {
|
|
@@ -135,25 +150,6 @@ SocketReference.socketIoSockets = new Map();
|
|
|
135
150
|
* Represents a connection to a stream of delta updates
|
|
136
151
|
*/
|
|
137
152
|
class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection {
|
|
138
|
-
/**
|
|
139
|
-
* @param socket - websocket to be used
|
|
140
|
-
* @param documentId - ID of the document
|
|
141
|
-
* @param details - details of the websocket connection
|
|
142
|
-
* @param socketReferenceKey - socket reference key
|
|
143
|
-
* @param enableMultiplexing - If the websocket is multiplexing multiple documents
|
|
144
|
-
*/
|
|
145
|
-
constructor(socket, documentId, socketReference, logger, enableMultiplexing) {
|
|
146
|
-
super(socket, documentId, logger);
|
|
147
|
-
this.enableMultiplexing = enableMultiplexing;
|
|
148
|
-
this.pushCallCounter = 0;
|
|
149
|
-
this.getOpsMap = new Map();
|
|
150
|
-
this.serverDisconnectHandler = (error) => {
|
|
151
|
-
this.logger.sendTelemetryEvent({ eventName: "ServerDisconnect", clientId: this.clientId }, error);
|
|
152
|
-
this.disposeCore(true, error);
|
|
153
|
-
};
|
|
154
|
-
this.socketReference = socketReference;
|
|
155
|
-
this.requestOpsNoncePrefix = `${(0, uuid_1.v4)()}-`;
|
|
156
|
-
}
|
|
157
153
|
/**
|
|
158
154
|
* Create a OdspDocumentDeltaConnection
|
|
159
155
|
* If url #1 fails to connect, will try url #2 if applicable.
|
|
@@ -161,7 +157,6 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
161
157
|
* @param tenantId - the ID of the tenant
|
|
162
158
|
* @param documentId - document ID
|
|
163
159
|
* @param token - authorization token for storage service
|
|
164
|
-
* @param io - websocket library
|
|
165
160
|
* @param client - information about the client
|
|
166
161
|
* @param mode - mode of the client
|
|
167
162
|
* @param url - websocket URL
|
|
@@ -170,7 +165,9 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
170
165
|
* @param epochTracker - track epoch changes
|
|
171
166
|
* @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache
|
|
172
167
|
*/
|
|
173
|
-
static async create(tenantId, documentId,
|
|
168
|
+
static async create(tenantId, documentId,
|
|
169
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
170
|
+
token, client, url, telemetryLogger, timeoutMs, epochTracker, socketReferenceKeyPrefix) {
|
|
174
171
|
const mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetryLogger);
|
|
175
172
|
// enable multiplexing when the websocket url does not include the tenant/document id
|
|
176
173
|
const parsedUrl = new URL(url);
|
|
@@ -179,8 +176,9 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
179
176
|
// this will allow multiple documents to share the same websocket connection
|
|
180
177
|
const key = socketReferenceKeyPrefix ? `${socketReferenceKeyPrefix},${url}` : url;
|
|
181
178
|
const socketReferenceKey = enableMultiplexing ? key : `${key},${tenantId},${documentId}`;
|
|
182
|
-
const socketReference = OdspDocumentDeltaConnection.getOrCreateSocketIoReference(
|
|
179
|
+
const socketReference = OdspDocumentDeltaConnection.getOrCreateSocketIoReference(timeoutMs, socketReferenceKey, url, enableMultiplexing, tenantId, documentId, telemetryLogger);
|
|
183
180
|
const socket = socketReference.socket;
|
|
181
|
+
const connectionId = (0, uuid_1.v4)();
|
|
184
182
|
const connectMessage = {
|
|
185
183
|
client,
|
|
186
184
|
id: documentId,
|
|
@@ -188,19 +186,22 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
188
186
|
tenantId,
|
|
189
187
|
token,
|
|
190
188
|
versions: protocolVersions,
|
|
191
|
-
|
|
189
|
+
driverVersion: packageVersion_1.pkgVersion,
|
|
190
|
+
nonce: connectionId,
|
|
192
191
|
epoch: epochTracker.fluidEpoch,
|
|
193
192
|
relayUserAgent: [client.details.environment, ` driverVersion:${packageVersion_1.pkgVersion}`].join(";"),
|
|
194
193
|
};
|
|
194
|
+
connectMessage.supportedFeatures = {
|
|
195
|
+
[feature_submit_signals_v2]: true,
|
|
196
|
+
};
|
|
195
197
|
// Reference to this client supporting get_ops flow.
|
|
196
|
-
connectMessage.supportedFeatures = {};
|
|
197
198
|
if (mc.config.getBoolean("Fluid.Driver.Odsp.GetOpsEnabled") !== false) {
|
|
198
199
|
connectMessage.supportedFeatures[feature_get_ops] = true;
|
|
199
200
|
}
|
|
200
|
-
const deltaConnection = new OdspDocumentDeltaConnection(socket, documentId, socketReference, telemetryLogger, enableMultiplexing);
|
|
201
|
+
const deltaConnection = new OdspDocumentDeltaConnection(socket, documentId, socketReference, telemetryLogger, enableMultiplexing, connectionId);
|
|
201
202
|
try {
|
|
202
203
|
await deltaConnection.initialize(connectMessage, timeoutMs);
|
|
203
|
-
await epochTracker.
|
|
204
|
+
await epochTracker.validateEpoch(deltaConnection.details.epoch, "push");
|
|
204
205
|
}
|
|
205
206
|
catch (errorObject) {
|
|
206
207
|
if (errorObject !== null && typeof errorObject === "object") {
|
|
@@ -232,23 +233,20 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
232
233
|
// Note: we suspect the incoming error object is either:
|
|
233
234
|
// - a socketError: add it to the OdspError object for driver to be able to parse it and reason over it.
|
|
234
235
|
// - anything else: let base class handle it
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
else {
|
|
239
|
-
return super.createErrorObject(handler, error, canRetry);
|
|
240
|
-
}
|
|
236
|
+
return canRetry && Number.isInteger(error?.code) && typeof error?.message === "string"
|
|
237
|
+
? (0, odspError_1.errorObjectFromSocketError)(error, handler)
|
|
238
|
+
: super.createErrorObject(handler, error, canRetry);
|
|
241
239
|
}
|
|
242
240
|
/**
|
|
243
241
|
* Gets or create a socket io connection for the given key
|
|
244
242
|
*/
|
|
245
|
-
static getOrCreateSocketIoReference(
|
|
243
|
+
static getOrCreateSocketIoReference(timeoutMs, key, url, enableMultiplexing, tenantId, documentId, logger) {
|
|
246
244
|
const existingSocketReference = SocketReference.find(key, logger);
|
|
247
245
|
if (existingSocketReference) {
|
|
248
246
|
return existingSocketReference;
|
|
249
247
|
}
|
|
250
248
|
const query = enableMultiplexing ? undefined : { documentId, tenantId };
|
|
251
|
-
const socket =
|
|
249
|
+
const socket = (0, socketModule_1.SocketIOClientStatic)(url, {
|
|
252
250
|
multiplex: false,
|
|
253
251
|
query,
|
|
254
252
|
reconnection: false,
|
|
@@ -257,6 +255,33 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
257
255
|
});
|
|
258
256
|
return new SocketReference(key, socket);
|
|
259
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* @param socket - websocket to be used
|
|
260
|
+
* @param documentId - ID of the document
|
|
261
|
+
* @param details - details of the websocket connection
|
|
262
|
+
* @param socketReferenceKey - socket reference key
|
|
263
|
+
* @param enableMultiplexing - If the websocket is multiplexing multiple documents
|
|
264
|
+
*/
|
|
265
|
+
constructor(socket, documentId, socketReference, logger, enableMultiplexing, connectionId) {
|
|
266
|
+
super(socket, documentId, logger, false, connectionId);
|
|
267
|
+
this.enableMultiplexing = enableMultiplexing;
|
|
268
|
+
this.pushCallCounter = 0;
|
|
269
|
+
this.getOpsMap = new Map();
|
|
270
|
+
this.disconnectHandler = (error, clientId) => {
|
|
271
|
+
if (clientId === undefined || clientId === this.clientId) {
|
|
272
|
+
this.logger.sendTelemetryEvent({
|
|
273
|
+
eventName: "ServerDisconnect",
|
|
274
|
+
driverVersion: packageVersion_1.pkgVersion,
|
|
275
|
+
details: JSON.stringify({
|
|
276
|
+
...this.getConnectionDetailsProps(),
|
|
277
|
+
}),
|
|
278
|
+
}, error);
|
|
279
|
+
this.disconnect(error);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
this.socketReference = socketReference;
|
|
283
|
+
this.requestOpsNoncePrefix = `${(0, uuid_1.v4)()}-`;
|
|
284
|
+
}
|
|
260
285
|
/**
|
|
261
286
|
* Retrieves ops from PUSH
|
|
262
287
|
* @param from - inclusive
|
|
@@ -264,17 +289,17 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
264
289
|
* @returns ops retrieved
|
|
265
290
|
*/
|
|
266
291
|
requestOps(from, to) {
|
|
267
|
-
|
|
292
|
+
(0, core_utils_1.assert)(!this.socketReference?.disconnected, 0x413 /* non-active socket */);
|
|
268
293
|
// Given that to is exclusive, we should be asking for at least something!
|
|
269
|
-
(0,
|
|
294
|
+
(0, core_utils_1.assert)(to > from, 0x272 /* "empty request" */);
|
|
270
295
|
// PUSH may disable this functionality
|
|
271
296
|
// back-compat: remove cast to any once latest version of IConnected is consumed
|
|
272
|
-
if (
|
|
297
|
+
if (this.details.supportedFeatures?.[feature_get_ops] !== true) {
|
|
273
298
|
return;
|
|
274
299
|
}
|
|
275
300
|
this.pushCallCounter++;
|
|
276
301
|
const nonce = `${this.requestOpsNoncePrefix}${this.pushCallCounter}`;
|
|
277
|
-
const start =
|
|
302
|
+
const start = client_utils_1.performance.now();
|
|
278
303
|
// We may keep keep accumulating memory for nothing, if we are not getting responses.
|
|
279
304
|
// Note that we should not have overlapping requests, as DeltaManager allows only one
|
|
280
305
|
// outstanding request to storage, and that's the only way to get here.
|
|
@@ -298,7 +323,7 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
298
323
|
from: payloadToDelete.from,
|
|
299
324
|
to: payloadToDelete.to,
|
|
300
325
|
length: payloadToDelete.to - payloadToDelete.from,
|
|
301
|
-
duration:
|
|
326
|
+
duration: client_utils_1.performance.now() - payloadToDelete.start,
|
|
302
327
|
});
|
|
303
328
|
this.getOpsMap.delete(key);
|
|
304
329
|
}
|
|
@@ -314,9 +339,9 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
314
339
|
});
|
|
315
340
|
}
|
|
316
341
|
async flush() {
|
|
317
|
-
|
|
342
|
+
(0, core_utils_1.assert)(!this.socketReference?.disconnected, 0x414 /* non-active socket */);
|
|
318
343
|
// back-compat: remove cast to any once latest version of IConnected is consumed
|
|
319
|
-
if (
|
|
344
|
+
if (this.details.supportedFeatures?.[feature_flush_ops] !== true) {
|
|
320
345
|
// Once single-commit summary is enabled end-to-end, flush support is a must!
|
|
321
346
|
// The only alternative is change in design where SPO fetches ops from PUSH OR
|
|
322
347
|
// summary includes required ops and SPO has some validation mechanism to ensure
|
|
@@ -336,10 +361,11 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
336
361
|
}
|
|
337
362
|
this.socket.emit("flush_ops", this.clientId, { nonce });
|
|
338
363
|
this.flushOpNonce = nonce;
|
|
339
|
-
this.flushDeferred = new
|
|
364
|
+
this.flushDeferred = new core_utils_1.Deferred();
|
|
340
365
|
return this.flushDeferred.promise;
|
|
341
366
|
}
|
|
342
367
|
async initialize(connectMessage, timeout) {
|
|
368
|
+
(0, core_utils_1.assert)(!this.socketReference?.disconnected, 0x415 /* non-active socket */);
|
|
343
369
|
if (this.enableMultiplexing) {
|
|
344
370
|
// multiplex compatible early handlers
|
|
345
371
|
this.earlyOpHandler = (messageDocumentId, msgs) => {
|
|
@@ -349,39 +375,52 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
349
375
|
};
|
|
350
376
|
this.earlySignalHandler = (msg, messageDocumentId) => {
|
|
351
377
|
if (messageDocumentId === undefined || messageDocumentId === this.documentId) {
|
|
352
|
-
|
|
378
|
+
if (Array.isArray(msg)) {
|
|
379
|
+
this.queuedSignals.push(...msg);
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
this.queuedSignals.push(msg);
|
|
383
|
+
}
|
|
353
384
|
}
|
|
354
385
|
};
|
|
355
386
|
}
|
|
356
|
-
this.socketReference.on("
|
|
357
|
-
this.
|
|
387
|
+
this.socketReference.on("disconnect", this.disconnectHandler);
|
|
388
|
+
this.addTrackedListener("get_ops_response", (result) => {
|
|
358
389
|
const messages = result.messages;
|
|
359
390
|
const data = this.getOpsMap.get(result.nonce);
|
|
360
391
|
// Due to socket multiplexing, this client may not have asked for any data
|
|
361
392
|
// If so, there it most likely does not need these ops (otherwise it already asked for them)
|
|
362
393
|
// Also we may have deleted entry in this.getOpsMap due to too many requests and too slow response.
|
|
363
394
|
// But not processing such result may push us into infinite loop of fast requests and dropping all responses
|
|
364
|
-
if (data !== undefined || result.nonce.
|
|
395
|
+
if (data !== undefined || result.nonce.startsWith(this.requestOpsNoncePrefix)) {
|
|
365
396
|
this.getOpsMap.delete(result.nonce);
|
|
366
397
|
const common = {
|
|
367
398
|
eventName: "GetOps",
|
|
368
399
|
// We need nonce only to pair with GetOpsTooMany events, i.e. when record was deleted
|
|
369
400
|
nonce: data === undefined ? result.nonce : undefined,
|
|
370
401
|
code: result.code,
|
|
371
|
-
from: data
|
|
372
|
-
to: data
|
|
373
|
-
duration: data === undefined ? undefined :
|
|
402
|
+
from: data?.from,
|
|
403
|
+
to: data?.to,
|
|
404
|
+
duration: data === undefined ? undefined : client_utils_1.performance.now() - data.start,
|
|
374
405
|
};
|
|
375
406
|
if (messages !== undefined && messages.length > 0) {
|
|
376
|
-
this.logger.sendPerformanceEvent(
|
|
407
|
+
this.logger.sendPerformanceEvent({
|
|
408
|
+
...common,
|
|
409
|
+
first: messages[0].sequenceNumber,
|
|
410
|
+
last: messages[messages.length - 1].sequenceNumber,
|
|
411
|
+
length: messages.length,
|
|
412
|
+
});
|
|
377
413
|
this.emit("op", this.documentId, messages);
|
|
378
414
|
}
|
|
379
415
|
else {
|
|
380
|
-
this.logger.sendPerformanceEvent(
|
|
416
|
+
this.logger.sendPerformanceEvent({
|
|
417
|
+
...common,
|
|
418
|
+
length: 0,
|
|
419
|
+
});
|
|
381
420
|
}
|
|
382
421
|
}
|
|
383
422
|
});
|
|
384
|
-
this.
|
|
423
|
+
this.addTrackedListener("flush_ops_response", (result) => {
|
|
385
424
|
if (this.flushOpNonce === result.nonce) {
|
|
386
425
|
const seq = result.lastPersistedSequenceNumber;
|
|
387
426
|
let category = "generic";
|
|
@@ -409,7 +448,12 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
409
448
|
this.flushOpNonce = undefined;
|
|
410
449
|
}
|
|
411
450
|
});
|
|
412
|
-
await super.initialize(connectMessage, timeout)
|
|
451
|
+
await super.initialize(connectMessage, timeout).finally(() => {
|
|
452
|
+
this.logger.sendTelemetryEvent({
|
|
453
|
+
eventName: "ConnectionAttemptInfo",
|
|
454
|
+
...this.getConnectionDetailsProps(),
|
|
455
|
+
});
|
|
456
|
+
});
|
|
413
457
|
}
|
|
414
458
|
addTrackedListener(event, listener) {
|
|
415
459
|
// override some event listeners in order to support multiple documents/clients over the same websocket
|
|
@@ -425,7 +469,9 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
425
469
|
case "signal":
|
|
426
470
|
// per document signal handling
|
|
427
471
|
super.addTrackedListener(event, (msg, documentId) => {
|
|
428
|
-
if (!this.enableMultiplexing ||
|
|
472
|
+
if (!this.enableMultiplexing ||
|
|
473
|
+
!documentId ||
|
|
474
|
+
documentId === this.documentId) {
|
|
429
475
|
listener(msg, documentId);
|
|
430
476
|
}
|
|
431
477
|
});
|
|
@@ -433,11 +479,11 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
433
479
|
case "nack":
|
|
434
480
|
// per client / document nack handling
|
|
435
481
|
super.addTrackedListener(event, (clientIdOrDocumentId, nacks) => {
|
|
436
|
-
var _a, _b;
|
|
437
482
|
const handle = clientIdOrDocumentId.length === 0 ||
|
|
438
483
|
clientIdOrDocumentId === this.documentId ||
|
|
439
|
-
|
|
440
|
-
const { code, type, message, retryAfter } =
|
|
484
|
+
clientIdOrDocumentId === this.clientId;
|
|
485
|
+
const { code, type, message, retryAfter } = nacks[0]?.content ?? {};
|
|
486
|
+
const { clientSequenceNumber, referenceSequenceNumber } = nacks[0]?.operation ?? {};
|
|
441
487
|
this.logger.sendTelemetryEvent({
|
|
442
488
|
eventName: "ServerNack",
|
|
443
489
|
code,
|
|
@@ -446,6 +492,9 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
446
492
|
retryAfterSeconds: retryAfter,
|
|
447
493
|
clientId: this.clientId,
|
|
448
494
|
handle,
|
|
495
|
+
clientSequenceNumber,
|
|
496
|
+
referenceSequenceNumber,
|
|
497
|
+
opType: nacks[0]?.operation?.type,
|
|
449
498
|
});
|
|
450
499
|
if (handle) {
|
|
451
500
|
this.emit("nack", clientIdOrDocumentId, nacks);
|
|
@@ -457,22 +506,84 @@ class OdspDocumentDeltaConnection extends driver_base_1.DocumentDeltaConnection
|
|
|
457
506
|
break;
|
|
458
507
|
}
|
|
459
508
|
}
|
|
509
|
+
get disposed() {
|
|
510
|
+
if (!(this._disposed || this.socket.connected)) {
|
|
511
|
+
// Send error event if this connection is not yet disposed after socket is disconnected for 15s.
|
|
512
|
+
if (this.connectionNotYetDisposedTimeout === undefined) {
|
|
513
|
+
this.connectionNotYetDisposedTimeout = setTimeout(() => {
|
|
514
|
+
if (!this._disposed) {
|
|
515
|
+
this.logger.sendErrorEvent({
|
|
516
|
+
eventName: "ConnectionNotYetDisposed",
|
|
517
|
+
driverVersion: packageVersion_1.pkgVersion,
|
|
518
|
+
details: JSON.stringify({
|
|
519
|
+
...this.getConnectionDetailsProps(),
|
|
520
|
+
}),
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
}, 15000);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return this._disposed;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Returns true in case the connection is not yet disposed and the socket is also connected. The expectation is
|
|
530
|
+
* that it will be called only after connection is fully established. i.e. there should no way to submit an op
|
|
531
|
+
* while we are connecting, as connection object is not exposed to Loader layer until connection is established.
|
|
532
|
+
*/
|
|
533
|
+
get connected() {
|
|
534
|
+
return !this.disposed && this.socket.connected;
|
|
535
|
+
}
|
|
536
|
+
emitMessages(type, messages) {
|
|
537
|
+
// Only submit the op/signals if we are connected.
|
|
538
|
+
if (this.connected) {
|
|
539
|
+
this.socket.emit(type, this.clientId, messages);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Submits a new delta operation to the server
|
|
544
|
+
* @param message - delta operation to submit
|
|
545
|
+
*/
|
|
546
|
+
submit(messages) {
|
|
547
|
+
this.emitMessages("submitOp", [messages]);
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Submits a new signal to the server
|
|
551
|
+
*
|
|
552
|
+
* @param content - Content of the signal.
|
|
553
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
554
|
+
*/
|
|
555
|
+
submitSignal(content, targetClientId) {
|
|
556
|
+
const signal = {
|
|
557
|
+
content,
|
|
558
|
+
targetClientId,
|
|
559
|
+
};
|
|
560
|
+
// back-compat: the typing for this method and emitMessages is incorrect, will be fixed in a future PR
|
|
561
|
+
this.emitMessages("submitSignal", [signal]);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Critical path where we need to also close the socket for an error.
|
|
565
|
+
* @param error - Error causing the socket to close.
|
|
566
|
+
*/
|
|
567
|
+
closeSocketCore(error) {
|
|
568
|
+
const socket = this.socketReference;
|
|
569
|
+
(0, core_utils_1.assert)(socket !== undefined, 0x416 /* reentrancy not supported in close socket */);
|
|
570
|
+
socket.closeSocket(error);
|
|
571
|
+
(0, core_utils_1.assert)(this.socketReference === undefined, 0x417 /* disconnect flow did not work correctly */);
|
|
572
|
+
}
|
|
460
573
|
/**
|
|
461
574
|
* Disconnect from the websocket
|
|
462
575
|
*/
|
|
463
|
-
|
|
464
|
-
var _a;
|
|
576
|
+
disconnectCore() {
|
|
465
577
|
const socket = this.socketReference;
|
|
466
|
-
(0,
|
|
467
|
-
(_a = this.socketReference) === null || _a === void 0 ? void 0 : _a.off("server_disconnect", this.serverDisconnectHandler);
|
|
578
|
+
(0, core_utils_1.assert)(socket !== undefined, 0x0a2 /* "reentrancy not supported!" */);
|
|
468
579
|
this.socketReference = undefined;
|
|
469
|
-
|
|
580
|
+
socket.off("disconnect", this.disconnectHandler);
|
|
581
|
+
if (this.hasDetails) {
|
|
470
582
|
// tell the server we are disconnecting this client from the document
|
|
471
583
|
this.socket.emit("disconnect_document", this.clientId, this.documentId);
|
|
472
584
|
}
|
|
473
|
-
socket.removeSocketIoReference(
|
|
474
|
-
this.emit("disconnect", reason);
|
|
585
|
+
socket.removeSocketIoReference();
|
|
475
586
|
}
|
|
476
587
|
}
|
|
477
588
|
exports.OdspDocumentDeltaConnection = OdspDocumentDeltaConnection;
|
|
478
|
-
//# sourceMappingURL=odspDocumentDeltaConnection.
|
|
589
|
+
//# sourceMappingURL=odspDocumentDeltaConnection.cjs.map
|