Packages > fluid-framework

fluid-framework Package

Bundles a collection of Fluid Framework client libraries for easy use when paired with a corresponding service client package (e.g. @fluidframework/azure-client, @fluidframework/tinylicious-client, or @fluid-experimental/osdp-client (BETA)).

Interfaces

Interface Modifiers Description
CommitMetadata Information about a commit that has been applied.
ContainerSchema Declares the Fluid objects that will be available in the Container.
FieldProps Additional information to provide to a FieldSchema.
FieldSchemaUnsafe Unenforced version of FieldSchema.
IConnection Base interface for information for each connection made to the Fluid session.
IDisposable An object with an explicit lifetime that can be ended.
IFluidContainer sealed Provides an entrypoint into the client side of collaborative Fluid data. Provides access to the data as well as status on the collaboration session.
IFluidContainerEvents sealed Events emitted from IFluidContainer.
IMember Base interface to be implemented to fetch each service's member.
IServiceAudience Base interface to be implemented to fetch each service's audience.
IServiceAudienceEvents Events that trigger when the roster of members in the Fluid session change.
ISubscribable

An object which allows the registration of listeners so that subscribers can be notified when an event happens.

EventEmitter can be used as a base class to implement this via extension.

ITree Channel for a Fluid Tree DDS.
MakeNominal 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 Allows reversion of a change made to SharedTree.
SchemaIncompatible Information about how a view schema was incompatible.
TreeApi Provides various functions for interacting with TreeNodes.
TreeArrayNode A TreeNode which implements 'readonly T[]' and the array mutation APIs.
TreeArrayNodeBase A generic array type, used to defined types like TreeArrayNode.
TreeArrayNodeUnsafe Unenforced version of TreeArrayNode.
TreeChangeEvents A collection of events that can be raised by a TreeNode.
TreeMapNode A map of string keys to tree objects.
TreeMapNodeUnsafe Unenforced version of TreeMapNode.
TreeNodeApi Provides various functions for analyzing TreeNodes.
TreeNodeSchemaClass Tree node schema which is implemented using a class.
TreeNodeSchemaCore Data common to all tree node schema.
TreeNodeSchemaNonClass Schema which is not a class.
TreeView

An editable view of a (version control style) branch of a shared tree.

This view is always in one of two states: 1. In schema: the stored schema is compatible with the provided view schema. There is no error, and root can be used. 2. Out of schema: the stored schema is incompatible with the provided view schema. There is an error, and root cannot be used.

TreeViewEvents Events for TreeView.
WithType Adds a type field.

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 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.
TreeConfiguration Configuration for how to schematize a tree.
TreeNode A non-leaf SharedTree node. Includes objects, arrays, and maps.

Enumerations

Enum Description
AttachState The attachment state of some Fluid data (e.g. a container or data store), denoting whether it is uploaded to the service. The transition from detached to attached state is a one-way transition.
CommitKind The type of a commit. This is used to describe the context in which the commit was created.
ConnectionState The state of the Container's connection to the service.
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 Description
AllowedTypes Types for use in fields.
ApplyKind Suitable for output. For input must error on side of excluding undefined instead.
ConnectionStateType Type defining the different states of connectivity a Container can be in.
ContainerAttachProps Represents properties that can be attached to a container.
DataObjectClass A class that has a factory that can create a DataObject and a constructor that will return the type of the DataObject.
DriverErrorTypes Different error types the Driver may report out to the Host.
Events Used to specify the kinds of events emitted by an ISubscribable.
ExtractItemType Get the Item type from a LazyItem<Item>.
FlexList A flexible way to list values. Each item in the list can either be an "eager" **value** or a "lazy" **function that returns a value** (the latter allows cyclic references to work).
FlexListToUnion Normalize FlexList type to a union.
ICriticalContainerError Represents errors raised on container.
ImplicitAllowedTypes Types allowed in a field.
ImplicitFieldSchema Schema for a field of a tree node.
InitialObjects Extract the type of 'initialObjects' from the given ContainerSchema type.
InsertableObjectFromSchemaRecord

Helper used to produce types for:

1. Insertable content which can be used to construct an object node.

2. Insertable content which is an unhydrated object node.

