@fluidframework/tree 2.91.0 → 2.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +158 -0
- package/README.md +1 -1
- package/api-report/tree.alpha.api.md +117 -51
- package/api-report/tree.beta.api.md +41 -12
- package/api-report/tree.legacy.beta.api.md +41 -12
- package/dist/api.d.ts +11 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/codec/codec.d.ts +28 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +1 -0
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +2 -2
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -4
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +18 -36
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +46 -59
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -4
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/forest/forest.d.ts +5 -2
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +8 -1
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/revisionTagCodec.d.ts +4 -3
- package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/dist/core/rebase/revisionTagCodec.js +2 -0
- package/dist/core/rebase/revisionTagCodec.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +2 -2
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +4 -4
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +1 -1
- package/dist/core/schema-stored/formatV2.js +1 -1
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +8 -0
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +63 -7
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/cursor.d.ts +25 -1
- package/dist/core/tree/cursor.d.ts.map +1 -1
- package/dist/core/tree/cursor.js +45 -1
- package/dist/core/tree/cursor.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +13 -1
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +34 -1
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +6 -2
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +11 -0
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +1 -1
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +5 -0
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +5 -6
- 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 +4 -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 +4 -2
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/entrypoints/public.js +1 -1
- package/dist/entrypoints/public.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdCodec.d.ts +4 -3
- package/dist/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdCodec.js +2 -0
- package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -6
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +6 -6
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +115 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +16 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.js +18 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +29 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +6 -4
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +13 -5
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +22 -18
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/cursorComparator.d.ts +23 -0
- package/dist/feature-libraries/cursorComparator.d.ts.map +1 -0
- package/dist/feature-libraries/cursorComparator.js +65 -0
- package/dist/feature-libraries/cursorComparator.js.map +1 -0
- package/dist/feature-libraries/forest-summary/codec.d.ts +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +5 -5
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +3 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +15 -8
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/indexing/types.d.ts +4 -3
- package/dist/feature-libraries/indexing/types.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/types.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +0 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +4 -3
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +2 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/index.js +2 -3
- package/dist/feature-libraries/schema-edits/index.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -54
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +3 -16
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -21
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/index.js +1 -2
- package/dist/feature-libraries/schema-index/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializableDomainSchema.d.ts +5 -5
- package/dist/serializableDomainSchema.d.ts.map +1 -1
- package/dist/serializableDomainSchema.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +14 -21
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +2 -36
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +15 -117
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -22
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +10 -27
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +23 -16
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.js +13 -5
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js +2 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +17 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +3 -0
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +34 -69
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +885 -678
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js +3 -3
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +23 -12
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +40 -67
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +0 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +18 -13
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +6 -9
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +5 -8
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +8 -8
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +5 -4
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +15 -14
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +38 -74
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +0 -1
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +1 -2
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +12 -2
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/sharedTreeAttributes.d.ts.map +1 -1
- package/dist/sharedTreeAttributes.js +3 -0
- package/dist/sharedTreeAttributes.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +4 -1
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
- package/dist/simple-tree/api/identifierIndex.js +1 -1
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +33 -4
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +17 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts +5 -5
- package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +10 -7
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +7 -19
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeAlpha.d.ts +126 -0
- package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -0
- package/dist/simple-tree/api/treeAlpha.js +7 -0
- package/dist/simple-tree/api/treeAlpha.js.map +1 -0
- package/dist/simple-tree/api/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +4 -1
- 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/treeNodeApi.d.ts +108 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +104 -3
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +7 -0
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +45 -8
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +117 -11
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +6 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +3 -0
- package/dist/simple-tree/fieldSchema.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 +4 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +23 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/map/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +6 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +17 -0
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +23 -1
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +4 -5
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +12 -23
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +27 -0
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +321 -11
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +100 -25
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +5 -2
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/referenceCounting.d.ts.map +1 -1
- package/dist/util/referenceCounting.js +0 -1
- package/dist/util/referenceCounting.js.map +1 -1
- package/dist/util/utils.d.ts +0 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +1 -6
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +1 -1
- package/legacy.d.ts +2 -3
- package/lib/api.d.ts +11 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js.map +1 -1
- package/lib/codec/codec.d.ts +28 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +1 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +2 -2
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +18 -36
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +45 -56
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/forest/forest.d.ts +5 -2
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +8 -1
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/revisionTagCodec.d.ts +4 -3
- package/lib/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/lib/core/rebase/revisionTagCodec.js +2 -0
- package/lib/core/rebase/revisionTagCodec.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +2 -2
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +4 -4
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -1
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +8 -0
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +63 -7
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/cursor.d.ts +25 -1
- package/lib/core/tree/cursor.d.ts.map +1 -1
- package/lib/core/tree/cursor.js +43 -0
- package/lib/core/tree/cursor.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +13 -1
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +31 -0
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +2 -2
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +11 -0
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +1 -1
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +5 -0
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/entrypoints/public.js +1 -1
- package/lib/entrypoints/public.js.map +1 -1
- package/lib/feature-libraries/changeAtomIdCodec.d.ts +4 -3
- package/lib/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdCodec.js +2 -0
- package/lib/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +112 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +13 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.js +8 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js +26 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +4 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +13 -5
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +22 -18
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/cursorComparator.d.ts +23 -0
- package/lib/feature-libraries/cursorComparator.d.ts.map +1 -0
- package/lib/feature-libraries/cursorComparator.js +61 -0
- package/lib/feature-libraries/cursorComparator.js.map +1 -0
- package/lib/feature-libraries/forest-summary/codec.d.ts +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +3 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +15 -8
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/indexing/types.d.ts +4 -3
- package/lib/feature-libraries/indexing/types.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/types.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +0 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +4 -3
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/index.js +1 -1
- package/lib/feature-libraries/schema-edits/index.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -50
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +3 -16
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +0 -19
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/index.js +1 -1
- package/lib/feature-libraries/schema-index/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializableDomainSchema.d.ts +5 -5
- package/lib/serializableDomainSchema.d.ts.map +1 -1
- package/lib/serializableDomainSchema.js +4 -1
- package/lib/serializableDomainSchema.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +4 -11
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +2 -36
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +17 -116
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -22
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +11 -27
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +19 -12
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.js +11 -5
- package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js +2 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +17 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -0
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +34 -69
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +889 -683
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +23 -12
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +41 -65
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +0 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +16 -11
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +5 -8
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +3 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +3 -3
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +8 -8
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +5 -4
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +15 -14
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +38 -71
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +0 -1
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +0 -1
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +14 -4
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/sharedTreeAttributes.d.ts.map +1 -1
- package/lib/sharedTreeAttributes.js +3 -0
- package/lib/sharedTreeAttributes.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +4 -1
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
- package/lib/simple-tree/api/identifierIndex.js +1 -1
- package/lib/simple-tree/api/identifierIndex.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +33 -4
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +19 -3
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts +5 -5
- package/lib/simple-tree/api/simpleTreeIndex.js +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +11 -8
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +7 -19
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeAlpha.d.ts +126 -0
- package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -0
- package/lib/simple-tree/api/treeAlpha.js +6 -0
- package/lib/simple-tree/api/treeAlpha.js.map +1 -0
- package/lib/simple-tree/api/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +4 -1
- 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/treeNodeApi.d.ts +108 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +101 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +7 -0
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +45 -8
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +118 -12
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +6 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +3 -0
- 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 +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/map/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +6 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +17 -0
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +24 -2
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/tableSchema.d.ts +4 -5
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +12 -23
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +29 -0
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +321 -11
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +103 -28
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +6 -3
- package/lib/treeFactory.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/referenceCounting.d.ts.map +1 -1
- package/lib/util/referenceCounting.js +0 -1
- package/lib/util/referenceCounting.js.map +1 -1
- package/lib/util/utils.d.ts +0 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +0 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +35 -40
- package/scripts/generate-entrypoint-sources.sh +4 -2
- package/src/api.ts +21 -0
- package/src/codec/codec.ts +32 -2
- package/src/codec/index.ts +2 -3
- package/src/codec/versioned/codec.ts +99 -109
- package/src/codec/versioned/index.ts +1 -3
- package/src/core/forest/forest.ts +5 -2
- package/src/core/index.ts +4 -0
- package/src/core/rebase/changeRebaser.ts +8 -0
- package/src/core/rebase/revisionTagCodec.ts +4 -4
- package/src/core/rebase/utils.ts +9 -2
- package/src/core/schema-stored/formatV2.ts +1 -1
- package/src/core/tree/anchorSet.ts +92 -10
- package/src/core/tree/cursor.ts +52 -1
- package/src/core/tree/deltaUtil.ts +37 -1
- package/src/core/tree/detachedFieldIndexCodecs.ts +4 -4
- package/src/core/tree/index.ts +4 -0
- package/src/core/tree/visitDelta.ts +13 -1
- package/src/core/tree/visitorUtils.ts +5 -0
- package/src/entrypoints/alpha.ts +21 -10
- package/src/entrypoints/beta.ts +7 -1
- package/src/entrypoints/legacy.ts +7 -1
- package/src/entrypoints/public.ts +1 -1
- package/src/feature-libraries/changeAtomIdCodec.ts +8 -7
- package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -2
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +18 -13
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +16 -10
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -14
- package/src/feature-libraries/chunked-forest/codec/{formatGeneric.ts → format/formatGeneric.ts} +1 -1
- package/src/feature-libraries/chunked-forest/codec/{format.ts → format/formatV1.ts} +41 -111
- package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +31 -0
- package/src/feature-libraries/chunked-forest/codec/format/index.ts +31 -0
- package/src/feature-libraries/chunked-forest/codec/format/versions.ts +81 -0
- package/src/feature-libraries/chunked-forest/codec/index.ts +6 -2
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +19 -12
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +6 -4
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +10 -10
- package/src/feature-libraries/chunked-forest/index.ts +2 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +42 -20
- package/src/feature-libraries/cursorComparator.ts +77 -0
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +5 -5
- package/src/feature-libraries/index.ts +5 -3
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +21 -10
- package/src/feature-libraries/indexing/types.ts +5 -3
- package/src/feature-libraries/mitigatedChangeFamily.ts +4 -1
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +4 -5
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +0 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +19 -26
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +4 -4
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -5
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +6 -2
- package/src/feature-libraries/object-forest/objectForest.ts +8 -2
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +11 -13
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +4 -5
- package/src/feature-libraries/schema-edits/index.ts +1 -4
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +10 -78
- package/src/feature-libraries/schema-index/codec.ts +0 -25
- package/src/feature-libraries/schema-index/formatV2.ts +1 -1
- package/src/feature-libraries/schema-index/index.ts +1 -4
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +6 -6
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +8 -5
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +4 -5
- package/src/index.ts +14 -3
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +6 -0
- package/src/shared-tree/independentView.ts +5 -18
- package/src/shared-tree/index.ts +0 -4
- package/src/shared-tree/schematizingTreeView.ts +19 -165
- package/src/shared-tree/sharedTree.ts +16 -59
- package/src/shared-tree/sharedTreeChangeCodecs.ts +23 -29
- package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -2
- package/src/shared-tree/sharedTreeChangeFamily.ts +2 -0
- package/src/shared-tree/sharedTreeChangeFormat.ts +23 -8
- package/src/shared-tree/tree.ts +2 -5
- package/src/shared-tree/treeAlpha.ts +30 -0
- package/src/shared-tree/treeCheckout.ts +275 -99
- package/src/shared-tree/unhydratedTreeContext.ts +1 -1
- package/src/shared-tree-core/editManagerCodecs.ts +99 -124
- package/src/shared-tree-core/editManagerCodecsCommons.ts +0 -1
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +54 -59
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +72 -95
- package/src/shared-tree-core/index.ts +4 -8
- package/src/shared-tree-core/messageCodecV1ToV4.ts +56 -71
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +76 -92
- package/src/shared-tree-core/messageCodecs.ts +88 -126
- package/src/shared-tree-core/messageFormat.ts +0 -3
- package/src/shared-tree-core/sharedTreeCore.ts +14 -21
- package/src/sharedTreeAttributes.ts +3 -0
- package/src/simple-tree/api/discrepancies.ts +6 -1
- package/src/simple-tree/api/identifierIndex.ts +2 -2
- package/src/simple-tree/api/index.ts +14 -0
- package/src/simple-tree/api/schemaFactory.ts +0 -2
- package/src/simple-tree/api/schemaFactoryAlpha.ts +80 -4
- package/src/simple-tree/api/simpleTreeIndex.ts +6 -6
- package/src/simple-tree/api/storedSchema.ts +12 -20
- package/src/simple-tree/api/tree.ts +7 -20
- package/src/simple-tree/api/treeAlpha.ts +153 -0
- package/src/simple-tree/api/treeBeta.ts +1 -1
- package/src/simple-tree/api/treeChangeEvents.ts +4 -1
- package/src/simple-tree/api/treeNodeApi.ts +189 -3
- package/src/simple-tree/core/toStored.ts +8 -0
- package/src/simple-tree/core/treeNodeKernel.ts +53 -7
- package/src/simple-tree/core/unhydratedFlexTree.ts +137 -9
- package/src/simple-tree/fieldSchema.ts +10 -0
- package/src/simple-tree/index.ts +15 -0
- package/src/simple-tree/node-kinds/array/arrayNode.ts +64 -0
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +25 -1
- package/src/simple-tree/node-kinds/array/index.ts +2 -0
- package/src/simple-tree/node-kinds/index.ts +3 -0
- package/src/simple-tree/node-kinds/map/index.ts +1 -0
- package/src/simple-tree/node-kinds/map/mapNode.ts +20 -3
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +6 -6
- package/src/simple-tree/simpleSchema.ts +20 -0
- package/src/simple-tree/toStoredSchema.ts +28 -1
- package/src/tableSchema.ts +16 -28
- package/src/text/textDomain.ts +68 -1
- package/src/text/textDomainFormatted.ts +113 -11
- package/src/treeFactory.ts +10 -5
- package/src/util/index.ts +0 -1
- package/src/util/referenceCounting.ts +0 -1
- package/src/util/utils.ts +0 -2
- package/.mocharc.customBenchmarks.cjs +0 -25
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +0 -191
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +0 -188
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
- /package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
- /package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
6
|
+
var useValue = arguments.length > 2;
|
|
7
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
8
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
9
|
+
}
|
|
10
|
+
return useValue ? value : void 0;
|
|
11
|
+
};
|
|
12
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
13
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
14
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
15
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
16
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
17
|
+
var _, done = false;
|
|
18
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
19
|
+
var context = {};
|
|
20
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
21
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
22
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
23
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
24
|
+
if (kind === "accessor") {
|
|
25
|
+
if (result === void 0) continue;
|
|
26
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
27
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
28
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
29
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
30
|
+
}
|
|
31
|
+
else if (_ = accept(result)) {
|
|
32
|
+
if (kind === "field") initializers.unshift(_);
|
|
33
|
+
else descriptor[key] = _;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
37
|
+
done = true;
|
|
38
|
+
};
|
|
5
39
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
6
40
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7
41
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -13,18 +47,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
47
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
48
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
49
|
};
|
|
16
|
-
var _TreeCheckout_events, _TreeCheckout_transaction, _TreeCheckout_validatedCommits;
|
|
17
50
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
18
51
|
import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
19
52
|
import { isStableId } from "@fluidframework/id-compressor/internal";
|
|
20
53
|
import { UsageError, } from "@fluidframework/telemetry-utils/internal";
|
|
21
54
|
import { FluidClientVersion, FormatValidatorNoOp, } from "../codec/index.js";
|
|
22
|
-
import {
|
|
23
|
-
import { allowsRepoSuperset, buildForest, createNodeIdentifierManager, defaultSchemaPolicy, fieldBatchCodecBuilder, intoDelta, jsonableTreeFromCursor, } from "../feature-libraries/index.js";
|
|
24
|
-
import { SquashingTransactionStack, SharedTreeBranch, TransactionResult, onForkTransitive, } from "../shared-tree-core/index.js";
|
|
25
|
-
import { customFromCursorStored, } from "../simple-tree/index.js";
|
|
26
|
-
import { Breakable, disposeSymbol, getOrCreate, hasSome, } from "../util/index.js";
|
|
27
|
-
import {
|
|
55
|
+
import { CommitKind, RevertibleStatus, TreeStoredSchemaRepository, combineVisitors, makeDetachedFieldIndex, rebaseChange, rootFieldKey, tagChange, visitDelta, isAncestor, moveToDetachedField, LeafNodeStoredSchema, diffHistories, makeAnonChange, deltaFieldMapHasVisibleChanges, } from "../core/index.js";
|
|
56
|
+
import { allowsRepoSuperset, buildForest, createNodeIdentifierManager, defaultSchemaPolicy, fieldBatchCodecBuilder, TreeStatus, intoDelta, jsonableTreeFromCursor, } from "../feature-libraries/index.js";
|
|
57
|
+
import { SquashingTransactionStack, SharedTreeBranch, TransactionResult as InternalTransactionResult, onForkTransitive, } from "../shared-tree-core/index.js";
|
|
58
|
+
import { getInnerNode, getKernel, customFromCursorStored, } from "../simple-tree/index.js";
|
|
59
|
+
import { Breakable, breakingMethod, disposeSymbol, getOrCreate, hasSome, throwIfBroken, } from "../util/index.js";
|
|
60
|
+
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
28
61
|
import { SharedTreeChangeEnricher } from "./sharedTreeChangeEnricher.js";
|
|
29
62
|
import { SharedTreeChangeFamily, hasSchemaChange } from "./sharedTreeChangeFamily.js";
|
|
30
63
|
/**
|
|
@@ -83,718 +116,872 @@ export function createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCod
|
|
|
83
116
|
return new TreeCheckout(branch, true, changeFamily, schema, forest, mintRevisionTag, revisionTagCodec, idCompressor, args?.removedRoots, args?.logger, breaker, args?.disposeForksAfterTransaction);
|
|
84
117
|
}
|
|
85
118
|
/**
|
|
86
|
-
*
|
|
119
|
+
* Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.
|
|
87
120
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.revertibleCommitBranches = new Map();
|
|
117
|
-
_TreeCheckout_events.set(this, createEmitter());
|
|
118
|
-
this.events = __classPrivateFieldGet(this, _TreeCheckout_events, "f");
|
|
119
|
-
this.onAfterBranchChange = (event) => {
|
|
120
|
-
// The following logic allows revertibles to be generated for the change.
|
|
121
|
-
// Currently only appends (including merges and transaction commits) are supported.
|
|
122
|
-
if (event.type === "append") {
|
|
123
|
-
// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
|
|
124
|
-
// Figure out a way to generate revertibles before the commits are garbage collected.
|
|
125
|
-
for (const commit of event.newCommits) {
|
|
126
|
-
const kind = event.type === "append" ? event.kind : CommitKind.Default;
|
|
127
|
-
const { change, revision } = commit;
|
|
128
|
-
const getRevertible = hasSchemaChange(change)
|
|
129
|
-
? undefined
|
|
130
|
-
: (onRevertibleDisposed) => {
|
|
131
|
-
if (!withinEventContext) {
|
|
132
|
-
throw new UsageError("Cannot get a revertible outside of the context of a changed event.");
|
|
133
|
-
}
|
|
134
|
-
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
135
|
-
throw new UsageError("Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.");
|
|
136
|
-
}
|
|
137
|
-
const revertible = this.createRevertible(revision, kind, this, onRevertibleDisposed);
|
|
138
|
-
this.revertibleCommitBranches.set(revision, __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.fork(commit));
|
|
139
|
-
this.revertibles.add(revertible);
|
|
140
|
-
return revertible;
|
|
141
|
-
};
|
|
142
|
-
let withinEventContext = true;
|
|
143
|
-
const metadata = {
|
|
144
|
-
kind,
|
|
145
|
-
isLocal: true,
|
|
146
|
-
getChange: () => {
|
|
147
|
-
const context = {
|
|
148
|
-
idCompressor: this.idCompressor,
|
|
149
|
-
originatorId: this.idCompressor.localSessionId,
|
|
150
|
-
revision,
|
|
151
|
-
};
|
|
152
|
-
const encodedChange = this.changeFamily.codecs.resolve(4).encode(change, context);
|
|
153
|
-
assert(commit.parent !== undefined, 0xca4 /* Expected applied commit to be parented */);
|
|
154
|
-
return {
|
|
155
|
-
version: 1,
|
|
156
|
-
revision,
|
|
157
|
-
originatorId: this.idCompressor.localSessionId,
|
|
158
|
-
change: encodedChange,
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
getRevertible: (onDisposed) => getRevertible?.(onDisposed),
|
|
162
|
-
label: this.labelTreeNode?.label,
|
|
163
|
-
labels: buildLabelsSet(this.labelTreeNode),
|
|
164
|
-
};
|
|
165
|
-
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", metadata, getRevertible);
|
|
166
|
-
withinEventContext = false;
|
|
121
|
+
function getCheckout(context) {
|
|
122
|
+
if (context instanceof TreeCheckout) {
|
|
123
|
+
return context;
|
|
124
|
+
}
|
|
125
|
+
if (context instanceof SchematizingSimpleTreeView) {
|
|
126
|
+
return context.checkout;
|
|
127
|
+
}
|
|
128
|
+
throw new UsageError("Unsupported context implementation");
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Adds constraints to a `checkout`'s pending transaction.
|
|
132
|
+
*
|
|
133
|
+
* @param checkout - The checkout whose transaction will have the constraints added to it.
|
|
134
|
+
* @param constraintsOnRevert - If true, use {@link ISharedTreeEditor.addNodeExistsConstraintOnRevert}.
|
|
135
|
+
* @param constraints - The constraints to add to the transaction.
|
|
136
|
+
*
|
|
137
|
+
* @see {@link RunTransactionParams.preconditions}.
|
|
138
|
+
*/
|
|
139
|
+
export function addConstraintsToTransaction(checkout, constraintsOnRevert, constraints = []) {
|
|
140
|
+
for (const constraint of constraints) {
|
|
141
|
+
assertValidConstraint(constraint, constraintsOnRevert);
|
|
142
|
+
const constraintType = constraint.type;
|
|
143
|
+
switch (constraintType) {
|
|
144
|
+
case "nodeInDocument": {
|
|
145
|
+
const node = getInnerNode(constraint.node);
|
|
146
|
+
assert(node.isHydrated(), 0xbc2 /* In document node must be hydrated. */);
|
|
147
|
+
if (constraintsOnRevert) {
|
|
148
|
+
checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);
|
|
167
149
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
171
|
-
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", {
|
|
172
|
-
isLocal: false,
|
|
173
|
-
kind: CommitKind.Default,
|
|
174
|
-
labels: new Set(),
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
this.onAfterChange = (event) => {
|
|
179
|
-
this.editLock.lock();
|
|
180
|
-
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("beforeBatch", event);
|
|
181
|
-
if (event.change !== undefined) {
|
|
182
|
-
const revision = event.type === "rebase"
|
|
183
|
-
? __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead().revision
|
|
184
|
-
: event.change.revision;
|
|
185
|
-
this.applyChange(event.change.change, revision);
|
|
186
|
-
}
|
|
187
|
-
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
188
|
-
this.editLock.unlock();
|
|
189
|
-
if (event.type === "append") {
|
|
190
|
-
for (const commit of event.newCommits) {
|
|
191
|
-
this.validateCommit(commit);
|
|
150
|
+
else {
|
|
151
|
+
checkout.editor.addNodeExistsConstraint(node.anchorNode);
|
|
192
152
|
}
|
|
153
|
+
break;
|
|
193
154
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// get all the roots last created or used by the revision
|
|
201
|
-
const roots = this._removedRoots.getRootsLastTouchedByRevision(revision);
|
|
202
|
-
// get the detached field for the root and delete it from the removed roots
|
|
203
|
-
for (const root of roots) {
|
|
204
|
-
visitor.destroy(this._removedRoots.toFieldKey(root), 1);
|
|
205
|
-
}
|
|
206
|
-
this._removedRoots.deleteRootsLastTouchedByRevision(revision);
|
|
155
|
+
case "noChange": {
|
|
156
|
+
if (constraintsOnRevert) {
|
|
157
|
+
checkout.editor.addNoChangeConstraintOnRevert();
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
checkout.editor.addNoChangeConstraint();
|
|
207
161
|
}
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* The {@link Transactor} for this checkout.
|
|
212
|
-
* @remarks In the context of a checkout, transactions allow edits to be batched into atomic units.
|
|
213
|
-
* Edits made during a transaction will update the local state of the tree immediately, but will be squashed into a single edit when the transaction is committed.
|
|
214
|
-
* If the transaction is aborted, the local state will be reset to what it was before the transaction began.
|
|
215
|
-
* Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.
|
|
216
|
-
*
|
|
217
|
-
* To avoid updating observers of the view state with intermediate results during a transaction,
|
|
218
|
-
* use {@link ITreeCheckout#branch} and {@link ISharedTreeFork#merge}.
|
|
219
|
-
*/
|
|
220
|
-
_TreeCheckout_transaction.set(this, void 0);
|
|
221
|
-
// #region Commit Validation
|
|
222
|
-
/** Used to maintain the contract of {@link onCommitValid}(). */
|
|
223
|
-
_TreeCheckout_validatedCommits.set(this, new WeakMap());
|
|
224
|
-
// #endregion Commit Validation
|
|
225
|
-
// #region Enrichment
|
|
226
|
-
/**
|
|
227
|
-
* Statistics about enrichment operations performed by this checkout.
|
|
228
|
-
* Used for testing. May be used for telemetry in the future.
|
|
229
|
-
* The performance cost of maintaining this information is negligible.
|
|
230
|
-
*/
|
|
231
|
-
this.enrichmentStats = { batches: 0, diffs: 0, commitsEnriched: 0, refreshers: 0, forks: 0, applied: 0 };
|
|
232
|
-
__classPrivateFieldSet(this, _TreeCheckout_transaction, this.createTransactionStack(branch), "f");
|
|
233
|
-
this.editLock = new EditLock(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEditor);
|
|
234
|
-
this.registerForBranchEvents();
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Pushes a new label node for a transaction nesting level.
|
|
238
|
-
*
|
|
239
|
-
* @param label - The label for this transaction level.
|
|
240
|
-
*
|
|
241
|
-
* @remarks
|
|
242
|
-
* Called at the start of each transaction (including nested ones).
|
|
243
|
-
* Creates a new {@link LabelTree} node as a child of the current deepest node (if any),
|
|
244
|
-
* or as the root if this is the outermost transaction.
|
|
245
|
-
*/
|
|
246
|
-
pushLabelFrame(label) {
|
|
247
|
-
const node = { label, sublabels: [] };
|
|
248
|
-
if (this.labelTreeNode === undefined) {
|
|
249
|
-
this.labelTreeNode = node;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
const current = this.currentLabelNode();
|
|
253
|
-
assert(current !== undefined, 0xcdb /* Expected current label node to exist */);
|
|
254
|
-
current.sublabels.push(node);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Returns the deepest open node on the right side of the label tree, which corresponds
|
|
259
|
-
* to the current (most recently pushed, not yet committed or aborted) transaction.
|
|
260
|
-
* Returns `undefined` when {@link TreeCheckout.labelTreeNode} is not set.
|
|
261
|
-
*/
|
|
262
|
-
currentLabelNode() {
|
|
263
|
-
if (this.labelTreeNode === undefined) {
|
|
264
|
-
return undefined;
|
|
265
|
-
}
|
|
266
|
-
// Walk down the right spine of the tree. Only one closed node is ever reachable
|
|
267
|
-
// during this traversal, so a single pointer (mostRecentlyClosedLabelNode) suffices
|
|
268
|
-
// to stop descending past committed nodes.
|
|
269
|
-
let node = this.labelTreeNode;
|
|
270
|
-
while (node.sublabels.length > 0) {
|
|
271
|
-
const lastChild = node.sublabels[node.sublabels.length - 1];
|
|
272
|
-
assert(lastChild !== undefined, 0xcdc /* Expected label tree node to have children */);
|
|
273
|
-
if (lastChild === this.mostRecentlyClosedLabelNode) {
|
|
274
162
|
break;
|
|
275
163
|
}
|
|
276
|
-
|
|
164
|
+
default: {
|
|
165
|
+
unreachableCase(constraintType);
|
|
166
|
+
}
|
|
277
167
|
}
|
|
278
|
-
return node;
|
|
279
168
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (node === this.labelTreeNode) {
|
|
292
|
-
this.labelTreeNode = undefined;
|
|
293
|
-
this.mostRecentlyClosedLabelNode = undefined;
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
// Temporarily mark node as closed so currentLabelNode() returns its parent.
|
|
297
|
-
this.mostRecentlyClosedLabelNode = node;
|
|
298
|
-
const parent = this.currentLabelNode();
|
|
299
|
-
assert(parent !== undefined, 0xcdd /* Expected parent label node to exist */);
|
|
300
|
-
parent.sublabels.pop();
|
|
301
|
-
// Point to the parent's new last child (guaranteed closed if it exists),
|
|
302
|
-
// or undefined if the parent has no more children.
|
|
303
|
-
const newLastChild = parent.sublabels[parent.sublabels.length - 1];
|
|
304
|
-
this.mostRecentlyClosedLabelNode = newLastChild;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Throws if the given {@link TransactionConstraintAlpha | transaction constraint} is not currently satisfied.
|
|
172
|
+
*/
|
|
173
|
+
export function assertValidConstraint(constraint, onRevert) {
|
|
174
|
+
switch (constraint.type) {
|
|
175
|
+
case "nodeInDocument": {
|
|
176
|
+
const nodeStatus = getKernel(constraint.node).getStatus();
|
|
177
|
+
if (nodeStatus !== TreeStatus.InDocument) {
|
|
178
|
+
const revertText = onRevert ? " on revert" : "";
|
|
179
|
+
throw new UsageError(`Attempted to add a "nodeInDocument" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`);
|
|
305
180
|
}
|
|
181
|
+
break;
|
|
306
182
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Helper method for {@link SchematizingSimpleTreeView.runTransaction} to properly clear transaction labels once the function completes.
|
|
313
|
-
*
|
|
314
|
-
* @remarks
|
|
315
|
-
* The label is stored during the execution of the function and will be included in the {@link ChangeMetadata} of the transaction.
|
|
316
|
-
*
|
|
317
|
-
* Labels supplied to nested transactions are ignored - only the outermost transaction label is ever used.
|
|
318
|
-
*
|
|
319
|
-
* @param fn - The function to execute. It receives the user provided transaction label as an optional parameter.
|
|
320
|
-
* @param label - The label to associate with the outermost transaction.
|
|
321
|
-
* @returns The result of executing `fn`.
|
|
322
|
-
*/
|
|
323
|
-
runWithTransactionLabel(fn, label) {
|
|
324
|
-
try {
|
|
325
|
-
return fn(label);
|
|
183
|
+
case "noChange": {
|
|
184
|
+
// This constraint is always satisfied at the time of checking, since it just requires that no changes have been made since the transaction callback returned.
|
|
185
|
+
break;
|
|
326
186
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
// Inner transactions' commits don't fire the "changed" event, so the label tree
|
|
330
|
-
// must remain intact until the outermost commit reads it.
|
|
331
|
-
if (this.transaction.size === 0) {
|
|
332
|
-
this.labelTreeNode = undefined;
|
|
333
|
-
this.mostRecentlyClosedLabelNode = undefined;
|
|
334
|
-
}
|
|
187
|
+
default: {
|
|
188
|
+
unreachableCase(constraint);
|
|
335
189
|
}
|
|
336
190
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* An implementation of {@link ITreeCheckout}.
|
|
194
|
+
*/
|
|
195
|
+
let TreeCheckout = (() => {
|
|
196
|
+
var _a, _TreeCheckout_events, _TreeCheckout_transaction, _TreeCheckout_validatedCommits;
|
|
197
|
+
let _instanceExtraInitializers = [];
|
|
198
|
+
let _exportVerbose_decorators;
|
|
199
|
+
let _applySerializedChange_decorators;
|
|
200
|
+
let _applyChange_decorators;
|
|
201
|
+
let _runTransaction_decorators;
|
|
202
|
+
let _runTransactionAsync_decorators;
|
|
203
|
+
let _viewWith_decorators;
|
|
204
|
+
let _fork_decorators;
|
|
205
|
+
return _a = class TreeCheckout {
|
|
206
|
+
constructor(branch,
|
|
207
|
+
/** True if and only if this checkout is for a branch which is persisted and shared with other clients. */
|
|
208
|
+
isSharedBranch, changeFamily, storedSchema, forest, mintRevisionTag, revisionTagCodec, idCompressor, _removedRoots = makeDetachedFieldIndex("repair", revisionTagCodec, idCompressor),
|
|
209
|
+
/** Optional logger for telemetry. */
|
|
210
|
+
logger, breaker = new Breakable("TreeCheckout"), disposeForksAfterTransaction = true) {
|
|
211
|
+
this.isSharedBranch = (__runInitializers(this, _instanceExtraInitializers), isSharedBranch);
|
|
212
|
+
this.changeFamily = changeFamily;
|
|
213
|
+
this.storedSchema = storedSchema;
|
|
214
|
+
this.forest = forest;
|
|
215
|
+
this.mintRevisionTag = mintRevisionTag;
|
|
216
|
+
this.revisionTagCodec = revisionTagCodec;
|
|
217
|
+
this.idCompressor = idCompressor;
|
|
218
|
+
this._removedRoots = _removedRoots;
|
|
219
|
+
this.logger = logger;
|
|
220
|
+
this.breaker = breaker;
|
|
221
|
+
this.disposeForksAfterTransaction = disposeForksAfterTransaction;
|
|
222
|
+
this.disposed = false;
|
|
223
|
+
this.views = new Set();
|
|
224
|
+
/**
|
|
225
|
+
* Set of revertibles maintained for automatic disposal
|
|
226
|
+
*/
|
|
227
|
+
this.revertibles = new Set();
|
|
228
|
+
/**
|
|
229
|
+
* Each branch's head commit corresponds to a revertible commit.
|
|
230
|
+
* Maintaining a whole branch ensures the commit graph is not pruned in a way that would prevent the commit from
|
|
231
|
+
* being reverted.
|
|
232
|
+
*/
|
|
233
|
+
this.revertibleCommitBranches = new Map();
|
|
234
|
+
_TreeCheckout_events.set(this, createEmitter());
|
|
235
|
+
this.events = __classPrivateFieldGet(this, _TreeCheckout_events, "f");
|
|
236
|
+
this.onAfterBranchChange = (event) => {
|
|
237
|
+
// The following logic allows revertibles to be generated for the change.
|
|
238
|
+
// Currently only appends (including merges and transaction commits) are supported.
|
|
239
|
+
if (event.type === "append") {
|
|
240
|
+
// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
|
|
241
|
+
// Figure out a way to generate revertibles before the commits are garbage collected.
|
|
242
|
+
for (const commit of event.newCommits) {
|
|
243
|
+
const kind = event.type === "append" ? event.kind : CommitKind.Default;
|
|
244
|
+
const { change, revision } = commit;
|
|
245
|
+
const getRevertible = hasSchemaChange(change)
|
|
246
|
+
? undefined
|
|
247
|
+
: (onRevertibleDisposed) => {
|
|
248
|
+
if (!withinEventContext) {
|
|
249
|
+
throw new UsageError("Cannot get a revertible outside of the context of a changed event.");
|
|
250
|
+
}
|
|
251
|
+
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
252
|
+
throw new UsageError("Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.");
|
|
253
|
+
}
|
|
254
|
+
const revertible = this.createRevertible(revision, kind, this, onRevertibleDisposed);
|
|
255
|
+
this.revertibleCommitBranches.set(revision, __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.fork(commit));
|
|
256
|
+
this.revertibles.add(revertible);
|
|
257
|
+
return revertible;
|
|
258
|
+
};
|
|
259
|
+
let withinEventContext = true;
|
|
260
|
+
const metadata = {
|
|
261
|
+
kind,
|
|
262
|
+
isLocal: true,
|
|
263
|
+
getChange: () => {
|
|
264
|
+
const context = {
|
|
265
|
+
idCompressor: this.idCompressor,
|
|
266
|
+
originatorId: this.idCompressor.localSessionId,
|
|
267
|
+
revision,
|
|
268
|
+
};
|
|
269
|
+
const encodedChange = this.changeFamily.codecs.resolve(4).encode(change, context);
|
|
270
|
+
assert(commit.parent !== undefined, 0xca4 /* Expected applied commit to be parented */);
|
|
271
|
+
return {
|
|
272
|
+
version: 1,
|
|
273
|
+
revision,
|
|
274
|
+
originatorId: this.idCompressor.localSessionId,
|
|
275
|
+
change: encodedChange,
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
getRevertible: (onDisposed) => getRevertible?.(onDisposed),
|
|
279
|
+
label: this.labelTreeNode?.label,
|
|
280
|
+
labels: buildLabelsSet(this.labelTreeNode),
|
|
281
|
+
};
|
|
282
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", metadata, getRevertible);
|
|
283
|
+
withinEventContext = false;
|
|
364
284
|
}
|
|
365
|
-
break;
|
|
366
285
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
286
|
+
else if (this.isRemoteChangeEvent(event)) {
|
|
287
|
+
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
288
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", {
|
|
289
|
+
isLocal: false,
|
|
290
|
+
kind: CommitKind.Default,
|
|
291
|
+
labels: new Set(),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
this.onAfterChange = (event) => {
|
|
296
|
+
this.editLock.lock();
|
|
297
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("beforeBatch", event);
|
|
298
|
+
if (event.change !== undefined) {
|
|
299
|
+
const revision = event.type === "rebase"
|
|
300
|
+
? __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead().revision
|
|
301
|
+
: event.change.revision;
|
|
302
|
+
this.applyInternalChange(event.change.change, revision);
|
|
303
|
+
}
|
|
304
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
305
|
+
this.editLock.unlock();
|
|
306
|
+
if (event.type === "append") {
|
|
307
|
+
for (const commit of event.newCommits) {
|
|
308
|
+
this.validateCommit(commit);
|
|
370
309
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
this.onAncestryTrimmed = (revisions) => {
|
|
313
|
+
// When the branch is trimmed, we can garbage collect any repair data whose latest relevant revision is one of the
|
|
314
|
+
// trimmed revisions.
|
|
315
|
+
this.withCombinedVisitor((visitor) => {
|
|
316
|
+
for (const revision of revisions) {
|
|
317
|
+
// get all the roots last created or used by the revision
|
|
318
|
+
const roots = this._removedRoots.getRootsLastTouchedByRevision(revision);
|
|
319
|
+
// get the detached field for the root and delete it from the removed roots
|
|
320
|
+
for (const root of roots) {
|
|
321
|
+
visitor.destroy(this._removedRoots.toFieldKey(root), 1);
|
|
322
|
+
}
|
|
323
|
+
this._removedRoots.deleteRootsLastTouchedByRevision(revision);
|
|
374
324
|
}
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* The {@link Transactor} for this checkout.
|
|
329
|
+
* @remarks In the context of a checkout, transactions allow edits to be batched into atomic units.
|
|
330
|
+
* Edits made during a transaction will update the local state of the tree immediately, but will be squashed into a single edit when the transaction is committed.
|
|
331
|
+
* If the transaction is aborted, the local state will be reset to what it was before the transaction began.
|
|
332
|
+
* Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.
|
|
333
|
+
*
|
|
334
|
+
* To avoid updating observers of the view state with intermediate results during a transaction,
|
|
335
|
+
* use {@link ITreeCheckout#fork} and {@link ISharedTreeFork#merge}.
|
|
336
|
+
*/
|
|
337
|
+
_TreeCheckout_transaction.set(this, void 0);
|
|
338
|
+
// #region Commit Validation
|
|
339
|
+
/** Used to maintain the contract of {@link onCommitValid}(). */
|
|
340
|
+
_TreeCheckout_validatedCommits.set(this, new WeakMap());
|
|
341
|
+
// #endregion Commit Validation
|
|
342
|
+
// #region Enrichment
|
|
343
|
+
/**
|
|
344
|
+
* Statistics about enrichment operations performed by this checkout.
|
|
345
|
+
* Used for testing. May be used for telemetry in the future.
|
|
346
|
+
* The performance cost of maintaining this information is negligible.
|
|
347
|
+
*/
|
|
348
|
+
this.enrichmentStats = { batches: 0, diffs: 0, commitsEnriched: 0, refreshers: 0, forks: 0, applied: 0 };
|
|
349
|
+
__classPrivateFieldSet(this, _TreeCheckout_transaction, this.createTransactionStack(branch), "f");
|
|
350
|
+
this.editLock = new EditLock(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEditor);
|
|
351
|
+
this.registerForBranchEvents();
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Pushes a new label node for a transaction nesting level.
|
|
355
|
+
*
|
|
356
|
+
* @param label - The label for this transaction level.
|
|
357
|
+
*
|
|
358
|
+
* @remarks
|
|
359
|
+
* Called at the start of each transaction (including nested ones).
|
|
360
|
+
* Creates a new {@link LabelTree} node as a child of the current deepest node (if any),
|
|
361
|
+
* or as the root if this is the outermost transaction.
|
|
362
|
+
*/
|
|
363
|
+
pushLabelFrame(label) {
|
|
364
|
+
const node = { label, sublabels: [] };
|
|
365
|
+
if (this.labelTreeNode === undefined) {
|
|
366
|
+
this.labelTreeNode = node;
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
const current = this.currentLabelNode();
|
|
370
|
+
assert(current !== undefined, 0xcdb /* Expected current label node to exist */);
|
|
371
|
+
current.sublabels.push(node);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Returns the deepest open node on the right side of the label tree, which corresponds
|
|
376
|
+
* to the current (most recently pushed, not yet committed or aborted) transaction.
|
|
377
|
+
* Returns `undefined` when {@link TreeCheckout.labelTreeNode} is not set.
|
|
378
|
+
*/
|
|
379
|
+
currentLabelNode() {
|
|
380
|
+
if (this.labelTreeNode === undefined) {
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
// Walk down the right spine of the tree. Only one closed node is ever reachable
|
|
384
|
+
// during this traversal, so a single pointer (mostRecentlyClosedLabelNode) suffices
|
|
385
|
+
// to stop descending past committed nodes.
|
|
386
|
+
let node = this.labelTreeNode;
|
|
387
|
+
while (node.sublabels.length > 0) {
|
|
388
|
+
const lastChild = node.sublabels[node.sublabels.length - 1];
|
|
389
|
+
assert(lastChild !== undefined, 0xcdc /* Expected label tree node to have children */);
|
|
390
|
+
if (lastChild === this.mostRecentlyClosedLabelNode) {
|
|
375
391
|
break;
|
|
376
392
|
}
|
|
377
|
-
|
|
378
|
-
|
|
393
|
+
node = lastChild;
|
|
394
|
+
}
|
|
395
|
+
return node;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Pops the current label frame from the label tree.
|
|
399
|
+
* @param aborted - If true, the node is removed from the tree (transaction was aborted).
|
|
400
|
+
* If false, the node is kept in the tree but marked as closed (transaction was committed).
|
|
401
|
+
*/
|
|
402
|
+
popLabelFrame(aborted) {
|
|
403
|
+
const node = this.currentLabelNode();
|
|
404
|
+
if (node === undefined) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (aborted) {
|
|
408
|
+
if (node === this.labelTreeNode) {
|
|
409
|
+
this.labelTreeNode = undefined;
|
|
410
|
+
this.mostRecentlyClosedLabelNode = undefined;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
// Temporarily mark node as closed so currentLabelNode() returns its parent.
|
|
414
|
+
this.mostRecentlyClosedLabelNode = node;
|
|
415
|
+
const parent = this.currentLabelNode();
|
|
416
|
+
assert(parent !== undefined, 0xcdd /* Expected parent label node to exist */);
|
|
417
|
+
parent.sublabels.pop();
|
|
418
|
+
// Point to the parent's new last child (guaranteed closed if it exists),
|
|
419
|
+
// or undefined if the parent has no more children.
|
|
420
|
+
const newLastChild = parent.sublabels[parent.sublabels.length - 1];
|
|
421
|
+
this.mostRecentlyClosedLabelNode = newLastChild;
|
|
379
422
|
}
|
|
380
423
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
exportVerbose() {
|
|
386
|
-
const cursor = this.forest.allocateCursor("contentSnapshot");
|
|
387
|
-
try {
|
|
388
|
-
moveToDetachedField(this.forest, cursor);
|
|
389
|
-
const length = cursor.getFieldLength();
|
|
390
|
-
if (length === 0) {
|
|
391
|
-
return undefined;
|
|
424
|
+
else {
|
|
425
|
+
this.mostRecentlyClosedLabelNode = node;
|
|
426
|
+
}
|
|
392
427
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
428
|
+
/**
|
|
429
|
+
* Helper method for {@link SchematizingSimpleTreeView.runTransaction} to properly clear transaction labels once the function completes.
|
|
430
|
+
*
|
|
431
|
+
* @remarks
|
|
432
|
+
* The label is stored during the execution of the function and will be included in the {@link ChangeMetadata} of the transaction.
|
|
433
|
+
*
|
|
434
|
+
* Labels supplied to nested transactions are ignored - only the outermost transaction label is ever used.
|
|
435
|
+
*
|
|
436
|
+
* @param fn - The function to execute. It receives the user provided transaction label as an optional parameter.
|
|
437
|
+
* @param label - The label to associate with the outermost transaction.
|
|
438
|
+
* @returns The result of executing `fn`.
|
|
439
|
+
*/
|
|
440
|
+
runWithTransactionLabel(fn, label) {
|
|
441
|
+
try {
|
|
442
|
+
return fn(label);
|
|
443
|
+
}
|
|
444
|
+
finally {
|
|
445
|
+
// Only clear the label tree when the outermost transaction has completed.
|
|
446
|
+
// Inner transactions' commits don't fire the "changed" event, so the label tree
|
|
447
|
+
// must remain intact until the outermost commit reads it.
|
|
448
|
+
if (this.transaction.size === 0) {
|
|
449
|
+
this.labelTreeNode = undefined;
|
|
450
|
+
this.mostRecentlyClosedLabelNode = undefined;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
396
453
|
}
|
|
397
|
-
|
|
398
|
-
|
|
454
|
+
get removedRoots() {
|
|
455
|
+
return this._removedRoots;
|
|
399
456
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
457
|
+
registerForBranchEvents() {
|
|
458
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.events.on("afterChange", this.onAfterBranchChange);
|
|
459
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEvents.on("afterChange", this.onAfterChange);
|
|
460
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEvents.on("ancestryTrimmed", this.onAncestryTrimmed);
|
|
461
|
+
}
|
|
462
|
+
unregisterFromBranchEvents() {
|
|
463
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.events.off("afterChange", this.onAfterBranchChange);
|
|
464
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEvents.off("afterChange", this.onAfterChange);
|
|
465
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEvents.off("ancestryTrimmed", this.onAncestryTrimmed);
|
|
466
|
+
}
|
|
467
|
+
createTransactionStack(branch) {
|
|
468
|
+
return new SquashingTransactionStack(branch, this.mintRevisionTag, () => {
|
|
469
|
+
const disposeForks = this.disposeForksAfterTransaction
|
|
470
|
+
? trackForksForDisposal(this)
|
|
471
|
+
: undefined;
|
|
472
|
+
// When each transaction is started, make a restorable checkpoint of the current state of removed roots
|
|
473
|
+
const restoreRemovedRoots = this._removedRoots.createCheckpoint();
|
|
474
|
+
return (result, viewUpdate) => {
|
|
475
|
+
const newHead = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead();
|
|
476
|
+
switch (result) {
|
|
477
|
+
case InternalTransactionResult.Abort: {
|
|
478
|
+
restoreRemovedRoots();
|
|
479
|
+
if (viewUpdate !== undefined) {
|
|
480
|
+
this.applyInternalChange(viewUpdate, newHead.revision);
|
|
481
|
+
}
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
case InternalTransactionResult.Commit: {
|
|
485
|
+
if (viewUpdate !== undefined) {
|
|
486
|
+
this.applyInternalChange(viewUpdate, newHead.revision);
|
|
487
|
+
}
|
|
488
|
+
if (this.transaction.size === 0) {
|
|
489
|
+
// The changes in a transaction squash commit have already applied to the checkout and are known to be valid, so we can validate the squash commit automatically.
|
|
490
|
+
this.validateCommit(newHead);
|
|
491
|
+
}
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
default: {
|
|
495
|
+
unreachableCase(result);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
disposeForks?.();
|
|
499
|
+
};
|
|
433
500
|
});
|
|
434
501
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
fail(0xad1 /* Unknown Shared Tree change type. */);
|
|
502
|
+
exportVerbose() {
|
|
503
|
+
const cursor = this.forest.allocateCursor("contentSnapshot");
|
|
504
|
+
try {
|
|
505
|
+
moveToDetachedField(this.forest, cursor);
|
|
506
|
+
const length = cursor.getFieldLength();
|
|
507
|
+
if (length === 0) {
|
|
508
|
+
return undefined;
|
|
509
|
+
}
|
|
510
|
+
else if (length === 1) {
|
|
511
|
+
cursor.enterNode(0);
|
|
512
|
+
return verboseFromCursor(cursor, this.storedSchema.nodeSchema);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
fail(0xac8 /* Invalid document root length */);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
finally {
|
|
519
|
+
cursor.free();
|
|
520
|
+
}
|
|
455
521
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
522
|
+
/**
|
|
523
|
+
* Applies the given serialized change (as was produced via a `"changed"` event of another checkout) to this checkout.
|
|
524
|
+
*/
|
|
525
|
+
applySerializedChange(serializedChange) {
|
|
526
|
+
if (!isSerializedChange(serializedChange)) {
|
|
527
|
+
throw new UsageError(`Cannot apply change. Invalid serialized change format.`);
|
|
528
|
+
}
|
|
529
|
+
const { revision, originatorId, change } = serializedChange;
|
|
530
|
+
if (originatorId !== this.idCompressor.localSessionId) {
|
|
531
|
+
throw new UsageError(`Cannot apply change. A serialized changed must be applied to the same SharedTree as it was created from.`);
|
|
532
|
+
}
|
|
533
|
+
const context = {
|
|
534
|
+
idCompressor: this.idCompressor,
|
|
535
|
+
originatorId: this.idCompressor.localSessionId,
|
|
536
|
+
revision,
|
|
537
|
+
};
|
|
538
|
+
const decodedChange = this.changeFamily.codecs.resolve(4).decode(change, context);
|
|
539
|
+
// Apply the change to the branch, but _not_ the `activeBranch` - we do not support squashing serialized commits in a transaction.
|
|
540
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.apply(tagChange(decodedChange, revision));
|
|
469
541
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
return
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
542
|
+
// #region TreeBranchAlpha
|
|
543
|
+
applyChange(change) {
|
|
544
|
+
this.applySerializedChange(change);
|
|
545
|
+
}
|
|
546
|
+
isBranch() {
|
|
547
|
+
return true;
|
|
548
|
+
}
|
|
549
|
+
hasRootSchema(_schema) {
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
runTransaction(transaction, params) {
|
|
553
|
+
this.mountTransaction(params, false);
|
|
554
|
+
const transactionCallbackStatus = transaction();
|
|
555
|
+
return this.unmountTransaction(transactionCallbackStatus, params);
|
|
556
|
+
}
|
|
557
|
+
async runTransactionAsync(transaction, params) {
|
|
558
|
+
this.mountTransaction(params, true);
|
|
559
|
+
const transactionCallbackStatus = await transaction();
|
|
560
|
+
return this.unmountTransaction(transactionCallbackStatus, params);
|
|
561
|
+
}
|
|
562
|
+
mountTransaction(params, isAsync) {
|
|
563
|
+
this.checkNotDisposed();
|
|
564
|
+
if (isAsync && this.transaction.size > 0) {
|
|
565
|
+
throw new UsageError("An asynchronous transaction cannot be started while another transaction is already in progress.");
|
|
566
|
+
}
|
|
567
|
+
this.pushLabelFrame(params?.label);
|
|
568
|
+
this.transaction.start();
|
|
569
|
+
addConstraintsToTransaction(this, false, params?.preconditions);
|
|
570
|
+
}
|
|
571
|
+
unmountTransaction(transactionCallbackStatus, params) {
|
|
572
|
+
this.checkNotDisposed();
|
|
573
|
+
const rollback = transactionCallbackStatus?.rollback;
|
|
574
|
+
const value = transactionCallbackStatus?.value;
|
|
575
|
+
if (rollback === true) {
|
|
576
|
+
this.popLabelFrame(true);
|
|
577
|
+
this.transaction.abort();
|
|
578
|
+
return value === undefined
|
|
579
|
+
? { success: false }
|
|
580
|
+
: { success: false, value: value };
|
|
581
|
+
}
|
|
582
|
+
addConstraintsToTransaction(this, true, transactionCallbackStatus?.preconditionsOnRevert);
|
|
583
|
+
this.popLabelFrame(false);
|
|
584
|
+
this.runWithTransactionLabel(() => {
|
|
585
|
+
this.transaction.commit();
|
|
586
|
+
}, params?.label);
|
|
587
|
+
return value === undefined
|
|
588
|
+
? { success: true }
|
|
589
|
+
: { success: true, value: value };
|
|
590
|
+
}
|
|
591
|
+
// #endregion TreeBranchAlpha
|
|
592
|
+
// Revision is the revision of the commit, if any, which caused this change.
|
|
593
|
+
applyInternalChange(change, revision) {
|
|
594
|
+
// Conflicts due to schema will be empty and thus are not applied.
|
|
595
|
+
for (const innerChange of change.changes) {
|
|
596
|
+
if (innerChange.type === "data") {
|
|
597
|
+
const delta = intoDelta(tagChange(innerChange.innerChange, revision));
|
|
598
|
+
this.withCombinedVisitor((visitor) => {
|
|
599
|
+
visitDelta(delta, visitor, this._removedRoots, revision);
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
else if (innerChange.type === "schema") {
|
|
603
|
+
// Schema changes from a current to a new schema are expected to be backwards compatible.
|
|
604
|
+
// This guarantees that all data in the forest (which is valid before the schema change)
|
|
605
|
+
// is also valid under the new schema.
|
|
606
|
+
// Note however, that such schema changes may in some cases be rolled back:
|
|
607
|
+
// Case 1: A transaction with a schema change may be aborted.
|
|
608
|
+
// The transaction may have made some data changes that would render some trees invalid
|
|
609
|
+
// under the old schema, but these changes will also be rolled back, thereby putting the forest
|
|
610
|
+
// back in the state before the transaction, which is valid under the original (reinstated) schema.
|
|
611
|
+
// Case 2: A branch with a schema change may be rebased such that the schema change (because
|
|
612
|
+
// of a constraint) is no longer applied.
|
|
613
|
+
// Such a branch may contain data changes that would render some trees invalid under the
|
|
614
|
+
// original schema. These data changes may not necessarily be rolled back.
|
|
615
|
+
// They will however be rebased over the rollback of the schema change. This rebasing will
|
|
616
|
+
// ensure that these data changes are muted if they would render some trees invalid under the
|
|
617
|
+
// original (reinstated) schema.
|
|
618
|
+
this.storedSchema.apply(innerChange.innerChange.schema.new);
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
fail(0xad1 /* Unknown Shared Tree change type. */);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
withCombinedVisitor(fn) {
|
|
626
|
+
const anchorVisitor = this.forest.anchors.acquireVisitor();
|
|
627
|
+
const combinedVisitor = combineVisitors([this.forest.acquireVisitor(), anchorVisitor]);
|
|
628
|
+
fn(combinedVisitor);
|
|
629
|
+
combinedVisitor.free();
|
|
630
|
+
}
|
|
631
|
+
checkNotDisposed(usageError) {
|
|
632
|
+
this.breaker.use();
|
|
633
|
+
if (this.disposed) {
|
|
634
|
+
if (usageError !== undefined) {
|
|
635
|
+
throw new UsageError(usageError);
|
|
636
|
+
}
|
|
637
|
+
assert(false, 0x911 /* Invalid operation on a disposed TreeCheckout */);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Creates a {@link RevertibleAlpha} object that can undo a specific change in the tree's history.
|
|
642
|
+
* Revision must exist in the given {@link TreeCheckout}'s branch.
|
|
643
|
+
*
|
|
644
|
+
* @param revision - The revision tag identifying the change to be made revertible.
|
|
645
|
+
* @param kind - The {@link CommitKind} that produced this revertible (e.g., Default, Undo, Redo).
|
|
646
|
+
* @param checkout - The {@link TreeCheckout} instance this revertible belongs to.
|
|
647
|
+
* @param onRevertibleDisposed - Callback function that will be called when the revertible is disposed.
|
|
648
|
+
* @returns A {@link RevertibleAlpha} object.
|
|
649
|
+
*/
|
|
650
|
+
createRevertible(revision, kind, checkout, onRevertibleDisposed) {
|
|
651
|
+
const commitBranches = checkout.revertibleCommitBranches;
|
|
652
|
+
const revertible = {
|
|
653
|
+
get status() {
|
|
654
|
+
const revertibleCommit = commitBranches.get(revision);
|
|
655
|
+
return revertibleCommit === undefined
|
|
656
|
+
? RevertibleStatus.Disposed
|
|
657
|
+
: RevertibleStatus.Valid;
|
|
658
|
+
},
|
|
659
|
+
revert: (release = true) => {
|
|
660
|
+
if (revertible.status === RevertibleStatus.Disposed) {
|
|
661
|
+
throw new UsageError("Unable to revert a revertible that has been disposed.");
|
|
662
|
+
}
|
|
663
|
+
const revertMetrics = checkout.revertRevertible(revision, kind);
|
|
664
|
+
checkout.logger?.sendTelemetryEvent({
|
|
665
|
+
eventName: _a.revertTelemetryEventName,
|
|
666
|
+
...revertMetrics,
|
|
667
|
+
});
|
|
668
|
+
if (release) {
|
|
669
|
+
revertible.dispose();
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
clone: (targetBranch) => {
|
|
673
|
+
// TODO:#23442: When a revertible is cloned for a forked branch, optimize to create a fork of a revertible branch once per revision NOT once per revision per checkout.
|
|
674
|
+
const targetCheckout = getCheckout(targetBranch);
|
|
675
|
+
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
676
|
+
if (revertibleBranch === undefined) {
|
|
677
|
+
throw new UsageError("Unable to clone a revertible that has been disposed.");
|
|
678
|
+
}
|
|
679
|
+
const commitToRevert = revertibleBranch.getHead();
|
|
680
|
+
const activeBranchHead = __classPrivateFieldGet(targetCheckout, _TreeCheckout_transaction, "f").activeBranch.getHead();
|
|
681
|
+
if (isAncestor(commitToRevert, activeBranchHead, true) === false) {
|
|
682
|
+
throw new UsageError("Cannot clone revertible for a commit that is not present on the given branch.");
|
|
683
|
+
}
|
|
684
|
+
targetCheckout.revertibleCommitBranches.set(revision, revertibleBranch.fork());
|
|
685
|
+
return this.createRevertible(revision, kind, targetCheckout, onRevertibleDisposed);
|
|
686
|
+
},
|
|
687
|
+
dispose: () => {
|
|
688
|
+
if (revertible.status === RevertibleStatus.Disposed) {
|
|
689
|
+
throw new UsageError("Unable to dispose a revertible that has already been disposed.");
|
|
690
|
+
}
|
|
691
|
+
checkout.disposeRevertible(revertible, revision);
|
|
692
|
+
onRevertibleDisposed?.(revertible);
|
|
693
|
+
},
|
|
694
|
+
};
|
|
695
|
+
return revertible;
|
|
696
|
+
}
|
|
697
|
+
viewWith(config) {
|
|
698
|
+
const view = new SchematizingSimpleTreeView(this, config, createNodeIdentifierManager(this.idCompressor), () => {
|
|
699
|
+
this.views.delete(view);
|
|
500
700
|
});
|
|
501
|
-
|
|
701
|
+
this.views.add(view);
|
|
702
|
+
return view;
|
|
703
|
+
}
|
|
704
|
+
get rootEvents() {
|
|
705
|
+
return this.forest.anchors.events;
|
|
706
|
+
}
|
|
707
|
+
get editor() {
|
|
708
|
+
this.checkNotDisposed();
|
|
709
|
+
return this.editLock.editor;
|
|
710
|
+
}
|
|
711
|
+
locate(anchor) {
|
|
712
|
+
this.checkNotDisposed();
|
|
713
|
+
return this.forest.anchors.locate(anchor);
|
|
714
|
+
}
|
|
715
|
+
get transaction() {
|
|
716
|
+
return __classPrivateFieldGet(this, _TreeCheckout_transaction, "f");
|
|
717
|
+
}
|
|
718
|
+
fork() {
|
|
719
|
+
this.checkNotDisposed("The parent branch has already been disposed and can no longer create new branches.");
|
|
720
|
+
// Branching after an unfinished transaction would expose the application to a state where its invariants may be violated.
|
|
721
|
+
if (this.transaction.size > 0) {
|
|
722
|
+
throw new UsageError("A view cannot be forked while it has a pending transaction.");
|
|
723
|
+
}
|
|
724
|
+
this.editLock.checkUnlocked("Branching");
|
|
725
|
+
const branch = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.fork();
|
|
726
|
+
const storedSchema = this.storedSchema.clone();
|
|
727
|
+
const forkBreaker = new Breakable("TreeCheckout");
|
|
728
|
+
const forest = this.forest.clone(storedSchema, forkBreaker);
|
|
729
|
+
const checkout = new _a(branch, false, this.changeFamily, storedSchema, forest, this.mintRevisionTag, this.revisionTagCodec, this.idCompressor, this._removedRoots.clone(), this.logger, forkBreaker, this.disposeForksAfterTransaction);
|
|
730
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("fork", checkout);
|
|
731
|
+
return checkout;
|
|
732
|
+
}
|
|
733
|
+
switchBranch(branch) {
|
|
734
|
+
// TODO: Dispose old branch, if necessary
|
|
735
|
+
assert(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").size === 0, 0xc55 /* Cannot switch branches during a transaction */);
|
|
736
|
+
const diff = diffHistories(this.changeFamily.rebaser, __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead(), branch.getHead(), this.mintRevisionTag);
|
|
737
|
+
this.unregisterFromBranchEvents();
|
|
738
|
+
__classPrivateFieldSet(this, _TreeCheckout_transaction, this.createTransactionStack(branch), "f");
|
|
739
|
+
this.editLock = new EditLock(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEditor);
|
|
740
|
+
this.registerForBranchEvents();
|
|
741
|
+
// TODO: Rework eventing
|
|
742
|
+
this.applyInternalChange(diff);
|
|
743
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
744
|
+
}
|
|
745
|
+
rebase(branch) {
|
|
746
|
+
const checkout = getCheckout(branch);
|
|
747
|
+
this.checkNotDisposed("The target branch of the rebase has been disposed and cannot be rebased.");
|
|
748
|
+
checkout.checkNotDisposed("The source branch of the rebase has been disposed and cannot be rebased.");
|
|
749
|
+
this.editLock.checkUnlocked("Rebasing");
|
|
750
|
+
if (this.transaction.size > 0) {
|
|
751
|
+
throw new UsageError("Views cannot be rebased onto a view that has a pending transaction.");
|
|
752
|
+
}
|
|
753
|
+
if (checkout.transaction.size > 0) {
|
|
754
|
+
throw new UsageError("A view cannot be rebased while it has a pending transaction.");
|
|
755
|
+
}
|
|
756
|
+
assert(!checkout.isSharedBranch, 0xa5d /* Shared branches cannot be rebased onto another branch. */);
|
|
757
|
+
__classPrivateFieldGet(checkout, _TreeCheckout_transaction, "f").activeBranch.rebaseOnto(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch);
|
|
758
|
+
}
|
|
759
|
+
rebaseOnto(branch) {
|
|
760
|
+
getCheckout(branch).rebase(this);
|
|
761
|
+
}
|
|
762
|
+
merge(branch, disposeMerged = true) {
|
|
763
|
+
const checkout = getCheckout(branch);
|
|
764
|
+
this.checkNotDisposed("The target branch of the merge has been disposed and cannot be merged.");
|
|
765
|
+
checkout.checkNotDisposed("The source branch of the merge has been disposed and cannot be merged.");
|
|
766
|
+
this.editLock.checkUnlocked("Merging");
|
|
767
|
+
if (this.transaction.size > 0) {
|
|
768
|
+
throw new UsageError("Views cannot be merged into a view while it has a pending transaction.");
|
|
769
|
+
}
|
|
770
|
+
if (checkout.transaction.size > 0) {
|
|
771
|
+
throw new UsageError("Views with an open transaction cannot be merged into another view.");
|
|
772
|
+
}
|
|
773
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.merge(__classPrivateFieldGet(checkout, _TreeCheckout_transaction, "f").activeBranch);
|
|
774
|
+
if (disposeMerged && !checkout.isSharedBranch) {
|
|
775
|
+
// Dispose the merged checkout unless it is a shared branch.
|
|
776
|
+
checkout[disposeSymbol]();
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
updateSchema(newSchema, allowNonSupersetSchema) {
|
|
780
|
+
this.checkNotDisposed();
|
|
781
|
+
if (allowNonSupersetSchema !== true) {
|
|
782
|
+
assert(allowsRepoSuperset(defaultSchemaPolicy, this.storedSchema.clone(), newSchema), 0xbe6 /* New schema must allow all documents allowed by old schema */);
|
|
783
|
+
}
|
|
784
|
+
this.editor.schema.setStoredSchema(this.storedSchema.clone(), newSchema);
|
|
785
|
+
}
|
|
786
|
+
dispose() {
|
|
787
|
+
this.editLock.checkUnlocked("Disposing a view");
|
|
788
|
+
this[disposeSymbol]();
|
|
789
|
+
}
|
|
790
|
+
[(_TreeCheckout_events = new WeakMap(), _TreeCheckout_transaction = new WeakMap(), _TreeCheckout_validatedCommits = new WeakMap(), _exportVerbose_decorators = [throwIfBroken], _applySerializedChange_decorators = [throwIfBroken], _applyChange_decorators = [throwIfBroken], _runTransaction_decorators = [breakingMethod], _runTransactionAsync_decorators = [breakingMethod], _viewWith_decorators = [throwIfBroken], _fork_decorators = [throwIfBroken], disposeSymbol)]() {
|
|
791
|
+
this.checkNotDisposed("The branch has already been disposed and cannot be disposed again.");
|
|
792
|
+
this.disposed = true;
|
|
793
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.dispose();
|
|
794
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").dispose();
|
|
795
|
+
this.purgeRevertibles();
|
|
796
|
+
for (const view of this.views) {
|
|
797
|
+
view.dispose();
|
|
798
|
+
}
|
|
799
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("dispose");
|
|
800
|
+
}
|
|
801
|
+
getRemovedRoots() {
|
|
802
|
+
this.assertNoUntrackedRoots();
|
|
803
|
+
const trees = [];
|
|
804
|
+
const cursor = this.forest.allocateCursor("getRemovedRoots");
|
|
805
|
+
for (const { id, root } of this._removedRoots.entries()) {
|
|
806
|
+
const parentField = this._removedRoots.toFieldKey(root);
|
|
807
|
+
this.forest.moveCursorToPath({ parent: undefined, parentField, parentIndex: 0 }, cursor);
|
|
808
|
+
const tree = jsonableTreeFromCursor(cursor);
|
|
809
|
+
// This method is used for tree consistency comparison.
|
|
810
|
+
const { major, minor } = id;
|
|
811
|
+
const finalizedMajor = major === undefined ? major : this.revisionTagCodec.encode(major);
|
|
812
|
+
trees.push([finalizedMajor, minor, tree]);
|
|
813
|
+
}
|
|
814
|
+
cursor.free();
|
|
815
|
+
return trees;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* This must be called on the root/main checkout after loading from a summary.
|
|
819
|
+
* @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.
|
|
820
|
+
* Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.
|
|
821
|
+
*/
|
|
822
|
+
load() {
|
|
823
|
+
// Set the tip revision as the latest relevant revision for any removed roots that are loaded from a summary - this allows them to be garbage collected later.
|
|
824
|
+
// When a load happens, the head of the trunk and the head of the local/main branch must be the same (this is enforced by SharedTree).
|
|
825
|
+
this._removedRoots.setRevisionsForLoadedData(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead().revision);
|
|
826
|
+
// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.
|
|
827
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
828
|
+
}
|
|
829
|
+
purgeRevertibles() {
|
|
830
|
+
for (const revertible of this.revertibles) {
|
|
502
831
|
revertible.dispose();
|
|
503
832
|
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
833
|
+
}
|
|
834
|
+
disposeRevertible(revertible, revision) {
|
|
835
|
+
this.revertibleCommitBranches.get(revision)?.dispose();
|
|
836
|
+
this.revertibleCommitBranches.delete(revision);
|
|
837
|
+
this.revertibles.delete(revertible);
|
|
838
|
+
}
|
|
839
|
+
revertRevertible(revision, kind) {
|
|
840
|
+
this.editLock.checkUnlocked("Reverting a commit");
|
|
841
|
+
if (this.transaction.size > 0) {
|
|
842
|
+
throw new UsageError("Undo is not yet supported during transactions.");
|
|
511
843
|
}
|
|
844
|
+
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
845
|
+
assert(revertibleBranch !== undefined, 0x7cc /* expected to find a revertible commit */);
|
|
512
846
|
const commitToRevert = revertibleBranch.getHead();
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
847
|
+
const revisionForInvert = this.mintRevisionTag();
|
|
848
|
+
let change = tagChange(this.changeFamily.rebaser.invert(commitToRevert, false, revisionForInvert), revisionForInvert);
|
|
849
|
+
const headCommit = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead();
|
|
850
|
+
// Rebase the inverted change onto any commits that occurred after the undoable commits.
|
|
851
|
+
if (commitToRevert !== headCommit) {
|
|
852
|
+
// The inverse may be rebased over newer commits which (despite being present in the history)
|
|
853
|
+
// have no net effect on the document state (e.g. an edit plus its undo).
|
|
854
|
+
// In that case, a no-change constraint should not be violated during rebase.
|
|
855
|
+
const diff = diffHistories(this.changeFamily.rebaser, commitToRevert, headCommit, this.mintRevisionTag);
|
|
856
|
+
const ignoreNoChangeViolation = !sharedTreeChangeHasVisibleChanges(diff);
|
|
857
|
+
change = tagChange(rebaseChange(this.changeFamily.rebaser, change, commitToRevert, headCommit, this.mintRevisionTag, ignoreNoChangeViolation).change, revisionForInvert);
|
|
516
858
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
859
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.apply(change, kind === CommitKind.Default || kind === CommitKind.Redo
|
|
860
|
+
? CommitKind.Undo
|
|
861
|
+
: CommitKind.Redo);
|
|
862
|
+
// Derive some stats about the reversion to return to the caller.
|
|
863
|
+
let revertAge = 0;
|
|
864
|
+
let currentCommit = headCommit;
|
|
865
|
+
while (commitToRevert.revision !== currentCommit.revision) {
|
|
866
|
+
revertAge++;
|
|
867
|
+
const parentCommit = currentCommit.parent;
|
|
868
|
+
assert(parentCommit !== undefined, 0x9a9 /* expected to find a parent commit */);
|
|
869
|
+
currentCommit = parentCommit;
|
|
523
870
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
const parentField = this._removedRoots.toFieldKey(root);
|
|
639
|
-
this.forest.moveCursorToPath({ parent: undefined, parentField, parentIndex: 0 }, cursor);
|
|
640
|
-
const tree = jsonableTreeFromCursor(cursor);
|
|
641
|
-
// This method is used for tree consistency comparison.
|
|
642
|
-
const { major, minor } = id;
|
|
643
|
-
const finalizedMajor = major === undefined ? major : this.revisionTagCodec.encode(major);
|
|
644
|
-
trees.push([finalizedMajor, minor, tree]);
|
|
645
|
-
}
|
|
646
|
-
cursor.free();
|
|
647
|
-
return trees;
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* This must be called on the root/main checkout after loading from a summary.
|
|
651
|
-
* @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.
|
|
652
|
-
* Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.
|
|
653
|
-
*/
|
|
654
|
-
load() {
|
|
655
|
-
// Set the tip revision as the latest relevant revision for any removed roots that are loaded from a summary - this allows them to be garbage collected later.
|
|
656
|
-
// When a load happens, the head of the trunk and the head of the local/main branch must be the same (this is enforced by SharedTree).
|
|
657
|
-
this._removedRoots.setRevisionsForLoadedData(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead().revision);
|
|
658
|
-
// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.
|
|
659
|
-
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
660
|
-
}
|
|
661
|
-
purgeRevertibles() {
|
|
662
|
-
for (const revertible of this.revertibles) {
|
|
663
|
-
revertible.dispose();
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
disposeRevertible(revertible, revision) {
|
|
667
|
-
this.revertibleCommitBranches.get(revision)?.dispose();
|
|
668
|
-
this.revertibleCommitBranches.delete(revision);
|
|
669
|
-
this.revertibles.delete(revertible);
|
|
670
|
-
}
|
|
671
|
-
revertRevertible(revision, kind) {
|
|
672
|
-
this.editLock.checkUnlocked("Reverting a commit");
|
|
673
|
-
if (this.transaction.size > 0) {
|
|
674
|
-
throw new UsageError("Undo is not yet supported during transactions.");
|
|
675
|
-
}
|
|
676
|
-
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
677
|
-
assert(revertibleBranch !== undefined, 0x7cc /* expected to find a revertible commit */);
|
|
678
|
-
const commitToRevert = revertibleBranch.getHead();
|
|
679
|
-
const revisionForInvert = this.mintRevisionTag();
|
|
680
|
-
let change = tagChange(this.changeFamily.rebaser.invert(commitToRevert, false, revisionForInvert), revisionForInvert);
|
|
681
|
-
const headCommit = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead();
|
|
682
|
-
// Rebase the inverted change onto any commits that occurred after the undoable commits.
|
|
683
|
-
if (commitToRevert !== headCommit) {
|
|
684
|
-
change = tagChange(rebaseChange(this.changeFamily.rebaser, change, commitToRevert, headCommit, this.mintRevisionTag).change, revisionForInvert);
|
|
685
|
-
}
|
|
686
|
-
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.apply(change, kind === CommitKind.Default || kind === CommitKind.Redo
|
|
687
|
-
? CommitKind.Undo
|
|
688
|
-
: CommitKind.Redo);
|
|
689
|
-
// Derive some stats about the reversion to return to the caller.
|
|
690
|
-
let revertAge = 0;
|
|
691
|
-
let currentCommit = headCommit;
|
|
692
|
-
while (commitToRevert.revision !== currentCommit.revision) {
|
|
693
|
-
revertAge++;
|
|
694
|
-
const parentCommit = currentCommit.parent;
|
|
695
|
-
assert(parentCommit !== undefined, 0x9a9 /* expected to find a parent commit */);
|
|
696
|
-
currentCommit = parentCommit;
|
|
697
|
-
}
|
|
698
|
-
return { age: revertAge };
|
|
699
|
-
}
|
|
700
|
-
assertNoUntrackedRoots() {
|
|
701
|
-
const cursor = this.forest.getCursorAboveDetachedFields();
|
|
702
|
-
const rootFields = new Set([rootFieldKey]);
|
|
703
|
-
for (const { root } of this._removedRoots.entries()) {
|
|
704
|
-
rootFields.add(this._removedRoots.toFieldKey(root));
|
|
705
|
-
}
|
|
706
|
-
if (!cursor.firstField()) {
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
do {
|
|
710
|
-
const field = cursor.getFieldKey();
|
|
711
|
-
assert(rootFields.has(field), 0xa22 /* Forest has a root field which is unknown to the detached field index */);
|
|
712
|
-
rootFields.delete(field);
|
|
713
|
-
} while (cursor.nextField());
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
* `true` iff the given branch change event is due to a remote change
|
|
717
|
-
*/
|
|
718
|
-
isRemoteChangeEvent(event) {
|
|
719
|
-
return (
|
|
720
|
-
// Remote changes are only ever applied to shared branches
|
|
721
|
-
this.isSharedBranch &&
|
|
722
|
-
// Remote changes are applied to the branch by rebasing it onto the trunk.
|
|
723
|
-
// No other rebases are allowed on shared branches, so we can use this to detect remote changes.
|
|
724
|
-
event.type === "rebase");
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* Registers a function to be called when the given commit is validated.
|
|
728
|
-
* @remarks A commit is validated by the checkout after it has been applied to the checkout's state (e.g. it has an effect on the forest).
|
|
729
|
-
* If the commit applies successfully (i.e. it does not raise any unexpected errors), the commit is considered valid and the registered function is called.
|
|
730
|
-
* If the commit does not apply successfully (because it causes an unexpected error), the function is not called (and the checkout will left in an error state).
|
|
731
|
-
*
|
|
732
|
-
* If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.
|
|
733
|
-
* Otherwise, the function is registered to be called later and this function returns `false`.
|
|
734
|
-
*/
|
|
735
|
-
onCommitValid(commit, fn) {
|
|
736
|
-
const validated = getOrCreate(__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
737
|
-
if (validated === true) {
|
|
738
|
-
fn(commit);
|
|
739
|
-
return true;
|
|
740
|
-
}
|
|
741
|
-
validated.push(fn);
|
|
742
|
-
return false;
|
|
743
|
-
}
|
|
744
|
-
/** Mark the given commit as "validated" according to the contract of {@link onCommitValid}(). */
|
|
745
|
-
validateCommit(commit) {
|
|
746
|
-
const validated = getOrCreate(__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
747
|
-
if (validated !== true) {
|
|
748
|
-
for (const fn of validated) {
|
|
749
|
-
fn(commit);
|
|
750
|
-
}
|
|
751
|
-
__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f").set(commit, true);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
resetEnrichmentStats() {
|
|
755
|
-
this.enrichmentStats.batches = 0;
|
|
756
|
-
this.enrichmentStats.diffs = 0;
|
|
757
|
-
this.enrichmentStats.commitsEnriched = 0;
|
|
758
|
-
this.enrichmentStats.refreshers = 0;
|
|
759
|
-
this.enrichmentStats.forks = 0;
|
|
760
|
-
this.enrichmentStats.applied = 0;
|
|
761
|
-
}
|
|
762
|
-
getEnrichmentStats() {
|
|
763
|
-
return { ...this.enrichmentStats };
|
|
764
|
-
}
|
|
765
|
-
enrich(context, changes) {
|
|
766
|
-
if (!hasSome(changes)) {
|
|
767
|
-
return [];
|
|
768
|
-
}
|
|
769
|
-
this.enrichmentStats.batches += 1;
|
|
770
|
-
const enricher = new SharedTreeChangeEnricher(this.forest, this._removedRoots, this.storedSchema, this.idCompressor, () => (this.enrichmentStats.commitsEnriched += 1), () => (this.enrichmentStats.refreshers += 1), () => (this.enrichmentStats.forks += 1), () => (this.enrichmentStats.applied += 1));
|
|
771
|
-
// This `lastCommitApplied` may be on the main branch or on a transaction branch.
|
|
772
|
-
// In either case, it is crucial that the state of the forest & detached field index reflects all changes up to and including this commit.
|
|
773
|
-
const lastCommitApplied = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead();
|
|
774
|
-
if (context !== lastCommitApplied) {
|
|
775
|
-
enricher.enqueueChange(() => {
|
|
776
|
-
this.enrichmentStats.diffs += 1;
|
|
777
|
-
const diff = diffHistories(this.changeFamily.rebaser, lastCommitApplied, context, this.mintRevisionTag);
|
|
778
|
-
return makeAnonChange(diff);
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
const enriched = [];
|
|
782
|
-
for (const change of changes) {
|
|
783
|
-
enriched.push(enricher.enrich(change.change));
|
|
784
|
-
enricher.enqueueChange(change);
|
|
785
|
-
}
|
|
786
|
-
enricher[disposeSymbol]();
|
|
787
|
-
return enriched;
|
|
788
|
-
}
|
|
789
|
-
get mainBranch() {
|
|
790
|
-
return __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* The name of the telemetry event logged for calls to {@link TreeCheckout.revertRevertible}.
|
|
795
|
-
* @privateRemarks Exposed for testing purposes.
|
|
796
|
-
*/
|
|
797
|
-
TreeCheckout.revertTelemetryEventName = "RevertRevertible";
|
|
871
|
+
return { age: revertAge };
|
|
872
|
+
}
|
|
873
|
+
assertNoUntrackedRoots() {
|
|
874
|
+
const cursor = this.forest.getCursorAboveDetachedFields();
|
|
875
|
+
const rootFields = new Set([rootFieldKey]);
|
|
876
|
+
for (const { root } of this._removedRoots.entries()) {
|
|
877
|
+
rootFields.add(this._removedRoots.toFieldKey(root));
|
|
878
|
+
}
|
|
879
|
+
if (!cursor.firstField()) {
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
do {
|
|
883
|
+
const field = cursor.getFieldKey();
|
|
884
|
+
assert(rootFields.has(field), 0xa22 /* Forest has a root field which is unknown to the detached field index */);
|
|
885
|
+
rootFields.delete(field);
|
|
886
|
+
} while (cursor.nextField());
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* `true` iff the given branch change event is due to a remote change
|
|
890
|
+
*/
|
|
891
|
+
isRemoteChangeEvent(event) {
|
|
892
|
+
return (
|
|
893
|
+
// Remote changes are only ever applied to shared branches
|
|
894
|
+
this.isSharedBranch &&
|
|
895
|
+
// Remote changes are applied to the branch by rebasing it onto the trunk.
|
|
896
|
+
// No other rebases are allowed on shared branches, so we can use this to detect remote changes.
|
|
897
|
+
event.type === "rebase");
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Registers a function to be called when the given commit is validated.
|
|
901
|
+
* @remarks A commit is validated by the checkout after it has been applied to the checkout's state (e.g. it has an effect on the forest).
|
|
902
|
+
* If the commit applies successfully (i.e. it does not raise any unexpected errors), the commit is considered valid and the registered function is called.
|
|
903
|
+
* If the commit does not apply successfully (because it causes an unexpected error), the function is not called (and the checkout will left in an error state).
|
|
904
|
+
*
|
|
905
|
+
* If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.
|
|
906
|
+
* Otherwise, the function is registered to be called later and this function returns `false`.
|
|
907
|
+
*/
|
|
908
|
+
onCommitValid(commit, fn) {
|
|
909
|
+
const validated = getOrCreate(__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
910
|
+
if (validated === true) {
|
|
911
|
+
fn(commit);
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
914
|
+
validated.push(fn);
|
|
915
|
+
return false;
|
|
916
|
+
}
|
|
917
|
+
/** Mark the given commit as "validated" according to the contract of {@link onCommitValid}(). */
|
|
918
|
+
validateCommit(commit) {
|
|
919
|
+
const validated = getOrCreate(__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
920
|
+
if (validated !== true) {
|
|
921
|
+
for (const fn of validated) {
|
|
922
|
+
fn(commit);
|
|
923
|
+
}
|
|
924
|
+
__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f").set(commit, true);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
resetEnrichmentStats() {
|
|
928
|
+
this.enrichmentStats.batches = 0;
|
|
929
|
+
this.enrichmentStats.diffs = 0;
|
|
930
|
+
this.enrichmentStats.commitsEnriched = 0;
|
|
931
|
+
this.enrichmentStats.refreshers = 0;
|
|
932
|
+
this.enrichmentStats.forks = 0;
|
|
933
|
+
this.enrichmentStats.applied = 0;
|
|
934
|
+
}
|
|
935
|
+
getEnrichmentStats() {
|
|
936
|
+
return { ...this.enrichmentStats };
|
|
937
|
+
}
|
|
938
|
+
enrich(context, changes) {
|
|
939
|
+
if (!hasSome(changes)) {
|
|
940
|
+
return [];
|
|
941
|
+
}
|
|
942
|
+
this.enrichmentStats.batches += 1;
|
|
943
|
+
const enricher = new SharedTreeChangeEnricher(this.forest, this._removedRoots, this.storedSchema, this.idCompressor, () => (this.enrichmentStats.commitsEnriched += 1), () => (this.enrichmentStats.refreshers += 1), () => (this.enrichmentStats.forks += 1), () => (this.enrichmentStats.applied += 1));
|
|
944
|
+
// This `lastCommitApplied` may be on the main branch or on a transaction branch.
|
|
945
|
+
// In either case, it is crucial that the state of the forest & detached field index reflects all changes up to and including this commit.
|
|
946
|
+
const lastCommitApplied = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead();
|
|
947
|
+
if (context !== lastCommitApplied) {
|
|
948
|
+
enricher.enqueueChange(() => {
|
|
949
|
+
this.enrichmentStats.diffs += 1;
|
|
950
|
+
const diff = diffHistories(this.changeFamily.rebaser, lastCommitApplied, context, this.mintRevisionTag);
|
|
951
|
+
return makeAnonChange(diff);
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
const enriched = [];
|
|
955
|
+
for (const change of changes) {
|
|
956
|
+
enriched.push(enricher.enrich(change.change));
|
|
957
|
+
enricher.enqueueChange(change);
|
|
958
|
+
}
|
|
959
|
+
enricher[disposeSymbol]();
|
|
960
|
+
return enriched;
|
|
961
|
+
}
|
|
962
|
+
get mainBranch() {
|
|
963
|
+
return __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch;
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
(() => {
|
|
967
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
968
|
+
__esDecorate(_a, null, _exportVerbose_decorators, { kind: "method", name: "exportVerbose", static: false, private: false, access: { has: obj => "exportVerbose" in obj, get: obj => obj.exportVerbose }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
969
|
+
__esDecorate(_a, null, _applySerializedChange_decorators, { kind: "method", name: "applySerializedChange", static: false, private: false, access: { has: obj => "applySerializedChange" in obj, get: obj => obj.applySerializedChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
970
|
+
__esDecorate(_a, null, _applyChange_decorators, { kind: "method", name: "applyChange", static: false, private: false, access: { has: obj => "applyChange" in obj, get: obj => obj.applyChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
971
|
+
__esDecorate(_a, null, _runTransaction_decorators, { kind: "method", name: "runTransaction", static: false, private: false, access: { has: obj => "runTransaction" in obj, get: obj => obj.runTransaction }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
972
|
+
__esDecorate(_a, null, _runTransactionAsync_decorators, { kind: "method", name: "runTransactionAsync", static: false, private: false, access: { has: obj => "runTransactionAsync" in obj, get: obj => obj.runTransactionAsync }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
973
|
+
__esDecorate(_a, null, _viewWith_decorators, { kind: "method", name: "viewWith", static: false, private: false, access: { has: obj => "viewWith" in obj, get: obj => obj.viewWith }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
974
|
+
__esDecorate(_a, null, _fork_decorators, { kind: "method", name: "fork", static: false, private: false, access: { has: obj => "fork" in obj, get: obj => obj.fork }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
975
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
976
|
+
})(),
|
|
977
|
+
/**
|
|
978
|
+
* The name of the telemetry event logged for calls to {@link TreeCheckout.revertRevertible}.
|
|
979
|
+
* @privateRemarks Exposed for testing purposes.
|
|
980
|
+
*/
|
|
981
|
+
_a.revertTelemetryEventName = "RevertRevertible",
|
|
982
|
+
_a;
|
|
983
|
+
})();
|
|
984
|
+
export { TreeCheckout };
|
|
798
985
|
/**
|
|
799
986
|
* A helper class that assists {@link TreeCheckout} in preventing functionality from being used while the tree is in the middle of being edited.
|
|
800
987
|
*/
|
|
@@ -941,4 +1128,23 @@ function isSerializedChange(value) {
|
|
|
941
1128
|
isStableId(change.originatorId) &&
|
|
942
1129
|
change.change !== undefined);
|
|
943
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Enumerates through a shared tree change, looking for schema change and field changes that result in visible changes to the tree (e.g. an insert, move, delete).
|
|
1133
|
+
* This function also considers changes to detached roots to be visible changes, but not renames of roots or builds of new roots.
|
|
1134
|
+
*
|
|
1135
|
+
* @param change - The change to analyze.
|
|
1136
|
+
* @returns True if the change contains any schema changes or any field changes that result in visible changes to the tree, false otherwise.
|
|
1137
|
+
*/
|
|
1138
|
+
function sharedTreeChangeHasVisibleChanges(change) {
|
|
1139
|
+
for (const inner of change.changes) {
|
|
1140
|
+
if (inner.type === "schema") {
|
|
1141
|
+
return true;
|
|
1142
|
+
}
|
|
1143
|
+
const delta = intoDelta(tagChange(inner.innerChange, undefined));
|
|
1144
|
+
if (deltaFieldMapHasVisibleChanges(delta.fields)) {
|
|
1145
|
+
return true;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
return false;
|
|
1149
|
+
}
|
|
944
1150
|
//# sourceMappingURL=treeCheckout.js.map
|