@fluidframework/tree 2.116.0-416006 → 2.116.1
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/CHANGELOG.md +84 -0
- package/README.md +5 -3
- package/api-report/tree.alpha.api.md +4 -2
- package/api-report/tree.beta.api.md +1 -1
- package/api-report/tree.legacy.beta.api.md +1 -1
- package/dist/codec/codec.d.ts +6 -6
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +3 -3
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +3 -3
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/core/forest/editableForest.d.ts +2 -0
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +2 -2
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +24 -3
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +24 -6
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +30 -6
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +146 -54
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +2 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +87 -70
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +5 -0
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +127 -107
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +2 -2
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.js +1 -1
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +2 -11
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +11 -16
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +10 -3
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +34 -13
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -1
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +2 -4
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +30 -5
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +8 -8
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +25 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +24 -0
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +21 -10
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +56 -24
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +2 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +3 -2
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/changeEnricher.d.ts +3 -2
- package/dist/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/changeEnricher.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts +9 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +7 -2
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -2
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +2 -2
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +2 -2
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +11 -2
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +11 -8
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/summaryTypes.d.ts +2 -2
- package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/summaryTypes.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +2 -2
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +5 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +10 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +19 -2
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/tableSchema.d.ts +1 -1
- package/dist/tableSchema.js +1 -1
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +1 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +14 -2
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +9 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/compressedIds.d.ts +2 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +1 -6
- package/dist/util/compressedIds.js.map +1 -1
- package/lib/codec/codec.d.ts +6 -6
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +3 -3
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +3 -3
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/core/forest/editableForest.d.ts +2 -0
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +24 -3
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +22 -4
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +30 -6
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +146 -56
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +2 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +88 -70
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +5 -0
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +129 -108
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +2 -2
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.js +2 -2
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -11
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +11 -16
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +10 -3
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +35 -14
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +2 -2
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +1 -1
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +3 -5
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +30 -5
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +8 -8
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +25 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +24 -0
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +21 -10
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +56 -24
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +2 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +3 -2
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/changeEnricher.d.ts +3 -2
- package/lib/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/changeEnricher.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts +9 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +7 -2
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -2
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +2 -2
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +2 -2
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +11 -2
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +11 -8
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/summaryTypes.d.ts +2 -2
- package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/summaryTypes.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +2 -2
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +5 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +10 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +19 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/tableSchema.d.ts +1 -1
- package/lib/tableSchema.js +1 -1
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +1 -1
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +14 -2
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +9 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/compressedIds.d.ts +2 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +1 -6
- package/lib/util/compressedIds.js.map +1 -1
- package/package.json +27 -27
- package/src/codec/codec.ts +7 -7
- package/src/codec/versioned/codec.ts +5 -5
- package/src/core/forest/editableForest.ts +2 -0
- package/src/core/index.ts +1 -1
- package/src/core/tree/index.ts +1 -1
- package/src/core/tree/visitorUtils.ts +37 -12
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +214 -59
- package/src/feature-libraries/comparison-forest/comparisonForest.ts +6 -1
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +2 -2
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +10 -0
- package/src/feature-libraries/forest-summary/summaryTypes.ts +2 -2
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +1 -1
- package/src/feature-libraries/modular-schema/invert.ts +2 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2 -23
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +12 -21
- package/src/feature-libraries/object-forest/objectForest.ts +48 -14
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +3 -3
- package/src/feature-libraries/sequence-field/rebase.ts +2 -2
- package/src/feature-libraries/sequence-field/utils.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +5 -12
- package/src/shared-tree/sharedTree.ts +41 -10
- package/src/shared-tree/sharedTreeChangeCodecs.ts +2 -2
- package/src/shared-tree/sharedTreeChangeEnricher.ts +25 -1
- package/src/shared-tree/treeCheckout.ts +53 -24
- package/src/shared-tree-core/branchCommitEnricher.ts +6 -2
- package/src/shared-tree-core/changeEnricher.ts +7 -2
- package/src/shared-tree-core/defaultResubmitMachine.ts +5 -0
- package/src/shared-tree-core/editManager.ts +2 -4
- package/src/shared-tree-core/editManagerCodecs.ts +2 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
- package/src/shared-tree-core/messageCodecs.ts +2 -2
- package/src/shared-tree-core/sharedTreeCore.ts +29 -11
- package/src/shared-tree-core/summaryTypes.ts +2 -2
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +1 -1
- package/src/simple-tree/api/storedSchema.ts +2 -2
- package/src/simple-tree/api/treeChangeEvents.ts +5 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +15 -0
- package/src/simple-tree/node-kinds/map/mapNode.ts +23 -2
- package/src/tableSchema.ts +1 -1
- package/src/treeFactory.ts +0 -1
- package/src/util/breakable.ts +9 -1
- package/src/util/compressedIds.ts +7 -13
|
@@ -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 type {
|
|
5
|
+
import type { OldestSupportedClientVersion } from "@fluidframework/runtime-definitions/internal";
|
|
6
6
|
import { ForestSummaryFormatVersion } from "./summaryFormatCommon.js";
|
|
7
7
|
/**
|
|
8
8
|
* Returns the summary format version to use as per the given minimum version for collab.
|
|
9
9
|
*/
|
|
10
|
-
export declare function minVersionToForestSummaryFormatVersion(version:
|
|
10
|
+
export declare function minVersionToForestSummaryFormatVersion(version: OldestSupportedClientVersion): ForestSummaryFormatVersion;
|
|
11
11
|
/**
|
|
12
12
|
* Gets the key for the blob containing the forest summary root content based on the summary format version.
|
|
13
13
|
* @param summaryFormatVersion - The version of the forest summary format.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryTypes.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/summaryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"summaryTypes.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/summaryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAQjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAItE;;GAEG;AACH,wBAAgB,sCAAsC,CACrD,OAAO,EAAE,4BAA4B,GACnC,0BAA0B,CAK5B;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC7C,oBAAoB,EAAE,0BAA0B,GAAG,SAAS,GAC1D,MAAM,CAKR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryTypes.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/summaryTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAGgD;AAEhD,mDAA0D;AAE1D,qEAAsE;AACtE,qEAAgG;AAChG,6DAAwF;AAExF;;GAEG;AACH,SAAgB,sCAAsC,CACrD,
|
|
1
|
+
{"version":3,"file":"summaryTypes.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/summaryTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAGgD;AAEhD,mDAA0D;AAE1D,qEAAsE;AACtE,qEAAgG;AAChG,6DAAwF;AAExF;;GAEG;AACH,SAAgB,sCAAsC,CACrD,OAAqC;IAErC,OAAO,IAAA,0CAA+B,EAAC,OAAO,EAAE;QAC/C,CAAC,oCAAyB,CAAC,EAAE,mDAA0B,CAAC,EAAE;QAC1D,CAAC,6BAAkB,CAAC,KAAK,CAAC,EAAE,mDAA0B,CAAC,EAAE;KACzD,CAAC,CAAC;AACJ,CAAC;AAPD,wFAOC;AAED;;;;GAIG;AACH,SAAgB,8BAA8B,CAC7C,oBAA4D;IAE5D,OAAO,oBAAoB,KAAK,SAAS;QACxC,oBAAoB,GAAG,mDAA0B,CAAC,EAAE;QACpD,CAAC,CAAC,8CAA2B;QAC7B,CAAC,CAAC,0CAAuB,CAAC;AAC5B,CAAC;AAPD,wEAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { OldestSupportedClientVersion } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport { FluidClientVersion } from \"../../codec/index.js\";\n\nimport { ForestSummaryFormatVersion } from \"./summaryFormatCommon.js\";\nimport { summaryContentBlobKey as summaryContentBlobKeyV1ToV2 } from \"./summaryFormatV1ToV2.js\";\nimport { summaryContentBlobKey as summaryContentBlobKeyV3 } from \"./summaryFormatV3.js\";\n\n/**\n * Returns the summary format version to use as per the given minimum version for collab.\n */\nexport function minVersionToForestSummaryFormatVersion(\n\tversion: OldestSupportedClientVersion,\n): ForestSummaryFormatVersion {\n\treturn getConfigForMinVersionForCollab(version, {\n\t\t[lowestMinVersionForCollab]: ForestSummaryFormatVersion.v2,\n\t\t[FluidClientVersion.v2_74]: ForestSummaryFormatVersion.v3,\n\t});\n}\n\n/**\n * Gets the key for the blob containing the forest summary root content based on the summary format version.\n * @param summaryFormatVersion - The version of the forest summary format.\n * @returns The key for the forest summary root content blob.\n */\nexport function getForestRootSummaryContentKey(\n\tsummaryFormatVersion: ForestSummaryFormatVersion | undefined,\n): string {\n\treturn summaryFormatVersion === undefined ||\n\t\tsummaryFormatVersion < ForestSummaryFormatVersion.v3\n\t\t? summaryContentBlobKeyV1ToV2\n\t\t: summaryContentBlobKeyV3;\n}\n"]}
|
|
@@ -259,7 +259,7 @@ class AnchorTreeIndex {
|
|
|
259
259
|
if (errorMessage !== undefined) {
|
|
260
260
|
throw new Error(errorMessage);
|
|
261
261
|
}
|
|
262
|
-
(0, internal_1.
|
|
262
|
+
(0, internal_1.fail)(0xa8f /* invalid operation on a disposed index */);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchorTreeIndex.js","sourceRoot":"","sources":["../../../src/feature-libraries/indexing/anchorTreeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAAmE;AAEnE,kDAkB6B;AAC7B,kDAAiE;AACjE,oDAAmD;AAiBnD;;;;;;;GAOG;AACH,MAAa,eAAe;IA6B3B;;;;;;;;OAQG;IACH,YACkB,MAA2B,EAC3B,OAEe,EACf,QAAyE,EACzE,eAA6D,EAC7D,iBAAiB,KAAK;QANtB,WAAM,GAAN,MAAM,CAAqB;QAC3B,YAAO,GAAP,OAAO,CAEQ;QACf,aAAQ,GAAR,QAAQ,CAAiE;QACzE,oBAAe,GAAf,eAAe,CAA8C;QAC7D,mBAAc,GAAd,cAAc,CAAQ;QA5CxB,QAAoB,GAAG,iBAAiB,CAAC;QAClD,aAAQ,GAAG,KAAK,CAAC;QACxB;;;;WAIG;QACc,eAAU,GAAG,IAAI,GAAG,EAAoD,CAAC;QAC1F;;;;WAIG;QACc,eAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;QAC5D;;WAEG;QACc,cAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;QACzD;;WAEG;QACc,YAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;QAC3D;;;WAGG;QACc,cAAS,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAoB3D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;Q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/B,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,WAAqC;QAC7D,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,EAAE;YAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YACpD,OAAO,UAAU,KAAK,qBAAU,CAAC,UAAU,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD;AAvZD,0CAuZC;AAED;;GAEG;AACH,SAAS,WAAW,CACnB,WAA8C,EAC9C,MAAqC;IAErC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,QAAQ,CAAC;QACjB,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAI,KAAmB;IAChD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACzB,CAAC;AAFD,gCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\ttype FieldKey,\n\ttype TreeNodeSchemaIdentifier,\n\tforEachField,\n\tforEachNode,\n\ttype ITreeSubscriptionCursor,\n\tcreateAnnouncedVisitor,\n\ttype IForestSubscription,\n\ttype AnnouncedVisitor,\n\tCursorLocationType,\n\trootField,\n\ttype UpPath,\n\tkeyAsDetachedField,\n\tcompareUpPaths,\n\tTreeNavigationResult,\n\ttype ITreeCursorSynchronous,\n} from \"../../core/index.js\";\nimport { disposeSymbol, getOrCreate } from \"../../util/index.js\";\nimport { TreeStatus } from \"../flex-tree/index.js\";\n\nimport type { TreeIndex, TreeIndexNodes } from \"./types.js\";\n\n/**\n * A function that gets the value to index a node on, must be pure and functional.\n * The given cursor should point to the node that will be indexed.\n *\n * @returns a value the index will use as the key for the given node\n *\n * @remarks\n * This function does not own the cursor in any way, it walks the cursor to find the key the node is indexed on\n * but returns the cursor to the state it was in before being passed to the function. It should also not be disposed by this function\n * and must be disposed elsewhere.\n */\nexport type KeyFinder<TKey> = (tree: ITreeSubscriptionCursor) => TKey;\n\n/**\n * An index from some arbitrary keys to anchor nodes. Keys can be anything that is a {@link TreeValue}.\n * A key can map to multiple nodes but each collection of nodes only results in a single value.\n *\n * @remarks\n * Detached nodes are stored in the index but filtered out when any public facing apis are called. This means that\n * calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.\n */\nexport class AnchorTreeIndex<TKey, TValue> implements TreeIndex<TKey, TValue> {\n\tpublic readonly [Symbol.toStringTag] = \"AnchorTreeIndex\";\n\tpublic disposed = false;\n\t/**\n\t * Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not\n\t * need to be considered at all for this index. This allows us to skip subtrees that aren't relevant\n\t * as a performance optimization.\n\t */\n\tprivate readonly keyFinders = new Map<TreeNodeSchemaIdentifier, KeyFinder<TKey> | null>();\n\t/**\n\t * The actual index from keys to anchor nodes.\n\t * @remarks\n\t * Should not store empty values (and thus values should be a valid {@link TreeIndexNodes}).\n\t */\n\tprivate readonly keyToNodes = new Map<TKey, AnchorNode[]>();\n\t/**\n\t * Maintained for efficient removal of anchor nodes from the index when updating their keys\n\t */\n\tprivate readonly nodeToKey = new Map<AnchorNode, TKey>();\n\t/**\n\t * Keeps track of anchors for disposal.\n\t */\n\tprivate readonly anchors = new Map<AnchorNode, Anchor[]>();\n\t/**\n\t * The key finder that is registered on the forest to keep this index updated, maintained\n\t * here for deregistration on disposal\n\t */\n\tprivate readonly keyFinder = this.acquireVisitor.bind(this);\n\n\t/**\n\t * @param forest - the forest that is being indexed\n\t * @param indexer - a function that retrieves the key finder based on a given schema or undefined if the schema does not have an associated key finder\n\t * @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes\n\t * so that the values returned from the index are more usable\n\t * @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes\n\t * @param isShallowIndex - indicates if this index is shallow, meaning that it only allows nodes to be keyed off of fields directly under them rather than anywhere in their subtree.\n\t * As a performance optimization, re-indexing up the spine can be turned off for shallow indexes.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IForestSubscription,\n\t\tprivate readonly indexer: (\n\t\t\tschemaId: TreeNodeSchemaIdentifier,\n\t\t) => KeyFinder<TKey> | undefined,\n\t\tprivate readonly getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined,\n\t\tprivate readonly checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined,\n\t\tprivate readonly isShallowIndex = false,\n\t) {\n\t\tthis.forest.registerAnnouncedVisitor(this.keyFinder);\n\n\t\tconst detachedFieldKeys: FieldKey[] = [];\n\t\tconst detachedFieldsCursor = forest.getCursorAboveDetachedFields();\n\t\tforEachField(detachedFieldsCursor, (field) => {\n\t\t\tdetachedFieldKeys.push(field.getFieldKey());\n\t\t});\n\n\t\t// index all existing trees (this includes the primary document tree and all other detached/removed trees)\n\t\tfor (const fieldKey of detachedFieldKeys) {\n\t\t\tconst cursor = forest.allocateCursor();\n\t\t\tforest.tryMoveCursorToField({ fieldKey, parent: undefined }, cursor);\n\t\t\tthis.indexField(cursor);\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t/**\n\t * Creates an announced visitor that responds to edits to the forest and updates the index accordingly.\n\t */\n\tprivate acquireVisitor(): AnnouncedVisitor {\n\t\tthis.checkNotDisposed(\n\t\t\t\"visitor getter should be deregistered from the forest when index is disposed\",\n\t\t);\n\t\tlet parentField: FieldKey | undefined;\n\t\tlet parent: UpPath | undefined;\n\n\t\treturn createAnnouncedVisitor({\n\t\t\t// nodes (and their entire subtrees) are added to the index as soon as they are created\n\t\t\tafterCreate: (content: readonly ITreeCursorSynchronous[], destination: FieldKey) => {\n\t\t\t\tconst detachedCursor = this.forest.allocateCursor();\n\t\t\t\tassert(\n\t\t\t\t\tthis.forest.tryMoveCursorToField(\n\t\t\t\t\t\t{ fieldKey: destination, parent: undefined },\n\t\t\t\t\t\tdetachedCursor,\n\t\t\t\t\t) === TreeNavigationResult.Ok,\n\t\t\t\t\t0xa8a /* destination of created nodes must be a valid detached field */,\n\t\t\t\t);\n\t\t\t\tthis.indexField(detachedCursor);\n\t\t\t\tdetachedCursor.free();\n\t\t\t},\n\t\t\tafterAttach: () => {\n\t\t\t\tassert(parent !== undefined, 0xa99 /* must have a parent */);\n\t\t\t\tthis.reIndexSpine(parent);\n\t\t\t},\n\t\t\tafterDetach: (_source, _count_, _destination, isReplaced) => {\n\t\t\t\tif (isReplaced) {\n\t\t\t\t\t// If the node will be replaced, we defer re-indexing until the corresponding attach event.\n\t\t\t\t\t// This has performance benefits but is also required to avoid experiencing the error case where the field that is used as the indexing key is empty.\n\t\t\t\t} else {\n\t\t\t\t\tassert(parent !== undefined, 0xa9a /* must have a parent */);\n\t\t\t\t\tthis.reIndexSpine(parent);\n\t\t\t\t}\n\t\t\t},\n\t\t\t// the methods below are used to keep track of the path that has been traversed by the visitor\n\t\t\t// this is required so that cursors can be moved to the correct location when index updates are required\n\t\t\tenterNode(index: number): void {\n\t\t\t\tassert(parentField !== undefined, 0xa8d /* must be in a field to enter node */);\n\n\t\t\t\tparent = {\n\t\t\t\t\tparent,\n\t\t\t\t\tparentField,\n\t\t\t\t\tparentIndex: index,\n\t\t\t\t};\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t\texitNode(index: number): void {\n\t\t\t\tassert(parent !== undefined, 0xa8e /* must have parent node */);\n\t\t\t\tconst temp = parent;\n\t\t\t\tparentField = temp.parentField;\n\t\t\t\tparent = temp.parent;\n\t\t\t},\n\t\t\tenterField: (key: FieldKey) => {\n\t\t\t\tparentField = key;\n\t\t\t},\n\t\t\texitField(key: FieldKey): void {\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Returns the value associated with the given key if it has been indexed\n\t */\n\tpublic get(key: TKey): TValue | undefined {\n\t\tthis.checkNotDisposed();\n\t\treturn this.getFilteredValue(this.keyToNodes.get(key));\n\t}\n\n\t/**\n\t * Returns true iff the key exists in the index\n\t */\n\tpublic has(key: TKey): boolean {\n\t\tthis.checkNotDisposed();\n\t\treturn this.get(key) !== undefined;\n\t}\n\n\t/**\n\t * Returns the number of values that are indexed\n\t */\n\tpublic get size(): number {\n\t\tthis.checkNotDisposed();\n\t\tlet s = 0;\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\ts += 1;\n\t\t\t}\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Returns all keys in the index\n\t */\n\tpublic *keys(): IterableIterator<TKey> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\tyield key;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of values in the index\n\t */\n\tpublic *values(): IterableIterator<TValue> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield filtered;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index\n\t */\n\tpublic *entries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield [key, filtered];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Applies the provided callback to each entry in the index.\n\t */\n\tpublic forEach(\n\t\tcallbackfn: (value: TValue, key: TKey, map: AnchorTreeIndex<TKey, TValue>) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tcallbackfn.call(thisArg, filtered, key, this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index, including ones that are detached.\n\t * This function should only be used for testing purposes, it is not exposed as part of the public {@link TreeIndex} API.\n\t */\n\tpublic *allEntries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tassert(\n\t\t\t\thasElement(nodes),\n\t\t\t\t0xce9 /* expected at least one node for each key in the index */,\n\t\t\t);\n\t\t\tconst value = this.getValue(nodes);\n\t\t\tif (value !== undefined) {\n\t\t\t\tyield [key, value];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis[disposeSymbol]();\n\t}\n\n\t/**\n\t * Disposes this index and all the anchors it holds onto.\n\t */\n\tpublic [disposeSymbol](): void {\n\t\tthis.checkNotDisposed(\"index is already disposed\");\n\t\tfor (const anchors of this.anchors.values()) {\n\t\t\tfor (const anchor of anchors) {\n\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t}\n\t\t}\n\t\tthis.keyToNodes.clear();\n\t\tthis.anchors.clear();\n\t\tthis.forest.deregisterAnnouncedVisitor(this.keyFinder);\n\t\tthis.disposed = true;\n\t}\n\n\t/**\n\t * Checks if the spine needs to be re-indexed and if so, re-indexes it starting from the given path.\n\t */\n\tprivate reIndexSpine(path: UpPath): void {\n\t\tconst cursor = this.forest.allocateCursor();\n\t\tthis.forest.moveCursorToPath(path, cursor);\n\t\tassert(\n\t\t\tcursor.mode === CursorLocationType.Nodes,\n\t\t\t0xa9b /* attach should happen in a node */,\n\t\t);\n\t\tcursor.exitNode();\n\t\t// TODO ADO:36390 avoid re-indexing the whole field when not necessary\n\t\tthis.indexField(cursor);\n\t\tif (!this.isShallowIndex) {\n\t\t\tthis.indexSpine(cursor);\n\t\t}\n\t\tcursor.clear();\n\t}\n\n\tprivate checkNotDisposed(errorMessage?: string): void {\n\t\tif (this.disposed) {\n\t\t\tif (errorMessage !== undefined) {\n\t\t\t\tthrow new Error(errorMessage);\n\t\t\t}\n\t\t\tassert(false, 0xa8f /* invalid operation on a disposed index */);\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in node mode, indexes it.\n\t */\n\tprivate indexNode(nodeCursor: ITreeSubscriptionCursor): void {\n\t\tconst keyFinder = getOrCreate(\n\t\t\tthis.keyFinders,\n\t\t\t// the node schema type to look up\n\t\t\tnodeCursor.type,\n\t\t\t// if the indexer does not return a key finder for this schema, we cache a null value to indicate the indexer\n\t\t\t// does not need to be called if this schema is encountered in the future\n\t\t\t(schema) => this.indexer(schema) ?? null,\n\t\t);\n\n\t\tif (keyFinder !== null) {\n\t\t\tconst expectedPath = nodeCursor.getPath();\n\t\t\tconst key = keyFinder(nodeCursor);\n\t\t\t// TODO: determine perf impact of this check, alternative is not doing it in which case (if the key finder is not pure and functional),\n\t\t\t// an error may be thrown further down the line if the structure of the nodes aren't expected or the contents of the index could be inaccurate\n\t\t\tif (!compareUpPaths(nodeCursor.getPath(), expectedPath)) {\n\t\t\t\tthrow new Error(\"key finder should be pure and functional\");\n\t\t\t}\n\t\t\tconst anchor = nodeCursor.buildAnchor();\n\t\t\tconst anchorNode =\n\t\t\t\tthis.forest.anchors.locate(anchor) ?? fail(0xb16 /* expected anchor node */);\n\n\t\t\t// check if this anchor node already exists in the index\n\t\t\tconst existingKey = this.nodeToKey.get(anchorNode);\n\t\t\tif (existingKey !== undefined) {\n\t\t\t\t// if the node already exists but has the same key, we return early\n\t\t\t\tif (existingKey === key) {\n\t\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\t// if the node has a different key, we remove the existing one first because it means the key had been detached\n\t\t\t\t\tthis.removeAnchor(anchorNode, existingKey);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tgetOrCreate(this.keyToNodes, key, () => []).push(anchorNode);\n\t\t\tthis.nodeToKey.set(anchorNode, key);\n\n\t\t\tgetOrCreate(this.anchors, anchorNode, () => []).push(anchor);\n\t\t\t// when the anchor node is destroyed, delete it from the index\n\t\t\tanchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis.removeAnchor(anchorNode, key);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in field mode, recursively indexes all nodes under the field.\n\t */\n\tprivate indexField(fieldCursor: ITreeSubscriptionCursor): void {\n\t\tforEachNode(fieldCursor, (nodeCursor) => {\n\t\t\tthis.indexNode(nodeCursor);\n\n\t\t\tforEachField(nodeCursor, (f) => {\n\t\t\t\tthis.indexField(f);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.\n\t */\n\tprivate indexSpine(cursor: ITreeSubscriptionCursor): void {\n\t\tif (keyAsDetachedField(cursor.getFieldKey()) === rootField) {\n\t\t\t// return early if we're already at the root field\n\t\t\treturn;\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t}\n\n\t\t// walk up the spine and index nodes until we reach the root\n\t\twhile (\n\t\t\tcursor.mode === CursorLocationType.Fields &&\n\t\t\tkeyAsDetachedField(cursor.getFieldKey()) !== rootField\n\t\t) {\n\t\t\tforEachNode(cursor, (nodeCursor) => {\n\t\t\t\tthis.indexNode(nodeCursor);\n\t\t\t});\n\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t}\n\t}\n\n\tprivate removeAnchor(anchorNode: AnchorNode, key: TKey): void {\n\t\tconst indexedNodes = this.keyToNodes.get(key);\n\t\tassert(\n\t\t\tindexedNodes !== undefined,\n\t\t\t0xa90 /* destroyed anchor node should be tracked by index */,\n\t\t);\n\t\tconst newNodes = filterNodes(indexedNodes, (n) => n !== anchorNode);\n\t\tif (newNodes === undefined) {\n\t\t\tthis.keyToNodes.delete(key);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tnewNodes.length < indexedNodes.length,\n\t\t\t\t0xa91 /* destroyed anchor node should be tracked by index */,\n\t\t\t);\n\t\t\tthis.keyToNodes.set(key, newNodes);\n\t\t}\n\t\tthis.nodeToKey.delete(anchorNode);\n\t\tassert(\n\t\t\tthis.anchors.delete(anchorNode),\n\t\t\t0xa92 /* destroyed anchor should be tracked by index */,\n\t\t);\n\t}\n\n\t/**\n\t * Filters out any anchor nodes that are detached and returns the value for the remaining nodes.\n\t */\n\tprivate getFilteredValue(anchorNodes: AnchorNode[] | undefined): TValue | undefined {\n\t\tconst attachedNodes = filterNodes(anchorNodes, (anchorNode) => {\n\t\t\tconst nodeStatus = this.checkTreeStatus(anchorNode);\n\t\t\treturn nodeStatus === TreeStatus.InDocument;\n\t\t});\n\n\t\tif (attachedNodes !== undefined) {\n\t\t\treturn this.getValue(attachedNodes);\n\t\t}\n\t}\n}\n\n/**\n * Filters the given anchor nodes based on the given filter function.\n */\nfunction filterNodes(\n\tanchorNodes: readonly AnchorNode[] | undefined,\n\tfilter: (node: AnchorNode) => boolean,\n): (AnchorNode[] & TreeIndexNodes<AnchorNode>) | undefined {\n\tif (anchorNodes !== undefined) {\n\t\tconst filtered = anchorNodes.filter(filter);\n\t\tif (hasElement(filtered)) {\n\t\t\treturn filtered;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Checks that an array is of the type {@link TreeIndexNodes} and has at least one element.\n */\nexport function hasElement<T>(array: readonly T[]): array is TreeIndexNodes<T> {\n\treturn array.length > 0;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"anchorTreeIndex.js","sourceRoot":"","sources":["../../../src/feature-libraries/indexing/anchorTreeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAAmE;AAEnE,kDAkB6B;AAC7B,kDAAiE;AACjE,oDAAmD;AAiBnD;;;;;;;GAOG;AACH,MAAa,eAAe;IA6B3B;;;;;;;;OAQG;IACH,YACkB,MAA2B,EAC3B,OAEe,EACf,QAAyE,EACzE,eAA6D,EAC7D,iBAAiB,KAAK;QANtB,WAAM,GAAN,MAAM,CAAqB;QAC3B,YAAO,GAAP,OAAO,CAEQ;QACf,aAAQ,GAAR,QAAQ,CAAiE;QACzE,oBAAe,GAAf,eAAe,CAA8C;QAC7D,mBAAc,GAAd,cAAc,CAAQ;QA5CxB,QAAoB,GAAG,iBAAiB,CAAC;QAClD,aAAQ,GAAG,KAAK,CAAC;QACxB;;;;WAIG;QACc,eAAU,GAAG,IAAI,GAAG,EAAoD,CAAC;QAC1F;;;;WAIG;QACc,eAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;QAC5D;;WAEG;QACc,cAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;QACzD;;WAEG;QACc,YAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;QAC3D;;;WAGG;QACc,cAAS,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAoB3D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAErD,MAAM,iBAAiB,GAAe,EAAE,CAAC;QACzC,MAAM,oBAAoB,GAAG,MAAM,CAAC,4BAA4B,EAAE,CAAC;QACnE,IAAA,uBAAY,EAAC,oBAAo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UAAU,EAAE,EAAE;YAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YACpD,OAAO,UAAU,KAAK,qBAAU,CAAC,UAAU,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD;AAvZD,0CAuZC;AAED;;GAEG;AACH,SAAS,WAAW,CACnB,WAA8C,EAC9C,MAAqC;IAErC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,QAAQ,CAAC;QACjB,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAI,KAAmB;IAChD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACzB,CAAC;AAFD,gCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\ttype FieldKey,\n\ttype TreeNodeSchemaIdentifier,\n\tforEachField,\n\tforEachNode,\n\ttype ITreeSubscriptionCursor,\n\tcreateAnnouncedVisitor,\n\ttype IForestSubscription,\n\ttype AnnouncedVisitor,\n\tCursorLocationType,\n\trootField,\n\ttype UpPath,\n\tkeyAsDetachedField,\n\tcompareUpPaths,\n\tTreeNavigationResult,\n\ttype ITreeCursorSynchronous,\n} from \"../../core/index.js\";\nimport { disposeSymbol, getOrCreate } from \"../../util/index.js\";\nimport { TreeStatus } from \"../flex-tree/index.js\";\n\nimport type { TreeIndex, TreeIndexNodes } from \"./types.js\";\n\n/**\n * A function that gets the value to index a node on, must be pure and functional.\n * The given cursor should point to the node that will be indexed.\n *\n * @returns a value the index will use as the key for the given node\n *\n * @remarks\n * This function does not own the cursor in any way, it walks the cursor to find the key the node is indexed on\n * but returns the cursor to the state it was in before being passed to the function. It should also not be disposed by this function\n * and must be disposed elsewhere.\n */\nexport type KeyFinder<TKey> = (tree: ITreeSubscriptionCursor) => TKey;\n\n/**\n * An index from some arbitrary keys to anchor nodes. Keys can be anything that is a {@link TreeValue}.\n * A key can map to multiple nodes but each collection of nodes only results in a single value.\n *\n * @remarks\n * Detached nodes are stored in the index but filtered out when any public facing apis are called. This means that\n * calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.\n */\nexport class AnchorTreeIndex<TKey, TValue> implements TreeIndex<TKey, TValue> {\n\tpublic readonly [Symbol.toStringTag] = \"AnchorTreeIndex\";\n\tpublic disposed = false;\n\t/**\n\t * Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not\n\t * need to be considered at all for this index. This allows us to skip subtrees that aren't relevant\n\t * as a performance optimization.\n\t */\n\tprivate readonly keyFinders = new Map<TreeNodeSchemaIdentifier, KeyFinder<TKey> | null>();\n\t/**\n\t * The actual index from keys to anchor nodes.\n\t * @remarks\n\t * Should not store empty values (and thus values should be a valid {@link TreeIndexNodes}).\n\t */\n\tprivate readonly keyToNodes = new Map<TKey, AnchorNode[]>();\n\t/**\n\t * Maintained for efficient removal of anchor nodes from the index when updating their keys\n\t */\n\tprivate readonly nodeToKey = new Map<AnchorNode, TKey>();\n\t/**\n\t * Keeps track of anchors for disposal.\n\t */\n\tprivate readonly anchors = new Map<AnchorNode, Anchor[]>();\n\t/**\n\t * The key finder that is registered on the forest to keep this index updated, maintained\n\t * here for deregistration on disposal\n\t */\n\tprivate readonly keyFinder = this.acquireVisitor.bind(this);\n\n\t/**\n\t * @param forest - the forest that is being indexed\n\t * @param indexer - a function that retrieves the key finder based on a given schema or undefined if the schema does not have an associated key finder\n\t * @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes\n\t * so that the values returned from the index are more usable\n\t * @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes\n\t * @param isShallowIndex - indicates if this index is shallow, meaning that it only allows nodes to be keyed off of fields directly under them rather than anywhere in their subtree.\n\t * As a performance optimization, re-indexing up the spine can be turned off for shallow indexes.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IForestSubscription,\n\t\tprivate readonly indexer: (\n\t\t\tschemaId: TreeNodeSchemaIdentifier,\n\t\t) => KeyFinder<TKey> | undefined,\n\t\tprivate readonly getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined,\n\t\tprivate readonly checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined,\n\t\tprivate readonly isShallowIndex = false,\n\t) {\n\t\tthis.forest.registerAnnouncedVisitor(this.keyFinder);\n\n\t\tconst detachedFieldKeys: FieldKey[] = [];\n\t\tconst detachedFieldsCursor = forest.getCursorAboveDetachedFields();\n\t\tforEachField(detachedFieldsCursor, (field) => {\n\t\t\tdetachedFieldKeys.push(field.getFieldKey());\n\t\t});\n\n\t\t// index all existing trees (this includes the primary document tree and all other detached/removed trees)\n\t\tfor (const fieldKey of detachedFieldKeys) {\n\t\t\tconst cursor = forest.allocateCursor();\n\t\t\tforest.tryMoveCursorToField({ fieldKey, parent: undefined }, cursor);\n\t\t\tthis.indexField(cursor);\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t/**\n\t * Creates an announced visitor that responds to edits to the forest and updates the index accordingly.\n\t */\n\tprivate acquireVisitor(): AnnouncedVisitor {\n\t\tthis.checkNotDisposed(\n\t\t\t\"visitor getter should be deregistered from the forest when index is disposed\",\n\t\t);\n\t\tlet parentField: FieldKey | undefined;\n\t\tlet parent: UpPath | undefined;\n\n\t\treturn createAnnouncedVisitor({\n\t\t\t// nodes (and their entire subtrees) are added to the index as soon as they are created\n\t\t\tafterCreate: (content: readonly ITreeCursorSynchronous[], destination: FieldKey) => {\n\t\t\t\tconst detachedCursor = this.forest.allocateCursor();\n\t\t\t\tassert(\n\t\t\t\t\tthis.forest.tryMoveCursorToField(\n\t\t\t\t\t\t{ fieldKey: destination, parent: undefined },\n\t\t\t\t\t\tdetachedCursor,\n\t\t\t\t\t) === TreeNavigationResult.Ok,\n\t\t\t\t\t0xa8a /* destination of created nodes must be a valid detached field */,\n\t\t\t\t);\n\t\t\t\tthis.indexField(detachedCursor);\n\t\t\t\tdetachedCursor.free();\n\t\t\t},\n\t\t\tafterAttach: () => {\n\t\t\t\tassert(parent !== undefined, 0xa99 /* must have a parent */);\n\t\t\t\tthis.reIndexSpine(parent);\n\t\t\t},\n\t\t\tafterDetach: (_source, _count_, _destination, isReplaced) => {\n\t\t\t\tif (isReplaced) {\n\t\t\t\t\t// If the node will be replaced, we defer re-indexing until the corresponding attach event.\n\t\t\t\t\t// This has performance benefits but is also required to avoid experiencing the error case where the field that is used as the indexing key is empty.\n\t\t\t\t} else {\n\t\t\t\t\tassert(parent !== undefined, 0xa9a /* must have a parent */);\n\t\t\t\t\tthis.reIndexSpine(parent);\n\t\t\t\t}\n\t\t\t},\n\t\t\t// the methods below are used to keep track of the path that has been traversed by the visitor\n\t\t\t// this is required so that cursors can be moved to the correct location when index updates are required\n\t\t\tenterNode(index: number): void {\n\t\t\t\tassert(parentField !== undefined, 0xa8d /* must be in a field to enter node */);\n\n\t\t\t\tparent = {\n\t\t\t\t\tparent,\n\t\t\t\t\tparentField,\n\t\t\t\t\tparentIndex: index,\n\t\t\t\t};\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t\texitNode(index: number): void {\n\t\t\t\tassert(parent !== undefined, 0xa8e /* must have parent node */);\n\t\t\t\tconst temp = parent;\n\t\t\t\tparentField = temp.parentField;\n\t\t\t\tparent = temp.parent;\n\t\t\t},\n\t\t\tenterField: (key: FieldKey) => {\n\t\t\t\tparentField = key;\n\t\t\t},\n\t\t\texitField(key: FieldKey): void {\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Returns the value associated with the given key if it has been indexed\n\t */\n\tpublic get(key: TKey): TValue | undefined {\n\t\tthis.checkNotDisposed();\n\t\treturn this.getFilteredValue(this.keyToNodes.get(key));\n\t}\n\n\t/**\n\t * Returns true iff the key exists in the index\n\t */\n\tpublic has(key: TKey): boolean {\n\t\tthis.checkNotDisposed();\n\t\treturn this.get(key) !== undefined;\n\t}\n\n\t/**\n\t * Returns the number of values that are indexed\n\t */\n\tpublic get size(): number {\n\t\tthis.checkNotDisposed();\n\t\tlet s = 0;\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\ts += 1;\n\t\t\t}\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Returns all keys in the index\n\t */\n\tpublic *keys(): IterableIterator<TKey> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\tyield key;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of values in the index\n\t */\n\tpublic *values(): IterableIterator<TValue> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield filtered;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index\n\t */\n\tpublic *entries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield [key, filtered];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Applies the provided callback to each entry in the index.\n\t */\n\tpublic forEach(\n\t\tcallbackfn: (value: TValue, key: TKey, map: AnchorTreeIndex<TKey, TValue>) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tcallbackfn.call(thisArg, filtered, key, this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index, including ones that are detached.\n\t * This function should only be used for testing purposes, it is not exposed as part of the public {@link TreeIndex} API.\n\t */\n\tpublic *allEntries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tassert(\n\t\t\t\thasElement(nodes),\n\t\t\t\t0xce9 /* expected at least one node for each key in the index */,\n\t\t\t);\n\t\t\tconst value = this.getValue(nodes);\n\t\t\tif (value !== undefined) {\n\t\t\t\tyield [key, value];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis[disposeSymbol]();\n\t}\n\n\t/**\n\t * Disposes this index and all the anchors it holds onto.\n\t */\n\tpublic [disposeSymbol](): void {\n\t\tthis.checkNotDisposed(\"index is already disposed\");\n\t\tfor (const anchors of this.anchors.values()) {\n\t\t\tfor (const anchor of anchors) {\n\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t}\n\t\t}\n\t\tthis.keyToNodes.clear();\n\t\tthis.anchors.clear();\n\t\tthis.forest.deregisterAnnouncedVisitor(this.keyFinder);\n\t\tthis.disposed = true;\n\t}\n\n\t/**\n\t * Checks if the spine needs to be re-indexed and if so, re-indexes it starting from the given path.\n\t */\n\tprivate reIndexSpine(path: UpPath): void {\n\t\tconst cursor = this.forest.allocateCursor();\n\t\tthis.forest.moveCursorToPath(path, cursor);\n\t\tassert(\n\t\t\tcursor.mode === CursorLocationType.Nodes,\n\t\t\t0xa9b /* attach should happen in a node */,\n\t\t);\n\t\tcursor.exitNode();\n\t\t// TODO ADO:36390 avoid re-indexing the whole field when not necessary\n\t\tthis.indexField(cursor);\n\t\tif (!this.isShallowIndex) {\n\t\t\tthis.indexSpine(cursor);\n\t\t}\n\t\tcursor.clear();\n\t}\n\n\tprivate checkNotDisposed(errorMessage?: string): void {\n\t\tif (this.disposed) {\n\t\t\tif (errorMessage !== undefined) {\n\t\t\t\tthrow new Error(errorMessage);\n\t\t\t}\n\t\t\tfail(0xa8f /* invalid operation on a disposed index */);\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in node mode, indexes it.\n\t */\n\tprivate indexNode(nodeCursor: ITreeSubscriptionCursor): void {\n\t\tconst keyFinder = getOrCreate(\n\t\t\tthis.keyFinders,\n\t\t\t// the node schema type to look up\n\t\t\tnodeCursor.type,\n\t\t\t// if the indexer does not return a key finder for this schema, we cache a null value to indicate the indexer\n\t\t\t// does not need to be called if this schema is encountered in the future\n\t\t\t(schema) => this.indexer(schema) ?? null,\n\t\t);\n\n\t\tif (keyFinder !== null) {\n\t\t\tconst expectedPath = nodeCursor.getPath();\n\t\t\tconst key = keyFinder(nodeCursor);\n\t\t\t// TODO: determine perf impact of this check, alternative is not doing it in which case (if the key finder is not pure and functional),\n\t\t\t// an error may be thrown further down the line if the structure of the nodes aren't expected or the contents of the index could be inaccurate\n\t\t\tif (!compareUpPaths(nodeCursor.getPath(), expectedPath)) {\n\t\t\t\tthrow new Error(\"key finder should be pure and functional\");\n\t\t\t}\n\t\t\tconst anchor = nodeCursor.buildAnchor();\n\t\t\tconst anchorNode =\n\t\t\t\tthis.forest.anchors.locate(anchor) ?? fail(0xb16 /* expected anchor node */);\n\n\t\t\t// check if this anchor node already exists in the index\n\t\t\tconst existingKey = this.nodeToKey.get(anchorNode);\n\t\t\tif (existingKey !== undefined) {\n\t\t\t\t// if the node already exists but has the same key, we return early\n\t\t\t\tif (existingKey === key) {\n\t\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\t// if the node has a different key, we remove the existing one first because it means the key had been detached\n\t\t\t\t\tthis.removeAnchor(anchorNode, existingKey);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tgetOrCreate(this.keyToNodes, key, () => []).push(anchorNode);\n\t\t\tthis.nodeToKey.set(anchorNode, key);\n\n\t\t\tgetOrCreate(this.anchors, anchorNode, () => []).push(anchor);\n\t\t\t// when the anchor node is destroyed, delete it from the index\n\t\t\tanchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis.removeAnchor(anchorNode, key);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in field mode, recursively indexes all nodes under the field.\n\t */\n\tprivate indexField(fieldCursor: ITreeSubscriptionCursor): void {\n\t\tforEachNode(fieldCursor, (nodeCursor) => {\n\t\t\tthis.indexNode(nodeCursor);\n\n\t\t\tforEachField(nodeCursor, (f) => {\n\t\t\t\tthis.indexField(f);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.\n\t */\n\tprivate indexSpine(cursor: ITreeSubscriptionCursor): void {\n\t\tif (keyAsDetachedField(cursor.getFieldKey()) === rootField) {\n\t\t\t// return early if we're already at the root field\n\t\t\treturn;\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t}\n\n\t\t// walk up the spine and index nodes until we reach the root\n\t\twhile (\n\t\t\tcursor.mode === CursorLocationType.Fields &&\n\t\t\tkeyAsDetachedField(cursor.getFieldKey()) !== rootField\n\t\t) {\n\t\t\tforEachNode(cursor, (nodeCursor) => {\n\t\t\t\tthis.indexNode(nodeCursor);\n\t\t\t});\n\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t}\n\t}\n\n\tprivate removeAnchor(anchorNode: AnchorNode, key: TKey): void {\n\t\tconst indexedNodes = this.keyToNodes.get(key);\n\t\tassert(\n\t\t\tindexedNodes !== undefined,\n\t\t\t0xa90 /* destroyed anchor node should be tracked by index */,\n\t\t);\n\t\tconst newNodes = filterNodes(indexedNodes, (n) => n !== anchorNode);\n\t\tif (newNodes === undefined) {\n\t\t\tthis.keyToNodes.delete(key);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tnewNodes.length < indexedNodes.length,\n\t\t\t\t0xa91 /* destroyed anchor node should be tracked by index */,\n\t\t\t);\n\t\t\tthis.keyToNodes.set(key, newNodes);\n\t\t}\n\t\tthis.nodeToKey.delete(anchorNode);\n\t\tassert(\n\t\t\tthis.anchors.delete(anchorNode),\n\t\t\t0xa92 /* destroyed anchor should be tracked by index */,\n\t\t);\n\t}\n\n\t/**\n\t * Filters out any anchor nodes that are detached and returns the value for the remaining nodes.\n\t */\n\tprivate getFilteredValue(anchorNodes: AnchorNode[] | undefined): TValue | undefined {\n\t\tconst attachedNodes = filterNodes(anchorNodes, (anchorNode) => {\n\t\t\tconst nodeStatus = this.checkTreeStatus(anchorNode);\n\t\t\treturn nodeStatus === TreeStatus.InDocument;\n\t\t});\n\n\t\tif (attachedNodes !== undefined) {\n\t\t\treturn this.getValue(attachedNodes);\n\t\t}\n\t}\n}\n\n/**\n * Filters the given anchor nodes based on the given filter function.\n */\nfunction filterNodes(\n\tanchorNodes: readonly AnchorNode[] | undefined,\n\tfilter: (node: AnchorNode) => boolean,\n): (AnchorNode[] & TreeIndexNodes<AnchorNode>) | undefined {\n\tif (anchorNodes !== undefined) {\n\t\tconst filtered = anchorNodes.filter(filter);\n\t\tif (hasElement(filtered)) {\n\t\t\treturn filtered;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Checks that an array is of the type {@link TreeIndexNodes} and has at least one element.\n */\nexport function hasElement<T>(array: readonly T[]): array is TreeIndexNodes<T> {\n\treturn array.length > 0;\n}\n"]}
|
|
@@ -129,7 +129,7 @@ class InvertManager extends modularChangeUtils_js_1.CrossFieldManagerI {
|
|
|
129
129
|
(0, changeAtomIdBTree_js_1.setInChangeAtomIdMap)(this.table.invertedNodeToParent, id, this.fieldId);
|
|
130
130
|
}
|
|
131
131
|
moveKey(target, revision, id, count) {
|
|
132
|
-
(0, internal_1.
|
|
132
|
+
(0, internal_1.fail)(0x9c5 /* Keys should not be moved manually during invert */);
|
|
133
133
|
}
|
|
134
134
|
get table() {
|
|
135
135
|
return this.crossFieldTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invert.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/invert.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,kDAU6B;AAC7B,kDAAoF;AACpF,kEAIiC;AACjC,mEASiC;AACjC,mEAUiC;AAGjC,mEAA0D;AAE1D;;;;;GAKG;AACH,SAAgB,mBAAmB,CAClC,MAAsC,EACtC,UAAmB,EACnB,iBAA8B,EAC9B,UAA2D;IAE3D,iFAAiF;IACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE7E,wEAAwE;IACxE,IAAA,iBAAM,EACL,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,EACpC,KAAK,CAAC,6CAA6C,CACnD,CAAC;IAEF,MAAM,QAAQ,GAAmB,UAAU;QAC1C,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QAChE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAErC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,0BAA0B,CAAC;IACpE,MAAM,0BAA0B,GAAG,MAA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AAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5D,CAAC;IACF,CAAC;AACF,CAAC","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\trevisionMetadataSourceFromInfo,\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype FieldKindIdentifier,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\ttype TreeChunk,\n} from \"../../core/index.js\";\nimport { brand, idAllocatorFromMaxId, type IdAllocator } from \"../../util/index.js\";\nimport {\n\tnewChangeAtomIdBTree,\n\tsetInChangeAtomIdMap,\n\ttype ChangeAtomIdBTree,\n} from \"../changeAtomIdBTree.js\";\nimport {\n\tnewCrossFieldKeyTable,\n\ttype CrossFieldKeyTable,\n\ttype FieldChange,\n\ttype FieldChangeMap,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\nimport {\n\tCrossFieldManagerI,\n\tgetChangeHandler,\n\tgetRevInfoFromTaggedChanges,\n\thasConflicts,\n\tmakeModularChangeset,\n\tnewConstraintState,\n\tnewCrossFieldTable,\n\tupdateConstraintsForFields,\n\ttype CrossFieldTable,\n} from \"./modularChangeUtils.js\";\nimport type { CrossFieldTarget } from \"./crossFieldQueries.js\";\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport { NodeAttachState } from \"./fieldChangeHandler.js\";\n\n/**\n * @param change - The change to invert.\n * @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when\n * performing a sandwich rebase.\n * @param revisionForInvert - The revision for the invert changeset.\n */\nexport function invertModularChange(\n\tchange: TaggedChange<ModularChangeset>,\n\tisRollback: boolean,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): ModularChangeset {\n\t// Rollback changesets destroy the nodes created by the change being rolled back.\n\tconst destroys = isRollback ? invertBuilds(change.change.builds) : undefined;\n\n\t// Destroys only occur in rollback changesets, which are never inverted.\n\tassert(\n\t\tchange.change.destroys === undefined,\n\t\t0x89a /* Unexpected destroys in change to invert */,\n\t);\n\n\tconst revInfos: RevisionInfo[] = isRollback\n\t\t? [{ revision: revisionForInvert, rollbackOf: change.revision }]\n\t\t: [{ revision: revisionForInvert }];\n\n\tconst noChangeConstraint = change.change.noChangeConstraintOnRevert;\n\tconst noChangeConstraintOnRevert = change.change.noChangeConstraint;\n\n\tif (hasConflicts(change.change)) {\n\t\treturn makeModularChangeset({\n\t\t\tmaxId: change.change.maxId as number,\n\t\t\trevisions: revInfos,\n\t\t\tdestroys,\n\t\t});\n\t}\n\n\tconst genId: IdAllocator = idAllocatorFromMaxId(change.change.maxId ?? -1);\n\n\tconst crossFieldTable: InvertTable = {\n\t\t...newCrossFieldTable<FieldChange>(),\n\t\toriginalFieldToContext: new Map(),\n\t\tinvertedNodeToParent: brand(change.change.nodeToParent.clone()),\n\t};\n\tconst { revInfos: oldRevInfos } = getRevInfoFromTaggedChanges([change]);\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(oldRevInfos);\n\n\tconst invertedFields = invertFieldMap(\n\t\tchange.change.fieldChanges,\n\t\tundefined,\n\t\tisRollback,\n\t\tgenId,\n\t\tcrossFieldTable,\n\t\trevisionMetadata,\n\t\trevisionForInvert,\n\t\tfieldKinds,\n\t);\n\n\tconst invertedNodes = newChangeAtomIdBTree<NodeChangeset>();\n\tchange.change.nodeChanges.forEachPair(([revision, localId], nodeChangeset) => {\n\t\tinvertedNodes.set(\n\t\t\t[revision, localId],\n\t\t\tinvertNodeChange(\n\t\t\t\tnodeChangeset,\n\t\t\t\t{ revision, localId },\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\tcrossFieldTable,\n\t\t\t\trevisionMetadata,\n\t\t\t\trevisionForInvert,\n\t\t\t\tfieldKinds,\n\t\t\t),\n\t\t);\n\t});\n\n\tif (crossFieldTable.invalidatedFields.size > 0) {\n\t\tconst fieldsToUpdate = crossFieldTable.invalidatedFields;\n\t\tcrossFieldTable.invalidatedFields = new Set();\n\t\tfor (const fieldChange of fieldsToUpdate) {\n\t\t\tconst originalFieldChange = fieldChange.change;\n\t\t\tconst context = crossFieldTable.originalFieldToContext.get(fieldChange);\n\t\t\tassert(\n\t\t\t\tcontext !== undefined,\n\t\t\t\t0x851 /* Should have context for every invalidated field */,\n\t\t\t);\n\t\t\tconst { invertedField, fieldId } = context;\n\n\t\t\tconst amendedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\t\toriginalFieldChange,\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\trevisionForInvert,\n\t\t\t\tnew InvertManager(crossFieldTable, fieldChange, fieldId),\n\t\t\t\trevisionMetadata,\n\t\t\t);\n\t\t\tinvertedField.change = brand(amendedChange);\n\t\t}\n\t}\n\n\tconst crossFieldKeys = makeCrossFieldKeyTable(invertedFields, invertedNodes, fieldKinds);\n\n\tconst constraintState = newConstraintState(0);\n\tupdateConstraintsForFields(\n\t\tinvertedFields,\n\t\tNodeAttachState.Attached,\n\t\tconstraintState,\n\t\tinvertedNodes,\n\t\tfieldKinds,\n\t);\n\n\treturn makeModularChangeset({\n\t\tfieldChanges: invertedFields,\n\t\tnodeChanges: invertedNodes,\n\t\tnodeToParent: crossFieldTable.invertedNodeToParent,\n\t\tnodeAliases: change.change.nodeAliases,\n\t\tcrossFieldKeys,\n\t\tmaxId: genId.getMaxId(),\n\t\trevisions: revInfos,\n\t\tconstraintViolationCount: constraintState.violationCount,\n\t\tnoChangeConstraint,\n\t\tnoChangeConstraintOnRevert,\n\t\tdestroys,\n\t});\n}\n\nfunction invertFieldMap(\n\tchanges: FieldChangeMap,\n\tparentId: NodeId | undefined,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): FieldChangeMap {\n\tconst invertedFields: FieldChangeMap = new Map();\n\n\tfor (const [field, fieldChange] of changes) {\n\t\tconst fieldId = { nodeId: parentId, field };\n\t\tconst manager = new InvertManager(crossFieldTable, fieldChange, fieldId);\n\t\tconst invertedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\tfieldChange.change,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\trevisionForInvert,\n\t\t\tmanager,\n\t\t\trevisionMetadata,\n\t\t);\n\n\t\tconst invertedFieldChange: FieldChange = {\n\t\t\t...fieldChange,\n\t\t\tchange: brand(invertedChange),\n\t\t};\n\t\tinvertedFields.set(field, invertedFieldChange);\n\n\t\tcrossFieldTable.originalFieldToContext.set(fieldChange, {\n\t\t\tfieldId,\n\t\t\tinvertedField: invertedFieldChange,\n\t\t});\n\t}\n\n\treturn invertedFields;\n}\n\nfunction invertNodeChange(\n\tchange: NodeChangeset,\n\tid: NodeId,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): NodeChangeset {\n\tconst inverse: NodeChangeset = {};\n\n\t// If the node has a constraint, it should be inverted to a node-exist-on-revert constraint. This ensure that if\n\t// the inverse is inverted again, the original input constraint will be restored.\n\tif (change.nodeExistsConstraint !== undefined) {\n\t\tinverse.nodeExistsConstraintOnRevert = change.nodeExistsConstraint;\n\t}\n\n\t// The node-exist-on-revert constraint of a node is the constraint that should apply when the a change is reverted.\n\t// So, it should become the constraint in the inverse. If this constraint is violated when applying the inverse,\n\t// it will be discarded.\n\tif (change.nodeExistsConstraintOnRevert !== undefined) {\n\t\tinverse.nodeExistsConstraint = change.nodeExistsConstraintOnRevert;\n\t}\n\n\tif (change.fieldChanges !== undefined) {\n\t\tinverse.fieldChanges = invertFieldMap(\n\t\t\tchange.fieldChanges,\n\t\t\tid,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\tcrossFieldTable,\n\t\t\trevisionMetadata,\n\t\t\trevisionForInvert,\n\t\t\tfieldKinds,\n\t\t);\n\t}\n\n\treturn inverse;\n}\n\nfunction invertBuilds(\n\tbuilds: ChangeAtomIdBTree<TreeChunk> | undefined,\n): ChangeAtomIdBTree<number> | undefined {\n\tif (builds !== undefined) {\n\t\treturn brand(builds.mapValues((chunk) => chunk.topLevelLength));\n\t}\n\treturn undefined;\n}\n\ninterface InvertTable extends CrossFieldTable<FieldChange> {\n\toriginalFieldToContext: Map<FieldChange, InvertContext>;\n\tinvertedNodeToParent: ChangeAtomIdBTree<FieldId>;\n}\n\ninterface InvertContext {\n\tfieldId: FieldId;\n\tinvertedField: FieldChange;\n}\n\nclass InvertManager extends CrossFieldManagerI<FieldChange> {\n\tpublic constructor(\n\t\ttable: InvertTable,\n\t\tfield: FieldChange,\n\t\tprivate readonly fieldId: FieldId,\n\t\tallowInval = true,\n\t) {\n\t\tsuper(table, field, allowInval);\n\t}\n\n\tpublic override onMoveIn(id: ChangeAtomId): void {\n\t\tsetInChangeAtomIdMap(this.table.invertedNodeToParent, id, this.fieldId);\n\t}\n\n\tpublic override moveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void {\n\t\tassert(false, 0x9c5 /* Keys should not be moved manually during invert */);\n\t}\n\n\tprivate get table(): InvertTable {\n\t\treturn this.crossFieldTable as InvertTable;\n\t}\n}\n\nfunction makeCrossFieldKeyTable(\n\tfields: FieldChangeMap,\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): CrossFieldKeyTable {\n\tconst keys: CrossFieldKeyTable = newCrossFieldKeyTable();\n\tpopulateCrossFieldKeyTableForFieldMap(keys, fields, undefined, fieldKinds);\n\tnodes.forEachPair(([revision, localId], node) => {\n\t\tif (node.fieldChanges !== undefined) {\n\t\t\tpopulateCrossFieldKeyTableForFieldMap(\n\t\t\t\tkeys,\n\t\t\t\tnode.fieldChanges,\n\t\t\t\t{\n\t\t\t\t\trevision,\n\t\t\t\t\tlocalId,\n\t\t\t\t},\n\t\t\t\tfieldKinds,\n\t\t\t);\n\t\t}\n\t});\n\n\treturn keys;\n}\n\nfunction populateCrossFieldKeyTableForFieldMap(\n\ttable: CrossFieldKeyTable,\n\tfields: FieldChangeMap,\n\tparent: NodeId | undefined,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): void {\n\tfor (const [fieldKey, fieldChange] of fields) {\n\t\tconst keys = getChangeHandler(fieldKinds, fieldChange.fieldKind).getCrossFieldKeys(\n\t\t\tfieldChange.change,\n\t\t);\n\t\tfor (const { key, count } of keys) {\n\t\t\ttable.set(key, count, { nodeId: parent, field: fieldKey });\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"invert.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/invert.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,kDAU6B;AAC7B,kDAAoF;AACpF,kEAIiC;AACjC,mEASiC;AACjC,mEAUiC;AAGjC,mEAA0D;AAE1D;;;;;GAKG;AACH,SAAgB,mBAAmB,CAClC,MAAsC,EACtC,UAAmB,EACnB,iBAA8B,EAC9B,UAA2D;IAE3D,iFAAiF;IACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE7E,wEAAwE;IACxE,IAAA,iBAAM,EACL,MAAM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EACzB,MAAsB,EACtB,MAA0B,EAC1B,UAA2D;IAE3D,KAAK,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,MAAM,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,IAAA,wCAAgB,EAAC,UAAU,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,iBAAiB,CACjF,WAAW,CAAC,MAAM,CAClB,CAAC;QACF,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC;YACnC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5D,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\trevisionMetadataSourceFromInfo,\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype FieldKindIdentifier,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\ttype TreeChunk,\n} from \"../../core/index.js\";\nimport { brand, idAllocatorFromMaxId, type IdAllocator } from \"../../util/index.js\";\nimport {\n\tnewChangeAtomIdBTree,\n\tsetInChangeAtomIdMap,\n\ttype ChangeAtomIdBTree,\n} from \"../changeAtomIdBTree.js\";\nimport {\n\tnewCrossFieldKeyTable,\n\ttype CrossFieldKeyTable,\n\ttype FieldChange,\n\ttype FieldChangeMap,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\nimport {\n\tCrossFieldManagerI,\n\tgetChangeHandler,\n\tgetRevInfoFromTaggedChanges,\n\thasConflicts,\n\tmakeModularChangeset,\n\tnewConstraintState,\n\tnewCrossFieldTable,\n\tupdateConstraintsForFields,\n\ttype CrossFieldTable,\n} from \"./modularChangeUtils.js\";\nimport type { CrossFieldTarget } from \"./crossFieldQueries.js\";\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport { NodeAttachState } from \"./fieldChangeHandler.js\";\n\n/**\n * @param change - The change to invert.\n * @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when\n * performing a sandwich rebase.\n * @param revisionForInvert - The revision for the invert changeset.\n */\nexport function invertModularChange(\n\tchange: TaggedChange<ModularChangeset>,\n\tisRollback: boolean,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): ModularChangeset {\n\t// Rollback changesets destroy the nodes created by the change being rolled back.\n\tconst destroys = isRollback ? invertBuilds(change.change.builds) : undefined;\n\n\t// Destroys only occur in rollback changesets, which are never inverted.\n\tassert(\n\t\tchange.change.destroys === undefined,\n\t\t0x89a /* Unexpected destroys in change to invert */,\n\t);\n\n\tconst revInfos: RevisionInfo[] = isRollback\n\t\t? [{ revision: revisionForInvert, rollbackOf: change.revision }]\n\t\t: [{ revision: revisionForInvert }];\n\n\tconst noChangeConstraint = change.change.noChangeConstraintOnRevert;\n\tconst noChangeConstraintOnRevert = change.change.noChangeConstraint;\n\n\tif (hasConflicts(change.change)) {\n\t\treturn makeModularChangeset({\n\t\t\tmaxId: change.change.maxId as number,\n\t\t\trevisions: revInfos,\n\t\t\tdestroys,\n\t\t});\n\t}\n\n\tconst genId: IdAllocator = idAllocatorFromMaxId(change.change.maxId ?? -1);\n\n\tconst crossFieldTable: InvertTable = {\n\t\t...newCrossFieldTable<FieldChange>(),\n\t\toriginalFieldToContext: new Map(),\n\t\tinvertedNodeToParent: brand(change.change.nodeToParent.clone()),\n\t};\n\tconst { revInfos: oldRevInfos } = getRevInfoFromTaggedChanges([change]);\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(oldRevInfos);\n\n\tconst invertedFields = invertFieldMap(\n\t\tchange.change.fieldChanges,\n\t\tundefined,\n\t\tisRollback,\n\t\tgenId,\n\t\tcrossFieldTable,\n\t\trevisionMetadata,\n\t\trevisionForInvert,\n\t\tfieldKinds,\n\t);\n\n\tconst invertedNodes = newChangeAtomIdBTree<NodeChangeset>();\n\tchange.change.nodeChanges.forEachPair(([revision, localId], nodeChangeset) => {\n\t\tinvertedNodes.set(\n\t\t\t[revision, localId],\n\t\t\tinvertNodeChange(\n\t\t\t\tnodeChangeset,\n\t\t\t\t{ revision, localId },\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\tcrossFieldTable,\n\t\t\t\trevisionMetadata,\n\t\t\t\trevisionForInvert,\n\t\t\t\tfieldKinds,\n\t\t\t),\n\t\t);\n\t});\n\n\tif (crossFieldTable.invalidatedFields.size > 0) {\n\t\tconst fieldsToUpdate = crossFieldTable.invalidatedFields;\n\t\tcrossFieldTable.invalidatedFields = new Set();\n\t\tfor (const fieldChange of fieldsToUpdate) {\n\t\t\tconst originalFieldChange = fieldChange.change;\n\t\t\tconst context = crossFieldTable.originalFieldToContext.get(fieldChange);\n\t\t\tassert(\n\t\t\t\tcontext !== undefined,\n\t\t\t\t0x851 /* Should have context for every invalidated field */,\n\t\t\t);\n\t\t\tconst { invertedField, fieldId } = context;\n\n\t\t\tconst amendedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\t\toriginalFieldChange,\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\trevisionForInvert,\n\t\t\t\tnew InvertManager(crossFieldTable, fieldChange, fieldId),\n\t\t\t\trevisionMetadata,\n\t\t\t);\n\t\t\tinvertedField.change = brand(amendedChange);\n\t\t}\n\t}\n\n\tconst crossFieldKeys = makeCrossFieldKeyTable(invertedFields, invertedNodes, fieldKinds);\n\n\tconst constraintState = newConstraintState(0);\n\tupdateConstraintsForFields(\n\t\tinvertedFields,\n\t\tNodeAttachState.Attached,\n\t\tconstraintState,\n\t\tinvertedNodes,\n\t\tfieldKinds,\n\t);\n\n\treturn makeModularChangeset({\n\t\tfieldChanges: invertedFields,\n\t\tnodeChanges: invertedNodes,\n\t\tnodeToParent: crossFieldTable.invertedNodeToParent,\n\t\tnodeAliases: change.change.nodeAliases,\n\t\tcrossFieldKeys,\n\t\tmaxId: genId.getMaxId(),\n\t\trevisions: revInfos,\n\t\tconstraintViolationCount: constraintState.violationCount,\n\t\tnoChangeConstraint,\n\t\tnoChangeConstraintOnRevert,\n\t\tdestroys,\n\t});\n}\n\nfunction invertFieldMap(\n\tchanges: FieldChangeMap,\n\tparentId: NodeId | undefined,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): FieldChangeMap {\n\tconst invertedFields: FieldChangeMap = new Map();\n\n\tfor (const [field, fieldChange] of changes) {\n\t\tconst fieldId = { nodeId: parentId, field };\n\t\tconst manager = new InvertManager(crossFieldTable, fieldChange, fieldId);\n\t\tconst invertedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\tfieldChange.change,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\trevisionForInvert,\n\t\t\tmanager,\n\t\t\trevisionMetadata,\n\t\t);\n\n\t\tconst invertedFieldChange: FieldChange = {\n\t\t\t...fieldChange,\n\t\t\tchange: brand(invertedChange),\n\t\t};\n\t\tinvertedFields.set(field, invertedFieldChange);\n\n\t\tcrossFieldTable.originalFieldToContext.set(fieldChange, {\n\t\t\tfieldId,\n\t\t\tinvertedField: invertedFieldChange,\n\t\t});\n\t}\n\n\treturn invertedFields;\n}\n\nfunction invertNodeChange(\n\tchange: NodeChangeset,\n\tid: NodeId,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): NodeChangeset {\n\tconst inverse: NodeChangeset = {};\n\n\t// If the node has a constraint, it should be inverted to a node-exist-on-revert constraint. This ensure that if\n\t// the inverse is inverted again, the original input constraint will be restored.\n\tif (change.nodeExistsConstraint !== undefined) {\n\t\tinverse.nodeExistsConstraintOnRevert = change.nodeExistsConstraint;\n\t}\n\n\t// The node-exist-on-revert constraint of a node is the constraint that should apply when the a change is reverted.\n\t// So, it should become the constraint in the inverse. If this constraint is violated when applying the inverse,\n\t// it will be discarded.\n\tif (change.nodeExistsConstraintOnRevert !== undefined) {\n\t\tinverse.nodeExistsConstraint = change.nodeExistsConstraintOnRevert;\n\t}\n\n\tif (change.fieldChanges !== undefined) {\n\t\tinverse.fieldChanges = invertFieldMap(\n\t\t\tchange.fieldChanges,\n\t\t\tid,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\tcrossFieldTable,\n\t\t\trevisionMetadata,\n\t\t\trevisionForInvert,\n\t\t\tfieldKinds,\n\t\t);\n\t}\n\n\treturn inverse;\n}\n\nfunction invertBuilds(\n\tbuilds: ChangeAtomIdBTree<TreeChunk> | undefined,\n): ChangeAtomIdBTree<number> | undefined {\n\tif (builds !== undefined) {\n\t\treturn brand(builds.mapValues((chunk) => chunk.topLevelLength));\n\t}\n\treturn undefined;\n}\n\ninterface InvertTable extends CrossFieldTable<FieldChange> {\n\toriginalFieldToContext: Map<FieldChange, InvertContext>;\n\tinvertedNodeToParent: ChangeAtomIdBTree<FieldId>;\n}\n\ninterface InvertContext {\n\tfieldId: FieldId;\n\tinvertedField: FieldChange;\n}\n\nclass InvertManager extends CrossFieldManagerI<FieldChange> {\n\tpublic constructor(\n\t\ttable: InvertTable,\n\t\tfield: FieldChange,\n\t\tprivate readonly fieldId: FieldId,\n\t\tallowInval = true,\n\t) {\n\t\tsuper(table, field, allowInval);\n\t}\n\n\tpublic override onMoveIn(id: ChangeAtomId): void {\n\t\tsetInChangeAtomIdMap(this.table.invertedNodeToParent, id, this.fieldId);\n\t}\n\n\tpublic override moveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void {\n\t\tfail(0x9c5 /* Keys should not be moved manually during invert */);\n\t}\n\n\tprivate get table(): InvertTable {\n\t\treturn this.crossFieldTable as InvertTable;\n\t}\n}\n\nfunction makeCrossFieldKeyTable(\n\tfields: FieldChangeMap,\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): CrossFieldKeyTable {\n\tconst keys: CrossFieldKeyTable = newCrossFieldKeyTable();\n\tpopulateCrossFieldKeyTableForFieldMap(keys, fields, undefined, fieldKinds);\n\tnodes.forEachPair(([revision, localId], node) => {\n\t\tif (node.fieldChanges !== undefined) {\n\t\t\tpopulateCrossFieldKeyTableForFieldMap(\n\t\t\t\tkeys,\n\t\t\t\tnode.fieldChanges,\n\t\t\t\t{\n\t\t\t\t\trevision,\n\t\t\t\t\tlocalId,\n\t\t\t\t},\n\t\t\t\tfieldKinds,\n\t\t\t);\n\t\t}\n\t});\n\n\treturn keys;\n}\n\nfunction populateCrossFieldKeyTableForFieldMap(\n\ttable: CrossFieldKeyTable,\n\tfields: FieldChangeMap,\n\tparent: NodeId | undefined,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): void {\n\tfor (const [fieldKey, fieldChange] of fields) {\n\t\tconst keys = getChangeHandler(fieldKinds, fieldChange.fieldKind).getCrossFieldKeys(\n\t\t\tfieldChange.change,\n\t\t);\n\t\tfor (const { key, count } of keys) {\n\t\t\ttable.set(key, count, { nodeId: parent, field: fieldKey });\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modularChangeFamily.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeFamily.ts"],"names":[],"mappings":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B;IAI5C,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI;IAqBlE,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI;IAqB1E,qBAAqB,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;IAelD,6BAA6B,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;CAcjE;AAkHD,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;CACtC;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AA6D3E,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIrF;AAkBD,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,iBAAiB,CAAC,MAAM,CAAC,GACpC,OAAO,CAIT"}
|
|
@@ -864,18 +864,9 @@ function updateRefreshers(change, getDetachedNode, removedRoots, requireRefreshe
|
|
|
864
864
|
refreshers.set([root.major, (0, index_js_3.brand)(root.minor)], node);
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
|
-
const { fieldChanges, nodeChanges, nodeToParent, nodeAliases, crossFieldKeys, maxId, revisions, constraintViolationCount, builds, destroys, } = change;
|
|
868
867
|
return (0, modularChangeUtils_js_1.makeModularChangeset)({
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
nodeToParent,
|
|
872
|
-
nodeAliases,
|
|
873
|
-
crossFieldKeys,
|
|
874
|
-
maxId: maxId,
|
|
875
|
-
revisions,
|
|
876
|
-
constraintViolationCount,
|
|
877
|
-
builds,
|
|
878
|
-
destroys,
|
|
868
|
+
...change,
|
|
869
|
+
maxId: change.maxId,
|
|
879
870
|
refreshers,
|
|
880
871
|
});
|
|
881
872
|
}
|