@fluidframework/tree 2.111.0 → 2.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +145 -0
- package/api-report/tree.alpha.api.md +48 -5
- package/api-report/tree.beta.api.md +1 -1
- package/api-report/tree.legacy.beta.api.md +1 -1
- package/api-report/tree.legacy.public.api.md +1 -1
- package/api-report/tree.public.api.md +1 -1
- package/dist/componentApi.d.ts +198 -0
- package/dist/componentApi.d.ts.map +1 -0
- package/dist/componentApi.js +138 -0
- package/dist/componentApi.js.map +1 -0
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +4 -2
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -16
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +3 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
- package/dist/feature-libraries/schemaChecker.d.ts +22 -3
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +48 -5
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +17 -4
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +11 -5
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +3 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +1 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +6 -3
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/serializedChange.d.ts +41 -0
- package/dist/shared-tree/serializedChange.d.ts.map +1 -0
- package/dist/shared-tree/serializedChange.js +87 -0
- package/dist/shared-tree/serializedChange.js.map +1 -0
- package/dist/shared-tree/sharedTree.d.ts +13 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +2 -0
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts +35 -0
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
- package/dist/shared-tree/transactionMinimize.js +65 -0
- package/dist/shared-tree/transactionMinimize.js.map +1 -0
- package/dist/shared-tree/treeCheckout.d.ts +3 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +36 -62
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +6 -3
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +35 -14
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +1 -1
- package/dist/shared-tree-core/messageFormat.js +1 -1
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageTypes.d.ts +1 -0
- package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/messageTypes.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +24 -11
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +16 -2
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -44
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +1 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +1 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +22 -2
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +2 -2
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +2 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/treeFactory.js +1 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +16 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +9 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/compressedIds.d.ts +69 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +32 -1
- package/dist/util/compressedIds.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +16 -3
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/nestedSet.d.ts +1 -1
- package/dist/util/nestedSet.d.ts.map +1 -1
- package/dist/util/nestedSet.js.map +1 -1
- package/dist/util/utils.d.ts +0 -6
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +1 -15
- package/dist/util/utils.js.map +1 -1
- package/lib/componentApi.d.ts +198 -0
- package/lib/componentApi.d.ts.map +1 -0
- package/lib/componentApi.js +135 -0
- package/lib/componentApi.js.map +1 -0
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -17
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -0
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
- package/lib/feature-libraries/schemaChecker.d.ts +22 -3
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/schemaChecker.js +48 -5
- package/lib/feature-libraries/schemaChecker.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +17 -4
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +9 -3
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -0
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +1 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +7 -4
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/serializedChange.d.ts +41 -0
- package/lib/shared-tree/serializedChange.d.ts.map +1 -0
- package/lib/shared-tree/serializedChange.js +84 -0
- package/lib/shared-tree/serializedChange.js.map +1 -0
- package/lib/shared-tree/sharedTree.d.ts +13 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +2 -0
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts +35 -0
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
- package/lib/shared-tree/transactionMinimize.js +62 -0
- package/lib/shared-tree/transactionMinimize.js.map +1 -0
- package/lib/shared-tree/treeCheckout.d.ts +3 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +18 -44
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +6 -3
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +36 -15
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +1 -1
- package/lib/shared-tree-core/messageFormat.js +1 -1
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageTypes.d.ts +1 -0
- package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/messageTypes.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +25 -12
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +16 -2
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +29 -42
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -3
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +2 -3
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +22 -2
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +2 -2
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/treeFactory.js +1 -1
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +16 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +9 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/compressedIds.d.ts +69 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +30 -0
- package/lib/util/compressedIds.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +17 -4
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/nestedSet.d.ts +1 -1
- package/lib/util/nestedSet.d.ts.map +1 -1
- package/lib/util/nestedSet.js.map +1 -1
- package/lib/util/utils.d.ts +0 -6
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +0 -13
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/componentApi.ts +354 -0
- package/src/entrypoints/alpha.ts +3 -0
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -27
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -44
- package/src/feature-libraries/index.ts +2 -0
- package/src/feature-libraries/modular-schema/index.ts +1 -0
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
- package/src/feature-libraries/schemaChecker.ts +86 -9
- package/src/index.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +35 -5
- package/src/shared-tree/index.ts +3 -0
- package/src/shared-tree/schematizingTreeView.ts +15 -5
- package/src/shared-tree/serializedChange.ts +127 -0
- package/src/shared-tree/sharedTree.ts +16 -0
- package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
- package/src/shared-tree/transactionMinimize.ts +74 -0
- package/src/shared-tree/treeCheckout.ts +42 -57
- package/src/shared-tree-core/editManager.ts +42 -6
- package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
- package/src/shared-tree-core/messageFormat.ts +1 -1
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
- package/src/shared-tree-core/messageTypes.ts +1 -0
- package/src/shared-tree-core/sharedTreeCore.ts +33 -10
- package/src/shared-tree-core/transaction.ts +19 -2
- package/src/simple-tree/api/index.ts +1 -1
- package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
- package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
- package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -3
- package/src/simple-tree/api/storedSchema.ts +2 -3
- package/src/simple-tree/api/tree.ts +24 -2
- package/src/simple-tree/api/typesUnsafe.ts +2 -1
- package/src/simple-tree/index.ts +1 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
- package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
- package/src/treeFactory.ts +1 -1
- package/src/util/breakable.ts +8 -1
- package/src/util/compressedIds.ts +90 -2
- package/src/util/index.ts +3 -1
- package/src/util/nestedMap.ts +21 -4
- package/src/util/nestedSet.ts +1 -1
- package/src/util/utils.ts +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,150 @@
|
|
|
1
1
|
# @fluidframework/tree
|
|
2
2
|
|
|
3
|
+
## 2.112.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add Component utilities for composing open-polymorphic schema ([#27628](https://github.com/microsoft/FluidFramework/pull/27628)) [7a56d096bf](https://github.com/microsoft/FluidFramework/commit/7a56d096bffab133ab4e7ab9c8f9c465b7ba9e81)
|
|
8
|
+
|
|
9
|
+
A new `@alpha` `Component` namespace is now exported from `@fluidframework/tree` (and re-exported from `fluid-framework`). It provides utilities for composing independently authored application "components" that contribute to a shared configuration, which is useful for implementing ["open polymorphism"](<https://en.wikipedia.org/wiki/Polymorphism_(computer_science)>) schema patterns where the set of allowed types for a field or collection can be extended by separate libraries.
|
|
10
|
+
|
|
11
|
+
Each component is expressed as a `Component.Factory`: a function which receives a lazy reference to the composed configuration and returns the content that component contributes. Because the configuration is provided lazily, components may reference (including recursively) types contributed by other components. `Component.compose` combines a set of components into a `Component.Composed`, from which the aggregated configuration and per-component content can be read.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
/** Example application component content type. */
|
|
15
|
+
interface MyAppComponentContent {
|
|
16
|
+
/**
|
|
17
|
+
* Item types contributed by this component.
|
|
18
|
+
* We are just typing them as TreeNodeSchema here to keep things simple.
|
|
19
|
+
* Real use would often provide some static factory to be able to create instances, as well as some APIs all item nodes should implement.
|
|
20
|
+
*/
|
|
21
|
+
readonly items: Component.LazyArray<TreeNodeSchema>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type MyAppComponent = Component.Factory<MyAppComponentContent>;
|
|
25
|
+
|
|
26
|
+
// A simple component, which does not depend on any other context.
|
|
27
|
+
const textComponent: MyAppComponent = () => ({
|
|
28
|
+
items: () => [() => TextItem],
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// A component which creates an item type which recursively depends on all item types.
|
|
32
|
+
const containerComponent: MyAppComponent = (config) => ({
|
|
33
|
+
items: () => [
|
|
34
|
+
() =>
|
|
35
|
+
class extends sf.array("Container", config().getComposed("items")) {},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const appConfig = Component.compose([containerComponent, textComponent]);
|
|
40
|
+
|
|
41
|
+
// The config's items can now be used to create a TreeViewConfiguration, root schema, or whatever else is needed.
|
|
42
|
+
class Root extends sf.object("Root", {
|
|
43
|
+
content: appConfig.getComposed("items"),
|
|
44
|
+
}) {}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
See the worked examples in [openPolymorphism.integration.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/openPolymorphism.integration.ts) for end-to-end usage with SharedTree schema.
|
|
48
|
+
|
|
49
|
+
- Independent tree views now accept an optional telemetry logger ([#27567](https://github.com/microsoft/FluidFramework/pull/27567)) [5fbbcab0af](https://github.com/microsoft/FluidFramework/commit/5fbbcab0aff87519ae6f112611f0c1e62f30d97e)
|
|
50
|
+
|
|
51
|
+
The alpha `independentView`, `independentInitializedView`, and `createIndependentTreeAlpha` APIs now accept an optional `logger` on their options.
|
|
52
|
+
Previously these standalone (non-`SharedTree`) views had no way to surface telemetry,
|
|
53
|
+
so internal events—including those emitted when the tree enters a broken state—were dropped.
|
|
54
|
+
Passing a logger forwards those events to the caller's telemetry pipeline.
|
|
55
|
+
This makes it possible to diagnose failures in scenarios that use independent tree views, such as snapshot import/export, schema migration, and other out-of-container workflows.
|
|
56
|
+
|
|
57
|
+
Events emitted by an independent tree view are tagged with the `independentView` namespace.
|
|
58
|
+
If no logger is provided, behavior is unchanged and telemetry events continue to be dropped.
|
|
59
|
+
|
|
60
|
+
The `logger` option is typed as `ITelemetryBaseLogger` from `@fluidframework/core-interfaces`,
|
|
61
|
+
so any standard Fluid telemetry logger can be passed directly.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// ...
|
|
65
|
+
const view = independentView(
|
|
66
|
+
new TreeViewConfiguration({ schema: MySchema }),
|
|
67
|
+
{
|
|
68
|
+
logger: myTelemetryLogger,
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
// ...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- Shared branch names ([#27708](https://github.com/microsoft/FluidFramework/pull/27708)) [1f08b9210b](https://github.com/microsoft/FluidFramework/commit/1f08b9210bf7ba3adbc98c45b02ab8a6a58929f5)
|
|
75
|
+
|
|
76
|
+
The existing [`createSharedBranch`](https://fluidframework.com/docs/api/tree/itreealpha-interface#createsharedbranch-methodsignature) alpha API now takes an optional `name` string parameter that is associated with the shared branch.
|
|
77
|
+
This name can be retrieved by passing the shared branch ID to `getSharedBranchName`.
|
|
78
|
+
|
|
79
|
+
Note that, unlike the shared branch IDs, shared branch names are not guaranteed to be unique.
|
|
80
|
+
|
|
81
|
+
#### Compatibility Implications
|
|
82
|
+
|
|
83
|
+
This change breaks compatibility in the following ways:
|
|
84
|
+
- A document written by a client running an earlier FF version cannot be opened by a client running this version.
|
|
85
|
+
- A document written by a client running this version cannot be opened by a client running an earlier FF version.
|
|
86
|
+
- Clients running earlier FF versions will crash upon receiving ops from clients running this version.
|
|
87
|
+
- Clients running this version will crash upon receiving ops from clients running earlier FF versions.
|
|
88
|
+
|
|
89
|
+
These breaks are only applicable for clients with `enableSharedBranches` turned on. Other clients are unaffected.
|
|
90
|
+
|
|
91
|
+
- Add at, pop, shift, unshift, findLast, and findLastIndex methods to TreeArrayNodeAlpha ([#27686](https://github.com/microsoft/FluidFramework/pull/27686)) [59669008b9](https://github.com/microsoft/FluidFramework/commit/59669008b9f9f70ccb94030a6382afcdf8f28cd4)
|
|
92
|
+
|
|
93
|
+
`TreeArrayNodeAlpha` now has `at`, `pop`, `shift`, `unshift`, `findLast`, and `findLastIndex` methods, further aligning it with JavaScript's built-in Array API:
|
|
94
|
+
- `at(index)` `at` was already implemented at runtime, and consumers compiling with `lib: ES2022` or later could already see it through the inherited `ReadonlyArray` typings. This change adds no new runtime behavior, but makes `at` an explicitly declared, documented part of the API, independent of the consumer's TypeScript `lib` configuration.
|
|
95
|
+
- `unshift(...items)` is an alias for `insertAtStart`, mirroring how `push` aliases `insertAtEnd`: it inserts new item(s) at the start of the array. Unlike `Array.prototype.unshift`, it does not return the new length of the array.
|
|
96
|
+
- `pop()` removes and returns the last item in the array, or returns `undefined` (without modifying the array) if it is empty.
|
|
97
|
+
- `shift()` removes and returns the first item in the array, or returns `undefined` (without modifying the array) if it is empty.
|
|
98
|
+
- `findLast(predicate, thisArg?)` and `findLastIndex(predicate, thisArg?)` search the array from the last item to the first, returning the last matching item (or `undefined`) and its index (or `-1`) respectively, like their `Array.prototype` equivalents. As with `Array.prototype.findLast`, passing a type guard as the `findLast` predicate narrows the returned item's type.
|
|
99
|
+
|
|
100
|
+
These methods are available on `TreeArrayNodeAlpha`, which can be obtained from an existing `TreeArrayNode` via `asAlpha`, or by declaring the schema with `SchemaFactoryAlpha`'s `arrayAlpha`.
|
|
101
|
+
|
|
102
|
+
#### Usage
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import { SchemaFactory, asAlpha } from "@fluidframework/tree/alpha";
|
|
106
|
+
|
|
107
|
+
const sf = new SchemaFactory("example");
|
|
108
|
+
const Inventory = sf.array("Inventory", sf.string);
|
|
109
|
+
const inventory = asAlpha(new Inventory(["Apples", "Bananas", "Pears"]));
|
|
110
|
+
|
|
111
|
+
// inventory: ["Apples", "Bananas", "Pears"]
|
|
112
|
+
inventory.unshift("Oranges", "Grapes");
|
|
113
|
+
// inventory: ["Oranges", "Grapes", "Apples", "Bananas", "Pears"]
|
|
114
|
+
|
|
115
|
+
inventory.at(0); // "Oranges"
|
|
116
|
+
inventory.at(-1); // "Pears"
|
|
117
|
+
inventory.at(10); // undefined
|
|
118
|
+
|
|
119
|
+
inventory.findLast((item) => item.startsWith("G")); // "Grapes"
|
|
120
|
+
inventory.findLastIndex((item) => item.startsWith("G")); // 1
|
|
121
|
+
|
|
122
|
+
// inventory: ["Oranges", "Grapes", "Apples", "Bananas", "Pears"]
|
|
123
|
+
inventory.pop(); // "Pears"
|
|
124
|
+
// inventory ["Oranges", "Grapes", "Apples", "Bananas"]
|
|
125
|
+
|
|
126
|
+
inventory.shift(); // "Oranges"
|
|
127
|
+
// inventory: ["Grapes", "Apples", "Bananas"]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- Retain history option ([#27696](https://github.com/microsoft/FluidFramework/pull/27696)) [2fa44c6ed2](https://github.com/microsoft/FluidFramework/commit/2fa44c6ed222a8ed88a632a0bf3cad0c26e72514)
|
|
131
|
+
|
|
132
|
+
Adds a new `retainHistory` flag to [`SharedTreeOptions`](https://fluidframework.com/docs/api/tree/sharedtreeoptions-interface) (defaults to `false`).
|
|
133
|
+
Setting `retainHistory` to `true` will prevent SharedTree from garbage-collecting historical data about old changes.
|
|
134
|
+
Note that this will cause unbounded growth both in memory on the client and in summaries/snapshots (the at-rest data representing a Fluid document).
|
|
135
|
+
For these reasons, this option is only intended for debugging and experimentation.
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- Fix insertable types when using typesRecursive with multiple allowed types ([#27698](https://github.com/microsoft/FluidFramework/pull/27698)) [b72f836d09](https://github.com/microsoft/FluidFramework/commit/b72f836d09437654e0ef5787625073f9da41cf9f)
|
|
140
|
+
|
|
141
|
+
The allowed types produced by `SchemaFactoryBeta.typesRecursive` (and `SchemaFactoryAlpha.typesRecursive`) are now processed correctly when used in a recursive schema that permits more than one type.
|
|
142
|
+
|
|
143
|
+
Previously, passing their output to a recursive schema (for example `factory.arrayRecursive` or `factory.mapRecursive`) computed the node's insertable content type as `never`.
|
|
144
|
+
This caused valid insertions to fail to compile.
|
|
145
|
+
Recursive schemas built from a `typesRecursive` list with two or more types now accept insertable content for each of the allowed types as expected.
|
|
146
|
+
Recursive schemas that use a single type were unaffected.
|
|
147
|
+
|
|
3
148
|
## 2.111.0
|
|
4
149
|
|
|
5
150
|
### Minor Changes
|
|
@@ -218,6 +218,31 @@ export interface CommitMetadata {
|
|
|
218
218
|
// @alpha
|
|
219
219
|
export function comparePersistedSchema(persisted: JsonCompatible, view: ImplicitFieldSchema, options: ICodecOptions): Omit<SchemaCompatibilityStatus, "canInitialize">;
|
|
220
220
|
|
|
221
|
+
// @alpha
|
|
222
|
+
export namespace Component {
|
|
223
|
+
export function compose<TComponent>(allComponents: readonly Factory<TComponent>[]): Composed<TComponent>;
|
|
224
|
+
export function compose<TComponent, TConfig>(allComponents: readonly Factory<TComponent, TConfig>[], lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig): Composed<TComponent, TConfig>;
|
|
225
|
+
const memoize: <T>(factory: () => T) => (() => T);
|
|
226
|
+
// @sealed
|
|
227
|
+
export interface Composed<TComponent, TConfig = ComposedDefault<TComponent>> {
|
|
228
|
+
readonly components: readonly TComponent[];
|
|
229
|
+
readonly config: TConfig;
|
|
230
|
+
getComponent<TFactory extends Factory<TComponent, TConfig>>(factory: TFactory): ReturnType<TFactory>;
|
|
231
|
+
getComposed<TKey extends keyof {
|
|
232
|
+
[Property in keyof TComponent as TComponent[Property] extends LazyArray<unknown> | undefined ? Property : never]: boolean;
|
|
233
|
+
}>(property: TKey): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U> ? () => U : never)[];
|
|
234
|
+
getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(configurable: TConfigurable): ReturnType<TConfigurable["configure"]>;
|
|
235
|
+
}
|
|
236
|
+
// @sealed
|
|
237
|
+
export type ComposedDefault<TComponent> = Composed<TComponent, ComposedDefault<TComponent>>;
|
|
238
|
+
export interface Configurable<TConfigPartial, out TResult, TComponent> {
|
|
239
|
+
configure(config: TConfigPartial, components: Composed<TComponent, TConfigPartial>): TResult;
|
|
240
|
+
}
|
|
241
|
+
// @input
|
|
242
|
+
export type Factory<TComponent, TConfig = ComposedDefault<TComponent>> = (lazyConfiguration: () => TConfig) => TComponent;
|
|
243
|
+
export type LazyArray<T> = () => readonly (() => T)[];
|
|
244
|
+
}
|
|
245
|
+
|
|
221
246
|
// @beta
|
|
222
247
|
export type ConciseTree<THandle = IFluidHandle> = Exclude<TreeLeafValue, IFluidHandle> | THandle | ConciseTree<THandle>[] | {
|
|
223
248
|
[key: string]: ConciseTree<THandle>;
|
|
@@ -242,7 +267,7 @@ export function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(view:
|
|
|
242
267
|
export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSchema>(options?: CreateIndependentTreeAlphaOptions): ViewableTree & Pick<ITreeAlpha, "exportVerbose" | "exportSimpleSchema">;
|
|
243
268
|
|
|
244
269
|
// @alpha
|
|
245
|
-
export type CreateIndependentTreeAlphaOptions = ForestOptions & ((IndependentViewOptions & {
|
|
270
|
+
export type CreateIndependentTreeAlphaOptions = ForestOptions & IndependentViewTelemetryOptions & ((IndependentViewOptions & {
|
|
246
271
|
content?: never;
|
|
247
272
|
}) | (ICodecOptions & {
|
|
248
273
|
content: ViewContent;
|
|
@@ -538,16 +563,21 @@ export function incrementalEncodingPolicyForAllowedTypes(rootSchema: TreeSchema)
|
|
|
538
563
|
export const incrementalSummaryHint: unique symbol;
|
|
539
564
|
|
|
540
565
|
// @alpha
|
|
541
|
-
export function independentInitializedView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & ICodecOptions, content: ViewContent): TreeViewAlpha<TSchema>;
|
|
566
|
+
export function independentInitializedView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & ICodecOptions & IndependentViewTelemetryOptions, content: ViewContent): TreeViewAlpha<TSchema>;
|
|
542
567
|
|
|
543
568
|
// @alpha
|
|
544
569
|
export function independentView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options?: IndependentViewOptions): TreeViewAlpha<TSchema>;
|
|
545
570
|
|
|
546
571
|
// @alpha @input
|
|
547
|
-
export interface IndependentViewOptions extends ForestOptions, Partial<CodecWriteOptions
|
|
572
|
+
export interface IndependentViewOptions extends ForestOptions, Partial<CodecWriteOptions>, IndependentViewTelemetryOptions {
|
|
548
573
|
idCompressor?: IIdCompressor | undefined;
|
|
549
574
|
}
|
|
550
575
|
|
|
576
|
+
// @alpha @input
|
|
577
|
+
export interface IndependentViewTelemetryOptions {
|
|
578
|
+
readonly logger?: ITelemetryBaseLogger | undefined;
|
|
579
|
+
}
|
|
580
|
+
|
|
551
581
|
// @public @system
|
|
552
582
|
type _InlineTrick = 0;
|
|
553
583
|
|
|
@@ -648,10 +678,11 @@ export interface ITree extends ViewableTree, IFluidLoadable {
|
|
|
648
678
|
|
|
649
679
|
// @alpha @sealed
|
|
650
680
|
export interface ITreeAlpha extends ITree {
|
|
651
|
-
createSharedBranch(): string;
|
|
681
|
+
createSharedBranch(name?: string): string;
|
|
652
682
|
exportSimpleSchema(): SimpleTreeSchema;
|
|
653
683
|
exportVerbose(): VerboseTree | undefined;
|
|
654
684
|
getSharedBranchIds(): string[];
|
|
685
|
+
getSharedBranchName(branchId: string): string | undefined;
|
|
655
686
|
viewSharedBranchWith<TRoot extends ImplicitFieldSchema>(branchId: string, config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
|
|
656
687
|
}
|
|
657
688
|
|
|
@@ -844,6 +875,9 @@ export const MapNodeSchema: {
|
|
|
844
875
|
readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is MapNodeSchema;
|
|
845
876
|
};
|
|
846
877
|
|
|
878
|
+
// @alpha @deprecated
|
|
879
|
+
export const minimize: TransactionPostProcessor;
|
|
880
|
+
|
|
847
881
|
// @alpha
|
|
848
882
|
export interface NoChangeConstraint {
|
|
849
883
|
// (undocumented)
|
|
@@ -1248,6 +1282,7 @@ export interface SharedTreeFormatOptions {
|
|
|
1248
1282
|
// @alpha @input
|
|
1249
1283
|
export interface SharedTreeOptions extends SharedTreeOptionsBeta, Partial<CodecWriteOptions>, Partial<SharedTreeFormatOptions> {
|
|
1250
1284
|
readonly enableSharedBranches?: boolean;
|
|
1285
|
+
readonly retainHistory?: boolean;
|
|
1251
1286
|
shouldEncodeIncrementally?: IncrementalEncodingPolicy;
|
|
1252
1287
|
}
|
|
1253
1288
|
|
|
@@ -1454,7 +1489,7 @@ export namespace System_Unsafe {
|
|
|
1454
1489
|
// @system
|
|
1455
1490
|
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = IsUnion<TList> extends true ? never : {
|
|
1456
1491
|
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchemaUnsafe> ? InsertableTypedNodeUnsafe<TSchema> : never;
|
|
1457
|
-
}[
|
|
1492
|
+
}[NumberKeys<TList>];
|
|
1458
1493
|
// @system
|
|
1459
1494
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
1460
1495
|
// @system
|
|
@@ -1749,7 +1784,14 @@ export const TreeArrayNode: {
|
|
|
1749
1784
|
|
|
1750
1785
|
// @alpha @sealed
|
|
1751
1786
|
export interface TreeArrayNodeAlpha<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes, out T = [TAllowedTypes] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TAllowedTypes> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, in TNew = [TAllowedTypes] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes> : InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>> extends TreeArrayNode<TAllowedTypes, T, TNew> {
|
|
1787
|
+
at(index: number): T | undefined;
|
|
1788
|
+
findLast<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: unknown): S | undefined;
|
|
1789
|
+
findLast(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: unknown): T | undefined;
|
|
1790
|
+
findLastIndex(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: unknown): number;
|
|
1791
|
+
pop(): T | undefined;
|
|
1792
|
+
shift(): T | undefined;
|
|
1752
1793
|
splice(start: number, deleteCount?: number, ...items: readonly (TNew | IterableTreeArrayContent<TNew>)[]): T[];
|
|
1794
|
+
unshift(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
1753
1795
|
}
|
|
1754
1796
|
|
|
1755
1797
|
// @beta @sealed
|
|
@@ -1776,6 +1818,7 @@ export interface TreeBranch extends IDisposable {
|
|
|
1776
1818
|
// @alpha @sealed
|
|
1777
1819
|
export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
1778
1820
|
applyChange(change: JsonCompatibleReadOnly): void;
|
|
1821
|
+
computeNetChangeIfRebasedOnto(branch: TreeBranch): JsonCompatibleReadOnly | undefined;
|
|
1779
1822
|
readonly events: Listenable_2<TreeBranchEvents>;
|
|
1780
1823
|
// (undocumented)
|
|
1781
1824
|
fork(): TreeBranchAlpha;
|
|
@@ -737,7 +737,7 @@ export namespace System_Unsafe {
|
|
|
737
737
|
// @system
|
|
738
738
|
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = IsUnion<TList> extends true ? never : {
|
|
739
739
|
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchemaUnsafe> ? InsertableTypedNodeUnsafe<TSchema> : never;
|
|
740
|
-
}[
|
|
740
|
+
}[NumberKeys<TList>];
|
|
741
741
|
// @system
|
|
742
742
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
743
743
|
// @system
|
|
@@ -749,7 +749,7 @@ export namespace System_Unsafe {
|
|
|
749
749
|
// @system
|
|
750
750
|
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = IsUnion<TList> extends true ? never : {
|
|
751
751
|
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchemaUnsafe> ? InsertableTypedNodeUnsafe<TSchema> : never;
|
|
752
|
-
}[
|
|
752
|
+
}[NumberKeys<TList>];
|
|
753
753
|
// @system
|
|
754
754
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
755
755
|
// @system
|
|
@@ -391,7 +391,7 @@ export namespace System_Unsafe {
|
|
|
391
391
|
// @system
|
|
392
392
|
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = IsUnion<TList> extends true ? never : {
|
|
393
393
|
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchemaUnsafe> ? InsertableTypedNodeUnsafe<TSchema> : never;
|
|
394
|
-
}[
|
|
394
|
+
}[NumberKeys<TList>];
|
|
395
395
|
// @system
|
|
396
396
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
397
397
|
// @system
|
|
@@ -391,7 +391,7 @@ export namespace System_Unsafe {
|
|
|
391
391
|
// @system
|
|
392
392
|
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = IsUnion<TList> extends true ? never : {
|
|
393
393
|
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchemaUnsafe> ? InsertableTypedNodeUnsafe<TSchema> : never;
|
|
394
|
-
}[
|
|
394
|
+
}[NumberKeys<TList>];
|
|
395
395
|
// @system
|
|
396
396
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
397
397
|
// @system
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Utilities for composing application "components" which contribute to a shared configuration.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Nothing in this namespace is specific to tree schema,
|
|
10
|
+
* however it is designed to be able to handle the needs of components which work with {@link TreeSchema}.
|
|
11
|
+
*
|
|
12
|
+
* This is mainly used to implement "open polymorphism", where the set of allowed types
|
|
13
|
+
* for a field or collection can be extended by independently authored libraries (components) instead of being
|
|
14
|
+
* fixed up front.
|
|
15
|
+
*
|
|
16
|
+
* This basically amounts to dependency injection, where the "injection" is done at "composition" time to build the schema.
|
|
17
|
+
*
|
|
18
|
+
* Tree's schema do not natively support open polymorphism: all possible implementations must be explicitly listed.
|
|
19
|
+
* These tools work around these limitations by carefully controlling evaluation order:
|
|
20
|
+
* the source code can be structured in an open polymorphism style which at runtime evaluates into closed polymorphism
|
|
21
|
+
* by having each component register its implementations into a central collection (typically an
|
|
22
|
+
* {@link AllowedTypes} array).
|
|
23
|
+
*
|
|
24
|
+
* Each component is expressed as a {@link Component.Factory}: a function which receives a lazy reference to the
|
|
25
|
+
* composed configuration and returns the content that component contributes.
|
|
26
|
+
* Because the configuration is provided lazily, components may reference (including recursively) types contributed by
|
|
27
|
+
* other components, as long as nothing evaluates the lazy references until composition has completed.
|
|
28
|
+
* Use {@link Component.(compose:1)} to combine a set of components into a {@link Component.Composed}.
|
|
29
|
+
*
|
|
30
|
+
* See {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/openPolymorphism.integration.ts|openPolymorphism.integration.ts} for worked examples of this pattern.
|
|
31
|
+
*
|
|
32
|
+
* @privateRemarks
|
|
33
|
+
* The examples and integration tests for this pattern live in `openPolymorphism.integration.ts`.
|
|
34
|
+
* Those tests and the docs here should be kept in sync.
|
|
35
|
+
*
|
|
36
|
+
* @alpha
|
|
37
|
+
*/
|
|
38
|
+
export declare namespace Component {
|
|
39
|
+
/**
|
|
40
|
+
* A function which takes in a lazy configuration and returns the content a component contributes.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* The lazy configuration allows the component to reference items from the composed configuration, which can
|
|
44
|
+
* include items the component itself contributes (allowing recursive references between components).
|
|
45
|
+
*
|
|
46
|
+
* The execution of the factory must not evaluate `lazyConfiguration` (doing so will error):
|
|
47
|
+
* instead the returned `TComponent` can capture `lazyConfiguration` and evaluate it at a later time
|
|
48
|
+
* (after all components have been composed).
|
|
49
|
+
*
|
|
50
|
+
* @typeParam TComponent - The content a component contributes.
|
|
51
|
+
* @typeParam TConfig - The composed configuration type made available to components.
|
|
52
|
+
* Defaults to the {@link Component.Composed} produced by composition: the common case where
|
|
53
|
+
* components read composed content directly from the composition and no custom configuration type is needed.
|
|
54
|
+
*
|
|
55
|
+
* @input
|
|
56
|
+
* @alpha
|
|
57
|
+
*/
|
|
58
|
+
type Factory<TComponent, TConfig = ComposedDefault<TComponent>> = (lazyConfiguration: () => TConfig) => TComponent;
|
|
59
|
+
/**
|
|
60
|
+
* A function which returns an array of lazy values which each evaluate to `T`.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* This mirrors the shape of {@link AllowedTypes} where all of the values are lazy:
|
|
64
|
+
* the outer function and inner functions defer evaluation until after composition is complete.
|
|
65
|
+
*
|
|
66
|
+
* @typeParam T - The type each lazy value evaluates to.
|
|
67
|
+
*
|
|
68
|
+
* @alpha
|
|
69
|
+
*/
|
|
70
|
+
type LazyArray<T> = () => readonly (() => T)[];
|
|
71
|
+
/**
|
|
72
|
+
* Wrap a 0 argument function to cache the result.
|
|
73
|
+
* @remarks
|
|
74
|
+
* Do not use for impure functions.
|
|
75
|
+
*
|
|
76
|
+
* Generally {@link Component} utilities have built in caching in most cases,
|
|
77
|
+
* but this is occasionally helpful when manually implementing laziness.
|
|
78
|
+
*
|
|
79
|
+
* Note that this takes a different approach than use in {@link evaluateLazySchema} where the function evaluation is done using a utility that adds caching.
|
|
80
|
+
*
|
|
81
|
+
* @param factory - The factory function to memoize.
|
|
82
|
+
* @returns A function that returns the cached result of the factory.
|
|
83
|
+
* @alpha
|
|
84
|
+
*/
|
|
85
|
+
const memoize: <T>(factory: () => T) => (() => T);
|
|
86
|
+
/**
|
|
87
|
+
* An item which can be configured (evaluated) against a composed configuration to produce a result.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* Use {@link Component.Composed.getConfigured} to evaluate a `Configurable`.
|
|
91
|
+
* The result is cached, so a given `Configurable` is only evaluated once per composition.
|
|
92
|
+
*
|
|
93
|
+
* @typeParam TConfigPartial - The configuration type made available when configuring.
|
|
94
|
+
* @typeParam TResult - The result produced by configuring.
|
|
95
|
+
* @typeParam TComponent - The content components contribute.
|
|
96
|
+
*
|
|
97
|
+
* @alpha
|
|
98
|
+
*/
|
|
99
|
+
interface Configurable<TConfigPartial, out TResult, TComponent> {
|
|
100
|
+
/**
|
|
101
|
+
* Produce the configured result.
|
|
102
|
+
* @param config - The composed configuration.
|
|
103
|
+
* @param components - The composed components.
|
|
104
|
+
*/
|
|
105
|
+
configure(config: TConfigPartial, components: Composed<TComponent, TConfigPartial>): TResult;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* The {@link Component.Composed} itself is used as the configuration made available to components:
|
|
112
|
+
* the simple case where components read composed content directly from the composition.
|
|
113
|
+
* To produce a custom aggregated configuration, use the overload which takes a `lazyConfiguration` builder.
|
|
114
|
+
*
|
|
115
|
+
* @param allComponents - The components to compose.
|
|
116
|
+
* @returns The composed components, from which configuration and per-component content can be read.
|
|
117
|
+
*
|
|
118
|
+
* @typeParam TComponent - The content each component contributes.
|
|
119
|
+
*
|
|
120
|
+
* @alpha
|
|
121
|
+
*/
|
|
122
|
+
function compose<TComponent>(allComponents: readonly Factory<TComponent>[]): Composed<TComponent>;
|
|
123
|
+
/**
|
|
124
|
+
* Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.
|
|
125
|
+
*
|
|
126
|
+
* @param allComponents - The components to compose.
|
|
127
|
+
* @param lazyConfiguration - Builds the composed configuration from the composed components.
|
|
128
|
+
* This is invoked once, after all components have been created, and can aggregate content contributed by the
|
|
129
|
+
* components (for example via {@link Component.Composed.getComposed}).
|
|
130
|
+
* @returns The composed components, from which configuration and per-component content can be read.
|
|
131
|
+
*
|
|
132
|
+
* @typeParam TComponent - The content each component contributes.
|
|
133
|
+
* @typeParam TConfig - The composed configuration type made available to components.
|
|
134
|
+
*
|
|
135
|
+
* @alpha
|
|
136
|
+
*/
|
|
137
|
+
function compose<TComponent, TConfig>(allComponents: readonly Factory<TComponent, TConfig>[], lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig): Composed<TComponent, TConfig>;
|
|
138
|
+
/**
|
|
139
|
+
* The default configuration type for a composition.
|
|
140
|
+
* Also the type of Composed when using the default composition.
|
|
141
|
+
* @privateRemarks
|
|
142
|
+
* Declaring this as its own type makes the recursion possible instead of having to list the config parameter as unknown.
|
|
143
|
+
* This makes it easier to understand what is going on when seeing this type in the intellisense.
|
|
144
|
+
* @sealed @alpha
|
|
145
|
+
*/
|
|
146
|
+
type ComposedDefault<TComponent> = Composed<TComponent, ComposedDefault<TComponent>>;
|
|
147
|
+
/**
|
|
148
|
+
* The result of composing multiple components.
|
|
149
|
+
*
|
|
150
|
+
* @remarks
|
|
151
|
+
* Create using {@link Component.(compose:1)}.
|
|
152
|
+
*
|
|
153
|
+
* @typeParam TComponent - The content each component contributes.
|
|
154
|
+
* @typeParam TConfig - The composed configuration type made available to components.
|
|
155
|
+
* Defaults to the composition itself: the common case where no custom configuration type is needed.
|
|
156
|
+
*
|
|
157
|
+
* @sealed @alpha
|
|
158
|
+
*/
|
|
159
|
+
interface Composed<TComponent, TConfig = ComposedDefault<TComponent>> {
|
|
160
|
+
/**
|
|
161
|
+
* The components which were composed.
|
|
162
|
+
*/
|
|
163
|
+
readonly components: readonly TComponent[];
|
|
164
|
+
/**
|
|
165
|
+
* The configuration which was produced when composing.
|
|
166
|
+
*/
|
|
167
|
+
readonly config: TConfig;
|
|
168
|
+
/**
|
|
169
|
+
* Get a component by its factory.
|
|
170
|
+
*
|
|
171
|
+
* @param factory - The factory used to look up the component. Must have been provided when composing.
|
|
172
|
+
* @returns The content created by the provided factory.
|
|
173
|
+
* This result is cached during composition and not reevaluated.
|
|
174
|
+
*/
|
|
175
|
+
getComponent<TFactory extends Factory<TComponent, TConfig>>(factory: TFactory): ReturnType<TFactory>;
|
|
176
|
+
/**
|
|
177
|
+
* Configure a {@link Component.Configurable}.
|
|
178
|
+
* @remarks
|
|
179
|
+
* The result is cached when first evaluated, so subsequent calls with the same `configurable` return the
|
|
180
|
+
* same result.
|
|
181
|
+
* @param configurable - The item to configure against this composition.
|
|
182
|
+
*/
|
|
183
|
+
getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(configurable: TConfigurable): ReturnType<TConfigurable["configure"]>;
|
|
184
|
+
/**
|
|
185
|
+
* Compose the contents of a {@link Component.LazyArray} property from all components.
|
|
186
|
+
* @remarks
|
|
187
|
+
* The result is cached when first evaluated, so subsequent calls with the same `property` return the
|
|
188
|
+
* same result.
|
|
189
|
+
* @param property - The property of the components to compose.
|
|
190
|
+
* @returns The concatenation of the lazy values contributed by each component for `property`.
|
|
191
|
+
* Components which omit the property contribute nothing.
|
|
192
|
+
*/
|
|
193
|
+
getComposed<TKey extends keyof {
|
|
194
|
+
[Property in keyof TComponent as TComponent[Property] extends LazyArray<unknown> | undefined ? Property : never]: boolean;
|
|
195
|
+
}>(property: TKey): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U> ? () => U : never)[];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=componentApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentApi.d.ts","sourceRoot":"","sources":["../src/componentApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,yBAAiB,SAAS,CAAC;IAC1B;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAY,OAAO,CAAC,UAAU,EAAE,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,CACxE,iBAAiB,EAAE,MAAM,OAAO,KAC5B,UAAU,CAAC;IAEhB;;;;;;;;;;OAUG;IACH,KAAY,SAAS,CAAC,CAAC,IAAI,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAEtD;;;;;;;;;;;;;OAaG;IACI,MAAM,OAAO,eAAgB,MAAM,CAAC,KAAG,CAAC,MAAM,CAAC,CAUrD,CAAC;IAEF;;;;;;;;;;;;OAYG;IACH,UAAiB,YAAY,CAAC,cAAc,EAAE,GAAG,CAAC,OAAO,EAAE,UAAU;QACpE;;;;WAIG;QACH,SAAS,CACR,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC,GAC9C,OAAO,CAAC;KACX;IAuGD;;;;;;;;;;;;;;OAcG;IACH,SAAgB,OAAO,CAAC,UAAU,EACjC,aAAa,EAAE,SAAS,OAAO,CAAC,UAAU,CAAC,EAAE,GAC3C,QAAQ,CAAC,UAAU,CAAC,CAAC;IACxB;;;;;;;;;;;;;OAaG;IACH,SAAgB,OAAO,CAAC,UAAU,EAAE,OAAO,EAC1C,aAAa,EAAE,SAAS,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,EACtD,iBAAiB,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,GACrE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IASjC;;;;;;;OAOG;IACH,KAAY,eAAe,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IAE5F;;;;;;;;;;;OAWG;IACH,UAAiB,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC;QAC1E;;WAEG;QACH,QAAQ,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC;QAE3C;;WAEG;QACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QAEzB;;;;;;WAMG;QACH,YAAY,CAAC,QAAQ,SAAS,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EACzD,OAAO,EAAE,QAAQ,GACf,UAAU,CAAC,QAAQ,CAAC,CAAC;QAExB;;;;;;WAMG;QACH,aAAa,CAAC,aAAa,SAAS,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAC7E,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;QAE1C;;;;;;;;WAQG;QACH,WAAW,CACV,IAAI,SAAS,MAAM;aACjB,QAAQ,IAAI,MAAM,UAAU,IAAI,UAAU,CAAC,QAAQ,CAAC,SAClD,SAAS,CAAC,OAAO,CAAC,GAClB,SAAS,GACT,QAAQ,GACR,KAAK,GAAG,OAAO;SAClB,EAED,QAAQ,EAAE,IAAI,GACZ,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GACzE,MAAM,CAAC,GACP,KAAK,CAAC,EAAE,CAAC;KACZ;CACD"}
|