@fluidframework/aqueduct Package
The aqueduct
package is a library for building Fluid objects and Fluid containers within the Fluid Framework. Its goal is to provide a thin base layer over the existing Fluid Framework interfaces that allows developers to get started quickly.
Remarks
About the package name: An Aqueduct is a way to transport water from a source to another location. The package name was chosen because its purpose is to facilitate using lower level constructs and therefore handle 'fluid' items same as an aqueduct.
Interfaces
Interface | Description |
---|---|
DataObjectTypes | This type is used as the base generic input to DataObject and PureDataObject. |
IDataObjectProps | |
IRootDataObjectFactory |
Classes
Class | Description |
---|---|
BaseContainerRuntimeFactory | BaseContainerRuntimeFactory produces container runtimes with a given data store and service registry, as well as given request handlers. It can be subclassed to implement a first-time initialization procedure for the containers it creates. |
BaseContainerService | This class is a simple starter class for building a Container Service. It simply provides routing |
ContainerRuntimeFactoryWithDefaultDataStore |
A ContainerRuntimeFactory that initializes Containers with a single default data store, which can be requested from the container with an empty URL. This factory should be exposed as fluidExport off the entry point to your module. |
DataObject |
DataObject is a base data store that is primed with a root directory. It ensures that it is created and ready before you can access it. Having a single root directory allows for easier development. Instead of creating and registering channels with the runtime any new DDS that is set on the root will automatically be registered. |
DataObjectFactory | DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects. It facilitates DataObject's features (such as its shared directory) by ensuring relevant shared objects etc are available to the factory. |
PureDataObject | This is a bare-bones base class that does basic setup and enables for factory on an initialize call. You probably don't want to inherit from this data store directly unless you are creating another base data store class |
PureDataObjectFactory | PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject. Consumers should typically use DataObjectFactory instead unless creating another base data store factory. |
Types
TypeAlias | Description |
---|---|
ContainerServiceRegistryEntries |
Functions
Function | Return Type | Description |
---|---|---|
defaultFluidObjectRequestHandler(fluidObject, request) | IResponse | Default request handler for a Fluid object that returns the object itself if: 1. the request url is empty 2. the request url is "/" 3. the request url starts with "/" and is followed by a query param, such as /?key=value Returns a 404 error for any other url. |
getDefaultObjectFromContainer(container) | Promise<T> |
Helper function for getting the default Fluid Object from a Container. This function only works for Containers that support "/" request. T - defines the type you expect to be returned |
getObjectFromContainer(path, container) | Promise<T> |
Helper function for getting a Fluid Object from a Container given a path/url. This function only works for Containers that support getting FluidObjects via request. T - defines the type you expect to be returned |
getObjectWithIdFromContainer(id, container) | Promise<T> |
Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for Containers that support getting FluidObjects via request. T - defines the type you expect to be returned |
waitForAttach(dataStoreRuntime) | Promise<void> |
Variables
Variable | Type | Description |
---|---|---|
defaultRouteRequestHandler | (defaultRootId: string) => (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined> | Pipe through container request into internal request. If request is empty and default url is provided, redirect request to such default url. |
generateContainerServicesRequestHandler | (serviceRegistry: ContainerServiceRegistryEntries) => RuntimeRequestHandler | Given a collection of IContainerServices will produce a RequestHandler for them all |
mountableViewRequestHandler | (MountableViewClass: IFluidMountableViewClass, handlers: RuntimeRequestHandler[]) => (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse> |
A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable view isn't necessary. When a request is received with a mountableView: true header, this request handler will reissue the request without the header, and respond with a mountable view of the given class using the response. |
serviceRoutePathRoot |
Function Details
defaultFluidObjectRequestHandler
Default request handler for a Fluid object that returns the object itself if: 1. the request url is empty 2. the request url is "/" 3. the request url starts with "/" and is followed by a query param, such as /?key=value Returns a 404 error for any other url.
Signature
export declare function defaultFluidObjectRequestHandler(fluidObject: FluidObject, request: IRequest): IResponse;
Parameters
Parameter | Type | Description |
---|---|---|
fluidObject | FluidObject | |
request | IRequest |
Returns
Return type: IResponse
getDefaultObjectFromContainer
Helper function for getting the default Fluid Object from a Container. This function only works for Containers that support "/" request.
T - defines the type you expect to be returned
Signature
export declare function getDefaultObjectFromContainer<T = FluidObject>(container: IContainer): Promise<T>;
Type Parameters
Parameter | Default | Description |
---|---|---|
T | FluidObject |
Parameters
Parameter | Type | Description |
---|---|---|
container | IContainer | Container you're attempting to get the object from |
Returns
Return type: Promise<T>
getObjectFromContainer
Helper function for getting a Fluid Object from a Container given a path/url. This function only works for Containers that support getting FluidObjects via request.
T - defines the type you expect to be returned
Signature
export declare function getObjectFromContainer<T = FluidObject>(path: string, container: IContainer): Promise<T>;
Type Parameters
Parameter | Default | Description |
---|---|---|
T | FluidObject |
Parameters
Parameter | Type | Description |
---|---|---|
path | string | Unique path/url of the FluidObject |
container | IContainer | Container you're attempting to get the object from |
Returns
Return type: Promise<T>
getObjectWithIdFromContainer
Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for Containers that support getting FluidObjects via request.
T - defines the type you expect to be returned
Signature
export declare function getObjectWithIdFromContainer<T = FluidObject>(id: string, container: IContainer): Promise<T>;
Type Parameters
Parameter | Default | Description |
---|---|---|
T | FluidObject |
Parameters
Parameter | Type | Description |
---|---|---|
id | string | Unique id of the FluidObject |
container | IContainer | Container you're attempting to get the object from |
Returns
Return type: Promise<T>
waitForAttach
Signature
export declare function waitForAttach(dataStoreRuntime: IFluidDataStoreRuntime): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
dataStoreRuntime | IFluidDataStoreRuntime |
Returns
Return type: Promise<void>
Variable Details
defaultRouteRequestHandler
Pipe through container request into internal request. If request is empty and default url is provided, redirect request to such default url.
Signature
defaultRouteRequestHandler: (defaultRootId: string) => (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>
Type: (defaultRootId: string) => (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>
generateContainerServicesRequestHandler
Given a collection of IContainerServices will produce a RequestHandler for them all
Signature
generateContainerServicesRequestHandler: (serviceRegistry: ContainerServiceRegistryEntries) => RuntimeRequestHandler
Type: (serviceRegistry: ContainerServiceRegistryEntries) => RuntimeRequestHandler
mountableViewRequestHandler
A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable view isn't necessary.
When a request is received with a mountableView: true header, this request handler will reissue the request without the header, and respond with a mountable view of the given class using the response.
Signature
mountableViewRequestHandler: (MountableViewClass: IFluidMountableViewClass, handlers: RuntimeRequestHandler[]) => (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse>
Type: (MountableViewClass: IFluidMountableViewClass, handlers: RuntimeRequestHandler[]) => (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse>
serviceRoutePathRoot
Signature
serviceRoutePathRoot = "_services"