@fluidframework/tree 2.30.0 → 2.31.1
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 +1632 -1500
- package/api-extractor/api-extractor.current.json +0 -3
- package/api-report/tree.alpha.api.md +233 -88
- package/api-report/tree.beta.api.md +86 -61
- package/api-report/tree.legacy.alpha.api.md +86 -61
- package/api-report/tree.legacy.public.api.md +86 -61
- package/api-report/tree.public.api.md +86 -61
- package/dist/alpha.d.ts +26 -1
- package/dist/beta.d.ts +5 -1
- package/dist/codec/codec.d.ts +1 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +3 -4
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/discriminatedUnions.d.ts.map +1 -1
- package/dist/codec/discriminatedUnions.js +1 -1
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/core/rebase/utils.js +1 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +4 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +8 -4
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +4 -4
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/treeTextFormat.js +2 -2
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -8
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -4
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js +15 -15
- package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +4 -4
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -19
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +1 -2
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +3 -3
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +4 -4
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +4 -4
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +2 -3
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +2 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +16 -17
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +1 -1
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -1
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +4 -5
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +15 -16
- package/dist/jsonDomainSchema.d.ts.map +1 -1
- package/dist/jsonDomainSchema.js +10 -5
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/legacy.d.ts +5 -1
- 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 +5 -1
- package/dist/serializableDomainSchema.d.ts +8 -14
- package/dist/serializableDomainSchema.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +16 -12
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts +6 -2
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeApiAlpha.js +20 -17
- package/dist/shared-tree/treeApiAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +4 -3
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +2 -2
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +37 -31
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/sharedTreeAttributes.d.ts +18 -0
- package/dist/sharedTreeAttributes.d.ts.map +1 -0
- package/dist/sharedTreeAttributes.js +25 -0
- package/dist/sharedTreeAttributes.js.map +1 -0
- package/dist/simple-tree/api/customTree.js +3 -3
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +10 -0
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +10 -0
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.d.ts +13 -43
- package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js +13 -43
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +2 -2
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +100 -58
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +65 -133
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +31 -23
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +17 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +4 -4
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +26 -15
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +7 -6
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +4 -3
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/dist/simple-tree/api/tree.d.ts +1 -1
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +6 -6
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +3 -3
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +87 -21
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js +0 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +4 -4
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/view.d.ts.map +1 -1
- package/dist/simple-tree/api/view.js +16 -17
- package/dist/simple-tree/api/view.js.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +70 -147
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +5 -4
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +13 -9
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/arrayNodeTypes.d.ts +46 -0
- package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -0
- package/dist/simple-tree/arrayNodeTypes.js +30 -0
- package/dist/simple-tree/arrayNodeTypes.js.map +1 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +1 -11
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -2
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -3
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +12 -5
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +36 -20
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +14 -7
- 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/core/unhydratedFlexTree.js +5 -5
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/index.d.ts +9 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +9 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +22 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +2 -0
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +3 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +5 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/mapNodeTypes.d.ts +46 -0
- package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -0
- package/dist/simple-tree/mapNodeTypes.js +30 -0
- package/dist/simple-tree/mapNodeTypes.js.map +1 -0
- package/dist/simple-tree/objectNode.d.ts +10 -3
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +10 -5
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +9 -5
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js +3 -0
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/proxies.js +2 -1
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +47 -6
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +40 -4
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +54 -30
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
- package/dist/simple-tree/simpleSchema.js.map +1 -0
- package/dist/simple-tree/toMapTree.js +3 -3
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +1 -1
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +4 -5
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/treeFactory.d.ts +0 -12
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +5 -21
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +1 -2
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeCheck.d.ts +7 -0
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +0 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +1 -4
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +26 -1
- package/lib/beta.d.ts +5 -1
- package/lib/codec/codec.d.ts +1 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +1 -2
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/discriminatedUnions.d.ts.map +1 -1
- package/lib/codec/discriminatedUnions.js +2 -2
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/core/rebase/utils.js +1 -1
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +4 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +6 -2
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +2 -2
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/treeTextFormat.js +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +2 -2
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +2 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +1 -2
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +2 -2
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +2 -2
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +2 -2
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +2 -2
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js +1 -2
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +2 -2
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +2 -1
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +1 -2
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +2 -2
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +2 -2
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +1 -2
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +15 -16
- package/lib/jsonDomainSchema.d.ts.map +1 -1
- package/lib/jsonDomainSchema.js +11 -6
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/legacy.d.ts +5 -1
- 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 +5 -1
- package/lib/serializableDomainSchema.d.ts +8 -14
- package/lib/serializableDomainSchema.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +2 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +14 -10
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts +6 -2
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeApiAlpha.js +10 -7
- package/lib/shared-tree/treeApiAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +2 -2
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +4 -3
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +2 -2
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +35 -29
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/sharedTreeAttributes.d.ts +18 -0
- package/lib/sharedTreeAttributes.d.ts.map +1 -0
- package/lib/sharedTreeAttributes.js +22 -0
- package/lib/sharedTreeAttributes.js.map +1 -0
- package/lib/simple-tree/api/customTree.js +2 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +10 -0
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js +10 -0
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.d.ts +13 -43
- package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js +13 -43
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +100 -58
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +64 -132
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +31 -23
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +18 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +4 -4
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +21 -10
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +2 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/lib/simple-tree/api/tree.d.ts +1 -1
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +2 -2
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +2 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +87 -21
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js +0 -1
- package/lib/simple-tree/api/typesUnsafe.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.map +1 -1
- package/lib/simple-tree/api/view.js +1 -2
- package/lib/simple-tree/api/view.js.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +69 -146
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +5 -4
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +7 -3
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/arrayNodeTypes.d.ts +46 -0
- package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -0
- package/lib/simple-tree/arrayNodeTypes.js +26 -0
- package/lib/simple-tree/arrayNodeTypes.js.map +1 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js +2 -12
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -2
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +12 -5
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +28 -14
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +14 -7
- 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/core/unhydratedFlexTree.js +2 -2
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/index.d.ts +9 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +3 -0
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +22 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +2 -0
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +3 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +5 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/mapNodeTypes.d.ts +46 -0
- package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -0
- package/lib/simple-tree/mapNodeTypes.js +26 -0
- package/lib/simple-tree/mapNodeTypes.js.map +1 -0
- package/lib/simple-tree/objectNode.d.ts +10 -3
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +10 -5
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +9 -5
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js +3 -0
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/proxies.js +2 -1
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +47 -6
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +37 -3
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +54 -30
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
- package/lib/simple-tree/simpleSchema.js.map +1 -0
- package/lib/simple-tree/toMapTree.js +2 -2
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +2 -2
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +1 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/treeFactory.d.ts +0 -12
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +1 -17
- package/lib/treeFactory.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +1 -2
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeCheck.d.ts +7 -0
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +0 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +0 -2
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -25
- package/src/codec/codec.ts +2 -2
- package/src/codec/discriminatedUnions.ts +2 -2
- package/src/core/rebase/utils.ts +1 -1
- package/src/core/schema-stored/schema.ts +6 -2
- package/src/core/tree/anchorSet.ts +1 -2
- package/src/core/tree/treeTextFormat.ts +1 -1
- package/src/feature-libraries/chunked-forest/basicChunk.ts +2 -2
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -2
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -2
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +1 -2
- package/src/feature-libraries/flex-tree/lazyField.ts +2 -2
- package/src/feature-libraries/flex-tree/lazyNode.ts +2 -2
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -2
- package/src/feature-libraries/modular-schema/comparison.ts +2 -2
- package/src/feature-libraries/modular-schema/isNeverTree.ts +1 -2
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1 -2
- package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +2 -2
- package/src/feature-libraries/object-forest/objectForest.ts +1 -2
- package/src/feature-libraries/schema-index/codec.ts +2 -1
- package/src/feature-libraries/sequence-field/compose.ts +2 -2
- package/src/feature-libraries/sequence-field/invert.ts +2 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +2 -2
- package/src/feature-libraries/sequence-field/utils.ts +2 -2
- package/src/feature-libraries/treeCursorUtils.ts +1 -2
- package/src/index.ts +26 -3
- package/src/jsonDomainSchema.ts +30 -11
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizeTree.ts +2 -2
- package/src/shared-tree/sharedTree.ts +16 -10
- package/src/shared-tree/sharedTreeChangeFamily.ts +1 -2
- package/src/shared-tree/treeApiAlpha.ts +36 -13
- package/src/shared-tree/treeCheckout.ts +2 -8
- package/src/shared-tree-core/branch.ts +5 -3
- package/src/shared-tree-core/editManager.ts +37 -45
- package/src/sharedTreeAttributes.ts +25 -0
- package/src/simple-tree/api/customTree.ts +2 -2
- package/src/simple-tree/api/getJsonSchema.ts +10 -0
- package/src/simple-tree/api/getSimpleSchema.ts +14 -44
- package/src/simple-tree/api/index.ts +7 -11
- package/src/simple-tree/api/schemaCreationUtilities.ts +1 -2
- package/src/simple-tree/api/schemaFactory.ts +161 -86
- package/src/simple-tree/api/schemaFactoryAlpha.ts +62 -67
- package/src/simple-tree/api/schemaFactoryRecursive.ts +44 -12
- package/src/simple-tree/api/schemaFromSimple.ts +41 -13
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -7
- package/src/simple-tree/api/simpleTreeIndex.ts +2 -1
- package/src/simple-tree/api/tree.ts +3 -3
- package/src/simple-tree/api/treeNodeApi.ts +2 -2
- package/src/simple-tree/api/typesUnsafe.ts +151 -33
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +1 -2
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -185
- package/src/simple-tree/arrayNode.ts +20 -14
- package/src/simple-tree/arrayNodeTypes.ts +93 -0
- package/src/simple-tree/core/getOrCreateNode.ts +3 -13
- package/src/simple-tree/core/index.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +32 -18
- package/src/simple-tree/core/treeNodeSchema.ts +14 -8
- package/src/simple-tree/core/unhydratedFlexTree.ts +2 -2
- package/src/simple-tree/index.ts +30 -9
- package/src/simple-tree/leafNodeSchema.ts +28 -7
- package/src/simple-tree/mapNode.ts +13 -11
- package/src/simple-tree/mapNodeTypes.ts +90 -0
- package/src/simple-tree/objectNode.ts +37 -13
- package/src/simple-tree/objectNodeTypes.ts +21 -16
- package/src/simple-tree/proxies.ts +2 -2
- package/src/simple-tree/schemaTypes.ts +83 -19
- package/src/simple-tree/{api/simpleSchema.ts → simpleSchema.ts} +61 -32
- package/src/simple-tree/toMapTree.ts +2 -2
- package/src/simple-tree/toStoredSchema.ts +2 -2
- package/src/simple-tree/treeNodeValid.ts +1 -2
- package/src/treeFactory.ts +1 -19
- package/src/util/idAllocator.ts +1 -3
- package/src/util/index.ts +0 -1
- package/src/util/typeCheck.ts +7 -0
- package/src/util/utils.ts +0 -3
- package/dist/simple-tree/api/simpleSchema.d.ts.map +0 -1
- package/dist/simple-tree/api/simpleSchema.js.map +0 -1
- package/dist/simple-tree/core/schemaCaching.d.ts +0 -16
- package/dist/simple-tree/core/schemaCaching.d.ts.map +0 -1
- package/dist/simple-tree/core/schemaCaching.js +0 -32
- package/dist/simple-tree/core/schemaCaching.js.map +0 -1
- package/lib/simple-tree/api/simpleSchema.d.ts.map +0 -1
- package/lib/simple-tree/api/simpleSchema.js.map +0 -1
- package/lib/simple-tree/core/schemaCaching.d.ts +0 -16
- package/lib/simple-tree/core/schemaCaching.d.ts.map +0 -1
- package/lib/simple-tree/core/schemaCaching.js +0 -27
- package/lib/simple-tree/core/schemaCaching.js.map +0 -1
- package/prettier.config.cjs +0 -8
- package/src/simple-tree/core/schemaCaching.ts +0 -35
- /package/dist/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
- /package/lib/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { TreeLeafValue } from "../schemaTypes.js";
|
|
7
|
+
import type { SimpleNodeSchemaBase } from "../simpleSchema.js";
|
|
7
8
|
import type { InternalTreeNode, TreeNode, Unhydrated } from "./types.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -18,6 +19,13 @@ import type { InternalTreeNode, TreeNode, Unhydrated } from "./types.js";
|
|
|
18
19
|
* Captures the schema both as runtime data and compile time type information.
|
|
19
20
|
* Use {@link SchemaFactory} to define schema.
|
|
20
21
|
* Use `Tree.schema(value)` to lookup the schema for a {@link TreeNode} or {@link TreeLeafValue}.
|
|
22
|
+
* @privateRemarks
|
|
23
|
+
* TODO:
|
|
24
|
+
* The long lists of type parameters here are awkward to deal with.
|
|
25
|
+
* Switching to (or adding an option to use)
|
|
26
|
+
* an interface based pattern with unordered named parameters for types like this would be a good idea.
|
|
27
|
+
* The related `@system` types should be simple to port to the new pattern, but stable public one like this will need to support both:
|
|
28
|
+
* the new one could either be added as a system type, or be recommended to replace this one (deprecating it).
|
|
21
29
|
* @sealed @public
|
|
22
30
|
*/
|
|
23
31
|
export type TreeNodeSchema<
|
|
@@ -81,6 +89,8 @@ export type TreeNodeSchemaNonClass<
|
|
|
81
89
|
? {
|
|
82
90
|
/**
|
|
83
91
|
* Constructs an {@link Unhydrated} node with this schema.
|
|
92
|
+
* @privateRemarks
|
|
93
|
+
* Also allows InternalTreeNode.
|
|
84
94
|
* @sealed
|
|
85
95
|
*/
|
|
86
96
|
create(data?: TInsertable | TConstructorExtra): TNode;
|
|
@@ -88,6 +98,8 @@ export type TreeNodeSchemaNonClass<
|
|
|
88
98
|
: {
|
|
89
99
|
/**
|
|
90
100
|
* Constructs an {@link Unhydrated} node with this schema.
|
|
101
|
+
* @privateRemarks
|
|
102
|
+
* Also allows InternalTreeNode.
|
|
91
103
|
* @sealed
|
|
92
104
|
*/
|
|
93
105
|
create(data: TInsertable | TConstructorExtra): TNode;
|
|
@@ -227,7 +239,7 @@ export interface TreeNodeSchemaCore<
|
|
|
227
239
|
out Info = unknown,
|
|
228
240
|
out TInsertable = never,
|
|
229
241
|
out TCustomMetadata = unknown,
|
|
230
|
-
> {
|
|
242
|
+
> extends SimpleNodeSchemaBase<Kind, TCustomMetadata> {
|
|
231
243
|
/**
|
|
232
244
|
* Unique (within a document's schema) identifier used to associate nodes with their schema.
|
|
233
245
|
* @remarks
|
|
@@ -239,7 +251,6 @@ export interface TreeNodeSchemaCore<
|
|
|
239
251
|
* it is best practice to pick a new identifier.
|
|
240
252
|
*/
|
|
241
253
|
readonly identifier: Name;
|
|
242
|
-
readonly kind: Kind;
|
|
243
254
|
|
|
244
255
|
/**
|
|
245
256
|
* Data used to define this schema.
|
|
@@ -283,11 +294,6 @@ export interface TreeNodeSchemaCore<
|
|
|
283
294
|
*/
|
|
284
295
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
285
296
|
|
|
286
|
-
/**
|
|
287
|
-
* User-provided {@link NodeSchemaMetadata} for this schema.
|
|
288
|
-
*/
|
|
289
|
-
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
290
|
-
|
|
291
297
|
/**
|
|
292
298
|
* Constructs an instance of this node type.
|
|
293
299
|
* @remarks
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, oob } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, oob, fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
8
8
|
import type { Listenable } from "@fluidframework/core-interfaces";
|
|
9
9
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
type TreeStoredSchema,
|
|
26
26
|
type Value,
|
|
27
27
|
} from "../../core/index.js";
|
|
28
|
-
import { brand,
|
|
28
|
+
import { brand, getOrCreate, mapIterable } from "../../util/index.js";
|
|
29
29
|
import {
|
|
30
30
|
type FlexTreeContext,
|
|
31
31
|
FlexTreeEntityKind,
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -57,14 +57,6 @@ export {
|
|
|
57
57
|
type IdentifierIndex,
|
|
58
58
|
createSimpleTreeIndex,
|
|
59
59
|
createIdentifierIndex,
|
|
60
|
-
type SimpleNodeSchemaBase,
|
|
61
|
-
type SimpleTreeSchema,
|
|
62
|
-
type SimpleNodeSchema,
|
|
63
|
-
type SimpleFieldSchema,
|
|
64
|
-
type SimpleLeafNodeSchema,
|
|
65
|
-
type SimpleMapNodeSchema,
|
|
66
|
-
type SimpleArrayNodeSchema,
|
|
67
|
-
type SimpleObjectNodeSchema,
|
|
68
60
|
type JsonSchemaId,
|
|
69
61
|
type JsonSchemaType,
|
|
70
62
|
type JsonObjectNodeSchema,
|
|
@@ -108,8 +100,12 @@ export {
|
|
|
108
100
|
type TreeNodeSchemaClassUnsafe,
|
|
109
101
|
type TreeNodeSchemaUnsafe,
|
|
110
102
|
type AllowedTypesUnsafe,
|
|
103
|
+
type ImplicitAllowedTypesUnsafe,
|
|
104
|
+
type ImplicitFieldSchemaUnsafe,
|
|
111
105
|
type TreeNodeSchemaNonClassUnsafe,
|
|
112
106
|
type InsertableTreeNodeFromAllowedTypesUnsafe,
|
|
107
|
+
type ArrayNodeCustomizableSchemaUnsafe,
|
|
108
|
+
type MapNodeCustomizableSchemaUnsafe,
|
|
113
109
|
type TreeViewAlpha,
|
|
114
110
|
type TreeBranch,
|
|
115
111
|
type TreeBranchEvents,
|
|
@@ -124,7 +120,7 @@ export {
|
|
|
124
120
|
type CustomTreeNode,
|
|
125
121
|
type CustomTreeValue,
|
|
126
122
|
tryStoredSchemaAsArray,
|
|
127
|
-
type
|
|
123
|
+
type SchemaStatics,
|
|
128
124
|
type ITreeAlpha,
|
|
129
125
|
type TransactionConstraint,
|
|
130
126
|
type NodeInDocumentConstraint,
|
|
@@ -141,7 +137,19 @@ export {
|
|
|
141
137
|
replaceHandles,
|
|
142
138
|
replaceVerboseTreeHandles,
|
|
143
139
|
type HandleConverter,
|
|
140
|
+
type FieldSchemaAlphaUnsafe,
|
|
144
141
|
} from "./api/index.js";
|
|
142
|
+
export type {
|
|
143
|
+
SimpleTreeSchema,
|
|
144
|
+
SimpleNodeSchema,
|
|
145
|
+
SimpleFieldSchema,
|
|
146
|
+
SimpleLeafNodeSchema,
|
|
147
|
+
SimpleMapNodeSchema,
|
|
148
|
+
SimpleArrayNodeSchema,
|
|
149
|
+
SimpleObjectNodeSchema,
|
|
150
|
+
SimpleNodeSchemaBase,
|
|
151
|
+
SimpleObjectFieldSchema,
|
|
152
|
+
} from "./simpleSchema.js";
|
|
145
153
|
export {
|
|
146
154
|
type NodeFromSchema,
|
|
147
155
|
isTreeNodeSchemaClass,
|
|
@@ -154,6 +162,7 @@ export {
|
|
|
154
162
|
type AllowedTypes,
|
|
155
163
|
FieldKind,
|
|
156
164
|
FieldSchema,
|
|
165
|
+
type FieldSchemaAlpha,
|
|
157
166
|
type InsertableTreeFieldFromImplicitField,
|
|
158
167
|
type InsertableTypedNode,
|
|
159
168
|
type NodeBuilderData,
|
|
@@ -186,6 +195,16 @@ export {
|
|
|
186
195
|
IterableTreeArrayContent,
|
|
187
196
|
type ReadonlyArrayNode,
|
|
188
197
|
} from "./arrayNode.js";
|
|
198
|
+
export type {
|
|
199
|
+
ArrayNodeCustomizableSchema,
|
|
200
|
+
ArrayNodePojoEmulationSchema,
|
|
201
|
+
} from "./arrayNodeTypes.js";
|
|
202
|
+
export { ArrayNodeSchema, isArrayNodeSchema } from "./arrayNodeTypes.js";
|
|
203
|
+
export type {
|
|
204
|
+
MapNodeCustomizableSchema,
|
|
205
|
+
MapNodePojoEmulationSchema,
|
|
206
|
+
} from "./mapNodeTypes.js";
|
|
207
|
+
export { MapNodeSchema, isMapNodeSchema } from "./mapNodeTypes.js";
|
|
189
208
|
export {
|
|
190
209
|
type FieldHasDefault,
|
|
191
210
|
type InsertableObjectFromSchemaRecord,
|
|
@@ -194,6 +213,7 @@ export {
|
|
|
194
213
|
setField,
|
|
195
214
|
createUnknownOptionalFieldPolicy,
|
|
196
215
|
} from "./objectNode.js";
|
|
216
|
+
export { ObjectNodeSchema } from "./objectNodeTypes.js";
|
|
197
217
|
export type { TreeMapNode, MapNodeInsertableData } from "./mapNode.js";
|
|
198
218
|
export {
|
|
199
219
|
mapTreeFromNodeData,
|
|
@@ -209,4 +229,5 @@ export {
|
|
|
209
229
|
handleSchema,
|
|
210
230
|
nullSchema,
|
|
211
231
|
} from "./leafNodeSchema.js";
|
|
232
|
+
export type { LeafSchema } from "./leafNodeSchema.js";
|
|
212
233
|
export type { LazyItem, FlexList, FlexListToUnion, ExtractItemType } from "./flexList.js";
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
valueSchemaAllows,
|
|
13
13
|
} from "../feature-libraries/index.js";
|
|
14
14
|
import { NodeKind, type TreeNodeSchema, type TreeNodeSchemaNonClass } from "./core/index.js";
|
|
15
|
+
import type { NodeSchemaMetadata, TreeLeafValue } from "./schemaTypes.js";
|
|
16
|
+
import type { SimpleLeafNodeSchema } from "./simpleSchema.js";
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Instances of this class are schema for leaf nodes.
|
|
@@ -44,9 +46,14 @@ export class LeafNodeSchema<Name extends string, const T extends ValueSchema>
|
|
|
44
46
|
return data;
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
public readonly leafKind: ValueSchema;
|
|
50
|
+
|
|
51
|
+
public readonly metadata: NodeSchemaMetadata = {};
|
|
52
|
+
|
|
47
53
|
public constructor(name: Name, t: T) {
|
|
48
54
|
this.identifier = name;
|
|
49
55
|
this.info = t;
|
|
56
|
+
this.leafKind = t;
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
|
|
@@ -56,17 +63,31 @@ export class LeafNodeSchema<Name extends string, const T extends ValueSchema>
|
|
|
56
63
|
function makeLeaf<Name extends string, const T extends ValueSchema>(
|
|
57
64
|
name: Name,
|
|
58
65
|
t: T,
|
|
59
|
-
):
|
|
60
|
-
`com.fluidframework.leaf.${Name}`,
|
|
61
|
-
NodeKind.Leaf,
|
|
62
|
-
TreeValue<T>,
|
|
63
|
-
TreeValue<T>,
|
|
64
|
-
true
|
|
65
|
-
> {
|
|
66
|
+
): LeafSchema<Name, TreeValue<T>> & SimpleLeafNodeSchema {
|
|
66
67
|
// Names in this domain follow https://en.wikipedia.org/wiki/Reverse_domain_name_notation
|
|
67
68
|
return new LeafNodeSchema(`com.fluidframework.leaf.${name}`, t);
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
/**
|
|
72
|
+
* A {@link TreeNodeSchema} for a {@link TreeLeafValue}.
|
|
73
|
+
* @remarks
|
|
74
|
+
* This is just a more specific alias for a particular {@link TreeNodeSchemaNonClass}.
|
|
75
|
+
* It only exists to make the API (particularly errors, IntelliSense, and generated .d.ts files) more readable.
|
|
76
|
+
*
|
|
77
|
+
* See {@link SchemaFactory} and its various properties for actual leaf schema objects.
|
|
78
|
+
* @privateRemarks
|
|
79
|
+
* This is an interface so its name will show up in things like type errors instead of the fully expanded TreeNodeSchemaNonClass.
|
|
80
|
+
* @system @sealed @public
|
|
81
|
+
*/
|
|
82
|
+
export interface LeafSchema<Name extends string, T extends TreeLeafValue>
|
|
83
|
+
extends TreeNodeSchemaNonClass<
|
|
84
|
+
`com.fluidframework.leaf.${Name}`,
|
|
85
|
+
NodeKind.Leaf,
|
|
86
|
+
/* TNode */ T,
|
|
87
|
+
/* TInsertable */ T,
|
|
88
|
+
/* ImplicitlyConstructable */ true
|
|
89
|
+
> {}
|
|
90
|
+
|
|
70
91
|
// Leaf schema shared between all SchemaFactory instances.
|
|
71
92
|
export const stringSchema = makeLeaf("string", ValueSchema.String);
|
|
72
93
|
export const numberSchema = makeLeaf("number", ValueSchema.Number);
|
|
@@ -24,9 +24,7 @@ import {
|
|
|
24
24
|
getKernel,
|
|
25
25
|
type InnerNode,
|
|
26
26
|
NodeKind,
|
|
27
|
-
type TreeNodeSchemaBoth,
|
|
28
27
|
type TreeNodeSchema,
|
|
29
|
-
type WithType,
|
|
30
28
|
// eslint-disable-next-line import/no-deprecated
|
|
31
29
|
typeNameSymbol,
|
|
32
30
|
type TreeNode,
|
|
@@ -45,6 +43,7 @@ import { brand, count, type RestrictiveStringRecord } from "../util/index.js";
|
|
|
45
43
|
import { TreeNodeValid, type MostDerivedData } from "./treeNodeValid.js";
|
|
46
44
|
import type { ExclusiveMapTree } from "../core/index.js";
|
|
47
45
|
import { getUnhydratedContext } from "./createContext.js";
|
|
46
|
+
import type { MapNodeCustomizableSchema, MapNodePojoEmulationSchema } from "./mapNodeTypes.js";
|
|
48
47
|
|
|
49
48
|
/**
|
|
50
49
|
* A map of string keys to tree objects.
|
|
@@ -245,6 +244,9 @@ export function mapSchema<
|
|
|
245
244
|
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
246
245
|
) {
|
|
247
246
|
const lazyChildTypes = new Lazy(() => normalizeAllowedTypes(info));
|
|
247
|
+
const lazyAllowedTypesIdentifiers = new Lazy(
|
|
248
|
+
() => new Set([...lazyChildTypes.value].map((type) => type.identifier)),
|
|
249
|
+
);
|
|
248
250
|
|
|
249
251
|
let unhydratedContext: Context;
|
|
250
252
|
|
|
@@ -271,6 +273,10 @@ export function mapSchema<
|
|
|
271
273
|
);
|
|
272
274
|
}
|
|
273
275
|
|
|
276
|
+
public static get allowedTypesIdentifiers(): ReadonlySet<string> {
|
|
277
|
+
return lazyAllowedTypesIdentifiers.value;
|
|
278
|
+
}
|
|
279
|
+
|
|
274
280
|
protected static override constructorCached: MostDerivedData | undefined = undefined;
|
|
275
281
|
|
|
276
282
|
protected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {
|
|
@@ -286,8 +292,7 @@ export function mapSchema<
|
|
|
286
292
|
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
|
|
287
293
|
return lazyChildTypes.value;
|
|
288
294
|
}
|
|
289
|
-
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata>
|
|
290
|
-
metadata;
|
|
295
|
+
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};
|
|
291
296
|
|
|
292
297
|
// eslint-disable-next-line import/no-deprecated
|
|
293
298
|
public get [typeNameSymbol](): TName {
|
|
@@ -297,16 +302,13 @@ export function mapSchema<
|
|
|
297
302
|
return Schema.constructorCached?.constructor as unknown as typeof schemaErased;
|
|
298
303
|
}
|
|
299
304
|
}
|
|
300
|
-
const schemaErased:
|
|
305
|
+
const schemaErased: MapNodeCustomizableSchema<
|
|
301
306
|
TName,
|
|
302
|
-
NodeKind.Map,
|
|
303
|
-
TreeMapNode<T> & WithType<TName, NodeKind.Map>,
|
|
304
|
-
MapNodeInsertableData<T>,
|
|
305
|
-
ImplicitlyConstructable,
|
|
306
307
|
T,
|
|
307
|
-
|
|
308
|
+
ImplicitlyConstructable,
|
|
308
309
|
TCustomMetadata
|
|
309
|
-
>
|
|
310
|
+
> &
|
|
311
|
+
MapNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> = Schema;
|
|
310
312
|
return schemaErased;
|
|
311
313
|
}
|
|
312
314
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { MapNodeInsertableData, TreeMapNode } from "./mapNode.js";
|
|
7
|
+
import type { ImplicitAllowedTypes } from "./schemaTypes.js";
|
|
8
|
+
import {
|
|
9
|
+
NodeKind,
|
|
10
|
+
type TreeNodeSchemaClass,
|
|
11
|
+
type TreeNodeSchema,
|
|
12
|
+
type TreeNodeSchemaNonClass,
|
|
13
|
+
type WithType,
|
|
14
|
+
} from "./core/index.js";
|
|
15
|
+
|
|
16
|
+
import type { SimpleMapNodeSchema } from "./simpleSchema.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A schema for customizable {@link (TreeMapNode:interface)}s.
|
|
20
|
+
* @system @sealed @alpha
|
|
21
|
+
*/
|
|
22
|
+
export interface MapNodeCustomizableSchema<
|
|
23
|
+
out TName extends string = string,
|
|
24
|
+
in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,
|
|
25
|
+
out ImplicitlyConstructable extends boolean = true,
|
|
26
|
+
out TCustomMetadata = unknown,
|
|
27
|
+
> extends TreeNodeSchemaClass<
|
|
28
|
+
TName,
|
|
29
|
+
NodeKind.Map,
|
|
30
|
+
TreeMapNode<T> & WithType<TName, NodeKind.Map, T>,
|
|
31
|
+
MapNodeInsertableData<T>,
|
|
32
|
+
ImplicitlyConstructable,
|
|
33
|
+
T,
|
|
34
|
+
undefined,
|
|
35
|
+
TCustomMetadata
|
|
36
|
+
>,
|
|
37
|
+
SimpleMapNodeSchema<TCustomMetadata> {}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A schema for POJO emulation mode {@link (TreeMapNode:interface)}s.
|
|
41
|
+
* @system @sealed @alpha
|
|
42
|
+
*/
|
|
43
|
+
export interface MapNodePojoEmulationSchema<
|
|
44
|
+
out TName extends string = string,
|
|
45
|
+
in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,
|
|
46
|
+
out ImplicitlyConstructable extends boolean = true,
|
|
47
|
+
out TCustomMetadata = unknown,
|
|
48
|
+
> extends TreeNodeSchemaNonClass<
|
|
49
|
+
TName,
|
|
50
|
+
NodeKind.Map,
|
|
51
|
+
TreeMapNode<T> & WithType<TName, NodeKind.Map, T>,
|
|
52
|
+
MapNodeInsertableData<T>,
|
|
53
|
+
ImplicitlyConstructable,
|
|
54
|
+
T,
|
|
55
|
+
undefined,
|
|
56
|
+
TCustomMetadata
|
|
57
|
+
>,
|
|
58
|
+
SimpleMapNodeSchema<TCustomMetadata> {}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A schema for {@link (TreeMapNode:interface)}s.
|
|
62
|
+
* @privateRemarks
|
|
63
|
+
* This could have generic arguments added and forwarded.
|
|
64
|
+
* The expected use-cases for this don't need them however, and if they did want an argument it would probably be the allowed types;
|
|
65
|
+
* perhaps if moving to an order independent way to pass generic arguments, adding support for them here would make sense.
|
|
66
|
+
* @alpha
|
|
67
|
+
*/
|
|
68
|
+
export type MapNodeSchema = MapNodeCustomizableSchema | MapNodePojoEmulationSchema;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @alpha
|
|
72
|
+
*/
|
|
73
|
+
export const MapNodeSchema = {
|
|
74
|
+
/**
|
|
75
|
+
* instanceof-based narrowing support for MapNodeSchema in Javascript and TypeScript 5.3 or newer.
|
|
76
|
+
*/
|
|
77
|
+
[Symbol.hasInstance](value: TreeNodeSchema): value is MapNodeSchema {
|
|
78
|
+
return isMapNodeSchema(value);
|
|
79
|
+
},
|
|
80
|
+
} as const;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Narrows a {@link (TreeNodeSchema:interface)} to an {@link (MapNodeSchema:interface)}.
|
|
84
|
+
* @privateRemarks
|
|
85
|
+
* If at some point we want to have internal only APIs for MapNodeSchema (like done for objects),
|
|
86
|
+
* this can include those since its not the public facing API.
|
|
87
|
+
*/
|
|
88
|
+
export function isMapNodeSchema(schema: TreeNodeSchema): schema is MapNodeSchema {
|
|
89
|
+
return schema.kind === NodeKind.Map;
|
|
90
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, Lazy } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, Lazy, fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
9
|
import type { FieldKey, SchemaPolicy } from "../core/index.js";
|
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
type ImplicitAllowedTypes,
|
|
28
28
|
FieldKind,
|
|
29
29
|
type NodeSchemaMetadata,
|
|
30
|
+
type FieldSchemaAlpha,
|
|
31
|
+
ObjectFieldSchema,
|
|
30
32
|
} from "./schemaTypes.js";
|
|
31
33
|
import {
|
|
32
34
|
type TreeNodeSchema,
|
|
@@ -42,7 +44,7 @@ import {
|
|
|
42
44
|
getOrCreateInnerNode,
|
|
43
45
|
} from "./core/index.js";
|
|
44
46
|
import { mapTreeFromNodeData, type InsertableContent } from "./toMapTree.js";
|
|
45
|
-
import {
|
|
47
|
+
import type { RestrictiveStringRecord, FlattenKeys } from "../util/index.js";
|
|
46
48
|
import {
|
|
47
49
|
isObjectNodeSchema,
|
|
48
50
|
type ObjectNodeSchema,
|
|
@@ -50,16 +52,21 @@ import {
|
|
|
50
52
|
} from "./objectNodeTypes.js";
|
|
51
53
|
import { TreeNodeValid, type MostDerivedData } from "./treeNodeValid.js";
|
|
52
54
|
import { getUnhydratedContext } from "./createContext.js";
|
|
55
|
+
import type { SimpleObjectFieldSchema } from "./simpleSchema.js";
|
|
53
56
|
|
|
54
57
|
/**
|
|
55
58
|
* Generates the properties for an ObjectNode from its field schema object.
|
|
56
59
|
* @system @public
|
|
57
60
|
*/
|
|
58
|
-
export type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> =
|
|
59
|
-
|
|
60
|
-
?
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
export type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> =
|
|
62
|
+
RestrictiveStringRecord<ImplicitFieldSchema> extends T
|
|
63
|
+
? // eslint-disable-next-line @typescript-eslint/ban-types
|
|
64
|
+
{}
|
|
65
|
+
: {
|
|
66
|
+
-readonly [Property in keyof T]: Property extends string
|
|
67
|
+
? TreeFieldFromImplicitField<T[Property]>
|
|
68
|
+
: unknown;
|
|
69
|
+
};
|
|
63
70
|
|
|
64
71
|
/**
|
|
65
72
|
* A {@link TreeNode} which modules a JavaScript object.
|
|
@@ -112,12 +119,21 @@ export type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSche
|
|
|
112
119
|
* To prevent extraneous properties in literals for the fields of an empty object from compiling, the empty case is special cased to produce `Record<string, never>`.
|
|
113
120
|
* More details at {@link https://mercury.com/blog/creating-an-emptyobject-type-in-typescript}.
|
|
114
121
|
*
|
|
122
|
+
* Additionally when T is exactly `RestrictiveStringRecord<ImplicitFieldSchema>` produce just `never` so that it is assignable to the insertable for any given object type.
|
|
123
|
+
*
|
|
124
|
+
* Separating `{}` from `RestrictiveStringRecord<ImplicitFieldSchema>` is a bit messy since both extend each-other despite them being very different types.
|
|
125
|
+
* A third dummy type `{ arbitraryKey: "arbitraryValue" }` is used to resolve this.
|
|
126
|
+
*
|
|
115
127
|
* @system @public
|
|
116
128
|
*/
|
|
117
129
|
export type InsertableObjectFromSchemaRecord<
|
|
118
130
|
T extends RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
119
|
-
> =
|
|
120
|
-
?
|
|
131
|
+
> = RestrictiveStringRecord<ImplicitFieldSchema> extends T
|
|
132
|
+
? { arbitraryKey: "arbitraryValue" } extends T
|
|
133
|
+
? // {} case
|
|
134
|
+
Record<string, never>
|
|
135
|
+
: // RestrictiveStringRecord<ImplicitFieldSchema> case
|
|
136
|
+
never
|
|
121
137
|
: FlattenKeys<
|
|
122
138
|
{
|
|
123
139
|
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<
|
|
@@ -366,8 +382,17 @@ export function objectSchema<
|
|
|
366
382
|
let unhydratedContext: Context;
|
|
367
383
|
|
|
368
384
|
class CustomObjectNode extends CustomObjectNodeBase<T> {
|
|
369
|
-
public static readonly fields: ReadonlyMap<
|
|
370
|
-
|
|
385
|
+
public static readonly fields: ReadonlyMap<
|
|
386
|
+
string,
|
|
387
|
+
FieldSchemaAlpha & SimpleObjectFieldSchema
|
|
388
|
+
> = new Map(
|
|
389
|
+
Array.from(flexKeyMap, ([key, value]) => [
|
|
390
|
+
key as string,
|
|
391
|
+
new ObjectFieldSchema(value.schema.kind, value.schema.allowedTypes, {
|
|
392
|
+
...value.schema.props,
|
|
393
|
+
key: getStoredKey(key as string, value.schema),
|
|
394
|
+
}),
|
|
395
|
+
]),
|
|
371
396
|
);
|
|
372
397
|
public static readonly flexKeyMap: SimpleKeyMap = flexKeyMap;
|
|
373
398
|
public static readonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string> = new Map<
|
|
@@ -467,8 +492,7 @@ export function objectSchema<
|
|
|
467
492
|
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
|
|
468
493
|
return lazyChildTypes.value;
|
|
469
494
|
}
|
|
470
|
-
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata>
|
|
471
|
-
metadata;
|
|
495
|
+
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};
|
|
472
496
|
|
|
473
497
|
// eslint-disable-next-line import/no-deprecated
|
|
474
498
|
public get [typeNameSymbol](): TName {
|
|
@@ -9,35 +9,37 @@ import type {
|
|
|
9
9
|
InsertableObjectFromSchemaRecord,
|
|
10
10
|
SimpleKeyMap,
|
|
11
11
|
} from "./objectNode.js";
|
|
12
|
-
import type { ImplicitFieldSchema,
|
|
12
|
+
import type { ImplicitFieldSchema, FieldSchemaAlpha } from "./schemaTypes.js";
|
|
13
13
|
import { NodeKind, type TreeNodeSchemaClass, type TreeNodeSchema } from "./core/index.js";
|
|
14
14
|
import type { FieldKey } from "../core/index.js";
|
|
15
|
+
import type { SimpleObjectFieldSchema, SimpleObjectNodeSchema } from "./simpleSchema.js";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* A schema for {@link TreeObjectNode}s.
|
|
18
|
-
* @
|
|
19
|
-
*
|
|
19
|
+
* @sealed
|
|
20
|
+
* @alpha
|
|
20
21
|
*/
|
|
21
22
|
export interface ObjectNodeSchema<
|
|
22
|
-
TName extends string = string,
|
|
23
|
-
T extends
|
|
23
|
+
out TName extends string = string,
|
|
24
|
+
in out T extends
|
|
24
25
|
RestrictiveStringRecord<ImplicitFieldSchema> = RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
25
26
|
ImplicitlyConstructable extends boolean = boolean,
|
|
26
|
-
TCustomMetadata = unknown,
|
|
27
|
+
out TCustomMetadata = unknown,
|
|
27
28
|
> extends TreeNodeSchemaClass<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
TName,
|
|
30
|
+
NodeKind.Object,
|
|
31
|
+
TreeObjectNode<T, TName>,
|
|
32
|
+
InsertableObjectFromSchemaRecord<T>,
|
|
33
|
+
ImplicitlyConstructable,
|
|
34
|
+
T,
|
|
35
|
+
never,
|
|
36
|
+
TCustomMetadata
|
|
37
|
+
>,
|
|
38
|
+
SimpleObjectNodeSchema<TCustomMetadata> {
|
|
37
39
|
/**
|
|
38
40
|
* From property keys to the associated schema.
|
|
39
41
|
*/
|
|
40
|
-
readonly fields: ReadonlyMap<string,
|
|
42
|
+
readonly fields: ReadonlyMap<string, FieldSchemaAlpha & SimpleObjectFieldSchema>;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -65,6 +67,9 @@ export interface ObjectNodeSchemaInternalData {
|
|
|
65
67
|
readonly allowUnknownOptionalFields: boolean;
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
/**
|
|
71
|
+
* @alpha
|
|
72
|
+
*/
|
|
68
73
|
export const ObjectNodeSchema = {
|
|
69
74
|
/**
|
|
70
75
|
* instanceof-based narrowing support for ObjectNodeSchema in Javascript and TypeScript 5.3 or newer.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
-
|
|
7
|
+
import { fail } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import {
|
|
9
9
|
EmptyKey,
|
|
10
10
|
type IForestSubscription,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
type FlexTreeRequiredField,
|
|
21
21
|
type FlexTreeOptionalField,
|
|
22
22
|
} from "../feature-libraries/index.js";
|
|
23
|
-
import { type Mutable,
|
|
23
|
+
import { type Mutable, isReadonlyArray } from "../util/index.js";
|
|
24
24
|
import {
|
|
25
25
|
getKernel,
|
|
26
26
|
type TreeNode,
|