@fluidframework/tree 2.80.0 → 2.81.0-374083
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/api-report/tree.alpha.api.md +43 -7
- package/dist/alpha.d.ts +5 -0
- package/dist/core/change-family/changeFamily.d.ts +4 -1
- 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/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 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +6 -1
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +46 -8
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +5 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +30 -8
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/anchorSet.js +1 -0
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +6 -0
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +9 -0
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +4 -3
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +11 -3
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +14 -2
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +3 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +58 -18
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +10 -4
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +16 -2
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +7 -0
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +4 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +93 -44
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +238 -69
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -2
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +2 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +5 -2
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +132 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts +1 -0
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +6 -1
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +6 -0
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +40 -9
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +8 -3
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js +1 -0
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -7
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -51
- 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/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -9
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +4 -4
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -2
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +11 -28
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +255 -161
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js +393 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -20
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1350 -476
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js +32 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +47 -11
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +3 -1
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts +2 -2
- package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/index.js +1 -2
- package/dist/feature-libraries/optional-field/index.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +5 -26
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +221 -443
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +31 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +57 -28
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +57 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +83 -259
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts +2 -3
- package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/index.js +1 -3
- package/dist/feature-libraries/sequence-field/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +65 -167
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +7 -90
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +107 -114
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +18 -31
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +365 -187
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -62
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts +30 -59
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +15 -24
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +116 -305
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -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/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +4 -4
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +2 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +1 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +38 -35
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +9 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +11 -0
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +1 -0
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +10 -4
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +14 -7
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +9 -10
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +63 -8
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +3 -2
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +9 -4
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +2 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +20 -14
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +10 -2
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +6 -0
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +2 -2
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- 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/messageCodecs.d.ts +4 -0
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +10 -2
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +1 -0
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +6 -0
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +1 -0
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -4
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +297 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +3 -1
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +6 -2
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +59 -8
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +4 -4
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +4 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +7 -5
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/common.js +1 -1
- package/dist/simple-tree/node-kinds/common.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +19 -19
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +4 -2
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +184 -126
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +31 -13
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/text/index.d.ts +6 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +10 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/textDomain.d.ts +138 -0
- package/dist/text/textDomain.d.ts.map +1 -0
- package/dist/text/textDomain.js +121 -0
- package/dist/text/textDomain.js.map +1 -0
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +12 -2
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +12 -4
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +14 -18
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.js +12 -12
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/rangeMap.d.ts +24 -12
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +46 -6
- package/dist/util/rangeMap.js.map +1 -1
- package/docs/user-facing/merge-semantics.md +3 -2
- package/eslint.config.mts +4 -32
- package/lib/alpha.d.ts +5 -0
- package/lib/core/change-family/changeFamily.d.ts +4 -1
- 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/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 -3
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +6 -1
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +46 -8
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +3 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +30 -8
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/anchorSet.js +1 -0
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +6 -0
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +10 -1
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +11 -3
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +12 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +3 -2
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +58 -18
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +10 -4
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.js +14 -1
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +8 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +93 -44
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +236 -70
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -2
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +2 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +2 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +128 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts +1 -0
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +5 -1
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +6 -0
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +41 -10
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.js +2 -1
- package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +3 -5
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -51
- 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/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -9
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +4 -4
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +2 -2
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +11 -28
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +247 -143
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js +389 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +8 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -20
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1344 -479
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js +29 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +47 -11
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +3 -1
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts +2 -2
- package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/index.js +1 -1
- package/lib/feature-libraries/optional-field/index.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +5 -26
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +221 -441
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +27 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +53 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +85 -261
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts +2 -3
- package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/index.js +0 -1
- package/lib/feature-libraries/sequence-field/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +67 -169
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js +6 -84
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +109 -116
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +18 -31
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +356 -182
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -63
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts +30 -59
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +15 -24
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +112 -298
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/index.d.ts +3 -2
- 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/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +4 -4
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +3 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +1 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +41 -38
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +9 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +11 -0
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +1 -0
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +11 -5
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +12 -6
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +9 -10
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +66 -11
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +3 -2
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +9 -4
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +2 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +20 -14
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +8 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +6 -0
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +2 -2
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- 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/messageCodecs.d.ts +4 -0
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +8 -1
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +1 -0
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +6 -0
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -0
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +4 -4
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +270 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +3 -1
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +6 -2
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +58 -8
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +4 -4
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +8 -6
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/common.js +2 -2
- package/lib/simple-tree/node-kinds/common.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +20 -20
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +4 -2
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +184 -125
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +28 -11
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/text/index.d.ts +6 -0
- package/lib/text/index.d.ts.map +1 -0
- package/lib/text/index.js +6 -0
- package/lib/text/index.js.map +1 -0
- package/lib/text/textDomain.d.ts +138 -0
- package/lib/text/textDomain.d.ts.map +1 -0
- package/lib/text/textDomain.js +118 -0
- package/lib/text/textDomain.js.map +1 -0
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +13 -3
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +12 -4
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +15 -19
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.js +12 -12
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/rangeMap.d.ts +24 -12
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +44 -5
- package/lib/util/rangeMap.js.map +1 -1
- package/package.json +25 -25
- package/src/core/change-family/changeFamily.ts +5 -0
- package/src/core/change-family/index.ts +1 -0
- package/src/core/index.ts +6 -1
- package/src/core/rebase/changeRebaser.ts +6 -1
- package/src/core/rebase/index.ts +3 -0
- package/src/core/rebase/types.ts +65 -21
- package/src/core/rebase/utils.ts +39 -11
- package/src/core/tree/anchorSet.ts +1 -0
- package/src/core/tree/detachedFieldIndex.ts +17 -1
- package/src/core/tree/index.ts +2 -1
- package/src/core/tree/pathTree.ts +16 -4
- package/src/core/tree/visitDelta.ts +6 -2
- package/src/core/tree/visitorUtils.ts +55 -19
- package/src/feature-libraries/changeAtomIdBTree.ts +37 -5
- package/src/feature-libraries/chunked-forest/basicChunk.ts +7 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +6 -1
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -0
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +399 -127
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +13 -5
- package/src/feature-libraries/default-schema/index.ts +17 -5
- package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +188 -0
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +35 -9
- package/src/feature-libraries/deltaUtils.ts +6 -1
- package/src/feature-libraries/flex-tree/context.ts +17 -0
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
- package/src/feature-libraries/flex-tree/lazyField.ts +68 -25
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +3 -1
- package/src/feature-libraries/index.ts +22 -8
- package/src/feature-libraries/mapTreeCursor.ts +2 -1
- package/src/feature-libraries/mitigatedChangeFamily.ts +3 -1
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +142 -44
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +32 -58
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -18
- package/src/feature-libraries/modular-schema/index.ts +16 -15
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +560 -351
- package/src/feature-libraries/modular-schema/modularChangeCodecV3.ts +760 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +14 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2620 -782
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +1 -0
- package/src/feature-libraries/modular-schema/modularChangeFormatV3.ts +62 -0
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +58 -11
- package/src/feature-libraries/object-forest/objectForest.ts +3 -1
- package/src/feature-libraries/optional-field/index.ts +1 -3
- package/src/feature-libraries/optional-field/optionalField.ts +318 -562
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +45 -0
- package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +24 -38
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
- package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +94 -0
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -1
- package/src/feature-libraries/sequence-field/compose.ts +139 -522
- package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
- package/src/feature-libraries/sequence-field/index.ts +0 -9
- package/src/feature-libraries/sequence-field/invert.ts +103 -228
- package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +8 -195
- package/src/feature-libraries/sequence-field/rebase.ts +169 -205
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +25 -47
- package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +0 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +648 -228
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -70
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +25 -27
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +19 -129
- package/src/feature-libraries/sequence-field/types.ts +34 -64
- package/src/feature-libraries/sequence-field/utils.ts +139 -353
- package/src/index.ts +7 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +3 -2
- package/src/shared-tree/schematizeTree.ts +21 -8
- package/src/shared-tree/schematizingTreeView.ts +56 -70
- package/src/shared-tree/sharedTree.ts +20 -3
- package/src/shared-tree/sharedTreeChangeCodecs.ts +5 -1
- package/src/shared-tree/sharedTreeChangeEnricher.ts +2 -0
- package/src/shared-tree/sharedTreeChangeFamily.ts +15 -5
- package/src/shared-tree/sharedTreeEditBuilder.ts +39 -8
- package/src/shared-tree/treeCheckout.ts +95 -24
- package/src/shared-tree-core/branch.ts +13 -3
- package/src/shared-tree-core/editManager.ts +42 -28
- package/src/shared-tree-core/editManagerCodecs.ts +11 -1
- package/src/shared-tree-core/editManagerFormatCommons.ts +6 -0
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
- package/src/shared-tree-core/index.ts +2 -0
- package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +11 -1
- package/src/shared-tree-core/messageFormat.ts +6 -0
- package/src/shared-tree-core/messageFormatV1ToV4.ts +3 -1
- package/src/shared-tree-core/sharedTreeCore.ts +4 -1
- package/src/simple-tree/api/index.ts +3 -0
- package/src/simple-tree/api/schemaFactoryAlpha.ts +1 -1
- package/src/simple-tree/api/schemaFactoryBeta.ts +1 -1
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +4 -4
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +501 -0
- package/src/simple-tree/api/tree.ts +3 -1
- package/src/simple-tree/core/treeNodeKernel.ts +6 -2
- package/src/simple-tree/core/unhydratedFlexTree.ts +87 -36
- package/src/simple-tree/fieldSchema.ts +6 -4
- package/src/simple-tree/index.ts +5 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +9 -7
- package/src/simple-tree/node-kinds/common.ts +2 -5
- package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
- package/src/simple-tree/node-kinds/object/objectNode.ts +26 -26
- package/src/simple-tree/node-kinds/record/recordNode.ts +10 -9
- package/src/simple-tree/prepareForInsertion.ts +343 -201
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +43 -15
- package/src/text/README.md +8 -0
- package/src/text/index.ts +6 -0
- package/src/text/textDomain.ts +199 -0
- package/src/treeFactory.ts +14 -4
- package/src/util/bTreeUtils.ts +33 -22
- package/src/util/index.ts +3 -0
- package/src/util/nestedMap.ts +12 -12
- package/src/util/rangeMap.ts +72 -18
- package/.eslintrc.cjs +0 -125
- package/assertTagging.config.mjs +0 -14
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
- package/docs/main/sequence-field/move-composition.md +0 -46
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
- package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
package/lib/core/rebase/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { areEqualChangeAtomIds, areEqualChangeAtomIdOpts, makeChangeAtomId, asChangeAtomId, mintCommit, CommitKind, RevisionTagSchema, SessionIdSchema, taggedAtomId, taggedOptAtomId, offsetChangeAtomId, StableIdSchema, subtractChangeAtomIds, newChangeAtomIdRangeMap, compareRevisions, } from "./types.js";
|
|
5
|
+
export { areEqualChangeAtomIds, areEqualChangeAtomIdOpts, makeChangeAtomId, asChangeAtomId, mintCommit, CommitKind, RevisionTagSchema, SessionIdSchema, taggedAtomId, taggedOptAtomId, offsetChangeAtomId, StableIdSchema, subtractChangeAtomIds, newChangeAtomIdRangeMap, newChangeAtomIdTransform, compareRevisions, } from "./types.js";
|
|
6
6
|
export { RevisionTagCodec } from "./revisionTagCodec.js";
|
|
7
7
|
export { FinalChangeStatus, makeAnonChange, tagChange, mapTaggedChange, tagRollbackInverse, } from "./changeRebaser.js";
|
|
8
8
|
export { findAncestor, findCommonAncestor, rebaseBranch, rebaseChange, rebaseChangeOverChanges, revisionMetadataSourceFromInfo, replaceChange, isAncestor, diffHistories, } from "./utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/rebase/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,UAAU,EAEV,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/rebase/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,UAAU,EAEV,UAAU,EAMV,iBAAiB,EAOjB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EAErB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAGN,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,EACf,kBAAkB,GAKlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,YAAY,EAEZ,YAAY,EACZ,uBAAuB,EACvB,8BAA8B,EAG9B,aAAa,EACb,UAAU,EACV,aAAa,GACb,MAAM,YAAY,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tareEqualChangeAtomIds,\n\tareEqualChangeAtomIdOpts,\n\tmakeChangeAtomId,\n\tasChangeAtomId,\n\tmintCommit,\n\ttype GraphCommit,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype LocalChangeMetadata,\n\ttype RemoteChangeMetadata,\n\ttype ChangeMetadata,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\ttype EncodedRevisionTag,\n\ttype EncodedChangeAtomId,\n\ttype EncodedStableId,\n\ttype ChangesetLocalId,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\tSessionIdSchema,\n\ttaggedAtomId,\n\ttaggedOptAtomId,\n\toffsetChangeAtomId,\n\tStableIdSchema,\n\tsubtractChangeAtomIds,\n\ttype ChangeAtomIdRangeMap,\n\tnewChangeAtomIdRangeMap,\n\tnewChangeAtomIdTransform,\n\tcompareRevisions,\n} from \"./types.js\";\nexport { RevisionTagCodec } from \"./revisionTagCodec.js\";\nexport {\n\ttype ChangeRebaser,\n\ttype FinalChange,\n\tFinalChangeStatus,\n\tmakeAnonChange,\n\ttagChange,\n\tmapTaggedChange,\n\ttagRollbackInverse,\n\ttype TaggedChange,\n\ttype RevisionMetadataSource,\n\ttype RevisionInfo,\n\ttype RevisionReplacer,\n} from \"./changeRebaser.js\";\nexport {\n\tfindAncestor,\n\tfindCommonAncestor,\n\trebaseBranch,\n\ttype BranchRebaseResult,\n\trebaseChange,\n\trebaseChangeOverChanges,\n\trevisionMetadataSourceFromInfo,\n\ttype RebaseStats,\n\ttype RebaseStatsWithDuration,\n\treplaceChange,\n\tisAncestor,\n\tdiffHistories,\n} from \"./utils.js\";\n"]}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { OpSpaceCompressedId, SessionId, SessionSpaceCompressedId, StableId } from "@fluidframework/id-compressor";
|
|
6
6
|
import { type Brand, type JsonCompatibleReadOnly, type NestedMap, RangeMap } from "../../util/index.js";
|
|
7
|
+
import type { RevertibleAlpha } from "../revertible.js";
|
|
7
8
|
/**
|
|
8
9
|
* The identifier for a particular session/user/client that can generate `GraphCommit`s
|
|
9
10
|
*/
|
|
@@ -57,7 +58,7 @@ export declare function makeChangeAtomId(localId: ChangesetLocalId, revision?: R
|
|
|
57
58
|
export declare function asChangeAtomId(id: ChangesetLocalId | ChangeAtomId): ChangeAtomId;
|
|
58
59
|
export declare function taggedAtomId(id: ChangeAtomId, revision: RevisionTag | undefined): ChangeAtomId;
|
|
59
60
|
export declare function taggedOptAtomId(id: ChangeAtomId | undefined, revision: RevisionTag | undefined): ChangeAtomId | undefined;
|
|
60
|
-
export declare function offsetChangeAtomId(id:
|
|
61
|
+
export declare function offsetChangeAtomId<T extends ChangeAtomId = ChangeAtomId>(id: T, offset: number): T;
|
|
61
62
|
/**
|
|
62
63
|
* A node in a graph of commits. A commit's parent is the commit on which it was based.
|
|
63
64
|
*/
|
|
@@ -103,24 +104,60 @@ export interface CommitMetadata {
|
|
|
103
104
|
readonly isLocal: boolean;
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
106
|
-
* Information about a
|
|
107
|
-
*
|
|
107
|
+
* Information about a change that has been applied by the local client.
|
|
108
108
|
* @sealed @alpha
|
|
109
109
|
*/
|
|
110
|
-
export
|
|
110
|
+
export interface LocalChangeMetadata extends CommitMetadata {
|
|
111
|
+
/**
|
|
112
|
+
* Whether the change was made on the local machine/client or received from a remote client.
|
|
113
|
+
*/
|
|
111
114
|
readonly isLocal: true;
|
|
112
115
|
/**
|
|
113
|
-
*
|
|
114
|
-
* @remarks This
|
|
116
|
+
* Returns a serializable object that encodes the change.
|
|
117
|
+
* @remarks This is only available for local changes.
|
|
118
|
+
* This change object can be {@link TreeBranchAlpha.applyChange | applied to another branch} in the same state as the one which generated it.
|
|
115
119
|
* The change object must be applied to a SharedTree with the same IdCompressor session ID as it was created from.
|
|
116
120
|
* @privateRemarks
|
|
117
121
|
* This is a `SerializedChange` from treeCheckout.ts.
|
|
118
122
|
*/
|
|
119
123
|
getChange(): JsonCompatibleReadOnly;
|
|
120
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Returns an object (a {@link RevertibleAlpha | "revertible"}) that can be used to revert the change that produced this event.
|
|
126
|
+
* @remarks This is only available for local changes.
|
|
127
|
+
* If the change is not revertible (for example, it was a change to the application schema), then this will return `undefined`.
|
|
128
|
+
* Revertibles should be disposed when they are no longer needed.
|
|
129
|
+
* @param onDisposed - A callback that will be invoked when the `Revertible` is disposed.
|
|
130
|
+
* This happens when the `Revertible` is disposed manually or when the `TreeView` that the `Revertible` belongs to is disposed - whichever happens first.
|
|
131
|
+
* This is typically used to clean up any resources associated with the `Revertible` in the host application.
|
|
132
|
+
* @throws Throws an error if called outside the scope of the `changed` event that provided it.
|
|
133
|
+
*/
|
|
134
|
+
getRevertible(onDisposed?: (revertible: RevertibleAlpha) => void): RevertibleAlpha | undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Information about a change that has been applied by a remote client.
|
|
138
|
+
* @sealed @alpha
|
|
139
|
+
*/
|
|
140
|
+
export interface RemoteChangeMetadata extends CommitMetadata {
|
|
141
|
+
/**
|
|
142
|
+
* Whether the change was made on the local machine/client or received from a remote client.
|
|
143
|
+
*/
|
|
121
144
|
readonly isLocal: false;
|
|
145
|
+
/**
|
|
146
|
+
* Returns a serializable object that encodes the change.
|
|
147
|
+
* @remarks This is only available for {@link LocalChangeMetadata | local changes}.
|
|
148
|
+
*/
|
|
122
149
|
readonly getChange?: undefined;
|
|
123
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Returns an object (a {@link RevertibleAlpha | "revertible"}) that can be used to revert the change that produced this event.
|
|
152
|
+
* @remarks This is only available for {@link LocalChangeMetadata | local changes}.
|
|
153
|
+
*/
|
|
154
|
+
readonly getRevertible?: undefined;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Information about a {@link LocalChangeMetadata | local} or {@link RemoteChangeMetadata | remote} change that has been applied.
|
|
158
|
+
* @sealed @alpha
|
|
159
|
+
*/
|
|
160
|
+
export type ChangeMetadata = LocalChangeMetadata | RemoteChangeMetadata;
|
|
124
161
|
/**
|
|
125
162
|
* Creates a new graph commit object. This is useful for creating copies of commits with different parentage.
|
|
126
163
|
* @param parent - the parent of the new commit
|
|
@@ -130,6 +167,7 @@ export type ChangeMetadata = CommitMetadata & ({
|
|
|
130
167
|
export declare function mintCommit<TChange>(parent: GraphCommit<TChange>, commit: Omit<GraphCommit<TChange>, "parent">): GraphCommit<TChange>;
|
|
131
168
|
export type ChangeAtomIdRangeMap<V> = RangeMap<ChangeAtomId, V>;
|
|
132
169
|
export declare function newChangeAtomIdRangeMap<V>(): ChangeAtomIdRangeMap<V>;
|
|
170
|
+
export declare function newChangeAtomIdTransform(): ChangeAtomIdRangeMap<ChangeAtomId>;
|
|
133
171
|
export declare function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number;
|
|
134
172
|
export declare function compareRevisions(a: RevisionTag | undefined, b: RevisionTag | undefined): number;
|
|
135
173
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACN,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,QAAQ,EAIR,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACN,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,QAAQ,EAIR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,eAAe,gDAAiC,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,wBAAwB,GAAG,MAAM,CAAC;AAC5D,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,mBAAmB,EAAE,oBAAoB,CAAC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;CACnC;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAExE;;;;;GAKG;AAGH,wBAAgB,UAAU,CAAC,OAAO,EACjC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAC5B,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GAC1C,WAAW,CAAC,OAAO,CAAC,CAOtB;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AAEhE,wBAAgB,uBAAuB,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,CAEpE;AAED,wBAAgB,wBAAwB,IAAI,oBAAoB,CAAC,YAAY,CAAC,CAE7E;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,MAAM,CAO9E;AAED,wBAAgB,gBAAgB,CAC/B,CAAC,EAAE,WAAW,GAAG,SAAS,EAC1B,CAAC,EAAE,WAAW,GAAG,SAAS,GACxB,MAAM,CAYR"}
|
package/lib/core/rebase/types.js
CHANGED
|
@@ -79,6 +79,9 @@ export function mintCommit(parent, commit) {
|
|
|
79
79
|
export function newChangeAtomIdRangeMap() {
|
|
80
80
|
return new RangeMap(offsetChangeAtomId, subtractChangeAtomIds);
|
|
81
81
|
}
|
|
82
|
+
export function newChangeAtomIdTransform() {
|
|
83
|
+
return new RangeMap(offsetChangeAtomId, subtractChangeAtomIds, offsetChangeAtomId);
|
|
84
|
+
}
|
|
82
85
|
export function subtractChangeAtomIds(a, b) {
|
|
83
86
|
const cmp = compareRevisions(a.revision, b.revision);
|
|
84
87
|
if (cmp !== 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,IAA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,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC/B,CAA0B,EAC1B,CAA0B;IAE1B,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC;IACV,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC,CAAC;IACX,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC;AACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"@fluidframework/id-compressor\";\nimport { Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\ttype NestedMap,\n\tRangeMap,\n\tbrand,\n\tbrandedNumberType,\n\tbrandedStringType,\n} from \"../../util/index.js\";\n\n/**\n * The identifier for a particular session/user/client that can generate `GraphCommit`s\n */\nexport const SessionIdSchema = brandedStringType<SessionId>();\n\n/**\n * A unique identifier for a commit. Commits that have been rebased, but are semantically\n * the same, will share the same revision tag.\n *\n * The constant 'root' is reserved for the trunk base: minting a SessionSpaceCompressedId is not\n * possible on readonly clients. These clients generally don't need ids, but must be done at tree initialization time.\n */\nexport type RevisionTag = SessionSpaceCompressedId | \"root\";\nexport type EncodedRevisionTag = Brand<OpSpaceCompressedId, \"EncodedRevisionTag\"> | \"root\";\nexport const RevisionTagSchema = Type.Union([\n\tType.Literal(\"root\"),\n\tbrandedNumberType<Exclude<EncodedRevisionTag, string>>(),\n]);\n\nexport type EncodedStableId = Brand<StableId, \"EncodedStableId\">;\nexport const StableIdSchema = Type.String();\n\n/**\n * An ID which is unique within a revision of a `ModularChangeset`.\n * A `ModularChangeset` which is a composition of multiple revisions may contain duplicate `ChangesetLocalId`s,\n * but they are unique when qualified by the revision of the change they are used in.\n */\nexport type ChangesetLocalId = Brand<number, \"ChangesetLocalId\">;\n\n/**\n * A globally unique ID for an atom of change, or a node associated with the atom of change.\n * *\n * @privateRemarks\n * TODO: Rename this to be more general.\n */\nexport interface ChangeAtomId {\n\t/**\n\t * Uniquely identifies the changeset within which the change was made.\n\t * Only undefined when referring to an anonymous changesets.\n\t */\n\treadonly revision?: RevisionTag;\n\t/**\n\t * Uniquely identifies, in the scope of the changeset, the change made to the field.\n\t */\n\treadonly localId: ChangesetLocalId;\n}\n\nexport type EncodedChangeAtomId = [ChangesetLocalId, EncodedRevisionTag] | ChangesetLocalId;\n\nexport type ChangeAtomIdMap<T> = NestedMap<RevisionTag | undefined, ChangesetLocalId, T>;\n\n/**\n * Returns true iff `a` and `b` are the same.\n */\nexport function areEqualChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): boolean {\n\treturn a.localId === b.localId && a.revision === b.revision;\n}\n\nexport function areEqualChangeAtomIdOpts(\n\ta: ChangeAtomId | undefined,\n\tb: ChangeAtomId | undefined,\n): boolean {\n\tif (a === undefined || b === undefined) {\n\t\treturn a === b;\n\t}\n\n\treturn areEqualChangeAtomIds(a, b);\n}\n\n/**\n * Returns a ChangeAtomId with the given revision and local ID.\n */\nexport function makeChangeAtomId(\n\tlocalId: ChangesetLocalId,\n\trevision?: RevisionTag,\n): ChangeAtomId {\n\treturn revision === undefined ? { localId } : { localId, revision };\n}\n\nexport function asChangeAtomId(id: ChangesetLocalId | ChangeAtomId): ChangeAtomId {\n\treturn typeof id === \"object\" ? id : { localId: id };\n}\n\nexport function taggedAtomId(\n\tid: ChangeAtomId,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId {\n\treturn makeChangeAtomId(id.localId, id.revision ?? revision);\n}\n\nexport function taggedOptAtomId(\n\tid: ChangeAtomId | undefined,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId | undefined {\n\tif (id === undefined) {\n\t\treturn undefined;\n\t}\n\treturn taggedAtomId(id, revision);\n}\n\nexport function offsetChangeAtomId(id: ChangeAtomId, offset: number): ChangeAtomId {\n\treturn { ...id, localId: brand(id.localId + offset) };\n}\n\n/**\n * A node in a graph of commits. A commit's parent is the commit on which it was based.\n */\nexport interface GraphCommit<TChange> {\n\t/**\n\t * The tag for this commit.\n\t * @remarks\n\t * If this commit is rebased, the corresponding rebased commit will retain this tag.\n\t * With the exception of transaction commits (which all share the same tag), this tag is unique within a given branch history.\n\t */\n\treadonly revision: RevisionTag;\n\t/** The change that will result from applying this commit */\n\treadonly change: TChange;\n\t/** The parent of this commit, on whose change this commit's change is based */\n\treadonly parent?: GraphCommit<TChange>;\n}\n\n/**\n * The type of a commit. This is used to describe the context in which the commit was created.\n *\n * @public\n */\nexport enum CommitKind {\n\t/** A commit corresponding to a change that is not the result of an undo/redo from this client. */\n\tDefault,\n\t/** A commit that is the result of an undo from this client. */\n\tUndo,\n\t/** A commit that is the result of a redo from this client. */\n\tRedo,\n}\n\n/**\n * Information about a commit that has been applied.\n *\n * @sealed @public\n */\nexport interface CommitMetadata {\n\t/**\n\t * A {@link CommitKind} enum value describing whether the commit represents an Edit, an Undo, or a Redo.\n\t */\n\treadonly kind: CommitKind;\n\t/**\n\t * Indicates whether the commit is a local edit\n\t */\n\treadonly isLocal: boolean;\n}\n\n/**\n * Information about a commit that has been applied.\n *\n * @sealed @alpha\n */\nexport type ChangeMetadata = CommitMetadata &\n\t(\n\t\t| {\n\t\t\t\treadonly isLocal: true;\n\t\t\t\t/**\n\t\t\t\t * A serializable object that encodes the change.\n\t\t\t\t * @remarks This change object can be {@link TreeBranchAlpha.applyChange | applied to another branch} in the same state as the one which generated it.\n\t\t\t\t * The change object must be applied to a SharedTree with the same IdCompressor session ID as it was created from.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * This is a `SerializedChange` from treeCheckout.ts.\n\t\t\t\t */\n\t\t\t\tgetChange(): JsonCompatibleReadOnly;\n\t\t }\n\t\t| {\n\t\t\t\treadonly isLocal: false;\n\t\t\t\treadonly getChange?: undefined;\n\t\t }\n\t);\n\n/**\n * Creates a new graph commit object. This is useful for creating copies of commits with different parentage.\n * @param parent - the parent of the new commit\n * @param commit - the contents of the new commit object\n * @returns the new commit object\n */\n// Note that this function is synchronous, and therefore it is not a Promise.\n// However, it is still a strong commit-mint.\nexport function mintCommit<TChange>(\n\tparent: GraphCommit<TChange>,\n\tcommit: Omit<GraphCommit<TChange>, \"parent\">,\n): GraphCommit<TChange> {\n\tconst { revision, change } = commit;\n\treturn {\n\t\trevision,\n\t\tchange,\n\t\tparent,\n\t};\n}\n\nexport type ChangeAtomIdRangeMap<V> = RangeMap<ChangeAtomId, V>;\n\nexport function newChangeAtomIdRangeMap<V>(): ChangeAtomIdRangeMap<V> {\n\treturn new RangeMap(offsetChangeAtomId, subtractChangeAtomIds);\n}\n\nexport function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number {\n\tconst cmp = compareRevisions(a.revision, b.revision);\n\tif (cmp !== 0) {\n\t\treturn cmp * Number.POSITIVE_INFINITY;\n\t}\n\n\treturn a.localId - b.localId;\n}\n\nexport function compareRevisions(\n\ta: RevisionTag | undefined,\n\tb: RevisionTag | undefined,\n): number {\n\tif (a === undefined) {\n\t\treturn b === undefined ? 0 : -1;\n\t} else if (b === undefined) {\n\t\treturn 1;\n\t} else if (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"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,EAAE,CAAe;IACrE,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;QACf,OAAO,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC/B,CAA0B,EAC1B,CAA0B;IAE1B,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC;IACV,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC,CAAC;IACX,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC;AACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"@fluidframework/id-compressor\";\nimport { Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\ttype NestedMap,\n\tRangeMap,\n\tbrand,\n\tbrandedNumberType,\n\tbrandedStringType,\n} from \"../../util/index.js\";\nimport type { RevertibleAlpha } from \"../revertible.js\";\n\n/**\n * The identifier for a particular session/user/client that can generate `GraphCommit`s\n */\nexport const SessionIdSchema = brandedStringType<SessionId>();\n\n/**\n * A unique identifier for a commit. Commits that have been rebased, but are semantically\n * the same, will share the same revision tag.\n *\n * The constant 'root' is reserved for the trunk base: minting a SessionSpaceCompressedId is not\n * possible on readonly clients. These clients generally don't need ids, but must be done at tree initialization time.\n */\nexport type RevisionTag = SessionSpaceCompressedId | \"root\";\nexport type EncodedRevisionTag = Brand<OpSpaceCompressedId, \"EncodedRevisionTag\"> | \"root\";\nexport const RevisionTagSchema = Type.Union([\n\tType.Literal(\"root\"),\n\tbrandedNumberType<Exclude<EncodedRevisionTag, string>>(),\n]);\n\nexport type EncodedStableId = Brand<StableId, \"EncodedStableId\">;\nexport const StableIdSchema = Type.String();\n\n/**\n * An ID which is unique within a revision of a `ModularChangeset`.\n * A `ModularChangeset` which is a composition of multiple revisions may contain duplicate `ChangesetLocalId`s,\n * but they are unique when qualified by the revision of the change they are used in.\n */\nexport type ChangesetLocalId = Brand<number, \"ChangesetLocalId\">;\n\n/**\n * A globally unique ID for an atom of change, or a node associated with the atom of change.\n * *\n * @privateRemarks\n * TODO: Rename this to be more general.\n */\nexport interface ChangeAtomId {\n\t/**\n\t * Uniquely identifies the changeset within which the change was made.\n\t * Only undefined when referring to an anonymous changesets.\n\t */\n\treadonly revision?: RevisionTag;\n\t/**\n\t * Uniquely identifies, in the scope of the changeset, the change made to the field.\n\t */\n\treadonly localId: ChangesetLocalId;\n}\n\nexport type EncodedChangeAtomId = [ChangesetLocalId, EncodedRevisionTag] | ChangesetLocalId;\n\nexport type ChangeAtomIdMap<T> = NestedMap<RevisionTag | undefined, ChangesetLocalId, T>;\n\n/**\n * Returns true iff `a` and `b` are the same.\n */\nexport function areEqualChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): boolean {\n\treturn a.localId === b.localId && a.revision === b.revision;\n}\n\nexport function areEqualChangeAtomIdOpts(\n\ta: ChangeAtomId | undefined,\n\tb: ChangeAtomId | undefined,\n): boolean {\n\tif (a === undefined || b === undefined) {\n\t\treturn a === b;\n\t}\n\n\treturn areEqualChangeAtomIds(a, b);\n}\n\n/**\n * Returns a ChangeAtomId with the given revision and local ID.\n */\nexport function makeChangeAtomId(\n\tlocalId: ChangesetLocalId,\n\trevision?: RevisionTag,\n): ChangeAtomId {\n\treturn revision === undefined ? { localId } : { localId, revision };\n}\n\nexport function asChangeAtomId(id: ChangesetLocalId | ChangeAtomId): ChangeAtomId {\n\treturn typeof id === \"object\" ? id : { localId: id };\n}\n\nexport function taggedAtomId(\n\tid: ChangeAtomId,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId {\n\treturn makeChangeAtomId(id.localId, id.revision ?? revision);\n}\n\nexport function taggedOptAtomId(\n\tid: ChangeAtomId | undefined,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId | undefined {\n\tif (id === undefined) {\n\t\treturn undefined;\n\t}\n\treturn taggedAtomId(id, revision);\n}\n\nexport function offsetChangeAtomId<T extends ChangeAtomId = ChangeAtomId>(\n\tid: T,\n\toffset: number,\n): T {\n\treturn { ...id, localId: brand(id.localId + offset) };\n}\n\n/**\n * A node in a graph of commits. A commit's parent is the commit on which it was based.\n */\nexport interface GraphCommit<TChange> {\n\t/**\n\t * The tag for this commit.\n\t * @remarks\n\t * If this commit is rebased, the corresponding rebased commit will retain this tag.\n\t * With the exception of transaction commits (which all share the same tag), this tag is unique within a given branch history.\n\t */\n\treadonly revision: RevisionTag;\n\t/** The change that will result from applying this commit */\n\treadonly change: TChange;\n\t/** The parent of this commit, on whose change this commit's change is based */\n\treadonly parent?: GraphCommit<TChange>;\n}\n\n/**\n * The type of a commit. This is used to describe the context in which the commit was created.\n *\n * @public\n */\nexport enum CommitKind {\n\t/** A commit corresponding to a change that is not the result of an undo/redo from this client. */\n\tDefault,\n\t/** A commit that is the result of an undo from this client. */\n\tUndo,\n\t/** A commit that is the result of a redo from this client. */\n\tRedo,\n}\n\n/**\n * Information about a commit that has been applied.\n *\n * @sealed @public\n */\nexport interface CommitMetadata {\n\t/**\n\t * A {@link CommitKind} enum value describing whether the commit represents an Edit, an Undo, or a Redo.\n\t */\n\treadonly kind: CommitKind;\n\t/**\n\t * Indicates whether the commit is a local edit\n\t */\n\treadonly isLocal: boolean;\n}\n\n/**\n * Information about a change that has been applied by the local client.\n * @sealed @alpha\n */\nexport interface LocalChangeMetadata extends CommitMetadata {\n\t/**\n\t * Whether the change was made on the local machine/client or received from a remote client.\n\t */\n\treadonly isLocal: true;\n\t/**\n\t * Returns a serializable object that encodes the change.\n\t * @remarks This is only available for local changes.\n\t * This change object can be {@link TreeBranchAlpha.applyChange | applied to another branch} in the same state as the one which generated it.\n\t * The change object must be applied to a SharedTree with the same IdCompressor session ID as it was created from.\n\t * @privateRemarks\n\t * This is a `SerializedChange` from treeCheckout.ts.\n\t */\n\tgetChange(): JsonCompatibleReadOnly;\n\t/**\n\t * Returns an object (a {@link RevertibleAlpha | \"revertible\"}) that can be used to revert the change that produced this event.\n\t * @remarks This is only available for local changes.\n\t * If the change is not revertible (for example, it was a change to the application schema), then this will return `undefined`.\n\t * Revertibles should be disposed when they are no longer needed.\n\t * @param onDisposed - A callback that will be invoked when the `Revertible` is disposed.\n\t * This happens when the `Revertible` is disposed manually or when the `TreeView` that the `Revertible` belongs to is disposed - whichever happens first.\n\t * This is typically used to clean up any resources associated with the `Revertible` in the host application.\n\t * @throws Throws an error if called outside the scope of the `changed` event that provided it.\n\t */\n\tgetRevertible(\n\t\tonDisposed?: (revertible: RevertibleAlpha) => void,\n\t): RevertibleAlpha | undefined;\n}\n\n/**\n * Information about a change that has been applied by a remote client.\n * @sealed @alpha\n */\nexport interface RemoteChangeMetadata extends CommitMetadata {\n\t/**\n\t * Whether the change was made on the local machine/client or received from a remote client.\n\t */\n\treadonly isLocal: false;\n\t/**\n\t * Returns a serializable object that encodes the change.\n\t * @remarks This is only available for {@link LocalChangeMetadata | local changes}.\n\t */\n\treadonly getChange?: undefined;\n\t/**\n\t * Returns an object (a {@link RevertibleAlpha | \"revertible\"}) that can be used to revert the change that produced this event.\n\t * @remarks This is only available for {@link LocalChangeMetadata | local changes}.\n\t */\n\treadonly getRevertible?: undefined;\n}\n\n/**\n * Information about a {@link LocalChangeMetadata | local} or {@link RemoteChangeMetadata | remote} change that has been applied.\n * @sealed @alpha\n */\nexport type ChangeMetadata = LocalChangeMetadata | RemoteChangeMetadata;\n\n/**\n * Creates a new graph commit object. This is useful for creating copies of commits with different parentage.\n * @param parent - the parent of the new commit\n * @param commit - the contents of the new commit object\n * @returns the new commit object\n */\n// Note that this function is synchronous, and therefore it is not a Promise.\n// However, it is still a strong commit-mint.\nexport function mintCommit<TChange>(\n\tparent: GraphCommit<TChange>,\n\tcommit: Omit<GraphCommit<TChange>, \"parent\">,\n): GraphCommit<TChange> {\n\tconst { revision, change } = commit;\n\treturn {\n\t\trevision,\n\t\tchange,\n\t\tparent,\n\t};\n}\n\nexport type ChangeAtomIdRangeMap<V> = RangeMap<ChangeAtomId, V>;\n\nexport function newChangeAtomIdRangeMap<V>(): ChangeAtomIdRangeMap<V> {\n\treturn new RangeMap(offsetChangeAtomId, subtractChangeAtomIds);\n}\n\nexport function newChangeAtomIdTransform(): ChangeAtomIdRangeMap<ChangeAtomId> {\n\treturn new RangeMap(offsetChangeAtomId, subtractChangeAtomIds, offsetChangeAtomId);\n}\n\nexport function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number {\n\tconst cmp = compareRevisions(a.revision, b.revision);\n\tif (cmp !== 0) {\n\t\treturn cmp * Number.POSITIVE_INFINITY;\n\t}\n\n\treturn a.localId - b.localId;\n}\n\nexport function compareRevisions(\n\ta: RevisionTag | undefined,\n\tb: RevisionTag | undefined,\n): number {\n\tif (a === undefined) {\n\t\treturn b === undefined ? 0 : -1;\n\t} else if (b === undefined) {\n\t\treturn 1;\n\t} else if (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG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rebaseDistance: targetCommits.length,
|
|
132
132
|
countDropped: sourceBranchLength - sourceSet.size,
|
|
133
133
|
},
|
|
134
|
-
}, "sourceChange", () =>
|
|
134
|
+
}, "sourceChange", () => {
|
|
135
|
+
return changeRebaser.compose(editsToCompose);
|
|
136
|
+
});
|
|
135
137
|
}
|
|
136
138
|
/**
|
|
137
139
|
* "Sandwich/Horseshoe Rebase" a change over the given source and target branches
|
|
@@ -160,25 +162,45 @@ export function rebaseChange(changeRebaser, change, sourceHead, targetHead, mint
|
|
|
160
162
|
};
|
|
161
163
|
}
|
|
162
164
|
export function revisionMetadataSourceFromInfo(revInfos) {
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
|
|
165
|
+
const compareRevisions = (revision1, revision2) => {
|
|
166
|
+
const index1 = getIndex(revision1);
|
|
167
|
+
const index2 = getIndex(revision2);
|
|
168
|
+
if (index1 !== undefined) {
|
|
169
|
+
return index2 === undefined ? -1 : index2 - index1;
|
|
170
|
+
}
|
|
171
|
+
return index2 === undefined ? 0 : 1;
|
|
166
172
|
};
|
|
167
173
|
const tryGetInfo = (revision) => {
|
|
168
174
|
if (revision === undefined) {
|
|
169
175
|
return undefined;
|
|
170
176
|
}
|
|
171
|
-
|
|
172
|
-
return index === undefined ? undefined : revInfos[index];
|
|
177
|
+
return revInfos.find((info) => info.revision === revision);
|
|
173
178
|
};
|
|
174
179
|
const hasRollback = (revision) => {
|
|
175
180
|
return revInfos.some((info) => info.rollbackOf === revision);
|
|
176
181
|
};
|
|
177
|
-
|
|
182
|
+
const getIndex = (revision) => {
|
|
183
|
+
const index = revInfos.findIndex((revInfo) => revInfo.revision === revision);
|
|
184
|
+
if (index >= 0) {
|
|
185
|
+
return index;
|
|
186
|
+
}
|
|
187
|
+
const rollbackIndex = revInfos.findIndex((revInfo) => revInfo.rollbackOf === revision);
|
|
188
|
+
if (rollbackIndex >= 0) {
|
|
189
|
+
// This change is the forward revision of a rollback included in revInfos, so it comes after
|
|
190
|
+
// all revisions in revInfos. Earlier rollbacks have later forward revisions.
|
|
191
|
+
return 2 * revInfos.length - rollbackIndex;
|
|
192
|
+
}
|
|
193
|
+
return undefined;
|
|
194
|
+
};
|
|
195
|
+
return { compareRevisions, tryGetInfo, hasRollback };
|
|
178
196
|
}
|
|
179
197
|
export function rebaseChangeOverChanges(changeRebaser, changeToRebase, changesToRebaseOver) {
|
|
180
198
|
const revisionMetadata = revisionMetadataSourceFromInfo(getRevInfoFromTaggedChanges([...changesToRebaseOver, changeToRebase]));
|
|
181
|
-
|
|
199
|
+
let result = changeToRebase;
|
|
200
|
+
for (const b of changesToRebaseOver) {
|
|
201
|
+
result = mapTaggedChange(changeToRebase, changeRebaser.rebase(result, b, revisionMetadata));
|
|
202
|
+
}
|
|
203
|
+
return result.change;
|
|
182
204
|
}
|
|
183
205
|
// TODO: Deduplicate
|
|
184
206
|
function getRevInfoFromTaggedChanges(changes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/rebase/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAgB,MAAM,qBAAqB,CAAC;AAEtF,OAAO,EAKN,cAAc,EACd,eAAe,EACf,SAAS,EACT,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAsC,UAAU,EAAE,MAAM,YAAY,CAAC;AAuK5E,MAAM,UAAU,YAAY,CAC3B,eAAkC,EAClC,aAAqC,EACrC,UAAgC,EAChC,YAAkC,EAClC,UAAU,GAAG,YAAY;IAEzB,4CAA4C;IAC5C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,E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AC;IAC9C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5F,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1C,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,CAAC,CAC1D,CAAC;IAEF,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnB,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport { defineLazyCachedProperty, hasSome, type Mutable } from \"../../util/index.js\";\n\nimport {\n\ttype ChangeRebaser,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype TaggedChange,\n\tmakeAnonChange,\n\tmapTaggedChange,\n\ttagChange,\n\ttagRollbackInverse,\n} from \"./changeRebaser.js\";\nimport { type GraphCommit, type RevisionTag, mintCommit } from \"./types.js\";\n\n/**\n * Contains information about how the commit graph changed as the result of rebasing a source branch onto another target branch.\n * @remarks\n * ```text\n * Consider the commit graph below containing two branches, X and Y, with head commits C and E, respectively.\n * Branch Y branches off of Branch X at their common ancestor commit A, i.e. \"Y is based off of X at commit A\".\n *\n * A ─ B ─ C ← Branch X\n * └─ D ─ E ← Branch Y\n *\n * Branch Y is then rebased onto Branch X. This results in the following commit graph:\n *\n * A ─ B ─ C ← Branch X\n * └─ D'─ E'← Branch Y\n *\n * Commits D' and E' are the rebased versions of commits D and E, respectively. This results in:\n * deletedSourceCommits: [D, E],\n * targetCommits: [B, C],\n * sourceCommits: [D', E']\n * ```\n */\nexport interface RebasedCommits<TChange> {\n\t/**\n\t * The commits on the original source branch that were rebased. These are no longer referenced by the source branch and have\n\t * been replaced with new versions on the new source branch, see {@link sourceCommits}. In the case that the source\n\t * branch was already ahead of the target branch before the rebase, this list will be empty.\n\t */\n\tdeletedSourceCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the target branch that the source branch's commits were rebased over. These are now the direct\n\t * ancestors of {@link sourceCommits}. In the case that the source branch was already ahead of the target branch\n\t * before the rebase, this list will be empty.\n\t */\n\ttargetCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the source branch that are not also on the target branch after the rebase operation. In the case that the\n\t * source branch was already ahead of the target branch before the rebase, these are the same commits that were already on\n\t * the source branch before the rebase, otherwise these are the new, rebased versions of {@link deletedSourceCommits}.\n\t */\n\tsourceCommits: GraphCommit<TChange>[];\n}\n\n/**\n * Telemetry metrics for a rebase operation.\n */\nexport interface RebaseStats {\n\t/**\n\t * The length of the source branch before the rebase.\n\t */\n\treadonly sourceBranchLength: number;\n\t/**\n\t * Number of commits rebased over on the target branch.\n\t */\n\treadonly rebaseDistance: number;\n\t/**\n\t * The number of commits that are dropped from the source branch when rebased to the target branch.\n\t */\n\treadonly countDropped: number;\n}\n\nexport interface RebaseStatsWithDuration extends RebaseStats {\n\treadonly duration: number;\n}\n\nexport interface BranchRebaseResult<TChange> {\n\t/**\n\t * The head of a rebased source branch.\n\t */\n\treadonly newSourceHead: GraphCommit<TChange>;\n\t/**\n\t * A thunk that computes the cumulative change to the source branch (undefined if no change occurred)\n\t */\n\treadonly sourceChange: TChange | undefined;\n\t/**\n\t * Details about how the commits on the source branch changed\n\t */\n\treadonly commits: RebasedCommits<TChange>;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\ninterface RebaseChangeResult<TChange> {\n\treadonly change: TChange;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `targetHead`\n * @param targetHead - the commit to rebase the source branch onto\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. For example:\n * ```\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (B')-(D) <- Branch Y\n * //\n * // As Branch Y is rebased onto Branch X, commits B and B' cancel out so there is no version of B on the new rebased source branch\n * //\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (D') <- Branch Y'\n * //\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `newBase`\n * @param targetCommit - the commit on the target branch to rebase the source branch onto.\n * @param targetHead - the head of the branch that `newBase` belongs to. Must be `newBase` or a descendent of `newBase`.\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. Additionally, this function will rebase\n * the source branch _farther_ than `newBase` if the source branch's next commits after `newBase` match those on the target branch.\n * For example:\n * ```\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (B')-(D')-(F) <- Branch Y\n * //\n * // If Branch Y is rebased onto commit C of Branch X, the branches must at least look like this afterwards (B was cancelled out):\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (D'')-(F') <- Branch Y'\n * //\n * // But this function will recognize that B is equivalent to B' and D is equivalent to D', and instead produce:\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (F') <- Branch Y'\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead = targetCommit,\n): BranchRebaseResult<TChange> {\n\t// Get both source and target as path arrays\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]);\n\tassert(ancestor !== undefined, 0x675 /* branches must be related */);\n\n\tconst sourceBranchLength = sourcePath.length;\n\n\t// Find where `targetCommit` is in the target branch\n\tconst targetCommitIndex = targetPath.indexOf(targetCommit);\n\tif (targetCommitIndex === -1) {\n\t\t// If the targetCommit is not in the target path, then it is either disjoint from `target` or it is behind/at\n\t\t// the commit where source and target diverge (ancestor), in which case there is nothing more to rebase\n\t\t// TODO: Ideally, this would be an \"assertExpensive\". It is commented out because it causes O(N²) behavior when\n\t\t// processing N inbound commits from the same client whose ref seq# is not advancing (which is a common case).\n\t\t// N can be large when the client is sending a burst of changes (potentially on reconnection).\n\t\t// assert(\n\t\t// \tfindCommonAncestor(targetCommit, targetHead) !== undefined,\n\t\t// \t0x676 /* target commit is not in target branch */,\n\t\t// );\n\t\treturn {\n\t\t\tnewSourceHead: sourceHead,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: { deletedSourceCommits: [], targetCommits: [], sourceCommits: sourcePath },\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommitIndex + 1,\n\t\t\t\tcountDropped: 0,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Iterate through the target path and look for commits that are also present on the source branch (i.e. they\n\t// have matching tags). Each commit found in the target branch can be skipped when processing the source branch\n\t// because it has already been rebased onto the target. In the case that one or more of these commits are present\n\t// directly after `targetCommit`, then the new base can be advanced further without having to do any work.\n\tconst sourceSet = new Set(sourcePath.map((r) => r.revision));\n\tlet newBaseIndex = targetCommitIndex;\n\n\tfor (const [i, { revision }] of targetPath.entries()) {\n\t\tif (sourceSet.has(revision)) {\n\t\t\tsourceSet.delete(revision);\n\t\t\tnewBaseIndex = Math.max(newBaseIndex, i);\n\t\t} else if (i > targetCommitIndex) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/** The commit on the target branch that the new source branch branches off of (i.e. the new common ancestor) */\n\tconst newBase = targetPath[newBaseIndex] ?? oob();\n\t// Figure out how much of the trunk to start rebasing over.\n\tconst targetCommits = targetPath.slice(0, newBaseIndex + 1);\n\tconst deletedSourceCommits = [...sourcePath];\n\n\t// If the source and target rebase path begin with a range that has all the same revisions, remove it; it is\n\t// equivalent on both branches and doesn't need to be rebased.\n\tconst targetRebasePath = [...targetCommits];\n\tif (hasSome(sourcePath) && hasSome(targetRebasePath)) {\n\t\tconst minLength = Math.min(sourcePath.length, targetRebasePath.length);\n\t\tfor (let i = 0; i < minLength; i++) {\n\t\t\tconst firstSourcePath = sourcePath[0];\n\t\t\tconst firstTargetRebasePath = targetRebasePath[0];\n\t\t\tif (firstSourcePath.revision === firstTargetRebasePath.revision) {\n\t\t\t\tsourcePath.shift();\n\t\t\t\ttargetRebasePath.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst sourceCommits: GraphCommit<TChange>[] = [];\n\n\t// If all commits that are about to be rebased over on the target branch already comprise the start of the source branch,\n\t// are in the same order, and have no other commits interleaving them, then no rebasing needs to occur. Those commits can\n\t// simply be removed from the source branch, and the remaining commits on the source branch are reparented off of the new\n\t// base commit.\n\tif (!hasSome(targetRebasePath)) {\n\t\tfor (const c of sourcePath) {\n\t\t\tsourceCommits.push(mintCommit(sourceCommits[sourceCommits.length - 1] ?? newBase, c));\n\t\t}\n\t\treturn {\n\t\t\tnewSourceHead: sourceCommits[sourceCommits.length - 1] ?? newBase,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t};\n\t}\n\n\t// For each source commit, rebase backwards over the inverses of any commits already rebased, and then\n\t// rebase forwards over the rest of the commits up to the new base before advancing the new base.\n\tlet newHead = newBase;\n\tconst revInfos = getRevInfoFromTaggedChanges([...targetRebasePath, ...sourcePath]);\n\t// Note that the `revisionMetadata` gets updated as `revInfos` gets updated.\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(revInfos);\n\tlet editsToCompose: TaggedChange<TChange>[] = [...targetRebasePath];\n\tfor (const c of sourcePath) {\n\t\tconst rollback = rollbackFromCommit(changeRebaser, c, mintRevisionTag, true /* cache */);\n\t\tif (sourceSet.has(c.revision)) {\n\t\t\tconst currentComposedEdit = makeAnonChange(changeRebaser.compose(editsToCompose));\n\t\t\teditsToCompose = [currentComposedEdit];\n\t\t\tconst change = changeRebaser.rebase(c, currentComposedEdit, revisionMetadata);\n\t\t\tnewHead = {\n\t\t\t\trevision: c.revision,\n\t\t\t\tchange,\n\t\t\t\tparent: newHead,\n\t\t\t};\n\t\t\tsourceCommits.push(newHead);\n\t\t\teditsToCompose.push(tagChange(change, c.revision));\n\t\t}\n\t\trevInfos.push({ revision: c.revision });\n\t\teditsToCompose.unshift(rollback);\n\t\trevInfos.unshift({ revision: rollback.revision, rollbackOf: rollback.rollbackOf });\n\t}\n\n\treturn defineLazyCachedProperty(\n\t\t{\n\t\t\tnewSourceHead: newHead,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t},\n\t\t\"sourceChange\",\n\t\t() => changeRebaser.compose(editsToCompose),\n\t);\n}\n\n/**\n * \"Sandwich/Horseshoe Rebase\" a change over the given source and target branches\n * @param changeRebaser - the change rebaser responsible for rebasing the change over the commits in each branch\n * @param change - the change to rebase\n * @param sourceHead - the head of the branch that `change` is based on\n * @param targetHead - the branch to rebase `change` onto\n * @returns the rebased change\n *\n * @remarks inverses will be cached.\n */\nexport function rebaseChange<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchange: TaggedChange<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): RebaseChangeResult<TChange> {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tassert(\n\t\tfindCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]) !== undefined,\n\t\t0x576 /* branch A and branch B must be related */,\n\t);\n\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag, true),\n\t);\n\tinverses.reverse();\n\n\tconst telemetryProperties = {\n\t\tsourceBranchLength: 1,\n\t\trebaseDistance: sourcePath.length + targetPath.length,\n\t\tcountDropped: 0,\n\t};\n\n\treturn {\n\t\tchange: rebaseChangeOverChanges(changeRebaser, change, [...inverses, ...targetPath]),\n\t\ttelemetryProperties,\n\t};\n}\n\nexport function revisionMetadataSourceFromInfo(\n\trevInfos: readonly RevisionInfo[],\n): RevisionMetadataSource {\n\tconst getIndex = (revision: RevisionTag): number | undefined => {\n\t\tconst index = revInfos.findIndex((revInfo) => revInfo.revision === revision);\n\t\treturn index >= 0 ? index : undefined;\n\t};\n\tconst tryGetInfo = (revision: RevisionTag | undefined): RevisionInfo | undefined => {\n\t\tif (revision === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst index = getIndex(revision);\n\t\treturn index === undefined ? undefined : revInfos[index];\n\t};\n\n\tconst hasRollback = (revision: RevisionTag): boolean => {\n\t\treturn revInfos.some((info) => info.rollbackOf === revision);\n\t};\n\n\treturn { getIndex, tryGetInfo, hasRollback };\n}\n\nexport function rebaseChangeOverChanges<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchangeToRebase: TaggedChange<TChange>,\n\tchangesToRebaseOver: TaggedChange<TChange>[],\n): TChange {\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(\n\t\tgetRevInfoFromTaggedChanges([...changesToRebaseOver, changeToRebase]),\n\t);\n\n\treturn changesToRebaseOver.reduce(\n\t\t(a, b) => mapTaggedChange(changeToRebase, changeRebaser.rebase(a, b, revisionMetadata)),\n\t\tchangeToRebase,\n\t).change;\n}\n\n// TODO: Deduplicate\nfunction getRevInfoFromTaggedChanges(changes: TaggedChange<unknown>[]): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tfor (const taggedChange of changes) {\n\t\trevInfos.push(...revisionInfoFromTaggedChange(taggedChange));\n\t}\n\n\treturn revInfos;\n}\n\n// TODO: Deduplicate\nfunction revisionInfoFromTaggedChange(taggedChange: TaggedChange<unknown>): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tif (taggedChange.revision !== undefined) {\n\t\tconst info: Mutable<RevisionInfo> = { revision: taggedChange.revision };\n\t\tif (taggedChange.rollbackOf !== undefined) {\n\t\t\tinfo.rollbackOf = taggedChange.rollbackOf;\n\t\t}\n\t\trevInfos.push(info);\n\t}\n\treturn revInfos;\n}\n\nfunction rollbackFromCommit<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tcommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n\tcache?: boolean,\n): TaggedChange<TChange, RevisionTag> {\n\tconst cachedRollback = Rollback.get(commit);\n\tif (cachedRollback !== undefined) {\n\t\treturn cachedRollback;\n\t}\n\tconst tag = mintRevisionTag();\n\tconst rollback = tagRollbackInverse(\n\t\tchangeRebaser.invert(commit, true, tag),\n\t\ttag,\n\t\tcommit.revision,\n\t);\n\n\tif (cache === true) {\n\t\tRollback.set(commit, rollback);\n\t}\n\treturn rollback;\n}\n\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T, path?: T[]],\n): T;\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors. Returns\n * `undefined` if `descendant` is undefined.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n): T | undefined;\n/**\n * Find an ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the ancestor found by `predicate`,\n * but otherwise including `descendant`).\n * @param predicate - a function which will be evaluated on `descendant` and then ancestor of `descendant` (in ascending order) until it returns true.\n * @returns the closest ancestor of `descendant` that satisfies `predicate`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * id: string;\n * parent?: Parented;\n * }\n * const g = { id: \"g\" }; // Grandparent\n * const p = { parent: g, id: \"p\" }; // Parent\n * const c = { parent: p, id: \"c\" }; // Child\n * const path: Parented[] = [];\n * const ancestor = findAncestor<Parented>([c, path], (n) => n.id === \"g\");\n * // ancestor === g\n * // path === [p, c]\n * ```\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean,\n): T | undefined;\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean = (t): boolean => t.parent === undefined,\n): T | undefined {\n\tlet d: T | undefined;\n\tlet path: T[] | undefined;\n\tif (Array.isArray(descendant)) {\n\t\t[d, path] = descendant;\n\t} else {\n\t\td = descendant;\n\t}\n\tfor (let cur = d; cur !== undefined; cur = cur.parent) {\n\t\tif (predicate(cur)) {\n\t\t\tpath?.reverse();\n\t\t\treturn cur;\n\t\t}\n\t\tpath?.push(cur);\n\t}\n\n\tif (path !== undefined) {\n\t\tpath.length = 0;\n\t}\n\treturn undefined;\n}\n\n/**\n * Find a common ancestor between two descendants that are linked by parent pointers.\n * @param descendantA - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantA` (not including the ancestor).\n * @param descendantB - another descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantB` (not including the ancestor).\n * @returns the common ancestor of `descendantA` and `descendantB`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * parent?: Parented;\n * }\n * const shared = {};\n * const a = { parent: shared };\n * const b1 = { parent: shared };\n * const b2 = { parent: b1 };\n * const pathB: Parented[] = []\n * const ancestor = findCommonAncestor<Parented>(a, [b2, pathB]);\n * // ancestor === shared\n * // pathB === [b1, b2]\n * ```\n */\nexport function findCommonAncestor<T extends { parent?: T }>(\n\tdescendantA: T | [descendantA: T, path?: T[]] | undefined,\n\tdescendantB: T | [descendantB: T, path?: T[]] | undefined,\n): T | undefined {\n\tlet a: T | undefined;\n\tlet b: T | undefined;\n\tlet pathA: T[] | undefined;\n\tlet pathB: T[] | undefined;\n\tif (Array.isArray(descendantA)) {\n\t\t[a, pathA] = descendantA;\n\t\tassert(pathA === undefined || pathA.length === 0, 0x578 /* Path A must be empty */);\n\t} else {\n\t\ta = descendantA;\n\t}\n\tif (Array.isArray(descendantB)) {\n\t\t[b, pathB] = descendantB;\n\t\tassert(pathB === undefined || pathB.length === 0, 0x579 /* Path B must be empty */);\n\t} else {\n\t\tb = descendantB;\n\t}\n\n\tif (a === b) {\n\t\treturn a;\n\t}\n\n\tconst reversePaths = (): void => {\n\t\tpathA?.reverse();\n\t\tpathB?.reverse();\n\t};\n\n\tconst visited = new Set();\n\twhile (a !== undefined || b !== undefined) {\n\t\tif (a !== undefined) {\n\t\t\tif (visited.has(a)) {\n\t\t\t\tif (pathB !== undefined) {\n\t\t\t\t\tpathB.length = pathB.findIndex((r) => Object.is(r, a));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\tvisited.add(a);\n\t\t\tpathA?.push(a);\n\t\t\ta = a.parent;\n\t\t}\n\n\t\tif (b !== undefined) {\n\t\t\tif (visited.has(b)) {\n\t\t\t\tif (pathA !== undefined) {\n\t\t\t\t\tpathA.length = pathA.findIndex((r) => Object.is(r, b));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\tvisited.add(b);\n\t\t\tpathB?.push(b);\n\t\t\tb = b.parent;\n\t\t}\n\t}\n\n\tif (pathA !== undefined) {\n\t\tpathA.length = 0;\n\t}\n\tif (pathB !== undefined) {\n\t\tpathB.length = 0;\n\t}\n\treturn undefined;\n}\n\nexport function replaceChange<TChange>(\n\tcommit: GraphCommit<TChange>,\n\tchange: TChange,\n): GraphCommit<TChange> {\n\tconst output = { ...commit, change };\n\tRollback.set(output, undefined);\n\treturn output;\n}\n\n/** Associates rollback data with commits */\nnamespace Rollback {\n\tconst map = new WeakMap<GraphCommit<unknown>, TaggedChange<unknown, RevisionTag>>();\n\n\texport function get<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t): TaggedChange<TChange, RevisionTag> | undefined {\n\t\treturn map.get(commit) as TaggedChange<TChange, RevisionTag> | undefined;\n\t}\n\n\texport function set<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t\trollback: TaggedChange<TChange, RevisionTag> | undefined,\n\t): void {\n\t\tif (rollback === undefined) {\n\t\t\tmap.delete(commit);\n\t\t} else {\n\t\t\tmap.set(commit, rollback);\n\t\t}\n\t}\n}\n\n/**\n * Checks if one node is an ancestor of another in a parent-linked tree structure.\n * @param ancestor - The potential ancestor node\n * @param descendant - The potential descendant node\n * @param allowEqual - If true, returns true when ancestor === descendant\n * @returns true if ancestor is an ancestor of descendant (or equal if allowEqual is true)\n */\nexport function isAncestor<TNode extends { readonly parent?: TNode }>(\n\tancestor: TNode,\n\tdescendant: TNode,\n\tallowEqual: boolean,\n): boolean {\n\tif (allowEqual && ancestor === descendant) {\n\t\treturn true;\n\t}\n\n\tlet current = descendant.parent;\n\twhile (current !== undefined) {\n\t\tif (current === ancestor) {\n\t\t\treturn true;\n\t\t}\n\t\tcurrent = current.parent;\n\t}\n\n\treturn false;\n}\n\n/**\n * Returns a change that represents the different between two places in a commit graph.\n * Applying this change to the state at `sourceCommit` will yield the state at `targetCommit`.\n * @param changeRebaser - the change rebaser responsible for providing inverses to the changes in the commits.\n * @param sourceCommit - the commit representing the initial state.\n * @param targetCommit - the commit representing the final state.\n * @param mintRevisionTag - a function which can be called to create revision tags for any rollback changes that need to be generated.\n * @returns a change representing the difference between `sourceCommit` and `targetCommit`.\n */\nexport function diffHistories<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceCommit: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): TChange {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceCommit, sourcePath], [targetCommit, targetPath]);\n\tassert(ancestor !== undefined, 0xc6f /* Branches must be related */);\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag),\n\t);\n\n\tinverses.reverse();\n\treturn changeRebaser.compose([...inverses, ...targetPath]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/rebase/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAgB,MAAM,qBAAqB,CAAC;AAEtF,OAAO,EAKN,cAAc,EACd,eAAe,EACf,SAAS,EACT,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAsC,UAAU,EAAE,MAAM,YAAY,CAAC;AAuK5E,MAAM,UAAU,YAAY,CAC3B,eAAkC,EAClC,aAAqC,EACrC,UAAgC,EAChC,YAAkC,EAClC,UAAU,GAAG,YAAY;IAEzB,4CAA4C;IAC5C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,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,CAAC,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport { defineLazyCachedProperty, hasSome, type Mutable } from \"../../util/index.js\";\n\nimport {\n\ttype ChangeRebaser,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype TaggedChange,\n\tmakeAnonChange,\n\tmapTaggedChange,\n\ttagChange,\n\ttagRollbackInverse,\n} from \"./changeRebaser.js\";\nimport { type GraphCommit, type RevisionTag, mintCommit } from \"./types.js\";\n\n/**\n * Contains information about how the commit graph changed as the result of rebasing a source branch onto another target branch.\n * @remarks\n * ```text\n * Consider the commit graph below containing two branches, X and Y, with head commits C and E, respectively.\n * Branch Y branches off of Branch X at their common ancestor commit A, i.e. \"Y is based off of X at commit A\".\n *\n * A ─ B ─ C ← Branch X\n * └─ D ─ E ← Branch Y\n *\n * Branch Y is then rebased onto Branch X. This results in the following commit graph:\n *\n * A ─ B ─ C ← Branch X\n * └─ D'─ E'← Branch Y\n *\n * Commits D' and E' are the rebased versions of commits D and E, respectively. This results in:\n * deletedSourceCommits: [D, E],\n * targetCommits: [B, C],\n * sourceCommits: [D', E']\n * ```\n */\nexport interface RebasedCommits<TChange> {\n\t/**\n\t * The commits on the original source branch that were rebased. These are no longer referenced by the source branch and have\n\t * been replaced with new versions on the new source branch, see {@link sourceCommits}. In the case that the source\n\t * branch was already ahead of the target branch before the rebase, this list will be empty.\n\t */\n\tdeletedSourceCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the target branch that the source branch's commits were rebased over. These are now the direct\n\t * ancestors of {@link sourceCommits}. In the case that the source branch was already ahead of the target branch\n\t * before the rebase, this list will be empty.\n\t */\n\ttargetCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the source branch that are not also on the target branch after the rebase operation. In the case that the\n\t * source branch was already ahead of the target branch before the rebase, these are the same commits that were already on\n\t * the source branch before the rebase, otherwise these are the new, rebased versions of {@link deletedSourceCommits}.\n\t */\n\tsourceCommits: GraphCommit<TChange>[];\n}\n\n/**\n * Telemetry metrics for a rebase operation.\n */\nexport interface RebaseStats {\n\t/**\n\t * The length of the source branch before the rebase.\n\t */\n\treadonly sourceBranchLength: number;\n\t/**\n\t * Number of commits rebased over on the target branch.\n\t */\n\treadonly rebaseDistance: number;\n\t/**\n\t * The number of commits that are dropped from the source branch when rebased to the target branch.\n\t */\n\treadonly countDropped: number;\n}\n\nexport interface RebaseStatsWithDuration extends RebaseStats {\n\treadonly duration: number;\n}\n\nexport interface BranchRebaseResult<TChange> {\n\t/**\n\t * The head of a rebased source branch.\n\t */\n\treadonly newSourceHead: GraphCommit<TChange>;\n\t/**\n\t * A thunk that computes the cumulative change to the source branch (undefined if no change occurred)\n\t */\n\treadonly sourceChange: TChange | undefined;\n\t/**\n\t * Details about how the commits on the source branch changed\n\t */\n\treadonly commits: RebasedCommits<TChange>;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\ninterface RebaseChangeResult<TChange> {\n\treadonly change: TChange;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `targetHead`\n * @param targetHead - the commit to rebase the source branch onto\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. For example:\n * ```\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (B')-(D) <- Branch Y\n * //\n * // As Branch Y is rebased onto Branch X, commits B and B' cancel out so there is no version of B on the new rebased source branch\n * //\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (D') <- Branch Y'\n * //\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `newBase`\n * @param targetCommit - the commit on the target branch to rebase the source branch onto.\n * @param targetHead - the head of the branch that `newBase` belongs to. Must be `newBase` or a descendent of `newBase`.\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. Additionally, this function will rebase\n * the source branch _farther_ than `newBase` if the source branch's next commits after `newBase` match those on the target branch.\n * For example:\n * ```\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (B')-(D')-(F) <- Branch Y\n * //\n * // If Branch Y is rebased onto commit C of Branch X, the branches must at least look like this afterwards (B was cancelled out):\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (D'')-(F') <- Branch Y'\n * //\n * // But this function will recognize that B is equivalent to B' and D is equivalent to D', and instead produce:\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (F') <- Branch Y'\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead = targetCommit,\n): BranchRebaseResult<TChange> {\n\t// Get both source and target as path arrays\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]);\n\tassert(ancestor !== undefined, 0x675 /* branches must be related */);\n\n\tconst sourceBranchLength = sourcePath.length;\n\n\t// Find where `targetCommit` is in the target branch\n\tconst targetCommitIndex = targetPath.indexOf(targetCommit);\n\tif (targetCommitIndex === -1) {\n\t\t// If the targetCommit is not in the target path, then it is either disjoint from `target` or it is behind/at\n\t\t// the commit where source and target diverge (ancestor), in which case there is nothing more to rebase\n\t\t// TODO: Ideally, this would be an \"assertExpensive\". It is commented out because it causes O(N²) behavior when\n\t\t// processing N inbound commits from the same client whose ref seq# is not advancing (which is a common case).\n\t\t// N can be large when the client is sending a burst of changes (potentially on reconnection).\n\t\t// assert(\n\t\t// \tfindCommonAncestor(targetCommit, targetHead) !== undefined,\n\t\t// \t0x676 /* target commit is not in target branch */,\n\t\t// );\n\t\treturn {\n\t\t\tnewSourceHead: sourceHead,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: { deletedSourceCommits: [], targetCommits: [], sourceCommits: sourcePath },\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommitIndex + 1,\n\t\t\t\tcountDropped: 0,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Iterate through the target path and look for commits that are also present on the source branch (i.e. they\n\t// have matching tags). Each commit found in the target branch can be skipped when processing the source branch\n\t// because it has already been rebased onto the target. In the case that one or more of these commits are present\n\t// directly after `targetCommit`, then the new base can be advanced further without having to do any work.\n\tconst sourceSet = new Set(sourcePath.map((r) => r.revision));\n\tlet newBaseIndex = targetCommitIndex;\n\n\tfor (const [i, { revision }] of targetPath.entries()) {\n\t\tif (sourceSet.has(revision)) {\n\t\t\tsourceSet.delete(revision);\n\t\t\tnewBaseIndex = Math.max(newBaseIndex, i);\n\t\t} else if (i > targetCommitIndex) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/** The commit on the target branch that the new source branch branches off of (i.e. the new common ancestor) */\n\tconst newBase = targetPath[newBaseIndex] ?? oob();\n\t// Figure out how much of the trunk to start rebasing over.\n\tconst targetCommits = targetPath.slice(0, newBaseIndex + 1);\n\tconst deletedSourceCommits = [...sourcePath];\n\n\t// If the source and target rebase path begin with a range that has all the same revisions, remove it; it is\n\t// equivalent on both branches and doesn't need to be rebased.\n\tconst targetRebasePath = [...targetCommits];\n\tif (hasSome(sourcePath) && hasSome(targetRebasePath)) {\n\t\tconst minLength = Math.min(sourcePath.length, targetRebasePath.length);\n\t\tfor (let i = 0; i < minLength; i++) {\n\t\t\tconst firstSourcePath = sourcePath[0];\n\t\t\tconst firstTargetRebasePath = targetRebasePath[0];\n\t\t\tif (firstSourcePath.revision === firstTargetRebasePath.revision) {\n\t\t\t\tsourcePath.shift();\n\t\t\t\ttargetRebasePath.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst sourceCommits: GraphCommit<TChange>[] = [];\n\n\t// If all commits that are about to be rebased over on the target branch already comprise the start of the source branch,\n\t// are in the same order, and have no other commits interleaving them, then no rebasing needs to occur. Those commits can\n\t// simply be removed from the source branch, and the remaining commits on the source branch are reparented off of the new\n\t// base commit.\n\tif (!hasSome(targetRebasePath)) {\n\t\tfor (const c of sourcePath) {\n\t\t\tsourceCommits.push(mintCommit(sourceCommits[sourceCommits.length - 1] ?? newBase, c));\n\t\t}\n\t\treturn {\n\t\t\tnewSourceHead: sourceCommits[sourceCommits.length - 1] ?? newBase,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t};\n\t}\n\n\t// For each source commit, rebase backwards over the inverses of any commits already rebased, and then\n\t// rebase forwards over the rest of the commits up to the new base before advancing the new base.\n\tlet newHead = newBase;\n\tconst revInfos = getRevInfoFromTaggedChanges([...targetRebasePath, ...sourcePath]);\n\t// Note that the `revisionMetadata` gets updated as `revInfos` gets updated.\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(revInfos);\n\tlet editsToCompose: TaggedChange<TChange>[] = [...targetRebasePath];\n\tfor (const c of sourcePath) {\n\t\tconst rollback = rollbackFromCommit(changeRebaser, c, mintRevisionTag, true /* cache */);\n\t\tif (sourceSet.has(c.revision)) {\n\t\t\tconst currentComposedEdit = makeAnonChange(changeRebaser.compose(editsToCompose));\n\t\t\teditsToCompose = [currentComposedEdit];\n\t\t\tconst change = changeRebaser.rebase(c, currentComposedEdit, revisionMetadata);\n\t\t\tnewHead = {\n\t\t\t\trevision: c.revision,\n\t\t\t\tchange,\n\t\t\t\tparent: newHead,\n\t\t\t};\n\t\t\tsourceCommits.push(newHead);\n\t\t\teditsToCompose.push(tagChange(change, c.revision));\n\t\t}\n\t\trevInfos.push({ revision: c.revision });\n\t\teditsToCompose.unshift(rollback);\n\t\trevInfos.unshift({ revision: rollback.revision, rollbackOf: rollback.rollbackOf });\n\t}\n\n\treturn defineLazyCachedProperty(\n\t\t{\n\t\t\tnewSourceHead: newHead,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t},\n\t\t\"sourceChange\",\n\t\t() => {\n\t\t\treturn changeRebaser.compose(editsToCompose);\n\t\t},\n\t);\n}\n\n/**\n * \"Sandwich/Horseshoe Rebase\" a change over the given source and target branches\n * @param changeRebaser - the change rebaser responsible for rebasing the change over the commits in each branch\n * @param change - the change to rebase\n * @param sourceHead - the head of the branch that `change` is based on\n * @param targetHead - the branch to rebase `change` onto\n * @returns the rebased change\n *\n * @remarks inverses will be cached.\n */\nexport function rebaseChange<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchange: TaggedChange<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): RebaseChangeResult<TChange> {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tassert(\n\t\tfindCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]) !== undefined,\n\t\t0x576 /* branch A and branch B must be related */,\n\t);\n\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag, true),\n\t);\n\tinverses.reverse();\n\n\tconst telemetryProperties = {\n\t\tsourceBranchLength: 1,\n\t\trebaseDistance: sourcePath.length + targetPath.length,\n\t\tcountDropped: 0,\n\t};\n\n\treturn {\n\t\tchange: rebaseChangeOverChanges(changeRebaser, change, [...inverses, ...targetPath]),\n\t\ttelemetryProperties,\n\t};\n}\n\nexport function revisionMetadataSourceFromInfo(\n\trevInfos: readonly RevisionInfo[],\n): RevisionMetadataSource {\n\tconst compareRevisions = (revision1: RevisionTag, revision2: RevisionTag): number => {\n\t\tconst index1 = getIndex(revision1);\n\t\tconst index2 = getIndex(revision2);\n\n\t\tif (index1 !== undefined) {\n\t\t\treturn index2 === undefined ? -1 : index2 - index1;\n\t\t}\n\n\t\treturn index2 === undefined ? 0 : 1;\n\t};\n\n\tconst tryGetInfo = (revision: RevisionTag | undefined): RevisionInfo | undefined => {\n\t\tif (revision === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn revInfos.find((info) => info.revision === revision);\n\t};\n\n\tconst hasRollback = (revision: RevisionTag): boolean => {\n\t\treturn revInfos.some((info) => info.rollbackOf === revision);\n\t};\n\n\tconst getIndex = (revision: RevisionTag): number | undefined => {\n\t\tconst index = revInfos.findIndex((revInfo) => revInfo.revision === revision);\n\t\tif (index >= 0) {\n\t\t\treturn index;\n\t\t}\n\n\t\tconst rollbackIndex = revInfos.findIndex((revInfo) => revInfo.rollbackOf === revision);\n\t\tif (rollbackIndex >= 0) {\n\t\t\t// This change is the forward revision of a rollback included in revInfos, so it comes after\n\t\t\t// all revisions in revInfos. Earlier rollbacks have later forward revisions.\n\t\t\treturn 2 * revInfos.length - rollbackIndex;\n\t\t}\n\n\t\treturn undefined;\n\t};\n\n\treturn { compareRevisions, tryGetInfo, hasRollback };\n}\n\nexport function rebaseChangeOverChanges<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchangeToRebase: TaggedChange<TChange>,\n\tchangesToRebaseOver: TaggedChange<TChange>[],\n): TChange {\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(\n\t\tgetRevInfoFromTaggedChanges([...changesToRebaseOver, changeToRebase]),\n\t);\n\n\tlet result = changeToRebase;\n\tfor (const b of changesToRebaseOver) {\n\t\tresult = mapTaggedChange(\n\t\t\tchangeToRebase,\n\t\t\tchangeRebaser.rebase(result, b, revisionMetadata),\n\t\t);\n\t}\n\treturn result.change;\n}\n\n// TODO: Deduplicate\nfunction getRevInfoFromTaggedChanges(changes: TaggedChange<unknown>[]): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tfor (const taggedChange of changes) {\n\t\trevInfos.push(...revisionInfoFromTaggedChange(taggedChange));\n\t}\n\n\treturn revInfos;\n}\n\n// TODO: Deduplicate\nfunction revisionInfoFromTaggedChange(taggedChange: TaggedChange<unknown>): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tif (taggedChange.revision !== undefined) {\n\t\tconst info: Mutable<RevisionInfo> = { revision: taggedChange.revision };\n\t\tif (taggedChange.rollbackOf !== undefined) {\n\t\t\tinfo.rollbackOf = taggedChange.rollbackOf;\n\t\t}\n\t\trevInfos.push(info);\n\t}\n\treturn revInfos;\n}\n\nfunction rollbackFromCommit<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tcommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n\tcache?: boolean,\n): TaggedChange<TChange, RevisionTag> {\n\tconst cachedRollback = Rollback.get(commit);\n\tif (cachedRollback !== undefined) {\n\t\treturn cachedRollback;\n\t}\n\tconst tag = mintRevisionTag();\n\tconst rollback = tagRollbackInverse(\n\t\tchangeRebaser.invert(commit, true, tag),\n\t\ttag,\n\t\tcommit.revision,\n\t);\n\n\tif (cache === true) {\n\t\tRollback.set(commit, rollback);\n\t}\n\treturn rollback;\n}\n\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T, path?: T[]],\n): T;\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors. Returns\n * `undefined` if `descendant` is undefined.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n): T | undefined;\n/**\n * Find an ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the ancestor found by `predicate`,\n * but otherwise including `descendant`).\n * @param predicate - a function which will be evaluated on `descendant` and then ancestor of `descendant` (in ascending order) until it returns true.\n * @returns the closest ancestor of `descendant` that satisfies `predicate`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * id: string;\n * parent?: Parented;\n * }\n * const g = { id: \"g\" }; // Grandparent\n * const p = { parent: g, id: \"p\" }; // Parent\n * const c = { parent: p, id: \"c\" }; // Child\n * const path: Parented[] = [];\n * const ancestor = findAncestor<Parented>([c, path], (n) => n.id === \"g\");\n * // ancestor === g\n * // path === [p, c]\n * ```\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean,\n): T | undefined;\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean = (t): boolean => t.parent === undefined,\n): T | undefined {\n\tlet d: T | undefined;\n\tlet path: T[] | undefined;\n\tif (Array.isArray(descendant)) {\n\t\t[d, path] = descendant;\n\t} else {\n\t\td = descendant;\n\t}\n\tfor (let cur = d; cur !== undefined; cur = cur.parent) {\n\t\tif (predicate(cur)) {\n\t\t\tpath?.reverse();\n\t\t\treturn cur;\n\t\t}\n\t\tpath?.push(cur);\n\t}\n\n\tif (path !== undefined) {\n\t\tpath.length = 0;\n\t}\n\treturn undefined;\n}\n\n/**\n * Find a common ancestor between two descendants that are linked by parent pointers.\n * @param descendantA - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantA` (not including the ancestor).\n * @param descendantB - another descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantB` (not including the ancestor).\n * @returns the common ancestor of `descendantA` and `descendantB`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * parent?: Parented;\n * }\n * const shared = {};\n * const a = { parent: shared };\n * const b1 = { parent: shared };\n * const b2 = { parent: b1 };\n * const pathB: Parented[] = []\n * const ancestor = findCommonAncestor<Parented>(a, [b2, pathB]);\n * // ancestor === shared\n * // pathB === [b1, b2]\n * ```\n */\nexport function findCommonAncestor<T extends { parent?: T }>(\n\tdescendantA: T | [descendantA: T, path?: T[]] | undefined,\n\tdescendantB: T | [descendantB: T, path?: T[]] | undefined,\n): T | undefined {\n\tlet a: T | undefined;\n\tlet b: T | undefined;\n\tlet pathA: T[] | undefined;\n\tlet pathB: T[] | undefined;\n\tif (Array.isArray(descendantA)) {\n\t\t[a, pathA] = descendantA;\n\t\tassert(pathA === undefined || pathA.length === 0, 0x578 /* Path A must be empty */);\n\t} else {\n\t\ta = descendantA;\n\t}\n\tif (Array.isArray(descendantB)) {\n\t\t[b, pathB] = descendantB;\n\t\tassert(pathB === undefined || pathB.length === 0, 0x579 /* Path B must be empty */);\n\t} else {\n\t\tb = descendantB;\n\t}\n\n\tif (a === b) {\n\t\treturn a;\n\t}\n\n\tconst reversePaths = (): void => {\n\t\tpathA?.reverse();\n\t\tpathB?.reverse();\n\t};\n\n\tconst visited = new Set();\n\twhile (a !== undefined || b !== undefined) {\n\t\tif (a !== undefined) {\n\t\t\tif (visited.has(a)) {\n\t\t\t\tif (pathB !== undefined) {\n\t\t\t\t\tpathB.length = pathB.findIndex((r) => Object.is(r, a));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\tvisited.add(a);\n\t\t\tpathA?.push(a);\n\t\t\ta = a.parent;\n\t\t}\n\n\t\tif (b !== undefined) {\n\t\t\tif (visited.has(b)) {\n\t\t\t\tif (pathA !== undefined) {\n\t\t\t\t\tpathA.length = pathA.findIndex((r) => Object.is(r, b));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\tvisited.add(b);\n\t\t\tpathB?.push(b);\n\t\t\tb = b.parent;\n\t\t}\n\t}\n\n\tif (pathA !== undefined) {\n\t\tpathA.length = 0;\n\t}\n\tif (pathB !== undefined) {\n\t\tpathB.length = 0;\n\t}\n\treturn undefined;\n}\n\nexport function replaceChange<TChange>(\n\tcommit: GraphCommit<TChange>,\n\tchange: TChange,\n): GraphCommit<TChange> {\n\tconst output = { ...commit, change };\n\tRollback.set(output, undefined);\n\treturn output;\n}\n\n/** Associates rollback data with commits */\nnamespace Rollback {\n\tconst map = new WeakMap<GraphCommit<unknown>, TaggedChange<unknown, RevisionTag>>();\n\n\texport function get<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t): TaggedChange<TChange, RevisionTag> | undefined {\n\t\treturn map.get(commit) as TaggedChange<TChange, RevisionTag> | undefined;\n\t}\n\n\texport function set<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t\trollback: TaggedChange<TChange, RevisionTag> | undefined,\n\t): void {\n\t\tif (rollback === undefined) {\n\t\t\tmap.delete(commit);\n\t\t} else {\n\t\t\tmap.set(commit, rollback);\n\t\t}\n\t}\n}\n\n/**\n * Checks if one node is an ancestor of another in a parent-linked tree structure.\n * @param ancestor - The potential ancestor node\n * @param descendant - The potential descendant node\n * @param allowEqual - If true, returns true when ancestor === descendant\n * @returns true if ancestor is an ancestor of descendant (or equal if allowEqual is true)\n */\nexport function isAncestor<TNode extends { readonly parent?: TNode }>(\n\tancestor: TNode,\n\tdescendant: TNode,\n\tallowEqual: boolean,\n): boolean {\n\tif (allowEqual && ancestor === descendant) {\n\t\treturn true;\n\t}\n\n\tlet current = descendant.parent;\n\twhile (current !== undefined) {\n\t\tif (current === ancestor) {\n\t\t\treturn true;\n\t\t}\n\t\tcurrent = current.parent;\n\t}\n\n\treturn false;\n}\n\n/**\n * Returns a change that represents the different between two places in a commit graph.\n * Applying this change to the state at `sourceCommit` will yield the state at `targetCommit`.\n * @param changeRebaser - the change rebaser responsible for providing inverses to the changes in the commits.\n * @param sourceCommit - the commit representing the initial state.\n * @param targetCommit - the commit representing the final state.\n * @param mintRevisionTag - a function which can be called to create revision tags for any rollback changes that need to be generated.\n * @returns a change representing the difference between `sourceCommit` and `targetCommit`.\n */\nexport function diffHistories<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceCommit: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): TChange {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceCommit, sourcePath], [targetCommit, targetPath]);\n\tassert(ancestor !== undefined, 0xc6f /* Branches must be related */);\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag),\n\t);\n\n\tinverses.reverse();\n\treturn changeRebaser.compose([...inverses, ...targetPath]);\n}\n"]}
|
|
@@ -839,6 +839,7 @@ class PathNode extends ReferenceCountedBase {
|
|
|
839
839
|
function binaryFind(sorted, index) {
|
|
840
840
|
// Try guessing the list is not sparse as a starter:
|
|
841
841
|
const guess = sorted[index];
|
|
842
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
|
|
842
843
|
if (guess !== undefined && guess.parentIndex === index) {
|
|
843
844
|
return guess;
|
|
844
845
|
}
|