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

Parameter Constraint Default Description
I DataObjectTypes DataObjectTypes The 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

Constructor Alerts Description
(constructor)(props) Beta Constructs a new instance of the PureDataObject class

Static Methods

Method Alerts Return Type Description
getDataObject(runtime) Beta Promise<PureDataObject>

Properties

Property Alerts Modifiers Type Description
context Beta readonly IFluidDataStoreContext This context is used to talk up to the IContainerRuntime
handle Beta readonly IFluidHandleInternal<this> Handle to a data store
id Beta readonly string
IFluidHandle Beta readonly IFluidHandleInternal<this>
IFluidLoadable Beta readonly this
initializeP Beta Promise<void> | undefined Internal implementation detail. Subclasses should not use this.
initProps Beta optional I["InitialState"]
providers Beta readonly AsyncFluidObjectProvider<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

runtime Beta readonly IFluidDataStoreRuntime This is your FluidDataStoreRuntime object

Methods

Method Alerts Return Type Description
finishInitialization(existing) Beta Promise<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() Beta Promise<void> Called every time the data store is initialized after create or existing.
initializeInternal(existing) Beta Promise<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) Beta Promise<void> Called the first time the data store is initialized (new creations with a new data store runtime)
initializingFromExisting() Beta Promise<void> Called every time but the first time the data store is initialized (creations with an existing data store runtime)
preInitialize() Beta Promise<void> Called every time the data store is initialized, before initializingFirstTime or initializingFromExisting is called.
request(req) Beta Promise<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

Parameter Type Description
props IDataObjectProps<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

Parameter Type Description
existing boolean

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

Parameter Type Description
runtime IFluidDataStoreRuntime

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

Parameter Type Description
existing boolean

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

Parameter Modifiers Type Description
props optional I["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

Parameter Type Description
req IRequest

Returns

Return type: Promise<IResponse>