@fluidframework/tree 2.74.0-365691 → 2.74.0-368706
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/.vscode/settings.json +2 -2
- package/api-report/tree.alpha.api.md +119 -85
- package/api-report/tree.beta.api.md +0 -1
- package/api-report/tree.legacy.beta.api.md +0 -1
- package/api-report/tree.legacy.public.api.md +0 -1
- package/api-report/tree.public.api.md +0 -1
- package/dist/alpha.d.ts +3 -2
- package/dist/codec/codec.d.ts +14 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +11 -0
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +1 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/format.d.ts +4 -1
- package/dist/codec/versioned/format.d.ts.map +1 -1
- package/dist/codec/versioned/format.js +4 -1
- package/dist/codec/versioned/format.js.map +1 -1
- 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 +7 -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 +2 -1
- 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 +25 -7
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +40 -13
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +21 -12
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/index.d.ts +4 -3
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +6 -2
- 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/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/codec/incrementalEncodingPolicy.d.ts +14 -6
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +90 -42
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +234 -69
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -4
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +33 -28
- 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 +4 -2
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +36 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +126 -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/detachedFieldIndexSummarizer.d.ts +30 -8
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +41 -11
- package/dist/feature-libraries/detachedFieldIndexSummarizer.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 +37 -8
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +2 -2
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +4 -4
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +9 -13
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +21 -26
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/format.d.ts +41 -5
- package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/format.js +7 -7
- package/dist/feature-libraries/forest-summary/format.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +11 -9
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +16 -29
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
- package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/index.js +3 -2
- package/dist/feature-libraries/forest-summary/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +47 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.js +57 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
- package/dist/feature-libraries/index.d.ts +4 -4
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +7 -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/comparison.d.ts +18 -2
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +54 -3
- package/dist/feature-libraries/modular-schema/comparison.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 -52
- 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/fieldKind.d.ts +25 -13
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.js +0 -21
- package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -10
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +12 -8
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +17 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +388 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +17 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +413 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -284
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -15
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1298 -465
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +5 -5
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +146 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +32 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +50 -10
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +24 -3
- package/dist/feature-libraries/modular-schema/modularChangeTypes.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 +217 -451
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- 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/schema-index/schemaSummarizer.d.ts +27 -8
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +42 -16
- package/dist/feature-libraries/schema-index/schemaSummarizer.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 +80 -256
- 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 -86
- 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 +106 -112
- 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 +16 -33
- 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 +358 -179
- 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 -60
- 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 +111 -299
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.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 +32 -33
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +11 -5
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +14 -4
- 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 +20 -8
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +25 -11
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
- 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 +13 -6
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +1 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +12 -10
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +66 -17
- 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 +4 -3
- 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 +9 -9
- 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 +16 -6
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/{lib/shared-tree-core/editManagerCodecsV5.d.ts → dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +7 -7
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +20 -6
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +22 -7
- 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/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +29 -9
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +41 -13
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +5 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +8 -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/{lib/shared-tree-core/messageCodecV5.d.ts → dist/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +6 -6
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
- 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 +16 -6
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +20 -6
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +22 -7
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +8 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/{messageFormatV5.d.ts → messageFormatVSharedBranches.d.ts} +5 -7
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts +14 -47
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +30 -18
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/summaryTypes.d.ts +94 -0
- package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -0
- package/dist/shared-tree-core/summaryTypes.js +47 -0
- package/dist/shared-tree-core/summaryTypes.js.map +1 -0
- package/dist/shared-tree-core/versionedSummarizer.d.ts +67 -0
- package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
- package/dist/shared-tree-core/versionedSummarizer.js +63 -0
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -0
- package/dist/simple-tree/api/configuration.d.ts +3 -26
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +10 -21
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.d.ts +11 -0
- package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.js +7 -0
- package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.d.ts +3 -3
- package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js +9 -3
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js +7 -0
- package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -4
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -5
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +0 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +6 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +5 -0
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +12 -12
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +18 -6
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +13 -8
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +3 -3
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +2 -2
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -3
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +17 -15
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js +5 -40
- package/dist/simple-tree/core/toStored.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/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +4 -0
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js +20 -5
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +7 -7
- 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 +8 -7
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +15 -12
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.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 +5 -3
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.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.d.ts.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/map/mapNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.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 +18 -18
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.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/node-kinds/record/recordNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.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 +183 -125
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +55 -23
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js +17 -0
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +8 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +58 -11
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +205 -30
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeSchema.d.ts +23 -0
- package/dist/simple-tree/treeSchema.d.ts.map +1 -0
- package/dist/simple-tree/treeSchema.js +25 -0
- package/dist/simple-tree/treeSchema.js.map +1 -0
- 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 +29 -11
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts +117 -63
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +159 -58
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +17 -3
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +4 -1
- package/dist/util/index.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/dist/util/readSnapshotBlob.d.ts +13 -0
- package/dist/util/readSnapshotBlob.d.ts.map +1 -0
- package/dist/util/readSnapshotBlob.js +18 -0
- package/dist/util/readSnapshotBlob.js.map +1 -0
- package/lib/alpha.d.ts +3 -2
- package/lib/codec/codec.d.ts +14 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +11 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +1 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/format.d.ts +4 -1
- package/lib/codec/versioned/format.d.ts.map +1 -1
- package/lib/codec/versioned/format.js +4 -1
- package/lib/codec/versioned/format.js.map +1 -1
- 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 +2 -1
- 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 +25 -7
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +40 -13
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +22 -13
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/index.d.ts +4 -3
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +3 -2
- 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/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/codec/incrementalEncodingPolicy.d.ts +14 -6
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +90 -42
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +232 -69
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -4
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +34 -29
- 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 +36 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +122 -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/detachedFieldIndexSummarizer.d.ts +30 -8
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +38 -8
- package/lib/feature-libraries/detachedFieldIndexSummarizer.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 +38 -9
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +2 -2
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +5 -5
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +9 -13
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +17 -22
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/format.d.ts +41 -5
- package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/format.js +3 -3
- package/lib/feature-libraries/forest-summary/format.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +11 -9
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +13 -26
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
- package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/index.js +2 -1
- package/lib/feature-libraries/forest-summary/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +47 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.js +53 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
- package/lib/feature-libraries/index.d.ts +4 -4
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -3
- 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/comparison.d.ts +18 -2
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +55 -5
- package/lib/feature-libraries/modular-schema/comparison.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 -52
- 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/fieldKind.d.ts +25 -13
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.js +0 -21
- package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +7 -10
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +4 -3
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +17 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +384 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +17 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +409 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +9 -285
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -15
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1284 -458
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +146 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +29 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +50 -10
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +20 -2
- package/lib/feature-libraries/modular-schema/modularChangeTypes.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 +217 -449
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- 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/schema-index/schemaSummarizer.d.ts +27 -8
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +38 -12
- package/lib/feature-libraries/schema-index/schemaSummarizer.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 +82 -258
- 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 -80
- 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 +108 -114
- 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 +16 -33
- 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 +350 -175
- 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 -61
- 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 +107 -292
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.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 +35 -36
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +11 -5
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +14 -4
- 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 +20 -8
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +25 -11
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
- 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 +11 -5
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +2 -2
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +12 -10
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +69 -20
- 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 +4 -3
- 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 +9 -9
- 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 +14 -5
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/{dist/shared-tree-core/editManagerCodecsV5.d.ts → lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +4 -4
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +20 -6
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +22 -7
- 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/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +29 -9
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +39 -11
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +5 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +4 -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/{dist/shared-tree-core/messageCodecV5.d.ts → lib/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +3 -3
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
- 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 +14 -5
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +20 -6
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +22 -7
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +8 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/{messageFormatV5.d.ts → messageFormatVSharedBranches.d.ts} +5 -7
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts +14 -47
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +28 -16
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/summaryTypes.d.ts +94 -0
- package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -0
- package/lib/shared-tree-core/summaryTypes.js +43 -0
- package/lib/shared-tree-core/summaryTypes.js.map +1 -0
- package/lib/shared-tree-core/versionedSummarizer.d.ts +67 -0
- package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
- package/lib/shared-tree-core/versionedSummarizer.js +59 -0
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -0
- package/lib/simple-tree/api/configuration.d.ts +3 -26
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +14 -25
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.d.ts +11 -0
- package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.js +7 -0
- package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.d.ts +3 -3
- package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js +9 -3
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js +8 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -4
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -3
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js +0 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +6 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +5 -0
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +12 -12
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.js +15 -3
- package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +15 -10
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +3 -3
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +2 -2
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +17 -15
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js +4 -37
- package/lib/simple-tree/core/toStored.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/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +5 -1
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js +20 -5
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +7 -7
- 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 +8 -7
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +6 -5
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +5 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.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 +6 -4
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.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.d.ts.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/map/mapNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.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 +19 -19
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.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/node-kinds/record/recordNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.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 +183 -124
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +55 -23
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js +16 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +8 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +58 -11
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +204 -31
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeSchema.d.ts +23 -0
- package/lib/simple-tree/treeSchema.d.ts.map +1 -0
- package/lib/simple-tree/treeSchema.js +21 -0
- package/lib/simple-tree/treeSchema.js.map +1 -0
- 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 +26 -9
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts +117 -63
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +160 -59
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +18 -4
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/index.d.ts +2 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -1
- package/lib/util/index.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/lib/util/readSnapshotBlob.d.ts +13 -0
- package/lib/util/readSnapshotBlob.d.ts.map +1 -0
- package/lib/util/readSnapshotBlob.js +14 -0
- package/lib/util/readSnapshotBlob.js.map +1 -0
- package/package.json +21 -21
- package/src/codec/codec.ts +15 -1
- package/src/codec/versioned/codec.ts +1 -1
- package/src/codec/versioned/format.ts +4 -1
- package/src/core/change-family/changeFamily.ts +5 -0
- package/src/core/change-family/index.ts +1 -0
- package/src/core/index.ts +7 -2
- package/src/core/rebase/changeRebaser.ts +6 -1
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/types.ts +8 -1
- package/src/core/rebase/utils.ts +31 -7
- package/src/core/tree/detachedFieldIndex.ts +71 -14
- package/src/core/tree/index.ts +9 -3
- package/src/core/tree/pathTree.ts +16 -4
- 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/codec/incrementalEncodingPolicy.ts +15 -7
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -9
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +393 -127
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +35 -38
- package/src/feature-libraries/default-schema/index.ts +16 -5
- package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +180 -0
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +35 -9
- package/src/feature-libraries/deltaUtils.ts +6 -1
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +62 -15
- 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 +66 -24
- package/src/feature-libraries/forest-summary/codec.ts +8 -8
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +45 -37
- package/src/feature-libraries/forest-summary/format.ts +4 -4
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +23 -39
- package/src/feature-libraries/forest-summary/index.ts +2 -1
- package/src/feature-libraries/forest-summary/summaryTypes.ts +61 -0
- package/src/feature-libraries/index.ts +22 -9
- package/src/feature-libraries/mapTreeCursor.ts +2 -1
- package/src/feature-libraries/mitigatedChangeFamily.ts +3 -1
- package/src/feature-libraries/modular-schema/comparison.ts +63 -5
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +142 -44
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +36 -57
- package/src/feature-libraries/modular-schema/fieldKind.ts +24 -40
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +10 -19
- package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -1
- package/src/feature-libraries/modular-schema/index.ts +21 -15
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +732 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +790 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +29 -499
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2542 -742
- package/src/feature-libraries/modular-schema/{modularChangeFormat.ts → modularChangeFormatV1.ts} +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +62 -0
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +98 -10
- package/src/feature-libraries/optional-field/index.ts +1 -3
- package/src/feature-libraries/optional-field/optionalField.ts +317 -574
- package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +24 -38
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +59 -18
- package/src/feature-libraries/sequence-field/compose.ts +134 -519
- 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 -191
- package/src/feature-libraries/sequence-field/rebase.ts +168 -203
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +31 -52
- package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +0 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +643 -220
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -68
- 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 +133 -346
- package/src/index.ts +3 -2
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.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 +50 -68
- package/src/shared-tree/sharedTree.ts +39 -12
- package/src/shared-tree/sharedTreeChangeCodecs.ts +5 -1
- package/src/shared-tree/sharedTreeChangeEnricher.ts +31 -11
- package/src/shared-tree/sharedTreeChangeFamily.ts +7 -4
- package/src/shared-tree/sharedTreeEditBuilder.ts +46 -12
- package/src/shared-tree/treeAlpha.ts +2 -3
- package/src/shared-tree/treeCheckout.ts +104 -31
- package/src/shared-tree-core/branch.ts +8 -2
- package/src/shared-tree-core/editManager.ts +16 -2
- package/src/shared-tree-core/editManagerCodecs.ts +17 -5
- package/src/shared-tree-core/{editManagerCodecsV5.ts → editManagerCodecsVSharedBranches.ts} +3 -3
- package/src/shared-tree-core/editManagerFormatCommons.ts +22 -7
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
- package/src/shared-tree-core/{editManagerFormatV5.ts → editManagerFormatVSharedBranches.ts} +2 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +58 -16
- package/src/shared-tree-core/index.ts +11 -3
- package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
- package/src/shared-tree-core/{messageCodecV5.ts → messageCodecVSharedBranches.ts} +3 -3
- package/src/shared-tree-core/messageCodecs.ts +17 -5
- package/src/shared-tree-core/messageFormat.ts +22 -7
- package/src/shared-tree-core/messageFormatV1ToV4.ts +16 -2
- package/src/shared-tree-core/{messageFormatV5.ts → messageFormatVSharedBranches.ts} +4 -6
- package/src/shared-tree-core/sharedTreeCore.ts +67 -76
- package/src/shared-tree-core/summaryTypes.ts +122 -0
- package/src/shared-tree-core/versionedSummarizer.ts +107 -0
- package/src/simple-tree/api/configuration.ts +21 -68
- package/src/simple-tree/api/dirtyIndex.ts +11 -0
- package/src/simple-tree/api/discrepancies.ts +1 -1
- package/src/simple-tree/api/getSimpleSchema.ts +13 -6
- package/src/simple-tree/api/incrementalAllowedTypes.ts +15 -3
- package/src/simple-tree/api/index.ts +3 -4
- package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
- package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
- package/src/simple-tree/api/schemaFactoryRecursive.ts +0 -2
- package/src/simple-tree/api/schemaFromSimple.ts +11 -5
- package/src/simple-tree/api/simpleSchemaCodec.ts +17 -3
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +18 -10
- package/src/simple-tree/api/typesUnsafe.ts +7 -3
- package/src/simple-tree/core/allowedTypes.ts +3 -3
- package/src/simple-tree/core/index.ts +2 -2
- package/src/simple-tree/core/toStored.ts +22 -55
- package/src/simple-tree/core/unhydratedFlexTree.ts +87 -36
- package/src/simple-tree/core/walkSchema.ts +6 -0
- package/src/simple-tree/createContext.ts +26 -11
- package/src/simple-tree/fieldSchema.ts +16 -7
- package/src/simple-tree/index.ts +12 -11
- package/src/simple-tree/node-kinds/array/arrayNode.ts +12 -7
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +3 -3
- package/src/simple-tree/node-kinds/common.ts +2 -5
- package/src/simple-tree/node-kinds/map/mapNode.ts +9 -6
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +3 -3
- package/src/simple-tree/node-kinds/object/objectNode.ts +26 -26
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +6 -2
- package/src/simple-tree/node-kinds/record/recordNode.ts +15 -11
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +3 -3
- package/src/simple-tree/prepareForInsertion.ts +343 -200
- package/src/simple-tree/simpleSchema.ts +79 -32
- package/src/simple-tree/simpleSchemaFormatV1.ts +9 -1
- package/src/simple-tree/toStoredSchema.ts +319 -61
- package/src/simple-tree/treeSchema.ts +54 -0
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +42 -14
- package/src/tableSchema.ts +485 -166
- package/src/treeFactory.ts +19 -5
- package/src/util/index.ts +5 -0
- package/src/util/rangeMap.ts +72 -18
- package/src/util/readSnapshotBlob.ts +23 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
- 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/dist/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
- package/dist/shared-tree-core/editManagerCodecsV5.js.map +0 -1
- package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
- package/dist/shared-tree-core/editManagerFormatV5.js.map +0 -1
- package/dist/shared-tree-core/messageCodecV5.d.ts.map +0 -1
- package/dist/shared-tree-core/messageCodecV5.js.map +0 -1
- package/dist/shared-tree-core/messageFormatV5.d.ts.map +0 -1
- package/dist/shared-tree-core/messageFormatV5.js.map +0 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +0 -177
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
- package/docs/main/sequence-field/move-composition.md +0 -46
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
- 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/lib/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
- package/lib/shared-tree-core/editManagerCodecsV5.js.map +0 -1
- package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
- package/lib/shared-tree-core/editManagerFormatV5.js.map +0 -1
- package/lib/shared-tree-core/messageCodecV5.d.ts.map +0 -1
- package/lib/shared-tree-core/messageCodecV5.js.map +0 -1
- package/lib/shared-tree-core/messageFormatV5.d.ts.map +0 -1
- package/lib/shared-tree-core/messageFormatV5.js.map +0 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +0 -171
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
- package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +0 -209
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,KAAK,qBAAqB,EAAW,MAAM,0CAA0C,CAAC;AAE/F,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EAMjB,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EACX,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG,wBAAwB,GAAG,MAAM,CAAC;AACzD,M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CAAC;QAAE,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;CAAE,EACtF,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GACvB,MAAM,IAAI,CASZ"}
|
|
@@ -27,16 +27,17 @@ class SharedTreeBranch {
|
|
|
27
27
|
* @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must
|
|
28
28
|
* never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.
|
|
29
29
|
*/
|
|
30
|
-
constructor(head, changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher) {
|
|
30
|
+
constructor(head, changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher, editorOptions) {
|
|
31
31
|
this.head = head;
|
|
32
32
|
this.changeFamily = changeFamily;
|
|
33
33
|
this.mintRevisionTag = mintRevisionTag;
|
|
34
34
|
this.branchTrimmer = branchTrimmer;
|
|
35
35
|
this.telemetryEventBatcher = telemetryEventBatcher;
|
|
36
|
+
this.editorOptions = editorOptions;
|
|
36
37
|
_SharedTreeBranch_events.set(this, (0, client_utils_1.createEmitter)());
|
|
37
38
|
this.events = __classPrivateFieldGet(this, _SharedTreeBranch_events, "f");
|
|
38
39
|
this.disposed = false;
|
|
39
|
-
this.editor = this.changeFamily.buildEditor(mintRevisionTag, (change) => this.apply(change));
|
|
40
|
+
this.editor = this.changeFamily.buildEditor(mintRevisionTag, (change) => this.apply(change), this.editorOptions);
|
|
40
41
|
this.unsubscribeBranchTrimmer = branchTrimmer?.on("ancestryTrimmed", (commit) => {
|
|
41
42
|
__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("ancestryTrimmed", commit);
|
|
42
43
|
});
|
|
@@ -88,7 +89,7 @@ class SharedTreeBranch {
|
|
|
88
89
|
*/
|
|
89
90
|
fork(commit = this.head) {
|
|
90
91
|
this.assertNotDisposed();
|
|
91
|
-
const fork = new SharedTreeBranch(commit, this.changeFamily, this.mintRevisionTag, this.branchTrimmer);
|
|
92
|
+
const fork = new SharedTreeBranch(commit, this.changeFamily, this.mintRevisionTag, this.branchTrimmer, undefined, this.editorOptions);
|
|
92
93
|
__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("fork", fork);
|
|
93
94
|
return fork;
|
|
94
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+DAA6D;AAE7D,kEAA6D;AAC7D,uEAA+F;AAE/F,+CAc0B;AAC1B,+CAAqE;AAiFrE;;GAEG;AACH,MAAa,gBAAgB;IAM5B;;;;;;OAMG;IACH,YACS,IAA0B,EAClB,YAA4C,EAC3C,eAAkC,EAClC,aAAgD,EAChD,qBAEhB;QANO,SAAI,GAAJ,IAAI,CAAsB;QAClB,iBAAY,GAAZ,YAAY,CAAgC;QAC3C,oBAAe,GAAf,eAAe,CAAmB;QAClC,kBAAa,GAAb,aAAa,CAAmC;QAChD,0BAAqB,GAArB,qBAAqB,CAErC;QAnBO,mCAAU,IAAA,4BAAa,GAA4C,EAAC;QAC7D,WAAM,GAAyD,uBAAA,IAAI,gCAAQ,CAAC;QAEpF,aAAQ,GAAG,KAAK,CAAC;QAkBxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CACvE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAClB,CAAC;QACF,IAAI,CAAC,wBAAwB,GAAG,aAAa,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE;YAC/E,uBAAA,IAAI,gCAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,O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O,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAZD,4CAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n} from \"../core/index.js\";\nimport { hasSome, defineLazyCachedProperty } from \"../util/index.js\";\nimport type {\n\tOpSpaceCompressedId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\n\nexport type BranchId = SessionSpaceCompressedId | \"main\";\nexport type EncodedBranchId = OpSpaceCompressedId;\n\n/**\n * Describes a change to a `SharedTreeBranch`. Each of the following event types provides a `change` which contains the net change to the branch (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch.\n * * Rebase - when a rebase operation adds commits from another branch and replaces existing commits with their rebased versions.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tkind: CommitKind;\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits appended to the head of the branch by this operation */\n\t\t\tnewCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits removed from the head of the branch by this operation */\n\t\t\tremovedCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"rebase\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t };\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {\n\treadonly #events = createEmitter<SharedTreeBranchEvents<TEditor, TChange>>();\n\tpublic readonly events: Listenable<SharedTreeBranchEvents<TEditor, TChange>> = this.#events;\n\tpublic readonly editor: TEditor;\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t) {\n\t\tthis.editor = this.changeFamily.buildEditor(mintRevisionTag, (change) =>\n\t\t\tthis.apply(change),\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.#events.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch.\n\t * @remarks This is a \"manual override\" of sorts, for when the branch needs to be set to a certain state without going through the usual flow of edits.\n\t * This might be necessary as a performance optimization, or to prevent parts of the system updating incorrectly (this method emits no change events!).\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param kind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(change: TaggedChange<TChange>, kind: CommitKind = CommitKind.Default): void {\n\t\tthis.assertNotDisposed();\n\n\t\tconst revisionTag = change.revision;\n\t\tassert(revisionTag !== undefined, 0xa49 /* Revision tag must be provided */);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision: revisionTag,\n\t\t\tchange: change.change,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tkind,\n\t\t\tchange,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Gets the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * @param commit - The commit to base the new branch off of. Defaults to the head of this branch.\n\t * @remarks Changes made to the new branch will not be applied to this branch until the new branch is {@link SharedTreeBranch.merge | merged} back in.\n\t * Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(commit: GraphCommit<TChange> = this.head): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tcommit,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t);\n\t\tthis.#events.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): void {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\t\tassert(hasSome(targetCommits), 0xa83 /* Expected commit(s) for a non no-op rebase */);\n\n\t\tconst newCommits = targetCommits.concat(sourceCommits);\n\t\tconst changeEvent = {\n\t\t\ttype: \"rebase\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Remove a range of commits from this branch.\n\t * @param commit - All commits after (but not including) this commit will be removed.\n\t * @returns The net change to this branch and the commits that were removed from this branch.\n\t */\n\tpublic removeAfter(commit: GraphCommit<TChange>): void {\n\t\tif (commit === this.head) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst removedCommits: GraphCommit<TChange>[] = [];\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfindAncestor([this.head, removedCommits], (c) => {\n\t\t\t// TODO: Pull this side effect out if/when more diverse ancestry walking helpers are available\n\t\t\tif (c !== commit) {\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst inverse = this.changeFamily.rebaser.invert(c, true, revision);\n\t\t\t\tinverses.push(tagRollbackInverse(inverse, revision, c.revision));\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\t\tassert(hasSome(removedCommits), 0xa84 /* Commit must be in the branch's ancestry */);\n\n\t\tconst change = makeAnonChange(this.changeFamily.rebaser.compose(inverses));\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange,\n\t\t\tremovedCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = commit;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the commits that were added to this branch by the merge, or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): { sourceCommits: GraphCommit<TChange>[] } | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\n\t\tif (branch === this) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tassert(hasSome(sourceCommits), 0xa86 /* Expected source commits in non no-op merge */);\n\t\tconst { rebaser } = this.changeFamily;\n\t\tconst changeEvent = defineLazyCachedProperty(\n\t\t\t{\n\t\t\t\ttype: \"append\",\n\t\t\t\tkind: CommitKind.Default,\n\t\t\t\tnewCommits: sourceCommits,\n\t\t\t} as const,\n\t\t\t\"change\",\n\t\t\t() => makeAnonChange(rebaser.compose(sourceCommits)),\n\t\t);\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t\treturn { sourceCommits };\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.#events.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given branch forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param branch - the branch that will be listened to for forks\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\n// Branches are invariant over TChange\nexport function onForkTransitive<T extends { events: Listenable<{ fork(t: T): void }> }>(\n\tbranch: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tbranch.events.on(\"fork\", (fork: T) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => offs.forEach((off) => off());\n}\n"]}
|
|
1
|
+
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+DAA6D;AAE7D,kEAA6D;AAC7D,uEAA+F;AAE/F,+CAe0B;AAC1B,+CAAqE;AAiFrE;;GAEG;AACH,MAAa,gBAAgB;IAM5B;;;;;;OAMG;IACH,YACS,IAA0B,EAClB,YAA4C,EAC3C,eAAkC,EAClC,aAAgD,EAChD,qBAEhB,E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IACI,OAAO;QACb,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,wBAAwB,EAAE,EAAE,CAAC;QAElC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,uBAAA,IAAI,gCAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAEO,iBAAiB;QACxB,IAAA,iBAAM,EAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACxD,CAAC;CACD;AA/QD,4CA+QC;;AAED;;;;;;;GAOG;AACH,sCAAsC;AACtC,SAAgB,gBAAgB,CAC/B,MAAS,EACT,MAAyB;IAEzB,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,CACR,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAO,EAAE,EAAE;QACpC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC,CAAC,CACF,CAAC;IACF,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAZD,4CAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n\ttype EditorOptions,\n} from \"../core/index.js\";\nimport { hasSome, defineLazyCachedProperty } from \"../util/index.js\";\nimport type {\n\tOpSpaceCompressedId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\n\nexport type BranchId = SessionSpaceCompressedId | \"main\";\nexport type EncodedBranchId = OpSpaceCompressedId;\n\n/**\n * Describes a change to a `SharedTreeBranch`. Each of the following event types provides a `change` which contains the net change to the branch (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch.\n * * Rebase - when a rebase operation adds commits from another branch and replaces existing commits with their rebased versions.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tkind: CommitKind;\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits appended to the head of the branch by this operation */\n\t\t\tnewCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits removed from the head of the branch by this operation */\n\t\t\tremovedCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"rebase\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t };\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {\n\treadonly #events = createEmitter<SharedTreeBranchEvents<TEditor, TChange>>();\n\tpublic readonly events: Listenable<SharedTreeBranchEvents<TEditor, TChange>> = this.#events;\n\tpublic readonly editor: TEditor;\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t\tprivate readonly editorOptions?: EditorOptions,\n\t) {\n\t\tthis.editor = this.changeFamily.buildEditor(\n\t\t\tmintRevisionTag,\n\t\t\t(change) => this.apply(change),\n\t\t\tthis.editorOptions,\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.#events.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch.\n\t * @remarks This is a \"manual override\" of sorts, for when the branch needs to be set to a certain state without going through the usual flow of edits.\n\t * This might be necessary as a performance optimization, or to prevent parts of the system updating incorrectly (this method emits no change events!).\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param kind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(change: TaggedChange<TChange>, kind: CommitKind = CommitKind.Default): void {\n\t\tthis.assertNotDisposed();\n\n\t\tconst revisionTag = change.revision;\n\t\tassert(revisionTag !== undefined, 0xa49 /* Revision tag must be provided */);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision: revisionTag,\n\t\t\tchange: change.change,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tkind,\n\t\t\tchange,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Gets the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * @param commit - The commit to base the new branch off of. Defaults to the head of this branch.\n\t * @remarks Changes made to the new branch will not be applied to this branch until the new branch is {@link SharedTreeBranch.merge | merged} back in.\n\t * Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(commit: GraphCommit<TChange> = this.head): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tcommit,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t\tundefined,\n\t\t\tthis.editorOptions,\n\t\t);\n\t\tthis.#events.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): void {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\t\tassert(hasSome(targetCommits), 0xa83 /* Expected commit(s) for a non no-op rebase */);\n\n\t\tconst newCommits = targetCommits.concat(sourceCommits);\n\t\tconst changeEvent = {\n\t\t\ttype: \"rebase\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Remove a range of commits from this branch.\n\t * @param commit - All commits after (but not including) this commit will be removed.\n\t * @returns The net change to this branch and the commits that were removed from this branch.\n\t */\n\tpublic removeAfter(commit: GraphCommit<TChange>): void {\n\t\tif (commit === this.head) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst removedCommits: GraphCommit<TChange>[] = [];\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfindAncestor([this.head, removedCommits], (c) => {\n\t\t\t// TODO: Pull this side effect out if/when more diverse ancestry walking helpers are available\n\t\t\tif (c !== commit) {\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst inverse = this.changeFamily.rebaser.invert(c, true, revision);\n\t\t\t\tinverses.push(tagRollbackInverse(inverse, revision, c.revision));\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\t\tassert(hasSome(removedCommits), 0xa84 /* Commit must be in the branch's ancestry */);\n\n\t\tconst change = makeAnonChange(this.changeFamily.rebaser.compose(inverses));\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange,\n\t\t\tremovedCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = commit;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the commits that were added to this branch by the merge, or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): { sourceCommits: GraphCommit<TChange>[] } | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\n\t\tif (branch === this) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tassert(hasSome(sourceCommits), 0xa86 /* Expected source commits in non no-op merge */);\n\t\tconst { rebaser } = this.changeFamily;\n\t\tconst changeEvent = defineLazyCachedProperty(\n\t\t\t{\n\t\t\t\ttype: \"append\",\n\t\t\t\tkind: CommitKind.Default,\n\t\t\t\tnewCommits: sourceCommits,\n\t\t\t} as const,\n\t\t\t\"change\",\n\t\t\t() => makeAnonChange(rebaser.compose(sourceCommits)),\n\t\t);\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t\treturn { sourceCommits };\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.#events.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given branch forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param branch - the branch that will be listened to for forks\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\n// Branches are invariant over TChange\nexport function onForkTransitive<T extends { events: Listenable<{ fork(t: T): void }> }>(\n\tbranch: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tbranch.events.on(\"fork\", (fork: T) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => offs.forEach((off) => off());\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { SessionId } from "@fluidframework/id-compressor";
|
|
6
|
-
import { type ChangeFamily, type ChangeFamilyEditor, type GraphCommit, type RevisionTag } from "../core/index.js";
|
|
6
|
+
import { type ChangeFamily, type ChangeFamilyEditor, type GraphCommit, type RevisionTag, type EditorOptions } from "../core/index.js";
|
|
7
7
|
import { SharedTreeBranch, type BranchId } from "./branch.js";
|
|
8
8
|
import type { SeqNumber, SequencedCommit, SummarySessionBranch } from "./editManagerFormatCommons.js";
|
|
9
9
|
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
@@ -49,7 +49,7 @@ export declare class EditManager<TEditor extends ChangeFamilyEditor, TChangeset,
|
|
|
49
49
|
* @param mintRevisionTag - a function which generates globally unique revision tags
|
|
50
50
|
* @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.
|
|
51
51
|
*/
|
|
52
|
-
constructor(changeFamily: TChangeFamily, localSessionId: SessionId, mintRevisionTag: () => RevisionTag, onSharedBranchCreated?: ((branchId: BranchId) => void) | undefined, logger?: ITelemetryLoggerExt);
|
|
52
|
+
constructor(changeFamily: TChangeFamily, localSessionId: SessionId, mintRevisionTag: () => RevisionTag, onSharedBranchCreated?: ((branchId: BranchId) => void) | undefined, editorOptions?: EditorOptions, logger?: ITelemetryLoggerExt);
|
|
53
53
|
getLocalBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChangeset>;
|
|
54
54
|
private getSharedBranch;
|
|
55
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editManager.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,WAAW,EAMhB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACN,gBAAgB,EAGhB,KAAK,QAAQ,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAEX,SAAS,EAET,eAAe,EACf,oBAAoB,EACpB,MAAM,+BAA+B,CAAC;AAQvC,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAGlD,eAAO,MAAM,6BAA6B,EAAE,SAA0C,CAAC;AAkBvF;;;GAGG;AAEH,qBAAa,WAAW,CACvB,OAAO,SAAS,kBAAkB,EAClC,UAAU,EACV,aAAa,SAAS,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC;aA8CtC,YAAY,EAAE,aAAa;aAC3B,cAAc,EAAE,SAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IA/CxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyC;IAEjE,OAAO,CAAC,QAAQ,CAAC,c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C;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;IACvD,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,SAAS,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;CACrF"}
|
|
@@ -40,7 +40,7 @@ class EditManager {
|
|
|
40
40
|
* @param mintRevisionTag - a function which generates globally unique revision tags
|
|
41
41
|
* @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.
|
|
42
42
|
*/
|
|
43
|
-
constructor(changeFamily, localSessionId, mintRevisionTag, onSharedBranchCreated, logger) {
|
|
43
|
+
constructor(changeFamily, localSessionId, mintRevisionTag, onSharedBranchCreated, editorOptions, logger) {
|
|
44
44
|
this.changeFamily = changeFamily;
|
|
45
45
|
this.localSessionId = localSessionId;
|
|
46
46
|
this.mintRevisionTag = mintRevisionTag;
|
|
@@ -73,8 +73,8 @@ class EditManager {
|
|
|
73
73
|
category: "performance",
|
|
74
74
|
}, logger, maxRebaseStatsAggregationCount);
|
|
75
75
|
}
|
|
76
|
-
const mainTrunk = new branch_js_1.SharedTreeBranch(this.trunkBase, changeFamily, mintRevisionTag, this._events, this.telemetryEventBatcher);
|
|
77
|
-
this.createAndAddSharedBranch("main", undefined, undefined, mainTrunk);
|
|
76
|
+
const mainTrunk = new branch_js_1.SharedTreeBranch(this.trunkBase, changeFamily, mintRevisionTag, this._events, this.telemetryEventBatcher, editorOptions);
|
|
77
|
+
this.createAndAddSharedBranch("main", undefined, undefined, mainTrunk, editorOptions);
|
|
78
78
|
}
|
|
79
79
|
getLocalBranch(branchId) {
|
|
80
80
|
return this.getSharedBranch(branchId).localBranch;
|
|
@@ -314,8 +314,8 @@ class EditManager {
|
|
|
314
314
|
const hadBranch = this.sharedBranches.delete(branchId);
|
|
315
315
|
(0, internal_1.assert)(hadBranch, 0xc5c /* Expected branch to exist */);
|
|
316
316
|
}
|
|
317
|
-
createAndAddSharedBranch(branchId, sessionId, parent, branch) {
|
|
318
|
-
const sharedBranch = this.createSharedBranch(branchId, sessionId, parent, branch);
|
|
317
|
+
createAndAddSharedBranch(branchId, sessionId, parent, branch, editorOptions) {
|
|
318
|
+
const sharedBranch = this.createSharedBranch(branchId, sessionId, parent, branch, editorOptions);
|
|
319
319
|
this.addSharedBranch(branchId, sharedBranch);
|
|
320
320
|
return sharedBranch;
|
|
321
321
|
}
|
|
@@ -331,8 +331,8 @@ class EditManager {
|
|
|
331
331
|
this.onSharedBranchCreated?.(branchId);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
createSharedBranch(branchId, sessionId, parent, branch) {
|
|
335
|
-
const sharedBranch = new SharedBranch(parent, branch, branchId, sessionId, minimumPossibleSequenceId, this.changeFamily, this.mintRevisionTag, this._events, this.telemetryEventBatcher);
|
|
334
|
+
createSharedBranch(branchId, sessionId, parent, branch, editorOptions) {
|
|
335
|
+
const sharedBranch = new SharedBranch(parent, branch, branchId, sessionId, minimumPossibleSequenceId, this.changeFamily, this.mintRevisionTag, this._events, this.telemetryEventBatcher, editorOptions);
|
|
336
336
|
return sharedBranch;
|
|
337
337
|
}
|
|
338
338
|
/* eslint-disable jsdoc/check-indentation */
|
|
@@ -399,7 +399,7 @@ function getPathFromBase(branchHead, baseBranchHead) {
|
|
|
399
399
|
return path;
|
|
400
400
|
}
|
|
401
401
|
class SharedBranch {
|
|
402
|
-
constructor(parentBranch, trunk, id, sessionId, baseCommitSequenceId, changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher) {
|
|
402
|
+
constructor(parentBranch, trunk, id, sessionId, baseCommitSequenceId, changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher, editorOptions) {
|
|
403
403
|
this.parentBranch = parentBranch;
|
|
404
404
|
this.trunk = trunk;
|
|
405
405
|
this.id = id;
|
|
@@ -427,7 +427,7 @@ class SharedBranch {
|
|
|
427
427
|
* This does not include an entry for the {@link trunkBase}.
|
|
428
428
|
*/
|
|
429
429
|
this.commitMetadata = new Map();
|
|
430
|
-
this.localBranch = new branch_js_1.SharedTreeBranch(this.trunk.getHead(), changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher);
|
|
430
|
+
this.localBranch = new branch_js_1.SharedTreeBranch(this.trunk.getHead(), changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher, editorOptions);
|
|
431
431
|
this.sequenceIdToCommit.set(baseCommitSequenceId, this.trunk.getHead());
|
|
432
432
|
this.localBranch.events.on("afterChange", (event) => {
|
|
433
433
|
if (event.type === "append") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editManager.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,+DAA6D;AAE7D,gEAAkD;AAElD,+CAU0B;AAC1B,+CAAiF;AAEjF,2CAKqB;AAQrB,6DAM8B;AAC9B,uEAGkD;AAGrC,QAAA,6BAA6B,GAAc,IAAA,gBAAK,EAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACvF,MAAM,yBAAyB,GAAe;IAC7C,cAAc,EAAE,qCAA6B;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,MAAqC,CAAC;AAE3D;;GAEG;AACH,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAE5C;;;GAGG;AACH,sDAAsD;AACtD,MAAa,WAAW;IA0CvB;;;;;OAKG;IACH,YACiB,YAA2B,EAC3B,cAAyB,EACxB,eAAkC,EAClC,qBAAoD,EACrE,MAA4B;QAJZ,iBAAY,GAAZ,YAAY,CAAe;QAC3B,mBAAc,GAAd,cAAc,CAAW;QACxB,oBAAe,GAAf,eAAe,CAAmB;QAClC,0BAAqB,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AAI,CAAC,eAAe,CACpB,CACD,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,2GAA2G;AAC3G,6EAA6E;AAC7E,SAAS,iBAAiB,CAAC,UAAsB;IAChD,OAAO;QACN,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,YAAY,EAAE,CAAC,UAAU,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC;KAChD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\ttype RebaseStatsWithDuration,\n\ttagChange,\n} from \"../core/index.js\";\nimport { type Mutable, brand, getOrCreate, mapIterable } from \"../util/index.js\";\n\nimport {\n\tSharedTreeBranch,\n\ttype BranchTrimmingEvents,\n\tonForkTransitive,\n\ttype BranchId,\n} from \"./branch.js\";\nimport type {\n\tCommit,\n\tSeqNumber,\n\tSequenceId,\n\tSequencedCommit,\n\tSummarySessionBranch,\n} from \"./editManagerFormatCommons.js\";\nimport {\n\tgetUpperBoundOfPreviousSequenceId,\n\tequalSequenceIds,\n\tmaxSequenceId,\n\tminSequenceId,\n\tsequenceIdComparator,\n} from \"./sequenceIdUtils.js\";\nimport {\n\tTelemetryEventBatcher,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\n\nexport const minimumPossibleSequenceNumber: SeqNumber = brand(Number.MIN_SAFE_INTEGER);\nconst minimumPossibleSequenceId: SequenceId = {\n\tsequenceNumber: minimumPossibleSequenceNumber,\n};\n\n/**\n * A special revision tag for the initial {@link EditManager.trunkBase} commit.\n * @remarks This tag is used to supply the _initial_ trunk base with a known revision.\n * The trunk base may advance over time, after which point the trunk base will have a different revision.\n * When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.\n */\nconst rootRevision = \"root\" as const satisfies RevisionTag;\n\n/**\n * Max number of telemetry log call that may be aggregated before being sent.\n */\nconst maxRebaseStatsAggregationCount = 1000;\n\n/**\n * Represents a local branch of a document and interprets the effect on the document of adding sequenced changes,\n * which were based on a given session's branch, to the document history\n */\n// TODO: Try to reduce this to a single type parameter\nexport class EditManager<\n\tTEditor extends ChangeFamilyEditor,\n\tTChangeset,\n\tTChangeFamily extends ChangeFamily<TEditor, TChangeset>,\n> {\n\tprivate readonly _events = createEmitter<BranchTrimmingEvents>();\n\n\tprivate readonly sharedBranches = new Map<BranchId, SharedBranch<TEditor, TChangeset>>();\n\n\t/**\n\t * Tracks where on the trunk of the main branch all registered branches are based.\n\t * Each key is the sequence id of a commit on the trunk,\n\t * and the value is the set of all branches who have that commit as their common ancestor with the trunk.\n\t *\n\t * @remarks\n\t * This does not include the local branch.\n\t */\n\tprivate readonly trunkBranches = new BTree<\n\t\tSequenceId,\n\t\tSet<SharedTreeBranch<TEditor, TChangeset>>\n\t>(undefined, sequenceIdComparator);\n\n\t/**\n\t * The sequence number of the newest commit on the trunk that has been received by all peers.\n\t * Defaults to {@link minimumPossibleSequenceNumber} if no commits have been received.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tprivate minimumSequenceNumber = minimumPossibleSequenceNumber;\n\n\t/**\n\t * A special commit that is a \"base\" (tail) of the trunk, though not part of the trunk itself.\n\t * This makes it possible to model the trunk in the same way as any other branch (it branches off of a base commit)\n\t * which allows it to use branching APIs to interact with the other branches.\n\t * Each time trunk eviction occurs, the most recent evicted commit becomes the new `trunkBase`.\n\t */\n\tprivate trunkBase: GraphCommit<TChangeset>;\n\n\tprivate readonly telemetryEventBatcher:\n\t\t| TelemetryEventBatcher<keyof RebaseStatsWithDuration>\n\t\t| undefined;\n\n\t/**\n\t * @param changeFamily - the change family of changes on the trunk and local branch\n\t * @param localSessionId - the id of the local session that will be used for local commits\n\t * @param mintRevisionTag - a function which generates globally unique revision tags\n\t * @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.\n\t */\n\tpublic constructor(\n\t\tpublic readonly changeFamily: TChangeFamily,\n\t\tpublic readonly localSessionId: SessionId,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly onSharedBranchCreated?: (branchId: BranchId) => void,\n\t\tlogger?: ITelemetryLoggerExt,\n\t) {\n\t\tthis.trunkBase = {\n\t\t\trevision: rootRevision,\n\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t};\n\n\t\tif (logger !== undefined) {\n\t\t\tthis.telemetryEventBatcher = new TelemetryEventBatcher(\n\t\t\t\t{\n\t\t\t\t\teventName: \"rebaseProcessing\",\n\t\t\t\t\tcategory: \"performance\",\n\t\t\t\t},\n\t\t\t\tlogger,\n\t\t\t\tmaxRebaseStatsAggregationCount,\n\t\t\t);\n\t\t}\n\n\t\tconst mainTrunk = new SharedTreeBranch(\n\t\t\tthis.trunkBase,\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\n\t\tthis.createAndAddSharedBranch(\"main\", undefined, undefined, mainTrunk);\n\t}\n\n\tpublic getLocalBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.getSharedBranch(branchId).localBranch;\n\t}\n\n\tprivate getSharedBranch(branchId: BranchId): SharedBranch<TEditor, TChangeset> {\n\t\treturn this.sharedBranches.get(branchId) ?? fail(0xc56 /* Branch does not exist */);\n\t}\n\n\t/**\n\t * Make the given branch known to the `EditManager`. The `EditManager` will ensure that all registered\n\t * branches remain usable even as the minimum sequence number advances.\n\t *\n\t * TODO#AB6926: Refactor local branch management into a separate class that encapsulates `trunkBranches` and everything\n\t * that touches it.\n\t * TODO#AB6925: Maintain the divergence point between each branch and the trunk so that we don't have to recompute\n\t * it so often.\n\t */\n\tprivate registerBranch(branch: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tthis.trackBranch(branch);\n\t\t// Whenever the branch is rebased, update our record of its base trunk commit\n\t\tconst offBeforeRebase = branch.events.on(\"beforeChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.untrackBranch(branch);\n\t\t\t}\n\t\t});\n\t\tconst offAfterRebase = branch.events.on(\"afterChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.trackBranch(branch);\n\t\t\t\tthis.trimHistory();\n\t\t\t}\n\t\t});\n\t\t// When the branch is disposed, update our branch set and trim the trunk\n\t\tconst offDispose = branch.events.on(\"dispose\", () => {\n\t\t\tthis.untrackBranch(branch);\n\t\t\tthis.trimHistory();\n\t\t\toffBeforeRebase();\n\t\t\toffAfterRebase();\n\t\t\toffDispose();\n\t\t});\n\t}\n\n\tprivate trackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad2 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\n\t\tassert(!branches.has(b), 0x670 /* Branch was registered more than once */);\n\t\tbranches.add(b);\n\t}\n\n\tprivate untrackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad3 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches =\n\t\t\tthis.trunkBranches.get(sequenceId) ?? fail(0xad4 /* Expected branch to be tracked */);\n\n\t\tassert(branches.delete(b), 0x671 /* Expected branch to be tracked */);\n\t\tif (branches.size === 0) {\n\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t}\n\t}\n\n\t/**\n\t * Return the sequenced number of the latest sequenced change.\n\t */\n\tpublic getLatestSequenceNumber(): SeqNumber | undefined {\n\t\tlet maxSequenceNumber: SeqNumber | undefined;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tconst branchMax = branch.getCommitSequenceId(\n\t\t\t\tbranch.trunk.getHead().revision,\n\t\t\t).sequenceNumber;\n\t\t\tif (maxSequenceNumber === undefined || maxSequenceNumber < branchMax) {\n\t\t\t\tmaxSequenceNumber = branchMax;\n\t\t\t}\n\t\t}\n\n\t\treturn maxSequenceNumber;\n\t}\n\n\t/**\n\t * Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,\n\t * if they are not retained by revertibles or local branches.\n\t * @param minimumSequenceNumber - the sequence number of the newest commit that all peers (including this one) have received and applied to their trunks.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tpublic advanceMinimumSequenceNumber(\n\t\tminimumSequenceNumber: SeqNumber,\n\t\ttrimHistory = true,\n\t): void {\n\t\tif (minimumSequenceNumber === this.minimumSequenceNumber) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tminimumSequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x476 /* number must be larger or equal to current minimumSequenceNumber. */,\n\t\t);\n\n\t\tthis.minimumSequenceNumber = minimumSequenceNumber;\n\t\tif (trimHistory) {\n\t\t\tthis.trimHistory();\n\t\t}\n\t}\n\n\t/**\n\t * Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine\n\t * if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.\n\t */\n\tprivate trimHistory(): void {\n\t\t/** The sequence id of the most recent commit on the trunk that will be trimmed */\n\t\tlet trunkTailSequenceId: SequenceId = {\n\t\t\tsequenceNumber: this.minimumSequenceNumber,\n\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t};\n\t\t// If there are any outstanding registered branches, get the one that is the oldest (has the \"most behind\" trunk base)\n\t\tconst minimumBranchBaseSequenceId = this.trunkBranches.minKey();\n\t\tif (minimumBranchBaseSequenceId !== undefined) {\n\t\t\t// If that branch is behind the minimum sequence id, we only want to evict commits older than it,\n\t\t\t// even if those commits are behind the minimum sequence id\n\t\t\tconst sequenceIdBeforeMinimumBranchBase = getUpperBoundOfPreviousSequenceId(\n\t\t\t\tminimumBranchBaseSequenceId,\n\t\t\t);\n\t\t\ttrunkTailSequenceId = minSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tsequenceIdBeforeMinimumBranchBase,\n\t\t\t);\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\n\t\tconst [sequenceId, latestEvicted] = mainBranch.getClosestTrunkCommit(\n\t\t\tmaxSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tmainBranch.sequenceIdToCommit.minKey() ?? minimumPossibleSequenceId,\n\t\t\t),\n\t\t);\n\n\t\t// Don't do any work if the commit found by the search is already the tail of the trunk\n\t\tif (latestEvicted === this.trunkBase) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This mutation is a performance hack. If commits are truly immutable, then changing the trunk's tail requires\n\t\t// regenerating the entire commit graph. Instead, we can simply chop off the tail like this if we're certain\n\t\t// that there are no outstanding references to any of the commits being removed (other than the references via\n\t\t// the trunk). The peer branches have been rebased to the head of the trunk, the local branch is already rebased\n\t\t// to the head of the trunk, and all other branches are tracked by `trunkBranches` and known to be ahead of or at\n\t\t// `newTrunkBase`. Therefore, no branches should have unique references to any of the commits being evicted here.\n\t\t// We mutate the most recent of the evicted commits to become the new trunk base. That way, any other commits that\n\t\t// have parent pointers to the latest evicted commit will stay linked, even though that it is no longer part of the trunk.\n\t\tconst newTrunkBase = latestEvicted as Mutable<typeof latestEvicted>;\n\n\t\t// collect the revisions that will be trimmed to send as part of the branch trimmed event\n\t\tconst trimmedCommits = getPathFromBase(newTrunkBase, this.trunkBase);\n\t\tconst trimmedRevisions = trimmedCommits.map((c) => c.revision);\n\n\t\t// The minimum sequence number informs us that all peer branches are at least caught up to the tail commit,\n\t\t// so rebase them accordingly. This is necessary to prevent peer branches from referencing any evicted commits.\n\t\tmainBranch.trimHistory(latestEvicted, sequenceId);\n\n\t\t// Only the last trimmed commit, which is the new trunk base, should remain accessible.\n\t\tfor (const commit of trimmedCommits.slice(0, -1)) {\n\t\t\tReflect.defineProperty(commit, \"change\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa5e /* Should not access 'change' property of an evicted commit */),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"revision\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t0xa5f /* Should not access 'revision' property of an evicted commit */,\n\t\t\t\t\t),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"parent\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa60 /* Should not access 'parent' property of an evicted commit */),\n\t\t\t});\n\t\t}\n\n\t\t// Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.\n\t\tdelete newTrunkBase.parent;\n\t\tthis.trunkBase = newTrunkBase;\n\n\t\tthis._events.emit(\"ancestryTrimmed\", trimmedRevisions);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tif (!branch.isEmpty(this.trunkBase)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn this.minimumSequenceNumber === minimumPossibleSequenceNumber;\n\t}\n\n\tpublic getSummaryData(): SummaryData<TChangeset> {\n\t\t// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.\n\t\tthis.trimHistory();\n\n\t\tconst minSeqNumberToSummarize: SequenceId = {\n\t\t\tsequenceNumber: brand(this.minimumSequenceNumber + 1),\n\t\t};\n\t\tlet minBaseSeqId: SequenceId = minSeqNumberToSummarize;\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branches = new Map<BranchId, SharedBranchSummaryData<TChangeset>>();\n\t\tfor (const [branchId, branch] of this.sharedBranches) {\n\t\t\tif (branchId !== \"main\") {\n\t\t\t\tconst branchSummary = branch.getSummaryData(\n\t\t\t\t\tminSeqNumberToSummarize,\n\t\t\t\t\tthis.trunkBase.revision,\n\t\t\t\t);\n\t\t\t\tbranches.set(branchId, branchSummary);\n\t\t\t\tassert(branchSummary.base !== undefined, 0xc57 /* Branch summary must have a base */);\n\t\t\t\tconst baseSequenceId = mainBranch.getCommitSequenceId(branchSummary.base);\n\t\t\t\tminBaseSeqId = minSequenceId(minBaseSeqId, baseSequenceId);\n\t\t\t}\n\t\t}\n\t\tconst mainSummary = mainBranch.getSummaryData(minBaseSeqId, this.trunkBase.revision);\n\t\treturn { main: mainSummary, branches, originator: this.localSessionId };\n\t}\n\n\tpublic loadSummaryData(data: SummaryData<TChangeset>): void {\n\t\tassert(\n\t\t\tthis.isEmpty(),\n\t\t\t0x68a /* Attempted to load from summary after edit manager was already mutated */,\n\t\t);\n\t\t// Record the tags of each trunk commit as we generate the trunk so they can be looked up quickly\n\t\t// when hydrating the peer branches below\n\t\tconst trunkRevisionCache = new Map<RevisionTag, GraphCommit<TChangeset>>();\n\t\ttrunkRevisionCache.set(this.trunkBase.revision, this.trunkBase);\n\t\tconst mainBranch =\n\t\t\tthis.sharedBranches.get(\"main\") ?? fail(0xc58 /* Main branch must exist */);\n\t\tmainBranch.loadSummaryData(data.main, trunkRevisionCache);\n\t\tif (data.branches !== undefined) {\n\t\t\tfor (const [branchId, branchData] of data.branches) {\n\t\t\t\tconst branch = this.createSharedBranch(\n\t\t\t\t\tbranchId,\n\t\t\t\t\tbranchData.session,\n\t\t\t\t\tmainBranch,\n\t\t\t\t\tmainBranch.trunk.fork(),\n\t\t\t\t);\n\t\t\t\tbranch.loadSummaryData(branchData, trunkRevisionCache);\n\t\t\t\tthis.addSharedBranch(branchId, branch);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getTrunkHead(branchId: BranchId): GraphCommit<TChangeset> {\n\t\treturn this.getSharedBranch(branchId).trunk.getHead();\n\t}\n\n\tpublic getTrunkChanges(branchId: BranchId): TChangeset[] {\n\t\treturn this.getTrunkCommits(branchId).map((c) => c.change);\n\t}\n\n\tpublic getTrunkCommits(branchId: BranchId): GraphCommit<TChangeset>[] {\n\t\treturn getPathFromBase(this.getTrunkHead(branchId), this.trunkBase);\n\t}\n\n\tpublic getLocalCommits(branchId: BranchId): readonly GraphCommit<TChangeset>[] {\n\t\tconst branch = this.getSharedBranch(branchId);\n\t\treturn branch.getLocalCommits();\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `EditManager`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tmax = Math.max(max, branch.getLongestBranchLength());\n\t\t}\n\t\treturn max;\n\t}\n\n\tpublic sequenceBranchCreation(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tif (sessionId === this.localSessionId) {\n\t\t\tassert(this.sharedBranches.has(branchId), 0xc59 /* Expected branch to already exist */);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branchTrunk = mainBranch.rebasePeer(sessionId, referenceSequenceNumber).fork();\n\t\tthis.createAndAddSharedBranch(branchId, sessionId, mainBranch, branchTrunk);\n\t}\n\n\tpublic addNewBranch(branchId: BranchId): void {\n\t\tconst main = this.getSharedBranch(\"main\") ?? fail(0xc5a /* Main branch must exist */);\n\t\tthis.createAndAddSharedBranch(\n\t\t\tbranchId,\n\t\t\tthis.localSessionId,\n\t\t\tmain,\n\t\t\tthis.getLocalBranch(\"main\").fork(),\n\t\t);\n\t}\n\n\tpublic getSharedBranchIds(): BranchId[] {\n\t\treturn Array.from(this.sharedBranches.keys());\n\t}\n\n\tpublic removeBranch(branchId: BranchId): void {\n\t\tassert(branchId !== \"main\", 0xc5b /* Cannot remove main branch */);\n\t\tconst hadBranch = this.sharedBranches.delete(branchId);\n\t\tassert(hadBranch, 0xc5c /* Expected branch to exist */);\n\t}\n\n\tprivate createAndAddSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = this.createSharedBranch(branchId, sessionId, parent, branch);\n\t\tthis.addSharedBranch(branchId, sharedBranch);\n\t\treturn sharedBranch;\n\t}\n\n\tprivate addSharedBranch(\n\t\tbranchId: BranchId,\n\t\tbranch: SharedBranch<TEditor, TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\t!this.sharedBranches.has(branchId),\n\t\t\t0xc5d /* A branch with this ID already exists */,\n\t\t);\n\t\tthis.sharedBranches.set(branchId, branch);\n\n\t\t// Track all forks of the local branch for purposes of trunk eviction. Unlike the local branch, they have\n\t\t// an unknown lifetime and rebase frequency, so we can not make any assumptions about which trunk commits\n\t\t// they require and therefore we monitor them explicitly.\n\t\tonForkTransitive(branch.localBranch, (fork) => this.registerBranch(fork));\n\n\t\tif (branchId !== \"main\") {\n\t\t\tthis.registerBranch(branch.localBranch);\n\t\t\tthis.onSharedBranchCreated?.(branchId);\n\t\t}\n\t}\n\n\tprivate createSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = new SharedBranch(\n\t\t\tparent,\n\t\t\tbranch,\n\t\t\tbranchId,\n\t\t\tsessionId,\n\t\t\tminimumPossibleSequenceId,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\n\t\treturn sharedBranch;\n\t}\n\n\t/* eslint-disable jsdoc/check-indentation */\n\t/**\n\t * Add a bunch of sequenced changes. A bunch is a group of sequenced commits that have the following properties:\n\t * - They are not interleaved with messages from other DDSes in the container.\n\t * - They are all part of the same batch, which entails:\n\t * - They are contiguous in sequencing order.\n\t * - They are all from the same client.\n\t * - They are all based on the same reference sequence number.\n\t * - They are not interleaved with messages from other clients.\n\t */\n\t/* eslint-enable jsdoc/check-indentation */\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tassert(newCommits.length > 0, 0xad8 /* Expected at least one sequenced change */);\n\t\tassert(\n\t\t\tsequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,\n\t\t);\n\n\t\tconst branch = this.getSharedBranch(branchId);\n\n\t\tconst onSequenceLocalCommit = (\n\t\t\tcommit: GraphCommit<TChangeset>,\n\t\t\tsequenceId: SequenceId,\n\t\t\tpreviousSequenceId: SequenceId,\n\t\t): void => {\n\t\t\t// Next, we need to update the sequence IDs that our local branches (user's branches, not peer branches) are associated with.\n\t\t\t// In particular, if a local branch is based on the previous trunk head (the branch's first ancestor in the trunk is the commit that was the head before we pushed the new commit)\n\t\t\t// and also branches off of the local branch (it has an ancestor that is part of the local branch), it needs to have its sequence number advanced to be that of the new trunk head.\n\t\t\t// Intuitively, this makes sense because:\n\t\t\t// 1. The trunk's head just advanced forward by some (sequence) amount.\n\t\t\t// 2. The local branch is always rebased to be branching off of the head of the trunk (not literally in this case, because of the optimization, but in effect).\n\t\t\t// 3. Therefore, the entire local branch just advanced forward by some (sequence) amount, and any commits downstream of it which track the sequence numbers of their base commits on the trunk should also advance.\n\t\t\t// This update is not necessarily required for all local branches, since some may have fallen behind the local branch and are based on older trunk commits (such branches do not need updating).\n\t\t\tconst currentBranches = this.trunkBranches.get(previousSequenceId);\n\t\t\tif (currentBranches !== undefined) {\n\t\t\t\tconst newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\t\t\t\tfor (const forkedBranch of currentBranches) {\n\t\t\t\t\t// Check every branch associated with the old sequence ID and advance it if it is based on the local branch (specifically, on the local branch as it was before we pushed its first commit to the trunk).\n\t\t\t\t\t// We validate this by checking if the branch's head is a descendant of the local commit that we just pushed.\n\t\t\t\t\tif (findAncestor(forkedBranch.getHead(), (c) => c === commit) !== undefined) {\n\t\t\t\t\t\tnewBranches.add(forkedBranch);\n\t\t\t\t\t\tcurrentBranches.delete(forkedBranch);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Clean up our trunk branches map by removing any empty sets.\n\t\t\t\tif (currentBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(previousSequenceId);\n\t\t\t\t}\n\t\t\t\tif (newBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst areLocalCommits = sessionId === this.localSessionId;\n\t\tbranch.addSequencedChanges(\n\t\t\tnewCommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\tareLocalCommits,\n\t\t\treferenceSequenceNumber,\n\t\t\tonSequenceLocalCommit,\n\t\t);\n\t}\n\n\tpublic findLocalCommit(\n\t\tbranchId: BranchId,\n\t\trevision: RevisionTag,\n\t): [commit: GraphCommit<TChangeset>, commitsAfter: GraphCommit<TChangeset>[]] {\n\t\tconst commits: GraphCommit<TChangeset>[] = [];\n\t\tconst commit = findAncestor(\n\t\t\t[this.getSharedBranch(branchId).localBranch.getHead(), commits],\n\t\t\t(c) => c.revision === revision,\n\t\t);\n\t\tassert(commit !== undefined, 0x599 /* Expected local branch to contain revision */);\n\t\treturn [commit, commits];\n\t}\n}\n\n/**\n * The in-memory data that summaries contain\n */\nexport interface SummaryData<TChangeset> {\n\treadonly originator?: SessionId;\n\treadonly main: SharedBranchSummaryData<TChangeset>;\n\treadonly branches?: ReadonlyMap<BranchId, SharedBranchSummaryData<TChangeset>>;\n}\n\nexport interface SharedBranchSummaryData<TChangeset> {\n\treadonly id?: BranchId;\n\treadonly name?: string;\n\treadonly session?: SessionId;\n\treadonly author?: string;\n\treadonly base?: RevisionTag;\n\treadonly trunk: readonly SequencedCommit<TChangeset>[];\n\treadonly peerLocalBranches: ReadonlyMap<SessionId, SummarySessionBranch<TChangeset>>;\n}\n\n/**\n * Gets the path from the base of a branch to its head.\n */\nfunction getPathFromBase<TCommit extends { parent?: TCommit }>(\n\tbranchHead: TCommit,\n\tbaseBranchHead: TCommit,\n): TCommit[] {\n\tconst path: TCommit[] = [];\n\tassert(\n\t\tfindCommonAncestor([branchHead, path], baseBranchHead) !== undefined,\n\t\t0x573 /* Expected branches to be related */,\n\t);\n\treturn path;\n}\n\nclass SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {\n\t/**\n\t * This branch holds the changes made by this client which have not yet been confirmed as sequenced changes.\n\t */\n\tpublic readonly localBranch: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Branches are maintained to represent the local change list that the issuing client had\n\t * at the time of submitting the latest known edit on the branch.\n\t * This means the head commit of each branch is always in its original (non-rebased) form.\n\t */\n\tprivate readonly peerLocalBranches: Map<SessionId, SharedTreeBranch<TEditor, TChangeset>> =\n\t\tnew Map();\n\n\t/**\n\t * A map from a sequence id to the commit which has that sequence id.\n\t * This also includes an entry for the {@link trunkBase} which always has the lowest key in the map.\n\t */\n\tpublic readonly sequenceIdToCommit = new BTree<SequenceId, GraphCommit<TChangeset>>(\n\t\tundefined,\n\t\tsequenceIdComparator,\n\t);\n\n\t/**\n\t * The list of commits (from oldest to most recent) that are on the local branch but not on the trunk.\n\t * When a local commit is sequenced, the first commit in this list shifted onto the tip of the trunk.\n\t */\n\tprivate readonly localCommits: GraphCommit<TChangeset>[] = [];\n\n\t/**\n\t * Records extra data associated with sequenced commits.\n\t * This does not include an entry for the {@link trunkBase}.\n\t */\n\tprivate readonly commitMetadata = new Map<\n\t\tRevisionTag,\n\t\t{ sequenceId: SequenceId; sessionId: SessionId }\n\t>();\n\n\tpublic constructor(\n\t\tpublic readonly parentBranch: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tpublic readonly trunk: SharedTreeBranch<TEditor, TChangeset>,\n\t\tprivate readonly id: BranchId,\n\t\tprivate readonly sessionId: SessionId | undefined,\n\t\tbaseCommitSequenceId: SequenceId,\n\t\tprivate readonly changeFamily: ChangeFamily<TEditor, TChangeset>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tbranchTrimmer: Listenable<BranchTrimmingEvents>,\n\t\ttelemetryEventBatcher: TelemetryEventBatcher<keyof RebaseStatsWithDuration> | undefined,\n\t) {\n\t\tthis.localBranch = new SharedTreeBranch(\n\t\t\tthis.trunk.getHead(),\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tbranchTrimmer,\n\t\t\ttelemetryEventBatcher,\n\t\t);\n\n\t\tthis.sequenceIdToCommit.set(baseCommitSequenceId, this.trunk.getHead());\n\n\t\tthis.localBranch.events.on(\"afterChange\", (event) => {\n\t\t\tif (event.type === \"append\") {\n\t\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\t\tthis.localCommits.push(commit);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.localCommits.length = 0;\n\t\t\t\tfindCommonAncestor(\n\t\t\t\t\t[this.localBranch.getHead(), this.localCommits],\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\tareLocalCommits: boolean,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\tsequenceNumber >= // This is \">=\", not \">\" because changes in the same batch will have the same sequence number\n\t\t\t\t(this.sequenceIdToCommit.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),\n\t\t\t0xa64 /* Attempted to sequence change with an outdated sequence number */,\n\t\t);\n\n\t\tconst batchSize = this.getBatchSize(sequenceNumber);\n\t\t// The sequence id for the next commit to be processed in the bunch.\n\t\tlet nextSequenceId =\n\t\t\tbatchSize === 0\n\t\t\t\t? {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\tindexInBatch: batchSize,\n\t\t\t\t\t};\n\n\t\t// Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto\n\t\t// the trunk.\n\t\tif (areLocalCommits) {\n\t\t\tfor (const { revision } of newCommits) {\n\t\t\t\tthis.sequenceLocalCommit(revision, nextSequenceId, sessionId, onSequenceLocalCommit);\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Remote changes, i.e., changes from remote clients are applied in three steps.\n\t\t// Step 1 - Recreate the peer remote client's local environment.\n\t\t// Get the revision that the remote change is based on and rebase that peer local branch over the part of the\n\t\t// trunk up to the base revision. This will be a no-op if the sending client has not advanced since the last\n\t\t// time we received an edit from it\n\t\tconst peerLocalBranch = this.rebasePeer(sessionId, referenceSequenceNumber);\n\n\t\t// Step 2 - Append the changes to the peer branch and rebase the changes to the tip of the trunk.\n\t\tif (peerLocalBranch.getHead() === this.trunk.getHead()) {\n\t\t\t// If the peer local branch is fully caught up and empty (no changes relative to the trunk) after being\n\t\t\t// rebased, then push changes to the trunk directly and update the peer branch to the trunk's head.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tthis.pushCommitToTrunk(nextSequenceId, { ...newCommit, sessionId });\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\tpeerLocalBranch.setHead(this.trunk.getHead());\n\t\t} else {\n\t\t\t// Otherwise, push the changes to the peer local branch and merge the branch into the trunk.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tpeerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));\n\t\t\t}\n\t\t\tconst result = this.trunk.merge(peerLocalBranch);\n\t\t\tif (result !== undefined) {\n\t\t\t\t// If the merge resulted in any changes to the trunk, update the sequence map and trunk metadata\n\t\t\t\t// with the rebased commits.\n\t\t\t\tfor (const sourceCommit of result.sourceCommits) {\n\t\t\t\t\tthis.sequenceIdToCommit.set(nextSequenceId, sourceCommit);\n\t\t\t\t\tthis.commitMetadata.set(sourceCommit.revision, {\n\t\t\t\t\t\tsequenceId: nextSequenceId,\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t});\n\t\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Step 3 - Rebase the local branch over the updated trunk.\n\t\tthis.localBranch.rebaseOnto(this.trunk);\n\t}\n\n\tpublic isEmpty(baseCommit: GraphCommit<TChangeset>): boolean {\n\t\treturn (\n\t\t\tthis.trunk.getHead() === baseCommit &&\n\t\t\tthis.peerLocalBranches.size === 0 &&\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead()\n\t\t);\n\t}\n\n\tpublic rebasePeer(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t): SharedTreeBranch<TEditor, TChangeset> {\n\t\tconst [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);\n\t\tconst peerLocalBranch = getOrCreate(\n\t\t\tthis.peerLocalBranches,\n\t\t\tsessionId,\n\t\t\t() => new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),\n\t\t);\n\t\tpeerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);\n\t\treturn peerLocalBranch;\n\t}\n\n\tpublic getPeerBranchOrTrunk(sessionId: SessionId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.peerLocalBranches.get(sessionId) ?? this.trunk;\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `SharedBranch`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tfor (const branch of this.peerLocalBranches.values()) {\n\t\t\tconst branchPath = getPathFromBase(branch.getHead(), trunkHead);\n\t\t\tif (branchPath.length > max) {\n\t\t\t\tmax = branchPath.length;\n\t\t\t}\n\t\t}\n\t\tconst localPath = getPathFromBase(this.localBranch.getHead(), trunkHead);\n\t\treturn Math.max(max, localPath.length);\n\t}\n\n\tpublic trimHistory(newBase: GraphCommit<TChangeset>, sequenceId: SequenceId): void {\n\t\tthis.rebasePeers(newBase);\n\n\t\tthis.sequenceIdToCommit.editRange(\n\t\t\tminimumPossibleSequenceId,\n\t\t\tsequenceId,\n\t\t\ttrue,\n\t\t\t(s, commit) => {\n\t\t\t\t// Cleanup look-aside data for each evicted commit\n\t\t\t\tthis.commitMetadata.delete(commit.revision);\n\t\t\t\t// Delete all evicted commits from `sequenceMap` except for the latest one, which is the new `trunkBase`\n\t\t\t\tif (equalSequenceIds(s, sequenceId)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcommit === newBase,\n\t\t\t\t\t\t0x729 /* Expected last evicted commit to be new trunk base */,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn { delete: true };\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\tconst trunkSize = getPathFromBase(this.trunk.getHead(), newBase).length;\n\t\tassert(\n\t\t\tthis.sequenceIdToCommit.size === trunkSize + 1,\n\t\t\t0x744 /* The size of the sequenceMap must have one element more than the trunk */,\n\t\t);\n\t\tassert(\n\t\t\tthis.commitMetadata.size === trunkSize,\n\t\t\t0x745 /* The size of the trunkMetadata must be the same as the trunk */,\n\t\t);\n\t}\n\n\tprivate rebasePeers(commit: GraphCommit<TChangeset>): void {\n\t\tfor (const [, branch] of this.peerLocalBranches) {\n\t\t\tbranch.rebaseOnto(this.trunk, commit);\n\t\t}\n\n\t\t// The metadata for new trunk base revision needs to be deleted before modifying it.\n\t\tthis.commitMetadata.delete(commit.revision);\n\t}\n\n\tpublic getLocalCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn this.localCommits;\n\t}\n\n\t/**\n\t * Promote the oldest un-sequenced commit on the local branch to the head of the trunk.\n\t * @param sequenceId - The sequence id of the new trunk commit\n\t * @remarks This method is a performance optimization for the scenario where this client receives its own change back after sequencing.\n\t * The normal (not optimized) process in this case would be to apply the new sequenced commit to the trunk and then rebase the local branch over the trunk.\n\t * The first commit will be \"the same\" (as in, it will have the same revision) as the commit that was just sequenced, so the rebase will be a no-op.\n\t * Because the rebase is a no-op, we can skip it entirely and simply remove the commit from the local branch and append it to the trunk.\n\t * Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.\n\t */\n\tprivate sequenceLocalCommit(\n\t\trevision: RevisionTag,\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tif (this.commitMetadata.has(revision)) {\n\t\t\t// This can happen if the commit came from a shared branch and was concurrently merged by another client.\n\t\t\t// In this case, the newly sequenced commit is redundant and should therefore be ignored.\n\t\t\treturn;\n\t\t}\n\n\t\t// First, push the local commit to the trunk.\n\t\t// We are mutating our `localCommits` cache here,but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.\n\t\tconst firstLocalCommit = this.localCommits.shift();\n\t\tassert(\n\t\t\tfirstLocalCommit !== undefined,\n\t\t\t0x6b5 /* Received a sequenced change from the local session despite having no local changes */,\n\t\t);\n\n\t\tconst prevSequenceId = this.getCommitSequenceId(this.trunk.getHead().revision);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, sessionId);\n\t\tonSequenceLocalCommit(firstLocalCommit, sequenceId, prevSequenceId);\n\t}\n\n\t/**\n\t * Finds the most recent trunk commit that was sequenced at or before the given point.\n\t * @param searchBy - the sequence number or the sequence id to search for\n\t * @remarks Fails if there is no eligible commit.\n\t * @returns the closest commit and its sequence id\n\t */\n\tpublic getClosestTrunkCommit(searchBy: SeqNumber): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(searchBy: SequenceId): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(\n\t\tsearchBy: SeqNumber | SequenceId,\n\t): [SequenceId, GraphCommit<TChangeset>] {\n\t\tconst sequenceId: SequenceId =\n\t\t\ttypeof searchBy === \"number\"\n\t\t\t\t? {\n\t\t\t\t\t\t// This is to make sure that the correct commit is selected in this 2 scenarios:\n\t\t\t\t\t\t// 1) The commit is unique for that sequence number\n\t\t\t\t\t\t// 2) There are more than one commit for the same sequence number, in this case we need to select the last one.\n\t\t\t\t\t\tsequenceNumber: searchBy,\n\t\t\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t\t\t}\n\t\t\t\t: searchBy;\n\n\t\tconst commit = this.sequenceIdToCommit.getPairOrNextLower(sequenceId);\n\t\tassert(commit !== undefined, 0x746 /* sequence id has been evicted */);\n\t\treturn commit;\n\t}\n\n\tprivate pushGraphCommitToTrunk(\n\t\tsequenceId: SequenceId,\n\t\tgraphCommit: GraphCommit<TChangeset>,\n\t\tsessionId: SessionId,\n\t): void {\n\t\tthis.trunk.setHead(graphCommit);\n\t\tthis.registerSequencedCommit(sequenceId, sessionId, graphCommit);\n\t}\n\n\tprivate pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {\n\t\tconst mintedCommit = mintCommit(this.trunk.getHead(), commit);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);\n\t}\n\n\tprivate registerSequencedCommit(\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tcommit: GraphCommit<TChangeset>,\n\t): void {\n\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\tthis.commitMetadata.set(commit.revision, { sequenceId, sessionId });\n\t}\n\n\tpublic getCommitSequenceId(commitRevision: RevisionTag): SequenceId {\n\t\tconst id = this.commitMetadata.get(commitRevision)?.sequenceId;\n\t\tif (id === undefined) {\n\t\t\treturn minimumPossibleSequenceId;\n\t\t}\n\t\treturn id;\n\t}\n\n\t// TODO: Document that this is to handle receiving separate commits with the same sequence ID,\n\t// as a batch of changes are not guaranteed to be processed as one bunch.\n\tprivate getBatchSize(sequenceNumber: SeqNumber): number {\n\t\tconst startSequenceId: SequenceId = {\n\t\t\tsequenceNumber,\n\t\t};\n\t\tconst endSequenceId: SequenceId = {\n\t\t\tsequenceNumber: brand((sequenceNumber as number) + 1),\n\t\t};\n\n\t\treturn this.sequenceIdToCommit.getRange(startSequenceId, endSequenceId, false).length;\n\t}\n\n\tpublic getSummaryData(\n\t\tminSeqNumberToSummarize: SequenceId,\n\t\ttrunkBaseRevision: RevisionTag,\n\t): SharedBranchSummaryData<TChangeset> {\n\t\t// The assert below is acceptable at present because summarization only ever occurs on a client with no\n\t\t// local/in-flight changes.\n\t\t// In the future we may wish to relax this constraint. For that to work, the current implementation of\n\t\t// `EditManager` would have to be amended in one of two ways:\n\t\t// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.\n\t\t// B) The contents of such a branch should be computed on demand based on the trunk.\n\t\t// Note that option (A) would be a simple change to `addSequencedChanges` whereas (B) would likely require\n\t\t// rebasing trunk changes over the inverse of trunk changes.\n\t\tassert(\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead(),\n\t\t\t0xc5e /* Clients with local changes cannot be used to generate summaries */,\n\t\t);\n\n\t\tlet parentHead: GraphCommit<TChangeset>;\n\t\tif (this.parentBranch === undefined) {\n\t\t\tconst oldestCommitInCollabWindow =\n\t\t\t\tthis.getClosestTrunkCommit(minSeqNumberToSummarize)[1];\n\t\t\t// Path construction is exclusive, so we need to use the parent of the oldest commit in the window if it exists\n\t\t\tparentHead = oldestCommitInCollabWindow.parent ?? oldestCommitInCollabWindow;\n\t\t} else {\n\t\t\tparentHead = this.parentBranch.trunk.getHead();\n\t\t}\n\n\t\tconst childBranchTrunkCommits: GraphCommit<TChangeset>[] = [];\n\t\tconst forkPointFromMainTrunk = findCommonAncestor(\n\t\t\t[this.trunk.getHead(), childBranchTrunkCommits],\n\t\t\tparentHead,\n\t\t);\n\t\tassert(\n\t\t\tforkPointFromMainTrunk !== undefined,\n\t\t\t0xc5f /* Expected child branch to be based on main branch */,\n\t\t);\n\n\t\tconst trunk = childBranchTrunkCommits.map((c) => {\n\t\t\tconst metadata =\n\t\t\t\tthis.commitMetadata.get(c.revision) ??\n\t\t\t\tfail(0xad5 /* Expected metadata for trunk commit */);\n\t\t\tconst commit: SequencedCommit<TChangeset> = {\n\t\t\t\tchange: c.change,\n\t\t\t\trevision: c.revision,\n\t\t\t\tsequenceNumber: metadata.sequenceId.sequenceNumber,\n\t\t\t\tsessionId: metadata.sessionId,\n\t\t\t};\n\t\t\tif (metadata.sequenceId.indexInBatch !== undefined) {\n\t\t\t\tcommit.indexInBatch = metadata.sequenceId.indexInBatch;\n\t\t\t}\n\t\t\treturn commit;\n\t\t});\n\n\t\tconst peerLocalBranches = new Map<SessionId, SummarySessionBranch<TChangeset>>(\n\t\t\tmapIterable(this.peerLocalBranches.entries(), ([sessionId, branch]) => {\n\t\t\t\tconst branchPath: GraphCommit<TChangeset>[] = [];\n\t\t\t\tconst ancestor =\n\t\t\t\t\tfindCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??\n\t\t\t\t\tfail(0xad6 /* Expected branch to be based on trunk */);\n\n\t\t\t\tconst base =\n\t\t\t\t\tancestor.revision === trunkBaseRevision ? rootRevision : ancestor.revision;\n\t\t\t\treturn [\n\t\t\t\t\tsessionId,\n\t\t\t\t\t{\n\t\t\t\t\t\tbase,\n\t\t\t\t\t\tcommits: branchPath.map((c) => {\n\t\t\t\t\t\t\tconst commit: Commit<TChangeset> = {\n\t\t\t\t\t\t\t\tchange: c.change,\n\t\t\t\t\t\t\t\trevision: c.revision,\n\t\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn commit;\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}),\n\t\t);\n\n\t\tconst trunkBase =\n\t\t\tthis.parentBranch === undefined ? undefined : forkPointFromMainTrunk.revision;\n\t\treturn { trunk, peerLocalBranches, base: trunkBase, id: this.id, session: this.sessionId };\n\t}\n\n\tpublic loadSummaryData(\n\t\tdata: SharedBranchSummaryData<TChangeset>,\n\t\ttrunkRevisionCache: Map<RevisionTag, GraphCommit<TChangeset>>,\n\t): void {\n\t\tassert(\n\t\t\t(this.parentBranch === undefined) === (data.base === undefined),\n\t\t\t0xc60 /* Expected branch base to match presence of parent branch */,\n\t\t);\n\t\tconst parentTrunkBase =\n\t\t\ttrunkRevisionCache.get(data.base ?? rootRevision) ??\n\t\t\tfail(0xc61 /* Expected base revision to be in trunk cache */);\n\t\tthis.trunk.setHead(\n\t\t\tdata.trunk.reduce((base, c) => {\n\t\t\t\tconst sequenceId: SequenceId =\n\t\t\t\t\tc.indexInBatch === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t\tindexInBatch: c.indexInBatch,\n\t\t\t\t\t\t\t};\n\t\t\t\tconst commit = mintCommit(base, c);\n\t\t\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\t\t\tthis.commitMetadata.set(c.revision, {\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tsessionId: c.sessionId,\n\t\t\t\t});\n\t\t\t\ttrunkRevisionCache.set(c.revision, commit);\n\t\t\t\treturn commit;\n\t\t\t}, parentTrunkBase),\n\t\t);\n\n\t\tthis.localBranch.setHead(this.trunk.getHead());\n\n\t\tfor (const [sessionId, branch] of data.peerLocalBranches) {\n\t\t\tconst commit =\n\t\t\t\ttrunkRevisionCache.get(branch.base) ??\n\t\t\t\tfail(0xad7 /* Expected summary branch to be based off of a revision in the trunk */);\n\n\t\t\tthis.peerLocalBranches.set(\n\t\t\t\tsessionId,\n\t\t\t\tnew SharedTreeBranch(\n\t\t\t\t\tbranch.commits.reduce(mintCommit, commit),\n\t\t\t\t\tthis.changeFamily,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n// Returns the sequence id for the next commit to be processed in the bunch. Since all the commits have the\n// same sequence number, only the index in the batch needs to be incremented.\nfunction getNextSequenceId(sequenceId: SequenceId): SequenceId {\n\treturn {\n\t\tsequenceNumber: sequenceId.sequenceNumber,\n\t\tindexInBatch: (sequenceId.indexInBatch ?? 0) + 1,\n\t};\n}\n\ntype OnSequenceCommit<TChangeset> = (\n\tcommit: GraphCommit<TChangeset>,\n\tsequenceId: SequenceId,\n\tprevSequenceId: SequenceId,\n) => void;\n"]}
|
|
1
|
+
{"version":3,"file":"editManager.js","sourceRoot":"","sources":["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AAU,EAAE,MAAM,CAAC,CAAC;YAChD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;gBACnC,UAAU;gBACV,SAAS,EAAE,CAAC,CAAC,SAAS;aACtB,CAAC,CAAC;YACH,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC3C,OAAO,MAAM,CAAC;QACf,CAAC,EAAE,eAAe,CAAC,CACnB,CAAC;QAEF,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/C,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC1D,MAAM,MAAM,GACX,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;gBACnC,IAAA,eAAI,EAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;YAEtF,IAAI,CAAC,iBAAiB,CAAC,GAAG,CACzB,SAAS,EACT,IAAI,4BAAgB,CACnB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAU,EAAE,MAAM,CAAC,EACzC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,eAAe,CACpB,CACD,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,2GAA2G;AAC3G,6EAA6E;AAC7E,SAAS,iBAAiB,CAAC,UAAsB;IAChD,OAAO;QACN,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,YAAY,EAAE,CAAC,UAAU,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC;KAChD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\ttype RebaseStatsWithDuration,\n\ttagChange,\n\ttype EditorOptions,\n} from \"../core/index.js\";\nimport { type Mutable, brand, getOrCreate, mapIterable } from \"../util/index.js\";\n\nimport {\n\tSharedTreeBranch,\n\ttype BranchTrimmingEvents,\n\tonForkTransitive,\n\ttype BranchId,\n} from \"./branch.js\";\nimport type {\n\tCommit,\n\tSeqNumber,\n\tSequenceId,\n\tSequencedCommit,\n\tSummarySessionBranch,\n} from \"./editManagerFormatCommons.js\";\nimport {\n\tgetUpperBoundOfPreviousSequenceId,\n\tequalSequenceIds,\n\tmaxSequenceId,\n\tminSequenceId,\n\tsequenceIdComparator,\n} from \"./sequenceIdUtils.js\";\nimport {\n\tTelemetryEventBatcher,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\n\nexport const minimumPossibleSequenceNumber: SeqNumber = brand(Number.MIN_SAFE_INTEGER);\nconst minimumPossibleSequenceId: SequenceId = {\n\tsequenceNumber: minimumPossibleSequenceNumber,\n};\n\n/**\n * A special revision tag for the initial {@link EditManager.trunkBase} commit.\n * @remarks This tag is used to supply the _initial_ trunk base with a known revision.\n * The trunk base may advance over time, after which point the trunk base will have a different revision.\n * When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.\n */\nconst rootRevision = \"root\" as const satisfies RevisionTag;\n\n/**\n * Max number of telemetry log call that may be aggregated before being sent.\n */\nconst maxRebaseStatsAggregationCount = 1000;\n\n/**\n * Represents a local branch of a document and interprets the effect on the document of adding sequenced changes,\n * which were based on a given session's branch, to the document history\n */\n// TODO: Try to reduce this to a single type parameter\nexport class EditManager<\n\tTEditor extends ChangeFamilyEditor,\n\tTChangeset,\n\tTChangeFamily extends ChangeFamily<TEditor, TChangeset>,\n> {\n\tprivate readonly _events = createEmitter<BranchTrimmingEvents>();\n\n\tprivate readonly sharedBranches = new Map<BranchId, SharedBranch<TEditor, TChangeset>>();\n\n\t/**\n\t * Tracks where on the trunk of the main branch all registered branches are based.\n\t * Each key is the sequence id of a commit on the trunk,\n\t * and the value is the set of all branches who have that commit as their common ancestor with the trunk.\n\t *\n\t * @remarks\n\t * This does not include the local branch.\n\t */\n\tprivate readonly trunkBranches = new BTree<\n\t\tSequenceId,\n\t\tSet<SharedTreeBranch<TEditor, TChangeset>>\n\t>(undefined, sequenceIdComparator);\n\n\t/**\n\t * The sequence number of the newest commit on the trunk that has been received by all peers.\n\t * Defaults to {@link minimumPossibleSequenceNumber} if no commits have been received.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tprivate minimumSequenceNumber = minimumPossibleSequenceNumber;\n\n\t/**\n\t * A special commit that is a \"base\" (tail) of the trunk, though not part of the trunk itself.\n\t * This makes it possible to model the trunk in the same way as any other branch (it branches off of a base commit)\n\t * which allows it to use branching APIs to interact with the other branches.\n\t * Each time trunk eviction occurs, the most recent evicted commit becomes the new `trunkBase`.\n\t */\n\tprivate trunkBase: GraphCommit<TChangeset>;\n\n\tprivate readonly telemetryEventBatcher:\n\t\t| TelemetryEventBatcher<keyof RebaseStatsWithDuration>\n\t\t| undefined;\n\n\t/**\n\t * @param changeFamily - the change family of changes on the trunk and local branch\n\t * @param localSessionId - the id of the local session that will be used for local commits\n\t * @param mintRevisionTag - a function which generates globally unique revision tags\n\t * @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.\n\t */\n\tpublic constructor(\n\t\tpublic readonly changeFamily: TChangeFamily,\n\t\tpublic readonly localSessionId: SessionId,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly onSharedBranchCreated?: (branchId: BranchId) => void,\n\t\teditorOptions?: EditorOptions,\n\t\tlogger?: ITelemetryLoggerExt,\n\t) {\n\t\tthis.trunkBase = {\n\t\t\trevision: rootRevision,\n\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t};\n\n\t\tif (logger !== undefined) {\n\t\t\tthis.telemetryEventBatcher = new TelemetryEventBatcher(\n\t\t\t\t{\n\t\t\t\t\teventName: \"rebaseProcessing\",\n\t\t\t\t\tcategory: \"performance\",\n\t\t\t\t},\n\t\t\t\tlogger,\n\t\t\t\tmaxRebaseStatsAggregationCount,\n\t\t\t);\n\t\t}\n\n\t\tconst mainTrunk = new SharedTreeBranch(\n\t\t\tthis.trunkBase,\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t\teditorOptions,\n\t\t);\n\n\t\tthis.createAndAddSharedBranch(\"main\", undefined, undefined, mainTrunk, editorOptions);\n\t}\n\n\tpublic getLocalBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.getSharedBranch(branchId).localBranch;\n\t}\n\n\tprivate getSharedBranch(branchId: BranchId): SharedBranch<TEditor, TChangeset> {\n\t\treturn this.sharedBranches.get(branchId) ?? fail(0xc56 /* Branch does not exist */);\n\t}\n\n\t/**\n\t * Make the given branch known to the `EditManager`. The `EditManager` will ensure that all registered\n\t * branches remain usable even as the minimum sequence number advances.\n\t *\n\t * TODO#AB6926: Refactor local branch management into a separate class that encapsulates `trunkBranches` and everything\n\t * that touches it.\n\t * TODO#AB6925: Maintain the divergence point between each branch and the trunk so that we don't have to recompute\n\t * it so often.\n\t */\n\tprivate registerBranch(branch: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tthis.trackBranch(branch);\n\t\t// Whenever the branch is rebased, update our record of its base trunk commit\n\t\tconst offBeforeRebase = branch.events.on(\"beforeChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.untrackBranch(branch);\n\t\t\t}\n\t\t});\n\t\tconst offAfterRebase = branch.events.on(\"afterChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.trackBranch(branch);\n\t\t\t\tthis.trimHistory();\n\t\t\t}\n\t\t});\n\t\t// When the branch is disposed, update our branch set and trim the trunk\n\t\tconst offDispose = branch.events.on(\"dispose\", () => {\n\t\t\tthis.untrackBranch(branch);\n\t\t\tthis.trimHistory();\n\t\t\toffBeforeRebase();\n\t\t\toffAfterRebase();\n\t\t\toffDispose();\n\t\t});\n\t}\n\n\tprivate trackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad2 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\n\t\tassert(!branches.has(b), 0x670 /* Branch was registered more than once */);\n\t\tbranches.add(b);\n\t}\n\n\tprivate untrackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad3 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches =\n\t\t\tthis.trunkBranches.get(sequenceId) ?? fail(0xad4 /* Expected branch to be tracked */);\n\n\t\tassert(branches.delete(b), 0x671 /* Expected branch to be tracked */);\n\t\tif (branches.size === 0) {\n\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t}\n\t}\n\n\t/**\n\t * Return the sequenced number of the latest sequenced change.\n\t */\n\tpublic getLatestSequenceNumber(): SeqNumber | undefined {\n\t\tlet maxSequenceNumber: SeqNumber | undefined;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tconst branchMax = branch.getCommitSequenceId(\n\t\t\t\tbranch.trunk.getHead().revision,\n\t\t\t).sequenceNumber;\n\t\t\tif (maxSequenceNumber === undefined || maxSequenceNumber < branchMax) {\n\t\t\t\tmaxSequenceNumber = branchMax;\n\t\t\t}\n\t\t}\n\n\t\treturn maxSequenceNumber;\n\t}\n\n\t/**\n\t * Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,\n\t * if they are not retained by revertibles or local branches.\n\t * @param minimumSequenceNumber - the sequence number of the newest commit that all peers (including this one) have received and applied to their trunks.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tpublic advanceMinimumSequenceNumber(\n\t\tminimumSequenceNumber: SeqNumber,\n\t\ttrimHistory = true,\n\t): void {\n\t\tif (minimumSequenceNumber === this.minimumSequenceNumber) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tminimumSequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x476 /* number must be larger or equal to current minimumSequenceNumber. */,\n\t\t);\n\n\t\tthis.minimumSequenceNumber = minimumSequenceNumber;\n\t\tif (trimHistory) {\n\t\t\tthis.trimHistory();\n\t\t}\n\t}\n\n\t/**\n\t * Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine\n\t * if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.\n\t */\n\tprivate trimHistory(): void {\n\t\t/** The sequence id of the most recent commit on the trunk that will be trimmed */\n\t\tlet trunkTailSequenceId: SequenceId = {\n\t\t\tsequenceNumber: this.minimumSequenceNumber,\n\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t};\n\t\t// If there are any outstanding registered branches, get the one that is the oldest (has the \"most behind\" trunk base)\n\t\tconst minimumBranchBaseSequenceId = this.trunkBranches.minKey();\n\t\tif (minimumBranchBaseSequenceId !== undefined) {\n\t\t\t// If that branch is behind the minimum sequence id, we only want to evict commits older than it,\n\t\t\t// even if those commits are behind the minimum sequence id\n\t\t\tconst sequenceIdBeforeMinimumBranchBase = getUpperBoundOfPreviousSequenceId(\n\t\t\t\tminimumBranchBaseSequenceId,\n\t\t\t);\n\t\t\ttrunkTailSequenceId = minSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tsequenceIdBeforeMinimumBranchBase,\n\t\t\t);\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\n\t\tconst [sequenceId, latestEvicted] = mainBranch.getClosestTrunkCommit(\n\t\t\tmaxSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tmainBranch.sequenceIdToCommit.minKey() ?? minimumPossibleSequenceId,\n\t\t\t),\n\t\t);\n\n\t\t// Don't do any work if the commit found by the search is already the tail of the trunk\n\t\tif (latestEvicted === this.trunkBase) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This mutation is a performance hack. If commits are truly immutable, then changing the trunk's tail requires\n\t\t// regenerating the entire commit graph. Instead, we can simply chop off the tail like this if we're certain\n\t\t// that there are no outstanding references to any of the commits being removed (other than the references via\n\t\t// the trunk). The peer branches have been rebased to the head of the trunk, the local branch is already rebased\n\t\t// to the head of the trunk, and all other branches are tracked by `trunkBranches` and known to be ahead of or at\n\t\t// `newTrunkBase`. Therefore, no branches should have unique references to any of the commits being evicted here.\n\t\t// We mutate the most recent of the evicted commits to become the new trunk base. That way, any other commits that\n\t\t// have parent pointers to the latest evicted commit will stay linked, even though that it is no longer part of the trunk.\n\t\tconst newTrunkBase = latestEvicted as Mutable<typeof latestEvicted>;\n\n\t\t// collect the revisions that will be trimmed to send as part of the branch trimmed event\n\t\tconst trimmedCommits = getPathFromBase(newTrunkBase, this.trunkBase);\n\t\tconst trimmedRevisions = trimmedCommits.map((c) => c.revision);\n\n\t\t// The minimum sequence number informs us that all peer branches are at least caught up to the tail commit,\n\t\t// so rebase them accordingly. This is necessary to prevent peer branches from referencing any evicted commits.\n\t\tmainBranch.trimHistory(latestEvicted, sequenceId);\n\n\t\t// Only the last trimmed commit, which is the new trunk base, should remain accessible.\n\t\tfor (const commit of trimmedCommits.slice(0, -1)) {\n\t\t\tReflect.defineProperty(commit, \"change\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa5e /* Should not access 'change' property of an evicted commit */),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"revision\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t0xa5f /* Should not access 'revision' property of an evicted commit */,\n\t\t\t\t\t),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"parent\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa60 /* Should not access 'parent' property of an evicted commit */),\n\t\t\t});\n\t\t}\n\n\t\t// Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.\n\t\tdelete newTrunkBase.parent;\n\t\tthis.trunkBase = newTrunkBase;\n\n\t\tthis._events.emit(\"ancestryTrimmed\", trimmedRevisions);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tif (!branch.isEmpty(this.trunkBase)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn this.minimumSequenceNumber === minimumPossibleSequenceNumber;\n\t}\n\n\tpublic getSummaryData(): SummaryData<TChangeset> {\n\t\t// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.\n\t\tthis.trimHistory();\n\n\t\tconst minSeqNumberToSummarize: SequenceId = {\n\t\t\tsequenceNumber: brand(this.minimumSequenceNumber + 1),\n\t\t};\n\t\tlet minBaseSeqId: SequenceId = minSeqNumberToSummarize;\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branches = new Map<BranchId, SharedBranchSummaryData<TChangeset>>();\n\t\tfor (const [branchId, branch] of this.sharedBranches) {\n\t\t\tif (branchId !== \"main\") {\n\t\t\t\tconst branchSummary = branch.getSummaryData(\n\t\t\t\t\tminSeqNumberToSummarize,\n\t\t\t\t\tthis.trunkBase.revision,\n\t\t\t\t);\n\t\t\t\tbranches.set(branchId, branchSummary);\n\t\t\t\tassert(branchSummary.base !== undefined, 0xc57 /* Branch summary must have a base */);\n\t\t\t\tconst baseSequenceId = mainBranch.getCommitSequenceId(branchSummary.base);\n\t\t\t\tminBaseSeqId = minSequenceId(minBaseSeqId, baseSequenceId);\n\t\t\t}\n\t\t}\n\t\tconst mainSummary = mainBranch.getSummaryData(minBaseSeqId, this.trunkBase.revision);\n\t\treturn { main: mainSummary, branches, originator: this.localSessionId };\n\t}\n\n\tpublic loadSummaryData(data: SummaryData<TChangeset>): void {\n\t\tassert(\n\t\t\tthis.isEmpty(),\n\t\t\t0x68a /* Attempted to load from summary after edit manager was already mutated */,\n\t\t);\n\t\t// Record the tags of each trunk commit as we generate the trunk so they can be looked up quickly\n\t\t// when hydrating the peer branches below\n\t\tconst trunkRevisionCache = new Map<RevisionTag, GraphCommit<TChangeset>>();\n\t\ttrunkRevisionCache.set(this.trunkBase.revision, this.trunkBase);\n\t\tconst mainBranch =\n\t\t\tthis.sharedBranches.get(\"main\") ?? fail(0xc58 /* Main branch must exist */);\n\t\tmainBranch.loadSummaryData(data.main, trunkRevisionCache);\n\t\tif (data.branches !== undefined) {\n\t\t\tfor (const [branchId, branchData] of data.branches) {\n\t\t\t\tconst branch = this.createSharedBranch(\n\t\t\t\t\tbranchId,\n\t\t\t\t\tbranchData.session,\n\t\t\t\t\tmainBranch,\n\t\t\t\t\tmainBranch.trunk.fork(),\n\t\t\t\t);\n\t\t\t\tbranch.loadSummaryData(branchData, trunkRevisionCache);\n\t\t\t\tthis.addSharedBranch(branchId, branch);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getTrunkHead(branchId: BranchId): GraphCommit<TChangeset> {\n\t\treturn this.getSharedBranch(branchId).trunk.getHead();\n\t}\n\n\tpublic getTrunkChanges(branchId: BranchId): TChangeset[] {\n\t\treturn this.getTrunkCommits(branchId).map((c) => c.change);\n\t}\n\n\tpublic getTrunkCommits(branchId: BranchId): GraphCommit<TChangeset>[] {\n\t\treturn getPathFromBase(this.getTrunkHead(branchId), this.trunkBase);\n\t}\n\n\tpublic getLocalCommits(branchId: BranchId): readonly GraphCommit<TChangeset>[] {\n\t\tconst branch = this.getSharedBranch(branchId);\n\t\treturn branch.getLocalCommits();\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `EditManager`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tmax = Math.max(max, branch.getLongestBranchLength());\n\t\t}\n\t\treturn max;\n\t}\n\n\tpublic sequenceBranchCreation(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tif (sessionId === this.localSessionId) {\n\t\t\tassert(this.sharedBranches.has(branchId), 0xc59 /* Expected branch to already exist */);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branchTrunk = mainBranch.rebasePeer(sessionId, referenceSequenceNumber).fork();\n\t\tthis.createAndAddSharedBranch(branchId, sessionId, mainBranch, branchTrunk);\n\t}\n\n\tpublic addNewBranch(branchId: BranchId): void {\n\t\tconst main = this.getSharedBranch(\"main\") ?? fail(0xc5a /* Main branch must exist */);\n\t\tthis.createAndAddSharedBranch(\n\t\t\tbranchId,\n\t\t\tthis.localSessionId,\n\t\t\tmain,\n\t\t\tthis.getLocalBranch(\"main\").fork(),\n\t\t);\n\t}\n\n\tpublic getSharedBranchIds(): BranchId[] {\n\t\treturn Array.from(this.sharedBranches.keys());\n\t}\n\n\tpublic removeBranch(branchId: BranchId): void {\n\t\tassert(branchId !== \"main\", 0xc5b /* Cannot remove main branch */);\n\t\tconst hadBranch = this.sharedBranches.delete(branchId);\n\t\tassert(hadBranch, 0xc5c /* Expected branch to exist */);\n\t}\n\n\tprivate createAndAddSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t\teditorOptions?: EditorOptions,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = this.createSharedBranch(\n\t\t\tbranchId,\n\t\t\tsessionId,\n\t\t\tparent,\n\t\t\tbranch,\n\t\t\teditorOptions,\n\t\t);\n\t\tthis.addSharedBranch(branchId, sharedBranch);\n\t\treturn sharedBranch;\n\t}\n\n\tprivate addSharedBranch(\n\t\tbranchId: BranchId,\n\t\tbranch: SharedBranch<TEditor, TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\t!this.sharedBranches.has(branchId),\n\t\t\t0xc5d /* A branch with this ID already exists */,\n\t\t);\n\t\tthis.sharedBranches.set(branchId, branch);\n\n\t\t// Track all forks of the local branch for purposes of trunk eviction. Unlike the local branch, they have\n\t\t// an unknown lifetime and rebase frequency, so we can not make any assumptions about which trunk commits\n\t\t// they require and therefore we monitor them explicitly.\n\t\tonForkTransitive(branch.localBranch, (fork) => this.registerBranch(fork));\n\n\t\tif (branchId !== \"main\") {\n\t\t\tthis.registerBranch(branch.localBranch);\n\t\t\tthis.onSharedBranchCreated?.(branchId);\n\t\t}\n\t}\n\n\tprivate createSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t\teditorOptions?: EditorOptions,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = new SharedBranch(\n\t\t\tparent,\n\t\t\tbranch,\n\t\t\tbranchId,\n\t\t\tsessionId,\n\t\t\tminimumPossibleSequenceId,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t\teditorOptions,\n\t\t);\n\n\t\treturn sharedBranch;\n\t}\n\n\t/* eslint-disable jsdoc/check-indentation */\n\t/**\n\t * Add a bunch of sequenced changes. A bunch is a group of sequenced commits that have the following properties:\n\t * - They are not interleaved with messages from other DDSes in the container.\n\t * - They are all part of the same batch, which entails:\n\t * - They are contiguous in sequencing order.\n\t * - They are all from the same client.\n\t * - They are all based on the same reference sequence number.\n\t * - They are not interleaved with messages from other clients.\n\t */\n\t/* eslint-enable jsdoc/check-indentation */\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tassert(newCommits.length > 0, 0xad8 /* Expected at least one sequenced change */);\n\t\tassert(\n\t\t\tsequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,\n\t\t);\n\n\t\tconst branch = this.getSharedBranch(branchId);\n\n\t\tconst onSequenceLocalCommit = (\n\t\t\tcommit: GraphCommit<TChangeset>,\n\t\t\tsequenceId: SequenceId,\n\t\t\tpreviousSequenceId: SequenceId,\n\t\t): void => {\n\t\t\t// Next, we need to update the sequence IDs that our local branches (user's branches, not peer branches) are associated with.\n\t\t\t// In particular, if a local branch is based on the previous trunk head (the branch's first ancestor in the trunk is the commit that was the head before we pushed the new commit)\n\t\t\t// and also branches off of the local branch (it has an ancestor that is part of the local branch), it needs to have its sequence number advanced to be that of the new trunk head.\n\t\t\t// Intuitively, this makes sense because:\n\t\t\t// 1. The trunk's head just advanced forward by some (sequence) amount.\n\t\t\t// 2. The local branch is always rebased to be branching off of the head of the trunk (not literally in this case, because of the optimization, but in effect).\n\t\t\t// 3. Therefore, the entire local branch just advanced forward by some (sequence) amount, and any commits downstream of it which track the sequence numbers of their base commits on the trunk should also advance.\n\t\t\t// This update is not necessarily required for all local branches, since some may have fallen behind the local branch and are based on older trunk commits (such branches do not need updating).\n\t\t\tconst currentBranches = this.trunkBranches.get(previousSequenceId);\n\t\t\tif (currentBranches !== undefined) {\n\t\t\t\tconst newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\t\t\t\tfor (const forkedBranch of currentBranches) {\n\t\t\t\t\t// Check every branch associated with the old sequence ID and advance it if it is based on the local branch (specifically, on the local branch as it was before we pushed its first commit to the trunk).\n\t\t\t\t\t// We validate this by checking if the branch's head is a descendant of the local commit that we just pushed.\n\t\t\t\t\tif (findAncestor(forkedBranch.getHead(), (c) => c === commit) !== undefined) {\n\t\t\t\t\t\tnewBranches.add(forkedBranch);\n\t\t\t\t\t\tcurrentBranches.delete(forkedBranch);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Clean up our trunk branches map by removing any empty sets.\n\t\t\t\tif (currentBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(previousSequenceId);\n\t\t\t\t}\n\t\t\t\tif (newBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst areLocalCommits = sessionId === this.localSessionId;\n\t\tbranch.addSequencedChanges(\n\t\t\tnewCommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\tareLocalCommits,\n\t\t\treferenceSequenceNumber,\n\t\t\tonSequenceLocalCommit,\n\t\t);\n\t}\n\n\tpublic findLocalCommit(\n\t\tbranchId: BranchId,\n\t\trevision: RevisionTag,\n\t): [commit: GraphCommit<TChangeset>, commitsAfter: GraphCommit<TChangeset>[]] {\n\t\tconst commits: GraphCommit<TChangeset>[] = [];\n\t\tconst commit = findAncestor(\n\t\t\t[this.getSharedBranch(branchId).localBranch.getHead(), commits],\n\t\t\t(c) => c.revision === revision,\n\t\t);\n\t\tassert(commit !== undefined, 0x599 /* Expected local branch to contain revision */);\n\t\treturn [commit, commits];\n\t}\n}\n\n/**\n * The in-memory data that summaries contain\n */\nexport interface SummaryData<TChangeset> {\n\treadonly originator?: SessionId;\n\treadonly main: SharedBranchSummaryData<TChangeset>;\n\treadonly branches?: ReadonlyMap<BranchId, SharedBranchSummaryData<TChangeset>>;\n}\n\nexport interface SharedBranchSummaryData<TChangeset> {\n\treadonly id?: BranchId;\n\treadonly name?: string;\n\treadonly session?: SessionId;\n\treadonly author?: string;\n\treadonly base?: RevisionTag;\n\treadonly trunk: readonly SequencedCommit<TChangeset>[];\n\treadonly peerLocalBranches: ReadonlyMap<SessionId, SummarySessionBranch<TChangeset>>;\n}\n\n/**\n * Gets the path from the base of a branch to its head.\n */\nfunction getPathFromBase<TCommit extends { parent?: TCommit }>(\n\tbranchHead: TCommit,\n\tbaseBranchHead: TCommit,\n): TCommit[] {\n\tconst path: TCommit[] = [];\n\tassert(\n\t\tfindCommonAncestor([branchHead, path], baseBranchHead) !== undefined,\n\t\t0x573 /* Expected branches to be related */,\n\t);\n\treturn path;\n}\n\nclass SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {\n\t/**\n\t * This branch holds the changes made by this client which have not yet been confirmed as sequenced changes.\n\t */\n\tpublic readonly localBranch: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Branches are maintained to represent the local change list that the issuing client had\n\t * at the time of submitting the latest known edit on the branch.\n\t * This means the head commit of each branch is always in its original (non-rebased) form.\n\t */\n\tprivate readonly peerLocalBranches: Map<SessionId, SharedTreeBranch<TEditor, TChangeset>> =\n\t\tnew Map();\n\n\t/**\n\t * A map from a sequence id to the commit which has that sequence id.\n\t * This also includes an entry for the {@link trunkBase} which always has the lowest key in the map.\n\t */\n\tpublic readonly sequenceIdToCommit = new BTree<SequenceId, GraphCommit<TChangeset>>(\n\t\tundefined,\n\t\tsequenceIdComparator,\n\t);\n\n\t/**\n\t * The list of commits (from oldest to most recent) that are on the local branch but not on the trunk.\n\t * When a local commit is sequenced, the first commit in this list shifted onto the tip of the trunk.\n\t */\n\tprivate readonly localCommits: GraphCommit<TChangeset>[] = [];\n\n\t/**\n\t * Records extra data associated with sequenced commits.\n\t * This does not include an entry for the {@link trunkBase}.\n\t */\n\tprivate readonly commitMetadata = new Map<\n\t\tRevisionTag,\n\t\t{ sequenceId: SequenceId; sessionId: SessionId }\n\t>();\n\n\tpublic constructor(\n\t\tpublic readonly parentBranch: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tpublic readonly trunk: SharedTreeBranch<TEditor, TChangeset>,\n\t\tprivate readonly id: BranchId,\n\t\tprivate readonly sessionId: SessionId | undefined,\n\t\tbaseCommitSequenceId: SequenceId,\n\t\tprivate readonly changeFamily: ChangeFamily<TEditor, TChangeset>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tbranchTrimmer: Listenable<BranchTrimmingEvents>,\n\t\ttelemetryEventBatcher: TelemetryEventBatcher<keyof RebaseStatsWithDuration> | undefined,\n\t\teditorOptions?: EditorOptions,\n\t) {\n\t\tthis.localBranch = new SharedTreeBranch(\n\t\t\tthis.trunk.getHead(),\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tbranchTrimmer,\n\t\t\ttelemetryEventBatcher,\n\t\t\teditorOptions,\n\t\t);\n\n\t\tthis.sequenceIdToCommit.set(baseCommitSequenceId, this.trunk.getHead());\n\n\t\tthis.localBranch.events.on(\"afterChange\", (event) => {\n\t\t\tif (event.type === \"append\") {\n\t\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\t\tthis.localCommits.push(commit);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.localCommits.length = 0;\n\t\t\t\tfindCommonAncestor(\n\t\t\t\t\t[this.localBranch.getHead(), this.localCommits],\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\tareLocalCommits: boolean,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\tsequenceNumber >= // This is \">=\", not \">\" because changes in the same batch will have the same sequence number\n\t\t\t\t(this.sequenceIdToCommit.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),\n\t\t\t0xa64 /* Attempted to sequence change with an outdated sequence number */,\n\t\t);\n\n\t\tconst batchSize = this.getBatchSize(sequenceNumber);\n\t\t// The sequence id for the next commit to be processed in the bunch.\n\t\tlet nextSequenceId =\n\t\t\tbatchSize === 0\n\t\t\t\t? {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\tindexInBatch: batchSize,\n\t\t\t\t\t};\n\n\t\t// Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto\n\t\t// the trunk.\n\t\tif (areLocalCommits) {\n\t\t\tfor (const { revision } of newCommits) {\n\t\t\t\tthis.sequenceLocalCommit(revision, nextSequenceId, sessionId, onSequenceLocalCommit);\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Remote changes, i.e., changes from remote clients are applied in three steps.\n\t\t// Step 1 - Recreate the peer remote client's local environment.\n\t\t// Get the revision that the remote change is based on and rebase that peer local branch over the part of the\n\t\t// trunk up to the base revision. This will be a no-op if the sending client has not advanced since the last\n\t\t// time we received an edit from it\n\t\tconst peerLocalBranch = this.rebasePeer(sessionId, referenceSequenceNumber);\n\n\t\t// Step 2 - Append the changes to the peer branch and rebase the changes to the tip of the trunk.\n\t\tif (peerLocalBranch.getHead() === this.trunk.getHead()) {\n\t\t\t// If the peer local branch is fully caught up and empty (no changes relative to the trunk) after being\n\t\t\t// rebased, then push changes to the trunk directly and update the peer branch to the trunk's head.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tthis.pushCommitToTrunk(nextSequenceId, { ...newCommit, sessionId });\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\tpeerLocalBranch.setHead(this.trunk.getHead());\n\t\t} else {\n\t\t\t// Otherwise, push the changes to the peer local branch and merge the branch into the trunk.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tpeerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));\n\t\t\t}\n\t\t\tconst result = this.trunk.merge(peerLocalBranch);\n\t\t\tif (result !== undefined) {\n\t\t\t\t// If the merge resulted in any changes to the trunk, update the sequence map and trunk metadata\n\t\t\t\t// with the rebased commits.\n\t\t\t\tfor (const sourceCommit of result.sourceCommits) {\n\t\t\t\t\tthis.sequenceIdToCommit.set(nextSequenceId, sourceCommit);\n\t\t\t\t\tthis.commitMetadata.set(sourceCommit.revision, {\n\t\t\t\t\t\tsequenceId: nextSequenceId,\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t});\n\t\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Step 3 - Rebase the local branch over the updated trunk.\n\t\tthis.localBranch.rebaseOnto(this.trunk);\n\t}\n\n\tpublic isEmpty(baseCommit: GraphCommit<TChangeset>): boolean {\n\t\treturn (\n\t\t\tthis.trunk.getHead() === baseCommit &&\n\t\t\tthis.peerLocalBranches.size === 0 &&\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead()\n\t\t);\n\t}\n\n\tpublic rebasePeer(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t): SharedTreeBranch<TEditor, TChangeset> {\n\t\tconst [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);\n\t\tconst peerLocalBranch = getOrCreate(\n\t\t\tthis.peerLocalBranches,\n\t\t\tsessionId,\n\t\t\t() => new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),\n\t\t);\n\t\tpeerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);\n\t\treturn peerLocalBranch;\n\t}\n\n\tpublic getPeerBranchOrTrunk(sessionId: SessionId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.peerLocalBranches.get(sessionId) ?? this.trunk;\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `SharedBranch`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tfor (const branch of this.peerLocalBranches.values()) {\n\t\t\tconst branchPath = getPathFromBase(branch.getHead(), trunkHead);\n\t\t\tif (branchPath.length > max) {\n\t\t\t\tmax = branchPath.length;\n\t\t\t}\n\t\t}\n\t\tconst localPath = getPathFromBase(this.localBranch.getHead(), trunkHead);\n\t\treturn Math.max(max, localPath.length);\n\t}\n\n\tpublic trimHistory(newBase: GraphCommit<TChangeset>, sequenceId: SequenceId): void {\n\t\tthis.rebasePeers(newBase);\n\n\t\tthis.sequenceIdToCommit.editRange(\n\t\t\tminimumPossibleSequenceId,\n\t\t\tsequenceId,\n\t\t\ttrue,\n\t\t\t(s, commit) => {\n\t\t\t\t// Cleanup look-aside data for each evicted commit\n\t\t\t\tthis.commitMetadata.delete(commit.revision);\n\t\t\t\t// Delete all evicted commits from `sequenceMap` except for the latest one, which is the new `trunkBase`\n\t\t\t\tif (equalSequenceIds(s, sequenceId)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcommit === newBase,\n\t\t\t\t\t\t0x729 /* Expected last evicted commit to be new trunk base */,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn { delete: true };\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\tconst trunkSize = getPathFromBase(this.trunk.getHead(), newBase).length;\n\t\tassert(\n\t\t\tthis.sequenceIdToCommit.size === trunkSize + 1,\n\t\t\t0x744 /* The size of the sequenceMap must have one element more than the trunk */,\n\t\t);\n\t\tassert(\n\t\t\tthis.commitMetadata.size === trunkSize,\n\t\t\t0x745 /* The size of the trunkMetadata must be the same as the trunk */,\n\t\t);\n\t}\n\n\tprivate rebasePeers(commit: GraphCommit<TChangeset>): void {\n\t\tfor (const [, branch] of this.peerLocalBranches) {\n\t\t\tbranch.rebaseOnto(this.trunk, commit);\n\t\t}\n\n\t\t// The metadata for new trunk base revision needs to be deleted before modifying it.\n\t\tthis.commitMetadata.delete(commit.revision);\n\t}\n\n\tpublic getLocalCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn this.localCommits;\n\t}\n\n\t/**\n\t * Promote the oldest un-sequenced commit on the local branch to the head of the trunk.\n\t * @param sequenceId - The sequence id of the new trunk commit\n\t * @remarks This method is a performance optimization for the scenario where this client receives its own change back after sequencing.\n\t * The normal (not optimized) process in this case would be to apply the new sequenced commit to the trunk and then rebase the local branch over the trunk.\n\t * The first commit will be \"the same\" (as in, it will have the same revision) as the commit that was just sequenced, so the rebase will be a no-op.\n\t * Because the rebase is a no-op, we can skip it entirely and simply remove the commit from the local branch and append it to the trunk.\n\t * Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.\n\t */\n\tprivate sequenceLocalCommit(\n\t\trevision: RevisionTag,\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tif (this.commitMetadata.has(revision)) {\n\t\t\t// This can happen if the commit came from a shared branch and was concurrently merged by another client.\n\t\t\t// In this case, the newly sequenced commit is redundant and should therefore be ignored.\n\t\t\treturn;\n\t\t}\n\n\t\t// First, push the local commit to the trunk.\n\t\t// We are mutating our `localCommits` cache here,but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.\n\t\tconst firstLocalCommit = this.localCommits.shift();\n\t\tassert(\n\t\t\tfirstLocalCommit !== undefined,\n\t\t\t0x6b5 /* Received a sequenced change from the local session despite having no local changes */,\n\t\t);\n\n\t\tconst prevSequenceId = this.getCommitSequenceId(this.trunk.getHead().revision);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, sessionId);\n\t\tonSequenceLocalCommit(firstLocalCommit, sequenceId, prevSequenceId);\n\t}\n\n\t/**\n\t * Finds the most recent trunk commit that was sequenced at or before the given point.\n\t * @param searchBy - the sequence number or the sequence id to search for\n\t * @remarks Fails if there is no eligible commit.\n\t * @returns the closest commit and its sequence id\n\t */\n\tpublic getClosestTrunkCommit(searchBy: SeqNumber): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(searchBy: SequenceId): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(\n\t\tsearchBy: SeqNumber | SequenceId,\n\t): [SequenceId, GraphCommit<TChangeset>] {\n\t\tconst sequenceId: SequenceId =\n\t\t\ttypeof searchBy === \"number\"\n\t\t\t\t? {\n\t\t\t\t\t\t// This is to make sure that the correct commit is selected in this 2 scenarios:\n\t\t\t\t\t\t// 1) The commit is unique for that sequence number\n\t\t\t\t\t\t// 2) There are more than one commit for the same sequence number, in this case we need to select the last one.\n\t\t\t\t\t\tsequenceNumber: searchBy,\n\t\t\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t\t\t}\n\t\t\t\t: searchBy;\n\n\t\tconst commit = this.sequenceIdToCommit.getPairOrNextLower(sequenceId);\n\t\tassert(commit !== undefined, 0x746 /* sequence id has been evicted */);\n\t\treturn commit;\n\t}\n\n\tprivate pushGraphCommitToTrunk(\n\t\tsequenceId: SequenceId,\n\t\tgraphCommit: GraphCommit<TChangeset>,\n\t\tsessionId: SessionId,\n\t): void {\n\t\tthis.trunk.setHead(graphCommit);\n\t\tthis.registerSequencedCommit(sequenceId, sessionId, graphCommit);\n\t}\n\n\tprivate pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {\n\t\tconst mintedCommit = mintCommit(this.trunk.getHead(), commit);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);\n\t}\n\n\tprivate registerSequencedCommit(\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tcommit: GraphCommit<TChangeset>,\n\t): void {\n\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\tthis.commitMetadata.set(commit.revision, { sequenceId, sessionId });\n\t}\n\n\tpublic getCommitSequenceId(commitRevision: RevisionTag): SequenceId {\n\t\tconst id = this.commitMetadata.get(commitRevision)?.sequenceId;\n\t\tif (id === undefined) {\n\t\t\treturn minimumPossibleSequenceId;\n\t\t}\n\t\treturn id;\n\t}\n\n\t// TODO: Document that this is to handle receiving separate commits with the same sequence ID,\n\t// as a batch of changes are not guaranteed to be processed as one bunch.\n\tprivate getBatchSize(sequenceNumber: SeqNumber): number {\n\t\tconst startSequenceId: SequenceId = {\n\t\t\tsequenceNumber,\n\t\t};\n\t\tconst endSequenceId: SequenceId = {\n\t\t\tsequenceNumber: brand((sequenceNumber as number) + 1),\n\t\t};\n\n\t\treturn this.sequenceIdToCommit.getRange(startSequenceId, endSequenceId, false).length;\n\t}\n\n\tpublic getSummaryData(\n\t\tminSeqNumberToSummarize: SequenceId,\n\t\ttrunkBaseRevision: RevisionTag,\n\t): SharedBranchSummaryData<TChangeset> {\n\t\t// The assert below is acceptable at present because summarization only ever occurs on a client with no\n\t\t// local/in-flight changes.\n\t\t// In the future we may wish to relax this constraint. For that to work, the current implementation of\n\t\t// `EditManager` would have to be amended in one of two ways:\n\t\t// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.\n\t\t// B) The contents of such a branch should be computed on demand based on the trunk.\n\t\t// Note that option (A) would be a simple change to `addSequencedChanges` whereas (B) would likely require\n\t\t// rebasing trunk changes over the inverse of trunk changes.\n\t\tassert(\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead(),\n\t\t\t0xc5e /* Clients with local changes cannot be used to generate summaries */,\n\t\t);\n\n\t\tlet parentHead: GraphCommit<TChangeset>;\n\t\tif (this.parentBranch === undefined) {\n\t\t\tconst oldestCommitInCollabWindow =\n\t\t\t\tthis.getClosestTrunkCommit(minSeqNumberToSummarize)[1];\n\t\t\t// Path construction is exclusive, so we need to use the parent of the oldest commit in the window if it exists\n\t\t\tparentHead = oldestCommitInCollabWindow.parent ?? oldestCommitInCollabWindow;\n\t\t} else {\n\t\t\tparentHead = this.parentBranch.trunk.getHead();\n\t\t}\n\n\t\tconst childBranchTrunkCommits: GraphCommit<TChangeset>[] = [];\n\t\tconst forkPointFromMainTrunk = findCommonAncestor(\n\t\t\t[this.trunk.getHead(), childBranchTrunkCommits],\n\t\t\tparentHead,\n\t\t);\n\t\tassert(\n\t\t\tforkPointFromMainTrunk !== undefined,\n\t\t\t0xc5f /* Expected child branch to be based on main branch */,\n\t\t);\n\n\t\tconst trunk = childBranchTrunkCommits.map((c) => {\n\t\t\tconst metadata =\n\t\t\t\tthis.commitMetadata.get(c.revision) ??\n\t\t\t\tfail(0xad5 /* Expected metadata for trunk commit */);\n\t\t\tconst commit: SequencedCommit<TChangeset> = {\n\t\t\t\tchange: c.change,\n\t\t\t\trevision: c.revision,\n\t\t\t\tsequenceNumber: metadata.sequenceId.sequenceNumber,\n\t\t\t\tsessionId: metadata.sessionId,\n\t\t\t};\n\t\t\tif (metadata.sequenceId.indexInBatch !== undefined) {\n\t\t\t\tcommit.indexInBatch = metadata.sequenceId.indexInBatch;\n\t\t\t}\n\t\t\treturn commit;\n\t\t});\n\n\t\tconst peerLocalBranches = new Map<SessionId, SummarySessionBranch<TChangeset>>(\n\t\t\tmapIterable(this.peerLocalBranches.entries(), ([sessionId, branch]) => {\n\t\t\t\tconst branchPath: GraphCommit<TChangeset>[] = [];\n\t\t\t\tconst ancestor =\n\t\t\t\t\tfindCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??\n\t\t\t\t\tfail(0xad6 /* Expected branch to be based on trunk */);\n\n\t\t\t\tconst base =\n\t\t\t\t\tancestor.revision === trunkBaseRevision ? rootRevision : ancestor.revision;\n\t\t\t\treturn [\n\t\t\t\t\tsessionId,\n\t\t\t\t\t{\n\t\t\t\t\t\tbase,\n\t\t\t\t\t\tcommits: branchPath.map((c) => {\n\t\t\t\t\t\t\tconst commit: Commit<TChangeset> = {\n\t\t\t\t\t\t\t\tchange: c.change,\n\t\t\t\t\t\t\t\trevision: c.revision,\n\t\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn commit;\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}),\n\t\t);\n\n\t\tconst trunkBase =\n\t\t\tthis.parentBranch === undefined ? undefined : forkPointFromMainTrunk.revision;\n\t\treturn { trunk, peerLocalBranches, base: trunkBase, id: this.id, session: this.sessionId };\n\t}\n\n\tpublic loadSummaryData(\n\t\tdata: SharedBranchSummaryData<TChangeset>,\n\t\ttrunkRevisionCache: Map<RevisionTag, GraphCommit<TChangeset>>,\n\t): void {\n\t\tassert(\n\t\t\t(this.parentBranch === undefined) === (data.base === undefined),\n\t\t\t0xc60 /* Expected branch base to match presence of parent branch */,\n\t\t);\n\t\tconst parentTrunkBase =\n\t\t\ttrunkRevisionCache.get(data.base ?? rootRevision) ??\n\t\t\tfail(0xc61 /* Expected base revision to be in trunk cache */);\n\t\tthis.trunk.setHead(\n\t\t\tdata.trunk.reduce((base, c) => {\n\t\t\t\tconst sequenceId: SequenceId =\n\t\t\t\t\tc.indexInBatch === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t\tindexInBatch: c.indexInBatch,\n\t\t\t\t\t\t\t};\n\t\t\t\tconst commit = mintCommit(base, c);\n\t\t\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\t\t\tthis.commitMetadata.set(c.revision, {\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tsessionId: c.sessionId,\n\t\t\t\t});\n\t\t\t\ttrunkRevisionCache.set(c.revision, commit);\n\t\t\t\treturn commit;\n\t\t\t}, parentTrunkBase),\n\t\t);\n\n\t\tthis.localBranch.setHead(this.trunk.getHead());\n\n\t\tfor (const [sessionId, branch] of data.peerLocalBranches) {\n\t\t\tconst commit =\n\t\t\t\ttrunkRevisionCache.get(branch.base) ??\n\t\t\t\tfail(0xad7 /* Expected summary branch to be based off of a revision in the trunk */);\n\n\t\t\tthis.peerLocalBranches.set(\n\t\t\t\tsessionId,\n\t\t\t\tnew SharedTreeBranch(\n\t\t\t\t\tbranch.commits.reduce(mintCommit, commit),\n\t\t\t\t\tthis.changeFamily,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n// Returns the sequence id for the next commit to be processed in the bunch. Since all the commits have the\n// same sequence number, only the index in the batch needs to be incremented.\nfunction getNextSequenceId(sequenceId: SequenceId): SequenceId {\n\treturn {\n\t\tsequenceNumber: sequenceId.sequenceNumber,\n\t\tindexInBatch: (sequenceId.indexInBatch ?? 0) + 1,\n\t};\n}\n\ntype OnSequenceCommit<TChangeset> = (\n\tcommit: GraphCommit<TChangeset>,\n\tsequenceId: SequenceId,\n\tprevSequenceId: SequenceId,\n) => void;\n"]}
|
|
@@ -23,6 +23,10 @@ export declare function clientVersionToEditManagerFormatVersion(clientVersion: M
|
|
|
23
23
|
* Returns the version that should be used for testing shared branches.
|
|
24
24
|
*/
|
|
25
25
|
export declare function editManagerFormatVersionSelectorForSharedBranches(clientVersion: MinimumVersionForCollab): EditManagerFormatVersion;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the version that should be used for testing shared branches.
|
|
28
|
+
*/
|
|
29
|
+
export declare function editManagerFormatVersionSelectorForDetachedRootEditing(clientVersion: MinimumVersionForCollab): EditManagerFormatVersion;
|
|
26
30
|
export interface EditManagerCodecOptions {
|
|
27
31
|
readonly editManagerFormatSelector?: (minVersionForCollab: MinimumVersionForCollab) => EditManagerFormatVersion;
|
|
28
32
|
}
|