@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
|
@@ -24,80 +24,34 @@ import {
|
|
|
24
24
|
import type { Listenable } from "@fluidframework/core-interfaces";
|
|
25
25
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
26
26
|
|
|
27
|
-
import { hasSome } from "../util/index.js";
|
|
27
|
+
import { hasSome, defineLazyCachedProperty } from "../util/index.js";
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Describes a change to a `SharedTreeBranch`.
|
|
31
|
-
* this change format describes each in terms of the "removed commits" (all commits which were present
|
|
32
|
-
* on the branch before the operation but are no longer present after) and the "new commits" (all
|
|
33
|
-
* commits which are present on the branch after the operation that were not present before). Each of
|
|
34
|
-
* the following event types also provides a `change` which contains the net change to the branch
|
|
35
|
-
* (or is undefined if there was no net change):
|
|
30
|
+
* Describes a change to a `SharedTreeBranch`. Each of the following event types provides a `change` which contains the net change to the branch (or is undefined if there was no net change):
|
|
36
31
|
* * Append - when one or more commits are appended to the head of the branch, for example via
|
|
37
32
|
* a change applied by the branch's editor, or as a result of merging another branch into this one
|
|
38
|
-
* * Remove - when one or more commits are removed from the head of the branch.
|
|
39
|
-
* when a
|
|
40
|
-
* * Replace - when an operation simultaneously removes and appends commits. For example, when this
|
|
41
|
-
* branch is rebased and some commits are removed and replaced with rebased versions, or when a
|
|
42
|
-
* transaction completes and all pending commits are replaced with a single squash commit.
|
|
33
|
+
* * Remove - when one or more commits are removed from the head of the branch.
|
|
34
|
+
* * Rebase - when a rebase operation adds commits from another branch and replaces existing commits with their rebased versions.
|
|
43
35
|
*/
|
|
44
36
|
export type SharedTreeBranchChange<TChange> =
|
|
45
37
|
| {
|
|
46
38
|
type: "append";
|
|
47
39
|
kind: CommitKind;
|
|
48
40
|
change: TaggedChange<TChange>;
|
|
41
|
+
/** The commits appended to the head of the branch by this operation */
|
|
49
42
|
newCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];
|
|
50
43
|
}
|
|
51
44
|
| {
|
|
52
45
|
type: "remove";
|
|
53
|
-
change: TaggedChange<TChange
|
|
46
|
+
change: TaggedChange<TChange>;
|
|
47
|
+
/** The commits removed from the head of the branch by this operation */
|
|
54
48
|
removedCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];
|
|
55
49
|
}
|
|
56
50
|
| {
|
|
57
|
-
type: "
|
|
51
|
+
type: "rebase";
|
|
58
52
|
change: TaggedChange<TChange> | undefined;
|
|
59
|
-
removedCommits: readonly GraphCommit<TChange>[];
|
|
60
|
-
newCommits: readonly GraphCommit<TChange>[];
|
|
61
53
|
};
|
|
62
54
|
|
|
63
|
-
/**
|
|
64
|
-
* Returns the operation that caused the given {@link SharedTreeBranchChange}.
|
|
65
|
-
*/
|
|
66
|
-
export function getChangeReplaceType(
|
|
67
|
-
change: SharedTreeBranchChange<unknown> & { type: "replace" },
|
|
68
|
-
): "transactionCommit" | "rebase" {
|
|
69
|
-
// The "replace" variant of the change event is emitted by two operations: committing a transaction and doing a rebase.
|
|
70
|
-
// Committing a transaction will always remove one or more commits (the commits that were squashed),
|
|
71
|
-
// and will add exactly one new commit (the squash commit).
|
|
72
|
-
if (change.removedCommits.length === 0 || change.newCommits.length !== 1) {
|
|
73
|
-
return "rebase";
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// There is only one case in which a rebase both removes commits and adds exactly one new commit.
|
|
77
|
-
// This occurs when there is exactly one divergent, but equivalent, commit on each branch:
|
|
78
|
-
//
|
|
79
|
-
// A ─ B (branch X) -- rebase Y onto X --> A ─ B (branch X)
|
|
80
|
-
// └─ B' (branch Y) └─ (branch Y)
|
|
81
|
-
//
|
|
82
|
-
// B' is removed and replaced by B because both have the same revision.
|
|
83
|
-
assert(
|
|
84
|
-
change.removedCommits[0] !== undefined,
|
|
85
|
-
0x9e4 /* This wont run due to the length check above */,
|
|
86
|
-
);
|
|
87
|
-
assert(
|
|
88
|
-
change.newCommits[0] !== undefined,
|
|
89
|
-
0x9e5 /* This wont run because a replace operation always has new commits */,
|
|
90
|
-
);
|
|
91
|
-
if (
|
|
92
|
-
change.removedCommits.length === 1 &&
|
|
93
|
-
change.removedCommits[0].revision === change.newCommits[0].revision
|
|
94
|
-
) {
|
|
95
|
-
return "rebase";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return "transactionCommit";
|
|
99
|
-
}
|
|
100
|
-
|
|
101
55
|
/**
|
|
102
56
|
* The events emitted by a `SharedTreeBranch`
|
|
103
57
|
*/
|
|
@@ -189,35 +143,31 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
189
143
|
|
|
190
144
|
/**
|
|
191
145
|
* Apply a change to this branch.
|
|
192
|
-
* @param
|
|
146
|
+
* @param change - the change to apply
|
|
193
147
|
* @param kind - the kind of change to apply
|
|
194
148
|
* @returns the change that was applied and the new head commit of the branch
|
|
195
149
|
*/
|
|
196
|
-
public apply(
|
|
197
|
-
taggedChange: TaggedChange<TChange>,
|
|
198
|
-
kind: CommitKind = CommitKind.Default,
|
|
199
|
-
): [change: TChange, newCommit: GraphCommit<TChange>] {
|
|
150
|
+
public apply(change: TaggedChange<TChange>, kind: CommitKind = CommitKind.Default): void {
|
|
200
151
|
this.assertNotDisposed();
|
|
201
152
|
|
|
202
|
-
const revisionTag =
|
|
153
|
+
const revisionTag = change.revision;
|
|
203
154
|
assert(revisionTag !== undefined, 0xa49 /* Revision tag must be provided */);
|
|
204
155
|
|
|
205
156
|
const newHead = mintCommit(this.head, {
|
|
206
157
|
revision: revisionTag,
|
|
207
|
-
change:
|
|
158
|
+
change: change.change,
|
|
208
159
|
});
|
|
209
160
|
|
|
210
161
|
const changeEvent = {
|
|
211
162
|
type: "append",
|
|
212
163
|
kind,
|
|
213
|
-
change
|
|
164
|
+
change,
|
|
214
165
|
newCommits: [newHead],
|
|
215
166
|
} as const;
|
|
216
167
|
|
|
217
168
|
this.#events.emit("beforeChange", changeEvent);
|
|
218
169
|
this.head = newHead;
|
|
219
170
|
this.#events.emit("afterChange", changeEvent);
|
|
220
|
-
return [taggedChange.change, newHead];
|
|
221
171
|
}
|
|
222
172
|
|
|
223
173
|
/**
|
|
@@ -256,13 +206,13 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
256
206
|
public rebaseOnto(
|
|
257
207
|
branch: SharedTreeBranch<TEditor, TChange>,
|
|
258
208
|
upTo = branch.getHead(),
|
|
259
|
-
):
|
|
209
|
+
): void {
|
|
260
210
|
this.assertNotDisposed();
|
|
261
211
|
|
|
262
212
|
// Rebase this branch onto the given branch
|
|
263
213
|
const rebaseResult = this.rebaseBranch(this, branch, upTo);
|
|
264
214
|
if (rebaseResult === undefined) {
|
|
265
|
-
return
|
|
215
|
+
return;
|
|
266
216
|
}
|
|
267
217
|
|
|
268
218
|
// The net change to this branch is provided by the `rebaseBranch` API
|
|
@@ -272,7 +222,7 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
272
222
|
|
|
273
223
|
const newCommits = targetCommits.concat(sourceCommits);
|
|
274
224
|
const changeEvent = {
|
|
275
|
-
type: "
|
|
225
|
+
type: "rebase",
|
|
276
226
|
get change() {
|
|
277
227
|
const change = rebaseResult.sourceChange;
|
|
278
228
|
return change === undefined ? undefined : makeAnonChange(change);
|
|
@@ -284,7 +234,6 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
284
234
|
this.#events.emit("beforeChange", changeEvent);
|
|
285
235
|
this.head = newSourceHead;
|
|
286
236
|
this.#events.emit("afterChange", changeEvent);
|
|
287
|
-
return rebaseResult;
|
|
288
237
|
}
|
|
289
238
|
|
|
290
239
|
/**
|
|
@@ -292,11 +241,9 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
292
241
|
* @param commit - All commits after (but not including) this commit will be removed.
|
|
293
242
|
* @returns The net change to this branch and the commits that were removed from this branch.
|
|
294
243
|
*/
|
|
295
|
-
public removeAfter(
|
|
296
|
-
commit: GraphCommit<TChange>,
|
|
297
|
-
): [change: TaggedChange<TChange> | undefined, removedCommits: GraphCommit<TChange>[]] {
|
|
244
|
+
public removeAfter(commit: GraphCommit<TChange>): void {
|
|
298
245
|
if (commit === this.head) {
|
|
299
|
-
return
|
|
246
|
+
return;
|
|
300
247
|
}
|
|
301
248
|
|
|
302
249
|
const removedCommits: GraphCommit<TChange>[] = [];
|
|
@@ -329,43 +276,6 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
329
276
|
this.#events.emit("beforeChange", changeEvent);
|
|
330
277
|
this.head = commit;
|
|
331
278
|
this.#events.emit("afterChange", changeEvent);
|
|
332
|
-
return [change, removedCommits];
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Replace a range of commits on this branch with a single commit composed of equivalent changes.
|
|
337
|
-
* @param commit - All commits after (but not including) this commit will be squashed.
|
|
338
|
-
* @returns The commits that were squashed and removed from this branch.
|
|
339
|
-
* @remarks The commits after `commit` will be removed from this branch, and the squash commit will become the new head of this branch.
|
|
340
|
-
* The change event emitted by this operation will have a `change` property that is undefined, since no net change occurred.
|
|
341
|
-
*/
|
|
342
|
-
public squashAfter(commit: GraphCommit<TChange>): GraphCommit<TChange>[] {
|
|
343
|
-
if (commit === this.head) {
|
|
344
|
-
return [];
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
const removedCommits: GraphCommit<TChange>[] = [];
|
|
348
|
-
findAncestor([this.head, removedCommits], (c) => c === commit);
|
|
349
|
-
assert(hasSome(removedCommits), 0xa85 /* Commit must be in the branch's ancestry */);
|
|
350
|
-
|
|
351
|
-
const squashedChange = this.changeFamily.rebaser.compose(removedCommits);
|
|
352
|
-
const revision = this.mintRevisionTag();
|
|
353
|
-
const newHead = mintCommit(commit, {
|
|
354
|
-
revision,
|
|
355
|
-
change: this.changeFamily.rebaser.changeRevision(squashedChange, revision),
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
const changeEvent = {
|
|
359
|
-
type: "replace",
|
|
360
|
-
change: undefined,
|
|
361
|
-
removedCommits,
|
|
362
|
-
newCommits: [newHead],
|
|
363
|
-
} as const;
|
|
364
|
-
|
|
365
|
-
this.#events.emit("beforeChange", changeEvent);
|
|
366
|
-
this.head = newHead;
|
|
367
|
-
this.#events.emit("afterChange", changeEvent);
|
|
368
|
-
return removedCommits;
|
|
369
279
|
}
|
|
370
280
|
|
|
371
281
|
/**
|
|
@@ -375,9 +285,7 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
375
285
|
* @returns the net change to this branch and the commits that were added to this branch by the merge,
|
|
376
286
|
* or undefined if nothing changed
|
|
377
287
|
*/
|
|
378
|
-
public merge(
|
|
379
|
-
branch: SharedTreeBranch<TEditor, TChange>,
|
|
380
|
-
): [change: TChange, newCommits: GraphCommit<TChange>[]] | undefined {
|
|
288
|
+
public merge(branch: SharedTreeBranch<TEditor, TChange>): void {
|
|
381
289
|
this.assertNotDisposed();
|
|
382
290
|
branch.assertNotDisposed();
|
|
383
291
|
|
|
@@ -394,21 +302,20 @@ export class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {
|
|
|
394
302
|
// Compute the net change to this branch
|
|
395
303
|
const sourceCommits = rebaseResult.commits.sourceCommits;
|
|
396
304
|
assert(hasSome(sourceCommits), 0xa86 /* Expected source commits in non no-op merge */);
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
305
|
+
const { rebaser } = this.changeFamily;
|
|
306
|
+
const changeEvent = defineLazyCachedProperty(
|
|
307
|
+
{
|
|
308
|
+
type: "append",
|
|
309
|
+
kind: CommitKind.Default,
|
|
310
|
+
newCommits: sourceCommits,
|
|
311
|
+
} as const,
|
|
312
|
+
"change",
|
|
313
|
+
() => makeAnonChange(rebaser.compose(sourceCommits)),
|
|
314
|
+
);
|
|
407
315
|
|
|
408
316
|
this.#events.emit("beforeChange", changeEvent);
|
|
409
317
|
this.head = rebaseResult.newSourceHead;
|
|
410
318
|
this.#events.emit("afterChange", changeEvent);
|
|
411
|
-
return [change, sourceCommits];
|
|
412
319
|
}
|
|
413
320
|
|
|
414
321
|
/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "../core/index.js";
|
|
13
13
|
import type { ChangeEnricherReadonlyCheckout } from "./changeEnricher.js";
|
|
14
14
|
import { TransactionEnricher } from "./transactionEnricher.js";
|
|
15
|
-
import {
|
|
15
|
+
import type { SharedTreeBranchChange } from "./branch.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Utility for enriching commits from a {@link Branch} before these commits are applied and submitted.
|
|
@@ -50,26 +50,13 @@ export class BranchCommitEnricher<TChange> {
|
|
|
50
50
|
* @param isAttached - Whether or not the SharedTree is attached to the service.
|
|
51
51
|
*/
|
|
52
52
|
public processChange(change: SharedTreeBranchChange<TChange>): void {
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.#transactionEnricher.addTransactionStep(commit);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
if (
|
|
63
|
-
change.type === "append" ||
|
|
64
|
-
(change.type === "replace" && getChangeReplaceType(change) === "transactionCommit")
|
|
65
|
-
) {
|
|
66
|
-
for (const newCommit of change.newCommits) {
|
|
67
|
-
const newChange =
|
|
68
|
-
this.#getOuterTransactionChange?.(newCommit.revision) ??
|
|
69
|
-
this.#enricher.updateChangeEnrichments(newCommit.change, newCommit.revision);
|
|
53
|
+
if (change.type === "append") {
|
|
54
|
+
for (const newCommit of change.newCommits) {
|
|
55
|
+
const newChange =
|
|
56
|
+
this.#getOuterTransactionChange?.(newCommit.revision) ??
|
|
57
|
+
this.#enricher.updateChangeEnrichments(newCommit.change, newCommit.revision);
|
|
70
58
|
|
|
71
|
-
|
|
72
|
-
}
|
|
59
|
+
this.#preparedCommits.set(newCommit, replaceChange(newCommit, newChange));
|
|
73
60
|
}
|
|
74
61
|
}
|
|
75
62
|
|
|
@@ -111,4 +98,16 @@ export class BranchCommitEnricher<TChange> {
|
|
|
111
98
|
public abortTransaction(): void {
|
|
112
99
|
this.#transactionEnricher.abortTransaction();
|
|
113
100
|
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Add new transaction commits to the current transaction.
|
|
104
|
+
* @param newCommits - The new commits to add.
|
|
105
|
+
* @remarks This will throw an error if there is no ongoing transaction.
|
|
106
|
+
*/
|
|
107
|
+
public addTransactionCommits(newCommits: Iterable<GraphCommit<TChange>>): void {
|
|
108
|
+
assert(this.#transactionEnricher.isTransacting(), 0xa97 /* Not in transaction */);
|
|
109
|
+
for (const commit of newCommits) {
|
|
110
|
+
this.#transactionEnricher.addTransactionStep(commit);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
114
113
|
}
|
|
@@ -22,12 +22,7 @@ import {
|
|
|
22
22
|
} from "../core/index.js";
|
|
23
23
|
import { type Mutable, brand, fail, getOrCreate, mapIterable } from "../util/index.js";
|
|
24
24
|
|
|
25
|
-
import {
|
|
26
|
-
SharedTreeBranch,
|
|
27
|
-
type BranchTrimmingEvents,
|
|
28
|
-
getChangeReplaceType,
|
|
29
|
-
onForkTransitive,
|
|
30
|
-
} from "./branch.js";
|
|
25
|
+
import { SharedTreeBranch, type BranchTrimmingEvents, onForkTransitive } from "./branch.js";
|
|
31
26
|
import type {
|
|
32
27
|
Commit,
|
|
33
28
|
SeqNumber,
|
|
@@ -224,12 +219,12 @@ export class EditManager<
|
|
|
224
219
|
this.trackBranch(branch);
|
|
225
220
|
// Whenever the branch is rebased, update our record of its base trunk commit
|
|
226
221
|
const offBeforeRebase = branch.events.on("beforeChange", (args) => {
|
|
227
|
-
if (args.type === "
|
|
222
|
+
if (args.type === "rebase") {
|
|
228
223
|
this.untrackBranch(branch);
|
|
229
224
|
}
|
|
230
225
|
});
|
|
231
226
|
const offAfterRebase = branch.events.on("afterChange", (args) => {
|
|
232
|
-
if (args.type === "
|
|
227
|
+
if (args.type === "rebase") {
|
|
233
228
|
this.trackBranch(branch);
|
|
234
229
|
this.trimTrunk();
|
|
235
230
|
}
|
|
@@ -8,7 +8,6 @@ export {
|
|
|
8
8
|
SharedTreeBranch,
|
|
9
9
|
type SharedTreeBranchChange,
|
|
10
10
|
type SharedTreeBranchEvents,
|
|
11
|
-
getChangeReplaceType,
|
|
12
11
|
} from "./branch.js";
|
|
13
12
|
|
|
14
13
|
export {
|
|
@@ -16,6 +15,7 @@ export {
|
|
|
16
15
|
type Transactor,
|
|
17
16
|
type TransactionEvents,
|
|
18
17
|
TransactionStack,
|
|
18
|
+
SquashingTransactionStack,
|
|
19
19
|
type OnPush,
|
|
20
20
|
type OnPop,
|
|
21
21
|
} from "./transaction.js";
|
|
@@ -26,6 +26,7 @@ export {
|
|
|
26
26
|
type Summarizable,
|
|
27
27
|
type SummaryElementParser,
|
|
28
28
|
type SummaryElementStringifier,
|
|
29
|
+
type ClonableSchemaAndPolicy,
|
|
29
30
|
} from "./sharedTreeCore.js";
|
|
30
31
|
|
|
31
32
|
export type { ResubmitMachine } from "./resubmitMachine.js";
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
breakingClass,
|
|
46
46
|
} from "../util/index.js";
|
|
47
47
|
|
|
48
|
-
import {
|
|
48
|
+
import type { SharedTreeBranch } from "./branch.js";
|
|
49
49
|
import { EditManager, minimumPossibleSequenceNumber } from "./editManager.js";
|
|
50
50
|
import { makeEditManagerCodec } from "./editManagerCodecs.js";
|
|
51
51
|
import type { SeqNumber } from "./editManagerFormat.js";
|
|
@@ -97,13 +97,6 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
97
97
|
return this.getLocalBranch().editor;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/**
|
|
101
|
-
* Gets the revision at the head of the trunk.
|
|
102
|
-
*/
|
|
103
|
-
protected get trunkHeadRevision(): RevisionTag {
|
|
104
|
-
return this.editManager.getTrunkHead().revision;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
100
|
/**
|
|
108
101
|
* Used to encode/decode messages sent to/received from the Fluid runtime.
|
|
109
102
|
*
|
|
@@ -189,14 +182,9 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
189
182
|
// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.
|
|
190
183
|
this.commitEnricher.processChange(change);
|
|
191
184
|
}
|
|
192
|
-
|
|
193
|
-
this.editManager.localBranch.events.on("afterChange", (change) => {
|
|
194
|
-
if (
|
|
195
|
-
change.type === "append" ||
|
|
196
|
-
(change.type === "replace" && getChangeReplaceType(change) === "transactionCommit")
|
|
197
|
-
) {
|
|
185
|
+
if (change.type === "append") {
|
|
198
186
|
for (const commit of change.newCommits) {
|
|
199
|
-
this.submitCommit(commit, this.schemaAndPolicy);
|
|
187
|
+
this.submitCommit(commit, this.schemaAndPolicy, false);
|
|
200
188
|
}
|
|
201
189
|
}
|
|
202
190
|
});
|
|
@@ -269,6 +257,10 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
269
257
|
}
|
|
270
258
|
|
|
271
259
|
protected async loadCore(services: IChannelStorageService): Promise<void> {
|
|
260
|
+
assert(
|
|
261
|
+
this.editManager.localBranch.getHead() === this.editManager.getTrunkHead(),
|
|
262
|
+
0xaaa /* All local changes should be applied to the trunk before loading from summary */,
|
|
263
|
+
);
|
|
272
264
|
const [editManagerSummarizer, ...summarizables] = this.summarizables;
|
|
273
265
|
const loadEditManager = this.loadSummarizable(editManagerSummarizer, services);
|
|
274
266
|
const loadSummarizables = summarizables.map(async (s) =>
|
|
@@ -316,7 +308,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
316
308
|
protected submitCommit(
|
|
317
309
|
commit: GraphCommit<TChange>,
|
|
318
310
|
schemaAndPolicy: ClonableSchemaAndPolicy,
|
|
319
|
-
isResubmit
|
|
311
|
+
isResubmit: boolean,
|
|
320
312
|
): void {
|
|
321
313
|
assert(
|
|
322
314
|
this.isAttached() === (this.detachedRevision === undefined),
|
|
@@ -380,9 +372,6 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
380
372
|
this.editManager.advanceMinimumSequenceNumber(brand(message.minimumSequenceNumber));
|
|
381
373
|
}
|
|
382
374
|
|
|
383
|
-
/**
|
|
384
|
-
* @returns the head commit of the root local branch
|
|
385
|
-
*/
|
|
386
375
|
protected getLocalBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
387
376
|
return this.editManager.localBranch;
|
|
388
377
|
}
|
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
6
7
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
7
8
|
import type { IDisposable, Listenable } from "@fluidframework/core-interfaces";
|
|
8
9
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
10
|
+
import {
|
|
11
|
+
findAncestor,
|
|
12
|
+
type ChangeFamilyEditor,
|
|
13
|
+
type GraphCommit,
|
|
14
|
+
type TaggedChange,
|
|
15
|
+
} from "../core/index.js";
|
|
16
|
+
import type { SharedTreeBranch, SharedTreeBranchEvents } from "./branch.js";
|
|
17
|
+
import { getOrCreate } from "../util/index.js";
|
|
9
18
|
|
|
10
19
|
/**
|
|
11
20
|
* Describes the result of a transaction.
|
|
@@ -163,3 +172,139 @@ export class TransactionStack implements Transactor, IDisposable {
|
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.
|
|
178
|
+
* @remarks Given a branch, this class will fork the branch when a transaction begins and squash the forked branch back into the original branch when the transaction ends.
|
|
179
|
+
* This class provides conveniences for interacting with the {@link SquashingTransactionStack.activeBranch | active branch} in a way that is stable across transaction boundaries.
|
|
180
|
+
* For example, see {@link SquashingTransactionStack.activeBranchEditor | activeBranchEditor} and {@link SquashingTransactionStack.activeBranchEvents | activeBranchEvents}.
|
|
181
|
+
*/
|
|
182
|
+
export class SquashingTransactionStack<
|
|
183
|
+
TEditor extends ChangeFamilyEditor,
|
|
184
|
+
TChange,
|
|
185
|
+
> extends TransactionStack {
|
|
186
|
+
public readonly branch: SharedTreeBranch<TEditor, TChange>;
|
|
187
|
+
#transactionBranch?: SharedTreeBranch<TEditor, TChange>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* An editor for whichever branch is currently the {@link SquashingTransactionStack.activeBranch | active branch}.
|
|
191
|
+
* @remarks This editor can safely be held on to across transaction boundaries, as it will properly delegate to the correct branch.
|
|
192
|
+
* In contrast, it is not safe to hold onto e.g. `activeBranch.editor` across transaction boundaries, since the active branch may change.
|
|
193
|
+
*/
|
|
194
|
+
public readonly activeBranchEditor = new Proxy<TEditor>({} as unknown as TEditor, {
|
|
195
|
+
get: (_, p, receiver) => {
|
|
196
|
+
return Reflect.get(this.activeBranch.editor, p, receiver);
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Get the "active branch" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.
|
|
202
|
+
*/
|
|
203
|
+
public get activeBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
204
|
+
return this.#transactionBranch ?? this.branch;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Provides events for changes in the {@link SquashingTransactionStack.activeBranch | active branch}.
|
|
209
|
+
* @remarks When the active branch changes, the listeners for these events will automatically be transferred to the new active branch.
|
|
210
|
+
* In contrast, binding an event to the {@link SquashingTransactionStack.activeBranch | active branch} directly will not automatically transfer the listener when the active branch changes.
|
|
211
|
+
*/
|
|
212
|
+
public get activeBranchEvents(): Listenable<SharedTreeBranchEvents<TEditor, TChange>> {
|
|
213
|
+
const off = (
|
|
214
|
+
eventName: keyof SharedTreeBranchEvents<TEditor, TChange>,
|
|
215
|
+
listener: SharedTreeBranchEvents<TEditor, TChange>[typeof eventName],
|
|
216
|
+
): void => {
|
|
217
|
+
this.activeBranch.events.off(eventName, listener);
|
|
218
|
+
const listeners = this.#activeBranchEvents.get(eventName);
|
|
219
|
+
if (listeners?.delete(listener) === true && listeners.size === 0) {
|
|
220
|
+
this.#activeBranchEvents.delete(eventName);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
on: (eventName, listener) => {
|
|
226
|
+
const listeners = getOrCreate(this.#activeBranchEvents, eventName, () => new Set());
|
|
227
|
+
listeners.add(listener);
|
|
228
|
+
this.activeBranch.events.on(eventName, listener);
|
|
229
|
+
return () => off(eventName, listener);
|
|
230
|
+
},
|
|
231
|
+
off,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
readonly #activeBranchEvents = new Map<
|
|
235
|
+
keyof SharedTreeBranchEvents<TEditor, TChange>,
|
|
236
|
+
Set<
|
|
237
|
+
SharedTreeBranchEvents<TEditor, TChange>[keyof SharedTreeBranchEvents<TEditor, TChange>]
|
|
238
|
+
>
|
|
239
|
+
>();
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Construct a new {@link SquashingTransactionStack}.
|
|
243
|
+
* @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.
|
|
244
|
+
* @param squash - Called once when the outer-most transaction is committed to produce a single squashed change from the transaction's commits.
|
|
245
|
+
* The change will be applied to the original {@link SquashingTransactionStack.branch | branch}.
|
|
246
|
+
* @param onPush - {@link OnPush | A function} that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
|
|
247
|
+
*/
|
|
248
|
+
public constructor(
|
|
249
|
+
branch: SharedTreeBranch<TEditor, TChange>,
|
|
250
|
+
squash: (commits: GraphCommit<TChange>[]) => TaggedChange<TChange>,
|
|
251
|
+
onPush?: OnPush,
|
|
252
|
+
) {
|
|
253
|
+
super(() => {
|
|
254
|
+
// Keep track of the commit that each transaction was on when it started
|
|
255
|
+
// TODO:#8603: This may need to be computed differently if we allow rebasing during a transaction.
|
|
256
|
+
const startHead = this.activeBranch.getHead();
|
|
257
|
+
const onPop = onPush?.();
|
|
258
|
+
const transactionBranch = this.#transactionBranch ?? this.branch.fork();
|
|
259
|
+
this.setTransactionBranch(transactionBranch);
|
|
260
|
+
transactionBranch.editor.enterTransaction();
|
|
261
|
+
return (result) => {
|
|
262
|
+
assert(this.#transactionBranch !== undefined, 0xa98 /* Expected transaction branch */);
|
|
263
|
+
this.#transactionBranch.editor.exitTransaction();
|
|
264
|
+
switch (result) {
|
|
265
|
+
case TransactionResult.Abort:
|
|
266
|
+
// When a transaction is aborted, roll back all the transaction's changes on the current branch
|
|
267
|
+
this.#transactionBranch.removeAfter(startHead);
|
|
268
|
+
break;
|
|
269
|
+
case TransactionResult.Commit:
|
|
270
|
+
// If this was the outermost transaction closing...
|
|
271
|
+
if (!this.isInProgress()) {
|
|
272
|
+
if (this.#transactionBranch.getHead() !== startHead) {
|
|
273
|
+
// ...squash all the new commits on the transaction branch into a new commit on the original branch
|
|
274
|
+
const removedCommits: GraphCommit<TChange>[] = [];
|
|
275
|
+
findAncestor(
|
|
276
|
+
[this.#transactionBranch.getHead(), removedCommits],
|
|
277
|
+
(c) => c === startHead,
|
|
278
|
+
);
|
|
279
|
+
branch.apply(squash(removedCommits));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
default:
|
|
284
|
+
unreachableCase(result);
|
|
285
|
+
}
|
|
286
|
+
if (!this.isInProgress()) {
|
|
287
|
+
this.#transactionBranch.dispose();
|
|
288
|
+
this.setTransactionBranch(undefined);
|
|
289
|
+
}
|
|
290
|
+
onPop?.(result);
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
this.branch = branch;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */
|
|
298
|
+
private setTransactionBranch(
|
|
299
|
+
transactionBranch: SharedTreeBranch<TEditor, TChange> | undefined,
|
|
300
|
+
): void {
|
|
301
|
+
const oldActiveBranch = this.activeBranch;
|
|
302
|
+
this.#transactionBranch = transactionBranch;
|
|
303
|
+
for (const [eventName, listeners] of this.#activeBranchEvents) {
|
|
304
|
+
for (const listener of listeners) {
|
|
305
|
+
oldActiveBranch.events.off(eventName, listener);
|
|
306
|
+
this.activeBranch.events.on(eventName, listener);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
@@ -8,7 +8,7 @@ import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
8
8
|
import type { ITreeCursor } from "../../core/index.js";
|
|
9
9
|
import type { TreeLeafValue, ImplicitAllowedTypes } from "../schemaTypes.js";
|
|
10
10
|
import type { TreeNodeSchema } from "../core/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { customFromCursor, type EncodeOptions } from "./customTree.js";
|
|
12
12
|
import { getUnhydratedContext } from "../createContext.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -55,5 +55,5 @@ function conciseFromCursorInner<TCustom>(
|
|
|
55
55
|
options: Required<EncodeOptions<TCustom>>,
|
|
56
56
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
57
57
|
): ConciseTree<TCustom> {
|
|
58
|
-
return
|
|
58
|
+
return customFromCursor(reader, options, schema, conciseFromCursorInner);
|
|
59
59
|
}
|
|
@@ -32,6 +32,7 @@ import { isFieldInSchema } from "../../feature-libraries/index.js";
|
|
|
32
32
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
33
33
|
import { inSchemaOrThrow, mapTreeFromNodeData } from "../toMapTree.js";
|
|
34
34
|
import { getUnhydratedContext } from "../createContext.js";
|
|
35
|
+
import { createUnknownOptionalFieldPolicy } from "../objectNode.js";
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* Construct tree content that is compatible with the field defined by the provided `schema`.
|
|
@@ -122,7 +123,10 @@ export function createFromCursor<const TSchema extends ImplicitFieldSchema>(
|
|
|
122
123
|
const flexSchema = context.flexContext.schema;
|
|
123
124
|
|
|
124
125
|
const schemaValidationPolicy: SchemaAndPolicy = {
|
|
125
|
-
policy:
|
|
126
|
+
policy: {
|
|
127
|
+
...defaultSchemaPolicy,
|
|
128
|
+
allowUnknownOptionalFields: createUnknownOptionalFieldPolicy(schema),
|
|
129
|
+
},
|
|
126
130
|
schema: context.flexContext.schema,
|
|
127
131
|
};
|
|
128
132
|
|