fluid-framework Package

Packages > fluid-framework

The **fluid-framework** package bundles a collection of Fluid Framework client packages for easy use when paired with a corresponding service client package (for example, @fluidframework/azure-client or @fluidframework/tinylicious-client).

Classes

List of classes contained in this package or namespace
Class Description
DirectoryFactory The factory that defines the directory.
DOProviderContainerRuntimeFactory The DOProviderContainerRuntimeFactory is container code that provides a single RootDataObject. This data object is dynamically customized (registry and initial objects) based on the schema provided to the container runtime factory.
FluidContainer Implementation of the IFluidContainer.
Interval
IntervalCollection
IntervalCollectionIterator
LocalValueMaker A LocalValueMaker enables a container type DDS to produce and store local values with minimal awareness of how those objects are stored, serialized, and deserialized.
MapFactory The factory that defines the map.
PaddingSegment An empty segment that occupies 'cachedLength' positions. SparseMatrix uses PaddingSegment to "pad" a run of unoccupied cells.
RootDataObject
RunSegment
SequenceDeltaEvent The event object returned on sequenceDelta events.The properties of this object and its sub-objects represent a point in time state at the time the operation was applied. They will not take into consideration any future modifications performed to the underlying sequence and merge tree.For group ops, each op will get it's own event, and the group op property will be set on the op args.Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.
SequenceEvent Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.The properties of this object and its sub-objects represent a point in time state at the time the operation was applied. They will not take into any future modifications performed to the underlying sequence and merge tree.
SequenceInterval
SequenceMaintenanceEvent The event object returned on maintenance events.The properties of this object and its sub-objects represent a point in time state at the time the operation was applied. They will not take into any future modifications performed to the underlying sequence and merge tree.
ServiceAudience Base class for providing audience information for sessions interacting with FluidContainer This can be extended by different service-specific client packages to additional parameters to the user and client details returned in IMember
SharedDirectory SharedDirectory provides a hierarchical organization of map-like data structures as SubDirectories. The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax. SubDirectories can be retrieved for use as working directories.
SharedIntervalCollection
SharedIntervalCollectionFactory The factory that defines the SharedIntervalCollection
SharedMap 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.
SharedNumberSequence The SharedNumberSequence holds a sequence of numbers. Each number will be stored at a position within the sequence. See the sequence documentation for details on working with sequences.
SharedNumberSequenceFactory
SharedObjectSequence The SharedObjectSequence holds a sequence of serializable objects. Each object will be stored at a position within the sequence. See the sequence documentation for details on working with sequences.
SharedObjectSequenceFactory
SharedSegmentSequence
SharedSequence
SharedString The Shared String is a specialized data structure for handling collaborative text. It is based on a more general Sequence data structure but has additional features that make working with text easier.In addition to text, a Shared String can also contain markers. Markers can be used to store metadata at positions within the text, like the details of an image or Fluid object that should be rendered with the text.
SharedStringFactory
SparseMatrix
SparseMatrixFactory
SubSequence

Enumerations

List of enums contained in this package or namespace
Enumeration 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.

Functions

List of functions contained in this package or namespace
Function Description
positionToRowCol(position)

Interfaces

