@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
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { deltaFieldMapHasChanges, makeAnonChange, makeChangeAtomId, makeDetachedFieldIndex, newChangeAtomIdRangeMap, newChangeAtomIdTransform, offsetChangeAtomId, visitDelta, } from "../../core/index.js";
|
|
6
|
+
import { brand, hasSingle, setInNestedMap, } from "../../util/index.js";
|
|
7
|
+
import { getFromChangeAtomIdMap, newChangeAtomIdBTree, setInChangeAtomIdMap, } from "../changeAtomIdBTree.js";
|
|
8
|
+
import { CrossFieldTarget } from "./crossFieldQueries.js";
|
|
9
|
+
import { EditFilterStatus, NodeAttachState, } from "./fieldChangeHandler.js";
|
|
10
|
+
import { filterEdits } from "./filterEdits.js";
|
|
11
|
+
import { invertModularChange } from "./invert.js";
|
|
12
|
+
import { intoDelta } from "./modularChangeFamily.js";
|
|
13
|
+
import { getChangeHandler, nodeChangeFromId, normalizeNodeId, validateChangeset, } from "./modularChangeUtils.js";
|
|
14
|
+
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
5
15
|
/**
|
|
6
16
|
* "Minimizes" a {@link ModularChangeset} so that it contains no extraneous
|
|
7
17
|
* information, i.e. no new content that isn't observable from document tree
|
|
@@ -11,15 +21,455 @@
|
|
|
11
21
|
* transaction, or changes whose effects cancel out to nothing. Minimizing reduces the size of an edit without altering
|
|
12
22
|
* its observable effect.
|
|
13
23
|
*
|
|
14
|
-
* This is the eventual home of the minimization algorithm, colocated with {@link ModularChangeFamily} so it can use its
|
|
15
|
-
* internals. It is currently a no-op that returns the change unchanged; a real implementation will be provided in a
|
|
16
|
-
* future change.
|
|
17
|
-
*
|
|
18
24
|
* @param change - The change to minimize.
|
|
19
|
-
* @param
|
|
25
|
+
* @param fieldKinds - The field kinds used in the changeset.
|
|
26
|
+
* @param forestFactory - A function that returns a new forest instance.
|
|
27
|
+
*/
|
|
28
|
+
export function minimizeModularChangeset(change, fieldKinds, forestFactory) {
|
|
29
|
+
return new ModularChangeMinimizer(change, fieldKinds).minimize(forestFactory);
|
|
30
|
+
}
|
|
31
|
+
class ModularChangeMinimizer {
|
|
32
|
+
change;
|
|
33
|
+
fieldKinds;
|
|
34
|
+
builtNodeIds;
|
|
35
|
+
builtRootIds;
|
|
36
|
+
outputAttachStates;
|
|
37
|
+
outputToInputRootId;
|
|
38
|
+
rootIdToNodeId;
|
|
39
|
+
attachedRootIds;
|
|
40
|
+
constructor(change, fieldKinds) {
|
|
41
|
+
this.change = change;
|
|
42
|
+
this.fieldKinds = fieldKinds;
|
|
43
|
+
this.outputAttachStates = getOutputNodeAttachStates(change, fieldKinds);
|
|
44
|
+
const nodeInfo = getNodeInfo(change, fieldKinds);
|
|
45
|
+
this.builtNodeIds = nodeInfo.builtNodeIds;
|
|
46
|
+
this.builtRootIds = nodeInfo.builtRootIds;
|
|
47
|
+
this.rootIdToNodeId = nodeInfo.rootIdToNodeId;
|
|
48
|
+
const delta = intoDelta(makeAnonChange(change), fieldKinds);
|
|
49
|
+
this.outputToInputRootId = outputToInputRootIdFromDelta(delta);
|
|
50
|
+
this.attachedRootIds = collectAttachedRootIds(delta, this.outputToInputRootId);
|
|
51
|
+
}
|
|
52
|
+
minimize(forestFactory) {
|
|
53
|
+
const residualChange = filterEdits(this.change, this.filterEditsForResidualChange.bind(this), this.fieldKinds);
|
|
54
|
+
residualChange.builds = this.squashBuilds(forestFactory);
|
|
55
|
+
validateChangeset(residualChange, this.fieldKinds);
|
|
56
|
+
return residualChange;
|
|
57
|
+
}
|
|
58
|
+
isNodeIdInBuiltTree(nodeId) {
|
|
59
|
+
return (nodeId !== undefined &&
|
|
60
|
+
getFromChangeAtomIdMap(this.builtNodeIds, normalizeNodeId(nodeId, this.change.nodeAliases)) === true);
|
|
61
|
+
}
|
|
62
|
+
isNodeDetachedInOutput(nodeId) {
|
|
63
|
+
return ((getFromChangeAtomIdMap(this.outputAttachStates, normalizeNodeId(nodeId, this.change.nodeAliases)) ?? fail(0xd37 /* Should have attach state for every node ID */)) ===
|
|
64
|
+
NodeAttachState.Detached);
|
|
65
|
+
}
|
|
66
|
+
isFieldDetachedInOutput(fieldId) {
|
|
67
|
+
return fieldId.nodeId !== undefined && this.isNodeDetachedInOutput(fieldId.nodeId);
|
|
68
|
+
}
|
|
69
|
+
shouldSquashDetach(fieldId, inputRootId) {
|
|
70
|
+
// `inputRootId === undefined` indicates that this is a move of a transiently attached built root.
|
|
71
|
+
// In that case, we convert the move to an insert at the final location, discarding the detach portion.
|
|
72
|
+
return this.isNodeIdInBuiltTree(fieldId.nodeId) && inputRootId === undefined;
|
|
73
|
+
}
|
|
74
|
+
shouldSquashAttach(fieldId, rootInputId, count, endpoint) {
|
|
75
|
+
if (!this.isNodeIdInBuiltTree(fieldId.nodeId)) {
|
|
76
|
+
return { value: false, length: count };
|
|
77
|
+
}
|
|
78
|
+
let countProcessed = count;
|
|
79
|
+
const isMoveOfBuiltRootEntry = this.builtRootIds.getFirst(rootInputId, countProcessed);
|
|
80
|
+
countProcessed = isMoveOfBuiltRootEntry.length;
|
|
81
|
+
const isAttachOfBuiltRoot = isMoveOfBuiltRootEntry?.value ?? false;
|
|
82
|
+
const isMoveFromBuiltTree = endpoint?.nodeId !== undefined && this.isNodeIdInBuiltTree(endpoint.nodeId);
|
|
83
|
+
const isAttachOfBuiltNode = isAttachOfBuiltRoot || isMoveFromBuiltTree;
|
|
84
|
+
return { value: isAttachOfBuiltNode, length: countProcessed };
|
|
85
|
+
}
|
|
86
|
+
shouldDropAttach(fieldId, rootInputId, count, endpoint) {
|
|
87
|
+
const isInDetachedTree = this.isFieldDetachedInOutput(fieldId);
|
|
88
|
+
let countProcessed = count;
|
|
89
|
+
const shouldSquashAttachEntry = this.shouldSquashAttach(fieldId, rootInputId, countProcessed, endpoint);
|
|
90
|
+
countProcessed = shouldSquashAttachEntry.length;
|
|
91
|
+
const isBuiltRootEntry = this.builtRootIds.getFirst(rootInputId, countProcessed);
|
|
92
|
+
countProcessed = isBuiltRootEntry.length;
|
|
93
|
+
const isAttachOfBuild = isBuiltRootEntry.value ??
|
|
94
|
+
(endpoint !== undefined && this.isNodeIdInBuiltTree(endpoint.nodeId));
|
|
95
|
+
const isAttachedRootEntry = this.attachedRootIds.getFirst(rootInputId, countProcessed);
|
|
96
|
+
countProcessed = isAttachedRootEntry.length;
|
|
97
|
+
const isTransientAttachOfBuild = isAttachOfBuild && !isAttachedRootEntry.value;
|
|
98
|
+
return {
|
|
99
|
+
value: isInDetachedTree || shouldSquashAttachEntry.value || isTransientAttachOfBuild,
|
|
100
|
+
length: countProcessed,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
shouldDropDetach(fieldId, detachId, rootInputId, count, endpoint) {
|
|
104
|
+
let countProcessed = count;
|
|
105
|
+
if (this.shouldSquashDetach(fieldId, rootInputId)) {
|
|
106
|
+
return { value: true, length: countProcessed };
|
|
107
|
+
}
|
|
108
|
+
if (rootInputId !== undefined) {
|
|
109
|
+
// `inputRootId` is defined when this detach represents the rename of a detached root.
|
|
110
|
+
const isDetachOfBuiltRootEntry = this.builtRootIds.getFirst(rootInputId, countProcessed);
|
|
111
|
+
countProcessed = isDetachOfBuiltRootEntry.length;
|
|
112
|
+
const isDetachOfBuiltRoot = isDetachOfBuiltRootEntry.value !== undefined;
|
|
113
|
+
if (isDetachOfBuiltRoot)
|
|
114
|
+
// If this is a rename of a built node, either it ends detached, or is moved elsewhere.
|
|
115
|
+
// If moved, we squash the detach away, leaving only an attach at the destination.
|
|
116
|
+
// If detached, the build is not used, so we drop the rename.
|
|
117
|
+
return {
|
|
118
|
+
value: true,
|
|
119
|
+
length: countProcessed,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (endpoint !== undefined) {
|
|
123
|
+
const shouldDropAttachEntry = this.shouldDropAttach(endpoint, rootInputId ?? detachId, countProcessed, fieldId);
|
|
124
|
+
countProcessed = shouldDropAttachEntry.length;
|
|
125
|
+
if (!shouldDropAttachEntry.value) {
|
|
126
|
+
// This detach is part of a move, and we are not dropping the attach, so we must preserve the detach as well.
|
|
127
|
+
return { value: false, length: countProcessed };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return { value: this.isFieldDetachedInOutput(fieldId), length: countProcessed };
|
|
131
|
+
}
|
|
132
|
+
filterEditsForBuildChange(fieldChange, fieldId) {
|
|
133
|
+
return {
|
|
134
|
+
...fieldChange,
|
|
135
|
+
change: brand(getChangeHandler(this.fieldKinds, fieldChange.fieldKind).rebaser.filterEdits(fieldChange.change, {
|
|
136
|
+
filterDetach: (detachId, count, inputRootId, endpoint) => this.filterDetachForBuildChange(fieldId, detachId, count, inputRootId, endpoint),
|
|
137
|
+
filterAttach: (id, count, _outputRootId, endpoint) => this.filterAttachForBuildChange(fieldId, id, count, endpoint),
|
|
138
|
+
preserveOtherEdits: false,
|
|
139
|
+
})),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
filterDetachForBuildChange(fieldId, detachId, count, inputRootId, endpoint) {
|
|
143
|
+
if (!this.shouldSquashDetach(fieldId, inputRootId)) {
|
|
144
|
+
return {
|
|
145
|
+
value: { action: EditFilterStatus.Remove, shouldRemoveChild: false },
|
|
146
|
+
length: count,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
let countProcessed = count;
|
|
150
|
+
const moveEndpointEntry = this.change.crossFieldKeys.getFirst({ ...(endpoint ?? detachId), target: CrossFieldTarget.Destination }, countProcessed);
|
|
151
|
+
countProcessed = moveEndpointEntry.length;
|
|
152
|
+
if (moveEndpointEntry.value !== undefined) {
|
|
153
|
+
const willSquashEndpointEntry = this.shouldSquashAttach(moveEndpointEntry.value, inputRootId ?? detachId, countProcessed, fieldId);
|
|
154
|
+
countProcessed = willSquashEndpointEntry.length;
|
|
155
|
+
const action = willSquashEndpointEntry.value
|
|
156
|
+
? EditFilterStatus.Preserve
|
|
157
|
+
: EditFilterStatus.PreserveWithoutMove;
|
|
158
|
+
return { value: { action }, length: countProcessed };
|
|
159
|
+
}
|
|
160
|
+
return { value: { action: EditFilterStatus.Preserve }, length: countProcessed };
|
|
161
|
+
}
|
|
162
|
+
filterAttachForBuildChange(fieldId, id, count, endpoint) {
|
|
163
|
+
let countProcessed = count;
|
|
164
|
+
const moveId = endpoint ?? id;
|
|
165
|
+
const moveEndpointEntry = this.change.crossFieldKeys.getFirst({ ...moveId, target: CrossFieldTarget.Source }, countProcessed);
|
|
166
|
+
countProcessed = moveEndpointEntry.length;
|
|
167
|
+
const inputIdEntry = this.outputToInputRootId.getFirst(moveId, countProcessed);
|
|
168
|
+
countProcessed = inputIdEntry.length;
|
|
169
|
+
const rootInputId = inputIdEntry.value ?? moveId;
|
|
170
|
+
const shouldSquashEntry = this.shouldSquashAttach(fieldId, rootInputId, countProcessed, moveEndpointEntry.value);
|
|
171
|
+
countProcessed = shouldSquashEntry.length;
|
|
172
|
+
const isMove = moveEndpointEntry.value !== undefined;
|
|
173
|
+
if (!shouldSquashEntry.value) {
|
|
174
|
+
return { value: { action: EditFilterStatus.Remove }, length: countProcessed };
|
|
175
|
+
}
|
|
176
|
+
if (isMove) {
|
|
177
|
+
const movedNodeId = getFromChangeAtomIdMap(this.rootIdToNodeId, moveId);
|
|
178
|
+
return {
|
|
179
|
+
value: {
|
|
180
|
+
action: EditFilterStatus.PreserveWithoutMove,
|
|
181
|
+
nodeId: movedNodeId,
|
|
182
|
+
newAttachId: rootInputId,
|
|
183
|
+
},
|
|
184
|
+
length: countProcessed,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
value: { action: EditFilterStatus.Preserve },
|
|
189
|
+
length: countProcessed,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Returns a version of `fieldChange` to be used in the final minimized change.
|
|
194
|
+
* The filtered change will have dropped:
|
|
195
|
+
* - Edits which were squashed into the built trees.
|
|
196
|
+
* - Detaches of built roots. If part of a move, these are instead represented as an attach at the final location.
|
|
197
|
+
* - Edits to nodes which are detached in the output, except for detaches of content which does end attached.
|
|
198
|
+
*/
|
|
199
|
+
filterEditsForResidualChange(fieldChange, fieldId) {
|
|
200
|
+
return {
|
|
201
|
+
...fieldChange,
|
|
202
|
+
change: brand(getChangeHandler(this.fieldKinds, fieldChange.fieldKind).rebaser.filterEdits(fieldChange.change, {
|
|
203
|
+
filterDetach: (...args) => this.filterDetachForResidualChange(fieldId, ...args),
|
|
204
|
+
filterAttach: (...args) => this.filterAttachForResidualChange(fieldId, ...args),
|
|
205
|
+
preserveOtherEdits: false,
|
|
206
|
+
})),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
filterDetachForResidualChange(fieldId, detachId, count, inputRootId, endpoint) {
|
|
210
|
+
let countProcessed = count;
|
|
211
|
+
const moveId = endpoint ?? detachId;
|
|
212
|
+
const moveEndpointEntry = this.change.crossFieldKeys.getFirst({ ...moveId, target: CrossFieldTarget.Destination }, count);
|
|
213
|
+
countProcessed = moveEndpointEntry.length;
|
|
214
|
+
const shouldDropEntry = this.shouldDropDetach(fieldId, detachId, inputRootId, countProcessed, moveEndpointEntry.value);
|
|
215
|
+
countProcessed = shouldDropEntry.length;
|
|
216
|
+
let hasPreservedAttach = false;
|
|
217
|
+
let hasDroppedAttach = false;
|
|
218
|
+
if (moveEndpointEntry.value !== undefined) {
|
|
219
|
+
const willDropAttachEntry = this.shouldDropAttach(moveEndpointEntry.value, inputRootId ?? detachId, countProcessed, fieldId);
|
|
220
|
+
countProcessed = willDropAttachEntry.length;
|
|
221
|
+
hasDroppedAttach = willDropAttachEntry.value;
|
|
222
|
+
hasPreservedAttach = !willDropAttachEntry.value;
|
|
223
|
+
}
|
|
224
|
+
if (shouldDropEntry.value) {
|
|
225
|
+
// If there is a preserved attach, we will represent any child change at that location,
|
|
226
|
+
// so we must remove them from here.
|
|
227
|
+
return {
|
|
228
|
+
value: { action: EditFilterStatus.Remove, shouldRemoveChild: hasPreservedAttach },
|
|
229
|
+
length: countProcessed,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
value: {
|
|
234
|
+
action: hasDroppedAttach
|
|
235
|
+
? EditFilterStatus.PreserveWithoutMove
|
|
236
|
+
: EditFilterStatus.Preserve,
|
|
237
|
+
},
|
|
238
|
+
length: countProcessed,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
filterAttachForResidualChange(fieldId, id, count, outputRootId, endpoint) {
|
|
242
|
+
let countProcessed = count;
|
|
243
|
+
const moveId = endpoint ?? id;
|
|
244
|
+
const moveEndpointEntry = this.change.crossFieldKeys.getFirst({ ...moveId, target: CrossFieldTarget.Source }, countProcessed);
|
|
245
|
+
countProcessed = moveEndpointEntry.length;
|
|
246
|
+
const inputIdEntry = this.outputToInputRootId.getFirst(moveId, countProcessed);
|
|
247
|
+
countProcessed = inputIdEntry.length;
|
|
248
|
+
const rootInputId = inputIdEntry.value ?? moveId;
|
|
249
|
+
const shouldDropEntry = this.shouldDropAttach(fieldId, rootInputId, countProcessed, moveEndpointEntry.value);
|
|
250
|
+
countProcessed = shouldDropEntry.length;
|
|
251
|
+
if (shouldDropEntry.value) {
|
|
252
|
+
return {
|
|
253
|
+
value: { action: EditFilterStatus.Remove },
|
|
254
|
+
length: countProcessed,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
if (moveEndpointEntry.value !== undefined) {
|
|
258
|
+
const willDropEndpointEntry = this.shouldDropDetach(moveEndpointEntry.value, moveId, inputIdEntry.value, countProcessed, fieldId);
|
|
259
|
+
countProcessed = willDropEndpointEntry.length;
|
|
260
|
+
if (willDropEndpointEntry.value) {
|
|
261
|
+
const movedNodeId = getFromChangeAtomIdMap(this.rootIdToNodeId, moveId);
|
|
262
|
+
return {
|
|
263
|
+
value: {
|
|
264
|
+
action: EditFilterStatus.PreserveWithoutMove,
|
|
265
|
+
nodeId: movedNodeId,
|
|
266
|
+
newAttachId: inputIdEntry.value ?? moveId,
|
|
267
|
+
},
|
|
268
|
+
length: countProcessed,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
value: { action: EditFilterStatus.Preserve },
|
|
274
|
+
length: countProcessed,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
squashBuilds(forestFactory) {
|
|
278
|
+
const changeForBuilds = filterEdits(this.change, this.filterEditsForBuildChange.bind(this), this.fieldKinds);
|
|
279
|
+
const deltaForBuilds = intoDelta(makeAnonChange(changeForBuilds), this.fieldKinds);
|
|
280
|
+
assert(!deltaFieldMapHasChanges(deltaForBuilds.fields), 0xd38 /* Expected all changes to attached tree to be filtered out */);
|
|
281
|
+
// There may still be paths to existing nodes in the delta, which must be removed before being applied to an empty forest.
|
|
282
|
+
// It is safe to remove these, because there are no edits to them, as asserted above.
|
|
283
|
+
deltaForBuilds.fields = new Map();
|
|
284
|
+
const forest = forestFactory();
|
|
285
|
+
const detachedFieldIndex = makeDetachedFieldIndex();
|
|
286
|
+
visitDelta(deltaForBuilds, forest.acquireVisitor(), detachedFieldIndex, undefined);
|
|
287
|
+
const squashedBuilds = newChangeAtomIdBTree();
|
|
288
|
+
const cursor = forest.getCursorAboveDetachedFields();
|
|
289
|
+
for (const entry of detachedFieldIndex.entries()) {
|
|
290
|
+
cursor.enterField(detachedFieldIndex.toFieldKey(entry.root));
|
|
291
|
+
const chunks = forest.chunkField(cursor);
|
|
292
|
+
// Delta visiting currently splits ranges of nodes into individual elements,
|
|
293
|
+
// so for now we will not have more than one node in a detached field.
|
|
294
|
+
assert(hasSingle(chunks), 0xd39 /* TODO: Handle multiple chunks */);
|
|
295
|
+
const chunk = chunks[0];
|
|
296
|
+
assert(chunk.topLevelLength === 1, 0xd3a /* TODO: Handle chunk with range of nodes */);
|
|
297
|
+
const rootId = {
|
|
298
|
+
revision: entry.id.major,
|
|
299
|
+
localId: brand(entry.id.minor),
|
|
300
|
+
};
|
|
301
|
+
const isAttachedEntry = this.attachedRootIds.getFirst(rootId, chunk.topLevelLength);
|
|
302
|
+
assert(isAttachedEntry.length === chunk.topLevelLength, 0xd3b /* TODO: Handle chunks which are only partially attached */);
|
|
303
|
+
if (isAttachedEntry.value) {
|
|
304
|
+
setInChangeAtomIdMap(squashedBuilds, rootId, chunk);
|
|
305
|
+
}
|
|
306
|
+
cursor.exitField();
|
|
307
|
+
}
|
|
308
|
+
return squashedBuilds;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function getOutputNodeAttachStates(change, fieldKinds) {
|
|
312
|
+
const inverse = invertModularChange(makeAnonChange(change), true, "root", fieldKinds);
|
|
313
|
+
return getInputNodeAttachStates(inverse, fieldKinds);
|
|
314
|
+
}
|
|
315
|
+
function getInputNodeAttachStates(change, fieldKinds) {
|
|
316
|
+
const nodeAttachStates = newChangeAtomIdBTree();
|
|
317
|
+
addInputNodeAttachStatesForFields(NodeAttachState.Attached, change.fieldChanges, change.nodeChanges, change.nodeAliases, fieldKinds, nodeAttachStates);
|
|
318
|
+
return nodeAttachStates;
|
|
319
|
+
}
|
|
320
|
+
function addInputNodeAttachStatesForFields(parentState, fields, nodes, nodeAliases, fieldKinds, nodeAttachStates) {
|
|
321
|
+
for (const fieldChange of fields.values()) {
|
|
322
|
+
const children = getChangeHandler(fieldKinds, fieldChange.fieldKind).getNestedChanges(fieldChange.change);
|
|
323
|
+
for (const { nodeId, inputRootId: inputId } of children) {
|
|
324
|
+
const normalizedNodeId = normalizeNodeId(nodeId, nodeAliases);
|
|
325
|
+
const attachState = parentState === NodeAttachState.Attached && inputId === undefined
|
|
326
|
+
? NodeAttachState.Attached
|
|
327
|
+
: NodeAttachState.Detached;
|
|
328
|
+
nodeAttachStates.set([normalizedNodeId.revision, normalizedNodeId.localId], attachState);
|
|
329
|
+
const nodeChangeset = nodeChangeFromId(nodes, normalizedNodeId);
|
|
330
|
+
if (nodeChangeset.fieldChanges !== undefined) {
|
|
331
|
+
addInputNodeAttachStatesForFields(attachState, nodeChangeset.fieldChanges, nodes, nodeAliases, fieldKinds, nodeAttachStates);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function getNodeInfo(change, fieldKinds) {
|
|
337
|
+
const builtRootIds = newChangeAtomIdRangeMap();
|
|
338
|
+
if (change.builds !== undefined) {
|
|
339
|
+
for (const [rootId, chunk] of change.builds.entries()) {
|
|
340
|
+
builtRootIds.set(makeChangeAtomId(rootId[1], rootId[0]), chunk.topLevelLength, true);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const builtNodeIds = newChangeAtomIdBTree();
|
|
344
|
+
const rootIdToNodeId = newChangeAtomIdBTree();
|
|
345
|
+
addNodeInfoForFields(false, change.fieldChanges, change.nodeChanges, change.nodeAliases, builtRootIds, fieldKinds, builtNodeIds, rootIdToNodeId);
|
|
346
|
+
return { builtRootIds, builtNodeIds, rootIdToNodeId };
|
|
347
|
+
}
|
|
348
|
+
function addNodeInfoForFields(parentIsBuilt, fields, nodes, nodeAliases, buildIds, fieldKinds, builtNodeIds, rootIdToNodeId) {
|
|
349
|
+
for (const fieldChange of fields.values()) {
|
|
350
|
+
const children = getChangeHandler(fieldKinds, fieldChange.fieldKind).getNestedChanges(fieldChange.change);
|
|
351
|
+
for (const { nodeId, inputRootId: inputId, detachId } of children) {
|
|
352
|
+
const normalizedNodeId = normalizeNodeId(nodeId, nodeAliases);
|
|
353
|
+
const isPartOfBuild = parentIsBuilt ||
|
|
354
|
+
(inputId !== undefined && buildIds.getFirst(inputId, 1).value === true);
|
|
355
|
+
if (isPartOfBuild) {
|
|
356
|
+
builtNodeIds.set([normalizedNodeId.revision, normalizedNodeId.localId], true);
|
|
357
|
+
}
|
|
358
|
+
if (inputId !== undefined) {
|
|
359
|
+
setInChangeAtomIdMap(rootIdToNodeId, inputId, normalizedNodeId);
|
|
360
|
+
}
|
|
361
|
+
if (detachId !== undefined) {
|
|
362
|
+
setInChangeAtomIdMap(rootIdToNodeId, detachId, normalizedNodeId);
|
|
363
|
+
}
|
|
364
|
+
const nodeChangeset = nodeChangeFromId(nodes, normalizedNodeId);
|
|
365
|
+
if (nodeChangeset.fieldChanges !== undefined) {
|
|
366
|
+
addNodeInfoForFields(isPartOfBuild, nodeChangeset.fieldChanges, nodes, nodeAliases, buildIds, fieldKinds, builtNodeIds, rootIdToNodeId);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Collects the set of root IDs whose content ends up attached within the live document tree
|
|
373
|
+
* once the given change is applied.
|
|
374
|
+
* There are entries both for nodes which are detached in the input context,
|
|
375
|
+
* and also for nodes which are detached by this delta.
|
|
376
|
+
* The keys are pre-rename IDs.
|
|
377
|
+
*
|
|
378
|
+
* @remarks
|
|
379
|
+
* These are the "used" nodes: any build whose nodes are not in this set has no observable
|
|
380
|
+
* effect on the resulting document and can be dropped.
|
|
20
381
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
382
|
+
function collectAttachedRootIds(delta, outputToInputRootId) {
|
|
383
|
+
const detachIdToNodeChanges = getDeltaNodeChangesByDetachId(delta);
|
|
384
|
+
const attached = newChangeAtomIdRangeMap();
|
|
385
|
+
// Worklist of detached node ID ranges newly discovered to be live, whose own nested content must be visited.
|
|
386
|
+
const worklist = [];
|
|
387
|
+
const markLive = (attachId, count) => {
|
|
388
|
+
for (const inputIdEntry of outputToInputRootId.getAll(attachId, count)) {
|
|
389
|
+
const inputId = inputIdEntry.value ?? offsetChangeAtomId(attachId, inputIdEntry.offset);
|
|
390
|
+
// Only the sub-ranges of `[id, id + count)` that are not already live are newly discovered.
|
|
391
|
+
// Mark each such run live in a single range operation and enqueue it for processing.
|
|
392
|
+
for (const fragment of attached.getAll(inputId, inputIdEntry.length)) {
|
|
393
|
+
if (fragment.value === undefined) {
|
|
394
|
+
const runStart = offsetChangeAtomId(inputId, fragment.offset);
|
|
395
|
+
attached.set(runStart, fragment.length, true);
|
|
396
|
+
worklist.push({ id: runStart, count: fragment.length });
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
const visitLiveFields = (fields) => {
|
|
402
|
+
if (fields === undefined) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
for (const field of fields.values()) {
|
|
406
|
+
for (const mark of field.marks) {
|
|
407
|
+
if (mark.attach !== undefined) {
|
|
408
|
+
markLive({ revision: mark.attach.major, localId: brand(mark.attach.minor) }, mark.count);
|
|
409
|
+
}
|
|
410
|
+
// `mark.fields` edits the cell's pre-existing content. Only descend when that content
|
|
411
|
+
// stays in the live tree (i.e. it is not being detached out of the tree).
|
|
412
|
+
if (mark.detach === undefined) {
|
|
413
|
+
visitLiveFields(mark.fields);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
visitLiveFields(delta.fields);
|
|
419
|
+
// Process node ranges discovered to be live: pull in their nested content and propagate
|
|
420
|
+
// liveness backwards across renames (a node attached under its post-rename ID was built under its
|
|
421
|
+
// pre-rename ID). Iterate to a fixed point.
|
|
422
|
+
while (worklist.length > 0) {
|
|
423
|
+
const next = worklist.pop();
|
|
424
|
+
if (next === undefined) {
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
const { id, count } = next;
|
|
428
|
+
// Nested content is keyed per node, so it must be visited one ID at a time.
|
|
429
|
+
for (let offset = 0; offset < count; offset += 1) {
|
|
430
|
+
visitLiveFields(detachIdToNodeChanges.get(id.revision)?.get(brand(id.localId + offset)));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return attached;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Returns a mapping from root ID to the field changes for that node.
|
|
437
|
+
* There are entries both for nodes which are detached in the input context,
|
|
438
|
+
* and also for nodes which are detached by this delta.
|
|
439
|
+
* The keys are pre-rename IDs.
|
|
440
|
+
*/
|
|
441
|
+
function getDeltaNodeChangesByDetachId(delta) {
|
|
442
|
+
const detachIdToChanges = new Map();
|
|
443
|
+
const visitFields = (fields) => {
|
|
444
|
+
for (const fieldChange of fields.values()) {
|
|
445
|
+
for (const mark of fieldChange.marks) {
|
|
446
|
+
if (mark.fields !== undefined) {
|
|
447
|
+
visitFields(mark.fields);
|
|
448
|
+
if (mark.detach !== undefined) {
|
|
449
|
+
setInNestedMap(detachIdToChanges, mark.detach.major, mark.detach.minor, mark.fields);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
if (delta.fields !== undefined) {
|
|
456
|
+
visitFields(delta.fields);
|
|
457
|
+
}
|
|
458
|
+
if (delta.global !== undefined) {
|
|
459
|
+
for (const { id, fields } of delta.global) {
|
|
460
|
+
setInNestedMap(detachIdToChanges, id.major, id.minor, fields);
|
|
461
|
+
visitFields(fields);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return detachIdToChanges;
|
|
465
|
+
}
|
|
466
|
+
function outputToInputRootIdFromDelta(delta) {
|
|
467
|
+
const outputToInputRootId = newChangeAtomIdTransform();
|
|
468
|
+
if (delta.rename !== undefined) {
|
|
469
|
+
for (const { oldId, newId, count } of delta.rename) {
|
|
470
|
+
outputToInputRootId.set(makeChangeAtomId(brand(newId.minor), newId.major), count, makeChangeAtomId(brand(oldId.minor), oldId.major));
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return outputToInputRootId;
|
|
24
474
|
}
|
|
25
475
|
//# sourceMappingURL=minimizeModularChange.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimizeModularChange.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/minimizeModularChange.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,wBAAwB,CACvC,MAAwB,EACxB,YAAiC;IAEjC,iGAAiG;IACjG,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ModularChangeFamily } from \"./modularChangeFamily.js\";\nimport type { ModularChangeset } from \"./modularChangeTypes.js\";\n\n/**\n * \"Minimizes\" a {@link ModularChangeset} so that it contains no extraneous\n * information, i.e. no new content that isn't observable from document tree\n * and no edits without net observed effect on the document tree.\n * @remarks\n * \"Extraneous information\" includes, for example, data for nodes that were both created and removed within the same\n * transaction, or changes whose effects cancel out to nothing. Minimizing reduces the size of an edit without altering\n * its observable effect.\n *\n * This is the eventual home of the minimization algorithm, colocated with {@link ModularChangeFamily} so it can use its\n * internals. It is currently a no-op that returns the change unchanged; a real implementation will be provided in a\n * future change.\n *\n * @param change - The change to minimize.\n * @param changeFamily - The change family used to compute the change's delta and identify built nodes.\n */\nexport function minimizeModularChangeset(\n\tchange: ModularChangeset,\n\tchangeFamily: ModularChangeFamily,\n): ModularChangeset {\n\t// TODO: Actually minimize the change. For now this is a no-op that returns the change unchanged.\n\treturn change;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"minimizeModularChange.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/minimizeModularChange.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,UAAU,GASV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,EACL,SAAS,EACT,cAAc,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,GAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACN,gBAAgB,EAChB,eAAe,GAGf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AASrD,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CACvC,MAAwB,EACxB,UAA2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AC5B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tdeltaFieldMapHasChanges,\n\tmakeAnonChange,\n\tmakeChangeAtomId,\n\tmakeDetachedFieldIndex,\n\tnewChangeAtomIdRangeMap,\n\tnewChangeAtomIdTransform,\n\toffsetChangeAtomId,\n\tvisitDelta,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\ttype ChangeAtomIdRangeMap,\n\ttype DeltaFieldMap,\n\ttype DeltaRoot,\n\ttype FieldKindIdentifier,\n\ttype IEditableForest,\n\ttype TreeChunk,\n} from \"../../core/index.js\";\nimport {\n\tbrand,\n\thasSingle,\n\tsetInNestedMap,\n\ttype Mutable,\n\ttype RangeQueryResult,\n} from \"../../util/index.js\";\nimport {\n\tgetFromChangeAtomIdMap,\n\tnewChangeAtomIdBTree,\n\tsetInChangeAtomIdMap,\n\ttype ChangeAtomIdBTree,\n} from \"../changeAtomIdBTree.js\";\nimport { CrossFieldTarget } from \"./crossFieldQueries.js\";\nimport {\n\tEditFilterStatus,\n\tNodeAttachState,\n\ttype FilterAttachResult,\n\ttype FilterDetachResult,\n} from \"./fieldChangeHandler.js\";\n\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport { filterEdits } from \"./filterEdits.js\";\nimport { invertModularChange } from \"./invert.js\";\nimport { intoDelta } from \"./modularChangeFamily.js\";\nimport type {\n\tFieldChange,\n\tFieldChangeMap,\n\tFieldId,\n\tModularChangeset,\n\tNodeChangeset,\n\tNodeId,\n} from \"./modularChangeTypes.js\";\nimport {\n\tgetChangeHandler,\n\tnodeChangeFromId,\n\tnormalizeNodeId,\n\tvalidateChangeset,\n} from \"./modularChangeUtils.js\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\n/**\n * \"Minimizes\" a {@link ModularChangeset} so that it contains no extraneous\n * information, i.e. no new content that isn't observable from document tree\n * and no edits without net observed effect on the document tree.\n * @remarks\n * \"Extraneous information\" includes, for example, data for nodes that were both created and removed within the same\n * transaction, or changes whose effects cancel out to nothing. Minimizing reduces the size of an edit without altering\n * its observable effect.\n *\n * @param change - The change to minimize.\n * @param fieldKinds - The field kinds used in the changeset.\n * @param forestFactory - A function that returns a new forest instance.\n */\nexport function minimizeModularChangeset(\n\tchange: ModularChangeset,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\tforestFactory: () => IEditableForest,\n): ModularChangeset {\n\treturn new ModularChangeMinimizer(change, fieldKinds).minimize(forestFactory);\n}\n\nclass ModularChangeMinimizer {\n\tprivate readonly builtNodeIds: ChangeAtomIdBTree<true>;\n\tprivate readonly builtRootIds: ChangeAtomIdRangeMap<true>;\n\tprivate readonly outputAttachStates: ChangeAtomIdBTree<NodeAttachState>;\n\tprivate readonly outputToInputRootId: ChangeAtomIdRangeMap<ChangeAtomId>;\n\tprivate readonly rootIdToNodeId: ChangeAtomIdBTree<NodeId>;\n\tprivate readonly attachedRootIds: ChangeAtomIdRangeSet;\n\n\tpublic constructor(\n\t\tprivate readonly change: ModularChangeset,\n\t\tprivate readonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\t) {\n\t\tthis.outputAttachStates = getOutputNodeAttachStates(change, fieldKinds);\n\t\tconst nodeInfo = getNodeInfo(change, fieldKinds);\n\t\tthis.builtNodeIds = nodeInfo.builtNodeIds;\n\t\tthis.builtRootIds = nodeInfo.builtRootIds;\n\t\tthis.rootIdToNodeId = nodeInfo.rootIdToNodeId;\n\n\t\tconst delta = intoDelta(makeAnonChange(change), fieldKinds);\n\t\tthis.outputToInputRootId = outputToInputRootIdFromDelta(delta);\n\t\tthis.attachedRootIds = collectAttachedRootIds(delta, this.outputToInputRootId);\n\t}\n\n\tpublic minimize(forestFactory: () => IEditableForest): ModularChangeset {\n\t\tconst residualChange = filterEdits(\n\t\t\tthis.change,\n\t\t\tthis.filterEditsForResidualChange.bind(this),\n\t\t\tthis.fieldKinds,\n\t\t);\n\n\t\t(residualChange as Mutable<ModularChangeset>).builds = this.squashBuilds(forestFactory);\n\t\tvalidateChangeset(residualChange, this.fieldKinds);\n\t\treturn residualChange;\n\t}\n\n\tprivate isNodeIdInBuiltTree(nodeId: NodeId | undefined): boolean {\n\t\treturn (\n\t\t\tnodeId !== undefined &&\n\t\t\tgetFromChangeAtomIdMap(\n\t\t\t\tthis.builtNodeIds,\n\t\t\t\tnormalizeNodeId(nodeId, this.change.nodeAliases),\n\t\t\t) === true\n\t\t);\n\t}\n\n\tprivate isNodeDetachedInOutput(nodeId: NodeId): boolean {\n\t\treturn (\n\t\t\t(getFromChangeAtomIdMap(\n\t\t\t\tthis.outputAttachStates,\n\t\t\t\tnormalizeNodeId(nodeId, this.change.nodeAliases),\n\t\t\t) ?? fail(0xd37 /* Should have attach state for every node ID */)) ===\n\t\t\tNodeAttachState.Detached\n\t\t);\n\t}\n\n\tprivate isFieldDetachedInOutput(fieldId: FieldId): boolean {\n\t\treturn fieldId.nodeId !== undefined && this.isNodeDetachedInOutput(fieldId.nodeId);\n\t}\n\n\tprivate shouldSquashDetach(\n\t\tfieldId: FieldId,\n\t\tinputRootId: ChangeAtomId | undefined,\n\t): boolean {\n\t\t// `inputRootId === undefined` indicates that this is a move of a transiently attached built root.\n\t\t// In that case, we convert the move to an insert at the final location, discarding the detach portion.\n\t\treturn this.isNodeIdInBuiltTree(fieldId.nodeId) && inputRootId === undefined;\n\t}\n\n\tprivate shouldSquashAttach(\n\t\tfieldId: FieldId,\n\t\trootInputId: ChangeAtomId,\n\t\tcount: number,\n\t\tendpoint: FieldId | undefined,\n\t): RangeQueryResult<boolean> {\n\t\tif (!this.isNodeIdInBuiltTree(fieldId.nodeId)) {\n\t\t\treturn { value: false, length: count };\n\t\t}\n\n\t\tlet countProcessed = count;\n\t\tconst isMoveOfBuiltRootEntry = this.builtRootIds.getFirst(rootInputId, countProcessed);\n\t\tcountProcessed = isMoveOfBuiltRootEntry.length;\n\n\t\tconst isAttachOfBuiltRoot = isMoveOfBuiltRootEntry?.value ?? false;\n\t\tconst isMoveFromBuiltTree =\n\t\t\tendpoint?.nodeId !== undefined && this.isNodeIdInBuiltTree(endpoint.nodeId);\n\n\t\tconst isAttachOfBuiltNode = isAttachOfBuiltRoot || isMoveFromBuiltTree;\n\t\treturn { value: isAttachOfBuiltNode, length: countProcessed };\n\t}\n\n\tprivate shouldDropAttach(\n\t\tfieldId: FieldId,\n\t\trootInputId: ChangeAtomId,\n\t\tcount: number,\n\t\tendpoint: FieldId | undefined,\n\t): RangeQueryResult<boolean> {\n\t\tconst isInDetachedTree = this.isFieldDetachedInOutput(fieldId);\n\n\t\tlet countProcessed = count;\n\t\tconst shouldSquashAttachEntry = this.shouldSquashAttach(\n\t\t\tfieldId,\n\t\t\trootInputId,\n\t\t\tcountProcessed,\n\t\t\tendpoint,\n\t\t);\n\t\tcountProcessed = shouldSquashAttachEntry.length;\n\n\t\tconst isBuiltRootEntry = this.builtRootIds.getFirst(rootInputId, countProcessed);\n\t\tcountProcessed = isBuiltRootEntry.length;\n\n\t\tconst isAttachOfBuild =\n\t\t\tisBuiltRootEntry.value ??\n\t\t\t(endpoint !== undefined && this.isNodeIdInBuiltTree(endpoint.nodeId));\n\n\t\tconst isAttachedRootEntry = this.attachedRootIds.getFirst(rootInputId, countProcessed);\n\t\tcountProcessed = isAttachedRootEntry.length;\n\n\t\tconst isTransientAttachOfBuild = isAttachOfBuild && !isAttachedRootEntry.value;\n\t\treturn {\n\t\t\tvalue: isInDetachedTree || shouldSquashAttachEntry.value || isTransientAttachOfBuild,\n\t\t\tlength: countProcessed,\n\t\t};\n\t}\n\n\tprivate shouldDropDetach(\n\t\tfieldId: FieldId,\n\t\tdetachId: ChangeAtomId,\n\t\trootInputId: ChangeAtomId | undefined,\n\t\tcount: number,\n\t\tendpoint: FieldId | undefined,\n\t): RangeQueryResult<boolean> {\n\t\tlet countProcessed = count;\n\t\tif (this.shouldSquashDetach(fieldId, rootInputId)) {\n\t\t\treturn { value: true, length: countProcessed };\n\t\t}\n\n\t\tif (rootInputId !== undefined) {\n\t\t\t// `inputRootId` is defined when this detach represents the rename of a detached root.\n\t\t\tconst isDetachOfBuiltRootEntry = this.builtRootIds.getFirst(rootInputId, countProcessed);\n\t\t\tcountProcessed = isDetachOfBuiltRootEntry.length;\n\t\t\tconst isDetachOfBuiltRoot = isDetachOfBuiltRootEntry.value !== undefined;\n\t\t\tif (isDetachOfBuiltRoot)\n\t\t\t\t// If this is a rename of a built node, either it ends detached, or is moved elsewhere.\n\t\t\t\t// If moved, we squash the detach away, leaving only an attach at the destination.\n\t\t\t\t// If detached, the build is not used, so we drop the rename.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: true,\n\t\t\t\t\tlength: countProcessed,\n\t\t\t\t};\n\t\t}\n\n\t\tif (endpoint !== undefined) {\n\t\t\tconst shouldDropAttachEntry = this.shouldDropAttach(\n\t\t\t\tendpoint,\n\t\t\t\trootInputId ?? detachId,\n\t\t\t\tcountProcessed,\n\t\t\t\tfieldId,\n\t\t\t);\n\t\t\tcountProcessed = shouldDropAttachEntry.length;\n\n\t\t\tif (!shouldDropAttachEntry.value) {\n\t\t\t\t// This detach is part of a move, and we are not dropping the attach, so we must preserve the detach as well.\n\t\t\t\treturn { value: false, length: countProcessed };\n\t\t\t}\n\t\t}\n\n\t\treturn { value: this.isFieldDetachedInOutput(fieldId), length: countProcessed };\n\t}\n\n\tprivate filterEditsForBuildChange(fieldChange: FieldChange, fieldId: FieldId): FieldChange {\n\t\treturn {\n\t\t\t...fieldChange,\n\t\t\tchange: brand(\n\t\t\t\tgetChangeHandler(this.fieldKinds, fieldChange.fieldKind).rebaser.filterEdits(\n\t\t\t\t\tfieldChange.change,\n\t\t\t\t\t{\n\t\t\t\t\t\tfilterDetach: (detachId, count, inputRootId, endpoint) =>\n\t\t\t\t\t\t\tthis.filterDetachForBuildChange(fieldId, detachId, count, inputRootId, endpoint),\n\t\t\t\t\t\tfilterAttach: (id, count, _outputRootId, endpoint) =>\n\t\t\t\t\t\t\tthis.filterAttachForBuildChange(fieldId, id, count, endpoint),\n\t\t\t\t\t\tpreserveOtherEdits: false,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t),\n\t\t};\n\t}\n\n\tprivate filterDetachForBuildChange(\n\t\tfieldId: FieldId,\n\t\tdetachId: ChangeAtomId,\n\t\tcount: number,\n\t\tinputRootId: ChangeAtomId | undefined,\n\t\tendpoint?: ChangeAtomId,\n\t): RangeQueryResult<FilterDetachResult> {\n\t\tif (!this.shouldSquashDetach(fieldId, inputRootId)) {\n\t\t\treturn {\n\t\t\t\tvalue: { action: EditFilterStatus.Remove, shouldRemoveChild: false },\n\t\t\t\tlength: count,\n\t\t\t};\n\t\t}\n\n\t\tlet countProcessed = count;\n\t\tconst moveEndpointEntry = this.change.crossFieldKeys.getFirst(\n\t\t\t{ ...(endpoint ?? detachId), target: CrossFieldTarget.Destination },\n\t\t\tcountProcessed,\n\t\t);\n\t\tcountProcessed = moveEndpointEntry.length;\n\n\t\tif (moveEndpointEntry.value !== undefined) {\n\t\t\tconst willSquashEndpointEntry = this.shouldSquashAttach(\n\t\t\t\tmoveEndpointEntry.value,\n\t\t\t\tinputRootId ?? detachId,\n\t\t\t\tcountProcessed,\n\t\t\t\tfieldId,\n\t\t\t);\n\t\t\tcountProcessed = willSquashEndpointEntry.length;\n\n\t\t\tconst action = willSquashEndpointEntry.value\n\t\t\t\t? EditFilterStatus.Preserve\n\t\t\t\t: EditFilterStatus.PreserveWithoutMove;\n\n\t\t\treturn { value: { action }, length: countProcessed };\n\t\t}\n\n\t\treturn { value: { action: EditFilterStatus.Preserve }, length: countProcessed };\n\t}\n\n\tprivate filterAttachForBuildChange(\n\t\tfieldId: FieldId,\n\t\tid: ChangeAtomId,\n\t\tcount: number,\n\t\tendpoint?: ChangeAtomId,\n\t): RangeQueryResult<FilterAttachResult> {\n\t\tlet countProcessed = count;\n\t\tconst moveId = endpoint ?? id;\n\t\tconst moveEndpointEntry = this.change.crossFieldKeys.getFirst(\n\t\t\t{ ...moveId, target: CrossFieldTarget.Source },\n\t\t\tcountProcessed,\n\t\t);\n\t\tcountProcessed = moveEndpointEntry.length;\n\n\t\tconst inputIdEntry = this.outputToInputRootId.getFirst(moveId, countProcessed);\n\t\tcountProcessed = inputIdEntry.length;\n\n\t\tconst rootInputId = inputIdEntry.value ?? moveId;\n\t\tconst shouldSquashEntry = this.shouldSquashAttach(\n\t\t\tfieldId,\n\t\t\trootInputId,\n\t\t\tcountProcessed,\n\t\t\tmoveEndpointEntry.value,\n\t\t);\n\t\tcountProcessed = shouldSquashEntry.length;\n\n\t\tconst isMove = moveEndpointEntry.value !== undefined;\n\t\tif (!shouldSquashEntry.value) {\n\t\t\treturn { value: { action: EditFilterStatus.Remove }, length: countProcessed };\n\t\t}\n\n\t\tif (isMove) {\n\t\t\tconst movedNodeId = getFromChangeAtomIdMap(this.rootIdToNodeId, moveId);\n\t\t\treturn {\n\t\t\t\tvalue: {\n\t\t\t\t\taction: EditFilterStatus.PreserveWithoutMove,\n\t\t\t\t\tnodeId: movedNodeId,\n\t\t\t\t\tnewAttachId: rootInputId,\n\t\t\t\t},\n\t\t\t\tlength: countProcessed,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: { action: EditFilterStatus.Preserve },\n\t\t\tlength: countProcessed,\n\t\t};\n\t}\n\n\t/**\n\t * Returns a version of `fieldChange` to be used in the final minimized change.\n\t * The filtered change will have dropped:\n\t * - Edits which were squashed into the built trees.\n\t * - Detaches of built roots. If part of a move, these are instead represented as an attach at the final location.\n\t * - Edits to nodes which are detached in the output, except for detaches of content which does end attached.\n\t */\n\tprivate filterEditsForResidualChange(\n\t\tfieldChange: FieldChange,\n\t\tfieldId: FieldId,\n\t): FieldChange {\n\t\treturn {\n\t\t\t...fieldChange,\n\t\t\tchange: brand(\n\t\t\t\tgetChangeHandler(this.fieldKinds, fieldChange.fieldKind).rebaser.filterEdits(\n\t\t\t\t\tfieldChange.change,\n\t\t\t\t\t{\n\t\t\t\t\t\tfilterDetach: (...args) => this.filterDetachForResidualChange(fieldId, ...args),\n\t\t\t\t\t\tfilterAttach: (...args) => this.filterAttachForResidualChange(fieldId, ...args),\n\t\t\t\t\t\tpreserveOtherEdits: false,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t),\n\t\t};\n\t}\n\n\tprivate filterDetachForResidualChange(\n\t\tfieldId: FieldId,\n\t\tdetachId: ChangeAtomId,\n\t\tcount: number,\n\t\tinputRootId: ChangeAtomId | undefined,\n\t\tendpoint?: ChangeAtomId,\n\t): RangeQueryResult<FilterDetachResult> {\n\t\tlet countProcessed = count;\n\t\tconst moveId = endpoint ?? detachId;\n\t\tconst moveEndpointEntry = this.change.crossFieldKeys.getFirst(\n\t\t\t{ ...moveId, target: CrossFieldTarget.Destination },\n\t\t\tcount,\n\t\t);\n\t\tcountProcessed = moveEndpointEntry.length;\n\n\t\tconst shouldDropEntry = this.shouldDropDetach(\n\t\t\tfieldId,\n\t\t\tdetachId,\n\t\t\tinputRootId,\n\t\t\tcountProcessed,\n\t\t\tmoveEndpointEntry.value,\n\t\t);\n\t\tcountProcessed = shouldDropEntry.length;\n\n\t\tlet hasPreservedAttach = false;\n\t\tlet hasDroppedAttach = false;\n\t\tif (moveEndpointEntry.value !== undefined) {\n\t\t\tconst willDropAttachEntry = this.shouldDropAttach(\n\t\t\t\tmoveEndpointEntry.value,\n\t\t\t\tinputRootId ?? detachId,\n\t\t\t\tcountProcessed,\n\t\t\t\tfieldId,\n\t\t\t);\n\t\t\tcountProcessed = willDropAttachEntry.length;\n\t\t\thasDroppedAttach = willDropAttachEntry.value;\n\t\t\thasPreservedAttach = !willDropAttachEntry.value;\n\t\t}\n\n\t\tif (shouldDropEntry.value) {\n\t\t\t// If there is a preserved attach, we will represent any child change at that location,\n\t\t\t// so we must remove them from here.\n\t\t\treturn {\n\t\t\t\tvalue: { action: EditFilterStatus.Remove, shouldRemoveChild: hasPreservedAttach },\n\t\t\t\tlength: countProcessed,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: {\n\t\t\t\taction: hasDroppedAttach\n\t\t\t\t\t? EditFilterStatus.PreserveWithoutMove\n\t\t\t\t\t: EditFilterStatus.Preserve,\n\t\t\t},\n\t\t\tlength: countProcessed,\n\t\t};\n\t}\n\n\tprivate filterAttachForResidualChange(\n\t\tfieldId: FieldId,\n\t\tid: ChangeAtomId,\n\t\tcount: number,\n\t\toutputRootId: ChangeAtomId | undefined,\n\t\tendpoint?: ChangeAtomId,\n\t): RangeQueryResult<FilterAttachResult> {\n\t\tlet countProcessed = count;\n\t\tconst moveId = endpoint ?? id;\n\t\tconst moveEndpointEntry = this.change.crossFieldKeys.getFirst(\n\t\t\t{ ...moveId, target: CrossFieldTarget.Source },\n\t\t\tcountProcessed,\n\t\t);\n\t\tcountProcessed = moveEndpointEntry.length;\n\n\t\tconst inputIdEntry = this.outputToInputRootId.getFirst(moveId, countProcessed);\n\t\tcountProcessed = inputIdEntry.length;\n\n\t\tconst rootInputId = inputIdEntry.value ?? moveId;\n\t\tconst shouldDropEntry = this.shouldDropAttach(\n\t\t\tfieldId,\n\t\t\trootInputId,\n\t\t\tcountProcessed,\n\t\t\tmoveEndpointEntry.value,\n\t\t);\n\t\tcountProcessed = shouldDropEntry.length;\n\n\t\tif (shouldDropEntry.value) {\n\t\t\treturn {\n\t\t\t\tvalue: { action: EditFilterStatus.Remove },\n\t\t\t\tlength: countProcessed,\n\t\t\t};\n\t\t}\n\n\t\tif (moveEndpointEntry.value !== undefined) {\n\t\t\tconst willDropEndpointEntry = this.shouldDropDetach(\n\t\t\t\tmoveEndpointEntry.value,\n\t\t\t\tmoveId,\n\t\t\t\tinputIdEntry.value,\n\t\t\t\tcountProcessed,\n\t\t\t\tfieldId,\n\t\t\t);\n\t\t\tcountProcessed = willDropEndpointEntry.length;\n\t\t\tif (willDropEndpointEntry.value) {\n\t\t\t\tconst movedNodeId = getFromChangeAtomIdMap(this.rootIdToNodeId, moveId);\n\t\t\t\treturn {\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\taction: EditFilterStatus.PreserveWithoutMove,\n\t\t\t\t\t\tnodeId: movedNodeId,\n\t\t\t\t\t\tnewAttachId: inputIdEntry.value ?? moveId,\n\t\t\t\t\t},\n\t\t\t\t\tlength: countProcessed,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: { action: EditFilterStatus.Preserve },\n\t\t\tlength: countProcessed,\n\t\t};\n\t}\n\n\tprivate squashBuilds(forestFactory: () => IEditableForest): ChangeAtomIdBTree<TreeChunk> {\n\t\tconst changeForBuilds = filterEdits(\n\t\t\tthis.change,\n\t\t\tthis.filterEditsForBuildChange.bind(this),\n\t\t\tthis.fieldKinds,\n\t\t);\n\n\t\tconst deltaForBuilds = intoDelta(makeAnonChange(changeForBuilds), this.fieldKinds);\n\t\tassert(\n\t\t\t!deltaFieldMapHasChanges(deltaForBuilds.fields),\n\t\t\t0xd38 /* Expected all changes to attached tree to be filtered out */,\n\t\t);\n\n\t\t// There may still be paths to existing nodes in the delta, which must be removed before being applied to an empty forest.\n\t\t// It is safe to remove these, because there are no edits to them, as asserted above.\n\t\t(deltaForBuilds as Mutable<DeltaRoot<unknown>>).fields = new Map();\n\n\t\tconst forest = forestFactory();\n\t\tconst detachedFieldIndex = makeDetachedFieldIndex();\n\n\t\tvisitDelta(deltaForBuilds, forest.acquireVisitor(), detachedFieldIndex, undefined);\n\t\tconst squashedBuilds = newChangeAtomIdBTree<TreeChunk>();\n\t\tconst cursor = forest.getCursorAboveDetachedFields();\n\t\tfor (const entry of detachedFieldIndex.entries()) {\n\t\t\tcursor.enterField(detachedFieldIndex.toFieldKey(entry.root));\n\t\t\tconst chunks = forest.chunkField(cursor);\n\n\t\t\t// Delta visiting currently splits ranges of nodes into individual elements,\n\t\t\t// so for now we will not have more than one node in a detached field.\n\t\t\tassert(hasSingle(chunks), 0xd39 /* TODO: Handle multiple chunks */);\n\t\t\tconst chunk = chunks[0];\n\t\t\tassert(chunk.topLevelLength === 1, 0xd3a /* TODO: Handle chunk with range of nodes */);\n\n\t\t\tconst rootId: ChangeAtomId = {\n\t\t\t\trevision: entry.id.major,\n\t\t\t\tlocalId: brand(entry.id.minor),\n\t\t\t};\n\n\t\t\tconst isAttachedEntry = this.attachedRootIds.getFirst(rootId, chunk.topLevelLength);\n\t\t\tassert(\n\t\t\t\tisAttachedEntry.length === chunk.topLevelLength,\n\t\t\t\t0xd3b /* TODO: Handle chunks which are only partially attached */,\n\t\t\t);\n\n\t\t\tif (isAttachedEntry.value) {\n\t\t\t\tsetInChangeAtomIdMap(squashedBuilds, rootId, chunk);\n\t\t\t}\n\n\t\t\tcursor.exitField();\n\t\t}\n\n\t\treturn squashedBuilds;\n\t}\n}\n\nfunction getOutputNodeAttachStates(\n\tchange: ModularChangeset,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): ChangeAtomIdBTree<NodeAttachState> {\n\tconst inverse = invertModularChange(makeAnonChange(change), true, \"root\", fieldKinds);\n\treturn getInputNodeAttachStates(inverse, fieldKinds);\n}\n\nfunction getInputNodeAttachStates(\n\tchange: ModularChangeset,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): ChangeAtomIdBTree<NodeAttachState> {\n\tconst nodeAttachStates = newChangeAtomIdBTree<NodeAttachState>();\n\taddInputNodeAttachStatesForFields(\n\t\tNodeAttachState.Attached,\n\t\tchange.fieldChanges,\n\t\tchange.nodeChanges,\n\t\tchange.nodeAliases,\n\t\tfieldKinds,\n\t\tnodeAttachStates,\n\t);\n\treturn nodeAttachStates;\n}\n\nfunction addInputNodeAttachStatesForFields(\n\tparentState: NodeAttachState,\n\tfields: FieldChangeMap,\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tnodeAliases: ChangeAtomIdBTree<NodeId>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\tnodeAttachStates: ChangeAtomIdBTree<NodeAttachState>,\n): void {\n\tfor (const fieldChange of fields.values()) {\n\t\tconst children = getChangeHandler(fieldKinds, fieldChange.fieldKind).getNestedChanges(\n\t\t\tfieldChange.change,\n\t\t);\n\n\t\tfor (const { nodeId, inputRootId: inputId } of children) {\n\t\t\tconst normalizedNodeId = normalizeNodeId(nodeId, nodeAliases);\n\t\t\tconst attachState =\n\t\t\t\tparentState === NodeAttachState.Attached && inputId === undefined\n\t\t\t\t\t? NodeAttachState.Attached\n\t\t\t\t\t: NodeAttachState.Detached;\n\n\t\t\tnodeAttachStates.set([normalizedNodeId.revision, normalizedNodeId.localId], attachState);\n\n\t\t\tconst nodeChangeset = nodeChangeFromId(nodes, normalizedNodeId);\n\t\t\tif (nodeChangeset.fieldChanges !== undefined) {\n\t\t\t\taddInputNodeAttachStatesForFields(\n\t\t\t\t\tattachState,\n\t\t\t\t\tnodeChangeset.fieldChanges,\n\t\t\t\t\tnodes,\n\t\t\t\t\tnodeAliases,\n\t\t\t\t\tfieldKinds,\n\t\t\t\t\tnodeAttachStates,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction getNodeInfo(\n\tchange: ModularChangeset,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): {\n\treadonly builtRootIds: ChangeAtomIdRangeMap<true>;\n\treadonly builtNodeIds: ChangeAtomIdBTree<true>;\n\t/**\n\t * Maps from the input context ID for roots which are already detached,\n\t * or detach ID for roots which are detached or moved by `change`.\n\t */\n\treadonly rootIdToNodeId: ChangeAtomIdBTree<NodeId>;\n} {\n\tconst builtRootIds = newChangeAtomIdRangeMap<true>();\n\tif (change.builds !== undefined) {\n\t\tfor (const [rootId, chunk] of change.builds.entries()) {\n\t\t\tbuiltRootIds.set(makeChangeAtomId(rootId[1], rootId[0]), chunk.topLevelLength, true);\n\t\t}\n\t}\n\n\tconst builtNodeIds = newChangeAtomIdBTree<true>();\n\tconst rootIdToNodeId = newChangeAtomIdBTree<NodeId>();\n\taddNodeInfoForFields(\n\t\tfalse,\n\t\tchange.fieldChanges,\n\t\tchange.nodeChanges,\n\t\tchange.nodeAliases,\n\t\tbuiltRootIds,\n\t\tfieldKinds,\n\t\tbuiltNodeIds,\n\t\trootIdToNodeId,\n\t);\n\n\treturn { builtRootIds, builtNodeIds, rootIdToNodeId };\n}\n\nfunction addNodeInfoForFields(\n\tparentIsBuilt: boolean,\n\tfields: FieldChangeMap,\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tnodeAliases: ChangeAtomIdBTree<NodeId>,\n\tbuildIds: ChangeAtomIdRangeMap<true>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\tbuiltNodeIds: ChangeAtomIdBTree<true>,\n\trootIdToNodeId: ChangeAtomIdBTree<NodeId>,\n): void {\n\tfor (const fieldChange of fields.values()) {\n\t\tconst children = getChangeHandler(fieldKinds, fieldChange.fieldKind).getNestedChanges(\n\t\t\tfieldChange.change,\n\t\t);\n\n\t\tfor (const { nodeId, inputRootId: inputId, detachId } of children) {\n\t\t\tconst normalizedNodeId = normalizeNodeId(nodeId, nodeAliases);\n\t\t\tconst isPartOfBuild =\n\t\t\t\tparentIsBuilt ||\n\t\t\t\t(inputId !== undefined && buildIds.getFirst(inputId, 1).value === true);\n\n\t\t\tif (isPartOfBuild) {\n\t\t\t\tbuiltNodeIds.set([normalizedNodeId.revision, normalizedNodeId.localId], true);\n\t\t\t}\n\n\t\t\tif (inputId !== undefined) {\n\t\t\t\tsetInChangeAtomIdMap(rootIdToNodeId, inputId, normalizedNodeId);\n\t\t\t}\n\n\t\t\tif (detachId !== undefined) {\n\t\t\t\tsetInChangeAtomIdMap(rootIdToNodeId, detachId, normalizedNodeId);\n\t\t\t}\n\n\t\t\tconst nodeChangeset = nodeChangeFromId(nodes, normalizedNodeId);\n\t\t\tif (nodeChangeset.fieldChanges !== undefined) {\n\t\t\t\taddNodeInfoForFields(\n\t\t\t\t\tisPartOfBuild,\n\t\t\t\t\tnodeChangeset.fieldChanges,\n\t\t\t\t\tnodes,\n\t\t\t\t\tnodeAliases,\n\t\t\t\t\tbuildIds,\n\t\t\t\t\tfieldKinds,\n\t\t\t\t\tbuiltNodeIds,\n\t\t\t\t\trootIdToNodeId,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** A contiguous run of node IDs starting at `id` and spanning `count` consecutive IDs. */\ninterface ChangeAtomIdRange {\n\treadonly id: ChangeAtomId;\n\treadonly count: number;\n}\n\n/**\n * A set of node IDs, stored as a {@link ChangeAtomIdRangeMap} so that consecutive runs of IDs are\n * represented (and marked/queried) as ranges rather than one entry per ID.\n */\ntype ChangeAtomIdRangeSet = ChangeAtomIdRangeMap<true>;\n\n/**\n * Collects the set of root IDs whose content ends up attached within the live document tree\n * once the given change is applied.\n * There are entries both for nodes which are detached in the input context,\n * and also for nodes which are detached by this delta.\n * The keys are pre-rename IDs.\n *\n * @remarks\n * These are the \"used\" nodes: any build whose nodes are not in this set has no observable\n * effect on the resulting document and can be dropped.\n */\nfunction collectAttachedRootIds(\n\tdelta: DeltaRoot,\n\toutputToInputRootId: ChangeAtomIdRangeMap<ChangeAtomId>,\n): ChangeAtomIdRangeSet {\n\tconst detachIdToNodeChanges = getDeltaNodeChangesByDetachId(delta);\n\tconst attached: ChangeAtomIdRangeSet = newChangeAtomIdRangeMap<true>();\n\n\t// Worklist of detached node ID ranges newly discovered to be live, whose own nested content must be visited.\n\tconst worklist: ChangeAtomIdRange[] = [];\n\tconst markLive = (attachId: ChangeAtomId, count: number): void => {\n\t\tfor (const inputIdEntry of outputToInputRootId.getAll(attachId, count)) {\n\t\t\tconst inputId = inputIdEntry.value ?? offsetChangeAtomId(attachId, inputIdEntry.offset);\n\n\t\t\t// Only the sub-ranges of `[id, id + count)` that are not already live are newly discovered.\n\t\t\t// Mark each such run live in a single range operation and enqueue it for processing.\n\t\t\tfor (const fragment of attached.getAll(inputId, inputIdEntry.length)) {\n\t\t\t\tif (fragment.value === undefined) {\n\t\t\t\t\tconst runStart = offsetChangeAtomId(inputId, fragment.offset);\n\t\t\t\t\tattached.set(runStart, fragment.length, true);\n\t\t\t\t\tworklist.push({ id: runStart, count: fragment.length });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tconst visitLiveFields = (fields: DeltaFieldMap | undefined): void => {\n\t\tif (fields === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const field of fields.values()) {\n\t\t\tfor (const mark of field.marks) {\n\t\t\t\tif (mark.attach !== undefined) {\n\t\t\t\t\tmarkLive(\n\t\t\t\t\t\t{ revision: mark.attach.major, localId: brand(mark.attach.minor) },\n\t\t\t\t\t\tmark.count,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// `mark.fields` edits the cell's pre-existing content. Only descend when that content\n\t\t\t\t// stays in the live tree (i.e. it is not being detached out of the tree).\n\t\t\t\tif (mark.detach === undefined) {\n\t\t\t\t\tvisitLiveFields(mark.fields);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tvisitLiveFields(delta.fields);\n\n\t// Process node ranges discovered to be live: pull in their nested content and propagate\n\t// liveness backwards across renames (a node attached under its post-rename ID was built under its\n\t// pre-rename ID). Iterate to a fixed point.\n\twhile (worklist.length > 0) {\n\t\tconst next = worklist.pop();\n\t\tif (next === undefined) {\n\t\t\tbreak;\n\t\t}\n\t\tconst { id, count } = next;\n\t\t// Nested content is keyed per node, so it must be visited one ID at a time.\n\t\tfor (let offset = 0; offset < count; offset += 1) {\n\t\t\tvisitLiveFields(detachIdToNodeChanges.get(id.revision)?.get(brand(id.localId + offset)));\n\t\t}\n\t}\n\n\treturn attached;\n}\n\n/**\n * Returns a mapping from root ID to the field changes for that node.\n * There are entries both for nodes which are detached in the input context,\n * and also for nodes which are detached by this delta.\n * The keys are pre-rename IDs.\n */\nfunction getDeltaNodeChangesByDetachId(delta: DeltaRoot): ChangeAtomIdMap<DeltaFieldMap> {\n\tconst detachIdToChanges: ChangeAtomIdMap<DeltaFieldMap> = new Map();\n\n\tconst visitFields = (fields: DeltaFieldMap): void => {\n\t\tfor (const fieldChange of fields.values()) {\n\t\t\tfor (const mark of fieldChange.marks) {\n\t\t\t\tif (mark.fields !== undefined) {\n\t\t\t\t\tvisitFields(mark.fields);\n\n\t\t\t\t\tif (mark.detach !== undefined) {\n\t\t\t\t\t\tsetInNestedMap(\n\t\t\t\t\t\t\tdetachIdToChanges,\n\t\t\t\t\t\t\tmark.detach.major,\n\t\t\t\t\t\t\tmark.detach.minor,\n\t\t\t\t\t\t\tmark.fields,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tif (delta.fields !== undefined) {\n\t\tvisitFields(delta.fields);\n\t}\n\n\tif (delta.global !== undefined) {\n\t\tfor (const { id, fields } of delta.global) {\n\t\t\tsetInNestedMap(detachIdToChanges, id.major, id.minor, fields);\n\t\t\tvisitFields(fields);\n\t\t}\n\t}\n\n\treturn detachIdToChanges;\n}\n\nfunction outputToInputRootIdFromDelta(delta: DeltaRoot): ChangeAtomIdRangeMap<ChangeAtomId> {\n\tconst outputToInputRootId = newChangeAtomIdTransform();\n\tif (delta.rename !== undefined) {\n\t\tfor (const { oldId, newId, count } of delta.rename) {\n\t\t\toutputToInputRootId.set(\n\t\t\t\tmakeChangeAtomId(brand(newId.minor), newId.major),\n\t\t\t\tcount,\n\t\t\t\tmakeChangeAtomId(brand(oldId.minor), oldId.major),\n\t\t\t);\n\t\t}\n\t}\n\n\treturn outputToInputRootId;\n}\n"]}
|
|
@@ -8,7 +8,7 @@ import { type ChangeAtomIdBTree } from "../changeAtomIdBTree.js";
|
|
|
8
8
|
import type { TreeChunk } from "../chunked-forest/index.js";
|
|
9
9
|
import { type RebaseRevisionMetadata } from "./fieldChangeHandler.js";
|
|
10
10
|
import type { FlexFieldKind } from "./fieldKind.js";
|
|
11
|
-
import { type FieldChangeset, type
|
|
11
|
+
import { type FieldChangeset, type ModularChangeset } from "./modularChangeTypes.js";
|
|
12
12
|
/**
|
|
13
13
|
* Implementation of ChangeFamily which delegates work in a given field to the appropriate FieldKind
|
|
14
14
|
* as determined by the schema.
|
|
@@ -91,13 +91,6 @@ export declare class ModularChangeFamily implements ChangeFamily<ModularEditBuil
|
|
|
91
91
|
private replaceFieldMapRevisions;
|
|
92
92
|
buildEditor(mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<ModularChangeset>) => void): ModularEditBuilder;
|
|
93
93
|
private createEmptyFieldChange;
|
|
94
|
-
validateChangeset(change: ModularChangeset): void;
|
|
95
|
-
/**
|
|
96
|
-
* Asserts that each child and cross field key in each field has a correct entry in
|
|
97
|
-
* `nodeToParent` or `crossFieldKeyTable`.
|
|
98
|
-
* @returns the number of children found.
|
|
99
|
-
*/
|
|
100
|
-
private validateFieldChanges;
|
|
101
94
|
private getEffectiveChange;
|
|
102
95
|
/**
|
|
103
96
|
* Returns a copy of the given changeset with the same declarations (e.g., new cells) but no actual changes.
|
|
@@ -203,6 +196,4 @@ export interface GlobalEditDescription {
|
|
|
203
196
|
builds?: ChangeAtomIdBTree<TreeChunk>;
|
|
204
197
|
}
|
|
205
198
|
export type EditDescription = FieldEditDescription | GlobalEditDescription;
|
|
206
|
-
export declare function getParentFieldId(changeset: ModularChangeset, nodeId: NodeId): FieldId;
|
|
207
|
-
export declare function normalizeFieldId(fieldId: FieldId, nodeAliases: ChangeAtomIdBTree<NodeId>): FieldId;
|
|
208
199
|
//# sourceMappingURL=modularChangeFamily.d.ts.map
|