@fluidframework/odsp-driver 2.50.0 → 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +12 -0
- package/CHANGELOG.md +4 -0
- package/dist/checkUrl.d.ts +1 -1
- package/dist/checkUrl.d.ts.map +1 -1
- package/dist/checkUrl.js.map +1 -1
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts +1 -1
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/contractsPublic.d.ts +18 -2
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/contractsPublic.js +12 -1
- package/dist/contractsPublic.js.map +1 -1
- package/dist/createFile/createFile.d.ts +6 -6
- package/dist/createFile/createFile.d.ts.map +1 -1
- package/dist/createFile/createFile.js.map +1 -1
- package/dist/createFile/createNewContainerOnExistingFile.d.ts +6 -6
- package/dist/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/createFile/createNewContainerOnExistingFile.js +11 -2
- package/dist/createFile/createNewContainerOnExistingFile.js.map +1 -1
- package/dist/createFile/createNewUtils.d.ts +9 -6
- package/dist/createFile/createNewUtils.d.ts.map +1 -1
- package/dist/createFile/createNewUtils.js +19 -8
- package/dist/createFile/createNewUtils.js.map +1 -1
- package/dist/createFile/index.d.ts +1 -1
- package/dist/createFile/index.d.ts.map +1 -1
- package/dist/createFile/index.js.map +1 -1
- package/dist/createOdspCreateContainerRequest.d.ts +2 -2
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/createOdspCreateContainerRequest.js.map +1 -1
- package/dist/createOdspUrl.d.ts +1 -1
- package/dist/createOdspUrl.d.ts.map +1 -1
- package/dist/createOdspUrl.js.map +1 -1
- package/dist/epochTracker.d.ts +4 -4
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts +6 -6
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +7 -0
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts +2 -2
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js.map +1 -1
- package/dist/getQueryString.d.ts +1 -1
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/getQueryString.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -4
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/dist/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
- package/dist/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
- package/dist/odspCache.d.ts +2 -2
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +6 -6
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +9 -0
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDeltaStorageService.d.ts +6 -6
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts +5 -5
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts +6 -6
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.d.ts +2 -2
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +7 -7
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +1 -1
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +9 -9
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +3 -3
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +3 -3
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +3 -0
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +4 -4
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspError.d.ts +3 -3
- package/dist/odspError.d.ts.map +1 -1
- package/dist/odspError.js.map +1 -1
- package/dist/odspFluidFileLink.d.ts +1 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspFluidFileLink.js.map +1 -1
- package/dist/odspLayerCompatState.d.ts +1 -1
- package/dist/odspLayerCompatState.d.ts.map +1 -1
- package/dist/odspLayerCompatState.js.map +1 -1
- package/dist/odspLocationRedirection.d.ts +2 -2
- package/dist/odspLocationRedirection.d.ts.map +1 -1
- package/dist/odspLocationRedirection.js.map +1 -1
- package/dist/odspPublicUtils.d.ts +1 -1
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts +2 -2
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspSummaryUploadManager.d.ts +5 -5
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUrlHelper.d.ts +1 -1
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/odspUrlHelper.js.map +1 -1
- package/dist/odspUtils.d.ts +5 -5
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js.map +1 -1
- package/dist/opsCaching.d.ts +1 -1
- package/dist/opsCaching.d.ts.map +1 -1
- package/dist/opsCaching.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/prefetchLatestSnapshot.d.ts +5 -5
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/dist/retryErrorsStorageAdapter.d.ts +4 -4
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.d.ts +1 -1
- package/dist/retryUtils.d.ts.map +1 -1
- package/dist/retryUtils.js.map +1 -1
- package/dist/vroom.d.ts +4 -4
- package/dist/vroom.d.ts.map +1 -1
- package/dist/vroom.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts +2 -2
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/checkUrl.d.ts +1 -1
- package/lib/checkUrl.d.ts.map +1 -1
- package/lib/checkUrl.js.map +1 -1
- package/lib/compactSnapshotParser.d.ts +2 -2
- package/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/compactSnapshotWriter.d.ts +1 -1
- package/lib/compactSnapshotWriter.d.ts.map +1 -1
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/contracts.d.ts +3 -3
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/contractsPublic.d.ts +18 -2
- package/lib/contractsPublic.d.ts.map +1 -1
- package/lib/contractsPublic.js +11 -0
- package/lib/contractsPublic.js.map +1 -1
- package/lib/createFile/createFile.d.ts +6 -6
- package/lib/createFile/createFile.d.ts.map +1 -1
- package/lib/createFile/createFile.js.map +1 -1
- package/lib/createFile/createNewContainerOnExistingFile.d.ts +6 -6
- package/lib/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/lib/createFile/createNewContainerOnExistingFile.js +12 -3
- package/lib/createFile/createNewContainerOnExistingFile.js.map +1 -1
- package/lib/createFile/createNewUtils.d.ts +9 -6
- package/lib/createFile/createNewUtils.d.ts.map +1 -1
- package/lib/createFile/createNewUtils.js +19 -8
- package/lib/createFile/createNewUtils.js.map +1 -1
- package/lib/createFile/index.d.ts +1 -1
- package/lib/createFile/index.d.ts.map +1 -1
- package/lib/createFile/index.js.map +1 -1
- package/lib/createOdspCreateContainerRequest.d.ts +2 -2
- package/lib/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/lib/createOdspCreateContainerRequest.js.map +1 -1
- package/lib/createOdspUrl.d.ts +1 -1
- package/lib/createOdspUrl.d.ts.map +1 -1
- package/lib/createOdspUrl.js.map +1 -1
- package/lib/epochTracker.d.ts +4 -4
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js.map +1 -1
- package/lib/fetchSnapshot.d.ts +6 -6
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js +7 -0
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/getFileLink.d.ts +2 -2
- package/lib/getFileLink.d.ts.map +1 -1
- package/lib/getFileLink.js.map +1 -1
- package/lib/getQueryString.d.ts +1 -1
- package/lib/getQueryString.d.ts.map +1 -1
- package/lib/getQueryString.js.map +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.ts +4 -4
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/lib/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
- package/lib/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
- package/lib/odspCache.d.ts +2 -2
- package/lib/odspCache.d.ts.map +1 -1
- package/lib/odspCache.js.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts +6 -6
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.js +9 -0
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
- package/lib/odspDeltaStorageService.d.ts +6 -6
- package/lib/odspDeltaStorageService.d.ts.map +1 -1
- package/lib/odspDeltaStorageService.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts +5 -5
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.d.ts +6 -6
- package/lib/odspDocumentService.d.ts.map +1 -1
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactory.d.ts +2 -2
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactory.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +7 -7
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js +1 -1
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts +9 -9
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts +3 -3
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.js.map +1 -1
- package/lib/odspDriverUrlResolver.d.ts +3 -3
- package/lib/odspDriverUrlResolver.d.ts.map +1 -1
- package/lib/odspDriverUrlResolver.js +4 -1
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts +4 -4
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspError.d.ts +3 -3
- package/lib/odspError.d.ts.map +1 -1
- package/lib/odspError.js +1 -1
- package/lib/odspError.js.map +1 -1
- package/lib/odspFluidFileLink.d.ts +1 -1
- package/lib/odspFluidFileLink.d.ts.map +1 -1
- package/lib/odspFluidFileLink.js.map +1 -1
- package/lib/odspLayerCompatState.d.ts +1 -1
- package/lib/odspLayerCompatState.d.ts.map +1 -1
- package/lib/odspLayerCompatState.js.map +1 -1
- package/lib/odspLocationRedirection.d.ts +2 -2
- package/lib/odspLocationRedirection.d.ts.map +1 -1
- package/lib/odspLocationRedirection.js.map +1 -1
- package/lib/odspPublicUtils.d.ts +1 -1
- package/lib/odspPublicUtils.d.ts.map +1 -1
- package/lib/odspPublicUtils.js.map +1 -1
- package/lib/odspSnapshotParser.d.ts +2 -2
- package/lib/odspSnapshotParser.d.ts.map +1 -1
- package/lib/odspSnapshotParser.js.map +1 -1
- package/lib/odspSummaryUploadManager.d.ts +5 -5
- package/lib/odspSummaryUploadManager.d.ts.map +1 -1
- package/lib/odspSummaryUploadManager.js +1 -1
- package/lib/odspSummaryUploadManager.js.map +1 -1
- package/lib/odspUrlHelper.d.ts +1 -1
- package/lib/odspUrlHelper.d.ts.map +1 -1
- package/lib/odspUrlHelper.js.map +1 -1
- package/lib/odspUtils.d.ts +5 -5
- package/lib/odspUtils.d.ts.map +1 -1
- package/lib/odspUtils.js.map +1 -1
- package/lib/opsCaching.d.ts +1 -1
- package/lib/opsCaching.d.ts.map +1 -1
- package/lib/opsCaching.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/prefetchLatestSnapshot.d.ts +5 -5
- package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
- package/lib/prefetchLatestSnapshot.js.map +1 -1
- package/lib/retryErrorsStorageAdapter.d.ts +4 -4
- package/lib/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/lib/retryErrorsStorageAdapter.js.map +1 -1
- package/lib/retryUtils.d.ts +1 -1
- package/lib/retryUtils.d.ts.map +1 -1
- package/lib/retryUtils.js.map +1 -1
- package/lib/vroom.d.ts +4 -4
- package/lib/vroom.d.ts.map +1 -1
- package/lib/vroom.js.map +1 -1
- package/lib/zipItDataRepresentationUtils.d.ts +2 -2
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +13 -14
- package/src/checkUrl.ts +1 -1
- package/src/compactSnapshotParser.ts +4 -4
- package/src/compactSnapshotWriter.ts +2 -2
- package/src/contracts.ts +3 -3
- package/src/contractsPublic.ts +20 -2
- package/src/createFile/createFile.ts +10 -10
- package/src/createFile/createNewContainerOnExistingFile.ts +20 -9
- package/src/createFile/createNewUtils.ts +27 -15
- package/src/createFile/index.ts +2 -1
- package/src/createOdspCreateContainerRequest.ts +2 -2
- package/src/createOdspUrl.ts +1 -1
- package/src/epochTracker.ts +11 -11
- package/src/fetchSnapshot.ts +20 -13
- package/src/getFileLink.ts +4 -4
- package/src/getQueryString.ts +1 -1
- package/src/index.ts +10 -10
- package/src/localOdspDriver/localOdspDeltaStorageService.ts +2 -2
- package/src/localOdspDriver/localOdspDocumentService.ts +4 -4
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +8 -5
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +4 -4
- package/src/localOdspDriver/localOdspLayerCompatState.ts +1 -1
- package/src/odspCache.ts +7 -7
- package/src/odspDelayLoadedDeltaStream.ts +24 -14
- package/src/odspDeltaStorageService.ts +8 -8
- package/src/odspDocumentDeltaConnection.ts +9 -9
- package/src/odspDocumentService.ts +8 -8
- package/src/odspDocumentServiceFactory.ts +2 -2
- package/src/odspDocumentServiceFactoryCore.ts +20 -19
- package/src/odspDocumentStorageManager.ts +18 -18
- package/src/odspDocumentStorageServiceBase.ts +13 -13
- package/src/odspDriverUrlResolver.ts +9 -6
- package/src/odspDriverUrlResolverForShareLink.ts +5 -5
- package/src/odspError.ts +6 -3
- package/src/odspFluidFileLink.ts +1 -1
- package/src/odspLayerCompatState.ts +1 -1
- package/src/odspLocationRedirection.ts +2 -2
- package/src/odspPublicUtils.ts +1 -1
- package/src/odspSnapshotParser.ts +2 -2
- package/src/odspSummaryUploadManager.ts +11 -7
- package/src/odspUrlHelper.ts +1 -1
- package/src/odspUtils.ts +13 -13
- package/src/opsCaching.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +13 -13
- package/src/retryErrorsStorageAdapter.ts +4 -4
- package/src/retryUtils.ts +1 -1
- package/src/vroom.ts +5 -5
- package/src/zipItDataRepresentationUtils.ts +2 -2
package/.eslintrc.cjs
CHANGED
|
@@ -17,6 +17,18 @@ module.exports = {
|
|
|
17
17
|
// This library uses and serializes "utf-8".
|
|
18
18
|
"unicorn/text-encoding-identifier-case": "off",
|
|
19
19
|
"@fluid-internal/fluid/no-unchecked-record-access": "warn",
|
|
20
|
+
|
|
21
|
+
// #region TODO: remove these once eslint-config-fluid has been updated to 5.8.0
|
|
22
|
+
"@typescript-eslint/consistent-type-exports": [
|
|
23
|
+
"error",
|
|
24
|
+
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
25
|
+
],
|
|
26
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
27
|
+
"error",
|
|
28
|
+
{ fixStyle: "inline-type-imports" },
|
|
29
|
+
],
|
|
30
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
31
|
+
// #endregion
|
|
20
32
|
},
|
|
21
33
|
overrides: [
|
|
22
34
|
{
|
package/CHANGELOG.md
CHANGED
package/dist/checkUrl.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { DriverPreCheckInfo } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { DriverPreCheckInfo } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.
|
|
8
8
|
* Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.
|
package/dist/checkUrl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkUrl.d.ts","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"checkUrl.d.ts","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAItF;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,GAAG,GAAG,kBAAkB,GAAG,SAAS,CAqBzE"}
|
package/dist/checkUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkUrl.js","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAA+D;AAE/D;;;;;;;GAOG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACxC,MAAM,OAAO,GAAG,IAAA,4CAAqB,EAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,IAAI,UAA8B,CAAC;IACnC,IAAI,CAAC;QACJ,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACtB,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;QAC/C,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,aAAa;IACd,CAAC;IAED,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;AArBD,4BAqBC","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/internal\";\n\nimport { getLocatorFromOdspUrl } from \"./odspFluidFileLink.js\";\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 * @legacy\n * @alpha\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\t\t// Drop error\n\t}\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"]}
|
|
1
|
+
{"version":3,"file":"checkUrl.js","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAA+D;AAE/D;;;;;;;GAOG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACxC,MAAM,OAAO,GAAG,IAAA,4CAAqB,EAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,IAAI,UAA8B,CAAC;IACnC,IAAI,CAAC;QACJ,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACtB,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;QAC/C,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,aAAa;IACd,CAAC;IAED,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;AArBD,4BAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { DriverPreCheckInfo } from \"@fluidframework/driver-definitions/internal\";\n\nimport { getLocatorFromOdspUrl } from \"./odspFluidFileLink.js\";\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 * @legacy\n * @alpha\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\t\t// Drop error\n\t}\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"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
6
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
5
|
+
import type { ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
6
|
+
import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
7
7
|
export declare const snapshotMinReadVersion = "1.0";
|
|
8
8
|
export declare const currentReadVersion = "1.0";
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compactSnapshotParser.d.ts","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"compactSnapshotParser.d.ts","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,SAAS,EAGT,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAgBpF,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAC5C,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC;;;;GAIG;AACH,MAAM,WAAW,0BAA2B,SAAQ,SAAS;IAC5D,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AA0ND;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,mBAAmB,GACzB,0BAA0B,CA8C5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compactSnapshotParser.js","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAQ7D,6DAAkD;AAClD,iDAAyC;AACzC,uFAU2C;AAE9B,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAC/B,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAWxC;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAe;IAIvC,IAAA,wDAAsB,EAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACrE,IAAI,sBAAs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AAkE,CACxE,CAAC;IACF,IAAA,iBAAM,EACL,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,8BAAsB,CAAC,EAClE,KAAK,CAAC,+DAA+D,CACrE,CAAC;IACF,IAAA,iBAAM,EACL,0BAAkB,KAAK,EAAE,EACzB,KAAK,CAAC,4DAA4D,CAClE,CAAC;IAEF,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAAC,GAAG,IAAA,sBAAO,EAAC,GAAG,EAAE,CACrD,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CACrC,CAAC;IACF,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,IAAA,sBAAO,EAAC,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAEpF,OAAO;QACN,GAAG,QAAQ;QACX,YAAY,EAAE,YAAY,CAAC,YAAY;QACvC,GAAG,EAAE,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC;QACvE,oBAAoB,EAAE,OAAO,CAAC,GAAG;QACjC,eAAe,EAAE,CAAC;QAClB,cAAc,EAAE;YACf,GAAG,cAAc;YACjB,oBAAoB;YACpB,aAAa;YACb,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB;YACvD,sBAAsB,EAAE,YAAY,CAAC,sBAAsB;YAC3D,6BAA6B,EAAE,QAAQ,CAAC,6BAA6B;SACrE;KACD,CAAC;AACH,CAAC;AAjDD,oEAiDC","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/internal\";\nimport {\n\tISnapshot,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ReadBuffer } from \"./ReadBufferUtils.js\";\nimport { measure } from \"./odspUtils.js\";\nimport {\n\tNodeCore,\n\tNodeTypes,\n\tTreeBuilder,\n\tassertBlobCoreInstance,\n\tassertBoolInstance,\n\tassertNodeCoreInstance,\n\tassertNumberInstance,\n\tgetNodeProps,\n\tgetStringInstance,\n} from \"./zipItDataRepresentationUtils.js\";\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 * @internal\n */\nexport interface ISnapshotContentsWithProps extends ISnapshot {\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\tblobContents: Map<string, ArrayBuffer>;\n\tslowBlobStructureCount: number;\n} {\n\tassertNodeCoreInstance(node, \"TreeBlobs should be of type NodeCore\");\n\tlet slowBlobStructureCount = 0;\n\tconst blobContents: 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\tblobContents.set(blob.getString(1), blob.getBlob(3).arrayBuffer);\n\t\t} else {\n\t\t\t/**\n\t\t\t * More generalized workflow\n\t\t\t */\n\t\t\tslowBlobStructureCount += 1;\n\t\t\tconst records = getNodeProps(blob);\n\t\t\tassertBlobCoreInstance(records.data, \"data should be of BlobCore type\");\n\t\t\tconst id = getStringInstance(records.id, \"blob id should be string\");\n\t\t\tblobContents.set(id, records.data.arrayBuffer);\n\t\t}\n\t}\n\treturn { blobContents, 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): ISequencedDocumentMessage[] {\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\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\tsnapshotTree: ISnapshotTree;\n\tslowTreeStructureCount: number;\n\ttreeStructureCountWithGroupId: number;\n} {\n\tlet slowTreeStructureCount = 0;\n\tlet treeStructureCountWithGroupId = 0;\n\tconst trees: Record<string, ISnapshotTree> = {};\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\tswitch (length) {\n\t\t\t\tcase 2: {\n\t\t\t\t\t// empty tree case\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\ttrees[treeNode.getString(1)] = { blobs: {}, trees: {} };\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase 4: {\n\t\t\t\t\tconst content = treeNode.getMaybeString(2);\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"children\": <blob id>\n\t\t\t\t\tif (content === \"children\") {\n\t\t\t\t\t\tconst result = readTreeSection(treeNode.getNode(3));\n\t\t\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\t\t\ttreeStructureCountWithGroupId += result.treeStructureCountWithGroupId;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"value\": <blob id>\n\t\t\t\t\tif (content === \"value\") {\n\t\t\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(3);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 6: {\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"nodeType\": 3\n\t\t\t\t\t// \"value\": <blob id>\n\t\t\t\t\tif (\n\t\t\t\t\t\ttreeNode.getMaybeString(2) === \"nodeType\" &&\n\t\t\t\t\t\ttreeNode.getMaybeString(4) === \"value\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(5);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"unreferenced\": true\n\t\t\t\t\t// \"children\": <blob id>\n\t\t\t\t\tif (\n\t\t\t\t\t\ttreeNode.getMaybeString(2) === \"unreferenced\" &&\n\t\t\t\t\t\ttreeNode.getMaybeString(4) === \"children\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst result = readTreeSection(treeNode.getNode(5));\n\t\t\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\t\t\ttreeStructureCountWithGroupId += result.treeStructureCountWithGroupId;\n\t\t\t\t\t\tassert(treeNode.getBool(3), 0x3db /* Unreferenced if present should be true */);\n\t\t\t\t\t\tsnapshotTree.unreferenced = true;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * More generalized workflow\n\t\t */\n\t\tslowTreeStructureCount++;\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\t// eslint-disable-next-line unicorn/no-negated-condition\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\tif (records.groupId !== undefined) {\n\t\t\t\tconst groupId = getStringInstance(records.groupId, \"groupId should be a string\");\n\t\t\t\ttrees[path].groupId = groupId;\n\t\t\t\ttreeStructureCountWithGroupId++;\n\t\t\t}\n\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\ttreeStructureCountWithGroupId += result.treeStructureCountWithGroupId;\n\t\t} else {\n\t\t\ttrees[path] = { blobs: {}, trees: {} };\n\t\t}\n\t}\n\treturn { snapshotTree, slowTreeStructureCount, treeStructureCountWithGroupId };\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\tsequenceNumber: number;\n\tsnapshotTree: ISnapshotTree;\n\tslowTreeStructureCount: number;\n\ttreeStructureCountWithGroupId: number;\n} {\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, treeStructureCountWithGroupId } =\n\t\treadTreeSection(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\ttreeStructureCountWithGroupId,\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 * @internal\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\tNumber.parseFloat(snapshotMinReadVersion) >= Number.parseFloat(mrv),\n\t\t0x20f /* \"Driver min read version should >= to server minReadVersion\" */,\n\t);\n\tassert(\n\t\tNumber.parseFloat(cv) >= Number.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(() =>\n\t\treadSnapshotSection(records.snapshot),\n\t);\n\tconst [blobContents, durationBlobs] = measure(() => readBlobSection(records.blobs));\n\n\treturn {\n\t\t...snapshot,\n\t\tblobContents: blobContents.blobContents,\n\t\tops: records.deltas === undefined ? [] : readOpsSection(records.deltas),\n\t\tlatestSequenceNumber: records.lsn,\n\t\tsnapshotFormatV: 1,\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: blobContents.slowBlobStructureCount,\n\t\t\ttreeStructureCountWithGroupId: snapshot.treeStructureCountWithGroupId,\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compactSnapshotParser.js","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAQ7D,6DAAkD;AAClD,iDAAyC;AACzC,uFAU2C;AAE9B,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAC/B,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAWxC;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAe;IAIvC,IAAA,wDAAsB,EAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACrE,IAAI,sBAAsB,GAAG,CAAC,CAAC;IAC/B,MAAM,YAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;IACzD,KAAK,MAAM,IAAI,IAAI,IAAI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,8BAAsB,CAAC,EAClE,KAAK,CAAC,+DAA+D,CACrE,CAAC;IACF,IAAA,iBAAM,EACL,0BAAkB,KAAK,EAAE,EACzB,KAAK,CAAC,4DAA4D,CAClE,CAAC;IAEF,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAAC,GAAG,IAAA,sBAAO,EAAC,GAAG,EAAE,CACrD,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CACrC,CAAC;IACF,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,IAAA,sBAAO,EAAC,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAEpF,OAAO;QACN,GAAG,QAAQ;QACX,YAAY,EAAE,YAAY,CAAC,YAAY;QACvC,GAAG,EAAE,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC;QACvE,oBAAoB,EAAE,OAAO,CAAC,GAAG;QACjC,eAAe,EAAE,CAAC;QAClB,cAAc,EAAE;YACf,GAAG,cAAc;YACjB,oBAAoB;YACpB,aAAa;YACb,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB;YACvD,sBAAsB,EAAE,YAAY,CAAC,sBAAsB;YAC3D,6BAA6B,EAAE,QAAQ,CAAC,6BAA6B;SACrE;KACD,CAAC;AACH,CAAC;AAjDD,oEAiDC","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/internal\";\nimport type {\n\tISnapshot,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ReadBuffer } from \"./ReadBufferUtils.js\";\nimport { measure } from \"./odspUtils.js\";\nimport {\n\ttype NodeCore,\n\ttype NodeTypes,\n\tTreeBuilder,\n\tassertBlobCoreInstance,\n\tassertBoolInstance,\n\tassertNodeCoreInstance,\n\tassertNumberInstance,\n\tgetNodeProps,\n\tgetStringInstance,\n} from \"./zipItDataRepresentationUtils.js\";\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 * @internal\n */\nexport interface ISnapshotContentsWithProps extends ISnapshot {\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\tblobContents: Map<string, ArrayBuffer>;\n\tslowBlobStructureCount: number;\n} {\n\tassertNodeCoreInstance(node, \"TreeBlobs should be of type NodeCore\");\n\tlet slowBlobStructureCount = 0;\n\tconst blobContents: 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\tblobContents.set(blob.getString(1), blob.getBlob(3).arrayBuffer);\n\t\t} else {\n\t\t\t/**\n\t\t\t * More generalized workflow\n\t\t\t */\n\t\t\tslowBlobStructureCount += 1;\n\t\t\tconst records = getNodeProps(blob);\n\t\t\tassertBlobCoreInstance(records.data, \"data should be of BlobCore type\");\n\t\t\tconst id = getStringInstance(records.id, \"blob id should be string\");\n\t\t\tblobContents.set(id, records.data.arrayBuffer);\n\t\t}\n\t}\n\treturn { blobContents, 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): ISequencedDocumentMessage[] {\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\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\tsnapshotTree: ISnapshotTree;\n\tslowTreeStructureCount: number;\n\ttreeStructureCountWithGroupId: number;\n} {\n\tlet slowTreeStructureCount = 0;\n\tlet treeStructureCountWithGroupId = 0;\n\tconst trees: Record<string, ISnapshotTree> = {};\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\tswitch (length) {\n\t\t\t\tcase 2: {\n\t\t\t\t\t// empty tree case\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\ttrees[treeNode.getString(1)] = { blobs: {}, trees: {} };\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase 4: {\n\t\t\t\t\tconst content = treeNode.getMaybeString(2);\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"children\": <blob id>\n\t\t\t\t\tif (content === \"children\") {\n\t\t\t\t\t\tconst result = readTreeSection(treeNode.getNode(3));\n\t\t\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\t\t\ttreeStructureCountWithGroupId += result.treeStructureCountWithGroupId;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"value\": <blob id>\n\t\t\t\t\tif (content === \"value\") {\n\t\t\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(3);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 6: {\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"nodeType\": 3\n\t\t\t\t\t// \"value\": <blob id>\n\t\t\t\t\tif (\n\t\t\t\t\t\ttreeNode.getMaybeString(2) === \"nodeType\" &&\n\t\t\t\t\t\ttreeNode.getMaybeString(4) === \"value\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(5);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// \"name\": <node name>\n\t\t\t\t\t// \"unreferenced\": true\n\t\t\t\t\t// \"children\": <blob id>\n\t\t\t\t\tif (\n\t\t\t\t\t\ttreeNode.getMaybeString(2) === \"unreferenced\" &&\n\t\t\t\t\t\ttreeNode.getMaybeString(4) === \"children\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst result = readTreeSection(treeNode.getNode(5));\n\t\t\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\t\t\ttreeStructureCountWithGroupId += result.treeStructureCountWithGroupId;\n\t\t\t\t\t\tassert(treeNode.getBool(3), 0x3db /* Unreferenced if present should be true */);\n\t\t\t\t\t\tsnapshotTree.unreferenced = true;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * More generalized workflow\n\t\t */\n\t\tslowTreeStructureCount++;\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\t// eslint-disable-next-line unicorn/no-negated-condition\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\tif (records.groupId !== undefined) {\n\t\t\t\tconst groupId = getStringInstance(records.groupId, \"groupId should be a string\");\n\t\t\t\ttrees[path].groupId = groupId;\n\t\t\t\ttreeStructureCountWithGroupId++;\n\t\t\t}\n\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\ttreeStructureCountWithGroupId += result.treeStructureCountWithGroupId;\n\t\t} else {\n\t\t\ttrees[path] = { blobs: {}, trees: {} };\n\t\t}\n\t}\n\treturn { snapshotTree, slowTreeStructureCount, treeStructureCountWithGroupId };\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\tsequenceNumber: number;\n\tsnapshotTree: ISnapshotTree;\n\tslowTreeStructureCount: number;\n\ttreeStructureCountWithGroupId: number;\n} {\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, treeStructureCountWithGroupId } =\n\t\treadTreeSection(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\ttreeStructureCountWithGroupId,\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 * @internal\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\tNumber.parseFloat(snapshotMinReadVersion) >= Number.parseFloat(mrv),\n\t\t0x20f /* \"Driver min read version should >= to server minReadVersion\" */,\n\t);\n\tassert(\n\t\tNumber.parseFloat(cv) >= Number.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(() =>\n\t\treadSnapshotSection(records.snapshot),\n\t);\n\tconst [blobContents, durationBlobs] = measure(() => readBlobSection(records.blobs));\n\n\treturn {\n\t\t...snapshot,\n\t\tblobContents: blobContents.blobContents,\n\t\tops: records.deltas === undefined ? [] : readOpsSection(records.deltas),\n\t\tlatestSequenceNumber: records.lsn,\n\t\tsnapshotFormatV: 1,\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: blobContents.slowBlobStructureCount,\n\t\t\ttreeStructureCountWithGroupId: snapshot.treeStructureCountWithGroupId,\n\t\t},\n\t};\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Converts trees/blobs/ops to binary compact representation.
|
|
8
8
|
* @param snapshotContents - snapshot tree contents to serialize
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compactSnapshotWriter.d.ts","sourceRoot":"","sources":["../src/compactSnapshotWriter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"compactSnapshotWriter.d.ts","sourceRoot":"","sources":["../src/compactSnapshotWriter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,K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AC;IACrC,CAAC;IAED,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAEnD,oBAAoB,CACnB,QAAQ,EACR,gBAAgB,CAAC,YAAY,EAC7B,gBAAgB,CAAC,cAAc,CAC/B,CAAC;IAEF,YAAY;IACZ,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAE3D,2BAA2B;IAC3B,eAAe,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC,SAAS,EAAE,CAAC;AAC5B,CAAC;AAhCD,4DAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tISnapshot,\n\tIBlob,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport { TreeBuilderSerializer } from \"./WriteBufferUtils.js\";\nimport { snapshotMinReadVersion } from \"./compactSnapshotParser.js\";\nimport {\n\tNodeCore,\n\taddBoolProperty,\n\taddDictionaryStringProperty,\n\taddNumberProperty,\n\taddStringProperty,\n} from \"./zipItDataRepresentationUtils.js\";\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): void {\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(\n\tsnapshotNode: NodeCore,\n\tblobs: Map<string, IBlob | ArrayBuffer>,\n): void {\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(new Uint8Array(stringToBuffer(blob.contents, blob.encoding ?? \"utf8\")));\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): void {\n\tsnapshotNode.addDictionaryString(\"treeNodes\");\n\tconst treesNode = snapshotNode.addNode(\"list\");\n\twriteTreeSectionCore(treesNode, snapshotTree);\n}\n\nfunction writeTreeSectionCore(treesNode: NodeCore, snapshotTree: ISnapshotTree): void {\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\tif (value.groupId !== undefined) {\n\t\t\taddDictionaryStringProperty(treeNode, \"groupId\", value.groupId);\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): void {\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[]): void {\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\tfor (const op of ops) {\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: ISnapshot): 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(\n\t\trootNode,\n\t\tsnapshotContents.snapshotTree,\n\t\tsnapshotContents.sequenceNumber,\n\t);\n\n\t// Add Blobs\n\twriteBlobsSection(rootNode, snapshotContents.blobContents);\n\n\t// Then write the ops node.\n\twriteOpsSection(rootNode, snapshotContents.ops);\n\n\treturn builder.serialize();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compactSnapshotWriter.js","sourceRoot":"","sources":["../src/compactSnapshotWriter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAQ7D,+DAA8D;AAC9D,yEAAoE;AACpE,uFAM2C;AAE3C;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,IAAc,EAAE,oBAA4B;IACvE,IAAA,mDAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,iDAAsB,CAAC,CAAC;IACvD,IAAA,mDAAiB,EAAC,IAAI,EAAE,IAAI,EAAE,iDAAsB,CAAC,CAAC;IACtD,IAAA,mDAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CACzB,YAAsB,EACtB,KAAuC;I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AC,gBAA2B;IACnE,MAAM,OAAO,GAAG,IAAI,2CAAqB,EAAE,CAAC;IAC5C,wBAAwB;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IACnC,IAAA,iBAAM,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,CAAC;QACxC,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;IACrC,CAAC;IAED,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAEnD,oBAAoB,CACnB,QAAQ,EACR,gBAAgB,CAAC,YAAY,EAC7B,gBAAgB,CAAC,cAAc,CAC/B,CAAC;IAEF,YAAY;IACZ,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAE3D,2BAA2B;IAC3B,eAAe,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC,SAAS,EAAE,CAAC;AAC5B,CAAC;AAhCD,4DAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tISnapshot,\n\tIBlob,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport { TreeBuilderSerializer } from \"./WriteBufferUtils.js\";\nimport { snapshotMinReadVersion } from \"./compactSnapshotParser.js\";\nimport {\n\ttype NodeCore,\n\taddBoolProperty,\n\taddDictionaryStringProperty,\n\taddNumberProperty,\n\taddStringProperty,\n} from \"./zipItDataRepresentationUtils.js\";\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): void {\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(\n\tsnapshotNode: NodeCore,\n\tblobs: Map<string, IBlob | ArrayBuffer>,\n): void {\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(new Uint8Array(stringToBuffer(blob.contents, blob.encoding ?? \"utf8\")));\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): void {\n\tsnapshotNode.addDictionaryString(\"treeNodes\");\n\tconst treesNode = snapshotNode.addNode(\"list\");\n\twriteTreeSectionCore(treesNode, snapshotTree);\n}\n\nfunction writeTreeSectionCore(treesNode: NodeCore, snapshotTree: ISnapshotTree): void {\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\tif (value.groupId !== undefined) {\n\t\t\taddDictionaryStringProperty(treeNode, \"groupId\", value.groupId);\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): void {\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[]): void {\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\tfor (const op of ops) {\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: ISnapshot): 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(\n\t\trootNode,\n\t\tsnapshotContents.snapshotTree,\n\t\tsnapshotContents.sequenceNumber,\n\t);\n\n\t// Add Blobs\n\twriteBlobsSection(rootNode, snapshotContents.blobContents);\n\n\t// Then write the ops node.\n\twriteOpsSection(rootNode, snapshotContents.ops);\n\n\treturn builder.serialize();\n}\n"]}
|
package/dist/contracts.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISnapshot, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
6
|
-
import { HostStoragePolicy } from "@fluidframework/odsp-driver-definitions/internal";
|
|
7
|
-
import { ISnapshotContents } from "./odspPublicUtils.js";
|
|
5
|
+
import type { ISnapshot, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
6
|
+
import type { HostStoragePolicy } from "@fluidframework/odsp-driver-definitions/internal";
|
|
7
|
+
import type { ISnapshotContents } from "./odspPublicUtils.js";
|
|
8
8
|
/**
|
|
9
9
|
* Interface for error responses for the WebSocket connection
|
|
10
10
|
*/
|
package/dist/contracts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,SAAS,EACT,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAG1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AAC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{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA8MU,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAuC5C;;GAEG;AACU,QAAA,6BAA6B,GAAG,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tISnapshot,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { HostStoragePolicy } from \"@fluidframework/odsp-driver-definitions/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport { ISnapshotContents } from \"./odspPublicUtils.js\";\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?: unknown;\n}\n\n/**\n * Interface for delta storage response.\n * Contains either SequencedDocumentMessages or SequencedDeltaOpMessage.\n */\nexport interface IDeltaStorageGetResponse {\n\tvalue: ISequencedDocumentMessage[] | ISequencedDeltaOpMessage[];\n}\n\nexport interface ISequencedDeltaOpMessage {\n\top: 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\tgroupId?: string;\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\tgroupId?: string;\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\tsupportGetSnapshotApi?: 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// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\"sharing\"?: any;\n\t\"sharingLink\"?: string;\n\t\"sharingLinkErrorReason\"?: string;\n\t\"name\": string;\n}\n\nexport interface IRenameFileResponse {\n\t\"@odata.context\": string;\n\t\"id\": string;\n\t\"name\": string;\n}\n\nexport interface IVersionedValueWithEpoch {\n\t// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\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/**\n\t * Time in seconds. Currently never set by PUSH\n\t */\n\tretryAfter?: number;\n\tmessages?: ISequencedDocumentMessage[];\n}\n\nexport interface IFlushOpsResponse {\n\tnonce: string;\n\tcode: number;\n\t/**\n\t * Time in seconds\n\t */\n\tretryAfter?: number;\n\tlastPersistedSequenceNumber?: number;\n}\n\n/**\n * Represents the cached snapshot value.\n * @deprecated - This will be replaced with ISnapshotCachedEntry2 which wraps the new ISnapshot interface.\n * For now, to support back compat from cache, we need to keep it for now.\n */\n// eslint-disable-next-line import/no-deprecated\nexport interface ISnapshotCachedEntry extends ISnapshotContents {\n\tcacheEntryTime: number;\n}\n\n/**\n * Represents the cached snapshot value.\n */\nexport interface ISnapshotCachedEntry2 extends ISnapshot {\n\tcacheEntryTime: number;\n}\n\n/**\n * Represents the type of signal containing the sensitivity policy labels for the container.\n */\nexport const policyLabelsUpdatesSignalType = \"PolicyLabelsUpdate\";\n"]}
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA8MU,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAuC5C;;GAEG;AACU,QAAA,6BAA6B,GAAG,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tISnapshot,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { HostStoragePolicy } from \"@fluidframework/odsp-driver-definitions/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport type { ISnapshotContents } from \"./odspPublicUtils.js\";\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?: unknown;\n}\n\n/**\n * Interface for delta storage response.\n * Contains either SequencedDocumentMessages or SequencedDeltaOpMessage.\n */\nexport interface IDeltaStorageGetResponse {\n\tvalue: ISequencedDocumentMessage[] | ISequencedDeltaOpMessage[];\n}\n\nexport interface ISequencedDeltaOpMessage {\n\top: 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\tgroupId?: string;\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\tgroupId?: string;\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\tsupportGetSnapshotApi?: 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// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\"sharing\"?: any;\n\t\"sharingLink\"?: string;\n\t\"sharingLinkErrorReason\"?: string;\n\t\"name\": string;\n}\n\nexport interface IRenameFileResponse {\n\t\"@odata.context\": string;\n\t\"id\": string;\n\t\"name\": string;\n}\n\nexport interface IVersionedValueWithEpoch {\n\t// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\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/**\n\t * Time in seconds. Currently never set by PUSH\n\t */\n\tretryAfter?: number;\n\tmessages?: ISequencedDocumentMessage[];\n}\n\nexport interface IFlushOpsResponse {\n\tnonce: string;\n\tcode: number;\n\t/**\n\t * Time in seconds\n\t */\n\tretryAfter?: number;\n\tlastPersistedSequenceNumber?: number;\n}\n\n/**\n * Represents the cached snapshot value.\n * @deprecated - This will be replaced with ISnapshotCachedEntry2 which wraps the new ISnapshot interface.\n * For now, to support back compat from cache, we need to keep it for now.\n */\n// eslint-disable-next-line import/no-deprecated\nexport interface ISnapshotCachedEntry extends ISnapshotContents {\n\tcacheEntryTime: number;\n}\n\n/**\n * Represents the cached snapshot value.\n */\nexport interface ISnapshotCachedEntry2 extends ISnapshot {\n\tcacheEntryTime: number;\n}\n\n/**\n * Represents the type of signal containing the sensitivity policy labels for the container.\n */\nexport const policyLabelsUpdatesSignalType = \"PolicyLabelsUpdate\";\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IOdspUrlParts } from "@fluidframework/odsp-driver-definitions/internal";
|
|
5
|
+
import type { IOdspUrlParts } from "@fluidframework/odsp-driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* @legacy
|
|
8
8
|
* @alpha
|
|
@@ -48,8 +48,24 @@ export declare enum ClpCompliantAppHeader {
|
|
|
48
48
|
export interface IClpCompliantAppHeader {
|
|
49
49
|
[ClpCompliantAppHeader.isClpCompliantApp]: boolean;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare enum FileMetadataHeader {
|
|
55
|
+
/**
|
|
56
|
+
* ETag (entity tag) identifier for a specific version of the file.
|
|
57
|
+
* When provided, it will be sent to the snapshot API in the If-Match header.
|
|
58
|
+
*/
|
|
59
|
+
eTag = "eTag"
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export interface IFileMetadataHeader {
|
|
65
|
+
[FileMetadataHeader.eTag]: string;
|
|
66
|
+
}
|
|
51
67
|
declare module "@fluidframework/core-interfaces" {
|
|
52
|
-
interface IRequestHeader extends Partial<ISharingLinkHeader>, Partial<IClpCompliantAppHeader> {
|
|
68
|
+
interface IRequestHeader extends Partial<ISharingLinkHeader>, Partial<IClpCompliantAppHeader>, Partial<IFileMetadataHeader> {
|
|
53
69
|
}
|
|
54
70
|
}
|
|
55
71
|
//# sourceMappingURL=contractsPublic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractsPublic.d.ts","sourceRoot":"","sources":["../src/contractsPublic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"contractsPublic.d.ts","sourceRoot":"","sources":["../src/contractsPublic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AAEtF;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,aAAa;IAC/D,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC5B;;;OAGG;IACH,qBAAqB,0BAA0B;IAC/C;;;OAGG;IACH,sBAAsB,2BAA2B;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IACnD,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpD;AACD;;GAEG;AACH,oBAAY,qBAAqB;IAGhC,iBAAiB,wBAAwB;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACnD;AAED;;GAEG;AACH,oBAAY,kBAAkB;IAC7B;;;OAGG;IACH,IAAI,SAAS;CACb;AACD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,OAAO,QAAQ,iCAAiC,CAAC;IAChD,UAAiB,cAChB,SAAQ,OAAO,CAAC,kBAAkB,CAAC,EAClC,OAAO,CAAC,sBAAsB,CAAC,EAC/B,OAAO,CAAC,mBAAmB,CAAC;KAAG;CACjC"}
|
package/dist/contractsPublic.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ClpCompliantAppHeader = exports.SharingLinkHeader = void 0;
|
|
7
|
+
exports.FileMetadataHeader = exports.ClpCompliantAppHeader = exports.SharingLinkHeader = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
@@ -30,4 +30,15 @@ var ClpCompliantAppHeader;
|
|
|
30
30
|
// Odsp will not return Classified, labeled, or protected documents if the host app cannot support them.
|
|
31
31
|
ClpCompliantAppHeader["isClpCompliantApp"] = "X-CLP-Compliant-App";
|
|
32
32
|
})(ClpCompliantAppHeader || (exports.ClpCompliantAppHeader = ClpCompliantAppHeader = {}));
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
var FileMetadataHeader;
|
|
37
|
+
(function (FileMetadataHeader) {
|
|
38
|
+
/**
|
|
39
|
+
* ETag (entity tag) identifier for a specific version of the file.
|
|
40
|
+
* When provided, it will be sent to the snapshot API in the If-Match header.
|
|
41
|
+
*/
|
|
42
|
+
FileMetadataHeader["eTag"] = "eTag";
|
|
43
|
+
})(FileMetadataHeader || (exports.FileMetadataHeader = FileMetadataHeader = {}));
|
|
33
44
|
//# sourceMappingURL=contractsPublic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractsPublic.js","sourceRoot":"","sources":["../src/contractsPublic.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgBH;;GAEG;AACH,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC5B;;;OAGG;IACH,oEAA+C,CAAA;IAC/C;;;OAGG;IACH,sEAAiD,CAAA;AAClD,CAAC,EAXW,iBAAiB,iCAAjB,iBAAiB,QAW5B;AASD;;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/internal\";\n\n/**\n * @legacy\n * @alpha\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 * @internal\n */\nexport enum SharingLinkHeader {\n\t/**\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\t */\n\tisSharingLinkToRedeem = \"isSharingLinkToRedeem\",\n\t/**\n\t * When isSharingLinkToRedeem is true, this header can be used to tell the server that the redemption of the sharing link\n\t * is meant to be non-durable.\n\t */\n\tisRedemptionNonDurable = \"isRedemptionNonDurable\",\n}\n\n/**\n * @internal\n */\nexport interface ISharingLinkHeader {\n\t[SharingLinkHeader.isSharingLinkToRedeem]: boolean;\n\t[SharingLinkHeader.isRedemptionNonDurable]: boolean;\n}\n/**\n * @internal\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 * @internal\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"]}
|
|
1
|
+
{"version":3,"file":"contractsPublic.js","sourceRoot":"","sources":["../src/contractsPublic.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgBH;;GAEG;AACH,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC5B;;;OAGG;IACH,oEAA+C,CAAA;IAC/C;;;OAGG;IACH,sEAAiD,CAAA;AAClD,CAAC,EAXW,iBAAiB,iCAAjB,iBAAiB,QAW5B;AASD;;GAEG;AACH,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAChC,oGAAoG;IACpG,wGAAwG;IACxG,kEAAyC,CAAA;AAC1C,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC;AASD;;GAEG;AACH,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC7B;;;OAGG;IACH,mCAAa,CAAA;AACd,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IOdspUrlParts } from \"@fluidframework/odsp-driver-definitions/internal\";\n\n/**\n * @legacy\n * @alpha\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 * @internal\n */\nexport enum SharingLinkHeader {\n\t/**\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\t */\n\tisSharingLinkToRedeem = \"isSharingLinkToRedeem\",\n\t/**\n\t * When isSharingLinkToRedeem is true, this header can be used to tell the server that the redemption of the sharing link\n\t * is meant to be non-durable.\n\t */\n\tisRedemptionNonDurable = \"isRedemptionNonDurable\",\n}\n\n/**\n * @internal\n */\nexport interface ISharingLinkHeader {\n\t[SharingLinkHeader.isSharingLinkToRedeem]: boolean;\n\t[SharingLinkHeader.isRedemptionNonDurable]: boolean;\n}\n/**\n * @internal\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 * @internal\n */\nexport interface IClpCompliantAppHeader {\n\t[ClpCompliantAppHeader.isClpCompliantApp]: boolean;\n}\n\n/**\n * @internal\n */\nexport enum FileMetadataHeader {\n\t/**\n\t * ETag (entity tag) identifier for a specific version of the file.\n\t * When provided, it will be sent to the snapshot API in the If-Match header.\n\t */\n\teTag = \"eTag\",\n}\n/**\n * @internal\n */\nexport interface IFileMetadataHeader {\n\t[FileMetadataHeader.eTag]: string;\n}\n\ndeclare module \"@fluidframework/core-interfaces\" {\n\texport interface IRequestHeader\n\t\textends Partial<ISharingLinkHeader>,\n\t\t\tPartial<IClpCompliantAppHeader>,\n\t\t\tPartial<IFileMetadataHeader> {}\n}\n"]}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { IFileEntry, IOdspResolvedUrl, InstrumentedStorageTokenFetcher, type IOdspUrlParts } from "@fluidframework/odsp-driver-definitions/internal";
|
|
7
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
8
|
-
import { ICreateFileResponse,
|
|
9
|
-
import { EpochTracker } from "./../epochTracker.js";
|
|
10
|
-
import { INewFileInfo } from "./../odspUtils.js";
|
|
5
|
+
import type { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
+
import { type IFileEntry, type IOdspResolvedUrl, type InstrumentedStorageTokenFetcher, type IOdspUrlParts } from "@fluidframework/odsp-driver-definitions/internal";
|
|
7
|
+
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
8
|
+
import type { ICreateFileResponse, IRenameFileResponse } from "./../contracts.js";
|
|
9
|
+
import type { EpochTracker } from "./../epochTracker.js";
|
|
10
|
+
import { type INewFileInfo } from "./../odspUtils.js";
|
|
11
11
|
/**
|
|
12
12
|
* Creates a new Fluid file.
|
|
13
13
|
* Returns resolved url
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFile.d.ts","sourceRoot":"","sources":["../../src/createFile/createFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"createFile.d.ts","sourceRoot":"","sources":["../../src/createFile/createFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,EACN,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,+BAA+B,EAGpC,KAAK,aAAa,EAClB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGlF,OAAO,KAAK,EAAE,YAAY,EAAE,M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EAC9B,YAA0B,EAC1B,sCAA+C;IAE/C,MAAM,QAAQ,GAAG,cAAc,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,eAAe,GAAG,kBAAkB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACjE,MAAM,OAAO,GACZ,GAAG,IAAA,6BAAU,EAAC,IAAI,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,WAAW,WAAW,CAAC,OAAO,cAAc;QACvF,GAAG,QAAQ,IAAI,eAAe,EAAE,CAAC;IAElC,MAAM,iBAAiB,GAAG,IAAA,uDAAmC,EAAC,gBAAgB,CAAC,CAAC;IAEhF,8EAA8E;IAC9E,iGAAiG;IACjG,MAAM,oBAAoB,GAAG,IAAA,0CAA2B,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,+CAA2B,EAAsB;QACvD,iBAAiB;QACjB,aAAa;QACb,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,CAAC;gBACtB,MAAM,IAAI,4BAAiB,CAC1B,0CAA0C,EAC1C,yBAAc,CAAC,uBAAuB,EACtC,EAAE,aAAa,EAAb,8BAAa,EAAE,CACjB,CAAC;YACH,CAAC;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/internal\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIFileEntry,\n\tIOdspResolvedUrl,\n\tInstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\tShareLinkInfoType,\n\ttype IOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICreateFileResponse, type IRenameFileResponse } from \"./../contracts.js\";\nimport { ClpCompliantAppHeader } from \"./../contractsPublic.js\";\nimport { createOdspUrl } from \"./../createOdspUrl.js\";\nimport { EpochTracker } from \"./../epochTracker.js\";\nimport { getHeadersWithAuth } from \"./../getUrlAndHeadersWithAuth.js\";\nimport { OdspDriverUrlResolver } from \"./../odspDriverUrlResolver.js\";\nimport { checkForKnownServerFarmType, getApiRoot } from \"./../odspUrlHelper.js\";\nimport {\n\tINewFileInfo,\n\tappendNavParam,\n\tbuildOdspShareLinkReqParams,\n\tcreateCacheSnapshotKey,\n\tgetWithRetryForTokenRefresh,\n\tsnapshotWithLoadingGroupIdSupported,\n} from \"./../odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./../packageVersion.js\";\nimport { runWithRetry } from \"./../retryUtils.js\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils.js\";\n\nconst isInvalidFileName = (fileName: string): boolean => {\n\tconst invalidCharsRegex = /[\"*/:<>?\\\\|]+/g;\n\treturn invalidCharsRegex.test(fileName);\n};\n\n/**\n * Creates a new Fluid file.\n * Returns resolved url\n */\nexport async function createNewFluidFile(\n\tgetAuthHeader: 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\tresolvedUrl?: IOdspResolvedUrl,\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\tOdspErrorTypes.invalidFileNameError,\n\t\t\t{ driverVersion },\n\t\t);\n\t}\n\n\tlet itemId: string;\n\tlet pendingRename: string | undefined;\n\tlet summaryHandle: string = \"\";\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (createNewSummary === undefined) {\n\t\tconst content = await createNewEmptyFluidFile(\n\t\t\tgetAuthHeader,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tepochTracker,\n\t\t);\n\t\titemId = content.itemId;\n\t\tpendingRename = newFileInfo.filename;\n\t} else {\n\t\tconst content = await createNewFluidFileFromSummary(\n\t\t\tgetAuthHeader,\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(content, enableSingleRequestForShareLinkWithCreate);\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.context = resolvedUrl?.context;\n\todspResolvedUrl.appName = resolvedUrl?.appName;\n\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t? odspResolvedUrl.codeHint\n\t\t: resolvedUrl?.codeHint;\n\n\tif (shareLinkInfo?.createLink?.link) {\n\t\tlet newWebUrl = shareLinkInfo.createLink.link.webUrl;\n\t\tnewWebUrl = appendNavParam(\n\t\t\tnewWebUrl,\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"/\",\n\t\t\todspResolvedUrl.codeHint?.containerPackageName,\n\t\t);\n\t\tshareLinkInfo.createLink.link.webUrl = newWebUrl;\n\t}\n\n\todspResolvedUrl.shareLinkInfo = shareLinkInfo;\n\todspResolvedUrl.pendingRename = pendingRename;\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: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(\n\t\t\tcreateCacheSnapshotKey(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tsnapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),\n\t\t\t),\n\t\t\tsnapshot,\n\t\t);\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\n * createLinkScope in the request parameters then extract and save the sharing link information from\n * 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\tresponse: ICreateFileResponse,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n): ShareLinkInfoType | undefined {\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (enableSingleRequestForShareLinkWithCreate) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst { sharing } = response;\n\t\tif (!sharing) {\n\t\t\treturn;\n\t\t}\n\t\t/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t\tshareLinkInfo = {\n\t\t\tcreateLink: {\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\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\t/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t}\n\treturn shareLinkInfo;\n}\n\n/**\n * Encodes file path so it can be embedded in the request url\n * @param path - path to encode\n * @returns encoded path or \"\" if path is undefined\n */\nfunction encodeFilePath(path: string | undefined): string {\n\treturn path ? encodeURIComponent(path.startsWith(\"/\") ? path : `/${path}`) : \"\";\n}\n\nexport async function createNewEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<{ itemId: string; fileName: string }> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);\n\tconst initialUrl = `${getApiRoot(new URL(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 url = initialUrl;\n\t\tconst method = \"PUT\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"CreateNewFile\",\n\t\t);\n\t\tconst internalFarmType = checkForKnownServerFarmType(newFileInfo.siteUrl);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"createNewEmptyFile\",\n\t\t\t\tdetails: {\n\t\t\t\t\tinternalFarmType,\n\t\t\t\t},\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\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,\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\tOdspErrorTypes.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\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn { itemId: content.id, fileName: content.name };\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function renameEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\todspParts: IOdspUrlParts,\n\trequestedFileName: string,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<IRenameFileResponse> {\n\tconst initialUrl = `${getApiRoot(new URL(odspParts.siteUrl))}/drives/${\n\t\todspParts.driveId\n\t}/items/${odspParts.itemId}?@name.conflictBehavior=rename`;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst url = initialUrl;\n\t\tconst method = \"PATCH\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"renameFile\",\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"renameFile\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\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<IRenameFileResponse>(\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: JSON.stringify({\n\t\t\t\t\t\t\t\t\tname: requestedFileName,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"PATCH\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"renameFile\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"renameFile\",\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\"ODSP RenameFile call returned no item ID (for empty file)\",\n\t\t\t\t\t\tOdspErrorTypes.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\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn content;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function createNewFluidFileFromSummary(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree,\n\tepochTracker: EpochTracker,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<ICreateFileResponse> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(newFileInfo.filename);\n\tconst baseUrl =\n\t\t`${getApiRoot(new URL(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\tgetAuthHeader,\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\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
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\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype IFileEntry,\n\ttype IOdspResolvedUrl,\n\ttype InstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\ttype ShareLinkInfoType,\n\ttype IOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICreateFileResponse, IRenameFileResponse } from \"./../contracts.js\";\nimport { ClpCompliantAppHeader } from \"./../contractsPublic.js\";\nimport { createOdspUrl } from \"./../createOdspUrl.js\";\nimport type { EpochTracker } from \"./../epochTracker.js\";\nimport { getHeadersWithAuth } from \"./../getUrlAndHeadersWithAuth.js\";\nimport { OdspDriverUrlResolver } from \"./../odspDriverUrlResolver.js\";\nimport { checkForKnownServerFarmType, getApiRoot } from \"./../odspUrlHelper.js\";\nimport {\n\ttype INewFileInfo,\n\tappendNavParam,\n\tbuildOdspShareLinkReqParams,\n\tcreateCacheSnapshotKey,\n\tgetWithRetryForTokenRefresh,\n\tsnapshotWithLoadingGroupIdSupported,\n} from \"./../odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./../packageVersion.js\";\nimport { runWithRetry } from \"./../retryUtils.js\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils.js\";\n\nconst isInvalidFileName = (fileName: string): boolean => {\n\tconst invalidCharsRegex = /[\"*/:<>?\\\\|]+/g;\n\treturn invalidCharsRegex.test(fileName);\n};\n\n/**\n * Creates a new Fluid file.\n * Returns resolved url\n */\nexport async function createNewFluidFile(\n\tgetAuthHeader: 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\tresolvedUrl?: IOdspResolvedUrl,\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\tOdspErrorTypes.invalidFileNameError,\n\t\t\t{ driverVersion },\n\t\t);\n\t}\n\n\tlet itemId: string;\n\tlet pendingRename: string | undefined;\n\tlet summaryHandle: string = \"\";\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (createNewSummary === undefined) {\n\t\tconst content = await createNewEmptyFluidFile(\n\t\t\tgetAuthHeader,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tepochTracker,\n\t\t);\n\t\titemId = content.itemId;\n\t\tpendingRename = newFileInfo.filename;\n\t} else {\n\t\tconst content = await createNewFluidFileFromSummary(\n\t\t\tgetAuthHeader,\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(content, enableSingleRequestForShareLinkWithCreate);\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.context = resolvedUrl?.context;\n\todspResolvedUrl.appName = resolvedUrl?.appName;\n\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t? odspResolvedUrl.codeHint\n\t\t: resolvedUrl?.codeHint;\n\n\tif (shareLinkInfo?.createLink?.link) {\n\t\tlet newWebUrl = shareLinkInfo.createLink.link.webUrl;\n\t\tnewWebUrl = appendNavParam(\n\t\t\tnewWebUrl,\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"/\",\n\t\t\todspResolvedUrl.codeHint?.containerPackageName,\n\t\t);\n\t\tshareLinkInfo.createLink.link.webUrl = newWebUrl;\n\t}\n\n\todspResolvedUrl.shareLinkInfo = shareLinkInfo;\n\todspResolvedUrl.pendingRename = pendingRename;\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: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(\n\t\t\tcreateCacheSnapshotKey(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tsnapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),\n\t\t\t),\n\t\t\tsnapshot,\n\t\t);\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\n * createLinkScope in the request parameters then extract and save the sharing link information from\n * 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\tresponse: ICreateFileResponse,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n): ShareLinkInfoType | undefined {\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (enableSingleRequestForShareLinkWithCreate) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst { sharing } = response;\n\t\tif (!sharing) {\n\t\t\treturn;\n\t\t}\n\t\t/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t\tshareLinkInfo = {\n\t\t\tcreateLink: {\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\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\t/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t}\n\treturn shareLinkInfo;\n}\n\n/**\n * Encodes file path so it can be embedded in the request url\n * @param path - path to encode\n * @returns encoded path or \"\" if path is undefined\n */\nfunction encodeFilePath(path: string | undefined): string {\n\treturn path ? encodeURIComponent(path.startsWith(\"/\") ? path : `/${path}`) : \"\";\n}\n\nexport async function createNewEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<{ itemId: string; fileName: string }> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);\n\tconst initialUrl = `${getApiRoot(new URL(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 url = initialUrl;\n\t\tconst method = \"PUT\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"CreateNewFile\",\n\t\t);\n\t\tconst internalFarmType = checkForKnownServerFarmType(newFileInfo.siteUrl);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"createNewEmptyFile\",\n\t\t\t\tdetails: {\n\t\t\t\t\tinternalFarmType,\n\t\t\t\t},\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\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,\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\tOdspErrorTypes.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\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn { itemId: content.id, fileName: content.name };\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function renameEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\todspParts: IOdspUrlParts,\n\trequestedFileName: string,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<IRenameFileResponse> {\n\tconst initialUrl = `${getApiRoot(new URL(odspParts.siteUrl))}/drives/${\n\t\todspParts.driveId\n\t}/items/${odspParts.itemId}?@name.conflictBehavior=rename`;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst url = initialUrl;\n\t\tconst method = \"PATCH\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"renameFile\",\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"renameFile\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\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<IRenameFileResponse>(\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: JSON.stringify({\n\t\t\t\t\t\t\t\t\tname: requestedFileName,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"PATCH\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"renameFile\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"renameFile\",\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\"ODSP RenameFile call returned no item ID (for empty file)\",\n\t\t\t\t\t\tOdspErrorTypes.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\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn content;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function createNewFluidFileFromSummary(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree,\n\tepochTracker: EpochTracker,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<ICreateFileResponse> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(newFileInfo.filename);\n\tconst baseUrl =\n\t\t`${getApiRoot(new URL(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\tgetAuthHeader,\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\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { IFileEntry, IOdspResolvedUrl, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
7
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
8
|
-
import { EpochTracker } from "./../epochTracker.js";
|
|
9
|
-
import { IExistingFileInfo } from "./../odspUtils.js";
|
|
5
|
+
import type { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
+
import type { IFileEntry, IOdspResolvedUrl, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
7
|
+
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
8
|
+
import type { EpochTracker } from "./../epochTracker.js";
|
|
9
|
+
import { type IExistingFileInfo } from "./../odspUtils.js";
|
|
10
10
|
/**
|
|
11
11
|
* Creates a new Fluid container on an existing file.
|
|
12
12
|
*
|
|
@@ -18,5 +18,5 @@ import { IExistingFileInfo } from "./../odspUtils.js";
|
|
|
18
18
|
* by an existing file. For example, SharePoint Pages is able to store Fluid container in an
|
|
19
19
|
* "alternative file partition" where the main File stub is an ASPX page.
|
|
20
20
|
*/
|
|
21
|
-
export declare function createNewContainerOnExistingFile(getAuthHeader: InstrumentedStorageTokenFetcher, fileInfo: IExistingFileInfo, logger: ITelemetryLoggerExt, createNewSummary: ISummaryTree | undefined, epochTracker: EpochTracker, fileEntry: IFileEntry, createNewCaching: boolean, forceAccessTokenViaAuthorizationHeader: boolean, isClpCompliantApp?: boolean): Promise<IOdspResolvedUrl>;
|
|
21
|
+
export declare function createNewContainerOnExistingFile(getAuthHeader: InstrumentedStorageTokenFetcher, fileInfo: IExistingFileInfo, logger: ITelemetryLoggerExt, createNewSummary: ISummaryTree | undefined, epochTracker: EpochTracker, fileEntry: IFileEntry, createNewCaching: boolean, forceAccessTokenViaAuthorizationHeader: boolean, isClpCompliantApp?: boolean, eTag?: string): Promise<IOdspResolvedUrl>;
|
|
22
22
|
//# sourceMappingURL=createNewContainerOnExistingFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNewContainerOnExistingFile.d.ts","sourceRoot":"","sources":["../../src/createFile/createNewContainerOnExistingFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"createNewContainerOnExistingFile.d.ts","sourceRoot":"","sources":["../../src/createFile/createNewContainerOnExistingFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,KAAK,EACX,UAAU,EACV,gBAAgB,EAChB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,0CAA0C,CAAC;AAKlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,mBAAmB,CAAC;AAO3B;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACrD,aAAa,EAAE,+BAA+B,EAC9C,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,mBAAmB,EAC3B,gBAAgB,EAAE,YAAY,GAAG,SAAS,EAC1C,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,OAAO,EACzB,sCAAsC,EAAE,OAAO,EAC/C,iBAAiB,CAAC,EAAE,OAAO,EAC3B,IAAI,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC,CA4D3B"}
|