@fluidframework/tree 2.118.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +367 -75
- package/README.md +55 -52
- package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
- package/api-report/tree.alpha.api.md +130 -145
- package/api-report/tree.beta.api.md +122 -91
- package/api-report/tree.legacy.beta.api.md +122 -91
- package/api-report/tree.legacy.public.api.md +26 -43
- package/api-report/tree.public.api.md +26 -43
- package/dist/api.d.ts +9 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +2 -3
- package/dist/api.js.map +1 -1
- package/dist/codec/codec.d.ts +2 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +9 -7
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/discriminatedUnions.js +1 -0
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +4 -2
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/componentApi.d.ts.map +1 -1
- package/dist/componentApi.js +20 -17
- package/dist/componentApi.js.map +1 -1
- package/dist/core/change-family/editBuilder.js +1 -0
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/forest/editableForest.js +1 -2
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/forest/forest.js +3 -3
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +9 -5
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.js +5 -5
- 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/revisionTagCodec.d.ts +1 -1
- package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/dist/core/rebase/revisionTagCodec.js +3 -1
- package/dist/core/rebase/revisionTagCodec.js.map +1 -1
- package/dist/core/rebase/types.d.ts +12 -1
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +19 -15
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.js +9 -10
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/schema.js +9 -4
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.js +6 -4
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +62 -55
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/chunk.js +2 -2
- package/dist/core/tree/chunk.js.map +1 -1
- package/dist/core/tree/cursor.js +12 -12
- package/dist/core/tree/cursor.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +34 -9
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +51 -17
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +23 -21
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.js +1 -2
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +7 -4
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/mapTree.js +1 -2
- package/dist/core/tree/mapTree.js.map +1 -1
- package/dist/core/tree/pathTree.js +7 -8
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.d.ts +4 -4
- package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/sparseTree.js +17 -13
- package/dist/core/tree/sparseTree.js.map +1 -1
- package/dist/core/tree/treeTextFormat.js +4 -5
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/types.js +3 -3
- package/dist/core/tree/types.js.map +1 -1
- package/dist/core/tree/visitDelta.js +1 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.js +5 -6
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +6 -4
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/entrypoints/beta.d.ts +1 -1
- package/dist/entrypoints/beta.d.ts.map +1 -1
- package/dist/entrypoints/beta.js +2 -2
- package/dist/entrypoints/beta.js.map +1 -1
- package/dist/entrypoints/legacy.d.ts +1 -1
- package/dist/entrypoints/legacy.d.ts.map +1 -1
- package/dist/entrypoints/legacy.js +2 -2
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/entrypoints/public.d.ts +1 -1
- package/dist/entrypoints/public.d.ts.map +1 -1
- package/dist/entrypoints/public.js +1 -2
- package/dist/entrypoints/public.js.map +1 -1
- package/dist/extensibleUnionNode.d.ts.map +1 -1
- package/dist/extensibleUnionNode.js +1 -1
- package/dist/extensibleUnionNode.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +3 -4
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdCodec.js +1 -2
- package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +28 -20
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +22 -16
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +9 -11
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +15 -7
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +7 -3
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -0
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +33 -17
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +11 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +5 -6
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -3
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +73 -15
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +79 -79
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/dist/feature-libraries/cursorComparator.d.ts +8 -0
- package/dist/feature-libraries/cursorComparator.d.ts.map +1 -1
- package/dist/feature-libraries/cursorComparator.js +43 -10
- package/dist/feature-libraries/cursorComparator.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +2 -2
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +2 -3
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.js +1 -2
- package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +19 -3
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js +2 -2
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js +14 -14
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +28 -30
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +24 -23
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.js +2 -2
- package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js +5 -5
- package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +122 -117
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.js +2 -3
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +35 -31
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js +6 -7
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +2 -3
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +6 -7
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -4
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +3 -3
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.js +10 -0
- package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
- package/dist/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/filterEdits.js +51 -0
- package/dist/feature-libraries/modular-schema/filterEdits.js.map +1 -0
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -4
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +1 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.js +5 -30
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -5
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +459 -10
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +14 -15
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +30 -97
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +1 -2
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +115 -12
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/dist/feature-libraries/modular-schema/prune.d.ts +2 -3
- package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/prune.js +25 -8
- package/dist/feature-libraries/modular-schema/prune.js.map +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js +2 -2
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -1
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +3 -3
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +274 -267
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +27 -35
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +7 -7
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +8 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +1 -2
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +3 -0
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +5 -5
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +8 -2
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/filterEdits.js +29 -11
- package/dist/feature-libraries/sequence-field/filterEdits.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +102 -102
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +79 -79
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +56 -56
- package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +1 -2
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markListFactory.js +3 -4
- package/dist/feature-libraries/sequence-field/markListFactory.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js +4 -2
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +9 -9
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/prune.js +1 -2
- package/dist/feature-libraries/sequence-field/prune.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +7 -2
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +1 -2
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +1 -2
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +54 -67
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +19 -15
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +8 -8
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/feature-libraries/valueUtilities.js +4 -5
- package/dist/feature-libraries/valueUtilities.js.map +1 -1
- package/dist/index.d.ts +4 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializableDomainSchema.d.ts +1 -1
- package/dist/shared-tree/history.d.ts.map +1 -1
- package/dist/shared-tree/history.js +32 -13
- package/dist/shared-tree/history.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +27 -3
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +36 -7
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +6 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/isAuditableFromOutcome.js +1 -2
- package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -1
- package/dist/shared-tree/schematizeTree.js +3 -4
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +2 -2
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +59 -26
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +28 -19
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +3 -3
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +12 -4
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +11 -8
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.js +2 -3
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +2 -0
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/dist/shared-tree/transactionMinimize.js +2 -1
- package/dist/shared-tree/transactionMinimize.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.js +2 -3
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
- package/dist/shared-tree/tree.js +2 -2
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +5 -16
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +18 -11
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/{lib/simple-tree/api → dist/shared-tree}/treeBeta.d.ts +8 -65
- package/dist/shared-tree/treeBeta.d.ts.map +1 -0
- package/dist/shared-tree/treeBeta.js +70 -0
- package/dist/shared-tree/treeBeta.js.map +1 -0
- package/dist/shared-tree/treeCheckout.d.ts +5 -0
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +986 -907
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js +3 -4
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +24 -20
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitCounter.js +35 -32
- package/dist/shared-tree-core/branchCommitCounter.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +9 -8
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.js +2 -3
- package/dist/shared-tree-core/branchIdCodec.js.map +1 -1
- package/dist/shared-tree-core/customMetadataCodec.js +2 -3
- package/dist/shared-tree-core/customMetadataCodec.js.map +1 -1
- package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +11 -9
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +73 -44
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +3 -3
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +33 -36
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -2
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +11 -11
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +5 -4
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +10 -9
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +6 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +1 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +1 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +3 -3
- package/dist/shared-tree-core/messageCodecs.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/messageFormatVSharedBranches.d.ts +3 -2
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +44 -22
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/summaryTypes.js +2 -2
- package/dist/shared-tree-core/summaryTypes.js.map +1 -1
- package/dist/shared-tree-core/transaction.js +36 -39
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js +4 -0
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/dist/simple-tree/api/cloneTree.d.ts +11 -0
- package/dist/simple-tree/api/cloneTree.d.ts.map +1 -0
- package/dist/simple-tree/api/cloneTree.js +31 -0
- package/dist/simple-tree/api/cloneTree.js.map +1 -0
- package/dist/simple-tree/api/conciseTree.js +2 -3
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.js +21 -2
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/create.js +2 -3
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.js +6 -6
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.js +1 -2
- package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +2 -3
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js +2 -3
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +1 -2
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js +1 -2
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.js +1 -2
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js +2 -2
- package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -7
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +2 -3
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +6 -9
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +4 -9
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +13 -12
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +20 -22
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +78 -81
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +32 -35
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -2
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +1 -2
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +7 -7
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +2 -3
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -3
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +1 -2
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +54 -12
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +2 -3
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +4 -4
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +80 -61
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +3 -5
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +16 -4
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
- package/dist/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
- package/dist/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
- package/dist/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts +1 -75
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +7 -7
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +8 -6
- 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/api/verboseTree.js +5 -6
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +22 -13
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/context.js +3 -0
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/flexList.js +2 -3
- package/dist/simple-tree/core/flexList.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +2 -3
- package/dist/simple-tree/core/getOrCreateNode.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 -2
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +3 -4
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +31 -32
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +194 -192
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js +3 -3
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +23 -23
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/types.js +1 -2
- package/dist/simple-tree/core/types.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +177 -150
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +2 -3
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +7 -9
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js +6 -7
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/createContext.js +2 -3
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +33 -15
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/getTreeNodeForField.js +1 -2
- package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +5 -8
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +18 -17
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +31 -33
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js +2 -2
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.js +1 -2
- package/dist/simple-tree/node-kinds/common.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +10 -16
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js +2 -2
- 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 +27 -28
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js +2 -2
- 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 +10 -13
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js +2 -2
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +4 -5
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +11 -11
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeSchema.js +1 -2
- package/dist/simple-tree/treeSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +3 -4
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.js +1 -2
- package/dist/simple-tree/walkFieldSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +2 -87
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +309 -275
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +16 -3
- package/dist/text/codePointUtils.d.ts.map +1 -1
- package/dist/text/codePointUtils.js +24 -13
- package/dist/text/codePointUtils.js.map +1 -1
- package/dist/text/textDomain.d.ts +7 -1
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +32 -28
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +45 -34
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.js +2 -5
- package/dist/text/textDomainFormattedDefault.js.map +1 -1
- package/dist/treeDataStore.js +2 -3
- package/dist/treeDataStore.js.map +1 -1
- package/dist/treeFactory.js +7 -7
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/arrayUtilities.js +5 -6
- package/dist/util/arrayUtilities.js.map +1 -1
- package/dist/util/bTreeUtils.js +3 -4
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/brand.js +6 -5
- package/dist/util/brand.js.map +1 -1
- package/dist/util/brandedMap.js +2 -3
- package/dist/util/brandedMap.js.map +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +7 -4
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/cloneWithReplacements.js +1 -2
- package/dist/util/cloneWithReplacements.js.map +1 -1
- package/dist/util/compressedIds.js +29 -7
- package/dist/util/compressedIds.js.map +1 -1
- package/dist/util/idAllocator.js +3 -3
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/nestedMap.js +15 -17
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/nestedSet.js +2 -3
- package/dist/util/nestedSet.js.map +1 -1
- package/dist/util/offsetList.js +2 -4
- package/dist/util/offsetList.js.map +1 -1
- package/dist/util/opaque.js +2 -3
- package/dist/util/opaque.js.map +1 -1
- package/dist/util/rangeMap.js +6 -2
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/readSnapshotBlob.d.ts.map +1 -1
- package/dist/util/referenceCounting.js +1 -0
- package/dist/util/referenceCounting.js.map +1 -1
- package/dist/util/stackyIterator.js +3 -2
- package/dist/util/stackyIterator.js.map +1 -1
- package/dist/util/typeUtils.js +1 -2
- package/dist/util/typeUtils.js.map +1 -1
- package/dist/util/typeboxBrand.js +2 -3
- package/dist/util/typeboxBrand.js.map +1 -1
- package/dist/util/utils.d.ts +2 -2
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +32 -32
- package/dist/util/utils.js.map +1 -1
- package/lib/api.d.ts +9 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js.map +1 -1
- package/lib/codec/codec.d.ts +2 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +2 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/discriminatedUnions.js +1 -0
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +2 -0
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/componentApi.d.ts.map +1 -1
- package/lib/componentApi.js +20 -17
- package/lib/componentApi.js.map +1 -1
- package/lib/core/change-family/editBuilder.js +1 -0
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- 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/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/revisionTagCodec.js +3 -1
- package/lib/core/rebase/revisionTagCodec.js.map +1 -1
- package/lib/core/rebase/types.d.ts +12 -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/schema-stored/schema.js +5 -0
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js +4 -2
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/core/tree/anchorSet.js +61 -54
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +34 -9
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +41 -10
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +23 -21
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +2 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.d.ts +4 -4
- package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/sparseTree.js +15 -11
- package/lib/core/tree/sparseTree.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/entrypoints/beta.d.ts +1 -1
- package/lib/entrypoints/beta.d.ts.map +1 -1
- package/lib/entrypoints/beta.js +1 -1
- package/lib/entrypoints/beta.js.map +1 -1
- package/lib/entrypoints/legacy.d.ts +1 -1
- package/lib/entrypoints/legacy.d.ts.map +1 -1
- package/lib/entrypoints/legacy.js +1 -1
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/entrypoints/public.d.ts +1 -1
- package/lib/entrypoints/public.d.ts.map +1 -1
- package/lib/entrypoints/public.js +1 -1
- package/lib/entrypoints/public.js.map +1 -1
- package/lib/extensibleUnionNode.d.ts.map +1 -1
- package/lib/extensibleUnionNode.js +2 -2
- package/lib/extensibleUnionNode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +14 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +14 -6
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +18 -12
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -3
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -0
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +28 -12
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +9 -0
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +71 -13
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +79 -79
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/lib/feature-libraries/cursorComparator.d.ts +8 -0
- package/lib/feature-libraries/cursorComparator.d.ts.map +1 -1
- package/lib/feature-libraries/cursorComparator.js +43 -9
- package/lib/feature-libraries/cursorComparator.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +19 -3
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js +12 -12
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +25 -27
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +22 -21
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +122 -117
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +33 -29
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
- 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.js +10 -0
- package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
- package/lib/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/filterEdits.js +46 -0
- package/lib/feature-libraries/modular-schema/filterEdits.js.map +1 -0
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +5 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.js +6 -30
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +458 -8
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +20 -85
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +100 -3
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/lib/feature-libraries/modular-schema/prune.d.ts +2 -3
- package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/prune.js +25 -7
- package/lib/feature-libraries/modular-schema/prune.js.map +1 -1
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +273 -266
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +24 -32
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +3 -0
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +6 -0
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/filterEdits.js +31 -12
- package/lib/feature-libraries/sequence-field/filterEdits.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/markListFactory.js +3 -4
- package/lib/feature-libraries/sequence-field/markListFactory.js.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js +4 -2
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +6 -0
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +3 -15
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +13 -9
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +4 -29
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -17
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializableDomainSchema.d.ts +1 -1
- package/lib/shared-tree/history.d.ts.map +1 -1
- package/lib/shared-tree/history.js +32 -13
- package/lib/shared-tree/history.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +27 -3
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +30 -2
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +2 -2
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +60 -27
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +24 -15
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +12 -4
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +6 -3
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +2 -0
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/lib/shared-tree/transactionMinimize.js +4 -3
- package/lib/shared-tree/transactionMinimize.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +5 -16
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +13 -6
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/{dist/simple-tree/api → lib/shared-tree}/treeBeta.d.ts +8 -65
- package/lib/shared-tree/treeBeta.d.ts.map +1 -0
- package/lib/shared-tree/treeBeta.js +64 -0
- package/lib/shared-tree/treeBeta.js.map +1 -0
- package/lib/shared-tree/treeCheckout.d.ts +5 -0
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +985 -906
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js +3 -4
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +22 -18
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitCounter.js +35 -32
- package/lib/shared-tree-core/branchCommitCounter.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +9 -8
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +11 -9
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +73 -44
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +32 -34
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +4 -4
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +2 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +6 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +2 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +45 -23
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.js +36 -39
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js +4 -0
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/lib/simple-tree/api/cloneTree.d.ts +11 -0
- package/lib/simple-tree/api/cloneTree.d.ts.map +1 -0
- package/lib/simple-tree/api/cloneTree.js +28 -0
- package/lib/simple-tree/api/cloneTree.js.map +1 -0
- package/lib/simple-tree/api/configuration.js +19 -0
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +4 -9
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +9 -8
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +18 -20
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +78 -81
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +32 -35
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +7 -7
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +48 -6
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +4 -4
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +80 -61
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +2 -3
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +16 -4
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
- package/lib/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
- package/lib/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
- package/lib/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts +1 -75
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +8 -6
- 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.js +12 -3
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/context.js +3 -0
- package/lib/simple-tree/core/context.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/treeNode.d.ts +3 -4
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +29 -30
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +181 -179
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +19 -19
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +173 -146
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +7 -9
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js +5 -6
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +23 -5
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +16 -15
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +28 -32
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +10 -17
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.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 +25 -28
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.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 +10 -14
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
- 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/tableSchema.d.ts +2 -87
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +309 -275
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +16 -3
- package/lib/text/codePointUtils.d.ts.map +1 -1
- package/lib/text/codePointUtils.js +22 -10
- package/lib/text/codePointUtils.js.map +1 -1
- package/lib/text/textDomain.d.ts +7 -1
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +21 -17
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +43 -32
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.js +2 -5
- package/lib/text/textDomainFormattedDefault.js.map +1 -1
- package/lib/util/brand.js +1 -0
- package/lib/util/brand.js.map +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +3 -0
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/compressedIds.js +22 -0
- package/lib/util/compressedIds.js.map +1 -1
- package/lib/util/nestedMap.js +2 -4
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/offsetList.js +2 -4
- package/lib/util/offsetList.js.map +1 -1
- package/lib/util/rangeMap.js +4 -0
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/readSnapshotBlob.d.ts.map +1 -1
- package/lib/util/referenceCounting.js +1 -0
- package/lib/util/referenceCounting.js.map +1 -1
- package/lib/util/stackyIterator.js +3 -2
- package/lib/util/stackyIterator.js.map +1 -1
- package/lib/util/utils.d.ts +2 -2
- package/lib/util/utils.d.ts.map +1 -1
- package/package.json +67 -95
- package/src/api.ts +11 -0
- package/src/core/index.ts +6 -2
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/types.ts +16 -1
- package/src/core/tree/anchorSet.ts +2 -2
- package/src/core/tree/deltaUtil.ts +67 -13
- package/src/core/tree/index.ts +5 -2
- package/src/entrypoints/alpha.ts +19 -21
- package/src/entrypoints/beta.ts +12 -5
- package/src/entrypoints/legacy.ts +12 -5
- package/src/entrypoints/public.ts +1 -5
- package/src/extensibleUnionNode.ts +1 -2
- package/src/feature-libraries/cursorComparator.ts +57 -9
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +77 -12
- package/src/feature-libraries/modular-schema/filterEdits.ts +108 -0
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +7 -4
- package/src/feature-libraries/modular-schema/index.ts +5 -2
- package/src/feature-libraries/modular-schema/invert.ts +16 -61
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +831 -10
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +10 -124
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +164 -2
- package/src/feature-libraries/modular-schema/prune.ts +52 -10
- package/src/feature-libraries/optional-field/optionalField.ts +30 -42
- package/src/feature-libraries/sequence-field/filterEdits.ts +62 -26
- package/src/feature-libraries/sequence-field/utils.ts +7 -19
- package/src/index.ts +7 -39
- package/src/internalTypes.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/history.ts +41 -19
- package/src/shared-tree/independentView.ts +40 -3
- package/src/shared-tree/index.ts +5 -1
- package/src/shared-tree/schematizingTreeView.ts +2 -2
- package/src/shared-tree/sharedTree.ts +2 -1
- package/src/shared-tree/transactionMinimize.ts +13 -4
- package/src/shared-tree/treeAlpha.ts +17 -31
- package/src/{simple-tree/api → shared-tree}/treeBeta.ts +56 -167
- package/src/shared-tree/treeCheckout.ts +82 -9
- package/src/shared-tree-core/editManager.ts +16 -8
- package/src/shared-tree-core/editManagerCodecsCommons.ts +30 -34
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +1 -1
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -2
- package/src/simple-tree/api/cloneTree.ts +47 -0
- package/src/simple-tree/api/index.ts +15 -21
- package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +87 -6
- package/src/simple-tree/api/transactionTypes.ts +4 -4
- package/src/simple-tree/api/tree.ts +139 -85
- package/src/simple-tree/api/treeChangeEvents.ts +16 -4
- package/src/simple-tree/api/treeChangeEventsBeta.ts +245 -0
- package/src/simple-tree/api/treeNodeApi.ts +6 -85
- package/src/simple-tree/api/typesUnsafe.ts +8 -6
- package/src/simple-tree/core/index.ts +1 -1
- package/src/simple-tree/core/treeNode.ts +3 -10
- package/src/simple-tree/core/withType.ts +8 -11
- package/src/simple-tree/index.ts +3 -7
- package/src/simple-tree/node-kinds/array/arrayNode.ts +14 -12
- package/src/simple-tree/node-kinds/map/mapNode.ts +14 -15
- package/src/simple-tree/node-kinds/object/objectNode.ts +3 -6
- package/src/simple-tree/node-kinds/record/recordNode.ts +6 -8
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +2 -1
- package/src/tableSchema.ts +8 -187
- package/src/text/codePointUtils.ts +25 -14
- package/src/text/textDomain.ts +15 -2
- package/src/text/textDomainFormatted.ts +9 -4
- package/tsconfig.json +1 -1
- package/alpha.d.ts +0 -11
- package/beta.d.ts +0 -11
- package/dist/simple-tree/api/treeAlpha.d.ts +0 -126
- package/dist/simple-tree/api/treeAlpha.d.ts.map +0 -1
- package/dist/simple-tree/api/treeAlpha.js.map +0 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +0 -1
- package/dist/simple-tree/api/treeBeta.js +0 -83
- package/dist/simple-tree/api/treeBeta.js.map +0 -1
- package/docs/main/glossary.md +0 -163
- package/internal.d.ts +0 -11
- package/legacy.d.ts +0 -11
- package/lib/simple-tree/api/treeAlpha.d.ts +0 -126
- package/lib/simple-tree/api/treeAlpha.d.ts.map +0 -1
- package/lib/simple-tree/api/treeAlpha.js.map +0 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +0 -1
- package/lib/simple-tree/api/treeBeta.js +0 -77
- package/lib/simple-tree/api/treeBeta.js.map +0 -1
- package/src/simple-tree/api/treeAlpha.ts +0 -153
- /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
- /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TreeCheckout =
|
|
7
|
+
exports.TreeCheckout = void 0;
|
|
8
|
+
exports.createTreeCheckout = createTreeCheckout;
|
|
9
|
+
exports.addConstraintsToTransaction = addConstraintsToTransaction;
|
|
10
|
+
exports.assertValidConstraint = assertValidConstraint;
|
|
8
11
|
const tslib_1 = require("tslib");
|
|
9
12
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
10
13
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
@@ -119,10 +122,10 @@ function createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, arg
|
|
|
119
122
|
change: changeFamily.rebaser.compose([]),
|
|
120
123
|
revision: "root",
|
|
121
124
|
customMetadata: undefined,
|
|
125
|
+
wasTrimmed: true,
|
|
122
126
|
}, changeFamily, () => idCompressor.generateCompressedId());
|
|
123
127
|
return new TreeCheckout(branch, true, changeFamily, schema, forest, mintRevisionTag, revisionTagCodec, idCompressor, args?.removedRoots);
|
|
124
128
|
}
|
|
125
|
-
exports.createTreeCheckout = createTreeCheckout;
|
|
126
129
|
/**
|
|
127
130
|
* Get the {@link TreeCheckout} associated with a given {@link UntypedTreeView}.
|
|
128
131
|
*/
|
|
@@ -175,7 +178,6 @@ function addConstraintsToTransaction(checkout, constraintsOnRevert, constraints
|
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
|
-
exports.addConstraintsToTransaction = addConstraintsToTransaction;
|
|
179
181
|
/**
|
|
180
182
|
* Throws if the given {@link TransactionConstraintAlpha | transaction constraint} is not currently satisfied.
|
|
181
183
|
*/
|
|
@@ -198,12 +200,10 @@ function assertValidConstraint(constraint, onRevert) {
|
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
|
-
exports.assertValidConstraint = assertValidConstraint;
|
|
202
203
|
/**
|
|
203
204
|
* An implementation of {@link ITreeCheckout}.
|
|
204
205
|
*/
|
|
205
206
|
let TreeCheckout = (() => {
|
|
206
|
-
var _a, _TreeCheckout_events, _TreeCheckout_transaction, _TreeCheckout_validatedCommits;
|
|
207
207
|
let _instanceExtraInitializers = [];
|
|
208
208
|
let _exportVerbose_decorators;
|
|
209
209
|
let _applySerializedChange_decorators;
|
|
@@ -213,990 +213,1069 @@ let TreeCheckout = (() => {
|
|
|
213
213
|
let _withCombinedVisitor_decorators;
|
|
214
214
|
let _viewWith_decorators;
|
|
215
215
|
let _fork_decorators;
|
|
216
|
-
return
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
get
|
|
224
|
-
|
|
216
|
+
return class TreeCheckout {
|
|
217
|
+
static {
|
|
218
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
219
|
+
tslib_1.__esDecorate(this, null, _exportVerbose_decorators, { kind: "method", name: "exportVerbose", static: false, private: false, access: { has: obj => "exportVerbose" in obj, get: obj => obj.exportVerbose }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
220
|
+
tslib_1.__esDecorate(this, null, _applySerializedChange_decorators, { kind: "method", name: "applySerializedChange", static: false, private: false, access: { has: obj => "applySerializedChange" in obj, get: obj => obj.applySerializedChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
221
|
+
tslib_1.__esDecorate(this, null, _applyChange_decorators, { kind: "method", name: "applyChange", static: false, private: false, access: { has: obj => "applyChange" in obj, get: obj => obj.applyChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
222
|
+
tslib_1.__esDecorate(this, null, _runTransaction_decorators, { kind: "method", name: "runTransaction", static: false, private: false, access: { has: obj => "runTransaction" in obj, get: obj => obj.runTransaction }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
223
|
+
tslib_1.__esDecorate(this, null, _runTransactionAsync_decorators, { kind: "method", name: "runTransactionAsync", static: false, private: false, access: { has: obj => "runTransactionAsync" in obj, get: obj => obj.runTransactionAsync }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
224
|
+
tslib_1.__esDecorate(this, null, _withCombinedVisitor_decorators, { kind: "method", name: "withCombinedVisitor", static: false, private: false, access: { has: obj => "withCombinedVisitor" in obj, get: obj => obj.withCombinedVisitor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
225
|
+
tslib_1.__esDecorate(this, null, _viewWith_decorators, { kind: "method", name: "viewWith", static: false, private: false, access: { has: obj => "viewWith" in obj, get: obj => obj.viewWith }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
226
|
+
tslib_1.__esDecorate(this, null, _fork_decorators, { kind: "method", name: "fork", static: false, private: false, access: { has: obj => "fork" in obj, get: obj => obj.fork }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
227
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
228
|
+
}
|
|
229
|
+
branch = tslib_1.__runInitializers(this, _instanceExtraInitializers);
|
|
230
|
+
isSharedBranch;
|
|
231
|
+
changeFamily;
|
|
232
|
+
storedSchema;
|
|
233
|
+
forest;
|
|
234
|
+
mintRevisionTag;
|
|
235
|
+
revisionTagCodec;
|
|
236
|
+
idCompressor;
|
|
237
|
+
_removedRoots;
|
|
238
|
+
disposeForksAfterTransaction;
|
|
239
|
+
disposed = false;
|
|
240
|
+
/**
|
|
241
|
+
* Logger for telemetry events related to this checkout.
|
|
242
|
+
* @remarks
|
|
243
|
+
* This logger is provided by the {@link Breakable} passed to the constructor, and may be `undefined` if no logger was provided.
|
|
244
|
+
* See the explanation on {@link Breakable.logger} for why this pattern makes sense.
|
|
245
|
+
*/
|
|
246
|
+
get logger() {
|
|
247
|
+
return this.breaker.logger;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The breaker for this checkout.
|
|
251
|
+
* @remarks
|
|
252
|
+
* As the forest is part of the mutable state of the checkout,
|
|
253
|
+
* we want to be broken if it is broken, so we use the forest's breaker as our own.
|
|
254
|
+
*
|
|
255
|
+
* This does mean that if something goes wrong in the checkout, we break the forest,
|
|
256
|
+
* which is not strictly necessary, but may be desirable as if something is wrong with the checkout,
|
|
257
|
+
* while the forest might be internally consistent, it likely doesn't contain the correct content
|
|
258
|
+
* (since the checkout is keeping it up to date properly anymore).
|
|
259
|
+
*/
|
|
260
|
+
get breaker() {
|
|
261
|
+
return this.forest.breaker;
|
|
262
|
+
}
|
|
263
|
+
editLock;
|
|
264
|
+
/**
|
|
265
|
+
* Root of the mutable label tree tracking transaction nesting.
|
|
266
|
+
*
|
|
267
|
+
* @remarks
|
|
268
|
+
* The label tree is always isomorphic to the actual transaction tree — every transaction
|
|
269
|
+
* (whether labeled or not) gets its own node. To find the "current" (deepest open) node,
|
|
270
|
+
* walk down the right side of the tree, stopping at {@link TreeCheckout.mostRecentlyClosedLabelNode}.
|
|
271
|
+
*
|
|
272
|
+
* Cleared by {@link TreeCheckout.runWithTransactionLabel} after the commit event is emitted.
|
|
273
|
+
*/
|
|
274
|
+
labelTreeNode;
|
|
275
|
+
/**
|
|
276
|
+
* Points to the most recently closed (committed) label node.
|
|
277
|
+
* Used by {@link TreeCheckout.currentLabelNode} to stop descending past committed nodes.
|
|
278
|
+
*/
|
|
279
|
+
mostRecentlyClosedLabelNode;
|
|
280
|
+
views = new Set();
|
|
281
|
+
/**
|
|
282
|
+
* Event emitters for local commits.
|
|
283
|
+
*/
|
|
284
|
+
localCommitEventEmitters = new Map();
|
|
285
|
+
/**
|
|
286
|
+
* Revertibles maintained for automatic disposal
|
|
287
|
+
*/
|
|
288
|
+
revertibles = new Map();
|
|
289
|
+
/**
|
|
290
|
+
* Each branch's head commit corresponds to a revertible commit.
|
|
291
|
+
* Maintaining a whole branch ensures the commit graph is not pruned in a way that would prevent the commit from
|
|
292
|
+
* being reverted.
|
|
293
|
+
*/
|
|
294
|
+
revertibleCommitBranches = new Map();
|
|
295
|
+
/**
|
|
296
|
+
* The name of the telemetry event logged for calls to {@link TreeCheckout.revertRevertible}.
|
|
297
|
+
* @privateRemarks Exposed for testing purposes.
|
|
298
|
+
*/
|
|
299
|
+
static revertTelemetryEventName = "RevertRevertible";
|
|
300
|
+
/**
|
|
301
|
+
* The name of the telemetry event logged when a schema change is applied.
|
|
302
|
+
* @privateRemarks Exposed for testing purposes.
|
|
303
|
+
*/
|
|
304
|
+
static schemaChangeTelemetryEventName = "SchemaChangeApplied";
|
|
305
|
+
#events = (0, client_utils_1.createEmitter)();
|
|
306
|
+
events = this.#events;
|
|
307
|
+
_branchHistory;
|
|
308
|
+
constructor(branch,
|
|
309
|
+
/** True if and only if this checkout is for a branch which is persisted and shared with other clients. */
|
|
310
|
+
isSharedBranch, changeFamily, storedSchema, forest, mintRevisionTag, revisionTagCodec, idCompressor, _removedRoots = (0, index_js_2.makeDetachedFieldIndex)("repair"), disposeForksAfterTransaction = true) {
|
|
311
|
+
this.branch = branch;
|
|
312
|
+
this.isSharedBranch = isSharedBranch;
|
|
313
|
+
this.changeFamily = changeFamily;
|
|
314
|
+
this.storedSchema = storedSchema;
|
|
315
|
+
this.forest = forest;
|
|
316
|
+
this.mintRevisionTag = mintRevisionTag;
|
|
317
|
+
this.revisionTagCodec = revisionTagCodec;
|
|
318
|
+
this.idCompressor = idCompressor;
|
|
319
|
+
this._removedRoots = _removedRoots;
|
|
320
|
+
this.disposeForksAfterTransaction = disposeForksAfterTransaction;
|
|
321
|
+
this.#transaction = this.createTransactionStack(branch);
|
|
322
|
+
this.editLock = new EditLock(this.#transaction.activeBranchEditor);
|
|
323
|
+
this.registerForBranchEvents();
|
|
324
|
+
}
|
|
325
|
+
get branchHistory() {
|
|
326
|
+
this._branchHistory ??= new history_js_1.DefaultTreeBranchHistory(this.branch, this.idCompressor);
|
|
327
|
+
return this._branchHistory;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Pushes a new label node for a transaction nesting level.
|
|
331
|
+
*
|
|
332
|
+
* @param label - The label for this transaction level.
|
|
333
|
+
*
|
|
334
|
+
* @remarks
|
|
335
|
+
* Called at the start of each transaction (including nested ones).
|
|
336
|
+
* Creates a new {@link LabelTree} node as a child of the current deepest node (if any),
|
|
337
|
+
* or as the root if this is the outermost transaction.
|
|
338
|
+
*/
|
|
339
|
+
pushLabelFrame(label) {
|
|
340
|
+
const node = { label, sublabels: [] };
|
|
341
|
+
if (this.labelTreeNode === undefined) {
|
|
342
|
+
this.labelTreeNode = node;
|
|
225
343
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
* we want to be broken if it is broken, so we use the forest's breaker as our own.
|
|
231
|
-
*
|
|
232
|
-
* This does mean that if something goes wrong in the checkout, we break the forest,
|
|
233
|
-
* which is not strictly necessary, but may be desirable as if something is wrong with the checkout,
|
|
234
|
-
* while the forest might be internally consistent, it likely doesn't contain the correct content
|
|
235
|
-
* (since the checkout is keeping it up to date properly anymore).
|
|
236
|
-
*/
|
|
237
|
-
get breaker() {
|
|
238
|
-
return this.forest.breaker;
|
|
344
|
+
else {
|
|
345
|
+
const current = this.currentLabelNode();
|
|
346
|
+
(0, internal_1.assert)(current !== undefined, 0xcdb /* Expected current label node to exist */);
|
|
347
|
+
current.sublabels.push(node);
|
|
239
348
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Returns the deepest open node on the right side of the label tree, which corresponds
|
|
352
|
+
* to the current (most recently pushed, not yet committed or aborted) transaction.
|
|
353
|
+
* Returns `undefined` when {@link TreeCheckout.labelTreeNode} is not set.
|
|
354
|
+
*/
|
|
355
|
+
currentLabelNode() {
|
|
356
|
+
if (this.labelTreeNode === undefined) {
|
|
357
|
+
return undefined;
|
|
358
|
+
}
|
|
359
|
+
// Walk down the right spine of the tree. Only one closed node is ever reachable
|
|
360
|
+
// during this traversal, so a single pointer (mostRecentlyClosedLabelNode) suffices
|
|
361
|
+
// to stop descending past committed nodes.
|
|
362
|
+
let node = this.labelTreeNode;
|
|
363
|
+
while (node.sublabels.length > 0) {
|
|
364
|
+
const lastChild = node.sublabels[node.sublabels.length - 1];
|
|
365
|
+
(0, internal_1.assert)(lastChild !== undefined, 0xcdc /* Expected label tree node to have children */);
|
|
366
|
+
if (lastChild === this.mostRecentlyClosedLabelNode) {
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
node = lastChild;
|
|
370
|
+
}
|
|
371
|
+
return node;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Pops the current label frame from the label tree.
|
|
375
|
+
* @param aborted - If true, the node is removed from the tree (transaction was aborted).
|
|
376
|
+
* If false, the node is kept in the tree but marked as closed (transaction was committed).
|
|
377
|
+
*/
|
|
378
|
+
popLabelFrame(aborted) {
|
|
379
|
+
const node = this.currentLabelNode();
|
|
380
|
+
if (node === undefined) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (aborted) {
|
|
384
|
+
if (node === this.labelTreeNode) {
|
|
385
|
+
this.labelTreeNode = undefined;
|
|
386
|
+
this.mostRecentlyClosedLabelNode = undefined;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
// Temporarily mark node as closed so currentLabelNode() returns its parent.
|
|
390
|
+
this.mostRecentlyClosedLabelNode = node;
|
|
391
|
+
const parent = this.currentLabelNode();
|
|
392
|
+
(0, internal_1.assert)(parent !== undefined, 0xcdd /* Expected parent label node to exist */);
|
|
393
|
+
parent.sublabels.pop();
|
|
394
|
+
// Point to the parent's new last child (guaranteed closed if it exists),
|
|
395
|
+
// or undefined if the parent has no more children.
|
|
396
|
+
const newLastChild = parent.sublabels[parent.sublabels.length - 1];
|
|
397
|
+
this.mostRecentlyClosedLabelNode = newLastChild;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this.mostRecentlyClosedLabelNode = node;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Helper method for {@link SchematizingSimpleTreeView.runTransaction} to properly clear transaction labels once the function completes.
|
|
406
|
+
*
|
|
407
|
+
* @remarks
|
|
408
|
+
* The label is stored during the execution of the function and will be included in the {@link ChangeMetadata} of the transaction.
|
|
409
|
+
*
|
|
410
|
+
* Labels supplied to nested transactions are ignored - only the outermost transaction label is ever used.
|
|
411
|
+
*
|
|
412
|
+
* @param fn - The function to execute. It receives the user provided transaction label as an optional parameter.
|
|
413
|
+
* @param label - The label to associate with the outermost transaction.
|
|
414
|
+
* @returns The result of executing `fn`.
|
|
415
|
+
*/
|
|
416
|
+
runWithTransactionLabel(fn, label) {
|
|
417
|
+
try {
|
|
418
|
+
return fn(label);
|
|
419
|
+
}
|
|
420
|
+
finally {
|
|
421
|
+
// Only clear the label tree when the outermost transaction has completed.
|
|
422
|
+
// Inner transactions' commits don't fire the "changed" event, so the label tree
|
|
423
|
+
// must remain intact until the outermost commit reads it.
|
|
424
|
+
if (this.transaction.size === 0) {
|
|
425
|
+
this.labelTreeNode = undefined;
|
|
426
|
+
this.mostRecentlyClosedLabelNode = undefined;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
get removedRoots() {
|
|
431
|
+
return this._removedRoots;
|
|
432
|
+
}
|
|
433
|
+
registerForBranchEvents() {
|
|
434
|
+
this.#transaction.branch.events.on("afterChange", this.onAfterBranchChange);
|
|
435
|
+
this.#transaction.branch.events.on("commitSequenced", this.onCommitSequenced);
|
|
436
|
+
this.#transaction.activeBranchEvents.on("afterChange", this.onAfterChange);
|
|
437
|
+
this.#transaction.activeBranchEvents.on("ancestryTrimmed", this.onAncestryTrimmed);
|
|
438
|
+
}
|
|
439
|
+
unregisterFromBranchEvents() {
|
|
440
|
+
this.#transaction.branch.events.off("afterChange", this.onAfterBranchChange);
|
|
441
|
+
this.#transaction.branch.events.off("commitSequenced", this.onCommitSequenced);
|
|
442
|
+
this.#transaction.activeBranchEvents.off("afterChange", this.onAfterChange);
|
|
443
|
+
this.#transaction.activeBranchEvents.off("ancestryTrimmed", this.onAncestryTrimmed);
|
|
444
|
+
}
|
|
445
|
+
createTransactionStack(branch) {
|
|
446
|
+
return new index_js_4.SquashingTransactionStack(branch, this.mintRevisionTag, () => {
|
|
447
|
+
// When each transaction is started, make a restorable checkpoint of the current state of removed roots
|
|
448
|
+
const restoreRemovedRoots = this._removedRoots.createCheckpoint();
|
|
449
|
+
return (result, viewUpdate) => {
|
|
450
|
+
const newHead = this.#transaction.branch.getHead();
|
|
451
|
+
switch (result) {
|
|
452
|
+
case index_js_4.TransactionResult.Abort: {
|
|
453
|
+
restoreRemovedRoots();
|
|
454
|
+
if (viewUpdate !== undefined) {
|
|
455
|
+
this.applyInternalChange(viewUpdate, newHead.revision);
|
|
456
|
+
}
|
|
287
457
|
break;
|
|
288
458
|
}
|
|
289
|
-
case
|
|
290
|
-
|
|
459
|
+
case index_js_4.TransactionResult.Commit: {
|
|
460
|
+
if (viewUpdate !== undefined) {
|
|
461
|
+
this.applyInternalChange(viewUpdate, newHead.revision);
|
|
462
|
+
}
|
|
463
|
+
if (this.transaction.size === 0) {
|
|
464
|
+
// The changes in a transaction squash commit have already applied to the checkout and are known to be valid, so we can validate the squash commit automatically.
|
|
465
|
+
this.validateCommit(newHead);
|
|
466
|
+
}
|
|
291
467
|
break;
|
|
292
468
|
}
|
|
293
469
|
default: {
|
|
294
|
-
(0, internal_1.unreachableCase)(
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
this.emitChangedLocked(() => {
|
|
298
|
-
emitter.emit("settled", outcome);
|
|
299
|
-
}, "a commit settled event callback");
|
|
300
|
-
// No more events will be emitted for this commit, so we can remove the emitter from the map.
|
|
301
|
-
this.localCommitEventEmitters.delete(commit.revision);
|
|
302
|
-
};
|
|
303
|
-
this.onAfterBranchChange = (event) => {
|
|
304
|
-
// The following logic allows revertibles to be generated for the change.
|
|
305
|
-
// Currently only appends (including merges and transaction commits) are supported.
|
|
306
|
-
if (event.type === "append") {
|
|
307
|
-
// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
|
|
308
|
-
// Figure out a way to generate revertibles before the commits are garbage collected.
|
|
309
|
-
for (const commit of event.newCommits) {
|
|
310
|
-
const kind = event.type === "append" ? event.kind : index_js_2.CommitKind.Default;
|
|
311
|
-
const { change, revision } = commit;
|
|
312
|
-
// Snapshot the label tree for this commit before any listener runs, so the captured
|
|
313
|
-
// value is stable against mutations to `metadata.labels.tree` (which aliases the
|
|
314
|
-
// live `labelTreeNode`).
|
|
315
|
-
const commitLabelTree = this.labelTreeNode === undefined ? undefined : cloneLabelTree(this.labelTreeNode);
|
|
316
|
-
const getRevertible = (0, sharedTreeChangeFamily_js_1.hasSchemaChange)(change)
|
|
317
|
-
? undefined
|
|
318
|
-
: (onRevertibleDisposed) => {
|
|
319
|
-
if (!withinEventContext) {
|
|
320
|
-
throw new internal_2.UsageError("Cannot get a revertible outside of the context of a changed event.");
|
|
321
|
-
}
|
|
322
|
-
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
323
|
-
throw new internal_2.UsageError("Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.");
|
|
324
|
-
}
|
|
325
|
-
const revertible = this.createRevertible(revision, kind, this, onRevertibleDisposed, commitLabelTree);
|
|
326
|
-
this.revertibleCommitBranches.set(revision, tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.fork(commit));
|
|
327
|
-
this.revertibles.set(revision, revertible);
|
|
328
|
-
return revertible;
|
|
329
|
-
};
|
|
330
|
-
let withinEventContext = true;
|
|
331
|
-
const events = (0, client_utils_1.createEmitter)();
|
|
332
|
-
this.localCommitEventEmitters.set(commit.revision, events);
|
|
333
|
-
const metadata = {
|
|
334
|
-
kind,
|
|
335
|
-
isLocal: true,
|
|
336
|
-
getChange: () => {
|
|
337
|
-
(0, internal_1.assert)(commit.parent !== undefined, 0xca4 /* Expected applied commit to be parented */);
|
|
338
|
-
return serializedChange_js_1.SerializedChange.V1.encode(this.idCompressor, this.changeFamily, change, revision);
|
|
339
|
-
},
|
|
340
|
-
getRevertible: (onDisposed) => getRevertible?.(onDisposed),
|
|
341
|
-
label: this.labelTreeNode?.label,
|
|
342
|
-
labels: buildLabelsSet(this.labelTreeNode),
|
|
343
|
-
events,
|
|
344
|
-
};
|
|
345
|
-
this.emitChangedLocked(() => {
|
|
346
|
-
tslib_1.__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", metadata, getRevertible);
|
|
347
|
-
});
|
|
348
|
-
withinEventContext = false;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
else if (event.type === "remove") {
|
|
352
|
-
// Commits that are rolled back should no longer be revertible
|
|
353
|
-
for (const commit of event.removedCommits) {
|
|
354
|
-
this.revertibles.get(commit.revision)?.dispose();
|
|
470
|
+
(0, internal_1.unreachableCase)(result);
|
|
355
471
|
}
|
|
356
472
|
}
|
|
357
|
-
else if (this.isRemoteChangeEvent(event)) {
|
|
358
|
-
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
359
|
-
this.emitChangedLocked(() => {
|
|
360
|
-
tslib_1.__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", {
|
|
361
|
-
isLocal: false,
|
|
362
|
-
kind: index_js_2.CommitKind.Default,
|
|
363
|
-
labels: new Set(),
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
473
|
};
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
this.validateCommit(commit);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
this.onAncestryTrimmed = (revisions) => {
|
|
386
|
-
// When the branch is trimmed, we can garbage collect any repair data whose latest relevant revision is one of the
|
|
387
|
-
// trimmed revisions.
|
|
388
|
-
this.withCombinedVisitor((visitor) => {
|
|
389
|
-
for (const revision of revisions) {
|
|
390
|
-
// get all the roots last created or used by the revision
|
|
391
|
-
const roots = this._removedRoots.getRootsLastTouchedByRevision(revision);
|
|
392
|
-
// get the detached field for the root and delete it from the removed roots
|
|
393
|
-
for (const root of roots) {
|
|
394
|
-
visitor.destroy(this._removedRoots.toFieldKey(root), 1);
|
|
395
|
-
}
|
|
396
|
-
this._removedRoots.deleteRootsLastTouchedByRevision(revision);
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
/**
|
|
401
|
-
* The {@link Transactor} for this checkout.
|
|
402
|
-
* @remarks In the context of a checkout, transactions allow edits to be batched into atomic units.
|
|
403
|
-
* Edits made during a transaction will update the local state of the tree immediately, but will be squashed into a single edit when the transaction is committed.
|
|
404
|
-
* If the transaction is aborted, the local state will be reset to what it was before the transaction began.
|
|
405
|
-
* Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.
|
|
406
|
-
*
|
|
407
|
-
* To avoid updating observers of the view state with intermediate results during a transaction,
|
|
408
|
-
* use {@link ITreeCheckout#fork} and {@link ISharedTreeFork#merge}.
|
|
409
|
-
*/
|
|
410
|
-
_TreeCheckout_transaction.set(this, void 0);
|
|
411
|
-
// #region Commit Validation
|
|
412
|
-
/** Used to maintain the contract of {@link onCommitValid}(). */
|
|
413
|
-
_TreeCheckout_validatedCommits.set(this, new WeakMap());
|
|
414
|
-
// #endregion Commit Validation
|
|
415
|
-
// #region Enrichment
|
|
416
|
-
/**
|
|
417
|
-
* Statistics about enrichment operations performed by this checkout.
|
|
418
|
-
* Used for testing. May be used for telemetry in the future.
|
|
419
|
-
* The performance cost of maintaining this information is negligible.
|
|
420
|
-
*/
|
|
421
|
-
this.enrichmentStats = { batches: 0, diffs: 0, commitsEnriched: 0, refreshers: 0, forks: 0, applied: 0 };
|
|
422
|
-
tslib_1.__classPrivateFieldSet(this, _TreeCheckout_transaction, this.createTransactionStack(branch), "f");
|
|
423
|
-
this.editLock = new EditLock(tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEditor);
|
|
424
|
-
this.registerForBranchEvents();
|
|
425
|
-
}
|
|
426
|
-
get branchHistory() {
|
|
427
|
-
this._branchHistory ??= new history_js_1.DefaultTreeBranchHistory(this.branch, this.idCompressor);
|
|
428
|
-
return this._branchHistory;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Pushes a new label node for a transaction nesting level.
|
|
432
|
-
*
|
|
433
|
-
* @param label - The label for this transaction level.
|
|
434
|
-
*
|
|
435
|
-
* @remarks
|
|
436
|
-
* Called at the start of each transaction (including nested ones).
|
|
437
|
-
* Creates a new {@link LabelTree} node as a child of the current deepest node (if any),
|
|
438
|
-
* or as the root if this is the outermost transaction.
|
|
439
|
-
*/
|
|
440
|
-
pushLabelFrame(label) {
|
|
441
|
-
const node = { label, sublabels: [] };
|
|
442
|
-
if (this.labelTreeNode === undefined) {
|
|
443
|
-
this.labelTreeNode = node;
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
exportVerbose() {
|
|
477
|
+
const cursor = this.forest.allocateCursor("contentSnapshot");
|
|
478
|
+
try {
|
|
479
|
+
(0, index_js_2.moveToDetachedField)(this.forest, cursor);
|
|
480
|
+
const length = cursor.getFieldLength();
|
|
481
|
+
if (length === 0) {
|
|
482
|
+
return undefined;
|
|
483
|
+
}
|
|
484
|
+
else if (length === 1) {
|
|
485
|
+
cursor.enterNode(0);
|
|
486
|
+
return verboseFromCursor(cursor, this.storedSchema.nodeSchema);
|
|
444
487
|
}
|
|
445
488
|
else {
|
|
446
|
-
|
|
447
|
-
(0, internal_1.assert)(current !== undefined, 0xcdb /* Expected current label node to exist */);
|
|
448
|
-
current.sublabels.push(node);
|
|
489
|
+
(0, internal_1.fail)(0xac8 /* Invalid document root length */);
|
|
449
490
|
}
|
|
450
491
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
* to the current (most recently pushed, not yet committed or aborted) transaction.
|
|
454
|
-
* Returns `undefined` when {@link TreeCheckout.labelTreeNode} is not set.
|
|
455
|
-
*/
|
|
456
|
-
currentLabelNode() {
|
|
457
|
-
if (this.labelTreeNode === undefined) {
|
|
458
|
-
return undefined;
|
|
459
|
-
}
|
|
460
|
-
// Walk down the right spine of the tree. Only one closed node is ever reachable
|
|
461
|
-
// during this traversal, so a single pointer (mostRecentlyClosedLabelNode) suffices
|
|
462
|
-
// to stop descending past committed nodes.
|
|
463
|
-
let node = this.labelTreeNode;
|
|
464
|
-
while (node.sublabels.length > 0) {
|
|
465
|
-
const lastChild = node.sublabels[node.sublabels.length - 1];
|
|
466
|
-
(0, internal_1.assert)(lastChild !== undefined, 0xcdc /* Expected label tree node to have children */);
|
|
467
|
-
if (lastChild === this.mostRecentlyClosedLabelNode) {
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
node = lastChild;
|
|
471
|
-
}
|
|
472
|
-
return node;
|
|
492
|
+
finally {
|
|
493
|
+
cursor.free();
|
|
473
494
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
// Temporarily mark node as closed so currentLabelNode() returns its parent.
|
|
491
|
-
this.mostRecentlyClosedLabelNode = node;
|
|
492
|
-
const parent = this.currentLabelNode();
|
|
493
|
-
(0, internal_1.assert)(parent !== undefined, 0xcdd /* Expected parent label node to exist */);
|
|
494
|
-
parent.sublabels.pop();
|
|
495
|
-
// Point to the parent's new last child (guaranteed closed if it exists),
|
|
496
|
-
// or undefined if the parent has no more children.
|
|
497
|
-
const newLastChild = parent.sublabels[parent.sublabels.length - 1];
|
|
498
|
-
this.mostRecentlyClosedLabelNode = newLastChild;
|
|
499
|
-
}
|
|
495
|
+
}
|
|
496
|
+
onCommitSequenced = (commit) => {
|
|
497
|
+
const emitter = this.localCommitEventEmitters.get(commit.revision);
|
|
498
|
+
if (emitter === undefined) {
|
|
499
|
+
// If the commit predates the creation of this checkout, there will be no emitter associated with the commit.
|
|
500
|
+
// In that case, we don't need to emit any events.
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
const constraintStatus = (0, sharedTreeChangeFamily_js_1.getConstraintStatus)(commit.change);
|
|
504
|
+
let outcome;
|
|
505
|
+
switch (constraintStatus) {
|
|
506
|
+
case sharedTreeChangeFamily_js_1.ConstraintStatus.Satisfied: {
|
|
507
|
+
outcome = index_js_2.CommitOutcome.FullyApplied;
|
|
508
|
+
break;
|
|
500
509
|
}
|
|
501
|
-
|
|
502
|
-
|
|
510
|
+
case sharedTreeChangeFamily_js_1.ConstraintStatus.ImplicitViolation: {
|
|
511
|
+
outcome = index_js_2.CommitOutcome.FullyDropped;
|
|
512
|
+
break;
|
|
503
513
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
*
|
|
508
|
-
* @remarks
|
|
509
|
-
* The label is stored during the execution of the function and will be included in the {@link ChangeMetadata} of the transaction.
|
|
510
|
-
*
|
|
511
|
-
* Labels supplied to nested transactions are ignored - only the outermost transaction label is ever used.
|
|
512
|
-
*
|
|
513
|
-
* @param fn - The function to execute. It receives the user provided transaction label as an optional parameter.
|
|
514
|
-
* @param label - The label to associate with the outermost transaction.
|
|
515
|
-
* @returns The result of executing `fn`.
|
|
516
|
-
*/
|
|
517
|
-
runWithTransactionLabel(fn, label) {
|
|
518
|
-
try {
|
|
519
|
-
return fn(label);
|
|
514
|
+
case sharedTreeChangeFamily_js_1.ConstraintStatus.ExplicitViolation: {
|
|
515
|
+
outcome = index_js_2.CommitOutcome.NewContentOnly;
|
|
516
|
+
break;
|
|
520
517
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
// Inner transactions' commits don't fire the "changed" event, so the label tree
|
|
524
|
-
// must remain intact until the outermost commit reads it.
|
|
525
|
-
if (this.transaction.size === 0) {
|
|
526
|
-
this.labelTreeNode = undefined;
|
|
527
|
-
this.mostRecentlyClosedLabelNode = undefined;
|
|
528
|
-
}
|
|
518
|
+
default: {
|
|
519
|
+
(0, internal_1.unreachableCase)(constraintStatus);
|
|
529
520
|
}
|
|
530
521
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
//
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
if (viewUpdate !== undefined) {
|
|
556
|
-
this.applyInternalChange(viewUpdate, newHead.revision);
|
|
557
|
-
}
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
case index_js_4.TransactionResult.Commit: {
|
|
561
|
-
if (viewUpdate !== undefined) {
|
|
562
|
-
this.applyInternalChange(viewUpdate, newHead.revision);
|
|
563
|
-
}
|
|
564
|
-
if (this.transaction.size === 0) {
|
|
565
|
-
// The changes in a transaction squash commit have already applied to the checkout and are known to be valid, so we can validate the squash commit automatically.
|
|
566
|
-
this.validateCommit(newHead);
|
|
567
|
-
}
|
|
568
|
-
break;
|
|
522
|
+
this.emitChangedLocked(() => {
|
|
523
|
+
emitter.emit("settled", outcome);
|
|
524
|
+
}, "a commit settled event callback");
|
|
525
|
+
// No more events will be emitted for this commit, so we can remove the emitter from the map.
|
|
526
|
+
this.localCommitEventEmitters.delete(commit.revision);
|
|
527
|
+
};
|
|
528
|
+
onAfterBranchChange = (event) => {
|
|
529
|
+
// The following logic allows revertibles to be generated for the change.
|
|
530
|
+
// Currently only appends (including merges and transaction commits) are supported.
|
|
531
|
+
if (event.type === "append") {
|
|
532
|
+
// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
|
|
533
|
+
// Figure out a way to generate revertibles before the commits are garbage collected.
|
|
534
|
+
for (const commit of event.newCommits) {
|
|
535
|
+
const kind = event.type === "append" ? event.kind : index_js_2.CommitKind.Default;
|
|
536
|
+
const { change, revision } = commit;
|
|
537
|
+
// Snapshot the label tree for this commit before any listener runs, so the captured
|
|
538
|
+
// value is stable against mutations to `metadata.labels.tree` (which aliases the
|
|
539
|
+
// live `labelTreeNode`).
|
|
540
|
+
const commitLabelTree = this.labelTreeNode === undefined ? undefined : cloneLabelTree(this.labelTreeNode);
|
|
541
|
+
const getRevertible = (0, sharedTreeChangeFamily_js_1.hasSchemaChange)(change)
|
|
542
|
+
? undefined
|
|
543
|
+
: (onRevertibleDisposed) => {
|
|
544
|
+
if (!withinEventContext) {
|
|
545
|
+
throw new internal_2.UsageError("Cannot get a revertible outside of the context of a changed event.");
|
|
569
546
|
}
|
|
570
|
-
|
|
571
|
-
(
|
|
547
|
+
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
548
|
+
throw new internal_2.UsageError("Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.");
|
|
572
549
|
}
|
|
573
|
-
|
|
550
|
+
const revertible = this.createRevertible(revision, kind, this, onRevertibleDisposed, commitLabelTree);
|
|
551
|
+
this.revertibleCommitBranches.set(revision, this.#transaction.branch.fork(commit));
|
|
552
|
+
this.revertibles.set(revision, revertible);
|
|
553
|
+
return revertible;
|
|
554
|
+
};
|
|
555
|
+
let withinEventContext = true;
|
|
556
|
+
const events = (0, client_utils_1.createEmitter)();
|
|
557
|
+
this.localCommitEventEmitters.set(commit.revision, events);
|
|
558
|
+
const metadata = {
|
|
559
|
+
kind,
|
|
560
|
+
isLocal: true,
|
|
561
|
+
getChange: () => {
|
|
562
|
+
(0, internal_1.assert)(commit.parent !== undefined, 0xca4 /* Expected applied commit to be parented */);
|
|
563
|
+
return serializedChange_js_1.SerializedChange.V1.encode(this.idCompressor, this.changeFamily, change, revision);
|
|
564
|
+
},
|
|
565
|
+
getRevertible: (onDisposed) => getRevertible?.(onDisposed),
|
|
566
|
+
label: this.labelTreeNode?.label,
|
|
567
|
+
labels: buildLabelsSet(this.labelTreeNode),
|
|
568
|
+
events,
|
|
574
569
|
};
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
try {
|
|
580
|
-
(0, index_js_2.moveToDetachedField)(this.forest, cursor);
|
|
581
|
-
const length = cursor.getFieldLength();
|
|
582
|
-
if (length === 0) {
|
|
583
|
-
return undefined;
|
|
584
|
-
}
|
|
585
|
-
else if (length === 1) {
|
|
586
|
-
cursor.enterNode(0);
|
|
587
|
-
return verboseFromCursor(cursor, this.storedSchema.nodeSchema);
|
|
588
|
-
}
|
|
589
|
-
else {
|
|
590
|
-
(0, internal_1.fail)(0xac8 /* Invalid document root length */);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
finally {
|
|
594
|
-
cursor.free();
|
|
570
|
+
this.emitChangedLocked(() => {
|
|
571
|
+
this.#events.emit("changed", metadata, getRevertible);
|
|
572
|
+
});
|
|
573
|
+
withinEventContext = false;
|
|
595
574
|
}
|
|
596
575
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
*
|
|
602
|
-
* @remarks
|
|
603
|
-
* Shared by both the local and remote `changed` emission paths in {@link TreeCheckout.onAfterBranchChange}.
|
|
604
|
-
* The `try`/`finally` ensures the lock is released even if a listener throws.
|
|
605
|
-
*/
|
|
606
|
-
emitChangedLocked(emit, reason = "a change event callback") {
|
|
607
|
-
this.editLock.lock(reason);
|
|
608
|
-
try {
|
|
609
|
-
emit();
|
|
610
|
-
}
|
|
611
|
-
finally {
|
|
612
|
-
// TODO: any event that throws potentially leaves the code which triggered that event,
|
|
613
|
-
// and thus this checkout (and likely more) in a broken state.
|
|
614
|
-
// Unlocking this editLock prevents future use of this broken state from giving a confusing error in this case,
|
|
615
|
-
// however, a better approach would probably be to put something (this checkout and/or the editLock)
|
|
616
|
-
// into a broken state (using a properly scoped `Breakable`),
|
|
617
|
-
// likely by moving emitChangedLocked into EditLock, and having EditLock get a Breakable,
|
|
618
|
-
// and having the new emitChangedLocked use `Breakable.use`.
|
|
619
|
-
this.editLock.unlock();
|
|
576
|
+
else if (event.type === "remove") {
|
|
577
|
+
// Commits that are rolled back should no longer be revertible
|
|
578
|
+
for (const commit of event.removedCommits) {
|
|
579
|
+
this.revertibles.get(commit.revision)?.dispose();
|
|
620
580
|
}
|
|
621
581
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
582
|
+
else if (this.isRemoteChangeEvent(event)) {
|
|
583
|
+
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
584
|
+
this.emitChangedLocked(() => {
|
|
585
|
+
this.#events.emit("changed", {
|
|
586
|
+
isLocal: false,
|
|
587
|
+
kind: index_js_2.CommitKind.Default,
|
|
588
|
+
labels: new Set(),
|
|
589
|
+
});
|
|
590
|
+
});
|
|
629
591
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
592
|
+
};
|
|
593
|
+
/**
|
|
594
|
+
* Hold the `editLock` for the duration of `emit`, so that re-entrant edits, transactions,
|
|
595
|
+
* branch operations, etc. attempted from inside a `changed` listener throw the canonical
|
|
596
|
+
* "forbidden during a change event" {@link UsageError} via {@link EditLock.checkUnlocked}.
|
|
597
|
+
*
|
|
598
|
+
* @remarks
|
|
599
|
+
* Shared by both the local and remote `changed` emission paths in {@link TreeCheckout.onAfterBranchChange}.
|
|
600
|
+
* The `try`/`finally` ensures the lock is released even if a listener throws.
|
|
601
|
+
*/
|
|
602
|
+
emitChangedLocked(emit, reason = "a change event callback") {
|
|
603
|
+
this.editLock.lock(reason);
|
|
604
|
+
try {
|
|
605
|
+
emit();
|
|
633
606
|
}
|
|
634
|
-
|
|
635
|
-
|
|
607
|
+
finally {
|
|
608
|
+
// TODO: any event that throws potentially leaves the code which triggered that event,
|
|
609
|
+
// and thus this checkout (and likely more) in a broken state.
|
|
610
|
+
// Unlocking this editLock prevents future use of this broken state from giving a confusing error in this case,
|
|
611
|
+
// however, a better approach would probably be to put something (this checkout and/or the editLock)
|
|
612
|
+
// into a broken state (using a properly scoped `Breakable`),
|
|
613
|
+
// likely by moving emitChangedLocked into EditLock, and having EditLock get a Breakable,
|
|
614
|
+
// and having the new emitChangedLocked use `Breakable.use`.
|
|
615
|
+
this.editLock.unlock();
|
|
636
616
|
}
|
|
637
|
-
|
|
638
|
-
|
|
617
|
+
}
|
|
618
|
+
onAfterChange = (event) => {
|
|
619
|
+
this.editLock.lock("a change event callback");
|
|
620
|
+
this.#events.emit("beforeBatch", event);
|
|
621
|
+
if (event.change !== undefined) {
|
|
622
|
+
const revision = event.type === "rebase"
|
|
623
|
+
? this.#transaction.activeBranch.getHead().revision
|
|
624
|
+
: event.change.revision;
|
|
625
|
+
this.applyInternalChange(event.change.change, revision);
|
|
639
626
|
}
|
|
640
|
-
|
|
641
|
-
|
|
627
|
+
this.#events.emit("afterBatch");
|
|
628
|
+
this.editLock.unlock();
|
|
629
|
+
if (event.type === "append") {
|
|
630
|
+
for (const commit of event.newCommits) {
|
|
631
|
+
this.validateCommit(commit);
|
|
632
|
+
}
|
|
642
633
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
634
|
+
};
|
|
635
|
+
/**
|
|
636
|
+
* Applies the given serialized change (as was produced via a `"changed"` event of another checkout) to this checkout.
|
|
637
|
+
*/
|
|
638
|
+
applySerializedChange(serializedChange) {
|
|
639
|
+
const change = serializedChange_js_1.SerializedChange.V1.decode(this.idCompressor, this.changeFamily, serializedChange);
|
|
640
|
+
// Apply the change to the branch, but _not_ the `activeBranch` - we do not support squashing serialized commits in a transaction.
|
|
641
|
+
this.#transaction.branch.apply(change, index_js_2.CommitKind.Default, undefined);
|
|
642
|
+
}
|
|
643
|
+
// #region UntypedTreeViewAlpha
|
|
644
|
+
applyChange(change) {
|
|
645
|
+
this.applySerializedChange(change);
|
|
646
|
+
}
|
|
647
|
+
isBranch() {
|
|
648
|
+
return this.isView();
|
|
649
|
+
}
|
|
650
|
+
isView() {
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
hasRootSchema(_schema) {
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
runTransaction(transaction, params) {
|
|
657
|
+
this.mountTransaction(params, false);
|
|
658
|
+
const transactionCallbackStatus = transaction();
|
|
659
|
+
return this.unmountTransaction(transactionCallbackStatus, params);
|
|
660
|
+
}
|
|
661
|
+
async runTransactionAsync(transaction, params) {
|
|
662
|
+
this.mountTransaction(params, true);
|
|
663
|
+
const transactionCallbackStatus = await transaction();
|
|
664
|
+
return this.unmountTransaction(transactionCallbackStatus, params);
|
|
665
|
+
}
|
|
666
|
+
mountTransaction(params, isAsync) {
|
|
667
|
+
this.checkNotDisposed();
|
|
668
|
+
// Starting a transaction is an edit, so it is forbidden from within a change-event
|
|
669
|
+
// callback (where the edit lock is held), the same as direct edits. For the async
|
|
670
|
+
// entry point this throw is captured as a rejected promise by the `async` wrapper.
|
|
671
|
+
//
|
|
672
|
+
// Note: because runTransaction/runTransactionAsync are `@breakingMethod`, this throw also
|
|
673
|
+
// puts the checkout into a broken state (unlike a direct edit, which throws recoverably).
|
|
674
|
+
// That is the same pre-existing broken-state limitation tracked by the TODO in
|
|
675
|
+
// `emitChangedLocked`, not something specific to transactions.
|
|
676
|
+
this.editLock.checkUnlocked("Running a transaction");
|
|
677
|
+
if (isAsync && this.transaction.size > 0) {
|
|
678
|
+
throw new internal_2.UsageError("An asynchronous transaction cannot be started while another transaction is already in progress.");
|
|
647
679
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
680
|
+
this.pushLabelFrame(params?.label);
|
|
681
|
+
this.transaction.start({
|
|
682
|
+
postProcessor: (0, transactionPostProcessor_js_1.extractTransactionChangeProcessor)(params?.postProcessor),
|
|
683
|
+
// Like the validation described above, rejecting malformed metadata breaks the checkout rather
|
|
684
|
+
// than being recoverable. Tracked by https://github.com/microsoft/FluidFramework/issues/28085.
|
|
685
|
+
customMetadata: snapshotCustomMetadata(params?.customMetadata),
|
|
686
|
+
});
|
|
687
|
+
addConstraintsToTransaction(this, false, params?.preconditions);
|
|
688
|
+
}
|
|
689
|
+
unmountTransaction(transactionCallbackStatus, params) {
|
|
690
|
+
this.checkNotDisposed();
|
|
691
|
+
const rollback = transactionCallbackStatus?.rollback;
|
|
692
|
+
const value = transactionCallbackStatus?.value;
|
|
693
|
+
if (rollback === true) {
|
|
694
|
+
this.popLabelFrame(true);
|
|
695
|
+
this.transaction.abort();
|
|
696
|
+
return value === undefined
|
|
697
|
+
? { success: false }
|
|
698
|
+
: { success: false, value: value };
|
|
652
699
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
700
|
+
addConstraintsToTransaction(this, true, transactionCallbackStatus?.preconditionsOnRevert);
|
|
701
|
+
this.popLabelFrame(false);
|
|
702
|
+
this.runWithTransactionLabel(() => {
|
|
703
|
+
this.transaction.commit();
|
|
704
|
+
}, params?.label);
|
|
705
|
+
return value === undefined
|
|
706
|
+
? { success: true }
|
|
707
|
+
: { success: true, value: value };
|
|
708
|
+
}
|
|
709
|
+
// #endregion UntypedTreeViewAlpha
|
|
710
|
+
// Revision is the revision of the commit, if any, which caused this change.
|
|
711
|
+
applyInternalChange(change, revision) {
|
|
712
|
+
// Conflicts due to schema will be empty and thus are not applied.
|
|
713
|
+
for (const innerChange of change.changes) {
|
|
714
|
+
if (innerChange.type === "data") {
|
|
715
|
+
const delta = (0, index_js_3.intoDelta)((0, index_js_2.tagChange)(innerChange.innerChange, revision));
|
|
716
|
+
this.withCombinedVisitor((visitor) => {
|
|
717
|
+
(0, index_js_2.visitDelta)(delta, visitor, this._removedRoots, revision);
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
else if (innerChange.type === "schema") {
|
|
721
|
+
// Schema changes from a current to a new schema are expected to be backwards compatible.
|
|
722
|
+
// This guarantees that all data in the forest (which is valid before the schema change)
|
|
723
|
+
// is also valid under the new schema.
|
|
724
|
+
// Note however, that such schema changes may in some cases be rolled back:
|
|
725
|
+
// Case 1: A transaction with a schema change may be aborted.
|
|
726
|
+
// The transaction may have made some data changes that would render some trees invalid
|
|
727
|
+
// under the old schema, but these changes will also be rolled back, thereby putting the forest
|
|
728
|
+
// back in the state before the transaction, which is valid under the original (reinstated) schema.
|
|
729
|
+
// Case 2: A branch with a schema change may be rebased such that the schema change (because
|
|
730
|
+
// of a constraint) is no longer applied.
|
|
731
|
+
// Such a branch may contain data changes that would render some trees invalid under the
|
|
732
|
+
// original schema. These data changes may not necessarily be rolled back.
|
|
733
|
+
// They will however be rebased over the rollback of the schema change. This rebasing will
|
|
734
|
+
// ensure that these data changes are muted if they would render some trees invalid under the
|
|
735
|
+
// original (reinstated) schema.
|
|
736
|
+
const newSchema = innerChange.innerChange.schema.new;
|
|
737
|
+
const telemetryMetrics = getSchemaChangeTelemetryMetrics(this.storedSchema, newSchema, innerChange.innerChange.isInverse);
|
|
738
|
+
this.storedSchema.apply(newSchema);
|
|
739
|
+
this.logger?.sendTelemetryEvent({
|
|
740
|
+
eventName: TreeCheckout.schemaChangeTelemetryEventName,
|
|
741
|
+
...(0, internal_2.tagCodeArtifacts)({
|
|
742
|
+
details: JSON.stringify({
|
|
743
|
+
...telemetryMetrics,
|
|
744
|
+
isSharedBranch: this.isSharedBranch,
|
|
745
|
+
}),
|
|
746
|
+
}),
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
(0, internal_1.fail)(0xad1 /* Unknown Shared Tree change type. */);
|
|
666
751
|
}
|
|
667
|
-
this.pushLabelFrame(params?.label);
|
|
668
|
-
this.transaction.start({
|
|
669
|
-
postProcessor: (0, transactionPostProcessor_js_1.extractTransactionChangeProcessor)(params?.postProcessor),
|
|
670
|
-
// Like the validation described above, rejecting malformed metadata breaks the checkout rather
|
|
671
|
-
// than being recoverable. Tracked by https://github.com/microsoft/FluidFramework/issues/28085.
|
|
672
|
-
customMetadata: snapshotCustomMetadata(params?.customMetadata),
|
|
673
|
-
});
|
|
674
|
-
addConstraintsToTransaction(this, false, params?.preconditions);
|
|
675
752
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
753
|
+
}
|
|
754
|
+
onAncestryTrimmed = (revisions) => {
|
|
755
|
+
// When the branch is trimmed, we can garbage collect any repair data whose latest relevant revision is one of the
|
|
756
|
+
// trimmed revisions.
|
|
757
|
+
this.withCombinedVisitor((visitor) => {
|
|
758
|
+
for (const revision of revisions) {
|
|
759
|
+
// get all the roots last created or used by the revision
|
|
760
|
+
const roots = this._removedRoots.getRootsLastTouchedByRevision(revision);
|
|
761
|
+
// get the detached field for the root and delete it from the removed roots
|
|
762
|
+
for (const root of roots) {
|
|
763
|
+
visitor.destroy(this._removedRoots.toFieldKey(root), 1);
|
|
764
|
+
}
|
|
765
|
+
this._removedRoots.deleteRootsLastTouchedByRevision(revision);
|
|
686
766
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
767
|
+
});
|
|
768
|
+
};
|
|
769
|
+
withCombinedVisitor(fn) {
|
|
770
|
+
const anchorVisitor = this.forest.anchors.acquireVisitor();
|
|
771
|
+
const combinedVisitor = (0, index_js_2.combineVisitors)([this.forest.acquireVisitor(), anchorVisitor]);
|
|
772
|
+
fn(combinedVisitor);
|
|
773
|
+
combinedVisitor.free();
|
|
774
|
+
}
|
|
775
|
+
checkNotDisposed(usageError) {
|
|
776
|
+
this.breaker.use();
|
|
777
|
+
if (this.disposed) {
|
|
778
|
+
if (usageError !== undefined) {
|
|
779
|
+
throw new internal_2.UsageError(usageError);
|
|
780
|
+
}
|
|
781
|
+
(0, internal_1.fail)(0x911 /* Invalid operation on a disposed TreeCheckout */);
|
|
695
782
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Creates a {@link RevertibleAlpha} object that can undo a specific change in the tree's history.
|
|
786
|
+
* Revision must exist in the given {@link TreeCheckout}'s branch.
|
|
787
|
+
*
|
|
788
|
+
* @param revision - The revision tag identifying the change to be made revertible.
|
|
789
|
+
* @param kind - The {@link CommitKind} that produced this revertible (e.g., Default, Undo, Redo).
|
|
790
|
+
* @param checkout - The {@link TreeCheckout} instance this revertible belongs to.
|
|
791
|
+
* @param onRevertibleDisposed - Callback function that will be called when the revertible is disposed.
|
|
792
|
+
* @param labelTree - The {@link LabelTree} (if any) active when the original commit was produced.
|
|
793
|
+
* The revert commit inherits these labels so that commits and their reverts can be associated.
|
|
794
|
+
* @returns A {@link RevertibleAlpha} object.
|
|
795
|
+
*/
|
|
796
|
+
createRevertible(revision, kind, checkout, onRevertibleDisposed, labelTree) {
|
|
797
|
+
const commitBranches = checkout.revertibleCommitBranches;
|
|
798
|
+
const revertible = {
|
|
799
|
+
get status() {
|
|
800
|
+
const revertibleCommit = commitBranches.get(revision);
|
|
801
|
+
return revertibleCommit === undefined
|
|
802
|
+
? index_js_2.RevertibleStatus.Disposed
|
|
803
|
+
: index_js_2.RevertibleStatus.Valid;
|
|
804
|
+
},
|
|
805
|
+
revert: (releaseOrOptions = true) => {
|
|
806
|
+
if (revertible.status === index_js_2.RevertibleStatus.Disposed) {
|
|
807
|
+
throw new internal_2.UsageError("Unable to revert a revertible that has been disposed.");
|
|
706
808
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
// of a constraint) is no longer applied.
|
|
718
|
-
// Such a branch may contain data changes that would render some trees invalid under the
|
|
719
|
-
// original schema. These data changes may not necessarily be rolled back.
|
|
720
|
-
// They will however be rebased over the rollback of the schema change. This rebasing will
|
|
721
|
-
// ensure that these data changes are muted if they would render some trees invalid under the
|
|
722
|
-
// original (reinstated) schema.
|
|
723
|
-
this.storedSchema.apply(innerChange.innerChange.schema.new);
|
|
809
|
+
const options = typeof releaseOrOptions === "boolean"
|
|
810
|
+
? { dispose: releaseOrOptions }
|
|
811
|
+
: releaseOrOptions;
|
|
812
|
+
const revertMetrics = checkout.revertRevertible(revision, kind, labelTree, snapshotCustomMetadata(options.customMetadata));
|
|
813
|
+
checkout.logger?.sendTelemetryEvent({
|
|
814
|
+
eventName: TreeCheckout.revertTelemetryEventName,
|
|
815
|
+
...revertMetrics,
|
|
816
|
+
});
|
|
817
|
+
if (options.dispose ?? true) {
|
|
818
|
+
revertible.dispose();
|
|
724
819
|
}
|
|
725
|
-
|
|
726
|
-
|
|
820
|
+
},
|
|
821
|
+
clone: (targetView) => {
|
|
822
|
+
// TODO:#23442: When a revertible is cloned for a forked branch, optimize to create a fork of a revertible branch once per revision NOT once per revision per checkout.
|
|
823
|
+
const targetCheckout = getCheckout(targetView);
|
|
824
|
+
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
825
|
+
if (revertibleBranch === undefined) {
|
|
826
|
+
throw new internal_2.UsageError("Unable to clone a revertible that has been disposed.");
|
|
727
827
|
}
|
|
728
|
-
|
|
828
|
+
const commitToRevert = revertibleBranch.getHead();
|
|
829
|
+
const branchHead = targetCheckout.#transaction.branch.getHead();
|
|
830
|
+
if ((0, index_js_2.isAncestor)(commitToRevert, branchHead, true) === false) {
|
|
831
|
+
throw new internal_2.UsageError("Cannot clone revertible for a commit that is not present on the given branch.");
|
|
832
|
+
}
|
|
833
|
+
targetCheckout.revertibleCommitBranches.set(revision, revertibleBranch.fork());
|
|
834
|
+
return this.createRevertible(revision, kind, targetCheckout, onRevertibleDisposed, labelTree);
|
|
835
|
+
},
|
|
836
|
+
dispose: () => {
|
|
837
|
+
if (revertible.status === index_js_2.RevertibleStatus.Disposed) {
|
|
838
|
+
throw new internal_2.UsageError("Unable to dispose a revertible that has already been disposed.");
|
|
839
|
+
}
|
|
840
|
+
checkout.disposeRevertible(revision);
|
|
841
|
+
onRevertibleDisposed?.(revertible);
|
|
842
|
+
},
|
|
843
|
+
};
|
|
844
|
+
return revertible;
|
|
845
|
+
}
|
|
846
|
+
viewWith(config) {
|
|
847
|
+
const view = new schematizingTreeView_js_1.SchematizingSimpleTreeView(this, config, (0, index_js_3.createNodeIdentifierManager)(this.idCompressor), () => {
|
|
848
|
+
this.views.delete(view);
|
|
849
|
+
});
|
|
850
|
+
this.views.add(view);
|
|
851
|
+
return view;
|
|
852
|
+
}
|
|
853
|
+
get rootEvents() {
|
|
854
|
+
return this.forest.anchors.events;
|
|
855
|
+
}
|
|
856
|
+
get editor() {
|
|
857
|
+
this.checkNotDisposed();
|
|
858
|
+
return this.editLock.editor;
|
|
859
|
+
}
|
|
860
|
+
locate(anchor) {
|
|
861
|
+
this.checkNotDisposed();
|
|
862
|
+
return this.forest.anchors.locate(anchor);
|
|
863
|
+
}
|
|
864
|
+
get transaction() {
|
|
865
|
+
return this.#transaction;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* The {@link Transactor} for this checkout.
|
|
869
|
+
* @remarks In the context of a checkout, transactions allow edits to be batched into atomic units.
|
|
870
|
+
* Edits made during a transaction will update the local state of the tree immediately, but will be squashed into a single edit when the transaction is committed.
|
|
871
|
+
* If the transaction is aborted, the local state will be reset to what it was before the transaction began.
|
|
872
|
+
* Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.
|
|
873
|
+
*
|
|
874
|
+
* To avoid updating observers of the view state with intermediate results during a transaction,
|
|
875
|
+
* use {@link ITreeCheckout#fork} and {@link ISharedTreeFork#merge}.
|
|
876
|
+
*/
|
|
877
|
+
#transaction;
|
|
878
|
+
fork() {
|
|
879
|
+
this.checkNotDisposed("The parent branch has already been disposed and can no longer create new branches.");
|
|
880
|
+
// Branching after an unfinished transaction would expose the application to a state where its invariants may be violated.
|
|
881
|
+
if (this.transaction.size > 0) {
|
|
882
|
+
throw new internal_2.UsageError("A view cannot be forked while it has a pending transaction.");
|
|
729
883
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
884
|
+
const branch = this.#transaction.branch.fork();
|
|
885
|
+
const storedSchema = this.storedSchema.clone();
|
|
886
|
+
const forkBreaker = new index_js_6.Breakable("TreeCheckout", this.logger);
|
|
887
|
+
const forest = this.forest.clone(storedSchema, forkBreaker);
|
|
888
|
+
const checkout = new TreeCheckout(branch, false, this.changeFamily, storedSchema, forest, this.mintRevisionTag, this.revisionTagCodec, this.idCompressor, this._removedRoots.clone());
|
|
889
|
+
this.#events.emit("fork", checkout);
|
|
890
|
+
return checkout;
|
|
891
|
+
}
|
|
892
|
+
switchBranch(branch) {
|
|
893
|
+
(0, internal_1.assert)(this.#transaction.size === 0, 0xc55 /* Cannot switch branches during a transaction */);
|
|
894
|
+
if (this.isSharedBranch) {
|
|
895
|
+
throw new internal_2.UsageError("Cannot switch a view away from a shared branch. Consider forking first.");
|
|
735
896
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
897
|
+
const diff = (0, index_js_2.diffHistories)(this.changeFamily.rebaser, this.#transaction.branch.getHead(), branch.getHead(), this.mintRevisionTag);
|
|
898
|
+
this.unregisterFromBranchEvents();
|
|
899
|
+
this.#transaction = this.createTransactionStack(branch);
|
|
900
|
+
this.branch = branch;
|
|
901
|
+
this._branchHistory?.dispose();
|
|
902
|
+
this._branchHistory = undefined;
|
|
903
|
+
this.editLock = new EditLock(this.#transaction.activeBranchEditor);
|
|
904
|
+
this.registerForBranchEvents();
|
|
905
|
+
// TODO: Rework eventing
|
|
906
|
+
this.applyInternalChange(diff);
|
|
907
|
+
this.#events.emit("afterBatch");
|
|
908
|
+
}
|
|
909
|
+
rewindTo(revisionString) {
|
|
910
|
+
this.checkNotDisposed("The branch has already been disposed and cannot be rewound.");
|
|
911
|
+
if (this.#transaction.size > 0) {
|
|
912
|
+
throw new internal_2.UsageError("Rewinding is not supported during transactions.");
|
|
744
913
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
*
|
|
749
|
-
* @param revision - The revision tag identifying the change to be made revertible.
|
|
750
|
-
* @param kind - The {@link CommitKind} that produced this revertible (e.g., Default, Undo, Redo).
|
|
751
|
-
* @param checkout - The {@link TreeCheckout} instance this revertible belongs to.
|
|
752
|
-
* @param onRevertibleDisposed - Callback function that will be called when the revertible is disposed.
|
|
753
|
-
* @param labelTree - The {@link LabelTree} (if any) active when the original commit was produced.
|
|
754
|
-
* The revert commit inherits these labels so that commits and their reverts can be associated.
|
|
755
|
-
* @returns A {@link RevertibleAlpha} object.
|
|
756
|
-
*/
|
|
757
|
-
createRevertible(revision, kind, checkout, onRevertibleDisposed, labelTree) {
|
|
758
|
-
const commitBranches = checkout.revertibleCommitBranches;
|
|
759
|
-
const revertible = {
|
|
760
|
-
get status() {
|
|
761
|
-
const revertibleCommit = commitBranches.get(revision);
|
|
762
|
-
return revertibleCommit === undefined
|
|
763
|
-
? index_js_2.RevertibleStatus.Disposed
|
|
764
|
-
: index_js_2.RevertibleStatus.Valid;
|
|
765
|
-
},
|
|
766
|
-
revert: (releaseOrOptions = true) => {
|
|
767
|
-
if (revertible.status === index_js_2.RevertibleStatus.Disposed) {
|
|
768
|
-
throw new internal_2.UsageError("Unable to revert a revertible that has been disposed.");
|
|
769
|
-
}
|
|
770
|
-
const options = typeof releaseOrOptions === "boolean"
|
|
771
|
-
? { dispose: releaseOrOptions }
|
|
772
|
-
: releaseOrOptions;
|
|
773
|
-
const revertMetrics = checkout.revertRevertible(revision, kind, labelTree, snapshotCustomMetadata(options.customMetadata));
|
|
774
|
-
checkout.logger?.sendTelemetryEvent({
|
|
775
|
-
eventName: _a.revertTelemetryEventName,
|
|
776
|
-
...revertMetrics,
|
|
777
|
-
});
|
|
778
|
-
if (options.dispose ?? true) {
|
|
779
|
-
revertible.dispose();
|
|
780
|
-
}
|
|
781
|
-
},
|
|
782
|
-
clone: (targetView) => {
|
|
783
|
-
// TODO:#23442: When a revertible is cloned for a forked branch, optimize to create a fork of a revertible branch once per revision NOT once per revision per checkout.
|
|
784
|
-
const targetCheckout = getCheckout(targetView);
|
|
785
|
-
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
786
|
-
if (revertibleBranch === undefined) {
|
|
787
|
-
throw new internal_2.UsageError("Unable to clone a revertible that has been disposed.");
|
|
788
|
-
}
|
|
789
|
-
const commitToRevert = revertibleBranch.getHead();
|
|
790
|
-
const branchHead = tslib_1.__classPrivateFieldGet(targetCheckout, _TreeCheckout_transaction, "f").branch.getHead();
|
|
791
|
-
if ((0, index_js_2.isAncestor)(commitToRevert, branchHead, true) === false) {
|
|
792
|
-
throw new internal_2.UsageError("Cannot clone revertible for a commit that is not present on the given branch.");
|
|
793
|
-
}
|
|
794
|
-
targetCheckout.revertibleCommitBranches.set(revision, revertibleBranch.fork());
|
|
795
|
-
return this.createRevertible(revision, kind, targetCheckout, onRevertibleDisposed, labelTree);
|
|
796
|
-
},
|
|
797
|
-
dispose: () => {
|
|
798
|
-
if (revertible.status === index_js_2.RevertibleStatus.Disposed) {
|
|
799
|
-
throw new internal_2.UsageError("Unable to dispose a revertible that has already been disposed.");
|
|
800
|
-
}
|
|
801
|
-
checkout.disposeRevertible(revision);
|
|
802
|
-
onRevertibleDisposed?.(revertible);
|
|
803
|
-
},
|
|
804
|
-
};
|
|
805
|
-
return revertible;
|
|
914
|
+
const revision = this.idCompressor.tryRecompress(revisionString);
|
|
915
|
+
if (revision === undefined) {
|
|
916
|
+
throw new internal_2.UsageError(`Unrecognized revision id: ${revisionString}`);
|
|
806
917
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
});
|
|
811
|
-
this.views.add(view);
|
|
812
|
-
return view;
|
|
918
|
+
const targetCommit = (0, index_js_2.findAncestor)(this.#transaction.branch.getHead(), (commit) => commit.revision === revision);
|
|
919
|
+
if (targetCommit === undefined) {
|
|
920
|
+
throw new internal_2.UsageError(`No commit found with revision: ${revisionString}`);
|
|
813
921
|
}
|
|
814
|
-
|
|
815
|
-
|
|
922
|
+
this.switchBranch(this.#transaction.branch.fork(targetCommit));
|
|
923
|
+
}
|
|
924
|
+
revertTo(revisionString, options) {
|
|
925
|
+
this.checkNotDisposed("The branch has already been disposed and prior revisions cannot be reverted to.");
|
|
926
|
+
this.editLock.checkUnlocked("Reverting to a revision");
|
|
927
|
+
if (this.#transaction.size > 0) {
|
|
928
|
+
throw new internal_2.UsageError("Reverting to a revision is not supported during transactions.");
|
|
816
929
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
930
|
+
const customMetadata = snapshotCustomMetadata(options?.customMetadata);
|
|
931
|
+
const revision = this.idCompressor.tryRecompress(revisionString);
|
|
932
|
+
if (revision === undefined) {
|
|
933
|
+
throw new internal_2.UsageError(`Unrecognized revision id: ${revisionString}`);
|
|
820
934
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
935
|
+
// Populated with the commits that came after the target commit, from oldest to newest.
|
|
936
|
+
const commitsToUndo = [];
|
|
937
|
+
const targetCommit = (0, index_js_2.findAncestor)([this.#transaction.activeBranch.getHead(), commitsToUndo], (commit) => commit.revision === revision);
|
|
938
|
+
if (targetCommit === undefined) {
|
|
939
|
+
throw new internal_2.UsageError(`No commit found with revision: ${revisionString}`);
|
|
824
940
|
}
|
|
825
|
-
|
|
826
|
-
|
|
941
|
+
if (!(0, index_js_6.hasSome)(commitsToUndo)) {
|
|
942
|
+
// The target commit is already the head of the branch, so there is nothing to revert.
|
|
943
|
+
return;
|
|
827
944
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
return checkout;
|
|
945
|
+
const revisionForInvert = this.mintRevisionTag();
|
|
946
|
+
const toUndo = this.changeFamily.rebaser.compose(commitsToUndo);
|
|
947
|
+
const inverse = this.changeFamily.rebaser.invert((0, index_js_2.makeAnonChange)(toUndo), false, revisionForInvert);
|
|
948
|
+
this.#transaction.branch.apply((0, index_js_2.tagChange)(inverse, revisionForInvert), index_js_2.CommitKind.Default, toMetadataTree(customMetadata));
|
|
949
|
+
}
|
|
950
|
+
rebase(view) {
|
|
951
|
+
const checkout = getCheckout(view);
|
|
952
|
+
this.checkNotDisposed("The target branch of the rebase has been disposed and cannot be rebased.");
|
|
953
|
+
checkout.checkNotDisposed("The source branch of the rebase has been disposed and cannot be rebased.");
|
|
954
|
+
this.editLock.checkUnlocked("Rebasing");
|
|
955
|
+
if (this.transaction.size > 0) {
|
|
956
|
+
throw new internal_2.UsageError("Views cannot be rebased onto a view that has a pending transaction.");
|
|
841
957
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
if (this.isSharedBranch) {
|
|
845
|
-
throw new internal_2.UsageError("Cannot switch a view away from a shared branch. Consider forking first.");
|
|
846
|
-
}
|
|
847
|
-
const diff = (0, index_js_2.diffHistories)(this.changeFamily.rebaser, tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead(), branch.getHead(), this.mintRevisionTag);
|
|
848
|
-
this.unregisterFromBranchEvents();
|
|
849
|
-
tslib_1.__classPrivateFieldSet(this, _TreeCheckout_transaction, this.createTransactionStack(branch), "f");
|
|
850
|
-
this.branch = branch;
|
|
851
|
-
this._branchHistory?.dispose();
|
|
852
|
-
this._branchHistory = undefined;
|
|
853
|
-
this.editLock = new EditLock(tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEditor);
|
|
854
|
-
this.registerForBranchEvents();
|
|
855
|
-
// TODO: Rework eventing
|
|
856
|
-
this.applyInternalChange(diff);
|
|
857
|
-
tslib_1.__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
958
|
+
if (checkout.transaction.size > 0) {
|
|
959
|
+
throw new internal_2.UsageError("A view cannot be rebased while it has a pending transaction.");
|
|
858
960
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
961
|
+
(0, internal_1.assert)(!checkout.isSharedBranch, 0xa5d /* Shared branches cannot be rebased onto another branch. */);
|
|
962
|
+
checkout.#transaction.branch.rebaseOnto(this.#transaction.branch);
|
|
963
|
+
}
|
|
964
|
+
rebaseOnto(view) {
|
|
965
|
+
getCheckout(view).rebase(this);
|
|
966
|
+
}
|
|
967
|
+
isMissingEditsFrom(view) {
|
|
968
|
+
const viewCheckout = getCheckout(view);
|
|
969
|
+
const targetPath = [];
|
|
970
|
+
const ancestor = (0, index_js_2.findCommonAncestor)(this.mainBranch.getHead(), [
|
|
971
|
+
viewCheckout.mainBranch.getHead(),
|
|
972
|
+
targetPath,
|
|
973
|
+
]);
|
|
974
|
+
if (ancestor === undefined) {
|
|
975
|
+
throw new internal_2.UsageError("Branches do not share a common ancestor.");
|
|
873
976
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
const revision = this.idCompressor.tryRecompress(revisionString);
|
|
882
|
-
if (revision === undefined) {
|
|
883
|
-
throw new internal_2.UsageError(`Unrecognized revision id: ${revisionString}`);
|
|
884
|
-
}
|
|
885
|
-
// Populated with the commits that came after the target commit, from oldest to newest.
|
|
886
|
-
const commitsToUndo = [];
|
|
887
|
-
const targetCommit = (0, index_js_2.findAncestor)([tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead(), commitsToUndo], (commit) => commit.revision === revision);
|
|
888
|
-
if (targetCommit === undefined) {
|
|
889
|
-
throw new internal_2.UsageError(`No commit found with revision: ${revisionString}`);
|
|
890
|
-
}
|
|
891
|
-
if (!(0, index_js_6.hasSome)(commitsToUndo)) {
|
|
892
|
-
// The target commit is already the head of the branch, so there is nothing to revert.
|
|
893
|
-
return;
|
|
894
|
-
}
|
|
895
|
-
const revisionForInvert = this.mintRevisionTag();
|
|
896
|
-
const toUndo = this.changeFamily.rebaser.compose(commitsToUndo);
|
|
897
|
-
const inverse = this.changeFamily.rebaser.invert((0, index_js_2.makeAnonChange)(toUndo), false, revisionForInvert);
|
|
898
|
-
tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.apply((0, index_js_2.tagChange)(inverse, revisionForInvert), index_js_2.CommitKind.Default, toMetadataTree(customMetadata));
|
|
977
|
+
return targetPath.length > 0;
|
|
978
|
+
}
|
|
979
|
+
computeNetChangeIfRebasedOnto(view) {
|
|
980
|
+
const viewCheckout = getCheckout(view);
|
|
981
|
+
const rebased = (0, index_js_2.rebaseBranch)(this.mintRevisionTag, this.changeFamily.rebaser, this.#transaction.branch.getHead(), viewCheckout.#transaction.branch.getHead());
|
|
982
|
+
if (rebased.sourceChange === undefined) {
|
|
983
|
+
return undefined;
|
|
899
984
|
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}
|
|
911
|
-
(0, internal_1.assert)(!checkout.isSharedBranch, 0xa5d /* Shared branches cannot be rebased onto another branch. */);
|
|
912
|
-
tslib_1.__classPrivateFieldGet(checkout, _TreeCheckout_transaction, "f").branch.rebaseOnto(tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch);
|
|
985
|
+
const revision = this.mintRevisionTag();
|
|
986
|
+
return serializedChange_js_1.SerializedChange.V1.encode(this.idCompressor, this.changeFamily, rebased.sourceChange, revision, undefined);
|
|
987
|
+
}
|
|
988
|
+
merge(view, disposeMerged = true) {
|
|
989
|
+
const checkout = getCheckout(view);
|
|
990
|
+
this.checkNotDisposed("The target branch of the merge has been disposed and cannot be merged.");
|
|
991
|
+
checkout.checkNotDisposed("The source branch of the merge has been disposed and cannot be merged.");
|
|
992
|
+
this.editLock.checkUnlocked("Merging");
|
|
993
|
+
if (this.transaction.size > 0) {
|
|
994
|
+
throw new internal_2.UsageError("Views cannot be merged into a view while it has a pending transaction.");
|
|
913
995
|
}
|
|
914
|
-
|
|
915
|
-
|
|
996
|
+
if (checkout.transaction.size > 0) {
|
|
997
|
+
throw new internal_2.UsageError("Views with an open transaction cannot be merged into another view.");
|
|
916
998
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
viewCheckout.mainBranch.getHead(),
|
|
922
|
-
targetPath,
|
|
923
|
-
]);
|
|
924
|
-
if (ancestor === undefined) {
|
|
925
|
-
throw new internal_2.UsageError("Branches do not share a common ancestor.");
|
|
926
|
-
}
|
|
927
|
-
return targetPath.length > 0;
|
|
999
|
+
this.#transaction.branch.merge(checkout.#transaction.branch);
|
|
1000
|
+
if (disposeMerged && !checkout.isSharedBranch) {
|
|
1001
|
+
// Dispose the merged checkout unless it is a shared branch.
|
|
1002
|
+
checkout[index_js_6.disposeSymbol]();
|
|
928
1003
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}
|
|
935
|
-
const revision = this.mintRevisionTag();
|
|
936
|
-
return serializedChange_js_1.SerializedChange.V1.encode(this.idCompressor, this.changeFamily, rebased.sourceChange, revision, undefined);
|
|
1004
|
+
}
|
|
1005
|
+
updateSchema(newSchema, allowNonSupersetSchema) {
|
|
1006
|
+
this.checkNotDisposed();
|
|
1007
|
+
if (allowNonSupersetSchema !== true) {
|
|
1008
|
+
(0, internal_1.assert)((0, index_js_3.allowsRepoSuperset)(index_js_3.defaultSchemaPolicy, this.storedSchema.clone(), newSchema), 0xbe6 /* New schema must allow all documents allowed by old schema */);
|
|
937
1009
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
checkout[index_js_6.disposeSymbol]();
|
|
953
|
-
}
|
|
1010
|
+
this.editor.schema.setStoredSchema(this.storedSchema.clone(), newSchema);
|
|
1011
|
+
}
|
|
1012
|
+
dispose() {
|
|
1013
|
+
this.editLock.checkUnlocked("Disposing a view");
|
|
1014
|
+
this[index_js_6.disposeSymbol]();
|
|
1015
|
+
}
|
|
1016
|
+
[(_exportVerbose_decorators = [index_js_6.throwIfBroken], _applySerializedChange_decorators = [index_js_6.throwIfBroken], _applyChange_decorators = [index_js_6.throwIfBroken], _runTransaction_decorators = [index_js_6.breakingMethod], _runTransactionAsync_decorators = [index_js_6.breakingMethod], _withCombinedVisitor_decorators = [index_js_6.breakingMethod], _viewWith_decorators = [index_js_6.throwIfBroken], _fork_decorators = [index_js_6.throwIfBroken], index_js_6.disposeSymbol)]() {
|
|
1017
|
+
this.checkNotDisposed("The branch has already been disposed and cannot be disposed again.");
|
|
1018
|
+
this.disposed = true;
|
|
1019
|
+
this.#transaction.branch.dispose();
|
|
1020
|
+
this.#transaction.dispose();
|
|
1021
|
+
this.purgeRevertibles();
|
|
1022
|
+
for (const view of this.views) {
|
|
1023
|
+
view.dispose();
|
|
954
1024
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1025
|
+
this.#events.emit("dispose");
|
|
1026
|
+
this._branchHistory?.dispose();
|
|
1027
|
+
this._branchHistory = undefined;
|
|
1028
|
+
}
|
|
1029
|
+
getRemovedRoots() {
|
|
1030
|
+
this.assertNoUntrackedRoots();
|
|
1031
|
+
const trees = [];
|
|
1032
|
+
const cursor = this.forest.allocateCursor("getRemovedRoots");
|
|
1033
|
+
for (const { id, root } of this._removedRoots.entries()) {
|
|
1034
|
+
const parentField = this._removedRoots.toFieldKey(root);
|
|
1035
|
+
this.forest.moveCursorToPath({ parent: undefined, parentField, parentIndex: 0 }, cursor);
|
|
1036
|
+
const tree = (0, index_js_3.jsonableTreeFromCursor)(cursor);
|
|
1037
|
+
// This method is used for tree consistency comparison.
|
|
1038
|
+
const { major, minor } = id;
|
|
1039
|
+
const finalizedMajor = major === undefined ? major : this.revisionTagCodec.encode(major);
|
|
1040
|
+
trees.push([finalizedMajor, minor, tree]);
|
|
961
1041
|
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1042
|
+
cursor.free();
|
|
1043
|
+
return trees;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* This must be called on the root/main checkout after loading from a summary.
|
|
1047
|
+
* @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.
|
|
1048
|
+
* Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.
|
|
1049
|
+
*/
|
|
1050
|
+
load() {
|
|
1051
|
+
// Set the tip revision as the latest relevant revision for any removed roots that are loaded from a summary - this allows them to be garbage collected later.
|
|
1052
|
+
// When a load happens, the head of the trunk and the head of the local/main branch must be the same (this is enforced by SharedTree).
|
|
1053
|
+
this._removedRoots.setRevisionsForLoadedData(this.#transaction.branch.getHead().revision);
|
|
1054
|
+
// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.
|
|
1055
|
+
this.#events.emit("afterBatch");
|
|
1056
|
+
}
|
|
1057
|
+
purgeRevertibles() {
|
|
1058
|
+
for (const revertible of this.revertibles.values()) {
|
|
1059
|
+
revertible.dispose();
|
|
965
1060
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
this._branchHistory?.dispose();
|
|
977
|
-
this._branchHistory = undefined;
|
|
1061
|
+
}
|
|
1062
|
+
disposeRevertible(revision) {
|
|
1063
|
+
this.revertibleCommitBranches.get(revision)?.dispose();
|
|
1064
|
+
this.revertibleCommitBranches.delete(revision);
|
|
1065
|
+
this.revertibles.delete(revision);
|
|
1066
|
+
}
|
|
1067
|
+
revertRevertible(revision, kind, labelTree, customMetadata) {
|
|
1068
|
+
this.editLock.checkUnlocked("Reverting a commit");
|
|
1069
|
+
if (this.transaction.size > 0) {
|
|
1070
|
+
throw new internal_2.UsageError("Undo is not yet supported during transactions.");
|
|
978
1071
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
return trees;
|
|
1072
|
+
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
1073
|
+
(0, internal_1.assert)(revertibleBranch !== undefined, 0x7cc /* expected to find a revertible commit */);
|
|
1074
|
+
const commitToRevert = revertibleBranch.getHead();
|
|
1075
|
+
const revisionForInvert = this.mintRevisionTag();
|
|
1076
|
+
let change = (0, index_js_2.tagChange)(this.changeFamily.rebaser.invert(commitToRevert, false, revisionForInvert), revisionForInvert);
|
|
1077
|
+
const headCommit = this.#transaction.branch.getHead();
|
|
1078
|
+
// Rebase the inverted change onto any commits that occurred after the undoable commits.
|
|
1079
|
+
if (commitToRevert !== headCommit) {
|
|
1080
|
+
// The inverse may be rebased over newer commits which (despite being present in the history)
|
|
1081
|
+
// have no net effect on the document state (e.g. an edit plus its undo).
|
|
1082
|
+
// In that case, a no-change constraint should not be violated during rebase.
|
|
1083
|
+
const diff = (0, index_js_2.diffHistories)(this.changeFamily.rebaser, commitToRevert, headCommit, this.mintRevisionTag);
|
|
1084
|
+
const ignoreNoChangeViolation = !sharedTreeChangeHasApplicationFacingChanges(diff);
|
|
1085
|
+
change = (0, index_js_2.tagChange)((0, index_js_2.rebaseChange)(this.changeFamily.rebaser, change, commitToRevert, headCommit, this.mintRevisionTag, ignoreNoChangeViolation).change, revisionForInvert);
|
|
994
1086
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.
|
|
1005
|
-
tslib_1.__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
1087
|
+
// Install the original commit's label tree so the revert commit's metadata inherits
|
|
1088
|
+
// the same labels. Reusing the captured tree (rather than wrapping it) ensures
|
|
1089
|
+
// revert-of-revert does not introduce new nesting.
|
|
1090
|
+
const previousLabelTreeNode = this.labelTreeNode;
|
|
1091
|
+
this.labelTreeNode = labelTree;
|
|
1092
|
+
try {
|
|
1093
|
+
this.#transaction.branch.apply(change, kind === index_js_2.CommitKind.Default || kind === index_js_2.CommitKind.Redo
|
|
1094
|
+
? index_js_2.CommitKind.Undo
|
|
1095
|
+
: index_js_2.CommitKind.Redo, toMetadataTree(customMetadata));
|
|
1006
1096
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
revertible.dispose();
|
|
1010
|
-
}
|
|
1097
|
+
finally {
|
|
1098
|
+
this.labelTreeNode = previousLabelTreeNode;
|
|
1011
1099
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1100
|
+
// Derive some stats about the reversion to return to the caller.
|
|
1101
|
+
let revertAge = 0;
|
|
1102
|
+
let currentCommit = headCommit;
|
|
1103
|
+
while (commitToRevert.revision !== currentCommit.revision) {
|
|
1104
|
+
revertAge++;
|
|
1105
|
+
const parentCommit = currentCommit.parent;
|
|
1106
|
+
(0, internal_1.assert)(parentCommit !== undefined, 0x9a9 /* expected to find a parent commit */);
|
|
1107
|
+
currentCommit = parentCommit;
|
|
1016
1108
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
(
|
|
1024
|
-
const commitToRevert = revertibleBranch.getHead();
|
|
1025
|
-
const revisionForInvert = this.mintRevisionTag();
|
|
1026
|
-
let change = (0, index_js_2.tagChange)(this.changeFamily.rebaser.invert(commitToRevert, false, revisionForInvert), revisionForInvert);
|
|
1027
|
-
const headCommit = tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead();
|
|
1028
|
-
// Rebase the inverted change onto any commits that occurred after the undoable commits.
|
|
1029
|
-
if (commitToRevert !== headCommit) {
|
|
1030
|
-
// The inverse may be rebased over newer commits which (despite being present in the history)
|
|
1031
|
-
// have no net effect on the document state (e.g. an edit plus its undo).
|
|
1032
|
-
// In that case, a no-change constraint should not be violated during rebase.
|
|
1033
|
-
const diff = (0, index_js_2.diffHistories)(this.changeFamily.rebaser, commitToRevert, headCommit, this.mintRevisionTag);
|
|
1034
|
-
const ignoreNoChangeViolation = !sharedTreeChangeHasVisibleChanges(diff);
|
|
1035
|
-
change = (0, index_js_2.tagChange)((0, index_js_2.rebaseChange)(this.changeFamily.rebaser, change, commitToRevert, headCommit, this.mintRevisionTag, ignoreNoChangeViolation).change, revisionForInvert);
|
|
1036
|
-
}
|
|
1037
|
-
// Install the original commit's label tree so the revert commit's metadata inherits
|
|
1038
|
-
// the same labels. Reusing the captured tree (rather than wrapping it) ensures
|
|
1039
|
-
// revert-of-revert does not introduce new nesting.
|
|
1040
|
-
const previousLabelTreeNode = this.labelTreeNode;
|
|
1041
|
-
this.labelTreeNode = labelTree;
|
|
1042
|
-
try {
|
|
1043
|
-
tslib_1.__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.apply(change, kind === index_js_2.CommitKind.Default || kind === index_js_2.CommitKind.Redo
|
|
1044
|
-
? index_js_2.CommitKind.Undo
|
|
1045
|
-
: index_js_2.CommitKind.Redo, toMetadataTree(customMetadata));
|
|
1046
|
-
}
|
|
1047
|
-
finally {
|
|
1048
|
-
this.labelTreeNode = previousLabelTreeNode;
|
|
1049
|
-
}
|
|
1050
|
-
// Derive some stats about the reversion to return to the caller.
|
|
1051
|
-
let revertAge = 0;
|
|
1052
|
-
let currentCommit = headCommit;
|
|
1053
|
-
while (commitToRevert.revision !== currentCommit.revision) {
|
|
1054
|
-
revertAge++;
|
|
1055
|
-
const parentCommit = currentCommit.parent;
|
|
1056
|
-
(0, internal_1.assert)(parentCommit !== undefined, 0x9a9 /* expected to find a parent commit */);
|
|
1057
|
-
currentCommit = parentCommit;
|
|
1058
|
-
}
|
|
1059
|
-
return { age: revertAge };
|
|
1109
|
+
return { age: revertAge };
|
|
1110
|
+
}
|
|
1111
|
+
assertNoUntrackedRoots() {
|
|
1112
|
+
const cursor = this.forest.getCursorAboveDetachedFields();
|
|
1113
|
+
const rootFields = new Set([index_js_2.rootFieldKey]);
|
|
1114
|
+
for (const { root } of this._removedRoots.entries()) {
|
|
1115
|
+
rootFields.add(this._removedRoots.toFieldKey(root));
|
|
1060
1116
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
const rootFields = new Set([index_js_2.rootFieldKey]);
|
|
1064
|
-
for (const { root } of this._removedRoots.entries()) {
|
|
1065
|
-
rootFields.add(this._removedRoots.toFieldKey(root));
|
|
1066
|
-
}
|
|
1067
|
-
if (!cursor.firstField()) {
|
|
1068
|
-
return;
|
|
1069
|
-
}
|
|
1070
|
-
do {
|
|
1071
|
-
const field = cursor.getFieldKey();
|
|
1072
|
-
(0, internal_1.assert)(rootFields.has(field), 0xa22 /* Forest has a root field which is unknown to the detached field index */);
|
|
1073
|
-
rootFields.delete(field);
|
|
1074
|
-
} while (cursor.nextField());
|
|
1117
|
+
if (!cursor.firstField()) {
|
|
1118
|
+
return;
|
|
1075
1119
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1120
|
+
do {
|
|
1121
|
+
const field = cursor.getFieldKey();
|
|
1122
|
+
(0, internal_1.assert)(rootFields.has(field), 0xa22 /* Forest has a root field which is unknown to the detached field index */);
|
|
1123
|
+
rootFields.delete(field);
|
|
1124
|
+
} while (cursor.nextField());
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* `true` iff the given branch change event is due to a remote change
|
|
1128
|
+
*/
|
|
1129
|
+
isRemoteChangeEvent(event) {
|
|
1130
|
+
return (
|
|
1131
|
+
// Remote changes are only ever applied to shared branches
|
|
1132
|
+
this.isSharedBranch &&
|
|
1133
|
+
// Remote changes are applied to the branch by rebasing it onto the trunk.
|
|
1134
|
+
// No other rebases are allowed on shared branches, so we can use this to detect remote changes.
|
|
1135
|
+
event.type === "rebase");
|
|
1136
|
+
}
|
|
1137
|
+
// #region Commit Validation
|
|
1138
|
+
/** Used to maintain the contract of {@link onCommitValid}(). */
|
|
1139
|
+
#validatedCommits = new WeakMap();
|
|
1140
|
+
/**
|
|
1141
|
+
* Registers a function to be called when the given commit is validated.
|
|
1142
|
+
* @remarks A commit is validated by the checkout after it has been applied to the checkout's state (e.g. it has an effect on the forest).
|
|
1143
|
+
* If the commit applies successfully (i.e. it does not raise any unexpected errors), the commit is considered valid and the registered function is called.
|
|
1144
|
+
* If the commit does not apply successfully (because it causes an unexpected error), the function is not called (and the checkout will left in an error state).
|
|
1145
|
+
*
|
|
1146
|
+
* If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.
|
|
1147
|
+
* Otherwise, the function is registered to be called later and this function returns `false`.
|
|
1148
|
+
*/
|
|
1149
|
+
onCommitValid(commit, fn) {
|
|
1150
|
+
const validated = (0, index_js_6.getOrCreate)(this.#validatedCommits, commit, () => []);
|
|
1151
|
+
if (validated === true) {
|
|
1152
|
+
fn(commit);
|
|
1153
|
+
return true;
|
|
1086
1154
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
*/
|
|
1096
|
-
onCommitValid(commit, fn) {
|
|
1097
|
-
const validated = (0, index_js_6.getOrCreate)(tslib_1.__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
1098
|
-
if (validated === true) {
|
|
1155
|
+
validated.push(fn);
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
/** Mark the given commit as "validated" according to the contract of {@link onCommitValid}(). */
|
|
1159
|
+
validateCommit(commit) {
|
|
1160
|
+
const validated = (0, index_js_6.getOrCreate)(this.#validatedCommits, commit, () => []);
|
|
1161
|
+
if (validated !== true) {
|
|
1162
|
+
for (const fn of validated) {
|
|
1099
1163
|
fn(commit);
|
|
1100
|
-
return true;
|
|
1101
|
-
}
|
|
1102
|
-
validated.push(fn);
|
|
1103
|
-
return false;
|
|
1104
|
-
}
|
|
1105
|
-
/** Mark the given commit as "validated" according to the contract of {@link onCommitValid}(). */
|
|
1106
|
-
validateCommit(commit) {
|
|
1107
|
-
const validated = (0, index_js_6.getOrCreate)(tslib_1.__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
1108
|
-
if (validated !== true) {
|
|
1109
|
-
for (const fn of validated) {
|
|
1110
|
-
fn(commit);
|
|
1111
|
-
}
|
|
1112
|
-
tslib_1.__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f").set(commit, true);
|
|
1113
1164
|
}
|
|
1165
|
+
this.#validatedCommits.set(commit, true);
|
|
1114
1166
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1167
|
+
}
|
|
1168
|
+
// #endregion Commit Validation
|
|
1169
|
+
// #region Enrichment
|
|
1170
|
+
/**
|
|
1171
|
+
* Statistics about enrichment operations performed by this checkout.
|
|
1172
|
+
* Used for testing. May be used for telemetry in the future.
|
|
1173
|
+
* The performance cost of maintaining this information is negligible.
|
|
1174
|
+
*/
|
|
1175
|
+
enrichmentStats = { batches: 0, diffs: 0, commitsEnriched: 0, refreshers: 0, forks: 0, applied: 0 };
|
|
1176
|
+
resetEnrichmentStats() {
|
|
1177
|
+
this.enrichmentStats.batches = 0;
|
|
1178
|
+
this.enrichmentStats.diffs = 0;
|
|
1179
|
+
this.enrichmentStats.commitsEnriched = 0;
|
|
1180
|
+
this.enrichmentStats.refreshers = 0;
|
|
1181
|
+
this.enrichmentStats.forks = 0;
|
|
1182
|
+
this.enrichmentStats.applied = 0;
|
|
1183
|
+
}
|
|
1184
|
+
getEnrichmentStats() {
|
|
1185
|
+
return { ...this.enrichmentStats };
|
|
1186
|
+
}
|
|
1187
|
+
enrich(context, changes, forceValidation) {
|
|
1188
|
+
if (!(0, index_js_6.hasSome)(changes)) {
|
|
1189
|
+
return [];
|
|
1122
1190
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1191
|
+
this.enrichmentStats.batches += 1;
|
|
1192
|
+
const enricher = new sharedTreeChangeEnricher_js_1.SharedTreeChangeEnricher(this.forest, this._removedRoots, this.storedSchema, this.idCompressor, () => (this.enrichmentStats.commitsEnriched += 1), () => (this.enrichmentStats.refreshers += 1), () => (this.enrichmentStats.forks += 1), () => (this.enrichmentStats.applied += 1));
|
|
1193
|
+
// This `lastCommitApplied` may be on the main branch or on a transaction branch.
|
|
1194
|
+
// In either case, it is crucial that the state of the forest & detached field index reflects all changes up to and including this commit.
|
|
1195
|
+
const lastCommitApplied = this.#transaction.activeBranch.getHead();
|
|
1196
|
+
if (context !== lastCommitApplied) {
|
|
1197
|
+
enricher.enqueueChange(() => {
|
|
1198
|
+
this.enrichmentStats.diffs += 1;
|
|
1199
|
+
const diff = (0, index_js_2.diffHistories)(this.changeFamily.rebaser, lastCommitApplied, context, this.mintRevisionTag);
|
|
1200
|
+
return (0, index_js_2.makeAnonChange)(diff);
|
|
1201
|
+
});
|
|
1125
1202
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
// This
|
|
1133
|
-
//
|
|
1134
|
-
|
|
1135
|
-
if (context !== lastCommitApplied) {
|
|
1136
|
-
enricher.enqueueChange(() => {
|
|
1137
|
-
this.enrichmentStats.diffs += 1;
|
|
1138
|
-
const diff = (0, index_js_2.diffHistories)(this.changeFamily.rebaser, lastCommitApplied, context, this.mintRevisionTag);
|
|
1139
|
-
return (0, index_js_2.makeAnonChange)(diff);
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
|
-
const enrichedChanges = [];
|
|
1143
|
-
for (const change of changes) {
|
|
1144
|
-
const enrichedChange = enricher.enrich(change.change);
|
|
1145
|
-
enrichedChanges.push(enrichedChange);
|
|
1146
|
-
// We could either apply the original or the enriched change: either should allow subsequent changes to be enriched correctly.
|
|
1147
|
-
// We choose to apply the enriched change in order to more closely replicate what a peer will experience (assuming no concurrent changes).
|
|
1148
|
-
// This makes it more likely that we'll detect a bug in the enrichment logic.
|
|
1149
|
-
// Note that enqueueing the change does not guarantee that it will be applied unless `forceValidation` is enabled.
|
|
1150
|
-
enricher.enqueueChange((0, index_js_2.tagChange)(enrichedChange, change.revision));
|
|
1151
|
-
}
|
|
1152
|
-
if (forceValidation) {
|
|
1153
|
-
// Ensure that all changes can be applied successfully.
|
|
1154
|
-
// This is useful for catching bugs in the enrichment logic and in the rebasing logic that may have been involved in producing the changes.
|
|
1155
|
-
// Note that we cannot guarantee that the enriched change will be applied successfully even in the absence of concurrent changes,
|
|
1156
|
-
// because the checkout state we are applying this enriched change to was derived from the state of the checkout, which may be different from that of a peer.
|
|
1157
|
-
enricher.purgeChangeQueue();
|
|
1158
|
-
}
|
|
1159
|
-
enricher[index_js_6.disposeSymbol]();
|
|
1160
|
-
return enrichedChanges;
|
|
1203
|
+
const enrichedChanges = [];
|
|
1204
|
+
for (const change of changes) {
|
|
1205
|
+
const enrichedChange = enricher.enrich(change.change);
|
|
1206
|
+
enrichedChanges.push(enrichedChange);
|
|
1207
|
+
// We could either apply the original or the enriched change: either should allow subsequent changes to be enriched correctly.
|
|
1208
|
+
// We choose to apply the enriched change in order to more closely replicate what a peer will experience (assuming no concurrent changes).
|
|
1209
|
+
// This makes it more likely that we'll detect a bug in the enrichment logic.
|
|
1210
|
+
// Note that enqueueing the change does not guarantee that it will be applied unless `forceValidation` is enabled.
|
|
1211
|
+
enricher.enqueueChange((0, index_js_2.tagChange)(enrichedChange, change.revision));
|
|
1161
1212
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1213
|
+
if (forceValidation) {
|
|
1214
|
+
// Ensure that all changes can be applied successfully.
|
|
1215
|
+
// This is useful for catching bugs in the enrichment logic and in the rebasing logic that may have been involved in producing the changes.
|
|
1216
|
+
// Note that we cannot guarantee that the enriched change will be applied successfully even in the absence of concurrent changes,
|
|
1217
|
+
// because the checkout state we are applying this enriched change to was derived from the state of the checkout, which may be different from that of a peer.
|
|
1218
|
+
enricher.purgeChangeQueue();
|
|
1164
1219
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
tslib_1.__esDecorate(_a, null, _runTransactionAsync_decorators, { kind: "method", name: "runTransactionAsync", static: false, private: false, access: { has: obj => "runTransactionAsync" in obj, get: obj => obj.runTransactionAsync }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1173
|
-
tslib_1.__esDecorate(_a, null, _withCombinedVisitor_decorators, { kind: "method", name: "withCombinedVisitor", static: false, private: false, access: { has: obj => "withCombinedVisitor" in obj, get: obj => obj.withCombinedVisitor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1174
|
-
tslib_1.__esDecorate(_a, null, _viewWith_decorators, { kind: "method", name: "viewWith", static: false, private: false, access: { has: obj => "viewWith" in obj, get: obj => obj.viewWith }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1175
|
-
tslib_1.__esDecorate(_a, null, _fork_decorators, { kind: "method", name: "fork", static: false, private: false, access: { has: obj => "fork" in obj, get: obj => obj.fork }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1176
|
-
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1177
|
-
})(),
|
|
1178
|
-
/**
|
|
1179
|
-
* The name of the telemetry event logged for calls to {@link TreeCheckout.revertRevertible}.
|
|
1180
|
-
* @privateRemarks Exposed for testing purposes.
|
|
1181
|
-
*/
|
|
1182
|
-
_a.revertTelemetryEventName = "RevertRevertible",
|
|
1183
|
-
_a;
|
|
1220
|
+
enricher[index_js_6.disposeSymbol]();
|
|
1221
|
+
return enrichedChanges;
|
|
1222
|
+
}
|
|
1223
|
+
get mainBranch() {
|
|
1224
|
+
return this.#transaction.branch;
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1184
1227
|
})();
|
|
1185
1228
|
exports.TreeCheckout = TreeCheckout;
|
|
1229
|
+
function getSchemaChangeTelemetryMetrics(oldSchema, newSchema, isInverse) {
|
|
1230
|
+
let addedNodeSchemaCount = 0;
|
|
1231
|
+
for (const identifier of newSchema.nodeSchema.keys()) {
|
|
1232
|
+
if (!oldSchema.nodeSchema.has(identifier)) {
|
|
1233
|
+
addedNodeSchemaCount++;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
let removedNodeSchemaCount = 0;
|
|
1237
|
+
for (const identifier of oldSchema.nodeSchema.keys()) {
|
|
1238
|
+
if (!newSchema.nodeSchema.has(identifier)) {
|
|
1239
|
+
removedNodeSchemaCount++;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
return {
|
|
1243
|
+
changeKind: isInverse
|
|
1244
|
+
? "rollback"
|
|
1245
|
+
: oldSchema.nodeSchema.size === 0
|
|
1246
|
+
? "initialize"
|
|
1247
|
+
: (0, index_js_3.allowsRepoSuperset)(index_js_3.defaultSchemaPolicy, oldSchema, newSchema)
|
|
1248
|
+
? "upgrade"
|
|
1249
|
+
: "restriction",
|
|
1250
|
+
isInverse,
|
|
1251
|
+
oldNodeSchemaCount: oldSchema.nodeSchema.size,
|
|
1252
|
+
newNodeSchemaCount: newSchema.nodeSchema.size,
|
|
1253
|
+
addedNodeSchemaCount,
|
|
1254
|
+
removedNodeSchemaCount,
|
|
1255
|
+
rootFieldKindChanged: oldSchema.rootFieldSchema.kind !== newSchema.rootFieldSchema.kind,
|
|
1256
|
+
oldRootAllowedTypeCount: oldSchema.rootFieldSchema.types.size,
|
|
1257
|
+
newRootAllowedTypeCount: newSchema.rootFieldSchema.types.size,
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1186
1260
|
/**
|
|
1187
1261
|
* A helper class that assists {@link TreeCheckout} in preventing functionality from being used while the tree is in the middle of being edited.
|
|
1188
1262
|
*/
|
|
1189
1263
|
class EditLock {
|
|
1264
|
+
/**
|
|
1265
|
+
* Edits the tree by calling the methods of the editor passed into the {@link EditLock} constructor.
|
|
1266
|
+
* @remarks Edits will throw an error if the lock is currently locked.
|
|
1267
|
+
*/
|
|
1268
|
+
editor;
|
|
1269
|
+
/**
|
|
1270
|
+
* The current status of the lock.
|
|
1271
|
+
* The `reason` string will be included in the error message if an attempt is made to edit the tree while the lock is held.
|
|
1272
|
+
*/
|
|
1273
|
+
status = { isLocked: false };
|
|
1190
1274
|
/**
|
|
1191
1275
|
* @param editor - an editor which will be used to create a new editor that is monitored to determine if any changes are happening to the tree.
|
|
1192
1276
|
* Use {@link EditLock.editor} in place of the original editor to ensure that changes are monitored.
|
|
1193
1277
|
*/
|
|
1194
1278
|
constructor(editor) {
|
|
1195
|
-
/**
|
|
1196
|
-
* The current status of the lock.
|
|
1197
|
-
* The `reason` string will be included in the error message if an attempt is made to edit the tree while the lock is held.
|
|
1198
|
-
*/
|
|
1199
|
-
this.status = { isLocked: false };
|
|
1200
1279
|
const checkLock = () => this.checkUnlocked("Editing the tree");
|
|
1201
1280
|
this.editor = {
|
|
1202
1281
|
get schema() {
|
|
@@ -1294,19 +1373,19 @@ function verboseFromCursor(reader, schema) {
|
|
|
1294
1373
|
};
|
|
1295
1374
|
}
|
|
1296
1375
|
/**
|
|
1297
|
-
*
|
|
1298
|
-
* This function also considers changes to detached roots to be visible changes, but not renames of roots or builds of new roots.
|
|
1376
|
+
* Whether the change contains any application-facing changes.
|
|
1299
1377
|
*
|
|
1300
1378
|
* @param change - The change to analyze.
|
|
1301
|
-
* @returns True if the change contains any schema changes or any field changes
|
|
1379
|
+
* @returns True if the change contains any schema changes or any field changes (either in the document tree or in detached trees), false otherwise.
|
|
1302
1380
|
*/
|
|
1303
|
-
function
|
|
1381
|
+
function sharedTreeChangeHasApplicationFacingChanges(change) {
|
|
1304
1382
|
for (const inner of change.changes) {
|
|
1305
1383
|
if (inner.type === "schema") {
|
|
1306
1384
|
return true;
|
|
1307
1385
|
}
|
|
1308
1386
|
const delta = (0, index_js_3.intoDelta)((0, index_js_2.tagChange)(inner.innerChange, undefined));
|
|
1309
|
-
|
|
1387
|
+
const profile = (0, index_js_2.getDeltaChangeProfile)(delta);
|
|
1388
|
+
if (profile.hasChangesInDocumentTree || profile.hasChangesInDetachedTrees) {
|
|
1310
1389
|
return true;
|
|
1311
1390
|
}
|
|
1312
1391
|
}
|