@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
package/CHANGELOG.md
CHANGED
|
@@ -1,1777 +1,1909 @@
|
|
|
1
1
|
# @fluidframework/tree
|
|
2
2
|
|
|
3
|
-
## 2.
|
|
3
|
+
## 2.31.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
The [`SchemaFactoryAlpha.scopedFactory`](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class)
|
|
10
|
-
method has been added, providing an easy way to create a new `SchemaFactory` with a nested scope string.
|
|
7
|
+
- Better type errors for invalid recursive schema ([#24080](https://github.com/microsoft/FluidFramework/pull/24080)) [8ae8d2cb05](https://github.com/microsoft/FluidFramework/commit/8ae8d2cb05f7ce765f1d1997135e72a1ea1e00fb)
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
Constraints have been added to `*Recursive` [`SchemaFactory`](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class) methods to ensure correct use without relying on [`ValidateRecursiveSchema`](https://fluidframework.com/docs/api/fluid-framework/validaterecursiveschema-typealias) as much.
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
- Improved type checking for recursive object schema Fields ([#24113](https://github.com/microsoft/FluidFramework/pull/24113)) [5b656f5cb0](https://github.com/microsoft/FluidFramework/commit/5b656f5cb0707c149aa4537017f71052f10467ee)
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
Most ways to provide incorrectly typed data for fields of [recursive object schema](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#objectrecursive-method) now produce simpler type errors without relying on [ValidateRecursiveSchema](https://fluidframework.com/docs/api/fluid-framework/validaterecursiveschema-typealias).
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
Instead the resulting tree can be further processed to do any desired replacements.
|
|
20
|
-
The following `@alpha` APIs have been added to assist with this:
|
|
15
|
+
As a side effect of this work, some schema which violated the documented allowed patterns specified by [SchemaFactory](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#schemafactory-remarks) but used to work (as long as they were not package exported) no longer compile.
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
2. `replaceHandles`
|
|
24
|
-
3. `replaceConciseTreeHandles`
|
|
25
|
-
4. `replaceVerboseTreeHandles`
|
|
17
|
+
The specific case known to break is when:
|
|
26
18
|
|
|
27
|
-
|
|
19
|
+
1. An Object node schema is co-recursive with an Array node schema.
|
|
20
|
+
2. The Array does not declare a named subclass.
|
|
21
|
+
3. The schema reference from the Object to the Array is not using the [lazy syntax](https://fluidframework.com/docs/api/fluid-framework/lazyitem-typealias).
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
They typically look like `() => MySchema` and are used when a [forward reference](https://en.wikipedia.org/wiki/Forward_declaration#Forward_reference) from one schema to another is required (including but not limited to recursive and co-recursive schema).
|
|
23
|
+
For example:
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
```typescript
|
|
26
|
+
class Foo extends sf.objectRecursive("Foo", {
|
|
27
|
+
fooList: sf.arrayRecursive("FooList", [() => Foo]), // Bad
|
|
28
|
+
}) {}
|
|
29
|
+
{
|
|
30
|
+
type _check = ValidateRecursiveSchema<typeof Foo>;
|
|
31
|
+
}
|
|
32
|
+
```
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
Such a schema is disallowed according to the documentation. See the
|
|
35
|
+
["recursive schema must explicitly declare a named class"](<(https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#schemafactory-remarks)>) remarks.
|
|
36
|
+
This restriction is necessary to avoid [generated `.d.ts` files replacing recursive references with `any`](https://github.com/microsoft/TypeScript/issues/55832).
|
|
37
|
+
Fixing this code is now also necessary to avoid a compile error.
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
```typescript
|
|
40
|
+
// Fixed
|
|
41
|
+
class FooList extends sf.arrayRecursive("FooList", [() => Foo]) {}
|
|
42
|
+
{
|
|
43
|
+
type _check = ValidateRecursiveSchema<typeof FooList>;
|
|
44
|
+
}
|
|
45
|
+
class Foo extends sf.objectRecursive("Foo", {
|
|
46
|
+
fooList: FooList,
|
|
47
|
+
}) {}
|
|
48
|
+
{
|
|
49
|
+
type _check = ValidateRecursiveSchema<typeof Foo>;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
This change will also result in much nicer IntelliSense and type errors while fixing the typing if the schema is exported.
|
|
44
54
|
|
|
45
|
-
|
|
55
|
+
There are still several cases which compile but violate this policy regarding recursive schema and can cause issues when exporting schema;
|
|
56
|
+
these should be migrated to the above pattern as well.
|
|
57
|
+
It is still valid to use non-recursive structurally named array and map schema inline; this change does not impact them.
|
|
46
58
|
|
|
47
|
-
|
|
48
|
-
It does so whenever a transaction is created and when processing inbound changes.
|
|
59
|
+
- Performance enhancements in SharedTree branch-related ops processing ([#24093](https://github.com/microsoft/FluidFramework/pull/24093)) [47b275bcf2](https://github.com/microsoft/FluidFramework/commit/47b275bcf2dd79696387f7c8f3e876d03b2813f8)
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
SharedTree leverages the "op bunching" feature where contiguous ops in a grouped batch are bunched and processed together
|
|
62
|
+
to asymptotically improve the performance of processing ops.
|
|
63
|
+
This performance enhancement focuses on the scenario where there are one or more commits in the trunk and one or more peer
|
|
64
|
+
commits are received in a bunch. With 1 trunk commits and 10 peer commits, the performance increases by 57%; with 100
|
|
65
|
+
trunk commits and 100 peer commits, the performance increases by 97%.
|
|
52
66
|
|
|
53
|
-
|
|
67
|
+
Some example scenarios where the performance will be improved:
|
|
54
68
|
|
|
55
|
-
-
|
|
69
|
+
- A client makes some local changes and another client simultaneously makes a large number of changes in a single JavaScript turn.
|
|
70
|
+
For example, a client is typing into a canvas while another client pastes a large amount of content into a table.
|
|
71
|
+
- A client makes a local branch with some changes and rebases it into the trunk. For example, an AI agent makes changes
|
|
72
|
+
on a local branch which are accepted by a user resulting in the AI's branch being merged into the trunk.
|
|
56
73
|
|
|
57
|
-
|
|
58
|
-
processing a batch of changes.
|
|
74
|
+
- Improve tree shaking for code which imports `SharedTreeAttributes` ([#24135](https://github.com/microsoft/FluidFramework/pull/24135)) [eb46f426ff](https://github.com/microsoft/FluidFramework/commit/eb46f426ff1ef6f98a3ffc666030bb59f8c7d22f)
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
Bundling code that imports `SharedTreeAttributes` from `@fluidframework/tree/legacy` should now better prune out the rest of the tree package's code.
|
|
77
|
+
This change reduced the dependency on webpack's
|
|
78
|
+
[`usedExports`](https://webpack.js.org/configuration/optimization/#optimizationusedexports) when tree shaking, but other
|
|
79
|
+
bundlers should also benefit.
|
|
62
80
|
|
|
63
|
-
-
|
|
81
|
+
- `TreeAlpha.exportConcise` now supports `undefined` ([#24187](https://github.com/microsoft/FluidFramework/pull/24187)) [958b9fd8b9](https://github.com/microsoft/FluidFramework/commit/958b9fd8b9a2bd43558fe2a94dc55f8f51d47ea8)
|
|
64
82
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
the number of local ops and incoming ops increase, the processing time will reduce.
|
|
83
|
+
There is a new overload for `TreeAlpha.exportConcise` which makes exporting optional fields easier.
|
|
84
|
+
This overload allows `undefined` and returns `undefined` in this case.
|
|
68
85
|
|
|
69
|
-
|
|
86
|
+
- Improvements to typing of object node schema ([#24143](https://github.com/microsoft/FluidFramework/pull/24143)) [02ecf8dfb2](https://github.com/microsoft/FluidFramework/commit/02ecf8dfb238dc4d1c88610cec34d7895802d28c)
|
|
70
87
|
|
|
71
|
-
|
|
88
|
+
Several tweaks to the typing of object node schema have been made to allow exposing an `@alpha` `ObjectNodeSchema` type.
|
|
72
89
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
a local branch with large number of changes.
|
|
90
|
+
[SchemaFactoryAlpha](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class)'s `object` and `objectRecursive` now return schema which are compatible with the new `ObjectNodeSchema` type.
|
|
91
|
+
This new `ObjectNodeSchema` type exposes a `fields: ReadonlyMap<string, FieldSchemaAlpha & SimpleObjectFieldSchema>` property which provides an easy way to get information about the object's fields.
|
|
76
92
|
|
|
77
|
-
|
|
93
|
+
Additionally an alpha `ObjectNodeSchema` object is added to enable support for `schema instanceof ObjectNodeSchema` to safely narrow `TreeNodeSchema` to this new type.
|
|
78
94
|
|
|
79
|
-
|
|
80
|
-
One place where it was easy to accidentally violate this rule and get hard-to-debug results was [`Tree.is`](https://fluidframework.com/docs/data-structures/tree/nodes#treeis).
|
|
81
|
-
This has been mitigated by adding a check in `Tree.is` which detects this mistake (which used to result in `false` being returned) and instead throws a `UsageError` explaining the situation.
|
|
82
|
-
The error will look something like:
|
|
95
|
+
In support of this work, several typing details were fixed including:
|
|
83
96
|
|
|
84
|
-
|
|
97
|
+
- `info` field of `[typeSchemaSymbol]` type brand on recursive object schema was specified to match non-recursive variants.
|
|
98
|
+
- Type of field metadata was correctly plumbed through `optionalReclusive` and `requiredRecursive`.
|
|
99
|
+
- When fields object provided to [SchemaFactory.object](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#object-method) is typed as `RestrictiveStringRecord<ImplicitFieldSchema>` the resulting [TreeObjectNode](https://fluidframework.com/docs/api/fluid-framework/treeobjectnode-typealias) no longer gets a `Record<string, TreeNode | TreeLeafValue>` signature which could incorrectly conflict with custom members added to the object. Instead `{}` is used to provide no information about felids on the type when the schema provides no information about them. Additionally this case is explicitly made non-constructable: the constructor takes in `never` instead of a `Record<string,never>` which could be erroneously satisfied with an empty object due to how TypeScript assignability rules consider records to have all allowed fields, but also allow objects missing those fields to be assigned to them.
|
|
85
100
|
|
|
86
|
-
|
|
101
|
+
Lastly, `metadata` on the various schema types has been made required instead of optional.
|
|
102
|
+
This does not impact the APIs for constructing schema: when `undefined` is provided the schema now defaults to `{}` instead of `undefined`.
|
|
103
|
+
This reduces the number of cases code reading metadata from schema has to handle.
|
|
87
104
|
|
|
88
|
-
## 2.
|
|
105
|
+
## 2.30.0
|
|
89
106
|
|
|
90
107
|
### Minor Changes
|
|
91
108
|
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
`SchemaFactory` now has a `leaves` member that is an array of all leaf schema.
|
|
109
|
+
- New SchemaFactoryAlpha.scopedFactory method ([#23987](https://github.com/microsoft/FluidFramework/pull/23987)) [cddd5139c3](https://github.com/microsoft/FluidFramework/commit/cddd5139c3e070ef26db55331528435a99c0a1b1)
|
|
95
110
|
|
|
96
|
-
|
|
111
|
+
The [`SchemaFactoryAlpha.scopedFactory`](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class)
|
|
112
|
+
method has been added, providing an easy way to create a new `SchemaFactory` with a nested scope string.
|
|
97
113
|
|
|
98
|
-
|
|
114
|
+
- TreeBranchEvents now exposes the rootChanged event ([#24014](https://github.com/microsoft/FluidFramework/pull/24014)) [702a08af83](https://github.com/microsoft/FluidFramework/commit/702a08af83206c21e1016ca47051052fa8554aa5)
|
|
99
115
|
|
|
100
|
-
|
|
116
|
+
`TreeBranchEvents` now includes the `rootChanged` event from `TreeViewEvents`.
|
|
101
117
|
|
|
102
|
-
|
|
118
|
+
- Alpha APIs for replacing handles in export formats have been redesigned ([#24061](https://github.com/microsoft/FluidFramework/pull/24061)) [34b319cae7](https://github.com/microsoft/FluidFramework/commit/34b319cae7a78db5530dc898689e2eb846f1419f)
|
|
103
119
|
|
|
104
|
-
|
|
120
|
+
The various import and export [`VerboseTree`](https://fluidframework.com/docs/api/fluid-framework/verbosetree-typealias) and [`ConciseTree`](https://fluidframework.com/docs/api/fluid-framework/concisetree-typealias) APIs no longer include `valueConverter` options.
|
|
121
|
+
Instead the resulting tree can be further processed to do any desired replacements.
|
|
122
|
+
The following `@alpha` APIs have been added to assist with this:
|
|
105
123
|
|
|
106
|
-
|
|
124
|
+
1. `cloneWithReplacements`
|
|
125
|
+
2. `replaceHandles`
|
|
126
|
+
3. `replaceConciseTreeHandles`
|
|
127
|
+
4. `replaceVerboseTreeHandles`
|
|
107
128
|
|
|
108
|
-
|
|
109
|
-
`@fluidframework/core-interfaces` package. As such, they are now deprecated in the `@fluidframework/tree` package.
|
|
129
|
+
- Rules regarding how and when lazy schema references are resolved have been clarified ([#24030](https://github.com/microsoft/FluidFramework/pull/24030)) [23f32794db](https://github.com/microsoft/FluidFramework/commit/23f32794dbd3672dcc18e2a9ba2f16f4bf1241f0)
|
|
110
130
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- Listenable
|
|
114
|
-
- Off
|
|
131
|
+
A lazy schema reference is a [LazyItem](https://fluidframework.com/docs/api/fluid-framework/lazyitem-typealias) referencing a [TreeNodeSchema](https://fluidframework.com/docs/api/fluid-framework/treenodeschema-typealias).
|
|
132
|
+
They typically look like `() => MySchema` and are used when a [forward reference](https://en.wikipedia.org/wiki/Forward_declaration#Forward_reference) from one schema to another is required (including but not limited to recursive and co-recursive schema).
|
|
115
133
|
|
|
116
|
-
|
|
134
|
+
[TreeViewConfiguration](https://fluidframework.com/docs/api/fluid-framework/treeviewconfiguration-class#_constructor_-constructor) now documents its significance with respect to lazy schema references.
|
|
135
|
+
Additionally some implicit assumptions like no modifications of [AllowedTypes](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias)
|
|
136
|
+
after resolving of lazy schema references have been enforced (such modifications would previously cause undefined behavior in the future, and now an error is thrown when trying to modify them).
|
|
117
137
|
|
|
118
|
-
|
|
138
|
+
`evaluateLazySchema` has been added as an `@alpha` API that is now consistently used by all internal code when evaluating lazy schema references.
|
|
139
|
+
This ensures consistent behavior and error reporting, but also adds caching.
|
|
140
|
+
Therefore it is now supported for applications to have lazy schema references which compute the schema when invoked,
|
|
141
|
+
without having to implement their own caching as long as those applications use `evaluateLazySchema` anytime they need to evaluate a lazy schema reference.
|
|
119
142
|
|
|
120
|
-
## 2.
|
|
143
|
+
## 2.23.0
|
|
121
144
|
|
|
122
145
|
### Minor Changes
|
|
123
146
|
|
|
124
|
-
-
|
|
147
|
+
- Creating large transactions and processing inbound changes is now faster ([#23929](https://github.com/microsoft/FluidFramework/pull/23929)) [35847b5ffe0](https://github.com/microsoft/FluidFramework/commit/35847b5ffe09d94cef42b74ab59e37c4bd6d8c2d)
|
|
125
148
|
|
|
126
|
-
|
|
127
|
-
|
|
149
|
+
SharedTree sometimes composes several sequential changes into a single change.
|
|
150
|
+
It does so whenever a transaction is created and when processing inbound changes.
|
|
128
151
|
|
|
129
|
-
|
|
152
|
+
Version 2.23.0 makes this composition process asymptotically faster.
|
|
153
|
+
For example, creating a transaction that performs 1000 edits on a single array now takes 170ms instead of 1.5s (an 89% improvement).
|
|
130
154
|
|
|
131
|
-
|
|
132
|
-
const schemaFactory = new SchemaFactoryAlpha(...);
|
|
133
|
-
class Point extends schemaFactory.object("Point", {
|
|
134
|
-
x: schemaFactory.required(schemaFactory.number),
|
|
135
|
-
y: schemaFactory.required(schemaFactory.number),
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
metadata: {
|
|
139
|
-
description: "A point in 2D space",
|
|
140
|
-
},
|
|
141
|
-
}) {}
|
|
155
|
+
See [Change #23902](https://github.com/microsoft/FluidFramework/pull/23902) for more details.
|
|
142
156
|
|
|
143
|
-
|
|
157
|
+
- Faster processing of events for large transactions ([#23939](https://github.com/microsoft/FluidFramework/pull/23939)) [2a1e7e0617f](https://github.com/microsoft/FluidFramework/commit/2a1e7e0617f618f82134c0bba269119ed980aadc)
|
|
144
158
|
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
In versions prior to 2.23.0, event processing time could scale quadratically (`O(N^2)`) with the change count when
|
|
160
|
+
processing a batch of changes.
|
|
147
161
|
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
This performance characteristic has been corrected. See change
|
|
163
|
+
[#23908](https://github.com/microsoft/FluidFramework/pull/23908) for more details.
|
|
150
164
|
|
|
151
|
-
|
|
165
|
+
- Op bunching performance enhancements ([#23732](https://github.com/microsoft/FluidFramework/pull/23732)) [a98b04fc9e0](https://github.com/microsoft/FluidFramework/commit/a98b04fc9e000971bdfa8135251a7dc3e189502c)
|
|
152
166
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
167
|
+
`SharedTree` now takes advantage of a new feature called "op bunching" where contiguous ops in a grouped batch are
|
|
168
|
+
bunched and processed together. This improves the performance of processing ops asymptotically; as
|
|
169
|
+
the number of local ops and incoming ops increase, the processing time will reduce.
|
|
156
170
|
|
|
157
|
-
|
|
171
|
+
For example, with 10 local ops + 10 incoming ops, the performance increases by 70%; with 100 local ops + 100 incoming ops, the performance increases by 94%.
|
|
158
172
|
|
|
159
|
-
|
|
160
|
-
By default, the app author wishes for all app content to be potentially indexable by search, unless otherwise specified.
|
|
161
|
-
They can leverage schema metadata to decorate types of nodes that should be ignored by search, and leverage that information when walking the tree during a search.
|
|
173
|
+
This will help improve performance in the following scenarios:
|
|
162
174
|
|
|
163
|
-
|
|
175
|
+
- A client makes a large number of changes in a single JS turn. For example, copy pasting large data like a table.
|
|
176
|
+
- A client has a large number of local changes. For example, slow clients whose changes are slow to ack or clients with
|
|
177
|
+
a local branch with large number of changes.
|
|
164
178
|
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Whether or not nodes of this type should be ignored by search.
|
|
168
|
-
* @defaultValue `false`
|
|
169
|
-
*/
|
|
170
|
-
searchIgnore?: boolean;
|
|
171
|
-
}
|
|
179
|
+
- Invalid schema base classes in Tree.is now throw an error instead of returning false ([#23938](https://github.com/microsoft/FluidFramework/pull/23938)) [00995654070](https://github.com/microsoft/FluidFramework/commit/00995654070a4e13b57b2562ff4a5935aba70a2f)
|
|
172
180
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
metadata: {
|
|
180
|
-
description: "A point in 2D space",
|
|
181
|
-
custom: {
|
|
182
|
-
searchIgnore: true,
|
|
183
|
-
},
|
|
184
|
-
}
|
|
185
|
-
}) {}
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
|
|
190
|
-
|
|
191
|
-
#### Potential for breaking existing code
|
|
192
|
-
|
|
193
|
-
These changes add the new property "metadata" to the base type from which all node schema derive.
|
|
194
|
-
If you have existing node schema subclasses that include a property of this name, there is a chance for potential conflict here that could be breaking.
|
|
195
|
-
If you encounter issues here, consider renaming your property or leveraging the new metadata support.
|
|
196
|
-
|
|
197
|
-
- New alpha APIs for schema evolution ([#23362](https://github.com/microsoft/FluidFramework/pull/23362)) [2406e00efe](https://github.com/microsoft/FluidFramework/commit/2406e00efed282be58a9e09cb3478c9a9d170ef0)
|
|
198
|
-
|
|
199
|
-
There are now `@alpha` APIs for schema evolution which support adding optional fields to object node types without a staged rollout.
|
|
200
|
-
|
|
201
|
-
SharedTree has many safety checks in place to ensure applications understand the format of documents they must support.
|
|
202
|
-
One of these checks verifies that the view schema (defined in application's code) aligns with the document schema (determined by the document data at rest).
|
|
203
|
-
This helps to ensure that clients running incompatible versions of the application's code don't collaborate at the same time on some document, which could cause data loss or disrupt application invariants.
|
|
204
|
-
One general solution application authors can perform is to stage the rollout of a feature which changes document schema into multiple phases:
|
|
205
|
-
|
|
206
|
-
1. Release an application version which understands documents written with the new format but doesn't attempt to upgrade any documents
|
|
207
|
-
2. Wait for this application version to saturate in the app's ecosystem
|
|
208
|
-
3. Release an application version which upgrades documents to start leveraging the new format.
|
|
209
|
-
|
|
210
|
-
However, this process can be cumbersome for application authors: for many types of changes, an app author doesn't particularly care if older application code collaborates with newer code, as the only downside is that the older application version might not present a fully faithful experience.
|
|
211
|
-
As an example, consider an application which renders circles on a canvas (similar to what is presented [here](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md)).
|
|
212
|
-
The application author might anticipate adding support to render the circle with various different other properties (border style, border width, background color, varying radius, etc.).
|
|
213
|
-
Therefore, they should declare their schema using `SchemaFactoryObjectOptions.allowUnknownOptionalFields` like so:
|
|
214
|
-
|
|
215
|
-
```typescript
|
|
216
|
-
import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
|
|
217
|
-
// "Old" application code/schema
|
|
218
|
-
const factory = new SchemaFactoryAlpha("Geometry");
|
|
219
|
-
class Circle extends factory.object(
|
|
220
|
-
"Circle",
|
|
221
|
-
{
|
|
222
|
-
x: factory.number,
|
|
223
|
-
y: factory.number,
|
|
224
|
-
},
|
|
225
|
-
{ allowUnknownOptionalFields: true },
|
|
226
|
-
) {}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Later, they add some of these features to their application:
|
|
230
|
-
|
|
231
|
-
```typescript
|
|
232
|
-
import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
|
|
233
|
-
// "New" application code/schema
|
|
234
|
-
const factory = new SchemaFactoryAlpha("Geometry");
|
|
235
|
-
class Circle extends factory.object(
|
|
236
|
-
"Circle",
|
|
237
|
-
{
|
|
238
|
-
x: factory.number,
|
|
239
|
-
y: factory.number,
|
|
240
|
-
// Note that radius and color must both be declared as optional fields since this application must
|
|
241
|
-
// support opening up existing documents that didn't have this information.
|
|
242
|
-
radius: factory.optional(factory.number),
|
|
243
|
-
color: factory.optional(factory.string), // ex: #00FF00
|
|
244
|
-
},
|
|
245
|
-
{ allowUnknownOptionalFields: true },
|
|
246
|
-
) {}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
When they go to deploy this newer version of the application, they could opt to start upgrading documents as soon as the newer code is rolled out, and the older code would still be able to open up (and collaborate on) documents using the newer schema version.
|
|
250
|
-
Note that it's only important that the old _application code_ elected to allow opening documents with unknown optional fields.
|
|
251
|
-
This policy is not persisted into documents in any form, so applications are free to modify it at any point.
|
|
252
|
-
|
|
253
|
-
For specific API details, see documentation on `SchemaFactoryObjectOptions.allowUnknownOptionalFields`.
|
|
254
|
-
For a more thorough discussion of this topic, see [Schema Evolvability](https://github.com/microsoft/FluidFramework/tree/main/packages/dds/tree#schema-evolvability) in the SharedTree README.
|
|
181
|
+
As documented in [`TreeNodeSchemaClass`](https://fluidframework.com/docs/api/fluid-framework/treenodeschemaclass-typealias#treenodeschemaclass-remarks), there are specific rules around sub-classing schema, mainly that only a single most derived class can be used.
|
|
182
|
+
One place where it was easy to accidentally violate this rule and get hard-to-debug results was [`Tree.is`](https://fluidframework.com/docs/data-structures/tree/nodes#treeis).
|
|
183
|
+
This has been mitigated by adding a check in `Tree.is` which detects this mistake (which used to result in `false` being returned) and instead throws a `UsageError` explaining the situation.
|
|
184
|
+
The error will look something like:
|
|
255
185
|
|
|
256
|
-
|
|
186
|
+
> Two schema classes were used (CustomObjectNode and Derived) which derived from the same SchemaFactory generated class ("com.example.Test"). This is invalid.
|
|
257
187
|
|
|
258
|
-
|
|
188
|
+
For applications wanting to test if a given `TreeNode` is an instance of some schema base class, this can be done using `instanceof` which includes base classes when doing the check.
|
|
259
189
|
|
|
260
|
-
## 2.
|
|
190
|
+
## 2.22.0
|
|
261
191
|
|
|
262
192
|
### Minor Changes
|
|
263
193
|
|
|
264
|
-
-
|
|
265
|
-
|
|
266
|
-
The `DisposableRevertible` interface has been replaced with `RevertibleAlpha`. The new `RevertibleAlpha` interface extends `Revertible` and includes a `clone(branch: TreeBranch)` method to facilitate cloning a Revertible to a specified target branch. The source branch where the `RevertibleAlpha` was created must share revision logs with the target branch where the `RevertibleAlpha` is being cloned. If this condition is not met, the operation will throw an error.
|
|
194
|
+
- Add `leaves` and statics to `SchemaFactory`. ([#23787](https://github.com/microsoft/FluidFramework/pull/23787)) [efa90f6274](https://github.com/microsoft/FluidFramework/commit/efa90f6274152cadb55329b7bbf6a6cd8e299847)
|
|
267
195
|
|
|
268
|
-
|
|
196
|
+
`SchemaFactory` now has a `leaves` member that is an array of all leaf schema.
|
|
269
197
|
|
|
270
|
-
|
|
271
|
-
This matches the behavior of non-empty ObjectNodes which already gave errors when unexpected properties were provided.
|
|
198
|
+
`SchemaFactory` now has static members to access leaf schema and create field schema.
|
|
272
199
|
|
|
273
|
-
|
|
274
|
-
class A extends schemaFactory.object("A", {}) {}
|
|
275
|
-
const a = new A({ thisDoesNotExist: 5 }); // This now errors.
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
- The events library has been moved from the tree package ([#23141](https://github.com/microsoft/FluidFramework/pull/23141)) [cae07b5c8c](https://github.com/microsoft/FluidFramework/commit/cae07b5c8c7904184b5fbf8c677f302da19cc697)
|
|
200
|
+
## 2.21.0
|
|
279
201
|
|
|
280
|
-
|
|
281
|
-
`@fluidframework/core-interfaces`, while the implementation has been relocated to `@fluid-internal/client-utils`. There are
|
|
282
|
-
no changes to how the events library is used; the relocation simply organizes the library into more appropriate
|
|
283
|
-
packages. This change should have no impact on developers using the Fluid Framework.
|
|
202
|
+
Dependency updates only.
|
|
284
203
|
|
|
285
|
-
## 2.
|
|
204
|
+
## 2.20.0
|
|
286
205
|
|
|
287
206
|
### Minor Changes
|
|
288
207
|
|
|
289
|
-
-
|
|
290
|
-
|
|
291
|
-
When using the return value from [`adaptEnum`](https://fluidframework.com/docs/api/v2/tree#adaptenum-function) as a function, passing in a value who's type is a union no longer produced an incorrectly typed return value. This has been fixed.
|
|
292
|
-
|
|
293
|
-
Additionally [`enumFromStrings`](https://fluidframework.com/docs/api/v2/tree#enumfromstrings-function) has improved the typing of its schema, ensuring the returned object's members have sufficiently specific types.
|
|
294
|
-
Part of this improvement was fixing the `.schema` property to be a tuple over each of the schema where it was previously a tuple of a single combined schema due to a bug.
|
|
295
|
-
|
|
296
|
-
One side-effect of these fixes is that narrowing of the `value` field of a node typed from the `.schema` behaves slightly different, such that the node type is now a union instead of it being a single type with a `.value` that is a union.
|
|
297
|
-
This means that narrowing based on `.value` property narrows which node type you have, not just the value property.
|
|
298
|
-
This mainly matters when matching all cases like the switch statement below:
|
|
299
|
-
|
|
300
|
-
```typescript
|
|
301
|
-
const Mode = enumFromStrings(schema, ["Fun", "Bonus"]);
|
|
302
|
-
type Mode = TreeNodeFromImplicitAllowedTypes<typeof Mode.schema>;
|
|
303
|
-
const node = new Mode.Bonus() as Mode;
|
|
304
|
-
|
|
305
|
-
switch (node.value) {
|
|
306
|
-
case "Fun": {
|
|
307
|
-
assert.fail();
|
|
308
|
-
}
|
|
309
|
-
case "Bonus": {
|
|
310
|
-
// This one runs
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
default:
|
|
314
|
-
// Before this change, "node.value" was never here, now "node" is never.
|
|
315
|
-
unreachableCase(node);
|
|
316
|
-
}
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
- SharedTree event listeners that implement `Listenable` now allow deregistration of event listeners via an `off()` function. ([#23046](https://github.com/microsoft/FluidFramework/pull/23046)) [c59225db03](https://github.com/microsoft/FluidFramework/commit/c59225db033a516ee20e459ae31567d97ce8776c)
|
|
320
|
-
|
|
321
|
-
The ability to deregister events via a callback returned by `on()` remains the same.
|
|
322
|
-
Both strategies will remain supported and consumers of SharedTree events may choose which method of deregistration they prefer in a given instance.
|
|
323
|
-
|
|
324
|
-
```typescript
|
|
325
|
-
// The new behavior
|
|
326
|
-
function deregisterViaOff(view: TreeView<MySchema>): {
|
|
327
|
-
const listener = () => { /* ... */ };
|
|
328
|
-
view.events.on("commitApplied", listener); // Register
|
|
329
|
-
view.events.off("commitApplied", listener); // Deregister
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// The existing behavior (still supported)
|
|
333
|
-
function deregisterViaCallback(view: TreeView<MySchema>): {
|
|
334
|
-
const off = view.events.on("commitApplied", () => { /* ... */ }); // Register
|
|
335
|
-
off(); // Deregister
|
|
336
|
-
}
|
|
337
|
-
```
|
|
208
|
+
- Events-related interfaces have been moved to core-interfaces ([#23313](https://github.com/microsoft/FluidFramework/pull/23313)) [69a755ebd7](https://github.com/microsoft/FluidFramework/commit/69a755ebd76db36ffd4638d331062f96ec4c0648)
|
|
338
209
|
|
|
339
|
-
|
|
210
|
+
The following interfaces and types have been moved from the `@fluidframework/tree` package into the
|
|
211
|
+
`@fluidframework/core-interfaces` package. As such, they are now deprecated in the `@fluidframework/tree` package.
|
|
340
212
|
|
|
341
|
-
|
|
342
|
-
|
|
213
|
+
- Listeners
|
|
214
|
+
- IsListener
|
|
215
|
+
- Listenable
|
|
216
|
+
- Off
|
|
343
217
|
|
|
344
|
-
|
|
345
|
-
class MapRecursive extends sf.mapRecursive("Map", [() => MapRecursive]) {}
|
|
346
|
-
{
|
|
347
|
-
type _check = ValidateRecursiveSchema<typeof MapRecursive>;
|
|
348
|
-
}
|
|
349
|
-
// New:
|
|
350
|
-
const fromObject = new MapRecursive({ x: new MapRecursive() });
|
|
351
|
-
// Existing:
|
|
352
|
-
const fromIterator = new MapRecursive([["x", new MapRecursive()]]);
|
|
353
|
-
const fromMap = new MapRecursive(new Map([["x", new MapRecursive()]]));
|
|
354
|
-
const fromNothing = new MapRecursive();
|
|
355
|
-
const fromUndefined = new MapRecursive(undefined);
|
|
356
|
-
```
|
|
218
|
+
Users should now import them from either `@fluidframework/core-interfaces` or `fluid-framework`.
|
|
357
219
|
|
|
358
|
-
|
|
220
|
+
These deprecated interfaces will be removed from the `@fluidframework/tree` package in Fluid Framework v3.0.
|
|
359
221
|
|
|
360
|
-
|
|
361
|
-
This new event is fired for both local and remote changes and maintains the existing functionality of `commitApplied` that is used for obtaining `Revertibles`.
|
|
362
|
-
|
|
363
|
-
## 2.5.0
|
|
222
|
+
## 2.13.0
|
|
364
223
|
|
|
365
224
|
### Minor Changes
|
|
366
225
|
|
|
367
|
-
-
|
|
368
|
-
|
|
369
|
-
A collection of new `@alpha` APIs for importing and exporting tree content and schema from SharedTrees has been added to `TreeAlpha`.
|
|
370
|
-
These include import and export APIs for `VerboseTree`, `ConciseTree` and compressed tree formats.
|
|
371
|
-
|
|
372
|
-
`TreeAlpha.create` is also added to allow constructing trees with a more general API instead of having to use the schema constructor directly (since that doesn't handle polymorphic roots, or non-schema aware code).
|
|
226
|
+
- Metadata can be associated with Node Schema ([#23321](https://github.com/microsoft/FluidFramework/pull/23321)) [58619c3c4e](https://github.com/microsoft/FluidFramework/commit/58619c3c4ee55ca1497a117321ae0b364e6084e6)
|
|
373
227
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
`independentView` has also been added, which is similar but handles the case of creating a new view without an existing schema or tree.
|
|
228
|
+
Users of TreeView can now specify metadata when creating Node Schema, via `SchemaFactoryAlpha`.
|
|
229
|
+
This metadata may include system-understood properties like `description`.
|
|
377
230
|
|
|
378
|
-
|
|
231
|
+
Example:
|
|
379
232
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
233
|
+
```typescript
|
|
234
|
+
const schemaFactory = new SchemaFactoryAlpha(...);
|
|
235
|
+
class Point extends schemaFactory.object("Point", {
|
|
236
|
+
x: schemaFactory.required(schemaFactory.number),
|
|
237
|
+
y: schemaFactory.required(schemaFactory.number),
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
metadata: {
|
|
241
|
+
description: "A point in 2D space",
|
|
242
|
+
},
|
|
243
|
+
}) {}
|
|
384
244
|
|
|
385
|
-
|
|
245
|
+
```
|
|
386
246
|
|
|
387
|
-
|
|
247
|
+
Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) ([getJsonSchema](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.4.0#user-content-metadata-can-now-be-associated-with-field-schema-22564)) leverages such system-understood metadata to generate useful information.
|
|
248
|
+
In the case of the `description` property, it is mapped directly to the `description` property supported by JSON Schema.
|
|
388
249
|
|
|
389
|
-
|
|
390
|
-
|
|
250
|
+
Custom, user-defined properties can also be specified.
|
|
251
|
+
These properties will not be used by the system by default, but can be used to associate common application-specific properties with Node Schema.
|
|
391
252
|
|
|
392
|
-
|
|
253
|
+
#### `SchemaFactoryAlpha` Updates
|
|
393
254
|
|
|
394
|
-
|
|
395
|
-
|
|
255
|
+
- `object` and `objectRecursive`, `arrayRecursive`, and `mapRecursive` now support `metadata` in their `options` parameter.
|
|
256
|
+
- (new) `arrayAlpha` - Variant of `array` that accepts an options parameter which supports `metadata`
|
|
257
|
+
- (new) `mapAlpha` - Variant of `map` that accepts an options parameter which supports `metadata`
|
|
396
258
|
|
|
397
|
-
|
|
398
|
-
Try `npm i --save-dev @types/ungap__structured-clone` if it exists or add a new declaration (.d.ts) file containing `declare module '@ungap/structured-clone';`
|
|
259
|
+
#### Example
|
|
399
260
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
261
|
+
An application is implementing search functionality.
|
|
262
|
+
By default, the app author wishes for all app content to be potentially indexable by search, unless otherwise specified.
|
|
263
|
+
They can leverage schema metadata to decorate types of nodes that should be ignored by search, and leverage that information when walking the tree during a search.
|
|
403
264
|
|
|
404
|
-
|
|
405
|
-
The second error impacts projects using the `noImplicitAny` tsconfig setting and the `fluid-framework` or `@fluidframework/tree` packages.
|
|
265
|
+
```typescript
|
|
406
266
|
|
|
407
|
-
|
|
267
|
+
interface AppMetadata {
|
|
268
|
+
/**
|
|
269
|
+
* Whether or not nodes of this type should be ignored by search.
|
|
270
|
+
* @defaultValue `false`
|
|
271
|
+
*/
|
|
272
|
+
searchIgnore?: boolean;
|
|
273
|
+
}
|
|
408
274
|
|
|
409
|
-
|
|
275
|
+
const schemaFactory = new SchemaFactoryAlpha(...);
|
|
276
|
+
class Point extends schemaFactory.object("Point", {
|
|
277
|
+
x: schemaFactory.required(schemaFactory.number),
|
|
278
|
+
y: schemaFactory.required(schemaFactory.number),
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
metadata: {
|
|
282
|
+
description: "A point in 2D space",
|
|
283
|
+
custom: {
|
|
284
|
+
searchIgnore: true,
|
|
285
|
+
},
|
|
286
|
+
}
|
|
287
|
+
}) {}
|
|
410
288
|
|
|
411
|
-
|
|
289
|
+
```
|
|
412
290
|
|
|
413
|
-
|
|
414
|
-
This replaces the use of `typedObjectValues` which has been removed.
|
|
291
|
+
Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
|
|
415
292
|
|
|
416
|
-
|
|
293
|
+
#### Potential for breaking existing code
|
|
417
294
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
type Mode = NodeFromSchema<(typeof Mode.schema)[number]>;
|
|
422
|
-
class Parent extends schemaFactory.object("Parent", { mode: Mode.schema }) {}
|
|
423
|
-
```
|
|
295
|
+
These changes add the new property "metadata" to the base type from which all node schema derive.
|
|
296
|
+
If you have existing node schema subclasses that include a property of this name, there is a chance for potential conflict here that could be breaking.
|
|
297
|
+
If you encounter issues here, consider renaming your property or leveraging the new metadata support.
|
|
424
298
|
|
|
425
|
-
|
|
299
|
+
- New alpha APIs for schema evolution ([#23362](https://github.com/microsoft/FluidFramework/pull/23362)) [2406e00efe](https://github.com/microsoft/FluidFramework/commit/2406e00efed282be58a9e09cb3478c9a9d170ef0)
|
|
426
300
|
|
|
427
|
-
|
|
428
|
-
type Mode = NodeFromSchema<(typeof Mode)[keyof typeof Mode]>; // This no longer works
|
|
429
|
-
class Parent extends schemaFactory.object("Parent", { mode: typedObjectValues(Mode) }) {} // This no longer works
|
|
430
|
-
```
|
|
301
|
+
There are now `@alpha` APIs for schema evolution which support adding optional fields to object node types without a staged rollout.
|
|
431
302
|
|
|
432
|
-
|
|
303
|
+
SharedTree has many safety checks in place to ensure applications understand the format of documents they must support.
|
|
304
|
+
One of these checks verifies that the view schema (defined in application's code) aligns with the document schema (determined by the document data at rest).
|
|
305
|
+
This helps to ensure that clients running incompatible versions of the application's code don't collaborate at the same time on some document, which could cause data loss or disrupt application invariants.
|
|
306
|
+
One general solution application authors can perform is to stage the rollout of a feature which changes document schema into multiple phases:
|
|
433
307
|
|
|
434
|
-
|
|
435
|
-
|
|
308
|
+
1. Release an application version which understands documents written with the new format but doesn't attempt to upgrade any documents
|
|
309
|
+
2. Wait for this application version to saturate in the app's ecosystem
|
|
310
|
+
3. Release an application version which upgrades documents to start leveraging the new format.
|
|
436
311
|
|
|
437
|
-
|
|
312
|
+
However, this process can be cumbersome for application authors: for many types of changes, an app author doesn't particularly care if older application code collaborates with newer code, as the only downside is that the older application version might not present a fully faithful experience.
|
|
313
|
+
As an example, consider an application which renders circles on a canvas (similar to what is presented [here](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md)).
|
|
314
|
+
The application author might anticipate adding support to render the circle with various different other properties (border style, border width, background color, varying radius, etc.).
|
|
315
|
+
Therefore, they should declare their schema using `SchemaFactoryObjectOptions.allowUnknownOptionalFields` like so:
|
|
438
316
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
317
|
+
```typescript
|
|
318
|
+
import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
|
|
319
|
+
// "Old" application code/schema
|
|
320
|
+
const factory = new SchemaFactoryAlpha("Geometry");
|
|
321
|
+
class Circle extends factory.object(
|
|
322
|
+
"Circle",
|
|
323
|
+
{
|
|
324
|
+
x: factory.number,
|
|
325
|
+
y: factory.number,
|
|
326
|
+
},
|
|
327
|
+
{ allowUnknownOptionalFields: true },
|
|
328
|
+
) {}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Later, they add some of these features to their application:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
|
|
335
|
+
// "New" application code/schema
|
|
336
|
+
const factory = new SchemaFactoryAlpha("Geometry");
|
|
337
|
+
class Circle extends factory.object(
|
|
338
|
+
"Circle",
|
|
339
|
+
{
|
|
340
|
+
x: factory.number,
|
|
341
|
+
y: factory.number,
|
|
342
|
+
// Note that radius and color must both be declared as optional fields since this application must
|
|
343
|
+
// support opening up existing documents that didn't have this information.
|
|
344
|
+
radius: factory.optional(factory.number),
|
|
345
|
+
color: factory.optional(factory.string), // ex: #00FF00
|
|
346
|
+
},
|
|
347
|
+
{ allowUnknownOptionalFields: true },
|
|
348
|
+
) {}
|
|
349
|
+
```
|
|
447
350
|
|
|
448
|
-
|
|
449
|
-
|
|
351
|
+
When they go to deploy this newer version of the application, they could opt to start upgrading documents as soon as the newer code is rolled out, and the older code would still be able to open up (and collaborate on) documents using the newer schema version.
|
|
352
|
+
Note that it's only important that the old _application code_ elected to allow opening documents with unknown optional fields.
|
|
353
|
+
This policy is not persisted into documents in any form, so applications are free to modify it at any point.
|
|
450
354
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
const _fromNothing: Schema = new Schema();
|
|
454
|
-
```
|
|
355
|
+
For specific API details, see documentation on `SchemaFactoryObjectOptions.allowUnknownOptionalFields`.
|
|
356
|
+
For a more thorough discussion of this topic, see [Schema Evolvability](https://github.com/microsoft/FluidFramework/tree/main/packages/dds/tree#schema-evolvability) in the SharedTree README.
|
|
455
357
|
|
|
456
|
-
|
|
457
|
-
class Schema extends schemaFactory.map("x", schemaFactory.number) {}
|
|
358
|
+
## 2.12.0
|
|
458
359
|
|
|
459
|
-
|
|
460
|
-
const _fromIterable: Schema = new Schema([]);
|
|
461
|
-
const _fromObject: Schema = new Schema({});
|
|
360
|
+
Dependency updates only.
|
|
462
361
|
|
|
463
|
-
|
|
464
|
-
const _fromUndefined: Schema = new Schema(undefined);
|
|
465
|
-
const _fromNothing: Schema = new Schema();
|
|
466
|
-
```
|
|
362
|
+
## 2.11.0
|
|
467
363
|
|
|
468
|
-
|
|
469
|
-
const Schema = schemaFactory.array(schemaFactory.number);
|
|
470
|
-
type Schema = NodeFromSchema<typeof Schema>;
|
|
364
|
+
### Minor Changes
|
|
471
365
|
|
|
472
|
-
|
|
473
|
-
const _fromIterable: Schema = Schema.create([]);
|
|
366
|
+
- Revertible objects can now be cloned using `RevertibleAlpha.clone()` ([#23044](https://github.com/microsoft/FluidFramework/pull/23044)) [5abfa015af](https://github.com/microsoft/FluidFramework/commit/5abfa015aff9d639d82830f3ad828324d5680bd7)
|
|
474
367
|
|
|
475
|
-
|
|
476
|
-
const _fromUndefined: Schema = Schema.create(undefined);
|
|
477
|
-
const _fromNothing: Schema = Schema.create();
|
|
478
|
-
```
|
|
368
|
+
The `DisposableRevertible` interface has been replaced with `RevertibleAlpha`. The new `RevertibleAlpha` interface extends `Revertible` and includes a `clone(branch: TreeBranch)` method to facilitate cloning a Revertible to a specified target branch. The source branch where the `RevertibleAlpha` was created must share revision logs with the target branch where the `RevertibleAlpha` is being cloned. If this condition is not met, the operation will throw an error.
|
|
479
369
|
|
|
480
|
-
|
|
481
|
-
const Schema = schemaFactory.map(schemaFactory.number);
|
|
482
|
-
type Schema = NodeFromSchema<typeof Schema>;
|
|
483
|
-
// Existing support
|
|
484
|
-
const _fromIterable: Schema = Schema.create([]);
|
|
485
|
-
const _fromObject: Schema = Schema.create({});
|
|
370
|
+
- Providing unused properties in object literals for building empty ObjectNodes no longer compiles ([#23162](https://github.com/microsoft/FluidFramework/pull/23162)) [dc3c30019e](https://github.com/microsoft/FluidFramework/commit/dc3c30019ef869b27b9468bff59f10434d3c5c68)
|
|
486
371
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const _fromNothing: Schema = Schema.create();
|
|
490
|
-
```
|
|
372
|
+
ObjectNodes with no fields will now emit a compiler error if constructed from an object literal with fields.
|
|
373
|
+
This matches the behavior of non-empty ObjectNodes which already gave errors when unexpected properties were provided.
|
|
491
374
|
|
|
492
|
-
|
|
375
|
+
```typescript
|
|
376
|
+
class A extends schemaFactory.object("A", {}) {}
|
|
377
|
+
const a = new A({ thisDoesNotExist: 5 }); // This now errors.
|
|
378
|
+
```
|
|
493
379
|
|
|
494
|
-
|
|
495
|
-
Due to limitations of the TypeScript language, there was no practical way to prevent less descriptive types, like `TreeNodeSchema` or `ImplicitFieldSchema`, from being used where the type of a specific schema was intended.
|
|
496
|
-
Code which does this will encounter several issues with tree APIs, and this change fixes some of those issues.
|
|
497
|
-
This change mainly fixes that `NodeFromSchema<TreeNodeSchema>` used to return `unknown` and now returns `TreeNode | TreeLeafValue`.
|
|
380
|
+
- The events library has been moved from the tree package ([#23141](https://github.com/microsoft/FluidFramework/pull/23141)) [cae07b5c8c](https://github.com/microsoft/FluidFramework/commit/cae07b5c8c7904184b5fbf8c677f302da19cc697)
|
|
498
381
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
382
|
+
In previous releases, the `@fluidframework/tree` package contained an internal events library. The events-related types and interfaces have been moved to
|
|
383
|
+
`@fluidframework/core-interfaces`, while the implementation has been relocated to `@fluid-internal/client-utils`. There are
|
|
384
|
+
no changes to how the events library is used; the relocation simply organizes the library into more appropriate
|
|
385
|
+
packages. This change should have no impact on developers using the Fluid Framework.
|
|
502
386
|
|
|
503
|
-
|
|
504
|
-
With the typing being partly fixed, some unsafe inputs are still allowed when trying to initialize such a view, but some are now prevented.
|
|
387
|
+
## 2.10.0
|
|
505
388
|
|
|
506
|
-
|
|
507
|
-
Despite this, it did mostly work in some cases, and has some real use-cases (like tests looping over test data consisting of pairs of schema and initial trees).
|
|
508
|
-
To help mitigate the impact of this change, some experimental `@alpha` APIs have been introduced to help address these previously unsupported but somewhat working use-cases.
|
|
389
|
+
### Minor Changes
|
|
509
390
|
|
|
510
|
-
|
|
391
|
+
- Fix typing bug in `adaptEnum` and `enumFromStrings` ([#23077](https://github.com/microsoft/FluidFramework/pull/23077)) [cfb68388cb](https://github.com/microsoft/FluidFramework/commit/cfb68388cb6b88a0ef670633b3afa46a82c99972)
|
|
511
392
|
|
|
512
|
-
|
|
513
|
-
import { TinyliciousClient } from "@fluidframework/tinylicious-client";
|
|
514
|
-
import {
|
|
515
|
-
SchemaFactory,
|
|
516
|
-
SharedTree,
|
|
517
|
-
TreeViewConfiguration,
|
|
518
|
-
type TreeNodeSchema,
|
|
519
|
-
} from "fluid-framework";
|
|
520
|
-
|
|
521
|
-
// Create a ITree instance
|
|
522
|
-
const tinyliciousClient = new TinyliciousClient();
|
|
523
|
-
const { container } = await tinyliciousClient.createContainer({ initialObjects: {} }, "2");
|
|
524
|
-
const tree = await container.create(SharedTree);
|
|
393
|
+
When using the return value from [`adaptEnum`](https://fluidframework.com/docs/api/v2/tree#adaptenum-function) as a function, passing in a value who's type is a union no longer produced an incorrectly typed return value. This has been fixed.
|
|
525
394
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
// Bad: This loses the schema aware type information. `: TreeNodeSchema` should be omitted to preserve strong typing.
|
|
529
|
-
const schema: TreeNodeSchema = schemaFactory.array(schemaFactory.number);
|
|
530
|
-
const config = new TreeViewConfiguration({ schema });
|
|
395
|
+
Additionally [`enumFromStrings`](https://fluidframework.com/docs/api/v2/tree#enumfromstrings-function) has improved the typing of its schema, ensuring the returned object's members have sufficiently specific types.
|
|
396
|
+
Part of this improvement was fixing the `.schema` property to be a tuple over each of the schema where it was previously a tuple of a single combined schema due to a bug.
|
|
531
397
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
view.root = "invalid";
|
|
536
|
-
view.root = {};
|
|
537
|
-
// Since all assignments are allowed, valid ones still work:
|
|
538
|
-
view.root = [];
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
After this change:
|
|
542
|
-
|
|
543
|
-
```typescript
|
|
544
|
-
// Root is now typed as `TreeNode | TreeLeafValue`, still allowing some invalid assignment operations.
|
|
545
|
-
// In the future this should be prevented as well, since the type of the setter in this case should be `never`.
|
|
546
|
-
view.root = "invalid";
|
|
547
|
-
// This no longer compiles:
|
|
548
|
-
view.root = {};
|
|
549
|
-
// This also no longer compiles despite being valid at runtime:
|
|
550
|
-
view.root = [];
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
For code that wants to continue using an unsafe API, which can result in runtime errors if the data does not follow the schema, a new alternative has been added to address this use-case. A special type `UnsafeUnknownSchema` can now be used to opt into allowing all valid trees to be provided.
|
|
554
|
-
Note that this leaves ensuring the data is in schema up to the user.
|
|
555
|
-
For now these adjusted APIs can be accessed by casting the view to `TreeViewAlpha<UnsafeUnknownSchema>`.
|
|
556
|
-
If stabilized, this option will be added to `TreeView` directly.
|
|
557
|
-
|
|
558
|
-
```typescript
|
|
559
|
-
const viewAlpha = view as TreeViewAlpha<UnsafeUnknownSchema>;
|
|
560
|
-
viewAlpha.initialize([]);
|
|
561
|
-
viewAlpha.root = [];
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
Additionally, this seems to have negatively impacted co-recursive schema which declare a co-recursive array as the first schema in the co-recursive cycle.
|
|
565
|
-
Like the TypeScript language our schema system is built on, we don't guarantee exactly which recursive type will compile, but will do our best to ensure useful recursive schema can be created easily.
|
|
566
|
-
In this case a slight change may be required to some recursive schema to get them to compile again:
|
|
567
|
-
|
|
568
|
-
For example this schema used to compile:
|
|
569
|
-
|
|
570
|
-
```typescript
|
|
571
|
-
class A extends sf.arrayRecursive("A", [() => B]) {}
|
|
572
|
-
{
|
|
573
|
-
type _check = ValidateRecursiveSchema<typeof A>;
|
|
574
|
-
}
|
|
575
|
-
// Used to work, but breaks in this update.
|
|
576
|
-
class B extends sf.object("B", { x: A }) {}
|
|
577
|
-
```
|
|
398
|
+
One side-effect of these fixes is that narrowing of the `value` field of a node typed from the `.schema` behaves slightly different, such that the node type is now a union instead of it being a single type with a `.value` that is a union.
|
|
399
|
+
This means that narrowing based on `.value` property narrows which node type you have, not just the value property.
|
|
400
|
+
This mainly matters when matching all cases like the switch statement below:
|
|
578
401
|
|
|
579
|
-
|
|
580
|
-
|
|
402
|
+
```typescript
|
|
403
|
+
const Mode = enumFromStrings(schema, ["Fun", "Bonus"]);
|
|
404
|
+
type Mode = TreeNodeFromImplicitAllowedTypes<typeof Mode.schema>;
|
|
405
|
+
const node = new Mode.Bonus() as Mode;
|
|
581
406
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
type _check = ValidateRecursiveSchema<typeof A>;
|
|
407
|
+
switch (node.value) {
|
|
408
|
+
case "Fun": {
|
|
409
|
+
assert.fail();
|
|
586
410
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
type _check = ValidateRecursiveSchema<typeof B>;
|
|
591
|
-
}
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
Note: while the following pattern may still compile, we recommend using the previous pattern instead since the one below may break in the future.
|
|
595
|
-
|
|
596
|
-
```typescript
|
|
597
|
-
class B extends sf.objectRecursive("B", { x: [() => A] }) {}
|
|
598
|
-
{
|
|
599
|
-
type _check = ValidateRecursiveSchema<typeof B>;
|
|
411
|
+
case "Bonus": {
|
|
412
|
+
// This one runs
|
|
413
|
+
break;
|
|
600
414
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
415
|
+
default:
|
|
416
|
+
// Before this change, "node.value" was never here, now "node" is never.
|
|
417
|
+
unreachableCase(node);
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
- SharedTree event listeners that implement `Listenable` now allow deregistration of event listeners via an `off()` function. ([#23046](https://github.com/microsoft/FluidFramework/pull/23046)) [c59225db03](https://github.com/microsoft/FluidFramework/commit/c59225db033a516ee20e459ae31567d97ce8776c)
|
|
422
|
+
|
|
423
|
+
The ability to deregister events via a callback returned by `on()` remains the same.
|
|
424
|
+
Both strategies will remain supported and consumers of SharedTree events may choose which method of deregistration they prefer in a given instance.
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
// The new behavior
|
|
428
|
+
function deregisterViaOff(view: TreeView<MySchema>): {
|
|
429
|
+
const listener = () => { /* ... */ };
|
|
430
|
+
view.events.on("commitApplied", listener); // Register
|
|
431
|
+
view.events.off("commitApplied", listener); // Deregister
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// The existing behavior (still supported)
|
|
435
|
+
function deregisterViaCallback(view: TreeView<MySchema>): {
|
|
436
|
+
const off = view.events.on("commitApplied", () => { /* ... */ }); // Register
|
|
437
|
+
off(); // Deregister
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
- Allow constructing recursive maps from objects ([#23070](https://github.com/microsoft/FluidFramework/pull/23070)) [0185a08c6f](https://github.com/microsoft/FluidFramework/commit/0185a08c6f8bf6e922a6467f11da049503c4d215)
|
|
442
|
+
|
|
443
|
+
Previously only non-recursive maps could be constructed from objects.
|
|
444
|
+
Now all maps nodes can constructed from objects:
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
class MapRecursive extends sf.mapRecursive("Map", [() => MapRecursive]) {}
|
|
448
|
+
{
|
|
449
|
+
type _check = ValidateRecursiveSchema<typeof MapRecursive>;
|
|
450
|
+
}
|
|
451
|
+
// New:
|
|
452
|
+
const fromObject = new MapRecursive({ x: new MapRecursive() });
|
|
453
|
+
// Existing:
|
|
454
|
+
const fromIterator = new MapRecursive([["x", new MapRecursive()]]);
|
|
455
|
+
const fromMap = new MapRecursive(new Map([["x", new MapRecursive()]]));
|
|
456
|
+
const fromNothing = new MapRecursive();
|
|
457
|
+
const fromUndefined = new MapRecursive(undefined);
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
- Provide more comprehensive replacement to the `commitApplied` event ([#22977](https://github.com/microsoft/FluidFramework/pull/22977)) [e51c94da32](https://github.com/microsoft/FluidFramework/commit/e51c94da3248868de3c0c7fdce568cc425204155)
|
|
461
|
+
|
|
462
|
+
Adds a new `changed` event to the (currently alpha) `TreeBranchEvents` that replaces the `commitApplied` event on `TreeViewEvents`.
|
|
463
|
+
This new event is fired for both local and remote changes and maintains the existing functionality of `commitApplied` that is used for obtaining `Revertibles`.
|
|
606
464
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
```typescript
|
|
610
|
-
const schemaFactory = new SchemaFactory("com.myApp");
|
|
611
|
-
class A extends schemaFactory.object("A", {}) {}
|
|
612
|
-
class B extends schemaFactory.array("B", schemaFactory.number) {}
|
|
465
|
+
## 2.5.0
|
|
613
466
|
|
|
614
|
-
|
|
615
|
-
const schema = [A, B];
|
|
467
|
+
### Minor Changes
|
|
616
468
|
|
|
617
|
-
|
|
618
|
-
const view = sharedTree.viewWith(config);
|
|
469
|
+
- ✨ New! Alpha APIs for tree data import and export ([#22566](https://github.com/microsoft/FluidFramework/pull/22566)) [18a23e8816](https://github.com/microsoft/FluidFramework/commit/18a23e8816467f2ed0c9d6d8637b70d99aa48b7a)
|
|
619
470
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
```
|
|
471
|
+
A collection of new `@alpha` APIs for importing and exporting tree content and schema from SharedTrees has been added to `TreeAlpha`.
|
|
472
|
+
These include import and export APIs for `VerboseTree`, `ConciseTree` and compressed tree formats.
|
|
623
473
|
|
|
624
|
-
|
|
474
|
+
`TreeAlpha.create` is also added to allow constructing trees with a more general API instead of having to use the schema constructor directly (since that doesn't handle polymorphic roots, or non-schema aware code).
|
|
625
475
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
476
|
+
The function `independentInitializedView` has been added to provide a way to combine data from the existing `extractPersistedSchema` and new `TreeAlpha.exportCompressed` back into a `TreeView` in a way which can support safely importing data which could have been exported with a different schema.
|
|
477
|
+
This allows replicating the schema evolution process for Fluid documents stored in a service, but entirely locally without involving any collaboration services.
|
|
478
|
+
`independentView` has also been added, which is similar but handles the case of creating a new view without an existing schema or tree.
|
|
629
479
|
|
|
630
|
-
|
|
631
|
-
const schema: (typeof A | typeof B)[] = [B];
|
|
632
|
-
```
|
|
480
|
+
Together these APIs address several use-cases:
|
|
633
481
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
482
|
+
1. Using SharedTree as an in-memory non-collaborative datastore.
|
|
483
|
+
2. Importing and exporting data from a SharedTree to and from other services or storage locations (such as locally saved files).
|
|
484
|
+
3. Testing various scenarios without relying on a service.
|
|
485
|
+
4. Using SharedTree libraries for just the schema system and encode/decode support.
|
|
637
486
|
|
|
638
|
-
|
|
487
|
+
- Compilation no longer fails when building with TypeScript's libCheck option ([#22923](https://github.com/microsoft/FluidFramework/pull/22923)) [a1b4cdd45e](https://github.com/microsoft/FluidFramework/commit/a1b4cdd45ee9812e2598ab8d2854333d26a06eb4)
|
|
639
488
|
|
|
640
|
-
|
|
489
|
+
When compiling code using Fluid Framework with TypeScript's `libCheck` (meaning without [skipLibCheck](https://www.typescriptlang.org/tsconfig/#skipLibCheck)), two compile errors can be encountered:
|
|
641
490
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const config = new TreeViewConfiguration({ schema });
|
|
645
|
-
```
|
|
491
|
+
```
|
|
492
|
+
> tsc
|
|
646
493
|
|
|
647
|
-
|
|
648
|
-
const config = new TreeViewConfiguration({ schema: [A, B] });
|
|
649
|
-
```
|
|
494
|
+
node_modules/@fluidframework/merge-tree/lib/client.d.ts:124:18 - error TS2368: Type parameter name cannot be 'undefined'.
|
|
650
495
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
However, when given `AllowedTypes` arrays which should not contain any unions, but that were accidentally flattened to a single union, it can fix them:
|
|
496
|
+
124 walkSegments<undefined>(handler: ISegmentAction<undefined>, start?: number, end?: number, accum?: undefined, splitRange?: boolean): void;
|
|
497
|
+
~~~~~~~~~
|
|
654
498
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
const schemaBad = [A, B];
|
|
658
|
-
// Fixes the type to be [typeof A, typeof B]
|
|
659
|
-
const schema = unsafeArrayToTuple(schemaBad);
|
|
499
|
+
node_modules/@fluidframework/tree/lib/util/utils.d.ts:5:29 - error TS7016: Could not find a declaration file for module '@ungap/structured-clone'. 'node_modules/@ungap/structured-clone/esm/index.js' implicitly has an 'any' type.
|
|
500
|
+
Try `npm i --save-dev @types/ungap__structured-clone` if it exists or add a new declaration (.d.ts) file containing `declare module '@ungap/structured-clone';`
|
|
660
501
|
|
|
661
|
-
|
|
662
|
-
|
|
502
|
+
5 import structuredClone from "@ungap/structured-clone";
|
|
503
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
504
|
+
```
|
|
663
505
|
|
|
664
|
-
|
|
506
|
+
The first error impacts projects using TypeScript 5.5 or greater and either of the `fluid-framework` or `@fluidframework/merge-tree` packages.
|
|
507
|
+
The second error impacts projects using the `noImplicitAny` tsconfig setting and the `fluid-framework` or `@fluidframework/tree` packages.
|
|
665
508
|
|
|
666
|
-
|
|
667
|
-
The branching functions (`branch`, `merge`, `rebaseOnto`, etc.) are now directly available on the view object rather than a separate object.
|
|
668
|
-
In particular, `TreeViewAlpha` is now a `TreeBranch`, which exposes the methods to coordinate branches.
|
|
509
|
+
Both errors have been fixed.
|
|
669
510
|
|
|
670
|
-
|
|
511
|
+
This should allow `libCheck` to be reenabled in any impacted projects.
|
|
671
512
|
|
|
672
|
-
|
|
513
|
+
- A `.schema` member has been added to the alpha enum schema APIs ([#22874](https://github.com/microsoft/FluidFramework/pull/22874)) [645b9ed695](https://github.com/microsoft/FluidFramework/commit/645b9ed69540338843ad14f1144ff4d1f80d6f09)
|
|
673
514
|
|
|
674
|
-
|
|
515
|
+
The return value from `@alpha` APIs `enumFromStrings` and `adaptEnum` now has a property named `schema` which can be used to include it in a parent schema.
|
|
516
|
+
This replaces the use of `typedObjectValues` which has been removed.
|
|
675
517
|
|
|
676
|
-
|
|
677
|
-
const sf = new SchemaFactory("example");
|
|
678
|
-
class StringArray extends sf.array("StringArray", sf.string) {}
|
|
518
|
+
Use of these APIs now look like:
|
|
679
519
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
// ...
|
|
687
|
-
// Later, merge the branch into the main view
|
|
688
|
-
view.merge(branch);
|
|
689
|
-
// `view` now contains "new string"
|
|
690
|
-
}
|
|
691
|
-
```
|
|
692
|
-
|
|
693
|
-
Here is the equivalent behavior with the previous API, for reference:
|
|
694
|
-
|
|
695
|
-
```typescript
|
|
696
|
-
const sf = new SchemaFactory("example");
|
|
697
|
-
class StringArray extends sf.array("StringArray", sf.string) {}
|
|
698
|
-
|
|
699
|
-
function example(view: TreeViewAlpha<typeof StringArray>): void {
|
|
700
|
-
// Get the branch for the view
|
|
701
|
-
const branch = getBranch(view);
|
|
702
|
-
const fork = branch.branch();
|
|
703
|
-
// Modify the branch rather than the main view
|
|
704
|
-
fork.root.insertAtEnd("new string");
|
|
705
|
-
// `view` does not yet contain "new string"
|
|
706
|
-
// ...
|
|
707
|
-
// Later, merge the branch into the main view
|
|
708
|
-
branch.merge(fork);
|
|
709
|
-
// `view` now contains "new string"
|
|
710
|
-
}
|
|
711
|
-
```
|
|
520
|
+
```typescript
|
|
521
|
+
const schemaFactory = new SchemaFactory("com.myApp");
|
|
522
|
+
const Mode = enumFromStrings(schemaFactory, ["Fun", "Cool"]);
|
|
523
|
+
type Mode = NodeFromSchema<(typeof Mode.schema)[number]>;
|
|
524
|
+
class Parent extends schemaFactory.object("Parent", { mode: Mode.schema }) {}
|
|
525
|
+
```
|
|
712
526
|
|
|
713
|
-
|
|
527
|
+
Previously, the last two lines would have been:
|
|
714
528
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
529
|
+
```typescript
|
|
530
|
+
type Mode = NodeFromSchema<(typeof Mode)[keyof typeof Mode]>; // This no longer works
|
|
531
|
+
class Parent extends schemaFactory.object("Parent", {
|
|
532
|
+
mode: typedObjectValues(Mode),
|
|
533
|
+
}) {} // This no longer works
|
|
534
|
+
```
|
|
719
535
|
|
|
720
|
-
|
|
536
|
+
- TreeNodeSchemaClass now specifies its TNode as TreeNode ([#22938](https://github.com/microsoft/FluidFramework/pull/22938)) [b669a6efdb](https://github.com/microsoft/FluidFramework/commit/b669a6efdba685c71897cade4f907304f1a73910)
|
|
721
537
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
const view = branch; // `branch` is now typed as a `TreeViewAlpha<MySchema>`
|
|
725
|
-
}
|
|
726
|
-
```
|
|
538
|
+
`TreeNodeSchemaClass`'s `TNode` parameter was formerly `unknown` and has been improved to be the more specific `TreeNode | TreeLeafValue`.
|
|
539
|
+
This change further narrows this to `TreeNode`.
|
|
727
540
|
|
|
728
|
-
|
|
541
|
+
`TreeNodeSchema`, which is more commonly used, still permits `TNode` of `TreeNode | TreeLeafValue`, so this change should have little impact on most code, but in some edge cases it can result in slightly more specific typing.
|
|
729
542
|
|
|
730
|
-
|
|
731
|
-
const viewAlpha = asTreeViewAlpha(view);
|
|
732
|
-
```
|
|
543
|
+
- Array and Map nodes can now be explicitly constructed with undefined or no argument ([#22946](https://github.com/microsoft/FluidFramework/pull/22946)) [176335ce88](https://github.com/microsoft/FluidFramework/commit/176335ce88d005159819c559b445a1655ec429d5)
|
|
733
544
|
|
|
734
|
-
|
|
545
|
+
The input parameter to the constructor and `create` methods of Array and Map nodes is now optional. When the optional parameter is omitted, an empty map or array will be created.
|
|
735
546
|
|
|
736
|
-
|
|
547
|
+
#### Examples
|
|
737
548
|
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
A new alpha `configuredSharedTree` had been added.
|
|
741
|
-
This allows providing configuration options, primarily for debugging, testing and evaluation of upcoming features.
|
|
742
|
-
The resulting configured `SharedTree` object can then be used in-place of the regular `SharedTree` imported from `fluid-framework`.
|
|
743
|
-
|
|
744
|
-
```typescript
|
|
745
|
-
import {
|
|
746
|
-
ForestType,
|
|
747
|
-
TreeCompressionStrategy,
|
|
748
|
-
configuredSharedTree,
|
|
749
|
-
typeboxValidator,
|
|
750
|
-
} from "@fluid-framework/alpha";
|
|
751
|
-
// Maximum debuggability and validation enabled:
|
|
752
|
-
const SharedTree = configuredSharedTree({
|
|
753
|
-
forest: ForestType.Expensive,
|
|
754
|
-
jsonValidator: typeboxValidator,
|
|
755
|
-
treeEncodeType: TreeCompressionStrategy.Uncompressed,
|
|
756
|
-
});
|
|
757
|
-
// Opts into the under development optimized tree storage planned to be the eventual default implementation:
|
|
758
|
-
const SharedTree = configuredSharedTree({
|
|
759
|
-
forest: ForestType.Optimized,
|
|
760
|
-
});
|
|
761
|
-
```
|
|
762
|
-
|
|
763
|
-
- ✨ New! Alpha API for snapshotting Schema ([#22733](https://github.com/microsoft/FluidFramework/pull/22733)) [920a65f66e](https://github.com/microsoft/FluidFramework/commit/920a65f66e0caad7e1b5e3df1e0afd3475a87c4a)
|
|
764
|
-
|
|
765
|
-
`extractPersistedSchema` can now be used to extra a JSON-compatible representation of the subset of a schema that gets stored in documents.
|
|
766
|
-
This can be used write tests which snapshot an applications schema.
|
|
767
|
-
Such tests can be used to detect schema changes which could would impact document compatibility,
|
|
768
|
-
and can be combined with the new `comparePersistedSchema` to measure what kind of compatibility impact the schema change has.
|
|
769
|
-
|
|
770
|
-
- Fix reading of `null` from unhydrated trees ([#22748](https://github.com/microsoft/FluidFramework/pull/22748)) [6a75bd0616](https://github.com/microsoft/FluidFramework/commit/6a75bd0616ecd315ae0e9458d88ba1c755dfd785)
|
|
771
|
-
|
|
772
|
-
Unhydrated trees containing object nodes with required fields set to `null` used to throw an error.
|
|
773
|
-
This was a bug: `null` is a valid value in tree's whose schema allow it, and this specific case now correctly returns `null` values when appropriate without erroring.
|
|
774
|
-
|
|
775
|
-
- Expose the view schema from the TreeView interface ([#22547](https://github.com/microsoft/FluidFramework/pull/22547)) [2aa29d9a13](https://github.com/microsoft/FluidFramework/commit/2aa29d9a13f099b129ec6834c8cbdaf6a25db114)
|
|
776
|
-
|
|
777
|
-
Users of TreeView can now access the type-safe view schema directly on the view object via `TreeView.schema`.
|
|
778
|
-
This allows users to avoid passing the schema around in addition to the view in scenarios where both are needed.
|
|
779
|
-
It also avoids scenarios in which code wants to accept both a view and its schema and thus must constrain both to be of the same schema type.
|
|
780
|
-
|
|
781
|
-
- Metadata can now be associated with Field Schema ([#22564](https://github.com/microsoft/FluidFramework/pull/22564)) [1d9f4c97ed](https://github.com/microsoft/FluidFramework/commit/1d9f4c97edf3f2bbf23ca30c35b67f0ec38b728d)
|
|
782
|
-
|
|
783
|
-
Users of TreeView can now specify metadata when creating Field Schema.
|
|
784
|
-
This includes system-understood metadata, i.e., `description`.
|
|
785
|
-
|
|
786
|
-
Example:
|
|
787
|
-
|
|
788
|
-
```typescript
|
|
789
|
-
class Point extends schemaFactory.object("Point", {
|
|
790
|
-
x: schemaFactory.required(schemaFactory.number, {
|
|
791
|
-
metadata: { description: "The horizontal component of the point." },
|
|
792
|
-
}),
|
|
793
|
-
y: schemaFactory.required(schemaFactory.number, {
|
|
794
|
-
metadata: { description: "The vertical component of the point." },
|
|
795
|
-
}),
|
|
796
|
-
}) {}
|
|
797
|
-
```
|
|
798
|
-
|
|
799
|
-
Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) (`getJsonSchema`) can leverage such system-understood metadata to generate useful information.
|
|
800
|
-
In the case of the `description` property, this is mapped directly to the `description` property supported by JSON Schema.
|
|
801
|
-
|
|
802
|
-
Custom, user-defined properties can also be specified.
|
|
803
|
-
These properties will not be leveraged by the system by default, but can be used as a handy means of associating common application-specific properties with Field Schema.
|
|
804
|
-
|
|
805
|
-
Example:
|
|
806
|
-
|
|
807
|
-
An application is implementing search functionality.
|
|
808
|
-
By default, the app author wishes for all app content to be indexable by search, unless otherwise specified.
|
|
809
|
-
They can leverage schema metadata to decorate fields that should be ignored by search, and leverage that information when walking the tree during a search.
|
|
810
|
-
|
|
811
|
-
```typescript
|
|
812
|
-
|
|
813
|
-
interface AppMetadata {
|
|
814
|
-
/**
|
|
815
|
-
* Whether or not the field should be ignored by search.
|
|
816
|
-
* @defaultValue `false`
|
|
817
|
-
*/
|
|
818
|
-
searchIgnore?: boolean;
|
|
819
|
-
}
|
|
549
|
+
```typescript
|
|
550
|
+
class Schema extends schemaFactory.array("x", schemaFactory.number) {}
|
|
820
551
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
metadata: {
|
|
824
|
-
description: "The position of the upper-left corner of the note."
|
|
825
|
-
custom: {
|
|
826
|
-
// Search doesn't care where the note is on the canvas.
|
|
827
|
-
// It only cares about the text content.
|
|
828
|
-
searchIgnore: true
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
}),
|
|
832
|
-
text: schemaFactory.required(schemaFactory.string, {
|
|
833
|
-
metadata: {
|
|
834
|
-
description: "The textual contents of the note."
|
|
835
|
-
}
|
|
836
|
-
}),
|
|
837
|
-
}) {}
|
|
838
|
-
|
|
839
|
-
```
|
|
840
|
-
|
|
841
|
-
Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
|
|
842
|
-
|
|
843
|
-
- ✨ New! Alpha SharedTree branching APIs ([#22550](https://github.com/microsoft/FluidFramework/pull/22550)) [8f4587c912](https://github.com/microsoft/FluidFramework/commit/8f4587c912f955c405d7bbbc5b42f3ffc3b497d7)
|
|
844
|
-
|
|
845
|
-
Several APIs have been added to allow for creating and coordinating "version-control"-style branches of the SharedTree.
|
|
846
|
-
Use the `getBranch` entry point function to acquire a branch.
|
|
847
|
-
For example:
|
|
848
|
-
|
|
849
|
-
```ts
|
|
850
|
-
function makeEditOnBranch(mainView: TreeView<typeof MySchema>) {
|
|
851
|
-
mainView.root.myData = 3;
|
|
852
|
-
const mainBranch = getBranch(mainView); // This function accepts either a view of a SharedTree (acquired e.g. via `sharedTree.viewWith(...)`) or a `SharedTree` directly.
|
|
853
|
-
const forkBranch = mainBranch.branch(); // This creates a new branch based on the existing branch.
|
|
854
|
-
const forkView = forkBranch.viewWith(new TreeViewConfiguration({ schema: MySchema })); // Acquire a view of the forked branch in order to read or edit its tree.
|
|
855
|
-
forkView.root.myData = 4; // Set the value on the fork branch to be 4. The main branch still has a value of 3.
|
|
856
|
-
mainBranch.merge(forkBranch); // Merging the fork changes into the main branch causes the main branch to have a value of 4.
|
|
857
|
-
|
|
858
|
-
// Note: The main branch (and therefore, also the `forkView`) is automatically disposed by the merge.
|
|
859
|
-
// To prevent this, use `mainBranch.merge(forkBranch, false)`.
|
|
860
|
-
}
|
|
861
|
-
```
|
|
552
|
+
// Existing support
|
|
553
|
+
const _fromIterable: Schema = new Schema([]);
|
|
862
554
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
555
|
+
// New
|
|
556
|
+
const _fromUndefined: Schema = new Schema(undefined);
|
|
557
|
+
const _fromNothing: Schema = new Schema();
|
|
558
|
+
```
|
|
866
559
|
|
|
867
|
-
|
|
560
|
+
```typescript
|
|
561
|
+
class Schema extends schemaFactory.map("x", schemaFactory.number) {}
|
|
868
562
|
|
|
869
|
-
|
|
563
|
+
// Existing support
|
|
564
|
+
const _fromIterable: Schema = new Schema([]);
|
|
565
|
+
const _fromObject: Schema = new Schema({});
|
|
870
566
|
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
});
|
|
567
|
+
// New
|
|
568
|
+
const _fromUndefined: Schema = new Schema(undefined);
|
|
569
|
+
const _fromNothing: Schema = new Schema();
|
|
570
|
+
```
|
|
876
571
|
|
|
877
|
-
|
|
878
|
-
|
|
572
|
+
```typescript
|
|
573
|
+
const Schema = schemaFactory.array(schemaFactory.number);
|
|
574
|
+
type Schema = NodeFromSchema<typeof Schema>;
|
|
879
575
|
|
|
880
|
-
|
|
576
|
+
// Existing support
|
|
577
|
+
const _fromIterable: Schema = Schema.create([]);
|
|
881
578
|
|
|
882
|
-
|
|
579
|
+
// New
|
|
580
|
+
const _fromUndefined: Schema = Schema.create(undefined);
|
|
581
|
+
const _fromNothing: Schema = Schema.create();
|
|
582
|
+
```
|
|
883
583
|
|
|
884
|
-
|
|
885
|
-
|
|
584
|
+
```typescript
|
|
585
|
+
const Schema = schemaFactory.map(schemaFactory.number);
|
|
586
|
+
type Schema = NodeFromSchema<typeof Schema>;
|
|
587
|
+
// Existing support
|
|
588
|
+
const _fromIterable: Schema = Schema.create([]);
|
|
589
|
+
const _fromObject: Schema = Schema.create({});
|
|
886
590
|
|
|
887
|
-
|
|
591
|
+
// New
|
|
592
|
+
const _fromUndefined: Schema = Schema.create(undefined);
|
|
593
|
+
const _fromNothing: Schema = Schema.create();
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
- Typing has been improved when an exact TypeScript type for a schema is not provided ([#22763](https://github.com/microsoft/FluidFramework/pull/22763)) [05197d6d3f](https://github.com/microsoft/FluidFramework/commit/05197d6d3f0189ecd61fd74ec55f6836e6797249)
|
|
597
|
+
|
|
598
|
+
The Tree APIs are designed to be used in a strongly typed way, with the full TypeScript type for the schema always being provided.
|
|
599
|
+
Due to limitations of the TypeScript language, there was no practical way to prevent less descriptive types, like `TreeNodeSchema` or `ImplicitFieldSchema`, from being used where the type of a specific schema was intended.
|
|
600
|
+
Code which does this will encounter several issues with tree APIs, and this change fixes some of those issues.
|
|
601
|
+
This change mainly fixes that `NodeFromSchema<TreeNodeSchema>` used to return `unknown` and now returns `TreeNode | TreeLeafValue`.
|
|
602
|
+
|
|
603
|
+
This change by itself seems mostly harmless, as it just improves the precision of the typing in this one edge case.
|
|
604
|
+
Unfortunately, there are other typing bugs which complicate the situation, causing APIs for inserting data into the tree to also behave poorly when given non-specific types like `TreeNodeSchema`.
|
|
605
|
+
These APIs include cases like `TreeView.initialize`.
|
|
606
|
+
|
|
607
|
+
This incorrectly allowed some usage like taking a type-erased schema and initial tree pair, creating a view of type `TreeView<ImplicitFieldSchema>`, then initializing it.
|
|
608
|
+
With the typing being partly fixed, some unsafe inputs are still allowed when trying to initialize such a view, but some are now prevented.
|
|
609
|
+
|
|
610
|
+
This use-case of modifying trees in code not that is not strongly typed by the exact schema was not intended to be supported.
|
|
611
|
+
Despite this, it did mostly work in some cases, and has some real use-cases (like tests looping over test data consisting of pairs of schema and initial trees).
|
|
612
|
+
To help mitigate the impact of this change, some experimental `@alpha` APIs have been introduced to help address these previously unsupported but somewhat working use-cases.
|
|
613
|
+
|
|
614
|
+
Before this change:
|
|
615
|
+
|
|
616
|
+
```typescript
|
|
617
|
+
import { TinyliciousClient } from "@fluidframework/tinylicious-client";
|
|
618
|
+
import {
|
|
619
|
+
SchemaFactory,
|
|
620
|
+
SharedTree,
|
|
621
|
+
TreeViewConfiguration,
|
|
622
|
+
type TreeNodeSchema,
|
|
623
|
+
} from "fluid-framework";
|
|
624
|
+
|
|
625
|
+
// Create a ITree instance
|
|
626
|
+
const tinyliciousClient = new TinyliciousClient();
|
|
627
|
+
const { container } = await tinyliciousClient.createContainer(
|
|
628
|
+
{ initialObjects: {} },
|
|
629
|
+
"2",
|
|
630
|
+
);
|
|
631
|
+
const tree = await container.create(SharedTree);
|
|
632
|
+
|
|
633
|
+
const schemaFactory = new SchemaFactory("demo");
|
|
634
|
+
|
|
635
|
+
// Bad: This loses the schema aware type information. `: TreeNodeSchema` should be omitted to preserve strong typing.
|
|
636
|
+
const schema: TreeNodeSchema = schemaFactory.array(schemaFactory.number);
|
|
637
|
+
const config = new TreeViewConfiguration({ schema });
|
|
638
|
+
|
|
639
|
+
// This view is typed as `TreeView<TreeNodeSchema>`, which does not work well since it's missing the actual schema type information.
|
|
640
|
+
const view = tree.viewWith(config);
|
|
641
|
+
// Root is typed as `unknown` allowing invalid assignment operations.
|
|
642
|
+
view.root = "invalid";
|
|
643
|
+
view.root = {};
|
|
644
|
+
// Since all assignments are allowed, valid ones still work:
|
|
645
|
+
view.root = [];
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
After this change:
|
|
649
|
+
|
|
650
|
+
```typescript
|
|
651
|
+
// Root is now typed as `TreeNode | TreeLeafValue`, still allowing some invalid assignment operations.
|
|
652
|
+
// In the future this should be prevented as well, since the type of the setter in this case should be `never`.
|
|
653
|
+
view.root = "invalid";
|
|
654
|
+
// This no longer compiles:
|
|
655
|
+
view.root = {};
|
|
656
|
+
// This also no longer compiles despite being valid at runtime:
|
|
657
|
+
view.root = [];
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
For code that wants to continue using an unsafe API, which can result in runtime errors if the data does not follow the schema, a new alternative has been added to address this use-case. A special type `UnsafeUnknownSchema` can now be used to opt into allowing all valid trees to be provided.
|
|
661
|
+
Note that this leaves ensuring the data is in schema up to the user.
|
|
662
|
+
For now these adjusted APIs can be accessed by casting the view to `TreeViewAlpha<UnsafeUnknownSchema>`.
|
|
663
|
+
If stabilized, this option will be added to `TreeView` directly.
|
|
664
|
+
|
|
665
|
+
```typescript
|
|
666
|
+
const viewAlpha = view as TreeViewAlpha<UnsafeUnknownSchema>;
|
|
667
|
+
viewAlpha.initialize([]);
|
|
668
|
+
viewAlpha.root = [];
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
Additionally, this seems to have negatively impacted co-recursive schema which declare a co-recursive array as the first schema in the co-recursive cycle.
|
|
672
|
+
Like the TypeScript language our schema system is built on, we don't guarantee exactly which recursive type will compile, but will do our best to ensure useful recursive schema can be created easily.
|
|
673
|
+
In this case a slight change may be required to some recursive schema to get them to compile again:
|
|
674
|
+
|
|
675
|
+
For example this schema used to compile:
|
|
676
|
+
|
|
677
|
+
```typescript
|
|
678
|
+
class A extends sf.arrayRecursive("A", [() => B]) {}
|
|
679
|
+
{
|
|
680
|
+
type _check = ValidateRecursiveSchema<typeof A>;
|
|
681
|
+
}
|
|
682
|
+
// Used to work, but breaks in this update.
|
|
683
|
+
class B extends sf.object("B", { x: A }) {}
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
But now you must use the recursive functions like `objectRecursive` for types which are co-recursive with an array in some cases.
|
|
687
|
+
In our example, it can be fixed as follows:
|
|
688
|
+
|
|
689
|
+
```typescript
|
|
690
|
+
class A extends sf.arrayRecursive("A", [() => B]) {}
|
|
691
|
+
{
|
|
692
|
+
type _check = ValidateRecursiveSchema<typeof A>;
|
|
693
|
+
}
|
|
694
|
+
// Fixed corecursive type, using "Recursive" method variant to declare schema.
|
|
695
|
+
class B extends sf.objectRecursive("B", { x: A }) {}
|
|
696
|
+
{
|
|
697
|
+
type _check = ValidateRecursiveSchema<typeof B>;
|
|
698
|
+
}
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
Note: while the following pattern may still compile, we recommend using the previous pattern instead since the one below may break in the future.
|
|
702
|
+
|
|
703
|
+
```typescript
|
|
704
|
+
class B extends sf.objectRecursive("B", { x: [() => A] }) {}
|
|
705
|
+
{
|
|
706
|
+
type _check = ValidateRecursiveSchema<typeof B>;
|
|
707
|
+
}
|
|
708
|
+
// Works, for now, but not recommended.
|
|
709
|
+
class A extends sf.array("A", B) {}
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
- The strictness of input tree types when inexact schemas are provided has been improved ([#22874](https://github.com/microsoft/FluidFramework/pull/22874)) [645b9ed695](https://github.com/microsoft/FluidFramework/commit/645b9ed69540338843ad14f1144ff4d1f80d6f09)
|
|
713
|
+
|
|
714
|
+
Consider the following code where the type of the schema is not exactly specified:
|
|
715
|
+
|
|
716
|
+
```typescript
|
|
717
|
+
const schemaFactory = new SchemaFactory("com.myApp");
|
|
718
|
+
class A extends schemaFactory.object("A", {}) {}
|
|
719
|
+
class B extends schemaFactory.array("B", schemaFactory.number) {}
|
|
720
|
+
|
|
721
|
+
// Gives imprecise type (typeof A | typeof B)[]. The desired precise type here is [typeof A, typeof B].
|
|
722
|
+
const schema = [A, B];
|
|
723
|
+
|
|
724
|
+
const config = new TreeViewConfiguration({ schema });
|
|
725
|
+
const view = sharedTree.viewWith(config);
|
|
726
|
+
|
|
727
|
+
// Does not compile since setter for root is typed `never` due to imprecise schema.
|
|
728
|
+
view.root = [];
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
The assignment of `view.root` is disallowed since a schema with type `(typeof A | typeof B)[]` could be any of:
|
|
732
|
+
|
|
733
|
+
```typescript
|
|
734
|
+
const schema: (typeof A | typeof B)[] = [A];
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
```typescript
|
|
738
|
+
const schema: (typeof A | typeof B)[] = [B];
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
```typescript
|
|
742
|
+
const schema: (typeof A | typeof B)[] = [A, B];
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
The attempted assignment is not compatible with all of these (specifically it is incompatible with the first one) so performing this assignment could make the tree out of schema and is thus disallowed.
|
|
746
|
+
|
|
747
|
+
To avoid this ambiguity and capture the precise type of `[typeof A, typeof B]`, use one of the following patterns:
|
|
748
|
+
|
|
749
|
+
```typescript
|
|
750
|
+
const schema = [A, B] as const;
|
|
751
|
+
const config = new TreeViewConfiguration({ schema });
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
```typescript
|
|
755
|
+
const config = new TreeViewConfiguration({ schema: [A, B] });
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
To help update existing code which accidentally depended on this bug, an `@alpha` API `unsafeArrayToTuple` has been added.
|
|
759
|
+
Many usages of this API will produce incorrectly typed outputs.
|
|
760
|
+
However, when given `AllowedTypes` arrays which should not contain any unions, but that were accidentally flattened to a single union, it can fix them:
|
|
761
|
+
|
|
762
|
+
```typescript
|
|
763
|
+
// Gives imprecise type (typeof A | typeof B)[]
|
|
764
|
+
const schemaBad = [A, B];
|
|
765
|
+
// Fixes the type to be [typeof A, typeof B]
|
|
766
|
+
const schema = unsafeArrayToTuple(schemaBad);
|
|
767
|
+
|
|
768
|
+
const config = new TreeViewConfiguration({ schema });
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
- SharedTree branching API has been improved ([#22970](https://github.com/microsoft/FluidFramework/pull/22970)) [80ed0284f0](https://github.com/microsoft/FluidFramework/commit/80ed0284f01107d2ba8bcf2f3ebaf6175367603a)
|
|
772
|
+
|
|
773
|
+
The alpha SharedTree branching API has been updated to be more accessible and intuitive.
|
|
774
|
+
The branching functions (`branch`, `merge`, `rebaseOnto`, etc.) are now directly available on the view object rather than a separate object.
|
|
775
|
+
In particular, `TreeViewAlpha` is now a `TreeBranch`, which exposes the methods to coordinate branches.
|
|
776
|
+
|
|
777
|
+
The existing `TreeBranch` type has been renamed to `BranchableTree` and is now **deprecated**.
|
|
778
|
+
|
|
779
|
+
See the `TreeBranch` interface for more details.
|
|
780
|
+
|
|
781
|
+
The new API is used e.g. as follows:
|
|
782
|
+
|
|
783
|
+
```typescript
|
|
784
|
+
const sf = new SchemaFactory("example");
|
|
785
|
+
class StringArray extends sf.array("StringArray", sf.string) {}
|
|
786
|
+
|
|
787
|
+
function example(view: TreeViewAlpha<typeof StringArray>): void {
|
|
788
|
+
// Create a branch
|
|
789
|
+
const branch = view.fork();
|
|
790
|
+
// Modify the branch rather than the main view
|
|
791
|
+
branch.root.insertAtEnd("new string");
|
|
792
|
+
// `view` does not yet contain "new string"
|
|
793
|
+
// ...
|
|
794
|
+
// Later, merge the branch into the main view
|
|
795
|
+
view.merge(branch);
|
|
796
|
+
// `view` now contains "new string"
|
|
797
|
+
}
|
|
798
|
+
```
|
|
888
799
|
|
|
889
|
-
|
|
890
|
-
See [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) for more details.
|
|
800
|
+
Here is the equivalent behavior with the previous API, for reference:
|
|
891
801
|
|
|
892
|
-
|
|
802
|
+
```typescript
|
|
803
|
+
const sf = new SchemaFactory("example");
|
|
804
|
+
class StringArray extends sf.array("StringArray", sf.string) {}
|
|
893
805
|
|
|
894
|
-
|
|
895
|
-
|
|
806
|
+
function example(view: TreeViewAlpha<typeof StringArray>): void {
|
|
807
|
+
// Get the branch for the view
|
|
808
|
+
const branch = getBranch(view);
|
|
809
|
+
const fork = branch.branch();
|
|
810
|
+
// Modify the branch rather than the main view
|
|
811
|
+
fork.root.insertAtEnd("new string");
|
|
812
|
+
// `view` does not yet contain "new string"
|
|
813
|
+
// ...
|
|
814
|
+
// Later, merge the branch into the main view
|
|
815
|
+
branch.merge(fork);
|
|
816
|
+
// `view` now contains "new string"
|
|
817
|
+
}
|
|
818
|
+
```
|
|
896
819
|
|
|
897
|
-
|
|
898
|
-
const MyMap = schemaFactory.map(schemaFactory.number);
|
|
899
|
-
type MyMap = NodeFromSchema<typeof MyMap>;
|
|
900
|
-
const _fromMap: MyMap = MyMap.create(new MyMap());
|
|
901
|
-
const _fromIterable: MyMap = MyMap.create([]);
|
|
902
|
-
const _fromObject: MyMap = MyMap.create({});
|
|
903
|
-
```
|
|
820
|
+
Additionally, there is a new API to acquire the branch from a node:
|
|
904
821
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
Since the TypeScript compiler is unable to generate references to `TreeNodeSchemaNonClass` with how it was nested in `internalTypes.js`,
|
|
910
|
-
this change could break the build of packages exporting types referencing structurally named map and array schema.
|
|
911
|
-
This has been mitigated by moving `TreeNodeSchemaNonClass` out of `internalTypes.js`:
|
|
912
|
-
any code importing `TreeNodeSchemaNonClass` (and thus disregarding the `@system` restriction) can be fixed by importing it from the top level instead of the `internalTypes.js`
|
|
822
|
+
```typescript
|
|
823
|
+
// All nodes that have been inserted into the tree belong to a branch - this retrieves that branch
|
|
824
|
+
const branch = TreeAlpha.branch(node);
|
|
825
|
+
```
|
|
913
826
|
|
|
914
|
-
|
|
827
|
+
To convert the branch object to a view with a known schema, use:
|
|
915
828
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
829
|
+
```typescript
|
|
830
|
+
if (branch.hasRootSchema(MySchema)) {
|
|
831
|
+
const view = branch; // `branch` is now typed as a `TreeViewAlpha<MySchema>`
|
|
832
|
+
}
|
|
833
|
+
```
|
|
919
834
|
|
|
920
|
-
|
|
835
|
+
Use the following function to expose the alpha APIs on a `TreeView` that is not typed as a `TreeViewAlpha`:
|
|
921
836
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
837
|
+
```typescript
|
|
838
|
+
const viewAlpha = asTreeViewAlpha(view);
|
|
839
|
+
```
|
|
925
840
|
|
|
926
|
-
## 2.
|
|
841
|
+
## 2.4.0
|
|
927
842
|
|
|
928
843
|
### Minor Changes
|
|
929
844
|
|
|
930
|
-
-
|
|
845
|
+
- ✨ New! Alpha API for providing SharedTree configuration options ([#22701](https://github.com/microsoft/FluidFramework/pull/22701)) [40d3648ddf](https://github.com/microsoft/FluidFramework/commit/40d3648ddfb5223ef6daef49a4f5cab1cfa52b71)
|
|
846
|
+
|
|
847
|
+
A new alpha `configuredSharedTree` had been added.
|
|
848
|
+
This allows providing configuration options, primarily for debugging, testing and evaluation of upcoming features.
|
|
849
|
+
The resulting configured `SharedTree` object can then be used in-place of the regular `SharedTree` imported from `fluid-framework`.
|
|
850
|
+
|
|
851
|
+
```typescript
|
|
852
|
+
import {
|
|
853
|
+
ForestType,
|
|
854
|
+
TreeCompressionStrategy,
|
|
855
|
+
configuredSharedTree,
|
|
856
|
+
typeboxValidator,
|
|
857
|
+
} from "@fluid-framework/alpha";
|
|
858
|
+
// Maximum debuggability and validation enabled:
|
|
859
|
+
const SharedTree = configuredSharedTree({
|
|
860
|
+
forest: ForestType.Expensive,
|
|
861
|
+
jsonValidator: typeboxValidator,
|
|
862
|
+
treeEncodeType: TreeCompressionStrategy.Uncompressed,
|
|
863
|
+
});
|
|
864
|
+
// Opts into the under development optimized tree storage planned to be the eventual default implementation:
|
|
865
|
+
const SharedTree = configuredSharedTree({
|
|
866
|
+
forest: ForestType.Optimized,
|
|
867
|
+
});
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
- ✨ New! Alpha API for snapshotting Schema ([#22733](https://github.com/microsoft/FluidFramework/pull/22733)) [920a65f66e](https://github.com/microsoft/FluidFramework/commit/920a65f66e0caad7e1b5e3df1e0afd3475a87c4a)
|
|
871
|
+
|
|
872
|
+
`extractPersistedSchema` can now be used to extra a JSON-compatible representation of the subset of a schema that gets stored in documents.
|
|
873
|
+
This can be used write tests which snapshot an applications schema.
|
|
874
|
+
Such tests can be used to detect schema changes which could would impact document compatibility,
|
|
875
|
+
and can be combined with the new `comparePersistedSchema` to measure what kind of compatibility impact the schema change has.
|
|
876
|
+
|
|
877
|
+
- Fix reading of `null` from unhydrated trees ([#22748](https://github.com/microsoft/FluidFramework/pull/22748)) [6a75bd0616](https://github.com/microsoft/FluidFramework/commit/6a75bd0616ecd315ae0e9458d88ba1c755dfd785)
|
|
878
|
+
|
|
879
|
+
Unhydrated trees containing object nodes with required fields set to `null` used to throw an error.
|
|
880
|
+
This was a bug: `null` is a valid value in tree's whose schema allow it, and this specific case now correctly returns `null` values when appropriate without erroring.
|
|
881
|
+
|
|
882
|
+
- Expose the view schema from the TreeView interface ([#22547](https://github.com/microsoft/FluidFramework/pull/22547)) [2aa29d9a13](https://github.com/microsoft/FluidFramework/commit/2aa29d9a13f099b129ec6834c8cbdaf6a25db114)
|
|
883
|
+
|
|
884
|
+
Users of TreeView can now access the type-safe view schema directly on the view object via `TreeView.schema`.
|
|
885
|
+
This allows users to avoid passing the schema around in addition to the view in scenarios where both are needed.
|
|
886
|
+
It also avoids scenarios in which code wants to accept both a view and its schema and thus must constrain both to be of the same schema type.
|
|
887
|
+
|
|
888
|
+
- Metadata can now be associated with Field Schema ([#22564](https://github.com/microsoft/FluidFramework/pull/22564)) [1d9f4c97ed](https://github.com/microsoft/FluidFramework/commit/1d9f4c97edf3f2bbf23ca30c35b67f0ec38b728d)
|
|
889
|
+
|
|
890
|
+
Users of TreeView can now specify metadata when creating Field Schema.
|
|
891
|
+
This includes system-understood metadata, i.e., `description`.
|
|
892
|
+
|
|
893
|
+
Example:
|
|
894
|
+
|
|
895
|
+
```typescript
|
|
896
|
+
class Point extends schemaFactory.object("Point", {
|
|
897
|
+
x: schemaFactory.required(schemaFactory.number, {
|
|
898
|
+
metadata: { description: "The horizontal component of the point." },
|
|
899
|
+
}),
|
|
900
|
+
y: schemaFactory.required(schemaFactory.number, {
|
|
901
|
+
metadata: { description: "The vertical component of the point." },
|
|
902
|
+
}),
|
|
903
|
+
}) {}
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) (`getJsonSchema`) can leverage such system-understood metadata to generate useful information.
|
|
907
|
+
In the case of the `description` property, this is mapped directly to the `description` property supported by JSON Schema.
|
|
908
|
+
|
|
909
|
+
Custom, user-defined properties can also be specified.
|
|
910
|
+
These properties will not be leveraged by the system by default, but can be used as a handy means of associating common application-specific properties with Field Schema.
|
|
911
|
+
|
|
912
|
+
Example:
|
|
913
|
+
|
|
914
|
+
An application is implementing search functionality.
|
|
915
|
+
By default, the app author wishes for all app content to be indexable by search, unless otherwise specified.
|
|
916
|
+
They can leverage schema metadata to decorate fields that should be ignored by search, and leverage that information when walking the tree during a search.
|
|
917
|
+
|
|
918
|
+
```typescript
|
|
919
|
+
|
|
920
|
+
interface AppMetadata {
|
|
921
|
+
/**
|
|
922
|
+
* Whether or not the field should be ignored by search.
|
|
923
|
+
* @defaultValue `false`
|
|
924
|
+
*/
|
|
925
|
+
searchIgnore?: boolean;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
class Note extends schemaFactory.object("Note", {
|
|
929
|
+
position: schemaFactory.required(Point, {
|
|
930
|
+
metadata: {
|
|
931
|
+
description: "The position of the upper-left corner of the note."
|
|
932
|
+
custom: {
|
|
933
|
+
// Search doesn't care where the note is on the canvas.
|
|
934
|
+
// It only cares about the text content.
|
|
935
|
+
searchIgnore: true
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}),
|
|
939
|
+
text: schemaFactory.required(schemaFactory.string, {
|
|
940
|
+
metadata: {
|
|
941
|
+
description: "The textual contents of the note."
|
|
942
|
+
}
|
|
943
|
+
}),
|
|
944
|
+
}) {}
|
|
945
|
+
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
|
|
949
|
+
|
|
950
|
+
- ✨ New! Alpha SharedTree branching APIs ([#22550](https://github.com/microsoft/FluidFramework/pull/22550)) [8f4587c912](https://github.com/microsoft/FluidFramework/commit/8f4587c912f955c405d7bbbc5b42f3ffc3b497d7)
|
|
951
|
+
|
|
952
|
+
Several APIs have been added to allow for creating and coordinating "version-control"-style branches of the SharedTree.
|
|
953
|
+
Use the `getBranch` entry point function to acquire a branch.
|
|
954
|
+
For example:
|
|
955
|
+
|
|
956
|
+
```ts
|
|
957
|
+
function makeEditOnBranch(mainView: TreeView<typeof MySchema>) {
|
|
958
|
+
mainView.root.myData = 3;
|
|
959
|
+
const mainBranch = getBranch(mainView); // This function accepts either a view of a SharedTree (acquired e.g. via `sharedTree.viewWith(...)`) or a `SharedTree` directly.
|
|
960
|
+
const forkBranch = mainBranch.branch(); // This creates a new branch based on the existing branch.
|
|
961
|
+
const forkView = forkBranch.viewWith(
|
|
962
|
+
new TreeViewConfiguration({ schema: MySchema }),
|
|
963
|
+
); // Acquire a view of the forked branch in order to read or edit its tree.
|
|
964
|
+
forkView.root.myData = 4; // Set the value on the fork branch to be 4. The main branch still has a value of 3.
|
|
965
|
+
mainBranch.merge(forkBranch); // Merging the fork changes into the main branch causes the main branch to have a value of 4.
|
|
931
966
|
|
|
932
|
-
|
|
967
|
+
// Note: The main branch (and therefore, also the `forkView`) is automatically disposed by the merge.
|
|
968
|
+
// To prevent this, use `mainBranch.merge(forkBranch, false)`.
|
|
969
|
+
}
|
|
970
|
+
```
|
|
933
971
|
|
|
934
|
-
|
|
972
|
+
Merging any number of commits into a target branch (via the `TreeBranch.merge` method) generates a revertible for each
|
|
973
|
+
commit on the target branch. See [#22644](https://github.com/microsoft/FluidFramework/pull/22644) for more information
|
|
974
|
+
about revertible support in the branching APIs.
|
|
935
975
|
|
|
936
|
-
|
|
937
|
-
Applications wishing to use SharedTree's eventing library for custom events can copy this file (and its referenced utility function) as a starting point for defining and emitting their own custom events.
|
|
938
|
-
See `createEmitter`'s documentation for example usage.
|
|
976
|
+
- Unhydrated SharedTree nodes now emit change events when edited ([#22661](https://github.com/microsoft/FluidFramework/pull/22661)) [d1eade6547](https://github.com/microsoft/FluidFramework/commit/d1eade65477a4e7fb1f8062cb83dfa03a8b1d800)
|
|
939
977
|
|
|
940
|
-
|
|
978
|
+
Newly-created SharedTree nodes which have not yet been inserted into the tree will now emit `nodeChanged` and `treeChanged` events when they are mutated via editing operations.
|
|
979
|
+
|
|
980
|
+
```ts
|
|
981
|
+
const node = new Foo({ foo: 3 });
|
|
982
|
+
Tree.on(node, "nodeChanged", () => {
|
|
983
|
+
console.log("This will fire even before node is inserted!");
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
node.foo = 4; // log: "This will fire even before node is inserted!";
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
- SharedTree's `RestrictiveReadonlyRecord` is deprecated ([#22479](https://github.com/microsoft/FluidFramework/pull/22479)) [8be73d374d](https://github.com/microsoft/FluidFramework/commit/8be73d374de04ff6226c531ba8b562561572640f)
|
|
990
|
+
|
|
991
|
+
`RestrictiveReadonlyRecord` was an attempt to implement a version of TypeScript's built-in `Record<TKey, TValue>` type that would prohibit (instead of leaving unrestricted like Record does) values under keys that do not extend `TKey`.
|
|
992
|
+
|
|
993
|
+
The implementation of `RestrictiveReadonlyRecord` failed to accomplish this except for the edge cases where `TKey` was exactly `string` or exactly `symbol`.
|
|
994
|
+
Fixing this bug appears to be impossible within the current limitation of TypeScript, however this library does not require any case other than `TKey` being exactly `string`.
|
|
995
|
+
|
|
996
|
+
To reduce the risk of users of the tree library using the problematic `RestrictiveReadonlyRecord` type, it has been deprecated and replaced with a more specific type that avoids the bug, `RestrictiveStringRecord<TValue>`.
|
|
997
|
+
|
|
998
|
+
To highlight that this new type is not intended for direct use by users of tree, and instead is just used as part of the typing of its public API, `RestrictiveStringRecord` has been tagged with `@system`.
|
|
999
|
+
See [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) for more details.
|
|
1000
|
+
|
|
1001
|
+
- Fix `.create` on structurally named MapNode and ArrayNode schema ([#22522](https://github.com/microsoft/FluidFramework/pull/22522)) [b3f91ae91c](https://github.com/microsoft/FluidFramework/commit/b3f91ae91cb750a6a7696ab5ea17c00895bb6d92)
|
|
1002
|
+
|
|
1003
|
+
Constructing a structurally named MapNode or ArrayNode schema (using the overload of `SchemaFactory.map` or `SchemaFactory.array` which does not take an explicit name), returned a `TreeNodeSchema` instead of a `TreeNodeSchemaNonClass`, which resulted in the `create` static method not being exposed.
|
|
1004
|
+
This has been fixed, and can now be used as follows:
|
|
941
1005
|
|
|
942
|
-
|
|
1006
|
+
```typescript
|
|
1007
|
+
const MyMap = schemaFactory.map(schemaFactory.number);
|
|
1008
|
+
type MyMap = NodeFromSchema<typeof MyMap>;
|
|
1009
|
+
const _fromMap: MyMap = MyMap.create(new MyMap());
|
|
1010
|
+
const _fromIterable: MyMap = MyMap.create([]);
|
|
1011
|
+
const _fromObject: MyMap = MyMap.create({});
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
This change causes some types to reference `TreeNodeSchemaNonClass` which did not reference it before.
|
|
1015
|
+
While `TreeNodeSchemaNonClass` is `@system` (See [Fluid Releases and API Support Levels
|
|
1016
|
+
](https://fluidframework.com/docs/build/releases-and-apitags/) for details) and thus not intended to be referred to by users of Fluid,
|
|
1017
|
+
this change caused the TypeScript compiler to generate references to it in more cases when compiling `d.ts` files.
|
|
1018
|
+
Since the TypeScript compiler is unable to generate references to `TreeNodeSchemaNonClass` with how it was nested in `internalTypes.js`,
|
|
1019
|
+
this change could break the build of packages exporting types referencing structurally named map and array schema.
|
|
1020
|
+
This has been mitigated by moving `TreeNodeSchemaNonClass` out of `internalTypes.js`:
|
|
1021
|
+
any code importing `TreeNodeSchemaNonClass` (and thus disregarding the `@system` restriction) can be fixed by importing it from the top level instead of the `internalTypes.js`
|
|
1022
|
+
|
|
1023
|
+
- Non-leaf field access has been optimized ([#22717](https://github.com/microsoft/FluidFramework/pull/22717)) [6a2b68103c](https://github.com/microsoft/FluidFramework/commit/6a2b68103cc3ad56a9ac0dfcaaa8546978ec29ac)
|
|
1024
|
+
|
|
1025
|
+
When reading non-leaf children which have been read previously, they are retrieved from cache faster.
|
|
1026
|
+
Several operations on subtrees under arrays have been optimized, including reading of non-leaf nodes for the first time.
|
|
1027
|
+
Overall this showed a roughly 5% speed up in a read heavy test application (the BubbleBench example) but gains are expected to vary a lot based on use-case.
|
|
1028
|
+
|
|
1029
|
+
- ✨ New! Alpha APIs for producing SharedTree schema from enums ([#20035](https://github.com/microsoft/FluidFramework/pull/20035)) [5f9bbe011a](https://github.com/microsoft/FluidFramework/commit/5f9bbe011a18ccac08a70340f6d20e60ce30c4a4)
|
|
1030
|
+
|
|
1031
|
+
`adaptEnum` and `enumFromStrings` have been added to `@fluidframework/tree/alpha` and `fluid-framework/alpha`.
|
|
1032
|
+
These unstable alpha APIs are relatively simple helpers on-top of public APIs (source: [schemaCreationUtilities.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/simple-tree/schemaCreationUtilities.ts)):
|
|
1033
|
+
thus if these change or stable alternatives are needed, an application can replicate this functionality using these implementations as an example.
|
|
943
1034
|
|
|
944
|
-
|
|
945
|
-
However, when constructing the node from this data, only own properties were used.
|
|
946
|
-
This allowed input which provided required values in inherited fields to pass validation.
|
|
947
|
-
When the node was constructed, it would lack these fields, and end up out of schema.
|
|
948
|
-
This has been fixed: both validation and node construction now only consider own properties.
|
|
1035
|
+
## 2.3.0
|
|
949
1036
|
|
|
950
|
-
|
|
951
|
-
Such cases may need to copy data from the objects with inherited properties into new objects with own properties before constructing nodes from them.
|
|
1037
|
+
### Minor Changes
|
|
952
1038
|
|
|
953
|
-
-
|
|
1039
|
+
- Add /alpha import path to @fluidframework/tree and fluid-framework packages ([#22483](https://github.com/microsoft/FluidFramework/pull/22483)) [12242cfdb5a](https://github.com/microsoft/FluidFramework/commit/12242cfdb5aa4c342cc62f11cbf1c072840bec44)
|
|
954
1040
|
|
|
955
|
-
|
|
956
|
-
const factory = new SchemaFactory("example");
|
|
957
|
-
class Point2d extends factory.object("Point2d", {
|
|
958
|
-
x: factory.number,
|
|
959
|
-
y: factory.number,
|
|
960
|
-
}) {}
|
|
1041
|
+
`@fluidframework/tree` and `fluid-framework` now have a `/alpha` import path where their `@alpha` APIs are exported.
|
|
961
1042
|
|
|
962
|
-
|
|
1043
|
+
- Refactor code for emitting events to make it easier to copy into other projects ([#22275](https://github.com/microsoft/FluidFramework/pull/22275)) [49849bb5f6b](https://github.com/microsoft/FluidFramework/commit/49849bb5f6bf92765bc63e19cdaf4f7d0498bebc)
|
|
963
1044
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
// ...
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
```
|
|
1045
|
+
Factored event emitting utilities into their own file, `events/emitter.ts`.
|
|
1046
|
+
Applications wishing to use SharedTree's eventing library for custom events can copy this file (and its referenced utility function) as a starting point for defining and emitting their own custom events.
|
|
1047
|
+
See `createEmitter`'s documentation for example usage.
|
|
971
1048
|
|
|
972
|
-
|
|
973
|
-
which properties of the node changed.
|
|
1049
|
+
Currently there are no published or officially supported versions of these utilities, but they are relatively simple, and can be copied and customized as needed.
|
|
974
1050
|
|
|
975
|
-
|
|
976
|
-
identifiers (or "stored keys") that can be provided through `FieldProps` when defining a schema.
|
|
977
|
-
See the documentation for `FieldProps` for more details about the distinction between "property keys" and "stored keys".
|
|
1051
|
+
- Implicitly constructed object nodes now only consider own properties during validation ([#22453](https://github.com/microsoft/FluidFramework/pull/22453)) [27faa56f5ae](https://github.com/microsoft/FluidFramework/commit/27faa56f5ae334e0b65fdd84c75764645e64f063)
|
|
978
1052
|
|
|
979
|
-
|
|
1053
|
+
When determining if some given data is compatible with a particular ObjectNode schema, both inherited and own properties were considered.
|
|
1054
|
+
However, when constructing the node from this data, only own properties were used.
|
|
1055
|
+
This allowed input which provided required values in inherited fields to pass validation.
|
|
1056
|
+
When the node was constructed, it would lack these fields, and end up out of schema.
|
|
1057
|
+
This has been fixed: both validation and node construction now only consider own properties.
|
|
980
1058
|
|
|
981
|
-
|
|
1059
|
+
This may cause some cases which previously exhibited data corruption to now throw a usage error reporting the data is incompatible.
|
|
1060
|
+
Such cases may need to copy data from the objects with inherited properties into new objects with own properties before constructing nodes from them.
|
|
982
1061
|
|
|
983
|
-
|
|
1062
|
+
- A `@beta` version of `nodeChanged` which includes the list of properties has been added ([#22229](https://github.com/microsoft/FluidFramework/pull/22229)) [aae34dd9fe1](https://github.com/microsoft/FluidFramework/commit/aae34dd9fe1aa6c153c26035f1486f4d8944c810)
|
|
984
1063
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
});
|
|
992
|
-
```
|
|
1064
|
+
```typescript
|
|
1065
|
+
const factory = new SchemaFactory("example");
|
|
1066
|
+
class Point2d extends factory.object("Point2d", {
|
|
1067
|
+
x: factory.number,
|
|
1068
|
+
y: factory.number,
|
|
1069
|
+
}) {}
|
|
993
1070
|
|
|
994
|
-
|
|
995
|
-
This could break existing code using "nodeChanged" in a particularly fragile way.
|
|
1071
|
+
const point = new Point2d({ x: 0, y: 0 });
|
|
996
1072
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1073
|
+
TreeBeta.on(point, "nodeChanged", (data) => {
|
|
1074
|
+
const changed: ReadonlySet<"x" | "y"> = data.changedProperties;
|
|
1075
|
+
if (changed.has("x")) {
|
|
1076
|
+
// ...
|
|
1000
1077
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1078
|
+
});
|
|
1079
|
+
```
|
|
1003
1080
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1081
|
+
The payload of the `nodeChanged` event emitted by SharedTree's `TreeBeta` includes a `changedProperties` property that indicates
|
|
1082
|
+
which properties of the node changed.
|
|
1006
1083
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
Tree.on(point, "nodeChanged", () => f()); // Safe
|
|
1012
|
-
```
|
|
1084
|
+
For object nodes, the list of properties uses the property identifiers defined in the schema, and not the persisted
|
|
1085
|
+
identifiers (or "stored keys") that can be provided through `FieldProps` when defining a schema.
|
|
1086
|
+
See the documentation for `FieldProps` for more details about the distinction between "property keys" and "stored keys".
|
|
1013
1087
|
|
|
1014
|
-
|
|
1088
|
+
For map nodes, every key that was added, removed, or updated by a change to the tree is included in the list of properties.
|
|
1015
1089
|
|
|
1016
|
-
|
|
1090
|
+
For array nodes, the set of properties will always be undefined: there is currently no API to get details about changes to an array.
|
|
1017
1091
|
|
|
1018
|
-
|
|
1092
|
+
Object nodes revieve strongly types sets of changed keys, allowing compile time detection of incorrect keys:
|
|
1019
1093
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
Example:
|
|
1027
|
-
|
|
1028
|
-
```typescript
|
|
1029
|
-
function getKeys(node: TreeNode & WithType<string, NodeKind.Array>): number[];
|
|
1030
|
-
function getKeys(node: TreeNode & WithType<string, NodeKind.Map | NodeKind.Object>): string[];
|
|
1031
|
-
function getKeys(node: TreeNode): string[] | number[];
|
|
1032
|
-
function getKeys(node: TreeNode): string[] | number[] {
|
|
1033
|
-
const schema = Tree.schema(node);
|
|
1034
|
-
switch (schema.kind) {
|
|
1035
|
-
case NodeKind.Array: {
|
|
1036
|
-
const arrayNode = node as TreeArrayNode;
|
|
1037
|
-
const keys: number[] = [];
|
|
1038
|
-
for (let index = 0; index < arrayNode.length; index++) {
|
|
1039
|
-
keys.push(index);
|
|
1040
|
-
}
|
|
1041
|
-
return keys;
|
|
1042
|
-
}
|
|
1043
|
-
case NodeKind.Map:
|
|
1044
|
-
return [...(node as TreeMapNode).keys()];
|
|
1045
|
-
case NodeKind.Object:
|
|
1046
|
-
return Object.keys(node);
|
|
1047
|
-
default:
|
|
1048
|
-
throw new Error("Unsupported Kind");
|
|
1049
|
-
}
|
|
1094
|
+
```typescript
|
|
1095
|
+
TreeBeta.on(point, "nodeChanged", (data) => {
|
|
1096
|
+
// @ts-expect-error Strong typing for changed properties of object nodes detects incorrect keys:
|
|
1097
|
+
if (data.changedProperties.has("z")) {
|
|
1098
|
+
// ...
|
|
1050
1099
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
- ✨ New! `Record`-typed objects can now be used to construct MapNodes ([#22042](https://github.com/microsoft/FluidFramework/pull/22042)) [25deff344b](https://github.com/microsoft/FluidFramework/commit/25deff344b447380486c1efb64ed69177c32ddc5)
|
|
1100
|
+
});
|
|
1101
|
+
```
|
|
1054
1102
|
|
|
1055
|
-
|
|
1103
|
+
The existing stable "nodeChanged" event's callback now is given a parameter called `unstable` of type `unknown` which is used to indicate that additional data can be provided there.
|
|
1104
|
+
This could break existing code using "nodeChanged" in a particularly fragile way.
|
|
1056
1105
|
|
|
1057
|
-
|
|
1106
|
+
```typescript
|
|
1107
|
+
function f(optional?: number) {
|
|
1108
|
+
// ...
|
|
1109
|
+
}
|
|
1110
|
+
Tree.on(point, "nodeChanged", f); // Bad
|
|
1111
|
+
```
|
|
1058
1112
|
|
|
1059
|
-
|
|
1113
|
+
Code like this which is implicitly discarding an optional argument from the function used as the listener will be broken.
|
|
1114
|
+
It can be fixed by using an inline lambda expression:
|
|
1060
1115
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1116
|
+
```typescript
|
|
1117
|
+
function f(optional?: number) {
|
|
1118
|
+
// ...
|
|
1119
|
+
}
|
|
1120
|
+
Tree.on(point, "nodeChanged", () => f()); // Safe
|
|
1121
|
+
```
|
|
1065
1122
|
|
|
1066
|
-
|
|
1067
|
-
as long as they do not require unhydrated nodes to differentiate ambiguous unions,
|
|
1068
|
-
or IFluidHandles (which themselves are not JSON compatible).
|
|
1123
|
+
- Make SharedTree usable with legacy APIs ([#22320](https://github.com/microsoft/FluidFramework/pull/22320)) [bbdf869b8a1](https://github.com/microsoft/FluidFramework/commit/bbdf869b8a1aae266bc8cb6f6016dcd8c22f0f88)
|
|
1069
1124
|
|
|
1070
|
-
|
|
1071
|
-
recursive maps do not advertise support for this feature in their typing,
|
|
1072
|
-
but it works at runtime.
|
|
1125
|
+
SharedTree was not previously exported in a way that made it usable with @fluidframework/aqueduct or other lower-level legacy APIs. This fixes that issue by making it consistent with other DDSes: such usages can `import { SharedTree } from "@fluidframework/tree/legacy";`.
|
|
1073
1126
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
The new `ITreeConfigurationOptions.preventAmbiguity` flag can be set to true to enable checking of some additional rules when constructing the `TreeViewConfiguration`.
|
|
1077
|
-
|
|
1078
|
-
This example shows an ambiguous schema:
|
|
1079
|
-
|
|
1080
|
-
```typescript
|
|
1081
|
-
const schemaFactory = new SchemaFactory("com.example");
|
|
1082
|
-
class Feet extends schemaFactory.object("Feet", { length: schemaFactory.number }) {}
|
|
1083
|
-
class Meters extends schemaFactory.object("Meters", { length: schemaFactory.number }) {}
|
|
1084
|
-
const config = new TreeViewConfiguration({
|
|
1085
|
-
// This combination of schema can lead to ambiguous cases, and will error since preventAmbiguity is true.
|
|
1086
|
-
schema: [Feet, Meters],
|
|
1087
|
-
preventAmbiguity: true,
|
|
1088
|
-
});
|
|
1089
|
-
const view = tree.viewWith(config);
|
|
1090
|
-
// This is invalid since it is ambiguous which type of node is being constructed.
|
|
1091
|
-
// The error thrown above when constructing the TreeViewConfiguration is because of this ambiguous case:
|
|
1092
|
-
view.initialize({ length: 5 });
|
|
1093
|
-
```
|
|
1094
|
-
|
|
1095
|
-
See the documentation on `ITreeConfigurationOptions.preventAmbiguity` for a more complete example and more details.
|
|
1096
|
-
|
|
1097
|
-
- `Tree.schema` now returns `TreeNodeSchema` ([#22185](https://github.com/microsoft/FluidFramework/pull/22185)) [bfe8310a94](https://github.com/microsoft/FluidFramework/commit/bfe8310a9406a8658c2fac8827c7114844c32234)
|
|
1098
|
-
|
|
1099
|
-
The typing of `Tree.schema` has changed from:
|
|
1100
|
-
|
|
1101
|
-
```typescript
|
|
1102
|
-
schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
|
|
1103
|
-
```
|
|
1104
|
-
|
|
1105
|
-
to:
|
|
1106
|
-
|
|
1107
|
-
```typescript
|
|
1108
|
-
schema(node: TreeNode | TreeLeafValue): TreeNodeSchema;
|
|
1109
|
-
```
|
|
1110
|
-
|
|
1111
|
-
The runtime behavior is unaffected: any code which worked and still compiles is fine and does not need changes.
|
|
1112
|
-
|
|
1113
|
-
`Tree.schema` was changed to mitigate two different issues:
|
|
1127
|
+
## 2.2.0
|
|
1114
1128
|
|
|
1115
|
-
|
|
1116
|
-
When the type of the input is not known precisely (for example it is a union of node types like `Foo | Bar`, or `TreeNode` or even `TreeNode | TreeLeafValue`), this was fine since schema are covariant over their node type.
|
|
1117
|
-
However when the input was more specific that the schema type, for example the type is simply `0`, this would result in unsound typing, since the create function could actually return values that did not conform with that schema (for example `schema.create(1)` for the number schema typed with `0` would return `1` with type `0`).
|
|
1118
|
-
2. The node type was provided to the incorrect type parameter of TreeNodeSchema.
|
|
1119
|
-
The `TNode` parameter is the third one, not the fourth.
|
|
1120
|
-
The fourth is `TBuild` which sets the input accepted to its create function or constructor.
|
|
1121
|
-
Thus this code accidentally left `TNode` unset (which is good due to the above issue), but invalidly set `TBuild`.
|
|
1122
|
-
`TBuild` is contravariant, so it has the opposite issue that setting `TNode` would have: if your input is simply typed as something general like `TreeNode`, then the returned schema would claim to be able to construct an instance given any `TreeNode`.
|
|
1123
|
-
This is incorrect, and this typing has been removed.
|
|
1129
|
+
### Minor Changes
|
|
1124
1130
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1131
|
+
- Compile-time type narrowing based on a TreeNode's NodeKind ([#22222](https://github.com/microsoft/FluidFramework/pull/22222)) [4d3bc876ae](https://github.com/microsoft/FluidFramework/commit/4d3bc876ae32fa3f2568299e29246f6970e48ee0)
|
|
1132
|
+
|
|
1133
|
+
`TreeNode`'s schema-aware APIs implement `WithType`, which now has a `NodeKind` parameter that can be used to narrow `TreeNode`s based on `NodeKind`.
|
|
1134
|
+
|
|
1135
|
+
Example:
|
|
1136
|
+
|
|
1137
|
+
```typescript
|
|
1138
|
+
function getKeys(node: TreeNode & WithType<string, NodeKind.Array>): number[];
|
|
1139
|
+
function getKeys(
|
|
1140
|
+
node: TreeNode & WithType<string, NodeKind.Map | NodeKind.Object>,
|
|
1141
|
+
): string[];
|
|
1142
|
+
function getKeys(node: TreeNode): string[] | number[];
|
|
1143
|
+
function getKeys(node: TreeNode): string[] | number[] {
|
|
1144
|
+
const schema = Tree.schema(node);
|
|
1145
|
+
switch (schema.kind) {
|
|
1146
|
+
case NodeKind.Array: {
|
|
1147
|
+
const arrayNode = node as TreeArrayNode;
|
|
1148
|
+
const keys: number[] = [];
|
|
1149
|
+
for (let index = 0; index < arrayNode.length; index++) {
|
|
1150
|
+
keys.push(index);
|
|
1151
|
+
}
|
|
1152
|
+
return keys;
|
|
1153
|
+
}
|
|
1154
|
+
case NodeKind.Map:
|
|
1155
|
+
return [...(node as TreeMapNode).keys()];
|
|
1156
|
+
case NodeKind.Object:
|
|
1157
|
+
return Object.keys(node);
|
|
1158
|
+
default:
|
|
1159
|
+
throw new Error("Unsupported Kind");
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
```
|
|
1130
1163
|
|
|
1131
|
-
-
|
|
1164
|
+
- ✨ New! `Record`-typed objects can now be used to construct MapNodes ([#22042](https://github.com/microsoft/FluidFramework/pull/22042)) [25deff344b](https://github.com/microsoft/FluidFramework/commit/25deff344b447380486c1efb64ed69177c32ddc5)
|
|
1132
1165
|
|
|
1133
|
-
|
|
1166
|
+
You can now construct MapNodes from `Record` typed objects, similar to how maps are expressed in JSON.
|
|
1134
1167
|
|
|
1135
|
-
|
|
1136
|
-
|
|
1168
|
+
Before this change, an `Iterable<string, Child>` was required, but now an object like `{key1: Child1, key2: Child2}` is allowed.
|
|
1169
|
+
|
|
1170
|
+
Full example using this new API:
|
|
1171
|
+
|
|
1172
|
+
```typescript
|
|
1173
|
+
class Schema extends schemaFactory.map("ExampleMap", schemaFactory.number) {}
|
|
1174
|
+
const fromRecord = new Schema({ x: 5 });
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
This new feature makes it possible for schemas to construct a tree entirely from JSON-compatible objects using their constructors,
|
|
1178
|
+
as long as they do not require unhydrated nodes to differentiate ambiguous unions,
|
|
1179
|
+
or IFluidHandles (which themselves are not JSON compatible).
|
|
1180
|
+
|
|
1181
|
+
Due to limitations of TypeScript and recursive types,
|
|
1182
|
+
recursive maps do not advertise support for this feature in their typing,
|
|
1183
|
+
but it works at runtime.
|
|
1184
|
+
|
|
1185
|
+
- New SharedTree configuration option: `ITreeConfigurationOptions.preventAmbiguity` ([#22048](https://github.com/microsoft/FluidFramework/pull/22048)) [966906a034](https://github.com/microsoft/FluidFramework/commit/966906a03490daa5a914030b37342abb8267c12d)
|
|
1186
|
+
|
|
1187
|
+
The new `ITreeConfigurationOptions.preventAmbiguity` flag can be set to true to enable checking of some additional rules when constructing the `TreeViewConfiguration`.
|
|
1188
|
+
|
|
1189
|
+
This example shows an ambiguous schema:
|
|
1190
|
+
|
|
1191
|
+
```typescript
|
|
1192
|
+
const schemaFactory = new SchemaFactory("com.example");
|
|
1193
|
+
class Feet extends schemaFactory.object("Feet", {
|
|
1194
|
+
length: schemaFactory.number,
|
|
1195
|
+
}) {}
|
|
1196
|
+
class Meters extends schemaFactory.object("Meters", {
|
|
1197
|
+
length: schemaFactory.number,
|
|
1198
|
+
}) {}
|
|
1199
|
+
const config = new TreeViewConfiguration({
|
|
1200
|
+
// This combination of schema can lead to ambiguous cases, and will error since preventAmbiguity is true.
|
|
1201
|
+
schema: [Feet, Meters],
|
|
1202
|
+
preventAmbiguity: true,
|
|
1203
|
+
});
|
|
1204
|
+
const view = tree.viewWith(config);
|
|
1205
|
+
// This is invalid since it is ambiguous which type of node is being constructed.
|
|
1206
|
+
// The error thrown above when constructing the TreeViewConfiguration is because of this ambiguous case:
|
|
1207
|
+
view.initialize({ length: 5 });
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
See the documentation on `ITreeConfigurationOptions.preventAmbiguity` for a more complete example and more details.
|
|
1211
|
+
|
|
1212
|
+
- `Tree.schema` now returns `TreeNodeSchema` ([#22185](https://github.com/microsoft/FluidFramework/pull/22185)) [bfe8310a94](https://github.com/microsoft/FluidFramework/commit/bfe8310a9406a8658c2fac8827c7114844c32234)
|
|
1213
|
+
|
|
1214
|
+
The typing of `Tree.schema` has changed from:
|
|
1215
|
+
|
|
1216
|
+
```typescript
|
|
1217
|
+
schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
to:
|
|
1221
|
+
|
|
1222
|
+
```typescript
|
|
1223
|
+
schema(node: TreeNode | TreeLeafValue): TreeNodeSchema;
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
The runtime behavior is unaffected: any code which worked and still compiles is fine and does not need changes.
|
|
1227
|
+
|
|
1228
|
+
`Tree.schema` was changed to mitigate two different issues:
|
|
1229
|
+
|
|
1230
|
+
1. It tried to give a more specific type based on the type of the passed in value.
|
|
1231
|
+
When the type of the input is not known precisely (for example it is a union of node types like `Foo | Bar`, or `TreeNode` or even `TreeNode | TreeLeafValue`), this was fine since schema are covariant over their node type.
|
|
1232
|
+
However when the input was more specific that the schema type, for example the type is simply `0`, this would result in unsound typing, since the create function could actually return values that did not conform with that schema (for example `schema.create(1)` for the number schema typed with `0` would return `1` with type `0`).
|
|
1233
|
+
2. The node type was provided to the incorrect type parameter of TreeNodeSchema.
|
|
1234
|
+
The `TNode` parameter is the third one, not the fourth.
|
|
1235
|
+
The fourth is `TBuild` which sets the input accepted to its create function or constructor.
|
|
1236
|
+
Thus this code accidentally left `TNode` unset (which is good due to the above issue), but invalidly set `TBuild`.
|
|
1237
|
+
`TBuild` is contravariant, so it has the opposite issue that setting `TNode` would have: if your input is simply typed as something general like `TreeNode`, then the returned schema would claim to be able to construct an instance given any `TreeNode`.
|
|
1238
|
+
This is incorrect, and this typing has been removed.
|
|
1239
|
+
|
|
1240
|
+
Fortunately it should be rare for code to be impacted by this issue.
|
|
1241
|
+
Any code which manually specified a generic type parameter to `Tree.schema()` will break, as well as code which assigned its result to an overly specifically typed variable.
|
|
1242
|
+
Code which used `typeof` on the returned schema could also break, though there are few use-cases for this so such code is not expected to exist.
|
|
1243
|
+
Currently it's very difficult to invoke the create function or constructor associated with a `TreeNodeSchema` as doing so already requires narrowing to `TreeNodeSchemaClass` or `TreeNodeSchemaNonClass`.
|
|
1244
|
+
It is possible some such code exists which will need to have an explicit cast added because it happened to work with the more specific (but incorrect) constructor input type.
|
|
1245
|
+
|
|
1246
|
+
- Recursive SharedTree schemas using MapNodes no longer produce invalid d.ts files ([#22106](https://github.com/microsoft/FluidFramework/pull/22106)) [554fc5a94e](https://github.com/microsoft/FluidFramework/commit/554fc5a94e57e2d109ea9008b7c64517c58a6b73)
|
|
1247
|
+
|
|
1248
|
+
Consider a recursive SharedTree schema like the following, which follows all our recommended best practices:
|
|
1249
|
+
|
|
1250
|
+
```typescript
|
|
1251
|
+
export class RecursiveMap extends schema.mapRecursive("RM", [
|
|
1252
|
+
() => RecursiveMap,
|
|
1253
|
+
]) {}
|
|
1254
|
+
{
|
|
1255
|
+
type _check = ValidateRecursiveSchema<typeof RecursiveMap>;
|
|
1256
|
+
}
|
|
1257
|
+
```
|
|
1258
|
+
|
|
1259
|
+
This schema would work when used from within its compilation unit, but would generate d.ts that fails to compile when exporting it:
|
|
1260
|
+
|
|
1261
|
+
```typescript
|
|
1262
|
+
declare const RecursiveMap_base: import("@fluidframework/tree").TreeNodeSchemaClass<
|
|
1263
|
+
"com.example.RM",
|
|
1264
|
+
import("@fluidframework/tree").NodeKind.Map,
|
|
1265
|
+
import("@fluidframework/tree").TreeMapNodeUnsafe<
|
|
1266
|
+
readonly [() => typeof RecursiveMap]
|
|
1267
|
+
> &
|
|
1268
|
+
import("@fluidframework/tree").WithType<"com.example.RM">,
|
|
1137
1269
|
{
|
|
1138
|
-
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1270
|
+
[Symbol.iterator](): Iterator<[string, RecursiveMap], any, undefined>;
|
|
1271
|
+
},
|
|
1272
|
+
false,
|
|
1273
|
+
readonly [() => typeof RecursiveMap]
|
|
1274
|
+
>;
|
|
1275
|
+
export declare class RecursiveMap extends RecursiveMap_base {}
|
|
1276
|
+
```
|
|
1141
1277
|
|
|
1142
|
-
|
|
1278
|
+
This results in the compile error in TypeScript 5.4.5:
|
|
1143
1279
|
|
|
1144
|
-
|
|
1145
|
-
declare const RecursiveMap_base: import("@fluidframework/tree").TreeNodeSchemaClass<
|
|
1146
|
-
"com.example.RM",
|
|
1147
|
-
import("@fluidframework/tree").NodeKind.Map,
|
|
1148
|
-
import("@fluidframework/tree").TreeMapNodeUnsafe<readonly [() => typeof RecursiveMap]> &
|
|
1149
|
-
import("@fluidframework/tree").WithType<"com.example.RM">,
|
|
1150
|
-
{
|
|
1151
|
-
[Symbol.iterator](): Iterator<[string, RecursiveMap], any, undefined>;
|
|
1152
|
-
},
|
|
1153
|
-
false,
|
|
1154
|
-
readonly [() => typeof RecursiveMap]
|
|
1155
|
-
>;
|
|
1156
|
-
export declare class RecursiveMap extends RecursiveMap_base {}
|
|
1157
|
-
```
|
|
1280
|
+
> error TS2310: Type 'RecursiveMap' recursively references itself as a base type.
|
|
1158
1281
|
|
|
1159
|
-
|
|
1282
|
+
With this change, that error is fixed by modifying the `TreeMapNodeUnsafe` type it references to inline the definition of `ReadonlyMap` instead of using the one from the TypeScript standard library.
|
|
1160
1283
|
|
|
1161
|
-
|
|
1284
|
+
- ✨ New! When unambiguous, ArrayNodes can now be constructed from Maps and MapNodes from arrays ([#22036](https://github.com/microsoft/FluidFramework/pull/22036)) [25e74f9f3b](https://github.com/microsoft/FluidFramework/commit/25e74f9f3bed6e6ff041c088813c4cc1ea276b9c)
|
|
1162
1285
|
|
|
1163
|
-
|
|
1286
|
+
Since the types for ArrayNodes and MapNodes indicate they can be constructed from iterables,
|
|
1287
|
+
it should work, even if those iterables are themselves arrays or maps.
|
|
1288
|
+
To avoid this being a breaking change, a priority system was introduced.
|
|
1289
|
+
ArrayNodes will only be implicitly constructable from JavaScript Map objects in contexts where no MapNodes are allowed.
|
|
1290
|
+
Similarly MapNodes will only be implicitly constructable from JavaScript Array objects in contexts where no ArrayNodes are allowed.
|
|
1164
1291
|
|
|
1165
|
-
|
|
1292
|
+
In practice, the main case in which this is likely to matter is when implicitly constructing a map node. If you provide an array of key value pairs, this now works instead of erroring, as long as no ArrayNode is valid at that location in the tree.
|
|
1166
1293
|
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1294
|
+
```typescript
|
|
1295
|
+
class MyMapNode extends schemaFactory.map("x", schemaFactory.number) {}
|
|
1296
|
+
class Root extends schemaFactory.object("root", { data: MyMapNode }) {}
|
|
1297
|
+
// This now works (before it compiled, but error at runtime):
|
|
1298
|
+
const fromArray = new Root({ data: [["x", 5]] });
|
|
1299
|
+
```
|
|
1172
1300
|
|
|
1173
|
-
|
|
1301
|
+
Prior versions used to have to do:
|
|
1174
1302
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
// This now works (before it compiled, but error at runtime):
|
|
1179
|
-
const fromArray = new Root({ data: [["x", 5]] });
|
|
1180
|
-
```
|
|
1303
|
+
```typescript
|
|
1304
|
+
new Root({ data: new MyMapNode([["x", 5]]) });
|
|
1305
|
+
```
|
|
1181
1306
|
|
|
1182
|
-
|
|
1307
|
+
or:
|
|
1183
1308
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1309
|
+
```typescript
|
|
1310
|
+
new Root({ data: new Map([["x", 5]]) });
|
|
1311
|
+
```
|
|
1187
1312
|
|
|
1188
|
-
|
|
1313
|
+
Both of these options still work: strictly more cases are allowed with this change.
|
|
1189
1314
|
|
|
1190
|
-
|
|
1191
|
-
new Root({ data: new Map([["x", 5]]) });
|
|
1192
|
-
```
|
|
1315
|
+
- Implicit TreeNode construction improvements ([#21995](https://github.com/microsoft/FluidFramework/pull/21995)) [977f96c1a0](https://github.com/microsoft/FluidFramework/commit/977f96c1a0dd1d5eb0dbcd087d07cb7510d533ea)
|
|
1193
1316
|
|
|
1194
|
-
|
|
1317
|
+
ArrayNodes and MapNodes could always be explicitly constructed (using `new`) from iterables.
|
|
1318
|
+
The types also allowed using of iterables to implicitly construct array nodes and map nodes,
|
|
1319
|
+
but this did not work at runtime.
|
|
1320
|
+
This has been fixed for all cases except implicitly constructing an ArrayNode form an `Iterable` that is actually a `Map`,
|
|
1321
|
+
and implicitly constructing a MapNode from an `Iterable` that is actually an `Array`.
|
|
1322
|
+
These cases may be fixed in the future, but require additional work to ensure unions of array nodes and map nodes work correctly.
|
|
1195
1323
|
|
|
1196
|
-
|
|
1324
|
+
Additionally MapNodes can now be constructed from `Iterator<readonly [string, content]>` where previously the inner arrays had to be mutable.
|
|
1197
1325
|
|
|
1198
|
-
|
|
1199
|
-
The types also allowed using of iterables to implicitly construct array nodes and map nodes,
|
|
1200
|
-
but this did not work at runtime.
|
|
1201
|
-
This has been fixed for all cases except implicitly constructing an ArrayNode form an `Iterable` that is actually a `Map`,
|
|
1202
|
-
and implicitly constructing a MapNode from an `Iterable` that is actually an `Array`.
|
|
1203
|
-
These cases may be fixed in the future, but require additional work to ensure unions of array nodes and map nodes work correctly.
|
|
1326
|
+
- Support generation of JSON Schema from Shared Tree view schema (alpha) ([#21984](https://github.com/microsoft/FluidFramework/pull/21984)) [9097bf8a44](https://github.com/microsoft/FluidFramework/commit/9097bf8a44310d0dcf1a4d2efc3a6f75997c58b3)
|
|
1204
1327
|
|
|
1205
|
-
|
|
1328
|
+
> [!WARNING]
|
|
1329
|
+
> This API is [alpha quality](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) and may change at any time.
|
|
1206
1330
|
|
|
1207
|
-
-
|
|
1331
|
+
Adds alpha-quality support for canonical [JSON Schema](https://json-schema.org/docs) representation of Shared Tree schema and adds a `getJsonSchema` function for getting that representation for a given `TreeNodeSchema`.
|
|
1332
|
+
This JSON Schema representation can be used to describe schema requirements to external systems, and can be used with validation tools like [ajv](https://ajv.js.org/) to validate data before inserting it into a `SharedTree`.
|
|
1208
1333
|
|
|
1209
|
-
|
|
1210
|
-
> This API is [alpha quality](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) and may change at any time.
|
|
1334
|
+
#### Example
|
|
1211
1335
|
|
|
1212
|
-
|
|
1213
|
-
This JSON Schema representation can be used to describe schema requirements to external systems, and can be used with validation tools like [ajv](https://ajv.js.org/) to validate data before inserting it into a `SharedTree`.
|
|
1336
|
+
Given a `SharedTree` schema like the following:
|
|
1214
1337
|
|
|
1215
|
-
|
|
1338
|
+
```typescript
|
|
1339
|
+
class MyObject extends schemaFactory.object("MyObject", {
|
|
1340
|
+
foo: schemaFactory.number,
|
|
1341
|
+
bar: schemaFactory.optional(schemaFactory.string),
|
|
1342
|
+
});
|
|
1343
|
+
```
|
|
1216
1344
|
|
|
1217
|
-
|
|
1345
|
+
JSON Schema like the following would be produced:
|
|
1218
1346
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1347
|
+
```json
|
|
1348
|
+
{
|
|
1349
|
+
"$defs": {
|
|
1350
|
+
"com.fluidframework.leaf.string": {
|
|
1351
|
+
"type": "string"
|
|
1352
|
+
},
|
|
1353
|
+
"com.fluidframework.leaf.number": {
|
|
1354
|
+
"type": "number"
|
|
1355
|
+
},
|
|
1356
|
+
"com.myapp.MyObject": {
|
|
1357
|
+
"type": "object",
|
|
1358
|
+
"properties": {
|
|
1359
|
+
"foo": { "$ref": "com.fluidframework.leaf.number" },
|
|
1360
|
+
"bar": { "$ref": "com.fluidframework.leaf.string" }
|
|
1361
|
+
},
|
|
1362
|
+
"required": ["foo"]
|
|
1363
|
+
}
|
|
1364
|
+
},
|
|
1365
|
+
"anyOf": [{ "$ref": "#/$defs/com.myapp.MyObject" }]
|
|
1366
|
+
}
|
|
1367
|
+
```
|
|
1225
1368
|
|
|
1226
|
-
|
|
1369
|
+
- Enforce use of TreeViewConfiguration's constructor ([#22055](https://github.com/microsoft/FluidFramework/pull/22055)) [e8955579f6](https://github.com/microsoft/FluidFramework/commit/e8955579f6d52a6c7e300642088c60d6ed12d7db)
|
|
1227
1370
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
"type": "string"
|
|
1233
|
-
},
|
|
1234
|
-
"com.fluidframework.leaf.number": {
|
|
1235
|
-
"type": "number"
|
|
1236
|
-
},
|
|
1237
|
-
"com.myapp.MyObject": {
|
|
1238
|
-
"type": "object",
|
|
1239
|
-
"properties": {
|
|
1240
|
-
"foo": { "$ref": "com.fluidframework.leaf.number" },
|
|
1241
|
-
"bar": { "$ref": "com.fluidframework.leaf.string" }
|
|
1242
|
-
},
|
|
1243
|
-
"required": ["foo"]
|
|
1244
|
-
}
|
|
1245
|
-
},
|
|
1246
|
-
"anyOf": [{ "$ref": "#/$defs/com.myapp.MyObject" }]
|
|
1247
|
-
}
|
|
1248
|
-
```
|
|
1371
|
+
`TreeViewConfiguration` is `@sealed`, meaning creating custom implementations of it such as assigning object literals to a `TreeViewConfiguration` or sub-classing it are not supported.
|
|
1372
|
+
This reserved the ability for the Fluid Framework to add members to this class over time, informing users that they must use it in such a way where such changes are non-breaking.
|
|
1373
|
+
However, there was no compiler-based enforcement of this expectation.
|
|
1374
|
+
It was only indicated via documentation and an implicit assumption that when an API takes in a typed defined as a class, that an instance of that class must be used rather than an arbitrary object of a similar shape.
|
|
1249
1375
|
|
|
1250
|
-
|
|
1376
|
+
With this change, the TypeScript compiler will now inform users when they invalidly provide an object literal as a `TreeViewConfiguration`.
|
|
1251
1377
|
|
|
1252
|
-
|
|
1253
|
-
This reserved the ability for the Fluid Framework to add members to this class over time, informing users that they must use it in such a way where such changes are non-breaking.
|
|
1254
|
-
However, there was no compiler-based enforcement of this expectation.
|
|
1255
|
-
It was only indicated via documentation and an implicit assumption that when an API takes in a typed defined as a class, that an instance of that class must be used rather than an arbitrary object of a similar shape.
|
|
1378
|
+
More specifically this causes code like this to produce a compile error:
|
|
1256
1379
|
|
|
1257
|
-
|
|
1380
|
+
```typescript
|
|
1381
|
+
// Don't do this!
|
|
1382
|
+
const view = tree.viewWith({
|
|
1383
|
+
schema: TestNode,
|
|
1384
|
+
enableSchemaValidation: false,
|
|
1385
|
+
});
|
|
1386
|
+
```
|
|
1258
1387
|
|
|
1259
|
-
|
|
1388
|
+
The above was never intended to work, and is not a supported use of the `viewWith` since it requires a `TreeViewConfiguration` which is sealed.
|
|
1389
|
+
Any code using the above pattern will break in Fluid Framework 2.2 and above. Such code will need to be updated to the pattern shown below.
|
|
1390
|
+
Any code broken by this change is technically unsupported and only worked due to a gap in the type checking. This is not considered a breaking change.
|
|
1391
|
+
The correct way to get a `TreeViewConfiguration` is by using its constructor:
|
|
1260
1392
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1393
|
+
```typescript
|
|
1394
|
+
// This pattern correctly initializes default values and validates input.
|
|
1395
|
+
const view = tree.viewWith(new TreeViewConfiguration({ schema: TestNode }));
|
|
1396
|
+
```
|
|
1265
1397
|
|
|
1266
|
-
|
|
1267
|
-
Any code using the above pattern will break in Fluid Framework 2.2 and above. Such code will need to be updated to the pattern shown below.
|
|
1268
|
-
Any code broken by this change is technically unsupported and only worked due to a gap in the type checking. This is not considered a breaking change.
|
|
1269
|
-
The correct way to get a `TreeViewConfiguration` is by using its constructor:
|
|
1398
|
+
Skipping the constructor causes the following problems:
|
|
1270
1399
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1400
|
+
1. `TreeViewConfiguration` does validation in its constructor, so skipping it also skips the validation which leads to much less friendly error messages for invalid schema.
|
|
1401
|
+
2. Skipping the constructor also discards any default values for options like `enableSchemaValidation`.
|
|
1402
|
+
This means that code written in that style would break if more options were added. Since such changes are planned,
|
|
1403
|
+
it is not practical to support this pattern.
|
|
1275
1404
|
|
|
1276
|
-
|
|
1405
|
+
- Add a function `isRepoSuperset` to determine if changes to a document schema are backward-compatible ([#22045](https://github.com/microsoft/FluidFramework/pull/22045)) [f6fdc95bb3](https://github.com/microsoft/FluidFramework/commit/f6fdc95bb36a892710bc315aae85fd2c75aec975)
|
|
1277
1406
|
|
|
1278
|
-
|
|
1279
|
-
2. Skipping the constructor also discards any default values for options like `enableSchemaValidation`.
|
|
1280
|
-
This means that code written in that style would break if more options were added. Since such changes are planned,
|
|
1281
|
-
it is not practical to support this pattern.
|
|
1407
|
+
Note: These changes are not customer-facing and make progress toward future plans in Tree's schema evolution space.
|
|
1282
1408
|
|
|
1283
|
-
-
|
|
1409
|
+
- Add `@alpha` API `FixRecursiveArraySchema` as a workaround around an issue with recursive ArrayNode schema ([#22122](https://github.com/microsoft/FluidFramework/pull/22122)) [9ceacf9b54](https://github.com/microsoft/FluidFramework/commit/9ceacf9b5468ac8280a1dc48ada9d8b46b499f14)
|
|
1284
1410
|
|
|
1285
|
-
|
|
1411
|
+
Importing a recursive ArrayNode schema via a d.ts file can produce an error like
|
|
1412
|
+
`error TS2310: Type 'RecursiveArray' recursively references itself as a base type.`
|
|
1413
|
+
if using a tsconfig with `"skipLibCheck": false`.
|
|
1286
1414
|
|
|
1287
|
-
|
|
1415
|
+
This error occurs due to the TypeScript compiler splitting the class definition into two separate declarations in the d.ts file (one for the base, and one for the actual class).
|
|
1416
|
+
For unknown reasons, splitting the class declaration in this way breaks the recursive type handling, leading to the mentioned error.
|
|
1288
1417
|
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
if using a tsconfig with `"skipLibCheck": false`.
|
|
1418
|
+
Since recursive type handling in TypeScript is order dependent, putting just the right kind of usages of the type before the declarations can cause it to not hit this error.
|
|
1419
|
+
For the case of ArrayNodes, this can be done via usage that looks like this:
|
|
1292
1420
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1421
|
+
```typescript
|
|
1422
|
+
/**
|
|
1423
|
+
* Workaround to avoid
|
|
1424
|
+
* `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.` in the d.ts file.
|
|
1425
|
+
*/
|
|
1426
|
+
export declare const _RecursiveArrayWorkaround: FixRecursiveArraySchema<
|
|
1427
|
+
typeof RecursiveArray
|
|
1428
|
+
>;
|
|
1429
|
+
export class RecursiveArray extends schema.arrayRecursive("RA", [
|
|
1430
|
+
() => RecursiveArray,
|
|
1431
|
+
]) {}
|
|
1432
|
+
{
|
|
1433
|
+
type _check = ValidateRecursiveSchema<typeof RecursiveArray>;
|
|
1434
|
+
}
|
|
1435
|
+
```
|
|
1295
1436
|
|
|
1296
|
-
|
|
1297
|
-
For the case of ArrayNodes, this can be done via usage that looks like this:
|
|
1437
|
+
- Fix document-corrupting bug when rebasing over move compositions ([#21993](https://github.com/microsoft/FluidFramework/pull/21993)) [f3af9d1cd3](https://github.com/microsoft/FluidFramework/commit/f3af9d1cd3f7ee1ea3660ae934ddca8473fbdb9b)
|
|
1298
1438
|
|
|
1299
|
-
|
|
1300
|
-
/**
|
|
1301
|
-
* Workaround to avoid
|
|
1302
|
-
* `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.` in the d.ts file.
|
|
1303
|
-
*/
|
|
1304
|
-
export declare const _RecursiveArrayWorkaround: FixRecursiveArraySchema<typeof RecursiveArray>;
|
|
1305
|
-
export class RecursiveArray extends schema.arrayRecursive("RA", [() => RecursiveArray]) {}
|
|
1306
|
-
{
|
|
1307
|
-
type _check = ValidateRecursiveSchema<typeof RecursiveArray>;
|
|
1308
|
-
}
|
|
1309
|
-
```
|
|
1310
|
-
|
|
1311
|
-
- Fix document-corrupting bug when rebasing over move compositions ([#21993](https://github.com/microsoft/FluidFramework/pull/21993)) [f3af9d1cd3](https://github.com/microsoft/FluidFramework/commit/f3af9d1cd3f7ee1ea3660ae934ddca8473fbdb9b)
|
|
1312
|
-
|
|
1313
|
-
Before this fix, if multiple users concurrently performed moves (possibly by reverting prior moves), there was a chance that the document would become corrupted.
|
|
1439
|
+
Before this fix, if multiple users concurrently performed moves (possibly by reverting prior moves), there was a chance that the document would become corrupted.
|
|
1314
1440
|
|
|
1315
1441
|
## 2.1.0
|
|
1316
1442
|
|
|
1317
1443
|
### Minor Changes
|
|
1318
1444
|
|
|
1319
|
-
-
|
|
1445
|
+
- Detect arrayNode iterator invalidation ([#21760](https://github.com/microsoft/FluidFramework/pull/21760)) [6fd320c385](https://github.com/microsoft/FluidFramework/commit/6fd320c38561e272a1acaf4248f47fc386c650e4)
|
|
1320
1446
|
|
|
1321
|
-
|
|
1447
|
+
When `arrayNode`s are edited concurrently during iteration, an error will be thrown.
|
|
1322
1448
|
|
|
1323
|
-
-
|
|
1449
|
+
- tree: Improved performance for accessing identifiers in shortId API ([#21944](https://github.com/microsoft/FluidFramework/pull/21944)) [6b4cf26d9c](https://github.com/microsoft/FluidFramework/commit/6b4cf26d9cc14c1a36cf07fd7408f1d1227e373a)
|
|
1324
1450
|
|
|
1325
|
-
|
|
1451
|
+
Users should see improved performance when calling the `Tree.shortId` API. Identifier field keys are now cached in the schema for faster access.
|
|
1326
1452
|
|
|
1327
|
-
-
|
|
1453
|
+
- ✨ New! Debug visualizers for TreeNodes in NodeJS and browsers ([#21895](https://github.com/microsoft/FluidFramework/pull/21895)) [0d197fefec](https://github.com/microsoft/FluidFramework/commit/0d197fefec852df2911151217ac1b71cde528a70)
|
|
1328
1454
|
|
|
1329
|
-
|
|
1455
|
+
TreeNodes now have custom debug visualizers to improve the debug experience in NodeJS and in browsers. Note that custom formatters must be enabled in the browser developer tools for that visualizer to be used.
|
|
1330
1456
|
|
|
1331
|
-
-
|
|
1457
|
+
- Using "delete" on tree fields now throws an error instead of not working correctly ([#21609](https://github.com/microsoft/FluidFramework/pull/21609)) [416849b1fd](https://github.com/microsoft/FluidFramework/commit/416849b1fda029870ee1c1742100de4f8dde45b7)
|
|
1332
1458
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1459
|
+
TypeScript allows `delete` on object node optional fields if the `exactOptionalPropertyTypes` tsconfig setting is not
|
|
1460
|
+
enabled. This does not work correctly at runtime and now produces an informative error.
|
|
1335
1461
|
|
|
1336
|
-
-
|
|
1462
|
+
- SharedTree content that is removed is now deleted ([#21372](https://github.com/microsoft/FluidFramework/pull/21372)) [a6e412159a](https://github.com/microsoft/FluidFramework/commit/a6e412159a4df6aceb84aac35288b108a5351905)
|
|
1337
1463
|
|
|
1338
|
-
|
|
1339
|
-
|
|
1464
|
+
SharedTree now supports garbage collection so that removed content is not retained forever.
|
|
1465
|
+
This is an internal change and users of SharedTree won't need to adapt any existing code.
|
|
1340
1466
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1467
|
+
This change could cause errors with cross-version collaboration where an older client does not send data that a newer
|
|
1468
|
+
version may need. In this case, a "refresher data not found" error will be thrown.
|
|
1343
1469
|
|
|
1344
|
-
-
|
|
1470
|
+
- Improved error reporting ([#21940](https://github.com/microsoft/FluidFramework/pull/21940)) [3b8a366dd1](https://github.com/microsoft/FluidFramework/commit/3b8a366dd15660f9c916832040faf772534c0755)
|
|
1345
1471
|
|
|
1346
|
-
|
|
1347
|
-
|
|
1472
|
+
Several cases of invalid usage patterns for tree APIs have gained improved error reporting, as well as improved documentation on the APIs detailing what usage is supported.
|
|
1473
|
+
These improvements include:
|
|
1348
1474
|
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1475
|
+
- Unsupported usages of schema classes: using more than one schema class derived from a single SchemaFactory generated base class. This used to hit internal asserts, but now has a descriptive user-facing UsageError. Most of this work was done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707).
|
|
1476
|
+
- Improved detection of when prior exception may have left SharedTree in an invalid state.
|
|
1477
|
+
These cases now report a UsageError including a reference to the prior exception. This was mainly done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707) and [b77d530](https://github.com/microsoft/FluidFramework/commit/b77d530b9252201c40a90d1a2a6315f76f1a4a4b).
|
|
1352
1478
|
|
|
1353
1479
|
## 2.0.0-rc.5.0.0
|
|
1354
1480
|
|
|
1355
1481
|
### Minor Changes
|
|
1356
1482
|
|
|
1357
|
-
-
|
|
1483
|
+
- fluid-framework: Type Erase ISharedObjectKind ([#21081](https://github.com/microsoft/FluidFramework/pull/21081)) [78f228e370](https://github.com/microsoft/FluidFramework/commit/78f228e37055bd4d9a8f02b3a1eefebf4da9c59c)
|
|
1358
1484
|
|
|
1359
|
-
|
|
1485
|
+
A new type, `SharedObjectKind` is added as a type erased version of `ISharedObjectKind` and `DataObjectClass`.
|
|
1360
1486
|
|
|
1361
|
-
|
|
1487
|
+
This type fills the role of both `ISharedObjectKind` and `DataObjectClass` in the `@public` "declarative API" exposed in the `fluid-framework` package.
|
|
1362
1488
|
|
|
1363
|
-
|
|
1489
|
+
This allows several types referenced by `ISharedObjectKind` to be made `@alpha` as they should only need to be used by legacy code and users of the unstable/alpha/legacy "encapsulated API".
|
|
1364
1490
|
|
|
1365
|
-
|
|
1366
|
-
|
|
1491
|
+
Access to these now less public types should not be required for users of the `@public` "declarative API" exposed in the `fluid-framework` package, but can still be accessed for those who need them under the `/legacy` import paths.
|
|
1492
|
+
The full list of such types is:
|
|
1367
1493
|
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1494
|
+
- `SharedTree` as exported from `@fluidframwork/tree`: It is still exported as `@public` from `fluid-framework` as `SharedObjectKind`.
|
|
1495
|
+
- `ISharedObjectKind`: See new `SharedObjectKind` type for use in `@public` APIs.
|
|
1496
|
+
`ISharedObject`
|
|
1497
|
+
- `IChannel`
|
|
1498
|
+
- `IChannelAttributes`
|
|
1499
|
+
- `IChannelFactory`
|
|
1500
|
+
- `IExperimentalIncrementalSummaryContext`
|
|
1501
|
+
- `IGarbageCollectionData`
|
|
1502
|
+
- `ISummaryStats`
|
|
1503
|
+
- `ISummaryTreeWithStats`
|
|
1504
|
+
- `ITelemetryContext`
|
|
1505
|
+
- `IDeltaManagerErased`
|
|
1506
|
+
- `IFluidDataStoreRuntimeEvents`
|
|
1507
|
+
- `IFluidHandleContext`
|
|
1508
|
+
- `IProvideFluidHandleContext`
|
|
1383
1509
|
|
|
1384
|
-
|
|
1510
|
+
Removed APIs:
|
|
1385
1511
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1512
|
+
- `DataObjectClass`: Usages replaced with `SharedObjectKind`.
|
|
1513
|
+
- `LoadableObjectClass`: Replaced with `SharedObjectKind`.
|
|
1514
|
+
- `LoadableObjectClassRecord`: Replaced with `Record<string, SharedObjectKind>`.
|
|
1515
|
+
-
|
|
1390
1516
|
|
|
1391
|
-
-
|
|
1517
|
+
- tree: Added support for optional schema validation on newly inserted content in SharedTree ([#21011](https://github.com/microsoft/FluidFramework/pull/21011)) [b14e9fa607](https://github.com/microsoft/FluidFramework/commit/b14e9fa607a8281f86d0cfac631e33ef12033e21)
|
|
1392
1518
|
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1519
|
+
When defining how to view a SharedTree, an application can now specify that new content inserted into the tree should
|
|
1520
|
+
be subject to schema validation at the time it is inserted, so if it's not valid according to the stored schema in the
|
|
1521
|
+
tree an error is thrown immediately.
|
|
1396
1522
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1523
|
+
This can be accomplished by passing an `ITreeConfigurationOptions` argument with `enableSchemaValidation` set to `true`
|
|
1524
|
+
when creating a `TreeConfiguration` to use with the SharedTree.
|
|
1399
1525
|
|
|
1400
|
-
|
|
1526
|
+
Since this feature requires additional compute when inserting new content into the tree, it is not enabled by default.
|
|
1401
1527
|
|
|
1402
|
-
-
|
|
1528
|
+
- Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
|
|
1403
1529
|
|
|
1404
|
-
|
|
1530
|
+
Update package implementations to use TypeScript 5.4.5.
|
|
1405
1531
|
|
|
1406
|
-
-
|
|
1532
|
+
- tree: A new tree status has been added for SharedTree nodes. ([#21270](https://github.com/microsoft/FluidFramework/pull/21270)) [8760e321b0](https://github.com/microsoft/FluidFramework/commit/8760e321b02177babfb187ae293a17a65723f249)
|
|
1407
1533
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1534
|
+
`TreeStatus.Created` indicates that a SharedTree node has been constructed but not yet inserted into the tree.
|
|
1535
|
+
Constraints passed to the `runTransaction` API are now marked as `readonly`.
|
|
1410
1536
|
|
|
1411
|
-
-
|
|
1537
|
+
- tree: Adjusted Listenable multi-event subscription policy. ([#21244](https://github.com/microsoft/FluidFramework/pull/21244)) [a0c1d2c5b1](https://github.com/microsoft/FluidFramework/commit/a0c1d2c5b1e20f3dc469377c093649fc5eb8c3dd)
|
|
1412
1538
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1539
|
+
`Listenable.on()` no longer supports the same listener function object being registered twice for the same event.
|
|
1540
|
+
The deregister function returned by `Listenable.on()` may now be called multiple times with no effect.
|
|
1415
1541
|
|
|
1416
|
-
-
|
|
1542
|
+
- Update to ES 2022 ([#21292](https://github.com/microsoft/FluidFramework/pull/21292)) [68921502f7](https://github.com/microsoft/FluidFramework/commit/68921502f79b1833c4cd6d0fe339bfb126a712c7)
|
|
1417
1543
|
|
|
1418
|
-
|
|
1544
|
+
Update tsconfig to target ES 2022.
|
|
1419
1545
|
|
|
1420
|
-
-
|
|
1546
|
+
- tree: Event types have been renamed ([#21233](https://github.com/microsoft/FluidFramework/pull/21233)) [4d56fd1f99](https://github.com/microsoft/FluidFramework/commit/4d56fd1f99a25f34c69d1aed2b60fbe156fc068f)
|
|
1421
1547
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1548
|
+
- `ISubscribable` is renamed to `Listenable`.
|
|
1549
|
+
- `IsEvent` type helper is renamed to `IsListener`.
|
|
1550
|
+
- `Events` is renamed to `Listeners`.
|
|
1425
1551
|
|
|
1426
|
-
-
|
|
1552
|
+
- tree: Move several types into InternalTypes ([#21482](https://github.com/microsoft/FluidFramework/pull/21482)) [64d49dd362](https://github.com/microsoft/FluidFramework/commit/64d49dd3629cefe6260a1d6223e58b10c2ac0cb6)
|
|
1427
1553
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1554
|
+
The stable public API surface for Tree has been reduced.
|
|
1555
|
+
Several types have been moved into InternalTypes, indicating that they are not fully stable nor intended to be referenced by users of Tree.
|
|
1430
1556
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1557
|
+
- NodeBuilderData
|
|
1558
|
+
- FieldHasDefault
|
|
1559
|
+
- TreeNodeSchemaNonClass
|
|
1560
|
+
- TreeArrayNodeBase
|
|
1561
|
+
- ScopedSchemaName
|
|
1562
|
+
- DefaultProvider
|
|
1563
|
+
- typeNameSymbol
|
|
1564
|
+
- InsertableObjectFromSchemaRecord
|
|
1565
|
+
- ObjectFromSchemaRecord
|
|
1566
|
+
- FieldHasDefaultUnsafe
|
|
1567
|
+
- ObjectFromSchemaRecordUnsafe
|
|
1568
|
+
- TreeObjectNodeUnsafe
|
|
1569
|
+
- TreeFieldFromImplicitFieldUnsafe
|
|
1570
|
+
- TreeNodeFromImplicitAllowedTypesUnsafe
|
|
1571
|
+
- InsertableTreeNodeFromImplicitAllowedTypesUnsafe
|
|
1572
|
+
- TreeArrayNodeUnsafe
|
|
1573
|
+
- TreeMapNodeUnsafe
|
|
1574
|
+
- InsertableObjectFromSchemaRecordUnsafe
|
|
1575
|
+
- InsertableTreeFieldFromImplicitFieldUnsafe
|
|
1576
|
+
- InsertableTypedNodeUnsafe
|
|
1577
|
+
- NodeBuilderDataUnsafe
|
|
1578
|
+
- NodeFromSchemaUnsafe
|
|
1579
|
+
- FlexList
|
|
1580
|
+
- TreeApi
|
|
1455
1581
|
|
|
1456
|
-
|
|
1582
|
+
Additionally a few more types which could not be moved due to technically limitations have been documented that they should be treated similarly.
|
|
1457
1583
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1584
|
+
- TreeNodeApi
|
|
1585
|
+
- TreeNodeSchemaCore
|
|
1586
|
+
- All \*Unsafe type (use for construction of recursive schema).
|
|
1587
|
+
- WithType
|
|
1588
|
+
- AllowedTypes
|
|
1589
|
+
- FieldSchemaUnsafe
|
|
1464
1590
|
|
|
1465
|
-
|
|
1591
|
+
Also to reduce confusion `type` was renamed to `typeNameSymbol`, and is now only type exported. `Tree.is` should be used to get type information from `TreeNodes` instead.
|
|
1466
1592
|
|
|
1467
|
-
-
|
|
1593
|
+
- tree: object node fields with statically known default values are now optional ([#21193](https://github.com/microsoft/FluidFramework/pull/21193)) [21eac41660](https://github.com/microsoft/FluidFramework/commit/21eac41660944208bad42b156d7df05fe6dc6b97)
|
|
1468
1594
|
|
|
1469
|
-
|
|
1595
|
+
Makes object node fields with statically known default values (i.e., `optional` and `identifier` fields) optional when creating trees, where they were previously required.
|
|
1470
1596
|
|
|
1471
|
-
|
|
1597
|
+
Example:
|
|
1472
1598
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1599
|
+
```typescript
|
|
1600
|
+
class Foo extends schemaFactory.object("Foo", {
|
|
1601
|
+
name: schemaFactory.string,
|
|
1602
|
+
id: schemaFactory.identifier,
|
|
1603
|
+
nickname: schemaFactory.optional(schemaFactory.string),
|
|
1604
|
+
}) {}
|
|
1479
1605
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1606
|
+
// Before
|
|
1607
|
+
const foo = new Foo({
|
|
1608
|
+
name: "Bar",
|
|
1609
|
+
id: undefined, // Had to explicitly specify `undefined` to opt into default behavior
|
|
1610
|
+
nickname: undefined, // Had to explicitly specify `undefined` for optional field
|
|
1611
|
+
});
|
|
1486
1612
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1613
|
+
// After
|
|
1614
|
+
const foo = new Foo({
|
|
1615
|
+
name: "Bar",
|
|
1616
|
+
// Can omit `id` and `nickname` fields, as both have statically known defaults!
|
|
1617
|
+
});
|
|
1618
|
+
```
|
|
1493
1619
|
|
|
1494
|
-
-
|
|
1620
|
+
- tree: Breaking change: Removed the `"afterBatch"` event from `Treeview` ([#21406](https://github.com/microsoft/FluidFramework/pull/21406)) [69aceb88e5](https://github.com/microsoft/FluidFramework/commit/69aceb88e525d7fb5c93aaa8328ce26a56e2d9cb)
|
|
1495
1621
|
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1622
|
+
This event is no longer necessary.
|
|
1623
|
+
In the past, it provided a means for waiting for a batch of changes to finish applying to the tree before taking some action.
|
|
1624
|
+
However, the tree change events exposed via `Tree.on` wait for a batch to complete before firing, so the `"afterBatch"` event provides no additional guarantees.
|
|
1625
|
+
Listeners of this event who wish to respond to changes to the tree view can use `"rootChanged"` instead.
|
|
1500
1626
|
|
|
1501
|
-
-
|
|
1627
|
+
- tree: Fix AfterBatch event ([#21162](https://github.com/microsoft/FluidFramework/pull/21162)) [cecd740a6c](https://github.com/microsoft/FluidFramework/commit/cecd740a6cadc6d3cdafdba7e22312b3d756c780)
|
|
1502
1628
|
|
|
1503
|
-
|
|
1629
|
+
`TreeViewEvents.afterBatch` is now triggered when appropriate instead of never firing.
|
|
1504
1630
|
|
|
1505
|
-
-
|
|
1631
|
+
- tree: Breaking change: `TreeStatus.Created` is now `TreeStatus.New` ([#21278](https://github.com/microsoft/FluidFramework/pull/21278)) [5a26346a14](https://github.com/microsoft/FluidFramework/commit/5a26346a145ed54d08cd5a9b4f1c9b177711bd7c)
|
|
1506
1632
|
|
|
1507
|
-
|
|
1633
|
+
`TreeStatus.Created` has been renamed to `TreeStatus.New`.
|
|
1508
1634
|
|
|
1509
|
-
-
|
|
1635
|
+
- tree: Implement compatibility-based schema evolution API ([#20815](https://github.com/microsoft/FluidFramework/pull/20815)) [64e5763b70](https://github.com/microsoft/FluidFramework/commit/64e5763b70e269418fbb77f75dbd3c82b91b1aff)
|
|
1510
1636
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1637
|
+
This change adjusts some top-level APIs for using SharedTree to better accommodate applications that need to change their schema.
|
|
1638
|
+
These changes enable forwards compatibility with future work to relax `SharedTree`'s restrictions around view schema and stored schema compatibility.
|
|
1639
|
+
That future work will enable more flexible policies around how applications can update their documents' schemas over time.
|
|
1514
1640
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1641
|
+
Application authors are encouraged to develop a compatibility policy which they are comfortable with using the guidance in the
|
|
1642
|
+
"Schema Evolvability" section of `@fluidframework/tree`'s readme.
|
|
1517
1643
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1644
|
+
To make the details of schema compatibilities that SharedTree supports more clear,
|
|
1645
|
+
`TreeView.error` has been functionally replaced with the `compatibility` property.
|
|
1646
|
+
Users desiring the previous strict behavior should use `view.compatibility.isEquivalent` at appropriate places in application logic.
|
|
1521
1647
|
|
|
1522
|
-
|
|
1648
|
+
# `ITree.schematize` removal
|
|
1523
1649
|
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
## Old
|
|
1530
|
-
|
|
1531
|
-
As an example, something like the following code may have been used before for both the document create and document load codepaths:
|
|
1532
|
-
|
|
1533
|
-
```typescript
|
|
1534
|
-
// -- fluid-framework API for statically defined objects in container schema --
|
|
1535
|
-
const tree = container.initialObjects.myTree;
|
|
1536
|
-
const view = tree.schematize(new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })));
|
|
1650
|
+
`ITree.schematize` (and its argument `TreeConfiguration`) has been removed. Instead, call `ITree.viewWith` and provide it a `TreeViewConfiguration`.
|
|
1651
|
+
Unlike `schematize`, `viewWith` does not implicitly initialize the document.
|
|
1652
|
+
As such, it doesn't take an `initialTree` property.
|
|
1653
|
+
Instead, applications should initialize their trees in document creation codepaths using the added `TreeView.initialize` API.
|
|
1537
1654
|
|
|
1538
|
-
|
|
1539
|
-
const tree = await container.create(SharedTree);
|
|
1540
|
-
const view = tree.schematize(new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })));
|
|
1541
|
-
```
|
|
1655
|
+
## Old
|
|
1542
1656
|
|
|
1543
|
-
|
|
1657
|
+
As an example, something like the following code may have been used before for both the document create and document load codepaths:
|
|
1544
1658
|
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1659
|
+
```typescript
|
|
1660
|
+
// -- fluid-framework API for statically defined objects in container schema --
|
|
1661
|
+
const tree = container.initialObjects.myTree;
|
|
1662
|
+
const view = tree.schematize(
|
|
1663
|
+
new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })),
|
|
1664
|
+
);
|
|
1550
1665
|
|
|
1551
|
-
|
|
1666
|
+
// -- fluid-framework API for dynamically created objects --
|
|
1667
|
+
const tree = await container.create(SharedTree);
|
|
1668
|
+
const view = tree.schematize(
|
|
1669
|
+
new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })),
|
|
1670
|
+
);
|
|
1671
|
+
```
|
|
1552
1672
|
|
|
1553
|
-
|
|
1673
|
+
When using the encapsulated API, creating a tree looks a bit different but the call to `schematize` is the same:
|
|
1554
1674
|
|
|
1555
|
-
|
|
1556
|
-
|
|
1675
|
+
```typescript
|
|
1676
|
+
// -- encapsulated API --
|
|
1677
|
+
const tree = SharedTree.create(runtime, "foo");
|
|
1678
|
+
const view = tree.schematize(
|
|
1679
|
+
new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })),
|
|
1680
|
+
);
|
|
1681
|
+
```
|
|
1557
1682
|
|
|
1558
|
-
|
|
1559
|
-
// a SharedTree is unaffected by this changeset.
|
|
1560
|
-
const tree = SharedTree.create(runtime, "foo");
|
|
1561
|
-
const view = tree.viewWith(treeConfig);
|
|
1562
|
-
view.initialize(new Point({ x: 0, y: 0 }));
|
|
1563
|
-
```
|
|
1683
|
+
## New
|
|
1564
1684
|
|
|
1565
|
-
|
|
1685
|
+
After migrating this code away from `schematize` and onto `viewWith`, it would look like this on the create codepath:
|
|
1566
1686
|
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
// root directory or in `IFluidContainer.initialObjects`
|
|
1570
|
-
const view = tree.viewWith(treeConfig);
|
|
1571
|
-
```
|
|
1687
|
+
```typescript
|
|
1688
|
+
const treeConfig = new TreeViewConfiguration({ schema: Point });
|
|
1572
1689
|
|
|
1573
|
-
|
|
1574
|
-
|
|
1690
|
+
// The following line reflects the first-party API (e.g. @fluidframework/aqueduct). If using the third-party API, obtaining
|
|
1691
|
+
// a SharedTree is unaffected by this changeset.
|
|
1692
|
+
const tree = SharedTree.create(runtime, "foo");
|
|
1693
|
+
const view = tree.viewWith(treeConfig);
|
|
1694
|
+
view.initialize(new Point({ x: 0, y: 0 }));
|
|
1695
|
+
```
|
|
1575
1696
|
|
|
1576
|
-
|
|
1697
|
+
and this on the load codepath:
|
|
1577
1698
|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1699
|
+
```typescript
|
|
1700
|
+
// 'tree' would typically be obtained by retrieving it from a well-known location, e.g. within a `DataObject`'s
|
|
1701
|
+
// root directory or in `IFluidContainer.initialObjects`
|
|
1702
|
+
const view = tree.viewWith(treeConfig);
|
|
1703
|
+
```
|
|
1704
|
+
|
|
1705
|
+
Besides only making the initial tree required to specify in places that actually perform document initialization, this is beneficial for mutation semantics: `tree.viewWith` never modifies the state of the underlying tree.
|
|
1706
|
+
This means applications are free to attempt to view a document using multiple schemas (e.g. legacy versions of their document format) without worrying about altering the document state.
|
|
1707
|
+
|
|
1708
|
+
If existing code used schematize in a context where it wasn't known whether the document needed to be initialized, you can leverage `TreeView.compatibility` like so:
|
|
1709
|
+
|
|
1710
|
+
```typescript
|
|
1711
|
+
const view = tree.viewWith(config);
|
|
1712
|
+
if (view.compatibility.canInitialize) {
|
|
1713
|
+
view.initialize(initialTree);
|
|
1714
|
+
}
|
|
1715
|
+
```
|
|
1584
1716
|
|
|
1585
|
-
|
|
1717
|
+
# Separate `schemaChanged` event on `TreeView`
|
|
1586
1718
|
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1719
|
+
The previous `rootChanged` event was called whenever the root was invalidated, which happens on changes to the document schema
|
|
1720
|
+
as well as changes to the root field (i.e. usage of `TreeView.root`'s setter on a local client, or acking such a change made by
|
|
1721
|
+
a remote client).
|
|
1590
1722
|
|
|
1591
|
-
|
|
1592
|
-
|
|
1723
|
+
There was no distinct `schemaChanged` event, meaning that any time the root changed,
|
|
1724
|
+
clients would have needed to check the `error` state on `TreeView` to see if the document's underlying schema had been changed.
|
|
1593
1725
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1726
|
+
Now, the latter case of the document's underlying schema changing has been split off into a `schemaChanged` event, which will
|
|
1727
|
+
fire before `rootChanged`.
|
|
1728
|
+
This should allow applications to run slightly less compatibility logic to routine changes to the root field.
|
|
1597
1729
|
|
|
1598
|
-
-
|
|
1730
|
+
- core-interfaces, tree: Unify `IDisposable` interfaces ([#21184](https://github.com/microsoft/FluidFramework/pull/21184)) [cfcb827851](https://github.com/microsoft/FluidFramework/commit/cfcb827851ffc81486db6c718380150189fb95c5)
|
|
1599
1731
|
|
|
1600
|
-
|
|
1732
|
+
Public APIs in `@fluidframework/tree` now use `IDisposable` from `@fluidframework/core-interfaces` replacing `disposeSymbol` with "dispose".
|
|
1601
1733
|
|
|
1602
|
-
|
|
1734
|
+
`IDisposable` in `@fluidframework/core-interfaces` is now `@sealed` indicating that third parties should not implement it to reserve the ability for Fluid Framework to extend it to include `Symbol.dispose` as a future non-breaking change.
|
|
1603
1735
|
|
|
1604
|
-
-
|
|
1736
|
+
- tree: Fix bug where reading tree during events could cause issues ([#21172](https://github.com/microsoft/FluidFramework/pull/21172)) [81a648a984](https://github.com/microsoft/FluidFramework/commit/81a648a9843f7940df318b63258d864d1fa91bc1)
|
|
1605
1737
|
|
|
1606
|
-
|
|
1738
|
+
Reading the tree inside of NodeChange and TreeChange events could corrupt internal memory structures leading to invalid data in subsequence reads as well as internal errors being thrown. This bug has been fixed.
|
|
1607
1739
|
|
|
1608
1740
|
## 2.0.0-rc.4.0.0
|
|
1609
1741
|
|
|
1610
1742
|
### Minor Changes
|
|
1611
1743
|
|
|
1612
|
-
-
|
|
1744
|
+
- Deprecated members of IFluidHandle are split off into new IFluidHandleInternal interface [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
1613
1745
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1746
|
+
Split IFluidHandle into two interfaces, `IFluidHandle` and `IFluidHandleInternal`.
|
|
1747
|
+
Code depending on the previously deprecated members of IFluidHandle can access them by using `toFluidHandleInternal` from `@fluidframework/runtime-utils/legacy`.
|
|
1616
1748
|
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1749
|
+
External implementation of the `IFluidHandle` interface are not supported: this change makes the typing better convey this using the `ErasedType` pattern.
|
|
1750
|
+
Any existing and previously working, and now broken, external implementations of `IFluidHandle` should still work at runtime, but will need some unsafe type casts to compile.
|
|
1751
|
+
Such handle implementation may break in the future and thus should be replaced with use of handles produced by the Fluid Framework client packages.
|
|
1620
1752
|
|
|
1621
|
-
-
|
|
1753
|
+
- Minor API fixes for "@fluidframework/tree" package. [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
1622
1754
|
|
|
1623
|
-
|
|
1755
|
+
Changes constructor for `FieldSchema` from public to private. Users should call `makeFieldSchema` to create instance of `FieldSchema`.
|
|
1624
1756
|
|
|
1625
1757
|
## 2.0.0-rc.3.0.0
|
|
1626
1758
|
|
|
1627
1759
|
### Major Changes
|
|
1628
1760
|
|
|
1629
|
-
-
|
|
1761
|
+
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1630
1762
|
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1763
|
+
Fluid Framework packages have been updated to use the [package.json "exports"
|
|
1764
|
+
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
|
|
1765
|
+
TypeScript types and implementation code.
|
|
1634
1766
|
|
|
1635
|
-
|
|
1767
|
+
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
1636
1768
|
|
|
1637
|
-
|
|
1638
|
-
|
|
1769
|
+
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
1770
|
+
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
1639
1771
|
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1772
|
+
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
|
|
1773
|
+
for use with modern versions of Node.js _and_ Bundlers.
|
|
1774
|
+
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
|
|
1775
|
+
regarding the module and moduleResolution options.
|
|
1644
1776
|
|
|
1645
|
-
|
|
1646
|
-
|
|
1777
|
+
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
|
|
1778
|
+
to distinguish stable APIs from those that are in development.**
|
|
1647
1779
|
|
|
1648
1780
|
### Minor Changes
|
|
1649
1781
|
|
|
1650
|
-
-
|
|
1782
|
+
- Better events [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1651
1783
|
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1784
|
+
We have updated the Events to make it easier to create granular event listeners for single nodes and better support the
|
|
1785
|
+
undo/redo feature. SharedTree nodes now expose `nodeChanged` and `treeChanged` events that fire in response to changes
|
|
1786
|
+
in the node, and to changes in the subtree rooted at the node, respectively.
|
|
1655
1787
|
|
|
1656
|
-
|
|
1788
|
+
This change was originally made in [#20286](https://github.com/microsoft/FluidFramework/pull/20286) ([ac1e773960](https://github.com/microsoft/FluidFramework/commit/ac1e7739607551abb0dae7fa74dda56aec94b609)).
|
|
1657
1789
|
|
|
1658
|
-
|
|
1790
|
+
[Read more about SharedTree Events at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#event-handling)
|
|
1659
1791
|
|
|
1660
|
-
-
|
|
1792
|
+
- Recursive schemas [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1661
1793
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1794
|
+
Schemas are even more powerful now with the added support for recursive types, which allows you to define types that
|
|
1795
|
+
reference nodes of the same type in their subtree.
|
|
1664
1796
|
|
|
1665
|
-
|
|
1797
|
+
Users of the beta APIs via `SchemaFactoryRecursive` can now find them on `SchemaFactory`.
|
|
1666
1798
|
|
|
1667
|
-
|
|
1799
|
+
[Read more about Recursive Schema at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#recursive-schema)
|
|
1668
1800
|
|
|
1669
|
-
-
|
|
1801
|
+
- Transactions [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1670
1802
|
|
|
1671
|
-
|
|
1672
|
-
|
|
1803
|
+
You can group multiple changes such that they are applied atomically, and if they fail, they fail atomically. As a
|
|
1804
|
+
result of grouping changes in a transaction, you also get a single revertible object making it easier to undo and redo.
|
|
1673
1805
|
|
|
1674
|
-
|
|
1806
|
+
[Read more about Transactions at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#transactions)
|
|
1675
1807
|
|
|
1676
|
-
-
|
|
1808
|
+
- tree: Empty optional fields on object nodes now are undefined non-enumerable own properties instead of not a property at all. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1677
1809
|
|
|
1678
|
-
|
|
1679
|
-
|
|
1810
|
+
Empty optional fields on object nodes now are now undefined non-enumerable own properties.
|
|
1811
|
+
This improves behavior in cases where they shadow inherited members which no longer have types which differ from the runtime behavior.
|
|
1680
1812
|
|
|
1681
|
-
-
|
|
1813
|
+
- tree: Allow root editing and make TreeView parameterized over schema. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1682
1814
|
|
|
1683
|
-
|
|
1684
|
-
|
|
1815
|
+
TreeView now is parameterized over the field schema instead of the root field type. This was needed to infer the correct input type when reassigning the root.
|
|
1816
|
+
Code providing an explicit type to TreeView, like `TreeView<Foo>` can usually be updated by replacing that with `TreeView<typeof Foo>`.
|
|
1685
1817
|
|
|
1686
|
-
-
|
|
1818
|
+
- fluid-framework: Replace SharedObjectClass with new ISharedObjectKind type. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1687
1819
|
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1820
|
+
The static objects used as SharedObjectClass now explicitly implement the new ISharedObjectKind type.
|
|
1821
|
+
SharedObjectClass has been removed as ISharedObjectKind now fills that role.
|
|
1822
|
+
LoadableObjectCtor has been inlined as it only had one use: an external user of it can replace it with `(new (...args: any[]) => T)`.
|
|
1691
1823
|
|
|
1692
|
-
-
|
|
1824
|
+
- Undo/Redo [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
1693
1825
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1826
|
+
Added the ability to listen for changes and track revertible objects on your undo/redo stacks. Revertibles allow you to
|
|
1827
|
+
undo and redo changes even if other changes have been made in remote clients.
|
|
1696
1828
|
|
|
1697
|
-
|
|
1829
|
+
[Read more about Undo/redo at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#undoredo-support)
|
|
1698
1830
|
|
|
1699
1831
|
## 2.0.0-rc.2.0.0
|
|
1700
1832
|
|
|
1701
1833
|
### Minor Changes
|
|
1702
1834
|
|
|
1703
|
-
-
|
|
1835
|
+
- map, tree: DDS classes are no longer publicly exported ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
|
|
1704
1836
|
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1837
|
+
SharedMap and SharedTree now only export their factories and the interface types.
|
|
1838
|
+
The actual concrete classes which leak implementation details are no longer exported.
|
|
1839
|
+
Users of the `SharedMap` type should use `ISharedMap`.
|
|
1840
|
+
Users of the `SharedTree` type should use `ISharedTree`.
|
|
1709
1841
|
|
|
1710
|
-
-
|
|
1842
|
+
- tree: Minor API fixes for "@fluidframework/tree" package. ([#19057](https://github.com/microsoft/FluidFramework/issues/19057)) [3e0f218832](https://github.com/microsoft/FluidFramework/commits/3e0f21883255317f8bb1f7c420543650502a5b66)
|
|
1711
1843
|
|
|
1712
|
-
|
|
1844
|
+
Rename `IterableTreeListContent` to `IterableTreeArrayContent`, inline `TreeMapNodeBase` into `TreeMapNode`, rename `TreeArrayNode.spread` to `TreeArrayNode.spread` and remove `create` which was not supposed to be public (use `TreeArrayNode.spread` instead).
|
|
1713
1845
|
|
|
1714
1846
|
## 2.0.0-rc.1.0.0
|
|
1715
1847
|
|
|
1716
1848
|
### Major Changes
|
|
1717
1849
|
|
|
1718
|
-
-
|
|
1850
|
+
- @fluid-experimental/tree2 package renamed ([#18851](https://github.com/microsoft/FluidFramework/issues/18851)) [6161193ffe](https://github.com/microsoft/FluidFramework/commits/6161193ffe661c3835c4f1ba2da78078dca10b4b)
|
|
1719
1851
|
|
|
1720
|
-
|
|
1852
|
+
The package is now `@fluidframework/tree`.
|
|
1721
1853
|
|
|
1722
1854
|
### Minor Changes
|
|
1723
1855
|
|
|
1724
|
-
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1856
|
+
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
1857
|
+
|
|
1858
|
+
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
1859
|
+
|
|
1860
|
+
- @fluidframework/gitresources
|
|
1861
|
+
- @fluidframework/server-kafka-orderer
|
|
1862
|
+
- @fluidframework/server-lambdas
|
|
1863
|
+
- @fluidframework/server-lambdas-driver
|
|
1864
|
+
- @fluidframework/server-local-server
|
|
1865
|
+
- @fluidframework/server-memory-orderer
|
|
1866
|
+
- @fluidframework/protocol-base
|
|
1867
|
+
- @fluidframework/server-routerlicious
|
|
1868
|
+
- @fluidframework/server-routerlicious-base
|
|
1869
|
+
- @fluidframework/server-services
|
|
1870
|
+
- @fluidframework/server-services-client
|
|
1871
|
+
- @fluidframework/server-services-core
|
|
1872
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
1873
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
1874
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
1875
|
+
- @fluidframework/server-services-shared
|
|
1876
|
+
- @fluidframework/server-services-telemetry
|
|
1877
|
+
- @fluidframework/server-services-utils
|
|
1878
|
+
- @fluidframework/server-test-utils
|
|
1879
|
+
- tinylicious
|
|
1880
|
+
|
|
1881
|
+
- Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
1882
|
+
|
|
1883
|
+
The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
|
|
1884
|
+
changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
|
|
1753
1885
|
|
|
1754
1886
|
## 2.0.0-internal.8.0.0
|
|
1755
1887
|
|
|
1756
1888
|
### Major Changes
|
|
1757
1889
|
|
|
1758
|
-
-
|
|
1890
|
+
- datastore-definitions: Jsonable and Serializable now require a generic parameter [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
1759
1891
|
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1892
|
+
The `Jsonable` and `Serializable` types from @fluidframework/datastore-definitions now require a generic parameter and
|
|
1893
|
+
if that type is `any` or `unknown`will return a new result `JsonableTypeWith<>` that more accurately represents the
|
|
1894
|
+
limitation of serialization.
|
|
1763
1895
|
|
|
1764
|
-
|
|
1896
|
+
Additional modifications:
|
|
1765
1897
|
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1898
|
+
- `Jsonable`'s `TReplacement` parameter default has also been changed from `void` to `never`, which now disallows
|
|
1899
|
+
`void`.
|
|
1900
|
+
- Unrecognized primitive types like `symbol` are now filtered to `never` instead of `{}`.
|
|
1901
|
+
- Recursive types with arrays (`[]`) are now supported.
|
|
1770
1902
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1903
|
+
`Serializable` is commonly used for DDS values and now requires more precision when using them. For example SharedMatrix
|
|
1904
|
+
(unqualified) has an `any` default that meant values were `Serializable<any>` (i.e. `any`), but now `Serializable<any>`
|
|
1905
|
+
is `JsonableTypeWith<IFluidHandle>` which may be problematic for reading or writing. Preferred correction is to specify
|
|
1906
|
+
the value type but casting through `any` may provide a quick fix.
|
|
1775
1907
|
|
|
1776
1908
|
## 2.0.0-internal.7.4.0
|
|
1777
1909
|
|
|
@@ -1781,190 +1913,190 @@ Dependency updates only.
|
|
|
1781
1913
|
|
|
1782
1914
|
### Minor Changes
|
|
1783
1915
|
|
|
1784
|
-
-
|
|
1916
|
+
- Rename SchemaCollection.treeSchema to nodeSchema ([#18067](https://github.com/microsoft/FluidFramework/issues/18067)) [be7ee4b383](https://github.com/microsoft/FluidFramework/commits/be7ee4b383c86fbcb60e92b606bbd305d0157acb)
|
|
1785
1917
|
|
|
1786
|
-
|
|
1918
|
+
This breaks all existing documents, as well as any users of SchemaCollection.treeSchema.
|
|
1787
1919
|
|
|
1788
|
-
-
|
|
1920
|
+
- Remove editable-tree-1 ([#18169](https://github.com/microsoft/FluidFramework/issues/18169)) [f0100204bd](https://github.com/microsoft/FluidFramework/commits/f0100204bd19f8be769a1163a655a185e7c1289e)
|
|
1789
1921
|
|
|
1790
|
-
|
|
1922
|
+
Remove editable-tree-1 and APIs related to it. Users must migrate to editable-tree-2.
|
|
1791
1923
|
|
|
1792
1924
|
## 2.0.0-internal.7.2.0
|
|
1793
1925
|
|
|
1794
1926
|
### Minor Changes
|
|
1795
1927
|
|
|
1796
|
-
-
|
|
1928
|
+
- tree2: Rename DocumentSchema and toDocumentSchema ([#17854](https://github.com/microsoft/FluidFramework/issues/17854)) [0b5944050d](https://github.com/microsoft/FluidFramework/commits/0b5944050d3bc4470a87de4a4332235d37cb719c)
|
|
1797
1929
|
|
|
1798
|
-
|
|
1930
|
+
The following APIs have been renamed:
|
|
1799
1931
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1932
|
+
- `DocumentSchema` is now `TreeSchema`
|
|
1933
|
+
- `toDocumentSchema` is now `intoSchema`
|
|
1802
1934
|
|
|
1803
|
-
-
|
|
1935
|
+
- tree2: Rename SchemaData, FieldSchema, and FieldStoredSchema ([#17888](https://github.com/microsoft/FluidFramework/issues/17888)) [27f5a5e24d](https://github.com/microsoft/FluidFramework/commits/27f5a5e24dda81eafe5678742d68cd7d8afdc060)
|
|
1804
1936
|
|
|
1805
|
-
|
|
1937
|
+
The following APIs have been renamed:
|
|
1806
1938
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1939
|
+
- `SchemaData` is now `TreeStoredSchema`
|
|
1940
|
+
- `FieldSchema` is now `TreeFieldSchema`
|
|
1941
|
+
- `FieldStoredSchema` is now `TreeFieldStoredSchema`
|
|
1810
1942
|
|
|
1811
|
-
-
|
|
1943
|
+
- tree2: Add `null` to allowed leaf types ([#17781](https://github.com/microsoft/FluidFramework/issues/17781)) [040e28f3ab](https://github.com/microsoft/FluidFramework/commits/040e28f3aba415e086fe2661e97d984c97b85045)
|
|
1812
1944
|
|
|
1813
|
-
|
|
1945
|
+
Replaced the jsonNull schema with a new null leaf schema, and added support for leaf values which are null.
|
|
1814
1946
|
|
|
1815
|
-
-
|
|
1947
|
+
- tree2: Rename TreeSchema ([#17845](https://github.com/microsoft/FluidFramework/issues/17845)) [908ee8921e](https://github.com/microsoft/FluidFramework/commits/908ee8921eb8d7fc21f64eee88a12c678e9756dd)
|
|
1816
1948
|
|
|
1817
|
-
|
|
1949
|
+
The following APIs have been renamed:
|
|
1818
1950
|
|
|
1819
|
-
|
|
1951
|
+
- `TreeSchema` is now `TreeNodeSchema`
|
|
1820
1952
|
|
|
1821
|
-
-
|
|
1953
|
+
- tree2: Rename Struct ([#17899](https://github.com/microsoft/FluidFramework/issues/17899)) [d90af254fe](https://github.com/microsoft/FluidFramework/commits/d90af254fe4224dd6391908e88055f3c98cc1d18)
|
|
1822
1954
|
|
|
1823
|
-
|
|
1955
|
+
The following APIs have been renamed:
|
|
1824
1956
|
|
|
1825
|
-
|
|
1957
|
+
- `Struct` is now `ObjectNode`
|
|
1826
1958
|
|
|
1827
1959
|
## 2.0.0-internal.7.1.0
|
|
1828
1960
|
|
|
1829
1961
|
### Major Changes
|
|
1830
1962
|
|
|
1831
|
-
-
|
|
1963
|
+
- tree2: Regressions and new node removal model ([#17304](https://github.com/microsoft/FluidFramework/issues/17304)) [935bae84a5](https://github.com/microsoft/FluidFramework/commits/935bae84a513c7184025784e485ad64d23514f92)
|
|
1832
1964
|
|
|
1833
|
-
|
|
1965
|
+
Regression 1: All changes are atomized by the `visitDelta` function. This means that, if you insert/remove/move 2 contiguous nodes, the `visitDelta` function will call the `DeltaVisitor` twice (once for each node) instead of once for both nodes. Anything that sits downstream from the `DeltaVisitor` will therefore also see those changes as atomized.
|
|
1834
1966
|
|
|
1835
|
-
|
|
1967
|
+
Regression 2: The forest never forgets removed content so the memory will grow unbounded.
|
|
1836
1968
|
|
|
1837
|
-
|
|
1969
|
+
Removed nodes are preserved as detached in the forest instead of deleted. Anchors to removed nodes remain valid.
|
|
1838
1970
|
|
|
1839
|
-
|
|
1971
|
+
Change notification for node replacement in optional and required fields are now atomic.
|
|
1840
1972
|
|
|
1841
|
-
|
|
1973
|
+
Updated `PathVisitor` API.
|
|
1842
1974
|
|
|
1843
|
-
|
|
1975
|
+
Forest and AnchorSet are now updated in lockstep.
|
|
1844
1976
|
|
|
1845
1977
|
### Minor Changes
|
|
1846
1978
|
|
|
1847
|
-
-
|
|
1979
|
+
- tree2: Allow ImplicitFieldSchema for non-recursive schema building ([#17683](https://github.com/microsoft/FluidFramework/issues/17683)) [c11e1ce593](https://github.com/microsoft/FluidFramework/commits/c11e1ce59310c820117d06e4065bf42bed6b823d)
|
|
1848
1980
|
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1981
|
+
SchemaBuilder now accepts `ImplicitFieldSchema` in many places which used to require `FieldSchema`.
|
|
1982
|
+
This allows `Required` fields to be implicitly specified from just their AllowedTypes.
|
|
1983
|
+
Additionally in these cases the AllowedTypes can be implicitly specified from a single `Any` or `TreeSchema`.
|
|
1852
1984
|
|
|
1853
|
-
-
|
|
1985
|
+
- Remove SchemaBuilder.leaf ([#17773](https://github.com/microsoft/FluidFramework/issues/17773)) [674565130f](https://github.com/microsoft/FluidFramework/commits/674565130ffdcf8d23dae858273b303d123587c4)
|
|
1854
1986
|
|
|
1855
|
-
|
|
1987
|
+
Custom schema should use the predefined leaf domain, or wrap its leaf types instead of defining new leaf schema.
|
|
1856
1988
|
|
|
1857
|
-
-
|
|
1989
|
+
- tree2: Forest summaries now include detached fields ([#17391](https://github.com/microsoft/FluidFramework/issues/17391)) [5b6bc74ca8](https://github.com/microsoft/FluidFramework/commits/5b6bc74ca85470783c6f48c061385f128f4fc6f9)
|
|
1858
1990
|
|
|
1859
|
-
|
|
1991
|
+
Forest summaries now include detached fields. This breaks existing documents.
|
|
1860
1992
|
|
|
1861
|
-
-
|
|
1993
|
+
- tree2: Rename "Value" Multiplicity and FieldKind ([#17622](https://github.com/microsoft/FluidFramework/issues/17622)) [bb68aeb30c](https://github.com/microsoft/FluidFramework/commits/bb68aeb30cfb3d4e0e82f04f1771ad4cb69e23af)
|
|
1862
1994
|
|
|
1863
|
-
|
|
1995
|
+
`Multiplicity.Value` has been renamed to `Multiplicity.Single` and `FieldKinds.value` has been renamed to `FieldKinds.required`.
|
|
1864
1996
|
|
|
1865
|
-
-
|
|
1997
|
+
- tree2: SharedTreeFactory type changed ([#17588](https://github.com/microsoft/FluidFramework/issues/17588)) [7ebe2b7a79](https://github.com/microsoft/FluidFramework/commits/7ebe2b7a7962e4b9a87c305cc48ffc00b1e57583)
|
|
1866
1998
|
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1999
|
+
The 'type' field for @fluid-experimental/tree2's exported `IChannelFactory`s has been changed to not overlap with @fluid-experimental/tree's channel type.
|
|
2000
|
+
This breaks existing tree2 documents: upon loading them, an error with message "Channel Factory SharedTree not registered" will be thrown.
|
|
2001
|
+
If using the typed-tree API, the message will instead be "Channel Factory SharedTree:<subtype> not registered" where <subtype> is the subtype used by
|
|
2002
|
+
the application when constructing their `TypedTreeFactory`.
|
|
1871
2003
|
|
|
1872
|
-
|
|
2004
|
+
Applications which want to support such documents could add an explicit registry entry to their `ISharedObjectRegistry` which maps the type shown in the error message to a factory producing @fluid-experimental/tree2.
|
|
1873
2005
|
|
|
1874
2006
|
## 2.0.0-internal.7.0.0
|
|
1875
2007
|
|
|
1876
2008
|
### Major Changes
|
|
1877
2009
|
|
|
1878
|
-
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2010
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
2011
|
+
|
|
2012
|
+
This included the following changes from the protocol-definitions release:
|
|
2013
|
+
|
|
2014
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
2015
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
2016
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
2017
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
2018
|
+
ISignalMessageBase interface that contains common members.
|
|
2019
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
2020
|
+
|
|
2021
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
2022
|
+
|
|
2023
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
2024
|
+
|
|
2025
|
+
- @fluidframework/gitresources: 2.0.1
|
|
2026
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
2027
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
2028
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
2029
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
2030
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
2031
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
2032
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
2033
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
2034
|
+
- @fluidframework/server-services: 2.0.1
|
|
2035
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
2036
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
2037
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
2038
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
2039
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
2040
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
2041
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
2042
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
2043
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
2044
|
+
- tinylicious: 2.0.1
|
|
2045
|
+
|
|
2046
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
2047
|
+
|
|
2048
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
1917
2049
|
|
|
1918
2050
|
## 2.0.0-internal.6.4.0
|
|
1919
2051
|
|
|
1920
2052
|
### Minor Changes
|
|
1921
2053
|
|
|
1922
|
-
-
|
|
2054
|
+
- tree2: Replace ValueSchema.Serializable with FluidHandle ([#17306](https://github.com/microsoft/FluidFramework/issues/17306)) [99b1f7192e](https://github.com/microsoft/FluidFramework/commits/99b1f7192ec9fed19e2a76d9251c3fd123ae90e0)
|
|
1923
2055
|
|
|
1924
|
-
|
|
2056
|
+
Replace ValueSchema.Serializable with FluidHandle, removing support for arbitrary objects as tree values and preventing "any" type from Serializable from infecting TreeValue.
|
|
1925
2057
|
|
|
1926
|
-
-
|
|
2058
|
+
- tree2: Restrict struct field names to avoid collisions with schema2 names ([#17089](https://github.com/microsoft/FluidFramework/issues/17089)) [8f8294188f](https://github.com/microsoft/FluidFramework/commits/8f8294188f554e6cc708d6cbbde4ea1dd2e52728)
|
|
1927
2059
|
|
|
1928
|
-
|
|
2060
|
+
Struct field names are now restricted to avoid collisions with schema2 names.
|
|
1929
2061
|
|
|
1930
2062
|
## 2.0.0-internal.6.3.0
|
|
1931
2063
|
|
|
1932
2064
|
### Minor Changes
|
|
1933
2065
|
|
|
1934
|
-
-
|
|
2066
|
+
- Decouple Forest and Schema. ([#17139](https://github.com/microsoft/FluidFramework/issues/17139)) [c6b69f5c19](https://github.com/microsoft/FluidFramework/commits/c6b69f5c1957ceda7bebe6a31a570b49505e298b)
|
|
1935
2067
|
|
|
1936
|
-
|
|
2068
|
+
Forest no longer exports the schema, nor invalidates when schema changes.
|
|
1937
2069
|
|
|
1938
2070
|
## 2.0.0-internal.6.2.0
|
|
1939
2071
|
|
|
1940
2072
|
### Minor Changes
|
|
1941
2073
|
|
|
1942
|
-
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
2074
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
2075
|
+
|
|
2076
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
2077
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
2078
|
+
|
|
2079
|
+
- interface IDisposable
|
|
2080
|
+
- interface IErrorEvent
|
|
2081
|
+
- interface IErrorEvent
|
|
2082
|
+
- interface IEvent
|
|
2083
|
+
- interface IEventProvider
|
|
2084
|
+
- interface ILoggingError
|
|
2085
|
+
- interface ITaggedTelemetryPropertyType
|
|
2086
|
+
- interface ITelemetryBaseEvent
|
|
2087
|
+
- interface ITelemetryBaseLogger
|
|
2088
|
+
- interface ITelemetryErrorEvent
|
|
2089
|
+
- interface ITelemetryGenericEvent
|
|
2090
|
+
- interface ITelemetryLogger
|
|
2091
|
+
- interface ITelemetryPerformanceEvent
|
|
2092
|
+
- interface ITelemetryProperties
|
|
2093
|
+
- type ExtendEventProvider
|
|
2094
|
+
- type IEventThisPlaceHolder
|
|
2095
|
+
- type IEventTransformer
|
|
2096
|
+
- type ReplaceIEventThisPlaceHolder
|
|
2097
|
+
- type ReplaceIEventThisPlaceHolder
|
|
2098
|
+
- type TelemetryEventCategory
|
|
2099
|
+
- type TelemetryEventPropertyType
|
|
1968
2100
|
|
|
1969
2101
|
## 2.0.0-internal.6.1.0
|
|
1970
2102
|
|
|
@@ -1974,32 +2106,32 @@ Dependency updates only.
|
|
|
1974
2106
|
|
|
1975
2107
|
### Major Changes
|
|
1976
2108
|
|
|
1977
|
-
-
|
|
2109
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
1978
2110
|
|
|
1979
|
-
|
|
2111
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
1980
2112
|
|
|
1981
2113
|
## 2.0.0-internal.5.4.0
|
|
1982
2114
|
|
|
1983
2115
|
### Minor Changes
|
|
1984
2116
|
|
|
1985
|
-
-
|
|
2117
|
+
- Remove support for Global Fields ([#16546](https://github.com/microsoft/FluidFramework/issues/16546)) [cade66e2fd](https://github.com/microsoft/FluidFramework/commits/cade66e2fd55e92109e337ad1801e8751000c2bf)
|
|
1986
2118
|
|
|
1987
|
-
|
|
2119
|
+
Support for Global fields has been removed.
|
|
1988
2120
|
|
|
1989
|
-
-
|
|
2121
|
+
- Old SchemaBuilder APIs removed ([#16373](https://github.com/microsoft/FluidFramework/issues/16373)) [38bcf98635](https://github.com/microsoft/FluidFramework/commits/38bcf98635f35c4e0994798e18ae62389da2a773)
|
|
1990
2122
|
|
|
1991
|
-
|
|
2123
|
+
Remove old SchemaBuilder APIs in favor of Schema2 design.
|
|
1992
2124
|
|
|
1993
2125
|
## 2.0.0-internal.5.3.0
|
|
1994
2126
|
|
|
1995
2127
|
### Minor Changes
|
|
1996
2128
|
|
|
1997
|
-
-
|
|
2129
|
+
- Move closeAndGetPendingLocalState to IContainerExperimental ([#16302](https://github.com/microsoft/FluidFramework/issues/16302)) [93151af787](https://github.com/microsoft/FluidFramework/commits/93151af787b76e547cf3460df47f81832131db8c)
|
|
1998
2130
|
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2131
|
+
This change deprecates the experimental method closeAndGetPendingLocalState on IContainer and moves it to IContainerExperimental.
|
|
2132
|
+
IContainerExperimental is an interface that is easily casted to, which enables partners to access experimental features for testing and evaluation.
|
|
2133
|
+
Moving the experimental method off IContainer will reduce exposure and churn on that production interface as we iterate on and finalize our experimental features.
|
|
2134
|
+
Experimental features should not be used in production environments.
|
|
2003
2135
|
|
|
2004
2136
|
## 2.0.0-internal.5.2.0
|
|
2005
2137
|
|
|
@@ -2021,33 +2153,33 @@ Dependency updates only.
|
|
|
2021
2153
|
|
|
2022
2154
|
### Major Changes
|
|
2023
2155
|
|
|
2024
|
-
-
|
|
2156
|
+
- Renamed from `@fluid-internal/tree` to `@fluid-experimental/tree2` so that this package will be included in releases for experimental use.
|
|
2025
2157
|
|
|
2026
2158
|
### Minor Changes
|
|
2027
2159
|
|
|
2028
|
-
-
|
|
2160
|
+
- Op compression is enabled by default ([#14856](https://github.com/microsoft/FluidFramework/pull-requests/14856)) [439c21f31f](https://github.com/microsoft/FluidFramework/commits/439c21f31f4a3ea6515f01d2b2be7f35c04910ce)
|
|
2029
2161
|
|
|
2030
|
-
|
|
2162
|
+
If the size of a batch is larger than 614kb, the ops will be compressed. After upgrading to this version, if batches exceed the size threshold, the runtime will produce a new type of op with the compression properties. To open a document which contains this type of op, the client's runtime version needs to be at least `client_v2.0.0-internal.2.3.0`. Older clients will close with assert `0x3ce` ("Runtime message of unknown type") and will not be able to open the documents until they upgrade. To minimize the risk, it is recommended to audit existing session and ensure that at least 99.9% of them are using a runtime version equal or greater than `client_v2.0.0-internal.2.3.0`, before upgrading to `2.0.0-internal.4.1.0`.
|
|
2031
2163
|
|
|
2032
|
-
|
|
2033
|
-
|
|
2164
|
+
More information about op compression can be found
|
|
2165
|
+
[here](./packages/runtime/container-runtime/src/opLifecycle/README.md).
|
|
2034
2166
|
|
|
2035
|
-
-
|
|
2167
|
+
- @fluidframework/garbage-collector deprecated ([#14750](https://github.com/microsoft/FluidFramework/pull-requests/14750)) [60274eacab](https://github.com/microsoft/FluidFramework/commits/60274eacabf14d42f52f6ad1c2f64356e64ba1a2)
|
|
2036
2168
|
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2169
|
+
The `@fluidframework/garbage-collector` package is deprecated with the following functions, interfaces, and types in it.
|
|
2170
|
+
These are internal implementation details and have been deprecated for public use. They will be removed in an upcoming
|
|
2171
|
+
release.
|
|
2040
2172
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2173
|
+
- `cloneGCData`
|
|
2174
|
+
- `concatGarbageCollectionData`
|
|
2175
|
+
- `concatGarbageCollectionStates`
|
|
2176
|
+
- `GCDataBuilder`
|
|
2177
|
+
- `getGCDataFromSnapshot`
|
|
2178
|
+
- `IGCResult`
|
|
2179
|
+
- `removeRouteFromAllNodes`
|
|
2180
|
+
- `runGarbageCollection`
|
|
2181
|
+
- `trimLeadingAndTrailingSlashes`
|
|
2182
|
+
- `trimLeadingSlashes`
|
|
2183
|
+
- `trimTrailingSlashes`
|
|
2184
|
+
- `unpackChildNodesGCDetails`
|
|
2185
|
+
- `unpackChildNodesUsedRoutes`
|