Skip to main content
Version: v2

@fluidframework/shared-object-base Package

Interfaces​

InterfaceAlertsModifiersDescription
DataStoreContextAlphasealedContextual information about a data store which is provided when instantiating or loading it.
DataStoreOptionsAlphaOptions which define how to construct a particular DataStoreKind.
IFluidSerializerLegacy
ISharedObjectLegacyBase interface for shared objects from which other interfaces extend.
ISharedObjectEventsLegacyEvents emitted by ISharedObject.
ISharedObjectKindLegacyDefines a kind of shared object. Used in containers to register a shared object implementation, and to create new instances of a given type of shared object.
SharedObjectCreatorAlphasealedCreates instances of SharedObjectKinds.
SharedObjectKindsealedDefines a kind of shared object.
SharedObjectKindAlphaAlphasealedA SharedObjectKind that also implements SharedObjectKey.

Classes​

ClassAlertsDescription
SharedObjectLegacyHelper for implementing ISharedObject with simplified, synchronous summarization and garbage collection.
SharedObjectCoreLegacyBase class from which all shared objects derive.

Types​

TypeAliasAlertsDescription
SharedObjectKeyAlphaA RegistryKey for a SharedObjectKind.
SharedObjectRegistryAlphaA Registry of shared object kinds that can be created or loaded within a data store.

Functions​

FunctionAlertsReturn TypeDescription
defineDataStore(options)AlphaDataStoreKind<T>Creates a DataStoreKind from DataStoreOptions.
makeHandlesSerializable(value, serializer, bind)Legacyunknown

Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object where any embedded IFluidHandles have been replaced with a serializable form.

The original input object is not mutated. This method will shallowly clones all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)

parseHandles(value, serializer)LegacyunknownGiven a fully-plain object that may have serializable-form handles within, will return the mostly-plain object with handle objects created instead.
sharedObjectRegistryFromIterable(entries)AlphaSharedObjectRegistryCreates a SharedObjectRegistry from an iterable of SharedObjectKindAlphas or async getters for them.

Function Details​

defineDataStore​

Creates a DataStoreKind from DataStoreOptions.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/shared-object-base/alpha.

For more information about our API support guarantees, see here.

Signature​

export declare function defineDataStore<T, TRoot extends IFluidLoadable>(options: DataStoreOptions<TRoot, T>): DataStoreKind<T>;
Type Parameters​
ParameterConstraintDescription
T
TRootIFluidLoadable

Parameters​

ParameterTypeDescription
optionsDataStoreOptions<TRoot, T>

Returns​

Return type: DataStoreKind<T>

makeHandlesSerializable​

Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object where any embedded IFluidHandles have been replaced with a serializable form.

The original input object is not mutated. This method will shallowly clones all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/shared-object-base/legacy.

For more information about our API support guarantees, see here.

Signature​

export declare function makeHandlesSerializable(value: unknown, serializer: IFluidSerializer, bind: IFluidHandle): unknown;

Parameters​

ParameterTypeDescription
valueunknown
serializerIFluidSerializer
bindIFluidHandleBind any other handles we find in the object against this given handle.

Returns​

The fully-plain object

Return type: unknown

parseHandles​

Given a fully-plain object that may have serializable-form handles within, will return the mostly-plain object with handle objects created instead.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/shared-object-base/legacy.

For more information about our API support guarantees, see here.

Signature​

export declare function parseHandles(value: unknown, serializer: IFluidSerializer): unknown;

Remarks​

Idempotent when called multiple times.

Parameters​

ParameterTypeDescription
valueunknownThe fully-plain object
serializerIFluidSerializerThe serializer that knows how to convert serializable-form handles into handle objects

Returns​

The mostly-plain object with handle objects within

Return type: unknown

sharedObjectRegistryFromIterable​

Creates a SharedObjectRegistry from an iterable of SharedObjectKindAlphas or async getters for them.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/shared-object-base/alpha.

For more information about our API support guarantees, see here.

Signature​

export declare function sharedObjectRegistryFromIterable(entries: Iterable<SharedObjectKindAlpha<IFluidLoadable> | {
type: string;
kind: () => Promise<SharedObjectKindAlpha<IFluidLoadable>>;
}>): SharedObjectRegistry;

Parameters​

ParameterTypeDescription
entriesIterable<SharedObjectKindAlpha<IFluidLoadable> | { type: string; kind: () => Promise<SharedObjectKindAlpha<IFluidLoadable>>; }>

Returns​

Return type: SharedObjectRegistry