@fluidframework/tree 2.110.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/.vscode/settings.json +1 -0
- package/CHANGELOG.md +193 -0
- package/api-report/tree.alpha.api.md +96 -36
- package/api-report/tree.beta.api.md +39 -1
- package/api-report/tree.legacy.beta.api.md +39 -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/core/change-family/changeFamily.d.ts +3 -10
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/rebase/types.d.ts +2 -2
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- 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/entrypoints/beta.d.ts +1 -1
- package/dist/entrypoints/beta.d.ts.map +1 -1
- package/dist/entrypoints/beta.js.map +1 -1
- package/dist/entrypoints/legacy.d.ts +1 -1
- package/dist/entrypoints/legacy.d.ts.map +1 -1
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
- 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 +73 -28
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +76 -9
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -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/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- 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 +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -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 +15 -12
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +3 -2
- 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 +6 -5
- 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 +18 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +9 -4
- 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/transactionPostProcessor.d.ts +28 -0
- package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
- package/dist/shared-tree/transactionPostProcessor.js +28 -0
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
- package/dist/shared-tree/treeAlpha.js +3 -3
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +19 -13
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +54 -71
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
- package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.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/editManagerCodecs.d.ts +3 -2
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.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/editManagerSummarizer.d.ts +5 -9
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +1 -1
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -2
- package/dist/shared-tree-core/index.js.map +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 +27 -12
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +84 -9
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +88 -7
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- 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/schemaCreationUtilities.d.ts +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
- package/dist/simple-tree/api/schemaFactory.js +2 -2
- package/dist/simple-tree/api/schemaFactory.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 +2 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +3 -4
- 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/transactionTypes.d.ts +91 -28
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +108 -24
- 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/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.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/core/treeNodeSchema.d.ts +7 -7
- package/dist/simple-tree/core/treeNodeSchema.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/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +3 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +69 -758
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +275 -322
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +273 -0
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
- package/dist/text/textDomainFormattedDefault.js +94 -0
- package/dist/text/textDomainFormattedDefault.js.map +1 -0
- 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 +185 -0
- package/dist/util/compressedIds.d.ts.map +1 -0
- package/dist/util/compressedIds.js +164 -0
- package/dist/util/compressedIds.js.map +1 -0
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +10 -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/core/change-family/changeFamily.d.ts +3 -10
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/rebase/types.d.ts +2 -2
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- 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/entrypoints/beta.d.ts +1 -1
- package/lib/entrypoints/beta.d.ts.map +1 -1
- package/lib/entrypoints/beta.js.map +1 -1
- package/lib/entrypoints/legacy.d.ts +1 -1
- package/lib/entrypoints/legacy.d.ts.map +1 -1
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
- 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 +73 -28
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +75 -9
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -2
- 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/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- 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 +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- 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 +13 -10
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +3 -2
- 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 +6 -5
- 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 +18 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -5
- 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/transactionPostProcessor.d.ts +28 -0
- package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
- package/lib/shared-tree/transactionPostProcessor.js +23 -0
- package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
- package/lib/shared-tree/treeAlpha.js +3 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +19 -13
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +36 -53
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
- package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.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/editManagerCodecs.d.ts +3 -2
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.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/editManagerSummarizer.d.ts +5 -9
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +1 -1
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +1 -1
- package/lib/shared-tree-core/index.js.map +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 +28 -13
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +84 -9
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +87 -6
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- 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/schemaCreationUtilities.d.ts +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -2
- package/lib/simple-tree/api/schemaFactory.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 +2 -2
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +4 -5
- 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/transactionTypes.d.ts +91 -28
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +108 -24
- 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/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.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/core/treeNodeSchema.d.ts +7 -7
- package/lib/simple-tree/core/treeNodeSchema.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/text/index.d.ts +1 -0
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +1 -0
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +69 -758
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +277 -324
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +273 -0
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
- package/lib/text/textDomainFormattedDefault.js +91 -0
- package/lib/text/textDomainFormattedDefault.js.map +1 -0
- 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 +185 -0
- package/lib/util/compressedIds.d.ts.map +1 -0
- package/lib/util/compressedIds.js +154 -0
- package/lib/util/compressedIds.js.map +1 -0
- package/lib/util/index.d.ts +2 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -1
- 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 +23 -23
- package/src/componentApi.ts +354 -0
- package/src/core/change-family/changeFamily.ts +3 -12
- package/src/core/rebase/types.ts +2 -2
- package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
- package/src/entrypoints/alpha.ts +15 -8
- package/src/entrypoints/beta.ts +8 -0
- package/src/entrypoints/legacy.ts +8 -0
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +22 -72
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +110 -41
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
- package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
- package/src/feature-libraries/chunked-forest/index.ts +3 -0
- package/src/feature-libraries/forest-summary/codec.ts +5 -3
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
- package/src/feature-libraries/index.ts +5 -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/modular-schema/modularChangeCodecV1.ts +13 -9
- package/src/feature-libraries/schemaChecker.ts +86 -9
- package/src/index.ts +16 -8
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +40 -15
- package/src/shared-tree/index.ts +4 -0
- package/src/shared-tree/schematizingTreeView.ts +40 -30
- package/src/shared-tree/serializedChange.ts +127 -0
- package/src/shared-tree/sharedTree.ts +32 -4
- package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
- package/src/shared-tree/transactionMinimize.ts +74 -0
- package/src/shared-tree/transactionPostProcessor.ts +40 -0
- package/src/shared-tree/treeAlpha.ts +3 -3
- package/src/shared-tree/treeCheckout.ts +103 -101
- package/src/shared-tree/unhydratedTreeContext.ts +18 -15
- package/src/shared-tree-core/editManager.ts +42 -6
- package/src/shared-tree-core/editManagerCodecs.ts +3 -2
- package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
- package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
- package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
- package/src/shared-tree-core/index.ts +8 -5
- 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 +36 -12
- package/src/shared-tree-core/transaction.ts +165 -18
- package/src/simple-tree/api/index.ts +14 -10
- package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
- package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
- package/src/simple-tree/api/schemaFactory.ts +2 -2
- 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 +4 -5
- package/src/simple-tree/api/storedSchema.ts +2 -3
- package/src/simple-tree/api/transactionTypes.ts +111 -39
- package/src/simple-tree/api/tree.ts +165 -49
- package/src/simple-tree/api/treeBeta.ts +2 -0
- package/src/simple-tree/api/typesUnsafe.ts +2 -1
- package/src/simple-tree/core/treeNodeSchema.ts +7 -7
- package/src/simple-tree/index.ts +13 -9
- package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
- package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
- package/src/text/index.ts +1 -0
- package/src/text/textDomainFormatted.ts +520 -415
- package/src/text/textDomainFormattedDefault.ts +150 -0
- package/src/treeFactory.ts +1 -1
- package/src/util/breakable.ts +8 -1
- package/src/util/compressedIds.ts +304 -0
- package/src/util/index.ts +18 -1
- package/src/util/nestedMap.ts +21 -4
- package/src/util/nestedSet.ts +1 -1
- package/src/util/utils.ts +0 -18
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
+
|
|
8
|
+
import { getOrCreate } from "./util/index.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Utilities for composing application "components" which contribute to a shared configuration.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Nothing in this namespace is specific to tree schema,
|
|
15
|
+
* however it is designed to be able to handle the needs of components which work with {@link TreeSchema}.
|
|
16
|
+
*
|
|
17
|
+
* This is mainly used to implement "open polymorphism", where the set of allowed types
|
|
18
|
+
* for a field or collection can be extended by independently authored libraries (components) instead of being
|
|
19
|
+
* fixed up front.
|
|
20
|
+
*
|
|
21
|
+
* This basically amounts to dependency injection, where the "injection" is done at "composition" time to build the schema.
|
|
22
|
+
*
|
|
23
|
+
* Tree's schema do not natively support open polymorphism: all possible implementations must be explicitly listed.
|
|
24
|
+
* These tools work around these limitations by carefully controlling evaluation order:
|
|
25
|
+
* the source code can be structured in an open polymorphism style which at runtime evaluates into closed polymorphism
|
|
26
|
+
* by having each component register its implementations into a central collection (typically an
|
|
27
|
+
* {@link AllowedTypes} array).
|
|
28
|
+
*
|
|
29
|
+
* Each component is expressed as a {@link Component.Factory}: a function which receives a lazy reference to the
|
|
30
|
+
* composed configuration and returns the content that component contributes.
|
|
31
|
+
* Because the configuration is provided lazily, components may reference (including recursively) types contributed by
|
|
32
|
+
* other components, as long as nothing evaluates the lazy references until composition has completed.
|
|
33
|
+
* Use {@link Component.(compose:1)} to combine a set of components into a {@link Component.Composed}.
|
|
34
|
+
*
|
|
35
|
+
* 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.
|
|
36
|
+
*
|
|
37
|
+
* @privateRemarks
|
|
38
|
+
* The examples and integration tests for this pattern live in `openPolymorphism.integration.ts`.
|
|
39
|
+
* Those tests and the docs here should be kept in sync.
|
|
40
|
+
*
|
|
41
|
+
* @alpha
|
|
42
|
+
*/
|
|
43
|
+
export namespace Component {
|
|
44
|
+
/**
|
|
45
|
+
* A function which takes in a lazy configuration and returns the content a component contributes.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* The lazy configuration allows the component to reference items from the composed configuration, which can
|
|
49
|
+
* include items the component itself contributes (allowing recursive references between components).
|
|
50
|
+
*
|
|
51
|
+
* The execution of the factory must not evaluate `lazyConfiguration` (doing so will error):
|
|
52
|
+
* instead the returned `TComponent` can capture `lazyConfiguration` and evaluate it at a later time
|
|
53
|
+
* (after all components have been composed).
|
|
54
|
+
*
|
|
55
|
+
* @typeParam TComponent - The content a component contributes.
|
|
56
|
+
* @typeParam TConfig - The composed configuration type made available to components.
|
|
57
|
+
* Defaults to the {@link Component.Composed} produced by composition: the common case where
|
|
58
|
+
* components read composed content directly from the composition and no custom configuration type is needed.
|
|
59
|
+
*
|
|
60
|
+
* @input
|
|
61
|
+
* @alpha
|
|
62
|
+
*/
|
|
63
|
+
export type Factory<TComponent, TConfig = ComposedDefault<TComponent>> = (
|
|
64
|
+
lazyConfiguration: () => TConfig,
|
|
65
|
+
) => TComponent;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A function which returns an array of lazy values which each evaluate to `T`.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* This mirrors the shape of {@link AllowedTypes} where all of the values are lazy:
|
|
72
|
+
* the outer function and inner functions defer evaluation until after composition is complete.
|
|
73
|
+
*
|
|
74
|
+
* @typeParam T - The type each lazy value evaluates to.
|
|
75
|
+
*
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
export type LazyArray<T> = () => readonly (() => T)[];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Wrap a 0 argument function to cache the result.
|
|
82
|
+
* @remarks
|
|
83
|
+
* Do not use for impure functions.
|
|
84
|
+
*
|
|
85
|
+
* Generally {@link Component} utilities have built in caching in most cases,
|
|
86
|
+
* but this is occasionally helpful when manually implementing laziness.
|
|
87
|
+
*
|
|
88
|
+
* Note that this takes a different approach than use in {@link evaluateLazySchema} where the function evaluation is done using a utility that adds caching.
|
|
89
|
+
*
|
|
90
|
+
* @param factory - The factory function to memoize.
|
|
91
|
+
* @returns A function that returns the cached result of the factory.
|
|
92
|
+
* @alpha
|
|
93
|
+
*/
|
|
94
|
+
export const memoize = <T>(factory: () => T): (() => T) => {
|
|
95
|
+
let run = false;
|
|
96
|
+
let cached: T;
|
|
97
|
+
return () => {
|
|
98
|
+
if (!run) {
|
|
99
|
+
cached = factory();
|
|
100
|
+
run = true;
|
|
101
|
+
}
|
|
102
|
+
return cached;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* An item which can be configured (evaluated) against a composed configuration to produce a result.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* Use {@link Component.Composed.getConfigured} to evaluate a `Configurable`.
|
|
111
|
+
* The result is cached, so a given `Configurable` is only evaluated once per composition.
|
|
112
|
+
*
|
|
113
|
+
* @typeParam TConfigPartial - The configuration type made available when configuring.
|
|
114
|
+
* @typeParam TResult - The result produced by configuring.
|
|
115
|
+
* @typeParam TComponent - The content components contribute.
|
|
116
|
+
*
|
|
117
|
+
* @alpha
|
|
118
|
+
*/
|
|
119
|
+
export interface Configurable<TConfigPartial, out TResult, TComponent> {
|
|
120
|
+
/**
|
|
121
|
+
* Produce the configured result.
|
|
122
|
+
* @param config - The composed configuration.
|
|
123
|
+
* @param components - The composed components.
|
|
124
|
+
*/
|
|
125
|
+
configure(
|
|
126
|
+
config: TConfigPartial,
|
|
127
|
+
components: Composed<TComponent, TConfigPartial>,
|
|
128
|
+
): TResult;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Implementation of {@link Component.Composed}.
|
|
133
|
+
*/
|
|
134
|
+
class Config<TConfig, TComponent> implements Composed<TComponent, TConfig> {
|
|
135
|
+
public readonly componentsMap: ReadonlyMap<Factory<TComponent, TConfig>, TComponent>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Cache of results produced by {@link Component.Composed.getConfigured}.
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* Maps each {@link Component.Configurable} to the result of evaluating it against this composition.
|
|
142
|
+
* This ensures a given `Configurable` is only configured once: subsequent lookups return the cached result.
|
|
143
|
+
*/
|
|
144
|
+
private readonly evaluatedMap: Map<Configurable<TConfig, unknown, TComponent>, unknown> =
|
|
145
|
+
new Map();
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Cache of results produced by {@link Component.Composed.getComposed}.
|
|
149
|
+
*
|
|
150
|
+
* @remarks
|
|
151
|
+
* Maps each composed property to the array produced for it.
|
|
152
|
+
* This ensures a given property is only composed once: subsequent lookups return the same array
|
|
153
|
+
* (including the same lazy values), so repeated calls with the same property are reference-stable.
|
|
154
|
+
*/
|
|
155
|
+
private readonly composedMap: Map<keyof TComponent, readonly unknown[]> = new Map();
|
|
156
|
+
|
|
157
|
+
public readonly components: readonly TComponent[];
|
|
158
|
+
|
|
159
|
+
public readonly config: TConfig;
|
|
160
|
+
|
|
161
|
+
public constructor(
|
|
162
|
+
allComponents: readonly Factory<TComponent, TConfig>[],
|
|
163
|
+
lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,
|
|
164
|
+
) {
|
|
165
|
+
// eslint-disable-next-line no-undef-init -- Explicitly undefined: `config` is populated below, after all components have been constructed, and is read lazily via `lazyConfigInner`.
|
|
166
|
+
let config: TConfig | undefined = undefined;
|
|
167
|
+
const lazyConfigInner = (): TConfig => {
|
|
168
|
+
if (config === undefined) {
|
|
169
|
+
throw new UsageError(
|
|
170
|
+
"Configuration not yet available: components must not evaluate the lazy configuration during composition.",
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return config;
|
|
174
|
+
};
|
|
175
|
+
this.componentsMap = new Map(allComponents.map((c) => [c, c(lazyConfigInner)]));
|
|
176
|
+
this.components = [...this.componentsMap.values()];
|
|
177
|
+
config = lazyConfiguration(this);
|
|
178
|
+
this.config = config;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public getComponent<TFactory extends Factory<TComponent, TConfig>>(
|
|
182
|
+
factory: TFactory,
|
|
183
|
+
): ReturnType<TFactory> {
|
|
184
|
+
const found = this.componentsMap.get(factory);
|
|
185
|
+
if (found === undefined) {
|
|
186
|
+
throw new UsageError("Requested component not included in this configuration");
|
|
187
|
+
}
|
|
188
|
+
return found as ReturnType<TFactory>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
public getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(
|
|
192
|
+
configurable: TConfigurable,
|
|
193
|
+
): ReturnType<TConfigurable["configure"]> {
|
|
194
|
+
const configured: unknown = getOrCreate(this.evaluatedMap, configurable, (c) => {
|
|
195
|
+
const result = c.configure(this.config, this);
|
|
196
|
+
if (result === undefined) {
|
|
197
|
+
throw new UsageError("Configurable must not return undefined");
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
});
|
|
201
|
+
return configured as ReturnType<TConfigurable["configure"]>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
public getComposed<
|
|
205
|
+
TKey extends keyof {
|
|
206
|
+
[Property in keyof TComponent as TComponent[Property] extends
|
|
207
|
+
| LazyArray<unknown>
|
|
208
|
+
| undefined
|
|
209
|
+
? Property
|
|
210
|
+
: never]: boolean;
|
|
211
|
+
},
|
|
212
|
+
>(
|
|
213
|
+
property: TKey,
|
|
214
|
+
): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>
|
|
215
|
+
? () => U
|
|
216
|
+
: never)[] {
|
|
217
|
+
const result = getOrCreate(this.composedMap, property, () =>
|
|
218
|
+
this.components.flatMap((c) => {
|
|
219
|
+
const prop = c[property] as LazyArray<unknown> | undefined;
|
|
220
|
+
if (prop === undefined) {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
return prop();
|
|
224
|
+
}),
|
|
225
|
+
);
|
|
226
|
+
return result as (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>
|
|
227
|
+
? () => U
|
|
228
|
+
: never)[];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.
|
|
234
|
+
*
|
|
235
|
+
* @remarks
|
|
236
|
+
* The {@link Component.Composed} itself is used as the configuration made available to components:
|
|
237
|
+
* the simple case where components read composed content directly from the composition.
|
|
238
|
+
* To produce a custom aggregated configuration, use the overload which takes a `lazyConfiguration` builder.
|
|
239
|
+
*
|
|
240
|
+
* @param allComponents - The components to compose.
|
|
241
|
+
* @returns The composed components, from which configuration and per-component content can be read.
|
|
242
|
+
*
|
|
243
|
+
* @typeParam TComponent - The content each component contributes.
|
|
244
|
+
*
|
|
245
|
+
* @alpha
|
|
246
|
+
*/
|
|
247
|
+
export function compose<TComponent>(
|
|
248
|
+
allComponents: readonly Factory<TComponent>[],
|
|
249
|
+
): Composed<TComponent>;
|
|
250
|
+
/**
|
|
251
|
+
* Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.
|
|
252
|
+
*
|
|
253
|
+
* @param allComponents - The components to compose.
|
|
254
|
+
* @param lazyConfiguration - Builds the composed configuration from the composed components.
|
|
255
|
+
* This is invoked once, after all components have been created, and can aggregate content contributed by the
|
|
256
|
+
* components (for example via {@link Component.Composed.getComposed}).
|
|
257
|
+
* @returns The composed components, from which configuration and per-component content can be read.
|
|
258
|
+
*
|
|
259
|
+
* @typeParam TComponent - The content each component contributes.
|
|
260
|
+
* @typeParam TConfig - The composed configuration type made available to components.
|
|
261
|
+
*
|
|
262
|
+
* @alpha
|
|
263
|
+
*/
|
|
264
|
+
export function compose<TComponent, TConfig>(
|
|
265
|
+
allComponents: readonly Factory<TComponent, TConfig>[],
|
|
266
|
+
lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,
|
|
267
|
+
): Composed<TComponent, TConfig>;
|
|
268
|
+
export function compose<TComponent, TConfig>(
|
|
269
|
+
allComponents: readonly Factory<TComponent, TConfig>[],
|
|
270
|
+
lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig = (composed) =>
|
|
271
|
+
composed as unknown as TConfig,
|
|
272
|
+
): Composed<TComponent, TConfig> {
|
|
273
|
+
return new Config<TConfig, TComponent>(allComponents, lazyConfiguration);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* The default configuration type for a composition.
|
|
278
|
+
* Also the type of Composed when using the default composition.
|
|
279
|
+
* @privateRemarks
|
|
280
|
+
* Declaring this as its own type makes the recursion possible instead of having to list the config parameter as unknown.
|
|
281
|
+
* This makes it easier to understand what is going on when seeing this type in the intellisense.
|
|
282
|
+
* @sealed @alpha
|
|
283
|
+
*/
|
|
284
|
+
export type ComposedDefault<TComponent> = Composed<TComponent, ComposedDefault<TComponent>>;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The result of composing multiple components.
|
|
288
|
+
*
|
|
289
|
+
* @remarks
|
|
290
|
+
* Create using {@link Component.(compose:1)}.
|
|
291
|
+
*
|
|
292
|
+
* @typeParam TComponent - The content each component contributes.
|
|
293
|
+
* @typeParam TConfig - The composed configuration type made available to components.
|
|
294
|
+
* Defaults to the composition itself: the common case where no custom configuration type is needed.
|
|
295
|
+
*
|
|
296
|
+
* @sealed @alpha
|
|
297
|
+
*/
|
|
298
|
+
export interface Composed<TComponent, TConfig = ComposedDefault<TComponent>> {
|
|
299
|
+
/**
|
|
300
|
+
* The components which were composed.
|
|
301
|
+
*/
|
|
302
|
+
readonly components: readonly TComponent[];
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The configuration which was produced when composing.
|
|
306
|
+
*/
|
|
307
|
+
readonly config: TConfig;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Get a component by its factory.
|
|
311
|
+
*
|
|
312
|
+
* @param factory - The factory used to look up the component. Must have been provided when composing.
|
|
313
|
+
* @returns The content created by the provided factory.
|
|
314
|
+
* This result is cached during composition and not reevaluated.
|
|
315
|
+
*/
|
|
316
|
+
getComponent<TFactory extends Factory<TComponent, TConfig>>(
|
|
317
|
+
factory: TFactory,
|
|
318
|
+
): ReturnType<TFactory>;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Configure a {@link Component.Configurable}.
|
|
322
|
+
* @remarks
|
|
323
|
+
* The result is cached when first evaluated, so subsequent calls with the same `configurable` return the
|
|
324
|
+
* same result.
|
|
325
|
+
* @param configurable - The item to configure against this composition.
|
|
326
|
+
*/
|
|
327
|
+
getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(
|
|
328
|
+
configurable: TConfigurable,
|
|
329
|
+
): ReturnType<TConfigurable["configure"]>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Compose the contents of a {@link Component.LazyArray} property from all components.
|
|
333
|
+
* @remarks
|
|
334
|
+
* The result is cached when first evaluated, so subsequent calls with the same `property` return the
|
|
335
|
+
* same result.
|
|
336
|
+
* @param property - The property of the components to compose.
|
|
337
|
+
* @returns The concatenation of the lazy values contributed by each component for `property`.
|
|
338
|
+
* Components which omit the property contribute nothing.
|
|
339
|
+
*/
|
|
340
|
+
getComposed<
|
|
341
|
+
TKey extends keyof {
|
|
342
|
+
[Property in keyof TComponent as TComponent[Property] extends
|
|
343
|
+
| LazyArray<unknown>
|
|
344
|
+
| undefined
|
|
345
|
+
? Property
|
|
346
|
+
: never]: boolean;
|
|
347
|
+
},
|
|
348
|
+
>(
|
|
349
|
+
property: TKey,
|
|
350
|
+
): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>
|
|
351
|
+
? () => U
|
|
352
|
+
: never)[];
|
|
353
|
+
}
|
|
354
|
+
}
|
|
@@ -7,9 +7,7 @@ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
|
7
7
|
|
|
8
8
|
import type { ICodecFamily, IJsonCodec } from "../../codec/index.js";
|
|
9
9
|
import type { SchemaAndPolicy } from "../../core/index.js";
|
|
10
|
-
|
|
11
|
-
import type { FieldBatchEncodingContext } from "../../feature-libraries/index.js";
|
|
12
|
-
import type { JsonCompatibleReadOnly } from "../../util/index.js";
|
|
10
|
+
import type { IdentifierHealingConfig, JsonCompatibleReadOnly } from "../../util/index.js";
|
|
13
11
|
import type { ChangeRebaser, RevisionTag, TaggedChange } from "../rebase/index.js";
|
|
14
12
|
|
|
15
13
|
export interface ChangeFamily<TEditor extends ChangeFamilyEditor, TChange> {
|
|
@@ -39,17 +37,10 @@ export interface ChangeEncodingContext {
|
|
|
39
37
|
*/
|
|
40
38
|
readonly isSummary: boolean;
|
|
41
39
|
/**
|
|
42
|
-
*
|
|
43
|
-
* during decode are healed into deterministic stable UUIDs instead of
|
|
44
|
-
* throwing. See {@link FieldBatchEncodingContext.healUnresolvableIdentifiersOnDecode}.
|
|
40
|
+
* Heal-on-decode workaround configuration. See {@link IdentifierHealingConfig}.
|
|
45
41
|
* Only takes effect when `isSummary` is also `true`.
|
|
46
42
|
*/
|
|
47
|
-
readonly
|
|
48
|
-
/**
|
|
49
|
-
* The SharedTree's shared-object id, used as input to the deterministic
|
|
50
|
-
* UUID derivation when {@link healUnresolvableIdentifiersOnDecode} triggers.
|
|
51
|
-
*/
|
|
52
|
-
readonly sharedObjectId?: string;
|
|
43
|
+
readonly healing?: IdentifierHealingConfig;
|
|
53
44
|
}
|
|
54
45
|
|
|
55
46
|
export type ChangeFamilyCodec<TChange> = IJsonCodec<
|
package/src/core/rebase/types.ts
CHANGED
|
@@ -236,7 +236,7 @@ export interface LocalChangeMetadata extends CommitMetadata {
|
|
|
236
236
|
readonly label?: unknown;
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
|
-
* A set of {@link
|
|
239
|
+
* A set of {@link RunTransactionParamsBeta.label | labels} for all transactions (nested or otherwise)
|
|
240
240
|
* that made up this change.
|
|
241
241
|
* This can be used to identify, group, or filter changes — for example, to decide whether a change
|
|
242
242
|
* should be included in an undo/redo stack.
|
|
@@ -278,7 +278,7 @@ export interface LocalChangeMetadata extends CommitMetadata {
|
|
|
278
278
|
*
|
|
279
279
|
* @remarks
|
|
280
280
|
* Each transaction contributes a node whose {@link LabelTree.label} is its
|
|
281
|
-
* {@link
|
|
281
|
+
* {@link RunTransactionParamsBeta.label | label} (or `undefined` if no label was provided).
|
|
282
282
|
* When transactions are nested, inner transaction nodes become {@link LabelTree.sublabels | sublabels}
|
|
283
283
|
* of outer ones.
|
|
284
284
|
*
|
|
@@ -51,8 +51,8 @@ export interface TreeStoredSchemaSubscription extends TreeStoredSchema {
|
|
|
51
51
|
export interface MutableTreeStoredSchema extends TreeStoredSchemaSubscription {
|
|
52
52
|
/**
|
|
53
53
|
* Mutates the stored schema.
|
|
54
|
-
* Replaces all
|
|
55
|
-
* Can
|
|
54
|
+
* Replaces all schemas with the provided schema.
|
|
55
|
+
* Can overwrite preexisting schemas, and removes unmentioned schemas.
|
|
56
56
|
*/
|
|
57
57
|
apply(newSchema: TreeStoredSchema): void;
|
|
58
58
|
}
|
package/src/entrypoints/alpha.ts
CHANGED
|
@@ -120,6 +120,7 @@ export {
|
|
|
120
120
|
ObjectSchemaOptions,
|
|
121
121
|
PopUnion,
|
|
122
122
|
RecordNodeInsertableData,
|
|
123
|
+
RunTransactionParamsBeta,
|
|
123
124
|
SchemaFactoryBeta,
|
|
124
125
|
SchemaStaticsBeta,
|
|
125
126
|
SchemaUpgrade,
|
|
@@ -128,6 +129,11 @@ export {
|
|
|
128
129
|
SnapshotSchemaCompatibilityOptions,
|
|
129
130
|
System_TableSchema,
|
|
130
131
|
TableSchema,
|
|
132
|
+
TransactionCallbackStatusBeta,
|
|
133
|
+
TransactionResultFailed,
|
|
134
|
+
TransactionResultSuccess,
|
|
135
|
+
TransactionValueResult,
|
|
136
|
+
TransactionVoidResult,
|
|
131
137
|
TreeBeta,
|
|
132
138
|
TreeBranch,
|
|
133
139
|
TreeChangeEventsBeta,
|
|
@@ -142,6 +148,8 @@ export {
|
|
|
142
148
|
UnannotateAllowedTypesList,
|
|
143
149
|
UnannotateAllowedTypesListUnsafe,
|
|
144
150
|
UnionToTuple,
|
|
151
|
+
VoidTransactionCallbackStatusBeta,
|
|
152
|
+
WithValue,
|
|
145
153
|
adaptEnum,
|
|
146
154
|
asBeta,
|
|
147
155
|
configuredSharedTreeBeta,
|
|
@@ -170,6 +178,7 @@ export {
|
|
|
170
178
|
ChangeMetadata,
|
|
171
179
|
CodecName,
|
|
172
180
|
CodecWriteOptions,
|
|
181
|
+
Component,
|
|
173
182
|
CreateIndependentTreeAlphaOptions,
|
|
174
183
|
DirtyTreeMap,
|
|
175
184
|
DirtyTreeStatus,
|
|
@@ -193,6 +202,7 @@ export {
|
|
|
193
202
|
ITreeAlpha,
|
|
194
203
|
IncrementalEncodingPolicy,
|
|
195
204
|
IndependentViewOptions,
|
|
205
|
+
IndependentViewTelemetryOptions,
|
|
196
206
|
Insertable,
|
|
197
207
|
InsertableContent,
|
|
198
208
|
InsertableField,
|
|
@@ -241,7 +251,7 @@ export {
|
|
|
241
251
|
RemoteChangeMetadata,
|
|
242
252
|
RevertibleAlpha,
|
|
243
253
|
RevertibleAlphaFactory,
|
|
244
|
-
|
|
254
|
+
RunTransactionParamsAlpha,
|
|
245
255
|
SchemaFactoryAlpha,
|
|
246
256
|
SchemaStaticsAlpha,
|
|
247
257
|
SchemaType,
|
|
@@ -259,13 +269,10 @@ export {
|
|
|
259
269
|
SimpleRecordNodeSchema,
|
|
260
270
|
SimpleTreeSchema,
|
|
261
271
|
TextAsTree,
|
|
262
|
-
|
|
272
|
+
TransactionCallbackStatusAlpha,
|
|
263
273
|
TransactionConstraintAlpha,
|
|
264
274
|
TransactionLabels,
|
|
265
|
-
|
|
266
|
-
TransactionResultExt,
|
|
267
|
-
TransactionResultFailed,
|
|
268
|
-
TransactionResultSuccess,
|
|
275
|
+
TransactionPostProcessor,
|
|
269
276
|
TreeAlpha,
|
|
270
277
|
TreeArrayNodeAlpha,
|
|
271
278
|
TreeBranchAlpha,
|
|
@@ -285,8 +292,7 @@ export {
|
|
|
285
292
|
VerboseTree,
|
|
286
293
|
VerboseTreeNode,
|
|
287
294
|
ViewContent,
|
|
288
|
-
|
|
289
|
-
WithValue,
|
|
295
|
+
VoidTransactionCallbackStatusAlpha,
|
|
290
296
|
allowUnused,
|
|
291
297
|
asAlpha,
|
|
292
298
|
asTreeViewAlpha,
|
|
@@ -312,6 +318,7 @@ export {
|
|
|
312
318
|
incrementalSummaryHint,
|
|
313
319
|
independentInitializedView,
|
|
314
320
|
independentView,
|
|
321
|
+
minimize,
|
|
315
322
|
normalizeAllowedTypes,
|
|
316
323
|
persistedToSimpleSchema,
|
|
317
324
|
replaceConciseTreeHandles,
|
package/src/entrypoints/beta.ts
CHANGED
|
@@ -120,6 +120,7 @@ export {
|
|
|
120
120
|
ObjectSchemaOptions,
|
|
121
121
|
PopUnion,
|
|
122
122
|
RecordNodeInsertableData,
|
|
123
|
+
RunTransactionParamsBeta,
|
|
123
124
|
SchemaFactoryBeta,
|
|
124
125
|
SchemaStaticsBeta,
|
|
125
126
|
SchemaUpgrade,
|
|
@@ -128,6 +129,11 @@ export {
|
|
|
128
129
|
SnapshotSchemaCompatibilityOptions,
|
|
129
130
|
System_TableSchema,
|
|
130
131
|
TableSchema,
|
|
132
|
+
TransactionCallbackStatusBeta,
|
|
133
|
+
TransactionResultFailed,
|
|
134
|
+
TransactionResultSuccess,
|
|
135
|
+
TransactionValueResult,
|
|
136
|
+
TransactionVoidResult,
|
|
131
137
|
TreeBeta,
|
|
132
138
|
TreeBranch,
|
|
133
139
|
TreeChangeEventsBeta,
|
|
@@ -142,6 +148,8 @@ export {
|
|
|
142
148
|
UnannotateAllowedTypesList,
|
|
143
149
|
UnannotateAllowedTypesListUnsafe,
|
|
144
150
|
UnionToTuple,
|
|
151
|
+
VoidTransactionCallbackStatusBeta,
|
|
152
|
+
WithValue,
|
|
145
153
|
adaptEnum,
|
|
146
154
|
asBeta,
|
|
147
155
|
configuredSharedTreeBeta,
|
|
@@ -120,6 +120,7 @@ export {
|
|
|
120
120
|
ObjectSchemaOptions,
|
|
121
121
|
PopUnion,
|
|
122
122
|
RecordNodeInsertableData,
|
|
123
|
+
RunTransactionParamsBeta,
|
|
123
124
|
SchemaFactoryBeta,
|
|
124
125
|
SchemaStaticsBeta,
|
|
125
126
|
SchemaUpgrade,
|
|
@@ -128,6 +129,11 @@ export {
|
|
|
128
129
|
SnapshotSchemaCompatibilityOptions,
|
|
129
130
|
System_TableSchema,
|
|
130
131
|
TableSchema,
|
|
132
|
+
TransactionCallbackStatusBeta,
|
|
133
|
+
TransactionResultFailed,
|
|
134
|
+
TransactionResultSuccess,
|
|
135
|
+
TransactionValueResult,
|
|
136
|
+
TransactionVoidResult,
|
|
131
137
|
TreeBeta,
|
|
132
138
|
TreeBranch,
|
|
133
139
|
TreeChangeEventsBeta,
|
|
@@ -142,6 +148,8 @@ export {
|
|
|
142
148
|
UnannotateAllowedTypesList,
|
|
143
149
|
UnannotateAllowedTypesListUnsafe,
|
|
144
150
|
UnionToTuple,
|
|
151
|
+
VoidTransactionCallbackStatusBeta,
|
|
152
|
+
WithValue,
|
|
145
153
|
adaptEnum,
|
|
146
154
|
asBeta,
|
|
147
155
|
configuredSharedTreeBeta,
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert, unreachableCase, oob } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type {
|
|
8
|
-
IIdCompressor,
|
|
9
8
|
OpSpaceCompressedId,
|
|
10
|
-
|
|
9
|
+
SessionSpaceCompressedId,
|
|
11
10
|
} from "@fluidframework/id-compressor";
|
|
12
|
-
import { isFinalId } from "@fluidframework/id-compressor/internal";
|
|
13
|
-
import { v5 as uuidV5 } from "uuid";
|
|
14
11
|
|
|
15
12
|
import { DiscriminatedUnionDispatcher } from "../../../codec/index.js";
|
|
16
13
|
import type {
|
|
@@ -19,7 +16,12 @@ import type {
|
|
|
19
16
|
Value,
|
|
20
17
|
TreeChunk,
|
|
21
18
|
} from "../../../core/index.js";
|
|
22
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
assertValidIndex,
|
|
21
|
+
brand,
|
|
22
|
+
decompressIdentifierIfNeeded,
|
|
23
|
+
type IdDecodingContext,
|
|
24
|
+
} from "../../../util/index.js";
|
|
23
25
|
import { BasicChunk } from "../basicChunk.js";
|
|
24
26
|
import { emptyChunk } from "../emptyChunk.js";
|
|
25
27
|
import { SequenceChunk } from "../sequenceChunk.js";
|
|
@@ -39,8 +41,7 @@ import {
|
|
|
39
41
|
decode as genericDecode,
|
|
40
42
|
readStreamIdentifier,
|
|
41
43
|
} from "./chunkDecodingGeneric.js";
|
|
42
|
-
|
|
43
|
-
import type { FieldBatchEncodingContext, IncrementalDecoder } from "./codecs.js";
|
|
44
|
+
import type { IncrementalDecoder } from "./codecs.js";
|
|
44
45
|
import {
|
|
45
46
|
type EncodedAnyShape,
|
|
46
47
|
type EncodedChunkShape,
|
|
@@ -58,32 +59,6 @@ import {
|
|
|
58
59
|
supportsIncrementalEncoding,
|
|
59
60
|
} from "./format/index.js";
|
|
60
61
|
|
|
61
|
-
export interface IdDecodingContext {
|
|
62
|
-
idCompressor: IIdCompressor;
|
|
63
|
-
/**
|
|
64
|
-
* The creator of any local Ids to be decoded.
|
|
65
|
-
*/
|
|
66
|
-
originatorId: SessionId;
|
|
67
|
-
/**
|
|
68
|
-
* {@inheritdoc FieldBatchEncodingContext.isSummary}
|
|
69
|
-
*/
|
|
70
|
-
isSummary: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* See {@link FieldBatchEncodingContext.healUnresolvableIdentifiersOnDecode}.
|
|
73
|
-
*/
|
|
74
|
-
healUnresolvableIdentifiersOnDecode?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* See {@link FieldBatchEncodingContext.sharedObjectId}.
|
|
77
|
-
*/
|
|
78
|
-
sharedObjectId?: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Random v4 UUID generated as a namespace for the "heal an unresolvable identifier into a stable UUID"
|
|
83
|
-
* path in {@link readValue}. This scheme requires consensus across all clients to function.
|
|
84
|
-
*/
|
|
85
|
-
const healingNamespace = "f8a89df3-6882-400f-b913-4c1f6f0157bd";
|
|
86
|
-
|
|
87
62
|
/**
|
|
88
63
|
* Decode `chunk` into a TreeChunk.
|
|
89
64
|
*/
|
|
@@ -281,45 +256,20 @@ export function readValue(
|
|
|
281
256
|
typeof streamValue === "number" || typeof streamValue === "string",
|
|
282
257
|
0x997 /* identifier must be string or number. */,
|
|
283
258
|
);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
//
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
// Documents written before the encode-side fix for non-finalized identifier
|
|
299
|
-
// values can persist negative op-space IDs that are no
|
|
300
|
-
// longer resolvable once the originating session's local state has been stripped.
|
|
301
|
-
// When loading such a summary with the heal-on-decode option on, synthesize a deterministic
|
|
302
|
-
// stable UUID so all readers of the same blob agree on the resulting value.
|
|
303
|
-
//
|
|
304
|
-
// The heal path is intentionally restricted to summary loads — an
|
|
305
|
-
// unresolvable ID encountered while applying an op should still surface as
|
|
306
|
-
// an error, since it indicates a real bug rather than a recoverable state.
|
|
307
|
-
return uuidV5(
|
|
308
|
-
`${idDecodingContext.sharedObjectId}|${streamValue}`,
|
|
309
|
-
healingNamespace,
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
// See `SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode` for details on this error.
|
|
313
|
-
throw new Error(
|
|
314
|
-
"Summary could not be loaded due incorrectly encoded identifier. See SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode for mitigation.",
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
return idCompressor.decompress(
|
|
318
|
-
idCompressor.normalizeToSessionSpace(
|
|
319
|
-
streamValue as OpSpaceCompressedId,
|
|
320
|
-
idDecodingContext.originatorId,
|
|
321
|
-
),
|
|
322
|
-
);
|
|
259
|
+
// Strings (StableId UUIDs, heal-synthesized v5 UUIDs, or arbitrary user
|
|
260
|
+
// identifier strings) are already in the stored form and pass through.
|
|
261
|
+
// Op-space compressed ids are resolved by the caller-supplied
|
|
262
|
+
// `resolveEncodedId`, which encapsulates the originator lookup, finalized-id
|
|
263
|
+
// normalization, and (for the forest summarizer's heal path) UUIDv5 synthesis.
|
|
264
|
+
const sessionIdOrString: SessionSpaceCompressedId | string =
|
|
265
|
+
typeof streamValue === "string"
|
|
266
|
+
? streamValue
|
|
267
|
+
: idDecodingContext.resolveEncodedId(streamValue as OpSpaceCompressedId);
|
|
268
|
+
// Performance:
|
|
269
|
+
// Currently, we just fully expand the identifier here rather than keeping it in the SessionSpaceCompressedId format.
|
|
270
|
+
// Avoiding this expansion, and keeping the in memory format using SessionSpaceCompressedId would be a good optimization for the future.
|
|
271
|
+
// Keeping this optimization possible is why `resolveEncodedId` doesn't simply return a string.
|
|
272
|
+
return decompressIdentifierIfNeeded(sessionIdOrString, idDecodingContext.idCompressor);
|
|
323
273
|
} else {
|
|
324
274
|
// EncodedCounter case:
|
|
325
275
|
unreachableCase(shape, "decoding values as deltas is not yet supported");
|