@fluidframework/tree 2.111.0 → 2.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +145 -0
- package/api-report/tree.alpha.api.md +48 -5
- package/api-report/tree.beta.api.md +1 -1
- package/api-report/tree.legacy.beta.api.md +1 -1
- package/api-report/tree.legacy.public.api.md +1 -1
- package/api-report/tree.public.api.md +1 -1
- package/dist/componentApi.d.ts +198 -0
- package/dist/componentApi.d.ts.map +1 -0
- package/dist/componentApi.js +138 -0
- package/dist/componentApi.js.map +1 -0
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +4 -2
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -16
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +3 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
- package/dist/feature-libraries/schemaChecker.d.ts +22 -3
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +48 -5
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +17 -4
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +11 -5
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +3 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +1 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +6 -3
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/serializedChange.d.ts +41 -0
- package/dist/shared-tree/serializedChange.d.ts.map +1 -0
- package/dist/shared-tree/serializedChange.js +87 -0
- package/dist/shared-tree/serializedChange.js.map +1 -0
- package/dist/shared-tree/sharedTree.d.ts +13 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +2 -0
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts +35 -0
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
- package/dist/shared-tree/transactionMinimize.js +65 -0
- package/dist/shared-tree/transactionMinimize.js.map +1 -0
- package/dist/shared-tree/treeCheckout.d.ts +3 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +36 -62
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +6 -3
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +35 -14
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +1 -1
- package/dist/shared-tree-core/messageFormat.js +1 -1
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageTypes.d.ts +1 -0
- package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/messageTypes.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +24 -11
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +16 -2
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -44
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +1 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +1 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +22 -2
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +2 -2
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +2 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/treeFactory.js +1 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +16 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +9 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/compressedIds.d.ts +69 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +32 -1
- package/dist/util/compressedIds.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +16 -3
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/nestedSet.d.ts +1 -1
- package/dist/util/nestedSet.d.ts.map +1 -1
- package/dist/util/nestedSet.js.map +1 -1
- package/dist/util/utils.d.ts +0 -6
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +1 -15
- package/dist/util/utils.js.map +1 -1
- package/lib/componentApi.d.ts +198 -0
- package/lib/componentApi.d.ts.map +1 -0
- package/lib/componentApi.js +135 -0
- package/lib/componentApi.js.map +1 -0
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -17
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -0
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
- package/lib/feature-libraries/schemaChecker.d.ts +22 -3
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/schemaChecker.js +48 -5
- package/lib/feature-libraries/schemaChecker.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +17 -4
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +9 -3
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -0
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +1 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +7 -4
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/serializedChange.d.ts +41 -0
- package/lib/shared-tree/serializedChange.d.ts.map +1 -0
- package/lib/shared-tree/serializedChange.js +84 -0
- package/lib/shared-tree/serializedChange.js.map +1 -0
- package/lib/shared-tree/sharedTree.d.ts +13 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +2 -0
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts +35 -0
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
- package/lib/shared-tree/transactionMinimize.js +62 -0
- package/lib/shared-tree/transactionMinimize.js.map +1 -0
- package/lib/shared-tree/treeCheckout.d.ts +3 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +18 -44
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +6 -3
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +36 -15
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +1 -1
- package/lib/shared-tree-core/messageFormat.js +1 -1
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageTypes.d.ts +1 -0
- package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/messageTypes.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +25 -12
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +16 -2
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +29 -42
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -3
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +2 -3
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +22 -2
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +2 -2
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/treeFactory.js +1 -1
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +16 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +9 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/compressedIds.d.ts +69 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +30 -0
- package/lib/util/compressedIds.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +17 -4
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/nestedSet.d.ts +1 -1
- package/lib/util/nestedSet.d.ts.map +1 -1
- package/lib/util/nestedSet.js.map +1 -1
- package/lib/util/utils.d.ts +0 -6
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +0 -13
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/componentApi.ts +354 -0
- package/src/entrypoints/alpha.ts +3 -0
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -27
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -44
- package/src/feature-libraries/index.ts +2 -0
- package/src/feature-libraries/modular-schema/index.ts +1 -0
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
- package/src/feature-libraries/schemaChecker.ts +86 -9
- package/src/index.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +35 -5
- package/src/shared-tree/index.ts +3 -0
- package/src/shared-tree/schematizingTreeView.ts +15 -5
- package/src/shared-tree/serializedChange.ts +127 -0
- package/src/shared-tree/sharedTree.ts +16 -0
- package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
- package/src/shared-tree/transactionMinimize.ts +74 -0
- package/src/shared-tree/treeCheckout.ts +42 -57
- package/src/shared-tree-core/editManager.ts +42 -6
- package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
- package/src/shared-tree-core/messageFormat.ts +1 -1
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
- package/src/shared-tree-core/messageTypes.ts +1 -0
- package/src/shared-tree-core/sharedTreeCore.ts +33 -10
- package/src/shared-tree-core/transaction.ts +19 -2
- package/src/simple-tree/api/index.ts +1 -1
- package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
- package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
- package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -3
- package/src/simple-tree/api/storedSchema.ts +2 -3
- package/src/simple-tree/api/tree.ts +24 -2
- package/src/simple-tree/api/typesUnsafe.ts +2 -1
- package/src/simple-tree/index.ts +1 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
- package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
- package/src/treeFactory.ts +1 -1
- package/src/util/breakable.ts +8 -1
- package/src/util/compressedIds.ts +90 -2
- package/src/util/index.ts +3 -1
- package/src/util/nestedMap.ts +21 -4
- package/src/util/nestedSet.ts +1 -1
- package/src/util/utils.ts +0 -18
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
7
|
+
import { isStableId } from "@fluidframework/id-compressor/internal";
|
|
8
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
type ChangeFamily,
|
|
12
|
+
type RevisionTag,
|
|
13
|
+
tagChange,
|
|
14
|
+
type ChangeEncodingContext,
|
|
15
|
+
type TaggedChange,
|
|
16
|
+
} from "../core/index.js";
|
|
17
|
+
import type { JsonCompatibleReadOnly } from "../util/index.js";
|
|
18
|
+
|
|
19
|
+
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
20
|
+
import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
21
|
+
import { SharedTreeChangeFormatVersion } from "./sharedTreeChangeCodecs.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents a serialized change for SharedTree.
|
|
25
|
+
*
|
|
26
|
+
* Data in this format is not expected to be durable beyond the scope of a single session.
|
|
27
|
+
*/
|
|
28
|
+
interface SerializedChange {
|
|
29
|
+
readonly version: 1;
|
|
30
|
+
readonly revision: RevisionTag;
|
|
31
|
+
readonly change: JsonCompatibleReadOnly;
|
|
32
|
+
readonly originatorId: SessionId;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isSerializedChangeV1(value: unknown): value is SerializedChange {
|
|
36
|
+
if (typeof value !== "object" || value === null) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const change = value as Partial<SerializedChange>;
|
|
40
|
+
return (
|
|
41
|
+
change.version === 1 &&
|
|
42
|
+
(change.revision === "root" || typeof change.revision === "number") &&
|
|
43
|
+
typeof change.originatorId === "string" &&
|
|
44
|
+
isStableId(change.originatorId) &&
|
|
45
|
+
change.change !== undefined
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function encodeSerializedChangeV1(
|
|
50
|
+
idCompressor: IIdCompressor,
|
|
51
|
+
changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,
|
|
52
|
+
change: SharedTreeChange,
|
|
53
|
+
changeRevision: RevisionTag,
|
|
54
|
+
contextRevision?: RevisionTag,
|
|
55
|
+
): JsonCompatibleReadOnly {
|
|
56
|
+
const context: ChangeEncodingContext = {
|
|
57
|
+
idCompressor,
|
|
58
|
+
originatorId: idCompressor.localSessionId,
|
|
59
|
+
revision: contextRevision,
|
|
60
|
+
isSummary: false,
|
|
61
|
+
};
|
|
62
|
+
const encodedChange = changeFamily.codecs
|
|
63
|
+
.resolve(SharedTreeChangeFormatVersion.v4)
|
|
64
|
+
.encode(change, context);
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
version: 1,
|
|
68
|
+
revision: changeRevision,
|
|
69
|
+
originatorId: idCompressor.localSessionId,
|
|
70
|
+
change: encodedChange,
|
|
71
|
+
} satisfies SerializedChange;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function decodeSerializedChangeV1(
|
|
75
|
+
idCompressor: IIdCompressor,
|
|
76
|
+
changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,
|
|
77
|
+
serializedChange: JsonCompatibleReadOnly,
|
|
78
|
+
): TaggedChange<SharedTreeChange> {
|
|
79
|
+
if (!isSerializedChangeV1(serializedChange)) {
|
|
80
|
+
throw new UsageError(`Cannot apply change. Invalid serialized change format.`);
|
|
81
|
+
}
|
|
82
|
+
const { revision, originatorId, change } = serializedChange;
|
|
83
|
+
if (originatorId !== idCompressor.localSessionId) {
|
|
84
|
+
throw new UsageError(
|
|
85
|
+
`Cannot apply change. A serialized changed must be applied to the same SharedTree as it was created from.`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
const context: ChangeEncodingContext = {
|
|
89
|
+
idCompressor,
|
|
90
|
+
originatorId: idCompressor.localSessionId,
|
|
91
|
+
revision,
|
|
92
|
+
isSummary: false,
|
|
93
|
+
};
|
|
94
|
+
const treeChange = changeFamily.codecs
|
|
95
|
+
.resolve(SharedTreeChangeFormatVersion.v4)
|
|
96
|
+
.decode(change, context);
|
|
97
|
+
return tagChange(treeChange, revision);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Provides utilities for serializing and deserializing SharedTree changes.
|
|
102
|
+
*
|
|
103
|
+
* @remarks Such changes are not expected to be durable beyond the scope of a single session.
|
|
104
|
+
*/
|
|
105
|
+
export const SerializedChange = {
|
|
106
|
+
/** Utilities for version 1 of the serialized change format. */
|
|
107
|
+
V1: {
|
|
108
|
+
/**
|
|
109
|
+
* Encodes a SharedTree change into the version 1 serialized change format.
|
|
110
|
+
* @param idCompressor - The ID compressor to use for encoding.
|
|
111
|
+
* @param changeFamily - The change family to use for encoding.
|
|
112
|
+
* @param change - The change to encode.
|
|
113
|
+
* @param changeRevision - The revision tag for the change.
|
|
114
|
+
* @param contextRevision - The optional context revision tag.
|
|
115
|
+
* @returns The encoded change in the version 1 serialized change format.
|
|
116
|
+
*/
|
|
117
|
+
encode: encodeSerializedChangeV1,
|
|
118
|
+
/**
|
|
119
|
+
* Decodes a version 1 serialized change into a SharedTree change.
|
|
120
|
+
* @param idCompressor - The ID compressor to use for decoding.
|
|
121
|
+
* @param changeFamily - The change family to use for decoding.
|
|
122
|
+
* @param serializedChange - The serialized change to decode.
|
|
123
|
+
* @returns The decoded SharedTree change.
|
|
124
|
+
*/
|
|
125
|
+
decode: decodeSerializedChangeV1,
|
|
126
|
+
},
|
|
127
|
+
} as const;
|
|
@@ -336,6 +336,7 @@ export class SharedTreeKernel
|
|
|
336
336
|
viewWith: this.viewWith.bind(this),
|
|
337
337
|
viewSharedBranchWith: this.viewBranchWith.bind(this),
|
|
338
338
|
createSharedBranch: this.createSharedBranch.bind(this),
|
|
339
|
+
getSharedBranchName: this.getSharedBranchName.bind(this),
|
|
339
340
|
getSharedBranchIds: this.getSharedBranchIds.bind(this),
|
|
340
341
|
kernel: this,
|
|
341
342
|
};
|
|
@@ -639,6 +640,20 @@ export interface SharedTreeOptions
|
|
|
639
640
|
* See {@link IncrementalEncodingPolicy}.
|
|
640
641
|
*/
|
|
641
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;
|
|
642
657
|
}
|
|
643
658
|
|
|
644
659
|
export interface SharedTreeOptionsInternal
|
|
@@ -771,6 +786,7 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
|
771
786
|
healUnresolvableIdentifiersOnDecode: false,
|
|
772
787
|
writeVersionOverrides: new Map(),
|
|
773
788
|
allowPossiblyIncompatibleWriteVersionOverrides: false,
|
|
789
|
+
retainHistory: false,
|
|
774
790
|
};
|
|
775
791
|
|
|
776
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
|
+
});
|
|
@@ -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,
|
|
@@ -119,6 +118,7 @@ import { SharedTreeChangeFamily, hasSchemaChange } from "./sharedTreeChangeFamil
|
|
|
119
118
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
120
119
|
import type { ISharedTreeEditor, SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
121
120
|
import { extractTransactionChangeProcessor } from "./transactionPostProcessor.js";
|
|
121
|
+
import { SerializedChange } from "./serializedChange.js";
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Yields all defined (non-`undefined`) labels from a {@link LabelTree}, depth-first.
|
|
@@ -317,7 +317,7 @@ export function createTreeCheckout(
|
|
|
317
317
|
codecOptions?: Partial<CodecWriteOptions>;
|
|
318
318
|
},
|
|
319
319
|
): TreeCheckout {
|
|
320
|
-
const breaker = args?.breaker ?? new Breakable("TreeCheckout");
|
|
320
|
+
const breaker = args?.breaker ?? new Breakable("TreeCheckout", args?.logger);
|
|
321
321
|
const schema = args?.schema ?? new TreeStoredSchemaRepository();
|
|
322
322
|
const forest = args?.forest ?? buildForest(breaker, schema);
|
|
323
323
|
const defaultCodecOptions: CodecWriteOptions = {
|
|
@@ -530,7 +530,8 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
530
530
|
),
|
|
531
531
|
/** Optional logger for telemetry. */
|
|
532
532
|
private readonly logger?: TelemetryLoggerExt,
|
|
533
|
-
public readonly breaker: Breakable = new Breakable("TreeCheckout"),
|
|
533
|
+
public readonly breaker: Breakable = new Breakable("TreeCheckout", logger),
|
|
534
|
+
public readonly disposeForksAfterTransaction = true,
|
|
534
535
|
) {
|
|
535
536
|
this.#transaction = this.createTransactionStack(branch);
|
|
536
537
|
this.editLock = new EditLock(this.#transaction.activeBranchEditor);
|
|
@@ -763,24 +764,16 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
763
764
|
kind,
|
|
764
765
|
isLocal: true,
|
|
765
766
|
getChange: () => {
|
|
766
|
-
const context: ChangeEncodingContext = {
|
|
767
|
-
idCompressor: this.idCompressor,
|
|
768
|
-
originatorId: this.idCompressor.localSessionId,
|
|
769
|
-
revision,
|
|
770
|
-
isSummary: false,
|
|
771
|
-
};
|
|
772
|
-
const encodedChange = this.changeFamily.codecs.resolve(4).encode(change, context);
|
|
773
|
-
|
|
774
767
|
assert(
|
|
775
768
|
commit.parent !== undefined,
|
|
776
769
|
0xca4 /* Expected applied commit to be parented */,
|
|
777
770
|
);
|
|
778
|
-
return
|
|
779
|
-
|
|
771
|
+
return SerializedChange.V1.encode(
|
|
772
|
+
this.idCompressor,
|
|
773
|
+
this.changeFamily,
|
|
774
|
+
change,
|
|
780
775
|
revision,
|
|
781
|
-
|
|
782
|
-
change: encodedChange,
|
|
783
|
-
} satisfies SerializedChange;
|
|
776
|
+
);
|
|
784
777
|
},
|
|
785
778
|
getRevertible: (onDisposed) => getRevertible?.(onDisposed),
|
|
786
779
|
label: this.labelTreeNode?.label,
|
|
@@ -859,24 +852,13 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
859
852
|
*/
|
|
860
853
|
@throwIfBroken
|
|
861
854
|
public applySerializedChange(serializedChange: JsonCompatibleReadOnly): void {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
throw new UsageError(
|
|
868
|
-
`Cannot apply change. A serialized changed must be applied to the same SharedTree as it was created from.`,
|
|
869
|
-
);
|
|
870
|
-
}
|
|
871
|
-
const context: ChangeEncodingContext = {
|
|
872
|
-
idCompressor: this.idCompressor,
|
|
873
|
-
originatorId: this.idCompressor.localSessionId,
|
|
874
|
-
revision,
|
|
875
|
-
isSummary: false,
|
|
876
|
-
};
|
|
877
|
-
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
|
+
);
|
|
878
860
|
// Apply the change to the branch, but _not_ the `activeBranch` - we do not support squashing serialized commits in a transaction.
|
|
879
|
-
this.#transaction.branch.apply(
|
|
861
|
+
this.#transaction.branch.apply(change);
|
|
880
862
|
}
|
|
881
863
|
|
|
882
864
|
// #region TreeBranchAlpha
|
|
@@ -1219,7 +1201,7 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
1219
1201
|
|
|
1220
1202
|
const branch = this.#transaction.activeBranch.fork();
|
|
1221
1203
|
const storedSchema = this.storedSchema.clone();
|
|
1222
|
-
const forkBreaker = new Breakable("TreeCheckout");
|
|
1204
|
+
const forkBreaker = new Breakable("TreeCheckout", this.logger);
|
|
1223
1205
|
const forest = this.forest.clone(storedSchema, forkBreaker);
|
|
1224
1206
|
const checkout = new TreeCheckout(
|
|
1225
1207
|
branch,
|
|
@@ -1308,6 +1290,30 @@ export class TreeCheckout implements ITreeCheckout {
|
|
|
1308
1290
|
return targetPath.length > 0;
|
|
1309
1291
|
}
|
|
1310
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
|
+
|
|
1311
1317
|
public merge(branch: TreeBranch): void;
|
|
1312
1318
|
public merge(branch: TreeBranch, disposeMerged: boolean): void;
|
|
1313
1319
|
public merge(branch: TreeBranch, disposeMerged = true): void {
|
|
@@ -1770,27 +1776,6 @@ function verboseFromCursor(
|
|
|
1770
1776
|
};
|
|
1771
1777
|
}
|
|
1772
1778
|
|
|
1773
|
-
interface SerializedChange {
|
|
1774
|
-
version: 1;
|
|
1775
|
-
revision: RevisionTag;
|
|
1776
|
-
change: JsonCompatibleReadOnly;
|
|
1777
|
-
originatorId: SessionId;
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
function isSerializedChange(value: unknown): value is SerializedChange {
|
|
1781
|
-
if (typeof value !== "object" || value === null) {
|
|
1782
|
-
return false;
|
|
1783
|
-
}
|
|
1784
|
-
const change = value as Partial<SerializedChange>;
|
|
1785
|
-
return (
|
|
1786
|
-
change.version === 1 &&
|
|
1787
|
-
(change.revision === "root" || typeof change.revision === "number") &&
|
|
1788
|
-
typeof change.originatorId === "string" &&
|
|
1789
|
-
isStableId(change.originatorId) &&
|
|
1790
|
-
change.change !== undefined
|
|
1791
|
-
);
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
1779
|
/**
|
|
1795
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).
|
|
1796
1781
|
* This function also considers changes to detached roots to be visible changes, but not renames of roots or builds of new roots.
|
|
@@ -9,6 +9,7 @@ import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
|
9
9
|
import type { SessionId } from "@fluidframework/id-compressor";
|
|
10
10
|
import {
|
|
11
11
|
TelemetryEventBatcher,
|
|
12
|
+
UsageError,
|
|
12
13
|
type TelemetryLoggerExt,
|
|
13
14
|
} from "@fluidframework/telemetry-utils/internal";
|
|
14
15
|
import { BTree } from "@tylerbu/sorted-btree-es6";
|
|
@@ -117,6 +118,7 @@ export class EditManager<
|
|
|
117
118
|
* @param localSessionId - the id of the local session that will be used for local commits
|
|
118
119
|
* @param mintRevisionTag - a function which generates globally unique revision tags
|
|
119
120
|
* @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.
|
|
121
|
+
* @param retainHistory - when `true`, trunk commits are never trimmed/evicted.
|
|
120
122
|
*/
|
|
121
123
|
public constructor(
|
|
122
124
|
public readonly changeFamily: TChangeFamily,
|
|
@@ -124,6 +126,7 @@ export class EditManager<
|
|
|
124
126
|
private readonly mintRevisionTag: () => RevisionTag,
|
|
125
127
|
private readonly onSharedBranchCreated?: (branchId: BranchId) => void,
|
|
126
128
|
logger?: TelemetryLoggerExt,
|
|
129
|
+
private readonly retainHistory: boolean = false,
|
|
127
130
|
) {
|
|
128
131
|
this.trunkBase = {
|
|
129
132
|
revision: rootRevision,
|
|
@@ -149,15 +152,23 @@ export class EditManager<
|
|
|
149
152
|
this.telemetryEventBatcher,
|
|
150
153
|
);
|
|
151
154
|
|
|
152
|
-
this.createAndAddSharedBranch("main", undefined, undefined, mainTrunk);
|
|
155
|
+
this.createAndAddSharedBranch("main", "main", undefined, undefined, mainTrunk);
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
public getLocalBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChangeset> {
|
|
156
159
|
return this.getSharedBranch(branchId).localBranch;
|
|
157
160
|
}
|
|
158
161
|
|
|
162
|
+
public getSharedBranchName(branchId: BranchId): string | undefined {
|
|
163
|
+
return this.getSharedBranch(branchId).branchName;
|
|
164
|
+
}
|
|
165
|
+
|
|
159
166
|
private getSharedBranch(branchId: BranchId): SharedBranch<TEditor, TChangeset> {
|
|
160
|
-
|
|
167
|
+
const branch = this.sharedBranches.get(branchId);
|
|
168
|
+
if (branch === undefined) {
|
|
169
|
+
throw new UsageError("No shared branch with such ID");
|
|
170
|
+
}
|
|
171
|
+
return branch;
|
|
161
172
|
}
|
|
162
173
|
|
|
163
174
|
/**
|
|
@@ -268,6 +279,11 @@ export class EditManager<
|
|
|
268
279
|
* if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.
|
|
269
280
|
*/
|
|
270
281
|
private trimHistory(): void {
|
|
282
|
+
if (this.retainHistory) {
|
|
283
|
+
// When history retention is enabled, trunk commits are never evicted.
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
271
287
|
/** The sequence id of the most recent commit on the trunk that will be trimmed */
|
|
272
288
|
let trunkTailSequenceId: SequenceId = {
|
|
273
289
|
sequenceNumber: this.minimumSequenceNumber,
|
|
@@ -397,6 +413,7 @@ export class EditManager<
|
|
|
397
413
|
for (const [branchId, branchData] of data.branches) {
|
|
398
414
|
const branch = this.createSharedBranch(
|
|
399
415
|
branchId,
|
|
416
|
+
branchData.name,
|
|
400
417
|
branchData.session,
|
|
401
418
|
mainBranch,
|
|
402
419
|
mainBranch.trunk.fork(),
|
|
@@ -444,6 +461,7 @@ export class EditManager<
|
|
|
444
461
|
sessionId: SessionId,
|
|
445
462
|
referenceSequenceNumber: SeqNumber,
|
|
446
463
|
branchId: BranchId,
|
|
464
|
+
branchName?: string,
|
|
447
465
|
): void {
|
|
448
466
|
if (sessionId === this.localSessionId) {
|
|
449
467
|
assert(this.sharedBranches.has(branchId), 0xc59 /* Expected branch to already exist */);
|
|
@@ -452,13 +470,14 @@ export class EditManager<
|
|
|
452
470
|
|
|
453
471
|
const mainBranch = this.getSharedBranch("main");
|
|
454
472
|
const branchTrunk = mainBranch.rebasePeer(sessionId, referenceSequenceNumber).fork();
|
|
455
|
-
this.createAndAddSharedBranch(branchId, sessionId, mainBranch, branchTrunk);
|
|
473
|
+
this.createAndAddSharedBranch(branchId, branchName, sessionId, mainBranch, branchTrunk);
|
|
456
474
|
}
|
|
457
475
|
|
|
458
|
-
public addNewBranch(branchId: BranchId): void {
|
|
476
|
+
public addNewBranch(branchId: BranchId, branchName?: string): void {
|
|
459
477
|
const main = this.getSharedBranch("main") ?? fail(0xc5a /* Main branch must exist */);
|
|
460
478
|
this.createAndAddSharedBranch(
|
|
461
479
|
branchId,
|
|
480
|
+
branchName,
|
|
462
481
|
this.localSessionId,
|
|
463
482
|
main,
|
|
464
483
|
this.getLocalBranch("main").fork(),
|
|
@@ -477,11 +496,18 @@ export class EditManager<
|
|
|
477
496
|
|
|
478
497
|
private createAndAddSharedBranch(
|
|
479
498
|
branchId: BranchId,
|
|
499
|
+
branchName: string | undefined,
|
|
480
500
|
sessionId: SessionId | undefined,
|
|
481
501
|
parent: SharedBranch<TEditor, TChangeset> | undefined,
|
|
482
502
|
branch: SharedTreeBranch<TEditor, TChangeset>,
|
|
483
503
|
): SharedBranch<TEditor, TChangeset> {
|
|
484
|
-
const sharedBranch = this.createSharedBranch(
|
|
504
|
+
const sharedBranch = this.createSharedBranch(
|
|
505
|
+
branchId,
|
|
506
|
+
branchName,
|
|
507
|
+
sessionId,
|
|
508
|
+
parent,
|
|
509
|
+
branch,
|
|
510
|
+
);
|
|
485
511
|
this.addSharedBranch(branchId, sharedBranch);
|
|
486
512
|
return sharedBranch;
|
|
487
513
|
}
|
|
@@ -509,6 +535,7 @@ export class EditManager<
|
|
|
509
535
|
|
|
510
536
|
private createSharedBranch(
|
|
511
537
|
branchId: BranchId,
|
|
538
|
+
branchName: string | undefined,
|
|
512
539
|
sessionId: SessionId | undefined,
|
|
513
540
|
parent: SharedBranch<TEditor, TChangeset> | undefined,
|
|
514
541
|
branch: SharedTreeBranch<TEditor, TChangeset>,
|
|
@@ -517,6 +544,7 @@ export class EditManager<
|
|
|
517
544
|
parent,
|
|
518
545
|
branch,
|
|
519
546
|
branchId,
|
|
547
|
+
branchName,
|
|
520
548
|
sessionId,
|
|
521
549
|
minimumPossibleSequenceId,
|
|
522
550
|
this.changeFamily,
|
|
@@ -689,6 +717,7 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {
|
|
|
689
717
|
public readonly parentBranch: SharedBranch<TEditor, TChangeset> | undefined,
|
|
690
718
|
public readonly trunk: SharedTreeBranch<TEditor, TChangeset>,
|
|
691
719
|
private readonly id: BranchId,
|
|
720
|
+
public readonly branchName: string | undefined,
|
|
692
721
|
private readonly sessionId: SessionId | undefined,
|
|
693
722
|
baseCommitSequenceId: SequenceId,
|
|
694
723
|
private readonly changeFamily: ChangeFamily<TEditor, TChangeset>,
|
|
@@ -1076,7 +1105,14 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {
|
|
|
1076
1105
|
|
|
1077
1106
|
const trunkBase =
|
|
1078
1107
|
this.parentBranch === undefined ? undefined : forkPointFromMainTrunk.revision;
|
|
1079
|
-
return {
|
|
1108
|
+
return {
|
|
1109
|
+
trunk,
|
|
1110
|
+
peerLocalBranches,
|
|
1111
|
+
base: trunkBase,
|
|
1112
|
+
id: this.id,
|
|
1113
|
+
name: this.branchName,
|
|
1114
|
+
session: this.sessionId,
|
|
1115
|
+
};
|
|
1080
1116
|
}
|
|
1081
1117
|
|
|
1082
1118
|
public loadSummaryData(
|
|
@@ -167,7 +167,7 @@ export const EditManagerFormatVersion = strictEnum("editManager.FormatVersion",
|
|
|
167
167
|
* Not yet released.
|
|
168
168
|
* Only used for testing shared branches.
|
|
169
169
|
*/
|
|
170
|
-
vSharedBranches: "shared-branches|v0.
|
|
170
|
+
vSharedBranches: "shared-branches|v0.2",
|
|
171
171
|
});
|
|
172
172
|
export type EditManagerFormatVersion = Values<typeof EditManagerFormatVersion>;
|
|
173
173
|
export const supportedEditManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> =
|
|
@@ -68,6 +68,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
68
68
|
return {
|
|
69
69
|
originatorId: message.sessionId,
|
|
70
70
|
branchId: encodeBranchId(context.idCompressor, message.branchId),
|
|
71
|
+
branchName: message.branchName,
|
|
71
72
|
version,
|
|
72
73
|
};
|
|
73
74
|
}
|
|
@@ -85,6 +86,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
85
86
|
originatorId,
|
|
86
87
|
changeset,
|
|
87
88
|
branchId: encodedBranchId,
|
|
89
|
+
branchName: encodedBranchName,
|
|
88
90
|
} = encoded;
|
|
89
91
|
|
|
90
92
|
const changeContext: ChangeEncodingContext = {
|
|
@@ -97,7 +99,12 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
97
99
|
const branchId = decodeBranchId(context.idCompressor, encodedBranchId, changeContext);
|
|
98
100
|
|
|
99
101
|
if (changeset === undefined) {
|
|
100
|
-
return {
|
|
102
|
+
return {
|
|
103
|
+
type: "branch",
|
|
104
|
+
sessionId: originatorId,
|
|
105
|
+
branchId,
|
|
106
|
+
branchName: encodedBranchName,
|
|
107
|
+
};
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
assert(encodedRevision !== undefined, 0xc6a /* Commit messages must have a revision */);
|
|
@@ -56,7 +56,7 @@ export const MessageFormatVersion = strictEnum("MessageFormatVersion", {
|
|
|
56
56
|
* Not yet released.
|
|
57
57
|
* Only used for testing shared branches.
|
|
58
58
|
*/
|
|
59
|
-
vSharedBranches: "shared-branches|v0.
|
|
59
|
+
vSharedBranches: "shared-branches|v0.2",
|
|
60
60
|
});
|
|
61
61
|
export type MessageFormatVersion = Values<typeof MessageFormatVersion>;
|
|
62
62
|
export const supportedMessageFormatVersions: ReadonlySet<MessageFormatVersion> = new Set([
|
|
@@ -30,8 +30,17 @@ export interface Message {
|
|
|
30
30
|
*/
|
|
31
31
|
readonly changeset?: JsonCompatibleReadOnly;
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Unique ID associated with the branch.
|
|
35
|
+
*/
|
|
33
36
|
readonly branchId?: EncodedBranchId;
|
|
34
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Application-defined name of the branch, if any.
|
|
40
|
+
* Not guaranteed to be unique.
|
|
41
|
+
*/
|
|
42
|
+
readonly branchName?: string;
|
|
43
|
+
|
|
35
44
|
/**
|
|
36
45
|
* The version of the message format.
|
|
37
46
|
*/
|
|
@@ -46,5 +55,6 @@ export const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
|
|
|
46
55
|
originatorId: SessionIdSchema,
|
|
47
56
|
changeset: Type.Optional(tChange),
|
|
48
57
|
branchId: Type.Optional(Type.Number()),
|
|
58
|
+
branchName: Type.Optional(Type.String()),
|
|
49
59
|
version: Type.Literal(MessageFormatVersion.vSharedBranches),
|
|
50
60
|
});
|