@fluidframework/odsp-driver 2.50.0 → 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +12 -0
- package/CHANGELOG.md +4 -0
- package/dist/checkUrl.d.ts +1 -1
- package/dist/checkUrl.d.ts.map +1 -1
- package/dist/checkUrl.js.map +1 -1
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts +1 -1
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/contractsPublic.d.ts +18 -2
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/contractsPublic.js +12 -1
- package/dist/contractsPublic.js.map +1 -1
- package/dist/createFile/createFile.d.ts +6 -6
- package/dist/createFile/createFile.d.ts.map +1 -1
- package/dist/createFile/createFile.js.map +1 -1
- package/dist/createFile/createNewContainerOnExistingFile.d.ts +6 -6
- package/dist/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/createFile/createNewContainerOnExistingFile.js +11 -2
- package/dist/createFile/createNewContainerOnExistingFile.js.map +1 -1
- package/dist/createFile/createNewUtils.d.ts +9 -6
- package/dist/createFile/createNewUtils.d.ts.map +1 -1
- package/dist/createFile/createNewUtils.js +19 -8
- package/dist/createFile/createNewUtils.js.map +1 -1
- package/dist/createFile/index.d.ts +1 -1
- package/dist/createFile/index.d.ts.map +1 -1
- package/dist/createFile/index.js.map +1 -1
- package/dist/createOdspCreateContainerRequest.d.ts +2 -2
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/createOdspCreateContainerRequest.js.map +1 -1
- package/dist/createOdspUrl.d.ts +1 -1
- package/dist/createOdspUrl.d.ts.map +1 -1
- package/dist/createOdspUrl.js.map +1 -1
- package/dist/epochTracker.d.ts +4 -4
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts +6 -6
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +7 -0
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts +2 -2
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js.map +1 -1
- package/dist/getQueryString.d.ts +1 -1
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/getQueryString.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -4
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/dist/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
- package/dist/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
- package/dist/odspCache.d.ts +2 -2
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +6 -6
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +9 -0
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDeltaStorageService.d.ts +6 -6
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts +5 -5
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts +6 -6
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.d.ts +2 -2
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +7 -7
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +1 -1
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +9 -9
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +3 -3
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +3 -3
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +3 -0
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +4 -4
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspError.d.ts +3 -3
- package/dist/odspError.d.ts.map +1 -1
- package/dist/odspError.js.map +1 -1
- package/dist/odspFluidFileLink.d.ts +1 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspFluidFileLink.js.map +1 -1
- package/dist/odspLayerCompatState.d.ts +1 -1
- package/dist/odspLayerCompatState.d.ts.map +1 -1
- package/dist/odspLayerCompatState.js.map +1 -1
- package/dist/odspLocationRedirection.d.ts +2 -2
- package/dist/odspLocationRedirection.d.ts.map +1 -1
- package/dist/odspLocationRedirection.js.map +1 -1
- package/dist/odspPublicUtils.d.ts +1 -1
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts +2 -2
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspSummaryUploadManager.d.ts +5 -5
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUrlHelper.d.ts +1 -1
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/odspUrlHelper.js.map +1 -1
- package/dist/odspUtils.d.ts +5 -5
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js.map +1 -1
- package/dist/opsCaching.d.ts +1 -1
- package/dist/opsCaching.d.ts.map +1 -1
- package/dist/opsCaching.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/prefetchLatestSnapshot.d.ts +5 -5
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/dist/retryErrorsStorageAdapter.d.ts +4 -4
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.d.ts +1 -1
- package/dist/retryUtils.d.ts.map +1 -1
- package/dist/retryUtils.js.map +1 -1
- package/dist/vroom.d.ts +4 -4
- package/dist/vroom.d.ts.map +1 -1
- package/dist/vroom.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts +2 -2
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/checkUrl.d.ts +1 -1
- package/lib/checkUrl.d.ts.map +1 -1
- package/lib/checkUrl.js.map +1 -1
- package/lib/compactSnapshotParser.d.ts +2 -2
- package/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/compactSnapshotWriter.d.ts +1 -1
- package/lib/compactSnapshotWriter.d.ts.map +1 -1
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/contracts.d.ts +3 -3
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/contractsPublic.d.ts +18 -2
- package/lib/contractsPublic.d.ts.map +1 -1
- package/lib/contractsPublic.js +11 -0
- package/lib/contractsPublic.js.map +1 -1
- package/lib/createFile/createFile.d.ts +6 -6
- package/lib/createFile/createFile.d.ts.map +1 -1
- package/lib/createFile/createFile.js.map +1 -1
- package/lib/createFile/createNewContainerOnExistingFile.d.ts +6 -6
- package/lib/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/lib/createFile/createNewContainerOnExistingFile.js +12 -3
- package/lib/createFile/createNewContainerOnExistingFile.js.map +1 -1
- package/lib/createFile/createNewUtils.d.ts +9 -6
- package/lib/createFile/createNewUtils.d.ts.map +1 -1
- package/lib/createFile/createNewUtils.js +19 -8
- package/lib/createFile/createNewUtils.js.map +1 -1
- package/lib/createFile/index.d.ts +1 -1
- package/lib/createFile/index.d.ts.map +1 -1
- package/lib/createFile/index.js.map +1 -1
- package/lib/createOdspCreateContainerRequest.d.ts +2 -2
- package/lib/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/lib/createOdspCreateContainerRequest.js.map +1 -1
- package/lib/createOdspUrl.d.ts +1 -1
- package/lib/createOdspUrl.d.ts.map +1 -1
- package/lib/createOdspUrl.js.map +1 -1
- package/lib/epochTracker.d.ts +4 -4
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js.map +1 -1
- package/lib/fetchSnapshot.d.ts +6 -6
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js +7 -0
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/getFileLink.d.ts +2 -2
- package/lib/getFileLink.d.ts.map +1 -1
- package/lib/getFileLink.js.map +1 -1
- package/lib/getQueryString.d.ts +1 -1
- package/lib/getQueryString.d.ts.map +1 -1
- package/lib/getQueryString.js.map +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.ts +4 -4
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/lib/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
- package/lib/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
- package/lib/odspCache.d.ts +2 -2
- package/lib/odspCache.d.ts.map +1 -1
- package/lib/odspCache.js.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts +6 -6
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.js +9 -0
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
- package/lib/odspDeltaStorageService.d.ts +6 -6
- package/lib/odspDeltaStorageService.d.ts.map +1 -1
- package/lib/odspDeltaStorageService.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts +5 -5
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.d.ts +6 -6
- package/lib/odspDocumentService.d.ts.map +1 -1
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactory.d.ts +2 -2
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactory.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +7 -7
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js +1 -1
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts +9 -9
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts +3 -3
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.js.map +1 -1
- package/lib/odspDriverUrlResolver.d.ts +3 -3
- package/lib/odspDriverUrlResolver.d.ts.map +1 -1
- package/lib/odspDriverUrlResolver.js +4 -1
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts +4 -4
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspError.d.ts +3 -3
- package/lib/odspError.d.ts.map +1 -1
- package/lib/odspError.js +1 -1
- package/lib/odspError.js.map +1 -1
- package/lib/odspFluidFileLink.d.ts +1 -1
- package/lib/odspFluidFileLink.d.ts.map +1 -1
- package/lib/odspFluidFileLink.js.map +1 -1
- package/lib/odspLayerCompatState.d.ts +1 -1
- package/lib/odspLayerCompatState.d.ts.map +1 -1
- package/lib/odspLayerCompatState.js.map +1 -1
- package/lib/odspLocationRedirection.d.ts +2 -2
- package/lib/odspLocationRedirection.d.ts.map +1 -1
- package/lib/odspLocationRedirection.js.map +1 -1
- package/lib/odspPublicUtils.d.ts +1 -1
- package/lib/odspPublicUtils.d.ts.map +1 -1
- package/lib/odspPublicUtils.js.map +1 -1
- package/lib/odspSnapshotParser.d.ts +2 -2
- package/lib/odspSnapshotParser.d.ts.map +1 -1
- package/lib/odspSnapshotParser.js.map +1 -1
- package/lib/odspSummaryUploadManager.d.ts +5 -5
- package/lib/odspSummaryUploadManager.d.ts.map +1 -1
- package/lib/odspSummaryUploadManager.js +1 -1
- package/lib/odspSummaryUploadManager.js.map +1 -1
- package/lib/odspUrlHelper.d.ts +1 -1
- package/lib/odspUrlHelper.d.ts.map +1 -1
- package/lib/odspUrlHelper.js.map +1 -1
- package/lib/odspUtils.d.ts +5 -5
- package/lib/odspUtils.d.ts.map +1 -1
- package/lib/odspUtils.js.map +1 -1
- package/lib/opsCaching.d.ts +1 -1
- package/lib/opsCaching.d.ts.map +1 -1
- package/lib/opsCaching.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/prefetchLatestSnapshot.d.ts +5 -5
- package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
- package/lib/prefetchLatestSnapshot.js.map +1 -1
- package/lib/retryErrorsStorageAdapter.d.ts +4 -4
- package/lib/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/lib/retryErrorsStorageAdapter.js.map +1 -1
- package/lib/retryUtils.d.ts +1 -1
- package/lib/retryUtils.d.ts.map +1 -1
- package/lib/retryUtils.js.map +1 -1
- package/lib/vroom.d.ts +4 -4
- package/lib/vroom.d.ts.map +1 -1
- package/lib/vroom.js.map +1 -1
- package/lib/zipItDataRepresentationUtils.d.ts +2 -2
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +13 -14
- package/src/checkUrl.ts +1 -1
- package/src/compactSnapshotParser.ts +4 -4
- package/src/compactSnapshotWriter.ts +2 -2
- package/src/contracts.ts +3 -3
- package/src/contractsPublic.ts +20 -2
- package/src/createFile/createFile.ts +10 -10
- package/src/createFile/createNewContainerOnExistingFile.ts +20 -9
- package/src/createFile/createNewUtils.ts +27 -15
- package/src/createFile/index.ts +2 -1
- package/src/createOdspCreateContainerRequest.ts +2 -2
- package/src/createOdspUrl.ts +1 -1
- package/src/epochTracker.ts +11 -11
- package/src/fetchSnapshot.ts +20 -13
- package/src/getFileLink.ts +4 -4
- package/src/getQueryString.ts +1 -1
- package/src/index.ts +10 -10
- package/src/localOdspDriver/localOdspDeltaStorageService.ts +2 -2
- package/src/localOdspDriver/localOdspDocumentService.ts +4 -4
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +8 -5
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +4 -4
- package/src/localOdspDriver/localOdspLayerCompatState.ts +1 -1
- package/src/odspCache.ts +7 -7
- package/src/odspDelayLoadedDeltaStream.ts +24 -14
- package/src/odspDeltaStorageService.ts +8 -8
- package/src/odspDocumentDeltaConnection.ts +9 -9
- package/src/odspDocumentService.ts +8 -8
- package/src/odspDocumentServiceFactory.ts +2 -2
- package/src/odspDocumentServiceFactoryCore.ts +20 -19
- package/src/odspDocumentStorageManager.ts +18 -18
- package/src/odspDocumentStorageServiceBase.ts +13 -13
- package/src/odspDriverUrlResolver.ts +9 -6
- package/src/odspDriverUrlResolverForShareLink.ts +5 -5
- package/src/odspError.ts +6 -3
- package/src/odspFluidFileLink.ts +1 -1
- package/src/odspLayerCompatState.ts +1 -1
- package/src/odspLocationRedirection.ts +2 -2
- package/src/odspPublicUtils.ts +1 -1
- package/src/odspSnapshotParser.ts +2 -2
- package/src/odspSummaryUploadManager.ts +11 -7
- package/src/odspUrlHelper.ts +1 -1
- package/src/odspUtils.ts +13 -13
- package/src/opsCaching.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +13 -13
- package/src/retryErrorsStorageAdapter.ts +4 -4
- package/src/retryUtils.ts +1 -1
- package/src/vroom.ts +5 -5
- package/src/zipItDataRepresentationUtils.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDriverUrlResolverForShareLink.js","sourceRoot":"","sources":["../src/odspDriverUrlResolverForShareLink.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAmE;AAcnE,6DAAoF;AACpF,yDAAmD;AACnD,qDAA+C;AAC/C,yEAAmE;AACnE,iEAIgC;AAChC,iDAKwB;AAkBxB;;;;;;GAMG;AACH,MAAa,iCAAiC;IAK7C;;;;;;;;;;;;OAYG;IACH,YACC,qBAAyD,EACzD,MAA6B,EACZ,OAAgB,EAChB,UAGe,EACf,oBAA4C;QAL5C,YAAO,GAAP,OAAO,CAAS;QAChB,eAAU,GAAV,UAAU,CAGK;QACf,yBAAoB,GAApB,oBAAoB,CAAwB;QAxB7C,qBAAgB,GAAG,IAAI,uBAAY,EAAkB,CAAC;QA0BtE,IAAI,CAAC,MAAM,GAAG,IAAA,+BAAgB,EAAC,MAAM,CAAC,CAAC;QACvC,IAAI,qBAAqB,EAAE,CAAC;YAC3B,IAAI,CAAC,qBAAqB,GAAG;gBAC5B,GAAG,qBAAqB;gBACxB,YAAY,EAAE,qBAAqB,CAAC,YAAY;aAChD,CAAC;QACH,CAAC;IACF,CAAC;IAED;;;OAGG;IACI,mBAAmB,CAAC,UAAe,EAAE,YAAoB;QAC/D,MAAM,SAAS,GAAG,IAAA,4CAAqB,EAAC,UAAU,CAAC,CAAC;QAEpD,IAAI,CAAC,SAAS,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;QACL,MAAM,oBAAoB,GACzB,IAAA,sCAAuB,EAAC,iBAAiB,CAAC;YAC1C,eAAe,CAAC,QAAQ,EAAE,oBAAoB;YAC9C,IAAA,sCAAuB,EAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAEpD,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAEvC,OAAO,IAAA,6BAAc,EAAC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAC9B,OAAe,EACf,UAAqC;QAErC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAE7B,IAAA,4CAAqB,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEvC,OAAO,GAAG,CAAC,IAAI,CAAC;IACjB,CAAC;CACD;AA5OD,8EA4OC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIOdspResolvedUrl,\n\tIdentityType,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { OdspFluidDataStoreLocator, SharingLinkHeader } from \"./contractsPublic.js\";\nimport { createOdspUrl } from \"./createOdspUrl.js\";\nimport { getFileLink } from \"./getFileLink.js\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver.js\";\nimport {\n\tgetLocatorFromOdspUrl,\n\tlocatorQueryParamName,\n\tstoreLocatorInOdspUrl,\n} from \"./odspFluidFileLink.js\";\nimport {\n\tappendNavParam,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\tgetContainerPackageName,\n} from \"./odspUtils.js\";\n\n/**\n * Properties passed to the code responsible for fetching share link for a file.\n * @legacy\n * @alpha\n */\nexport interface ShareLinkFetcherProps {\n\t/**\n\t * Callback method that is used to fetch access token necessary to call API that produces share link\n\t */\n\ttokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>;\n\t/**\n\t * Identity type determining the shape of share link as it differs for Enterprise and Consumer users.\n\t */\n\tidentityType: IdentityType;\n}\n\n/**\n * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner\n * url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param.\n * This resolver also handles share links and try to generate one for the use by the app.\n * @legacy\n * @alpha\n */\nexport class OdspDriverUrlResolverForShareLink implements IUrlResolver {\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate readonly sharingLinkCache = new PromiseCache<string, string>();\n\tprivate readonly shareLinkFetcherProps: ShareLinkFetcherProps | undefined;\n\n\t/**\n\t * Creates url resolver instance\n\t * @param shareLinkFetcherProps - properties used when fetching share link.\n\t * Can be set as 'undefined' for cases where share link is not needed. Currently, only\n\t * getAbsoluteUrl() method requires share link.\n\t * @param logger - logger object that is used as telemetry sink\n\t * @param appName - application name hint that is encoded with url produced by getAbsoluteUrl() method.\n\t * This hint is used by link handling logic which determines which app to redirect to when user\n\t * navigates directly to the link.\n\t * @param getContext - callback function which is used to get context for given resolved url. If context\n\t * is returned then it will be embedded into url returned by getAbsoluteUrl() method.\n\t * @param containerPackageInfo - container package information which will be used to extract the container package name.\n\t */\n\tpublic constructor(\n\t\tshareLinkFetcherProps?: ShareLinkFetcherProps | undefined,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tprivate readonly appName?: string,\n\t\tprivate readonly getContext?: (\n\t\t\tresolvedUrl: IOdspResolvedUrl,\n\t\t\tdataStorePath: string,\n\t\t) => Promise<string | undefined>,\n\t\tprivate readonly containerPackageInfo?: IContainerPackageInfo,\n\t) {\n\t\tthis.logger = createOdspLogger(logger);\n\t\tif (shareLinkFetcherProps) {\n\t\t\tthis.shareLinkFetcherProps = {\n\t\t\t\t...shareLinkFetcherProps,\n\t\t\t\ttokenFetcher: shareLinkFetcherProps.tokenFetcher,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Takes an already generated data store url (from requestUrl) and appends a path to the\n\t * existing data store information.\n\t */\n\tpublic appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined {\n\t\tconst fluidInfo = getLocatorFromOdspUrl(requestUrl);\n\n\t\tif (!fluidInfo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parsingUrl = new URL(\n\t\t\tfluidInfo.dataStorePath,\n\t\t\t`${requestUrl.protocol}//${requestUrl.hostname}`,\n\t\t);\n\t\t// Determine if the caller is passing a query parameter or path since processing will be different.\n\t\tif (pathToAppend.startsWith(\"/?\") || pathToAppend.startsWith(\"?\")) {\n\t\t\tconst queryParams = new URLSearchParams(pathToAppend);\n\t\t\tfor (const [key, value] of queryParams.entries()) {\n\t\t\t\tparsingUrl.searchParams.append(key, value);\n\t\t\t}\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${parsingUrl.search}`;\n\t\t} else {\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${\n\t\t\t\tparsingUrl.pathname.endsWith(\"/\") || pathToAppend.startsWith(\"/\") ? \"\" : \"/\"\n\t\t\t}${pathToAppend}/${parsingUrl.search}`;\n\t\t}\n\t\tstoreLocatorInOdspUrl(requestUrl, fluidInfo);\n\n\t\treturn requestUrl.href;\n\t}\n\n\tprivate getKey(resolvedUrl: IOdspResolvedUrl): string {\n\t\treturn `${resolvedUrl.siteUrl},${resolvedUrl.driveId},${resolvedUrl.itemId}`;\n\t}\n\n\t/**\n\t * Resolves request URL into driver details\n\t */\n\tpublic async resolve(request: IRequest): Promise<IOdspResolvedUrl> {\n\t\tconst requestToBeResolved = { headers: request.headers, url: request.url };\n\t\tconst isSharingLinkToRedeem =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isSharingLinkToRedeem];\n\t\tconst isRedemptionNonDurable =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isRedemptionNonDurable];\n\t\ttry {\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconst odspFluidInfo = getLocatorFromOdspUrl(url);\n\t\t\tif (odspFluidInfo) {\n\t\t\t\trequestToBeResolved.url = createOdspUrl(odspFluidInfo);\n\t\t\t}\n\t\t} catch {\n\t\t\t// If the locator throws some error, then try to resolve the request as it is.\n\t\t}\n\n\t\tconst odspResolvedUrl = await new OdspDriverUrlResolver().resolve(requestToBeResolved);\n\n\t\todspResolvedUrl.context = await this.getContext?.(\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"\",\n\t\t);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t\t? odspResolvedUrl.codeHint\n\t\t\t: { containerPackageName: getContainerPackageName(this.containerPackageInfo) };\n\n\t\tif (isSharingLinkToRedeem) {\n\t\t\t// We need to remove the nav param if set by host when setting the sharelink as otherwise the shareLinkId\n\t\t\t// when redeeming the share link during the redeem fallback for trees latest call becomes greater than\n\t\t\t// the eligible length.\n\t\t\todspResolvedUrl.shareLinkInfo = Object.assign(odspResolvedUrl.shareLinkInfo ?? {}, {\n\t\t\t\tsharingLinkToRedeem: this.removeNavParam(request.url),\n\t\t\t\tisRedemptionNonDurable: isRedemptionNonDurable ?? false,\n\t\t\t});\n\t\t}\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\t// Kick start the sharing link request if we don't have it already as a performance optimization.\n\t\t\t// For detached create new, we don't have an item id yet and therefore cannot generate a share link\n\t\t\tthis.getShareLinkPromise(odspResolvedUrl).catch(() => {});\n\t\t}\n\t\treturn odspResolvedUrl;\n\t}\n\n\tprivate removeNavParam(link: string): string {\n\t\tconst url = new URL(link);\n\t\tconst params = new URLSearchParams(url.search);\n\t\tparams.delete(locatorQueryParamName);\n\t\turl.search = params.toString();\n\t\treturn url.href;\n\t}\n\n\tprivate async getShareLinkPromise(resolvedUrl: IOdspResolvedUrl): Promise<string> {\n\t\tif (this.shareLinkFetcherProps === undefined) {\n\t\t\tthrow new Error(\"Failed to get share link because share link fetcher props are missing\");\n\t\t}\n\n\t\tif (!(resolvedUrl.siteUrl && resolvedUrl.driveId && resolvedUrl.itemId)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Failed to get share link because necessary information is missing \" +\n\t\t\t\t\t\"(e.g. siteUrl, driveId or itemId)\",\n\t\t\t);\n\t\t}\n\n\t\tconst key = this.getKey(resolvedUrl);\n\t\tconst cachedLinkPromise = this.sharingLinkCache.get(key);\n\t\tif (cachedLinkPromise) {\n\t\t\treturn cachedLinkPromise;\n\t\t}\n\t\tconst newLinkPromise = getFileLink(\n\t\t\tthis.shareLinkFetcherProps.tokenFetcher,\n\t\t\tresolvedUrl,\n\t\t\tthis.logger,\n\t\t).catch((error) => {\n\t\t\t// This should imply that error is a non-retriable error.\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FluidFileUrlError\" }, error);\n\t\t\tthis.sharingLinkCache.remove(key);\n\t\t\tthrow error;\n\t\t});\n\t\tthis.sharingLinkCache.add(key, async () => newLinkPromise);\n\t\treturn newLinkPromise;\n\t}\n\n\t/**\n\t * Requests a driver + data store storage URL. Note that this method requires share link to be fetched\n\t * and it will throw in case share link fetcher props were not specified when instance was created.\n\t * @param resolvedUrl - The driver resolved URL\n\t * @param dataStorePath - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @param packageInfoSource - optional, represents container package information to be included in url.\n\t */\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\tconst shareLink = await this.getShareLinkPromise(odspResolvedUrl);\n\n\t\treturn this.appendLocatorParams(shareLink, resolvedUrl, dataStorePath, packageInfoSource);\n\t}\n\n\t/**\n\t * Appends the store locator properties to the provided base URL. This function is useful for scenarios where an application\n\t * has a base URL (for example a sharing link) of the Fluid file, but does not have the locator information that would be used by Fluid\n\t * to load the file later.\n\t * @param baseUrl - The input URL on which the locator params will be appended.\n\t * @param resolvedUrl - odsp-driver's resolvedURL object.\n\t * @param dataStorePath - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @returns The provided base URL appended with odsp-specific locator information\n\t */\n\tpublic async appendLocatorParams(\n\t\tbaseUrl: string,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\t// If the user has passed an empty dataStorePath, then extract it from the resolved url.\n\t\tconst actualDataStorePath = dataStorePath || (odspResolvedUrl.dataStorePath ?? \"\");\n\n\t\todspResolvedUrl.context = await this.getContext?.(odspResolvedUrl, actualDataStorePath);\n\n\t\t/**\n\t\t * containerPackageName can be provided by various ways, in the order of priority:\n\t\t * 1. packageInfoSource - passed by the call of appendLocatorParams\n\t\t * 2. odspResolvedUrl.codeHint?.containerPackageName - passed by the odsp-driver's resolvedURL object\n\t\t * 3. this.containerPackageInfo - passed by the constructor of OdspDrvierUrlResolverForShareLink\n\t\t * */\n\t\tconst containerPackageName: string | undefined =\n\t\t\tgetContainerPackageName(packageInfoSource) ??\n\t\t\todspResolvedUrl.codeHint?.containerPackageName ??\n\t\t\tgetContainerPackageName(this.containerPackageInfo);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\treturn appendNavParam(baseUrl, odspResolvedUrl, actualDataStorePath, containerPackageName);\n\t}\n\n\t/**\n\t * Crafts a supported document/driver URL\n\t */\n\tpublic static createDocumentUrl(\n\t\tbaseUrl: string,\n\t\tdriverInfo: OdspFluidDataStoreLocator,\n\t): string {\n\t\tconst url = new URL(baseUrl);\n\n\t\tstoreLocatorInOdspUrl(url, driverInfo);\n\n\t\treturn url.href;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDriverUrlResolverForShareLink.js","sourceRoot":"","sources":["../src/odspDriverUrlResolverForShareLink.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAmE;AAcnE,6DAAyF;AACzF,yDAAmD;AACnD,qDAA+C;AAC/C,yEAAmE;AACnE,iEAIgC;AAChC,iDAKwB;AAkBxB;;;;;;GAMG;AACH,MAAa,iCAAiC;IAK7C;;;;;;;;;;;;OAYG;IACH,YACC,qBAAyD,EACzD,MAA6B,EACZ,OAAgB,EAChB,UAGe,EACf,oBAA4C;QAL5C,YAAO,GAAP,OAAO,CAAS;QAChB,eAAU,GAAV,UAAU,CAGK;QACf,yBAAoB,GAApB,oBAAoB,CAAwB;QAxB7C,qBAAgB,GAAG,IAAI,uBAAY,EAAkB,CAAC;QA0BtE,IAAI,CAAC,MAAM,GAAG,IAAA,+BAAgB,EAAC,MAAM,CAAC,CAAC;QACvC,IAAI,qBAAqB,EAAE,CAAC;YAC3B,IAAI,CAAC,qBAAqB,GAAG;gBAC5B,GAAG,qBAAqB;gBACxB,YAAY,EAAE,qBAAqB,CAAC,YAAY;aAChD,CAAC;QACH,CAAC;IACF,CAAC;IAED;;;OAGG;IACI,mBAAmB,CAAC,UAAe,EAAE,YAAoB;QAC/D,MAAM,SAAS,GAAG,IAAA,4CAAqB,EAAC,UAAU,CAAC,CAAC;QAEpD,IAAI,CAAC,SAAS,EAAE,CAAC;YAChB,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,GAAG,CACzB,SAAS,CAAC,aAAa,EAC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IAAA,sCAAuB,EAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAEpD,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAEvC,OAAO,IAAA,6BAAc,EAAC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAC9B,OAAe,EACf,UAAqC;QAErC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAE7B,IAAA,4CAAqB,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEvC,OAAO,GAAG,CAAC,IAAI,CAAC;IACjB,CAAC;CACD;AA5OD,8EA4OC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIOdspResolvedUrl,\n\tIdentityType,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type OdspFluidDataStoreLocator, SharingLinkHeader } from \"./contractsPublic.js\";\nimport { createOdspUrl } from \"./createOdspUrl.js\";\nimport { getFileLink } from \"./getFileLink.js\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver.js\";\nimport {\n\tgetLocatorFromOdspUrl,\n\tlocatorQueryParamName,\n\tstoreLocatorInOdspUrl,\n} from \"./odspFluidFileLink.js\";\nimport {\n\tappendNavParam,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\tgetContainerPackageName,\n} from \"./odspUtils.js\";\n\n/**\n * Properties passed to the code responsible for fetching share link for a file.\n * @legacy\n * @alpha\n */\nexport interface ShareLinkFetcherProps {\n\t/**\n\t * Callback method that is used to fetch access token necessary to call API that produces share link\n\t */\n\ttokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>;\n\t/**\n\t * Identity type determining the shape of share link as it differs for Enterprise and Consumer users.\n\t */\n\tidentityType: IdentityType;\n}\n\n/**\n * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner\n * url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param.\n * This resolver also handles share links and try to generate one for the use by the app.\n * @legacy\n * @alpha\n */\nexport class OdspDriverUrlResolverForShareLink implements IUrlResolver {\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate readonly sharingLinkCache = new PromiseCache<string, string>();\n\tprivate readonly shareLinkFetcherProps: ShareLinkFetcherProps | undefined;\n\n\t/**\n\t * Creates url resolver instance\n\t * @param shareLinkFetcherProps - properties used when fetching share link.\n\t * Can be set as 'undefined' for cases where share link is not needed. Currently, only\n\t * getAbsoluteUrl() method requires share link.\n\t * @param logger - logger object that is used as telemetry sink\n\t * @param appName - application name hint that is encoded with url produced by getAbsoluteUrl() method.\n\t * This hint is used by link handling logic which determines which app to redirect to when user\n\t * navigates directly to the link.\n\t * @param getContext - callback function which is used to get context for given resolved url. If context\n\t * is returned then it will be embedded into url returned by getAbsoluteUrl() method.\n\t * @param containerPackageInfo - container package information which will be used to extract the container package name.\n\t */\n\tpublic constructor(\n\t\tshareLinkFetcherProps?: ShareLinkFetcherProps | undefined,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tprivate readonly appName?: string,\n\t\tprivate readonly getContext?: (\n\t\t\tresolvedUrl: IOdspResolvedUrl,\n\t\t\tdataStorePath: string,\n\t\t) => Promise<string | undefined>,\n\t\tprivate readonly containerPackageInfo?: IContainerPackageInfo,\n\t) {\n\t\tthis.logger = createOdspLogger(logger);\n\t\tif (shareLinkFetcherProps) {\n\t\t\tthis.shareLinkFetcherProps = {\n\t\t\t\t...shareLinkFetcherProps,\n\t\t\t\ttokenFetcher: shareLinkFetcherProps.tokenFetcher,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Takes an already generated data store url (from requestUrl) and appends a path to the\n\t * existing data store information.\n\t */\n\tpublic appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined {\n\t\tconst fluidInfo = getLocatorFromOdspUrl(requestUrl);\n\n\t\tif (!fluidInfo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parsingUrl = new URL(\n\t\t\tfluidInfo.dataStorePath,\n\t\t\t`${requestUrl.protocol}//${requestUrl.hostname}`,\n\t\t);\n\t\t// Determine if the caller is passing a query parameter or path since processing will be different.\n\t\tif (pathToAppend.startsWith(\"/?\") || pathToAppend.startsWith(\"?\")) {\n\t\t\tconst queryParams = new URLSearchParams(pathToAppend);\n\t\t\tfor (const [key, value] of queryParams.entries()) {\n\t\t\t\tparsingUrl.searchParams.append(key, value);\n\t\t\t}\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${parsingUrl.search}`;\n\t\t} else {\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${\n\t\t\t\tparsingUrl.pathname.endsWith(\"/\") || pathToAppend.startsWith(\"/\") ? \"\" : \"/\"\n\t\t\t}${pathToAppend}/${parsingUrl.search}`;\n\t\t}\n\t\tstoreLocatorInOdspUrl(requestUrl, fluidInfo);\n\n\t\treturn requestUrl.href;\n\t}\n\n\tprivate getKey(resolvedUrl: IOdspResolvedUrl): string {\n\t\treturn `${resolvedUrl.siteUrl},${resolvedUrl.driveId},${resolvedUrl.itemId}`;\n\t}\n\n\t/**\n\t * Resolves request URL into driver details\n\t */\n\tpublic async resolve(request: IRequest): Promise<IOdspResolvedUrl> {\n\t\tconst requestToBeResolved = { headers: request.headers, url: request.url };\n\t\tconst isSharingLinkToRedeem =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isSharingLinkToRedeem];\n\t\tconst isRedemptionNonDurable =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isRedemptionNonDurable];\n\t\ttry {\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconst odspFluidInfo = getLocatorFromOdspUrl(url);\n\t\t\tif (odspFluidInfo) {\n\t\t\t\trequestToBeResolved.url = createOdspUrl(odspFluidInfo);\n\t\t\t}\n\t\t} catch {\n\t\t\t// If the locator throws some error, then try to resolve the request as it is.\n\t\t}\n\n\t\tconst odspResolvedUrl = await new OdspDriverUrlResolver().resolve(requestToBeResolved);\n\n\t\todspResolvedUrl.context = await this.getContext?.(\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"\",\n\t\t);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t\t? odspResolvedUrl.codeHint\n\t\t\t: { containerPackageName: getContainerPackageName(this.containerPackageInfo) };\n\n\t\tif (isSharingLinkToRedeem) {\n\t\t\t// We need to remove the nav param if set by host when setting the sharelink as otherwise the shareLinkId\n\t\t\t// when redeeming the share link during the redeem fallback for trees latest call becomes greater than\n\t\t\t// the eligible length.\n\t\t\todspResolvedUrl.shareLinkInfo = Object.assign(odspResolvedUrl.shareLinkInfo ?? {}, {\n\t\t\t\tsharingLinkToRedeem: this.removeNavParam(request.url),\n\t\t\t\tisRedemptionNonDurable: isRedemptionNonDurable ?? false,\n\t\t\t});\n\t\t}\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\t// Kick start the sharing link request if we don't have it already as a performance optimization.\n\t\t\t// For detached create new, we don't have an item id yet and therefore cannot generate a share link\n\t\t\tthis.getShareLinkPromise(odspResolvedUrl).catch(() => {});\n\t\t}\n\t\treturn odspResolvedUrl;\n\t}\n\n\tprivate removeNavParam(link: string): string {\n\t\tconst url = new URL(link);\n\t\tconst params = new URLSearchParams(url.search);\n\t\tparams.delete(locatorQueryParamName);\n\t\turl.search = params.toString();\n\t\treturn url.href;\n\t}\n\n\tprivate async getShareLinkPromise(resolvedUrl: IOdspResolvedUrl): Promise<string> {\n\t\tif (this.shareLinkFetcherProps === undefined) {\n\t\t\tthrow new Error(\"Failed to get share link because share link fetcher props are missing\");\n\t\t}\n\n\t\tif (!(resolvedUrl.siteUrl && resolvedUrl.driveId && resolvedUrl.itemId)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Failed to get share link because necessary information is missing \" +\n\t\t\t\t\t\"(e.g. siteUrl, driveId or itemId)\",\n\t\t\t);\n\t\t}\n\n\t\tconst key = this.getKey(resolvedUrl);\n\t\tconst cachedLinkPromise = this.sharingLinkCache.get(key);\n\t\tif (cachedLinkPromise) {\n\t\t\treturn cachedLinkPromise;\n\t\t}\n\t\tconst newLinkPromise = getFileLink(\n\t\t\tthis.shareLinkFetcherProps.tokenFetcher,\n\t\t\tresolvedUrl,\n\t\t\tthis.logger,\n\t\t).catch((error) => {\n\t\t\t// This should imply that error is a non-retriable error.\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FluidFileUrlError\" }, error);\n\t\t\tthis.sharingLinkCache.remove(key);\n\t\t\tthrow error;\n\t\t});\n\t\tthis.sharingLinkCache.add(key, async () => newLinkPromise);\n\t\treturn newLinkPromise;\n\t}\n\n\t/**\n\t * Requests a driver + data store storage URL. Note that this method requires share link to be fetched\n\t * and it will throw in case share link fetcher props were not specified when instance was created.\n\t * @param resolvedUrl - The driver resolved URL\n\t * @param dataStorePath - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @param packageInfoSource - optional, represents container package information to be included in url.\n\t */\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\tconst shareLink = await this.getShareLinkPromise(odspResolvedUrl);\n\n\t\treturn this.appendLocatorParams(shareLink, resolvedUrl, dataStorePath, packageInfoSource);\n\t}\n\n\t/**\n\t * Appends the store locator properties to the provided base URL. This function is useful for scenarios where an application\n\t * has a base URL (for example a sharing link) of the Fluid file, but does not have the locator information that would be used by Fluid\n\t * to load the file later.\n\t * @param baseUrl - The input URL on which the locator params will be appended.\n\t * @param resolvedUrl - odsp-driver's resolvedURL object.\n\t * @param dataStorePath - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @returns The provided base URL appended with odsp-specific locator information\n\t */\n\tpublic async appendLocatorParams(\n\t\tbaseUrl: string,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\t// If the user has passed an empty dataStorePath, then extract it from the resolved url.\n\t\tconst actualDataStorePath = dataStorePath || (odspResolvedUrl.dataStorePath ?? \"\");\n\n\t\todspResolvedUrl.context = await this.getContext?.(odspResolvedUrl, actualDataStorePath);\n\n\t\t/**\n\t\t * containerPackageName can be provided by various ways, in the order of priority:\n\t\t * 1. packageInfoSource - passed by the call of appendLocatorParams\n\t\t * 2. odspResolvedUrl.codeHint?.containerPackageName - passed by the odsp-driver's resolvedURL object\n\t\t * 3. this.containerPackageInfo - passed by the constructor of OdspDrvierUrlResolverForShareLink\n\t\t * */\n\t\tconst containerPackageName: string | undefined =\n\t\t\tgetContainerPackageName(packageInfoSource) ??\n\t\t\todspResolvedUrl.codeHint?.containerPackageName ??\n\t\t\tgetContainerPackageName(this.containerPackageInfo);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\treturn appendNavParam(baseUrl, odspResolvedUrl, actualDataStorePath, containerPackageName);\n\t}\n\n\t/**\n\t * Crafts a supported document/driver URL\n\t */\n\tpublic static createDocumentUrl(\n\t\tbaseUrl: string,\n\t\tdriverInfo: OdspFluidDataStoreLocator,\n\t): string {\n\t\tconst url = new URL(baseUrl);\n\n\t\tstoreLocatorInOdspUrl(url, driverInfo);\n\n\t\treturn url.href;\n\t}\n}\n"]}
|
package/dist/odspError.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { OdspError } from "@fluidframework/odsp-driver-definitions/internal";
|
|
6
|
-
import { IFluidErrorBase } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
-
import { IOdspSocketError } from "./contracts.js";
|
|
5
|
+
import { type OdspError } from "@fluidframework/odsp-driver-definitions/internal";
|
|
6
|
+
import { type IFluidErrorBase } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
+
import type { IOdspSocketError } from "./contracts.js";
|
|
8
8
|
/**
|
|
9
9
|
* Returns network error based on error object from ODSP socket (IOdspSocketError)
|
|
10
10
|
*/
|
package/dist/odspError.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspError.d.ts","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"odspError.d.ts","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,SAAS,EAEd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,eAAe,EAEpB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,MAAM,GACb,eAAe,GAAG,SAAS,CA4B7B"}
|
package/dist/odspError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspError.js","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,oEAA0E;AAC1E,yEAAoF;AACpF,+
|
|
1
|
+
{"version":3,"file":"odspError.js","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,oEAA0E;AAC1E,yEAAoF;AACpF,+EAG0D;AAC1D,uEAGkD;AAGlD,2DAAkE;AAElE;;GAEG;AACH,SAAgB,0BAA0B,CACzC,WAA6B,EAC7B,OAAe;IAEf,0DAA0D;IAC1D,IAAI,CAAC;QACJ,iDAAiD;QACjD,MAAM,OAAO,GAAG,sBAAsB,OAAO,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;QACzE,MAAM,KAAK,GAAG,IAAA,iCAAsB,EACnC,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,IAAA,8BAAmB,GAAE,CAAC;YACrE,CAAC,CAAC,SAAS,CACZ,CAAC;QAEF,KAAK,CAAC,sBAAsB,CAAC;YAC5B,SAAS,EAAE,IAAI;YACf,iBAAiB,EAAE,IAAI;YACvB,YAAY,EAAE,OAAO;SACrB,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,4BAAiB,CAC3B,4CAA4C,EAC5C,yBAAc,CAAC,+BAA+B,EAC9C,EAAE,aAAa,EAAb,8BAAa,EAAE,CACjB,CAAC;IACH,CAAC;AACF,CAAC;AA/BD,gEA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { NonRetryableError } from \"@fluidframework/driver-utils/internal\";\nimport { createOdspNetworkError } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport {\n\ttype OdspError,\n\tOdspErrorTypes,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\tgetCircularReplacer,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IOdspSocketError } from \"./contracts.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\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({\n\t\t\todspError: true,\n\t\t\trelayServiceError: true,\n\t\t\tscenarioName: handler,\n\t\t});\n\t\treturn error;\n\t} catch {\n\t\treturn new NonRetryableError(\n\t\t\t\"Internal error: errorObjectFromSocketError\",\n\t\t\tOdspErrorTypes.fileNotFoundOrAccessDeniedError,\n\t\t\t{ driverVersion },\n\t\t);\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
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.js";
|
|
5
|
+
import type { OdspFluidDataStoreLocator } from "./contractsPublic.js";
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspFluidFileLink.d.ts","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"odspFluidFileLink.d.ts","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAatE;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CA0B1F;AA2DD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAKxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,GAAG,EACR,qBAAqB,GAAE,OAAc,GACnC,yBAAyB,GAAG,SAAS,CAiBvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspFluidFileLink.js","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkF;AAElF,iDAAqE;AAGrE,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;AAC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AE,aAAa,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACR,0DAA0D;IAC3D,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO;QACN,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,OAAO;QACP,MAAM;QACN,aAAa;QACb,OAAO;QACP,oBAAoB;QACpB,WAAW;QACX,OAAO;KACP,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,KAAK,CAAC;AAE3C;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,GAAQ,EAAE,OAAkC;IACjF,MAAM,mBAAmB,GAAG,+BAA+B,CAAC,OAAO,CAAC,CAAC;IACrE,0GAA0G;IAC1G,qCAAqC;IACrC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,6BAAqB,EAAE,mBAAmB,CAAC,CAAC;AAClE,CAAC;AALD,sDAKC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACpC,GAAQ,EACR,wBAAiC,IAAI;IAErC,mGAAmG;IACnG,MAAM,mBAAmB,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,6BAAqB,CAAC,CAAC;IACxE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,qGAAqG;IACrG,oFAAoF;IACpF,MAAM,aAAa,GAClB,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,gCAAiB,CAAC,CAAC,CAAC,+BAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAEhF,OAAO,+BAA+B,CACrC,mBAAmB,EACnB,aAAa,EACb,qBAAqB,CACrB,CAAC;AACH,CAAC;AApBD,sDAoBC","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\";\n\nimport { OdcApiSiteOrigin, OdcFileSiteOrigin } from \"./constants.js\";\nimport { OdspFluidDataStoreLocator } from \"./contractsPublic.js\";\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 * @legacy\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 * @legacy\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 * @legacy\n * @alpha\n */\nexport function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataStoreLocator): void {\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 * @legacy\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"]}
|
|
1
|
+
{"version":3,"file":"odspFluidFileLink.js","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkF;AAElF,iDAAqE;A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ACpF,MAAM,aAAa,GAClB,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,gCAAiB,CAAC,CAAC,CAAC,+BAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAEhF,OAAO,+BAA+B,CACrC,mBAAmB,EACnB,aAAa,EACb,qBAAqB,CACrB,CAAC;AACH,CAAC;AApBD,sDAoBC","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\";\n\nimport { OdcApiSiteOrigin, OdcFileSiteOrigin } from \"./constants.js\";\nimport type { OdspFluidDataStoreLocator } from \"./contractsPublic.js\";\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 * @legacy\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 * @legacy\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 * @legacy\n * @alpha\n */\nexport function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataStoreLocator): void {\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 * @legacy\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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { ILayerCompatDetails } from "@fluid-internal/client-utils";
|
|
6
6
|
/**
|
|
7
7
|
* ODSP Driver's compatibility details that is exposed to the Loader layer.
|
|
8
8
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspLayerCompatState.d.ts","sourceRoot":"","sources":["../src/odspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"odspLayerCompatState.d.ts","sourceRoot":"","sources":["../src/odspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAIxE;;;GAGG;AACH,eAAO,MAAM,gCAAgC,EAAE,mBAa9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspLayerCompatState.js","sourceRoot":"","sources":["../src/odspLayerCompatState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2DAAiD;AAEjD;;;GAGG;AACU,QAAA,gCAAgC,GAAwB;IACpE;;OAEG;IACH,UAAU,EAAV,8BAAU;IACV;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"odspLayerCompatState.js","sourceRoot":"","sources":["../src/odspLayerCompatState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2DAAiD;AAEjD;;;GAGG;AACU,QAAA,gCAAgC,GAAwB;IACpE;;OAEG;IACH,UAAU,EAAV,8BAAU;IACV;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ILayerCompatDetails } from \"@fluid-internal/client-utils\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * ODSP Driver's compatibility details that is exposed to the Loader layer.\n * @internal\n */\nexport const odspDriverCompatDetailsForLoader: ILayerCompatDetails = {\n\t/**\n\t * The package version of the ODSP Driver layer.\n\t */\n\tpkgVersion,\n\t/**\n\t * The current generation of the ODSP Driver layer.\n\t */\n\tgeneration: 1,\n\t/**\n\t * The features supported by the ODSP Driver layer across the Driver / Loader boundary.\n\t */\n\tsupportedFeatures: new Set<string>(),\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 { IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
6
|
-
import { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions/internal";
|
|
5
|
+
import type { IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
6
|
+
import type { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions/internal";
|
|
7
7
|
/**
|
|
8
8
|
* It takes a resolved url with old siteUrl and creates a new resolved url with updated site url domain.
|
|
9
9
|
* @param resolvedUrl - Previous odsp resolved url with older site url.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspLocationRedirection.d.ts","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"odspLocationRedirection.d.ts","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAIzF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,YAAY,EACzB,gBAAgB,EAAE,MAAM,GACtB,gBAAgB,CAOlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspLocationRedirection.js","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,iDAAoD;AAEpD;;;;;GAKG;AACH,SAAgB,oBAAoB,CACnC,WAAyB,EACzB,gBAAwB;IAExB,MAAM,eAAe,GAAG,EAAE,GAAG,IAAA,iCAAkB,EAAC,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;AAVD,oDAUC","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/internal\";\nimport { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions/internal\";\n\nimport { getOdspResolvedUrl } from \"./odspUtils.js\";\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"]}
|
|
1
|
+
{"version":3,"file":"odspLocationRedirection.js","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,iDAAoD;AAEpD;;;;;GAKG;AACH,SAAgB,oBAAoB,CACnC,WAAyB,EACzB,gBAAwB;IAExB,MAAM,eAAe,GAAG,EAAE,GAAG,IAAA,iCAAkB,EAAC,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;AAVD,oDAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IResolvedUrl } from \"@fluidframework/driver-definitions/internal\";\nimport type { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions/internal\";\n\nimport { getOdspResolvedUrl } from \"./odspUtils.js\";\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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of
|
|
8
8
|
* said document.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspPublicUtils.d.ts","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"odspPublicUtils.d.ts","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,aAAa,EACb,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG1F;AAED;;;;GAIG;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspPublicUtils.js","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAmE;AAMnE;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAc;IACxE,MAAM,MAAM,GAAG,wBAAS,CAAC,IAAI,CAAC,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;IACtD,OAAO,kBAAkB,CAAC,MAAM,IAAA,uBAAQ,EAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxE,CAAC;AAHD,kDAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer, hashFile } from \"@fluid-internal/client-utils\";\nimport {\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of\n * said document.\n *\n * @legacy\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 * @legacy\n * @alpha\n * @deprecated - This is deprecated.\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"]}
|
|
1
|
+
{"version":3,"file":"odspPublicUtils.js","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAmE;AAMnE;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAc;IACxE,MAAM,MAAM,GAAG,wBAAS,CAAC,IAAI,CAAC,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;IACtD,OAAO,kBAAkB,CAAC,MAAM,IAAA,uBAAQ,EAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxE,CAAC;AAHD,kDAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer, hashFile } from \"@fluid-internal/client-utils\";\nimport type {\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of\n * said document.\n *\n * @legacy\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 * @legacy\n * @alpha\n * @deprecated - This is deprecated.\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 { ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
6
|
-
import { IOdspSnapshot } from "./contracts.js";
|
|
5
|
+
import type { ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
6
|
+
import type { IOdspSnapshot } from "./contracts.js";
|
|
7
7
|
/**
|
|
8
8
|
* Converts existing IOdspSnapshot to snapshot tree, blob array and ops
|
|
9
9
|
* @param odspSnapshot - snapshot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspSnapshotParser.d.ts","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,SAAS,EAAiB,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"odspSnapshotParser.d.ts","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,6CAA6C,CAAC;AAE5F,OAAO,KAAK,EAAE,aAAa,EAAuB,MAAM,gBAAgB,CAAC;AAyCzE;;;GAGG;AACH,wBAAgB,yCAAyC,CACxD,YAAY,EAAE,aAAa,GACzB,SAAS,CA6BX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspSnapshotParser.js","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAK7D;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,QAA6B;IACpD,MAAM,MAAM,GAAsC,EAAE,CAAC;IACrD,2FAA2F;IAC3F,MAAM,IAAI,GAAkB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,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QACxB,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;YACvC,IAAA,iBAAM,EACL,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,IAAA,6BAAc,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,CACrD,CAAC;QACH,CAAC;IACF,CAAC;IAED,MAAM,cAAc,GAAG,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IAE7D,MAAM,GAAG,GAAc;QACtB,YAAY,EAAE,sBAAsB;QACpC,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;QAClB,eAAe,EAAE,CAAC;KAClB,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AA/BD,8FA+BC","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/internal\";\nimport { ISnapshot, ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\n\nimport { IOdspSnapshot, IOdspSnapshotCommit } from \"./contracts.js\";\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): ISnapshotTree {\n\tconst lookup: { [path: string]: ISnapshotTree } = {};\n\t// id is required for root tree as it will be used to determine the version we loaded from.\n\tconst root: 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: ISnapshotTree = {\n\t\t\t\tblobs: {},\n\t\t\t\ttrees: {},\n\t\t\t\tunreferenced: entry.unreferenced,\n\t\t\t\tgroupId: entry.groupId,\n\t\t\t};\n\t\t\tnode.trees[entryPathBase] = newTree;\n\t\t\tlookup[entry.path] = newTree;\n\t\t} else if (entry.type === \"blob\") {\n\t\t\tnode.blobs[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): ISnapshot {\n\tconst blobsWithBufferContent = new Map<string, ArrayBuffer>();\n\tif (odspSnapshot.blobs) {\n\t\tfor (const blob of odspSnapshot.blobs) {\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: ISnapshot = {\n\t\tblobContents: 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\tsnapshotFormatV: 1,\n\t};\n\treturn val;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspSnapshotParser.js","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAK7D;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,QAA6B;IACpD,MAAM,MAAM,GAAsC,EAAE,CAAC;IACrD,2FAA2F;IAC3F,MAAM,IAAI,GAAkB,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACtE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAElB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QACjE,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAA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Ac,CAAC;IAE7D,MAAM,GAAG,GAAc;QACtB,YAAY,EAAE,sBAAsB;QACpC,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;QAClB,eAAe,EAAE,CAAC;KAClB,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AA/BD,8FA+BC","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/internal\";\nimport type { ISnapshot, ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\n\nimport type { IOdspSnapshot, IOdspSnapshotCommit } from \"./contracts.js\";\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): ISnapshotTree {\n\tconst lookup: { [path: string]: ISnapshotTree } = {};\n\t// id is required for root tree as it will be used to determine the version we loaded from.\n\tconst root: 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: ISnapshotTree = {\n\t\t\t\tblobs: {},\n\t\t\t\ttrees: {},\n\t\t\t\tunreferenced: entry.unreferenced,\n\t\t\t\tgroupId: entry.groupId,\n\t\t\t};\n\t\t\tnode.trees[entryPathBase] = newTree;\n\t\t\tlookup[entry.path] = newTree;\n\t\t} else if (entry.type === \"blob\") {\n\t\t\tnode.blobs[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): ISnapshot {\n\tconst blobsWithBufferContent = new Map<string, ArrayBuffer>();\n\tif (odspSnapshot.blobs) {\n\t\tfor (const blob of odspSnapshot.blobs) {\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: ISnapshot = {\n\t\tblobContents: 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\tsnapshotFormatV: 1,\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 { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ISummaryContext } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
8
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
-
import { EpochTracker } from "./epochTracker.js";
|
|
5
|
+
import { type ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
+
import type { ISummaryContext } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
8
|
+
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
+
import type { EpochTracker } from "./epochTracker.js";
|
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspSummaryUploadManager.d.ts","sourceRoot":"","sources":["../src/odspSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"odspSummaryUploadManager.d.ts","sourceRoot":"","sources":["../src/odspSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EAGjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAKnF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AACxG,OAAO,EACN,KAAK,mBAAmB,EAI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,KAAK,gCAAW,CAAC,UAAU,CAAC,CAAC,CAAC;oBAC7B,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC;oBACtB,MAAM;gBACP,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACT,IAAA,0BAAe,EACd,aAAa,EACb,iBAAkB,aAA+B,CAAC,IAAI,EAAE,CACxD,CAAC;gBACH,CAAC;YACF,CAAC;YAED,MAAM,SAAS,GAA8B;gBAC5C,IAAI,EAAE,GAAG;gBACT,IAAI,EAAE,IAAA,qBAAU,EAAC,aAAa,CAAC;aAC/B,CAAC;YAEF,IAAI,KAA2B,CAAC;YAEhC,IAAI,KAAK,EAAE,CAAC;gBACX,IAAA,iBAAM,EACL,EAAE,KAAK,SAAS,EAChB,KAAK,CAAC,iEAAiE,CACvE,CAAC;gBACF,KAAK,GAAG;oBACP,KAAK;oBACL,GAAG,SAAS;oBACZ,YAAY;oBACZ,OAAO;iBACP,CAAC;YACH,CAAC;iBAAM,IAAI,EAAE,EAAE,CAAC;gBACf,KAAK,GAAG;oBACP,GAAG,SAAS;oBACZ,EAAE;iBACF,CAAC;YACH,CAAC;iBAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;YACjE,CAAC;YAED,YAAY,CAAC,OAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;CACD;AAhPD,4DAgPC","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/internal\";\nimport { ISummaryTree, SummaryType, SummaryObject } from \"@fluidframework/driver-definitions\";\nimport { ISummaryContext } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetGitType,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tIOdspSummaryPayload,\n\tIOdspSummaryTree,\n\tIOdspSummaryTreeBaseEntry,\n\tIWriteSummaryResponse,\n\tOdspSummaryTreeEntry,\n\tOdspSummaryTreeValue,\n} from \"./contracts.js\";\nimport { EpochTracker } from \"./epochTracker.js\";\nimport { getHeadersWithAuth } from \"./getUrlAndHeadersWithAuth.js\";\nimport { getWithRetryForTokenRefresh } from \"./odspUtils.js\";\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 getAuthHeader: InstrumentedStorageTokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly relayServiceTenantAndSessionId: () => string | undefined,\n\t) {\n\t\tthis.mc = loggerToMonitoringContext(logger);\n\t}\n\n\tpublic async writeSummaryTree(\n\t\ttree: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\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: 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 url = `${this.snapshotUrl}/snapshot`;\n\t\t\tconst method = \"POST\";\n\t\t\tconst authHeader = await this.getAuthHeader(\n\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\"WriteSummaryTree\",\n\t\t\t);\n\n\t\t\tconst headers = getHeadersWithAuth(authHeader);\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\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 = await this.epochTracker.fetchAndParseAsJSON<IWriteSummaryResponse>(\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbody: postBody,\n\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"uploadSummary\",\n\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: 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): Promise<{\n\t\tsnapshotTree: IOdspSummaryTree;\n\t\tblobs: number;\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\tassert(!key.includes(\"/\"), 0x9cd /* id should not include slashes */);\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\tlet groupId: string | undefined;\n\t\t\tswitch (summaryObject.type) {\n\t\t\t\tcase 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\tgroupId = summaryObject.groupId;\n\t\t\t\t\tblobs += result.blobs;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 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\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\t};\n\t\t\t\t\tblobs++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SummaryType.Handle: {\n\t\t\t\t\tif (!parentHandle) {\n\t\t\t\t\t\tthrow new 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 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(\n\t\t\t\t\t\tsummaryObject,\n\t\t\t\t\t\t`Unknown type: ${(summaryObject as SummaryObject).type}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst baseEntry: IOdspSummaryTreeBaseEntry = {\n\t\t\t\tpath: 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\tgroupId,\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"]}
|
|
1
|
+
{"version":3,"file":"odspSummaryUploadManager.js","sourceRoot":"","sources":["../src/odspSummaryUploadManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkE;AAClE,kEAA8E;AAC9E,2EAI4C;AAE5C,oEAG+C;AAE/C,uEAKkD;AAWlD,+EAAmE;AACnE,iDAA6D;AAE7D;;;GAGG;AACH,MAAa,wBAAwB;IAKpC,YACkB,WAAmB,EACnB,aAA8C,EAC/D,MAA2B,EACV,YAA0B,EAC1B,8BAAwD;QAJxD,gBAAW,GAAX,WAAW,CAAQ;QACnB,kBAAa,GAAb,aAAa,CAAiC;QAE9C,iBAAY,GAAZ,YAAY,CAAc;QAC1B,mCAA8B,GAA9B,8BAA8B,CAA0B;QAEzE,IAAI,CAAC,EAAE,GAAG,IAAA,oCAAyB,EAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAC5B,IAAkB,EAClB,OAAwB;QAExB,8HAA8H;QAC9H,gIAAgI;QAChI,6GAA6G;QAC7G,IACC,IAAI,CAAC,yBAAyB,KAAK,SAAS;YAC5C,IAAI,CAAC,yBAAyB,KAAK,OAAO,CAAC,cAAc,EACxD,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC;gBACjC,SAAS,EAAE,mCAAmC;gBAC9C,0BAA0B,EAAE,OAAO,CAAC,cAAc;gBAClD,yBAAyB,EAAE,IAAI,CAAC,yBAAyB;aACzD,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG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,IAAA,iBAAM,EACL,EAAE,KAAK,SAAS,EAChB,KAAK,CAAC,iEAAiE,CACvE,CAAC;gBACF,KAAK,GAAG;oBACP,KAAK;oBACL,GAAG,SAAS;oBACZ,YAAY;oBACZ,OAAO;iBACP,CAAC;YACH,CAAC;iBAAM,IAAI,EAAE,EAAE,CAAC;gBACf,KAAK,GAAG;oBACP,GAAG,SAAS;oBACZ,EAAE;iBACF,CAAC;YACH,CAAC;iBAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;YACjE,CAAC;YAED,YAAY,CAAC,OAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;CACD;AAhPD,4DAgPC","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/internal\";\nimport {\n\ttype ISummaryTree,\n\tSummaryType,\n\ttype SummaryObject,\n} from \"@fluidframework/driver-definitions\";\nimport type { ISummaryContext } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetGitType,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport type { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\ttype MonitoringContext,\n\tPerformanceEvent,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type {\n\tIOdspSummaryPayload,\n\tIOdspSummaryTree,\n\tIOdspSummaryTreeBaseEntry,\n\tIWriteSummaryResponse,\n\tOdspSummaryTreeEntry,\n\tOdspSummaryTreeValue,\n} from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport { getHeadersWithAuth } from \"./getUrlAndHeadersWithAuth.js\";\nimport { getWithRetryForTokenRefresh } from \"./odspUtils.js\";\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 getAuthHeader: InstrumentedStorageTokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly relayServiceTenantAndSessionId: () => string | undefined,\n\t) {\n\t\tthis.mc = loggerToMonitoringContext(logger);\n\t}\n\n\tpublic async writeSummaryTree(\n\t\ttree: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\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: 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 url = `${this.snapshotUrl}/snapshot`;\n\t\t\tconst method = \"POST\";\n\t\t\tconst authHeader = await this.getAuthHeader(\n\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\"WriteSummaryTree\",\n\t\t\t);\n\n\t\t\tconst headers = getHeadersWithAuth(authHeader);\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\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 = await this.epochTracker.fetchAndParseAsJSON<IWriteSummaryResponse>(\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbody: postBody,\n\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"uploadSummary\",\n\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: 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): Promise<{\n\t\tsnapshotTree: IOdspSummaryTree;\n\t\tblobs: number;\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\tassert(!key.includes(\"/\"), 0x9cd /* id should not include slashes */);\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\tlet groupId: string | undefined;\n\t\t\tswitch (summaryObject.type) {\n\t\t\t\tcase 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\tgroupId = summaryObject.groupId;\n\t\t\t\t\tblobs += result.blobs;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 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\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\t};\n\t\t\t\t\tblobs++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SummaryType.Handle: {\n\t\t\t\t\tif (!parentHandle) {\n\t\t\t\t\t\tthrow new 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 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(\n\t\t\t\t\t\tsummaryObject,\n\t\t\t\t\t\t`Unknown type: ${(summaryObject as SummaryObject).type}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst baseEntry: IOdspSummaryTreeBaseEntry = {\n\t\t\t\tpath: 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\tgroupId,\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"]}
|
package/dist/odspUrlHelper.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IOdspUrlParts } from "@fluidframework/odsp-driver-definitions/internal";
|
|
5
|
+
import type { IOdspUrlParts } from "@fluidframework/odsp-driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Checks whether or not the given URL has an ODC origin
|
|
8
8
|
* @param url - The URL to check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspUrlHelper.d.ts","sourceRoot":"","sources":["../src/odspUrlHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"odspUrlHelper.d.ts","sourceRoot":"","sources":["../src/odspUrlHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AAItF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAW9C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAO3C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAM1C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAe1C;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA6ClF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAW1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspUrlHelper.js","sourceRoot":"","sources":["../src/odspUrlHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0CAA0C;AAE1C;;;;GAIG;AACH,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C,CAAC,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAEnC,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrE,CAAC;AACF,CAAC;AA7CD,0CA6CC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CAAC,SAAiB;IAC5D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC3C,OAAO,MAAM,CAAC;IACf,CAAC;SAAM,IACN,MAAM,KAAK,0BAA0B;QACrC,MAAM,KAAK,6BAA6B,EACvC,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAXD,kEAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IOdspUrlParts } from \"@fluidframework/odsp-driver-definitions/internal\";\n\n// Centralized store for all ODC/SPO logic\n\n/**\n * Checks whether or not the given URL has an ODC origin\n * @param url - The URL to check\n * @internal\n */\nexport function hasOdcOrigin(url: URL): boolean {\n\treturn (\n\t\t// Primary API endpoint and several test endpoints\n\t\turl.origin.endsWith(\"onedrive.com\") ||\n\t\t// *storage.live.com hostnames\n\t\turl.origin.endsWith(\"storage.live.com\") ||\n\t\t// live-int\n\t\turl.origin.endsWith(\"storage.live-int.com\") ||\n\t\t// Test endpoints\n\t\turl.origin.endsWith(\"onedrive-tst.com\")\n\t);\n}\n\n/**\n * Gets the correct API root for the given ODSP url, e.g. 'https://foo-my.sharepoint.com/_api/v2.1'\n * @param url - The URL\n * @internal\n */\nexport function getApiRoot(url: URL): string {\n\tlet prefix = \"_api/\";\n\tif (hasOdcOrigin(url)) {\n\t\tprefix = \"\";\n\t}\n\n\treturn `${url.origin}/${prefix}v2.1`;\n}\n\n/**\n * Whether or not the given URL is a valid SPO/ODB URL\n * @param url - The URL to check\n * @internal\n */\nexport function isSpoUrl(url: URL): boolean {\n\t// Format: foo.sharepoint.com/_api/v2.1./drives/bar/items/baz and foo.sharepoint-df.com/...\n\tconst hostRegex = /\\.sharepoint(?:-df)?\\.com$/;\n\tconst pathRegex = /^\\/_api\\/v2\\.1\\/drives\\/[^/]+\\/items\\/[^/]+/;\n\n\treturn hostRegex.test(url.host.toLowerCase()) && pathRegex.test(url.pathname.toLowerCase());\n}\n\n/**\n * Whether or not the given URL is a valid ODC URL\n * @param url - The URL to check\n * @internal\n */\nexport function isOdcUrl(url: URL): boolean {\n\tif (!hasOdcOrigin(url)) {\n\t\treturn false;\n\t}\n\n\tconst path = url.pathname.toLowerCase();\n\n\t// Splitting the regexes so we don't have regex soup\n\t// Format: /v2.1/drive/items/ABC123!123 and /v2.1/drives/ABC123/items/ABC123!123\n\tconst odcRegex = /^\\/v2\\.1\\/(?:drive|drives\\/[^/]+)\\/items\\/[\\dA-Za-z]+!\\d+/;\n\n\t// Format: /v2.1/drives('ABC123')/items('ABC123!123')\n\tconst odcODataRegex = /^\\/v2\\.1\\/drives\\('[^/]+'\\)\\/items\\('[\\dA-Za-z]+!\\d+'\\)/;\n\n\treturn odcRegex.test(path) || odcODataRegex.test(path);\n}\n\n/**\n * Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID.\n * Returns undefined for invalid/malformed URLs.\n * @param url - The (raw) URL to parse\n * @internal\n */\nexport async function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefined> {\n\tconst pathname = url.pathname;\n\n\t// Joinsession like URL\n\t// Pick a regex based on the hostname\n\t// TODO This will only support ODC using api.onedrive.com, update to handle the future (share links etc)\n\tlet joinSessionMatch: RegExpExecArray | null;\n\tif (hasOdcOrigin(url)) {\n\t\t// Capture groups:\n\t\t// 0: match\n\t\t// 1: origin\n\t\t// 2: optional `drives` capture (the `/drives/<DRIVEID>` API format vs `/drive`)\n\t\t// 3: optional captured drive ID\n\t\t// 4: Item ID\n\t\t// 5: Drive ID portion of Item ID\n\t\tjoinSessionMatch =\n\t\t\t/(.*)\\/v2\\.1\\/drive(s\\/([\\dA-Za-z]+))?\\/items\\/(([\\dA-Za-z]+)!\\d+)/.exec(pathname);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\t// Try again but with the OData format ( `/drives('ABC123')/items('ABC123!456')` )\n\t\t\tjoinSessionMatch =\n\t\t\t\t/(.*)\\/v2\\.1\\/drives\\('([\\dA-Za-z]+)'\\)\\/items\\('(([\\dA-Za-z]+)!\\d+)'\\)/.exec(\n\t\t\t\t\tpathname,\n\t\t\t\t);\n\n\t\t\tif (joinSessionMatch === null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst driveId = joinSessionMatch[3] || joinSessionMatch[5];\n\t\tconst itemId = joinSessionMatch[4];\n\n\t\treturn { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };\n\t} else {\n\t\tjoinSessionMatch = /(.*)\\/_api\\/v2\\.1\\/drives\\/([^/]*)\\/items\\/([^/]*)(.*)/.exec(pathname);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst driveId = joinSessionMatch[2];\n\t\tconst itemId = joinSessionMatch[3];\n\n\t\treturn { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };\n\t}\n}\n\n/**\n * Inspect the ODSP siteUrl to guess if this document is in SPDF or MSIT, to aid livesite investigations\n * @param urlOnSite - The URL of the site or a resource on the site\n * @returns undefined if the URL doesn't match known SPDF/MSIT patterns, \"SPDF\" if it's SPDF, \"MSIT\" if it's MSIT\n */\nexport function checkForKnownServerFarmType(urlOnSite: string): \"SPDF\" | \"MSIT\" | undefined {\n\tconst domain = new URL(urlOnSite).hostname.toLowerCase();\n\tif (domain.endsWith(\".sharepoint-df.com\")) {\n\t\treturn \"SPDF\";\n\t} else if (\n\t\tdomain === \"microsoft.sharepoint.com\" ||\n\t\tdomain === \"microsoft-my.sharepoint.com\"\n\t) {\n\t\treturn \"MSIT\";\n\t}\n\treturn undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspUrlHelper.js","sourceRoot":"","sources":["../src/odspUrlHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0CAA0C;AAE1C;;;;GAIG;AACH,SAAgB,YAAY,CAAC,GAAQ;IACpC,OAAO;IACN,kDAAkD;IAClD,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;QACnC,8BAA8B;QAC9B,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACvC,WAAW;QACX,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QAC3C,iBAAiB;QACjB,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CACvC,CAAC;AACH,CAAC;AAXD,oCAWC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,GAAQ;IAClC,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,GAAG,EAAE,CAAC;IACb,CAAC;IAED,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,MAAM,MAAM,CAAC;AACtC,CAAC;AAPD,gCAOC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,GAAQ;IAChC,2FAA2F;IAC3F,MAAM,SAAS,GAAG,4BAA4B,CAAC;IAC/C,MAAM,SAAS,GAAG,6CAA6C,CAAC;IAEhE,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;AAC7F,CAAC;AAND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AE,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrE,CAAC;SAAM,CAAC;QACP,gBAAgB,GAAG,wDAAwD,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE3F,IAAI,gBAAgB,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAEnC,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrE,CAAC;AACF,CAAC;AA7CD,0CA6CC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CAAC,SAAiB;IAC5D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC3C,OAAO,MAAM,CAAC;IACf,CAAC;SAAM,IACN,MAAM,KAAK,0BAA0B;QACrC,MAAM,KAAK,6BAA6B,EACvC,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAXD,kEAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IOdspUrlParts } from \"@fluidframework/odsp-driver-definitions/internal\";\n\n// Centralized store for all ODC/SPO logic\n\n/**\n * Checks whether or not the given URL has an ODC origin\n * @param url - The URL to check\n * @internal\n */\nexport function hasOdcOrigin(url: URL): boolean {\n\treturn (\n\t\t// Primary API endpoint and several test endpoints\n\t\turl.origin.endsWith(\"onedrive.com\") ||\n\t\t// *storage.live.com hostnames\n\t\turl.origin.endsWith(\"storage.live.com\") ||\n\t\t// live-int\n\t\turl.origin.endsWith(\"storage.live-int.com\") ||\n\t\t// Test endpoints\n\t\turl.origin.endsWith(\"onedrive-tst.com\")\n\t);\n}\n\n/**\n * Gets the correct API root for the given ODSP url, e.g. 'https://foo-my.sharepoint.com/_api/v2.1'\n * @param url - The URL\n * @internal\n */\nexport function getApiRoot(url: URL): string {\n\tlet prefix = \"_api/\";\n\tif (hasOdcOrigin(url)) {\n\t\tprefix = \"\";\n\t}\n\n\treturn `${url.origin}/${prefix}v2.1`;\n}\n\n/**\n * Whether or not the given URL is a valid SPO/ODB URL\n * @param url - The URL to check\n * @internal\n */\nexport function isSpoUrl(url: URL): boolean {\n\t// Format: foo.sharepoint.com/_api/v2.1./drives/bar/items/baz and foo.sharepoint-df.com/...\n\tconst hostRegex = /\\.sharepoint(?:-df)?\\.com$/;\n\tconst pathRegex = /^\\/_api\\/v2\\.1\\/drives\\/[^/]+\\/items\\/[^/]+/;\n\n\treturn hostRegex.test(url.host.toLowerCase()) && pathRegex.test(url.pathname.toLowerCase());\n}\n\n/**\n * Whether or not the given URL is a valid ODC URL\n * @param url - The URL to check\n * @internal\n */\nexport function isOdcUrl(url: URL): boolean {\n\tif (!hasOdcOrigin(url)) {\n\t\treturn false;\n\t}\n\n\tconst path = url.pathname.toLowerCase();\n\n\t// Splitting the regexes so we don't have regex soup\n\t// Format: /v2.1/drive/items/ABC123!123 and /v2.1/drives/ABC123/items/ABC123!123\n\tconst odcRegex = /^\\/v2\\.1\\/(?:drive|drives\\/[^/]+)\\/items\\/[\\dA-Za-z]+!\\d+/;\n\n\t// Format: /v2.1/drives('ABC123')/items('ABC123!123')\n\tconst odcODataRegex = /^\\/v2\\.1\\/drives\\('[^/]+'\\)\\/items\\('[\\dA-Za-z]+!\\d+'\\)/;\n\n\treturn odcRegex.test(path) || odcODataRegex.test(path);\n}\n\n/**\n * Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID.\n * Returns undefined for invalid/malformed URLs.\n * @param url - The (raw) URL to parse\n * @internal\n */\nexport async function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefined> {\n\tconst pathname = url.pathname;\n\n\t// Joinsession like URL\n\t// Pick a regex based on the hostname\n\t// TODO This will only support ODC using api.onedrive.com, update to handle the future (share links etc)\n\tlet joinSessionMatch: RegExpExecArray | null;\n\tif (hasOdcOrigin(url)) {\n\t\t// Capture groups:\n\t\t// 0: match\n\t\t// 1: origin\n\t\t// 2: optional `drives` capture (the `/drives/<DRIVEID>` API format vs `/drive`)\n\t\t// 3: optional captured drive ID\n\t\t// 4: Item ID\n\t\t// 5: Drive ID portion of Item ID\n\t\tjoinSessionMatch =\n\t\t\t/(.*)\\/v2\\.1\\/drive(s\\/([\\dA-Za-z]+))?\\/items\\/(([\\dA-Za-z]+)!\\d+)/.exec(pathname);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\t// Try again but with the OData format ( `/drives('ABC123')/items('ABC123!456')` )\n\t\t\tjoinSessionMatch =\n\t\t\t\t/(.*)\\/v2\\.1\\/drives\\('([\\dA-Za-z]+)'\\)\\/items\\('(([\\dA-Za-z]+)!\\d+)'\\)/.exec(\n\t\t\t\t\tpathname,\n\t\t\t\t);\n\n\t\t\tif (joinSessionMatch === null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst driveId = joinSessionMatch[3] || joinSessionMatch[5];\n\t\tconst itemId = joinSessionMatch[4];\n\n\t\treturn { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };\n\t} else {\n\t\tjoinSessionMatch = /(.*)\\/_api\\/v2\\.1\\/drives\\/([^/]*)\\/items\\/([^/]*)(.*)/.exec(pathname);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst driveId = joinSessionMatch[2];\n\t\tconst itemId = joinSessionMatch[3];\n\n\t\treturn { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };\n\t}\n}\n\n/**\n * Inspect the ODSP siteUrl to guess if this document is in SPDF or MSIT, to aid livesite investigations\n * @param urlOnSite - The URL of the site or a resource on the site\n * @returns undefined if the URL doesn't match known SPDF/MSIT patterns, \"SPDF\" if it's SPDF, \"MSIT\" if it's MSIT\n */\nexport function checkForKnownServerFarmType(urlOnSite: string): \"SPDF\" | \"MSIT\" | undefined {\n\tconst domain = new URL(urlOnSite).hostname.toLowerCase();\n\tif (domain.endsWith(\".sharepoint-df.com\")) {\n\t\treturn \"SPDF\";\n\t} else if (\n\t\tdomain === \"microsoft.sharepoint.com\" ||\n\t\tdomain === \"microsoft-my.sharepoint.com\"\n\t) {\n\t\treturn \"MSIT\";\n\t}\n\treturn undefined;\n}\n"]}
|
package/dist/odspUtils.d.ts
CHANGED
|
@@ -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 { ITelemetryBaseLogger, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IResolvedUrl, ISnapshot, IContainerPackageInfo } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { ICacheEntry, IOdspResolvedUrl, IOdspUrlParts, ISharingLinkKind, InstrumentedStorageTokenFetcher, InstrumentedTokenFetcher, OdspResourceTokenFetchOptions, TokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
8
|
-
import { type IConfigProvider, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
-
import { ISnapshotContents } from "./odspPublicUtils.js";
|
|
5
|
+
import type { ITelemetryBaseLogger, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { IResolvedUrl, ISnapshot, IContainerPackageInfo } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import { type ICacheEntry, type IOdspResolvedUrl, type IOdspUrlParts, type ISharingLinkKind, type InstrumentedStorageTokenFetcher, type InstrumentedTokenFetcher, type OdspResourceTokenFetchOptions, type TokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
8
|
+
import { type IConfigProvider, type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
+
import type { ISnapshotContents } from "./odspPublicUtils.js";
|
|
10
10
|
export declare const getWithRetryForTokenRefreshRepeat = "getWithRetryForTokenRefreshRepeat";
|
|
11
11
|
/**
|
|
12
12
|
* @legacy
|
package/dist/odspUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspUtils.d.ts","sourceRoot":"","sources":["../src/odspUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"odspUtils.d.ts","sourceRoot":"","sources":["../src/odspUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,oBAAoB,EACpB,wBAAwB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EACX,YAAY,EACZ,SAAS,EACT,qBAAqB,EACrB,MAAM,6CAA6C,CAAC;AAcrD,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAG7B,KAAK,6BAA6B,EAElC,KAAK,YAAY,EAKjB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,eAAe,EAEpB,KAAK,mBAAmB,EAKxB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,eAAO,MAAM,iCAAiC,sCAAsC,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;I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