@fluidframework/tree 2.113.0-411909 → 2.114.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/CHANGELOG.md +272 -0
- package/api-report/tree.alpha.api.md +19 -0
- package/dist/core/change-family/changeFamily.d.ts +15 -4
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/change-family/editBuilder.d.ts +2 -3
- package/dist/core/change-family/editBuilder.d.ts.map +1 -1
- package/dist/core/change-family/editBuilder.js +1 -2
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/change-family/index.d.ts +1 -1
- package/dist/core/change-family/index.d.ts.map +1 -1
- package/dist/core/change-family/index.js.map +1 -1
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/delta.d.ts +62 -16
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +7 -13
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +32 -46
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -0
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +2 -4
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +2 -2
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +5 -2
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +98 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.js +10 -0
- package/dist/feature-libraries/comparison-forest/index.js.map +1 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +18 -6
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +4 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +77 -72
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.d.ts +15 -0
- package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/invert.js +159 -0
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +53 -406
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +205 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.js +49 -0
- package/dist/feature-libraries/modular-schema/prune.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalField.js +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.d.ts +15 -0
- package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +64 -1
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.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/serializedChange.d.ts +2 -2
- package/dist/shared-tree/serializedChange.d.ts.map +1 -1
- package/dist/shared-tree/serializedChange.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +6 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +8 -6
- 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/sharedTreeChangeFamily.d.ts +41 -4
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +57 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/dist/shared-tree/transactionMinimize.js +2 -2
- package/dist/shared-tree/transactionMinimize.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +8 -7
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +23 -9
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +7 -0
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +4 -4
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -0
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -14
- 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/editManagerCodecsCommons.d.ts +11 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +4 -4
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +0 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +8 -1
- 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 +5 -5
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +10 -10
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +6 -3
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +21 -2
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +9 -0
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/text/textDomain.d.ts +12 -0
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +37 -16
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +155 -61
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +147 -71
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +37 -14
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/dist/text/textDomainFormattedDefault.js +13 -5
- package/dist/text/textDomainFormattedDefault.js.map +1 -1
- package/dist/treeDataStore.d.ts +49 -0
- package/dist/treeDataStore.d.ts.map +1 -0
- package/dist/treeDataStore.js +57 -0
- package/dist/treeDataStore.js.map +1 -0
- package/dist/treeFactory.d.ts +8 -3
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +6 -1
- package/dist/treeFactory.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +15 -4
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/change-family/editBuilder.d.ts +2 -3
- package/lib/core/change-family/editBuilder.d.ts.map +1 -1
- package/lib/core/change-family/editBuilder.js +1 -2
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/change-family/index.d.ts +1 -1
- package/lib/core/change-family/index.d.ts.map +1 -1
- package/lib/core/change-family/index.js.map +1 -1
- package/lib/core/index.d.ts +3 -2
- 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/delta.d.ts +62 -16
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +7 -13
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +7 -21
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -0
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +2 -4
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +2 -2
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +94 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.js +6 -0
- package/lib/feature-libraries/comparison-forest/index.js.map +1 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +16 -4
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +4 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.d.ts +15 -0
- package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/invert.js +155 -0
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +16 -367
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +192 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.js +45 -0
- package/lib/feature-libraries/modular-schema/prune.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalField.js +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/treeTextCursor.d.ts +15 -0
- package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/lib/feature-libraries/treeTextCursor.js +62 -1
- package/lib/feature-libraries/treeTextCursor.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.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/serializedChange.d.ts +2 -2
- package/lib/shared-tree/serializedChange.d.ts.map +1 -1
- package/lib/shared-tree/serializedChange.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +6 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +9 -7
- 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/sharedTreeChangeFamily.d.ts +41 -4
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +55 -0
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/lib/shared-tree/transactionMinimize.js +3 -3
- package/lib/shared-tree/transactionMinimize.js.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +8 -7
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +1 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +23 -9
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +7 -0
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +4 -4
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -0
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -14
- 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/editManagerCodecsCommons.d.ts +11 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +4 -4
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +0 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +8 -1
- 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 +5 -5
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +10 -10
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +6 -3
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +21 -2
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +9 -0
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/text/textDomain.d.ts +12 -0
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +34 -15
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +155 -61
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +148 -73
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +37 -14
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/lib/text/textDomainFormattedDefault.js +14 -6
- package/lib/text/textDomainFormattedDefault.js.map +1 -1
- package/lib/treeDataStore.d.ts +49 -0
- package/lib/treeDataStore.d.ts.map +1 -0
- package/lib/treeDataStore.js +52 -0
- package/lib/treeDataStore.js.map +1 -0
- package/lib/treeFactory.d.ts +8 -3
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +5 -0
- package/lib/treeFactory.js.map +1 -1
- package/package.json +25 -24
- package/src/core/change-family/changeFamily.ts +32 -4
- package/src/core/change-family/editBuilder.ts +1 -2
- package/src/core/change-family/index.ts +2 -0
- package/src/core/index.ts +9 -6
- package/src/core/tree/delta.ts +62 -16
- package/src/core/tree/detachedFieldIndex.ts +7 -38
- package/src/core/tree/index.ts +2 -0
- package/src/core/tree/visitorUtils.ts +3 -17
- package/src/entrypoints/alpha.ts +7 -3
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +11 -1
- package/src/feature-libraries/comparison-forest/comparisonForest.ts +140 -0
- package/src/feature-libraries/comparison-forest/index.ts +6 -0
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +20 -6
- package/src/feature-libraries/default-schema/index.ts +1 -0
- package/src/feature-libraries/default-schema/noChangeCodecs.ts +11 -3
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +33 -5
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -3
- package/src/feature-libraries/index.ts +5 -0
- package/src/feature-libraries/mitigatedChangeFamily.ts +21 -3
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -1
- package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +9 -4
- package/src/feature-libraries/modular-schema/index.ts +1 -0
- package/src/feature-libraries/modular-schema/invert.ts +338 -0
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +3 -5
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +16 -13
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +3 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +45 -644
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +340 -0
- package/src/feature-libraries/modular-schema/prune.ts +69 -0
- package/src/feature-libraries/optional-field/optionalField.ts +1 -1
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +4 -2
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +6 -3
- package/src/feature-libraries/treeTextCursor.ts +66 -1
- package/src/index.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/serializedChange.ts +2 -2
- package/src/shared-tree/sharedTree.ts +34 -14
- package/src/shared-tree/sharedTreeChangeCodecs.ts +11 -3
- package/src/shared-tree/sharedTreeChangeFamily.ts +77 -2
- package/src/shared-tree/transactionMinimize.ts +7 -3
- package/src/shared-tree/transactionPostProcessor.ts +5 -1
- package/src/shared-tree/treeCheckout.ts +55 -16
- package/src/shared-tree-core/branch.ts +40 -12
- package/src/shared-tree-core/editManager.ts +46 -25
- package/src/shared-tree-core/editManagerCodecs.ts +9 -21
- package/src/shared-tree-core/editManagerCodecsCommons.ts +14 -2
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +18 -21
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +18 -20
- package/src/shared-tree-core/editManagerSummarizer.ts +9 -6
- package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -3
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -2
- package/src/shared-tree-core/messageCodecs.ts +12 -2
- package/src/shared-tree-core/sharedTreeCore.ts +15 -6
- package/src/shared-tree-core/transaction.ts +47 -25
- package/src/simple-tree/api/eraseSchemaDetails.ts +15 -0
- package/src/simple-tree/node-kinds/array/arrayNode.ts +21 -2
- package/src/simple-tree/node-kinds/map/mapNode.ts +24 -2
- package/src/text/textDomain.ts +29 -6
- package/src/text/textDomainFormatted.ts +351 -134
- package/src/text/textDomainFormattedDefault.ts +25 -16
- package/src/treeDataStore.ts +125 -0
- package/src/treeFactory.ts +11 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { type ChangesetLocalId, type FieldKindIdentifier, type RevisionInfo, type RevisionTag, type TaggedChange, type TreeChunk } from "../../core/index.js";
|
|
6
|
+
import { type RangeQueryResult } from "../../util/index.js";
|
|
7
|
+
import { type ChangeAtomIdBTree } from "../changeAtomIdBTree.js";
|
|
8
|
+
import { CrossFieldTarget, type CrossFieldManager, type CrossFieldMap } from "./crossFieldQueries.js";
|
|
9
|
+
import type { FieldChangeHandler } from "./fieldChangeHandler.js";
|
|
10
|
+
import { NodeAttachState } from "./fieldChangeHandler.js";
|
|
11
|
+
import type { FlexFieldKind } from "./fieldKind.js";
|
|
12
|
+
import { type CrossFieldKeyTable, type FieldChangeMap, type FieldId, type ModularChangeset, type NoChangeConstraint, type NodeChangeset, type NodeId } from "./modularChangeTypes.js";
|
|
13
|
+
export declare function hasConflicts(change: ModularChangeset): boolean;
|
|
14
|
+
export declare function makeModularChangeset(props?: {
|
|
15
|
+
fieldChanges?: FieldChangeMap;
|
|
16
|
+
nodeChanges?: ChangeAtomIdBTree<NodeChangeset>;
|
|
17
|
+
nodeToParent?: ChangeAtomIdBTree<FieldId>;
|
|
18
|
+
nodeAliases?: ChangeAtomIdBTree<NodeId>;
|
|
19
|
+
crossFieldKeys?: CrossFieldKeyTable;
|
|
20
|
+
maxId: number;
|
|
21
|
+
revisions?: readonly RevisionInfo[];
|
|
22
|
+
constraintViolationCount?: number;
|
|
23
|
+
noChangeConstraint?: NoChangeConstraint;
|
|
24
|
+
noChangeConstraintOnRevert?: NoChangeConstraint;
|
|
25
|
+
builds?: ChangeAtomIdBTree<TreeChunk>;
|
|
26
|
+
destroys?: ChangeAtomIdBTree<number>;
|
|
27
|
+
refreshers?: ChangeAtomIdBTree<TreeChunk>;
|
|
28
|
+
}): ModularChangeset;
|
|
29
|
+
export interface CrossFieldTable<TFieldData> {
|
|
30
|
+
srcTable: CrossFieldMap<unknown>;
|
|
31
|
+
dstTable: CrossFieldMap<unknown>;
|
|
32
|
+
srcDependents: CrossFieldMap<TFieldData>;
|
|
33
|
+
dstDependents: CrossFieldMap<TFieldData>;
|
|
34
|
+
invalidatedFields: Set<TFieldData>;
|
|
35
|
+
}
|
|
36
|
+
export declare abstract class CrossFieldManagerI<T> implements CrossFieldManager {
|
|
37
|
+
protected readonly crossFieldTable: CrossFieldTable<T>;
|
|
38
|
+
private readonly currentFieldKey;
|
|
39
|
+
protected readonly allowInval: boolean;
|
|
40
|
+
constructor(crossFieldTable: CrossFieldTable<T>, currentFieldKey: T, allowInval?: boolean);
|
|
41
|
+
set(target: CrossFieldTarget, revision: RevisionTag | undefined, id: ChangesetLocalId, count: number, newValue: unknown, invalidateDependents: boolean): void;
|
|
42
|
+
get(target: CrossFieldTarget, revision: RevisionTag | undefined, id: ChangesetLocalId, count: number, addDependency: boolean): RangeQueryResult<unknown>;
|
|
43
|
+
abstract onMoveIn(id: NodeId): void;
|
|
44
|
+
abstract moveKey(target: CrossFieldTarget, revision: RevisionTag | undefined, id: ChangesetLocalId, count: number): void;
|
|
45
|
+
private getMap;
|
|
46
|
+
private getDependents;
|
|
47
|
+
}
|
|
48
|
+
export declare function newCrossFieldTable<T>(): CrossFieldTable<T>;
|
|
49
|
+
export declare function getRevInfoFromTaggedChanges(changes: TaggedChange<ModularChangeset>[]): {
|
|
50
|
+
revInfos: RevisionInfo[];
|
|
51
|
+
maxId: ChangesetLocalId;
|
|
52
|
+
};
|
|
53
|
+
export declare function revisionInfoFromTaggedChange(taggedChange: TaggedChange<ModularChangeset>): RevisionInfo[];
|
|
54
|
+
export declare function getChangeHandler(fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>, kind: FieldKindIdentifier): FieldChangeHandler<unknown>;
|
|
55
|
+
export interface ConstraintState {
|
|
56
|
+
violationCount: number;
|
|
57
|
+
}
|
|
58
|
+
export declare function newConstraintState(violationCount: number): ConstraintState;
|
|
59
|
+
export declare function updateConstraintsForFields(fields: FieldChangeMap, parentInputAttachState: NodeAttachState, constraintState: ConstraintState, nodes: ChangeAtomIdBTree<NodeChangeset>, fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>): void;
|
|
60
|
+
export declare function nodeChangeFromId(nodes: ChangeAtomIdBTree<NodeChangeset>, id: NodeId): NodeChangeset;
|
|
61
|
+
//# sourceMappingURL=modularChangeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modularChangeUtils.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,KAAK,gBAAgB,EAErB,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
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.nodeChangeFromId = exports.updateConstraintsForFields = exports.newConstraintState = exports.getChangeHandler = exports.revisionInfoFromTaggedChange = exports.getRevInfoFromTaggedChanges = exports.newCrossFieldTable = exports.CrossFieldManagerI = exports.makeModularChangeset = exports.hasConflicts = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const index_js_1 = require("../../core/index.js");
|
|
10
|
+
const index_js_2 = require("../../util/index.js");
|
|
11
|
+
const changeAtomIdBTree_js_1 = require("../changeAtomIdBTree.js");
|
|
12
|
+
const crossFieldQueries_js_1 = require("./crossFieldQueries.js");
|
|
13
|
+
const fieldChangeHandler_js_1 = require("./fieldChangeHandler.js");
|
|
14
|
+
const genericFieldKind_js_1 = require("./genericFieldKind.js");
|
|
15
|
+
const modularChangeTypes_js_1 = require("./modularChangeTypes.js");
|
|
16
|
+
function hasConflicts(change) {
|
|
17
|
+
return (change.constraintViolationCount ?? 0) > 0;
|
|
18
|
+
}
|
|
19
|
+
exports.hasConflicts = hasConflicts;
|
|
20
|
+
function makeModularChangeset(props) {
|
|
21
|
+
const p = props ?? { maxId: -1 };
|
|
22
|
+
const changeset = {
|
|
23
|
+
fieldChanges: p.fieldChanges ?? new Map(),
|
|
24
|
+
nodeChanges: p.nodeChanges ?? (0, changeAtomIdBTree_js_1.newChangeAtomIdBTree)(),
|
|
25
|
+
nodeToParent: p.nodeToParent ?? (0, changeAtomIdBTree_js_1.newChangeAtomIdBTree)(),
|
|
26
|
+
nodeAliases: p.nodeAliases ?? (0, changeAtomIdBTree_js_1.newChangeAtomIdBTree)(),
|
|
27
|
+
crossFieldKeys: p.crossFieldKeys ?? (0, modularChangeTypes_js_1.newCrossFieldKeyTable)(),
|
|
28
|
+
};
|
|
29
|
+
if (p.revisions !== undefined && p.revisions.length > 0) {
|
|
30
|
+
changeset.revisions = p.revisions;
|
|
31
|
+
}
|
|
32
|
+
if (p.maxId >= 0) {
|
|
33
|
+
changeset.maxId = (0, index_js_2.brand)(p.maxId);
|
|
34
|
+
}
|
|
35
|
+
if (p.constraintViolationCount !== undefined && p.constraintViolationCount > 0) {
|
|
36
|
+
changeset.constraintViolationCount = p.constraintViolationCount;
|
|
37
|
+
}
|
|
38
|
+
if (p.noChangeConstraint !== undefined) {
|
|
39
|
+
changeset.noChangeConstraint = p.noChangeConstraint;
|
|
40
|
+
}
|
|
41
|
+
if (p.noChangeConstraintOnRevert !== undefined) {
|
|
42
|
+
changeset.noChangeConstraintOnRevert = p.noChangeConstraintOnRevert;
|
|
43
|
+
}
|
|
44
|
+
if (p.builds !== undefined && p.builds.size > 0) {
|
|
45
|
+
changeset.builds = p.builds;
|
|
46
|
+
}
|
|
47
|
+
if (p.destroys !== undefined && p.destroys.size > 0) {
|
|
48
|
+
changeset.destroys = p.destroys;
|
|
49
|
+
}
|
|
50
|
+
if (p.refreshers !== undefined && p.refreshers.size > 0) {
|
|
51
|
+
changeset.refreshers = p.refreshers;
|
|
52
|
+
}
|
|
53
|
+
return changeset;
|
|
54
|
+
}
|
|
55
|
+
exports.makeModularChangeset = makeModularChangeset;
|
|
56
|
+
class CrossFieldManagerI {
|
|
57
|
+
constructor(crossFieldTable, currentFieldKey, allowInval = true) {
|
|
58
|
+
this.crossFieldTable = crossFieldTable;
|
|
59
|
+
this.currentFieldKey = currentFieldKey;
|
|
60
|
+
this.allowInval = allowInval;
|
|
61
|
+
}
|
|
62
|
+
set(target, revision, id, count, newValue, invalidateDependents) {
|
|
63
|
+
if (invalidateDependents && this.allowInval) {
|
|
64
|
+
const lastChangedId = id + count - 1;
|
|
65
|
+
let firstId = id;
|
|
66
|
+
while (firstId <= lastChangedId) {
|
|
67
|
+
const dependentEntry = (0, crossFieldQueries_js_1.getFirstFromCrossFieldMap)(this.getDependents(target), revision, firstId, lastChangedId - firstId + 1);
|
|
68
|
+
if (dependentEntry.value !== undefined) {
|
|
69
|
+
this.crossFieldTable.invalidatedFields.add(dependentEntry.value);
|
|
70
|
+
}
|
|
71
|
+
firstId = (0, index_js_2.brand)(firstId + dependentEntry.length);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
(0, crossFieldQueries_js_1.setInCrossFieldMap)(this.getMap(target), revision, id, count, newValue);
|
|
75
|
+
}
|
|
76
|
+
get(target, revision, id, count, addDependency) {
|
|
77
|
+
if (addDependency) {
|
|
78
|
+
// We assume that if there is already an entry for this ID it is because
|
|
79
|
+
// a field handler has called compose on the same node multiple times.
|
|
80
|
+
// In this case we only want to update the latest version, so we overwrite the dependency.
|
|
81
|
+
(0, crossFieldQueries_js_1.setInCrossFieldMap)(this.getDependents(target), revision, id, count, this.currentFieldKey);
|
|
82
|
+
}
|
|
83
|
+
return (0, crossFieldQueries_js_1.getFirstFromCrossFieldMap)(this.getMap(target), revision, id, count);
|
|
84
|
+
}
|
|
85
|
+
getMap(target) {
|
|
86
|
+
return target === crossFieldQueries_js_1.CrossFieldTarget.Source
|
|
87
|
+
? this.crossFieldTable.srcTable
|
|
88
|
+
: this.crossFieldTable.dstTable;
|
|
89
|
+
}
|
|
90
|
+
getDependents(target) {
|
|
91
|
+
return target === crossFieldQueries_js_1.CrossFieldTarget.Source
|
|
92
|
+
? this.crossFieldTable.srcDependents
|
|
93
|
+
: this.crossFieldTable.dstDependents;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.CrossFieldManagerI = CrossFieldManagerI;
|
|
97
|
+
function newCrossFieldTable() {
|
|
98
|
+
return {
|
|
99
|
+
srcTable: (0, index_js_1.newChangeAtomIdRangeMap)(),
|
|
100
|
+
dstTable: (0, index_js_1.newChangeAtomIdRangeMap)(),
|
|
101
|
+
srcDependents: (0, index_js_1.newChangeAtomIdRangeMap)(),
|
|
102
|
+
dstDependents: (0, index_js_1.newChangeAtomIdRangeMap)(),
|
|
103
|
+
invalidatedFields: new Set(),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
exports.newCrossFieldTable = newCrossFieldTable;
|
|
107
|
+
function getRevInfoFromTaggedChanges(changes) {
|
|
108
|
+
let maxId = -1;
|
|
109
|
+
const revInfos = [];
|
|
110
|
+
const revisions = new Set();
|
|
111
|
+
for (const taggedChange of changes) {
|
|
112
|
+
const change = taggedChange.change;
|
|
113
|
+
maxId = Math.max(change.maxId ?? -1, maxId);
|
|
114
|
+
const infosToAdd = revisionInfoFromTaggedChange(taggedChange);
|
|
115
|
+
for (const info of infosToAdd) {
|
|
116
|
+
if (!revisions.has(info.revision)) {
|
|
117
|
+
revisions.add(info.revision);
|
|
118
|
+
revInfos.push(info);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const rolledBackRevisions = [];
|
|
123
|
+
for (const info of revInfos) {
|
|
124
|
+
if (info.rollbackOf !== undefined) {
|
|
125
|
+
rolledBackRevisions.push(info.rollbackOf);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
rolledBackRevisions.reverse();
|
|
129
|
+
for (const revision of rolledBackRevisions) {
|
|
130
|
+
if (!revisions.has(revision)) {
|
|
131
|
+
revInfos.push({ revision });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { maxId: (0, index_js_2.brand)(maxId), revInfos };
|
|
135
|
+
}
|
|
136
|
+
exports.getRevInfoFromTaggedChanges = getRevInfoFromTaggedChanges;
|
|
137
|
+
function revisionInfoFromTaggedChange(taggedChange) {
|
|
138
|
+
const revInfos = [];
|
|
139
|
+
if (taggedChange.change.revisions !== undefined) {
|
|
140
|
+
revInfos.push(...taggedChange.change.revisions);
|
|
141
|
+
}
|
|
142
|
+
else if (taggedChange.revision !== undefined) {
|
|
143
|
+
const info = { revision: taggedChange.revision };
|
|
144
|
+
if (taggedChange.rollbackOf !== undefined) {
|
|
145
|
+
info.rollbackOf = taggedChange.rollbackOf;
|
|
146
|
+
}
|
|
147
|
+
revInfos.push(info);
|
|
148
|
+
}
|
|
149
|
+
return revInfos;
|
|
150
|
+
}
|
|
151
|
+
exports.revisionInfoFromTaggedChange = revisionInfoFromTaggedChange;
|
|
152
|
+
function getChangeHandler(fieldKinds, kind) {
|
|
153
|
+
return getFieldKind(fieldKinds, kind).changeHandler;
|
|
154
|
+
}
|
|
155
|
+
exports.getChangeHandler = getChangeHandler;
|
|
156
|
+
function getFieldKind(fieldKinds, kind) {
|
|
157
|
+
if (kind === genericFieldKind_js_1.genericFieldKind.identifier) {
|
|
158
|
+
return genericFieldKind_js_1.genericFieldKind;
|
|
159
|
+
}
|
|
160
|
+
const fieldKind = fieldKinds.get(kind);
|
|
161
|
+
(0, internal_1.assert)(fieldKind !== undefined, 0x3ad /* Unknown field kind */);
|
|
162
|
+
return fieldKind;
|
|
163
|
+
}
|
|
164
|
+
function newConstraintState(violationCount) {
|
|
165
|
+
return {
|
|
166
|
+
violationCount,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
exports.newConstraintState = newConstraintState;
|
|
170
|
+
function updateConstraintsForFields(fields, parentInputAttachState, constraintState, nodes, fieldKinds) {
|
|
171
|
+
for (const field of fields.values()) {
|
|
172
|
+
const handler = getChangeHandler(fieldKinds, field.fieldKind);
|
|
173
|
+
for (const [nodeId, inputIndex, _outputIndex] of handler.getNestedChanges(field.change)) {
|
|
174
|
+
const isInputDetached = inputIndex === undefined;
|
|
175
|
+
const inputAttachState = parentInputAttachState === fieldChangeHandler_js_1.NodeAttachState.Detached || isInputDetached
|
|
176
|
+
? fieldChangeHandler_js_1.NodeAttachState.Detached
|
|
177
|
+
: fieldChangeHandler_js_1.NodeAttachState.Attached;
|
|
178
|
+
updateConstraintsForNode(nodeId, inputAttachState, nodes, constraintState, fieldKinds);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.updateConstraintsForFields = updateConstraintsForFields;
|
|
183
|
+
function updateConstraintsForNode(nodeId, inputAttachState, nodes, constraintState, fieldKinds) {
|
|
184
|
+
const node = nodes.get([nodeId.revision, nodeId.localId]) ?? (0, internal_1.fail)(0xb24 /* Unknown node ID */);
|
|
185
|
+
if (node.nodeExistsConstraint !== undefined) {
|
|
186
|
+
const isNowViolated = inputAttachState === fieldChangeHandler_js_1.NodeAttachState.Detached;
|
|
187
|
+
if (node.nodeExistsConstraint.violated !== isNowViolated) {
|
|
188
|
+
node.nodeExistsConstraint = {
|
|
189
|
+
...node.nodeExistsConstraint,
|
|
190
|
+
violated: isNowViolated,
|
|
191
|
+
};
|
|
192
|
+
constraintState.violationCount += isNowViolated ? 1 : -1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (node.fieldChanges !== undefined) {
|
|
196
|
+
updateConstraintsForFields(node.fieldChanges, inputAttachState, constraintState, nodes, fieldKinds);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function nodeChangeFromId(nodes, id) {
|
|
200
|
+
const node = (0, changeAtomIdBTree_js_1.getFromChangeAtomIdMap)(nodes, id);
|
|
201
|
+
(0, internal_1.assert)(node !== undefined, 0x9ca /* Unknown node ID */);
|
|
202
|
+
return node;
|
|
203
|
+
}
|
|
204
|
+
exports.nodeChangeFromId = nodeChangeFromId;
|
|
205
|
+
//# sourceMappingURL=modularChangeUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modularChangeUtils.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,kDAS6B;AAC7B,kDAAiF;AACjF,kEAIiC;AACjC,iEAMgC;AAEhC,mEAA0D;AAE1D,+DAAyD;AACzD,mEAUiC;AAEjC,SAAgB,YAAY,CAAC,MAAwB;IACpD,OAAO,CAAC,MAAM,CAAC,wBAAwB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC;AAFD,oCAEC;AAED,SAAgB,oBAAoB,CAAC,KAcpC;IACA,MAAM,CAAC,GAAG,KAAK,IAAI,EAAE,KAAK,EAAE,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gBAC3B,GAAG,IAAI,CAAC,oBAAoB;gBAC5B,QAAQ,EAAE,aAAa;aACvB,CAAC;YACF,eAAe,CAAC,cAAc,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC;IAED,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACrC,0BAA0B,CACzB,IAAI,CAAC,YAAY,EACjB,gBAAgB,EAChB,eAAe,EACf,KAAK,EACL,UAAU,CACV,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAgB,gBAAgB,CAC/B,KAAuC,EACvC,EAAU;IAEV,MAAM,IAAI,GAAG,IAAA,6CAAsB,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAA,iBAAM,EAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AACb,CAAC;AAPD,4CAOC","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\tnewChangeAtomIdRangeMap,\n\ttype ChangesetLocalId,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype RevisionInfo,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\ttype TreeChunk,\n} from \"../../core/index.js\";\nimport { brand, type Mutable, type RangeQueryResult } from \"../../util/index.js\";\nimport {\n\tgetFromChangeAtomIdMap,\n\tnewChangeAtomIdBTree,\n\ttype ChangeAtomIdBTree,\n} from \"../changeAtomIdBTree.js\";\nimport {\n\tCrossFieldTarget,\n\tgetFirstFromCrossFieldMap,\n\tsetInCrossFieldMap,\n\ttype CrossFieldManager,\n\ttype CrossFieldMap,\n} from \"./crossFieldQueries.js\";\nimport type { FieldChangeHandler } from \"./fieldChangeHandler.js\";\nimport { NodeAttachState } from \"./fieldChangeHandler.js\";\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport { genericFieldKind } from \"./genericFieldKind.js\";\nimport {\n\tnewCrossFieldKeyTable,\n\ttype CrossFieldKeyTable,\n\ttype FieldChange,\n\ttype FieldChangeMap,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NoChangeConstraint,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\n\nexport function hasConflicts(change: ModularChangeset): boolean {\n\treturn (change.constraintViolationCount ?? 0) > 0;\n}\n\nexport function makeModularChangeset(props?: {\n\tfieldChanges?: FieldChangeMap;\n\tnodeChanges?: ChangeAtomIdBTree<NodeChangeset>;\n\tnodeToParent?: ChangeAtomIdBTree<FieldId>;\n\tnodeAliases?: ChangeAtomIdBTree<NodeId>;\n\tcrossFieldKeys?: CrossFieldKeyTable;\n\tmaxId: number;\n\trevisions?: readonly RevisionInfo[];\n\tconstraintViolationCount?: number;\n\tnoChangeConstraint?: NoChangeConstraint;\n\tnoChangeConstraintOnRevert?: NoChangeConstraint;\n\tbuilds?: ChangeAtomIdBTree<TreeChunk>;\n\tdestroys?: ChangeAtomIdBTree<number>;\n\trefreshers?: ChangeAtomIdBTree<TreeChunk>;\n}): ModularChangeset {\n\tconst p = props ?? { maxId: -1 };\n\tconst changeset: Mutable<ModularChangeset> = {\n\t\tfieldChanges: p.fieldChanges ?? new Map<FieldKey, FieldChange>(),\n\t\tnodeChanges: p.nodeChanges ?? newChangeAtomIdBTree(),\n\t\tnodeToParent: p.nodeToParent ?? newChangeAtomIdBTree(),\n\t\tnodeAliases: p.nodeAliases ?? newChangeAtomIdBTree(),\n\t\tcrossFieldKeys: p.crossFieldKeys ?? newCrossFieldKeyTable(),\n\t};\n\n\tif (p.revisions !== undefined && p.revisions.length > 0) {\n\t\tchangeset.revisions = p.revisions;\n\t}\n\tif (p.maxId >= 0) {\n\t\tchangeset.maxId = brand(p.maxId);\n\t}\n\tif (p.constraintViolationCount !== undefined && p.constraintViolationCount > 0) {\n\t\tchangeset.constraintViolationCount = p.constraintViolationCount;\n\t}\n\tif (p.noChangeConstraint !== undefined) {\n\t\tchangeset.noChangeConstraint = p.noChangeConstraint;\n\t}\n\tif (p.noChangeConstraintOnRevert !== undefined) {\n\t\tchangeset.noChangeConstraintOnRevert = p.noChangeConstraintOnRevert;\n\t}\n\tif (p.builds !== undefined && p.builds.size > 0) {\n\t\tchangeset.builds = p.builds;\n\t}\n\tif (p.destroys !== undefined && p.destroys.size > 0) {\n\t\tchangeset.destroys = p.destroys;\n\t}\n\tif (p.refreshers !== undefined && p.refreshers.size > 0) {\n\t\tchangeset.refreshers = p.refreshers;\n\t}\n\treturn changeset;\n}\n\n// TODO: TFieldData could instead just be a numeric ID generated by the CrossFieldTable\n// The CrossFieldTable could have a generic field ID to context table\nexport interface CrossFieldTable<TFieldData> {\n\tsrcTable: CrossFieldMap<unknown>;\n\tdstTable: CrossFieldMap<unknown>;\n\tsrcDependents: CrossFieldMap<TFieldData>;\n\tdstDependents: CrossFieldMap<TFieldData>;\n\tinvalidatedFields: Set<TFieldData>;\n}\n\nexport abstract class CrossFieldManagerI<T> implements CrossFieldManager {\n\tpublic constructor(\n\t\tprotected readonly crossFieldTable: CrossFieldTable<T>,\n\t\tprivate readonly currentFieldKey: T,\n\t\tprotected readonly allowInval = true,\n\t) {}\n\n\tpublic set(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\tnewValue: unknown,\n\t\tinvalidateDependents: boolean,\n\t): void {\n\t\tif (invalidateDependents && this.allowInval) {\n\t\t\tconst lastChangedId = (id as number) + count - 1;\n\t\t\tlet firstId = id;\n\t\t\twhile (firstId <= lastChangedId) {\n\t\t\t\tconst dependentEntry = getFirstFromCrossFieldMap(\n\t\t\t\t\tthis.getDependents(target),\n\t\t\t\t\trevision,\n\t\t\t\t\tfirstId,\n\t\t\t\t\tlastChangedId - firstId + 1,\n\t\t\t\t);\n\t\t\t\tif (dependentEntry.value !== undefined) {\n\t\t\t\t\tthis.crossFieldTable.invalidatedFields.add(dependentEntry.value);\n\t\t\t\t}\n\n\t\t\t\tfirstId = brand(firstId + dependentEntry.length);\n\t\t\t}\n\t\t}\n\t\tsetInCrossFieldMap(this.getMap(target), revision, id, count, newValue);\n\t}\n\n\tpublic get(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\taddDependency: boolean,\n\t): RangeQueryResult<unknown> {\n\t\tif (addDependency) {\n\t\t\t// We assume that if there is already an entry for this ID it is because\n\t\t\t// a field handler has called compose on the same node multiple times.\n\t\t\t// In this case we only want to update the latest version, so we overwrite the dependency.\n\t\t\tsetInCrossFieldMap(\n\t\t\t\tthis.getDependents(target),\n\t\t\t\trevision,\n\t\t\t\tid,\n\t\t\t\tcount,\n\t\t\t\tthis.currentFieldKey,\n\t\t\t);\n\t\t}\n\t\treturn getFirstFromCrossFieldMap(this.getMap(target), revision, id, count);\n\t}\n\n\tpublic abstract onMoveIn(id: NodeId): void;\n\n\tpublic abstract moveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void;\n\n\tprivate getMap(target: CrossFieldTarget): CrossFieldMap<unknown> {\n\t\treturn target === CrossFieldTarget.Source\n\t\t\t? this.crossFieldTable.srcTable\n\t\t\t: this.crossFieldTable.dstTable;\n\t}\n\n\tprivate getDependents(target: CrossFieldTarget): CrossFieldMap<T> {\n\t\treturn target === CrossFieldTarget.Source\n\t\t\t? this.crossFieldTable.srcDependents\n\t\t\t: this.crossFieldTable.dstDependents;\n\t}\n}\n\nexport function newCrossFieldTable<T>(): CrossFieldTable<T> {\n\treturn {\n\t\tsrcTable: newChangeAtomIdRangeMap(),\n\t\tdstTable: newChangeAtomIdRangeMap(),\n\t\tsrcDependents: newChangeAtomIdRangeMap(),\n\t\tdstDependents: newChangeAtomIdRangeMap(),\n\t\tinvalidatedFields: new Set(),\n\t};\n}\n\nexport function getRevInfoFromTaggedChanges(changes: TaggedChange<ModularChangeset>[]): {\n\trevInfos: RevisionInfo[];\n\tmaxId: ChangesetLocalId;\n} {\n\tlet maxId = -1;\n\tconst revInfos: RevisionInfo[] = [];\n\tconst revisions = new Set<RevisionTag>();\n\tfor (const taggedChange of changes) {\n\t\tconst change = taggedChange.change;\n\t\tmaxId = Math.max(change.maxId ?? -1, maxId);\n\t\tconst infosToAdd = revisionInfoFromTaggedChange(taggedChange);\n\t\tfor (const info of infosToAdd) {\n\t\t\tif (!revisions.has(info.revision)) {\n\t\t\t\trevisions.add(info.revision);\n\t\t\t\trevInfos.push(info);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst rolledBackRevisions: RevisionTag[] = [];\n\tfor (const info of revInfos) {\n\t\tif (info.rollbackOf !== undefined) {\n\t\t\trolledBackRevisions.push(info.rollbackOf);\n\t\t}\n\t}\n\n\trolledBackRevisions.reverse();\n\tfor (const revision of rolledBackRevisions) {\n\t\tif (!revisions.has(revision)) {\n\t\t\trevInfos.push({ revision });\n\t\t}\n\t}\n\n\treturn { maxId: brand(maxId), revInfos };\n}\n\nexport function revisionInfoFromTaggedChange(\n\ttaggedChange: TaggedChange<ModularChangeset>,\n): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tif (taggedChange.change.revisions !== undefined) {\n\t\trevInfos.push(...taggedChange.change.revisions);\n\t} else if (taggedChange.revision !== undefined) {\n\t\tconst info: Mutable<RevisionInfo> = { revision: taggedChange.revision };\n\t\tif (taggedChange.rollbackOf !== undefined) {\n\t\t\tinfo.rollbackOf = taggedChange.rollbackOf;\n\t\t}\n\t\trevInfos.push(info);\n\t}\n\treturn revInfos;\n}\n\nexport function getChangeHandler(\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\tkind: FieldKindIdentifier,\n): FieldChangeHandler<unknown> {\n\treturn getFieldKind(fieldKinds, kind).changeHandler;\n}\n\nfunction getFieldKind(\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\tkind: FieldKindIdentifier,\n): FlexFieldKind {\n\tif (kind === genericFieldKind.identifier) {\n\t\treturn genericFieldKind;\n\t}\n\tconst fieldKind = fieldKinds.get(kind);\n\tassert(fieldKind !== undefined, 0x3ad /* Unknown field kind */);\n\treturn fieldKind;\n}\n\nexport interface ConstraintState {\n\tviolationCount: number;\n}\n\nexport function newConstraintState(violationCount: number): ConstraintState {\n\treturn {\n\t\tviolationCount,\n\t};\n}\n\nexport function updateConstraintsForFields(\n\tfields: FieldChangeMap,\n\tparentInputAttachState: NodeAttachState,\n\tconstraintState: ConstraintState,\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): void {\n\tfor (const field of fields.values()) {\n\t\tconst handler = getChangeHandler(fieldKinds, field.fieldKind);\n\t\tfor (const [nodeId, inputIndex, _outputIndex] of handler.getNestedChanges(field.change)) {\n\t\t\tconst isInputDetached = inputIndex === undefined;\n\t\t\tconst inputAttachState =\n\t\t\t\tparentInputAttachState === NodeAttachState.Detached || isInputDetached\n\t\t\t\t\t? NodeAttachState.Detached\n\t\t\t\t\t: NodeAttachState.Attached;\n\n\t\t\tupdateConstraintsForNode(nodeId, inputAttachState, nodes, constraintState, fieldKinds);\n\t\t}\n\t}\n}\n\nfunction updateConstraintsForNode(\n\tnodeId: NodeId,\n\tinputAttachState: NodeAttachState,\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tconstraintState: ConstraintState,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): void {\n\tconst node =\n\t\tnodes.get([nodeId.revision, nodeId.localId]) ?? fail(0xb24 /* Unknown node ID */);\n\tif (node.nodeExistsConstraint !== undefined) {\n\t\tconst isNowViolated = inputAttachState === NodeAttachState.Detached;\n\t\tif (node.nodeExistsConstraint.violated !== isNowViolated) {\n\t\t\tnode.nodeExistsConstraint = {\n\t\t\t\t...node.nodeExistsConstraint,\n\t\t\t\tviolated: isNowViolated,\n\t\t\t};\n\t\t\tconstraintState.violationCount += isNowViolated ? 1 : -1;\n\t\t}\n\t}\n\n\tif (node.fieldChanges !== undefined) {\n\t\tupdateConstraintsForFields(\n\t\t\tnode.fieldChanges,\n\t\t\tinputAttachState,\n\t\t\tconstraintState,\n\t\t\tnodes,\n\t\t\tfieldKinds,\n\t\t);\n\t}\n}\n\nexport function nodeChangeFromId(\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tid: NodeId,\n): NodeChangeset {\n\tconst node = getFromChangeAtomIdMap(nodes, id);\n\tassert(node !== undefined, 0x9ca /* Unknown node ID */);\n\treturn node;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { FieldKindIdentifier } from "../../core/index.js";
|
|
6
|
+
import { type ChangeAtomIdBTree } from "../changeAtomIdBTree.js";
|
|
7
|
+
import type { FlexFieldKind } from "./fieldKind.js";
|
|
8
|
+
import type { FieldChangeMap, NodeChangeset } from "./modularChangeTypes.js";
|
|
9
|
+
export declare function pruneFieldMap(changeset: FieldChangeMap | undefined, nodeMap: ChangeAtomIdBTree<NodeChangeset>, fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>): FieldChangeMap | undefined;
|
|
10
|
+
//# sourceMappingURL=prune.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/prune.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAU,MAAM,yBAAyB,CAAC;AAGrF,wBAAgB,aAAa,CAC5B,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,EACzC,UAAU,EAAE,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC,GACzD,cAAc,GAAG,SAAS,CAmB5B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.pruneFieldMap = void 0;
|
|
8
|
+
const index_js_1 = require("../../util/index.js");
|
|
9
|
+
const changeAtomIdBTree_js_1 = require("../changeAtomIdBTree.js");
|
|
10
|
+
const modularChangeUtils_js_1 = require("./modularChangeUtils.js");
|
|
11
|
+
function pruneFieldMap(changeset, nodeMap, fieldKinds) {
|
|
12
|
+
if (changeset === undefined) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const prunedChangeset = new Map();
|
|
16
|
+
for (const [field, fieldChange] of changeset) {
|
|
17
|
+
const handler = (0, modularChangeUtils_js_1.getChangeHandler)(fieldKinds, fieldChange.fieldKind);
|
|
18
|
+
const prunedFieldChangeset = handler.rebaser.prune(fieldChange.change, (nodeId) => pruneNodeChange(nodeId, nodeMap, fieldKinds));
|
|
19
|
+
if (!handler.isEmpty(prunedFieldChangeset)) {
|
|
20
|
+
prunedChangeset.set(field, { ...fieldChange, change: (0, index_js_1.brand)(prunedFieldChangeset) });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return prunedChangeset.size > 0 ? prunedChangeset : undefined;
|
|
24
|
+
}
|
|
25
|
+
exports.pruneFieldMap = pruneFieldMap;
|
|
26
|
+
function pruneNodeChange(nodeId, nodeMap, fieldKinds) {
|
|
27
|
+
const changeset = (0, modularChangeUtils_js_1.nodeChangeFromId)(nodeMap, nodeId);
|
|
28
|
+
const prunedFields = changeset.fieldChanges === undefined
|
|
29
|
+
? undefined
|
|
30
|
+
: pruneFieldMap(changeset.fieldChanges, nodeMap, fieldKinds);
|
|
31
|
+
const prunedChange = { ...changeset, fieldChanges: prunedFields };
|
|
32
|
+
if (prunedChange.fieldChanges === undefined) {
|
|
33
|
+
delete prunedChange.fieldChanges;
|
|
34
|
+
}
|
|
35
|
+
if (isEmptyNodeChangeset(prunedChange)) {
|
|
36
|
+
nodeMap.delete([nodeId.revision, nodeId.localId]);
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
(0, changeAtomIdBTree_js_1.setInChangeAtomIdMap)(nodeMap, nodeId, prunedChange);
|
|
41
|
+
return nodeId;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function isEmptyNodeChangeset(change) {
|
|
45
|
+
return (change.fieldChanges === undefined &&
|
|
46
|
+
change.nodeExistsConstraint === undefined &&
|
|
47
|
+
change.nodeExistsConstraintOnRevert === undefined);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/prune.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kDAA4C;AAC5C,kEAAuF;AAGvF,mEAA6E;AAE7E,SAAgB,aAAa,CAC5B,SAAqC,EACrC,OAAyC,EACzC,UAA2D;IAE3D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,eAAe,GAAmB,IAAI,GAAG,EAAE,CAAC;IAClD,KAAK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C,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QAClD,OAAO,SAAS,CAAC;IAClB,CAAC;SAAM,CAAC;QACP,IAAA,2CAAoB,EAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC;IACf,CAAC;AACF,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAqB;IAClD,OAAO,CACN,MAAM,CAAC,YAAY,KAAK,SAAS;QACjC,MAAM,CAAC,oBAAoB,KAAK,SAAS;QACzC,MAAM,CAAC,4BAA4B,KAAK,SAAS,CACjD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FieldKindIdentifier } from \"../../core/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport { setInChangeAtomIdMap, type ChangeAtomIdBTree } from \"../changeAtomIdBTree.js\";\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport type { FieldChangeMap, NodeChangeset, NodeId } from \"./modularChangeTypes.js\";\nimport { getChangeHandler, nodeChangeFromId } from \"./modularChangeUtils.js\";\n\nexport function pruneFieldMap(\n\tchangeset: FieldChangeMap | undefined,\n\tnodeMap: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): FieldChangeMap | undefined {\n\tif (changeset === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst prunedChangeset: FieldChangeMap = new Map();\n\tfor (const [field, fieldChange] of changeset) {\n\t\tconst handler = getChangeHandler(fieldKinds, fieldChange.fieldKind);\n\n\t\tconst prunedFieldChangeset = handler.rebaser.prune(fieldChange.change, (nodeId) =>\n\t\t\tpruneNodeChange(nodeId, nodeMap, fieldKinds),\n\t\t);\n\n\t\tif (!handler.isEmpty(prunedFieldChangeset)) {\n\t\t\tprunedChangeset.set(field, { ...fieldChange, change: brand(prunedFieldChangeset) });\n\t\t}\n\t}\n\n\treturn prunedChangeset.size > 0 ? prunedChangeset : undefined;\n}\n\nfunction pruneNodeChange(\n\tnodeId: NodeId,\n\tnodeMap: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): NodeId | undefined {\n\tconst changeset = nodeChangeFromId(nodeMap, nodeId);\n\tconst prunedFields =\n\t\tchangeset.fieldChanges === undefined\n\t\t\t? undefined\n\t\t\t: pruneFieldMap(changeset.fieldChanges, nodeMap, fieldKinds);\n\n\tconst prunedChange = { ...changeset, fieldChanges: prunedFields };\n\tif (prunedChange.fieldChanges === undefined) {\n\t\tdelete prunedChange.fieldChanges;\n\t}\n\n\tif (isEmptyNodeChangeset(prunedChange)) {\n\t\tnodeMap.delete([nodeId.revision, nodeId.localId]);\n\t\treturn undefined;\n\t} else {\n\t\tsetInChangeAtomIdMap(nodeMap, nodeId, prunedChange);\n\t\treturn nodeId;\n\t}\n}\n\nfunction isEmptyNodeChangeset(change: NodeChangeset): boolean {\n\treturn (\n\t\tchange.fieldChanges === undefined &&\n\t\tchange.nodeExistsConstraint === undefined &&\n\t\tchange.nodeExistsConstraintOnRevert === undefined\n\t);\n}\n"]}
|
|
@@ -564,7 +564,7 @@ function filterEdits(change, options) {
|
|
|
564
564
|
const attachId = filtered.valueReplace.src;
|
|
565
565
|
const attachResult = attachId === undefined ? undefined : options.filterAttach(attachId, 1).value;
|
|
566
566
|
if (detachResult === index_js_3.EditFilterStatus.Remove) {
|
|
567
|
-
(0, internal_1.assert)(attachId === undefined || attachResult === index_js_3.EditFilterStatus.Remove,
|
|
567
|
+
(0, internal_1.assert)(attachId === undefined || attachResult === index_js_3.EditFilterStatus.Remove, 0xd0e /* Cannot remove detach without also removing attach */);
|
|
568
568
|
delete filtered.valueReplace;
|
|
569
569
|
}
|
|
570
570
|
else if (attachResult === index_js_3.EditFilterStatus.Remove) {
|