@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
|
@@ -21,26 +21,24 @@ import type {
|
|
|
21
21
|
WithType,
|
|
22
22
|
TreeNode,
|
|
23
23
|
} from "../core/index.js";
|
|
24
|
-
import type {
|
|
24
|
+
import type { FieldSchemaAlphaUnsafe, ImplicitAllowedTypesUnsafe } from "./typesUnsafe.js";
|
|
25
25
|
|
|
26
26
|
export function createFieldSchemaUnsafe<
|
|
27
27
|
Kind extends FieldKind,
|
|
28
|
-
Types extends
|
|
28
|
+
Types extends ImplicitAllowedTypesUnsafe,
|
|
29
|
+
TCustomMetadata = unknown,
|
|
29
30
|
>(
|
|
30
31
|
kind: Kind,
|
|
31
32
|
allowedTypes: Types,
|
|
32
|
-
props
|
|
33
|
-
):
|
|
33
|
+
props?: FieldProps<TCustomMetadata>,
|
|
34
|
+
): FieldSchemaAlphaUnsafe<Kind, Types, TCustomMetadata> {
|
|
34
35
|
// At runtime, we still want this to be a FieldSchema instance, but we can't satisfy its extends clause, so just return it as an FieldSchemaUnsafe
|
|
35
|
-
return createFieldSchema(
|
|
36
|
-
kind,
|
|
37
|
-
allowedTypes as ImplicitAllowedTypes,
|
|
38
|
-
props,
|
|
39
|
-
) as FieldSchemaUnsafe<Kind, Types>;
|
|
36
|
+
return createFieldSchema(kind, allowedTypes as ImplicitAllowedTypes & Types, props);
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
40
|
* Compile time check for validity of a recursive schema.
|
|
41
|
+
* This type also serves as a central location for documenting the requirements and issues related to recursive schema.
|
|
44
42
|
*
|
|
45
43
|
* @example
|
|
46
44
|
* ```typescript
|
|
@@ -50,13 +48,37 @@ export function createFieldSchemaUnsafe<
|
|
|
50
48
|
* }
|
|
51
49
|
* ```
|
|
52
50
|
* @remarks
|
|
53
|
-
*
|
|
51
|
+
* In this context recursive schema are defined as all {@link FieldSchema} and {@link TreeNodeSchema} schema which are part of a cycle such that walking down through each {@link TreeNodeSchemaCore.childTypes} the given starting schema can be reached again.
|
|
52
|
+
* Schema referencing the recursive schema and schema they reference that are not part of a cycle are not considered recursive.
|
|
53
|
+
*
|
|
54
|
+
* TypeScript puts a lot of limitations on the typing of recursive schema.
|
|
55
|
+
* To help avoid running into these limitations and thus getting schema that do not type check (or only type checks sometimes!),
|
|
56
|
+
* {@link SchemaFactory} provides APIs (postfixed with `Recursive`) for writing recursive schema.
|
|
57
|
+
* These APIs when combined with the patterns documented below should ensure that the schema provide robust type checking.
|
|
58
|
+
* These special patterns (other than {@link LazyItem} forward references which are not recursion specific)
|
|
59
|
+
* are not required for correct runtime behavior: they exist entirely to mitigate TypeScript type checking limitations and bugs.
|
|
60
|
+
* Ideally TypeScript's type checker would be able to handle all of these cases and more, removing the need for recursive type specific guidance, rules and APIs.
|
|
61
|
+
* Currently however there are open issues preventing this:
|
|
62
|
+
* {@link https://github.com/microsoft/TypeScript/issues/59550 | 1},
|
|
63
|
+
* {@link https://github.com/microsoft/TypeScript/issues/55832 | 2},
|
|
64
|
+
* {@link https://github.com/microsoft/TypeScript/issues/55758 | 3}.
|
|
65
|
+
* Note that the proposed resolution to some of these issues is for the compiler to error rather than allow the case,
|
|
66
|
+
* so even if these are all resolved the recursive type workarounds may still be needed.
|
|
67
|
+
*
|
|
68
|
+
* # Patterns
|
|
69
|
+
*
|
|
70
|
+
* Below are patterns for how to use recursive schema.
|
|
71
|
+
*
|
|
72
|
+
* ## General Patterns
|
|
73
|
+
*
|
|
74
|
+
* When defining a recursive {@link TreeNodeSchema}, use the `*Recursive` {@link SchemaFactory} methods.
|
|
75
|
+
* The returned class should be used as the base class for the recursive schema, which should then be passed to {@link ValidateRecursiveSchema}.
|
|
76
|
+
*
|
|
77
|
+
* Using {@link ValidateRecursiveSchema} will provide compile error for some of the cases of malformed schema.
|
|
54
78
|
* This can be used to help mitigate the issue that recursive schema definitions are {@link Unenforced}.
|
|
55
79
|
* If an issue is encountered where a mistake in a recursive schema is made which produces an invalid schema but is not rejected by this checker,
|
|
56
80
|
* it should be considered a bug and this should be updated to handle that case (or have a disclaimer added to these docs that it misses that case).
|
|
57
81
|
*
|
|
58
|
-
* # Recursive Schema
|
|
59
|
-
*
|
|
60
82
|
* The non-recursive versions of the schema building methods will run into several issues when used recursively.
|
|
61
83
|
* Consider the following example:
|
|
62
84
|
*
|
|
@@ -110,12 +132,22 @@ export function createFieldSchemaUnsafe<
|
|
|
110
132
|
* }
|
|
111
133
|
* ```
|
|
112
134
|
*
|
|
135
|
+
* ## Object Schema
|
|
136
|
+
*
|
|
137
|
+
* When defining fields, if the fields is part of the recursive cycle, use the `*Recursive` {@link SchemaFactory} methods for defining the {@link FieldSchema}.
|
|
138
|
+
*
|
|
139
|
+
* ## Array Schema
|
|
140
|
+
*
|
|
141
|
+
* See {@link FixRecursiveArraySchema} for array specific details.
|
|
142
|
+
*
|
|
113
143
|
* @privateRemarks
|
|
114
144
|
* There are probably mistakes this misses: it's hard to guess all the wrong things people will accidentally do and defend against them.
|
|
115
145
|
* Hopefully over time this can grow toward being robust, at least for common mistakes.
|
|
116
146
|
*
|
|
117
147
|
* This check duplicates logic that ideally would be entirely decided by the actual schema building methods.
|
|
118
148
|
* Therefore changes to those methods may require updating `ValidateRecursiveSchema`.
|
|
149
|
+
*
|
|
150
|
+
* TODO: this currently does not reject `any`, but ideally should.
|
|
119
151
|
* @public
|
|
120
152
|
*/
|
|
121
153
|
export type ValidateRecursiveSchema<
|
|
@@ -3,14 +3,23 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import { fail } from "../../util/index.js";
|
|
6
|
+
import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
8
7
|
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
9
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
type FieldSchema,
|
|
10
|
+
type AllowedTypes,
|
|
11
|
+
type FieldSchemaAlpha,
|
|
12
|
+
FieldKind,
|
|
13
|
+
} from "../schemaTypes.js";
|
|
10
14
|
import { SchemaFactory } from "./schemaFactory.js";
|
|
11
|
-
import type {
|
|
15
|
+
import type {
|
|
16
|
+
SimpleFieldSchema,
|
|
17
|
+
SimpleNodeSchema,
|
|
18
|
+
SimpleTreeSchema,
|
|
19
|
+
} from "../simpleSchema.js";
|
|
20
|
+
import { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
|
|
12
21
|
|
|
13
|
-
const factory = new
|
|
22
|
+
const factory = new SchemaFactoryAlpha(undefined);
|
|
14
23
|
|
|
15
24
|
/**
|
|
16
25
|
* Create {@link FieldSchema} from a SimpleTreeSchema.
|
|
@@ -21,9 +30,9 @@ const factory = new SchemaFactory(undefined);
|
|
|
21
30
|
* will produce a poor TypeScript typing experience which is subject to change.
|
|
22
31
|
*
|
|
23
32
|
* Editing through a view produced using this schema can easily violate invariants other users of the document might expect and must be done with great care.
|
|
24
|
-
* @
|
|
33
|
+
* @alpha
|
|
25
34
|
*/
|
|
26
|
-
export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema):
|
|
35
|
+
export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): FieldSchemaAlpha {
|
|
27
36
|
const context: Context = new Map(
|
|
28
37
|
[...simple.definitions].map(([id, schema]): [string, () => TreeNodeSchema] => [
|
|
29
38
|
id,
|
|
@@ -36,8 +45,19 @@ export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): FieldS
|
|
|
36
45
|
|
|
37
46
|
type Context = ReadonlyMap<string, () => TreeNodeSchema>;
|
|
38
47
|
|
|
39
|
-
function generateFieldSchema(simple: SimpleFieldSchema, context: Context):
|
|
40
|
-
|
|
48
|
+
function generateFieldSchema(simple: SimpleFieldSchema, context: Context): FieldSchemaAlpha {
|
|
49
|
+
const allowed = generateAllowedTypes(simple.allowedTypesIdentifiers, context);
|
|
50
|
+
// Using createFieldSchema could work, but would require setting up the default providers.
|
|
51
|
+
switch (simple.kind) {
|
|
52
|
+
case FieldKind.Identifier:
|
|
53
|
+
return SchemaFactoryAlpha.identifier({ metadata: simple.metadata });
|
|
54
|
+
case FieldKind.Optional:
|
|
55
|
+
return SchemaFactoryAlpha.optional(allowed, { metadata: simple.metadata });
|
|
56
|
+
case FieldKind.Required:
|
|
57
|
+
return SchemaFactoryAlpha.required(allowed, { metadata: simple.metadata });
|
|
58
|
+
default:
|
|
59
|
+
return unreachableCase(simple.kind);
|
|
60
|
+
}
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
function generateAllowedTypes(allowed: ReadonlySet<string>, context: Context): AllowedTypes {
|
|
@@ -48,15 +68,23 @@ function generateNode(id: string, schema: SimpleNodeSchema, context: Context): T
|
|
|
48
68
|
switch (schema.kind) {
|
|
49
69
|
case NodeKind.Object: {
|
|
50
70
|
const fields: Record<string, FieldSchema> = {};
|
|
51
|
-
for (const [key, field] of
|
|
71
|
+
for (const [key, field] of schema.fields) {
|
|
52
72
|
fields[key] = generateFieldSchema(field, context);
|
|
53
73
|
}
|
|
54
|
-
return factory.object(id, fields);
|
|
74
|
+
return factory.object(id, fields, { metadata: schema.metadata });
|
|
55
75
|
}
|
|
56
76
|
case NodeKind.Array:
|
|
57
|
-
return factory.
|
|
77
|
+
return factory.arrayAlpha(
|
|
78
|
+
id,
|
|
79
|
+
generateAllowedTypes(schema.allowedTypesIdentifiers, context),
|
|
80
|
+
{ metadata: schema.metadata },
|
|
81
|
+
);
|
|
58
82
|
case NodeKind.Map:
|
|
59
|
-
return factory.
|
|
83
|
+
return factory.mapAlpha(
|
|
84
|
+
id,
|
|
85
|
+
generateAllowedTypes(schema.allowedTypesIdentifiers, context),
|
|
86
|
+
{ metadata: schema.metadata },
|
|
87
|
+
);
|
|
60
88
|
case NodeKind.Leaf:
|
|
61
89
|
return (
|
|
62
90
|
SchemaFactory.leaves.find((leaf) => leaf.identifier === id) ??
|
|
@@ -27,7 +27,7 @@ import type {
|
|
|
27
27
|
SimpleNodeSchema,
|
|
28
28
|
SimpleObjectNodeSchema,
|
|
29
29
|
SimpleTreeSchema,
|
|
30
|
-
} from "
|
|
30
|
+
} from "../simpleSchema.js";
|
|
31
31
|
import { NodeKind } from "../core/index.js";
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -38,7 +38,7 @@ export function toJsonSchema(schema: SimpleTreeSchema): JsonTreeSchema {
|
|
|
38
38
|
const definitions = convertDefinitions(schema.definitions);
|
|
39
39
|
|
|
40
40
|
const allowedTypes: JsonSchemaRef[] = [];
|
|
41
|
-
for (const allowedType of schema.
|
|
41
|
+
for (const allowedType of schema.allowedTypesIdentifiers) {
|
|
42
42
|
allowedTypes.push(createSchemaRef(allowedType));
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -92,7 +92,7 @@ function convertNodeSchema(schema: SimpleNodeSchema): JsonNodeSchema {
|
|
|
92
92
|
|
|
93
93
|
function convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {
|
|
94
94
|
const allowedTypes: JsonSchemaRef[] = [];
|
|
95
|
-
schema.
|
|
95
|
+
schema.allowedTypesIdentifiers.forEach((type) => {
|
|
96
96
|
allowedTypes.push(createSchemaRef(type));
|
|
97
97
|
});
|
|
98
98
|
|
|
@@ -138,12 +138,12 @@ function convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNodeSchema {
|
|
141
|
+
export function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNodeSchema {
|
|
142
142
|
const properties: Record<string, JsonFieldSchema> = {};
|
|
143
143
|
const required: string[] = [];
|
|
144
|
-
for (const [key, fieldSchema] of
|
|
144
|
+
for (const [key, fieldSchema] of schema.fields) {
|
|
145
145
|
const allowedTypes: JsonSchemaRef[] = [];
|
|
146
|
-
for (const allowedType of fieldSchema.
|
|
146
|
+
for (const allowedType of fieldSchema.allowedTypesIdentifiers) {
|
|
147
147
|
allowedTypes.push(createSchemaRef(allowedType));
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -176,7 +176,7 @@ function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNode
|
|
|
176
176
|
|
|
177
177
|
function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
178
178
|
const allowedTypes: JsonSchemaRef[] = [];
|
|
179
|
-
schema.
|
|
179
|
+
schema.allowedTypesIdentifiers.forEach((type) => {
|
|
180
180
|
allowedTypes.push(createSchemaRef(type));
|
|
181
181
|
});
|
|
182
182
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { fail } from "@fluidframework/core-utils/internal";
|
|
6
7
|
import type {
|
|
7
8
|
AnchorNode,
|
|
8
9
|
FieldKey,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
type TreeIndexKey,
|
|
19
20
|
type KeyFinder,
|
|
20
21
|
} from "../../feature-libraries/index.js";
|
|
21
|
-
import { brand
|
|
22
|
+
import { brand } from "../../util/index.js";
|
|
22
23
|
import type { ImplicitFieldSchema, NodeFromSchema } from "../schemaTypes.js";
|
|
23
24
|
import { treeNodeFromAnchor, type TreeNode, type TreeNodeSchema } from "../core/index.js";
|
|
24
25
|
import { treeNodeApi } from "./treeNodeApi.js";
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
6
7
|
import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/core-interfaces";
|
|
7
8
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
9
|
|
|
@@ -32,13 +33,12 @@ import {
|
|
|
32
33
|
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
33
34
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
34
35
|
import { LeafNodeSchema } from "../leafNodeSchema.js";
|
|
35
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
36
36
|
import { isObjectNodeSchema, type ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
37
|
-
import {
|
|
37
|
+
import { getOrCreate } from "../../util/index.js";
|
|
38
38
|
import type { MakeNominal } from "../../util/index.js";
|
|
39
39
|
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
40
40
|
import type { VerboseTree } from "./verboseTree.js";
|
|
41
|
-
import type { SimpleTreeSchema } from "
|
|
41
|
+
import type { SimpleTreeSchema } from "../simpleSchema.js";
|
|
42
42
|
import type {
|
|
43
43
|
RunTransactionParams,
|
|
44
44
|
TransactionCallbackStatus,
|
|
@@ -3,11 +3,11 @@
|
|
|
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
|
|
|
8
8
|
import { EmptyKey, rootFieldKey } from "../../core/index.js";
|
|
9
9
|
import { type TreeStatus, isTreeValue, FieldKinds } from "../../feature-libraries/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { extractFromOpaque } from "../../util/index.js";
|
|
11
11
|
import {
|
|
12
12
|
type TreeLeafValue,
|
|
13
13
|
type ImplicitFieldSchema,
|
|
@@ -10,8 +10,8 @@ import type {
|
|
|
10
10
|
ApplyKindInput,
|
|
11
11
|
FieldKind,
|
|
12
12
|
FieldSchema,
|
|
13
|
+
FieldSchemaAlpha,
|
|
13
14
|
ImplicitAllowedTypes,
|
|
14
|
-
ImplicitFieldSchema,
|
|
15
15
|
TreeLeafValue,
|
|
16
16
|
} from "../schemaTypes.js";
|
|
17
17
|
import type {
|
|
@@ -22,9 +22,11 @@ import type {
|
|
|
22
22
|
InternalTreeNode,
|
|
23
23
|
TreeNodeSchema,
|
|
24
24
|
TreeNodeSchemaCore,
|
|
25
|
+
TreeNodeSchemaClass,
|
|
25
26
|
} from "../core/index.js";
|
|
26
27
|
import type { TreeArrayNode } from "../arrayNode.js";
|
|
27
28
|
import type { FlexListToUnion, LazyItem } from "../flexList.js";
|
|
29
|
+
import type { SimpleArrayNodeSchema, SimpleMapNodeSchema } from "../simpleSchema.js";
|
|
28
30
|
|
|
29
31
|
/*
|
|
30
32
|
* TODO:
|
|
@@ -52,12 +54,16 @@ export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
|
52
54
|
* {@link Unenforced} version of `ObjectFromSchemaRecord`.
|
|
53
55
|
* @remarks
|
|
54
56
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
57
|
+
* @privateRemarks
|
|
58
|
+
* This does not bother special casing `{}` since no one should make empty objects using the *Recursive APIs.
|
|
55
59
|
* @system @public
|
|
56
60
|
*/
|
|
57
61
|
export type ObjectFromSchemaRecordUnsafe<
|
|
58
|
-
T extends
|
|
62
|
+
T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,
|
|
59
63
|
> = {
|
|
60
|
-
-readonly [Property in keyof T]:
|
|
64
|
+
-readonly [Property in keyof T]: Property extends string
|
|
65
|
+
? TreeFieldFromImplicitFieldUnsafe<T[Property]>
|
|
66
|
+
: unknown;
|
|
61
67
|
};
|
|
62
68
|
|
|
63
69
|
/**
|
|
@@ -90,7 +96,15 @@ export interface TreeNodeSchemaClassUnsafe<
|
|
|
90
96
|
in TInsertable,
|
|
91
97
|
out ImplicitlyConstructable extends boolean,
|
|
92
98
|
out Info,
|
|
93
|
-
|
|
99
|
+
out TCustomMetadata = unknown,
|
|
100
|
+
> extends TreeNodeSchemaCore<
|
|
101
|
+
Name,
|
|
102
|
+
Kind,
|
|
103
|
+
ImplicitlyConstructable,
|
|
104
|
+
Info,
|
|
105
|
+
never,
|
|
106
|
+
TCustomMetadata
|
|
107
|
+
> {
|
|
94
108
|
/**
|
|
95
109
|
* Constructs an {@link Unhydrated} node with this schema.
|
|
96
110
|
* @remarks
|
|
@@ -125,9 +139,9 @@ export interface TreeNodeSchemaNonClassUnsafe<
|
|
|
125
139
|
* @system @public
|
|
126
140
|
*/
|
|
127
141
|
export type TreeObjectNodeUnsafe<
|
|
128
|
-
T extends
|
|
142
|
+
T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,
|
|
129
143
|
TypeName extends string = string,
|
|
130
|
-
> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;
|
|
144
|
+
> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
131
145
|
|
|
132
146
|
/**
|
|
133
147
|
* {@link Unenforced} version of {@link TreeFieldFromImplicitField}.
|
|
@@ -135,10 +149,10 @@ export type TreeObjectNodeUnsafe<
|
|
|
135
149
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
136
150
|
* @system @public
|
|
137
151
|
*/
|
|
138
|
-
export type TreeFieldFromImplicitFieldUnsafe<TSchema extends
|
|
152
|
+
export type TreeFieldFromImplicitFieldUnsafe<TSchema extends ImplicitFieldSchemaUnsafe> =
|
|
139
153
|
TSchema extends FieldSchemaUnsafe<infer Kind, infer Types>
|
|
140
154
|
? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind>
|
|
141
|
-
: TSchema extends
|
|
155
|
+
: TSchema extends ImplicitAllowedTypesUnsafe
|
|
142
156
|
? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema>
|
|
143
157
|
: unknown;
|
|
144
158
|
|
|
@@ -150,6 +164,35 @@ export type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<Implicit
|
|
|
150
164
|
*/
|
|
151
165
|
export type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
152
166
|
|
|
167
|
+
/**
|
|
168
|
+
* {@link Unenforced} version of {@link ImplicitAllowedTypes}.
|
|
169
|
+
* @remarks
|
|
170
|
+
* Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
171
|
+
* @privateRemarks
|
|
172
|
+
* This is similar to `Unenforced<ImplicitAllowedTypes>` in that it avoids constraining the schema
|
|
173
|
+
* (which is necessary to avoid breaking recursive types),
|
|
174
|
+
* but is superior from a safety perspective because it constrains the structure containing the schema.
|
|
175
|
+
* @system @public
|
|
176
|
+
*/
|
|
177
|
+
export type ImplicitAllowedTypesUnsafe =
|
|
178
|
+
| TreeNodeSchemaUnsafe
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments
|
|
180
|
+
| readonly LazyItem<Unenforced<TreeNodeSchema>>[];
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* {@link Unenforced} version of {@link ImplicitFieldSchema}.
|
|
184
|
+
* @remarks
|
|
185
|
+
* Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
186
|
+
* @privateRemarks
|
|
187
|
+
* This is similar to `Unenforced<ImplicitFieldSchema>` in that it avoids constraining the schema
|
|
188
|
+
* (which is necessary to avoid breaking recursive types),
|
|
189
|
+
* but is superior from a safety perspective because it constrains the structure containing the schema.
|
|
190
|
+
* @system @public
|
|
191
|
+
*/
|
|
192
|
+
export type ImplicitFieldSchemaUnsafe =
|
|
193
|
+
| FieldSchemaUnsafe<FieldKind, ImplicitAllowedTypesUnsafe>
|
|
194
|
+
| ImplicitAllowedTypesUnsafe;
|
|
195
|
+
|
|
153
196
|
/**
|
|
154
197
|
* {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.
|
|
155
198
|
* @remarks
|
|
@@ -157,7 +200,7 @@ export type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
|
157
200
|
* @system @public
|
|
158
201
|
*/
|
|
159
202
|
export type TreeNodeFromImplicitAllowedTypesUnsafe<
|
|
160
|
-
TSchema extends
|
|
203
|
+
TSchema extends ImplicitAllowedTypesUnsafe,
|
|
161
204
|
> = TSchema extends TreeNodeSchemaUnsafe
|
|
162
205
|
? NodeFromSchemaUnsafe<TSchema>
|
|
163
206
|
: TSchema extends AllowedTypesUnsafe
|
|
@@ -172,7 +215,7 @@ export type TreeNodeFromImplicitAllowedTypesUnsafe<
|
|
|
172
215
|
* @system @public
|
|
173
216
|
*/
|
|
174
217
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<
|
|
175
|
-
TSchema extends
|
|
218
|
+
TSchema extends ImplicitAllowedTypesUnsafe,
|
|
176
219
|
> = [TSchema] extends [TreeNodeSchemaUnsafe]
|
|
177
220
|
? InsertableTypedNodeUnsafe<TSchema>
|
|
178
221
|
: [TSchema] extends [AllowedTypesUnsafe]
|
|
@@ -184,14 +227,13 @@ export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<
|
|
|
184
227
|
* @see {@link Input}
|
|
185
228
|
* @system @public
|
|
186
229
|
*/
|
|
187
|
-
export type InsertableTreeNodeFromAllowedTypesUnsafe<
|
|
188
|
-
TList extends
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
: never;
|
|
230
|
+
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> =
|
|
231
|
+
TList extends readonly [
|
|
232
|
+
LazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,
|
|
233
|
+
...infer Rest extends AllowedTypesUnsafe,
|
|
234
|
+
]
|
|
235
|
+
? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest>
|
|
236
|
+
: never;
|
|
195
237
|
|
|
196
238
|
/**
|
|
197
239
|
* {@link Unenforced} version of {@link InsertableTypedNode}.
|
|
@@ -205,7 +247,7 @@ export type InsertableTreeNodeFromAllowedTypesUnsafe<
|
|
|
205
247
|
* @system @public
|
|
206
248
|
*/
|
|
207
249
|
export type InsertableTypedNodeUnsafe<
|
|
208
|
-
TSchema extends
|
|
250
|
+
TSchema extends TreeNodeSchemaUnsafe,
|
|
209
251
|
T = UnionToIntersection<TSchema>,
|
|
210
252
|
> =
|
|
211
253
|
| (T extends TreeNodeSchemaUnsafe<string, NodeKind, TreeNode | TreeLeafValue, never, true>
|
|
@@ -237,7 +279,7 @@ export type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> =
|
|
|
237
279
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
238
280
|
* @system @sealed @public
|
|
239
281
|
*/
|
|
240
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends
|
|
282
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends ImplicitAllowedTypesUnsafe>
|
|
241
283
|
extends TreeArrayNode<
|
|
242
284
|
TAllowedTypes,
|
|
243
285
|
TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,
|
|
@@ -250,7 +292,7 @@ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAl
|
|
|
250
292
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
251
293
|
* @system @sealed @public
|
|
252
294
|
*/
|
|
253
|
-
export interface TreeMapNodeUnsafe<T extends
|
|
295
|
+
export interface TreeMapNodeUnsafe<T extends ImplicitAllowedTypesUnsafe>
|
|
254
296
|
extends ReadonlyMapInlined<string, T>,
|
|
255
297
|
TreeNode {
|
|
256
298
|
/**
|
|
@@ -278,7 +320,7 @@ export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>>
|
|
|
278
320
|
* Authored by manually inlining ReadonlyMap from from the TypeScript lib which can be found by navigating to the definition of `ReadonlyMap`.
|
|
279
321
|
* @system @sealed @public
|
|
280
322
|
*/
|
|
281
|
-
export interface ReadonlyMapInlined<K, T extends
|
|
323
|
+
export interface ReadonlyMapInlined<K, T extends ImplicitAllowedTypesUnsafe> {
|
|
282
324
|
/** Returns an iterable of entries in the map. */
|
|
283
325
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
284
326
|
|
|
@@ -316,10 +358,10 @@ export interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes
|
|
|
316
358
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
317
359
|
* @system @sealed @public
|
|
318
360
|
*/
|
|
319
|
-
export type FieldHasDefaultUnsafe<T extends
|
|
361
|
+
export type FieldHasDefaultUnsafe<T extends ImplicitFieldSchemaUnsafe> =
|
|
320
362
|
T extends FieldSchemaUnsafe<
|
|
321
363
|
FieldKind.Optional | FieldKind.Identifier,
|
|
322
|
-
|
|
364
|
+
ImplicitAllowedTypesUnsafe
|
|
323
365
|
>
|
|
324
366
|
? true
|
|
325
367
|
: false;
|
|
@@ -332,18 +374,18 @@ export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> =
|
|
|
332
374
|
* @system @public
|
|
333
375
|
*/
|
|
334
376
|
export type InsertableObjectFromSchemaRecordUnsafe<
|
|
335
|
-
T extends
|
|
377
|
+
T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,
|
|
336
378
|
> = {
|
|
337
379
|
// Field might not have a default, so make it required:
|
|
338
|
-
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false
|
|
380
|
+
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property & string]> extends false
|
|
339
381
|
? Property
|
|
340
|
-
: never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
382
|
+
: never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property & string]>;
|
|
341
383
|
} & {
|
|
342
384
|
// Field might have a default, so allow optional.
|
|
343
385
|
// Note that if the field could be either, this returns boolean, causing both fields to exist, resulting in required.
|
|
344
|
-
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true
|
|
386
|
+
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property & string]> extends true
|
|
345
387
|
? Property
|
|
346
|
-
: never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
388
|
+
: never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property & string]>;
|
|
347
389
|
};
|
|
348
390
|
|
|
349
391
|
/**
|
|
@@ -354,7 +396,7 @@ export type InsertableObjectFromSchemaRecordUnsafe<
|
|
|
354
396
|
* @system @public
|
|
355
397
|
*/
|
|
356
398
|
export type InsertableTreeFieldFromImplicitFieldUnsafe<
|
|
357
|
-
TSchemaInput extends
|
|
399
|
+
TSchemaInput extends ImplicitFieldSchemaUnsafe,
|
|
358
400
|
TSchema = UnionToIntersection<TSchemaInput>,
|
|
359
401
|
> = [TSchema] extends [FieldSchemaUnsafe<infer Kind, infer Types>]
|
|
360
402
|
? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true>
|
|
@@ -366,12 +408,13 @@ export type InsertableTreeFieldFromImplicitFieldUnsafe<
|
|
|
366
408
|
* {@link Unenforced} version of {@link FieldSchema}.
|
|
367
409
|
* @remarks
|
|
368
410
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
369
|
-
* @public
|
|
411
|
+
* @system @sealed @public
|
|
370
412
|
*/
|
|
371
413
|
export interface FieldSchemaUnsafe<
|
|
372
414
|
out Kind extends FieldKind,
|
|
373
|
-
out Types extends
|
|
374
|
-
|
|
415
|
+
out Types extends ImplicitAllowedTypesUnsafe,
|
|
416
|
+
out TCustomMetadata = unknown,
|
|
417
|
+
> extends FieldSchema<Kind, any, TCustomMetadata> {
|
|
375
418
|
/**
|
|
376
419
|
* {@inheritDoc FieldSchema.kind}
|
|
377
420
|
*/
|
|
@@ -386,4 +429,79 @@ export interface FieldSchemaUnsafe<
|
|
|
386
429
|
readonly allowedTypeSet: ReadonlySet<TreeNodeSchema>;
|
|
387
430
|
}
|
|
388
431
|
|
|
432
|
+
/**
|
|
433
|
+
* {@link Unenforced} version of {@link FieldSchemaAlpha}.
|
|
434
|
+
* @remarks
|
|
435
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
436
|
+
* @system @sealed @alpha
|
|
437
|
+
*/
|
|
438
|
+
export interface FieldSchemaAlphaUnsafe<
|
|
439
|
+
out Kind extends FieldKind,
|
|
440
|
+
out Types extends ImplicitAllowedTypesUnsafe,
|
|
441
|
+
out TCustomMetadata = unknown,
|
|
442
|
+
> extends FieldSchemaAlpha<Kind, any, TCustomMetadata>,
|
|
443
|
+
FieldSchemaUnsafe<Kind, Types, TCustomMetadata> {
|
|
444
|
+
/**
|
|
445
|
+
* {@inheritDoc FieldSchema.allowedTypes}
|
|
446
|
+
*/
|
|
447
|
+
readonly allowedTypes: Types;
|
|
448
|
+
}
|
|
449
|
+
|
|
389
450
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* {@link Unenforced} version of {@link ArrayNodeCustomizableSchema}s.
|
|
454
|
+
* @remarks
|
|
455
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
456
|
+
* @sealed
|
|
457
|
+
* @alpha
|
|
458
|
+
* @system
|
|
459
|
+
*/
|
|
460
|
+
export interface ArrayNodeCustomizableSchemaUnsafe<
|
|
461
|
+
out TName extends string,
|
|
462
|
+
in out T extends ImplicitAllowedTypesUnsafe,
|
|
463
|
+
out TCustomMetadata,
|
|
464
|
+
> extends TreeNodeSchemaClass<
|
|
465
|
+
TName,
|
|
466
|
+
NodeKind.Array,
|
|
467
|
+
TreeArrayNodeUnsafe<T> & WithType<TName, NodeKind.Array, T>,
|
|
468
|
+
{
|
|
469
|
+
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
470
|
+
},
|
|
471
|
+
false,
|
|
472
|
+
T,
|
|
473
|
+
undefined,
|
|
474
|
+
TCustomMetadata
|
|
475
|
+
>,
|
|
476
|
+
SimpleArrayNodeSchema<TCustomMetadata> {}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* {@link Unenforced} version of {@link MapNodeCustomizableSchema}s.
|
|
480
|
+
* @remarks
|
|
481
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
482
|
+
* @sealed
|
|
483
|
+
* @alpha
|
|
484
|
+
* @system
|
|
485
|
+
*/
|
|
486
|
+
export interface MapNodeCustomizableSchemaUnsafe<
|
|
487
|
+
out TName extends string,
|
|
488
|
+
in out T extends ImplicitAllowedTypesUnsafe,
|
|
489
|
+
out TCustomMetadata,
|
|
490
|
+
> extends TreeNodeSchemaClass<
|
|
491
|
+
TName,
|
|
492
|
+
NodeKind.Map,
|
|
493
|
+
TreeMapNodeUnsafe<T> & WithType<TName, NodeKind.Map, T>,
|
|
494
|
+
| {
|
|
495
|
+
[Symbol.iterator](): Iterator<
|
|
496
|
+
[string, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]
|
|
497
|
+
>;
|
|
498
|
+
}
|
|
499
|
+
| {
|
|
500
|
+
readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
501
|
+
},
|
|
502
|
+
false,
|
|
503
|
+
T,
|
|
504
|
+
undefined,
|
|
505
|
+
TCustomMetadata
|
|
506
|
+
>,
|
|
507
|
+
SimpleMapNodeSchema<TCustomMetadata> {}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
8
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
|
+
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
aboveRootPlaceholder,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
type ITreeCursorSynchronous,
|
|
17
17
|
type TreeNodeSchemaIdentifier,
|
|
18
18
|
} from "../../core/index.js";
|
|
19
|
-
import { brand
|
|
19
|
+
import { brand } from "../../util/index.js";
|
|
20
20
|
import type {
|
|
21
21
|
TreeLeafValue,
|
|
22
22
|
ImplicitFieldSchema,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
6
7
|
import {
|
|
7
8
|
AdaptedViewSchema,
|
|
8
9
|
type TreeNodeStoredSchema,
|
|
@@ -11,7 +12,6 @@ import {
|
|
|
11
12
|
type TreeNodeSchemaIdentifier,
|
|
12
13
|
type TreeStoredSchema,
|
|
13
14
|
} from "../../core/index.js";
|
|
14
|
-
import { fail } from "../../util/index.js";
|
|
15
15
|
import {
|
|
16
16
|
FieldKinds,
|
|
17
17
|
type FullSchemaPolicy,
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
type ImplicitFieldSchema,
|
|
29
29
|
} from "../schemaTypes.js";
|
|
30
30
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
31
|
-
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
32
31
|
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
33
32
|
|
|
34
33
|
/**
|