Skip to content 

@fluidframework/datastore-definitions Package

Packages > @fluidframework/datastore-definitions

This package defines the interfaces required to implement and/or communicate with a data store.

Interfaces

List of interfaces contained in this package or namespace
Interface Description
IChannel
IChannelAttributes Represents the attributes of a channel/DDS.
IChannelFactory Definitions of a channel factory. Factories follow a common model but enable custom behavior.
IChannelServices Storage services to read the objects at a given path using the given delta connection.
IChannelStorageService Storage services to read the objects at a given path.
IDeltaConnection Interface to represent a connection to a delta notification stream.
IDeltaHandler Handler provided by shared data structure to process requests from the runtime.
IFluidDataStoreRuntime Represents the runtime for the data store. Contains helper functions/state of the data store.
IProvideChannel

Variables

List of variables contained in this package or namespace
Variable Description
IChannel

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
AsJsonable Take a type, usually an interface and tries to map it to a compatible jsonable type. This is basically taking advantage of duck typing. We are generating a type we know is jsonable from the input type, but setting anything not serializable to never, which will cause compile time issues with objects of the original type if they have properties that are not jsonable.The usage looks like foo<T>(input: AsJsonable<T>)if T isn't jsonable then all values of input will be invalid, as all the properties will need to be never which isn't possible.This won't be fool proof, but if someone modifies a type used in an AsJsonable to add a property that isn't Jsonable, they should get a compile time break, which is pretty good.What this type does: If T is Jsonable return T Else if f T is not a function, For each property K of T recursively if property K is not a symbol return AsJsonable of the property Else return never Else return never
AsSerializable
Jsonable Used to constrain a value to types that are serializable as JSON. The T type parameter may be used to customize the type of the leaves to support situations where a replacer is used to handle special values. (e.g., Json<JsonPrimitive | IFluidHandle>)Note that the Json type does not protect against the following pitfalls when serializing undefined and non-finite numbers:- undefined properties on objects are omitted (i.e., properties become undefined instead of equal to undefined). - When undefined appears as the root object or as an array element it is coerced to null. - Non-finite numbers (NaN, +/-Infinity) are also coerced to null. - (null always serializes as null.)
JsonableArray
JsonableObject
JsonablePrimitive
Serializable A union of the types that Fluid can intrinsically serialize, which is any type is that is Json serializable + Json serializable objects/arrays with IFluidHandles at the leaves.Convenient when declaring type constraints, such as <T extends Serializable>.(See Jsonable for caveats regarding serialization of undefined and non-finite numbers.)

Variables

IChannel

Signature:

IChannel: keyof IProvideChannel

Type Aliases

AsJsonable

Take a type, usually an interface and tries to map it to a compatible jsonable type. This is basically taking advantage of duck typing. We are generating a type we know is jsonable from the input type, but setting anything not serializable to never, which will cause compile time issues with objects of the original type if they have properties that are not jsonable.

The usage looks like foo<T>(input: AsJsonable<T>)

if T isn’t jsonable then all values of input will be invalid, as all the properties will need to be never which isn’t possible.

This won’t be fool proof, but if someone modifies a type used in an AsJsonable to add a property that isn’t Jsonable, they should get a compile time break, which is pretty good.

What this type does: If T is Jsonable return T Else if f T is not a function, For each property K of T recursively if property K is not a symbol return AsJsonable of the property Else return never Else return never

Signature:

export declare type AsJsonable<T, J = JsonablePrimitive> = T extends Jsonable<J> ? T : Extract<T, Function> extends never ? {
    [K in keyof T]: Extract<K, symbol> extends never ? AsJsonable<T[K], J> : never;
} : never;

AsSerializable

Signature:

export declare type AsSerializable<T> = AsJsonable<T, JsonablePrimitive | IFluidHandle>;

Jsonable

Used to constrain a value to types that are serializable as JSON. The T type parameter may be used to customize the type of the leaves to support situations where a replacer is used to handle special values. (e.g., Json<JsonPrimitive | IFluidHandle>)

Note that the Json type does not protect against the following pitfalls when serializing undefined and non-finite numbers:

  • undefined properties on objects are omitted (i.e., properties become undefined instead of equal to undefined). - When undefined appears as the root object or as an array element it is coerced to null. - Non-finite numbers (NaN, +/-Infinity) are also coerced to null. - (null always serializes as null.)

Signature:

export declare type Jsonable<T = JsonablePrimitive> = T | JsonableArray<T> | JsonableObject<T>;

JsonableArray

Signature:

export declare type JsonableArray<T> = Jsonable<T>[];

JsonableObject

Signature:

export declare type JsonableObject<T> = {
    [key: string]: Jsonable<T>;
    [key: number]: Jsonable<T>;
};

JsonablePrimitive

Signature:

export declare type JsonablePrimitive = undefined | null | boolean | number | string;

Serializable

A union of the types that Fluid can intrinsically serialize, which is any type is that is Json serializable + Json serializable objects/arrays with IFluidHandles at the leaves.

Convenient when declaring type constraints, such as <T extends Serializable>.

(See Jsonable for caveats regarding serialization of undefined and non-finite numbers.)

Signature:

export declare type Serializable = Jsonable<JsonablePrimitive | IFluidHandle>;