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