@fluidframework/tree 2.30.0 → 2.31.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 +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 +36 -26
- 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
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
-
|
|
8
|
-
// which degrades the API-Extractor report quality since API-Extractor can not tell the inline import is the same as the non-inline one.
|
|
9
|
-
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
10
|
-
import type { IFluidHandle as _dummyImport } from "@fluidframework/core-interfaces";
|
|
7
|
+
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
11
8
|
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
12
9
|
|
|
13
10
|
import type { TreeValue } from "../../core/index.js";
|
|
@@ -27,6 +24,7 @@ import {
|
|
|
27
24
|
nullSchema,
|
|
28
25
|
numberSchema,
|
|
29
26
|
stringSchema,
|
|
27
|
+
type LeafSchema,
|
|
30
28
|
} from "../leafNodeSchema.js";
|
|
31
29
|
import {
|
|
32
30
|
FieldKind,
|
|
@@ -40,6 +38,7 @@ import {
|
|
|
40
38
|
getDefaultProvider,
|
|
41
39
|
type NodeSchemaOptions,
|
|
42
40
|
markSchemaMostDerived,
|
|
41
|
+
type FieldSchemaAlpha,
|
|
43
42
|
} from "../schemaTypes.js";
|
|
44
43
|
import type {
|
|
45
44
|
NodeKind,
|
|
@@ -71,7 +70,9 @@ import type {
|
|
|
71
70
|
TreeArrayNodeUnsafe,
|
|
72
71
|
TreeMapNodeUnsafe,
|
|
73
72
|
TreeObjectNodeUnsafe,
|
|
74
|
-
|
|
73
|
+
ImplicitAllowedTypesUnsafe,
|
|
74
|
+
ImplicitFieldSchemaUnsafe,
|
|
75
|
+
FieldSchemaAlphaUnsafe,
|
|
75
76
|
} from "./typesUnsafe.js";
|
|
76
77
|
import { createFieldSchemaUnsafe } from "./schemaFactoryRecursive.js";
|
|
77
78
|
import { isLazy } from "../flexList.js";
|
|
@@ -175,7 +176,7 @@ export type ScopedSchemaName<
|
|
|
175
176
|
* As a workaround, we have this type as a third place which can be linked.
|
|
176
177
|
* @system @sealed @public
|
|
177
178
|
*/
|
|
178
|
-
export
|
|
179
|
+
export interface SchemaStatics {
|
|
179
180
|
/**
|
|
180
181
|
* {@link TreeNodeSchema} for holding a JavaScript `string`.
|
|
181
182
|
*
|
|
@@ -189,7 +190,7 @@ export const schemaStatics = {
|
|
|
189
190
|
* We should be much more clear about what happens if you use problematic values.
|
|
190
191
|
* We should validate and/or normalize them when inserting content.
|
|
191
192
|
*/
|
|
192
|
-
string:
|
|
193
|
+
readonly string: LeafSchema<"string", string>;
|
|
193
194
|
|
|
194
195
|
/**
|
|
195
196
|
* {@link TreeNodeSchema} for holding a JavaScript `number`.
|
|
@@ -205,12 +206,12 @@ export const schemaStatics = {
|
|
|
205
206
|
* We should be much more clear about what happens if you use problematic values.
|
|
206
207
|
* We should validate and/or normalize them when inserting content.
|
|
207
208
|
*/
|
|
208
|
-
number:
|
|
209
|
+
readonly number: LeafSchema<"number", number>;
|
|
209
210
|
|
|
210
211
|
/**
|
|
211
212
|
* {@link TreeNodeSchema} for holding a boolean.
|
|
212
213
|
*/
|
|
213
|
-
boolean:
|
|
214
|
+
readonly boolean: LeafSchema<"boolean", boolean>;
|
|
214
215
|
|
|
215
216
|
/**
|
|
216
217
|
* {@link TreeNodeSchema} for JavaScript `null`.
|
|
@@ -220,17 +221,24 @@ export const schemaStatics = {
|
|
|
220
221
|
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
221
222
|
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
222
223
|
*/
|
|
223
|
-
null
|
|
224
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
225
|
+
readonly null: LeafSchema<"null", null>;
|
|
224
226
|
|
|
225
227
|
/**
|
|
226
228
|
* {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
|
|
227
229
|
*/
|
|
228
|
-
handle:
|
|
230
|
+
readonly handle: LeafSchema<"handle", IFluidHandle>;
|
|
229
231
|
|
|
230
232
|
/**
|
|
231
233
|
* {@link AllowedTypes} for holding any of the leaf types.
|
|
232
234
|
*/
|
|
233
|
-
leaves: [
|
|
235
|
+
readonly leaves: readonly [
|
|
236
|
+
SchemaStatics["string"],
|
|
237
|
+
SchemaStatics["number"],
|
|
238
|
+
SchemaStatics["boolean"],
|
|
239
|
+
SchemaStatics["null"],
|
|
240
|
+
SchemaStatics["handle"],
|
|
241
|
+
];
|
|
234
242
|
|
|
235
243
|
/**
|
|
236
244
|
* Make a field optional instead of the default, which is required.
|
|
@@ -241,18 +249,10 @@ export const schemaStatics = {
|
|
|
241
249
|
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
242
250
|
* See {@link FieldSchemaMetadata.custom}.
|
|
243
251
|
*/
|
|
244
|
-
optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
252
|
+
readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
245
253
|
t: T,
|
|
246
254
|
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
247
|
-
)
|
|
248
|
-
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
|
|
249
|
-
return undefined;
|
|
250
|
-
});
|
|
251
|
-
return createFieldSchema(FieldKind.Optional, t, {
|
|
252
|
-
defaultProvider: defaultOptionalProvider,
|
|
253
|
-
...props,
|
|
254
|
-
});
|
|
255
|
-
},
|
|
255
|
+
) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
256
256
|
|
|
257
257
|
/**
|
|
258
258
|
* Make a field explicitly required.
|
|
@@ -267,42 +267,115 @@ export const schemaStatics = {
|
|
|
267
267
|
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
268
268
|
* See {@link FieldSchemaMetadata.custom}.
|
|
269
269
|
*/
|
|
270
|
-
required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
270
|
+
readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
271
271
|
t: T,
|
|
272
272
|
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
273
|
-
)
|
|
274
|
-
return createFieldSchema(FieldKind.Required, t, props);
|
|
275
|
-
},
|
|
273
|
+
) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
276
274
|
|
|
277
275
|
/**
|
|
278
|
-
* {@link
|
|
276
|
+
* {@link SchemaStatics.optional} except tweaked to work better for recursive types.
|
|
279
277
|
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
280
278
|
* @remarks
|
|
281
|
-
* This version of {@link
|
|
279
|
+
* This version of {@link SchemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
282
280
|
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
283
281
|
*/
|
|
284
|
-
optionalRecursive: <
|
|
282
|
+
readonly optionalRecursive: <
|
|
283
|
+
const T extends ImplicitAllowedTypesUnsafe,
|
|
284
|
+
const TCustomMetadata = unknown,
|
|
285
|
+
>(
|
|
285
286
|
t: T,
|
|
286
|
-
props?: Omit<FieldProps
|
|
287
|
-
)
|
|
288
|
-
return createFieldSchemaUnsafe(FieldKind.Optional, t, props);
|
|
289
|
-
},
|
|
287
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
288
|
+
) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
|
|
290
289
|
|
|
291
290
|
/**
|
|
292
|
-
* {@link
|
|
291
|
+
* {@link SchemaStatics.required} except tweaked to work better for recursive types.
|
|
293
292
|
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
294
293
|
* @remarks
|
|
295
|
-
* This version of {@link
|
|
294
|
+
* This version of {@link SchemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
296
295
|
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
297
296
|
*/
|
|
298
|
-
requiredRecursive: <
|
|
297
|
+
readonly requiredRecursive: <
|
|
298
|
+
const T extends ImplicitAllowedTypesUnsafe,
|
|
299
|
+
const TCustomMetadata = unknown,
|
|
300
|
+
>(
|
|
301
|
+
t: T,
|
|
302
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
303
|
+
) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
|
|
307
|
+
return undefined;
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Implementation of {@link SchemaStatics}.
|
|
312
|
+
* @remarks
|
|
313
|
+
* Entries can use more specific types than {@link SchemaStatics} requires to be more useful for non-public consumers.
|
|
314
|
+
* Additional non-public members are in {@link schemaStatics}.
|
|
315
|
+
*/
|
|
316
|
+
export const schemaStaticsBase = {
|
|
317
|
+
string: stringSchema,
|
|
318
|
+
number: numberSchema,
|
|
319
|
+
boolean: booleanSchema,
|
|
320
|
+
null: nullSchema,
|
|
321
|
+
handle: handleSchema,
|
|
322
|
+
leaves: [stringSchema, numberSchema, booleanSchema, nullSchema, handleSchema],
|
|
323
|
+
|
|
324
|
+
optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
325
|
+
t: T,
|
|
326
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
327
|
+
): FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata> => {
|
|
328
|
+
return createFieldSchema(FieldKind.Optional, t, {
|
|
329
|
+
defaultProvider: defaultOptionalProvider,
|
|
330
|
+
...props,
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
335
|
+
t: T,
|
|
336
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
337
|
+
): FieldSchemaAlpha<FieldKind.Required, T, TCustomMetadata> => {
|
|
338
|
+
return createFieldSchema(FieldKind.Required, t, props);
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
optionalRecursive: <
|
|
342
|
+
const T extends ImplicitAllowedTypesUnsafe,
|
|
343
|
+
const TCustomMetadata = unknown,
|
|
344
|
+
>(
|
|
345
|
+
t: T,
|
|
346
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
347
|
+
): FieldSchemaAlphaUnsafe<FieldKind.Optional, T, TCustomMetadata> => {
|
|
348
|
+
return createFieldSchemaUnsafe(FieldKind.Optional, t, {
|
|
349
|
+
defaultProvider: defaultOptionalProvider,
|
|
350
|
+
...props,
|
|
351
|
+
});
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
requiredRecursive: <
|
|
355
|
+
const T extends ImplicitAllowedTypesUnsafe,
|
|
356
|
+
const TCustomMetadata = unknown,
|
|
357
|
+
>(
|
|
299
358
|
t: T,
|
|
300
|
-
props?: Omit<FieldProps
|
|
301
|
-
):
|
|
359
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
360
|
+
): FieldSchemaAlphaUnsafe<FieldKind.Required, T, TCustomMetadata> => {
|
|
302
361
|
return createFieldSchemaUnsafe(FieldKind.Required, t, props);
|
|
303
362
|
},
|
|
363
|
+
} as const satisfies SchemaStatics;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Unstable extensions to {@link schemaStaticsBase}.
|
|
367
|
+
*/
|
|
368
|
+
export const schemaStatics = {
|
|
369
|
+
...schemaStaticsBase,
|
|
370
|
+
identifier: <const TCustomMetadata = unknown>(
|
|
371
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
372
|
+
): FieldSchemaAlpha<FieldKind.Identifier, typeof stringSchema, TCustomMetadata> => {
|
|
373
|
+
return createFieldSchema(FieldKind.Identifier, stringSchema, props);
|
|
374
|
+
},
|
|
304
375
|
} as const;
|
|
305
376
|
|
|
377
|
+
const schemaStaticsPublic: SchemaStatics = schemaStatics;
|
|
378
|
+
|
|
306
379
|
// TODO:
|
|
307
380
|
// SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.
|
|
308
381
|
// API-Extractor requires such links to be qualified with the class, so it can't work.
|
|
@@ -383,7 +456,8 @@ export const schemaStatics = {
|
|
|
383
456
|
*
|
|
384
457
|
* 8. IntelliSense: Shows internal type generation logic: `object & TreeNode & ObjectFromSchemaRecord<{}> & WithType<"test.x">`.
|
|
385
458
|
*
|
|
386
|
-
* 9. Recursion: Unsupported: Generated `.d.ts` files replace recursive references with `any
|
|
459
|
+
* 9. Recursion: Unsupported: [Generated `.d.ts` files replace recursive references with `any`](https://github.com/microsoft/TypeScript/issues/55832),
|
|
460
|
+
* breaking the use of recursive schema across compilation boundaries.
|
|
387
461
|
*
|
|
388
462
|
* Note that while "POJO Emulation" nodes act a lot like POJO objects, they are not true POJO objects:
|
|
389
463
|
*
|
|
@@ -413,7 +487,8 @@ export const schemaStatics = {
|
|
|
413
487
|
export class SchemaFactory<
|
|
414
488
|
out TScope extends string | undefined = string | undefined,
|
|
415
489
|
TName extends number | string = string,
|
|
416
|
-
>
|
|
490
|
+
> implements SchemaStatics
|
|
491
|
+
{
|
|
417
492
|
/**
|
|
418
493
|
* TODO:
|
|
419
494
|
* If users of this generate the same name because two different schema with the same identifier were used,
|
|
@@ -471,64 +546,64 @@ export class SchemaFactory<
|
|
|
471
546
|
}
|
|
472
547
|
|
|
473
548
|
/**
|
|
474
|
-
* {@inheritDoc
|
|
549
|
+
* {@inheritDoc SchemaStatics.string}
|
|
475
550
|
*/
|
|
476
|
-
public readonly string =
|
|
551
|
+
public readonly string = schemaStaticsPublic.string;
|
|
477
552
|
|
|
478
553
|
/**
|
|
479
|
-
* {@inheritDoc
|
|
554
|
+
* {@inheritDoc SchemaStatics.number}
|
|
480
555
|
*/
|
|
481
|
-
public readonly number =
|
|
556
|
+
public readonly number = schemaStaticsPublic.number;
|
|
482
557
|
|
|
483
558
|
/**
|
|
484
|
-
* {@inheritDoc
|
|
559
|
+
* {@inheritDoc SchemaStatics.boolean}
|
|
485
560
|
*/
|
|
486
|
-
public readonly boolean =
|
|
561
|
+
public readonly boolean = schemaStaticsPublic.boolean;
|
|
487
562
|
|
|
488
563
|
/**
|
|
489
|
-
* {@inheritDoc
|
|
564
|
+
* {@inheritDoc SchemaStatics.null}
|
|
490
565
|
*/
|
|
491
|
-
public readonly null =
|
|
566
|
+
public readonly null = schemaStaticsPublic.null;
|
|
492
567
|
|
|
493
568
|
/**
|
|
494
|
-
* {@inheritDoc
|
|
569
|
+
* {@inheritDoc SchemaStatics.handle}
|
|
495
570
|
*/
|
|
496
|
-
public readonly handle =
|
|
571
|
+
public readonly handle = schemaStaticsPublic.handle;
|
|
497
572
|
|
|
498
573
|
/**
|
|
499
|
-
* {@inheritDoc
|
|
574
|
+
* {@inheritDoc SchemaStatics.leaves}
|
|
500
575
|
*/
|
|
501
|
-
public readonly leaves =
|
|
576
|
+
public readonly leaves = schemaStaticsPublic.leaves;
|
|
502
577
|
|
|
503
578
|
/**
|
|
504
|
-
* {@inheritDoc
|
|
579
|
+
* {@inheritDoc SchemaStatics.string}
|
|
505
580
|
*/
|
|
506
|
-
public static readonly string =
|
|
581
|
+
public static readonly string = schemaStaticsPublic.string;
|
|
507
582
|
|
|
508
583
|
/**
|
|
509
|
-
* {@inheritDoc
|
|
584
|
+
* {@inheritDoc SchemaStatics.number}
|
|
510
585
|
*/
|
|
511
|
-
public static readonly number =
|
|
586
|
+
public static readonly number = schemaStaticsPublic.number;
|
|
512
587
|
|
|
513
588
|
/**
|
|
514
|
-
* {@inheritDoc
|
|
589
|
+
* {@inheritDoc SchemaStatics.boolean}
|
|
515
590
|
*/
|
|
516
|
-
public static readonly boolean =
|
|
591
|
+
public static readonly boolean = schemaStaticsPublic.boolean;
|
|
517
592
|
|
|
518
593
|
/**
|
|
519
|
-
* {@inheritDoc
|
|
594
|
+
* {@inheritDoc SchemaStatics.null}
|
|
520
595
|
*/
|
|
521
|
-
public static readonly null =
|
|
596
|
+
public static readonly null = schemaStaticsPublic.null;
|
|
522
597
|
|
|
523
598
|
/**
|
|
524
|
-
* {@inheritDoc
|
|
599
|
+
* {@inheritDoc SchemaStatics.handle}
|
|
525
600
|
*/
|
|
526
|
-
public static readonly handle =
|
|
601
|
+
public static readonly handle = schemaStaticsPublic.handle;
|
|
527
602
|
|
|
528
603
|
/**
|
|
529
|
-
* {@inheritDoc
|
|
604
|
+
* {@inheritDoc SchemaStatics.leaves}
|
|
530
605
|
*/
|
|
531
|
-
public static readonly leaves =
|
|
606
|
+
public static readonly leaves = schemaStaticsPublic.leaves;
|
|
532
607
|
|
|
533
608
|
/**
|
|
534
609
|
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
@@ -848,44 +923,44 @@ export class SchemaFactory<
|
|
|
848
923
|
}
|
|
849
924
|
|
|
850
925
|
/**
|
|
851
|
-
* {@inheritDoc
|
|
926
|
+
* {@inheritDoc SchemaStatics.optional}
|
|
852
927
|
*/
|
|
853
|
-
public readonly optional =
|
|
928
|
+
public readonly optional = schemaStaticsPublic.optional;
|
|
854
929
|
|
|
855
930
|
/**
|
|
856
|
-
* {@inheritDoc
|
|
931
|
+
* {@inheritDoc SchemaStatics.required}
|
|
857
932
|
*/
|
|
858
|
-
public readonly required =
|
|
933
|
+
public readonly required = schemaStaticsPublic.required;
|
|
859
934
|
|
|
860
935
|
/**
|
|
861
|
-
* {@inheritDoc
|
|
936
|
+
* {@inheritDoc SchemaStatics.optionalRecursive}
|
|
862
937
|
*/
|
|
863
|
-
public readonly optionalRecursive =
|
|
938
|
+
public readonly optionalRecursive = schemaStaticsPublic.optionalRecursive;
|
|
864
939
|
|
|
865
940
|
/**
|
|
866
|
-
* {@inheritDoc
|
|
941
|
+
* {@inheritDoc SchemaStatics.requiredRecursive}
|
|
867
942
|
*/
|
|
868
|
-
public readonly requiredRecursive =
|
|
943
|
+
public readonly requiredRecursive = schemaStaticsPublic.requiredRecursive;
|
|
869
944
|
|
|
870
945
|
/**
|
|
871
|
-
* {@inheritDoc
|
|
946
|
+
* {@inheritDoc SchemaStatics.optional}
|
|
872
947
|
*/
|
|
873
|
-
public static readonly optional =
|
|
948
|
+
public static readonly optional = schemaStaticsPublic.optional;
|
|
874
949
|
|
|
875
950
|
/**
|
|
876
|
-
* {@inheritDoc
|
|
951
|
+
* {@inheritDoc SchemaStatics.required}
|
|
877
952
|
*/
|
|
878
|
-
public static readonly required =
|
|
953
|
+
public static readonly required = schemaStaticsPublic.required;
|
|
879
954
|
|
|
880
955
|
/**
|
|
881
|
-
* {@inheritDoc
|
|
956
|
+
* {@inheritDoc SchemaStatics.optionalRecursive}
|
|
882
957
|
*/
|
|
883
|
-
public static readonly optionalRecursive =
|
|
958
|
+
public static readonly optionalRecursive = schemaStaticsPublic.optionalRecursive;
|
|
884
959
|
|
|
885
960
|
/**
|
|
886
|
-
* {@inheritDoc
|
|
961
|
+
* {@inheritDoc SchemaStatics.requiredRecursive}
|
|
887
962
|
*/
|
|
888
|
-
public static readonly requiredRecursive =
|
|
963
|
+
public static readonly requiredRecursive = schemaStaticsPublic.requiredRecursive;
|
|
889
964
|
|
|
890
965
|
/**
|
|
891
966
|
* A special field which holds a unique identifier for an object node.
|
|
@@ -933,7 +1008,7 @@ export class SchemaFactory<
|
|
|
933
1008
|
*/
|
|
934
1009
|
public objectRecursive<
|
|
935
1010
|
const Name extends TName,
|
|
936
|
-
const T extends
|
|
1011
|
+
const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,
|
|
937
1012
|
>(
|
|
938
1013
|
name: Name,
|
|
939
1014
|
t: T,
|
|
@@ -967,10 +1042,10 @@ export class SchemaFactory<
|
|
|
967
1042
|
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
968
1043
|
*/
|
|
969
1044
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
970
|
-
public arrayRecursive<
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1045
|
+
public arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(
|
|
1046
|
+
name: Name,
|
|
1047
|
+
allowedTypes: T,
|
|
1048
|
+
) {
|
|
974
1049
|
const RecursiveArray = this.namedArray(
|
|
975
1050
|
name,
|
|
976
1051
|
allowedTypes as T & ImplicitAllowedTypes,
|
|
@@ -1010,7 +1085,7 @@ export class SchemaFactory<
|
|
|
1010
1085
|
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
1011
1086
|
*/
|
|
1012
1087
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
1013
|
-
public mapRecursive<Name extends TName, const T extends
|
|
1088
|
+
public mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(
|
|
1014
1089
|
name: Name,
|
|
1015
1090
|
allowedTypes: T,
|
|
1016
1091
|
) {
|
|
@@ -5,32 +5,35 @@
|
|
|
5
5
|
|
|
6
6
|
import type {
|
|
7
7
|
ScopedSchemaName,
|
|
8
|
-
InsertableObjectFromSchemaRecord,
|
|
9
8
|
TreeObjectNodeUnsafe,
|
|
10
9
|
InsertableObjectFromSchemaRecordUnsafe,
|
|
11
10
|
} from "../../internalTypes.js";
|
|
12
11
|
import {
|
|
13
12
|
defaultSchemaFactoryObjectOptions,
|
|
14
13
|
SchemaFactory,
|
|
14
|
+
schemaStatics,
|
|
15
15
|
type SchemaFactoryObjectOptions,
|
|
16
16
|
} from "./schemaFactory.js";
|
|
17
17
|
import type {
|
|
18
18
|
ImplicitAllowedTypes,
|
|
19
19
|
ImplicitFieldSchema,
|
|
20
|
-
InsertableTreeNodeFromImplicitAllowedTypes,
|
|
21
20
|
NodeSchemaOptions,
|
|
22
21
|
} from "../schemaTypes.js";
|
|
23
|
-
import {
|
|
22
|
+
import { objectSchema } from "../objectNode.js";
|
|
24
23
|
import type { RestrictiveStringRecord } from "../../util/index.js";
|
|
25
|
-
import type { NodeKind, TreeNodeSchemaClass
|
|
24
|
+
import type { NodeKind, TreeNodeSchemaClass } from "../core/index.js";
|
|
26
25
|
import type {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
ImplicitAllowedTypesUnsafe,
|
|
27
|
+
ImplicitFieldSchemaUnsafe,
|
|
28
|
+
ArrayNodeCustomizableSchemaUnsafe,
|
|
29
|
+
MapNodeCustomizableSchemaUnsafe,
|
|
31
30
|
} from "./typesUnsafe.js";
|
|
32
|
-
import { mapSchema
|
|
33
|
-
import { arraySchema
|
|
31
|
+
import { mapSchema } from "../mapNode.js";
|
|
32
|
+
import { arraySchema } from "../arrayNode.js";
|
|
33
|
+
import type { ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
34
|
+
import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
|
|
35
|
+
import type { ArrayNodeCustomizableSchema } from "../arrayNodeTypes.js";
|
|
36
|
+
import type { MapNodeCustomizableSchema } from "../mapNodeTypes.js";
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
* {@link SchemaFactory} with additional alpha APIs.
|
|
@@ -66,16 +69,7 @@ export class SchemaFactoryAlpha<
|
|
|
66
69
|
name: Name,
|
|
67
70
|
fields: T,
|
|
68
71
|
options?: SchemaFactoryObjectOptions<TCustomMetadata>,
|
|
69
|
-
):
|
|
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
|
-
> {
|
|
72
|
+
): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {
|
|
79
73
|
return objectSchema(
|
|
80
74
|
this.scoped2(name),
|
|
81
75
|
fields,
|
|
@@ -91,7 +85,7 @@ export class SchemaFactoryAlpha<
|
|
|
91
85
|
*/
|
|
92
86
|
public override objectRecursive<
|
|
93
87
|
const Name extends TName,
|
|
94
|
-
const T extends
|
|
88
|
+
const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,
|
|
95
89
|
const TCustomMetadata = unknown,
|
|
96
90
|
>(
|
|
97
91
|
name: Name,
|
|
@@ -106,7 +100,19 @@ export class SchemaFactoryAlpha<
|
|
|
106
100
|
T,
|
|
107
101
|
never,
|
|
108
102
|
TCustomMetadata
|
|
109
|
-
>
|
|
103
|
+
> &
|
|
104
|
+
SimpleObjectNodeSchema<TCustomMetadata> &
|
|
105
|
+
// We can't just use non generic `ObjectNodeSchema` here since "Base constructors must all have the same return type".
|
|
106
|
+
// We also can't just use generic `ObjectNodeSchema` here and not `TreeNodeSchemaClass` since that doesn't work with unsafe recursive types.
|
|
107
|
+
// ObjectNodeSchema<
|
|
108
|
+
// ScopedSchemaName<TScope, Name>,
|
|
109
|
+
// // T & RestrictiveStringRecord<ImplicitFieldSchema> would be nice to use here, but it breaks the recursive type self references.
|
|
110
|
+
// RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
111
|
+
// false,
|
|
112
|
+
// TCustomMetadata
|
|
113
|
+
// >
|
|
114
|
+
Pick<ObjectNodeSchema, "fields"> {
|
|
115
|
+
// TODO: syntax highting is vs code is broken here. Don't trust it. Use the compiler instead.
|
|
110
116
|
type TScopedName = ScopedSchemaName<TScope, Name>;
|
|
111
117
|
return this.object(
|
|
112
118
|
name,
|
|
@@ -121,9 +127,35 @@ export class SchemaFactoryAlpha<
|
|
|
121
127
|
T,
|
|
122
128
|
never,
|
|
123
129
|
TCustomMetadata
|
|
124
|
-
|
|
130
|
+
> &
|
|
131
|
+
ObjectNodeSchema<
|
|
132
|
+
ScopedSchemaName<TScope, Name>,
|
|
133
|
+
RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
134
|
+
false,
|
|
135
|
+
TCustomMetadata
|
|
136
|
+
>;
|
|
125
137
|
}
|
|
126
138
|
|
|
139
|
+
/**
|
|
140
|
+
* {@inheritDoc SchemaStatics.optional}
|
|
141
|
+
*/
|
|
142
|
+
public static override readonly optional = schemaStatics.optional;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* {@inheritDoc SchemaStatics.required}
|
|
146
|
+
*/
|
|
147
|
+
public static override readonly required = schemaStatics.required;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* {@inheritDoc SchemaStatics.optionalRecursive}
|
|
151
|
+
*/
|
|
152
|
+
public static override readonly optionalRecursive = schemaStatics.optionalRecursive;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.
|
|
156
|
+
*/
|
|
157
|
+
public static readonly identifier = schemaStatics.identifier;
|
|
158
|
+
|
|
127
159
|
/**
|
|
128
160
|
* Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
129
161
|
*
|
|
@@ -146,16 +178,7 @@ export class SchemaFactoryAlpha<
|
|
|
146
178
|
name: Name,
|
|
147
179
|
allowedTypes: T,
|
|
148
180
|
options?: NodeSchemaOptions<TCustomMetadata>,
|
|
149
|
-
):
|
|
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
|
-
> {
|
|
181
|
+
): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {
|
|
159
182
|
return mapSchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);
|
|
160
183
|
}
|
|
161
184
|
|
|
@@ -165,28 +188,16 @@ export class SchemaFactoryAlpha<
|
|
|
165
188
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
166
189
|
public override mapRecursive<
|
|
167
190
|
Name extends TName,
|
|
168
|
-
const T extends
|
|
191
|
+
const T extends ImplicitAllowedTypesUnsafe,
|
|
169
192
|
const TCustomMetadata = unknown,
|
|
170
193
|
>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
|
|
171
194
|
return this.mapAlpha(
|
|
172
195
|
name,
|
|
173
196
|
allowedTypes as T & ImplicitAllowedTypes,
|
|
174
197
|
options,
|
|
175
|
-
) as unknown as
|
|
198
|
+
) as unknown as MapNodeCustomizableSchemaUnsafe<
|
|
176
199
|
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
200
|
T,
|
|
189
|
-
undefined,
|
|
190
201
|
TCustomMetadata
|
|
191
202
|
>;
|
|
192
203
|
}
|
|
@@ -200,7 +211,7 @@ export class SchemaFactoryAlpha<
|
|
|
200
211
|
*
|
|
201
212
|
* @example
|
|
202
213
|
* ```typescript
|
|
203
|
-
* class NamedArray extends factory.
|
|
214
|
+
* class NamedArray extends factory.arrayAlpha("name", factory.number) {}
|
|
204
215
|
* ```
|
|
205
216
|
*/
|
|
206
217
|
public arrayAlpha<
|
|
@@ -211,16 +222,7 @@ export class SchemaFactoryAlpha<
|
|
|
211
222
|
name: Name,
|
|
212
223
|
allowedTypes: T,
|
|
213
224
|
options?: NodeSchemaOptions<TCustomMetadata>,
|
|
214
|
-
):
|
|
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
|
-
> {
|
|
225
|
+
): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {
|
|
224
226
|
return arraySchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);
|
|
225
227
|
}
|
|
226
228
|
|
|
@@ -230,23 +232,16 @@ export class SchemaFactoryAlpha<
|
|
|
230
232
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
231
233
|
public override arrayRecursive<
|
|
232
234
|
const Name extends TName,
|
|
233
|
-
const T extends
|
|
235
|
+
const T extends ImplicitAllowedTypesUnsafe,
|
|
234
236
|
const TCustomMetadata = unknown,
|
|
235
237
|
>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
|
|
236
238
|
return this.arrayAlpha(
|
|
237
239
|
name,
|
|
238
240
|
allowedTypes as T & ImplicitAllowedTypes,
|
|
239
241
|
options,
|
|
240
|
-
) as unknown as
|
|
242
|
+
) as unknown as ArrayNodeCustomizableSchemaUnsafe<
|
|
241
243
|
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
244
|
T,
|
|
249
|
-
undefined,
|
|
250
245
|
TCustomMetadata
|
|
251
246
|
>;
|
|
252
247
|
}
|