diff --git a/.changeset/crazy-carrots-mate.md b/.changeset/crazy-carrots-mate.md new file mode 100644 index 000000000000..391cd484ffcf --- /dev/null +++ b/.changeset/crazy-carrots-mate.md @@ -0,0 +1,17 @@ +--- +"fluid-framework": minor +"@fluidframework/tree": minor +"@fluidframework/tree-agent": minor +"__section": feature +--- +A minimal set of branching APIs has been promoted to beta. + +The following APIs have been promoted to beta in `@fluidframework/tree`: + +- `TreeBranch.fork()` +- `TreeBranch.merge()` +- `TreeBranch.rebaseOnto()` +- `TreeBranch.dispose()` +- `TreeView.fork()` + +These APIs enable applications to implement basic local branching flows. diff --git a/packages/dds/tree/api-report/tree.alpha.api.md b/packages/dds/tree/api-report/tree.alpha.api.md index 781b7479a32f..e22fb75da886 100644 --- a/packages/dds/tree/api-report/tree.alpha.api.md +++ b/packages/dds/tree/api-report/tree.alpha.api.md @@ -117,6 +117,9 @@ export const ArrayNodeSchema: { // @alpha export function asAlpha(view: TreeView): TreeViewAlpha; +// @beta +export function asBeta(view: TreeView): TreeViewBeta; + // @alpha @deprecated export function asTreeViewAlpha(view: TreeView): TreeViewAlpha; @@ -1347,7 +1350,7 @@ export const Tree: Tree; // @alpha @sealed @system export interface TreeAlpha { - branch(node: TreeNode): TreeBranch | undefined; + branch(node: TreeNode): TreeBranchAlpha | undefined; child(node: TreeNode, key: string | number): TreeNode | TreeLeafValue | undefined; children(node: TreeNode): Iterable<[propertyKey: string | number, child: TreeNode | TreeLeafValue]>; create(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField): Unhydrated : TreeNode | TreeLeafValue | undefined>; @@ -1412,14 +1415,20 @@ export interface TreeBeta { // @beta export const TreeBeta: TreeBeta; -// @alpha @sealed +// @beta @sealed export interface TreeBranch extends IDisposable { dispose(error?: Error): void; - readonly events: Listenable_2; fork(): TreeBranch; - hasRootSchema(schema: TSchema): this is TreeViewAlpha; merge(branch: TreeBranch, disposeMerged?: boolean): void; rebaseOnto(branch: TreeBranch): void; +} + +// @alpha @sealed +export interface TreeBranchAlpha extends TreeBranch { + readonly events: Listenable_2; + // (undocumented) + fork(): TreeBranchAlpha; + hasRootSchema(schema: TSchema): this is TreeViewAlpha; runTransaction(transaction: () => TransactionCallbackStatus, params?: RunTransactionParams): TransactionResultExt; runTransaction(transaction: () => VoidTransactionCallbackStatus | void, params?: RunTransactionParams): TransactionResult; } @@ -1599,7 +1608,7 @@ export interface TreeView extends ID } // @alpha @sealed -export interface TreeViewAlpha extends Omit>, "root" | "initialize">, TreeBranch { +export interface TreeViewAlpha extends Omit>, "root" | "initialize" | "fork">, TreeBranchAlpha { // (undocumented) readonly events: Listenable_2; // (undocumented) @@ -1611,6 +1620,12 @@ export interface TreeViewAlpha); } +// @beta @sealed +export interface TreeViewBeta extends TreeView, TreeBranch { + // (undocumented) + fork(): ReturnType & TreeViewBeta; +} + // @public @sealed export class TreeViewConfiguration implements Required> { constructor(props: ITreeViewConfiguration); diff --git a/packages/dds/tree/api-report/tree.beta.api.md b/packages/dds/tree/api-report/tree.beta.api.md index 7b6be89ed6b5..2f941ad97530 100644 --- a/packages/dds/tree/api-report/tree.beta.api.md +++ b/packages/dds/tree/api-report/tree.beta.api.md @@ -70,6 +70,9 @@ type ApplyKindInput(view: TreeView): TreeViewBeta; + // @public export enum CommitKind { Default = 0, @@ -672,6 +675,14 @@ export interface TreeBeta { // @beta export const TreeBeta: TreeBeta; +// @beta @sealed +export interface TreeBranch extends IDisposable { + dispose(error?: Error): void; + fork(): TreeBranch; + merge(branch: TreeBranch, disposeMerged?: boolean): void; + rebaseOnto(branch: TreeBranch): void; +} + // @public @sealed export interface TreeChangeEvents { nodeChanged(unstable?: unknown): void; @@ -795,6 +806,12 @@ export interface TreeView extends ID upgradeSchema(): void; } +// @beta @sealed +export interface TreeViewBeta extends TreeView, TreeBranch { + // (undocumented) + fork(): ReturnType & TreeViewBeta; +} + // @public @sealed export class TreeViewConfiguration implements Required> { constructor(props: ITreeViewConfiguration); diff --git a/packages/dds/tree/api-report/tree.legacy.beta.api.md b/packages/dds/tree/api-report/tree.legacy.beta.api.md index f2e0a99f8d0f..e7d4b0351c4c 100644 --- a/packages/dds/tree/api-report/tree.legacy.beta.api.md +++ b/packages/dds/tree/api-report/tree.legacy.beta.api.md @@ -70,6 +70,9 @@ type ApplyKindInput(view: TreeView): TreeViewBeta; + // @public export enum CommitKind { Default = 0, @@ -684,6 +687,14 @@ export interface TreeBeta { // @beta export const TreeBeta: TreeBeta; +// @beta @sealed +export interface TreeBranch extends IDisposable { + dispose(error?: Error): void; + fork(): TreeBranch; + merge(branch: TreeBranch, disposeMerged?: boolean): void; + rebaseOnto(branch: TreeBranch): void; +} + // @public @sealed export interface TreeChangeEvents { nodeChanged(unstable?: unknown): void; @@ -807,6 +818,12 @@ export interface TreeView extends ID upgradeSchema(): void; } +// @beta @sealed +export interface TreeViewBeta extends TreeView, TreeBranch { + // (undocumented) + fork(): ReturnType & TreeViewBeta; +} + // @public @sealed export class TreeViewConfiguration implements Required> { constructor(props: ITreeViewConfiguration); diff --git a/packages/dds/tree/src/api.ts b/packages/dds/tree/src/api.ts index 358df51bcfff..771bca623321 100644 --- a/packages/dds/tree/src/api.ts +++ b/packages/dds/tree/src/api.ts @@ -6,6 +6,7 @@ import { type TreeView, type TreeViewAlpha, + type TreeViewBeta, type ImplicitFieldSchema, // eslint-disable-next-line import/no-deprecated asTreeViewAlpha, @@ -28,3 +29,13 @@ export function asAlpha( // eslint-disable-next-line import/no-deprecated return asTreeViewAlpha(view); } + +/** + * Retrieve the {@link TreeViewBeta | beta API} for a {@link TreeView}. + * @beta + */ +export function asBeta( + view: TreeView, +): TreeViewBeta { + return view as TreeViewBeta; +} diff --git a/packages/dds/tree/src/index.ts b/packages/dds/tree/src/index.ts index 0fc7c45de1f9..6c29f006f5be 100644 --- a/packages/dds/tree/src/index.ts +++ b/packages/dds/tree/src/index.ts @@ -165,6 +165,7 @@ export { singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, + type TreeViewBeta, type InsertableField, type Insertable, type InsertableContent, @@ -235,6 +236,7 @@ export { type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, + type TreeBranchAlpha, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, @@ -338,4 +340,4 @@ export type { MapNodeInsertableData } from "./simple-tree/index.js"; export { JsonAsTree } from "./jsonDomainSchema.js"; export { FluidSerializableAsTree } from "./serializableDomainSchema.js"; export { TableSchema, type System_TableSchema } from "./tableSchema.js"; -export { asAlpha } from "./api.js"; +export { asAlpha, asBeta } from "./api.js"; diff --git a/packages/dds/tree/src/shared-tree/schematizingTreeView.ts b/packages/dds/tree/src/shared-tree/schematizingTreeView.ts index 1a91d0f13ba0..b04d121ecb67 100644 --- a/packages/dds/tree/src/shared-tree/schematizingTreeView.ts +++ b/packages/dds/tree/src/shared-tree/schematizingTreeView.ts @@ -71,6 +71,7 @@ import { import { canInitialize, initialize, initializerFromChunk } from "./schematizeTree.js"; import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js"; +import type { TreeBranchAlpha } from "../simple-tree/index.js"; /** * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already @@ -513,15 +514,16 @@ export class SchematizingSimpleTreeView< // #region Branching - public fork(): ReturnType & SchematizingSimpleTreeView { + public fork(): ReturnType & + SchematizingSimpleTreeView { return this.checkout.branch().viewWith(this.config); } - public merge(context: TreeBranch, disposeMerged = true): void { + public merge(context: TreeBranchAlpha, disposeMerged = true): void { this.checkout.merge(getCheckout(context), disposeMerged); } - public rebaseOnto(context: TreeBranch): void { + public rebaseOnto(context: TreeBranchAlpha): void { getCheckout(context).rebase(this.checkout); } diff --git a/packages/dds/tree/src/shared-tree/treeAlpha.ts b/packages/dds/tree/src/shared-tree/treeAlpha.ts index f05925291382..492716e94b02 100644 --- a/packages/dds/tree/src/shared-tree/treeAlpha.ts +++ b/packages/dds/tree/src/shared-tree/treeAlpha.ts @@ -85,6 +85,7 @@ import { type Observer, withObservation, } from "../feature-libraries/index.js"; +import type { TreeBranchAlpha } from "../simple-tree/index.js"; import { independentInitializedView, type ViewContent } from "./independentView.js"; import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js"; import { isFluidHandle } from "@fluidframework/runtime-utils"; @@ -230,7 +231,7 @@ export interface TreeAlpha { * This does not fork a new branch, but rather retrieves the _existing_ branch for the node. * To create a new branch, use e.g. {@link TreeBranch.fork | `myBranch.fork()`}. */ - branch(node: TreeNode): TreeBranch | undefined; + branch(node: TreeNode): TreeBranchAlpha | undefined; /** * Construct tree content that is compatible with the field defined by the provided `schema`. @@ -755,7 +756,7 @@ export const TreeAlpha: TreeAlpha = { return result; }, - branch(node: TreeNode): TreeBranch | undefined { + branch(node: TreeNode): TreeBranchAlpha | undefined { const kernel = getKernel(node); if (!kernel.isHydrated()) { return undefined; diff --git a/packages/dds/tree/src/simple-tree/api/index.ts b/packages/dds/tree/src/simple-tree/api/index.ts index 3c3b97003165..1c930da6ee7e 100644 --- a/packages/dds/tree/src/simple-tree/api/index.ts +++ b/packages/dds/tree/src/simple-tree/api/index.ts @@ -19,7 +19,9 @@ export type { TreeViewEvents, SchemaCompatibilityStatus, TreeViewAlpha, + TreeViewBeta, TreeBranch, + TreeBranchAlpha, TreeBranchEvents, ITreeAlpha, } from "./tree.js"; diff --git a/packages/dds/tree/src/simple-tree/api/tree.ts b/packages/dds/tree/src/simple-tree/api/tree.ts index 90e35449a5d1..b6b09749c3c4 100644 --- a/packages/dds/tree/src/simple-tree/api/tree.ts +++ b/packages/dds/tree/src/simple-tree/api/tree.ts @@ -126,37 +126,10 @@ export interface ITreeAlpha extends ITree { * A collection of functionality associated with a (version-control-style) branch of a SharedTree. * @remarks A `TreeBranch` allows for the {@link TreeBranch.fork | creation of branches} and for those branches to later be {@link TreeBranch.merge | merged}. * - * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`. - * - * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranch.hasRootSchema | hasRootSchema()}. - * * The branch associated directly with the {@link ITree | SharedTree} is the "main" branch, and all other branches fork (directly or transitively) from that main branch. - * @sealed @alpha + * @sealed @beta */ export interface TreeBranch extends IDisposable { - /** - * Events for the branch - */ - readonly events: Listenable; - - /** - * Returns true if this branch has the given schema as its root schema. - * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema. - * - * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types. - * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`. - * @example - * ```typescript - * if (branch.hasRootSchema(MySchema)) { - * const { root } = branch; // `branch` is now a TreeViewAlpha - * // ... - * } - * ``` - */ - hasRootSchema( - schema: TSchema, - ): this is TreeViewAlpha; - /** * Fork a new branch off of this branch which is based off of this branch's current state. * @remarks Any changes to the tree on the new branch will not apply to this branch until the new branch is e.g. {@link TreeBranch.merge | merged} back into this branch. @@ -187,6 +160,54 @@ export interface TreeBranch extends IDisposable { */ rebaseOnto(branch: TreeBranch): void; + /** + * Dispose of this branch, cleaning up any resources associated with it. + * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error. + * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch. + * + * Disposing branches is important to avoid consuming memory unnecessarily. + * In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last {@link TreeBranch.rebaseOnto | rebased}. + * + * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect. + */ + dispose(error?: Error): void; +} + +/** + * {@link TreeBranch} with alpha-level APIs. + * @remarks + * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`. + * + * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranchAlpha.hasRootSchema | hasRootSchema()}. + * @sealed @alpha + */ +export interface TreeBranchAlpha extends TreeBranch { + /** + * Events for the branch + */ + readonly events: Listenable; + + /** + * Returns true if this branch has the given schema as its root schema. + * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema. + * + * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types. + * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`. + * @example + * ```typescript + * if (branch.hasRootSchema(MySchema)) { + * const { root } = branch; // `branch` is now a TreeViewAlpha + * // ... + * } + * ``` + */ + hasRootSchema( + schema: TSchema, + ): this is TreeViewAlpha; + + // Override the base fork method to return the alpha variant. + fork(): TreeBranchAlpha; + /** * Run a transaction which applies one or more edits to the tree as a single atomic unit. * @param transaction - The function to run as the body of the transaction. @@ -261,18 +282,6 @@ export interface TreeBranch extends IDisposable { transaction: () => VoidTransactionCallbackStatus | void, params?: RunTransactionParams, ): TransactionResult; - - /** - * Dispose of this branch, cleaning up any resources associated with it. - * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error. - * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch. - * - * Disposing branches is important to avoid consuming memory unnecessarily. - * In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last {@link TreeBranch.rebaseOnto | rebased}. - * - * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect. - */ - dispose(error?: Error): void; } /** @@ -371,18 +380,29 @@ export interface TreeView extends ID */ export interface TreeViewAlpha< in out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema, -> extends Omit>, "root" | "initialize">, - TreeBranch { +> extends Omit>, "root" | "initialize" | "fork">, + TreeBranchAlpha { get root(): ReadableField; set root(newRoot: InsertableField); + initialize(content: InsertableField): void; + readonly events: Listenable; - initialize(content: InsertableField): void; + // Override the base fork method to return a TreeViewAlpha. + fork(): ReturnType & TreeViewAlpha; +} +/** + * {@link TreeView} with additional beta APIs. + * @sealed @beta + */ +export interface TreeViewBeta + extends TreeView, + TreeBranch { // Override the base branch method to return a typed view rather than merely a branch. - fork(): ReturnType & TreeViewAlpha; + fork(): ReturnType & TreeViewBeta; } /** diff --git a/packages/dds/tree/src/simple-tree/index.ts b/packages/dds/tree/src/simple-tree/index.ts index 9b7997b59082..84a10c04700a 100644 --- a/packages/dds/tree/src/simple-tree/index.ts +++ b/packages/dds/tree/src/simple-tree/index.ts @@ -136,7 +136,9 @@ export { type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type TreeViewAlpha, + type TreeViewBeta, type TreeBranch, + type TreeBranchAlpha, type TreeBranchEvents, getPropertyKeyFromStoredKey, getStoredKey, diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md index 6aae605cca5a..221008b19a07 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md @@ -117,6 +117,9 @@ export const ArrayNodeSchema: { // @alpha export function asAlpha(view: TreeView): TreeViewAlpha; +// @beta +export function asBeta(view: TreeView): TreeViewBeta; + // @alpha @deprecated export function asTreeViewAlpha(view: TreeView): TreeViewAlpha; @@ -1739,7 +1742,7 @@ export const Tree: Tree; // @alpha @sealed @system export interface TreeAlpha { - branch(node: TreeNode): TreeBranch | undefined; + branch(node: TreeNode): TreeBranchAlpha | undefined; child(node: TreeNode, key: string | number): TreeNode | TreeLeafValue | undefined; children(node: TreeNode): Iterable<[propertyKey: string | number, child: TreeNode | TreeLeafValue]>; create(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField): Unhydrated : TreeNode | TreeLeafValue | undefined>; @@ -1804,14 +1807,20 @@ export interface TreeBeta { // @beta export const TreeBeta: TreeBeta; -// @alpha @sealed +// @beta @sealed export interface TreeBranch extends IDisposable { dispose(error?: Error): void; - readonly events: Listenable; fork(): TreeBranch; - hasRootSchema(schema: TSchema): this is TreeViewAlpha; merge(branch: TreeBranch, disposeMerged?: boolean): void; rebaseOnto(branch: TreeBranch): void; +} + +// @alpha @sealed +export interface TreeBranchAlpha extends TreeBranch { + readonly events: Listenable; + // (undocumented) + fork(): TreeBranchAlpha; + hasRootSchema(schema: TSchema): this is TreeViewAlpha; runTransaction(transaction: () => TransactionCallbackStatus, params?: RunTransactionParams): TransactionResultExt; runTransaction(transaction: () => VoidTransactionCallbackStatus | void, params?: RunTransactionParams): TransactionResult; } @@ -1991,7 +2000,7 @@ export interface TreeView extends ID } // @alpha @sealed -export interface TreeViewAlpha extends Omit>, "root" | "initialize">, TreeBranch { +export interface TreeViewAlpha extends Omit>, "root" | "initialize" | "fork">, TreeBranchAlpha { // (undocumented) readonly events: Listenable; // (undocumented) @@ -2003,6 +2012,12 @@ export interface TreeViewAlpha); } +// @beta @sealed +export interface TreeViewBeta extends TreeView, TreeBranch { + // (undocumented) + fork(): ReturnType & TreeViewBeta; +} + // @public @sealed export class TreeViewConfiguration implements Required> { constructor(props: ITreeViewConfiguration); diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md index ca4a4ce5bf0a..112d99c73739 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md @@ -70,6 +70,9 @@ type ApplyKindInput(view: TreeView): TreeViewBeta; + // @public export enum AttachState { Attached = "Attached", @@ -1058,6 +1061,14 @@ export interface TreeBeta { // @beta export const TreeBeta: TreeBeta; +// @beta @sealed +export interface TreeBranch extends IDisposable { + dispose(error?: Error): void; + fork(): TreeBranch; + merge(branch: TreeBranch, disposeMerged?: boolean): void; + rebaseOnto(branch: TreeBranch): void; +} + // @public @sealed export interface TreeChangeEvents { nodeChanged(unstable?: unknown): void; @@ -1181,6 +1192,12 @@ export interface TreeView extends ID upgradeSchema(): void; } +// @beta @sealed +export interface TreeViewBeta extends TreeView, TreeBranch { + // (undocumented) + fork(): ReturnType & TreeViewBeta; +} + // @public @sealed export class TreeViewConfiguration implements Required> { constructor(props: ITreeViewConfiguration); diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md index 26daec88773f..e443c6067472 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md @@ -70,6 +70,9 @@ type ApplyKindInput(view: TreeView): TreeViewBeta; + // @public export enum AttachState { Attached = "Attached", @@ -1416,6 +1419,14 @@ export interface TreeBeta { // @beta export const TreeBeta: TreeBeta; +// @beta @sealed +export interface TreeBranch extends IDisposable { + dispose(error?: Error): void; + fork(): TreeBranch; + merge(branch: TreeBranch, disposeMerged?: boolean): void; + rebaseOnto(branch: TreeBranch): void; +} + // @public @sealed export interface TreeChangeEvents { nodeChanged(unstable?: unknown): void; @@ -1539,6 +1550,12 @@ export interface TreeView extends ID upgradeSchema(): void; } +// @beta @sealed +export interface TreeViewBeta extends TreeView, TreeBranch { + // (undocumented) + fork(): ReturnType & TreeViewBeta; +} + // @public @sealed export class TreeViewConfiguration implements Required> { constructor(props: ITreeViewConfiguration); diff --git a/packages/framework/tree-agent/api-report/tree-agent.alpha.api.md b/packages/framework/tree-agent/api-report/tree-agent.alpha.api.md index 5eb128b812de..b619f104dc32 100644 --- a/packages/framework/tree-agent/api-report/tree-agent.alpha.api.md +++ b/packages/framework/tree-agent/api-report/tree-agent.alpha.api.md @@ -122,6 +122,6 @@ export class SharedTreeSemanticAgent { export type SynchronousEditor = (context: Record, code: string) => void; // @alpha -export type TreeView = Pick, "root" | "fork" | "merge" | "rebaseOnto" | "schema" | "events"> & TreeBranch; +export type TreeView = Pick, "root" | "fork" | "merge" | "rebaseOnto" | "schema" | "events"> & TreeBranchAlpha; ``` diff --git a/packages/framework/tree-agent/src/subtree.ts b/packages/framework/tree-agent/src/subtree.ts index 640bf3e0853c..82fd54d80502 100644 --- a/packages/framework/tree-agent/src/subtree.ts +++ b/packages/framework/tree-agent/src/subtree.ts @@ -17,9 +17,9 @@ import { TreeAlpha } from "@fluidframework/tree/alpha"; import type { UnsafeUnknownSchema, ReadableField, - TreeBranch, TreeRecordNode, ReadSchema, + TreeBranchAlpha, } from "@fluidframework/tree/alpha"; import { getNodeOnBranch } from "./getNodeOnBranch.js"; @@ -37,7 +37,7 @@ export class Subtree { } } - public get branch(): TreeBranch { + public get branch(): TreeBranchAlpha { return this.viewOrNode instanceof TreeNode ? (TreeAlpha.branch(this.viewOrNode) ?? fail("Node cannot be raw.")) : this.viewOrNode; diff --git a/packages/framework/tree-agent/src/utils.ts b/packages/framework/tree-agent/src/utils.ts index ae3b71c4dbb8..14ad3eecf265 100644 --- a/packages/framework/tree-agent/src/utils.ts +++ b/packages/framework/tree-agent/src/utils.ts @@ -12,7 +12,7 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal"; import type { ImplicitFieldSchema, TreeNodeSchemaClass } from "@fluidframework/tree"; import type { InsertableContent, - TreeBranch, + TreeBranchAlpha, TreeNode, TreeNodeSchema, TreeViewAlpha, @@ -95,7 +95,7 @@ export type TreeView = TreeViewAlpha, "root" | "fork" | "merge" | "rebaseOnto" | "schema" | "events" > & - TreeBranch; + TreeBranchAlpha; /** * TODO