@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
|
@@ -9,21 +9,17 @@ import type {
|
|
|
9
9
|
Listenable,
|
|
10
10
|
} from "@fluidframework/core-interfaces/internal";
|
|
11
11
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
12
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
12
|
+
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
13
13
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
AllowedUpdateType,
|
|
17
|
-
anchorSlot,
|
|
18
|
-
Compatibility,
|
|
19
|
-
type SchemaPolicy,
|
|
20
|
-
} from "../core/index.js";
|
|
15
|
+
import { AllowedUpdateType, anchorSlot, type SchemaPolicy } from "../core/index.js";
|
|
21
16
|
import {
|
|
22
17
|
type NodeKeyManager,
|
|
23
18
|
defaultSchemaPolicy,
|
|
24
19
|
ContextSlot,
|
|
25
20
|
cursorForMapTreeNode,
|
|
26
21
|
type FullSchemaPolicy,
|
|
22
|
+
TreeStatus,
|
|
27
23
|
} from "../feature-libraries/index.js";
|
|
28
24
|
import {
|
|
29
25
|
type FieldSchema,
|
|
@@ -48,6 +44,8 @@ import {
|
|
|
48
44
|
type UnsafeUnknownSchema,
|
|
49
45
|
type TreeBranch,
|
|
50
46
|
type TreeBranchEvents,
|
|
47
|
+
getOrCreateInnerNode,
|
|
48
|
+
getKernel,
|
|
51
49
|
} from "../simple-tree/index.js";
|
|
52
50
|
import { Breakable, breakingClass, disposeSymbol, type WithBreakable } from "../util/index.js";
|
|
53
51
|
|
|
@@ -58,7 +56,17 @@ import {
|
|
|
58
56
|
HydratedContext,
|
|
59
57
|
SimpleContextSlot,
|
|
60
58
|
areImplicitFieldSchemaEqual,
|
|
59
|
+
createUnknownOptionalFieldPolicy,
|
|
61
60
|
} from "../simple-tree/index.js";
|
|
61
|
+
import type {
|
|
62
|
+
VoidTransactionCallbackStatus,
|
|
63
|
+
TransactionCallbackStatus,
|
|
64
|
+
TransactionResult,
|
|
65
|
+
TransactionResultExt,
|
|
66
|
+
RunTransactionParams,
|
|
67
|
+
TransactionConstraint,
|
|
68
|
+
} from "./transactionTypes.js";
|
|
69
|
+
|
|
62
70
|
/**
|
|
63
71
|
* Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
|
|
64
72
|
* exists and error if creating a second.
|
|
@@ -116,14 +124,14 @@ export class SchematizingSimpleTreeView<
|
|
|
116
124
|
}
|
|
117
125
|
checkout.forest.anchors.slots.set(ViewSlot, this);
|
|
118
126
|
|
|
119
|
-
|
|
127
|
+
this.rootFieldSchema = normalizeFieldSchema(config.schema);
|
|
128
|
+
this.schemaPolicy = {
|
|
120
129
|
...defaultSchemaPolicy,
|
|
121
130
|
validateSchema: config.enableSchemaValidation,
|
|
131
|
+
allowUnknownOptionalFields: createUnknownOptionalFieldPolicy(this.rootFieldSchema),
|
|
122
132
|
};
|
|
123
|
-
this.rootFieldSchema = normalizeFieldSchema(config.schema);
|
|
124
|
-
this.schemaPolicy = defaultSchemaPolicy;
|
|
125
133
|
|
|
126
|
-
this.viewSchema = new ViewSchema(
|
|
134
|
+
this.viewSchema = new ViewSchema(this.schemaPolicy, {}, this.rootFieldSchema);
|
|
127
135
|
// This must be initialized before `update` can be called.
|
|
128
136
|
this.currentCompatibility = {
|
|
129
137
|
canView: false,
|
|
@@ -166,16 +174,13 @@ export class SchematizingSimpleTreeView<
|
|
|
166
174
|
this.nodeKeyManager,
|
|
167
175
|
{
|
|
168
176
|
schema: this.checkout.storedSchema,
|
|
169
|
-
policy:
|
|
170
|
-
...defaultSchemaPolicy,
|
|
171
|
-
validateSchema: this.config.enableSchemaValidation,
|
|
172
|
-
},
|
|
177
|
+
policy: this.schemaPolicy,
|
|
173
178
|
},
|
|
174
179
|
);
|
|
175
180
|
|
|
176
181
|
prepareContentForHydration(mapTree, this.checkout.forest);
|
|
177
182
|
initialize(this.checkout, {
|
|
178
|
-
schema: this.viewSchema.schema,
|
|
183
|
+
schema: toStoredSchema(this.viewSchema.schema),
|
|
179
184
|
initialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),
|
|
180
185
|
});
|
|
181
186
|
});
|
|
@@ -202,7 +207,7 @@ export class SchematizingSimpleTreeView<
|
|
|
202
207
|
AllowedUpdateType.SchemaCompatible,
|
|
203
208
|
this.checkout,
|
|
204
209
|
{
|
|
205
|
-
schema: this.viewSchema.schema,
|
|
210
|
+
schema: toStoredSchema(this.viewSchema.schema),
|
|
206
211
|
initialTree: undefined,
|
|
207
212
|
},
|
|
208
213
|
);
|
|
@@ -219,6 +224,84 @@ export class SchematizingSimpleTreeView<
|
|
|
219
224
|
return this.view;
|
|
220
225
|
}
|
|
221
226
|
|
|
227
|
+
/**
|
|
228
|
+
* {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}
|
|
229
|
+
*/
|
|
230
|
+
public runTransaction<TSuccessValue, TFailureValue>(
|
|
231
|
+
transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,
|
|
232
|
+
params?: RunTransactionParams,
|
|
233
|
+
): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
234
|
+
/**
|
|
235
|
+
* {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}
|
|
236
|
+
*/
|
|
237
|
+
public runTransaction(
|
|
238
|
+
transaction: () => VoidTransactionCallbackStatus | void,
|
|
239
|
+
params?: RunTransactionParams,
|
|
240
|
+
): TransactionResult;
|
|
241
|
+
public runTransaction<TSuccessValue, TFailureValue>(
|
|
242
|
+
transaction: () =>
|
|
243
|
+
| TransactionCallbackStatus<TSuccessValue, TFailureValue>
|
|
244
|
+
| VoidTransactionCallbackStatus
|
|
245
|
+
| void,
|
|
246
|
+
params?: RunTransactionParams,
|
|
247
|
+
): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {
|
|
248
|
+
const addConstraints = (
|
|
249
|
+
constraintsOnRevert: boolean,
|
|
250
|
+
constraints: readonly TransactionConstraint[] = [],
|
|
251
|
+
): void => {
|
|
252
|
+
for (const constraint of constraints) {
|
|
253
|
+
switch (constraint.type) {
|
|
254
|
+
case "nodeInDocument": {
|
|
255
|
+
const node = getOrCreateInnerNode(constraint.node);
|
|
256
|
+
const nodeStatus = getKernel(constraint.node).getStatus();
|
|
257
|
+
if (nodeStatus !== TreeStatus.InDocument) {
|
|
258
|
+
const revertText = constraintsOnRevert ? " on revert" : "";
|
|
259
|
+
throw new UsageError(
|
|
260
|
+
`Attempted to add a "nodeInDocument" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
if (constraintsOnRevert) {
|
|
264
|
+
this.checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);
|
|
265
|
+
} else {
|
|
266
|
+
this.checkout.editor.addNodeExistsConstraint(node.anchorNode);
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
default:
|
|
271
|
+
unreachableCase(constraint.type);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
this.checkout.transaction.start();
|
|
277
|
+
|
|
278
|
+
// Validate preconditions before running the transaction callback.
|
|
279
|
+
addConstraints(false /* constraintsOnRevert */, params?.preconditions);
|
|
280
|
+
const transactionCallbackStatus = transaction();
|
|
281
|
+
const rollback = transactionCallbackStatus?.rollback;
|
|
282
|
+
const value = (
|
|
283
|
+
transactionCallbackStatus as TransactionCallbackStatus<TSuccessValue, TFailureValue>
|
|
284
|
+
)?.value;
|
|
285
|
+
|
|
286
|
+
if (rollback === true) {
|
|
287
|
+
this.checkout.transaction.abort();
|
|
288
|
+
return value !== undefined
|
|
289
|
+
? { success: false, value: value as TFailureValue }
|
|
290
|
+
: { success: false };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Validate preconditions on revert after running the transaction callback and was successful.
|
|
294
|
+
addConstraints(
|
|
295
|
+
true /* constraintsOnRevert */,
|
|
296
|
+
transactionCallbackStatus?.preconditionsOnRevert,
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
this.checkout.transaction.commit();
|
|
300
|
+
return value !== undefined
|
|
301
|
+
? { success: true, value: value as TSuccessValue }
|
|
302
|
+
: { success: true };
|
|
303
|
+
}
|
|
304
|
+
|
|
222
305
|
private ensureUndisposed(): void {
|
|
223
306
|
if (this.disposed) {
|
|
224
307
|
this.failDisposed();
|
|
@@ -389,7 +472,7 @@ export class SchematizingSimpleTreeView<
|
|
|
389
472
|
|
|
390
473
|
// #region Branching
|
|
391
474
|
|
|
392
|
-
public fork(): ReturnType<TreeBranch["fork"]> &
|
|
475
|
+
public fork(): ReturnType<TreeBranch["fork"]> & SchematizingSimpleTreeView<TRootSchema> {
|
|
393
476
|
return this.checkout.branch().viewWith(this.config);
|
|
394
477
|
}
|
|
395
478
|
|
|
@@ -432,11 +515,7 @@ export function requireSchema(
|
|
|
432
515
|
|
|
433
516
|
{
|
|
434
517
|
const compatibility = viewSchema.checkCompatibility(checkout.storedSchema);
|
|
435
|
-
assert(
|
|
436
|
-
compatibility.write === Compatibility.Compatible &&
|
|
437
|
-
compatibility.read === Compatibility.Compatible,
|
|
438
|
-
0x8c3 /* requireSchema invoked with incompatible schema */,
|
|
439
|
-
);
|
|
518
|
+
assert(compatibility.canView, 0x8c3 /* requireSchema invoked with incompatible schema */);
|
|
440
519
|
}
|
|
441
520
|
|
|
442
521
|
const view = new CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);
|
|
@@ -4,12 +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";
|
|
12
|
-
import { createEmitter } from "@fluid-internal/client-utils";
|
|
7
|
+
import type { IFluidHandle } from "@fluidframework/core-interfaces/internal";
|
|
13
8
|
import type {
|
|
14
9
|
IChannelAttributes,
|
|
15
10
|
IChannelFactory,
|
|
@@ -22,10 +17,18 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
|
22
17
|
|
|
23
18
|
import { type ICodecOptions, noopValidator } from "../codec/index.js";
|
|
24
19
|
import {
|
|
20
|
+
type GraphCommit,
|
|
25
21
|
type IEditableForest,
|
|
22
|
+
type ITreeCursor,
|
|
26
23
|
type JsonableTree,
|
|
24
|
+
LeafNodeStoredSchema,
|
|
25
|
+
MapNodeStoredSchema,
|
|
26
|
+
ObjectNodeStoredSchema,
|
|
27
27
|
RevisionTagCodec,
|
|
28
28
|
type TaggedChange,
|
|
29
|
+
type TreeFieldStoredSchema,
|
|
30
|
+
type TreeNodeSchemaIdentifier,
|
|
31
|
+
type TreeNodeStoredSchema,
|
|
29
32
|
type TreeStoredSchema,
|
|
30
33
|
TreeStoredSchemaRepository,
|
|
31
34
|
type TreeStoredSchemaSubscription,
|
|
@@ -35,6 +38,7 @@ import {
|
|
|
35
38
|
|
|
36
39
|
import {
|
|
37
40
|
DetachedFieldIndexSummarizer,
|
|
41
|
+
FieldKinds,
|
|
38
42
|
ForestSummarizer,
|
|
39
43
|
SchemaSummarizer,
|
|
40
44
|
TreeCompressionStrategy,
|
|
@@ -47,18 +51,29 @@ import {
|
|
|
47
51
|
makeTreeChunker,
|
|
48
52
|
} from "../feature-libraries/index.js";
|
|
49
53
|
import {
|
|
54
|
+
type ClonableSchemaAndPolicy,
|
|
50
55
|
DefaultResubmitMachine,
|
|
51
56
|
type ExplicitCoreCodecVersions,
|
|
52
57
|
SharedTreeCore,
|
|
53
58
|
} from "../shared-tree-core/index.js";
|
|
54
|
-
import
|
|
55
|
-
ITree,
|
|
56
|
-
ImplicitFieldSchema,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
import {
|
|
60
|
+
type ITree,
|
|
61
|
+
type ImplicitFieldSchema,
|
|
62
|
+
NodeKind,
|
|
63
|
+
type ReadSchema,
|
|
64
|
+
type SimpleFieldSchema,
|
|
65
|
+
type SimpleTreeSchema,
|
|
66
|
+
type TreeView,
|
|
67
|
+
type TreeViewAlpha,
|
|
68
|
+
type TreeViewConfiguration,
|
|
69
|
+
type UnsafeUnknownSchema,
|
|
70
|
+
type VerboseTree,
|
|
71
|
+
tryStoredSchemaAsArray,
|
|
72
|
+
type SimpleNodeSchema,
|
|
73
|
+
customFromCursorStored,
|
|
74
|
+
FieldKind,
|
|
75
|
+
type CustomTreeNode,
|
|
76
|
+
type CustomTreeValue,
|
|
62
77
|
} from "../simple-tree/index.js";
|
|
63
78
|
|
|
64
79
|
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
@@ -66,20 +81,14 @@ import { SharedTreeReadonlyChangeEnricher } from "./sharedTreeChangeEnricher.js"
|
|
|
66
81
|
import { SharedTreeChangeFamily } from "./sharedTreeChangeFamily.js";
|
|
67
82
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
68
83
|
import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
69
|
-
import {
|
|
70
|
-
|
|
71
|
-
type TreeCheckout,
|
|
72
|
-
type BranchableTree,
|
|
73
|
-
createTreeCheckout,
|
|
74
|
-
} from "./treeCheckout.js";
|
|
75
|
-
import { breakingClass, throwIfBroken } from "../util/index.js";
|
|
84
|
+
import { type TreeCheckout, type BranchableTree, createTreeCheckout } from "./treeCheckout.js";
|
|
85
|
+
import { breakingClass, fail, throwIfBroken } from "../util/index.js";
|
|
76
86
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
77
87
|
|
|
78
88
|
/**
|
|
79
89
|
* Copy of data from an {@link ISharedTree} at some point in time.
|
|
80
90
|
* @remarks
|
|
81
91
|
* This is unrelated to Fluids concept of "snapshots".
|
|
82
|
-
* @internal
|
|
83
92
|
*/
|
|
84
93
|
export interface SharedTreeContentSnapshot {
|
|
85
94
|
/**
|
|
@@ -104,7 +113,27 @@ export interface SharedTreeContentSnapshot {
|
|
|
104
113
|
* {@link ITree} extended with some non-public APIs.
|
|
105
114
|
* @internal
|
|
106
115
|
*/
|
|
107
|
-
export interface
|
|
116
|
+
export interface ITreeInternal extends ISharedObject, ITree {
|
|
117
|
+
/**
|
|
118
|
+
* Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.
|
|
119
|
+
* @privateRemarks
|
|
120
|
+
* TODO:
|
|
121
|
+
* This should probably get promoted to a public API on ITree eventually.
|
|
122
|
+
*/
|
|
123
|
+
exportVerbose(): VerboseTree | undefined;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.
|
|
127
|
+
* @remarks
|
|
128
|
+
* To get the schema using property keys, use {@link getSimpleSchema} on the view schema.
|
|
129
|
+
*/
|
|
130
|
+
exportSimpleSchema(): SimpleTreeSchema;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* {@link ITreeInternal} extended with some non-exported APIs.
|
|
135
|
+
*/
|
|
136
|
+
export interface ISharedTree extends ISharedObject, ITreeInternal {
|
|
108
137
|
/**
|
|
109
138
|
* Provides a copy of the current content of the tree.
|
|
110
139
|
* This can be useful for inspecting the tree when no suitable view schema is available.
|
|
@@ -191,9 +220,6 @@ export class SharedTree
|
|
|
191
220
|
extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>
|
|
192
221
|
implements ISharedTree
|
|
193
222
|
{
|
|
194
|
-
private readonly _events: Listenable<CheckoutEvents> &
|
|
195
|
-
IEmitter<CheckoutEvents> &
|
|
196
|
-
HasListeners<CheckoutEvents>;
|
|
197
223
|
public readonly checkout: TreeCheckout;
|
|
198
224
|
public get storedSchema(): TreeStoredSchemaRepository {
|
|
199
225
|
return this.checkout.storedSchema;
|
|
@@ -203,7 +229,7 @@ export class SharedTree
|
|
|
203
229
|
id: string,
|
|
204
230
|
runtime: IFluidDataStoreRuntime,
|
|
205
231
|
attributes: IChannelAttributes,
|
|
206
|
-
optionsParam:
|
|
232
|
+
optionsParam: SharedTreeOptionsInternal,
|
|
207
233
|
telemetryContextPrefix: string = "fluid_sharedTree_",
|
|
208
234
|
) {
|
|
209
235
|
if (runtime.idCompressor === undefined) {
|
|
@@ -292,7 +318,6 @@ export class SharedTree
|
|
|
292
318
|
),
|
|
293
319
|
changeEnricher,
|
|
294
320
|
);
|
|
295
|
-
this._events = createEmitter<CheckoutEvents>();
|
|
296
321
|
const localBranch = this.getLocalBranch();
|
|
297
322
|
this.checkout = createTreeCheckout(
|
|
298
323
|
runtime.idCompressor,
|
|
@@ -304,11 +329,11 @@ export class SharedTree
|
|
|
304
329
|
schema,
|
|
305
330
|
forest,
|
|
306
331
|
fieldBatchCodec,
|
|
307
|
-
events: this._events,
|
|
308
332
|
removedRoots,
|
|
309
333
|
chunkCompressionStrategy: options.treeEncodeType,
|
|
310
334
|
logger: this.logger,
|
|
311
335
|
breaker: this.breaker,
|
|
336
|
+
disposeForksAfterTransaction: options.disposeForksAfterTransaction,
|
|
312
337
|
},
|
|
313
338
|
);
|
|
314
339
|
|
|
@@ -330,6 +355,42 @@ export class SharedTree
|
|
|
330
355
|
this.commitEnricher.commitTransaction();
|
|
331
356
|
}
|
|
332
357
|
});
|
|
358
|
+
this.checkout.events.on("beforeBatch", (event) => {
|
|
359
|
+
if (event.type === "append" && this.isAttached()) {
|
|
360
|
+
if (this.checkout.transaction.isInProgress()) {
|
|
361
|
+
this.commitEnricher.addTransactionCommits(event.newCommits);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
public exportVerbose(): VerboseTree | undefined {
|
|
368
|
+
const cursor = this.checkout.forest.allocateCursor("contentSnapshot");
|
|
369
|
+
try {
|
|
370
|
+
moveToDetachedField(this.checkout.forest, cursor);
|
|
371
|
+
const length = cursor.getFieldLength();
|
|
372
|
+
if (length === 0) {
|
|
373
|
+
return undefined;
|
|
374
|
+
} else if (length === 1) {
|
|
375
|
+
cursor.enterNode(0);
|
|
376
|
+
return verboseFromCursor(cursor, this.storedSchema.nodeSchema);
|
|
377
|
+
} else {
|
|
378
|
+
fail("Invalid document root length");
|
|
379
|
+
}
|
|
380
|
+
} finally {
|
|
381
|
+
cursor.free();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
public exportSimpleSchema(): SimpleTreeSchema {
|
|
386
|
+
return {
|
|
387
|
+
...exportSimpleFieldSchemaStored(this.storedSchema.rootFieldSchema),
|
|
388
|
+
definitions: new Map(
|
|
389
|
+
[...this.storedSchema.nodeSchema].map(([key, schema]) => {
|
|
390
|
+
return [key, exportSimpleNodeSchemaStored(schema)];
|
|
391
|
+
}),
|
|
392
|
+
),
|
|
393
|
+
};
|
|
333
394
|
}
|
|
334
395
|
|
|
335
396
|
@throwIfBroken
|
|
@@ -366,19 +427,7 @@ export class SharedTree
|
|
|
366
427
|
|
|
367
428
|
protected override async loadCore(services: IChannelStorageService): Promise<void> {
|
|
368
429
|
await super.loadCore(services);
|
|
369
|
-
this.checkout.
|
|
370
|
-
this._events.emit("afterBatch");
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
protected override submitCommit(
|
|
374
|
-
...args: Parameters<
|
|
375
|
-
SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>["submitCommit"]
|
|
376
|
-
>
|
|
377
|
-
): void {
|
|
378
|
-
// We do not submit ops for changes that are part of a transaction.
|
|
379
|
-
if (!this.checkout.transaction.isInProgress()) {
|
|
380
|
-
super.submitCommit(...args);
|
|
381
|
-
}
|
|
430
|
+
this.checkout.load();
|
|
382
431
|
}
|
|
383
432
|
|
|
384
433
|
protected override didAttach(): void {
|
|
@@ -403,6 +452,27 @@ export class SharedTree
|
|
|
403
452
|
);
|
|
404
453
|
super.applyStashedOp(...args);
|
|
405
454
|
}
|
|
455
|
+
|
|
456
|
+
protected override submitCommit(
|
|
457
|
+
commit: GraphCommit<SharedTreeChange>,
|
|
458
|
+
schemaAndPolicy: ClonableSchemaAndPolicy,
|
|
459
|
+
isResubmit: boolean,
|
|
460
|
+
): void {
|
|
461
|
+
assert(
|
|
462
|
+
!this.checkout.transaction.isInProgress(),
|
|
463
|
+
0xaa6 /* Cannot submit a commit while a transaction is in progress */,
|
|
464
|
+
);
|
|
465
|
+
if (isResubmit) {
|
|
466
|
+
return super.submitCommit(commit, schemaAndPolicy, isResubmit);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Refrain from submitting new commits until they are validated by the checkout.
|
|
470
|
+
// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout
|
|
471
|
+
// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.
|
|
472
|
+
this.checkout.onCommitValid(commit, () =>
|
|
473
|
+
super.submitCommit(commit, schemaAndPolicy, isResubmit),
|
|
474
|
+
);
|
|
475
|
+
}
|
|
406
476
|
}
|
|
407
477
|
|
|
408
478
|
/**
|
|
@@ -486,6 +556,9 @@ export type SharedTreeOptions = Partial<ICodecOptions> &
|
|
|
486
556
|
Partial<SharedTreeFormatOptions> &
|
|
487
557
|
ForestOptions;
|
|
488
558
|
|
|
559
|
+
export interface SharedTreeOptionsInternal extends SharedTreeOptions {
|
|
560
|
+
disposeForksAfterTransaction?: boolean;
|
|
561
|
+
}
|
|
489
562
|
/**
|
|
490
563
|
* Configuration options for SharedTree's internal tree storage.
|
|
491
564
|
* @alpha
|
|
@@ -540,11 +613,12 @@ export enum ForestType {
|
|
|
540
613
|
Expensive = 2,
|
|
541
614
|
}
|
|
542
615
|
|
|
543
|
-
export const defaultSharedTreeOptions: Required<
|
|
616
|
+
export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
544
617
|
jsonValidator: noopValidator,
|
|
545
618
|
forest: ForestType.Reference,
|
|
546
619
|
treeEncodeType: TreeCompressionStrategy.Compressed,
|
|
547
620
|
formatVersion: SharedTreeFormatVersion.v3,
|
|
621
|
+
disposeForksAfterTransaction: true,
|
|
548
622
|
};
|
|
549
623
|
|
|
550
624
|
/**
|
|
@@ -559,7 +633,7 @@ export class SharedTreeFactory implements IChannelFactory<ISharedTree> {
|
|
|
559
633
|
packageVersion: "0.0.0",
|
|
560
634
|
};
|
|
561
635
|
|
|
562
|
-
public constructor(private readonly options:
|
|
636
|
+
public constructor(private readonly options: SharedTreeOptionsInternal = {}) {}
|
|
563
637
|
|
|
564
638
|
public async load(
|
|
565
639
|
runtime: IFluidDataStoreRuntime,
|
|
@@ -578,3 +652,66 @@ export class SharedTreeFactory implements IChannelFactory<ISharedTree> {
|
|
|
578
652
|
return tree;
|
|
579
653
|
}
|
|
580
654
|
}
|
|
655
|
+
|
|
656
|
+
function verboseFromCursor(
|
|
657
|
+
reader: ITreeCursor,
|
|
658
|
+
schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,
|
|
659
|
+
): VerboseTree {
|
|
660
|
+
const fields = customFromCursorStored(reader, schema, verboseFromCursor);
|
|
661
|
+
const nodeSchema = schema.get(reader.type) ?? fail("missing schema for type in cursor");
|
|
662
|
+
if (nodeSchema instanceof LeafNodeStoredSchema) {
|
|
663
|
+
return fields as CustomTreeValue<IFluidHandle>;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
return {
|
|
667
|
+
type: reader.type,
|
|
668
|
+
fields: fields as CustomTreeNode<IFluidHandle>,
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {
|
|
673
|
+
let kind: FieldKind;
|
|
674
|
+
switch (schema.kind) {
|
|
675
|
+
case FieldKinds.identifier.identifier:
|
|
676
|
+
kind = FieldKind.Identifier;
|
|
677
|
+
break;
|
|
678
|
+
case FieldKinds.optional.identifier:
|
|
679
|
+
kind = FieldKind.Optional;
|
|
680
|
+
break;
|
|
681
|
+
case FieldKinds.required.identifier:
|
|
682
|
+
kind = FieldKind.Required;
|
|
683
|
+
break;
|
|
684
|
+
case FieldKinds.forbidden.identifier:
|
|
685
|
+
kind = FieldKind.Optional;
|
|
686
|
+
assert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);
|
|
687
|
+
break;
|
|
688
|
+
default:
|
|
689
|
+
fail("invalid field kind");
|
|
690
|
+
}
|
|
691
|
+
return { kind, allowedTypes: schema.types };
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
function exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {
|
|
695
|
+
const arrayTypes = tryStoredSchemaAsArray(schema);
|
|
696
|
+
if (arrayTypes !== undefined) {
|
|
697
|
+
return { kind: NodeKind.Array, allowedTypes: arrayTypes };
|
|
698
|
+
}
|
|
699
|
+
if (schema instanceof ObjectNodeStoredSchema) {
|
|
700
|
+
const fields: Record<string, SimpleFieldSchema> = {};
|
|
701
|
+
for (const [key, field] of schema.objectNodeFields) {
|
|
702
|
+
fields[key] = exportSimpleFieldSchemaStored(field);
|
|
703
|
+
}
|
|
704
|
+
return { kind: NodeKind.Object, fields };
|
|
705
|
+
}
|
|
706
|
+
if (schema instanceof MapNodeStoredSchema) {
|
|
707
|
+
assert(
|
|
708
|
+
schema.mapFields.kind === FieldKinds.optional.identifier,
|
|
709
|
+
0xa95 /* Invalid map schema */,
|
|
710
|
+
);
|
|
711
|
+
return { kind: NodeKind.Map, allowedTypes: schema.mapFields.types };
|
|
712
|
+
}
|
|
713
|
+
if (schema instanceof LeafNodeStoredSchema) {
|
|
714
|
+
return { kind: NodeKind.Leaf, leafKind: schema.leafValue };
|
|
715
|
+
}
|
|
716
|
+
fail("invalid schema kind");
|
|
717
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { TreeNode } from "../simple-tree/index.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A special object that signifies when a SharedTree {@link RunTransaction | transaction} should "roll back".
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const rollback = Symbol("SharedTree Transaction Rollback");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A requirement for a SharedTree transaction to succeed.
|
|
16
|
+
* @remarks Transaction constraints are useful for validating that the state of the tree meets some requirement when a transaction runs.
|
|
17
|
+
* In general, when running a transaction a client can validate their tree state in whatever way they wish and decide to either proceed with the transaction or not.
|
|
18
|
+
* However, they cannot know what the tree state will be when the transaction is _sequenced_.
|
|
19
|
+
* There may have been any number of edits from other clients that get sequenced before the transaction is eventually sequenced.
|
|
20
|
+
* Constraints provide a way to validate the tree state after the transaction has been sequenced and abort the transaction if the constraints are not met.
|
|
21
|
+
* All clients will validate the constraints of a transaction when it is sequenced, so all clients will agree on whether the transaction succeeds or not.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export type TransactionConstraint = NodeInDocumentConstraint; // TODO: Add more constraint types here
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A transaction {@link TransactionConstraint | constraint} which requires that the given node exists in the tree.
|
|
28
|
+
* @remarks The node must be in the document (its {@link TreeStatus | status} must be {@link TreeStatus.InDocument | InDocument}) to qualify as "existing".
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export interface NodeInDocumentConstraint {
|
|
32
|
+
readonly type: "nodeInDocument";
|
|
33
|
+
readonly node: TreeNode;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The status of the transaction callback in the {@link RunTransaction | RunTransaction} API.
|
|
38
|
+
* @alpha
|
|
39
|
+
*/
|
|
40
|
+
export type TransactionCallbackStatus<TSuccessValue, TFailureValue> = (
|
|
41
|
+
| {
|
|
42
|
+
/** Indicates that the transaction callback ran successfully. */
|
|
43
|
+
rollback?: false;
|
|
44
|
+
/** The user defined value when the transaction ran successfully. */
|
|
45
|
+
value: TSuccessValue;
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
/** Indicates that the transaction callback failed and the transaction should be rolled back. */
|
|
49
|
+
rollback: true;
|
|
50
|
+
/** The user defined value when the transaction failed. */
|
|
51
|
+
value: TFailureValue;
|
|
52
|
+
}
|
|
53
|
+
) & {
|
|
54
|
+
/**
|
|
55
|
+
* An optional list of {@link TransactionConstraint | constraints} that will be checked when the commit corresponding
|
|
56
|
+
* to this transaction is reverted. If any of these constraints are not met when the revert is being applied either
|
|
57
|
+
* locally or on remote clients, the revert will be ignored.
|
|
58
|
+
* These constraints must also be met at the time they are first introduced. If they are not met after the transaction
|
|
59
|
+
* callback returns, then `runTransaction` (which invokes the transaction callback) will throw a `UsageError`.
|
|
60
|
+
*/
|
|
61
|
+
preconditionsOnRevert?: readonly TransactionConstraint[];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The status of a the transaction callback in the {@link RunTransaction | RunTransaction} API where the transaction doesn't
|
|
66
|
+
* need to return a value. This is the same as {@link TransactionCallbackStatus} but with the `value` field omitted. This
|
|
67
|
+
* @alpha
|
|
68
|
+
*/
|
|
69
|
+
export type VoidTransactionCallbackStatus = Omit<
|
|
70
|
+
TransactionCallbackStatus<unknown, unknown>,
|
|
71
|
+
"value"
|
|
72
|
+
>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The result of the {@link RunTransaction | RunTransaction} API when it was successful.
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
export interface TransactionResultSuccess<TSuccessValue> {
|
|
79
|
+
/** Indicates that the transaction was successful. */
|
|
80
|
+
success: true;
|
|
81
|
+
/** The user defined value when the transaction was successful. */
|
|
82
|
+
value: TSuccessValue;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The result of the {@link RunTransaction | RunTransaction} API when it failed.
|
|
87
|
+
* @alpha
|
|
88
|
+
*/
|
|
89
|
+
export interface TransactionResultFailed<TFailureValue> {
|
|
90
|
+
/** Indicates that the transaction failed. */
|
|
91
|
+
success: false;
|
|
92
|
+
/** The user defined value when the transaction failed. */
|
|
93
|
+
value: TFailureValue;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The result of the {@link RunTransaction | RunTransaction} API.
|
|
98
|
+
* @alpha
|
|
99
|
+
*/
|
|
100
|
+
export type TransactionResultExt<TSuccessValue, TFailureValue> =
|
|
101
|
+
| TransactionResultSuccess<TSuccessValue>
|
|
102
|
+
| TransactionResultFailed<TFailureValue>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The result of the {@link RunTransaction | RunTransaction} API. This is the same as {@link TransactionResultExt}
|
|
106
|
+
* but with the `value` field omitted. This is useful when the transaction callback doesn't need to return a value.
|
|
107
|
+
* @alpha
|
|
108
|
+
*/
|
|
109
|
+
export type TransactionResult =
|
|
110
|
+
| Omit<TransactionResultSuccess<unknown>, "value">
|
|
111
|
+
| Omit<TransactionResultFailed<unknown>, "value">;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The parameters for the {@link RunTransaction | RunTransaction} API.
|
|
115
|
+
* @alpha
|
|
116
|
+
*/
|
|
117
|
+
export interface RunTransactionParams {
|
|
118
|
+
/**
|
|
119
|
+
* An optional list of {@link TransactionConstraint | constraints} that are checked just before the transaction begins.
|
|
120
|
+
* If any of the constraints are not met when `runTransaction` is called, an error will be thrown.
|
|
121
|
+
* If any of the constraints are not met after the transaction has been ordered by the service, it will be rolled back on
|
|
122
|
+
* this client and ignored by all other clients.
|
|
123
|
+
*/
|
|
124
|
+
readonly preconditions?: readonly TransactionConstraint[];
|
|
125
|
+
}
|