List of interfaces contained in this package or namespace
Interface Description
ContainerSchema The ContainerSchema declares the Fluid objects that will be available in the container. It includes both the instances of objects that are initially available upon container creation, as well as the types of objects that may be dynamically created throughout the lifetime of the container.
IAudience Audience represents all clients connected to the op stream, both read-only and read/write.
IConnection Base interface for information for each connection made to the Fluid session. This interface can be extended to provide additional information specific to each service.
IDirectory Interface describing actions on a directory.
IDirectoryDataObject Defines the in-memory object structure to be used for the conversion to/from serialized.
IDirectoryEvents Events emitted in response to changes to the directory data.### "containedValueChanged"The containedValueChanged event is emitted when a key is set or deleted. As opposed to the SharedDirectory's valueChanged event, this is emitted only on the IDirectory that directly contains the key.#### Listener signature ```typescript (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void ``` - changed - Information on the key that changed and its value prior to the change.- local - Whether the change originated from the this client.- target - The IDirectory itself.
IDirectoryNewStorageFormat
IDirectoryValueChanged Type of "valueChanged" event parameter for SharedDirectory
IFluidContainer The IFluidContainer provides an entrypoint into the client side of collaborative Fluid data. It provides access to the data as well as status on the collaboration session.
IFluidContainerEvents Events emitted from IFluidContainer.### "connected"The connected event is emitted when the IFluidContainer completes connecting to the Fluid service.#### Listener signature ```typescript () => void; ``` ### "dispose"The dispose event is emitted when the IFluidContainer is disposed, which permanently disables it.#### Listener signature ```typescript () => void; ``` ### "disconnected"The disconnected event is emitted when the IFluidContainer becomes disconnected from the Fluid service.#### Listener signature ```typescript () => void; ```
IIntervalCollectionEvent
IIntervalHelpers
IJSONRunSegment
IMember Base interface to be implemented to fetch each service's member. This interface can be extended by each service to provide additional service-specific user metadata.
ISequenceDeltaRange A range that has changed corresponding to a segment modification.
ISerializableInterval
ISerializableValue The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type. Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate) and ops (set). If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members that are ISerializedHandle (the serialized form of a handle). If type is a value type then it must be amongst the types registered via registerValueType or we won't know how to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent. If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a channel ID. This type is legacy and deprecated.
ISerializedInterval
ISerializedValue
IServiceAudience Base interface to be implemented to fetch each service's audience. The generic M allows consumers to further extend the client object with service-specific details about the connecting client, such as device information, environment, or a username.
IServiceAudienceEvents Events that trigger when the roster of members in the Fluid session change. Only changes that would be reflected in the returned map of IServiceAudience's getMembers method will emit events.### "membersChanged"The membersChanged event is emitted when a member is either added or removed.#### Listener signature ```typescript () => void; ``` ### "memberAdded"The memberAdded event is emitted when a member joins the audience.#### Listener signature ```typescript (clientId: string, member: M) => void; ``` - clientId - A unique identifier for the client- member - The service-specific member object for the client### "memberRemoved"The memberRemoved event is emitted when a member leaves the audience.#### Listener signature ```typescript (clientId: string, member: M) => void; ``` - clientId - A unique identifier for the client- member - The service-specific member object for the client
ISharedDirectory Interface describing a shared directory.
ISharedDirectoryEvents Events emitted in response to changes to the directory data. These events only emit on the ISharedDirectory itself, and not on subdirectories.### "valueChanged"The valueChanged event is emitted when a key is set or deleted. This is emitted for any key in the ISharedDirectory or any subdirectory.#### Listener signature ```typescript ( changed: IDirectoryValueChanged, local: boolean, op: ISequencedDocumentMessage | null, target: IEventThisPlaceHolder, ) => void ``` - changed - Information on the key that changed, its value prior to the change, and the path to the key that changed.- local - Whether the change originated from the this client.- op - The op that caused the change in value.- target - The ISharedDirectory itself.### "clear"The clear event is emitted when the ISharedDirectory is cleared.#### Listener signature ```typescript (local: boolean, op: ISequencedDocumentMessage | null, target: IEventThisPlaceHolder) => void ``` - local - Whether the clear originated from the this client.- op - The op that caused the clear.- target - The ISharedDirectory itself.
ISharedIntervalCollection
ISharedMap Shared map interface
ISharedMapEvents Events emitted in response to changes to the map data.### "valueChanged"The valueChanged event is emitted when a key is set or deleted.#### Listener signature ```typescript ( changed: IValueChanged, local: boolean, op: ISequencedDocumentMessage | null, target: IEventThisPlaceHolder, ) => void ``` - changed - Information on the key that changed and its value prior to the change.- local - Whether the change originated from the this client.- op - The op that caused the change in value.- target - The map itself.### "clear"The clear event is emitted when the map is cleared.#### Listener signature ```typescript (local: boolean, op: ISequencedDocumentMessage | null, target: IEventThisPlaceHolder) => void ``` - local - Whether the clear originated from the this client.- op - The op that caused the clear.- target - The map itself.
ISharedSegmentSequenceEvents Events emitted in response to changes to the sequence data.### "sequenceDelta"The sequenceDelta event is emitted when segments are inserted, annotated, or removed.#### Listener signature ```typescript (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void ``` - event - Various information on the segments that were modified.- target - The sequence itself.### "maintenance"The maintenance event is emitted when segments are modified during merge-tree maintenance.#### Listener signature ```typescript (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void ``` - event - Various information on the segments that were modified.- target - The sequence itself.
ISharedString Fluid object interface describing access methods on a SharedString
IValueChanged Type of "valueChanged" event parameter.
IValueOpEmitter Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.
RootDataObjectProps

