@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
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
} from "../core/index.js";
|
|
46
46
|
import {
|
|
47
47
|
DetachedFieldIndexSummarizer,
|
|
48
|
+
FieldBatchDecodingContext,
|
|
48
49
|
FieldKinds,
|
|
49
50
|
ForestSummarizer,
|
|
50
51
|
SchemaSummarizer,
|
|
@@ -58,6 +59,7 @@ import {
|
|
|
58
59
|
jsonableTreeFromFieldCursor,
|
|
59
60
|
makeMitigatedChangeFamily,
|
|
60
61
|
makeTreeChunker,
|
|
62
|
+
type FieldBatchEncodingContext,
|
|
61
63
|
type IncrementalEncodingPolicy,
|
|
62
64
|
} from "../feature-libraries/index.js";
|
|
63
65
|
import { schemaCodecBuilder } from "../feature-libraries/index.js";
|
|
@@ -235,24 +237,29 @@ export class SharedTreeKernel
|
|
|
235
237
|
);
|
|
236
238
|
const fieldBatchCodec = fieldBatchCodecBuilder.build(options);
|
|
237
239
|
|
|
238
|
-
const encoderContext = {
|
|
240
|
+
const encoderContext: FieldBatchEncodingContext = {
|
|
239
241
|
schema: {
|
|
240
242
|
schema,
|
|
241
243
|
policy: defaultSchemaPolicy,
|
|
242
244
|
},
|
|
243
245
|
encodeType: options.treeEncodeType,
|
|
244
|
-
originatorId: idCompressor.localSessionId,
|
|
245
246
|
idCompressor,
|
|
246
247
|
// ForestSummarizer is the only consumer of this context, and it
|
|
247
248
|
// only invokes the codec in summary encode / load paths.
|
|
248
249
|
isSummary: true,
|
|
249
|
-
healUnresolvableIdentifiersOnDecode: options.healUnresolvableIdentifiersOnDecode,
|
|
250
|
-
sharedObjectId: sharedObject.id,
|
|
251
250
|
};
|
|
251
|
+
const decoderContext = FieldBatchDecodingContext.forSummary({
|
|
252
|
+
idCompressor,
|
|
253
|
+
healing:
|
|
254
|
+
options.healUnresolvableIdentifiersOnDecode === true
|
|
255
|
+
? { sharedObjectId: sharedObject.id }
|
|
256
|
+
: undefined,
|
|
257
|
+
});
|
|
252
258
|
const forestSummarizer = new ForestSummarizer(
|
|
253
259
|
forest,
|
|
254
260
|
revisionTagCodec,
|
|
255
261
|
encoderContext,
|
|
262
|
+
decoderContext,
|
|
256
263
|
options,
|
|
257
264
|
idCompressor,
|
|
258
265
|
initialSequenceNumber,
|
|
@@ -329,6 +336,7 @@ export class SharedTreeKernel
|
|
|
329
336
|
viewWith: this.viewWith.bind(this),
|
|
330
337
|
viewSharedBranchWith: this.viewBranchWith.bind(this),
|
|
331
338
|
createSharedBranch: this.createSharedBranch.bind(this),
|
|
339
|
+
getSharedBranchName: this.getSharedBranchName.bind(this),
|
|
332
340
|
getSharedBranchIds: this.getSharedBranchIds.bind(this),
|
|
333
341
|
kernel: this,
|
|
334
342
|
};
|
|
@@ -603,6 +611,11 @@ export interface SharedTreeOptionsBeta extends ForestOptions, Partial<CodecWrite
|
|
|
603
611
|
* "Unresolvable" in the public-facing remarks corresponds to non-finalized short IDs persisted without
|
|
604
612
|
* any corresponding context for their originating session. See id-compressor internal documentation
|
|
605
613
|
* for more details.
|
|
614
|
+
*
|
|
615
|
+
* Internally this boolean is translated into {@link IdentifierHealingConfig} once the shared-object
|
|
616
|
+
* id is known (in `SharedTreeCore`'s constructor) and threaded through the codec contexts as a
|
|
617
|
+
* single `healing?` field from there on. The presence/absence of that config is the heal-on/heal-off
|
|
618
|
+
* discriminator inside the codec layer.
|
|
606
619
|
*/
|
|
607
620
|
readonly healUnresolvableIdentifiersOnDecode?: boolean;
|
|
608
621
|
}
|
|
@@ -627,6 +640,20 @@ export interface SharedTreeOptions
|
|
|
627
640
|
* See {@link IncrementalEncodingPolicy}.
|
|
628
641
|
*/
|
|
629
642
|
shouldEncodeIncrementally?: IncrementalEncodingPolicy;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* When `true`, prevents trunk commits from being trimmed/evicted, even after they fall outside
|
|
646
|
+
* the collaboration window.
|
|
647
|
+
*
|
|
648
|
+
* @defaultValue `false`
|
|
649
|
+
*
|
|
650
|
+
* @remarks
|
|
651
|
+
* By default, SharedTree evicts trunk commits once all peers have acknowledged them (i.e. once they
|
|
652
|
+
* are outside the collaboration window), and they are not otherwise retained (e.g. by revertibles or
|
|
653
|
+
* local branches), to bound memory usage. Enabling this flag retains the full trunk history for the
|
|
654
|
+
* lifetime of the client, which increases memory usage over time and should be used with care.
|
|
655
|
+
*/
|
|
656
|
+
readonly retainHistory?: boolean;
|
|
630
657
|
}
|
|
631
658
|
|
|
632
659
|
export interface SharedTreeOptionsInternal
|
|
@@ -759,6 +786,7 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
|
759
786
|
healUnresolvableIdentifiersOnDecode: false,
|
|
760
787
|
writeVersionOverrides: new Map(),
|
|
761
788
|
allowPossiblyIncompatibleWriteVersionOverrides: false,
|
|
789
|
+
retainHistory: false,
|
|
762
790
|
};
|
|
763
791
|
|
|
764
792
|
/**
|
|
@@ -245,7 +245,13 @@ export function hasSchemaChange(change: SharedTreeChange): boolean {
|
|
|
245
245
|
return change.changes.some((innerChange) => innerChange.type === "schema");
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Applies a mapping function to all data changes within a {@link SharedTreeChange}.
|
|
250
|
+
* @param change - The change to map over.
|
|
251
|
+
* @param map - The mapping function to apply to each data change.
|
|
252
|
+
* @returns A new {@link SharedTreeChange} with the mapped data changes.
|
|
253
|
+
*/
|
|
254
|
+
export function mapDataChanges(
|
|
249
255
|
change: SharedTreeChange,
|
|
250
256
|
map: (change: ModularChangeset) => ModularChangeset,
|
|
251
257
|
): SharedTreeChange {
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { fieldKinds, minimizeModularChangeset } from "../feature-libraries/index.js";
|
|
9
|
+
import { ChangeProcessorApplicability } from "../shared-tree-core/index.js";
|
|
10
|
+
import type { TransactionPostProcessor } from "../simple-tree/index.js";
|
|
11
|
+
|
|
12
|
+
import { mapDataChanges } from "./sharedTreeChangeFamily.js";
|
|
13
|
+
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
14
|
+
import { createTransactionPostProcessor } from "./transactionPostProcessor.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* "Minimizes" a {@link SharedTreeChange} so that it contains no extraneous
|
|
18
|
+
* information, i.e. no data that has no net effect on the document.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This iterates over the change's constituent {@link ModularChangeset}s,
|
|
22
|
+
* replacing each with its {@link minimizeModularChangeset | minimized} form.
|
|
23
|
+
* At most one data change is allowed in the change currently as a limitation
|
|
24
|
+
* of the minimization implementation, so this function throws a UsageError
|
|
25
|
+
* if more than one data change is present.
|
|
26
|
+
*
|
|
27
|
+
* Schema changes are left unchanged.
|
|
28
|
+
*/
|
|
29
|
+
function minimizeSharedTreeChange(change: SharedTreeChange): SharedTreeChange {
|
|
30
|
+
const countOfDataChanges = change.changes.filter(
|
|
31
|
+
(innerChange) => innerChange.type === "data",
|
|
32
|
+
).length;
|
|
33
|
+
if (countOfDataChanges > 1) {
|
|
34
|
+
throw new UsageError(
|
|
35
|
+
`At most one edit group can be minimized, but ${countOfDataChanges} were found. To workaround this limitation, pair at most one content edit with any schema changes.`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return mapDataChanges(change, (dataChange) =>
|
|
39
|
+
minimizeModularChangeset(dataChange, fieldKinds),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A {@link TransactionPostProcessor | post-processor} that "minimizes" the change
|
|
45
|
+
* produced when a transaction is committed, so that the resulting squashed change
|
|
46
|
+
* contains no extraneous information.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* Supply this via {@link RunTransactionParamsAlpha.postProcessor} when {@link RunTransaction | running a transaction}.
|
|
50
|
+
* "Extraneous information" includes, for example, data for nodes that were both
|
|
51
|
+
* created and removed within the transaction, or changes whose effects cancel
|
|
52
|
+
* out to nothing. Minimizing the change reduces the size of the edit that is
|
|
53
|
+
* submitted to (and stored by) the service without altering the observable
|
|
54
|
+
* effect of the transaction.
|
|
55
|
+
*
|
|
56
|
+
* The current implementation is limited and is unable to guarantee that the
|
|
57
|
+
* resulting change is fully minimized if multiple distinct edit groups are
|
|
58
|
+
* present in the transaction. Transaction edit groups are divided by schema
|
|
59
|
+
* changes, so this limitation is only relevant for transactions that contain
|
|
60
|
+
* one or more schema changes and content edits on both sides. In such cases,
|
|
61
|
+
* the implementation will throw a usage error:
|
|
62
|
+
* "At most one edit group can be minimized..."
|
|
63
|
+
*
|
|
64
|
+
* @deprecated Note: minimization is not yet implemented. For now this is a
|
|
65
|
+
* no-op that leaves the squashed change unchanged, so supplying it currently
|
|
66
|
+
* has no observable effect beyond reserving the behavior. A real
|
|
67
|
+
* implementation will be provided in a future change.
|
|
68
|
+
*
|
|
69
|
+
* @alpha
|
|
70
|
+
*/
|
|
71
|
+
export const minimize: TransactionPostProcessor = createTransactionPostProcessor({
|
|
72
|
+
applicability: ChangeProcessorApplicability.IfOutermost,
|
|
73
|
+
processChange: minimizeSharedTreeChange,
|
|
74
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ChangeProcessor } from "../shared-tree-core/index.js";
|
|
7
|
+
import type { TransactionPostProcessor } from "../simple-tree/index.js";
|
|
8
|
+
|
|
9
|
+
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The internal representation of a {@link TransactionPostProcessor}: a {@link ChangeProcessor} over
|
|
13
|
+
* {@link SharedTreeChange}.
|
|
14
|
+
* @remarks This is the (non-type-erased) form used internally to apply a transaction's post-processor.
|
|
15
|
+
*/
|
|
16
|
+
export type TransactionPostProcessorInternal = ChangeProcessor<SharedTreeChange>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Type-erases an internal {@link TransactionPostProcessorInternal | change processor} as a public
|
|
20
|
+
* {@link TransactionPostProcessor}.
|
|
21
|
+
* @remarks This is the only sanctioned way to produce a {@link TransactionPostProcessor}. The inverse conversion is
|
|
22
|
+
* {@link extractTransactionChangeProcessor}.
|
|
23
|
+
*/
|
|
24
|
+
export function createTransactionPostProcessor(
|
|
25
|
+
processor: TransactionPostProcessorInternal,
|
|
26
|
+
): TransactionPostProcessor {
|
|
27
|
+
return processor as unknown as TransactionPostProcessor;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Recovers the internal {@link TransactionPostProcessorInternal | change processor} from a type-erased
|
|
32
|
+
* {@link TransactionPostProcessor}.
|
|
33
|
+
* @remarks This reverses {@link createTransactionPostProcessor}. It is assumed that only code which produces these
|
|
34
|
+
* type-erased handles performs this conversion, allowing them to be treated as opaque elsewhere.
|
|
35
|
+
*/
|
|
36
|
+
export function extractTransactionChangeProcessor(
|
|
37
|
+
postProcessor: TransactionPostProcessor | undefined,
|
|
38
|
+
): TransactionPostProcessorInternal | undefined {
|
|
39
|
+
return postProcessor as unknown as TransactionPostProcessorInternal;
|
|
40
|
+
}
|
|
@@ -952,10 +952,10 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
952
952
|
const context: FieldBatchEncodingContext = {
|
|
953
953
|
encodeType: TreeCompressionStrategy.Compressed,
|
|
954
954
|
idCompressor,
|
|
955
|
-
originatorId: idCompressor.localSessionId, // TODO: Why is this needed?
|
|
956
955
|
schema: { schema: storedSchema, policy: defaultSchemaPolicy },
|
|
957
|
-
//
|
|
958
|
-
|
|
956
|
+
// Encode using summary-style identifier rules so the payload can be decoded
|
|
957
|
+
// without any originator session context.
|
|
958
|
+
isSummary: true,
|
|
959
959
|
};
|
|
960
960
|
const result = codec.encode(batch, context);
|
|
961
961
|
// TODO: codecs should better track which ones can contain handles, and which cannot. When done properly, casts like this can be removed.
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
7
7
|
import type { IFluidHandle, Listenable } from "@fluidframework/core-interfaces/internal";
|
|
8
8
|
import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
9
|
-
import type { IIdCompressor
|
|
10
|
-
import { isStableId } from "@fluidframework/id-compressor/internal";
|
|
9
|
+
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
11
10
|
import { type TelemetryLoggerExt, UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
12
11
|
|
|
13
12
|
import {
|
|
@@ -52,12 +51,12 @@ import {
|
|
|
52
51
|
type ChangeMetadata,
|
|
53
52
|
type LabelTree,
|
|
54
53
|
type TransactionLabels,
|
|
55
|
-
type ChangeEncodingContext,
|
|
56
54
|
type ReadOnlyDetachedFieldIndex,
|
|
57
55
|
makeAnonChange,
|
|
58
56
|
type TaggedChange,
|
|
59
57
|
deltaFieldMapHasVisibleChanges,
|
|
60
58
|
findCommonAncestor,
|
|
59
|
+
rebaseBranch,
|
|
61
60
|
} from "../core/index.js";
|
|
62
61
|
import {
|
|
63
62
|
type FieldBatchCodec,
|
|
@@ -76,6 +75,7 @@ import {
|
|
|
76
75
|
SharedTreeBranch,
|
|
77
76
|
TransactionResult as InternalTransactionResult,
|
|
78
77
|
type SharedTreeBranchChange,
|
|
78
|
+
type SquashingTransactionOptions,
|
|
79
79
|
type Transactor,
|
|
80
80
|
} from "../shared-tree-core/index.js";
|
|
81
81
|
import {
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
type TreeBranch,
|
|
89
89
|
type TreeBranchAlpha,
|
|
90
90
|
type VerboseTree,
|
|
91
|
-
type
|
|
92
|
-
type
|
|
93
|
-
type
|
|
94
|
-
type
|
|
95
|
-
type
|
|
91
|
+
type VoidTransactionCallbackStatusAlpha,
|
|
92
|
+
type TransactionCallbackStatusAlpha,
|
|
93
|
+
type TransactionVoidResult,
|
|
94
|
+
type TransactionValueResult,
|
|
95
|
+
type RunTransactionParamsAlpha,
|
|
96
96
|
type TransactionConstraintAlpha,
|
|
97
97
|
type TreeViewAlpha,
|
|
98
98
|
getInnerNode,
|
|
@@ -117,6 +117,8 @@ import { SharedTreeChangeEnricher } from "./sharedTreeChangeEnricher.js";
|
|
|
117
117
|
import { SharedTreeChangeFamily, hasSchemaChange } from "./sharedTreeChangeFamily.js";
|
|
118
118
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
119
119
|
import type { ISharedTreeEditor, SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
120
|
+
import { extractTransactionChangeProcessor } from "./transactionPostProcessor.js";
|
|
121
|
+
import { SerializedChange } from "./serializedChange.js";
|
|
120
122
|
|
|
121
123
|
/**
|
|
122
124
|
* Yields all defined (non-`undefined`) labels from a {@link LabelTree}, depth-first.
|
|
@@ -205,6 +207,11 @@ export interface CheckoutEvents {
|
|
|
205
207
|
dispose(): void;
|
|
206
208
|
}
|
|
207
209
|
|
|
210
|
+
/**
|
|
211
|
+
* A collection of functions for managing transactions on a {@link ITreeCheckout}.
|
|
212
|
+
*/
|
|
213
|
+
export type TreeTransactor = Transactor<SquashingTransactionOptions<SharedTreeChange>>;
|
|
214
|
+
|
|
208
215
|
/**
|
|
209
216
|
* Provides a means for interacting with a SharedTree.
|
|
210
217
|
* This includes reading data from the tree and running transactions to mutate the tree.
|
|
@@ -251,13 +258,13 @@ export interface ITreeCheckout
|
|
|
251
258
|
/**
|
|
252
259
|
* A collection of functions for managing transactions.
|
|
253
260
|
*/
|
|
254
|
-
readonly transaction:
|
|
261
|
+
readonly transaction: TreeTransactor;
|
|
255
262
|
|
|
256
263
|
fork(): ITreeCheckout;
|
|
257
264
|
|
|
258
265
|
/**
|
|
259
|
-
* Replaces all
|
|
260
|
-
* Can
|
|
266
|
+
* Replaces all schemas with the provided schema.
|
|
267
|
+
* Can overwrite preexisting schemas, and removes unmentioned schemas.
|
|
261
268
|
*
|
|
262
269
|
* @param newSchema - The new schema to replace the existing schema.
|
|
263
270
|
* @param allowNonSupersetSchema - Whether to allow non-superset schemas.
|
|
@@ -310,7 +317,7 @@ export function createTreeCheckout(
|
|
|
310
317
|
codecOptions?: Partial<CodecWriteOptions>;
|
|
311
318
|
},
|
|
312
319
|
): TreeCheckout {
|
|
313
|
-
const breaker = args?.breaker ?? new Breakable("TreeCheckout");
|
|
320
|
+
const breaker = args?.breaker ?? new Breakable("TreeCheckout", args?.logger);
|
|
314
321
|
const schema = args?.schema ?? new TreeStoredSchemaRepository();
|
|
315
322
|
const forest = args?.forest ?? buildForest(breaker, schema);
|
|
316
323
|
const defaultCodecOptions: CodecWriteOptions = {
|
|
@@ -390,7 +397,7 @@ function getCheckout(context: TreeBranch): TreeCheckout {
|
|
|
390
397
|
* @param constraintsOnRevert - If true, use {@link ISharedTreeEditor.addNodeExistsConstraintOnRevert}.
|
|
391
398
|
* @param constraints - The constraints to add to the transaction.
|
|
392
399
|
*
|
|
393
|
-
* @see {@link
|
|
400
|
+
* @see {@link RunTransactionParamsAlpha.preconditions}.
|
|
394
401
|
*/
|
|
395
402
|
export function addConstraintsToTransaction(
|
|
396
403
|
checkout: ITreeCheckout,
|
|
@@ -483,9 +490,9 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
483
490
|
private readonly views = new Set<TreeView<ImplicitFieldSchema>>();
|
|
484
491
|
|
|
485
492
|
/**
|
|
486
|
-
*
|
|
493
|
+
* Revertibles maintained for automatic disposal
|
|
487
494
|
*/
|
|
488
|
-
private readonly revertibles = new
|
|
495
|
+
private readonly revertibles = new Map<RevisionTag, RevertibleAlpha>();
|
|
489
496
|
|
|
490
497
|
/**
|
|
491
498
|
* Each branch's head commit corresponds to a revertible commit.
|
|
@@ -523,7 +530,8 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
523
530
|
),
|
|
524
531
|
/** Optional logger for telemetry. */
|
|
525
532
|
private readonly logger?: TelemetryLoggerExt,
|
|
526
|
-
public readonly breaker: Breakable = new Breakable("TreeCheckout"),
|
|
533
|
+
public readonly breaker: Breakable = new Breakable("TreeCheckout", logger),
|
|
534
|
+
public readonly disposeForksAfterTransaction = true,
|
|
527
535
|
) {
|
|
528
536
|
this.#transaction = this.createTransactionStack(branch);
|
|
529
537
|
this.editLock = new EditLock(this.#transaction.activeBranchEditor);
|
|
@@ -746,7 +754,7 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
746
754
|
revision,
|
|
747
755
|
this.#transaction.activeBranch.fork(commit),
|
|
748
756
|
);
|
|
749
|
-
this.revertibles.
|
|
757
|
+
this.revertibles.set(revision, revertible);
|
|
750
758
|
return revertible;
|
|
751
759
|
};
|
|
752
760
|
|
|
@@ -756,24 +764,16 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
756
764
|
kind,
|
|
757
765
|
isLocal: true,
|
|
758
766
|
getChange: () => {
|
|
759
|
-
const context: ChangeEncodingContext = {
|
|
760
|
-
idCompressor: this.idCompressor,
|
|
761
|
-
originatorId: this.idCompressor.localSessionId,
|
|
762
|
-
revision,
|
|
763
|
-
isSummary: false,
|
|
764
|
-
};
|
|
765
|
-
const encodedChange = this.changeFamily.codecs.resolve(4).encode(change, context);
|
|
766
|
-
|
|
767
767
|
assert(
|
|
768
768
|
commit.parent !== undefined,
|
|
769
769
|
0xca4 /* Expected applied commit to be parented */,
|
|
770
770
|
);
|
|
771
|
-
return
|
|
772
|
-
|
|
771
|
+
return SerializedChange.V1.encode(
|
|
772
|
+
this.idCompressor,
|
|
773
|
+
this.changeFamily,
|
|
774
|
+
change,
|
|
773
775
|
revision,
|
|
774
|
-
|
|
775
|
-
change: encodedChange,
|
|
776
|
-
} satisfies SerializedChange;
|
|
776
|
+
);
|
|
777
777
|
},
|
|
778
778
|
getRevertible: (onDisposed) => getRevertible?.(onDisposed),
|
|
779
779
|
label: this.labelTreeNode?.label,
|
|
@@ -785,6 +785,11 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
785
785
|
});
|
|
786
786
|
withinEventContext = false;
|
|
787
787
|
}
|
|
788
|
+
} else if (event.type === "remove") {
|
|
789
|
+
// Commits that are rolled back should no longer be revertible
|
|
790
|
+
for (const commit of event.removedCommits) {
|
|
791
|
+
this.revertibles.get(commit.revision)?.dispose();
|
|
792
|
+
}
|
|
788
793
|
} else if (this.isRemoteChangeEvent(event)) {
|
|
789
794
|
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
790
795
|
this.emitChangedLocked(() => {
|
|
@@ -847,24 +852,13 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
847
852
|
*/
|
|
848
853
|
@throwIfBroken
|
|
849
854
|
public applySerializedChange(serializedChange: JsonCompatibleReadOnly): void {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
throw new UsageError(
|
|
856
|
-
`Cannot apply change. A serialized changed must be applied to the same SharedTree as it was created from.`,
|
|
857
|
-
);
|
|
858
|
-
}
|
|
859
|
-
const context: ChangeEncodingContext = {
|
|
860
|
-
idCompressor: this.idCompressor,
|
|
861
|
-
originatorId: this.idCompressor.localSessionId,
|
|
862
|
-
revision,
|
|
863
|
-
isSummary: false,
|
|
864
|
-
};
|
|
865
|
-
const decodedChange = this.changeFamily.codecs.resolve(4).decode(change, context);
|
|
855
|
+
const change = SerializedChange.V1.decode(
|
|
856
|
+
this.idCompressor,
|
|
857
|
+
this.changeFamily,
|
|
858
|
+
serializedChange,
|
|
859
|
+
);
|
|
866
860
|
// Apply the change to the branch, but _not_ the `activeBranch` - we do not support squashing serialized commits in a transaction.
|
|
867
|
-
this.#transaction.branch.apply(
|
|
861
|
+
this.#transaction.branch.apply(change);
|
|
868
862
|
}
|
|
869
863
|
|
|
870
864
|
// #region TreeBranchAlpha
|
|
@@ -885,49 +879,52 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
885
879
|
}
|
|
886
880
|
|
|
887
881
|
public runTransaction<TSuccessValue, TFailureValue>(
|
|
888
|
-
transaction: () =>
|
|
889
|
-
params?:
|
|
890
|
-
):
|
|
882
|
+
transaction: () => TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>,
|
|
883
|
+
params?: RunTransactionParamsAlpha,
|
|
884
|
+
): TransactionValueResult<TSuccessValue, TFailureValue>;
|
|
891
885
|
public runTransaction(
|
|
892
|
-
transaction: () =>
|
|
893
|
-
params?:
|
|
894
|
-
):
|
|
886
|
+
transaction: () => VoidTransactionCallbackStatusAlpha | void,
|
|
887
|
+
params?: RunTransactionParamsAlpha,
|
|
888
|
+
): TransactionVoidResult;
|
|
895
889
|
@breakingMethod
|
|
896
890
|
public runTransaction<TSuccessValue, TFailureValue>(
|
|
897
891
|
transaction: () =>
|
|
898
|
-
|
|
|
899
|
-
|
|
|
892
|
+
| TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>
|
|
893
|
+
| VoidTransactionCallbackStatusAlpha
|
|
900
894
|
| void,
|
|
901
|
-
params?:
|
|
902
|
-
):
|
|
895
|
+
params?: RunTransactionParamsAlpha,
|
|
896
|
+
): TransactionValueResult<TSuccessValue, TFailureValue> | TransactionVoidResult {
|
|
903
897
|
this.mountTransaction(params, false);
|
|
904
898
|
const transactionCallbackStatus = transaction();
|
|
905
899
|
return this.unmountTransaction(transactionCallbackStatus, params);
|
|
906
900
|
}
|
|
907
901
|
|
|
908
902
|
public runTransactionAsync<TSuccessValue, TFailureValue>(
|
|
909
|
-
transaction: () => Promise<
|
|
910
|
-
params?:
|
|
911
|
-
): Promise<
|
|
903
|
+
transaction: () => Promise<TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>>,
|
|
904
|
+
params?: RunTransactionParamsAlpha,
|
|
905
|
+
): Promise<TransactionValueResult<TSuccessValue, TFailureValue>>;
|
|
912
906
|
public runTransactionAsync(
|
|
913
|
-
transaction: () => Promise<
|
|
914
|
-
params?:
|
|
915
|
-
): Promise<
|
|
907
|
+
transaction: () => Promise<VoidTransactionCallbackStatusAlpha | void>,
|
|
908
|
+
params?: RunTransactionParamsAlpha,
|
|
909
|
+
): Promise<TransactionVoidResult>;
|
|
916
910
|
@breakingMethod
|
|
917
911
|
public async runTransactionAsync<TSuccessValue, TFailureValue>(
|
|
918
912
|
transaction: () => Promise<
|
|
919
|
-
|
|
|
920
|
-
|
|
|
913
|
+
| TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>
|
|
914
|
+
| VoidTransactionCallbackStatusAlpha
|
|
921
915
|
| void
|
|
922
916
|
>,
|
|
923
|
-
params:
|
|
924
|
-
): Promise<
|
|
917
|
+
params: RunTransactionParamsAlpha | undefined,
|
|
918
|
+
): Promise<TransactionValueResult<TSuccessValue, TFailureValue> | TransactionVoidResult> {
|
|
925
919
|
this.mountTransaction(params, true);
|
|
926
920
|
const transactionCallbackStatus = await transaction();
|
|
927
921
|
return this.unmountTransaction(transactionCallbackStatus, params);
|
|
928
922
|
}
|
|
929
923
|
|
|
930
|
-
private mountTransaction(
|
|
924
|
+
private mountTransaction(
|
|
925
|
+
params: RunTransactionParamsAlpha | undefined,
|
|
926
|
+
isAsync: boolean,
|
|
927
|
+
): void {
|
|
931
928
|
this.checkNotDisposed();
|
|
932
929
|
// Starting a transaction is an edit, so it is forbidden from within a change-event
|
|
933
930
|
// callback (where the edit lock is held), the same as direct edits. For the async
|
|
@@ -944,22 +941,24 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
944
941
|
);
|
|
945
942
|
}
|
|
946
943
|
this.pushLabelFrame(params?.label);
|
|
947
|
-
this.transaction.start(
|
|
944
|
+
this.transaction.start({
|
|
945
|
+
postProcessor: extractTransactionChangeProcessor(params?.postProcessor),
|
|
946
|
+
});
|
|
948
947
|
|
|
949
948
|
addConstraintsToTransaction(this, false, params?.preconditions);
|
|
950
949
|
}
|
|
951
950
|
|
|
952
951
|
private unmountTransaction<TSuccessValue, TFailureValue>(
|
|
953
952
|
transactionCallbackStatus:
|
|
954
|
-
|
|
|
955
|
-
|
|
|
953
|
+
| TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>
|
|
954
|
+
| VoidTransactionCallbackStatusAlpha
|
|
956
955
|
| void,
|
|
957
|
-
params:
|
|
958
|
-
):
|
|
956
|
+
params: RunTransactionParamsAlpha | undefined,
|
|
957
|
+
): TransactionValueResult<TSuccessValue, TFailureValue> | TransactionVoidResult {
|
|
959
958
|
this.checkNotDisposed();
|
|
960
959
|
const rollback = transactionCallbackStatus?.rollback;
|
|
961
960
|
const value = (
|
|
962
|
-
transactionCallbackStatus as
|
|
961
|
+
transactionCallbackStatus as TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>
|
|
963
962
|
)?.value;
|
|
964
963
|
|
|
965
964
|
if (rollback === true) {
|
|
@@ -1127,7 +1126,7 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
1127
1126
|
"Unable to dispose a revertible that has already been disposed.",
|
|
1128
1127
|
);
|
|
1129
1128
|
}
|
|
1130
|
-
checkout.disposeRevertible(
|
|
1129
|
+
checkout.disposeRevertible(revision);
|
|
1131
1130
|
onRevertibleDisposed?.(revertible);
|
|
1132
1131
|
},
|
|
1133
1132
|
};
|
|
@@ -1175,7 +1174,7 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
1175
1174
|
return this.forest.anchors.locate(anchor);
|
|
1176
1175
|
}
|
|
1177
1176
|
|
|
1178
|
-
public get transaction():
|
|
1177
|
+
public get transaction(): TreeTransactor {
|
|
1179
1178
|
return this.#transaction;
|
|
1180
1179
|
}
|
|
1181
1180
|
/**
|
|
@@ -1202,7 +1201,7 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
1202
1201
|
|
|
1203
1202
|
const branch = this.#transaction.activeBranch.fork();
|
|
1204
1203
|
const storedSchema = this.storedSchema.clone();
|
|
1205
|
-
const forkBreaker = new Breakable("TreeCheckout");
|
|
1204
|
+
const forkBreaker = new Breakable("TreeCheckout", this.logger);
|
|
1206
1205
|
const forest = this.forest.clone(storedSchema, forkBreaker);
|
|
1207
1206
|
const checkout = new TreeCheckout(
|
|
1208
1207
|
branch,
|
|
@@ -1291,6 +1290,30 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
1291
1290
|
return targetPath.length > 0;
|
|
1292
1291
|
}
|
|
1293
1292
|
|
|
1293
|
+
public computeNetChangeIfRebasedOnto(
|
|
1294
|
+
branch: TreeBranch,
|
|
1295
|
+
): JsonCompatibleReadOnly | undefined {
|
|
1296
|
+
const branchCheckout = getCheckout(branch);
|
|
1297
|
+
const rebased = rebaseBranch(
|
|
1298
|
+
this.mintRevisionTag,
|
|
1299
|
+
this.changeFamily.rebaser,
|
|
1300
|
+
this.#transaction.branch.getHead(),
|
|
1301
|
+
branchCheckout.#transaction.branch.getHead(),
|
|
1302
|
+
);
|
|
1303
|
+
|
|
1304
|
+
if (rebased.sourceChange === undefined) {
|
|
1305
|
+
return undefined;
|
|
1306
|
+
}
|
|
1307
|
+
const revision = this.mintRevisionTag();
|
|
1308
|
+
return SerializedChange.V1.encode(
|
|
1309
|
+
this.idCompressor,
|
|
1310
|
+
this.changeFamily,
|
|
1311
|
+
rebased.sourceChange,
|
|
1312
|
+
revision,
|
|
1313
|
+
undefined,
|
|
1314
|
+
);
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1294
1317
|
public merge(branch: TreeBranch): void;
|
|
1295
1318
|
public merge(branch: TreeBranch, disposeMerged: boolean): void;
|
|
1296
1319
|
public merge(branch: TreeBranch, disposeMerged = true): void {
|
|
@@ -1380,15 +1403,15 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
1380
1403
|
}
|
|
1381
1404
|
|
|
1382
1405
|
private purgeRevertibles(): void {
|
|
1383
|
-
for (const revertible of this.revertibles) {
|
|
1406
|
+
for (const revertible of this.revertibles.values()) {
|
|
1384
1407
|
revertible.dispose();
|
|
1385
1408
|
}
|
|
1386
1409
|
}
|
|
1387
1410
|
|
|
1388
|
-
private disposeRevertible(
|
|
1411
|
+
private disposeRevertible(revision: RevisionTag): void {
|
|
1389
1412
|
this.revertibleCommitBranches.get(revision)?.dispose();
|
|
1390
1413
|
this.revertibleCommitBranches.delete(revision);
|
|
1391
|
-
this.revertibles.delete(
|
|
1414
|
+
this.revertibles.delete(revision);
|
|
1392
1415
|
}
|
|
1393
1416
|
|
|
1394
1417
|
private revertRevertible(
|
|
@@ -1753,27 +1776,6 @@ function verboseFromCursor(
|
|
|
1753
1776
|
};
|
|
1754
1777
|
}
|
|
1755
1778
|
|
|
1756
|
-
interface SerializedChange {
|
|
1757
|
-
version: 1;
|
|
1758
|
-
revision: RevisionTag;
|
|
1759
|
-
change: JsonCompatibleReadOnly;
|
|
1760
|
-
originatorId: SessionId;
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
function isSerializedChange(value: unknown): value is SerializedChange {
|
|
1764
|
-
if (typeof value !== "object" || value === null) {
|
|
1765
|
-
return false;
|
|
1766
|
-
}
|
|
1767
|
-
const change = value as Partial<SerializedChange>;
|
|
1768
|
-
return (
|
|
1769
|
-
change.version === 1 &&
|
|
1770
|
-
(change.revision === "root" || typeof change.revision === "number") &&
|
|
1771
|
-
typeof change.originatorId === "string" &&
|
|
1772
|
-
isStableId(change.originatorId) &&
|
|
1773
|
-
change.change !== undefined
|
|
1774
|
-
);
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
1779
|
/**
|
|
1778
1780
|
* Enumerates through a shared tree change, looking for schema change and field changes that result in visible changes to the tree (e.g. an insert, move, delete).
|
|
1779
1781
|
* This function also considers changes to detached roots to be visible changes, but not renames of roots or builds of new roots.
|