@fluidframework/tree 2.11.0 → 2.13.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 +140 -0
- package/api-report/tree.alpha.api.md +88 -12
- package/api-report/tree.beta.api.md +23 -11
- package/api-report/tree.legacy.alpha.api.md +23 -11
- package/api-report/tree.legacy.public.api.md +23 -11
- package/api-report/tree.public.api.md +23 -11
- package/dist/alpha.d.ts +11 -0
- package/dist/beta.d.ts +2 -0
- 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/defaultEditBuilder.d.ts +10 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.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 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +6 -4
- 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/crossFieldQueries.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +8 -2
- package/dist/feature-libraries/modular-schema/crossFieldQueries.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/fieldChangeHandler.d.ts +12 -5
- 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 +2 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modular-schema/modularChangeFamily.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +24 -4
- package/dist/feature-libraries/optional-field/optionalField.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/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +14 -5
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -14
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -0
- package/dist/shared-tree/index.d.ts +3 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -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 +10 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +51 -12
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +31 -10
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +106 -15
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/transactionTypes.d.ts +105 -0
- package/dist/shared-tree/transactionTypes.d.ts.map +1 -0
- package/dist/shared-tree/transactionTypes.js +13 -0
- package/dist/shared-tree/transactionTypes.js.map +1 -0
- package/dist/shared-tree/treeApi.d.ts +1 -25
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +4 -8
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +39 -13
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +275 -128
- 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 +3 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +6 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/jsonSchema.d.ts +6 -0
- package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/jsonSchema.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +65 -8
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +10 -4
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js +90 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/dist/simple-tree/api/simpleSchema.d.ts +8 -2
- 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/simpleSchemaToJsonSchema.js +13 -10
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.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/testRecursiveDomain.d.ts +5 -5
- package/dist/simple-tree/api/tree.d.ts +61 -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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -11
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +2 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +2 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +6 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +5 -20
- 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/mapNode.d.ts +2 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +2 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +9 -4
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +19 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +6 -2
- 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 +51 -3
- 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 +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +4 -5
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +72 -42
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +161 -151
- package/dist/util/rangeMap.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 +35 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +32 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +11 -0
- package/lib/beta.d.ts +2 -0
- 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/defaultEditBuilder.d.ts +10 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/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 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -2
- 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/crossFieldQueries.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +9 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.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/fieldChangeHandler.d.ts +12 -5
- 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 +2 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modular-schema/modularChangeFamily.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +24 -4
- package/lib/feature-libraries/optional-field/optionalField.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/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +14 -5
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +2 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -0
- package/lib/shared-tree/index.d.ts +3 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/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 +10 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +56 -17
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +31 -10
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +107 -16
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/transactionTypes.d.ts +105 -0
- package/lib/shared-tree/transactionTypes.d.ts.map +1 -0
- package/lib/shared-tree/transactionTypes.js +10 -0
- package/lib/shared-tree/transactionTypes.js.map +1 -0
- package/lib/shared-tree/treeApi.d.ts +1 -25
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +1 -5
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +39 -13
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +277 -130
- 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 +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +3 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/jsonSchema.d.ts +6 -0
- package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/jsonSchema.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +65 -8
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +9 -3
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js +86 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/lib/simple-tree/api/simpleSchema.d.ts +8 -2
- 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/simpleSchemaToJsonSchema.js +14 -11
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.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/testRecursiveDomain.d.ts +5 -5
- package/lib/simple-tree/api/tree.d.ts +61 -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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +12 -12
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +2 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +2 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- 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 +5 -20
- 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/mapNode.d.ts +2 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +2 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +9 -4
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +17 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +6 -2
- 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 +51 -3
- 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 +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +72 -42
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +159 -146
- package/lib/util/rangeMap.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 +35 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +29 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- 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/defaultEditBuilder.ts +14 -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 -1
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +9 -9
- package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +13 -9
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
- package/src/feature-libraries/modular-schema/index.ts +14 -0
- package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +124 -31
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +12 -0
- package/src/feature-libraries/optional-field/optionalField.ts +34 -5
- package/src/feature-libraries/sequence-field/types.ts +0 -1
- package/src/feature-libraries/sequence-field/utils.ts +18 -7
- package/src/index.ts +12 -29
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +13 -2
- package/src/shared-tree/schematizeTree.ts +6 -10
- package/src/shared-tree/schematizingTreeView.ts +102 -23
- package/src/shared-tree/sharedTree.ts +181 -44
- package/src/shared-tree/transactionTypes.ts +125 -0
- package/src/shared-tree/treeApi.ts +1 -28
- package/src/shared-tree/treeCheckout.ts +358 -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 +13 -2
- package/src/simple-tree/api/jsonSchema.ts +7 -0
- package/src/simple-tree/api/schemaFactory.ts +91 -3
- package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
- package/src/simple-tree/api/simpleSchema.ts +9 -2
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
- 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 +78 -0
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +197 -51
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
- package/src/simple-tree/arrayNode.ts +7 -1
- package/src/simple-tree/core/treeNodeSchema.ts +51 -7
- package/src/simple-tree/index.ts +9 -0
- package/src/simple-tree/leafNodeSchema.ts +0 -19
- package/src/simple-tree/mapNode.ts +7 -1
- package/src/simple-tree/objectNode.ts +33 -3
- package/src/simple-tree/objectNodeTypes.ts +9 -1
- package/src/simple-tree/schemaTypes.ts +57 -3
- package/src/simple-tree/toStoredSchema.ts +25 -19
- package/src/util/brand.ts +0 -2
- package/src/util/index.ts +3 -6
- package/src/util/rangeMap.ts +199 -189
- package/src/util/typeCheck.ts +0 -2
- package/src/util/utils.ts +73 -1
- package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -74
- package/dist/feature-libraries/memoizedIdRangeAllocator.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
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -71
- package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
- package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import type {
|
|
8
|
-
HasListeners,
|
|
9
|
-
IEmitter,
|
|
10
|
-
Listenable,
|
|
11
|
-
} from "@fluidframework/core-interfaces/internal";
|
|
7
|
+
import type { Listenable } from "@fluidframework/core-interfaces/internal";
|
|
12
8
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
13
9
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
14
10
|
import {
|
|
@@ -44,6 +40,7 @@ import {
|
|
|
44
40
|
visitDelta,
|
|
45
41
|
type RevertibleAlphaFactory,
|
|
46
42
|
type RevertibleAlpha,
|
|
43
|
+
type GraphCommit,
|
|
47
44
|
} from "../core/index.js";
|
|
48
45
|
import {
|
|
49
46
|
type FieldBatchCodec,
|
|
@@ -55,15 +52,14 @@ import {
|
|
|
55
52
|
makeFieldBatchCodec,
|
|
56
53
|
} from "../feature-libraries/index.js";
|
|
57
54
|
import {
|
|
55
|
+
SquashingTransactionStack,
|
|
58
56
|
SharedTreeBranch,
|
|
59
57
|
TransactionResult,
|
|
60
|
-
TransactionStack,
|
|
61
|
-
getChangeReplaceType,
|
|
62
58
|
onForkTransitive,
|
|
63
59
|
type SharedTreeBranchChange,
|
|
64
60
|
type Transactor,
|
|
65
61
|
} from "../shared-tree-core/index.js";
|
|
66
|
-
import { Breakable, disposeSymbol, fail,
|
|
62
|
+
import { Breakable, disposeSymbol, fail, getOrCreate } from "../util/index.js";
|
|
67
63
|
|
|
68
64
|
import { SharedTreeChangeFamily, hasSchemaChange } from "./sharedTreeChangeFamily.js";
|
|
69
65
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
@@ -77,6 +73,7 @@ import type {
|
|
|
77
73
|
UnsafeUnknownSchema,
|
|
78
74
|
ViewableTree,
|
|
79
75
|
TreeBranch,
|
|
76
|
+
TreeChangeEvents,
|
|
80
77
|
} from "../simple-tree/index.js";
|
|
81
78
|
import { getCheckout, SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
82
79
|
|
|
@@ -84,10 +81,21 @@ import { getCheckout, SchematizingSimpleTreeView } from "./schematizingTreeView.
|
|
|
84
81
|
* Events for {@link ITreeCheckout}.
|
|
85
82
|
*/
|
|
86
83
|
export interface CheckoutEvents {
|
|
84
|
+
/**
|
|
85
|
+
* The view is currently in a consistent state, but a batch of changes is about to be processed.
|
|
86
|
+
* @remarks Once this event fires, it is not safe to access the FlexTree, Forest and AnchorSet again until the corresponding {@link CheckoutEvents.afterBatch} fires.
|
|
87
|
+
* Every call to `beforeBatch` will be followed by a corresponding call to `afterBatch` (before any more calls to `beforeBatch`).
|
|
88
|
+
* @param change - The {@link SharedTreeBranchChange | change} to the checkout's active branch that is about to be processed.
|
|
89
|
+
* May be empty if the changes were produced by e.g. a rebase or the initial loading of the document.
|
|
90
|
+
*/
|
|
91
|
+
beforeBatch(change: SharedTreeBranchChange<SharedTreeChange>): void;
|
|
92
|
+
|
|
87
93
|
/**
|
|
88
94
|
* A batch of changes has finished processing and the view is in a consistent state.
|
|
89
|
-
* It is once again safe to access the FlexTree, Forest and AnchorSet.
|
|
95
|
+
* @remarks It is once again safe to access the FlexTree, Forest and AnchorSet.
|
|
90
96
|
*
|
|
97
|
+
* While every call to `beforeBatch` will be followed by a corresponding call to `afterBatch`, the converse is not true.
|
|
98
|
+
* This event may be fired without a preceding `beforeBatch` event if the checkout's branch and forest were directly updated via e.g. a summary load rather than via normal application of changes.
|
|
91
99
|
* @remarks
|
|
92
100
|
* This is mainly useful for knowing when to do followup work scheduled during events from Anchors.
|
|
93
101
|
*/
|
|
@@ -260,13 +268,11 @@ export function createTreeCheckout(
|
|
|
260
268
|
schema?: TreeStoredSchemaRepository;
|
|
261
269
|
forest?: IEditableForest;
|
|
262
270
|
fieldBatchCodec?: FieldBatchCodec;
|
|
263
|
-
events?: Listenable<CheckoutEvents> &
|
|
264
|
-
IEmitter<CheckoutEvents> &
|
|
265
|
-
HasListeners<CheckoutEvents>;
|
|
266
271
|
removedRoots?: DetachedFieldIndex;
|
|
267
272
|
chunkCompressionStrategy?: TreeCompressionStrategy;
|
|
268
273
|
logger?: ITelemetryLoggerExt;
|
|
269
274
|
breaker?: Breakable;
|
|
275
|
+
disposeForksAfterTransaction?: boolean;
|
|
270
276
|
},
|
|
271
277
|
): TreeCheckout {
|
|
272
278
|
const forest = args?.forest ?? buildForest();
|
|
@@ -293,7 +299,6 @@ export function createTreeCheckout(
|
|
|
293
299
|
changeFamily,
|
|
294
300
|
() => idCompressor.generateCompressedId(),
|
|
295
301
|
);
|
|
296
|
-
const events = args?.events ?? createEmitter();
|
|
297
302
|
|
|
298
303
|
return new TreeCheckout(
|
|
299
304
|
branch,
|
|
@@ -301,13 +306,13 @@ export function createTreeCheckout(
|
|
|
301
306
|
changeFamily,
|
|
302
307
|
schema,
|
|
303
308
|
forest,
|
|
304
|
-
events,
|
|
305
309
|
mintRevisionTag,
|
|
306
310
|
revisionTagCodec,
|
|
307
311
|
idCompressor,
|
|
308
312
|
args?.removedRoots,
|
|
309
313
|
args?.logger,
|
|
310
314
|
args?.breaker,
|
|
315
|
+
args?.disposeForksAfterTransaction,
|
|
311
316
|
);
|
|
312
317
|
}
|
|
313
318
|
|
|
@@ -340,6 +345,8 @@ export interface RevertMetrics {
|
|
|
340
345
|
export class TreeCheckout implements ITreeCheckoutFork {
|
|
341
346
|
public disposed = false;
|
|
342
347
|
|
|
348
|
+
private readonly editLock: EditLock;
|
|
349
|
+
|
|
343
350
|
private readonly views = new Set<TreeView<ImplicitFieldSchema>>();
|
|
344
351
|
|
|
345
352
|
/**
|
|
@@ -363,16 +370,16 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
363
370
|
*/
|
|
364
371
|
public static readonly revertTelemetryEventName = "RevertRevertible";
|
|
365
372
|
|
|
373
|
+
readonly #events = createEmitter<CheckoutEvents>();
|
|
374
|
+
public events: Listenable<CheckoutEvents> = this.#events;
|
|
375
|
+
|
|
366
376
|
public constructor(
|
|
367
|
-
|
|
377
|
+
branch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,
|
|
368
378
|
/** True if and only if this checkout is for a forked branch and not the "main branch" of the tree. */
|
|
369
379
|
public readonly isBranch: boolean,
|
|
370
380
|
private readonly changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,
|
|
371
381
|
public readonly storedSchema: TreeStoredSchemaRepository,
|
|
372
382
|
public readonly forest: IEditableForest,
|
|
373
|
-
public readonly events: Listenable<CheckoutEvents> &
|
|
374
|
-
IEmitter<CheckoutEvents> &
|
|
375
|
-
HasListeners<CheckoutEvents>,
|
|
376
383
|
private readonly mintRevisionTag: () => RevisionTag,
|
|
377
384
|
private readonly revisionTagCodec: RevisionTagCodec,
|
|
378
385
|
private readonly idCompressor: IIdCompressor,
|
|
@@ -384,122 +391,160 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
384
391
|
/** Optional logger for telemetry. */
|
|
385
392
|
private readonly logger?: ITelemetryLoggerExt,
|
|
386
393
|
private readonly breaker: Breakable = new Breakable("TreeCheckout"),
|
|
394
|
+
private readonly disposeForksAfterTransaction = true,
|
|
387
395
|
) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
let revision: RevisionTag | undefined;
|
|
395
|
-
if (event.type === "replace") {
|
|
396
|
-
assert(
|
|
397
|
-
hasSome(event.newCommits),
|
|
398
|
-
0xa81 /* Expected new commit for non no-op change event */,
|
|
399
|
-
);
|
|
400
|
-
revision = getLast(event.newCommits).revision;
|
|
401
|
-
} else {
|
|
402
|
-
revision = event.change.revision;
|
|
396
|
+
this.#transaction = new SquashingTransactionStack(
|
|
397
|
+
branch,
|
|
398
|
+
(commits) => {
|
|
399
|
+
const revision = this.mintRevisionTag();
|
|
400
|
+
for (const transactionStep of commits) {
|
|
401
|
+
this.removedRoots.updateMajor(transactionStep.revision, revision);
|
|
403
402
|
}
|
|
404
403
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
storedSchema.apply(change.innerChange.schema.new);
|
|
429
|
-
} else {
|
|
430
|
-
fail("Unknown Shared Tree change type.");
|
|
404
|
+
const squashedChange = this.changeFamily.rebaser.compose(commits);
|
|
405
|
+
const change = this.changeFamily.rebaser.changeRevision(squashedChange, revision);
|
|
406
|
+
return tagChange(change, revision);
|
|
407
|
+
},
|
|
408
|
+
() => {
|
|
409
|
+
const disposeForks = this.disposeForksAfterTransaction
|
|
410
|
+
? trackForksForDisposal(this)
|
|
411
|
+
: undefined;
|
|
412
|
+
// When each transaction is started, take a snapshot of the current state of removed roots
|
|
413
|
+
const removedRootsSnapshot = this.removedRoots.clone();
|
|
414
|
+
return (result) => {
|
|
415
|
+
switch (result) {
|
|
416
|
+
case TransactionResult.Abort:
|
|
417
|
+
this.removedRoots = removedRootsSnapshot;
|
|
418
|
+
break;
|
|
419
|
+
case TransactionResult.Commit:
|
|
420
|
+
if (!this.transaction.isInProgress()) {
|
|
421
|
+
// 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.
|
|
422
|
+
this.validateCommit(this.#transaction.branch.getHead());
|
|
423
|
+
}
|
|
424
|
+
break;
|
|
425
|
+
default:
|
|
426
|
+
unreachableCase(result);
|
|
431
427
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
428
|
+
disposeForks?.();
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
this.editLock = new EditLock(this.#transaction.activeBranchEditor);
|
|
434
|
+
|
|
435
|
+
branch.events.on("afterChange", (event) => {
|
|
437
436
|
// The following logic allows revertibles to be generated for the change.
|
|
438
|
-
// Currently only appends (including merges
|
|
439
|
-
if (
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
: (onRevertibleDisposed?: (revertible: RevertibleAlpha) => void) => {
|
|
453
|
-
if (!withinEventContext) {
|
|
454
|
-
throw new UsageError(
|
|
455
|
-
"Cannot get a revertible outside of the context of a changed event.",
|
|
456
|
-
);
|
|
457
|
-
}
|
|
458
|
-
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
459
|
-
throw new UsageError(
|
|
460
|
-
"Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.",
|
|
461
|
-
);
|
|
462
|
-
}
|
|
463
|
-
const revertible = this.createRevertible(
|
|
464
|
-
revision,
|
|
465
|
-
kind,
|
|
466
|
-
this,
|
|
467
|
-
onRevertibleDisposed,
|
|
437
|
+
// Currently only appends (including merges and transaction commits) are supported.
|
|
438
|
+
if (event.type === "append") {
|
|
439
|
+
// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
|
|
440
|
+
// Figure out a way to generate revertibles before the commits are garbage collected.
|
|
441
|
+
for (const commit of event.newCommits) {
|
|
442
|
+
const kind = event.type === "append" ? event.kind : CommitKind.Default;
|
|
443
|
+
const { change, revision } = commit;
|
|
444
|
+
|
|
445
|
+
const getRevertible = hasSchemaChange(change)
|
|
446
|
+
? undefined
|
|
447
|
+
: (onRevertibleDisposed?: (revertible: RevertibleAlpha) => void) => {
|
|
448
|
+
if (!withinEventContext) {
|
|
449
|
+
throw new UsageError(
|
|
450
|
+
"Cannot get a revertible outside of the context of a changed event.",
|
|
468
451
|
);
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
452
|
+
}
|
|
453
|
+
if (this.revertibleCommitBranches.get(revision) !== undefined) {
|
|
454
|
+
throw new UsageError(
|
|
455
|
+
"Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.",
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
const revertible = this.createRevertible(
|
|
459
|
+
revision,
|
|
460
|
+
kind,
|
|
461
|
+
this,
|
|
462
|
+
onRevertibleDisposed,
|
|
463
|
+
);
|
|
464
|
+
this.revertibleCommitBranches.set(
|
|
465
|
+
revision,
|
|
466
|
+
this.#transaction.activeBranch.fork(commit),
|
|
467
|
+
);
|
|
468
|
+
this.revertibles.add(revertible);
|
|
469
|
+
return revertible;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
let withinEventContext = true;
|
|
473
|
+
this.#events.emit("changed", { isLocal: true, kind }, getRevertible);
|
|
474
|
+
withinEventContext = false;
|
|
481
475
|
}
|
|
476
|
+
} else if (this.isRemoteChangeEvent(event)) {
|
|
477
|
+
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
478
|
+
this.#events.emit("changed", { isLocal: false, kind: CommitKind.Default });
|
|
482
479
|
}
|
|
483
480
|
});
|
|
484
481
|
|
|
482
|
+
this.#transaction.activeBranchEvents.on("afterChange", this.onAfterChange);
|
|
483
|
+
this.#transaction.activeBranchEvents.on("ancestryTrimmed", this.onAncestryTrimmed);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
private readonly onAfterChange = (event: SharedTreeBranchChange<SharedTreeChange>): void => {
|
|
487
|
+
this.editLock.lock();
|
|
488
|
+
this.#events.emit("beforeBatch", event);
|
|
489
|
+
if (event.change !== undefined) {
|
|
490
|
+
const revision =
|
|
491
|
+
event.type === "rebase"
|
|
492
|
+
? this.#transaction.activeBranch.getHead().revision
|
|
493
|
+
: event.change.revision;
|
|
494
|
+
|
|
495
|
+
// Conflicts due to schema will be empty and thus are not applied.
|
|
496
|
+
for (const change of event.change.change.changes) {
|
|
497
|
+
if (change.type === "data") {
|
|
498
|
+
const delta = intoDelta(tagChange(change.innerChange, revision));
|
|
499
|
+
this.withCombinedVisitor((visitor) => {
|
|
500
|
+
visitDelta(delta, visitor, this.removedRoots, revision);
|
|
501
|
+
});
|
|
502
|
+
} else if (change.type === "schema") {
|
|
503
|
+
// Schema changes from a current to a new schema are expected to be backwards compatible.
|
|
504
|
+
// This guarantees that all data in the forest (which is valid before the schema change)
|
|
505
|
+
// is also valid under the new schema.
|
|
506
|
+
// Note however, that such schema changes may in some cases be rolled back:
|
|
507
|
+
// Case 1: A transaction with a schema change may be aborted.
|
|
508
|
+
// The transaction may have made some data changes that would render some trees invalid
|
|
509
|
+
// under the old schema, but these changes will also be rolled back, thereby putting the forest
|
|
510
|
+
// back in the state before the transaction, which is valid under the original (reinstated) schema.
|
|
511
|
+
// Case 2: A branch with a schema change may be rebased such that the schema change (because
|
|
512
|
+
// of a constraint) is no longer applied.
|
|
513
|
+
// Such a branch may contain data changes that would render some trees invalid under the
|
|
514
|
+
// original schema. These data changes may not necessarily be rolled back.
|
|
515
|
+
// They will however be rebased over the rollback of the schema change. This rebasing will
|
|
516
|
+
// ensure that these data changes are muted if they would render some trees invalid under the
|
|
517
|
+
// original (reinstated) schema.
|
|
518
|
+
this.storedSchema.apply(change.innerChange.schema.new);
|
|
519
|
+
} else {
|
|
520
|
+
fail("Unknown Shared Tree change type.");
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
this.#events.emit("afterBatch");
|
|
525
|
+
this.editLock.unlock();
|
|
526
|
+
if (event.type === "append") {
|
|
527
|
+
event.newCommits.forEach((commit) => this.validateCommit(commit));
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
private readonly onAncestryTrimmed = (revisions: RevisionTag[]): void => {
|
|
485
532
|
// When the branch is trimmed, we can garbage collect any repair data whose latest relevant revision is one of the
|
|
486
533
|
// trimmed revisions.
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
534
|
+
this.withCombinedVisitor((visitor) => {
|
|
535
|
+
revisions.forEach((revision) => {
|
|
536
|
+
// get all the roots last created or used by the revision
|
|
537
|
+
const roots = this.removedRoots.getRootsLastTouchedByRevision(revision);
|
|
538
|
+
|
|
539
|
+
// get the detached field for the root and delete it from the removed roots
|
|
540
|
+
for (const root of roots) {
|
|
541
|
+
visitor.destroy(this.removedRoots.toFieldKey(root), 1);
|
|
542
|
+
}
|
|
497
543
|
|
|
498
|
-
|
|
499
|
-
});
|
|
544
|
+
this.removedRoots.deleteRootsLastTouchedByRevision(revision);
|
|
500
545
|
});
|
|
501
546
|
});
|
|
502
|
-
}
|
|
547
|
+
};
|
|
503
548
|
|
|
504
549
|
private withCombinedVisitor(fn: (visitor: DeltaVisitor) => void): void {
|
|
505
550
|
const anchorVisitor = this.forest.anchors.acquireVisitor();
|
|
@@ -622,7 +667,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
622
667
|
|
|
623
668
|
public get editor(): ISharedTreeEditor {
|
|
624
669
|
this.checkNotDisposed();
|
|
625
|
-
return this.
|
|
670
|
+
return this.editLock.editor;
|
|
626
671
|
}
|
|
627
672
|
|
|
628
673
|
public locate(anchor: Anchor): AnchorNode | undefined {
|
|
@@ -643,53 +688,15 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
643
688
|
* To avoid updating observers of the view state with intermediate results during a transaction,
|
|
644
689
|
* use {@link ITreeCheckout#branch} and {@link ISharedTreeFork#merge}.
|
|
645
690
|
*/
|
|
646
|
-
readonly #transaction
|
|
647
|
-
// Keep track of the commit that each transaction was on when it started
|
|
648
|
-
// TODO:#8603: This may need to be computed differently if we allow rebasing during a transaction.
|
|
649
|
-
const startCommit = this._branch.getHead();
|
|
650
|
-
// Keep track of all the forks created during the transaction so that we can dispose them when the transaction ends.
|
|
651
|
-
// This is a policy decision that we think is useful for the user, but it is not necessary for correctness.
|
|
652
|
-
const forks = new Set<TreeCheckout>();
|
|
653
|
-
const onDisposeUnSubscribes: (() => void)[] = [];
|
|
654
|
-
const onForkUnSubscribe = onForkTransitive(this, (fork) => {
|
|
655
|
-
forks.add(fork);
|
|
656
|
-
onDisposeUnSubscribes.push(fork.events.on("dispose", () => forks.delete(fork)));
|
|
657
|
-
});
|
|
658
|
-
// When each transaction is started, take a snapshot of the current state of removed roots
|
|
659
|
-
const removedRoots = this.removedRoots.clone();
|
|
660
|
-
this._branch.editor.enterTransaction();
|
|
661
|
-
return (result) => {
|
|
662
|
-
this._branch.editor.exitTransaction();
|
|
663
|
-
switch (result) {
|
|
664
|
-
case TransactionResult.Abort:
|
|
665
|
-
this._branch.removeAfter(startCommit);
|
|
666
|
-
// If a transaction is rolled back, revert removed roots back to the latest snapshot
|
|
667
|
-
this.removedRoots = removedRoots;
|
|
668
|
-
break;
|
|
669
|
-
case TransactionResult.Commit: {
|
|
670
|
-
const removedCommits = this._branch.squashAfter(startCommit);
|
|
671
|
-
const transactionRevision = this._branch.getHead().revision;
|
|
672
|
-
for (const transactionStep of removedCommits) {
|
|
673
|
-
this.removedRoots.updateMajor(transactionStep.revision, transactionRevision);
|
|
674
|
-
}
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
default:
|
|
678
|
-
unreachableCase(result);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
forks.forEach((fork) => fork.dispose());
|
|
682
|
-
onDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());
|
|
683
|
-
onForkUnSubscribe();
|
|
684
|
-
};
|
|
685
|
-
});
|
|
691
|
+
readonly #transaction: SquashingTransactionStack<SharedTreeEditBuilder, SharedTreeChange>;
|
|
686
692
|
|
|
687
693
|
public branch(): TreeCheckout {
|
|
688
694
|
this.checkNotDisposed(
|
|
689
695
|
"The parent branch has already been disposed and can no longer create new branches.",
|
|
690
696
|
);
|
|
697
|
+
this.editLock.checkUnlocked("Branching");
|
|
691
698
|
const anchors = new AnchorSet();
|
|
692
|
-
const branch = this.
|
|
699
|
+
const branch = this.#transaction.activeBranch.fork();
|
|
693
700
|
const storedSchema = this.storedSchema.clone();
|
|
694
701
|
const forest = this.forest.clone(storedSchema, anchors);
|
|
695
702
|
const checkout = new TreeCheckout(
|
|
@@ -698,15 +705,15 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
698
705
|
this.changeFamily,
|
|
699
706
|
storedSchema,
|
|
700
707
|
forest,
|
|
701
|
-
createEmitter(),
|
|
702
708
|
this.mintRevisionTag,
|
|
703
709
|
this.revisionTagCodec,
|
|
704
710
|
this.idCompressor,
|
|
705
711
|
this.removedRoots.clone(),
|
|
706
712
|
this.logger,
|
|
707
713
|
this.breaker,
|
|
714
|
+
this.disposeForksAfterTransaction,
|
|
708
715
|
);
|
|
709
|
-
this
|
|
716
|
+
this.#events.emit("fork", checkout);
|
|
710
717
|
return checkout;
|
|
711
718
|
}
|
|
712
719
|
|
|
@@ -717,6 +724,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
717
724
|
checkout.checkNotDisposed(
|
|
718
725
|
"The source of the branch rebase has been disposed and cannot be rebased.",
|
|
719
726
|
);
|
|
727
|
+
this.editLock.checkUnlocked("Rebasing");
|
|
720
728
|
assert(
|
|
721
729
|
!checkout.transaction.isInProgress(),
|
|
722
730
|
0x9af /* A view cannot be rebased while it has a pending transaction */,
|
|
@@ -726,7 +734,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
726
734
|
0xa5d /* The main branch cannot be rebased onto another branch. */,
|
|
727
735
|
);
|
|
728
736
|
|
|
729
|
-
checkout.
|
|
737
|
+
checkout.#transaction.activeBranch.rebaseOnto(this.#transaction.activeBranch);
|
|
730
738
|
}
|
|
731
739
|
|
|
732
740
|
public rebaseOnto(checkout: ITreeCheckout): void {
|
|
@@ -745,6 +753,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
745
753
|
checkout.checkNotDisposed(
|
|
746
754
|
"The source of the branch merge has been disposed and cannot be merged.",
|
|
747
755
|
);
|
|
756
|
+
this.editLock.checkUnlocked("Merging");
|
|
748
757
|
assert(
|
|
749
758
|
!this.transaction.isInProgress(),
|
|
750
759
|
0x9b0 /* Views cannot be merged into a view while it has a pending transaction */,
|
|
@@ -752,7 +761,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
752
761
|
while (checkout.transaction.isInProgress()) {
|
|
753
762
|
checkout.transaction.commit();
|
|
754
763
|
}
|
|
755
|
-
this.
|
|
764
|
+
this.#transaction.activeBranch.merge(checkout.#transaction.activeBranch);
|
|
756
765
|
if (disposeMerged && checkout.isBranch) {
|
|
757
766
|
// Dispose the merged checkout unless it is the main branch.
|
|
758
767
|
checkout[disposeSymbol]();
|
|
@@ -765,6 +774,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
765
774
|
}
|
|
766
775
|
|
|
767
776
|
public dispose(): void {
|
|
777
|
+
this.editLock.checkUnlocked("Disposing a view");
|
|
768
778
|
this[disposeSymbol]();
|
|
769
779
|
}
|
|
770
780
|
|
|
@@ -773,13 +783,13 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
773
783
|
"The branch has already been disposed and cannot be disposed again.",
|
|
774
784
|
);
|
|
775
785
|
this.disposed = true;
|
|
786
|
+
this.#transaction.branch.dispose();
|
|
776
787
|
this.#transaction.dispose();
|
|
777
788
|
this.purgeRevertibles();
|
|
778
|
-
this._branch.dispose();
|
|
779
789
|
for (const view of this.views) {
|
|
780
790
|
view.dispose();
|
|
781
791
|
}
|
|
782
|
-
this
|
|
792
|
+
this.#events.emit("dispose");
|
|
783
793
|
}
|
|
784
794
|
|
|
785
795
|
public getRemovedRoots(): [string | number | undefined, number, JsonableTree][] {
|
|
@@ -800,11 +810,16 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
800
810
|
}
|
|
801
811
|
|
|
802
812
|
/**
|
|
803
|
-
* This
|
|
804
|
-
* This
|
|
813
|
+
* This must be called on the root/main checkout after loading from a summary.
|
|
814
|
+
* @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.
|
|
815
|
+
* Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.
|
|
805
816
|
*/
|
|
806
|
-
public
|
|
807
|
-
this.
|
|
817
|
+
public load(): void {
|
|
818
|
+
// 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.
|
|
819
|
+
// 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).
|
|
820
|
+
this.removedRoots.setRevisionsForLoadedData(this.#transaction.branch.getHead().revision);
|
|
821
|
+
// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.
|
|
822
|
+
this.#events.emit("afterBatch");
|
|
808
823
|
}
|
|
809
824
|
|
|
810
825
|
private purgeRevertibles(): void {
|
|
@@ -834,7 +849,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
834
849
|
revisionForInvert,
|
|
835
850
|
);
|
|
836
851
|
|
|
837
|
-
const headCommit = this.
|
|
852
|
+
const headCommit = this.#transaction.activeBranch.getHead();
|
|
838
853
|
// Rebase the inverted change onto any commits that occurred after the undoable commits.
|
|
839
854
|
if (commitToRevert !== headCommit) {
|
|
840
855
|
change = tagChange(
|
|
@@ -849,7 +864,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
849
864
|
);
|
|
850
865
|
}
|
|
851
866
|
|
|
852
|
-
this.
|
|
867
|
+
this.#transaction.activeBranch.apply(
|
|
853
868
|
change,
|
|
854
869
|
kind === CommitKind.Default || kind === CommitKind.Redo
|
|
855
870
|
? CommitKind.Undo
|
|
@@ -901,8 +916,176 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
901
916
|
!this.isBranch &&
|
|
902
917
|
// Remote changes are applied to the main branch by rebasing it onto the trunk.
|
|
903
918
|
// No other rebases are allowed on the main branch, so we can use this to detect remote changes.
|
|
904
|
-
event.type === "
|
|
905
|
-
getChangeReplaceType(event) === "rebase"
|
|
919
|
+
event.type === "rebase"
|
|
906
920
|
);
|
|
907
921
|
}
|
|
922
|
+
|
|
923
|
+
// #region Commit Validation
|
|
924
|
+
|
|
925
|
+
/** Used to maintain the contract of {@link onCommitValid}(). */
|
|
926
|
+
#validatedCommits = new WeakMap<
|
|
927
|
+
GraphCommit<SharedTreeChange>,
|
|
928
|
+
((commit: GraphCommit<SharedTreeChange>) => void)[] | true
|
|
929
|
+
>();
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Registers a function to be called when the given commit is validated.
|
|
933
|
+
* @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).
|
|
934
|
+
* 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.
|
|
935
|
+
* 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).
|
|
936
|
+
*
|
|
937
|
+
* If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.
|
|
938
|
+
* Otherwise, the function is registered to be called later and this function returns `false`.
|
|
939
|
+
*/
|
|
940
|
+
public onCommitValid(
|
|
941
|
+
commit: GraphCommit<SharedTreeChange>,
|
|
942
|
+
fn: (commit: GraphCommit<SharedTreeChange>) => void,
|
|
943
|
+
): boolean {
|
|
944
|
+
const validated = getOrCreate(this.#validatedCommits, commit, () => []);
|
|
945
|
+
if (validated === true) {
|
|
946
|
+
fn(commit);
|
|
947
|
+
return true;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
validated.push(fn);
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/** Mark the given commit as "validated" according to the contract of {@link onCommitValid}(). */
|
|
955
|
+
private validateCommit(commit: GraphCommit<SharedTreeChange>): void {
|
|
956
|
+
const validated = getOrCreate(this.#validatedCommits, commit, () => []);
|
|
957
|
+
if (validated !== true) {
|
|
958
|
+
validated.forEach((fn) => fn(commit));
|
|
959
|
+
this.#validatedCommits.set(commit, true);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// #endregion Commit Validation
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* A helper class that assists {@link TreeCheckout} in preventing functionality from being used while the tree is in the middle of being edited.
|
|
968
|
+
*/
|
|
969
|
+
class EditLock {
|
|
970
|
+
/**
|
|
971
|
+
* Edits the tree by calling the methods of the editor passed into the {@link EditLock} constructor.
|
|
972
|
+
* @remarks Edits will throw an error if the lock is currently locked.
|
|
973
|
+
*/
|
|
974
|
+
public editor: ISharedTreeEditor;
|
|
975
|
+
private locked = false;
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* @param editor - an editor which will be used to create a new editor that is monitored to determine if any changes are happening to the tree.
|
|
979
|
+
* Use {@link EditLock.editor} in place of the original editor to ensure that changes are monitored.
|
|
980
|
+
*/
|
|
981
|
+
public constructor(editor: ISharedTreeEditor) {
|
|
982
|
+
const checkLock = (): void => this.checkUnlocked("Editing the tree");
|
|
983
|
+
this.editor = {
|
|
984
|
+
get schema() {
|
|
985
|
+
return editor.schema;
|
|
986
|
+
},
|
|
987
|
+
valueField(...fieldArgs) {
|
|
988
|
+
const valueField = editor.valueField(...fieldArgs);
|
|
989
|
+
return {
|
|
990
|
+
set(...editArgs) {
|
|
991
|
+
checkLock();
|
|
992
|
+
valueField.set(...editArgs);
|
|
993
|
+
},
|
|
994
|
+
};
|
|
995
|
+
},
|
|
996
|
+
optionalField(...fieldArgs) {
|
|
997
|
+
const optionalField = editor.optionalField(...fieldArgs);
|
|
998
|
+
return {
|
|
999
|
+
set(...editArgs) {
|
|
1000
|
+
checkLock();
|
|
1001
|
+
optionalField.set(...editArgs);
|
|
1002
|
+
},
|
|
1003
|
+
};
|
|
1004
|
+
},
|
|
1005
|
+
sequenceField(...fieldArgs) {
|
|
1006
|
+
const sequenceField = editor.sequenceField(...fieldArgs);
|
|
1007
|
+
return {
|
|
1008
|
+
insert(...editArgs) {
|
|
1009
|
+
checkLock();
|
|
1010
|
+
sequenceField.insert(...editArgs);
|
|
1011
|
+
},
|
|
1012
|
+
remove(...editArgs) {
|
|
1013
|
+
checkLock();
|
|
1014
|
+
sequenceField.remove(...editArgs);
|
|
1015
|
+
},
|
|
1016
|
+
};
|
|
1017
|
+
},
|
|
1018
|
+
move(...moveArgs) {
|
|
1019
|
+
checkLock();
|
|
1020
|
+
editor.move(...moveArgs);
|
|
1021
|
+
},
|
|
1022
|
+
addNodeExistsConstraint(path) {
|
|
1023
|
+
editor.addNodeExistsConstraint(path);
|
|
1024
|
+
},
|
|
1025
|
+
addNodeExistsConstraintOnRevert(path) {
|
|
1026
|
+
editor.addNodeExistsConstraintOnRevert(path);
|
|
1027
|
+
},
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Prevent further changes from being made to {@link EditLock.editor} until {@link EditLock.unlock} is called.
|
|
1033
|
+
* @remarks May only be called when the lock is not already locked.
|
|
1034
|
+
*/
|
|
1035
|
+
public lock(): void {
|
|
1036
|
+
if (this.locked) {
|
|
1037
|
+
debugger;
|
|
1038
|
+
}
|
|
1039
|
+
assert(!this.locked, 0xaa7 /* Checkout has already been locked */);
|
|
1040
|
+
this.locked = true;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Throws an error if the lock is currently locked.
|
|
1045
|
+
* @param action - The current action being performed by the user.
|
|
1046
|
+
* This must start with a capital letter, as it shows up as the first part of the error message and we want it to look nice.
|
|
1047
|
+
*/
|
|
1048
|
+
public checkUnlocked<T extends string>(action: T extends Capitalize<T> ? T : never): void {
|
|
1049
|
+
if (this.locked) {
|
|
1050
|
+
// These type assertions ensure that the event name strings used here match the actual event names
|
|
1051
|
+
const nodeChanged: keyof TreeChangeEvents = "nodeChanged";
|
|
1052
|
+
const treeChanged: keyof TreeChangeEvents = "treeChanged";
|
|
1053
|
+
throw new UsageError(
|
|
1054
|
+
`${action} is forbidden during a ${nodeChanged} or ${treeChanged} event`,
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* Allow changes to be made to {@link EditLock.editor} again.
|
|
1061
|
+
* @remarks May only be called when the lock is currently locked.
|
|
1062
|
+
*/
|
|
1063
|
+
public unlock(): void {
|
|
1064
|
+
assert(this.locked, 0xaa8 /* Checkout has not been locked */);
|
|
1065
|
+
this.locked = false;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Keeps track of all new forks created until the returned function is invoked, which will dispose all of those for.
|
|
1071
|
+
* The returned function may only be called once.
|
|
1072
|
+
*
|
|
1073
|
+
* @param checkout - The tree checkout for which you want to monitor forks for disposal.
|
|
1074
|
+
* @returns a function which can be called to dispose all of the tracked forks.
|
|
1075
|
+
*/
|
|
1076
|
+
function trackForksForDisposal(checkout: TreeCheckout): () => void {
|
|
1077
|
+
const forks = new Set<TreeCheckout>();
|
|
1078
|
+
const onDisposeUnSubscribes: (() => void)[] = [];
|
|
1079
|
+
const onForkUnSubscribe = onForkTransitive(checkout, (fork) => {
|
|
1080
|
+
forks.add(fork);
|
|
1081
|
+
onDisposeUnSubscribes.push(fork.events.on("dispose", () => forks.delete(fork)));
|
|
1082
|
+
});
|
|
1083
|
+
let disposed = false;
|
|
1084
|
+
return () => {
|
|
1085
|
+
assert(!disposed, 0xaa9 /* Forks may only be disposed once */);
|
|
1086
|
+
forks.forEach((fork) => fork.dispose());
|
|
1087
|
+
onDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());
|
|
1088
|
+
onForkUnSubscribe();
|
|
1089
|
+
disposed = true;
|
|
1090
|
+
};
|
|
908
1091
|
}
|