3. Union of 1 and 2.

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.
InsertableTypedNodeUnsafe Unenforced version of InsertableTypedNode.
IsEvent true iff the given type is an acceptable shape for an event
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.
LoadableObjectClass A class object of DataObject or SharedObject.
LoadableObjectClassRecord A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject or SharedObject.
MemberChangedListener Signature for IMember change events.
Myself An extended member object that includes currentConnection
NodeBuilderData Given a node's schema, return the corresponding object from which the node could be built.
NodeBuilderDataUnsafe Unenforced version of InsertableTreeNodeFromImplicitAllowedTypes.
NodeFromSchema Takes in TreeNodeSchema[] and returns a TypedNode union.
NodeFromSchemaUnsafe Unenforced version of NodeFromSchema.
ObjectFromSchemaRecord Helper used to produce types for object nodes.
ObjectFromSchemaRecordUnsafe Unenforced version of ObjectFromSchemaRecord.
RestrictiveReadonlyRecord Alternative to the built in Record type which does not permit unexpected members, and is readonly.
RevertibleFactory Factory for creating a Revertible. Will error if invoked outside the scope of the commitApplied event that provides it, or if invoked multiple times.
ScopedSchemaName The name of a schema produced by SchemaFactory, including its optional scope prefix.
TransactionConstraint A requirement for a SharedTree transaction to succeed.
TreeFieldFromImplicitField Converts ImplicitFieldSchema to the corresponding tree node's field type.
TreeFieldFromImplicitFieldUnsafe Unenforced version of TreeFieldFromImplicitField.
TreeLeafValue Value that may be stored as a leaf node.
TreeNodeFromImplicitAllowedTypes Type of of tree node for a field of the given schema.
TreeNodeFromImplicitAllowedTypesUnsafe Unenforced version of TreeNodeFromImplicitAllowedTypes.
TreeNodeSchema 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 Description
disposeSymbol readonly Placeholder for Symbol.dispose.
DriverErrorTypes readonly Different error types the Driver may report out to the Host.
SharedTree readonly SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees of objects, arrays, and other data types.
Tree readonly The Tree object holds various functions for interacting with TreeNodes.
TreeArrayNode readonly A TreeNode which implements 'readonly T[]' and the array mutation APIs.
type readonly The type of a TreeNode. For moore information about the type, use Tree.schema(theNode) instead.

Namespaces

Namespace Description
ConnectionStateType Namespace for the different connection states a container can be in. PLEASE NOTE: The sequence of the numerical values does no correspond to the typical connection state progression.

Variable Details

disposeSymbol

Placeholder for Symbol.dispose.

Signature

disposeSymbol: unique symbol

DriverErrorTypes

Different error types the Driver may report out to the Host.

Signature

DriverErrorTypes: {
    readonly genericNetworkError: "genericNetworkError";
    readonly authorizationError: "authorizationError";
    readonly fileNotFoundOrAccessDeniedError: "fileNotFoundOrAccessDeniedError";
    readonly offlineError: "offlineError";
    readonly unsupportedClientProtocolVersion: "unsupportedClientProtocolVersion";
    readonly writeError: "writeError";
    readonly fetchFailure: "fetchFailure";
    readonly fetchTokenError: "fetchTokenError";
    readonly incorrectServerResponse: "incorrectServerResponse";
    readonly fileOverwrittenInStorage: "fileOverwrittenInStorage";
    readonly deltaStreamConnectionForbidden: "deltaStreamConnectionForbidden";
    readonly locationRedirection: "locationRedirection";
    readonly fluidInvalidSchema: "fluidInvalidSchema";
    readonly fileIsLocked: "fileIsLocked";
    readonly outOfStorageError: "outOfStorageError";
    readonly genericError: "genericError";
    readonly throttlingError: "throttlingError";
    readonly usageError: "usageError";
}

SharedTree

SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees of objects, arrays, and other data types.

Signature

SharedTree: ISharedObjectKind<ITree>

Tree

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

Signature

treeApi: TreeApi

TreeArrayNode

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

Signature

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

type

The type of a TreeNode . For moore information about the type, use Tree.schema(theNode) instead.

Signature

type: unique symbol

Remarks

This symbol mainly exists on nodes to allow TypeScript to provide more accurate type checking. Tree.is and Tree.schema provide a superset of this information in more friendly ways.

This symbol should not manually be added to objects as doing so allows the object to be invalidly used where nodes are expected. Instead construct a real node of the desired type using its constructor.