@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
|
@@ -11,8 +11,12 @@ import {
|
|
|
11
11
|
EmptyKey,
|
|
12
12
|
forEachField,
|
|
13
13
|
inCursorField,
|
|
14
|
+
LeafNodeStoredSchema,
|
|
14
15
|
mapCursorField,
|
|
16
|
+
ObjectNodeStoredSchema,
|
|
15
17
|
type ITreeCursor,
|
|
18
|
+
type TreeNodeSchemaIdentifier,
|
|
19
|
+
type TreeNodeStoredSchema,
|
|
16
20
|
} from "../../core/index.js";
|
|
17
21
|
import { fail } from "../../util/index.js";
|
|
18
22
|
import type { TreeLeafValue } from "../schemaTypes.js";
|
|
@@ -25,6 +29,7 @@ import {
|
|
|
25
29
|
stringSchema,
|
|
26
30
|
} from "../leafNodeSchema.js";
|
|
27
31
|
import { isObjectNodeSchema } from "../objectNodeTypes.js";
|
|
32
|
+
import { FieldKinds, valueSchemaAllows } from "../../feature-libraries/index.js";
|
|
28
33
|
|
|
29
34
|
/**
|
|
30
35
|
* Options for how to encode a tree.
|
|
@@ -63,7 +68,7 @@ export type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };
|
|
|
63
68
|
/**
|
|
64
69
|
* Builds an {@link CustomTree} from a cursor in Nodes mode.
|
|
65
70
|
*/
|
|
66
|
-
export function
|
|
71
|
+
export function customFromCursor<TChild, THandle>(
|
|
67
72
|
reader: ITreeCursor,
|
|
68
73
|
options: Required<EncodeOptions<THandle>>,
|
|
69
74
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
@@ -118,3 +123,66 @@ export function customFromCursorInner<TChild, THandle>(
|
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Builds an {@link CustomTree} from a cursor in Nodes mode.
|
|
129
|
+
* @remarks
|
|
130
|
+
* Uses stored keys and stored schema.
|
|
131
|
+
*/
|
|
132
|
+
export function customFromCursorStored<TChild>(
|
|
133
|
+
reader: ITreeCursor,
|
|
134
|
+
schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,
|
|
135
|
+
childHandler: (
|
|
136
|
+
reader: ITreeCursor,
|
|
137
|
+
schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,
|
|
138
|
+
) => TChild,
|
|
139
|
+
): CustomTree<TChild, IFluidHandle> {
|
|
140
|
+
const type = reader.type;
|
|
141
|
+
const nodeSchema = schema.get(type) ?? fail("missing schema for type in cursor");
|
|
142
|
+
|
|
143
|
+
if (nodeSchema instanceof LeafNodeStoredSchema) {
|
|
144
|
+
assert(valueSchemaAllows(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);
|
|
145
|
+
return reader.value;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
assert(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);
|
|
149
|
+
|
|
150
|
+
const arrayTypes = tryStoredSchemaAsArray(nodeSchema);
|
|
151
|
+
if (arrayTypes !== undefined) {
|
|
152
|
+
const field = inCursorField(reader, EmptyKey, () =>
|
|
153
|
+
mapCursorField(reader, () => childHandler(reader, schema)),
|
|
154
|
+
);
|
|
155
|
+
return field;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const fields: Record<string, TChild> = {};
|
|
159
|
+
forEachField(reader, () => {
|
|
160
|
+
const children = mapCursorField(reader, () => childHandler(reader, schema));
|
|
161
|
+
if (children.length === 1) {
|
|
162
|
+
const storedKey = reader.getFieldKey();
|
|
163
|
+
// Length is checked above.
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
165
|
+
fields[storedKey] = children[0]!;
|
|
166
|
+
} else {
|
|
167
|
+
assert(children.length === 0, 0xa9e /* invalid children number */);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return fields;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Assumes `schema` corresponds to a simple-tree schema.
|
|
175
|
+
* If it is an array schema, returns the allowed types for the array field.
|
|
176
|
+
* Otherwise returns `undefined`.
|
|
177
|
+
*/
|
|
178
|
+
export function tryStoredSchemaAsArray(
|
|
179
|
+
schema: TreeNodeStoredSchema,
|
|
180
|
+
): ReadonlySet<string> | undefined {
|
|
181
|
+
if (schema instanceof ObjectNodeStoredSchema) {
|
|
182
|
+
const empty = schema.getFieldSchema(EmptyKey);
|
|
183
|
+
if (empty.kind === FieldKinds.sequence.identifier) {
|
|
184
|
+
assert(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);
|
|
185
|
+
return empty.types;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -17,7 +17,12 @@ export {
|
|
|
17
17
|
type TreeBranchEvents,
|
|
18
18
|
asTreeViewAlpha,
|
|
19
19
|
} from "./tree.js";
|
|
20
|
-
export {
|
|
20
|
+
export {
|
|
21
|
+
SchemaFactory,
|
|
22
|
+
type ScopedSchemaName,
|
|
23
|
+
type SchemaFactoryObjectOptions,
|
|
24
|
+
} from "./schemaFactory.js";
|
|
25
|
+
export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
|
|
21
26
|
export type {
|
|
22
27
|
ValidateRecursiveSchema,
|
|
23
28
|
FixRecursiveArraySchema,
|
|
@@ -90,7 +95,13 @@ export {
|
|
|
90
95
|
verboseFromCursor,
|
|
91
96
|
} from "./verboseTree.js";
|
|
92
97
|
|
|
93
|
-
export
|
|
98
|
+
export {
|
|
99
|
+
type EncodeOptions,
|
|
100
|
+
customFromCursorStored,
|
|
101
|
+
type CustomTreeNode,
|
|
102
|
+
type CustomTreeValue,
|
|
103
|
+
tryStoredSchemaAsArray,
|
|
104
|
+
} from "./customTree.js";
|
|
94
105
|
|
|
95
106
|
export { type ConciseTree, conciseFromCursor } from "./conciseTree.js";
|
|
96
107
|
|
|
@@ -58,6 +58,13 @@ export interface JsonNodeSchemaBase<
|
|
|
58
58
|
* {@inheritDoc JsonSchemaType}
|
|
59
59
|
*/
|
|
60
60
|
readonly type: TJsonSchemaType;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Description of the node schema.
|
|
64
|
+
* @remarks Derived from {@link NodeSchemaMetadata.description}.
|
|
65
|
+
* @see {@link https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description}
|
|
66
|
+
*/
|
|
67
|
+
readonly description?: string | undefined;
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
/**
|
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
getOrCreate,
|
|
19
19
|
isReadonlyArray,
|
|
20
20
|
} from "../../util/index.js";
|
|
21
|
+
// This import is required for intellisense in @link doc comments on mouseover in VSCode.
|
|
22
|
+
// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars
|
|
23
|
+
import type { TreeAlpha } from "../../shared-tree/index.js";
|
|
21
24
|
|
|
22
25
|
import {
|
|
23
26
|
booleanSchema,
|
|
@@ -37,6 +40,7 @@ import {
|
|
|
37
40
|
createFieldSchema,
|
|
38
41
|
type DefaultProvider,
|
|
39
42
|
getDefaultProvider,
|
|
43
|
+
type NodeSchemaOptions,
|
|
40
44
|
} from "../schemaTypes.js";
|
|
41
45
|
import { inPrototypeChain } from "../core/index.js";
|
|
42
46
|
import type {
|
|
@@ -74,6 +78,7 @@ import type {
|
|
|
74
78
|
import { createFieldSchemaUnsafe } from "./schemaFactoryRecursive.js";
|
|
75
79
|
import { TreeNodeValid } from "../treeNodeValid.js";
|
|
76
80
|
import { isLazy } from "../flexList.js";
|
|
81
|
+
|
|
77
82
|
/**
|
|
78
83
|
* Gets the leaf domain schema compatible with a given {@link TreeValue}.
|
|
79
84
|
*/
|
|
@@ -97,6 +102,64 @@ export function schemaFromValue(value: TreeValue): TreeNodeSchema {
|
|
|
97
102
|
}
|
|
98
103
|
}
|
|
99
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Options when declaring an {@link SchemaFactory.object|object node}'s schema
|
|
107
|
+
*
|
|
108
|
+
* @alpha
|
|
109
|
+
*/
|
|
110
|
+
export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>
|
|
111
|
+
extends NodeSchemaOptions<TCustomMetadata> {
|
|
112
|
+
/**
|
|
113
|
+
* Allow nodes typed with this object node schema to contain optional fields that are not present in the schema declaration.
|
|
114
|
+
* Such nodes can come into existence either via import APIs (see remarks) or by way of collaboration with another client
|
|
115
|
+
* that has upgraded the document's schema to include those optional fields.
|
|
116
|
+
*
|
|
117
|
+
* @defaultValue `false`
|
|
118
|
+
* @remarks
|
|
119
|
+
* The advantage of enabling this option is that it allows an application ecosystem with staged rollout to more quickly
|
|
120
|
+
* upgrade documents to include schema for new optional features.
|
|
121
|
+
*
|
|
122
|
+
* However, it does come with trade-offs that applications should weigh carefully when it comes to interactions between
|
|
123
|
+
* code and documents.
|
|
124
|
+
* When opening such documents, the API presented is still determined by the view schema.
|
|
125
|
+
* This can have implications on the behavior of edits or code which uses portions of the view schema,
|
|
126
|
+
* since this may inadvertently drop data which is present in those optional fields in the document schema.
|
|
127
|
+
*
|
|
128
|
+
* Consider the following example:
|
|
129
|
+
*
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const sf = new SchemaFactory("com.example");
|
|
132
|
+
* class PersonView extends sf.object("Person", { name: sf.string }, { allowUnknownOptionalFields: true }) {}
|
|
133
|
+
* class PersonStored extends sf.object("Person", { name: sf.string, nickname: sf.optional(sf.string) }) {}
|
|
134
|
+
*
|
|
135
|
+
* // Say we have a document which uses `PersonStored` in its schema, and application code constructs
|
|
136
|
+
* // a tree view using `PersonView`. If the application for some reason had implemented a function like this:
|
|
137
|
+
* function clonePerson(a: PersonView): PersonView {
|
|
138
|
+
* return new PersonView({ name: a.name });
|
|
139
|
+
* }
|
|
140
|
+
* // ...or even like this:
|
|
141
|
+
* function clonePerson(a: PersonView): PersonView {
|
|
142
|
+
* return new PersonView({ ...a})
|
|
143
|
+
* }
|
|
144
|
+
* // Then the alleged clone wouldn't actually clone the entire person in either case, it would drop the nickname.
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* If an application wants to be particularly careful to preserve all data on a node when editing it, it can use
|
|
148
|
+
* {@link TreeAlpha.(importVerbose:2)|import}/{@link TreeAlpha.(exportVerbose:2)|export} APIs with persistent keys.
|
|
149
|
+
*
|
|
150
|
+
* Note that public API methods which operate on entire nodes (such as `moveTo`, `moveToEnd`, etc. on arrays) do not encounter
|
|
151
|
+
* this problem as SharedTree's implementation stores the entire node in its lower layers. It's only when application code
|
|
152
|
+
* reaches into a node (either by accessing its fields, spreading it, or some other means) that this problem arises.
|
|
153
|
+
*/
|
|
154
|
+
allowUnknownOptionalFields?: boolean;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const defaultSchemaFactoryObjectOptions: Required<
|
|
158
|
+
Omit<SchemaFactoryObjectOptions, "metadata">
|
|
159
|
+
> = {
|
|
160
|
+
allowUnknownOptionalFields: false,
|
|
161
|
+
};
|
|
162
|
+
|
|
100
163
|
/**
|
|
101
164
|
* The name of a schema produced by {@link SchemaFactory}, including its optional scope prefix.
|
|
102
165
|
*
|
|
@@ -333,12 +396,19 @@ export class SchemaFactory<
|
|
|
333
396
|
true,
|
|
334
397
|
T
|
|
335
398
|
> {
|
|
336
|
-
return objectSchema(
|
|
399
|
+
return objectSchema(
|
|
400
|
+
this.scoped(name),
|
|
401
|
+
fields,
|
|
402
|
+
true,
|
|
403
|
+
defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,
|
|
404
|
+
);
|
|
337
405
|
}
|
|
338
406
|
|
|
339
407
|
/**
|
|
340
408
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
341
409
|
*
|
|
410
|
+
* @param allowedTypes - The types that may appear as values in the map.
|
|
411
|
+
*
|
|
342
412
|
* @remarks
|
|
343
413
|
* The unique identifier for this Map is defined as a function of the provided types.
|
|
344
414
|
* It is still scoped to this SchemaBuilder, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
|
|
@@ -375,6 +445,7 @@ export class SchemaFactory<
|
|
|
375
445
|
* Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
376
446
|
*
|
|
377
447
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
448
|
+
* @param allowedTypes - The types that may appear as values in the map.
|
|
378
449
|
*
|
|
379
450
|
* @example
|
|
380
451
|
* ```typescript
|
|
@@ -395,6 +466,8 @@ export class SchemaFactory<
|
|
|
395
466
|
>;
|
|
396
467
|
|
|
397
468
|
/**
|
|
469
|
+
* {@link SchemaFactory.map} implementation.
|
|
470
|
+
*
|
|
398
471
|
* @privateRemarks
|
|
399
472
|
* This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.
|
|
400
473
|
* This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload
|
|
@@ -469,12 +542,15 @@ export class SchemaFactory<
|
|
|
469
542
|
implicitlyConstructable,
|
|
470
543
|
// The current policy is customizable nodes don't get fake prototypes.
|
|
471
544
|
!customizable,
|
|
545
|
+
undefined,
|
|
472
546
|
);
|
|
473
547
|
}
|
|
474
548
|
|
|
475
549
|
/**
|
|
476
550
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
477
551
|
*
|
|
552
|
+
* @param allowedTypes - The types that may appear in the array.
|
|
553
|
+
*
|
|
478
554
|
* @remarks
|
|
479
555
|
* The identifier for this Array is defined as a function of the provided types.
|
|
480
556
|
* It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
|
|
@@ -521,6 +597,7 @@ export class SchemaFactory<
|
|
|
521
597
|
* Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
|
|
522
598
|
*
|
|
523
599
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
600
|
+
* @param allowedTypes - The types that may appear in the array.
|
|
524
601
|
*
|
|
525
602
|
* @example
|
|
526
603
|
* ```typescript
|
|
@@ -543,6 +620,8 @@ export class SchemaFactory<
|
|
|
543
620
|
>;
|
|
544
621
|
|
|
545
622
|
/**
|
|
623
|
+
* {@link SchemaFactory.array} implementation.
|
|
624
|
+
*
|
|
546
625
|
* @privateRemarks
|
|
547
626
|
* This should return TreeNodeSchemaBoth: see note on "map" implementation for details.
|
|
548
627
|
*/
|
|
@@ -726,11 +805,20 @@ export class SchemaFactory<
|
|
|
726
805
|
* `error TS2589: Type instantiation is excessively deep and possibly infinite.`
|
|
727
806
|
* which otherwise gets reported at sometimes incorrect source locations that vary based on incremental builds.
|
|
728
807
|
*/
|
|
729
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
730
808
|
public objectRecursive<
|
|
731
809
|
const Name extends TName,
|
|
732
810
|
const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,
|
|
733
|
-
>(
|
|
811
|
+
>(
|
|
812
|
+
name: Name,
|
|
813
|
+
t: T,
|
|
814
|
+
): TreeNodeSchemaClass<
|
|
815
|
+
ScopedSchemaName<TScope, Name>,
|
|
816
|
+
NodeKind.Object,
|
|
817
|
+
TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
|
|
818
|
+
object & InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
819
|
+
false,
|
|
820
|
+
T
|
|
821
|
+
> {
|
|
734
822
|
type TScopedName = ScopedSchemaName<TScope, Name>;
|
|
735
823
|
return this.object(
|
|
736
824
|
name,
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ScopedSchemaName,
|
|
8
|
+
InsertableObjectFromSchemaRecord,
|
|
9
|
+
TreeObjectNodeUnsafe,
|
|
10
|
+
InsertableObjectFromSchemaRecordUnsafe,
|
|
11
|
+
} from "../../internalTypes.js";
|
|
12
|
+
import {
|
|
13
|
+
defaultSchemaFactoryObjectOptions,
|
|
14
|
+
SchemaFactory,
|
|
15
|
+
type SchemaFactoryObjectOptions,
|
|
16
|
+
} from "./schemaFactory.js";
|
|
17
|
+
import type {
|
|
18
|
+
ImplicitAllowedTypes,
|
|
19
|
+
ImplicitFieldSchema,
|
|
20
|
+
InsertableTreeNodeFromImplicitAllowedTypes,
|
|
21
|
+
NodeSchemaOptions,
|
|
22
|
+
} from "../schemaTypes.js";
|
|
23
|
+
import { type TreeObjectNode, objectSchema } from "../objectNode.js";
|
|
24
|
+
import type { RestrictiveStringRecord } from "../../util/index.js";
|
|
25
|
+
import type { NodeKind, TreeNodeSchemaClass, WithType } from "../core/index.js";
|
|
26
|
+
import type {
|
|
27
|
+
InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
|
|
28
|
+
TreeArrayNodeUnsafe,
|
|
29
|
+
TreeMapNodeUnsafe,
|
|
30
|
+
Unenforced,
|
|
31
|
+
} from "./typesUnsafe.js";
|
|
32
|
+
import { mapSchema, type MapNodeInsertableData, type TreeMapNode } from "../mapNode.js";
|
|
33
|
+
import { arraySchema, type TreeArrayNode } from "../arrayNode.js";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* {@link SchemaFactory} with additional alpha APIs.
|
|
37
|
+
*
|
|
38
|
+
* @alpha
|
|
39
|
+
* @privateRemarks
|
|
40
|
+
*
|
|
41
|
+
* Some private methods on `SchemaFactory` are intentionally duplicated here to avoid increasing their exposure to `protected`.
|
|
42
|
+
* If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.
|
|
43
|
+
*/
|
|
44
|
+
export class SchemaFactoryAlpha<
|
|
45
|
+
out TScope extends string | undefined = string | undefined,
|
|
46
|
+
TName extends number | string = string,
|
|
47
|
+
> extends SchemaFactory<TScope, TName> {
|
|
48
|
+
private scoped2<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {
|
|
49
|
+
return (
|
|
50
|
+
this.scope === undefined ? `${name}` : `${this.scope}.${name}`
|
|
51
|
+
) as ScopedSchemaName<TScope, Name>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
56
|
+
*
|
|
57
|
+
* @param name - Unique identifier for this schema within this factory's scope.
|
|
58
|
+
* @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
|
|
59
|
+
* @param options - Additional options for the schema.
|
|
60
|
+
*/
|
|
61
|
+
public override object<
|
|
62
|
+
const Name extends TName,
|
|
63
|
+
const T extends RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
64
|
+
const TCustomMetadata = unknown,
|
|
65
|
+
>(
|
|
66
|
+
name: Name,
|
|
67
|
+
fields: T,
|
|
68
|
+
options?: SchemaFactoryObjectOptions<TCustomMetadata>,
|
|
69
|
+
): TreeNodeSchemaClass<
|
|
70
|
+
ScopedSchemaName<TScope, Name>,
|
|
71
|
+
NodeKind.Object,
|
|
72
|
+
TreeObjectNode<T, ScopedSchemaName<TScope, Name>>,
|
|
73
|
+
object & InsertableObjectFromSchemaRecord<T>,
|
|
74
|
+
true,
|
|
75
|
+
T,
|
|
76
|
+
never,
|
|
77
|
+
TCustomMetadata
|
|
78
|
+
> {
|
|
79
|
+
return objectSchema(
|
|
80
|
+
this.scoped2(name),
|
|
81
|
+
fields,
|
|
82
|
+
true,
|
|
83
|
+
options?.allowUnknownOptionalFields ??
|
|
84
|
+
defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,
|
|
85
|
+
options?.metadata,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* {@inheritdoc SchemaFactory.objectRecursive}
|
|
91
|
+
*/
|
|
92
|
+
public override objectRecursive<
|
|
93
|
+
const Name extends TName,
|
|
94
|
+
const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,
|
|
95
|
+
const TCustomMetadata = unknown,
|
|
96
|
+
>(
|
|
97
|
+
name: Name,
|
|
98
|
+
t: T,
|
|
99
|
+
options?: SchemaFactoryObjectOptions<TCustomMetadata>,
|
|
100
|
+
): TreeNodeSchemaClass<
|
|
101
|
+
ScopedSchemaName<TScope, Name>,
|
|
102
|
+
NodeKind.Object,
|
|
103
|
+
TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
|
|
104
|
+
object & InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
105
|
+
false,
|
|
106
|
+
T,
|
|
107
|
+
never,
|
|
108
|
+
TCustomMetadata
|
|
109
|
+
> {
|
|
110
|
+
type TScopedName = ScopedSchemaName<TScope, Name>;
|
|
111
|
+
return this.object(
|
|
112
|
+
name,
|
|
113
|
+
t as T & RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
114
|
+
options,
|
|
115
|
+
) as unknown as TreeNodeSchemaClass<
|
|
116
|
+
TScopedName,
|
|
117
|
+
NodeKind.Object,
|
|
118
|
+
TreeObjectNodeUnsafe<T, TScopedName>,
|
|
119
|
+
object & InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
120
|
+
false,
|
|
121
|
+
T,
|
|
122
|
+
never,
|
|
123
|
+
TCustomMetadata
|
|
124
|
+
>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
129
|
+
*
|
|
130
|
+
* @param name - Unique identifier for this schema within this factory's scope.
|
|
131
|
+
* @param allowedTypes - The types that may appear as values in the map.
|
|
132
|
+
* @param options - Additional options for the schema.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* class NamedMap extends factory.map("name", factory.number, {
|
|
137
|
+
* metadata: { description: "A map of numbers" }
|
|
138
|
+
* }) {}
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
public mapAlpha<
|
|
142
|
+
Name extends TName,
|
|
143
|
+
const T extends ImplicitAllowedTypes,
|
|
144
|
+
const TCustomMetadata = unknown,
|
|
145
|
+
>(
|
|
146
|
+
name: Name,
|
|
147
|
+
allowedTypes: T,
|
|
148
|
+
options?: NodeSchemaOptions<TCustomMetadata>,
|
|
149
|
+
): TreeNodeSchemaClass<
|
|
150
|
+
ScopedSchemaName<TScope, Name>,
|
|
151
|
+
NodeKind.Map,
|
|
152
|
+
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
153
|
+
MapNodeInsertableData<T>,
|
|
154
|
+
true,
|
|
155
|
+
T,
|
|
156
|
+
undefined,
|
|
157
|
+
TCustomMetadata
|
|
158
|
+
> {
|
|
159
|
+
return mapSchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* {@inheritDoc SchemaFactory.objectRecursive}
|
|
164
|
+
*/
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
166
|
+
public override mapRecursive<
|
|
167
|
+
Name extends TName,
|
|
168
|
+
const T extends Unenforced<ImplicitAllowedTypes>,
|
|
169
|
+
const TCustomMetadata = unknown,
|
|
170
|
+
>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
|
|
171
|
+
return this.mapAlpha(
|
|
172
|
+
name,
|
|
173
|
+
allowedTypes as T & ImplicitAllowedTypes,
|
|
174
|
+
options,
|
|
175
|
+
) as unknown as TreeNodeSchemaClass<
|
|
176
|
+
ScopedSchemaName<TScope, Name>,
|
|
177
|
+
NodeKind.Map,
|
|
178
|
+
TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
179
|
+
| {
|
|
180
|
+
[Symbol.iterator](): Iterator<
|
|
181
|
+
[string, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]
|
|
182
|
+
>;
|
|
183
|
+
}
|
|
184
|
+
| {
|
|
185
|
+
readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
186
|
+
},
|
|
187
|
+
false,
|
|
188
|
+
T,
|
|
189
|
+
undefined,
|
|
190
|
+
TCustomMetadata
|
|
191
|
+
>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
|
|
196
|
+
*
|
|
197
|
+
* @param name - Unique identifier for this schema within this factory's scope.
|
|
198
|
+
* @param allowedTypes - The types that may appear in the array.
|
|
199
|
+
* @param options - Additional options for the schema.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* class NamedArray extends factory.array("name", factory.number) {}
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
public arrayAlpha<
|
|
207
|
+
const Name extends TName,
|
|
208
|
+
const T extends ImplicitAllowedTypes,
|
|
209
|
+
const TCustomMetadata = unknown,
|
|
210
|
+
>(
|
|
211
|
+
name: Name,
|
|
212
|
+
allowedTypes: T,
|
|
213
|
+
options?: NodeSchemaOptions<TCustomMetadata>,
|
|
214
|
+
): TreeNodeSchemaClass<
|
|
215
|
+
ScopedSchemaName<TScope, Name>,
|
|
216
|
+
NodeKind.Array,
|
|
217
|
+
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,
|
|
218
|
+
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
219
|
+
true,
|
|
220
|
+
T,
|
|
221
|
+
undefined,
|
|
222
|
+
TCustomMetadata
|
|
223
|
+
> {
|
|
224
|
+
return arraySchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* {@inheritDoc SchemaFactory.objectRecursive}
|
|
229
|
+
*/
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
231
|
+
public override arrayRecursive<
|
|
232
|
+
const Name extends TName,
|
|
233
|
+
const T extends Unenforced<ImplicitAllowedTypes>,
|
|
234
|
+
const TCustomMetadata = unknown,
|
|
235
|
+
>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
|
|
236
|
+
return this.arrayAlpha(
|
|
237
|
+
name,
|
|
238
|
+
allowedTypes as T & ImplicitAllowedTypes,
|
|
239
|
+
options,
|
|
240
|
+
) as unknown as TreeNodeSchemaClass<
|
|
241
|
+
ScopedSchemaName<TScope, Name>,
|
|
242
|
+
NodeKind.Array,
|
|
243
|
+
TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,
|
|
244
|
+
{
|
|
245
|
+
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
246
|
+
},
|
|
247
|
+
false,
|
|
248
|
+
T,
|
|
249
|
+
undefined,
|
|
250
|
+
TCustomMetadata
|
|
251
|
+
>;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ValueSchema } from "../../core/index.js";
|
|
7
7
|
import type { NodeKind } from "../core/index.js";
|
|
8
|
-
import type { FieldKind, FieldSchemaMetadata } from "../schemaTypes.js";
|
|
8
|
+
import type { FieldKind, FieldSchemaMetadata, NodeSchemaMetadata } from "../schemaTypes.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Base interface for all {@link SimpleNodeSchema} implementations.
|
|
@@ -20,6 +20,11 @@ export interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {
|
|
|
20
20
|
* @remarks can be used to type-switch between implementations.
|
|
21
21
|
*/
|
|
22
22
|
readonly kind: TNodeKind;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* {@inheritDoc NodeSchemaMetadata}
|
|
26
|
+
*/
|
|
27
|
+
readonly metadata?: NodeSchemaMetadata | undefined;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -30,7 +35,9 @@ export interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {
|
|
|
30
35
|
*/
|
|
31
36
|
export interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Object> {
|
|
32
37
|
/**
|
|
33
|
-
* Schemas for each of the object's fields, keyed off of schema's
|
|
38
|
+
* Schemas for each of the object's fields, keyed off of schema's keys.
|
|
39
|
+
* @remarks
|
|
40
|
+
* Depending on how this schema was exported, the string keys may be either the property keys or the stored keys.
|
|
34
41
|
*/
|
|
35
42
|
readonly fields: Record<string, SimpleFieldSchema>;
|
|
36
43
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
import { ValueSchema } from "../../core/index.js";
|
|
9
|
-
import { getOrCreate, hasSingle, type Mutable } from "../../util/index.js";
|
|
9
|
+
import { copyProperty, getOrCreate, hasSingle, type Mutable } from "../../util/index.js";
|
|
10
10
|
import type {
|
|
11
11
|
JsonArrayNodeSchema,
|
|
12
12
|
JsonFieldSchema,
|
|
@@ -100,11 +100,15 @@ function convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSch
|
|
|
100
100
|
? allowedTypes[0]
|
|
101
101
|
: { anyOf: allowedTypes };
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
const output: Mutable<JsonArrayNodeSchema> = {
|
|
104
104
|
type: "array",
|
|
105
105
|
_treeNodeSchemaKind: NodeKind.Array,
|
|
106
106
|
items,
|
|
107
107
|
};
|
|
108
|
+
|
|
109
|
+
copyProperty(schema.metadata, "description", output);
|
|
110
|
+
|
|
111
|
+
return output;
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
function convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {
|
|
@@ -137,9 +141,9 @@ function convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema
|
|
|
137
141
|
function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNodeSchema {
|
|
138
142
|
const properties: Record<string, JsonFieldSchema> = {};
|
|
139
143
|
const required: string[] = [];
|
|
140
|
-
for (const [key,
|
|
144
|
+
for (const [key, fieldSchema] of Object.entries(schema.fields)) {
|
|
141
145
|
const allowedTypes: JsonSchemaRef[] = [];
|
|
142
|
-
for (const allowedType of
|
|
146
|
+
for (const allowedType of fieldSchema.allowedTypes) {
|
|
143
147
|
allowedTypes.push(createSchemaRef(allowedType));
|
|
144
148
|
}
|
|
145
149
|
|
|
@@ -149,24 +153,25 @@ function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNode
|
|
|
149
153
|
anyOf: allowedTypes,
|
|
150
154
|
};
|
|
151
155
|
|
|
152
|
-
|
|
153
|
-
if (value.metadata?.description !== undefined) {
|
|
154
|
-
output.description = value.metadata.description;
|
|
155
|
-
}
|
|
156
|
-
|
|
156
|
+
copyProperty(fieldSchema.metadata, "description", output);
|
|
157
157
|
properties[key] = output;
|
|
158
158
|
|
|
159
|
-
if (
|
|
159
|
+
if (fieldSchema.kind === FieldKind.Required) {
|
|
160
160
|
required.push(key);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
|
|
164
|
+
const transformedNode: Mutable<JsonObjectNodeSchema> = {
|
|
164
165
|
type: "object",
|
|
165
166
|
_treeNodeSchemaKind: NodeKind.Object,
|
|
166
167
|
properties,
|
|
167
168
|
required,
|
|
168
169
|
additionalProperties: false,
|
|
169
170
|
};
|
|
171
|
+
|
|
172
|
+
copyProperty(schema.metadata, "description", transformedNode);
|
|
173
|
+
|
|
174
|
+
return transformedNode;
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
@@ -174,7 +179,8 @@ function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
|
174
179
|
schema.allowedTypes.forEach((type) => {
|
|
175
180
|
allowedTypes.push(createSchemaRef(type));
|
|
176
181
|
});
|
|
177
|
-
|
|
182
|
+
|
|
183
|
+
const output: Mutable<JsonMapNodeSchema> = {
|
|
178
184
|
type: "object",
|
|
179
185
|
_treeNodeSchemaKind: NodeKind.Map,
|
|
180
186
|
patternProperties: {
|
|
@@ -185,6 +191,10 @@ function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
|
185
191
|
},
|
|
186
192
|
},
|
|
187
193
|
};
|
|
194
|
+
|
|
195
|
+
copyProperty(schema.metadata, "description", output);
|
|
196
|
+
|
|
197
|
+
return output;
|
|
188
198
|
}
|
|
189
199
|
|
|
190
200
|
function createSchemaRef(schemaId: string): JsonSchemaRef {
|