@fluidframework/odsp-driver 2.0.0-dev.7.3.0.210328 → 2.0.0-dev.7.3.0.211848
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/api-report/odsp-driver.api.md +2 -1
- package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +1 -1
- package/{lib/ReadBufferUtils.js.map → dist/ReadBufferUtils.cjs.map} +1 -1
- package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +2 -2
- package/dist/WriteBufferUtils.cjs.map +1 -0
- package/dist/{checkUrl.js → checkUrl.cjs} +2 -2
- package/dist/checkUrl.cjs.map +1 -0
- package/dist/{compactSnapshotParser.js → compactSnapshotParser.cjs} +4 -4
- package/dist/compactSnapshotParser.cjs.map +1 -0
- package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +4 -4
- package/dist/compactSnapshotWriter.cjs.map +1 -0
- package/dist/{constants.js → constants.cjs} +1 -1
- package/dist/constants.cjs.map +1 -0
- package/dist/{contracts.js → contracts.cjs} +1 -1
- package/dist/contracts.cjs.map +1 -0
- package/dist/{contractsPublic.js → contractsPublic.cjs} +1 -1
- package/dist/contractsPublic.cjs.map +1 -0
- package/dist/{createFile.js → createFile.cjs} +10 -10
- package/dist/createFile.cjs.map +1 -0
- package/dist/{createNewContainerOnExistingFile.js → createNewContainerOnExistingFile.cjs} +7 -7
- package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
- package/dist/{createNewModule.js → createNewModule.cjs} +3 -3
- package/dist/createNewModule.cjs.map +1 -0
- package/dist/{createNewUtils.js → createNewUtils.cjs} +4 -4
- package/dist/createNewUtils.cjs.map +1 -0
- package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +2 -2
- package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
- package/dist/{createOdspUrl.js → createOdspUrl.cjs} +1 -1
- package/dist/createOdspUrl.cjs.map +1 -0
- package/dist/{epochTracker.js → epochTracker.cjs} +6 -6
- package/dist/epochTracker.cjs.map +1 -0
- package/dist/{fetch.js → fetch.cjs} +1 -1
- package/dist/fetch.cjs.map +1 -0
- package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +8 -8
- package/dist/fetchSnapshot.cjs.map +1 -0
- package/dist/{getFileLink.js → getFileLink.cjs} +5 -5
- package/dist/getFileLink.cjs.map +1 -0
- package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
- package/dist/getQueryString.cjs.map +1 -0
- package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +1 -1
- package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
- package/dist/{index.js → index.cjs} +17 -17
- package/dist/index.cjs.map +1 -0
- package/dist/localOdspDriver/{localOdspDeltaStorageService.js → localOdspDeltaStorageService.cjs} +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
- package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +3 -3
- package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
- package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +4 -4
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
- package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +4 -4
- package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
- package/dist/{odspCache.js → odspCache.cjs} +1 -1
- package/dist/odspCache.cjs.map +1 -0
- package/dist/{odspDelayLoadedDeltaStream.js → odspDelayLoadedDeltaStream.cjs} +5 -5
- package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
- package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +2 -2
- package/dist/odspDeltaStorageService.cjs.map +1 -0
- package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +4 -4
- package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
- package/dist/{odspDocumentService.js → odspDocumentService.cjs} +8 -32
- package/dist/odspDocumentService.cjs.map +1 -0
- package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +3 -3
- package/dist/odspDocumentServiceFactory.cjs.map +1 -0
- package/dist/{odspDocumentServiceFactoryCore.js → odspDocumentServiceFactoryCore.cjs} +6 -30
- package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
- package/dist/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.cjs} +2 -2
- package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
- package/dist/{odspDocumentStorageManager.js → odspDocumentStorageManager.cjs} +7 -31
- package/dist/odspDocumentStorageManager.cjs.map +1 -0
- package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +1 -1
- package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
- package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +7 -7
- package/dist/odspDriverUrlResolver.cjs.map +1 -0
- package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +7 -7
- package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
- package/dist/{odspError.js → odspError.cjs} +2 -2
- package/dist/odspError.cjs.map +1 -0
- package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +2 -2
- package/dist/odspFluidFileLink.cjs.map +1 -0
- package/dist/{odspLocationRedirection.js → odspLocationRedirection.cjs} +2 -2
- package/dist/odspLocationRedirection.cjs.map +1 -0
- package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +1 -1
- package/dist/odspPublicUtils.cjs.map +1 -0
- package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +1 -1
- package/dist/odspSnapshotParser.cjs.map +1 -0
- package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +3 -3
- package/dist/odspSummaryUploadManager.cjs.map +1 -0
- package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +1 -1
- package/dist/odspUrlHelper.cjs.map +1 -0
- package/dist/{odspUtils.js → odspUtils.cjs} +3 -3
- package/dist/odspUtils.cjs.map +1 -0
- package/dist/{opsCaching.js → opsCaching.cjs} +1 -1
- package/dist/opsCaching.cjs.map +1 -0
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/{prefetchLatestSnapshot.js → prefetchLatestSnapshot.cjs} +3 -3
- package/dist/prefetchLatestSnapshot.cjs.map +1 -0
- package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +2 -2
- package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
- package/dist/{retryUtils.js → retryUtils.cjs} +2 -2
- package/dist/retryUtils.cjs.map +1 -0
- package/dist/{socketModule.js → socketModule.cjs} +1 -1
- package/dist/socketModule.cjs.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vroom.js → vroom.cjs} +4 -4
- package/{lib/vroom.js.map → dist/vroom.cjs.map} +1 -1
- package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +3 -3
- package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
- package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +1 -1
- package/lib/ReadBufferUtils.mjs.map +1 -0
- package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +2 -2
- package/lib/WriteBufferUtils.mjs.map +1 -0
- package/lib/{checkUrl.js → checkUrl.mjs} +2 -2
- package/lib/checkUrl.mjs.map +1 -0
- package/lib/{compactSnapshotParser.js → compactSnapshotParser.mjs} +4 -4
- package/lib/compactSnapshotParser.mjs.map +1 -0
- package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +4 -4
- package/lib/compactSnapshotWriter.mjs.map +1 -0
- package/lib/{constants.js → constants.mjs} +1 -1
- package/lib/constants.mjs.map +1 -0
- package/lib/{contracts.js → contracts.mjs} +1 -1
- package/lib/contracts.mjs.map +1 -0
- package/lib/{contractsPublic.js → contractsPublic.mjs} +1 -1
- package/lib/contractsPublic.mjs.map +1 -0
- package/lib/{createFile.js → createFile.mjs} +10 -10
- package/lib/createFile.mjs.map +1 -0
- package/lib/{createNewContainerOnExistingFile.js → createNewContainerOnExistingFile.mjs} +7 -7
- package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
- package/lib/{createNewModule.js → createNewModule.mjs} +3 -3
- package/lib/createNewModule.mjs.map +1 -0
- package/lib/{createNewUtils.js → createNewUtils.mjs} +4 -4
- package/lib/createNewUtils.mjs.map +1 -0
- package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +2 -2
- package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
- package/lib/{createOdspUrl.js → createOdspUrl.mjs} +1 -1
- package/lib/createOdspUrl.mjs.map +1 -0
- package/lib/{epochTracker.js → epochTracker.mjs} +6 -6
- package/lib/epochTracker.mjs.map +1 -0
- package/lib/{fetch.js → fetch.mjs} +1 -1
- package/lib/fetch.mjs.map +1 -0
- package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +8 -8
- package/lib/fetchSnapshot.mjs.map +1 -0
- package/lib/{getFileLink.js → getFileLink.mjs} +5 -5
- package/lib/getFileLink.mjs.map +1 -0
- package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
- package/lib/getQueryString.mjs.map +1 -0
- package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +1 -1
- package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
- package/lib/{index.js → index.mjs} +17 -24
- package/lib/index.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDeltaStorageService.js → localOdspDeltaStorageService.mjs} +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +3 -3
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +4 -4
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
- package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +4 -4
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
- package/lib/{odspCache.js → odspCache.mjs} +1 -5
- package/lib/odspCache.mjs.map +1 -0
- package/lib/{odspDelayLoadedDeltaStream.js → odspDelayLoadedDeltaStream.mjs} +5 -5
- package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
- package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +2 -2
- package/lib/odspDeltaStorageService.mjs.map +1 -0
- package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +4 -4
- package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
- package/lib/{odspDocumentService.js → odspDocumentService.mjs} +8 -10
- package/lib/odspDocumentService.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +3 -4
- package/lib/odspDocumentServiceFactory.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactoryCore.js → odspDocumentServiceFactoryCore.mjs} +6 -8
- package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
- package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +2 -2
- package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
- package/lib/{odspDocumentStorageManager.js → odspDocumentStorageManager.mjs} +7 -9
- package/lib/odspDocumentStorageManager.mjs.map +1 -0
- package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +1 -1
- package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
- package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +7 -11
- package/lib/odspDriverUrlResolver.mjs.map +1 -0
- package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +7 -11
- package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
- package/lib/{odspError.js → odspError.mjs} +2 -2
- package/lib/odspError.mjs.map +1 -0
- package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +2 -2
- package/lib/odspFluidFileLink.mjs.map +1 -0
- package/lib/{odspLocationRedirection.js → odspLocationRedirection.mjs} +2 -2
- package/lib/odspLocationRedirection.mjs.map +1 -0
- package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +1 -1
- package/lib/odspPublicUtils.mjs.map +1 -0
- package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +1 -1
- package/lib/odspSnapshotParser.mjs.map +1 -0
- package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +3 -3
- package/lib/odspSummaryUploadManager.mjs.map +1 -0
- package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +1 -1
- package/lib/odspUrlHelper.mjs.map +1 -0
- package/lib/{odspUtils.js → odspUtils.mjs} +3 -3
- package/lib/odspUtils.mjs.map +1 -0
- package/lib/{opsCaching.js → opsCaching.mjs} +1 -1
- package/lib/opsCaching.mjs.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{prefetchLatestSnapshot.js → prefetchLatestSnapshot.mjs} +3 -3
- package/lib/prefetchLatestSnapshot.mjs.map +1 -0
- package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +2 -2
- package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
- package/lib/{retryUtils.js → retryUtils.mjs} +2 -2
- package/lib/retryUtils.mjs.map +1 -0
- package/lib/{socketModule.js → socketModule.mjs} +1 -1
- package/lib/socketModule.mjs.map +1 -0
- package/lib/{vroom.js → vroom.mjs} +4 -4
- package/lib/vroom.mjs.map +1 -0
- package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +3 -7
- package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
- package/package.json +21 -21
- package/src/odspDocumentService.ts +1 -1
- package/src/odspDocumentServiceFactoryCore.ts +1 -1
- package/src/odspDocumentStorageManager.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +5 -3
- package/dist/ReadBufferUtils.js.map +0 -1
- package/dist/WriteBufferUtils.js.map +0 -1
- package/dist/checkUrl.js.map +0 -1
- package/dist/compactSnapshotParser.js.map +0 -1
- package/dist/compactSnapshotWriter.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/contracts.js.map +0 -1
- package/dist/contractsPublic.js.map +0 -1
- package/dist/createFile.js.map +0 -1
- package/dist/createNewContainerOnExistingFile.js.map +0 -1
- package/dist/createNewModule.js.map +0 -1
- package/dist/createNewUtils.js.map +0 -1
- package/dist/createOdspCreateContainerRequest.js.map +0 -1
- package/dist/createOdspUrl.js.map +0 -1
- package/dist/epochTracker.js.map +0 -1
- package/dist/fetch.js.map +0 -1
- package/dist/fetchSnapshot.js.map +0 -1
- package/dist/getFileLink.js.map +0 -1
- package/dist/getQueryString.js.map +0 -1
- package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
- package/dist/odspCache.js.map +0 -1
- package/dist/odspDelayLoadedDeltaStream.js.map +0 -1
- package/dist/odspDeltaStorageService.js.map +0 -1
- package/dist/odspDocumentDeltaConnection.js.map +0 -1
- package/dist/odspDocumentService.js.map +0 -1
- package/dist/odspDocumentServiceFactory.js.map +0 -1
- package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
- package/dist/odspDocumentStorageManager.js.map +0 -1
- package/dist/odspDocumentStorageServiceBase.js.map +0 -1
- package/dist/odspDriverUrlResolver.js.map +0 -1
- package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
- package/dist/odspError.js.map +0 -1
- package/dist/odspFluidFileLink.js.map +0 -1
- package/dist/odspLocationRedirection.js.map +0 -1
- package/dist/odspPublicUtils.js.map +0 -1
- package/dist/odspSnapshotParser.js.map +0 -1
- package/dist/odspSummaryUploadManager.js.map +0 -1
- package/dist/odspUrlHelper.js.map +0 -1
- package/dist/odspUtils.js.map +0 -1
- package/dist/opsCaching.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/prefetchLatestSnapshot.js.map +0 -1
- package/dist/retryErrorsStorageAdapter.js.map +0 -1
- package/dist/retryUtils.js.map +0 -1
- package/dist/socketModule.js.map +0 -1
- package/dist/vroom.js.map +0 -1
- package/dist/zipItDataRepresentationUtils.js.map +0 -1
- package/lib/WriteBufferUtils.js.map +0 -1
- package/lib/checkUrl.js.map +0 -1
- package/lib/compactSnapshotParser.js.map +0 -1
- package/lib/compactSnapshotWriter.js.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/contracts.js.map +0 -1
- package/lib/contractsPublic.js.map +0 -1
- package/lib/createFile.js.map +0 -1
- package/lib/createNewContainerOnExistingFile.js.map +0 -1
- package/lib/createNewModule.js.map +0 -1
- package/lib/createNewUtils.js.map +0 -1
- package/lib/createOdspCreateContainerRequest.js.map +0 -1
- package/lib/createOdspUrl.js.map +0 -1
- package/lib/epochTracker.js.map +0 -1
- package/lib/fetch.js.map +0 -1
- package/lib/fetchSnapshot.js.map +0 -1
- package/lib/getFileLink.js.map +0 -1
- package/lib/getQueryString.js.map +0 -1
- package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
- package/lib/odspCache.js.map +0 -1
- package/lib/odspDelayLoadedDeltaStream.js.map +0 -1
- package/lib/odspDeltaStorageService.js.map +0 -1
- package/lib/odspDocumentDeltaConnection.js.map +0 -1
- package/lib/odspDocumentService.js.map +0 -1
- package/lib/odspDocumentServiceFactory.js.map +0 -1
- package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
- package/lib/odspDocumentStorageManager.js.map +0 -1
- package/lib/odspDocumentStorageServiceBase.js.map +0 -1
- package/lib/odspDriverUrlResolver.js.map +0 -1
- package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
- package/lib/odspError.js.map +0 -1
- package/lib/odspFluidFileLink.js.map +0 -1
- package/lib/odspLocationRedirection.js.map +0 -1
- package/lib/odspPublicUtils.js.map +0 -1
- package/lib/odspSnapshotParser.js.map +0 -1
- package/lib/odspSummaryUploadManager.js.map +0 -1
- package/lib/odspUrlHelper.js.map +0 -1
- package/lib/odspUtils.js.map +0 -1
- package/lib/opsCaching.js.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/prefetchLatestSnapshot.js.map +0 -1
- package/lib/retryErrorsStorageAdapter.js.map +0 -1
- package/lib/retryUtils.js.map +0 -1
- package/lib/socketModule.js.map +0 -1
- package/lib/zipItDataRepresentationUtils.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
|
@@ -15,6 +15,7 @@ import { IFileEntry } from '@fluidframework/odsp-driver-definitions';
|
|
|
15
15
|
import { IOdspResolvedUrl } from '@fluidframework/odsp-driver-definitions';
|
|
16
16
|
import { IOdspUrlParts } from '@fluidframework/odsp-driver-definitions';
|
|
17
17
|
import { IPersistedCache } from '@fluidframework/odsp-driver-definitions';
|
|
18
|
+
import { IPrefetchSnapshotContents as IPrefetchSnapshotContents_2 } from './odspCache';
|
|
18
19
|
import { IRelaySessionAwareDriverFactory } from '@fluidframework/odsp-driver-definitions';
|
|
19
20
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
20
21
|
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
@@ -229,7 +230,7 @@ export class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory,
|
|
|
229
230
|
// (undocumented)
|
|
230
231
|
protected persistedCache: IPersistedCache;
|
|
231
232
|
// (undocumented)
|
|
232
|
-
get snapshotPrefetchResultCache(): PromiseCache<string,
|
|
233
|
+
get snapshotPrefetchResultCache(): PromiseCache<string, IPrefetchSnapshotContents_2>;
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
// @public @deprecated (undocumented)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadBufferUtils.
|
|
1
|
+
{"version":3,"file":"ReadBufferUtils.cjs","sourceRoot":"","sources":["../src/ReadBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD;;;GAGG;AACH,MAAa,UAAU;IAGtB,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED,YAA+B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QANrC,UAAK,GAAG,CAAC,CAAC;QAOnB,4DAA4D;QAC5D,+DAA+D;QAC/D,8DAA8D;QAC9D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,IAAW,GAAG;QACb,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IACxC,CAAC;IACD,IAAW,GAAG;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IACD,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,KAAa,EAAE,GAAW;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IAChB,CAAC;IAEM,IAAI,CAAC,SAAS,GAAG,CAAC;QACxB,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,MAAM,GAAG,SAAS,CAAC;QACvB,OAAO,MAAM,GAAG,CAAC,EAAE;YAClB,IAAA,mBAAM,EAAC,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAC1D,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;YAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,UAAU,IAAI,GAAG,CAAC;YAClB,MAAM,EAAE,CAAC;SACT;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAEM,IAAI,CAAC,MAAc;QACzB,IAAA,mBAAM,EAAC,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC;QACrB,IAAA,mBAAM,EAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAClF,CAAC;CACD;AAnDD,gCAmDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\n\n/**\n * Buffer class, used to sequentially read data.\n * Used by tree code to reconstruct a tree from binary representation.\n */\nexport class ReadBuffer {\n\tprotected index = 0;\n\n\tpublic get buffer() {\n\t\treturn this.data;\n\t}\n\n\tconstructor(protected readonly data: Uint8Array) {\n\t\t// BlobShallowCopy will return to users parts of this array.\n\t\t// We need to ensure that nobody can change it, as it will have\n\t\t// catastrophic result and will be really hard to investigate.\n\t\tObject.freeze(data.buffer);\n\t}\n\n\tpublic get eof() {\n\t\treturn this.index === this.data.length;\n\t}\n\tpublic get pos() {\n\t\treturn this.index;\n\t}\n\tpublic get length() {\n\t\treturn this.data.length;\n\t}\n\n\tpublic slice(start: number, end: number) {\n\t\treturn this.data.slice(start, end);\n\t}\n\n\tpublic reset() {\n\t\tthis.index = 0;\n\t}\n\n\tpublic read(lengthArg = 1): number {\n\t\tlet res = 0;\n\t\tlet multiplier = 1;\n\t\tlet length = lengthArg;\n\t\twhile (length > 0) {\n\t\t\tassert(!this.eof, 0x223 /* \"unexpected end of buffer\" */);\n\t\t\tres += this.data[this.index] * multiplier;\n\t\t\tthis.index++;\n\t\t\tmultiplier *= 256;\n\t\t\tlength--;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic skip(length: number) {\n\t\tassert(length >= 0, 0x224 /* \"Skip length should be positive\" */);\n\t\tthis.index += length;\n\t\tassert(this.index <= this.data.length, 0x3dc /* skipping past size of buffer */);\n\t}\n}\n"]}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.TreeBuilderSerializer = exports.calcLength = exports.WriteBuffer = void 0;
|
|
8
8
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
9
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
-
const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils");
|
|
10
|
+
const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils.cjs");
|
|
11
11
|
/**
|
|
12
12
|
* Buffer class, used to sequentially writ data.
|
|
13
13
|
* Used by tree code to serialize tree into binary representation.
|
|
@@ -249,4 +249,4 @@ class TreeBuilderSerializer extends NodeCoreSerializer {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
exports.TreeBuilderSerializer = TreeBuilderSerializer;
|
|
252
|
-
//# sourceMappingURL=WriteBufferUtils.
|
|
252
|
+
//# sourceMappingURL=WriteBufferUtils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteBufferUtils.cjs","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,2DAAoD;AACpD,qFAQwC;AAExC;;;GAGG;AACH,MAAa,WAAW;IAAxB;QACW,SAAI,GAAgB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,UAAK,GAAG,CAAC,CAAC;IAsCrB,CAAC;IApCU,IAAI,CAAC,IAAY;QAC1B,IAAA,mBAAM,EAAC,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE;YAC1B,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;YACpD,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;YAC1B,OAAO,KAAK,GAAG,MAAM,EAAE;gBACtB,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChC,KAAK,EAAE,CAAC;aACR;YACD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;SACpB;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,SAAS,GAAG,CAAC;QAC1C,IAAI,IAAI,GAAG,OAAO,CAAC;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;YACzD,MAAM,CAAC,KAAK,CAAC,IAAA,6CAAc,EAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC,CAAC;YACzD,0EAA0E;YAC1E,IAAI,GAAG,GAAG,CAAC,EAAE;gBACZ,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;aACzB;SACD;aAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;YACtC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3C;aAAM;YACN,IAAA,mBAAM,EAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAChE,IAAI,KAAK,CAAC,UAAU,EAAE;gBACrB,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;aAC7D;iBAAM;gBACN,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACvC;SACD;KACD;AACF,CAAC;AAED,MAAM,kBAAmB,SAAQ,uCAAQ;IACxC;QACC,KAAK,EAAE,CAAC;IACT,CAAC;IAEM,SAAS,CAAC,MAAmB;QACnC,iBAAiB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC5D,CAAC;CACD;AAED,MAAa,qBAAsB,SAAQ,kBAAkB;IAC5D;QACC,KAAK,EAAE,CAAC;IACT,CAAC;IAEM,SAAS;QACf,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;CACD;AAVD,sDAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tBlobCore,\n\tcodeToBytesMap,\n\tgetValueSafely,\n\tMarkerCodes,\n\tMarkerCodesEnd,\n\tMarkerCodesStart,\n\tNodeCore,\n} from \"./zipItDataRepresentationUtils\";\n\n/**\n * Buffer class, used to sequentially writ data.\n * Used by tree code to serialize tree into binary representation.\n */\nexport class WriteBuffer {\n\tprotected data?: Uint8Array = new Uint8Array(4096);\n\tprotected index = 0;\n\n\tprotected push(code: number) {\n\t\tassert(this.data !== undefined, 0x225 /* \"Data should be there\" */);\n\t\tconst length = this.data.length;\n\t\tif (this.index === length) {\n\t\t\tconst newData = new Uint8Array(length * 1.2 + 4096);\n\t\t\tlet index = 0;\n\t\t\tconst oldData = this.data;\n\t\t\twhile (index < length) {\n\t\t\t\tnewData[index] = oldData[index];\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tthis.data = newData;\n\t\t}\n\t\tthis.data[this.index] = code % 256;\n\t\tthis.index++;\n\t}\n\n\tpublic write(codeArg: number, lengthArg = 1) {\n\t\tlet code = codeArg;\n\t\tlet length = lengthArg;\n\t\twhile (length > 0) {\n\t\t\tthis.push(code % 256);\n\t\t\tcode = Math.floor(code / 256);\n\t\t\tlength--;\n\t\t}\n\t\tassert(code === 0, 0x226 /* Should write complete data */);\n\t}\n\n\tpublic done(): Uint8Array {\n\t\tassert(this.data !== undefined, 0x227 /* \"Data should be there\" */);\n\t\t// We can slice it to have smaller memory representation.\n\t\t// But it will be way more expensive in terms of CPU cycles!\n\t\tconst buffer = this.data.subarray(0, this.index);\n\t\tthis.data = undefined;\n\t\treturn buffer;\n\t}\n}\n\n// This list of maps below is reverse mapping of Marker Codes specified in zipItDataRepresentationUtils.ts file.\n// We can also found them on server filestore code.\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n\n/**\n * This contains mapping of number of bytes representing the corresponding string length to Marker Codes.\n */\nconst utf8StringBytesToCodeMap = {\n\t0: 13,\n\t1: 14,\n\t2: 15,\n\t4: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding length in which actual data(base64 string)\n * will be stored to Marker Codes.\n */\nconst binaryBytesToCodeMap = {\n\t0: 32,\n\t1: 33,\n\t2: 34,\n\t4: 35,\n\t8: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding const string id to Marker Codes.\n */\nconst constStringBytesToCodeMap = {\n\t1: 17,\n\t2: 18,\n\t4: 19,\n};\n\n/**\n * This contains mapping of number of bytes to Marker Codes representing the corresponding Integer.\n */\nconst integerBytesToCodeMap = {\n\t0: 1,\n\t1: 3,\n\t2: 5,\n\t4: 7,\n\t8: 9,\n};\n\n/**\n * This contains mapping of boolean to Marker Codes representing the corresponding bool value.\n */\nconst boolToCodeMap = [\n\t12, // false\n\t11, // true\n];\n\n/**\n * Calculate how many bytes are required to encode an integer. This is always power of 2.\n * So if 6 bytes are required to store an integer than it will return 8. 0 is a special case for which we\n * return 0 as it is usually just represented by marker code and we don't store the actual data.\n * @param num - number to encode.\n */\nexport function calcLength(numArg: number) {\n\tif (numArg === 0) {\n\t\treturn 0;\n\t}\n\tlet num = numArg;\n\tlet lengthLen = 0;\n\twhile (num > 0) {\n\t\tnum = Math.floor(num / 256);\n\t\tlengthLen++;\n\t}\n\tlet res = 1;\n\twhile (res < lengthLen) {\n\t\tres *= 2;\n\t}\n\treturn res;\n}\n\n/**\n * Implementation of serialization of blobs in buffer with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param content - string to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeDictionaryString(\n\tbuffer: WriteBuffer,\n\tcontent: string,\n\tdictionary: Map<string, number>,\n) {\n\tlet id = dictionary.get(content);\n\tlet idLength: number;\n\tif (id === undefined) {\n\t\tconst data = IsoBuffer.from(content, \"utf8\");\n\t\tconst lengthOfDataLen = calcLength(data.length);\n\n\t\tid = dictionary.size + 1;\n\t\tidLength = calcLength(id);\n\t\tdictionary.set(content, id);\n\t\tconst code =\n\t\t\tlengthOfDataLen > 1 || idLength > 1\n\t\t\t\t? MarkerCodes.ConstStringDeclareBig\n\t\t\t\t: MarkerCodes.ConstStringDeclare;\n\t\t// Write marker code for const string.\n\t\tbuffer.write(code);\n\t\tconst bytes = getValueSafely(codeToBytesMap, code);\n\t\tassert(\n\t\t\tbytes >= lengthOfDataLen,\n\t\t\t0x283 /* \"Length of data len should fit in the bytes from the map\" */,\n\t\t);\n\t\tassert(bytes >= idLength, 0x284 /* \"Length of id should fit in the bytes from the map\" */);\n\t\t// Assign and write id for const string.\n\t\tbuffer.write(id, bytes);\n\t\t// Write length of const string.\n\t\tbuffer.write(data.length, bytes);\n\t\t// Write const string data.\n\t\tfor (const element of data) {\n\t\t\tbuffer.write(element);\n\t\t}\n\t} else {\n\t\tidLength = calcLength(id);\n\t}\n\t// Write Marker Code\n\tbuffer.write(getValueSafely(constStringBytesToCodeMap, idLength));\n\t// Write id of const string\n\tbuffer.write(id, idLength);\n}\n\nfunction serializeString(buffer: WriteBuffer, content: string, codeMap = binaryBytesToCodeMap) {\n\tserializeBlob(buffer, IsoBuffer.from(content, \"utf8\"), utf8StringBytesToCodeMap);\n}\n\n/**\n * Implementation of serialization of blobs in buffer with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param blob - blob to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeBlob(\n\tbuffer: WriteBuffer,\n\tdata: Uint8Array,\n\tcodeMap: Record<number, number> = binaryBytesToCodeMap,\n) {\n\tconst lengthOfDataLen = calcLength(data.length);\n\t// Write Marker code.\n\tbuffer.write(getValueSafely(codeMap, lengthOfDataLen));\n\t// Write actual data if length greater than 0, otherwise Marker Code is enough.\n\tif (lengthOfDataLen > 0) {\n\t\tbuffer.write(data.length, lengthOfDataLen);\n\t\tfor (const element of data) {\n\t\t\tbuffer.write(element);\n\t\t}\n\t}\n}\n\n/**\n * Implementation of serialization of nodes with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param nodeCore - Node to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeNodeCore(\n\tbuffer: WriteBuffer,\n\tnodeCore: NodeCore,\n\tdictionary: Map<string, number>,\n) {\n\tfor (const child of nodeCore.nodes) {\n\t\tif (child instanceof NodeCore) {\n\t\t\t// For a tree node start and end with set/list start and end marker codes.\n\t\t\tconst startCode = MarkerCodesStart[child.type];\n\t\t\tconst endCode = MarkerCodesEnd[child.type];\n\t\t\tassert(startCode !== undefined, 0x285 /* \"Start code should not undefined\" */);\n\t\t\tassert(endCode !== undefined, 0x286 /* \"End code should not undefined\" */);\n\t\t\tbuffer.write(startCode);\n\t\t\tserializeNodeCore(buffer, child, dictionary);\n\t\t\tbuffer.write(endCode);\n\t\t} else if (child instanceof BlobCore) {\n\t\t\tserializeBlob(buffer, child.buffer);\n\t\t} else if (typeof child === \"number\") {\n\t\t\t// Calculate length in which integer will be stored\n\t\t\tconst len = calcLength(child);\n\t\t\t// Write corresponding Marker code for length of integer.\n\t\t\tbuffer.write(getValueSafely(integerBytesToCodeMap, len));\n\t\t\t// Write actual number if greater than 0, otherwise Marker Code is enough.\n\t\t\tif (len > 0) {\n\t\t\t\tbuffer.write(child, len);\n\t\t\t}\n\t\t} else if (typeof child === \"boolean\") {\n\t\t\tbuffer.write(boolToCodeMap[child ? 1 : 0]);\n\t\t} else {\n\t\t\tassert(child._stringElement, 0x3dd /* Unsupported node type */);\n\t\t\tif (child.dictionary) {\n\t\t\t\tserializeDictionaryString(buffer, child.content, dictionary);\n\t\t\t} else {\n\t\t\t\tserializeString(buffer, child.content);\n\t\t\t}\n\t\t}\n\t}\n}\n\nclass NodeCoreSerializer extends NodeCore {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tpublic serialize(buffer: WriteBuffer) {\n\t\tserializeNodeCore(buffer, this, new Map<string, number>());\n\t}\n}\n\nexport class TreeBuilderSerializer extends NodeCoreSerializer {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tpublic serialize(): Uint8Array {\n\t\tconst buffer = new WriteBuffer();\n\t\tsuper.serialize(buffer);\n\t\treturn buffer.done();\n\t}\n}\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.checkUrl = void 0;
|
|
8
|
-
const odspFluidFileLink_1 = require("./odspFluidFileLink");
|
|
8
|
+
const odspFluidFileLink_1 = require("./odspFluidFileLink.cjs");
|
|
9
9
|
/**
|
|
10
10
|
* A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.
|
|
11
11
|
* Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.
|
|
@@ -32,4 +32,4 @@ function checkUrl(documentUrl) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
exports.checkUrl = checkUrl;
|
|
35
|
-
//# sourceMappingURL=checkUrl.
|
|
35
|
+
//# sourceMappingURL=checkUrl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkUrl.cjs","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA4D;AAE5D;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACxC,MAAM,OAAO,GAAG,IAAA,yCAAqB,EAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE;QACb,OAAO,SAAS,CAAC;KACjB;IAED,IAAI,UAA8B,CAAC;IACnC,IAAI;QACH,IAAI,OAAO,EAAE,OAAO,EAAE;YACrB,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;SAC9C;KACD;IAAC,MAAM,GAAE;IAEV,OAAO;QACN,eAAe,EAAE,OAAO,EAAE,oBAAoB;QAC9C,uEAAuE;QACvE,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAC;AACH,CAAC;AAnBD,4BAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DriverPreCheckInfo } from \"@fluidframework/driver-definitions\";\nimport { getLocatorFromOdspUrl } from \"./odspFluidFileLink\";\n\n/**\n * A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.\n * Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.\n * Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs\n * before the entire Fluid loading process needs to be kicked off.\n * @public\n */\nexport function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined {\n\tconst locator = getLocatorFromOdspUrl(documentUrl);\n\n\tif (!locator) {\n\t\treturn undefined;\n\t}\n\n\tlet siteOrigin: string | undefined;\n\ttry {\n\t\tif (locator?.siteUrl) {\n\t\t\tsiteOrigin = new URL(locator?.siteUrl).origin;\n\t\t}\n\t} catch {}\n\n\treturn {\n\t\tcodeDetailsHint: locator?.containerPackageName,\n\t\t// Add the snapshot endpoint, which has the same domain as the site URL\n\t\tcriticalBootDomains: siteOrigin ? [siteOrigin] : undefined,\n\t};\n}\n"]}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.parseCompactSnapshotResponse = exports.currentReadVersion = exports.snapshotMinReadVersion = void 0;
|
|
8
8
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
-
const ReadBufferUtils_1 = require("./ReadBufferUtils");
|
|
10
|
-
const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils");
|
|
11
|
-
const odspUtils_1 = require("./odspUtils");
|
|
9
|
+
const ReadBufferUtils_1 = require("./ReadBufferUtils.cjs");
|
|
10
|
+
const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils.cjs");
|
|
11
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
12
12
|
exports.snapshotMinReadVersion = "1.0";
|
|
13
13
|
exports.currentReadVersion = "1.0";
|
|
14
14
|
/**
|
|
@@ -204,4 +204,4 @@ function parseCompactSnapshotResponse(buffer, logger) {
|
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
206
|
exports.parseCompactSnapshotResponse = parseCompactSnapshotResponse;
|
|
207
|
-
//# sourceMappingURL=compactSnapshotParser.
|
|
207
|
+
//# sourceMappingURL=compactSnapshotParser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compactSnapshotParser.cjs","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAIpD,2DAA+C;AAC/C,qFAUwC;AACxC,+CAAsC;AAEzB,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAC/B,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAWxC;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAe;IACvC,IAAA,qDAAsB,EAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACrE,IAAI,sBAAsB,GAAG,CAAC,CAAC;IAC/B,MAAM,KAAK,GAA6B,IAAI,GAAG,EAAE,CAAC;IAClD,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;QACxB,IAAA,qDAAsB,EAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAEpD;;;;WAIG;QACH,IACC,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI;YAC/B,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,MAAM,EAChC;YACD,oBAAoB;YACpB,iBAAiB;YACjB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,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OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9F,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,IAAA,mBAAO,EAAC,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7E,OAAO;QACN,GAAG,QAAQ;QACX,GAAG,KAAK;QACR,GAAG,EAAE,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;QACvE,oBAAoB,EAAE,OAAO,CAAC,GAAG;QACjC,cAAc,EAAE;YACf,GAAG,cAAc;YACjB,oBAAoB;YACpB,aAAa;YACb,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB;YACvD,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;SACpD;KACD,CAAC;AACH,CAAC;AA7CD,oEA6CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport {\n\tassertBlobCoreInstance,\n\tgetStringInstance,\n\tassertBoolInstance,\n\tassertNodeCoreInstance,\n\tassertNumberInstance,\n\tgetNodeProps,\n\tNodeCore,\n\tNodeTypes,\n\tTreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\nimport { measure } from \"./odspUtils\";\n\nexport const snapshotMinReadVersion = \"1.0\";\nexport const currentReadVersion = \"1.0\";\n\n/**\n * The parsing is significantly faster if the position of props is well known instead of dynamic. So these variables\n * represents how many times slower parsing path is executed. This will be then logged into telemetry.\n * @public\n */\nexport interface ISnapshotContentsWithProps extends ISnapshotContents {\n\ttelemetryProps: Record<string, number>;\n}\n\n/**\n * Recreates blobs section of the tree.\n * @param node - tree node to read blob section from\n */\nfunction readBlobSection(node: NodeTypes) {\n\tassertNodeCoreInstance(node, \"TreeBlobs should be of type NodeCore\");\n\tlet slowBlobStructureCount = 0;\n\tconst blobs: Map<string, ArrayBuffer> = new Map();\n\tfor (const blob of node) {\n\t\tassertNodeCoreInstance(blob, \"blob should be node\");\n\n\t\t/**\n\t\t * Perf optimization - the most common cases!\n\t\t * This is essentially unrolling code below for faster processing\n\t\t * It speeds up tree parsing by 2-3x times!\n\t\t */\n\t\tif (\n\t\t\tblob.length === 4 &&\n\t\t\tblob.getMaybeString(0) === \"id\" &&\n\t\t\tblob.getMaybeString(2) === \"data\"\n\t\t) {\n\t\t\t// \"id\": <node name>\n\t\t\t// \"data\": <blob>\n\t\t\tblobs.set(blob.getString(1), blob.getBlob(3).arrayBuffer);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/**\n\t\t * More generalized workflow\n\t\t */\n\t\tslowBlobStructureCount += 1;\n\t\tconst records = getNodeProps(blob);\n\t\tassertBlobCoreInstance(records.data, \"data should be of BlobCore type\");\n\t\tconst id = getStringInstance(records.id, \"blob id should be string\");\n\t\tblobs.set(id, records.data.arrayBuffer);\n\t}\n\treturn { blobs, slowBlobStructureCount };\n}\n\n/**\n * Recreates ops section of the tree.\n * @param node - tree node to read ops section from\n */\nfunction readOpsSection(node: NodeTypes) {\n\tassertNodeCoreInstance(node, \"Deltas should be of type NodeCore\");\n\tconst ops: ISequencedDocumentMessage[] = [];\n\tconst records = getNodeProps(node);\n\tassertNumberInstance(records.firstSequenceNumber, \"Seq number should be a number\");\n\tassertNodeCoreInstance(records.deltas, \"Deltas should be a Node\");\n\tfor (let i = 0; i < records.deltas.length; ++i) {\n\t\tops.push(JSON.parse(records.deltas.getString(i)));\n\t}\n\t// Due to a bug at service side, in an edge case service was serializing deltas even\n\t// when there are no ops. So just make the code resilient to that bug. Service has also\n\t// fixed that bug.\n\tassert(\n\t\tops.length === 0 || records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,\n\t\t0x280 /* \"Validate first op seq number\" */,\n\t);\n\treturn ops;\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readTreeSection(node: NodeCore) {\n\tlet slowTreeStructureCount = 0;\n\tconst trees = {};\n\tconst snapshotTree: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees,\n\t};\n\tfor (const treeNode of node) {\n\t\tassertNodeCoreInstance(treeNode, \"tree nodes should be nodes\");\n\n\t\t/**\n\t\t * Perf optimization - the most common cases!\n\t\t * This is essentially unrolling code below for faster processing\n\t\t * It speeds up tree parsing by 2-3x times!\n\t\t */\n\t\tconst length = treeNode.length;\n\t\tif (length > 0 && treeNode.getMaybeString(0) === \"name\") {\n\t\t\tif (length === 4) {\n\t\t\t\tconst content = treeNode.getMaybeString(2);\n\t\t\t\t// \"name\": <node name>\n\t\t\t\t// \"children\": <blob id>\n\t\t\t\tif (content === \"children\") {\n\t\t\t\t\tconst result = readTreeSection(treeNode.getNode(3));\n\t\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// \"name\": <node name>\n\t\t\t\t// \"value\": <blob id>\n\t\t\t\tif (content === \"value\") {\n\t\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(3);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// \"name\": <node name>\n\t\t\t// \"nodeType\": 3\n\t\t\t// \"value\": <blob id>\n\t\t\tif (\n\t\t\t\tlength === 6 &&\n\t\t\t\ttreeNode.getMaybeString(2) === \"nodeType\" &&\n\t\t\t\ttreeNode.getMaybeString(4) === \"value\"\n\t\t\t) {\n\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(5);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// \"name\": <node name>\n\t\t\t// \"unreferenced\": true\n\t\t\t// \"children\": <blob id>\n\t\t\tif (\n\t\t\t\tlength === 6 &&\n\t\t\t\ttreeNode.getMaybeString(2) === \"unreferenced\" &&\n\t\t\t\ttreeNode.getMaybeString(4) === \"children\"\n\t\t\t) {\n\t\t\t\tconst result = readTreeSection(treeNode.getNode(5));\n\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\tassert(treeNode.getBool(3), 0x3db /* Unreferenced if present should be true */);\n\t\t\t\tsnapshotTree.unreferenced = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * More generalized workflow\n\t\t */\n\t\tslowTreeStructureCount += 1;\n\t\tconst records = getNodeProps(treeNode);\n\n\t\tif (records.unreferenced !== undefined) {\n\t\t\tassertBoolInstance(records.unreferenced, \"Unreferenced flag should be bool\");\n\t\t\tassert(records.unreferenced, 0x281 /* \"Unreferenced if present should be true\" */);\n\t\t\tsnapshotTree.unreferenced = true;\n\t\t}\n\n\t\tconst path = getStringInstance(records.name, \"Path name should be string\");\n\t\tif (records.value !== undefined) {\n\t\t\tsnapshotTree.blobs[path] = getStringInstance(\n\t\t\t\trecords.value,\n\t\t\t\t\"Blob value should be string\",\n\t\t\t);\n\t\t} else if (records.children !== undefined) {\n\t\t\tassertNodeCoreInstance(records.children, \"Trees should be of type NodeCore\");\n\t\t\tconst result = readTreeSection(records.children);\n\t\t\ttrees[path] = result.snapshotTree;\n\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t} else {\n\t\t\ttrees[path] = { blobs: {}, trees: {} };\n\t\t}\n\t}\n\treturn { snapshotTree, slowTreeStructureCount };\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readSnapshotSection(node: NodeTypes) {\n\tassertNodeCoreInstance(node, \"Snapshot should be of type NodeCore\");\n\tconst records = getNodeProps(node);\n\n\tassertNodeCoreInstance(records.treeNodes, \"TreeNodes should be of type NodeCore\");\n\tassertNumberInstance(records.sequenceNumber, \"sequenceNumber should be of type number\");\n\tconst { snapshotTree, slowTreeStructureCount } = readTreeSection(records.treeNodes);\n\tsnapshotTree.id = getStringInstance(records.id, \"snapshotId should be string\");\n\tconst sequenceNumber = records.sequenceNumber.valueOf();\n\treturn {\n\t\tsequenceNumber,\n\t\tsnapshotTree,\n\t\tslowTreeStructureCount,\n\t};\n}\n\n/**\n * Converts snapshot from binary compact representation to tree/blobs/ops.\n * @param buffer - Compact snapshot to be parsed into tree/blobs/ops.\n * @returns Tree, blobs and ops from the snapshot.\n * @public\n */\nexport function parseCompactSnapshotResponse(\n\tbuffer: Uint8Array,\n\tlogger: ITelemetryLoggerExt,\n): ISnapshotContentsWithProps {\n\tconst { builder, telemetryProps } = TreeBuilder.load(new ReadBuffer(buffer), logger);\n\tassert(builder.length === 1, 0x219 /* \"1 root should be there\" */);\n\tconst root = builder.getNode(0);\n\n\tconst records = getNodeProps(root);\n\n\tconst mrv = getStringInstance(records.mrv, \"minReadVersion should be string\");\n\tconst cv = getStringInstance(records.cv, \"createVersion should be string\");\n\tif (records.lsn !== undefined) {\n\t\tassertNumberInstance(records.lsn, \"lsn should be a number\");\n\t}\n\n\tassert(\n\t\tparseFloat(snapshotMinReadVersion) >= parseFloat(mrv),\n\t\t0x20f /* \"Driver min read version should >= to server minReadVersion\" */,\n\t);\n\tassert(\n\t\tparseFloat(cv) >= parseFloat(snapshotMinReadVersion),\n\t\t0x210 /* \"Snapshot should be created with minReadVersion or above\" */,\n\t);\n\tassert(\n\t\tcurrentReadVersion === cv,\n\t\t0x2c2 /* \"Create Version should be equal to currentReadVersion\" */,\n\t);\n\n\tconst [snapshot, durationSnapshotTree] = measure(() => readSnapshotSection(records.snapshot));\n\tconst [blobs, durationBlobs] = measure(() => readBlobSection(records.blobs));\n\n\treturn {\n\t\t...snapshot,\n\t\t...blobs,\n\t\tops: records.deltas !== undefined ? readOpsSection(records.deltas) : [],\n\t\tlatestSequenceNumber: records.lsn,\n\t\ttelemetryProps: {\n\t\t\t...telemetryProps,\n\t\t\tdurationSnapshotTree,\n\t\t\tdurationBlobs,\n\t\t\tslowTreeStructureCount: snapshot.slowTreeStructureCount,\n\t\t\tslowBlobStructureCount: blobs.slowBlobStructureCount,\n\t\t},\n\t};\n}\n"]}
|
|
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.convertToCompactSnapshot = void 0;
|
|
8
8
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
9
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
-
const compactSnapshotParser_1 = require("./compactSnapshotParser");
|
|
11
|
-
const WriteBufferUtils_1 = require("./WriteBufferUtils");
|
|
12
|
-
const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils");
|
|
10
|
+
const compactSnapshotParser_1 = require("./compactSnapshotParser.cjs");
|
|
11
|
+
const WriteBufferUtils_1 = require("./WriteBufferUtils.cjs");
|
|
12
|
+
const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils.cjs");
|
|
13
13
|
/**
|
|
14
14
|
* Writes header section of the snapshot.
|
|
15
15
|
* @param node - snapshot node to serialize to
|
|
@@ -140,4 +140,4 @@ function convertToCompactSnapshot(snapshotContents) {
|
|
|
140
140
|
return builder.serialize();
|
|
141
141
|
}
|
|
142
142
|
exports.convertToCompactSnapshot = convertToCompactSnapshot;
|
|
143
|
-
//# sourceMappingURL=compactSnapshotWriter.
|
|
143
|
+
//# sourceMappingURL=compactSnapshotWriter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compactSnapshotWriter.cjs","sourceRoot":"","sources":["../src/compactSnapshotWriter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,2DAAoD;AAMpD,uE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S,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;KACH;AACF,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,gBAAmC;IAC3E,MAAM,OAAO,GAAG,IAAI,wCAAqB,EAAE,CAAC;IAC5C,wBAAwB;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IACnC,IAAA,mBAAM,EACL,gBAAgB,CAAC,cAAc,KAAK,SAAS,EAC7C,KAAK,CAAC,qCAAqC,CAC3C,CAAC;IAEF,IAAI,oBAAoB,GAAG,gBAAgB,CAAC,oBAAoB,CAAC;IACjE,IAAI,oBAAoB,KAAK,SAAS,EAAE;QACvC,oBAAoB;YACnB,gBAAgB,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;gBAC9B,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc;gBACtE,CAAC,CAAC,gBAAgB,CAAC,cAAc,CAAC;KACpC;IAED,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAEnD,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAE/F,YAAY;IACZ,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEpD,2BAA2B;IAC3B,eAAe,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC,SAAS,EAAE,CAAC;AAC5B,CAAC;AA5BD,4DA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tIBlob,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n} from \"@fluidframework/protocol-definitions\";\nimport { snapshotMinReadVersion } from \"./compactSnapshotParser\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { TreeBuilderSerializer } from \"./WriteBufferUtils\";\nimport {\n\taddBoolProperty,\n\taddNumberProperty,\n\taddStringProperty,\n\taddDictionaryStringProperty,\n\tNodeCore,\n} from \"./zipItDataRepresentationUtils\";\n\n/**\n * Writes header section of the snapshot.\n * @param node - snapshot node to serialize to\n * @param latestSequenceNumber - latest seq number of the container.\n */\nfunction writeSnapshotProps(node: NodeCore, latestSequenceNumber: number) {\n\taddStringProperty(node, \"mrv\", snapshotMinReadVersion);\n\taddStringProperty(node, \"cv\", snapshotMinReadVersion);\n\taddNumberProperty(node, \"lsn\", latestSequenceNumber);\n}\n\n/**\n * Represents blobs in the tree.\n * @param snapshotNode - node to serialize to.\n * @param blobs - blobs that is being serialized\n */\nfunction writeBlobsSection(snapshotNode: NodeCore, blobs: Map<string, IBlob | ArrayBuffer>) {\n\tsnapshotNode.addDictionaryString(\"blobs\");\n\tconst blobsNode = snapshotNode.addNode(\"list\");\n\tfor (const [storageBlobId, blob] of blobs) {\n\t\tconst blobNode = blobsNode.addNode();\n\t\taddDictionaryStringProperty(blobNode, \"id\", storageBlobId);\n\t\tblobNode.addString(\"data\");\n\t\tif (blob instanceof ArrayBuffer) {\n\t\t\tblobNode.addBlob(new Uint8Array(blob));\n\t\t} else {\n\t\t\tblobNode.addBlob(\n\t\t\t\tnew Uint8Array(stringToBuffer(blob.contents, blob.encoding ?? \"utf-8\")),\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Represents and serializes tree part of the snapshot\n * @param snapshotNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n */\nfunction writeTreeSection(snapshotNode: NodeCore, snapshotTree: ISnapshotTree) {\n\tsnapshotNode.addDictionaryString(\"treeNodes\");\n\tconst treesNode = snapshotNode.addNode(\"list\");\n\twriteTreeSectionCore(treesNode, snapshotTree);\n}\n\nfunction writeTreeSectionCore(treesNode: NodeCore, snapshotTree: ISnapshotTree) {\n\tfor (const [path, value] of Object.entries(snapshotTree.trees)) {\n\t\tconst treeNode = treesNode.addNode();\n\t\t// Many leaf nodes in the tree have same names like \"content\", \"body\", \"header\"\n\t\t// We could be smarter here and not use dictionary where we are sure reuse is unlikely, but\n\t\t// it does not feel like it's worth it.\n\t\taddDictionaryStringProperty(treeNode, \"name\", path);\n\t\tif (snapshotTree.unreferenced) {\n\t\t\taddBoolProperty(treeNode, \"unreferenced\", snapshotTree.unreferenced);\n\t\t}\n\t\t// Only write children prop if either blobs or trees are present.\n\t\tif (Object.keys(value.blobs).length > 0 || Object.keys(value.trees).length > 0) {\n\t\t\ttreeNode.addDictionaryString(\"children\");\n\t\t\tconst childNode = treeNode.addNode(\"list\");\n\t\t\twriteTreeSectionCore(childNode, value);\n\t\t}\n\t}\n\n\tif (snapshotTree.blobs) {\n\t\tfor (const [path, id] of Object.entries(snapshotTree.blobs)) {\n\t\t\tconst blobNode = treesNode.addNode();\n\t\t\taddDictionaryStringProperty(blobNode, \"name\", path);\n\t\t\taddDictionaryStringProperty(blobNode, \"value\", id);\n\t\t}\n\t}\n}\n\n/**\n * Represents (serializes) snapshot tree as generalizes tree\n * @param rootNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n * @param blobs - blobs mapping of the snapshot\n * @param snapshotSequenceNumber - seq number at which snapshot is taken\n */\nfunction writeSnapshotSection(\n\trootNode: NodeCore,\n\tsnapshotTree: ISnapshotTree,\n\tsnapshotSequenceNumber: number,\n) {\n\trootNode.addDictionaryString(\"snapshot\");\n\tconst snapshotNode = rootNode.addNode();\n\n\tconst snapshotId = snapshotTree.id;\n\tassert(snapshotId !== undefined, 0x21b /* \"Snapshot id should be provided\" */);\n\taddStringProperty(snapshotNode, \"id\", snapshotId);\n\taddStringProperty(snapshotNode, \"message\", `Snapshot@${snapshotSequenceNumber}`);\n\taddNumberProperty(snapshotNode, \"sequenceNumber\", snapshotSequenceNumber);\n\n\t// Add Trees\n\twriteTreeSection(snapshotNode, snapshotTree);\n}\n\n/**\n * Represents ops in the tree.\n * @param rootNode - node to serialize to.\n * @param ops - ops that is being serialized\n */\nfunction writeOpsSection(rootNode: NodeCore, ops: ISequencedDocumentMessage[]) {\n\tlet firstSequenceNumber: number | undefined;\n\tif (ops.length > 0) {\n\t\tfirstSequenceNumber = ops[0].sequenceNumber;\n\t}\n\tif (firstSequenceNumber !== undefined) {\n\t\trootNode.addDictionaryString(\"deltas\");\n\t\tconst opsNode = rootNode.addNode();\n\t\taddNumberProperty(opsNode, \"firstSequenceNumber\", firstSequenceNumber);\n\t\topsNode.addDictionaryString(\"deltas\");\n\t\tconst deltaNode = opsNode.addNode(\"list\");\n\t\tops.forEach((op) => {\n\t\t\tdeltaNode.addString(JSON.stringify(op));\n\t\t});\n\t}\n}\n\n/**\n * Converts trees/blobs/ops to binary compact representation.\n * @param snapshotContents - snapshot tree contents to serialize\n * @returns ReadBuffer - binary representation of the data.\n */\nexport function convertToCompactSnapshot(snapshotContents: ISnapshotContents): Uint8Array {\n\tconst builder = new TreeBuilderSerializer();\n\t// Create the root node.\n\tconst rootNode = builder.addNode();\n\tassert(\n\t\tsnapshotContents.sequenceNumber !== undefined,\n\t\t0x21c /* \"Seq number should be provided\" */,\n\t);\n\n\tlet latestSequenceNumber = snapshotContents.latestSequenceNumber;\n\tif (latestSequenceNumber === undefined) {\n\t\tlatestSequenceNumber =\n\t\t\tsnapshotContents.ops.length > 0\n\t\t\t\t? snapshotContents.ops[snapshotContents.ops.length - 1].sequenceNumber\n\t\t\t\t: snapshotContents.sequenceNumber;\n\t}\n\n\twriteSnapshotProps(rootNode, latestSequenceNumber);\n\n\twriteSnapshotSection(rootNode, snapshotContents.snapshotTree, snapshotContents.sequenceNumber);\n\n\t// Add Blobs\n\twriteBlobsSection(rootNode, snapshotContents.blobs);\n\n\t// Then write the ops node.\n\twriteOpsSection(rootNode, snapshotContents.ops);\n\n\treturn builder.serialize();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACU,QAAA,gBAAgB,GAAG,yCAAyC,CAAC;AAE1E;;GAEG;AACU,QAAA,iBAAiB,GAAG,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @public\n */\nexport const OdcApiSiteOrigin = \"https://my.microsoftpersonalcontent.com\";\n\n/**\n * @public\n */\nexport const OdcFileSiteOrigin = \"https://1drv.ms\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.cjs","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0LU,QAAA,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { HostStoragePolicy } from \"@fluidframework/odsp-driver-definitions\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\n\n/**\n * Interface for error responses for the WebSocket connection\n */\nexport interface IOdspSocketError {\n\t/**\n\t * An error code number for the error that occurred\n\t * It will be a valid HTTP status code\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes\n\t * This should not be displayed to the user directly\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds\n\t * The client should wait this many seconds before retrying its request\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Any error supplied by the socket containing codes and inner errors with further\n\t * details about the error.\n\t */\n\terror?: any;\n}\n\n/**\n * Interface for delta storage response.\n * Contains either SequencedDocumentMessages or SequencedDeltaOpMessage.\n */\nexport interface IDeltaStorageGetResponse {\n\tvalue: api.ISequencedDocumentMessage[] | ISequencedDeltaOpMessage[];\n}\n\nexport interface ISequencedDeltaOpMessage {\n\top: api.ISequencedDocumentMessage;\n\tsequenceNumber: number;\n}\n\nexport interface IDocumentStorageGetVersionsResponse {\n\tvalue: IDocumentStorageVersion[];\n}\n\nexport interface IDocumentStorageVersion {\n\tid: string;\n}\n\n/**\n *\n * Data structures that form ODSP Summary\n *\n */\n\nexport interface IOdspSummaryPayload {\n\ttype: \"container\" | \"channel\";\n\tmessage: string;\n\tsequenceNumber: number;\n\tentries: OdspSummaryTreeEntry[];\n}\n\nexport interface IWriteSummaryResponse {\n\tid: string;\n}\n\nexport type OdspSummaryTreeEntry = IOdspSummaryTreeValueEntry | IOdspSummaryTreeHandleEntry;\n\nexport interface IOdspSummaryTreeBaseEntry {\n\tpath: string;\n\ttype: \"blob\" | \"tree\" | \"commit\";\n}\n\nexport interface IOdspSummaryTreeValueEntry extends IOdspSummaryTreeBaseEntry {\n\tvalue: OdspSummaryTreeValue;\n\t// Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.\n\tunreferenced?: true;\n}\n\nexport interface IOdspSummaryTreeHandleEntry extends IOdspSummaryTreeBaseEntry {\n\tid: string;\n}\n\nexport type OdspSummaryTreeValue = IOdspSummaryTree | IOdspSummaryBlob;\n\nexport interface IOdspSummaryTree {\n\ttype: \"tree\";\n\tentries?: OdspSummaryTreeEntry[];\n}\n\nexport interface IOdspSummaryBlob {\n\ttype: \"blob\";\n\tcontent: string;\n\tencoding: \"base64\" | \"utf-8\";\n}\n\n/**\n *\n * Data structures that form ODSP Snapshot\n *\n */\n\nexport interface IOdspSnapshotTreeEntryTree {\n\tpath: string;\n\ttype: \"tree\";\n\t// Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.\n\tunreferenced?: true;\n}\n\nexport interface IOdspSnapshotTreeEntryCommit {\n\tid: string;\n\tpath: string;\n\ttype: \"commit\";\n}\n\nexport interface IOdspSnapshotTreeEntryBlob {\n\tid: string;\n\tpath: string;\n\ttype: \"blob\";\n}\n\nexport type IOdspSnapshotTreeEntry =\n\t| IOdspSnapshotTreeEntryTree\n\t| IOdspSnapshotTreeEntryCommit\n\t| IOdspSnapshotTreeEntryBlob;\n\nexport interface IOdspSnapshotCommit {\n\tentries: IOdspSnapshotTreeEntry[];\n\tid: string;\n\tsequenceNumber: number;\n}\n\n/**\n * Blob content, represents blobs in downloaded snapshot.\n */\nexport interface IOdspSnapshotBlob {\n\tcontent: string;\n\t// SPO only uses \"base64\" today for download.\n\t// We are adding undefined too, as temp way to roundtrip strings unchanged.\n\tencoding: \"base64\" | undefined;\n\tid: string;\n\tsize: number;\n}\n\nexport interface IOdspSnapshot {\n\tid: string;\n\ttrees: IOdspSnapshotCommit[];\n\tblobs?: IOdspSnapshotBlob[];\n\tops?: ISequencedDeltaOpMessage[];\n}\n\n/**\n * Same as HostStoragePolicy, but adds options that are internal to runtime.\n * All fields should be optional.\n */\nexport interface HostStoragePolicyInternal extends HostStoragePolicy {\n\tsummarizerClient?: boolean;\n}\n\nexport interface ICreateFileResponse {\n\t\"@odata.context\": string;\n\t\"driveId\": string;\n\t\"id\": string;\n\t\"itemId\": string;\n\t\"itemUrl\": string;\n\t\"sequenceNumber\": number;\n\t// sharing object contains shareId, sharingLink data or error in the response\n\t\"sharing\"?: any;\n\t\"sharingLink\"?: string;\n\t\"sharingLinkErrorReason\"?: string;\n}\n\nexport interface IVersionedValueWithEpoch {\n\tvalue: any;\n\tfluidEpoch: string;\n\t// This is same as \"persistedCacheValueVersion\" below. This represents the version of data stored in cache.\n\tversion: 3;\n}\n\nexport const persistedCacheValueVersion = 3;\n\nexport interface IGetOpsResponse {\n\tnonce: string;\n\tcode: number;\n\t/** Time in seconds. Currently never set by PUSH */\n\tretryAfter?: number;\n\tmessages?: api.ISequencedDocumentMessage[];\n}\n\nexport interface IFlushOpsResponse {\n\tnonce: string;\n\tcode: number;\n\t/** Time in seconds */\n\tretryAfter?: number;\n\tlastPersistedSequenceNumber?: number;\n}\n\n/**\n * Represents the cached snapshot value.\n */\nexport interface ISnapshotCachedEntry extends ISnapshotContents {\n\tcacheEntryTime: number;\n}\n"]}
|
|
@@ -23,4 +23,4 @@ var ClpCompliantAppHeader;
|
|
|
23
23
|
// Odsp will not return Classified, labeled, or protected documents if the host app cannot support them.
|
|
24
24
|
ClpCompliantAppHeader["isClpCompliantApp"] = "X-CLP-Compliant-App";
|
|
25
25
|
})(ClpCompliantAppHeader || (exports.ClpCompliantAppHeader = ClpCompliantAppHeader = {}));
|
|
26
|
-
//# sourceMappingURL=contractsPublic.
|
|
26
|
+
//# sourceMappingURL=contractsPublic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractsPublic.cjs","sourceRoot":"","sources":["../src/contractsPublic.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;GAEG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC5B,yGAAyG;IACzG,sDAAsD;IACtD,oEAA+C,CAAA;AAChD,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAQD;;GAEG;AACH,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAChC,oGAAoG;IACpG,wGAAwG;IACxG,kEAAyC,CAAA;AAC1C,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC","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\";\n\n/**\n * @public\n */\nexport interface OdspFluidDataStoreLocator extends IOdspUrlParts {\n\tdataStorePath: string;\n\tappName?: string;\n\tcontainerPackageName?: string;\n\tfileVersion?: string;\n\tcontext?: string;\n}\n\n/**\n * @public\n */\nexport enum SharingLinkHeader {\n\t// Can be used in request made to resolver, to tell the resolver that the passed in URL is a sharing link\n\t// which can be redeemed at server to get permissions.\n\tisSharingLinkToRedeem = \"isSharingLinkToRedeem\",\n}\n\n/**\n * @public\n */\nexport interface ISharingLinkHeader {\n\t[SharingLinkHeader.isSharingLinkToRedeem]: boolean;\n}\n/**\n * @public\n */\nexport enum ClpCompliantAppHeader {\n\t// Can be used in request made to resolver, to tell the resolver that the host app is CLP compliant.\n\t// Odsp will not return Classified, labeled, or protected documents if the host app cannot support them.\n\tisClpCompliantApp = \"X-CLP-Compliant-App\",\n}\n\n/**\n * @public\n */\nexport interface IClpCompliantAppHeader {\n\t[ClpCompliantAppHeader.isClpCompliantApp]: boolean;\n}\n\ndeclare module \"@fluidframework/core-interfaces\" {\n\texport interface IRequestHeader\n\t\textends Partial<ISharingLinkHeader>,\n\t\t\tPartial<IClpCompliantAppHeader> {}\n}\n"]}
|
|
@@ -10,15 +10,15 @@ const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
|
10
10
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
11
11
|
const odsp_driver_definitions_1 = require("@fluidframework/odsp-driver-definitions");
|
|
12
12
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
13
|
-
const getUrlAndHeadersWithAuth_1 = require("./getUrlAndHeadersWithAuth");
|
|
14
|
-
const odspUtils_1 = require("./odspUtils");
|
|
15
|
-
const createOdspUrl_1 = require("./createOdspUrl");
|
|
16
|
-
const odspUrlHelper_1 = require("./odspUrlHelper");
|
|
17
|
-
const odspDriverUrlResolver_1 = require("./odspDriverUrlResolver");
|
|
18
|
-
const createNewUtils_1 = require("./createNewUtils");
|
|
19
|
-
const retryUtils_1 = require("./retryUtils");
|
|
20
|
-
const packageVersion_1 = require("./packageVersion");
|
|
21
|
-
const contractsPublic_1 = require("./contractsPublic");
|
|
13
|
+
const getUrlAndHeadersWithAuth_1 = require("./getUrlAndHeadersWithAuth.cjs");
|
|
14
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
15
|
+
const createOdspUrl_1 = require("./createOdspUrl.cjs");
|
|
16
|
+
const odspUrlHelper_1 = require("./odspUrlHelper.cjs");
|
|
17
|
+
const odspDriverUrlResolver_1 = require("./odspDriverUrlResolver.cjs");
|
|
18
|
+
const createNewUtils_1 = require("./createNewUtils.cjs");
|
|
19
|
+
const retryUtils_1 = require("./retryUtils.cjs");
|
|
20
|
+
const packageVersion_1 = require("./packageVersion.cjs");
|
|
21
|
+
const contractsPublic_1 = require("./contractsPublic.cjs");
|
|
22
22
|
const isInvalidFileName = (fileName) => {
|
|
23
23
|
const invalidCharsRegex = /["*/:<>?\\|]+/g;
|
|
24
24
|
return !!fileName.match(invalidCharsRegex);
|
|
@@ -174,4 +174,4 @@ async function createNewFluidFileFromSummary(getStorageToken, newFileInfo, logge
|
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
exports.createNewFluidFileFromSummary = createNewFluidFileFromSummary;
|
|
177
|
-
//# sourceMappingURL=createFile.
|
|
177
|
+
//# sourceMappingURL=createFile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFile.cjs","sourceRoot":"","sources":["../src/createFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,+DAAiE;AAEjE,qEAAwF;AACxF,qFAQiD;AACjD,2EAAqE;AAErE,6EAAsE;AACtE,+CAMqB;AAErB,uDAAgD;AAChD,uDAA6C;AAE7C,uEAAgE;AAChE,yDAI0B;AAC1B,iDAA4C;AAC5C,yDAA+D;AAC/D,2DAA0D;AAE1D,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAW,EAAE;IACvD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;IAC3C,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;GAGG;AACI,KAAK,UAAU,kBAAkB,CACvC,eAAgD,EAChD,WAAyB,EACzB,MAA2B,EAC3B,gBAA0C,EAC1C,YAA0B,EAC1B,SAAqB,EACrB,gBAAyB,EACzB,sCAA+C,EAC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C,IAAA,qBAAS,EAAC,WAAW,CAAC,OAAO,CAAC,CAAC,WAAW,WAAW,CAAC,OAAO,cAAc;QACzF,GAAG,QAAQ,IAAI,eAAe,EAAE,CAAC;IAElC,MAAM,iBAAiB,GAAG,IAAA,oDAAmC,EAAC,gBAAgB,CAAC,CAAC;IAEhF,8EAA8E;IAC9E,iGAAiG;IACjG,MAAM,oBAAoB,GAAG,IAAA,uCAA2B,EAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACrF,MAAM,UAAU,GAAG,GAAG,OAAO,gCAC5B,oBAAoB,CAAC,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC,CAAC,EACrD,EAAE,CAAC;IAEH,OAAO,IAAA,4CAA2B,EAAsB;QACvD,iBAAiB;QACjB,eAAe;QACf,MAAM;QACN,UAAU;QACV,sCAAsC;QACtC,YAAY;QACZ,aAAa,EAAE,eAAe;QAC9B,SAAS,EAAE,YAAY;QACvB,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE;gBACrB,MAAM,IAAI,gCAAiB,CAC1B,0CAA0C,EAC1C,oCAAe,CAAC,uBAAuB,EACvC,EAAE,aAAa,EAAb,2BAAa,EAAE,CACjB,CAAC;aACF;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AA1CD,sEA0CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n\tInstrumentedStorageTokenFetcher,\n\tIOdspResolvedUrl,\n\tOdspErrorType,\n\tShareLinkInfoType,\n\tISharingLinkKind,\n\tShareLinkTypes,\n\tIFileEntry,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { ICreateFileResponse } from \"./contracts\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport {\n\tbuildOdspShareLinkReqParams,\n\tcreateCacheSnapshotKey,\n\tgetWithRetryForTokenRefresh,\n\tINewFileInfo,\n\tgetOrigin,\n} from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { createOdspUrl } from \"./createOdspUrl\";\nimport { getApiRoot } from \"./odspUrlHelper\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils\";\nimport { runWithRetry } from \"./retryUtils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic\";\n\nconst isInvalidFileName = (fileName: string): boolean => {\n\tconst invalidCharsRegex = /[\"*/:<>?\\\\|]+/g;\n\treturn !!fileName.match(invalidCharsRegex);\n};\n\n/**\n * Creates a new Fluid file.\n * Returns resolved url\n */\nexport async function createNewFluidFile(\n\tgetStorageToken: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree | undefined,\n\tepochTracker: EpochTracker,\n\tfileEntry: IFileEntry,\n\tcreateNewCaching: boolean,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tisClpCompliantApp?: boolean,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n\tenableShareLinkWithCreate?: boolean,\n): Promise<IOdspResolvedUrl> {\n\t// Check for valid filename before the request to create file is actually made.\n\tif (isInvalidFileName(newFileInfo.filename)) {\n\t\tthrow new NonRetryableError(\n\t\t\t// pre-0.58 error message: Invalid filename\n\t\t\t\"Invalid filename for createNew\",\n\t\t\tOdspErrorType.invalidFileNameError,\n\t\t\t{ driverVersion },\n\t\t);\n\t}\n\n\tlet itemId: string;\n\tlet summaryHandle: string = \"\";\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (createNewSummary === undefined) {\n\t\titemId = await createNewEmptyFluidFile(\n\t\t\tgetStorageToken,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tepochTracker,\n\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t);\n\t} else {\n\t\tconst content = await createNewFluidFileFromSummary(\n\t\t\tgetStorageToken,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tcreateNewSummary,\n\t\t\tepochTracker,\n\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t);\n\t\titemId = content.itemId;\n\t\tsummaryHandle = content.id;\n\n\t\tshareLinkInfo = extractShareLinkData(\n\t\t\tnewFileInfo.createLinkType,\n\t\t\tcontent,\n\t\t\tenableSingleRequestForShareLinkWithCreate,\n\t\t\tenableShareLinkWithCreate,\n\t\t);\n\t}\n\n\tconst odspUrl = createOdspUrl({ ...newFileInfo, itemId, dataStorePath: \"/\" });\n\tconst resolver = new OdspDriverUrlResolver();\n\tconst odspResolvedUrl = await resolver.resolve({\n\t\turl: odspUrl,\n\t\theaders: { [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },\n\t});\n\tfileEntry.docId = odspResolvedUrl.hashedDocumentId;\n\tfileEntry.resolvedUrl = odspResolvedUrl;\n\n\todspResolvedUrl.shareLinkInfo = shareLinkInfo;\n\n\tif (createNewSummary !== undefined && createNewCaching) {\n\t\tassert(summaryHandle !== undefined, 0x203 /* \"Summary handle is undefined\" */);\n\t\t// converting summary and getting sequence number\n\t\tconst snapshot: ISnapshotContents = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(createCacheSnapshotKey(odspResolvedUrl), snapshot);\n\t}\n\treturn odspResolvedUrl;\n}\n\n/**\n * If user requested creation of a sharing link along with the creation of the file by providing either\n * createLinkType (now deprecated) or createLinkScope in the request parameters, extract and save\n * sharing link information from the response if it is available.\n * In case there was an error in creation of the sharing link, error is provided back in the response,\n * and does not impact the creation of file in ODSP.\n * @param requestedSharingLinkKind - Kind of sharing link requested to be created along with the creation of file.\n * @param response - Response object received from the /snapshot api call\n * @returns Sharing link information received in the response from a successful creation of a file.\n */\nfunction extractShareLinkData(\n\trequestedSharingLinkKind: ShareLinkTypes | ISharingLinkKind | undefined,\n\tresponse: ICreateFileResponse,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n\tenableShareLinkWithCreate?: boolean,\n): ShareLinkInfoType | undefined {\n\tif (!requestedSharingLinkKind) {\n\t\treturn;\n\t}\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (enableSingleRequestForShareLinkWithCreate) {\n\t\tconst { sharing } = response;\n\t\tif (!sharing) {\n\t\t\treturn;\n\t\t}\n\t\tshareLinkInfo = {\n\t\t\tcreateLink: {\n\t\t\t\ttype: requestedSharingLinkKind,\n\t\t\t\tlink: sharing.sharingLink\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscope: sharing.sharingLink.scope,\n\t\t\t\t\t\t\trole: sharing.sharingLink.type,\n\t\t\t\t\t\t\twebUrl: sharing.sharingLink.webUrl,\n\t\t\t\t\t\t\t...sharing.sharingLink,\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t\terror: sharing.error,\n\t\t\t\tshareId: sharing.shareId,\n\t\t\t},\n\t\t};\n\t} else if (enableShareLinkWithCreate) {\n\t\tconst { sharing, sharingLink, sharingLinkErrorReason } = response;\n\t\tif (!sharingLink && !sharingLinkErrorReason) {\n\t\t\treturn;\n\t\t}\n\t\tshareLinkInfo = {\n\t\t\tcreateLink: {\n\t\t\t\ttype: requestedSharingLinkKind,\n\t\t\t\tlink: sharingLink,\n\t\t\t\terror: sharingLinkErrorReason,\n\t\t\t\tshareId: sharing?.shareId,\n\t\t\t},\n\t\t};\n\t}\n\treturn shareLinkInfo;\n}\n\nexport async function createNewEmptyFluidFile(\n\tgetStorageToken: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<string> {\n\tconst filePath = newFileInfo.filePath ? encodeURIComponent(`/${newFileInfo.filePath}`) : \"\";\n\t// add .tmp extension to empty file (host is expected to rename)\n\tconst encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);\n\tconst initialUrl = `${getApiRoot(getOrigin(newFileInfo.siteUrl))}/drives/${\n\t\tnewFileInfo.driveId\n\t}/items/root:/${filePath}/${encodedFilename}:/content?@name.conflictBehavior=rename&select=id,name,parentReference`;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst storageToken = await getStorageToken(options, \"CreateNewFile\");\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"createNewEmptyFile\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t\tinitialUrl,\n\t\t\t\t\tstorageToken,\n\t\t\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t\t\t);\n\t\t\t\theaders[\"Content-Type\"] = \"application/json\";\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<ICreateFileResponse>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: undefined,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"PUT\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"createFile\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"createFile\",\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tconst content = fetchResponse.content;\n\t\t\t\tif (!content?.id) {\n\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t// pre-0.58 error message: ODSP CreateFile call returned no item ID\n\t\t\t\t\t\t\"ODSP CreateFile call returned no item ID (for empty file)\",\n\t\t\t\t\t\tDriverErrorType.incorrectServerResponse,\n\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tevent.end({\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn content.id;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function createNewFluidFileFromSummary(\n\tgetStorageToken: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree,\n\tepochTracker: EpochTracker,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<ICreateFileResponse> {\n\tconst filePath = newFileInfo.filePath ? encodeURIComponent(`/${newFileInfo.filePath}`) : \"\";\n\tconst encodedFilename = encodeURIComponent(newFileInfo.filename);\n\tconst baseUrl =\n\t\t`${getApiRoot(getOrigin(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:` +\n\t\t`${filePath}/${encodedFilename}`;\n\n\tconst containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);\n\n\t// Build share link parameter based on the createLinkType provided so that the\n\t// snapshot api can create and return the share link along with creation of file in the response.\n\tconst createShareLinkParam = buildOdspShareLinkReqParams(newFileInfo.createLinkType);\n\tconst initialUrl = `${baseUrl}:/opStream/snapshots/snapshot${\n\t\tcreateShareLinkParam ? `?${createShareLinkParam}` : \"\"\n\t}`;\n\n\treturn createNewFluidContainerCore<ICreateFileResponse>({\n\t\tcontainerSnapshot,\n\t\tgetStorageToken,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t\tepochTracker,\n\t\ttelemetryName: \"CreateNewFile\",\n\t\tfetchType: \"createFile\",\n\t\tvalidateResponseCallback: (content) => {\n\t\t\tif (!content?.itemId) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"ODSP CreateFile call returned no item ID\",\n\t\t\t\t\tDriverErrorType.incorrectServerResponse,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.createNewContainerOnExistingFile = void 0;
|
|
8
8
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
9
|
-
const odspUtils_1 = require("./odspUtils");
|
|
10
|
-
const createOdspUrl_1 = require("./createOdspUrl");
|
|
11
|
-
const odspUrlHelper_1 = require("./odspUrlHelper");
|
|
12
|
-
const odspDriverUrlResolver_1 = require("./odspDriverUrlResolver");
|
|
13
|
-
const createNewUtils_1 = require("./createNewUtils");
|
|
14
|
-
const contractsPublic_1 = require("./contractsPublic");
|
|
9
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
10
|
+
const createOdspUrl_1 = require("./createOdspUrl.cjs");
|
|
11
|
+
const odspUrlHelper_1 = require("./odspUrlHelper.cjs");
|
|
12
|
+
const odspDriverUrlResolver_1 = require("./odspDriverUrlResolver.cjs");
|
|
13
|
+
const createNewUtils_1 = require("./createNewUtils.cjs");
|
|
14
|
+
const contractsPublic_1 = require("./contractsPublic.cjs");
|
|
15
15
|
/**
|
|
16
16
|
* Creates a new Fluid container on an existing file.
|
|
17
17
|
*
|
|
@@ -57,4 +57,4 @@ async function createNewContainerOnExistingFile(getStorageToken, fileInfo, logge
|
|
|
57
57
|
return odspResolvedUrl;
|
|
58
58
|
}
|
|
59
59
|
exports.createNewContainerOnExistingFile = createNewContainerOnExistingFile;
|
|
60
|
-
//# sourceMappingURL=createNewContainerOnExistingFile.
|
|
60
|
+
//# sourceMappingURL=createNewContainerOnExistingFile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNewContainerOnExistingFile.cjs","sourceRoot":"","sources":["../src/createNewContainerOnExistingFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,+DAA0D;AAO1D,+CAAmF;AAEnF,uDAAgD;AAChD,uDAA6C;AAE7C,uEAAgE;AAChE,yDAI0B;AAC1B,2DAA0D;AAE1D;;;;;;;;;;GAUG;AACI,KAAK,UAAU,gCAAgC,CACrD,eAAgD,EAChD,QAA2B,EAC3B,MAA2B,EAC3B,gBAA0C,EAC1C,YAA0B,EAC1B,SAAqB,EACrB,gBAAyB,EACzB,sCAA+C,EAC/C,iBAA2B;IAE3B,IAAI,gBAAgB,KAAK,SAAS,EAAE;QACnC,MAAM,IAAI,yBAAU,CAAC,uDAAuD,CAAC,CAAC;KAC9E;IAED,MAAM,OAAO,GAAG,GAAG,IAAA,0BAAU,EAAC,IAAA,qBAAS,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,QAAQ,CAAC,OAAO,UACpF,QAAQ,CAAC,MACV,EAAE,CAAC;IAEH,MAAM,iBAAiB,GAAG,IAAA,oDAAmC,EAAC,gBAAgB,CAAC,CAAC;IAEhF,MAAM,UAAU,GAAG,GAAG,OAAO,8BAA8B,CAAC;IAE5D,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,GAAG,MAAM,IAAA,4CAA2B,EAAwB;QACtF,iBAAiB;QACjB,eAAe;QACf,MAAM;QACN,UAAU;QACV,sCAAsC;QACtC,YAAY;QACZ,aAAa,EAAE,kCAAkC;QACjD,SAAS,EAAE,eAAe;KAC1B,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAA,6BAAa,EAAC,EAAE,GAAG,QAAQ,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,IAAI,6CAAqB,EAAE,CAAC;IAC7C,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;QAC9C,GAAG,EAAE,OAAO;QACZ,OAAO,EAAE,EAAE,CAAC,uCAAqB,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,EAAE;KACzE,CAAC,CAAC;IACH,SAAS,CAAC,KAAK,GAAG,eAAe,CAAC,gBAAgB,CAAC;IACnD,SAAS,CAAC,WAAW,GAAG,eAAe,CAAC;IAExC,IAAI,gBAAgB,EAAE;QACrB,iDAAiD;QACjD,MAAM,QAAQ,GAAsB,IAAA,0DAAyC,EAC5E,gBAAgB,EAChB,aAAa,CACb,CAAC;QACF,gCAAgC;QAChC,MAAM,YAAY,CAAC,GAAG,CAAC,IAAA,kCAAsB,EAAC,eAAe,CAAC,EAAE,QAAQ,CAAC,CAAC;KAC1E;IAED,OAAO,eAAe,CAAC;AACxB,CAAC;AAtDD,4EAsDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { UsageError } from \"@fluidframework/driver-utils\";\nimport {\n\tIFileEntry,\n\tInstrumentedStorageTokenFetcher,\n\tIOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { IWriteSummaryResponse } from \"./contracts\";\nimport { createCacheSnapshotKey, getOrigin, IExistingFileInfo } from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { createOdspUrl } from \"./createOdspUrl\";\nimport { getApiRoot } from \"./odspUrlHelper\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic\";\n\n/**\n * Creates a new Fluid container on an existing file.\n *\n * @remarks This requires service's capability to manage Fluid container inside an existing file.\n *\n * @example\n *\n * This enables a scenario where Fluid data is not stored as a standalone file but in a way that is managed\n * by an existing file. For example, SharePoint Pages is able to store Fluid container in an\n * \"alternative file partition\" where the main File stub is an ASPX page.\n */\nexport async function createNewContainerOnExistingFile(\n\tgetStorageToken: InstrumentedStorageTokenFetcher,\n\tfileInfo: IExistingFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree | undefined,\n\tepochTracker: EpochTracker,\n\tfileEntry: IFileEntry,\n\tcreateNewCaching: boolean,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tisClpCompliantApp?: boolean,\n): Promise<IOdspResolvedUrl> {\n\tif (createNewSummary === undefined) {\n\t\tthrow new UsageError(\"createNewSummary must exist to create a new container\");\n\t}\n\n\tconst baseUrl = `${getApiRoot(getOrigin(fileInfo.siteUrl))}/drives/${fileInfo.driveId}/items/${\n\t\tfileInfo.itemId\n\t}`;\n\n\tconst containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);\n\n\tconst initialUrl = `${baseUrl}/opStream/snapshots/snapshot`;\n\n\tconst { id: summaryHandle } = await createNewFluidContainerCore<IWriteSummaryResponse>({\n\t\tcontainerSnapshot,\n\t\tgetStorageToken,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t\tepochTracker,\n\t\ttelemetryName: \"CreateNewContainerOnExistingFile\",\n\t\tfetchType: \"uploadSummary\",\n\t});\n\n\tconst odspUrl = createOdspUrl({ ...fileInfo, dataStorePath: \"/\" });\n\tconst resolver = new OdspDriverUrlResolver();\n\tconst odspResolvedUrl = await resolver.resolve({\n\t\turl: odspUrl,\n\t\theaders: { [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },\n\t});\n\tfileEntry.docId = odspResolvedUrl.hashedDocumentId;\n\tfileEntry.resolvedUrl = odspResolvedUrl;\n\n\tif (createNewCaching) {\n\t\t// converting summary and getting sequence number\n\t\tconst snapshot: ISnapshotContents = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(createCacheSnapshotKey(odspResolvedUrl), snapshot);\n\t}\n\n\treturn odspResolvedUrl;\n}\n"]}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.createNewContainerOnExistingFile = exports.createNewFluidFile = void 0;
|
|
8
|
-
var createFile_1 = require("./createFile");
|
|
8
|
+
var createFile_1 = require("./createFile.cjs");
|
|
9
9
|
Object.defineProperty(exports, "createNewFluidFile", { enumerable: true, get: function () { return createFile_1.createNewFluidFile; } });
|
|
10
|
-
var createNewContainerOnExistingFile_1 = require("./createNewContainerOnExistingFile");
|
|
10
|
+
var createNewContainerOnExistingFile_1 = require("./createNewContainerOnExistingFile.cjs");
|
|
11
11
|
Object.defineProperty(exports, "createNewContainerOnExistingFile", { enumerable: true, get: function () { return createNewContainerOnExistingFile_1.createNewContainerOnExistingFile; } });
|
|
12
|
-
//# sourceMappingURL=createNewModule.
|
|
12
|
+
//# sourceMappingURL=createNewModule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNewModule.cjs","sourceRoot":"","sources":["../src/createNewModule.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAkD;AAAzC,gHAAA,kBAAkB,OAAA;AAC3B,2FAAsF;AAA7E,oJAAA,gCAAgC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { createNewFluidFile } from \"./createFile\";\nexport { createNewContainerOnExistingFile } from \"./createNewContainerOnExistingFile\";\n"]}
|
|
@@ -12,9 +12,9 @@ const client_utils_1 = require("@fluid-internal/client-utils");
|
|
|
12
12
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
13
13
|
const protocol_base_1 = require("@fluidframework/protocol-base");
|
|
14
14
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
15
|
-
const odspUtils_1 = require("./odspUtils");
|
|
16
|
-
const getUrlAndHeadersWithAuth_1 = require("./getUrlAndHeadersWithAuth");
|
|
17
|
-
const retryUtils_1 = require("./retryUtils");
|
|
15
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
16
|
+
const getUrlAndHeadersWithAuth_1 = require("./getUrlAndHeadersWithAuth.cjs");
|
|
17
|
+
const retryUtils_1 = require("./retryUtils.cjs");
|
|
18
18
|
/**
|
|
19
19
|
* Converts a summary(ISummaryTree) taken in detached container to snapshot tree and blobs
|
|
20
20
|
*/
|
|
@@ -200,4 +200,4 @@ async function createNewFluidContainerCore(args) {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
exports.createNewFluidContainerCore = createNewFluidContainerCore;
|
|
203
|
-
//# sourceMappingURL=createNewUtils.
|
|
203
|
+
//# sourceMappingURL=createNewUtils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNewUtils.cjs","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAClC,+EAK8C;AAC9C,+DAGsC;AACtC,+DAAkF;AAClF,2DAA6D;AAC7D,iEAA2D;AAC3D,qEAAwF;AAQxF,+CAA8E;AAG9E,6EAAsE;AACtE,iDAA4C;AAE5C;;GAEG;AACH,SAAgB,yCAAyC,CACxD,OAAqB,EACrB,MAAc;IAEd,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAiB,CAAC;IAClE,MAAM,kBAAkB,GAAG,IAAA,kDAAmC,E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;gBAC7D,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjC,GAAG,aAAa,CAAC,UAAU;aAC3B,CAAC,CAAC;YAEH,OAAO,aAAa,CAAC,OAAO,CAAC;QAC9B,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AA7FD,kEA6FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport {\n\tISummaryBlob,\n\tISummaryTree,\n\tSummaryType,\n\tISnapshotTree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils\";\nimport { stringToBuffer, Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { unreachableCase } from \"@fluidframework/core-utils\";\nimport { getGitType } from \"@fluidframework/protocol-base\";\nimport { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tIOdspSummaryPayload,\n\tIOdspSummaryTree,\n\tOdspSummaryTreeEntry,\n\tOdspSummaryTreeValue,\n} from \"./contracts\";\nimport { getWithRetryForTokenRefresh, maxUmpPostBodySize } from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { EpochTracker, FetchType } from \"./epochTracker\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport { runWithRetry } from \"./retryUtils\";\n\n/**\n * Converts a summary(ISummaryTree) taken in detached container to snapshot tree and blobs\n */\nexport function convertCreateNewSummaryTreeToTreeAndBlobs(\n\tsummary: ISummaryTree,\n\ttreeId: string,\n): ISnapshotContents {\n\tconst protocolSummary = summary.tree[\".protocol\"] as ISummaryTree;\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst sequenceNumber = documentAttributes.sequenceNumber;\n\tconst blobs = new Map<string, ArrayBuffer>();\n\tconst snapshotTree = convertCreateNewSummaryTreeToTreeAndBlobsCore(summary, blobs);\n\tsnapshotTree.id = treeId;\n\tconst snapshotTreeValue: ISnapshotContents = {\n\t\tsnapshotTree,\n\t\tblobs,\n\t\tops: [],\n\t\tsequenceNumber,\n\t\tlatestSequenceNumber: sequenceNumber,\n\t};\n\n\treturn snapshotTreeValue;\n}\n\nfunction convertCreateNewSummaryTreeToTreeAndBlobsCore(\n\tsummary: ISummaryTree,\n\tblobs: Map<string, ArrayBuffer>,\n) {\n\tconst treeNode: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees: {},\n\t\tunreferenced: summary.unreferenced,\n\t};\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\ttreeNode.trees[key] = convertCreateNewSummaryTreeToTreeAndBlobsCore(\n\t\t\t\t\tsummaryObject,\n\t\t\t\t\tblobs,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst contentBuffer =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? stringToBuffer(summaryObject.content, \"utf8\")\n\t\t\t\t\t\t: summaryObject.content;\n\t\t\t\tconst blobId = uuid();\n\t\t\t\ttreeNode.blobs[key] = blobId;\n\t\t\t\tblobs.set(blobId, contentBuffer);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle:\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\tthrow new Error(`No ${summaryObject.type} should be present for detached summary!`);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(summaryObject, `Unknown tree type ${(summaryObject as any).type}`);\n\t\t\t}\n\t\t}\n\t}\n\treturn treeNode;\n}\n\nexport function convertSummaryIntoContainerSnapshot(createNewSummary: ISummaryTree) {\n\tif (!isCombinedAppAndProtocolSummary(createNewSummary)) {\n\t\tthrow new Error(\"App and protocol summary required for create new path!!\");\n\t}\n\tconst appSummary = createNewSummary.tree[\".app\"];\n\tconst protocolSummary = createNewSummary.tree[\".protocol\"];\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst attributesSummaryBlob: ISummaryBlob = {\n\t\ttype: SummaryType.Blob,\n\t\tcontent: JSON.stringify(documentAttributes),\n\t};\n\tprotocolSummary.tree.attributes = attributesSummaryBlob;\n\tconst convertedCreateNewSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\t\".protocol\": protocolSummary,\n\t\t\t\".app\": appSummary,\n\t\t},\n\t};\n\tconst snapshotTree = convertSummaryToSnapshotTreeForCreateNew(convertedCreateNewSummary);\n\tconst snapshot: IOdspSummaryPayload = {\n\t\tentries: snapshotTree.entries ?? [],\n\t\tmessage: \"app\",\n\t\tsequenceNumber: documentAttributes.sequenceNumber,\n\t\ttype: \"container\",\n\t};\n\treturn snapshot;\n}\n\n/**\n * Converts a summary tree to ODSP tree\n */\nfunction convertSummaryToSnapshotTreeForCreateNew(summary: ISummaryTree): IOdspSummaryTree {\n\tconst snapshotTree: IOdspSummaryTree = {\n\t\ttype: \"tree\",\n\t\tentries: [],\n\t};\n\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tlet value: OdspSummaryTreeValue;\n\t\t// Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the\n\t\t// property is not present, the tree entry is considered referenced. If the property is present and is true,\n\t\t// the tree entry is considered unreferenced.\n\t\tlet unreferenced: true | undefined;\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tvalue = convertSummaryToSnapshotTreeForCreateNew(summaryObject);\n\t\t\t\tunreferenced = summaryObject.unreferenced;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst content =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? summaryObject.content\n\t\t\t\t\t\t: Uint8ArrayToString(summaryObject.content, \"base64\");\n\t\t\t\tconst encoding = typeof summaryObject.content === \"string\" ? \"utf-8\" : \"base64\";\n\n\t\t\t\tvalue = {\n\t\t\t\t\ttype: \"blob\",\n\t\t\t\t\tcontent,\n\t\t\t\t\tencoding,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new Error(\"No handle should be present for first summary!!\");\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`Unknown tree type ${summaryObject.type}`);\n\t\t\t}\n\t\t}\n\n\t\tconst entry: OdspSummaryTreeEntry = {\n\t\t\tpath: encodeURIComponent(key),\n\t\t\ttype: getGitType(summaryObject),\n\t\t\tvalue,\n\t\t\tunreferenced,\n\t\t};\n\t\tsnapshotTree.entries?.push(entry);\n\t}\n\n\treturn snapshotTree;\n}\n\nexport async function createNewFluidContainerCore<T>(args: {\n\tcontainerSnapshot: IOdspSummaryPayload;\n\tgetStorageToken: InstrumentedStorageTokenFetcher;\n\tlogger: ITelemetryLoggerExt;\n\tinitialUrl: string;\n\tforceAccessTokenViaAuthorizationHeader: boolean;\n\tepochTracker: EpochTracker;\n\ttelemetryName: string;\n\tfetchType: FetchType;\n\tvalidateResponseCallback?: (content: T) => void;\n}): Promise<T> {\n\tconst {\n\t\tcontainerSnapshot,\n\t\tgetStorageToken,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t\tepochTracker,\n\t\ttelemetryName,\n\t\tfetchType,\n\t\tvalidateResponseCallback,\n\t} = args;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst storageToken = await getStorageToken(options, telemetryName);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: telemetryName },\n\t\t\tasync (event) => {\n\t\t\t\tconst snapshotBody = JSON.stringify(containerSnapshot);\n\t\t\t\tlet url: string;\n\t\t\t\tlet headers: { [index: string]: string };\n\t\t\t\tlet addInBody = false;\n\t\t\t\tconst formBoundary = uuid();\n\t\t\t\tlet postBody = `--${formBoundary}\\r\\n`;\n\t\t\t\tpostBody += `Authorization: Bearer ${storageToken}\\r\\n`;\n\t\t\t\tpostBody += `X-HTTP-Method-Override: POST\\r\\n`;\n\t\t\t\tpostBody += `Content-Type: application/json\\r\\n`;\n\t\t\t\tpostBody += `_post: 1\\r\\n`;\n\t\t\t\tpostBody += `\\r\\n${snapshotBody}\\r\\n`;\n\t\t\t\tpostBody += `\\r\\n--${formBoundary}--`;\n\n\t\t\t\tif (postBody.length <= maxUmpPostBodySize) {\n\t\t\t\t\tconst urlObj = new URL(initialUrl);\n\t\t\t\t\turlObj.searchParams.set(\"ump\", \"1\");\n\t\t\t\t\turl = urlObj.href;\n\t\t\t\t\theaders = {\n\t\t\t\t\t\t\"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n\t\t\t\t\t};\n\t\t\t\t\taddInBody = true;\n\t\t\t\t} else {\n\t\t\t\t\tconst parts = getUrlAndHeadersWithAuth(\n\t\t\t\t\t\tinitialUrl,\n\t\t\t\t\t\tstorageToken,\n\t\t\t\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t);\n\t\t\t\t\turl = parts.url;\n\t\t\t\t\theaders = {\n\t\t\t\t\t\t...parts.headers,\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t};\n\t\t\t\t\tpostBody = snapshotBody;\n\t\t\t\t}\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<T>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: postBody,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfetchType,\n\t\t\t\t\t\t\taddInBody,\n\t\t\t\t\t\t),\n\t\t\t\t\ttelemetryName,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tvalidateResponseCallback?.(fetchResponse.content);\n\n\t\t\t\tevent.end({\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\n\t\t\t\treturn fetchResponse.content;\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createOdspCreateContainerRequest = void 0;
|
|
4
4
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
5
|
-
const odspUtils_1 = require("./odspUtils");
|
|
5
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
6
6
|
/**
|
|
7
7
|
* Create the request object with url and headers for creating a new file on OneDrive Sharepoint
|
|
8
8
|
* @param siteUrl - Base url for OneDrive
|
|
@@ -26,4 +26,4 @@ function createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName,
|
|
|
26
26
|
return createNewRequest;
|
|
27
27
|
}
|
|
28
28
|
exports.createOdspCreateContainerRequest = createOdspCreateContainerRequest;
|
|
29
|
-
//# sourceMappingURL=createOdspCreateContainerRequest.
|
|
29
|
+
//# sourceMappingURL=createOdspCreateContainerRequest.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOdspCreateContainerRequest.cjs","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":";;;AAKA,2EAAkE;AAElE,+CAA0D;AAE1D;;;;;;;;;GASG;AACH,SAAgB,gCAAgC,CAC/C,OAAe,EACf,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,mBAAuD;IAEvD,MAAM,sBAAsB,GAAG,IAAA,uCAA2B,EAAC,mBAAmB,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAa;QAClC,GAAG,EAAE,GAAG,OAAO,YAAY,kBAAkB,CAAC,OAAO,CAAC,SAAS,kBAAkB,CAChF,QAAQ,CACR,GAAG,sBAAsB,CAAC,CAAC,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QAChE,OAAO,EAAE;YACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE;gBACzB,QAAQ;aACR;SACD;KACD,CAAC;IACF,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAnBD,4EAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions\";\nimport { ShareLinkTypes, ISharingLinkKind } from \"@fluidframework/odsp-driver-definitions\";\nimport { buildOdspShareLinkReqParams } from \"./odspUtils\";\n\n/**\n * Create the request object with url and headers for creating a new file on OneDrive Sharepoint\n * @param siteUrl - Base url for OneDrive\n * @param driveId - drive identifier\n * @param filePath - path where file needs to be created\n * @param fileName - name of the new file to be created\n * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes\n * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink\n * @public\n */\nexport function createOdspCreateContainerRequest(\n\tsiteUrl: string,\n\tdriveId: string,\n\tfilePath: string,\n\tfileName: string,\n\tcreateShareLinkType?: ShareLinkTypes | ISharingLinkKind,\n): IRequest {\n\tconst shareLinkRequestParams = buildOdspShareLinkReqParams(createShareLinkType);\n\tconst createNewRequest: IRequest = {\n\t\turl: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(\n\t\t\tfilePath,\n\t\t)}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : \"\"}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: {\n\t\t\t\tfileName,\n\t\t\t},\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOdspUrl.cjs","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AAEH;;;;GAIG;AACH,SAAgB,aAAa,CAAC,CAA4B;IACzD,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,YAAY,kBAAkB,CACvD,CAAC,CAAC,OAAO,CACT,WAAW,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;IACvF,IAAI,CAAC,CAAC,oBAAoB,EAAE;QAC3B,OAAO,IAAI,yBAAyB,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC;KACjF;IACD,IAAI,CAAC,CAAC,WAAW,EAAE;QAClB,OAAO,IAAI,gBAAgB,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;KAC/D;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAZD,sCAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { OdspFluidDataStoreLocator } from \"./contractsPublic\";\n\n/*\n * Per https://github.com/microsoft/FluidFramework/issues/1556, isolating createOdspUrl() in its own file.\n */\n\n/**\n * Encodes ODC/SPO information into a URL format that can be handled by the Loader\n * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it\n * @public\n */\nexport function createOdspUrl(l: OdspFluidDataStoreLocator): string {\n\tlet odspUrl = `${l.siteUrl}?driveId=${encodeURIComponent(\n\t\tl.driveId,\n\t)}&itemId=${encodeURIComponent(l.itemId)}&path=${encodeURIComponent(l.dataStorePath)}`;\n\tif (l.containerPackageName) {\n\t\todspUrl += `&containerPackageName=${encodeURIComponent(l.containerPackageName)}`;\n\t}\n\tif (l.fileVersion) {\n\t\todspUrl += `&fileVersion=${encodeURIComponent(l.fileVersion)}`;\n\t}\n\n\treturn odspUrl;\n}\n"]}
|
|
@@ -11,11 +11,11 @@ const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
|
11
11
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
12
12
|
const odsp_driver_definitions_1 = require("@fluidframework/odsp-driver-definitions");
|
|
13
13
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
14
|
-
const odspUtils_1 = require("./odspUtils");
|
|
15
|
-
const contracts_1 = require("./contracts");
|
|
16
|
-
const contractsPublic_1 = require("./contractsPublic");
|
|
17
|
-
const packageVersion_1 = require("./packageVersion");
|
|
18
|
-
const odspLocationRedirection_1 = require("./odspLocationRedirection");
|
|
14
|
+
const odspUtils_1 = require("./odspUtils.cjs");
|
|
15
|
+
const contracts_1 = require("./contracts.cjs");
|
|
16
|
+
const contractsPublic_1 = require("./contractsPublic.cjs");
|
|
17
|
+
const packageVersion_1 = require("./packageVersion.cjs");
|
|
18
|
+
const odspLocationRedirection_1 = require("./odspLocationRedirection.cjs");
|
|
19
19
|
exports.Odsp409Error = "Odsp409Error";
|
|
20
20
|
// Must be less than policy of 5 days
|
|
21
21
|
exports.defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000; // 2 days in ms
|
|
@@ -429,4 +429,4 @@ function createOdspCacheAndTracker(persistedCacheArg, nonpersistentCache, fileEn
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
exports.createOdspCacheAndTracker = createOdspCacheAndTracker;
|
|
432
|
-
//# sourceMappingURL=epochTracker.
|
|
432
|
+
//# sourceMappingURL=epochTracker.cjs.map
|