@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,338 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import {
|
|
8
|
+
revisionMetadataSourceFromInfo,
|
|
9
|
+
type ChangeAtomId,
|
|
10
|
+
type ChangesetLocalId,
|
|
11
|
+
type FieldKindIdentifier,
|
|
12
|
+
type RevisionInfo,
|
|
13
|
+
type RevisionMetadataSource,
|
|
14
|
+
type RevisionTag,
|
|
15
|
+
type TaggedChange,
|
|
16
|
+
type TreeChunk,
|
|
17
|
+
} from "../../core/index.js";
|
|
18
|
+
import { brand, idAllocatorFromMaxId, type IdAllocator } from "../../util/index.js";
|
|
19
|
+
import {
|
|
20
|
+
newChangeAtomIdBTree,
|
|
21
|
+
setInChangeAtomIdMap,
|
|
22
|
+
type ChangeAtomIdBTree,
|
|
23
|
+
} from "../changeAtomIdBTree.js";
|
|
24
|
+
import {
|
|
25
|
+
newCrossFieldKeyTable,
|
|
26
|
+
type CrossFieldKeyTable,
|
|
27
|
+
type FieldChange,
|
|
28
|
+
type FieldChangeMap,
|
|
29
|
+
type FieldId,
|
|
30
|
+
type ModularChangeset,
|
|
31
|
+
type NodeChangeset,
|
|
32
|
+
type NodeId,
|
|
33
|
+
} from "./modularChangeTypes.js";
|
|
34
|
+
import {
|
|
35
|
+
CrossFieldManagerI,
|
|
36
|
+
getChangeHandler,
|
|
37
|
+
getRevInfoFromTaggedChanges,
|
|
38
|
+
hasConflicts,
|
|
39
|
+
makeModularChangeset,
|
|
40
|
+
newConstraintState,
|
|
41
|
+
newCrossFieldTable,
|
|
42
|
+
updateConstraintsForFields,
|
|
43
|
+
type CrossFieldTable,
|
|
44
|
+
} from "./modularChangeUtils.js";
|
|
45
|
+
import type { CrossFieldTarget } from "./crossFieldQueries.js";
|
|
46
|
+
import type { FlexFieldKind } from "./fieldKind.js";
|
|
47
|
+
import { NodeAttachState } from "./fieldChangeHandler.js";
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param change - The change to invert.
|
|
51
|
+
* @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when
|
|
52
|
+
* performing a sandwich rebase.
|
|
53
|
+
* @param revisionForInvert - The revision for the invert changeset.
|
|
54
|
+
*/
|
|
55
|
+
export function invertModularChange(
|
|
56
|
+
change: TaggedChange<ModularChangeset>,
|
|
57
|
+
isRollback: boolean,
|
|
58
|
+
revisionForInvert: RevisionTag,
|
|
59
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
60
|
+
): ModularChangeset {
|
|
61
|
+
// Rollback changesets destroy the nodes created by the change being rolled back.
|
|
62
|
+
const destroys = isRollback ? invertBuilds(change.change.builds) : undefined;
|
|
63
|
+
|
|
64
|
+
// Destroys only occur in rollback changesets, which are never inverted.
|
|
65
|
+
assert(
|
|
66
|
+
change.change.destroys === undefined,
|
|
67
|
+
0x89a /* Unexpected destroys in change to invert */,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const revInfos: RevisionInfo[] = isRollback
|
|
71
|
+
? [{ revision: revisionForInvert, rollbackOf: change.revision }]
|
|
72
|
+
: [{ revision: revisionForInvert }];
|
|
73
|
+
|
|
74
|
+
const noChangeConstraint = change.change.noChangeConstraintOnRevert;
|
|
75
|
+
const noChangeConstraintOnRevert = change.change.noChangeConstraint;
|
|
76
|
+
|
|
77
|
+
if (hasConflicts(change.change)) {
|
|
78
|
+
return makeModularChangeset({
|
|
79
|
+
maxId: change.change.maxId as number,
|
|
80
|
+
revisions: revInfos,
|
|
81
|
+
destroys,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const genId: IdAllocator = idAllocatorFromMaxId(change.change.maxId ?? -1);
|
|
86
|
+
|
|
87
|
+
const crossFieldTable: InvertTable = {
|
|
88
|
+
...newCrossFieldTable<FieldChange>(),
|
|
89
|
+
originalFieldToContext: new Map(),
|
|
90
|
+
invertedNodeToParent: brand(change.change.nodeToParent.clone()),
|
|
91
|
+
};
|
|
92
|
+
const { revInfos: oldRevInfos } = getRevInfoFromTaggedChanges([change]);
|
|
93
|
+
const revisionMetadata = revisionMetadataSourceFromInfo(oldRevInfos);
|
|
94
|
+
|
|
95
|
+
const invertedFields = invertFieldMap(
|
|
96
|
+
change.change.fieldChanges,
|
|
97
|
+
undefined,
|
|
98
|
+
isRollback,
|
|
99
|
+
genId,
|
|
100
|
+
crossFieldTable,
|
|
101
|
+
revisionMetadata,
|
|
102
|
+
revisionForInvert,
|
|
103
|
+
fieldKinds,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const invertedNodes = newChangeAtomIdBTree<NodeChangeset>();
|
|
107
|
+
change.change.nodeChanges.forEachPair(([revision, localId], nodeChangeset) => {
|
|
108
|
+
invertedNodes.set(
|
|
109
|
+
[revision, localId],
|
|
110
|
+
invertNodeChange(
|
|
111
|
+
nodeChangeset,
|
|
112
|
+
{ revision, localId },
|
|
113
|
+
isRollback,
|
|
114
|
+
genId,
|
|
115
|
+
crossFieldTable,
|
|
116
|
+
revisionMetadata,
|
|
117
|
+
revisionForInvert,
|
|
118
|
+
fieldKinds,
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (crossFieldTable.invalidatedFields.size > 0) {
|
|
124
|
+
const fieldsToUpdate = crossFieldTable.invalidatedFields;
|
|
125
|
+
crossFieldTable.invalidatedFields = new Set();
|
|
126
|
+
for (const fieldChange of fieldsToUpdate) {
|
|
127
|
+
const originalFieldChange = fieldChange.change;
|
|
128
|
+
const context = crossFieldTable.originalFieldToContext.get(fieldChange);
|
|
129
|
+
assert(
|
|
130
|
+
context !== undefined,
|
|
131
|
+
0x851 /* Should have context for every invalidated field */,
|
|
132
|
+
);
|
|
133
|
+
const { invertedField, fieldId } = context;
|
|
134
|
+
|
|
135
|
+
const amendedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(
|
|
136
|
+
originalFieldChange,
|
|
137
|
+
isRollback,
|
|
138
|
+
genId,
|
|
139
|
+
revisionForInvert,
|
|
140
|
+
new InvertManager(crossFieldTable, fieldChange, fieldId),
|
|
141
|
+
revisionMetadata,
|
|
142
|
+
);
|
|
143
|
+
invertedField.change = brand(amendedChange);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const crossFieldKeys = makeCrossFieldKeyTable(invertedFields, invertedNodes, fieldKinds);
|
|
148
|
+
|
|
149
|
+
const constraintState = newConstraintState(0);
|
|
150
|
+
updateConstraintsForFields(
|
|
151
|
+
invertedFields,
|
|
152
|
+
NodeAttachState.Attached,
|
|
153
|
+
constraintState,
|
|
154
|
+
invertedNodes,
|
|
155
|
+
fieldKinds,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
return makeModularChangeset({
|
|
159
|
+
fieldChanges: invertedFields,
|
|
160
|
+
nodeChanges: invertedNodes,
|
|
161
|
+
nodeToParent: crossFieldTable.invertedNodeToParent,
|
|
162
|
+
nodeAliases: change.change.nodeAliases,
|
|
163
|
+
crossFieldKeys,
|
|
164
|
+
maxId: genId.getMaxId(),
|
|
165
|
+
revisions: revInfos,
|
|
166
|
+
constraintViolationCount: constraintState.violationCount,
|
|
167
|
+
noChangeConstraint,
|
|
168
|
+
noChangeConstraintOnRevert,
|
|
169
|
+
destroys,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function invertFieldMap(
|
|
174
|
+
changes: FieldChangeMap,
|
|
175
|
+
parentId: NodeId | undefined,
|
|
176
|
+
isRollback: boolean,
|
|
177
|
+
genId: IdAllocator,
|
|
178
|
+
crossFieldTable: InvertTable,
|
|
179
|
+
revisionMetadata: RevisionMetadataSource,
|
|
180
|
+
revisionForInvert: RevisionTag,
|
|
181
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
182
|
+
): FieldChangeMap {
|
|
183
|
+
const invertedFields: FieldChangeMap = new Map();
|
|
184
|
+
|
|
185
|
+
for (const [field, fieldChange] of changes) {
|
|
186
|
+
const fieldId = { nodeId: parentId, field };
|
|
187
|
+
const manager = new InvertManager(crossFieldTable, fieldChange, fieldId);
|
|
188
|
+
const invertedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(
|
|
189
|
+
fieldChange.change,
|
|
190
|
+
isRollback,
|
|
191
|
+
genId,
|
|
192
|
+
revisionForInvert,
|
|
193
|
+
manager,
|
|
194
|
+
revisionMetadata,
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const invertedFieldChange: FieldChange = {
|
|
198
|
+
...fieldChange,
|
|
199
|
+
change: brand(invertedChange),
|
|
200
|
+
};
|
|
201
|
+
invertedFields.set(field, invertedFieldChange);
|
|
202
|
+
|
|
203
|
+
crossFieldTable.originalFieldToContext.set(fieldChange, {
|
|
204
|
+
fieldId,
|
|
205
|
+
invertedField: invertedFieldChange,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return invertedFields;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function invertNodeChange(
|
|
213
|
+
change: NodeChangeset,
|
|
214
|
+
id: NodeId,
|
|
215
|
+
isRollback: boolean,
|
|
216
|
+
genId: IdAllocator,
|
|
217
|
+
crossFieldTable: InvertTable,
|
|
218
|
+
revisionMetadata: RevisionMetadataSource,
|
|
219
|
+
revisionForInvert: RevisionTag,
|
|
220
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
221
|
+
): NodeChangeset {
|
|
222
|
+
const inverse: NodeChangeset = {};
|
|
223
|
+
|
|
224
|
+
// If the node has a constraint, it should be inverted to a node-exist-on-revert constraint. This ensure that if
|
|
225
|
+
// the inverse is inverted again, the original input constraint will be restored.
|
|
226
|
+
if (change.nodeExistsConstraint !== undefined) {
|
|
227
|
+
inverse.nodeExistsConstraintOnRevert = change.nodeExistsConstraint;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// The node-exist-on-revert constraint of a node is the constraint that should apply when the a change is reverted.
|
|
231
|
+
// So, it should become the constraint in the inverse. If this constraint is violated when applying the inverse,
|
|
232
|
+
// it will be discarded.
|
|
233
|
+
if (change.nodeExistsConstraintOnRevert !== undefined) {
|
|
234
|
+
inverse.nodeExistsConstraint = change.nodeExistsConstraintOnRevert;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (change.fieldChanges !== undefined) {
|
|
238
|
+
inverse.fieldChanges = invertFieldMap(
|
|
239
|
+
change.fieldChanges,
|
|
240
|
+
id,
|
|
241
|
+
isRollback,
|
|
242
|
+
genId,
|
|
243
|
+
crossFieldTable,
|
|
244
|
+
revisionMetadata,
|
|
245
|
+
revisionForInvert,
|
|
246
|
+
fieldKinds,
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return inverse;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function invertBuilds(
|
|
254
|
+
builds: ChangeAtomIdBTree<TreeChunk> | undefined,
|
|
255
|
+
): ChangeAtomIdBTree<number> | undefined {
|
|
256
|
+
if (builds !== undefined) {
|
|
257
|
+
return brand(builds.mapValues((chunk) => chunk.topLevelLength));
|
|
258
|
+
}
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
interface InvertTable extends CrossFieldTable<FieldChange> {
|
|
263
|
+
originalFieldToContext: Map<FieldChange, InvertContext>;
|
|
264
|
+
invertedNodeToParent: ChangeAtomIdBTree<FieldId>;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
interface InvertContext {
|
|
268
|
+
fieldId: FieldId;
|
|
269
|
+
invertedField: FieldChange;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
class InvertManager extends CrossFieldManagerI<FieldChange> {
|
|
273
|
+
public constructor(
|
|
274
|
+
table: InvertTable,
|
|
275
|
+
field: FieldChange,
|
|
276
|
+
private readonly fieldId: FieldId,
|
|
277
|
+
allowInval = true,
|
|
278
|
+
) {
|
|
279
|
+
super(table, field, allowInval);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
public override onMoveIn(id: ChangeAtomId): void {
|
|
283
|
+
setInChangeAtomIdMap(this.table.invertedNodeToParent, id, this.fieldId);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
public override moveKey(
|
|
287
|
+
target: CrossFieldTarget,
|
|
288
|
+
revision: RevisionTag | undefined,
|
|
289
|
+
id: ChangesetLocalId,
|
|
290
|
+
count: number,
|
|
291
|
+
): void {
|
|
292
|
+
assert(false, 0x9c5 /* Keys should not be moved manually during invert */);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private get table(): InvertTable {
|
|
296
|
+
return this.crossFieldTable as InvertTable;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function makeCrossFieldKeyTable(
|
|
301
|
+
fields: FieldChangeMap,
|
|
302
|
+
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
303
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
304
|
+
): CrossFieldKeyTable {
|
|
305
|
+
const keys: CrossFieldKeyTable = newCrossFieldKeyTable();
|
|
306
|
+
populateCrossFieldKeyTableForFieldMap(keys, fields, undefined, fieldKinds);
|
|
307
|
+
nodes.forEachPair(([revision, localId], node) => {
|
|
308
|
+
if (node.fieldChanges !== undefined) {
|
|
309
|
+
populateCrossFieldKeyTableForFieldMap(
|
|
310
|
+
keys,
|
|
311
|
+
node.fieldChanges,
|
|
312
|
+
{
|
|
313
|
+
revision,
|
|
314
|
+
localId,
|
|
315
|
+
},
|
|
316
|
+
fieldKinds,
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
return keys;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function populateCrossFieldKeyTableForFieldMap(
|
|
325
|
+
table: CrossFieldKeyTable,
|
|
326
|
+
fields: FieldChangeMap,
|
|
327
|
+
parent: NodeId | undefined,
|
|
328
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
329
|
+
): void {
|
|
330
|
+
for (const [fieldKey, fieldChange] of fields) {
|
|
331
|
+
const keys = getChangeHandler(fieldKinds, fieldChange.fieldKind).getCrossFieldKeys(
|
|
332
|
+
fieldChange.change,
|
|
333
|
+
);
|
|
334
|
+
for (const { key, count } of keys) {
|
|
335
|
+
table.set(key, count, { nodeId: parent, field: fieldKey });
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
import type { FlexFieldKind } from "./fieldKind.js";
|
|
6
|
+
import type { ModularChangeFamily } from "./modularChangeFamily.js";
|
|
9
7
|
import type { ModularChangeset } from "./modularChangeTypes.js";
|
|
10
8
|
|
|
11
9
|
/**
|
|
@@ -22,11 +20,11 @@ import type { ModularChangeset } from "./modularChangeTypes.js";
|
|
|
22
20
|
* future change.
|
|
23
21
|
*
|
|
24
22
|
* @param change - The change to minimize.
|
|
25
|
-
* @param
|
|
23
|
+
* @param changeFamily - The change family used to compute the change's delta and identify built nodes.
|
|
26
24
|
*/
|
|
27
25
|
export function minimizeModularChangeset(
|
|
28
26
|
change: ModularChangeset,
|
|
29
|
-
|
|
27
|
+
changeFamily: ModularChangeFamily,
|
|
30
28
|
): ModularChangeset {
|
|
31
29
|
// TODO: Actually minimize the change. For now this is a no-op that returns the change unchanged.
|
|
32
30
|
return change;
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "../../codec/index.js";
|
|
17
17
|
import type {
|
|
18
18
|
ChangeEncodingContext,
|
|
19
|
+
ChangeDecodingContext,
|
|
19
20
|
ChangesetLocalId,
|
|
20
21
|
EncodedRevisionTag,
|
|
21
22
|
FieldKey,
|
|
@@ -42,7 +43,11 @@ import {
|
|
|
42
43
|
} from "../chunked-forest/index.js";
|
|
43
44
|
import { TreeCompressionStrategy } from "../treeCompressionUtils.js";
|
|
44
45
|
|
|
45
|
-
import type {
|
|
46
|
+
import type {
|
|
47
|
+
FieldChangeEncodingContext,
|
|
48
|
+
FieldChangeDecodingContext,
|
|
49
|
+
FieldChangeHandler,
|
|
50
|
+
} from "./fieldChangeHandler.js";
|
|
46
51
|
import type {
|
|
47
52
|
FieldKindConfiguration,
|
|
48
53
|
FieldKindConfigurationEntry,
|
|
@@ -71,14 +76,16 @@ type ModularChangeCodec = IJsonCodec<
|
|
|
71
76
|
ModularChangeset,
|
|
72
77
|
EncodedModularChangesetV1,
|
|
73
78
|
EncodedModularChangesetV1,
|
|
74
|
-
ChangeEncodingContext
|
|
79
|
+
ChangeEncodingContext,
|
|
80
|
+
ChangeDecodingContext
|
|
75
81
|
>;
|
|
76
82
|
|
|
77
83
|
type FieldCodec = IJsonCodec<
|
|
78
84
|
FieldChangeset,
|
|
79
85
|
JsonCompatibleReadOnly,
|
|
80
86
|
JsonCompatibleReadOnly,
|
|
81
|
-
FieldChangeEncodingContext
|
|
87
|
+
FieldChangeEncodingContext,
|
|
88
|
+
FieldChangeDecodingContext
|
|
82
89
|
>;
|
|
83
90
|
|
|
84
91
|
type FieldChangesetCodecs = Map<
|
|
@@ -115,8 +122,6 @@ export function encodeFieldChangesForJson(
|
|
|
115
122
|
assert(node !== undefined, 0x92e /* Unknown node ID */);
|
|
116
123
|
return encodeNodeChangesForJson(node, fieldContext, fieldChangesetCodecs);
|
|
117
124
|
},
|
|
118
|
-
|
|
119
|
-
decodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),
|
|
120
125
|
};
|
|
121
126
|
|
|
122
127
|
return encodeFieldChangesForJsonI(change, fieldContext, fieldChangesetCodecs);
|
|
@@ -180,7 +185,7 @@ export function decodeFieldChangesFromJson(
|
|
|
180
185
|
encodedChange: EncodedFieldChangeMap,
|
|
181
186
|
parentId: NodeId | undefined,
|
|
182
187
|
decoded: ModularChangeset,
|
|
183
|
-
context:
|
|
188
|
+
context: ChangeDecodingContext,
|
|
184
189
|
idAllocator: IdAllocator,
|
|
185
190
|
fieldKinds: FieldKindConfiguration,
|
|
186
191
|
fieldChangesetCodecs: FieldChangesetCodecs,
|
|
@@ -200,11 +205,9 @@ export function decodeFieldChangesFromJson(
|
|
|
200
205
|
field: field.fieldKey,
|
|
201
206
|
};
|
|
202
207
|
|
|
203
|
-
const fieldContext:
|
|
208
|
+
const fieldContext: FieldChangeDecodingContext = {
|
|
204
209
|
baseContext: context,
|
|
205
210
|
|
|
206
|
-
encodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),
|
|
207
|
-
|
|
208
211
|
decodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {
|
|
209
212
|
const nodeId: NodeId = {
|
|
210
213
|
revision: context.revision,
|
|
@@ -252,7 +255,7 @@ export function decodeNodeChangesetFromJson(
|
|
|
252
255
|
encodedChange: EncodedNodeChangeset,
|
|
253
256
|
id: NodeId,
|
|
254
257
|
decoded: ModularChangeset,
|
|
255
|
-
context:
|
|
258
|
+
context: ChangeDecodingContext,
|
|
256
259
|
idAllocator: IdAllocator,
|
|
257
260
|
fieldKinds: FieldKindConfiguration,
|
|
258
261
|
fieldChangesetCodecs: FieldChangesetCodecs,
|
|
@@ -337,7 +340,7 @@ export function encodeDetachedNodes(
|
|
|
337
340
|
|
|
338
341
|
export function decodeDetachedNodes(
|
|
339
342
|
encoded: EncodedBuilds | undefined,
|
|
340
|
-
context:
|
|
343
|
+
context: ChangeDecodingContext,
|
|
341
344
|
revisionTagCodec: JsonCodecPart<
|
|
342
345
|
RevisionTag,
|
|
343
346
|
typeof RevisionTagSchema,
|
|
@@ -430,7 +433,7 @@ export function encodeRevisionInfos(
|
|
|
430
433
|
|
|
431
434
|
export function decodeRevisionInfos(
|
|
432
435
|
revisions: readonly EncodedRevisionInfo[] | undefined,
|
|
433
|
-
context:
|
|
436
|
+
context: ChangeDecodingContext,
|
|
434
437
|
revisionTagCodec: JsonCodecPart<
|
|
435
438
|
RevisionTag,
|
|
436
439
|
typeof RevisionTagSchema,
|
|
@@ -509,7 +512,7 @@ export function encodeChange(
|
|
|
509
512
|
|
|
510
513
|
export function decodeChange(
|
|
511
514
|
encodedChange: EncodedModularChangesetV1,
|
|
512
|
-
context:
|
|
515
|
+
context: ChangeDecodingContext,
|
|
513
516
|
fieldKinds: FieldKindConfiguration,
|
|
514
517
|
fieldChangesetCodecs: Map<
|
|
515
518
|
FieldKindIdentifier,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "../../codec/index.js";
|
|
12
12
|
import type {
|
|
13
13
|
ChangeEncodingContext,
|
|
14
|
+
ChangeDecodingContext,
|
|
14
15
|
RevisionTag,
|
|
15
16
|
RevisionTagSchema,
|
|
16
17
|
} from "../../core/index.js";
|
|
@@ -30,7 +31,8 @@ type ModularChangeCodec = IJsonCodec<
|
|
|
30
31
|
ModularChangeset,
|
|
31
32
|
EncodedModularChangesetV2,
|
|
32
33
|
EncodedModularChangesetV2,
|
|
33
|
-
ChangeEncodingContext
|
|
34
|
+
ChangeEncodingContext,
|
|
35
|
+
ChangeDecodingContext
|
|
34
36
|
>;
|
|
35
37
|
|
|
36
38
|
export function makeModularChangeCodecV2(
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../../codec/index.js";
|
|
14
14
|
import type {
|
|
15
15
|
ChangeEncodingContext,
|
|
16
|
+
ChangeDecodingContext,
|
|
16
17
|
RevisionTag,
|
|
17
18
|
RevisionTagSchema,
|
|
18
19
|
} from "../../core/index.js";
|
|
@@ -35,7 +36,7 @@ export function makeModularChangeCodecFamily(
|
|
|
35
36
|
fieldsCodec: FieldBatchCodec,
|
|
36
37
|
codecOptions: ICodecOptions,
|
|
37
38
|
chunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,
|
|
38
|
-
): ICodecFamily<ModularChangeset, ChangeEncodingContext> {
|
|
39
|
+
): ICodecFamily<ModularChangeset, ChangeEncodingContext, ChangeDecodingContext> {
|
|
39
40
|
return makeCodecFamily(
|
|
40
41
|
Array.from(fieldKindConfigurations.entries(), ([version, fieldKinds]) => {
|
|
41
42
|
switch (version) {
|