@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
|
@@ -200,6 +200,8 @@ export function createSimpleTreeIndex<
|
|
|
200
200
|
return treeNodeApi.status(simpleTree);
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
|
+
// simple tree indexes are shallow indexes, indicating so allows for a performance optimization
|
|
204
|
+
true,
|
|
203
205
|
);
|
|
204
206
|
|
|
205
207
|
// all the type checking guarantees that we put nodes of the correct type in the index
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { ICodecOptions } from "../../codec/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import type { TreeStoredSchema } from "../../core/index.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultSchemaPolicy,
|
|
10
10
|
encodeTreeSchema,
|
|
@@ -59,7 +59,7 @@ export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompati
|
|
|
59
59
|
* opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.
|
|
60
60
|
*
|
|
61
61
|
* @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.
|
|
62
|
-
* @param view - Schema which would be used to view persisted content.
|
|
62
|
+
* @param view - Schema which would be used to view persisted content.
|
|
63
63
|
* @param options - {@link ICodecOptions} used when parsing the provided schema.
|
|
64
64
|
* @param canInitialize - Passed through to the return value unchanged and otherwise unused.
|
|
65
65
|
* @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.
|
|
@@ -75,7 +75,7 @@ export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompati
|
|
|
75
75
|
* assert(
|
|
76
76
|
* comparePersistedSchema(
|
|
77
77
|
* require("./schema.json"),
|
|
78
|
-
*
|
|
78
|
+
* MySchema,
|
|
79
79
|
* { jsonValidator: typeboxValidator },
|
|
80
80
|
* false,
|
|
81
81
|
* ).canUpgrade,
|
|
@@ -85,14 +85,13 @@ export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompati
|
|
|
85
85
|
*/
|
|
86
86
|
export function comparePersistedSchema(
|
|
87
87
|
persisted: JsonCompatible,
|
|
88
|
-
view:
|
|
88
|
+
view: ImplicitFieldSchema,
|
|
89
89
|
options: ICodecOptions,
|
|
90
90
|
canInitialize: boolean,
|
|
91
91
|
): SchemaCompatibilityStatus {
|
|
92
92
|
const schemaCodec = makeSchemaCodec(options);
|
|
93
93
|
const stored = schemaCodec.decode(persisted as Format);
|
|
94
|
-
const
|
|
95
|
-
const viewSchema = new ViewSchema(defaultSchemaPolicy, {}, viewParsed);
|
|
94
|
+
const viewSchema = new ViewSchema(defaultSchemaPolicy, {}, view);
|
|
96
95
|
return comparePersistedSchemaInternal(stored, viewSchema, canInitialize);
|
|
97
96
|
}
|
|
98
97
|
|
|
@@ -105,22 +104,8 @@ export function comparePersistedSchemaInternal(
|
|
|
105
104
|
viewSchema: ViewSchema,
|
|
106
105
|
canInitialize: boolean,
|
|
107
106
|
): SchemaCompatibilityStatus {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// TODO: AB#8121: Weaken this check to support viewing under additional circumstances.
|
|
111
|
-
// In the near term, this should support viewing documents with additional optional fields in their schema on object types.
|
|
112
|
-
// Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility
|
|
113
|
-
// (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)
|
|
114
|
-
const canView =
|
|
115
|
-
result.write === Compatibility.Compatible && result.read === Compatibility.Compatible;
|
|
116
|
-
const canUpgrade = result.read === Compatibility.Compatible;
|
|
117
|
-
const isEquivalent = canView && canUpgrade;
|
|
118
|
-
const compatibility: SchemaCompatibilityStatus = {
|
|
119
|
-
canView,
|
|
120
|
-
canUpgrade,
|
|
121
|
-
isEquivalent,
|
|
107
|
+
return {
|
|
108
|
+
...viewSchema.checkCompatibility(stored),
|
|
122
109
|
canInitialize,
|
|
123
110
|
};
|
|
124
|
-
|
|
125
|
-
return compatibility;
|
|
126
111
|
}
|
|
@@ -12,6 +12,17 @@ import type {
|
|
|
12
12
|
RevertibleFactory,
|
|
13
13
|
} from "../../core/index.js";
|
|
14
14
|
|
|
15
|
+
import type {
|
|
16
|
+
RunTransactionParams,
|
|
17
|
+
VoidTransactionCallbackStatus,
|
|
18
|
+
TransactionCallbackStatus,
|
|
19
|
+
TransactionResult,
|
|
20
|
+
TransactionResultExt,
|
|
21
|
+
// This is referenced by doc comments.
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
|
|
23
|
+
TreeAlpha,
|
|
24
|
+
} from "../../shared-tree/index.js";
|
|
25
|
+
|
|
15
26
|
import {
|
|
16
27
|
type ImplicitFieldSchema,
|
|
17
28
|
type InsertableField,
|
|
@@ -41,6 +52,7 @@ import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
|
41
52
|
* Maybe rename "exportJsonSchema" to align on "concise" terminology.
|
|
42
53
|
* Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).
|
|
43
54
|
* Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).
|
|
55
|
+
* Some of these APIs are on ISharedTree and can get moved here.
|
|
44
56
|
* @system @sealed @public
|
|
45
57
|
*/
|
|
46
58
|
export interface ViewableTree {
|
|
@@ -536,6 +548,72 @@ export interface TreeViewAlpha<
|
|
|
536
548
|
|
|
537
549
|
// Override the base branch method to return a typed view rather than merely a branch.
|
|
538
550
|
fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TSchema>;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
554
|
+
* @param transaction - The function to run as the body of the transaction.
|
|
555
|
+
* It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.
|
|
556
|
+
* It includes a "rollback" property which may be returned as true at any point during the transaction. This will
|
|
557
|
+
* abort the transaction and discard any changes it made so far.
|
|
558
|
+
* "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
559
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
560
|
+
* @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
|
|
561
|
+
* - A "success" flag indicating whether the transaction was successful or not.
|
|
562
|
+
* - The success of failure value as returned by the transaction function.
|
|
563
|
+
* @remarks
|
|
564
|
+
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
565
|
+
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
566
|
+
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
567
|
+
* However, using a transaction has the following additional consequences:
|
|
568
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
569
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
570
|
+
*
|
|
571
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
572
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
573
|
+
*
|
|
574
|
+
* Nested transactions:
|
|
575
|
+
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
576
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
577
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
578
|
+
* for the outermost transaction which includes all inner transactions.
|
|
579
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
580
|
+
*/
|
|
581
|
+
runTransaction<TSuccessValue, TFailureValue>(
|
|
582
|
+
transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,
|
|
583
|
+
params?: RunTransactionParams,
|
|
584
|
+
): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
585
|
+
/**
|
|
586
|
+
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
587
|
+
* @param transaction - The function to run as the body of the transaction. It may return the following:
|
|
588
|
+
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
589
|
+
* - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
|
|
590
|
+
* may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
|
|
591
|
+
* far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
592
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
593
|
+
* @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
|
|
594
|
+
* transaction was successful or not.
|
|
595
|
+
* @remarks
|
|
596
|
+
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
597
|
+
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
598
|
+
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
599
|
+
* However, using a transaction has the following additional consequences:
|
|
600
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
601
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
602
|
+
*
|
|
603
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
604
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
605
|
+
*
|
|
606
|
+
* Nested transactions:
|
|
607
|
+
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
608
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
609
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
610
|
+
* for the outermost transaction which includes all inner transactions.
|
|
611
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
612
|
+
*/
|
|
613
|
+
runTransaction(
|
|
614
|
+
transaction: () => VoidTransactionCallbackStatus | void,
|
|
615
|
+
params?: RunTransactionParams,
|
|
616
|
+
): TransactionResult;
|
|
539
617
|
}
|
|
540
618
|
|
|
541
619
|
/**
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
} from "../leafNodeSchema.js";
|
|
39
39
|
import { isObjectNodeSchema } from "../objectNodeTypes.js";
|
|
40
40
|
import {
|
|
41
|
-
|
|
41
|
+
customFromCursor,
|
|
42
42
|
type CustomTreeNode,
|
|
43
43
|
type CustomTreeValue,
|
|
44
44
|
type EncodeOptions,
|
|
@@ -344,7 +344,7 @@ function verboseFromCursorInner<TCustom>(
|
|
|
344
344
|
options: Required<EncodeOptions<TCustom>>,
|
|
345
345
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
346
346
|
): VerboseTree<TCustom> {
|
|
347
|
-
const fields =
|
|
347
|
+
const fields = customFromCursor(reader, options, schema, verboseFromCursorInner);
|
|
348
348
|
const nodeSchema = schema.get(reader.type) ?? fail("missing schema for type in cursor");
|
|
349
349
|
if (nodeSchema.kind === NodeKind.Leaf) {
|
|
350
350
|
return fields as CustomTreeValue<TCustom>;
|
|
@@ -5,32 +5,56 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
AdaptedViewSchema,
|
|
8
|
+
type TreeNodeStoredSchema,
|
|
8
9
|
type Adapters,
|
|
9
|
-
Compatibility,
|
|
10
10
|
type TreeFieldStoredSchema,
|
|
11
11
|
type TreeNodeSchemaIdentifier,
|
|
12
|
-
type TreeNodeStoredSchema,
|
|
13
12
|
type TreeStoredSchema,
|
|
14
13
|
} from "../../core/index.js";
|
|
15
14
|
import { fail } from "../../util/index.js";
|
|
16
15
|
import {
|
|
16
|
+
FieldKinds,
|
|
17
17
|
type FullSchemaPolicy,
|
|
18
|
-
|
|
18
|
+
type FieldDiscrepancy,
|
|
19
|
+
getAllowedContentDiscrepancies,
|
|
19
20
|
isNeverTree,
|
|
21
|
+
PosetComparisonResult,
|
|
22
|
+
fieldRealizer,
|
|
23
|
+
comparePosetElements,
|
|
20
24
|
} from "../../feature-libraries/index.js";
|
|
25
|
+
import {
|
|
26
|
+
normalizeFieldSchema,
|
|
27
|
+
type FieldSchema,
|
|
28
|
+
type ImplicitFieldSchema,
|
|
29
|
+
} from "../schemaTypes.js";
|
|
30
|
+
import { toStoredSchema } from "../toStoredSchema.js";
|
|
31
|
+
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
32
|
+
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
21
33
|
|
|
22
34
|
/**
|
|
23
35
|
* A collection of View information for schema, including policy.
|
|
24
36
|
*/
|
|
25
37
|
export class ViewSchema {
|
|
26
38
|
/**
|
|
27
|
-
*
|
|
39
|
+
* Cached conversion of the view schema in the stored schema format.
|
|
40
|
+
*/
|
|
41
|
+
private readonly viewSchemaAsStored: TreeStoredSchema;
|
|
42
|
+
/**
|
|
43
|
+
* Normalized view schema (implicitly allowed view schema types are converted to their canonical form).
|
|
44
|
+
*/
|
|
45
|
+
public readonly schema: FieldSchema;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param viewSchema - Schema for the root field of this view.
|
|
28
49
|
*/
|
|
29
50
|
public constructor(
|
|
30
51
|
public readonly policy: FullSchemaPolicy,
|
|
31
52
|
public readonly adapters: Adapters,
|
|
32
|
-
|
|
33
|
-
) {
|
|
53
|
+
viewSchema: ImplicitFieldSchema,
|
|
54
|
+
) {
|
|
55
|
+
this.schema = normalizeFieldSchema(viewSchema);
|
|
56
|
+
this.viewSchemaAsStored = toStoredSchema(this.schema);
|
|
57
|
+
}
|
|
34
58
|
|
|
35
59
|
/**
|
|
36
60
|
* Determines the compatibility of a stored document
|
|
@@ -42,53 +66,168 @@ export class ViewSchema {
|
|
|
42
66
|
* TODO: this API violates the parse don't validate design philosophy.
|
|
43
67
|
* It should be wrapped with (or replaced by) a parse style API.
|
|
44
68
|
*/
|
|
45
|
-
public checkCompatibility(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
writeAllowingStoredSchemaUpdates: Compatibility;
|
|
49
|
-
} {
|
|
69
|
+
public checkCompatibility(
|
|
70
|
+
stored: TreeStoredSchema,
|
|
71
|
+
): Omit<SchemaCompatibilityStatus, "canInitialize"> {
|
|
50
72
|
// TODO: support adapters
|
|
51
73
|
// const adapted = this.adaptRepo(stored);
|
|
52
74
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy
|
|
76
|
+
// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.
|
|
77
|
+
// In the future, this would also include things like:
|
|
78
|
+
// - fields with more allowed types in the stored schema than in the view schema have out-of-schema "unknown content" adapters
|
|
79
|
+
let canView = true;
|
|
80
|
+
// View schema allows a superset of documents that stored schema does, hence the document could be upgraded to use a persisted version
|
|
81
|
+
// of this view schema as its stored schema.
|
|
82
|
+
let canUpgrade = true;
|
|
83
|
+
|
|
84
|
+
const updateCompatibilityFromFieldDiscrepancy = (discrepancy: FieldDiscrepancy): void => {
|
|
85
|
+
switch (discrepancy.mismatch) {
|
|
86
|
+
case "allowedTypes": {
|
|
87
|
+
// Since we only track the symmetric difference between the allowed types in the view and
|
|
88
|
+
// stored schemas, it's sufficient to check if any extra allowed types still exist in the
|
|
89
|
+
// stored schema.
|
|
90
|
+
if (
|
|
91
|
+
discrepancy.stored.some(
|
|
92
|
+
(identifier) =>
|
|
93
|
+
!isNeverTree(this.policy, stored, stored.nodeSchema.get(identifier)),
|
|
94
|
+
)
|
|
95
|
+
) {
|
|
96
|
+
// Stored schema has extra allowed types that the view schema does not.
|
|
97
|
+
canUpgrade = false;
|
|
98
|
+
canView = false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (
|
|
102
|
+
discrepancy.view.some(
|
|
103
|
+
(identifier) =>
|
|
104
|
+
!isNeverTree(
|
|
105
|
+
this.policy,
|
|
106
|
+
this.viewSchemaAsStored,
|
|
107
|
+
this.viewSchemaAsStored.nodeSchema.get(identifier),
|
|
108
|
+
),
|
|
109
|
+
)
|
|
110
|
+
) {
|
|
111
|
+
// View schema has extra allowed types that the stored schema does not.
|
|
112
|
+
canView = false;
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case "fieldKind": {
|
|
117
|
+
const result = comparePosetElements(
|
|
118
|
+
discrepancy.stored,
|
|
119
|
+
discrepancy.view,
|
|
120
|
+
fieldRealizer,
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
if (result === PosetComparisonResult.Greater) {
|
|
124
|
+
// Stored schema is more relaxed than view schema.
|
|
125
|
+
canUpgrade = false;
|
|
126
|
+
if (
|
|
127
|
+
discrepancy.view === FieldKinds.forbidden.identifier &&
|
|
128
|
+
discrepancy.identifier !== undefined &&
|
|
129
|
+
this.policy.allowUnknownOptionalFields(discrepancy.identifier)
|
|
130
|
+
) {
|
|
131
|
+
// When the application has opted into it, we allow viewing documents which have additional
|
|
132
|
+
// optional fields in the stored schema that are not present in the view schema.
|
|
133
|
+
} else {
|
|
134
|
+
canView = false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (result === PosetComparisonResult.Less) {
|
|
139
|
+
// View schema is more relaxed than stored schema.
|
|
140
|
+
canView = false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (result === PosetComparisonResult.Incomparable) {
|
|
144
|
+
canUpgrade = false;
|
|
145
|
+
canView = false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
case "valueSchema": {
|
|
151
|
+
canView = false;
|
|
152
|
+
canUpgrade = false;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
default:
|
|
156
|
+
unreachableCase(discrepancy);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
for (const discrepancy of getAllowedContentDiscrepancies(
|
|
161
|
+
this.viewSchemaAsStored,
|
|
162
|
+
stored,
|
|
163
|
+
)) {
|
|
164
|
+
if (!canView && !canUpgrade) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
switch (discrepancy.mismatch) {
|
|
169
|
+
case "nodeKind": {
|
|
170
|
+
const viewNodeSchema = this.viewSchemaAsStored.nodeSchema.get(
|
|
171
|
+
discrepancy.identifier,
|
|
172
|
+
);
|
|
173
|
+
const storedNodeSchema = stored.nodeSchema.get(discrepancy.identifier);
|
|
174
|
+
// We conservatively do not allow node types to change.
|
|
175
|
+
// The only time this might be valid in the sense that the data canonically converts is converting an object node
|
|
176
|
+
// to a map node over the union of all the object fields' types.
|
|
177
|
+
if (discrepancy.stored === undefined) {
|
|
178
|
+
const viewIsNever =
|
|
179
|
+
viewNodeSchema !== undefined
|
|
180
|
+
? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)
|
|
181
|
+
: true;
|
|
182
|
+
if (!viewIsNever) {
|
|
183
|
+
// View schema has added a node type that the stored schema doesn't know about.
|
|
184
|
+
canView = false;
|
|
185
|
+
}
|
|
186
|
+
} else if (discrepancy.view === undefined) {
|
|
187
|
+
const storedIsNever =
|
|
188
|
+
storedNodeSchema !== undefined
|
|
189
|
+
? isNeverTree(this.policy, stored, storedNodeSchema)
|
|
190
|
+
: true;
|
|
191
|
+
if (!storedIsNever) {
|
|
192
|
+
// Stored schema has a node type that the view schema doesn't know about.
|
|
193
|
+
canUpgrade = false;
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
// Node type exists in both schemas but has changed. We conservatively never allow this.
|
|
197
|
+
const storedIsNever =
|
|
198
|
+
storedNodeSchema !== undefined
|
|
199
|
+
? isNeverTree(this.policy, stored, storedNodeSchema)
|
|
200
|
+
: true;
|
|
201
|
+
const viewIsNever =
|
|
202
|
+
viewNodeSchema !== undefined
|
|
203
|
+
? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)
|
|
204
|
+
: true;
|
|
205
|
+
if (!storedIsNever || !viewIsNever) {
|
|
206
|
+
canView = false;
|
|
207
|
+
canUpgrade = false;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
case "valueSchema":
|
|
213
|
+
case "allowedTypes":
|
|
214
|
+
case "fieldKind": {
|
|
215
|
+
updateCompatibilityFromFieldDiscrepancy(discrepancy);
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case "fields": {
|
|
219
|
+
discrepancy.differences.forEach(updateCompatibilityFromFieldDiscrepancy);
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
// No default
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
canView,
|
|
228
|
+
canUpgrade,
|
|
229
|
+
isEquivalent: canView && canUpgrade,
|
|
230
|
+
};
|
|
92
231
|
}
|
|
93
232
|
|
|
94
233
|
/**
|
|
@@ -102,8 +241,15 @@ export class ViewSchema {
|
|
|
102
241
|
// since there never is a reason to have a never type as an adapter input,
|
|
103
242
|
// and its impossible for an adapter to be correctly implemented if its output type is never
|
|
104
243
|
// (unless its input is also never).
|
|
244
|
+
|
|
105
245
|
for (const adapter of this.adapters?.tree ?? []) {
|
|
106
|
-
if (
|
|
246
|
+
if (
|
|
247
|
+
isNeverTree(
|
|
248
|
+
this.policy,
|
|
249
|
+
this.viewSchemaAsStored,
|
|
250
|
+
this.viewSchemaAsStored.nodeSchema.get(adapter.output),
|
|
251
|
+
)
|
|
252
|
+
) {
|
|
107
253
|
fail("tree adapter for stored adapter.output should not be never");
|
|
108
254
|
}
|
|
109
255
|
}
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
SimpleTreeSchema,
|
|
21
21
|
} from "./simpleSchema.js";
|
|
22
22
|
import type { ValueSchema } from "../../core/index.js";
|
|
23
|
-
import { getOrCreate, type Mutable } from "../../util/index.js";
|
|
23
|
+
import { copyProperty, getOrCreate, type Mutable } from "../../util/index.js";
|
|
24
24
|
import { isObjectNodeSchema, type ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
25
25
|
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
26
26
|
|
|
@@ -41,11 +41,7 @@ export function toSimpleTreeSchema(schema: ImplicitFieldSchema): SimpleTreeSchem
|
|
|
41
41
|
definitions,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
if (normalizedSchema.metadata !== undefined) {
|
|
46
|
-
output.metadata = normalizedSchema.metadata;
|
|
47
|
-
}
|
|
48
|
-
|
|
44
|
+
copyProperty(normalizedSchema, "metadata", output);
|
|
49
45
|
return output;
|
|
50
46
|
}
|
|
51
47
|
|
|
@@ -95,20 +91,28 @@ function leafSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleLeafNodeSchema
|
|
|
95
91
|
function arraySchemaToSimpleSchema(schema: TreeNodeSchema): SimpleArrayNodeSchema {
|
|
96
92
|
const fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);
|
|
97
93
|
const allowedTypes = allowedTypesFromFieldSchema(fieldSchema);
|
|
98
|
-
|
|
94
|
+
const output: Mutable<SimpleArrayNodeSchema> = {
|
|
99
95
|
kind: NodeKind.Array,
|
|
100
96
|
allowedTypes,
|
|
101
97
|
};
|
|
98
|
+
|
|
99
|
+
copyProperty(schema, "metadata", output);
|
|
100
|
+
|
|
101
|
+
return output;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// TODO: Use a stronger type for map schemas once one is available (see object schema handler for an example).
|
|
105
105
|
function mapSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleMapNodeSchema {
|
|
106
106
|
const fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);
|
|
107
107
|
const allowedTypes = allowedTypesFromFieldSchema(fieldSchema);
|
|
108
|
-
|
|
108
|
+
const output: Mutable<SimpleMapNodeSchema> = {
|
|
109
109
|
kind: NodeKind.Map,
|
|
110
110
|
allowedTypes,
|
|
111
111
|
};
|
|
112
|
+
|
|
113
|
+
copyProperty(schema, "metadata", output);
|
|
114
|
+
|
|
115
|
+
return output;
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
function objectSchemaToSimpleSchema(schema: ObjectNodeSchema): SimpleObjectNodeSchema {
|
|
@@ -116,10 +120,15 @@ function objectSchemaToSimpleSchema(schema: ObjectNodeSchema): SimpleObjectNodeS
|
|
|
116
120
|
for (const [key, field] of schema.fields) {
|
|
117
121
|
fields[key] = fieldSchemaToSimpleSchema(field);
|
|
118
122
|
}
|
|
119
|
-
|
|
123
|
+
|
|
124
|
+
const output: Mutable<SimpleObjectNodeSchema> = {
|
|
120
125
|
kind: NodeKind.Object,
|
|
121
126
|
fields,
|
|
122
127
|
};
|
|
128
|
+
|
|
129
|
+
copyProperty(schema, "metadata", output);
|
|
130
|
+
|
|
131
|
+
return output;
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
/**
|
|
@@ -140,10 +149,7 @@ function fieldSchemaToSimpleSchema(schema: FieldSchema): SimpleFieldSchema {
|
|
|
140
149
|
allowedTypes,
|
|
141
150
|
};
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
if (schema.metadata !== undefined) {
|
|
145
|
-
result.metadata = schema.metadata;
|
|
146
|
-
}
|
|
152
|
+
copyProperty(schema, "metadata", result);
|
|
147
153
|
|
|
148
154
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
149
155
|
(schema as any)[simpleFieldSchemaCacheSymbol] = result;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
normalizeAllowedTypes,
|
|
19
19
|
type ImplicitAllowedTypes,
|
|
20
20
|
type InsertableTreeNodeFromImplicitAllowedTypes,
|
|
21
|
+
type NodeSchemaMetadata,
|
|
21
22
|
type TreeLeafValue,
|
|
22
23
|
type TreeNodeFromImplicitAllowedTypes,
|
|
23
24
|
} from "./schemaTypes.js";
|
|
@@ -1062,11 +1063,13 @@ export function arraySchema<
|
|
|
1062
1063
|
TName extends string,
|
|
1063
1064
|
const T extends ImplicitAllowedTypes,
|
|
1064
1065
|
const ImplicitlyConstructable extends boolean,
|
|
1066
|
+
const TCustomMetadata = unknown,
|
|
1065
1067
|
>(
|
|
1066
1068
|
identifier: TName,
|
|
1067
1069
|
info: T,
|
|
1068
1070
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
1069
1071
|
customizable: boolean,
|
|
1072
|
+
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
1070
1073
|
) {
|
|
1071
1074
|
type Output = TreeNodeSchemaBoth<
|
|
1072
1075
|
TName,
|
|
@@ -1075,7 +1078,8 @@ export function arraySchema<
|
|
|
1075
1078
|
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
1076
1079
|
ImplicitlyConstructable,
|
|
1077
1080
|
T,
|
|
1078
|
-
undefined
|
|
1081
|
+
undefined,
|
|
1082
|
+
TCustomMetadata
|
|
1079
1083
|
>;
|
|
1080
1084
|
|
|
1081
1085
|
const lazyChildTypes = new Lazy(() => normalizeAllowedTypes(info));
|
|
@@ -1157,6 +1161,8 @@ export function arraySchema<
|
|
|
1157
1161
|
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
|
|
1158
1162
|
return lazyChildTypes.value;
|
|
1159
1163
|
}
|
|
1164
|
+
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata> | undefined =
|
|
1165
|
+
metadata;
|
|
1160
1166
|
|
|
1161
1167
|
// eslint-disable-next-line import/no-deprecated
|
|
1162
1168
|
public get [typeNameSymbol](): TName {
|