@fluidframework/tree 2.11.0 → 2.12.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 +4 -0
- package/api-report/tree.alpha.api.md +2 -2
- package/api-report/tree.beta.api.md +1 -1
- package/api-report/tree.legacy.alpha.api.md +1 -1
- package/api-report/tree.legacy.public.api.md +1 -1
- package/api-report/tree.public.api.md +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +2 -9
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/format.d.ts +0 -3
- package/dist/core/schema-stored/format.d.ts.map +1 -1
- package/dist/core/schema-stored/format.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +12 -10
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +3 -5
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-view/index.d.ts +1 -1
- package/dist/core/schema-view/index.d.ts.map +1 -1
- package/dist/core/schema-view/index.js +1 -2
- package/dist/core/schema-view/index.js.map +1 -1
- package/dist/core/schema-view/view.d.ts +0 -7
- package/dist/core/schema-view/view.d.ts.map +1 -1
- package/dist/core/schema-view/view.js +1 -12
- package/dist/core/schema-view/view.js.map +1 -1
- package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
- package/dist/core/tree/chunk.d.ts.map +1 -0
- package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.js +2 -2
- package/dist/core/tree/chunk.js.map +1 -0
- package/dist/core/tree/index.d.ts +1 -0
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +5 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/treeTextFormat.d.ts +0 -5
- package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/types.d.ts +0 -5
- package/dist/core/tree/types.d.ts.map +1 -1
- package/dist/core/tree/types.js +0 -1
- package/dist/core/tree/types.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -14
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -3
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- 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/emptyChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js +2 -3
- package/dist/feature-libraries/chunked-forest/emptyChunk.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 +5 -5
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js +2 -2
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +13 -13
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +1 -0
- package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +2 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +6 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +31 -5
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.js +32 -33
- package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +5 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +99 -99
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +76 -76
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +54 -54
- package/dist/feature-libraries/sequence-field/types.d.ts +0 -1
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -14
- 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/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +1 -1
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +6 -6
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +8 -12
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +25 -7
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +104 -15
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +35 -12
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +159 -127
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +13 -35
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +12 -77
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +7 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +16 -18
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -2
- package/dist/shared-tree-core/editManager.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 +2 -2
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -9
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +4 -16
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +38 -0
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +118 -6
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +5 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +14 -2
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +53 -3
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +48 -0
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +5 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/simpleSchema.d.ts +3 -1
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +3 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +4 -4
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +8 -21
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +1 -0
- 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/verboseTree.js +1 -1
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/view.d.ts +14 -9
- package/dist/simple-tree/api/view.d.ts.map +1 -1
- package/dist/simple-tree/api/view.js +129 -40
- package/dist/simple-tree/api/view.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +5 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +0 -15
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -15
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +8 -3
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +18 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +4 -0
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +4 -2
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +18 -13
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/util/brand.d.ts +0 -2
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js +0 -1
- package/dist/util/brand.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeCheck.d.ts +0 -2
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +13 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +23 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +3 -10
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/format.d.ts +0 -3
- package/lib/core/schema-stored/format.d.ts.map +1 -1
- package/lib/core/schema-stored/format.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +12 -10
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -5
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-view/index.d.ts +1 -1
- package/lib/core/schema-view/index.d.ts.map +1 -1
- package/lib/core/schema-view/index.js +1 -1
- package/lib/core/schema-view/index.js.map +1 -1
- package/lib/core/schema-view/view.d.ts +0 -7
- package/lib/core/schema-view/view.d.ts.map +1 -1
- package/lib/core/schema-view/view.js +0 -11
- package/lib/core/schema-view/view.js.map +1 -1
- package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
- package/lib/core/tree/chunk.d.ts.map +1 -0
- package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.js +1 -1
- package/lib/core/tree/chunk.js.map +1 -0
- package/lib/core/tree/index.d.ts +1 -0
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -0
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/treeTextFormat.d.ts +0 -5
- package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/core/tree/types.d.ts +0 -5
- package/lib/core/tree/types.d.ts.map +1 -1
- package/lib/core/tree/types.js +0 -1
- package/lib/core/tree/types.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- 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/emptyChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -2
- package/lib/feature-libraries/chunked-forest/emptyChunk.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 +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +1 -0
- package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +2 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +31 -5
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.js +25 -28
- package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +99 -99
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +76 -76
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +54 -54
- package/lib/feature-libraries/sequence-field/types.d.ts +0 -1
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -3
- 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/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +1 -1
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +7 -7
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +10 -14
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +25 -7
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +105 -16
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +35 -12
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +161 -129
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +13 -35
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +12 -76
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +7 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +16 -18
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +3 -3
- package/lib/shared-tree-core/editManager.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 +2 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -9
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +4 -16
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +38 -0
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +112 -1
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +2 -2
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +5 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +14 -2
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +50 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +48 -0
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +4 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/simpleSchema.d.ts +3 -1
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +3 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +4 -4
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +5 -18
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +1 -0
- 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/verboseTree.js +2 -2
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/api/view.d.ts +14 -9
- package/lib/simple-tree/api/view.d.ts.map +1 -1
- package/lib/simple-tree/api/view.js +131 -42
- package/lib/simple-tree/api/view.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +0 -15
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +0 -15
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +8 -3
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +16 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +4 -0
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +4 -2
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +19 -14
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/util/brand.d.ts +0 -2
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js +0 -1
- package/lib/util/brand.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeCheck.d.ts +0 -2
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +13 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +21 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/core/index.ts +5 -1
- package/src/core/rebase/utils.ts +17 -20
- package/src/core/schema-stored/format.ts +0 -3
- package/src/core/schema-stored/schema.ts +13 -10
- package/src/core/schema-view/index.ts +0 -1
- package/src/core/schema-view/view.ts +0 -11
- package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
- package/src/core/tree/index.ts +8 -0
- package/src/core/tree/treeTextFormat.ts +0 -5
- package/src/core/tree/types.ts +0 -5
- package/src/feature-libraries/chunked-forest/basicChunk.ts +4 -2
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -1
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +4 -2
- package/src/feature-libraries/chunked-forest/index.ts +1 -1
- package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +4 -1
- package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
- package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
- package/src/feature-libraries/index.ts +13 -0
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
- package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
- package/src/feature-libraries/modular-schema/index.ts +13 -0
- package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
- package/src/feature-libraries/sequence-field/types.ts +0 -1
- package/src/index.ts +1 -29
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +1 -0
- package/src/shared-tree/schematizeTree.ts +6 -10
- package/src/shared-tree/schematizingTreeView.ts +11 -21
- package/src/shared-tree/sharedTree.ts +173 -41
- package/src/shared-tree/treeCheckout.ts +224 -175
- package/src/shared-tree-core/branch.ts +29 -122
- package/src/shared-tree-core/branchCommitEnricher.ts +19 -20
- package/src/shared-tree-core/editManager.ts +3 -8
- package/src/shared-tree-core/index.ts +2 -1
- package/src/shared-tree-core/sharedTreeCore.ts +8 -19
- package/src/shared-tree-core/transaction.ts +145 -0
- package/src/simple-tree/api/conciseTree.ts +2 -2
- package/src/simple-tree/api/create.ts +5 -1
- package/src/simple-tree/api/customTree.ts +69 -1
- package/src/simple-tree/api/index.ts +12 -2
- package/src/simple-tree/api/schemaFactory.ts +62 -1
- package/src/simple-tree/api/simpleSchema.ts +3 -1
- package/src/simple-tree/api/simpleTreeIndex.ts +2 -0
- package/src/simple-tree/api/storedSchema.ts +7 -22
- package/src/simple-tree/api/tree.ts +6 -0
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +197 -51
- package/src/simple-tree/index.ts +6 -0
- package/src/simple-tree/leafNodeSchema.ts +0 -19
- package/src/simple-tree/objectNode.ts +26 -2
- package/src/simple-tree/objectNodeTypes.ts +5 -0
- package/src/simple-tree/schemaTypes.ts +7 -2
- package/src/simple-tree/toStoredSchema.ts +25 -19
- package/src/util/brand.ts +0 -2
- package/src/util/index.ts +1 -0
- package/src/util/typeCheck.ts +0 -2
- package/src/util/utils.ts +26 -0
- package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/chunk.js.map +0 -1
|
@@ -8,7 +8,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
8
8
|
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");
|
|
9
9
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10
10
|
};
|
|
11
|
-
var
|
|
11
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
15
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
16
|
+
};
|
|
17
|
+
var _TreeCheckout_events, _TreeCheckout_transaction, _TreeCheckout_validatedCommits;
|
|
12
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
19
|
exports.TreeCheckout = exports.createTreeCheckout = void 0;
|
|
14
20
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
@@ -41,25 +47,22 @@ function createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, arg
|
|
|
41
47
|
change: changeFamily.rebaser.compose([]),
|
|
42
48
|
revision: "root",
|
|
43
49
|
}, changeFamily, () => idCompressor.generateCompressedId());
|
|
44
|
-
|
|
45
|
-
return new TreeCheckout(branch, false, changeFamily, schema, forest, events, mintRevisionTag, revisionTagCodec, idCompressor, args?.removedRoots, args?.logger, args?.breaker);
|
|
50
|
+
return new TreeCheckout(branch, false, changeFamily, schema, forest, mintRevisionTag, revisionTagCodec, idCompressor, args?.removedRoots, args?.logger, args?.breaker);
|
|
46
51
|
}
|
|
47
52
|
exports.createTreeCheckout = createTreeCheckout;
|
|
48
53
|
/**
|
|
49
54
|
* An implementation of {@link ITreeCheckoutFork}.
|
|
50
55
|
*/
|
|
51
56
|
class TreeCheckout {
|
|
52
|
-
constructor(
|
|
57
|
+
constructor(branch,
|
|
53
58
|
/** True if and only if this checkout is for a forked branch and not the "main branch" of the tree. */
|
|
54
|
-
isBranch, changeFamily, storedSchema, forest,
|
|
59
|
+
isBranch, changeFamily, storedSchema, forest, mintRevisionTag, revisionTagCodec, idCompressor, removedRoots = (0, index_js_2.makeDetachedFieldIndex)("repair", revisionTagCodec, idCompressor),
|
|
55
60
|
/** Optional logger for telemetry. */
|
|
56
61
|
logger, breaker = new index_js_5.Breakable("TreeCheckout")) {
|
|
57
|
-
this._branch = _branch;
|
|
58
62
|
this.isBranch = isBranch;
|
|
59
63
|
this.changeFamily = changeFamily;
|
|
60
64
|
this.storedSchema = storedSchema;
|
|
61
65
|
this.forest = forest;
|
|
62
|
-
this.events = events;
|
|
63
66
|
this.mintRevisionTag = mintRevisionTag;
|
|
64
67
|
this.revisionTagCodec = revisionTagCodec;
|
|
65
68
|
this.idCompressor = idCompressor;
|
|
@@ -78,69 +81,14 @@ class TreeCheckout {
|
|
|
78
81
|
* being reverted.
|
|
79
82
|
*/
|
|
80
83
|
this.revertibleCommitBranches = new Map();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* If the transaction is aborted, the local state will be reset to what it was before the transaction began.
|
|
86
|
-
* Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.
|
|
87
|
-
*
|
|
88
|
-
* To avoid updating observers of the view state with intermediate results during a transaction,
|
|
89
|
-
* use {@link ITreeCheckout#branch} and {@link ISharedTreeFork#merge}.
|
|
90
|
-
*/
|
|
91
|
-
_TreeCheckout_transaction.set(this, new index_js_4.TransactionStack(() => {
|
|
92
|
-
// Keep track of the commit that each transaction was on when it started
|
|
93
|
-
// TODO:#8603: This may need to be computed differently if we allow rebasing during a transaction.
|
|
94
|
-
const startCommit = this._branch.getHead();
|
|
95
|
-
// Keep track of all the forks created during the transaction so that we can dispose them when the transaction ends.
|
|
96
|
-
// This is a policy decision that we think is useful for the user, but it is not necessary for correctness.
|
|
97
|
-
const forks = new Set();
|
|
98
|
-
const onDisposeUnSubscribes = [];
|
|
99
|
-
const onForkUnSubscribe = (0, index_js_4.onForkTransitive)(this, (fork) => {
|
|
100
|
-
forks.add(fork);
|
|
101
|
-
onDisposeUnSubscribes.push(fork.events.on("dispose", () => forks.delete(fork)));
|
|
102
|
-
});
|
|
103
|
-
// When each transaction is started, take a snapshot of the current state of removed roots
|
|
104
|
-
const removedRoots = this.removedRoots.clone();
|
|
105
|
-
this._branch.editor.enterTransaction();
|
|
106
|
-
return (result) => {
|
|
107
|
-
this._branch.editor.exitTransaction();
|
|
108
|
-
switch (result) {
|
|
109
|
-
case index_js_4.TransactionResult.Abort:
|
|
110
|
-
this._branch.removeAfter(startCommit);
|
|
111
|
-
// If a transaction is rolled back, revert removed roots back to the latest snapshot
|
|
112
|
-
this.removedRoots = removedRoots;
|
|
113
|
-
break;
|
|
114
|
-
case index_js_4.TransactionResult.Commit: {
|
|
115
|
-
const removedCommits = this._branch.squashAfter(startCommit);
|
|
116
|
-
const transactionRevision = this._branch.getHead().revision;
|
|
117
|
-
for (const transactionStep of removedCommits) {
|
|
118
|
-
this.removedRoots.updateMajor(transactionStep.revision, transactionRevision);
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
default:
|
|
123
|
-
(0, internal_1.unreachableCase)(result);
|
|
124
|
-
}
|
|
125
|
-
forks.forEach((fork) => fork.dispose());
|
|
126
|
-
onDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());
|
|
127
|
-
onForkUnSubscribe();
|
|
128
|
-
};
|
|
129
|
-
}));
|
|
130
|
-
// We subscribe to `beforeChange` rather than `afterChange` here because it's possible that the change is invalid WRT our forest.
|
|
131
|
-
// For example, a bug in the editor might produce a malformed change object and thus applying the change to the forest will throw an error.
|
|
132
|
-
// In such a case we will crash here, preventing the change from being added to the commit graph, and preventing `afterChange` from firing.
|
|
133
|
-
// One important consequence of this is that we will not submit the op containing the invalid change, since op submissions happens in response to `afterChange`.
|
|
134
|
-
_branch.events.on("beforeChange", (event) => {
|
|
84
|
+
_TreeCheckout_events.set(this, (0, client_utils_1.createEmitter)());
|
|
85
|
+
this.events = __classPrivateFieldGet(this, _TreeCheckout_events, "f");
|
|
86
|
+
this.onAfterChange = (event) => {
|
|
87
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("beforeBatch", event);
|
|
135
88
|
if (event.change !== undefined) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
revision = (0, index_js_5.getLast)(event.newCommits).revision;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
revision = event.change.revision;
|
|
143
|
-
}
|
|
89
|
+
const revision = event.type === "rebase"
|
|
90
|
+
? __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead().revision
|
|
91
|
+
: event.change.revision;
|
|
144
92
|
// Conflicts due to schema will be empty and thus are not applied.
|
|
145
93
|
for (const change of event.change.change.changes) {
|
|
146
94
|
if (change.type === "data") {
|
|
@@ -165,54 +113,21 @@ class TreeCheckout {
|
|
|
165
113
|
// They will however be rebased over the rollback of the schema change. This rebasing will
|
|
166
114
|
// ensure that these data changes are muted if they would render some trees invalid under the
|
|
167
115
|
// original (reinstated) schema.
|
|
168
|
-
storedSchema.apply(change.innerChange.schema.new);
|
|
116
|
+
this.storedSchema.apply(change.innerChange.schema.new);
|
|
169
117
|
}
|
|
170
118
|
else {
|
|
171
119
|
(0, index_js_5.fail)("Unknown Shared Tree change type.");
|
|
172
120
|
}
|
|
173
121
|
}
|
|
174
|
-
this.events.emit("afterBatch");
|
|
175
122
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
// Currently only appends (including merges) and transaction commits are supported.
|
|
180
|
-
if (!this.transaction.isInProgress()) {
|
|
181
|
-
if (event.type === "append" ||
|
|
182
|
-
(event.type === "replace" && (0, index_js_4.getChangeReplaceType)(event) === "transactionCommit")) {
|
|
183
|
-
// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
|
|
184
|
-
// Figure out a way to generate revertibles before the commits are garbage collected.
|
|
185
|
-
for (const commit of event.newCommits) {
|
|
186
|
-
const kind = event.type === "append" ? event.kind : index_js_2.CommitKind.Default;
|
|
187
|
-
const { change, revision } = commit;
|
|
188
|
-
const getRevertible = (0, sharedTreeChangeFamily_js_1.hasSchemaChange)(change)
|
|
189
|
-
? undefined
|
|
190
|
-
: (onRevertibleDisposed) => {
|
|
191
|
-
if (!withinEventContext) {
|
|
192
|
-
throw new internal_2.UsageError("Cannot get a revertible outside of the context of a changed event.");
|
|
193
|
-
}
|
|
194
|
-
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
195
|
-
throw new internal_2.UsageError("Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.");
|
|
196
|
-
}
|
|
197
|
-
const revertible = this.createRevertible(revision, kind, this, onRevertibleDisposed);
|
|
198
|
-
this.revertibleCommitBranches.set(revision, _branch.fork(commit));
|
|
199
|
-
this.revertibles.add(revertible);
|
|
200
|
-
return revertible;
|
|
201
|
-
};
|
|
202
|
-
let withinEventContext = true;
|
|
203
|
-
this.events.emit("changed", { isLocal: true, kind }, getRevertible);
|
|
204
|
-
withinEventContext = false;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
else if (this.isRemoteChangeEvent(event)) {
|
|
208
|
-
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
209
|
-
this.events.emit("changed", { isLocal: false, kind: index_js_2.CommitKind.Default });
|
|
210
|
-
}
|
|
123
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
124
|
+
if (event.type === "append") {
|
|
125
|
+
event.newCommits.forEach((commit) => this.validateCommit(commit));
|
|
211
126
|
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
127
|
+
};
|
|
128
|
+
this.onAncestryTrimmed = (revisions) => {
|
|
129
|
+
// When the branch is trimmed, we can garbage collect any repair data whose latest relevant revision is one of the
|
|
130
|
+
// trimmed revisions.
|
|
216
131
|
this.withCombinedVisitor((visitor) => {
|
|
217
132
|
revisions.forEach((revision) => {
|
|
218
133
|
// get all the roots last created or used by the revision
|
|
@@ -224,7 +139,94 @@ class TreeCheckout {
|
|
|
224
139
|
this.removedRoots.deleteRootsLastTouchedByRevision(revision);
|
|
225
140
|
});
|
|
226
141
|
});
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The {@link Transactor} for this checkout.
|
|
145
|
+
* @remarks In the context of a checkout, transactions allow edits to be batched into atomic units.
|
|
146
|
+
* 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.
|
|
147
|
+
* If the transaction is aborted, the local state will be reset to what it was before the transaction began.
|
|
148
|
+
* Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.
|
|
149
|
+
*
|
|
150
|
+
* To avoid updating observers of the view state with intermediate results during a transaction,
|
|
151
|
+
* use {@link ITreeCheckout#branch} and {@link ISharedTreeFork#merge}.
|
|
152
|
+
*/
|
|
153
|
+
_TreeCheckout_transaction.set(this, void 0);
|
|
154
|
+
// #region Commit Validation
|
|
155
|
+
/** Used to maintain the contract of {@link onCommitValid}(). */
|
|
156
|
+
_TreeCheckout_validatedCommits.set(this, new WeakMap());
|
|
157
|
+
__classPrivateFieldSet(this, _TreeCheckout_transaction, new index_js_4.SquashingTransactionStack(branch, (commits) => {
|
|
158
|
+
const revision = this.mintRevisionTag();
|
|
159
|
+
for (const transactionStep of commits) {
|
|
160
|
+
this.removedRoots.updateMajor(transactionStep.revision, revision);
|
|
161
|
+
}
|
|
162
|
+
const squashedChange = this.changeFamily.rebaser.compose(commits);
|
|
163
|
+
const change = this.changeFamily.rebaser.changeRevision(squashedChange, revision);
|
|
164
|
+
return (0, index_js_2.tagChange)(change, revision);
|
|
165
|
+
}, () => {
|
|
166
|
+
// Keep track of all the forks created during the transaction so that we can dispose them when the transaction ends.
|
|
167
|
+
// This is a policy decision that we think is useful for the user, but it is not necessary for correctness.
|
|
168
|
+
const forks = new Set();
|
|
169
|
+
const onDisposeUnSubscribes = [];
|
|
170
|
+
const onForkUnSubscribe = (0, index_js_4.onForkTransitive)(this, (fork) => {
|
|
171
|
+
forks.add(fork);
|
|
172
|
+
onDisposeUnSubscribes.push(fork.events.on("dispose", () => forks.delete(fork)));
|
|
173
|
+
});
|
|
174
|
+
// When each transaction is started, take a snapshot of the current state of removed roots
|
|
175
|
+
const removedRootsSnapshot = this.removedRoots.clone();
|
|
176
|
+
return (result) => {
|
|
177
|
+
switch (result) {
|
|
178
|
+
case index_js_4.TransactionResult.Abort:
|
|
179
|
+
this.removedRoots = removedRootsSnapshot;
|
|
180
|
+
break;
|
|
181
|
+
case index_js_4.TransactionResult.Commit:
|
|
182
|
+
if (!this.transaction.isInProgress()) {
|
|
183
|
+
// 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.
|
|
184
|
+
this.validateCommit(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead());
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
(0, internal_1.unreachableCase)(result);
|
|
189
|
+
}
|
|
190
|
+
forks.forEach((fork) => fork.dispose());
|
|
191
|
+
onDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());
|
|
192
|
+
onForkUnSubscribe();
|
|
193
|
+
};
|
|
194
|
+
}), "f");
|
|
195
|
+
branch.events.on("afterChange", (event) => {
|
|
196
|
+
// The following logic allows revertibles to be generated for the change.
|
|
197
|
+
// Currently only appends (including merges and transaction commits) are supported.
|
|
198
|
+
if (event.type === "append") {
|
|
199
|
+
// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
|
|
200
|
+
// Figure out a way to generate revertibles before the commits are garbage collected.
|
|
201
|
+
for (const commit of event.newCommits) {
|
|
202
|
+
const kind = event.type === "append" ? event.kind : index_js_2.CommitKind.Default;
|
|
203
|
+
const { change, revision } = commit;
|
|
204
|
+
const getRevertible = (0, sharedTreeChangeFamily_js_1.hasSchemaChange)(change)
|
|
205
|
+
? undefined
|
|
206
|
+
: (onRevertibleDisposed) => {
|
|
207
|
+
if (!withinEventContext) {
|
|
208
|
+
throw new internal_2.UsageError("Cannot get a revertible outside of the context of a changed event.");
|
|
209
|
+
}
|
|
210
|
+
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
211
|
+
throw new internal_2.UsageError("Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.");
|
|
212
|
+
}
|
|
213
|
+
const revertible = this.createRevertible(revision, kind, this, onRevertibleDisposed);
|
|
214
|
+
this.revertibleCommitBranches.set(revision, __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.fork(commit));
|
|
215
|
+
this.revertibles.add(revertible);
|
|
216
|
+
return revertible;
|
|
217
|
+
};
|
|
218
|
+
let withinEventContext = true;
|
|
219
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", { isLocal: true, kind }, getRevertible);
|
|
220
|
+
withinEventContext = false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if (this.isRemoteChangeEvent(event)) {
|
|
224
|
+
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
225
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("changed", { isLocal: false, kind: index_js_2.CommitKind.Default });
|
|
226
|
+
}
|
|
227
227
|
});
|
|
228
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEvents.on("afterChange", this.onAfterChange);
|
|
229
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEvents.on("ancestryTrimmed", this.onAncestryTrimmed);
|
|
228
230
|
}
|
|
229
231
|
withCombinedVisitor(fn) {
|
|
230
232
|
const anchorVisitor = this.forest.anchors.acquireVisitor();
|
|
@@ -305,7 +307,7 @@ class TreeCheckout {
|
|
|
305
307
|
}
|
|
306
308
|
get editor() {
|
|
307
309
|
this.checkNotDisposed();
|
|
308
|
-
return this.
|
|
310
|
+
return __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranchEditor;
|
|
309
311
|
}
|
|
310
312
|
locate(anchor) {
|
|
311
313
|
this.checkNotDisposed();
|
|
@@ -317,11 +319,11 @@ class TreeCheckout {
|
|
|
317
319
|
branch() {
|
|
318
320
|
this.checkNotDisposed("The parent branch has already been disposed and can no longer create new branches.");
|
|
319
321
|
const anchors = new index_js_2.AnchorSet();
|
|
320
|
-
const branch = this.
|
|
322
|
+
const branch = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.fork();
|
|
321
323
|
const storedSchema = this.storedSchema.clone();
|
|
322
324
|
const forest = this.forest.clone(storedSchema, anchors);
|
|
323
|
-
const checkout = new TreeCheckout(branch, true, this.changeFamily, storedSchema, forest,
|
|
324
|
-
this.
|
|
325
|
+
const checkout = new TreeCheckout(branch, true, this.changeFamily, storedSchema, forest, this.mintRevisionTag, this.revisionTagCodec, this.idCompressor, this.removedRoots.clone(), this.logger, this.breaker);
|
|
326
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("fork", checkout);
|
|
325
327
|
return checkout;
|
|
326
328
|
}
|
|
327
329
|
rebase(checkout) {
|
|
@@ -329,7 +331,7 @@ class TreeCheckout {
|
|
|
329
331
|
checkout.checkNotDisposed("The source of the branch rebase has been disposed and cannot be rebased.");
|
|
330
332
|
(0, internal_1.assert)(!checkout.transaction.isInProgress(), 0x9af /* A view cannot be rebased while it has a pending transaction */);
|
|
331
333
|
(0, internal_1.assert)(checkout.isBranch, 0xa5d /* The main branch cannot be rebased onto another branch. */);
|
|
332
|
-
checkout.
|
|
334
|
+
__classPrivateFieldGet(checkout, _TreeCheckout_transaction, "f").activeBranch.rebaseOnto(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch);
|
|
333
335
|
}
|
|
334
336
|
rebaseOnto(checkout) {
|
|
335
337
|
this.checkNotDisposed("The target of the branch rebase has been disposed and cannot be rebased.");
|
|
@@ -342,7 +344,7 @@ class TreeCheckout {
|
|
|
342
344
|
while (checkout.transaction.isInProgress()) {
|
|
343
345
|
checkout.transaction.commit();
|
|
344
346
|
}
|
|
345
|
-
this.
|
|
347
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.merge(__classPrivateFieldGet(checkout, _TreeCheckout_transaction, "f").activeBranch);
|
|
346
348
|
if (disposeMerged && checkout.isBranch) {
|
|
347
349
|
// Dispose the merged checkout unless it is the main branch.
|
|
348
350
|
checkout[index_js_5.disposeSymbol]();
|
|
@@ -355,16 +357,16 @@ class TreeCheckout {
|
|
|
355
357
|
dispose() {
|
|
356
358
|
this[index_js_5.disposeSymbol]();
|
|
357
359
|
}
|
|
358
|
-
[(_TreeCheckout_transaction = new WeakMap(), index_js_5.disposeSymbol)]() {
|
|
360
|
+
[(_TreeCheckout_events = new WeakMap(), _TreeCheckout_transaction = new WeakMap(), _TreeCheckout_validatedCommits = new WeakMap(), index_js_5.disposeSymbol)]() {
|
|
359
361
|
this.checkNotDisposed("The branch has already been disposed and cannot be disposed again.");
|
|
360
362
|
this.disposed = true;
|
|
363
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.dispose();
|
|
361
364
|
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").dispose();
|
|
362
365
|
this.purgeRevertibles();
|
|
363
|
-
this._branch.dispose();
|
|
364
366
|
for (const view of this.views) {
|
|
365
367
|
view.dispose();
|
|
366
368
|
}
|
|
367
|
-
this.
|
|
369
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("dispose");
|
|
368
370
|
}
|
|
369
371
|
getRemovedRoots() {
|
|
370
372
|
this.assertNoUntrackedRoots();
|
|
@@ -383,11 +385,16 @@ class TreeCheckout {
|
|
|
383
385
|
return trees;
|
|
384
386
|
}
|
|
385
387
|
/**
|
|
386
|
-
* This
|
|
387
|
-
* This
|
|
388
|
+
* This must be called on the root/main checkout after loading from a summary.
|
|
389
|
+
* @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.
|
|
390
|
+
* Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.
|
|
388
391
|
*/
|
|
389
|
-
|
|
390
|
-
this.
|
|
392
|
+
load() {
|
|
393
|
+
// 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.
|
|
394
|
+
// 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).
|
|
395
|
+
this.removedRoots.setRevisionsForLoadedData(__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").branch.getHead().revision);
|
|
396
|
+
// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.
|
|
397
|
+
__classPrivateFieldGet(this, _TreeCheckout_events, "f").emit("afterBatch");
|
|
391
398
|
}
|
|
392
399
|
purgeRevertibles() {
|
|
393
400
|
for (const revertible of this.revertibles) {
|
|
@@ -408,12 +415,12 @@ class TreeCheckout {
|
|
|
408
415
|
const commitToRevert = revertibleBranch.getHead();
|
|
409
416
|
const revisionForInvert = this.mintRevisionTag();
|
|
410
417
|
let change = (0, index_js_2.tagChange)(this.changeFamily.rebaser.invert(commitToRevert, false, revisionForInvert), revisionForInvert);
|
|
411
|
-
const headCommit = this.
|
|
418
|
+
const headCommit = __classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.getHead();
|
|
412
419
|
// Rebase the inverted change onto any commits that occurred after the undoable commits.
|
|
413
420
|
if (commitToRevert !== headCommit) {
|
|
414
421
|
change = (0, index_js_2.tagChange)((0, index_js_2.rebaseChange)(this.changeFamily.rebaser, change, commitToRevert, headCommit, this.mintRevisionTag).change, revisionForInvert);
|
|
415
422
|
}
|
|
416
|
-
this.
|
|
423
|
+
__classPrivateFieldGet(this, _TreeCheckout_transaction, "f").activeBranch.apply(change, kind === index_js_2.CommitKind.Default || kind === index_js_2.CommitKind.Redo
|
|
417
424
|
? index_js_2.CommitKind.Undo
|
|
418
425
|
: index_js_2.CommitKind.Redo);
|
|
419
426
|
// Derive some stats about the reversion to return to the caller.
|
|
@@ -451,8 +458,33 @@ class TreeCheckout {
|
|
|
451
458
|
!this.isBranch &&
|
|
452
459
|
// Remote changes are applied to the main branch by rebasing it onto the trunk.
|
|
453
460
|
// No other rebases are allowed on the main branch, so we can use this to detect remote changes.
|
|
454
|
-
event.type === "
|
|
455
|
-
|
|
461
|
+
event.type === "rebase");
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Registers a function to be called when the given commit is validated.
|
|
465
|
+
* @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).
|
|
466
|
+
* 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.
|
|
467
|
+
* 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).
|
|
468
|
+
*
|
|
469
|
+
* If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.
|
|
470
|
+
* Otherwise, the function is registered to be called later and this function returns `false`.
|
|
471
|
+
*/
|
|
472
|
+
onCommitValid(commit, fn) {
|
|
473
|
+
const validated = (0, index_js_5.getOrCreate)(__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
474
|
+
if (validated === true) {
|
|
475
|
+
fn(commit);
|
|
476
|
+
return true;
|
|
477
|
+
}
|
|
478
|
+
validated.push(fn);
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
/** Mark the given commit as "validated" according to the contract of {@link onCommitValid}(). */
|
|
482
|
+
validateCommit(commit) {
|
|
483
|
+
const validated = (0, index_js_5.getOrCreate)(__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f"), commit, () => []);
|
|
484
|
+
if (validated !== true) {
|
|
485
|
+
validated.forEach((fn) => fn(commit));
|
|
486
|
+
__classPrivateFieldGet(this, _TreeCheckout_validatedCommits, "f").set(commit, true);
|
|
487
|
+
}
|
|
456
488
|
}
|
|
457
489
|
}
|
|
458
490
|
exports.TreeCheckout = TreeCheckout;
|