Variables

List of variables contained in this package or namespace
Variable Description
maxCellPosition
maxCol
maxCols
maxRow
maxRows
rowColToPosition

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
DataObjectClass A DataObjectClass is a class that has a factory that can create a DataObject and a constructor that will return the type of the DataObject.
DeserializeCallback
IDirectoryOperation Any operation on a directory
LoadableObjectClass A LoadableObjectClass is an 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 in a LoadableObjectRecord.
LoadableObjectCtor An object with a constructor that will return an IFluidLoadable.
LoadableObjectRecord A mapping of string identifiers to instantiated DataObjects or SharedObjects.
MatrixSegment
SharedObjectClass A SharedObjectClass is a class that has a factory that can create a DDS (SharedObject) and a constructor that will return the type of the DataObject.
SharedStringSegment
SparseMatrixItem

Enumerations

AttachState enum

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.

Signature:

export declare enum AttachState 

Enumeration Members

List of members in use in this enum
Member Value Description
Attached "Attached" In attached state, the data has completed upload to the service. It can be accessed by other clients after reaching attached state.
Attaching "Attaching" In attaching state, the data has started the upload to the service, but has not yet completed.
Detached "Detached" In detached state, the data is only present on the local client's machine. It has not yet been uploaded to the service.

Functions

positionToRowCol

Warning: This API is now obsolete.

positionToRowCol is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

export declare function positionToRowCol(position: number): {
    row: number;
    col: number;
};

Parameters

List of parameters
Parameter Type Description
position

Returns:

Variables

maxCellPosition

Warning: This API is now obsolete.

maxCellPosition is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

maxCellPosition: number

maxCol

Warning: This API is now obsolete.

maxCol is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

maxCol = 2097152

maxCols

Warning: This API is now obsolete.

maxCols is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

maxCols: number

maxRow

Warning: This API is now obsolete.

maxRow is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

maxRow = 4294967295

maxRows

Warning: This API is now obsolete.

maxRows is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

maxRows: number

rowColToPosition

Warning: This API is now obsolete.

positionToRowCol is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

rowColToPosition: (row: number, col: number) => number

Type Aliases

DataObjectClass

A DataObjectClass is a class that has a factory that can create a DataObject and a constructor that will return the type of the DataObject.

Signature:

export declare type DataObjectClass<T extends IFluidLoadable> = {
    readonly factory: IFluidDataStoreFactory;
} & LoadableObjectCtor<T>;

DeserializeCallback

Signature:

export declare type DeserializeCallback = (properties: MergeTree.PropertySet) => void;

IDirectoryOperation

Any operation on a directory

Signature:

export declare type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;

LoadableObjectClass

A LoadableObjectClass is an class object of DataObject or SharedObject

Signature:

export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;

LoadableObjectClassRecord

A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject or SharedObject in a LoadableObjectRecord.

Signature:

export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;

LoadableObjectCtor

An object with a constructor that will return an IFluidLoadable.

Signature:

export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;

LoadableObjectRecord

A mapping of string identifiers to instantiated DataObjects or SharedObjects.

Signature:

export declare type LoadableObjectRecord = Record<string, IFluidLoadable>;

MatrixSegment

Warning: This API is now obsolete.

MatrixSegment is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

export declare type MatrixSegment = RunSegment | PaddingSegment;

SharedObjectClass

A SharedObjectClass is a class that has a factory that can create a DDS (SharedObject) and a constructor that will return the type of the DataObject.

Signature:

export declare type SharedObjectClass<T extends IFluidLoadable> = {
    readonly getFactory: () => IChannelFactory;
} & LoadableObjectCtor<T>;

SharedStringSegment

Signature:

export declare type SharedStringSegment = MergeTree.TextSegment | MergeTree.Marker;

SparseMatrixItem

Warning: This API is now obsolete.

SparseMatrixItem is part of an abandoned prototype. Use SharedMatrix instead.

Signature:

export declare type SparseMatrixItem = Serializable;