@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspError.d.ts","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAKI,EAAE,SAAS,EAAE,MAAM,yCAAyC;OAC5D,EAAuB,eAAe,EAAE,MAAM,iCAAiC;OAC/E,EAAE,gBAAgB,EAAE;AAG3B;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,MAAM,GACb,eAAe,GAAG,SAAS,CAwB7B"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { createOdspNetworkError } from "@fluidframework/odsp-doclib-utils";
|
|
6
6
|
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { NonRetryableError } from "@fluidframework/driver-utils";
|
|
8
|
-
import {
|
|
8
|
+
import { getCircularReplacer } from "@fluidframework/telemetry-utils";
|
|
9
|
+
import { pkgVersion as driverVersion } from "./packageVersion.mjs";
|
|
9
10
|
/**
|
|
10
11
|
* Returns network error based on error object from ODSP socket (IOdspSocketError)
|
|
11
12
|
*/
|
|
@@ -14,7 +15,10 @@ export function errorObjectFromSocketError(socketError, handler) {
|
|
|
14
15
|
try {
|
|
15
16
|
// pre-0.58 error message prefix: OdspSocketError
|
|
16
17
|
const message = `ODSP socket error (${handler}): ${socketError.message}`;
|
|
17
|
-
const error = createOdspNetworkError(message, socketError.code, socketError.retryAfter
|
|
18
|
+
const error = createOdspNetworkError(message, socketError.code, socketError.retryAfter, undefined, // response from http request
|
|
19
|
+
socketError.error
|
|
20
|
+
? JSON.stringify({ error: socketError.error }, getCircularReplacer())
|
|
21
|
+
: undefined);
|
|
18
22
|
error.addTelemetryProperties({ odspError: true, relayServiceError: true });
|
|
19
23
|
return error;
|
|
20
24
|
}
|
|
@@ -22,4 +26,4 @@ export function errorObjectFromSocketError(socketError, handler) {
|
|
|
22
26
|
return new NonRetryableError("Internal error: errorObjectFromSocketError", DriverErrorType.fileNotFoundOrAccessDeniedError, { driverVersion });
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
|
-
//# sourceMappingURL=odspError.
|
|
29
|
+
//# sourceMappingURL=odspError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspError.mjs","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,sBAAsB,EAAE,MAAM,mCAAmC;OACnE,EAAE,eAAe,EAAE,MAAM,oCAAoC;OAC7D,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OAEzD,EAAE,mBAAmB,EAAmB,MAAM,iCAAiC;OAE/E,EAAE,UAAU,IAAI,aAAa,EAAE;AAEtC;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACzC,WAA6B,EAC7B,OAAe;IAEf,0DAA0D;IAC1D,IAAI;QACH,iDAAiD;QACjD,MAAM,OAAO,GAAG,sBAAsB,OAAO,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;QACzE,MAAM,KAAK,GAAG,sBAAsB,CACnC,OAAO,EACP,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,UAAU,EACtB,SAAS,EAAE,6BAA6B;QACxC,WAAW,CAAC,KAAK;YAChB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,EAAE,mBAAmB,EAAE,CAAC;YACrE,CAAC,CAAC,SAAS,CACZ,CAAC;QAEF,KAAK,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3E,OAAO,KAAK,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACf,OAAO,IAAI,iBAAiB,CAC3B,4CAA4C,EAC5C,eAAe,CAAC,+BAA+B,EAC/C,EAAE,aAAa,EAAE,CACjB,CAAC;KACF;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createOdspNetworkError } from \"@fluidframework/odsp-doclib-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils\";\nimport { OdspError } from \"@fluidframework/odsp-driver-definitions\";\nimport { getCircularReplacer, IFluidErrorBase } from \"@fluidframework/telemetry-utils\";\nimport { IOdspSocketError } from \"./contracts\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\n\n/**\n * Returns network error based on error object from ODSP socket (IOdspSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IOdspSocketError,\n\thandler: string,\n): IFluidErrorBase & OdspError {\n\t// Make sure we always return something, and do not throw.\n\ttry {\n\t\t// pre-0.58 error message prefix: OdspSocketError\n\t\tconst message = `ODSP socket error (${handler}): ${socketError.message}`;\n\t\tconst error = createOdspNetworkError(\n\t\t\tmessage,\n\t\t\tsocketError.code,\n\t\t\tsocketError.retryAfter,\n\t\t\tundefined, // response from http request\n\t\t\tsocketError.error\n\t\t\t\t? JSON.stringify({ error: socketError.error }, getCircularReplacer())\n\t\t\t\t: undefined, // responseText\n\t\t);\n\n\t\terror.addTelemetryProperties({ odspError: true, relayServiceError: true });\n\t\treturn error;\n\t} catch (error) {\n\t\treturn new NonRetryableError(\n\t\t\t\"Internal error: errorObjectFromSocketError\",\n\t\t\tDriverErrorType.fileNotFoundOrAccessDeniedError,\n\t\t\t{ driverVersion },\n\t\t);\n\t}\n}\n"]}
|
|
@@ -2,25 +2,34 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { OdspFluidDataStoreLocator } from "./contractsPublic";
|
|
5
|
+
import { OdspFluidDataStoreLocator } from "./contractsPublic.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* Transforms given Fluid data store locator into string that can be embedded into url
|
|
8
8
|
* @param locator - describes Fluid data store locator info to be encoded
|
|
9
9
|
* @returns string representing encoded Fluid data store locator info
|
|
10
|
+
* @alpha
|
|
10
11
|
*/
|
|
11
12
|
export declare function encodeOdspFluidDataStoreLocator(locator: OdspFluidDataStoreLocator): string;
|
|
13
|
+
/**
|
|
14
|
+
* This parameter is provided by host in the resolve request and it contains information about the file
|
|
15
|
+
* like driveId, itemId, siteUrl, datastorePath, packageName etc.
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
12
18
|
export declare const locatorQueryParamName = "nav";
|
|
13
19
|
/**
|
|
14
20
|
* Embeds Fluid data store locator data into given ODSP url
|
|
15
21
|
* @param url - file url in ODSP format (can be either canonical or share link)
|
|
16
22
|
* @param locator - object representing Fluid data store location in ODSP terms
|
|
23
|
+
* @alpha
|
|
17
24
|
*/
|
|
18
25
|
export declare function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataStoreLocator): void;
|
|
19
26
|
/**
|
|
20
27
|
* Extract ODSP Fluid data store locator object from given ODSP url. This extracts things like
|
|
21
28
|
* driveId, ItemId, siteUrl etc from a url where these are encoded in nav query param.
|
|
22
29
|
* @param url - ODSP url representing Fluid file link
|
|
30
|
+
* @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true
|
|
23
31
|
* @returns object representing Fluid data store location in ODSP terms
|
|
32
|
+
* @alpha
|
|
24
33
|
*/
|
|
25
|
-
export declare function getLocatorFromOdspUrl(url: URL): OdspFluidDataStoreLocator | undefined;
|
|
34
|
+
export declare function getLocatorFromOdspUrl(url: URL, requireFluidSignature?: boolean): OdspFluidDataStoreLocator | undefined;
|
|
26
35
|
//# sourceMappingURL=odspFluidFileLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspFluidFileLink.d.ts","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,yBAAyB,EAAE;AAcpC;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CA0B1F;AA2DD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,yBAAyB,QAKjF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,GAAG,EACR,qBAAqB,GAAE,OAAc,GACnC,yBAAyB,GAAG,SAAS,CAiBvC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { fromBase64ToUtf8, fromUtf8ToBase64 } from "@
|
|
6
|
-
import { OdcFileSiteOrigin, OdcApiSiteOrigin } from "./constants";
|
|
5
|
+
import { fromBase64ToUtf8, fromUtf8ToBase64 } from "@fluid-internal/client-utils";
|
|
6
|
+
import { OdcFileSiteOrigin, OdcApiSiteOrigin } from "./constants.mjs";
|
|
7
7
|
const fluidSignature = "1";
|
|
8
8
|
const fluidSignatureParamName = "fluid";
|
|
9
9
|
const sitePathParamName = "s";
|
|
@@ -18,6 +18,7 @@ const additionalContextParamName = "x";
|
|
|
18
18
|
* Transforms given Fluid data store locator into string that can be embedded into url
|
|
19
19
|
* @param locator - describes Fluid data store locator info to be encoded
|
|
20
20
|
* @returns string representing encoded Fluid data store locator info
|
|
21
|
+
* @alpha
|
|
21
22
|
*/
|
|
22
23
|
export function encodeOdspFluidDataStoreLocator(locator) {
|
|
23
24
|
const siteUrl = new URL(locator.siteUrl);
|
|
@@ -43,25 +44,25 @@ export function encodeOdspFluidDataStoreLocator(locator) {
|
|
|
43
44
|
/**
|
|
44
45
|
* Decodes given encoded value representing Fluid data store locator extracted from ODSP Fluid file link
|
|
45
46
|
* @param encodedLocatorValue - encoded Fluid data store locator value which was produced by
|
|
46
|
-
*
|
|
47
|
+
* {@link encodeOdspFluidDataStoreLocator} function
|
|
47
48
|
* @param siteOriginUrl - site origin that will be appended to encoded relative path to form absolute file url
|
|
49
|
+
* @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true
|
|
48
50
|
* @returns object representing Fluid data store location in ODSP terms
|
|
49
51
|
*/
|
|
50
|
-
function decodeOdspFluidDataStoreLocator(encodedLocatorValue, siteOriginUrl) {
|
|
51
|
-
var _a, _b, _c, _d;
|
|
52
|
+
function decodeOdspFluidDataStoreLocator(encodedLocatorValue, siteOriginUrl, requireFluidSignature = true) {
|
|
52
53
|
const locatorInfo = new URLSearchParams(fromBase64ToUtf8(encodedLocatorValue));
|
|
53
54
|
const signatureValue = locatorInfo.get(fluidSignatureParamName);
|
|
54
|
-
if (signatureValue !== "1") {
|
|
55
|
+
if (requireFluidSignature && signatureValue !== "1") {
|
|
55
56
|
return undefined;
|
|
56
57
|
}
|
|
57
58
|
const sitePath = locatorInfo.get(sitePathParamName);
|
|
58
59
|
const driveId = locatorInfo.get(driveIdParamName);
|
|
59
60
|
const itemId = locatorInfo.get(itemIdParamName);
|
|
60
61
|
const dataStorePath = locatorInfo.get(dataStorePathParamName);
|
|
61
|
-
const appName =
|
|
62
|
-
const containerPackageName =
|
|
63
|
-
const fileVersion =
|
|
64
|
-
const context =
|
|
62
|
+
const appName = locatorInfo.get(appNameParamName) ?? undefined;
|
|
63
|
+
const containerPackageName = locatorInfo.get(containerPackageNameParamName) ?? undefined;
|
|
64
|
+
const fileVersion = locatorInfo.get(fileVersionParamName) ?? undefined;
|
|
65
|
+
const context = locatorInfo.get(additionalContextParamName) ?? undefined;
|
|
65
66
|
// "" is a valid value for dataStorePath so simply check for absence of the param;
|
|
66
67
|
// file storage locator params must be present and non-empty
|
|
67
68
|
if (!sitePath || !driveId || !itemId || dataStorePath === null) {
|
|
@@ -71,7 +72,7 @@ function decodeOdspFluidDataStoreLocator(encodedLocatorValue, siteOriginUrl) {
|
|
|
71
72
|
try {
|
|
72
73
|
siteUrl = new URL(sitePath, siteOriginUrl);
|
|
73
74
|
}
|
|
74
|
-
catch
|
|
75
|
+
catch {
|
|
75
76
|
// Ignore failure to parse url as input might be malformed
|
|
76
77
|
}
|
|
77
78
|
if (!siteUrl) {
|
|
@@ -88,13 +89,17 @@ function decodeOdspFluidDataStoreLocator(encodedLocatorValue, siteOriginUrl) {
|
|
|
88
89
|
context,
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
/**
|
|
93
|
+
* This parameter is provided by host in the resolve request and it contains information about the file
|
|
94
|
+
* like driveId, itemId, siteUrl, datastorePath, packageName etc.
|
|
95
|
+
* @alpha
|
|
96
|
+
*/
|
|
93
97
|
export const locatorQueryParamName = "nav";
|
|
94
98
|
/**
|
|
95
99
|
* Embeds Fluid data store locator data into given ODSP url
|
|
96
100
|
* @param url - file url in ODSP format (can be either canonical or share link)
|
|
97
101
|
* @param locator - object representing Fluid data store location in ODSP terms
|
|
102
|
+
* @alpha
|
|
98
103
|
*/
|
|
99
104
|
export function storeLocatorInOdspUrl(url, locator) {
|
|
100
105
|
const encodedLocatorValue = encodeOdspFluidDataStoreLocator(locator);
|
|
@@ -106,9 +111,11 @@ export function storeLocatorInOdspUrl(url, locator) {
|
|
|
106
111
|
* Extract ODSP Fluid data store locator object from given ODSP url. This extracts things like
|
|
107
112
|
* driveId, ItemId, siteUrl etc from a url where these are encoded in nav query param.
|
|
108
113
|
* @param url - ODSP url representing Fluid file link
|
|
114
|
+
* @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true
|
|
109
115
|
* @returns object representing Fluid data store location in ODSP terms
|
|
116
|
+
* @alpha
|
|
110
117
|
*/
|
|
111
|
-
export function getLocatorFromOdspUrl(url) {
|
|
118
|
+
export function getLocatorFromOdspUrl(url, requireFluidSignature = true) {
|
|
112
119
|
// NOTE: No need to apply decodeURIComponent when accessing query params via URLSearchParams class.
|
|
113
120
|
const encodedLocatorValue = url.searchParams.get(locatorQueryParamName);
|
|
114
121
|
if (!encodedLocatorValue) {
|
|
@@ -117,6 +124,6 @@ export function getLocatorFromOdspUrl(url) {
|
|
|
117
124
|
// IMPORTANT: ODC deviates from ODSP in that its file link origin is different from vroom api origin.
|
|
118
125
|
// The following code passes vroom api origin as site origin instead of file origin.
|
|
119
126
|
const siteOriginUrl = url.origin.toLowerCase() === OdcFileSiteOrigin ? OdcApiSiteOrigin : url.origin;
|
|
120
|
-
return decodeOdspFluidDataStoreLocator(encodedLocatorValue, siteOriginUrl);
|
|
127
|
+
return decodeOdspFluidDataStoreLocator(encodedLocatorValue, siteOriginUrl, requireFluidSignature);
|
|
121
128
|
}
|
|
122
|
-
//# sourceMappingURL=odspFluidFileLink.
|
|
129
|
+
//# sourceMappingURL=odspFluidFileLink.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspFluidFileLink.mjs","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B;OAE1E,EAAE,iBAAiB,EAAE,gBAAgB,EAAE;AAE9C,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAC1C,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,OAAkC;IACjF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhE,IAAI,iBAAiB,GAAG,GAAG,iBAAiB,IAAI,QAAQ,IAAI,gBAAgB,IAAI,OAAO,IAAI,eAAe,IAAI,MAAM,IAAI,sBA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ErC,mGAAmG;IACnG,MAAM,mBAAmB,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACxE,IAAI,CAAC,mBAAmB,EAAE;QACzB,OAAO,SAAS,CAAC;KACjB;IAED,qGAAqG;IACrG,oFAAoF;IACpF,MAAM,aAAa,GAClB,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAEhF,OAAO,+BAA+B,CACrC,mBAAmB,EACnB,aAAa,EACb,qBAAqB,CACrB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromBase64ToUtf8, fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport { OdspFluidDataStoreLocator } from \"./contractsPublic\";\nimport { OdcFileSiteOrigin, OdcApiSiteOrigin } from \"./constants\";\n\nconst fluidSignature = \"1\";\nconst fluidSignatureParamName = \"fluid\";\nconst sitePathParamName = \"s\";\nconst driveIdParamName = \"d\";\nconst itemIdParamName = \"f\";\nconst dataStorePathParamName = \"c\";\nconst appNameParamName = \"a\";\nconst containerPackageNameParamName = \"p\";\nconst fileVersionParamName = \"v\";\nconst additionalContextParamName = \"x\";\n\n/**\n * Transforms given Fluid data store locator into string that can be embedded into url\n * @param locator - describes Fluid data store locator info to be encoded\n * @returns string representing encoded Fluid data store locator info\n * @alpha\n */\nexport function encodeOdspFluidDataStoreLocator(locator: OdspFluidDataStoreLocator): string {\n\tconst siteUrl = new URL(locator.siteUrl);\n\tconst sitePath = encodeURIComponent(siteUrl.pathname);\n\tconst driveId = encodeURIComponent(locator.driveId);\n\tconst itemId = encodeURIComponent(locator.itemId);\n\tconst dataStorePath = encodeURIComponent(locator.dataStorePath);\n\n\tlet locatorSerialized = `${sitePathParamName}=${sitePath}&${driveIdParamName}=${driveId}&${itemIdParamName}=${itemId}&${dataStorePathParamName}=${dataStorePath}&${fluidSignatureParamName}=${fluidSignature}`;\n\tif (locator.appName) {\n\t\tlocatorSerialized += `&${appNameParamName}=${encodeURIComponent(locator.appName)}`;\n\t}\n\tif (locator.containerPackageName) {\n\t\tlocatorSerialized += `&${containerPackageNameParamName}=${encodeURIComponent(\n\t\t\tlocator.containerPackageName,\n\t\t)}`;\n\t}\n\tif (locator.fileVersion) {\n\t\tlocatorSerialized += `&${fileVersionParamName}=${encodeURIComponent(locator.fileVersion)}`;\n\t}\n\tif (locator.context) {\n\t\tlocatorSerialized += `&${additionalContextParamName}=${encodeURIComponent(\n\t\t\tlocator.context,\n\t\t)}`;\n\t}\n\n\treturn fromUtf8ToBase64(locatorSerialized);\n}\n\n/**\n * Decodes given encoded value representing Fluid data store locator extracted from ODSP Fluid file link\n * @param encodedLocatorValue - encoded Fluid data store locator value which was produced by\n * {@link encodeOdspFluidDataStoreLocator} function\n * @param siteOriginUrl - site origin that will be appended to encoded relative path to form absolute file url\n * @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true\n * @returns object representing Fluid data store location in ODSP terms\n */\nfunction decodeOdspFluidDataStoreLocator(\n\tencodedLocatorValue: string,\n\tsiteOriginUrl: string,\n\trequireFluidSignature: boolean = true,\n): OdspFluidDataStoreLocator | undefined {\n\tconst locatorInfo = new URLSearchParams(fromBase64ToUtf8(encodedLocatorValue));\n\n\tconst signatureValue = locatorInfo.get(fluidSignatureParamName);\n\tif (requireFluidSignature && signatureValue !== \"1\") {\n\t\treturn undefined;\n\t}\n\n\tconst sitePath = locatorInfo.get(sitePathParamName);\n\tconst driveId = locatorInfo.get(driveIdParamName);\n\tconst itemId = locatorInfo.get(itemIdParamName);\n\tconst dataStorePath = locatorInfo.get(dataStorePathParamName);\n\tconst appName = locatorInfo.get(appNameParamName) ?? undefined;\n\tconst containerPackageName = locatorInfo.get(containerPackageNameParamName) ?? undefined;\n\tconst fileVersion = locatorInfo.get(fileVersionParamName) ?? undefined;\n\tconst context = locatorInfo.get(additionalContextParamName) ?? undefined;\n\t// \"\" is a valid value for dataStorePath so simply check for absence of the param;\n\t// file storage locator params must be present and non-empty\n\tif (!sitePath || !driveId || !itemId || dataStorePath === null) {\n\t\treturn undefined;\n\t}\n\n\tlet siteUrl: URL | undefined;\n\ttry {\n\t\tsiteUrl = new URL(sitePath, siteOriginUrl);\n\t} catch {\n\t\t// Ignore failure to parse url as input might be malformed\n\t}\n\n\tif (!siteUrl) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tsiteUrl: siteUrl.href,\n\t\tdriveId,\n\t\titemId,\n\t\tdataStorePath,\n\t\tappName,\n\t\tcontainerPackageName,\n\t\tfileVersion,\n\t\tcontext,\n\t};\n}\n\n/**\n * This parameter is provided by host in the resolve request and it contains information about the file\n * like driveId, itemId, siteUrl, datastorePath, packageName etc.\n * @alpha\n */\nexport const locatorQueryParamName = \"nav\";\n\n/**\n * Embeds Fluid data store locator data into given ODSP url\n * @param url - file url in ODSP format (can be either canonical or share link)\n * @param locator - object representing Fluid data store location in ODSP terms\n * @alpha\n */\nexport function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataStoreLocator) {\n\tconst encodedLocatorValue = encodeOdspFluidDataStoreLocator(locator);\n\t// IMPORTANT: Do not apply encodeURIComponent to encodedLocatorValue, param value is automatically encoded\n\t// when set via URLSearchParams class\n\turl.searchParams.set(locatorQueryParamName, encodedLocatorValue);\n}\n\n/**\n * Extract ODSP Fluid data store locator object from given ODSP url. This extracts things like\n * driveId, ItemId, siteUrl etc from a url where these are encoded in nav query param.\n * @param url - ODSP url representing Fluid file link\n * @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true\n * @returns object representing Fluid data store location in ODSP terms\n * @alpha\n */\nexport function getLocatorFromOdspUrl(\n\turl: URL,\n\trequireFluidSignature: boolean = true,\n): OdspFluidDataStoreLocator | undefined {\n\t// NOTE: No need to apply decodeURIComponent when accessing query params via URLSearchParams class.\n\tconst encodedLocatorValue = url.searchParams.get(locatorQueryParamName);\n\tif (!encodedLocatorValue) {\n\t\treturn undefined;\n\t}\n\n\t// IMPORTANT: ODC deviates from ODSP in that its file link origin is different from vroom api origin.\n\t// The following code passes vroom api origin as site origin instead of file origin.\n\tconst siteOriginUrl =\n\t\turl.origin.toLowerCase() === OdcFileSiteOrigin ? OdcApiSiteOrigin : url.origin;\n\n\treturn decodeOdspFluidDataStoreLocator(\n\t\tencodedLocatorValue,\n\t\tsiteOriginUrl,\n\t\trequireFluidSignature,\n\t);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
6
|
+
import { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions";
|
|
7
|
+
/**
|
|
8
|
+
* It takes a resolved url with old siteUrl and creates a new resolved url with updated site url domain.
|
|
9
|
+
* @param resolvedUrl - Previous odsp resolved url with older site url.
|
|
10
|
+
* @param redirectLocation - Url at which the network call has to be made. It contains new site info.
|
|
11
|
+
* @returns The resolved url after patching the correct siteUrl.
|
|
12
|
+
*/
|
|
13
|
+
export declare function patchOdspResolvedUrl(resolvedUrl: IResolvedUrl, redirectLocation: string): IOdspResolvedUrl;
|
|
14
|
+
//# sourceMappingURL=odspLocationRedirection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspLocationRedirection.d.ts","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,YAAY,EAAE,MAAM,oCAAoC;OAC1D,EAAE,gBAAgB,EAAE,MAAM,yCAAyC;AAG1E;;;;;GAKG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,YAAY,EACzB,gBAAgB,EAAE,MAAM,GACtB,gBAAgB,CAOlB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { getOdspResolvedUrl } from "./odspUtils.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* It takes a resolved url with old siteUrl and creates a new resolved url with updated site url domain.
|
|
8
|
+
* @param resolvedUrl - Previous odsp resolved url with older site url.
|
|
9
|
+
* @param redirectLocation - Url at which the network call has to be made. It contains new site info.
|
|
10
|
+
* @returns The resolved url after patching the correct siteUrl.
|
|
11
|
+
*/
|
|
12
|
+
export function patchOdspResolvedUrl(resolvedUrl, redirectLocation) {
|
|
13
|
+
const odspResolvedUrl = { ...getOdspResolvedUrl(resolvedUrl) };
|
|
14
|
+
// Generate the new SiteUrl from the redirection location.
|
|
15
|
+
const newSiteDomain = new URL(redirectLocation).origin;
|
|
16
|
+
const newSiteUrl = `${newSiteDomain}${new URL(odspResolvedUrl.siteUrl).pathname}`;
|
|
17
|
+
odspResolvedUrl.siteUrl = newSiteUrl;
|
|
18
|
+
return odspResolvedUrl;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=odspLocationRedirection.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspLocationRedirection.mjs","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,kBAAkB,EAAE;AAE7B;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAyB,EACzB,gBAAwB;IAExB,MAAM,eAAe,GAAG,EAAE,GAAG,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;IAC/D,0DAA0D;IAC1D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;IACvD,MAAM,UAAU,GAAG,GAAG,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IAClF,eAAe,CAAC,OAAO,GAAG,UAAU,CAAC;IACrC,OAAO,eAAe,CAAC;AACxB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions\";\nimport { getOdspResolvedUrl } from \"./odspUtils\";\n\n/**\n * It takes a resolved url with old siteUrl and creates a new resolved url with updated site url domain.\n * @param resolvedUrl - Previous odsp resolved url with older site url.\n * @param redirectLocation - Url at which the network call has to be made. It contains new site info.\n * @returns The resolved url after patching the correct siteUrl.\n */\nexport function patchOdspResolvedUrl(\n\tresolvedUrl: IResolvedUrl,\n\tredirectLocation: string,\n): IOdspResolvedUrl {\n\tconst odspResolvedUrl = { ...getOdspResolvedUrl(resolvedUrl) };\n\t// Generate the new SiteUrl from the redirection location.\n\tconst newSiteDomain = new URL(redirectLocation).origin;\n\tconst newSiteUrl = `${newSiteDomain}${new URL(odspResolvedUrl.siteUrl).pathname}`;\n\todspResolvedUrl.siteUrl = newSiteUrl;\n\treturn odspResolvedUrl;\n}\n"]}
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
6
9
|
export declare function getHashedDocumentId(driveId: string, itemId: string): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
7
13
|
export interface ISnapshotContents {
|
|
8
14
|
snapshotTree: ISnapshotTree;
|
|
9
15
|
blobs: Map<string, ArrayBuffer>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspPublicUtils.d.ts","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC;AAE/F;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG1F;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,YAAY,EAAE,aAAa,CAAC;IAC5B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChC,GAAG,EAAE,yBAAyB,EAAE,CAAC;IAEjC;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC"}
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { hashFile, IsoBuffer } from "@
|
|
5
|
+
import { hashFile, IsoBuffer } from "@fluid-internal/client-utils";
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
6
9
|
export async function getHashedDocumentId(driveId, itemId) {
|
|
7
10
|
const buffer = IsoBuffer.from(`${driveId}_${itemId}`);
|
|
8
11
|
return encodeURIComponent(await hashFile(buffer, "SHA-256", "base64"));
|
|
9
12
|
}
|
|
10
|
-
//# sourceMappingURL=odspPublicUtils.
|
|
13
|
+
//# sourceMappingURL=odspPublicUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspPublicUtils.mjs","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B;AAGlE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAc;IACxE,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;IACtD,OAAO,kBAAkB,CAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { hashFile, IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * @alpha\n */\nexport async function getHashedDocumentId(driveId: string, itemId: string): Promise<string> {\n\tconst buffer = IsoBuffer.from(`${driveId}_${itemId}`);\n\treturn encodeURIComponent(await hashFile(buffer, \"SHA-256\", \"base64\"));\n}\n\n/**\n * @alpha\n */\nexport interface ISnapshotContents {\n\tsnapshotTree: ISnapshotTree;\n\tblobs: Map<string, ArrayBuffer>;\n\tops: ISequencedDocumentMessage[];\n\n\t/**\n\t * Sequence number of the snapshot\n\t */\n\tsequenceNumber: number | undefined;\n\n\t/**\n\t * Sequence number for the latest op/snapshot for the file in ODSP\n\t */\n\tlatestSequenceNumber: number | undefined;\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IOdspSnapshot } from "./contracts";
|
|
6
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
5
|
+
import { IOdspSnapshot } from "./contracts.mjs";
|
|
6
|
+
import { ISnapshotContents } from "./odspPublicUtils.mjs";
|
|
7
7
|
/**
|
|
8
8
|
* Converts existing IOdspSnapshot to snapshot tree, blob array and ops
|
|
9
9
|
* @param odspSnapshot - snapshot
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspSnapshotParser.d.ts","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAKI,EAAE,aAAa,EAAuB;OACtC,EAAE,iBAAiB,EAAE;AAwC5B;;;GAGG;AACH,wBAAgB,yCAAyC,CACxD,YAAY,EAAE,aAAa,GACzB,iBAAiB,CA4BnB"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { stringToBuffer } from "@fluid-internal/client-utils";
|
|
6
|
+
import { assert } from "@fluidframework/core-utils";
|
|
6
7
|
/**
|
|
7
8
|
* Build a tree hierarchy base on a flat tree
|
|
8
9
|
*
|
|
@@ -13,7 +14,7 @@ import { assert, stringToBuffer } from "@fluidframework/common-utils";
|
|
|
13
14
|
function buildHierarchy(flatTree) {
|
|
14
15
|
const lookup = {};
|
|
15
16
|
// id is required for root tree as it will be used to determine the version we loaded from.
|
|
16
|
-
const root = { id: flatTree.id, blobs: {},
|
|
17
|
+
const root = { id: flatTree.id, blobs: {}, trees: {} };
|
|
17
18
|
lookup[""] = root;
|
|
18
19
|
for (const entry of flatTree.entries) {
|
|
19
20
|
const lastIndex = entry.path.lastIndexOf("/");
|
|
@@ -26,7 +27,6 @@ function buildHierarchy(flatTree) {
|
|
|
26
27
|
const newTree = {
|
|
27
28
|
blobs: {},
|
|
28
29
|
trees: {},
|
|
29
|
-
commits: {},
|
|
30
30
|
unreferenced: entry.unreferenced,
|
|
31
31
|
};
|
|
32
32
|
node.trees[decodeURIComponent(entryPathBase)] = newTree;
|
|
@@ -43,24 +43,23 @@ function buildHierarchy(flatTree) {
|
|
|
43
43
|
* @param odspSnapshot - snapshot
|
|
44
44
|
*/
|
|
45
45
|
export function convertOdspSnapshotToSnapshotTreeAndBlobs(odspSnapshot) {
|
|
46
|
-
var _a, _b;
|
|
47
46
|
const blobsWithBufferContent = new Map();
|
|
48
47
|
if (odspSnapshot.blobs) {
|
|
49
48
|
odspSnapshot.blobs.forEach((blob) => {
|
|
50
|
-
var _a;
|
|
51
49
|
assert(blob.encoding === "base64" || blob.encoding === undefined, 0x0a4 /* Unexpected blob encoding type */);
|
|
52
|
-
blobsWithBufferContent.set(blob.id, stringToBuffer(blob.content,
|
|
50
|
+
blobsWithBufferContent.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? "utf8"));
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
|
-
const sequenceNumber = odspSnapshot
|
|
53
|
+
const sequenceNumber = odspSnapshot?.trees[0].sequenceNumber;
|
|
56
54
|
const val = {
|
|
57
55
|
blobs: blobsWithBufferContent,
|
|
58
|
-
ops:
|
|
56
|
+
ops: odspSnapshot.ops?.map((op) => op.op) ?? [],
|
|
59
57
|
sequenceNumber,
|
|
60
58
|
snapshotTree: buildHierarchy(odspSnapshot.trees[0]),
|
|
61
|
-
latestSequenceNumber:
|
|
62
|
-
odspSnapshot.ops[odspSnapshot.ops.length - 1].sequenceNumber
|
|
59
|
+
latestSequenceNumber: odspSnapshot.ops && odspSnapshot.ops.length > 0
|
|
60
|
+
? odspSnapshot.ops[odspSnapshot.ops.length - 1].sequenceNumber
|
|
61
|
+
: sequenceNumber,
|
|
63
62
|
};
|
|
64
63
|
return val;
|
|
65
64
|
}
|
|
66
|
-
//# sourceMappingURL=odspSnapshotParser.
|
|
65
|
+
//# sourceMappingURL=odspSnapshotParser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspSnapshotParser.mjs","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,cAAc,EAAE,MAAM,8BAA8B;OACtD,EAAE,MAAM,EAAE,MAAM,4BAA4B;AAKnD;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,QAA6B;IACpD,MAAM,MAAM,GAA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I,GAAG,EAAuB,CAAC;IAC9D,IAAI,YAAY,CAAC,KAAK,EAAE;QACvB,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,MAAM,CACL,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EACzD,KAAK,CAAC,mCAAmC,CACzC,CAAC;YACF,sBAAsB,CAAC,GAAG,CACzB,IAAI,CAAC,EAAE,EACP,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,CACrD,CAAC;QACH,CAAC,CAAC,CAAC;KACH;IAED,MAAM,cAAc,GAAG,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IAE7D,MAAM,GAAG,GAAsB;QAC9B,KAAK,EAAE,sBAAsB;QAC7B,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE;QAC/C,cAAc;QACd,YAAY,EAAE,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnD,oBAAoB,EACnB,YAAY,CAAC,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;YAC9C,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc;YAC9D,CAAC,CAAC,cAAc;KAClB,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { IOdspSnapshot, IOdspSnapshotCommit } from \"./contracts\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\n\n/**\n * Build a tree hierarchy base on a flat tree\n *\n * @param flatTree - a flat tree\n * @param blobsShaToPathCache - Map with blobs sha as keys and values as path of the blob.\n * @returns the hierarchical tree\n */\nfunction buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {\n\tconst lookup: { [path: string]: api.ISnapshotTree } = {};\n\t// id is required for root tree as it will be used to determine the version we loaded from.\n\tconst root: api.ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };\n\tlookup[\"\"] = root;\n\n\tfor (const entry of flatTree.entries) {\n\t\tconst lastIndex = entry.path.lastIndexOf(\"/\");\n\t\tconst entryPathDir = entry.path.slice(0, Math.max(0, lastIndex));\n\t\tconst entryPathBase = entry.path.slice(lastIndex + 1);\n\n\t\t// ODSP snapshots are created breadth-first so we can assume we see tree nodes prior to their contents\n\t\tconst node = lookup[entryPathDir];\n\n\t\t// Add in either the blob or tree\n\t\tif (entry.type === \"tree\") {\n\t\t\tconst newTree: api.ISnapshotTree = {\n\t\t\t\tblobs: {},\n\t\t\t\ttrees: {},\n\t\t\t\tunreferenced: entry.unreferenced,\n\t\t\t};\n\t\t\tnode.trees[decodeURIComponent(entryPathBase)] = newTree;\n\t\t\tlookup[entry.path] = newTree;\n\t\t} else if (entry.type === \"blob\") {\n\t\t\tnode.blobs[decodeURIComponent(entryPathBase)] = entry.id;\n\t\t}\n\t}\n\n\treturn root;\n}\n\n/**\n * Converts existing IOdspSnapshot to snapshot tree, blob array and ops\n * @param odspSnapshot - snapshot\n */\nexport function convertOdspSnapshotToSnapshotTreeAndBlobs(\n\todspSnapshot: IOdspSnapshot,\n): ISnapshotContents {\n\tconst blobsWithBufferContent = new Map<string, ArrayBuffer>();\n\tif (odspSnapshot.blobs) {\n\t\todspSnapshot.blobs.forEach((blob) => {\n\t\t\tassert(\n\t\t\t\tblob.encoding === \"base64\" || blob.encoding === undefined,\n\t\t\t\t0x0a4 /* Unexpected blob encoding type */,\n\t\t\t);\n\t\t\tblobsWithBufferContent.set(\n\t\t\t\tblob.id,\n\t\t\t\tstringToBuffer(blob.content, blob.encoding ?? \"utf8\"),\n\t\t\t);\n\t\t});\n\t}\n\n\tconst sequenceNumber = odspSnapshot?.trees[0].sequenceNumber;\n\n\tconst val: ISnapshotContents = {\n\t\tblobs: blobsWithBufferContent,\n\t\tops: odspSnapshot.ops?.map((op) => op.op) ?? [],\n\t\tsequenceNumber,\n\t\tsnapshotTree: buildHierarchy(odspSnapshot.trees[0]),\n\t\tlatestSequenceNumber:\n\t\t\todspSnapshot.ops && odspSnapshot.ops.length > 0\n\t\t\t\t? odspSnapshot.ops[odspSnapshot.ops.length - 1].sequenceNumber\n\t\t\t\t: sequenceNumber,\n\t};\n\treturn val;\n}\n"]}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
5
|
import { ISummaryContext } from "@fluidframework/driver-definitions";
|
|
7
6
|
import * as api from "@fluidframework/protocol-definitions";
|
|
8
7
|
import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
|
|
9
|
-
import {
|
|
8
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
9
|
+
import { EpochTracker } from "./epochTracker.mjs";
|
|
10
10
|
/**
|
|
11
11
|
* This class manages a summary upload. When it receives a call to upload summary, it converts the summary tree into
|
|
12
12
|
* a snapshot tree and then uploads that to the server.
|
|
@@ -16,14 +16,17 @@ export declare class OdspSummaryUploadManager {
|
|
|
16
16
|
private readonly getStorageToken;
|
|
17
17
|
private readonly epochTracker;
|
|
18
18
|
private readonly forceAccessTokenViaAuthorizationHeader;
|
|
19
|
+
private readonly relayServiceTenantAndSessionId;
|
|
19
20
|
private lastSummaryProposalHandle;
|
|
20
21
|
private readonly mc;
|
|
21
|
-
constructor(snapshotUrl: string, getStorageToken: InstrumentedStorageTokenFetcher, logger:
|
|
22
|
+
constructor(snapshotUrl: string, getStorageToken: InstrumentedStorageTokenFetcher, logger: ITelemetryLoggerExt, epochTracker: EpochTracker, forceAccessTokenViaAuthorizationHeader: boolean, relayServiceTenantAndSessionId: () => string | undefined);
|
|
22
23
|
writeSummaryTree(tree: api.ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
23
24
|
private writeSummaryTreeCore;
|
|
24
25
|
/**
|
|
25
|
-
* Following are the goals of this function
|
|
26
|
-
*
|
|
26
|
+
* Following are the goals of this function:
|
|
27
|
+
*
|
|
28
|
+
* a. Converts the summary tree to a snapshot/odsp tree to be uploaded. Always upload full snapshot tree.
|
|
29
|
+
*
|
|
27
30
|
* @param parentHandle - Handle of the last uploaded summary or detach new summary.
|
|
28
31
|
* @param tree - Summary Tree which will be converted to snapshot tree to be uploaded.
|
|
29
32
|
* @param rootNodeName - Root node name of the summary tree.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspSummaryUploadManager.d.ts","sourceRoot":"","sources":["../src/odspSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,eAAe,EAAE,MAAM,oCAAoC;OAE7D,KAAK,GAAG,MAAM,sCAAsC;OACpD,EAAE,+BAA+B,EAAE,MAAM,yCAAyC;OAClF,EACN,mBAAmB,EAInB,MAAM,iCAAiC;OAUjC,EAAE,YAAY,EAAE;AAIvB;;;GAGG;AACH,qBAAa,wBAAwB;IAMnC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAEhC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,sCAAsC;IACvD,OAAO,CAAC,QAAQ,CAAC,8BAA8B;IAThD,OAAO,CAAC,yBAAyB,CAAqB;IACtD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;gBAGrB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,+BAA+B,EACjE,MAAM,EAAE,mBAAmB,EACV,YAAY,EAAE,YAAY,EAC1B,sCAAsC,EAAE,OAAO,EAC/C,8BAA8B,EAAE,MAAM,MAAM,GAAG,SAAS;IAK7D,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,eAAe;YA2BhE,oBAAoB;IAsElC;;;;;;;;;;OAUG;YACW,4BAA4B;CAyG1C"}
|
|
@@ -2,23 +2,25 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
6
|
+
import { assert, unreachableCase } from "@fluidframework/core-utils";
|
|
6
7
|
import { getGitType } from "@fluidframework/protocol-base";
|
|
7
8
|
import * as api from "@fluidframework/protocol-definitions";
|
|
8
|
-
import { loggerToMonitoringContext, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
9
|
+
import { loggerToMonitoringContext, PerformanceEvent, } from "@fluidframework/telemetry-utils";
|
|
10
|
+
import { isCombinedAppAndProtocolSummary } from "@fluidframework/driver-utils";
|
|
11
|
+
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.mjs";
|
|
12
|
+
import { getWithRetryForTokenRefresh } from "./odspUtils.mjs";
|
|
12
13
|
/**
|
|
13
14
|
* This class manages a summary upload. When it receives a call to upload summary, it converts the summary tree into
|
|
14
15
|
* a snapshot tree and then uploads that to the server.
|
|
15
16
|
*/
|
|
16
17
|
export class OdspSummaryUploadManager {
|
|
17
|
-
constructor(snapshotUrl, getStorageToken, logger, epochTracker, forceAccessTokenViaAuthorizationHeader) {
|
|
18
|
+
constructor(snapshotUrl, getStorageToken, logger, epochTracker, forceAccessTokenViaAuthorizationHeader, relayServiceTenantAndSessionId) {
|
|
18
19
|
this.snapshotUrl = snapshotUrl;
|
|
19
20
|
this.getStorageToken = getStorageToken;
|
|
20
21
|
this.epochTracker = epochTracker;
|
|
21
22
|
this.forceAccessTokenViaAuthorizationHeader = forceAccessTokenViaAuthorizationHeader;
|
|
23
|
+
this.relayServiceTenantAndSessionId = relayServiceTenantAndSessionId;
|
|
22
24
|
this.mc = loggerToMonitoringContext(logger);
|
|
23
25
|
}
|
|
24
26
|
async writeSummaryTree(tree, context) {
|
|
@@ -42,7 +44,7 @@ export class OdspSummaryUploadManager {
|
|
|
42
44
|
return id;
|
|
43
45
|
}
|
|
44
46
|
async writeSummaryTreeCore(parentHandle, referenceSequenceNumber, tree) {
|
|
45
|
-
const containsProtocolTree =
|
|
47
|
+
const containsProtocolTree = isCombinedAppAndProtocolSummary(tree);
|
|
46
48
|
const { snapshotTree, blobs } = await this.convertSummaryToSnapshotTree(parentHandle, tree, ".app");
|
|
47
49
|
const snapshot = {
|
|
48
50
|
entries: snapshotTree.entries,
|
|
@@ -56,8 +58,11 @@ export class OdspSummaryUploadManager {
|
|
|
56
58
|
const storageToken = await this.getStorageToken(options, "WriteSummaryTree");
|
|
57
59
|
const { url, headers } = getUrlAndHeadersWithAuth(`${this.snapshotUrl}/snapshot`, storageToken, this.forceAccessTokenViaAuthorizationHeader);
|
|
58
60
|
headers["Content-Type"] = "application/json";
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
const relayServiceTenantAndSessionId = this.relayServiceTenantAndSessionId();
|
|
62
|
+
// This would be undefined in case of summary is uploaded in detached container with attachment
|
|
63
|
+
// blobs flow where summary is uploaded without connecting to push.
|
|
64
|
+
if (relayServiceTenantAndSessionId !== undefined) {
|
|
65
|
+
headers["If-Match"] = `fluid:sessionid=${relayServiceTenantAndSessionId}${parentHandle ? `;containerid=${parentHandle}` : ""}`;
|
|
61
66
|
}
|
|
62
67
|
const postBody = JSON.stringify(snapshot);
|
|
63
68
|
return PerformanceEvent.timedExecAsync(this.mc.logger, {
|
|
@@ -81,17 +86,17 @@ export class OdspSummaryUploadManager {
|
|
|
81
86
|
});
|
|
82
87
|
}
|
|
83
88
|
/**
|
|
84
|
-
* Following are the goals of this function
|
|
85
|
-
*
|
|
89
|
+
* Following are the goals of this function:
|
|
90
|
+
*
|
|
91
|
+
* a. Converts the summary tree to a snapshot/odsp tree to be uploaded. Always upload full snapshot tree.
|
|
92
|
+
*
|
|
86
93
|
* @param parentHandle - Handle of the last uploaded summary or detach new summary.
|
|
87
94
|
* @param tree - Summary Tree which will be converted to snapshot tree to be uploaded.
|
|
88
95
|
* @param rootNodeName - Root node name of the summary tree.
|
|
89
96
|
* @param path - Current path of node which is getting evaluated.
|
|
90
97
|
* @param markUnreferencedNodes - True if we should mark unreferenced nodes.
|
|
91
98
|
*/
|
|
92
|
-
async convertSummaryToSnapshotTree(parentHandle, tree, rootNodeName, markUnreferencedNodes) {
|
|
93
|
-
var _a;
|
|
94
|
-
if (markUnreferencedNodes === void 0) { markUnreferencedNodes = (_a = this.mc.config.getBoolean("Fluid.Driver.Odsp.MarkUnreferencedNodes")) !== null && _a !== void 0 ? _a : true; }
|
|
99
|
+
async convertSummaryToSnapshotTree(parentHandle, tree, rootNodeName, markUnreferencedNodes = this.mc.config.getBoolean("Fluid.Driver.Odsp.MarkUnreferencedNodes") ?? true) {
|
|
95
100
|
const snapshotTree = {
|
|
96
101
|
type: "tree",
|
|
97
102
|
entries: [],
|
|
@@ -115,20 +120,18 @@ export class OdspSummaryUploadManager {
|
|
|
115
120
|
break;
|
|
116
121
|
}
|
|
117
122
|
case api.SummaryType.Blob: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
};
|
|
131
|
-
}
|
|
123
|
+
value =
|
|
124
|
+
typeof summaryObject.content === "string"
|
|
125
|
+
? {
|
|
126
|
+
type: "blob",
|
|
127
|
+
content: summaryObject.content,
|
|
128
|
+
encoding: "utf-8",
|
|
129
|
+
}
|
|
130
|
+
: {
|
|
131
|
+
type: "blob",
|
|
132
|
+
content: Uint8ArrayToString(summaryObject.content, "base64"),
|
|
133
|
+
encoding: "base64",
|
|
134
|
+
};
|
|
132
135
|
blobs++;
|
|
133
136
|
break;
|
|
134
137
|
}
|
|
@@ -159,10 +162,17 @@ export class OdspSummaryUploadManager {
|
|
|
159
162
|
let entry;
|
|
160
163
|
if (value) {
|
|
161
164
|
assert(id === undefined, 0x0ad /* "Snapshot entry has both a tree value and a referenced id!" */);
|
|
162
|
-
entry =
|
|
165
|
+
entry = {
|
|
166
|
+
value,
|
|
167
|
+
...baseEntry,
|
|
168
|
+
unreferenced,
|
|
169
|
+
};
|
|
163
170
|
}
|
|
164
171
|
else if (id) {
|
|
165
|
-
entry =
|
|
172
|
+
entry = {
|
|
173
|
+
...baseEntry,
|
|
174
|
+
id,
|
|
175
|
+
};
|
|
166
176
|
}
|
|
167
177
|
else {
|
|
168
178
|
throw new Error(`Invalid tree entry for ${summaryObject.type}`);
|
|
@@ -172,5 +182,4 @@ export class OdspSummaryUploadManager {
|
|
|
172
182
|
return { snapshotTree, blobs };
|
|
173
183
|
}
|
|
174
184
|
}
|
|
175
|
-
|
|
176
|
-
//# sourceMappingURL=odspSummaryUploadManager.js.map
|
|
185
|
+
//# sourceMappingURL=odspSummaryUploadManager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odspSummaryUploadManager.mjs","sourceRoot":"","sources":["../src/odspSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,kBAAkB,EAAE,MAAM,8BAA8B;OAC1D,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,4BAA4B;OAE7D,EAAE,UAAU,EAAE,MAAM,+BAA+B;OACnD,KAAK,GAAG,MAAM,sCAAsC;OAEpD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AAM,CAAC;oBACtC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;wBACzD,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;qBAC9B;oBACD,MAAM,OAAO,GAAG,GAAG,YAAY,GAAG,UAAU,EAAE,CAAC;oBAC/C,EAAE,GAAG,GAAG,YAAY,IAAI,OAAO,EAAE,CAAC;oBAClC,MAAM;iBACN;gBACD,KAAK,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;oBAChC,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC;oBACtB,MAAM;iBACN;gBACD,OAAO,CAAC,CAAC;oBACR,eAAe,CAAC,aAAa,EAAE,iBAAkB,aAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;iBAC/E;aACD;YAED,MAAM,SAAS,GAA8B;gBAC5C,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;gBAC7B,IAAI,EAAE,UAAU,CAAC,aAAa,CAAC;aAC/B,CAAC;YAEF,IAAI,KAA2B,CAAC;YAEhC,IAAI,KAAK,EAAE;gBACV,MAAM,CACL,EAAE,KAAK,SAAS,EAChB,KAAK,CAAC,iEAAiE,CACvE,CAAC;gBACF,KAAK,GAAG;oBACP,KAAK;oBACL,GAAG,SAAS;oBACZ,YAAY;iBACZ,CAAC;aACF;iBAAM,IAAI,EAAE,EAAE;gBACd,KAAK,GAAG;oBACP,GAAG,SAAS;oBACZ,EAAE;iBACF,CAAC;aACF;iBAAM;gBACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;aAChE;YAED,YAAY,CAAC,OAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAClC;QAED,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport { getGitType } from \"@fluidframework/protocol-base\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { isCombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport {\n\tIOdspSummaryPayload,\n\tIWriteSummaryResponse,\n\tIOdspSummaryTree,\n\tIOdspSummaryTreeBaseEntry,\n\tOdspSummaryTreeEntry,\n\tOdspSummaryTreeValue,\n} from \"./contracts\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport { getWithRetryForTokenRefresh } from \"./odspUtils\";\n\n/**\n * This class manages a summary upload. When it receives a call to upload summary, it converts the summary tree into\n * a snapshot tree and then uploads that to the server.\n */\nexport class OdspSummaryUploadManager {\n\t// Last proposed handle of the uploaded app summary.\n\tprivate lastSummaryProposalHandle: string | undefined;\n\tprivate readonly mc: MonitoringContext;\n\n\tconstructor(\n\t\tprivate readonly snapshotUrl: string,\n\t\tprivate readonly getStorageToken: InstrumentedStorageTokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly forceAccessTokenViaAuthorizationHeader: boolean,\n\t\tprivate readonly relayServiceTenantAndSessionId: () => string | undefined,\n\t) {\n\t\tthis.mc = loggerToMonitoringContext(logger);\n\t}\n\n\tpublic async writeSummaryTree(tree: api.ISummaryTree, context: ISummaryContext) {\n\t\t// If the last proposed handle is not the proposed handle of the acked summary(could happen when the last summary get nacked),\n\t\t// then re-initialize the caches with the previous ones else just update the previous caches with the caches from acked summary.\n\t\t// Don't bother logging if lastSummaryProposalHandle hasn't been set before; only log on a positive mismatch.\n\t\tif (\n\t\t\tthis.lastSummaryProposalHandle !== undefined &&\n\t\t\tthis.lastSummaryProposalHandle !== context.proposalHandle\n\t\t) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"LastSummaryProposedHandleMismatch\",\n\t\t\t\tackedSummaryProposedHandle: context.proposalHandle,\n\t\t\t\tlastSummaryProposalHandle: this.lastSummaryProposalHandle,\n\t\t\t});\n\t\t}\n\t\tconst result = await this.writeSummaryTreeCore(\n\t\t\tcontext.ackHandle,\n\t\t\tcontext.referenceSequenceNumber,\n\t\t\ttree,\n\t\t);\n\t\tconst id = result ? result.id : undefined;\n\t\tif (!result || !id) {\n\t\t\tthrow new Error(`Failed to write summary tree`);\n\t\t}\n\t\tthis.lastSummaryProposalHandle = id;\n\t\treturn id;\n\t}\n\n\tprivate async writeSummaryTreeCore(\n\t\tparentHandle: string | undefined,\n\t\treferenceSequenceNumber: number,\n\t\ttree: api.ISummaryTree,\n\t): Promise<IWriteSummaryResponse> {\n\t\tconst containsProtocolTree = isCombinedAppAndProtocolSummary(tree);\n\t\tconst { snapshotTree, blobs } = await this.convertSummaryToSnapshotTree(\n\t\t\tparentHandle,\n\t\t\ttree,\n\t\t\t\".app\",\n\t\t);\n\t\tconst snapshot: IOdspSummaryPayload = {\n\t\t\tentries: snapshotTree.entries!,\n\t\t\tmessage: \"app\",\n\t\t\tsequenceNumber: referenceSequenceNumber,\n\t\t\t// no ack handle implies this is initial summary after empty file creation.\n\t\t\t// send container payload so server will use it without a summary op\n\t\t\ttype: containsProtocolTree || parentHandle === undefined ? \"container\" : \"channel\",\n\t\t};\n\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"WriteSummaryTree\");\n\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.snapshotUrl}/snapshot`,\n\t\t\t\tstorageToken,\n\t\t\t\tthis.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\t\t\theaders[\"Content-Type\"] = \"application/json\";\n\t\t\tconst relayServiceTenantAndSessionId = this.relayServiceTenantAndSessionId();\n\t\t\t// This would be undefined in case of summary is uploaded in detached container with attachment\n\t\t\t// blobs flow where summary is uploaded without connecting to push.\n\t\t\tif (relayServiceTenantAndSessionId !== undefined) {\n\t\t\t\theaders[\"If-Match\"] = `fluid:sessionid=${relayServiceTenantAndSessionId}${\n\t\t\t\t\tparentHandle ? `;containerid=${parentHandle}` : \"\"\n\t\t\t\t}`;\n\t\t\t}\n\n\t\t\tconst postBody = JSON.stringify(snapshot);\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"uploadSummary\",\n\t\t\t\t\tattempt: options.refresh ? 2 : 1,\n\t\t\t\t\thasClaims: !!options.claims,\n\t\t\t\t\thasTenantId: !!options.tenantId,\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t\tblobs,\n\t\t\t\t\tsize: postBody.length,\n\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\ttype: snapshot.type,\n\t\t\t\t},\n\t\t\t\tasync () => {\n\t\t\t\t\tconst response =\n\t\t\t\t\t\tawait this.epochTracker.fetchAndParseAsJSON<IWriteSummaryResponse>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: postBody,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"uploadSummary\",\n\t\t\t\t\t\t);\n\t\t\t\t\treturn response.content;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Following are the goals of this function:\n\t *\n\t * a. Converts the summary tree to a snapshot/odsp tree to be uploaded. Always upload full snapshot tree.\n\t *\n\t * @param parentHandle - Handle of the last uploaded summary or detach new summary.\n\t * @param tree - Summary Tree which will be converted to snapshot tree to be uploaded.\n\t * @param rootNodeName - Root node name of the summary tree.\n\t * @param path - Current path of node which is getting evaluated.\n\t * @param markUnreferencedNodes - True if we should mark unreferenced nodes.\n\t */\n\tprivate async convertSummaryToSnapshotTree(\n\t\tparentHandle: string | undefined,\n\t\ttree: api.ISummaryTree,\n\t\trootNodeName: string,\n\t\tmarkUnreferencedNodes: boolean = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.MarkUnreferencedNodes\",\n\t\t) ?? true,\n\t) {\n\t\tconst snapshotTree: IOdspSummaryTree = {\n\t\t\ttype: \"tree\",\n\t\t\tentries: [] as OdspSummaryTreeEntry[],\n\t\t};\n\n\t\tlet blobs = 0;\n\t\tconst keys = Object.keys(tree.tree);\n\t\tfor (const key of keys) {\n\t\t\tconst summaryObject = tree.tree[key];\n\n\t\t\tlet id: string | undefined;\n\t\t\tlet value: OdspSummaryTreeValue | undefined;\n\n\t\t\t// Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the\n\t\t\t// property is not present, the tree entry is considered referenced. If the property is present and is\n\t\t\t// true (which is the only value it can have), the tree entry is considered unreferenced.\n\t\t\tlet unreferenced: true | undefined;\n\t\t\tswitch (summaryObject.type) {\n\t\t\t\tcase api.SummaryType.Tree: {\n\t\t\t\t\tconst result = await this.convertSummaryToSnapshotTree(\n\t\t\t\t\t\tparentHandle,\n\t\t\t\t\t\tsummaryObject,\n\t\t\t\t\t\trootNodeName,\n\t\t\t\t\t);\n\t\t\t\t\tvalue = result.snapshotTree;\n\t\t\t\t\tunreferenced = markUnreferencedNodes ? summaryObject.unreferenced : undefined;\n\t\t\t\t\tblobs += result.blobs;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase api.SummaryType.Blob: {\n\t\t\t\t\tvalue =\n\t\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\ttype: \"blob\",\n\t\t\t\t\t\t\t\t\tcontent: summaryObject.content,\n\t\t\t\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\ttype: \"blob\",\n\t\t\t\t\t\t\t\t\tcontent: Uint8ArrayToString(summaryObject.content, \"base64\"),\n\t\t\t\t\t\t\t\t\tencoding: \"base64\",\n\t\t\t\t\t\t\t };\n\t\t\t\t\tblobs++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase api.SummaryType.Handle: {\n\t\t\t\t\tif (!parentHandle) {\n\t\t\t\t\t\tthrow Error(\"Parent summary does not exist to reference by handle.\");\n\t\t\t\t\t}\n\t\t\t\t\tlet handlePath = summaryObject.handle;\n\t\t\t\t\tif (handlePath.length > 0 && !handlePath.startsWith(\"/\")) {\n\t\t\t\t\t\thandlePath = `/${handlePath}`;\n\t\t\t\t\t}\n\t\t\t\t\tconst pathKey = `${rootNodeName}${handlePath}`;\n\t\t\t\t\tid = `${parentHandle}/${pathKey}`;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase api.SummaryType.Attachment: {\n\t\t\t\t\tid = summaryObject.id;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(summaryObject, `Unknown type: ${(summaryObject as any).type}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst baseEntry: IOdspSummaryTreeBaseEntry = {\n\t\t\t\tpath: encodeURIComponent(key),\n\t\t\t\ttype: getGitType(summaryObject),\n\t\t\t};\n\n\t\t\tlet entry: OdspSummaryTreeEntry;\n\n\t\t\tif (value) {\n\t\t\t\tassert(\n\t\t\t\t\tid === undefined,\n\t\t\t\t\t0x0ad /* \"Snapshot entry has both a tree value and a referenced id!\" */,\n\t\t\t\t);\n\t\t\t\tentry = {\n\t\t\t\t\tvalue,\n\t\t\t\t\t...baseEntry,\n\t\t\t\t\tunreferenced,\n\t\t\t\t};\n\t\t\t} else if (id) {\n\t\t\t\tentry = {\n\t\t\t\t\t...baseEntry,\n\t\t\t\t\tid,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Invalid tree entry for ${summaryObject.type}`);\n\t\t\t}\n\n\t\t\tsnapshotTree.entries!.push(entry);\n\t\t}\n\n\t\treturn { snapshotTree, blobs };\n\t}\n}\n"]}
|