@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,226 +4,121 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import {
|
|
8
|
-
normalizeFieldSchema,
|
|
9
|
-
type FieldSchema,
|
|
10
|
-
type ImplicitAllowedTypes,
|
|
11
|
-
type ImplicitFieldSchema,
|
|
12
|
-
} from "../schemaTypes.js";
|
|
7
|
+
import { normalizeFieldSchema, type ImplicitFieldSchema } from "../schemaTypes.js";
|
|
13
8
|
import type {
|
|
14
9
|
SimpleArrayNodeSchema,
|
|
15
|
-
SimpleFieldSchema,
|
|
16
10
|
SimpleLeafNodeSchema,
|
|
17
11
|
SimpleMapNodeSchema,
|
|
18
12
|
SimpleNodeSchema,
|
|
13
|
+
SimpleObjectFieldSchema,
|
|
19
14
|
SimpleObjectNodeSchema,
|
|
20
15
|
SimpleTreeSchema,
|
|
21
|
-
} from "
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
16
|
+
} from "../simpleSchema.js";
|
|
17
|
+
import { ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
18
|
+
import { NodeKind } from "../core/index.js";
|
|
19
|
+
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
20
|
+
import { ArrayNodeSchema } from "../arrayNodeTypes.js";
|
|
21
|
+
import { LeafNodeSchema } from "../leafNodeSchema.js";
|
|
22
|
+
import { MapNodeSchema } from "../mapNodeTypes.js";
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
|
-
* Converts
|
|
25
|
+
* Converts an {@link ImplicitFieldSchema} to a "simple" schema representation.
|
|
26
|
+
*
|
|
27
|
+
* @param schema - The schema to convert
|
|
28
|
+
* @param copySchemaObjects - If true, TreeNodeSchema and FieldSchema are copied into plain JavaScript objects. Either way, custom metadata is referenced and not copied.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Given that the Schema types used in {@link ImplicitFieldSchema} already implement the {@link SimpleNodeSchema} interfaces, there are limited use-cases for this function.
|
|
32
|
+
* One possible use-case is converting schema to a more serialization friendly format.
|
|
33
|
+
* This format however is not JSON compatible due to use of Maps and Sets,
|
|
34
|
+
* but it it does not rely on cyclic object references for handling recursive schema and instead uses the `definitions` map.
|
|
35
|
+
*
|
|
36
|
+
* @privateRemarks
|
|
37
|
+
* TODO: once SimpleTreeSchema is stable, {@link TreeViewConfiguration} could implement {@link SimpleTreeSchema} directly.
|
|
38
|
+
* That would provide the non-copying alternative that could expose the value type of the definitions map as {@link TreeNodeSchema}.
|
|
29
39
|
*/
|
|
30
|
-
export function toSimpleTreeSchema(
|
|
40
|
+
export function toSimpleTreeSchema(
|
|
41
|
+
schema: ImplicitFieldSchema,
|
|
42
|
+
copySchemaObjects: boolean,
|
|
43
|
+
): SimpleTreeSchema {
|
|
31
44
|
const normalizedSchema = normalizeFieldSchema(schema);
|
|
32
|
-
|
|
33
|
-
const allowedTypes = allowedTypesFromFieldSchema(normalizedSchema);
|
|
34
|
-
|
|
35
45
|
const definitions = new Map<string, SimpleNodeSchema>();
|
|
36
|
-
|
|
46
|
+
walkFieldSchema(normalizedSchema, {
|
|
47
|
+
node: (nodeSchema) => {
|
|
48
|
+
// The set of node kinds is extensible, but the typing of SimpleNodeSchema is not, so we need to check that the schema is one of the known kinds.
|
|
49
|
+
assert(
|
|
50
|
+
nodeSchema instanceof ArrayNodeSchema ||
|
|
51
|
+
nodeSchema instanceof MapNodeSchema ||
|
|
52
|
+
nodeSchema instanceof LeafNodeSchema ||
|
|
53
|
+
nodeSchema instanceof ObjectNodeSchema,
|
|
54
|
+
0xb60 /* Invalid schema */,
|
|
55
|
+
);
|
|
56
|
+
const outSchema = copySchemaObjects ? copySimpleNodeSchema(nodeSchema) : nodeSchema;
|
|
57
|
+
definitions.set(nodeSchema.identifier, outSchema);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
37
60
|
|
|
38
|
-
|
|
61
|
+
return {
|
|
39
62
|
kind: normalizedSchema.kind,
|
|
40
|
-
|
|
63
|
+
allowedTypesIdentifiers: normalizedSchema.allowedTypesIdentifiers,
|
|
41
64
|
definitions,
|
|
65
|
+
metadata: normalizedSchema.metadata,
|
|
42
66
|
};
|
|
43
|
-
|
|
44
|
-
copyProperty(normalizedSchema, "metadata", output);
|
|
45
|
-
return output;
|
|
46
67
|
}
|
|
47
68
|
|
|
48
69
|
/**
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
const simpleNodeSchemaCache = new WeakMap<TreeNodeSchema, SimpleNodeSchema>();
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Creates a {@link SimpleNodeSchema} from a {@link TreeNodeSchema}.
|
|
70
|
+
* Copies a {@link SimpleNodeSchema} into a new plain JavaScript object.
|
|
55
71
|
*
|
|
56
72
|
* @remarks Caches the result on the input schema for future calls.
|
|
57
73
|
*/
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
case NodeKind.Object: {
|
|
72
|
-
assert(isObjectNodeSchema(schema), 0xa06 /* Expected object schema */);
|
|
73
|
-
return objectSchemaToSimpleSchema(schema);
|
|
74
|
-
}
|
|
75
|
-
default: {
|
|
76
|
-
unreachableCase(kind);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
74
|
+
function copySimpleNodeSchema(schema: SimpleNodeSchema): SimpleNodeSchema {
|
|
75
|
+
const kind = schema.kind;
|
|
76
|
+
switch (kind) {
|
|
77
|
+
case NodeKind.Leaf:
|
|
78
|
+
return copySimpleLeafSchema(schema);
|
|
79
|
+
case NodeKind.Array:
|
|
80
|
+
case NodeKind.Map:
|
|
81
|
+
return copySimpleMapOrArraySchema(schema);
|
|
82
|
+
case NodeKind.Object:
|
|
83
|
+
return copySimpleObjectSchema(schema);
|
|
84
|
+
default:
|
|
85
|
+
unreachableCase(kind);
|
|
86
|
+
}
|
|
80
87
|
}
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
function leafSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleLeafNodeSchema {
|
|
89
|
+
function copySimpleLeafSchema(schema: SimpleLeafNodeSchema): SimpleLeafNodeSchema {
|
|
84
90
|
return {
|
|
85
91
|
kind: NodeKind.Leaf,
|
|
86
|
-
leafKind: schema.
|
|
92
|
+
leafKind: schema.leafKind,
|
|
93
|
+
metadata: schema.metadata,
|
|
87
94
|
};
|
|
88
95
|
}
|
|
89
96
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
function copySimpleMapOrArraySchema(
|
|
98
|
+
schema: SimpleMapNodeSchema | SimpleArrayNodeSchema,
|
|
99
|
+
): SimpleMapNodeSchema | SimpleArrayNodeSchema {
|
|
100
|
+
return {
|
|
101
|
+
kind: schema.kind,
|
|
102
|
+
allowedTypesIdentifiers: schema.allowedTypesIdentifiers,
|
|
103
|
+
metadata: schema.metadata,
|
|
97
104
|
};
|
|
98
|
-
|
|
99
|
-
copyProperty(schema, "metadata", output);
|
|
100
|
-
|
|
101
|
-
return output;
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return output;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function objectSchemaToSimpleSchema(schema: ObjectNodeSchema): SimpleObjectNodeSchema {
|
|
119
|
-
const fields: Record<string, SimpleFieldSchema> = {};
|
|
120
|
-
for (const [key, field] of schema.fields) {
|
|
121
|
-
fields[key] = fieldSchemaToSimpleSchema(field);
|
|
107
|
+
function copySimpleObjectSchema(schema: SimpleObjectNodeSchema): SimpleObjectNodeSchema {
|
|
108
|
+
const fields: Map<string, SimpleObjectFieldSchema> = new Map();
|
|
109
|
+
for (const [propertyKey, field] of schema.fields) {
|
|
110
|
+
// field already is a SimpleObjectFieldSchema, but copy the subset of the properties needed by this interface to get a clean simple object.
|
|
111
|
+
fields.set(propertyKey, {
|
|
112
|
+
kind: field.kind,
|
|
113
|
+
allowedTypesIdentifiers: field.allowedTypesIdentifiers,
|
|
114
|
+
metadata: field.metadata,
|
|
115
|
+
storedKey: field.storedKey,
|
|
116
|
+
});
|
|
122
117
|
}
|
|
123
118
|
|
|
124
|
-
|
|
119
|
+
return {
|
|
125
120
|
kind: NodeKind.Object,
|
|
126
121
|
fields,
|
|
122
|
+
metadata: schema.metadata,
|
|
127
123
|
};
|
|
128
|
-
|
|
129
|
-
copyProperty(schema, "metadata", output);
|
|
130
|
-
|
|
131
|
-
return output;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Private symbol under which the results of {@link toSimpleNodeSchema} are cached on an input {@link TreeNodeSchema}.
|
|
136
|
-
*/
|
|
137
|
-
const simpleFieldSchemaCacheSymbol = Symbol("simpleFieldSchemaCache");
|
|
138
|
-
|
|
139
|
-
function fieldSchemaToSimpleSchema(schema: FieldSchema): SimpleFieldSchema {
|
|
140
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
-
if ((schema as any)[simpleFieldSchemaCacheSymbol] !== undefined) {
|
|
142
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
-
return (schema as any)[simpleFieldSchemaCacheSymbol] as SimpleFieldSchema;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const allowedTypes = allowedTypesFromFieldSchema(schema);
|
|
147
|
-
const result: Mutable<SimpleFieldSchema> = {
|
|
148
|
-
kind: schema.kind,
|
|
149
|
-
allowedTypes,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
copyProperty(schema, "metadata", result);
|
|
153
|
-
|
|
154
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
155
|
-
(schema as any)[simpleFieldSchemaCacheSymbol] = result;
|
|
156
|
-
|
|
157
|
-
return result;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function allowedTypesFromFieldSchema(schema: FieldSchema): Set<string> {
|
|
161
|
-
const allowedTypes = new Set<string>();
|
|
162
|
-
for (const type of schema.allowedTypeSet) {
|
|
163
|
-
allowedTypes.add(type.identifier);
|
|
164
|
-
}
|
|
165
|
-
return allowedTypes;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Recursively populates `definitions` by walking the input field schema tree.
|
|
170
|
-
*/
|
|
171
|
-
function populateSchemaDefinitionsForField(
|
|
172
|
-
schema: FieldSchema,
|
|
173
|
-
definitions: Map<string, SimpleNodeSchema>,
|
|
174
|
-
): void {
|
|
175
|
-
for (const child of schema.allowedTypeSet) {
|
|
176
|
-
populateSchemaDefinitionsForNode(child, definitions);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Recursively populates `definitions` by walking the input node schema tree.
|
|
182
|
-
*/
|
|
183
|
-
function populateSchemaDefinitionsForNode(
|
|
184
|
-
schema: TreeNodeSchema,
|
|
185
|
-
definitions: Map<string, SimpleNodeSchema>,
|
|
186
|
-
): void {
|
|
187
|
-
if (definitions.has(schema.identifier)) {
|
|
188
|
-
// If the definition has already been populated, no need to recurse.
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Populate definition for this schema
|
|
193
|
-
definitions.set(schema.identifier, toSimpleNodeSchema(schema));
|
|
194
|
-
|
|
195
|
-
// Recurse into children to populate definitions for them
|
|
196
|
-
const kind = schema.kind;
|
|
197
|
-
switch (kind) {
|
|
198
|
-
case NodeKind.Leaf: {
|
|
199
|
-
// Leaf node, so no need to recurse
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
case NodeKind.Map: {
|
|
203
|
-
// TODO: Utilize a map schema type-guard once one exists (see object case for an example).
|
|
204
|
-
|
|
205
|
-
// Recursively populate definitions for allowed map children
|
|
206
|
-
const fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);
|
|
207
|
-
populateSchemaDefinitionsForField(fieldSchema, definitions);
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
case NodeKind.Array: {
|
|
211
|
-
// TODO: Utilize an array schema type-guard once one exists (see object case for an example).
|
|
212
|
-
|
|
213
|
-
// Recursively populate definitions for allowed map children
|
|
214
|
-
const fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);
|
|
215
|
-
populateSchemaDefinitionsForField(fieldSchema, definitions);
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
case NodeKind.Object: {
|
|
219
|
-
assert(isObjectNodeSchema(schema), 0xa07 /* Expected object schema */);
|
|
220
|
-
for (const [, field] of schema.fields) {
|
|
221
|
-
populateSchemaDefinitionsForField(field, definitions);
|
|
222
|
-
}
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
default: {
|
|
226
|
-
unreachableCase(kind);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
124
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Lazy, oob } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { Lazy, oob, fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
9
|
import { EmptyKey, type ExclusiveMapTree } from "../core/index.js";
|
|
@@ -33,13 +33,11 @@ import {
|
|
|
33
33
|
typeSchemaSymbol,
|
|
34
34
|
type Context,
|
|
35
35
|
getOrCreateNodeFromInnerNode,
|
|
36
|
-
type TreeNodeSchemaBoth,
|
|
37
36
|
getSimpleNodeSchemaFromInnerNode,
|
|
38
37
|
getOrCreateInnerNode,
|
|
39
38
|
type TreeNodeSchemaClass,
|
|
40
39
|
} from "./core/index.js";
|
|
41
40
|
import { type InsertableContent, mapTreeFromNodeData } from "./toMapTree.js";
|
|
42
|
-
import { fail } from "../util/index.js";
|
|
43
41
|
import {
|
|
44
42
|
getKernel,
|
|
45
43
|
UnhydratedFlexTreeNode,
|
|
@@ -47,7 +45,11 @@ import {
|
|
|
47
45
|
} from "./core/index.js";
|
|
48
46
|
import { TreeNodeValid, type MostDerivedData } from "./treeNodeValid.js";
|
|
49
47
|
import { getUnhydratedContext } from "./createContext.js";
|
|
50
|
-
import type {
|
|
48
|
+
import type { ImplicitAllowedTypesUnsafe } from "./api/index.js";
|
|
49
|
+
import type {
|
|
50
|
+
ArrayNodeCustomizableSchema,
|
|
51
|
+
ArrayNodePojoEmulationSchema,
|
|
52
|
+
} from "./arrayNodeTypes.js";
|
|
51
53
|
|
|
52
54
|
/**
|
|
53
55
|
* A covariant base type for {@link (TreeArrayNode:interface)}.
|
|
@@ -73,7 +75,7 @@ export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue>
|
|
|
73
75
|
* @sealed @public
|
|
74
76
|
*/
|
|
75
77
|
export interface TreeArrayNode<
|
|
76
|
-
TAllowedTypes extends
|
|
78
|
+
TAllowedTypes extends ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes,
|
|
77
79
|
out T = [TAllowedTypes] extends [ImplicitAllowedTypes]
|
|
78
80
|
? TreeNodeFromImplicitAllowedTypes<TAllowedTypes>
|
|
79
81
|
: TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,
|
|
@@ -668,6 +670,7 @@ export function asIndex(key: string | symbol, exclusiveMax: number): number | un
|
|
|
668
670
|
}
|
|
669
671
|
|
|
670
672
|
/**
|
|
673
|
+
* Create a proxy which implements the {@link TreeArrayNode} API.
|
|
671
674
|
* @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.
|
|
672
675
|
* Otherwise setting of unexpected properties will error.
|
|
673
676
|
* @param proxyTarget - Target object of the proxy. Must provide an own `length` value property
|
|
@@ -1071,18 +1074,18 @@ export function arraySchema<
|
|
|
1071
1074
|
customizable: boolean,
|
|
1072
1075
|
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
1073
1076
|
) {
|
|
1074
|
-
type Output =
|
|
1077
|
+
type Output = ArrayNodeCustomizableSchema<
|
|
1075
1078
|
TName,
|
|
1076
|
-
NodeKind.Array,
|
|
1077
|
-
TreeArrayNode<T> & WithType<TName, NodeKind.Array>,
|
|
1078
|
-
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
1079
|
-
ImplicitlyConstructable,
|
|
1080
1079
|
T,
|
|
1081
|
-
|
|
1080
|
+
ImplicitlyConstructable,
|
|
1082
1081
|
TCustomMetadata
|
|
1083
|
-
|
|
1082
|
+
> &
|
|
1083
|
+
ArrayNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>;
|
|
1084
1084
|
|
|
1085
1085
|
const lazyChildTypes = new Lazy(() => normalizeAllowedTypes(info));
|
|
1086
|
+
const lazyAllowedTypesIdentifiers = new Lazy(
|
|
1087
|
+
() => new Set([...lazyChildTypes.value].map((type) => type.identifier)),
|
|
1088
|
+
);
|
|
1086
1089
|
|
|
1087
1090
|
let unhydratedContext: Context;
|
|
1088
1091
|
|
|
@@ -1120,6 +1123,10 @@ export function arraySchema<
|
|
|
1120
1123
|
);
|
|
1121
1124
|
}
|
|
1122
1125
|
|
|
1126
|
+
public static get allowedTypesIdentifiers(): ReadonlySet<string> {
|
|
1127
|
+
return lazyAllowedTypesIdentifiers.value;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1123
1130
|
protected static override constructorCached: MostDerivedData | undefined = undefined;
|
|
1124
1131
|
|
|
1125
1132
|
protected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {
|
|
@@ -1161,8 +1168,7 @@ export function arraySchema<
|
|
|
1161
1168
|
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
|
|
1162
1169
|
return lazyChildTypes.value;
|
|
1163
1170
|
}
|
|
1164
|
-
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata>
|
|
1165
|
-
metadata;
|
|
1171
|
+
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};
|
|
1166
1172
|
|
|
1167
1173
|
// eslint-disable-next-line import/no-deprecated
|
|
1168
1174
|
public get [typeNameSymbol](): TName {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { TreeArrayNode } from "./arrayNode.js";
|
|
7
|
+
import type {
|
|
8
|
+
ImplicitAllowedTypes,
|
|
9
|
+
InsertableTreeNodeFromImplicitAllowedTypes,
|
|
10
|
+
} from "./schemaTypes.js";
|
|
11
|
+
import {
|
|
12
|
+
NodeKind,
|
|
13
|
+
type TreeNodeSchemaClass,
|
|
14
|
+
type TreeNodeSchema,
|
|
15
|
+
type TreeNodeSchemaNonClass,
|
|
16
|
+
type WithType,
|
|
17
|
+
} from "./core/index.js";
|
|
18
|
+
|
|
19
|
+
import type { SimpleArrayNodeSchema } from "./simpleSchema.js";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A schema for customizable {@link (TreeArrayNode:interface)}s.
|
|
23
|
+
* @system @sealed @alpha
|
|
24
|
+
*/
|
|
25
|
+
export interface ArrayNodeCustomizableSchema<
|
|
26
|
+
out TName extends string = string,
|
|
27
|
+
in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,
|
|
28
|
+
out ImplicitlyConstructable extends boolean = true,
|
|
29
|
+
out TCustomMetadata = unknown,
|
|
30
|
+
> extends TreeNodeSchemaClass<
|
|
31
|
+
TName,
|
|
32
|
+
NodeKind.Array,
|
|
33
|
+
TreeArrayNode<T> & WithType<TName, NodeKind.Array, T>,
|
|
34
|
+
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
35
|
+
ImplicitlyConstructable,
|
|
36
|
+
T,
|
|
37
|
+
undefined,
|
|
38
|
+
TCustomMetadata
|
|
39
|
+
>,
|
|
40
|
+
SimpleArrayNodeSchema<TCustomMetadata> {}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A schema for POJO emulation mode {@link (TreeArrayNode:interface)}s.
|
|
44
|
+
* @system @sealed @alpha
|
|
45
|
+
*/
|
|
46
|
+
export interface ArrayNodePojoEmulationSchema<
|
|
47
|
+
out TName extends string = string,
|
|
48
|
+
in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,
|
|
49
|
+
out ImplicitlyConstructable extends boolean = true,
|
|
50
|
+
out TCustomMetadata = unknown,
|
|
51
|
+
> extends TreeNodeSchemaNonClass<
|
|
52
|
+
TName,
|
|
53
|
+
NodeKind.Array,
|
|
54
|
+
TreeArrayNode<T> & WithType<TName, NodeKind.Array, T>,
|
|
55
|
+
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
56
|
+
ImplicitlyConstructable,
|
|
57
|
+
T,
|
|
58
|
+
undefined,
|
|
59
|
+
TCustomMetadata
|
|
60
|
+
>,
|
|
61
|
+
SimpleArrayNodeSchema<TCustomMetadata> {}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A schema for {@link (TreeArrayNode:interface)}s.
|
|
65
|
+
* @privateRemarks
|
|
66
|
+
* This could have generic arguments added and forwarded.
|
|
67
|
+
* The expected use-cases for this don't need them however, and if they did want an argument it would probably be the allowed types;
|
|
68
|
+
* perhaps if moving to an order independent way to pass generic arguments, adding support for them here would make sense.
|
|
69
|
+
* @alpha
|
|
70
|
+
*/
|
|
71
|
+
export type ArrayNodeSchema = ArrayNodeCustomizableSchema | ArrayNodePojoEmulationSchema;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @alpha
|
|
75
|
+
*/
|
|
76
|
+
export const ArrayNodeSchema = {
|
|
77
|
+
/**
|
|
78
|
+
* instanceof-based narrowing support for ArrayNodeSchema in Javascript and TypeScript 5.3 or newer.
|
|
79
|
+
*/
|
|
80
|
+
[Symbol.hasInstance](value: TreeNodeSchema): value is ArrayNodeSchema {
|
|
81
|
+
return isArrayNodeSchema(value);
|
|
82
|
+
},
|
|
83
|
+
} as const;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Narrows a {@link (TreeNodeSchema:interface)} to an {@link (ArrayNodeSchema:interface)}.
|
|
87
|
+
* @privateRemarks
|
|
88
|
+
* If at some point we want to have internal only APIs for ArrayNodeSchema (like done for objects),
|
|
89
|
+
* this can include those since its not the public facing API.
|
|
90
|
+
*/
|
|
91
|
+
export function isArrayNodeSchema(schema: TreeNodeSchema): schema is ArrayNodeSchema {
|
|
92
|
+
return schema.kind === NodeKind.Array;
|
|
93
|
+
}
|
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { TreeValue } from "../../core/index.js";
|
|
7
|
-
import type { FlexTreeNode } from "../../feature-libraries/index.js";
|
|
8
|
-
import { fail } from "../../util/index.js";
|
|
9
7
|
import {
|
|
10
8
|
type InnerNode,
|
|
11
9
|
unhydratedFlexTreeNodeToTreeNode,
|
|
12
10
|
proxySlot,
|
|
11
|
+
createTreeNodeFromInner,
|
|
13
12
|
} from "./treeNodeKernel.js";
|
|
14
|
-
import {
|
|
15
|
-
import type { TreeNode, InternalTreeNode } from "./types.js";
|
|
13
|
+
import type { TreeNode } from "./types.js";
|
|
16
14
|
import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -31,13 +29,5 @@ export function getOrCreateNodeFromInnerNode(flexNode: InnerNode): TreeNode | Tr
|
|
|
31
29
|
return cached;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
getSimpleNodeSchemaFromInnerNode(flexNode) ?? fail(0xb3e /* Missing schema */);
|
|
36
|
-
const node = flexNode as unknown as InternalTreeNode;
|
|
37
|
-
// eslint-disable-next-line unicorn/prefer-ternary
|
|
38
|
-
if (typeof classSchema === "function") {
|
|
39
|
-
return new classSchema(node);
|
|
40
|
-
} else {
|
|
41
|
-
return (classSchema as { create(data: FlexTreeNode): TreeValue }).create(flexNode);
|
|
42
|
-
}
|
|
32
|
+
return createTreeNodeFromInner(flexNode);
|
|
43
33
|
}
|
|
@@ -13,6 +13,7 @@ export {
|
|
|
13
13
|
unhydratedFlexTreeNodeToTreeNode,
|
|
14
14
|
getOrCreateInnerNode,
|
|
15
15
|
treeNodeFromAnchor,
|
|
16
|
+
getSimpleNodeSchemaFromInnerNode,
|
|
16
17
|
} from "./treeNodeKernel.js";
|
|
17
18
|
export { type WithType, typeNameSymbol, typeSchemaSymbol } from "./withType.js";
|
|
18
19
|
export {
|
|
@@ -31,7 +32,6 @@ export {
|
|
|
31
32
|
type TreeNodeSchemaCore,
|
|
32
33
|
type TreeNodeSchemaBoth,
|
|
33
34
|
} from "./treeNodeSchema.js";
|
|
34
|
-
export { getSimpleNodeSchemaFromInnerNode } from "./schemaCaching.js";
|
|
35
35
|
export { walkAllowedTypes, type SchemaVisitor } from "./walkSchema.js";
|
|
36
36
|
export { Context, HydratedContext, SimpleContextSlot } from "./context.js";
|
|
37
37
|
export { getOrCreateNodeFromInnerNode } from "./getOrCreateNode.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, Lazy } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, Lazy, fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
8
8
|
import type { Listenable, Off } from "@fluidframework/core-interfaces";
|
|
9
9
|
import type { InternalTreeNode, TreeNode, Unhydrated } from "./types.js";
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
type FlexTreeNode,
|
|
27
27
|
} from "../../feature-libraries/index.js";
|
|
28
28
|
import type { TreeNodeSchema } from "./treeNodeSchema.js";
|
|
29
|
-
import { fail } from "../../util/index.js";
|
|
30
29
|
// TODO: decide how to deal with dependencies on flex-tree implementation.
|
|
31
30
|
// eslint-disable-next-line import/no-internal-modules
|
|
32
31
|
import { makeTree } from "../../feature-libraries/flex-tree/lazyNode.js";
|
|
@@ -423,22 +422,25 @@ export function tryDisposeTreeNode(anchorNode: AnchorNode): void {
|
|
|
423
422
|
}
|
|
424
423
|
|
|
425
424
|
/**
|
|
426
|
-
*
|
|
427
|
-
* @privateRemarks
|
|
428
|
-
* This provides a way to access simple tree schema from the flex tree without depending on {@link FlexTreeSchema} which is in the process of being removed.
|
|
429
|
-
* This is currently limited to hydrated nodes: this limitation will have to be fixed before {@link FlexTreeSchema} can be fully removed.
|
|
425
|
+
* Gets the {@link TreeNodeSchema} for the {@link InnerNode}.
|
|
430
426
|
*/
|
|
431
|
-
export function
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
);
|
|
427
|
+
export function getSimpleNodeSchemaFromInnerNode(innerNode: InnerNode): TreeNodeSchema {
|
|
428
|
+
const context: Context = getSimpleContextFromInnerNode(innerNode);
|
|
429
|
+
return context.schema.get(innerNode.schema) ?? fail(0xb3f /* missing schema from context */);
|
|
430
|
+
}
|
|
436
431
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
432
|
+
/**
|
|
433
|
+
* Gets the {@link Context} for the {@link InnerNode}.
|
|
434
|
+
*/
|
|
435
|
+
export function getSimpleContextFromInnerNode(innerNode: InnerNode): Context {
|
|
436
|
+
if (innerNode instanceof UnhydratedFlexTreeNode) {
|
|
437
|
+
return innerNode.simpleContext;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const context = innerNode.anchorNode.anchorSet.slots.get(SimpleContextSlot);
|
|
441
|
+
assert(context !== undefined, 0xa55 /* missing simple tree context */);
|
|
440
442
|
|
|
441
|
-
return context
|
|
443
|
+
return context;
|
|
442
444
|
}
|
|
443
445
|
|
|
444
446
|
/**
|
|
@@ -482,8 +484,20 @@ export function treeNodeFromAnchor(anchorNode: AnchorNode): TreeNode | TreeValue
|
|
|
482
484
|
}
|
|
483
485
|
|
|
484
486
|
const flexNode = flexNodeFromAnchor(anchorNode);
|
|
485
|
-
|
|
487
|
+
return createTreeNodeFromInner(flexNode);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Constructs a TreeNode from an InnerNode.
|
|
492
|
+
* @remarks
|
|
493
|
+
* This does not do caching or validation: caller must ensure duplicate nodes for a given inner node are not created, and that the inner node is valid.
|
|
494
|
+
*/
|
|
495
|
+
export function createTreeNodeFromInner(innerNode: InnerNode): TreeNode | TreeValue {
|
|
496
|
+
const classSchema = getSimpleNodeSchemaFromInnerNode(innerNode);
|
|
497
|
+
const internal = innerNode as unknown as InternalTreeNode;
|
|
486
498
|
return typeof classSchema === "function"
|
|
487
|
-
? new classSchema(
|
|
488
|
-
: (classSchema as { create(data:
|
|
499
|
+
? new classSchema(internal)
|
|
500
|
+
: (classSchema as { create(data: InternalTreeNode): TreeNode | TreeValue }).create(
|
|
501
|
+
internal,
|
|
502
|
+
);
|
|
489
503
|
}
|