refactor(experimental-tree): extract ISharedTree interface, hide class from API#26496
Draft
tylerbutler wants to merge 3 commits intomicrosoft:mainfrom
Draft
refactor(experimental-tree): extract ISharedTree interface, hide class from API#26496tylerbutler wants to merge 3 commits intomicrosoft:mainfrom
tylerbutler wants to merge 3 commits intomicrosoft:mainfrom
Conversation
…s from API Extract ISharedTree interface from the SharedTree class so the class no longer leaks SharedObject in the public API surface. Export SharedTree as a const + type alias backed by the interface, following the same pattern used by other DDSes. Update internal consumers (LazyCheckout, MergeHealth, SummaryTestUtilities) to use ISharedTree instead of the class directly.
…more consumers Fix ISharedTreeEvents event name mismatch: the interface declared 'appliedSequencedEdit' but the class emits 'sequencedEditApplied' (via SharedTreeEvent.SequencedEditApplied enum). With the event name corrected, migrate MergeHealth.ts and UndoRedoHandler.ts to use ISharedTree instead of the concrete SharedTree class. Also update EditCommittedEventArguments and SequencedEditAppliedEventArguments tree fields to ISharedTree.
…action APIs Change Checkout.tree and Transaction.tree public properties from SharedTree (concrete class) to ISharedTree (interface), removing the class from the public API surface of these types. Internally, both classes retain a private _concreteTree reference for operations that require SharedTree-specific details (emit, instanceof).
Contributor
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract an
ISharedTreeinterface from theSharedTreeclass in@fluid-experimental/treeso that the class no longer leaksSharedObjectin the public API surface.Changes
ISharedTree.ts: Defines theISharedTreeinterface that extendsISharedObject<ISharedTreeEvents>andNodeIdContext, exposing only the public contract (properties likeattributionId,logViewer,currentView,edits, and methods likeapplyEdit,mergeEditsFrom,revert, etc.)index.ts: Exports the newISharedTreetypeSummaryTestUtilities.ts: Updated to useISharedTreeinstead of the concreteSharedTreeclassexperimental-tree.alpha.api.mdnow includes theISharedTreeinterfaceWhy
This is part of a broader effort to stop leaking
SharedObject(and its dependency chain includingIChannelFactory,IFluidDataStoreRuntime, etc.) through the public API surface of DDS packages. By introducing an interface, external consumers interact withISharedTreewhile internal code can continue using the concreteSharedTreeclass.This follows the same pattern used by other DDSes in the Fluid Framework (SharedMap, SharedString, etc.).
Test plan
pnpm build @fluid-experimental/tree)