@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
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
} from "../../codec/index.js";
|
|
16
16
|
import {
|
|
17
17
|
type ChangeEncodingContext,
|
|
18
|
+
type ChangeDecodingContext,
|
|
18
19
|
type ChangeFamily,
|
|
19
|
-
type ChangeFamilyEditor,
|
|
20
20
|
type ChangeRebaser,
|
|
21
21
|
type ChangesetLocalId,
|
|
22
22
|
type DeltaDetachedNodeBuild,
|
|
@@ -41,13 +41,13 @@ import {
|
|
|
41
41
|
areEqualChangeAtomIdOpts,
|
|
42
42
|
tagChange,
|
|
43
43
|
makeAnonChange,
|
|
44
|
-
newChangeAtomIdRangeMap,
|
|
45
44
|
type DeltaDetachedNodeChanges,
|
|
46
45
|
type DeltaDetachedNodeRename,
|
|
47
46
|
mapTaggedChange,
|
|
48
47
|
type RevisionReplacer,
|
|
49
48
|
comparePartialRevisions,
|
|
50
49
|
comparePartialChangesetLocalIds,
|
|
50
|
+
type ProcessChangeFn,
|
|
51
51
|
} from "../../core/index.js";
|
|
52
52
|
import {
|
|
53
53
|
type IdAllocationState,
|
|
@@ -74,13 +74,7 @@ import {
|
|
|
74
74
|
} from "../changeAtomIdBTree.js";
|
|
75
75
|
import type { TreeChunk } from "../chunked-forest/index.js";
|
|
76
76
|
|
|
77
|
-
import {
|
|
78
|
-
type CrossFieldManager,
|
|
79
|
-
type CrossFieldMap,
|
|
80
|
-
CrossFieldTarget,
|
|
81
|
-
getFirstFromCrossFieldMap,
|
|
82
|
-
setInCrossFieldMap,
|
|
83
|
-
} from "./crossFieldQueries.js";
|
|
77
|
+
import type { CrossFieldTarget } from "./crossFieldQueries.js";
|
|
84
78
|
import {
|
|
85
79
|
EditFilterStatus,
|
|
86
80
|
type FieldChangeHandler,
|
|
@@ -100,10 +94,24 @@ import {
|
|
|
100
94
|
type FieldId,
|
|
101
95
|
type ModularChangeset,
|
|
102
96
|
newCrossFieldKeyTable,
|
|
103
|
-
type NoChangeConstraint,
|
|
104
97
|
type NodeChangeset,
|
|
105
98
|
type NodeId,
|
|
106
99
|
} from "./modularChangeTypes.js";
|
|
100
|
+
import {
|
|
101
|
+
CrossFieldManagerI,
|
|
102
|
+
getChangeHandler,
|
|
103
|
+
getRevInfoFromTaggedChanges,
|
|
104
|
+
hasConflicts,
|
|
105
|
+
makeModularChangeset,
|
|
106
|
+
newConstraintState,
|
|
107
|
+
newCrossFieldTable,
|
|
108
|
+
nodeChangeFromId,
|
|
109
|
+
revisionInfoFromTaggedChange,
|
|
110
|
+
updateConstraintsForFields,
|
|
111
|
+
type CrossFieldTable,
|
|
112
|
+
} from "./modularChangeUtils.js";
|
|
113
|
+
import { invertModularChange } from "./invert.js";
|
|
114
|
+
import { pruneFieldMap } from "./prune.js";
|
|
107
115
|
|
|
108
116
|
/**
|
|
109
117
|
* Implementation of ChangeFamily which delegates work in a given field to the appropriate FieldKind
|
|
@@ -111,7 +119,7 @@ import {
|
|
|
111
119
|
*/
|
|
112
120
|
export class ModularChangeFamily
|
|
113
121
|
implements
|
|
114
|
-
ChangeFamily<ModularEditBuilder, ModularChangeset>,
|
|
122
|
+
ChangeFamily<ModularEditBuilder, ModularChangeset, ModularChangeFamily>,
|
|
115
123
|
ChangeRebaser<ModularChangeset>
|
|
116
124
|
{
|
|
117
125
|
public static readonly emptyChange: ModularChangeset = makeModularChangeset();
|
|
@@ -120,7 +128,11 @@ export class ModularChangeFamily
|
|
|
120
128
|
|
|
121
129
|
public constructor(
|
|
122
130
|
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
123
|
-
public readonly codecs: ICodecFamily<
|
|
131
|
+
public readonly codecs: ICodecFamily<
|
|
132
|
+
ModularChangeset,
|
|
133
|
+
ChangeEncodingContext,
|
|
134
|
+
ChangeDecodingContext
|
|
135
|
+
>,
|
|
124
136
|
public readonly codecOptions: CodecWriteOptions,
|
|
125
137
|
) {
|
|
126
138
|
this.fieldKinds = fieldKinds;
|
|
@@ -130,6 +142,12 @@ export class ModularChangeFamily
|
|
|
130
142
|
return this;
|
|
131
143
|
}
|
|
132
144
|
|
|
145
|
+
public buildProcessor(
|
|
146
|
+
processFn: ProcessChangeFn<ModularChangeset, ModularChangeFamily>,
|
|
147
|
+
): (change: ModularChangeset) => ModularChangeset {
|
|
148
|
+
return (change: ModularChangeset) => processFn(change, this);
|
|
149
|
+
}
|
|
150
|
+
|
|
133
151
|
/**
|
|
134
152
|
* Produces an equivalent list of `FieldChangeset`s that all target the same {@link FlexFieldKind}.
|
|
135
153
|
* @param changes - The list of `FieldChange`s whose `FieldChangeset`s needs to be normalized.
|
|
@@ -161,8 +179,8 @@ export class ModularChangeFamily
|
|
|
161
179
|
change2: change2.change,
|
|
162
180
|
};
|
|
163
181
|
}
|
|
164
|
-
|
|
165
|
-
const changeHandler =
|
|
182
|
+
|
|
183
|
+
const changeHandler = getChangeHandler(this.fieldKinds, kind);
|
|
166
184
|
const normalizedChange1 = this.normalizeFieldChange(change1, changeHandler);
|
|
167
185
|
const normalizedChange2 = this.normalizeFieldChange(change2, changeHandler);
|
|
168
186
|
return {
|
|
@@ -683,207 +701,12 @@ export class ModularChangeFamily
|
|
|
683
701
|
return composedNodeChange;
|
|
684
702
|
}
|
|
685
703
|
|
|
686
|
-
/**
|
|
687
|
-
* @param change - The change to invert.
|
|
688
|
-
* @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when
|
|
689
|
-
* performing a sandwich rebase.
|
|
690
|
-
* @param revisionForInvert - The revision for the invert changeset.
|
|
691
|
-
*/
|
|
692
704
|
public invert(
|
|
693
705
|
change: TaggedChange<ModularChangeset>,
|
|
694
706
|
isRollback: boolean,
|
|
695
707
|
revisionForInvert: RevisionTag,
|
|
696
708
|
): ModularChangeset {
|
|
697
|
-
|
|
698
|
-
const destroys = isRollback ? invertBuilds(change.change.builds) : undefined;
|
|
699
|
-
|
|
700
|
-
// Destroys only occur in rollback changesets, which are never inverted.
|
|
701
|
-
assert(
|
|
702
|
-
change.change.destroys === undefined,
|
|
703
|
-
0x89a /* Unexpected destroys in change to invert */,
|
|
704
|
-
);
|
|
705
|
-
|
|
706
|
-
const revInfos: RevisionInfo[] = isRollback
|
|
707
|
-
? [{ revision: revisionForInvert, rollbackOf: change.revision }]
|
|
708
|
-
: [{ revision: revisionForInvert }];
|
|
709
|
-
|
|
710
|
-
const noChangeConstraint = change.change.noChangeConstraintOnRevert;
|
|
711
|
-
const noChangeConstraintOnRevert = change.change.noChangeConstraint;
|
|
712
|
-
|
|
713
|
-
if (hasConflicts(change.change)) {
|
|
714
|
-
return makeModularChangeset({
|
|
715
|
-
maxId: change.change.maxId as number,
|
|
716
|
-
revisions: revInfos,
|
|
717
|
-
destroys,
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
const genId: IdAllocator = idAllocatorFromMaxId(change.change.maxId ?? -1);
|
|
722
|
-
|
|
723
|
-
const crossFieldTable: InvertTable = {
|
|
724
|
-
...newCrossFieldTable<FieldChange>(),
|
|
725
|
-
originalFieldToContext: new Map(),
|
|
726
|
-
invertedNodeToParent: brand(change.change.nodeToParent.clone()),
|
|
727
|
-
};
|
|
728
|
-
const { revInfos: oldRevInfos } = getRevInfoFromTaggedChanges([change]);
|
|
729
|
-
const revisionMetadata = revisionMetadataSourceFromInfo(oldRevInfos);
|
|
730
|
-
|
|
731
|
-
const invertedFields = this.invertFieldMap(
|
|
732
|
-
change.change.fieldChanges,
|
|
733
|
-
undefined,
|
|
734
|
-
isRollback,
|
|
735
|
-
genId,
|
|
736
|
-
crossFieldTable,
|
|
737
|
-
revisionMetadata,
|
|
738
|
-
revisionForInvert,
|
|
739
|
-
);
|
|
740
|
-
|
|
741
|
-
const invertedNodes = newChangeAtomIdBTree<NodeChangeset>();
|
|
742
|
-
change.change.nodeChanges.forEachPair(([revision, localId], nodeChangeset) => {
|
|
743
|
-
invertedNodes.set(
|
|
744
|
-
[revision, localId],
|
|
745
|
-
this.invertNodeChange(
|
|
746
|
-
nodeChangeset,
|
|
747
|
-
{ revision, localId },
|
|
748
|
-
isRollback,
|
|
749
|
-
genId,
|
|
750
|
-
crossFieldTable,
|
|
751
|
-
revisionMetadata,
|
|
752
|
-
revisionForInvert,
|
|
753
|
-
),
|
|
754
|
-
);
|
|
755
|
-
});
|
|
756
|
-
|
|
757
|
-
if (crossFieldTable.invalidatedFields.size > 0) {
|
|
758
|
-
const fieldsToUpdate = crossFieldTable.invalidatedFields;
|
|
759
|
-
crossFieldTable.invalidatedFields = new Set();
|
|
760
|
-
for (const fieldChange of fieldsToUpdate) {
|
|
761
|
-
const originalFieldChange = fieldChange.change;
|
|
762
|
-
const context = crossFieldTable.originalFieldToContext.get(fieldChange);
|
|
763
|
-
assert(
|
|
764
|
-
context !== undefined,
|
|
765
|
-
0x851 /* Should have context for every invalidated field */,
|
|
766
|
-
);
|
|
767
|
-
const { invertedField, fieldId } = context;
|
|
768
|
-
|
|
769
|
-
const amendedChange = getChangeHandler(
|
|
770
|
-
this.fieldKinds,
|
|
771
|
-
fieldChange.fieldKind,
|
|
772
|
-
).rebaser.invert(
|
|
773
|
-
originalFieldChange,
|
|
774
|
-
isRollback,
|
|
775
|
-
genId,
|
|
776
|
-
revisionForInvert,
|
|
777
|
-
new InvertManager(crossFieldTable, fieldChange, fieldId),
|
|
778
|
-
revisionMetadata,
|
|
779
|
-
);
|
|
780
|
-
invertedField.change = brand(amendedChange);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
const crossFieldKeys = this.makeCrossFieldKeyTable(invertedFields, invertedNodes);
|
|
785
|
-
|
|
786
|
-
const constraintState = newConstraintState(0);
|
|
787
|
-
this.updateConstraintsForFields(
|
|
788
|
-
invertedFields,
|
|
789
|
-
NodeAttachState.Attached,
|
|
790
|
-
constraintState,
|
|
791
|
-
invertedNodes,
|
|
792
|
-
);
|
|
793
|
-
|
|
794
|
-
return makeModularChangeset({
|
|
795
|
-
fieldChanges: invertedFields,
|
|
796
|
-
nodeChanges: invertedNodes,
|
|
797
|
-
nodeToParent: crossFieldTable.invertedNodeToParent,
|
|
798
|
-
nodeAliases: change.change.nodeAliases,
|
|
799
|
-
crossFieldKeys,
|
|
800
|
-
maxId: genId.getMaxId(),
|
|
801
|
-
revisions: revInfos,
|
|
802
|
-
constraintViolationCount: constraintState.violationCount,
|
|
803
|
-
noChangeConstraint,
|
|
804
|
-
noChangeConstraintOnRevert,
|
|
805
|
-
destroys,
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
private invertFieldMap(
|
|
810
|
-
changes: FieldChangeMap,
|
|
811
|
-
parentId: NodeId | undefined,
|
|
812
|
-
isRollback: boolean,
|
|
813
|
-
genId: IdAllocator,
|
|
814
|
-
crossFieldTable: InvertTable,
|
|
815
|
-
revisionMetadata: RevisionMetadataSource,
|
|
816
|
-
revisionForInvert: RevisionTag,
|
|
817
|
-
): FieldChangeMap {
|
|
818
|
-
const invertedFields: FieldChangeMap = new Map();
|
|
819
|
-
|
|
820
|
-
for (const [field, fieldChange] of changes) {
|
|
821
|
-
const fieldId = { nodeId: parentId, field };
|
|
822
|
-
const manager = new InvertManager(crossFieldTable, fieldChange, fieldId);
|
|
823
|
-
const invertedChange = getChangeHandler(
|
|
824
|
-
this.fieldKinds,
|
|
825
|
-
fieldChange.fieldKind,
|
|
826
|
-
).rebaser.invert(
|
|
827
|
-
fieldChange.change,
|
|
828
|
-
isRollback,
|
|
829
|
-
genId,
|
|
830
|
-
revisionForInvert,
|
|
831
|
-
manager,
|
|
832
|
-
revisionMetadata,
|
|
833
|
-
);
|
|
834
|
-
|
|
835
|
-
const invertedFieldChange: FieldChange = {
|
|
836
|
-
...fieldChange,
|
|
837
|
-
change: brand(invertedChange),
|
|
838
|
-
};
|
|
839
|
-
invertedFields.set(field, invertedFieldChange);
|
|
840
|
-
|
|
841
|
-
crossFieldTable.originalFieldToContext.set(fieldChange, {
|
|
842
|
-
fieldId,
|
|
843
|
-
invertedField: invertedFieldChange,
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
return invertedFields;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
private invertNodeChange(
|
|
851
|
-
change: NodeChangeset,
|
|
852
|
-
id: NodeId,
|
|
853
|
-
isRollback: boolean,
|
|
854
|
-
genId: IdAllocator,
|
|
855
|
-
crossFieldTable: InvertTable,
|
|
856
|
-
revisionMetadata: RevisionMetadataSource,
|
|
857
|
-
revisionForInvert: RevisionTag,
|
|
858
|
-
): NodeChangeset {
|
|
859
|
-
const inverse: NodeChangeset = {};
|
|
860
|
-
|
|
861
|
-
// If the node has a constraint, it should be inverted to a node-exist-on-revert constraint. This ensure that if
|
|
862
|
-
// the inverse is inverted again, the original input constraint will be restored.
|
|
863
|
-
if (change.nodeExistsConstraint !== undefined) {
|
|
864
|
-
inverse.nodeExistsConstraintOnRevert = change.nodeExistsConstraint;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
// The node-exist-on-revert constraint of a node is the constraint that should apply when the a change is reverted.
|
|
868
|
-
// So, it should become the constraint in the inverse. If this constraint is violated when applying the inverse,
|
|
869
|
-
// it will be discarded.
|
|
870
|
-
if (change.nodeExistsConstraintOnRevert !== undefined) {
|
|
871
|
-
inverse.nodeExistsConstraint = change.nodeExistsConstraintOnRevert;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
if (change.fieldChanges !== undefined) {
|
|
875
|
-
inverse.fieldChanges = this.invertFieldMap(
|
|
876
|
-
change.fieldChanges,
|
|
877
|
-
id,
|
|
878
|
-
isRollback,
|
|
879
|
-
genId,
|
|
880
|
-
crossFieldTable,
|
|
881
|
-
revisionMetadata,
|
|
882
|
-
revisionForInvert,
|
|
883
|
-
);
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
return inverse;
|
|
709
|
+
return invertModularChange(change, isRollback, revisionForInvert, this.fieldKinds);
|
|
887
710
|
}
|
|
888
711
|
|
|
889
712
|
public rebase(
|
|
@@ -958,15 +781,16 @@ export class ModularChangeFamily
|
|
|
958
781
|
constraintState.violationCount += 1;
|
|
959
782
|
}
|
|
960
783
|
|
|
961
|
-
|
|
784
|
+
updateConstraintsForFields(
|
|
962
785
|
rebasedFields,
|
|
963
786
|
NodeAttachState.Attached,
|
|
964
787
|
constraintState,
|
|
965
788
|
rebasedNodes,
|
|
789
|
+
this.fieldKinds,
|
|
966
790
|
);
|
|
967
791
|
|
|
968
792
|
const rebased = makeModularChangeset({
|
|
969
|
-
fieldChanges:
|
|
793
|
+
fieldChanges: pruneFieldMap(rebasedFields, rebasedNodes, this.fieldKinds),
|
|
970
794
|
nodeChanges: rebasedNodes,
|
|
971
795
|
nodeToParent: crossFieldTable.rebasedNodeToParent,
|
|
972
796
|
nodeAliases: change.nodeAliases,
|
|
@@ -1409,105 +1233,6 @@ export class ModularChangeFamily
|
|
|
1409
1233
|
return rebasedChange;
|
|
1410
1234
|
}
|
|
1411
1235
|
|
|
1412
|
-
private updateConstraintsForFields(
|
|
1413
|
-
fields: FieldChangeMap,
|
|
1414
|
-
parentInputAttachState: NodeAttachState,
|
|
1415
|
-
constraintState: ConstraintState,
|
|
1416
|
-
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
1417
|
-
): void {
|
|
1418
|
-
for (const field of fields.values()) {
|
|
1419
|
-
const handler = getChangeHandler(this.fieldKinds, field.fieldKind);
|
|
1420
|
-
for (const [nodeId, inputIndex, _outputIndex] of handler.getNestedChanges(
|
|
1421
|
-
field.change,
|
|
1422
|
-
)) {
|
|
1423
|
-
const isInputDetached = inputIndex === undefined;
|
|
1424
|
-
const inputAttachState =
|
|
1425
|
-
parentInputAttachState === NodeAttachState.Detached || isInputDetached
|
|
1426
|
-
? NodeAttachState.Detached
|
|
1427
|
-
: NodeAttachState.Attached;
|
|
1428
|
-
|
|
1429
|
-
this.updateConstraintsForNode(nodeId, inputAttachState, nodes, constraintState);
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
private updateConstraintsForNode(
|
|
1435
|
-
nodeId: NodeId,
|
|
1436
|
-
inputAttachState: NodeAttachState,
|
|
1437
|
-
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
1438
|
-
constraintState: ConstraintState,
|
|
1439
|
-
): void {
|
|
1440
|
-
const node =
|
|
1441
|
-
nodes.get([nodeId.revision, nodeId.localId]) ?? fail(0xb24 /* Unknown node ID */);
|
|
1442
|
-
if (node.nodeExistsConstraint !== undefined) {
|
|
1443
|
-
const isNowViolated = inputAttachState === NodeAttachState.Detached;
|
|
1444
|
-
if (node.nodeExistsConstraint.violated !== isNowViolated) {
|
|
1445
|
-
node.nodeExistsConstraint = {
|
|
1446
|
-
...node.nodeExistsConstraint,
|
|
1447
|
-
violated: isNowViolated,
|
|
1448
|
-
};
|
|
1449
|
-
constraintState.violationCount += isNowViolated ? 1 : -1;
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
if (node.fieldChanges !== undefined) {
|
|
1454
|
-
this.updateConstraintsForFields(
|
|
1455
|
-
node.fieldChanges,
|
|
1456
|
-
inputAttachState,
|
|
1457
|
-
constraintState,
|
|
1458
|
-
nodes,
|
|
1459
|
-
);
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
private pruneFieldMap(
|
|
1464
|
-
changeset: FieldChangeMap | undefined,
|
|
1465
|
-
nodeMap: ChangeAtomIdBTree<NodeChangeset>,
|
|
1466
|
-
): FieldChangeMap | undefined {
|
|
1467
|
-
if (changeset === undefined) {
|
|
1468
|
-
return undefined;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
const prunedChangeset: FieldChangeMap = new Map();
|
|
1472
|
-
for (const [field, fieldChange] of changeset) {
|
|
1473
|
-
const handler = getChangeHandler(this.fieldKinds, fieldChange.fieldKind);
|
|
1474
|
-
|
|
1475
|
-
const prunedFieldChangeset = handler.rebaser.prune(fieldChange.change, (nodeId) =>
|
|
1476
|
-
this.pruneNodeChange(nodeId, nodeMap),
|
|
1477
|
-
);
|
|
1478
|
-
|
|
1479
|
-
if (!handler.isEmpty(prunedFieldChangeset)) {
|
|
1480
|
-
prunedChangeset.set(field, { ...fieldChange, change: brand(prunedFieldChangeset) });
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
return prunedChangeset.size > 0 ? prunedChangeset : undefined;
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
private pruneNodeChange(
|
|
1488
|
-
nodeId: NodeId,
|
|
1489
|
-
nodeMap: ChangeAtomIdBTree<NodeChangeset>,
|
|
1490
|
-
): NodeId | undefined {
|
|
1491
|
-
const changeset = nodeChangeFromId(nodeMap, nodeId);
|
|
1492
|
-
const prunedFields =
|
|
1493
|
-
changeset.fieldChanges === undefined
|
|
1494
|
-
? undefined
|
|
1495
|
-
: this.pruneFieldMap(changeset.fieldChanges, nodeMap);
|
|
1496
|
-
|
|
1497
|
-
const prunedChange = { ...changeset, fieldChanges: prunedFields };
|
|
1498
|
-
if (prunedChange.fieldChanges === undefined) {
|
|
1499
|
-
delete prunedChange.fieldChanges;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
if (isEmptyNodeChangeset(prunedChange)) {
|
|
1503
|
-
nodeMap.delete([nodeId.revision, nodeId.localId]);
|
|
1504
|
-
return undefined;
|
|
1505
|
-
} else {
|
|
1506
|
-
setInChangeAtomIdMap(nodeMap, nodeId, prunedChange);
|
|
1507
|
-
return nodeId;
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
1236
|
public getRevisions(change: ModularChangeset): Set<RevisionTag | undefined> {
|
|
1512
1237
|
if (change.revisions === undefined || change.revisions.length === 0) {
|
|
1513
1238
|
return new Set([undefined]);
|
|
@@ -1598,44 +1323,16 @@ export class ModularChangeFamily
|
|
|
1598
1323
|
return updatedFields;
|
|
1599
1324
|
}
|
|
1600
1325
|
|
|
1601
|
-
private makeCrossFieldKeyTable(
|
|
1602
|
-
fields: FieldChangeMap,
|
|
1603
|
-
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
1604
|
-
): CrossFieldKeyTable {
|
|
1605
|
-
const keys: CrossFieldKeyTable = newCrossFieldKeyTable();
|
|
1606
|
-
this.populateCrossFieldKeyTableForFieldMap(keys, fields, undefined);
|
|
1607
|
-
nodes.forEachPair(([revision, localId], node) => {
|
|
1608
|
-
if (node.fieldChanges !== undefined) {
|
|
1609
|
-
this.populateCrossFieldKeyTableForFieldMap(keys, node.fieldChanges, {
|
|
1610
|
-
revision,
|
|
1611
|
-
localId,
|
|
1612
|
-
});
|
|
1613
|
-
}
|
|
1614
|
-
});
|
|
1615
|
-
|
|
1616
|
-
return keys;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
private populateCrossFieldKeyTableForFieldMap(
|
|
1620
|
-
table: CrossFieldKeyTable,
|
|
1621
|
-
fields: FieldChangeMap,
|
|
1622
|
-
parent: NodeId | undefined,
|
|
1623
|
-
): void {
|
|
1624
|
-
for (const [fieldKey, fieldChange] of fields) {
|
|
1625
|
-
const keys = getChangeHandler(this.fieldKinds, fieldChange.fieldKind).getCrossFieldKeys(
|
|
1626
|
-
fieldChange.change,
|
|
1627
|
-
);
|
|
1628
|
-
for (const { key, count } of keys) {
|
|
1629
|
-
table.set(key, count, { nodeId: parent, field: fieldKey });
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
1326
|
public buildEditor(
|
|
1635
1327
|
mintRevisionTag: () => RevisionTag,
|
|
1636
1328
|
changeReceiver: (change: TaggedChange<ModularChangeset>) => void,
|
|
1637
1329
|
): ModularEditBuilder {
|
|
1638
|
-
return new ModularEditBuilder(
|
|
1330
|
+
return new ModularEditBuilder(
|
|
1331
|
+
this.rebaser,
|
|
1332
|
+
this.fieldKinds,
|
|
1333
|
+
changeReceiver,
|
|
1334
|
+
this.codecOptions,
|
|
1335
|
+
);
|
|
1639
1336
|
}
|
|
1640
1337
|
|
|
1641
1338
|
private createEmptyFieldChange(fieldKind: FieldKindIdentifier): FieldChange {
|
|
@@ -1877,15 +1574,6 @@ function composeBuildsDestroysAndRefreshers(
|
|
|
1877
1574
|
return { allBuilds, allDestroys, allRefreshers };
|
|
1878
1575
|
}
|
|
1879
1576
|
|
|
1880
|
-
function invertBuilds(
|
|
1881
|
-
builds: ChangeAtomIdBTree<TreeChunk> | undefined,
|
|
1882
|
-
): ChangeAtomIdBTree<number> | undefined {
|
|
1883
|
-
if (builds !== undefined) {
|
|
1884
|
-
return brand(builds.mapValues((chunk) => chunk.topLevelLength));
|
|
1885
|
-
}
|
|
1886
|
-
return undefined;
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
1577
|
/**
|
|
1890
1578
|
* Returns the set of removed roots that should be in memory for the given change to be applied.
|
|
1891
1579
|
* A removed root is relevant if any of the following is true:
|
|
@@ -2167,53 +1855,6 @@ export function rebaseRevisionMetadataFromInfo(
|
|
|
2167
1855
|
};
|
|
2168
1856
|
}
|
|
2169
1857
|
|
|
2170
|
-
function isEmptyNodeChangeset(change: NodeChangeset): boolean {
|
|
2171
|
-
return (
|
|
2172
|
-
change.fieldChanges === undefined &&
|
|
2173
|
-
change.nodeExistsConstraint === undefined &&
|
|
2174
|
-
change.nodeExistsConstraintOnRevert === undefined
|
|
2175
|
-
);
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
export function getFieldKind(
|
|
2179
|
-
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
2180
|
-
kind: FieldKindIdentifier,
|
|
2181
|
-
): FlexFieldKind {
|
|
2182
|
-
if (kind === genericFieldKind.identifier) {
|
|
2183
|
-
return genericFieldKind;
|
|
2184
|
-
}
|
|
2185
|
-
const fieldKind = fieldKinds.get(kind);
|
|
2186
|
-
assert(fieldKind !== undefined, 0x3ad /* Unknown field kind */);
|
|
2187
|
-
return fieldKind;
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
|
-
export function getChangeHandler(
|
|
2191
|
-
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
2192
|
-
kind: FieldKindIdentifier,
|
|
2193
|
-
): FieldChangeHandler<unknown> {
|
|
2194
|
-
return getFieldKind(fieldKinds, kind).changeHandler;
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
// TODO: TFieldData could instead just be a numeric ID generated by the CrossFieldTable
|
|
2198
|
-
// The CrossFieldTable could have a generic field ID to context table
|
|
2199
|
-
interface CrossFieldTable<TFieldData> {
|
|
2200
|
-
srcTable: CrossFieldMap<unknown>;
|
|
2201
|
-
dstTable: CrossFieldMap<unknown>;
|
|
2202
|
-
srcDependents: CrossFieldMap<TFieldData>;
|
|
2203
|
-
dstDependents: CrossFieldMap<TFieldData>;
|
|
2204
|
-
invalidatedFields: Set<TFieldData>;
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
interface InvertTable extends CrossFieldTable<FieldChange> {
|
|
2208
|
-
originalFieldToContext: Map<FieldChange, InvertContext>;
|
|
2209
|
-
invertedNodeToParent: ChangeAtomIdBTree<FieldId>;
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
interface InvertContext {
|
|
2213
|
-
fieldId: FieldId;
|
|
2214
|
-
invertedField: FieldChange;
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
1858
|
interface RebaseTable extends CrossFieldTable<FieldChange> {
|
|
2218
1859
|
readonly baseChange: ModularChangeset;
|
|
2219
1860
|
readonly newChange: ModularChangeset;
|
|
@@ -2320,133 +1961,6 @@ interface ComposeFieldContext {
|
|
|
2320
1961
|
composedChange: FieldChange;
|
|
2321
1962
|
}
|
|
2322
1963
|
|
|
2323
|
-
function newCrossFieldTable<T>(): CrossFieldTable<T> {
|
|
2324
|
-
return {
|
|
2325
|
-
srcTable: newChangeAtomIdRangeMap(),
|
|
2326
|
-
dstTable: newChangeAtomIdRangeMap(),
|
|
2327
|
-
srcDependents: newChangeAtomIdRangeMap(),
|
|
2328
|
-
dstDependents: newChangeAtomIdRangeMap(),
|
|
2329
|
-
invalidatedFields: new Set(),
|
|
2330
|
-
};
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
interface ConstraintState {
|
|
2334
|
-
violationCount: number;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
function newConstraintState(violationCount: number): ConstraintState {
|
|
2338
|
-
return {
|
|
2339
|
-
violationCount,
|
|
2340
|
-
};
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
abstract class CrossFieldManagerI<T> implements CrossFieldManager {
|
|
2344
|
-
public constructor(
|
|
2345
|
-
protected readonly crossFieldTable: CrossFieldTable<T>,
|
|
2346
|
-
private readonly currentFieldKey: T,
|
|
2347
|
-
protected readonly allowInval = true,
|
|
2348
|
-
) {}
|
|
2349
|
-
|
|
2350
|
-
public set(
|
|
2351
|
-
target: CrossFieldTarget,
|
|
2352
|
-
revision: RevisionTag | undefined,
|
|
2353
|
-
id: ChangesetLocalId,
|
|
2354
|
-
count: number,
|
|
2355
|
-
newValue: unknown,
|
|
2356
|
-
invalidateDependents: boolean,
|
|
2357
|
-
): void {
|
|
2358
|
-
if (invalidateDependents && this.allowInval) {
|
|
2359
|
-
const lastChangedId = (id as number) + count - 1;
|
|
2360
|
-
let firstId = id;
|
|
2361
|
-
while (firstId <= lastChangedId) {
|
|
2362
|
-
const dependentEntry = getFirstFromCrossFieldMap(
|
|
2363
|
-
this.getDependents(target),
|
|
2364
|
-
revision,
|
|
2365
|
-
firstId,
|
|
2366
|
-
lastChangedId - firstId + 1,
|
|
2367
|
-
);
|
|
2368
|
-
if (dependentEntry.value !== undefined) {
|
|
2369
|
-
this.crossFieldTable.invalidatedFields.add(dependentEntry.value);
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2372
|
-
firstId = brand(firstId + dependentEntry.length);
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
setInCrossFieldMap(this.getMap(target), revision, id, count, newValue);
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
public get(
|
|
2379
|
-
target: CrossFieldTarget,
|
|
2380
|
-
revision: RevisionTag | undefined,
|
|
2381
|
-
id: ChangesetLocalId,
|
|
2382
|
-
count: number,
|
|
2383
|
-
addDependency: boolean,
|
|
2384
|
-
): RangeQueryResult<unknown> {
|
|
2385
|
-
if (addDependency) {
|
|
2386
|
-
// We assume that if there is already an entry for this ID it is because
|
|
2387
|
-
// a field handler has called compose on the same node multiple times.
|
|
2388
|
-
// In this case we only want to update the latest version, so we overwrite the dependency.
|
|
2389
|
-
setInCrossFieldMap(
|
|
2390
|
-
this.getDependents(target),
|
|
2391
|
-
revision,
|
|
2392
|
-
id,
|
|
2393
|
-
count,
|
|
2394
|
-
this.currentFieldKey,
|
|
2395
|
-
);
|
|
2396
|
-
}
|
|
2397
|
-
return getFirstFromCrossFieldMap(this.getMap(target), revision, id, count);
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
public abstract onMoveIn(id: NodeId): void;
|
|
2401
|
-
|
|
2402
|
-
public abstract moveKey(
|
|
2403
|
-
target: CrossFieldTarget,
|
|
2404
|
-
revision: RevisionTag | undefined,
|
|
2405
|
-
id: ChangesetLocalId,
|
|
2406
|
-
count: number,
|
|
2407
|
-
): void;
|
|
2408
|
-
|
|
2409
|
-
private getMap(target: CrossFieldTarget): CrossFieldMap<unknown> {
|
|
2410
|
-
return target === CrossFieldTarget.Source
|
|
2411
|
-
? this.crossFieldTable.srcTable
|
|
2412
|
-
: this.crossFieldTable.dstTable;
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
private getDependents(target: CrossFieldTarget): CrossFieldMap<T> {
|
|
2416
|
-
return target === CrossFieldTarget.Source
|
|
2417
|
-
? this.crossFieldTable.srcDependents
|
|
2418
|
-
: this.crossFieldTable.dstDependents;
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
class InvertManager extends CrossFieldManagerI<FieldChange> {
|
|
2423
|
-
public constructor(
|
|
2424
|
-
table: InvertTable,
|
|
2425
|
-
field: FieldChange,
|
|
2426
|
-
private readonly fieldId: FieldId,
|
|
2427
|
-
allowInval = true,
|
|
2428
|
-
) {
|
|
2429
|
-
super(table, field, allowInval);
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
public override onMoveIn(id: ChangeAtomId): void {
|
|
2433
|
-
setInChangeAtomIdMap(this.table.invertedNodeToParent, id, this.fieldId);
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
public override moveKey(
|
|
2437
|
-
target: CrossFieldTarget,
|
|
2438
|
-
revision: RevisionTag | undefined,
|
|
2439
|
-
id: ChangesetLocalId,
|
|
2440
|
-
count: number,
|
|
2441
|
-
): void {
|
|
2442
|
-
assert(false, 0x9c5 /* Keys should not be moved manually during invert */);
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
private get table(): InvertTable {
|
|
2446
|
-
return this.crossFieldTable as InvertTable;
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
|
|
2450
1964
|
class RebaseManager extends CrossFieldManagerI<FieldChange> {
|
|
2451
1965
|
public constructor(
|
|
2452
1966
|
table: RebaseTable,
|
|
@@ -2612,69 +2126,18 @@ class ComposeManager extends CrossFieldManagerI<FieldChange> {
|
|
|
2612
2126
|
}
|
|
2613
2127
|
}
|
|
2614
2128
|
|
|
2615
|
-
function makeModularChangeset(props?: {
|
|
2616
|
-
fieldChanges?: FieldChangeMap;
|
|
2617
|
-
nodeChanges?: ChangeAtomIdBTree<NodeChangeset>;
|
|
2618
|
-
nodeToParent?: ChangeAtomIdBTree<FieldId>;
|
|
2619
|
-
nodeAliases?: ChangeAtomIdBTree<NodeId>;
|
|
2620
|
-
crossFieldKeys?: CrossFieldKeyTable;
|
|
2621
|
-
maxId: number;
|
|
2622
|
-
revisions?: readonly RevisionInfo[];
|
|
2623
|
-
constraintViolationCount?: number;
|
|
2624
|
-
noChangeConstraint?: NoChangeConstraint;
|
|
2625
|
-
noChangeConstraintOnRevert?: NoChangeConstraint;
|
|
2626
|
-
builds?: ChangeAtomIdBTree<TreeChunk>;
|
|
2627
|
-
destroys?: ChangeAtomIdBTree<number>;
|
|
2628
|
-
refreshers?: ChangeAtomIdBTree<TreeChunk>;
|
|
2629
|
-
}): ModularChangeset {
|
|
2630
|
-
const p = props ?? { maxId: -1 };
|
|
2631
|
-
const changeset: Mutable<ModularChangeset> = {
|
|
2632
|
-
fieldChanges: p.fieldChanges ?? new Map<FieldKey, FieldChange>(),
|
|
2633
|
-
nodeChanges: p.nodeChanges ?? newChangeAtomIdBTree(),
|
|
2634
|
-
nodeToParent: p.nodeToParent ?? newChangeAtomIdBTree(),
|
|
2635
|
-
nodeAliases: p.nodeAliases ?? newChangeAtomIdBTree(),
|
|
2636
|
-
crossFieldKeys: p.crossFieldKeys ?? newCrossFieldKeyTable(),
|
|
2637
|
-
};
|
|
2638
|
-
|
|
2639
|
-
if (p.revisions !== undefined && p.revisions.length > 0) {
|
|
2640
|
-
changeset.revisions = p.revisions;
|
|
2641
|
-
}
|
|
2642
|
-
if (p.maxId >= 0) {
|
|
2643
|
-
changeset.maxId = brand(p.maxId);
|
|
2644
|
-
}
|
|
2645
|
-
if (p.constraintViolationCount !== undefined && p.constraintViolationCount > 0) {
|
|
2646
|
-
changeset.constraintViolationCount = p.constraintViolationCount;
|
|
2647
|
-
}
|
|
2648
|
-
if (p.noChangeConstraint !== undefined) {
|
|
2649
|
-
changeset.noChangeConstraint = p.noChangeConstraint;
|
|
2650
|
-
}
|
|
2651
|
-
if (p.noChangeConstraintOnRevert !== undefined) {
|
|
2652
|
-
changeset.noChangeConstraintOnRevert = p.noChangeConstraintOnRevert;
|
|
2653
|
-
}
|
|
2654
|
-
if (p.builds !== undefined && p.builds.size > 0) {
|
|
2655
|
-
changeset.builds = p.builds;
|
|
2656
|
-
}
|
|
2657
|
-
if (p.destroys !== undefined && p.destroys.size > 0) {
|
|
2658
|
-
changeset.destroys = p.destroys;
|
|
2659
|
-
}
|
|
2660
|
-
if (p.refreshers !== undefined && p.refreshers.size > 0) {
|
|
2661
|
-
changeset.refreshers = p.refreshers;
|
|
2662
|
-
}
|
|
2663
|
-
return changeset;
|
|
2664
|
-
}
|
|
2665
|
-
|
|
2666
2129
|
export class ModularEditBuilder extends EditBuilder<ModularChangeset> {
|
|
2667
2130
|
private transactionDepth: number = 0;
|
|
2668
2131
|
private idAllocator: IdAllocator;
|
|
2669
2132
|
private readonly codecOptions: CodecWriteOptions;
|
|
2670
2133
|
|
|
2671
2134
|
public constructor(
|
|
2672
|
-
|
|
2135
|
+
private readonly rebaser: ChangeRebaser<ModularChangeset>,
|
|
2673
2136
|
private readonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
2674
2137
|
changeReceiver: (change: TaggedChange<ModularChangeset>) => void,
|
|
2675
2138
|
codecOptions: CodecWriteOptions,
|
|
2676
2139
|
) {
|
|
2677
|
-
super(
|
|
2140
|
+
super(changeReceiver);
|
|
2678
2141
|
this.idAllocator = idAllocatorFromMaxId();
|
|
2679
2142
|
this.codecOptions = codecOptions;
|
|
2680
2143
|
}
|
|
@@ -2791,7 +2254,7 @@ export class ModularEditBuilder extends EditBuilder<ModularChangeset> {
|
|
|
2791
2254
|
});
|
|
2792
2255
|
const revInfo = [...revisions].map((revision) => ({ revision }));
|
|
2793
2256
|
const composedChange: Mutable<ModularChangeset> = {
|
|
2794
|
-
...this.
|
|
2257
|
+
...this.rebaser.compose(changeMaps),
|
|
2795
2258
|
revisions: revInfo,
|
|
2796
2259
|
};
|
|
2797
2260
|
|
|
@@ -3007,58 +2470,6 @@ export interface GlobalEditDescription {
|
|
|
3007
2470
|
|
|
3008
2471
|
export type EditDescription = FieldEditDescription | GlobalEditDescription;
|
|
3009
2472
|
|
|
3010
|
-
function getRevInfoFromTaggedChanges(changes: TaggedChange<ModularChangeset>[]): {
|
|
3011
|
-
revInfos: RevisionInfo[];
|
|
3012
|
-
maxId: ChangesetLocalId;
|
|
3013
|
-
} {
|
|
3014
|
-
let maxId = -1;
|
|
3015
|
-
const revInfos: RevisionInfo[] = [];
|
|
3016
|
-
const revisions = new Set<RevisionTag>();
|
|
3017
|
-
for (const taggedChange of changes) {
|
|
3018
|
-
const change = taggedChange.change;
|
|
3019
|
-
maxId = Math.max(change.maxId ?? -1, maxId);
|
|
3020
|
-
const infosToAdd = revisionInfoFromTaggedChange(taggedChange);
|
|
3021
|
-
for (const info of infosToAdd) {
|
|
3022
|
-
if (!revisions.has(info.revision)) {
|
|
3023
|
-
revisions.add(info.revision);
|
|
3024
|
-
revInfos.push(info);
|
|
3025
|
-
}
|
|
3026
|
-
}
|
|
3027
|
-
}
|
|
3028
|
-
|
|
3029
|
-
const rolledBackRevisions: RevisionTag[] = [];
|
|
3030
|
-
for (const info of revInfos) {
|
|
3031
|
-
if (info.rollbackOf !== undefined) {
|
|
3032
|
-
rolledBackRevisions.push(info.rollbackOf);
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
|
|
3036
|
-
rolledBackRevisions.reverse();
|
|
3037
|
-
for (const revision of rolledBackRevisions) {
|
|
3038
|
-
if (!revisions.has(revision)) {
|
|
3039
|
-
revInfos.push({ revision });
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3042
|
-
|
|
3043
|
-
return { maxId: brand(maxId), revInfos };
|
|
3044
|
-
}
|
|
3045
|
-
|
|
3046
|
-
function revisionInfoFromTaggedChange(
|
|
3047
|
-
taggedChange: TaggedChange<ModularChangeset>,
|
|
3048
|
-
): RevisionInfo[] {
|
|
3049
|
-
const revInfos: RevisionInfo[] = [];
|
|
3050
|
-
if (taggedChange.change.revisions !== undefined) {
|
|
3051
|
-
revInfos.push(...taggedChange.change.revisions);
|
|
3052
|
-
} else if (taggedChange.revision !== undefined) {
|
|
3053
|
-
const info: Mutable<RevisionInfo> = { revision: taggedChange.revision };
|
|
3054
|
-
if (taggedChange.rollbackOf !== undefined) {
|
|
3055
|
-
info.rollbackOf = taggedChange.rollbackOf;
|
|
3056
|
-
}
|
|
3057
|
-
revInfos.push(info);
|
|
3058
|
-
}
|
|
3059
|
-
return revInfos;
|
|
3060
|
-
}
|
|
3061
|
-
|
|
3062
2473
|
function fieldChangeFromId(
|
|
3063
2474
|
fields: FieldChangeMap,
|
|
3064
2475
|
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
@@ -3094,12 +2505,6 @@ function rebasedNodeIdFromBaseNodeId(table: RebaseTable, baseId: NodeId): NodeId
|
|
|
3094
2505
|
return getFromChangeAtomIdMap(table.baseToRebasedNodeId, baseId) ?? baseId;
|
|
3095
2506
|
}
|
|
3096
2507
|
|
|
3097
|
-
function nodeChangeFromId(nodes: ChangeAtomIdBTree<NodeChangeset>, id: NodeId): NodeChangeset {
|
|
3098
|
-
const node = getFromChangeAtomIdMap(nodes, id);
|
|
3099
|
-
assert(node !== undefined, 0x9ca /* Unknown node ID */);
|
|
3100
|
-
return node;
|
|
3101
|
-
}
|
|
3102
|
-
|
|
3103
2508
|
function fieldIdFromFieldIdKey([revision, localId, field]: FieldIdKey): FieldId {
|
|
3104
2509
|
const nodeId = localId === undefined ? undefined : { revision, localId };
|
|
3105
2510
|
return { nodeId, field };
|
|
@@ -3171,10 +2576,6 @@ function normalizeNodeId(nodeId: NodeId, nodeAliases: ChangeAtomIdBTree<NodeId>)
|
|
|
3171
2576
|
}
|
|
3172
2577
|
}
|
|
3173
2578
|
|
|
3174
|
-
function hasConflicts(change: ModularChangeset): boolean {
|
|
3175
|
-
return (change.constraintViolationCount ?? 0) > 0;
|
|
3176
|
-
}
|
|
3177
|
-
|
|
3178
2579
|
/**
|
|
3179
2580
|
* A rebaseChild callback for fields with no new changes.
|
|
3180
2581
|
* Asserts that there are no new changes and returns undefined.
|