Skip to main content

PureDataObject Class

This is a bare-bones base class that does basic setup and enables for factory on an initialize call.

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

To use, import via @fluidframework/aqueduct/legacy.

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

Signature​

export declare abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes> extends TypedEventEmitter<I["Events"] & IEvent> implements IFluidLoadable, IProvideFluidHandle

Extends: TypedEventEmitter<I["Events"] & IEvent>

Implements: IFluidLoadable, IProvideFluidHandle

Type Parameters​

ParameterConstraintDefaultDescription
IDataObjectTypesDataObjectTypesThe optional input types used to strongly type the data object

Remarks​

You probably don't want to inherit from this data store directly unless you are creating another base data store class.

Constructors​

ConstructorAlertsDescription
(constructor)(props)BetaConstructs a new instance of the PureDataObject class

Static Methods​

MethodAlertsReturn TypeDescription
getDataObject(runtime)BetaPromise<PureDataObject>

Properties​

PropertyAlertsModifiersTypeDescription
contextBetareadonlyIFluidDataStoreContextThis context is used to talk up to the IContainerRuntime
handleBetareadonlyIFluidHandleInternal<this>Handle to a data store
idBetareadonlystring
IFluidHandleBetareadonlyIFluidHandleInternal<this>
IFluidLoadableBetareadonlythis
initializePBetaPromise<void> | undefinedInternal implementation detail. Subclasses should not use this.
initPropsBetaoptionalI["InitialState"]
providersBetareadonlyAsyncFluidObjectProvider<I["OptionalProviders"]>

Providers are FluidObject keyed objects that provide back a promise to the corresponding FluidObject or undefined. Providers injected/provided by the Container and/or HostingApplication

To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store

runtimeBetareadonlyIFluidDataStoreRuntimeThis is your FluidDataStoreRuntime object

Methods​

MethodAlertsReturn TypeDescription
finishInitialization(existing)BetaPromise<void>Await this API to ensure PureDataObject is fully initialized. Initialization happens on demand, only on as-needed bases. In most cases you should allow factory/object to decide when to finish initialization. But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods and need a fully initialized object, then you can await this API to ensure object is fully initialized.
hasInitialized()BetaPromise<void>Called every time the data store is initialized after create or existing.
initializeInternal(existing)BetaPromise<void>

Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should generally not be done.

Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is responsible for ensuring this is only invoked once.

initializingFirstTime(props)BetaPromise<void>Called the first time the data store is initialized (new creations with a new data store runtime)
initializingFromExisting()BetaPromise<void>Called every time but the first time the data store is initialized (creations with an existing data store runtime)
preInitialize()BetaPromise<void>Called every time the data store is initialized, before initializingFirstTime or initializingFromExisting is called.
request(req)BetaPromise<IResponse>

Return this object if someone requests it directly We will return this object in two scenarios:

  1. the request url is a "/"
  1. the request url is empty

Constructor Details​

(constructor)​

Constructs a new instance of the PureDataObject class

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

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

Signature​

constructor(props: IDataObjectProps<I>);

Parameters​

ParameterTypeDescription
propsIDataObjectProps<I>

Property Details​

context​

This context is used to talk up to the IContainerRuntime

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

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

Signature​

protected readonly context: IFluidDataStoreContext;

Type: IFluidDataStoreContext

handle​

Handle to a data store

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

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

Signature​

get handle(): IFluidHandleInternal<this>;

Type: IFluidHandleInternal<this>

id​

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

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

Signature​

get id(): string;

Type: string

IFluidHandle​

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

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

Signature​

get IFluidHandle(): IFluidHandleInternal<this>;

Type: IFluidHandleInternal<this>

IFluidLoadable​

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

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

Signature​

get IFluidLoadable(): this;

Type: this

initializeP​

Internal implementation detail. Subclasses should not use this.

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

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

Signature​

protected initializeP: Promise<void> | undefined;

Type: Promise<void> | undefined

initProps​

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

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

Signature​

protected initProps?: I["InitialState"];

Type: I["InitialState"]

providers​

Providers are FluidObject keyed objects that provide back a promise to the corresponding FluidObject or undefined. Providers injected/provided by the Container and/or HostingApplication

To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store

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

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

Signature​

protected readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;

Type: AsyncFluidObjectProvider<I["OptionalProviders"]>

runtime​

This is your FluidDataStoreRuntime object

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

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

Signature​

protected readonly runtime: IFluidDataStoreRuntime;

Type: IFluidDataStoreRuntime

Method Details​

finishInitialization​

Await this API to ensure PureDataObject is fully initialized. Initialization happens on demand, only on as-needed bases. In most cases you should allow factory/object to decide when to finish initialization. But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods and need a fully initialized object, then you can await this API to ensure object is fully initialized.

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

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

Signature​

finishInitialization(existing: boolean): Promise<void>;

Parameters​

ParameterTypeDescription
existingboolean

Returns​

Return type: Promise<void>

getDataObject​

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

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

Signature​

static getDataObject(runtime: IFluidDataStoreRuntime): Promise<PureDataObject>;

Parameters​

ParameterTypeDescription
runtimeIFluidDataStoreRuntime

Returns​

Return type: Promise<PureDataObject>

hasInitialized​

Called every time the data store is initialized after create or existing.

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

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

Signature​

protected hasInitialized(): Promise<void>;

Returns​

Return type: Promise<void>

initializeInternal​

Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should generally not be done.

Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is responsible for ensuring this is only invoked once.

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

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

Signature​

initializeInternal(existing: boolean): Promise<void>;

Parameters​

ParameterTypeDescription
existingboolean

Returns​

Return type: Promise<void>

initializingFirstTime​

Called the first time the data store is initialized (new creations with a new data store runtime)

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

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

Signature​

protected initializingFirstTime(props?: I["InitialState"]): Promise<void>;

Parameters​

ParameterModifiersTypeDescription
propsoptionalI["InitialState"]Optional props to be passed in on create

Returns​

Return type: Promise<void>

initializingFromExisting​

Called every time but the first time the data store is initialized (creations with an existing data store runtime)

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

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

Signature​

protected initializingFromExisting(): Promise<void>;

Returns​

Return type: Promise<void>

preInitialize​

Called every time the data store is initialized, before initializingFirstTime or initializingFromExisting is called.

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

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

Signature​

protected preInitialize(): Promise<void>;

Returns​

Return type: Promise<void>

request​

Return this object if someone requests it directly We will return this object in two scenarios:

  1. the request url is a "/"
  1. the request url is empty
This API is provided for existing users, but is not recommended for new users.

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

Signature​

request(req: IRequest): Promise<IResponse>;

Parameters​

ParameterTypeDescription
reqIRequest

Returns​

Return type: Promise<IResponse>