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.
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.
ISharedMap sealed

The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting and retrieving values that JavaScript developers are accustomed to with the Map built-in object. However, the keys of a SharedMap must be strings, and the values must either be a JSON-serializable object or a FluidObjectHandle.

For more information, including example usages, see https://fluidframework.com/docs/data-structures/map/.

ISharedMapEvents sealed Events emitted in response to changes to the map data.
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.
IValueChanged sealed Type of "valueChanged" event parameter.
MakeNominal Use this as the type of a protected field to cause a type to use nominal typing instead of structural.
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.
TreeMapNode A map of string keys to tree objects.
TreeNodeApi Provides various functions for analyzing TreeNodes.
TreeNodeEvents A collection of events that can be raised by a TreeNode.
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.

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 Alerts Description
AllowedTypes Types for use in fields.
ApplyKind Suitable for output. For input must error on side of excluding undefined instead.
ArrayToUnion Convert a Array type into a union of its value types.
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.

InsertableTreeFieldFromImplicitField Type of content that can be inserted into the tree for a field of the given schema.
InsertableTreeNodeFromImplicitAllowedTypes Type of content that can be inserted into the tree for a node of the given schema.
InsertableTypedNode Data which can be used as a node to be inserted. Either an unhydrated node, or content to build a new node.
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.
NodeFromSchema Takes in TreeNodeSchema[] and returns a TypedNode union.
ObjectFromSchemaRecord Helper used to produce types for object nodes.
RestrictiveReadonlyRecord Alternative to the built in Record type which does not permit unexpected members, and is readonly.
ScopedSchemaName The name of a schema produced by SchemaFactory, including its optional scope prefix.
SharedMap DEPRECATED Entrypoint for ISharedMap creation.
TreeFieldFromImplicitField Converts ImplicitFieldSchema to the corresponding tree node's field type.
TreeLeafValue Value that may be stored as a leaf node.
TreeNodeFromImplicitAllowedTypes Type of of tree node for a field of the given schema.
TreeNodeSchema Schema for a tree node.
TreeObjectNode A TreeNode which modules a JavaScript object.
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.

Variables

Variable Alerts Modifiers Description
disposeSymbol readonly

Placeholder for Symbol.dispose.

Replace this with Symbol.dispose when it is available.

DriverErrorTypes readonly Different error types the Driver may report out to the Host.
SharedMap DEPRECATED readonly Entrypoint for ISharedMap creation.
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.

Replace this with Symbol.dispose when it is available.

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";
}

SharedMap

Entrypoint for ISharedMap creation.

API This

Please use SharedTree for new containers. SharedMap is supported for loading preexisting Fluid Framework 1.0 containers only.

Signature

SharedMap: ISharedObjectKind<ISharedMap>

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

Tree: 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.