Packages > @fluidframework/tree

@fluidframework/tree Package

Interfaces

Interface Modifiers Description
CommitMetadata sealed Information about a commit that has been applied.
FieldProps Additional information to provide to a FieldSchema.
FieldSchemaUnsafe Unenforced version of FieldSchema.
InternalTreeNode sealed A node type internal to @fluidframework/tree.
ITree sealed Channel for a Fluid Tree DDS.
ITreeConfigurationOptions Options when constructing a tree view.
ITreeViewConfiguration Property-bag configuration for TreeViewConfiguration construction.
Listenable sealed An object which allows the registration of listeners so that subscribers can be notified when an event happens.
MakeNominal sealed Use this as the type of a protected field to cause a type to use nominal typing instead of structural.
NodeInDocumentConstraint A transaction constraint which requires that the given node exists in the tree.
Revertible sealed Allows reversion of a change made to SharedTree.
RunTransaction sealed A function which runs a transaction in a SharedTree.
SchemaCompatibilityStatus sealed

Information about a view schema's compatibility with the document's stored schema.

See SharedTree's README for more information about choosing a compatibility policy.

TreeArrayNode sealed A TreeNode which implements 'readonly T[]' and the array mutation APIs.
TreeArrayNodeUnsafe sealed Unenforced version of TreeArrayNode.
TreeChangeEvents sealed A collection of events that can be emitted by a TreeNode.
TreeMapNode sealed A map of string keys to tree objects.
TreeMapNodeUnsafe sealed Unenforced version of TreeMapNode.
TreeNodeApi sealed Provides various functions for analyzing TreeNodes. *
TreeNodeSchemaClass sealed Tree node schema which is implemented using a class.
TreeNodeSchemaCore sealed Data common to all tree node schema.
TreeView sealed

An editable view of a (version control style) branch of a shared tree based on some schema.

This schema--known as the view schema--may or may not align the stored schema of the document. Information about discrepancies between the two schemas is available via compatibility.

Application authors are encouraged to read [schema-evolution.md](../../docs/user-facing/schema-evolution.md) and choose a schema compatibility policy that aligns with their application's needs.

TreeViewEvents sealed Events for TreeView.
WithType sealed Adds a type symbol to a type for stronger typing.

Classes

Class Modifiers Description
FieldSchema sealed

All policy for a specific field, including functionality that does not have to be kept consistent across versions or deterministic.

This can include policy for how to use this schema for "view" purposes, and well as how to expose editing APIs. Use SchemaFactory to create the FieldSchema instances, for example optional(t, props).

IterableTreeArrayContent sealed Used to insert iterable content into a TreeArrayNode. Use (TreeArrayNode:variable).spread to create an instance of this type.
SchemaFactory sealed Creates various types of schema for TreeNodes.
TreeNode sealed A non-leaf SharedTree node. Includes objects, arrays, and maps.
TreeViewConfiguration sealed Configuration for viewWith(config).

Enumerations

Enum Description
CommitKind The type of a commit. This is used to describe the context in which the commit was created.
FieldKind Kind of a field on a node.
NodeKind Kind of tree node.
RevertibleStatus The status of a Revertible.
TreeStatus Status of the tree that a particular node belongs to.

Types

TypeAlias Modifiers Description
AllowedTypes Types for use in fields.
ImplicitAllowedTypes Types allowed in a field.
ImplicitFieldSchema Schema for a field of a tree node.
InsertableObjectFromSchemaRecordUnsafe Unenforced version of InsertableObjectFromSchemaRecord.
InsertableTreeFieldFromImplicitField Type of content that can be inserted into the tree for a field of the given schema.
InsertableTreeFieldFromImplicitFieldUnsafe Unenforced version of InsertableTreeFieldFromImplicitField.
InsertableTreeNodeFromImplicitAllowedTypes Type of content that can be inserted into the tree for a node of the given schema.
InsertableTreeNodeFromImplicitAllowedTypesUnsafe Unenforced version of InsertableTreeNodeFromImplicitAllowedTypes.
InsertableTypedNode Data which can be used as a node to be inserted. Either an unhydrated node, or content to build a new node.
IsListener true iff the given type is an acceptable shape for a event listener
LazyItem An "eager" or "lazy" Item in a FlexList. Lazy items are wrapped in a function to allow referring to themselves before they are declared. This makes recursive and co-recursive items possible.
Listeners Used to specify the kinds of events emitted by a Listenable.
NodeFromSchema Takes in TreeNodeSchema[] and returns a TypedNode union.
Off A function that, when called, will deregister an event listener subscription that was previously registered.
RestrictiveReadonlyRecord Alternative to the built in Record type which does not permit unexpected members, and is readonly.
RevertibleFactory sealed Factory for creating a Revertible. Will error if invoked outside the scope of the commitApplied event that provides it, or if invoked multiple times.
TransactionConstraint A requirement for a SharedTree transaction to succeed.
TreeFieldFromImplicitField Converts ImplicitFieldSchema to the corresponding tree node's field type.
TreeLeafValue Value that may be stored as a leaf node.
TreeNodeFromImplicitAllowedTypes Type of tree node for a field of the given schema.
TreeNodeSchema sealed Schema for a tree node.
TreeObjectNode A TreeNode which modules a JavaScript object.
TreeObjectNodeUnsafe Unenforced version of TreeObjectNode.
Unenforced

A placeholder to use in extends constraints when using the real type breaks compilation of some recursive types due to a design limitation of TypeScript.

These extends constraints only serve as documentation: to avoid breaking compilation, this type has to not actually enforce anything, and thus is just unknown. Therefore the type safety is the responsibility of the user of the API.

Unhydrated

Type alias to document which values are un-hydrated.

Un-hydrated values are nodes produced from schema's create functions that haven't been inserted into a tree yet.

Since un-hydrated nodes become hydrated when inserted, strong typing can't be used to distinguish them. This no-op wrapper is used instead.

ValidateRecursiveSchema Compile time check for validity of a recursive schema.

Variables

Variable Modifiers Type Description
rollback readonly unique symbol A special object that signifies when a SharedTree transaction should "roll back".
Tree readonly TreeApi The Tree object holds various functions for interacting with TreeNodes.
TreeArrayNode readonly { readonly spread: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>; } A TreeNode which implements 'readonly T[]' and the array mutation APIs.

Namespaces

Namespace Description
InternalTypes

Variable Details

rollback

A special object that signifies when a SharedTree transaction should “roll back”.

Signature

rollback: unique symbol

Type: unique symbol

Tree

The Tree object holds various functions for interacting with TreeNode s.

Signature

treeApi: TreeApi

Type: TreeApi

TreeArrayNode

A TreeNode which implements ‘readonly T[]’ and the array mutation APIs.

Signature

TreeArrayNode: {
    readonly spread: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;
}

Type: { readonly spread: <T>(content: Iterable<T>) => IterableTreeArrayContent <T>; }