@fluidframework/aqueduct 2.70.0-360753 → 2.70.0-361248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +2 -2
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.d.ts +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.js +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts +2 -2
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
- package/lib/data-object-factories/pureDataObjectFactory.d.ts +1 -1
- package/lib/data-object-factories/pureDataObjectFactory.js +1 -1
- package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
- package/package.json +20 -20
- package/src/container-runtime-factories/baseContainerRuntimeFactory.ts +1 -1
- package/src/data-object-factories/pureDataObjectFactory.ts +1 -1
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IContainerContext, IRuntime } from "@fluidframework/container-definitions/internal";
|
|
6
|
-
import { type IContainerRuntimeOptions
|
|
6
|
+
import { type IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
7
7
|
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
8
8
|
import type { FluidObject } from "@fluidframework/core-interfaces";
|
|
9
9
|
import { type RuntimeRequestHandler } from "@fluidframework/request-handler/internal";
|
|
10
|
-
import type { IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions/internal";
|
|
10
|
+
import type { IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry, MinimumVersionForCollab, NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions/internal";
|
|
11
11
|
import { RuntimeFactoryHelper } from "@fluidframework/runtime-utils/internal";
|
|
12
12
|
import { type IFluidDependencySynthesizer } from "@fluidframework/synthesize/internal";
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,iBAAiB,EACjB,QAAQ,EACR,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAGN,KAAK,wBAAwB,EAC7B,
|
|
1
|
+
{"version":3,"file":"baseContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,iBAAiB,EACjB,QAAQ,EACR,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAGN,KAAK,wBAAwB,EAC7B,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAEN,KAAK,qBAAqB,EAG1B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACX,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,EACvB,kCAAkC,EAClC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAEN,KAAK,2BAA2B,EAEhC,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,eAAe,EAAE,kCAAkC,CAAC;IACpD;;OAEG;IACH,mBAAmB,CAAC,E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OAAO,CAAC,IAAI,CAAC;CAClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,
|
|
1
|
+
{"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,yEAIoD;AAGpD,uEAKkD;AAOlD,qEAA8E;AAC9E,kEAI6C;AAsC7C;;;;;;GAMG;AACH,MAAa,2BACZ,SAAQ,+BAAoB;IAG5B;;OAEG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAWD,YAAmB,KAAuC;QACzD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAC7C,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;QACjD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,iCAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjE,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,oBAAoB,CAAC,OAA0B;QAC3D,MAAM,IAAI,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,uBAAuB,CAAC,OAA0B;QAC9D,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,aAAa,CACzB,OAA0B,EAC1B,QAAiB;QAEjB,MAAM,KAAK,GAAgD,OAAO,CAAC,KAAK,CAAC;QACzE,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,MAAM,EAAE,GAAG,IAAI,8BAAmB,CACjC,IAAI,CAAC,mBAAmB,EACxB,KAAK,CAAC,2BAA2B,CACjC,CAAC;YACF,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC;QACxC,CAAC;QAED,OAAO,IAAA,+BAAoB,EAAC;YAC3B,OAAO;YACP,QAAQ;YACR,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,cAAc,EAAE,KAAK;YACrB,gDAAgD;YAChD,cAAc,EAAE,IAAA,qCAA0B,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC;YACnE,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;SAC7C,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B,IAAkB,CAAC;IAE5F;;;;OAIG;IACO,KAAK,CAAC,uBAAuB,CAAC,OAA0B,IAAkB,CAAC;CACrF;AA/FD,kEA+FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIContainerContext,\n\tIRuntime,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidDataStoreRegistry,\n\tloadContainerRuntime,\n\ttype IContainerRuntimeOptions,\n} from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\ttype RuntimeRequestHandler,\n\t// eslint-disable-next-line import/no-deprecated\n\tbuildRuntimeRequestHandler,\n} from \"@fluidframework/request-handler/internal\";\nimport type {\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tMinimumVersionForCollab,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tDependencyContainer,\n\ttype IFluidDependencySynthesizer,\n\ttype IProvideFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\n/**\n * {@link BaseContainerRuntimeFactory} construction properties.\n * @legacy\n * @beta\n */\nexport interface BaseContainerRuntimeFactoryProps {\n\t/**\n\t * The data store registry for containers produced.\n\t */\n\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t/**\n\t * @deprecated Will be removed in a future release.\n\t */\n\tdependencyContainer?: IFluidDependencySynthesizer;\n\t/**\n\t * Request handlers for containers produced.\n\t * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\trequestHandlers?: RuntimeRequestHandler[];\n\t/**\n\t * The runtime options passed to the ContainerRuntime when instantiating it\n\t */\n\truntimeOptions?: IContainerRuntimeOptions;\n\t/**\n\t * Function that will initialize the entryPoint of the ContainerRuntime instances\n\t * created with this factory\n\t */\n\tprovideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\t/**\n\t * Minimum version of the FF runtime that is required to collaborate on new documents.\n\t * See {@link @fluidframework/container-runtime#LoadContainerRuntimeParams.minVersionForCollab} for more details on this property.\n\t */\n\tminVersionForCollab?: MinimumVersionForCollab | undefined;\n}\n\n/**\n * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,\n * request handlers, runtimeOptions, and entryPoint initialization function.\n * It can be subclassed to implement a first-time initialization procedure for the containers it creates.\n * @legacy\n * @beta\n */\nexport class BaseContainerRuntimeFactory\n\textends RuntimeFactoryHelper\n\timplements IProvideFluidDataStoreRegistry\n{\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.registry;\n\t}\n\tprivate readonly registry: IFluidDataStoreRegistry;\n\n\tprivate readonly registryEntries: NamedFluidDataStoreRegistryEntries;\n\tprivate readonly dependencyContainer?: IFluidDependencySynthesizer;\n\tprivate readonly runtimeOptions?: IContainerRuntimeOptions;\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly requestHandlers: RuntimeRequestHandler[];\n\tprivate readonly provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\tprivate readonly minVersionForCollab: MinimumVersionForCollab | undefined;\n\n\tpublic constructor(props: BaseContainerRuntimeFactoryProps) {\n\t\tsuper();\n\n\t\tthis.registryEntries = props.registryEntries;\n\t\tthis.dependencyContainer = props.dependencyContainer;\n\t\tthis.runtimeOptions = props.runtimeOptions;\n\t\tthis.provideEntryPoint = props.provideEntryPoint;\n\t\tthis.requestHandlers = props.requestHandlers ?? [];\n\t\tthis.registry = new FluidDataStoreRegistry(this.registryEntries);\n\t\tthis.minVersionForCollab = props.minVersionForCollab;\n\t}\n\n\t/**\n\t * Called the one time the container is created, and not on any subsequent load.\n\t * i.e. only when it's initialized on the client that first created it\n\t * @param runtime - The runtime for the container being initialized\n\t */\n\tpublic async instantiateFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\tawait this.containerInitializingFirstTime(runtime);\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\t/**\n\t * Called every time the container runtime is loaded for an existing container.\n\t * i.e. every time it's initialized _except_ for when it is first created\n\t * @param runtime - The runtime for the container being initialized\n\t */\n\tpublic async instantiateFromExisting(runtime: IContainerRuntime): Promise<void> {\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\t/**\n\t * Called at the start of initializing a container, to create the container runtime instance.\n\t * @param context - The context for the container being initialized\n\t * @param existing - Whether the container already exists and is being loaded (else it's being created new just now)\n\t */\n\tpublic async preInitialize(\n\t\tcontext: IContainerContext,\n\t\texisting: boolean,\n\t): Promise<IContainerRuntime & IRuntime> {\n\t\tconst scope: Partial<IProvideFluidDependencySynthesizer> = context.scope;\n\t\tif (this.dependencyContainer) {\n\t\t\tconst dc = new DependencyContainer<FluidObject>(\n\t\t\t\tthis.dependencyContainer,\n\t\t\t\tscope.IFluidDependencySynthesizer,\n\t\t\t);\n\t\t\tscope.IFluidDependencySynthesizer = dc;\n\t\t}\n\n\t\treturn loadContainerRuntime({\n\t\t\tcontext,\n\t\t\texisting,\n\t\t\truntimeOptions: this.runtimeOptions,\n\t\t\tregistryEntries: this.registryEntries,\n\t\t\tcontainerScope: scope,\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\trequestHandler: buildRuntimeRequestHandler(...this.requestHandlers),\n\t\t\tprovideEntryPoint: this.provideEntryPoint,\n\t\t\tminVersionForCollab: this.minVersionForCollab,\n\t\t});\n\t}\n\n\t/**\n\t * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container\n\t * is created. This likely includes creating any initial data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {}\n\n\t/**\n\t * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.\n\t * This likely includes loading any data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerHasInitialized(runtime: IContainerRuntime): Promise<void> {}\n}\n"]}
|
|
@@ -149,7 +149,7 @@ export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I ext
|
|
|
149
149
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
150
150
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
151
151
|
*
|
|
152
|
-
* @deprecated
|
|
152
|
+
* @deprecated the issue is that it does not allow the customer to decide the conflict resolution policy when an
|
|
153
153
|
* aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.
|
|
154
154
|
*/
|
|
155
155
|
createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime, initialState?: I["InitialState"]): Promise<TObj>;
|
|
@@ -201,7 +201,7 @@ class PureDataObjectFactory {
|
|
|
201
201
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
202
202
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
203
203
|
*
|
|
204
|
-
* @deprecated
|
|
204
|
+
* @deprecated the issue is that it does not allow the customer to decide the conflict resolution policy when an
|
|
205
205
|
* aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.
|
|
206
206
|
*/
|
|
207
207
|
async createRootInstance(rootDataStoreId, runtime, initialState) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAAoF;AAGpF,kEAA6D;AAC7D,iEAI4C;AAwC5C;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAG7B,EACD,IAAI,EACJ,OAAO,EACP,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,QAAQ,GACwB;IAIhC,OAAO;IACP,IAAI,YAAY,GAAG,eAAe,CAAC;IAEnC,mBAAmB;IACnB,YAAY,GAAG,IAAA,8BAAmB,EACjC,KAAK,EAAE,OAAiB,EAAE,UAAiC,EAAE,EAAE;QAC9D,iFAAiF;QACjF,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,CAAS,CAAC;QAC/D,IAAA,iBAAM,E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G,EAAE,CAAS,CAAC;QACrC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAES,KAAK,CAAC,yBAAyB,CACxC,gBAAuC,EACvC,WAA8B,EAC9B,YAAgC,EAChC,cAAuB;QAEvB,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,kBAAkB,CACjC,OAAuC,EACvC,YAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CAAC;YACpD,GAAG,IAAI,CAAC,WAAW;YACnB,OAAO;YACP,QAAQ,EAAE,KAAK;YACf,YAAY;SACZ,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AAxQD,sDAwQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStorePolicies,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\ninterface CreateDataObjectProps<TObj extends PureDataObject, I extends DataObjectTypes> {\n\tctor: new (props: IDataObjectProps<I>) => TObj;\n\tcontext: IFluidDataStoreContext;\n\tsharedObjectRegistry: ISharedObjectRegistry;\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\truntimeClassArg: typeof FluidDataStoreRuntime;\n\texisting: boolean;\n\tinitialState?: I[\"InitialState\"];\n\tpolicies?: Partial<IFluidDataStorePolicies>;\n}\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>({\n\tctor,\n\tcontext,\n\tsharedObjectRegistry,\n\toptionalProviders,\n\truntimeClassArg,\n\texisting,\n\tinitialState: initProps,\n\tpolicies,\n}: CreateDataObjectProps<TObj, I>): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t\tpolicies,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * Represents the properties required to create a DataObjectFactory.\n * This includes the type identifier, constructor, shared objects, optional providers,\n * registry entries, and the runtime class to use for the data object.\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport interface DataObjectFactoryProps<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> {\n\t/**\n\t * The type identifier for the data object factory.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The constructor for the data object.\n\t */\n\treadonly ctor: new (\n\t\tprops: IDataObjectProps<I>,\n\t) => TObj;\n\n\t/**\n\t * The shared objects (DDSes) to be registered with the data object.\n\t */\n\treadonly sharedObjects?: readonly IChannelFactory[];\n\n\t/**\n\t * Optional providers for dependency injection.\n\t */\n\treadonly optionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\n\t/**\n\t * Registry entries for named data stores.\n\t */\n\treadonly registryEntries?: NamedFluidDataStoreRegistryEntries;\n\n\t/**\n\t * The runtime class to use for the data object.\n\t */\n\treadonly runtimeClass?: typeof FluidDataStoreRuntime;\n\n\t/**\n\t * Optional policies that can be applied to the DataObject.\n\t * These policies define specific behaviors or constraints for the data object.\n\t */\n\treadonly policies?: Partial<IFluidDataStorePolicies>;\n}\n\n/**\n * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\tprivate readonly createProps: Omit<CreateDataObjectProps<TObj, I>, \"existing\" | \"context\">;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t */\n\tpublic readonly type: string;\n\n\t/**\n\t * @remarks Use the props object based constructor instead.\n\t * No new features will be added to this constructor,\n\t * and it will eventually be deprecated and removed.\n\t */\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects?: readonly IChannelFactory[],\n\t\toptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeClass?: typeof FluidDataStoreRuntime,\n\t);\n\tpublic constructor(props: DataObjectFactoryProps<TObj, I>);\n\tpublic constructor(\n\t\tpropsOrType: DataObjectFactoryProps<TObj, I> | string,\n\t\tmaybeCtor?: new (doProps: IDataObjectProps<I>) => TObj,\n\t\tmaybeSharedObjects?: readonly IChannelFactory[],\n\t\tmaybeOptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tmaybeRegistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tmaybeRuntimeFactory?: typeof FluidDataStoreRuntime,\n\t) {\n\t\tconst newProps =\n\t\t\ttypeof propsOrType === \"string\"\n\t\t\t\t? {\n\t\t\t\t\t\ttype: propsOrType,\n\t\t\t\t\t\t// both the arg and props base constructor require this param\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tctor: maybeCtor!,\n\t\t\t\t\t\tsharedObjects: maybeSharedObjects,\n\t\t\t\t\t\toptionalProviders: maybeOptionalProviders,\n\t\t\t\t\t\tregistryEntries: maybeRegistryEntries,\n\t\t\t\t\t\truntimeClass: maybeRuntimeFactory,\n\t\t\t\t\t}\n\t\t\t\t: propsOrType;\n\n\t\tif (newProps.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tthis.type = newProps.type;\n\n\t\tthis.createProps = {\n\t\t\tctor: newProps.ctor,\n\t\t\toptionalProviders: newProps.optionalProviders ?? {},\n\t\t\tsharedObjectRegistry: new Map(newProps.sharedObjects?.map((ext) => [ext.type, ext])),\n\t\t\truntimeClassArg: newProps.runtimeClass ?? FluidDataStoreRuntime,\n\t\t\tpolicies: newProps.policies,\n\t\t};\n\n\t\tif (newProps.registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(newProps.registryEntries);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject({ ...this.createProps, context, existing });\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: readonly string[],\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated - the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: readonly string[],\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAAoF;AAGpF,kEAA6D;AAC7D,iEAI4C;AAwC5C;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAG7B,EACD,IAAI,EACJ,OAAO,EACP,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,QAAQ,GACwB;IAIhC,OAAO;IACP,IAAI,YAAY,GAAG,eAAe,CAAC;IAEnC,mBAAmB;IACnB,YAAY,GAAG,IAAA,8BAAmB,EACjC,KAAK,EAAE,OAAiB,EAAE,UAAiC,EAAE,EAAE;QAC9D,iFAAiF;QACjF,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,CAAS,CAAC;QAC/D,IAAA,iBAAM,EACL,UAAU,CAAC,OAAO,KAAK,SAAS,EAChC,KAAK,CAAC,yDAAyD,CAC/D,CAAC;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,EACD,YAAY,CACZ,CAAC;IAEF,gFAAgF;IAChF,+DAA+D;IAC/D,6EAA6E;IAC7E,MAAM,OAAO,GAA0B,IAAI,YAAY;IACtD,uCAAuC;IACvC,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,KAAK,EAAE,EAA0B,EAAE,EAAE;QACpC,IAAA,iBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACpE,sGAAsG;QACtG,yGAAyG;QACzG,oFAAoF;QACpF,MAAM,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC,uBAAu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IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AAxQD,sDAwQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStorePolicies,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\ninterface CreateDataObjectProps<TObj extends PureDataObject, I extends DataObjectTypes> {\n\tctor: new (props: IDataObjectProps<I>) => TObj;\n\tcontext: IFluidDataStoreContext;\n\tsharedObjectRegistry: ISharedObjectRegistry;\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\truntimeClassArg: typeof FluidDataStoreRuntime;\n\texisting: boolean;\n\tinitialState?: I[\"InitialState\"];\n\tpolicies?: Partial<IFluidDataStorePolicies>;\n}\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>({\n\tctor,\n\tcontext,\n\tsharedObjectRegistry,\n\toptionalProviders,\n\truntimeClassArg,\n\texisting,\n\tinitialState: initProps,\n\tpolicies,\n}: CreateDataObjectProps<TObj, I>): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t\tpolicies,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * Represents the properties required to create a DataObjectFactory.\n * This includes the type identifier, constructor, shared objects, optional providers,\n * registry entries, and the runtime class to use for the data object.\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport interface DataObjectFactoryProps<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> {\n\t/**\n\t * The type identifier for the data object factory.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The constructor for the data object.\n\t */\n\treadonly ctor: new (\n\t\tprops: IDataObjectProps<I>,\n\t) => TObj;\n\n\t/**\n\t * The shared objects (DDSes) to be registered with the data object.\n\t */\n\treadonly sharedObjects?: readonly IChannelFactory[];\n\n\t/**\n\t * Optional providers for dependency injection.\n\t */\n\treadonly optionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\n\t/**\n\t * Registry entries for named data stores.\n\t */\n\treadonly registryEntries?: NamedFluidDataStoreRegistryEntries;\n\n\t/**\n\t * The runtime class to use for the data object.\n\t */\n\treadonly runtimeClass?: typeof FluidDataStoreRuntime;\n\n\t/**\n\t * Optional policies that can be applied to the DataObject.\n\t * These policies define specific behaviors or constraints for the data object.\n\t */\n\treadonly policies?: Partial<IFluidDataStorePolicies>;\n}\n\n/**\n * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\tprivate readonly createProps: Omit<CreateDataObjectProps<TObj, I>, \"existing\" | \"context\">;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t */\n\tpublic readonly type: string;\n\n\t/**\n\t * @remarks Use the props object based constructor instead.\n\t * No new features will be added to this constructor,\n\t * and it will eventually be deprecated and removed.\n\t */\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects?: readonly IChannelFactory[],\n\t\toptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeClass?: typeof FluidDataStoreRuntime,\n\t);\n\tpublic constructor(props: DataObjectFactoryProps<TObj, I>);\n\tpublic constructor(\n\t\tpropsOrType: DataObjectFactoryProps<TObj, I> | string,\n\t\tmaybeCtor?: new (doProps: IDataObjectProps<I>) => TObj,\n\t\tmaybeSharedObjects?: readonly IChannelFactory[],\n\t\tmaybeOptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tmaybeRegistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tmaybeRuntimeFactory?: typeof FluidDataStoreRuntime,\n\t) {\n\t\tconst newProps =\n\t\t\ttypeof propsOrType === \"string\"\n\t\t\t\t? {\n\t\t\t\t\t\ttype: propsOrType,\n\t\t\t\t\t\t// both the arg and props base constructor require this param\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tctor: maybeCtor!,\n\t\t\t\t\t\tsharedObjects: maybeSharedObjects,\n\t\t\t\t\t\toptionalProviders: maybeOptionalProviders,\n\t\t\t\t\t\tregistryEntries: maybeRegistryEntries,\n\t\t\t\t\t\truntimeClass: maybeRuntimeFactory,\n\t\t\t\t\t}\n\t\t\t\t: propsOrType;\n\n\t\tif (newProps.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tthis.type = newProps.type;\n\n\t\tthis.createProps = {\n\t\t\tctor: newProps.ctor,\n\t\t\toptionalProviders: newProps.optionalProviders ?? {},\n\t\t\tsharedObjectRegistry: new Map(newProps.sharedObjects?.map((ext) => [ext.type, ext])),\n\t\t\truntimeClassArg: newProps.runtimeClass ?? FluidDataStoreRuntime,\n\t\t\tpolicies: newProps.policies,\n\t\t};\n\n\t\tif (newProps.registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(newProps.registryEntries);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject({ ...this.createProps, context, existing });\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: readonly string[],\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: readonly string[],\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IContainerContext, IRuntime } from "@fluidframework/container-definitions/internal";
|
|
6
|
-
import { type IContainerRuntimeOptions
|
|
6
|
+
import { type IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
7
7
|
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
8
8
|
import type { FluidObject } from "@fluidframework/core-interfaces";
|
|
9
9
|
import { type RuntimeRequestHandler } from "@fluidframework/request-handler/internal";
|
|
10
|
-
import type { IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions/internal";
|
|
10
|
+
import type { IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry, MinimumVersionForCollab, NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions/internal";
|
|
11
11
|
import { RuntimeFactoryHelper } from "@fluidframework/runtime-utils/internal";
|
|
12
12
|
import { type IFluidDependencySynthesizer } from "@fluidframework/synthesize/internal";
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,iBAAiB,EACjB,QAAQ,EACR,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAGN,KAAK,wBAAwB,EAC7B,
|
|
1
|
+
{"version":3,"file":"baseContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,iBAAiB,EACjB,QAAQ,EACR,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAGN,KAAK,wBAAwB,EAC7B,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAEN,KAAK,qBAAqB,EAG1B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACX,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,EACvB,kCAAkC,EAClC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAEN,KAAK,2BAA2B,EAEhC,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,eAAe,EAAE,kCAAkC,CAAC;IACpD;;OAEG;IACH,mBAAmB,CAAC,EAAE,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,CAAC,IAAI,CAAC;CAClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,sBAAsB,EACtB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,sBAAsB,EACtB,oBAAoB,GAEpB,MAAM,4CAA4C,CAAC;AAGpD,OAAO;AAGN,gDAAgD;AAChD,0BAA0B,GAC1B,MAAM,0CAA0C,CAAC;AAOlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EACN,mBAAmB,GAGnB,MAAM,qCAAqC,CAAC;AAsC7C;;;;;;GAMG;AACH,MAAM,OAAO,2BACZ,SAAQ,oBAAoB;IAG5B;;OAEG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAWD,YAAmB,KAAuC;QACzD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAC7C,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;QACjD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjE,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,oBAAoB,CAAC,OAA0B;QAC3D,MAAM,IAAI,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,uBAAuB,CAAC,OAA0B;QAC9D,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,aAAa,CACzB,OAA0B,EAC1B,QAAiB;QAEjB,MAAM,KAAK,GAAgD,OAAO,CAAC,KAAK,CAAC;QACzE,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,MAAM,EAAE,GAAG,IAAI,mBAAmB,CACjC,IAAI,CAAC,mBAAmB,EACxB,KAAK,CAAC,2BAA2B,CACjC,CAAC;YACF,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC;QACxC,CAAC;QAED,OAAO,oBAAoB,CAAC;YAC3B,OAAO;YACP,QAAQ;YACR,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,cAAc,EAAE,KAAK;YACrB,gDAAgD;YAChD,cAAc,EAAE,0BAA0B,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC;YACnE,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;SAC7C,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B,IAAkB,CAAC;IAE5F;;;;OAIG;IACO,KAAK,CAAC,uBAAuB,CAAC,OAA0B,IAAkB,CAAC;CACrF","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIContainerContext,\n\tIRuntime,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidDataStoreRegistry,\n\tloadContainerRuntime,\n\ttype IContainerRuntimeOptions,\n} from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\ttype RuntimeRequestHandler,\n\t// eslint-disable-next-line import/no-deprecated\n\tbuildRuntimeRequestHandler,\n} from \"@fluidframework/request-handler/internal\";\nimport type {\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tMinimumVersionForCollab,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tDependencyContainer,\n\ttype IFluidDependencySynthesizer,\n\ttype IProvideFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\n/**\n * {@link BaseContainerRuntimeFactory} construction properties.\n * @legacy\n * @beta\n */\nexport interface BaseContainerRuntimeFactoryProps {\n\t/**\n\t * The data store registry for containers produced.\n\t */\n\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t/**\n\t * @deprecated Will be removed in a future release.\n\t */\n\tdependencyContainer?: IFluidDependencySynthesizer;\n\t/**\n\t * Request handlers for containers produced.\n\t * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\trequestHandlers?: RuntimeRequestHandler[];\n\t/**\n\t * The runtime options passed to the ContainerRuntime when instantiating it\n\t */\n\truntimeOptions?: IContainerRuntimeOptions;\n\t/**\n\t * Function that will initialize the entryPoint of the ContainerRuntime instances\n\t * created with this factory\n\t */\n\tprovideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\t/**\n\t * Minimum version of the FF runtime that is required to collaborate on new documents.\n\t * See {@link @fluidframework/container-runtime#LoadContainerRuntimeParams.minVersionForCollab} for more details on this property.\n\t */\n\tminVersionForCollab?: MinimumVersionForCollab | undefined;\n}\n\n/**\n * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,\n * request handlers, runtimeOptions, and entryPoint initialization function.\n * It can be subclassed to implement a first-time initialization procedure for the containers it creates.\n * @legacy\n * @beta\n */\nexport class BaseContainerRuntimeFactory\n\textends RuntimeFactoryHelper\n\timplements IProvideFluidDataStoreRegistry\n{\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.registry;\n\t}\n\tprivate readonly registry: IFluidDataStoreRegistry;\n\n\tprivate readonly registryEntries: NamedFluidDataStoreRegistryEntries;\n\tprivate readonly dependencyContainer?: IFluidDependencySynthesizer;\n\tprivate readonly runtimeOptions?: IContainerRuntimeOptions;\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly requestHandlers: RuntimeRequestHandler[];\n\tprivate readonly provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\tprivate readonly minVersionForCollab: MinimumVersionForCollab | undefined;\n\n\tpublic constructor(props: BaseContainerRuntimeFactoryProps) {\n\t\tsuper();\n\n\t\tthis.registryEntries = props.registryEntries;\n\t\tthis.dependencyContainer = props.dependencyContainer;\n\t\tthis.runtimeOptions = props.runtimeOptions;\n\t\tthis.provideEntryPoint = props.provideEntryPoint;\n\t\tthis.requestHandlers = props.requestHandlers ?? [];\n\t\tthis.registry = new FluidDataStoreRegistry(this.registryEntries);\n\t\tthis.minVersionForCollab = props.minVersionForCollab;\n\t}\n\n\t/**\n\t * Called the one time the container is created, and not on any subsequent load.\n\t * i.e. only when it's initialized on the client that first created it\n\t * @param runtime - The runtime for the container being initialized\n\t */\n\tpublic async instantiateFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\tawait this.containerInitializingFirstTime(runtime);\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\t/**\n\t * Called every time the container runtime is loaded for an existing container.\n\t * i.e. every time it's initialized _except_ for when it is first created\n\t * @param runtime - The runtime for the container being initialized\n\t */\n\tpublic async instantiateFromExisting(runtime: IContainerRuntime): Promise<void> {\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\t/**\n\t * Called at the start of initializing a container, to create the container runtime instance.\n\t * @param context - The context for the container being initialized\n\t * @param existing - Whether the container already exists and is being loaded (else it's being created new just now)\n\t */\n\tpublic async preInitialize(\n\t\tcontext: IContainerContext,\n\t\texisting: boolean,\n\t): Promise<IContainerRuntime & IRuntime> {\n\t\tconst scope: Partial<IProvideFluidDependencySynthesizer> = context.scope;\n\t\tif (this.dependencyContainer) {\n\t\t\tconst dc = new DependencyContainer<FluidObject>(\n\t\t\t\tthis.dependencyContainer,\n\t\t\t\tscope.IFluidDependencySynthesizer,\n\t\t\t);\n\t\t\tscope.IFluidDependencySynthesizer = dc;\n\t\t}\n\n\t\treturn loadContainerRuntime({\n\t\t\tcontext,\n\t\t\texisting,\n\t\t\truntimeOptions: this.runtimeOptions,\n\t\t\tregistryEntries: this.registryEntries,\n\t\t\tcontainerScope: scope,\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\trequestHandler: buildRuntimeRequestHandler(...this.requestHandlers),\n\t\t\tprovideEntryPoint: this.provideEntryPoint,\n\t\t\tminVersionForCollab: this.minVersionForCollab,\n\t\t});\n\t}\n\n\t/**\n\t * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container\n\t * is created. This likely includes creating any initial data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {}\n\n\t/**\n\t * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.\n\t * This likely includes loading any data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerHasInitialized(runtime: IContainerRuntime): Promise<void> {}\n}\n"]}
|
|
@@ -149,7 +149,7 @@ export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I ext
|
|
|
149
149
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
150
150
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
151
151
|
*
|
|
152
|
-
* @deprecated
|
|
152
|
+
* @deprecated the issue is that it does not allow the customer to decide the conflict resolution policy when an
|
|
153
153
|
* aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.
|
|
154
154
|
*/
|
|
155
155
|
createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime, initialState?: I["InitialState"]): Promise<TObj>;
|
|
@@ -198,7 +198,7 @@ export class PureDataObjectFactory {
|
|
|
198
198
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
199
199
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
200
200
|
*
|
|
201
|
-
* @deprecated
|
|
201
|
+
* @deprecated the issue is that it does not allow the customer to decide the conflict resolution policy when an
|
|
202
202
|
* aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.
|
|
203
203
|
*/
|
|
204
204
|
async createRootInstance(rootDataStoreId, runtime, initialState) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGpF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,qBAAqB,EAErB,mBAAmB,GACnB,MAAM,oCAAoC,CAAC;AAwC5C;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAG7B,EACD,IAAI,EACJ,OAAO,EACP,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,QAAQ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GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QAC5D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,6BAA6B,CAAC,eAAe,CAAC,CAAC;YAC5E,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC/E,OAAO,CAAC,MAAM,MAAM,CAAC,GAAG,EAAE,CAAS,CAAC;QACrC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAES,KAAK,CAAC,yBAAyB,CACxC,gBAAuC,EACvC,WAA8B,EAC9B,YAAgC,EAChC,cAAuB;QAEvB,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,kBAAkB,CACjC,OAAuC,EACvC,YAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CAAC;YACpD,GAAG,IAAI,CAAC,WAAW;YACnB,OAAO;YACP,QAAQ,EAAE,KAAK;YACf,YAAY;SACZ,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStorePolicies,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\ninterface CreateDataObjectProps<TObj extends PureDataObject, I extends DataObjectTypes> {\n\tctor: new (props: IDataObjectProps<I>) => TObj;\n\tcontext: IFluidDataStoreContext;\n\tsharedObjectRegistry: ISharedObjectRegistry;\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\truntimeClassArg: typeof FluidDataStoreRuntime;\n\texisting: boolean;\n\tinitialState?: I[\"InitialState\"];\n\tpolicies?: Partial<IFluidDataStorePolicies>;\n}\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>({\n\tctor,\n\tcontext,\n\tsharedObjectRegistry,\n\toptionalProviders,\n\truntimeClassArg,\n\texisting,\n\tinitialState: initProps,\n\tpolicies,\n}: CreateDataObjectProps<TObj, I>): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t\tpolicies,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * Represents the properties required to create a DataObjectFactory.\n * This includes the type identifier, constructor, shared objects, optional providers,\n * registry entries, and the runtime class to use for the data object.\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport interface DataObjectFactoryProps<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> {\n\t/**\n\t * The type identifier for the data object factory.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The constructor for the data object.\n\t */\n\treadonly ctor: new (\n\t\tprops: IDataObjectProps<I>,\n\t) => TObj;\n\n\t/**\n\t * The shared objects (DDSes) to be registered with the data object.\n\t */\n\treadonly sharedObjects?: readonly IChannelFactory[];\n\n\t/**\n\t * Optional providers for dependency injection.\n\t */\n\treadonly optionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\n\t/**\n\t * Registry entries for named data stores.\n\t */\n\treadonly registryEntries?: NamedFluidDataStoreRegistryEntries;\n\n\t/**\n\t * The runtime class to use for the data object.\n\t */\n\treadonly runtimeClass?: typeof FluidDataStoreRuntime;\n\n\t/**\n\t * Optional policies that can be applied to the DataObject.\n\t * These policies define specific behaviors or constraints for the data object.\n\t */\n\treadonly policies?: Partial<IFluidDataStorePolicies>;\n}\n\n/**\n * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\tprivate readonly createProps: Omit<CreateDataObjectProps<TObj, I>, \"existing\" | \"context\">;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t */\n\tpublic readonly type: string;\n\n\t/**\n\t * @remarks Use the props object based constructor instead.\n\t * No new features will be added to this constructor,\n\t * and it will eventually be deprecated and removed.\n\t */\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects?: readonly IChannelFactory[],\n\t\toptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeClass?: typeof FluidDataStoreRuntime,\n\t);\n\tpublic constructor(props: DataObjectFactoryProps<TObj, I>);\n\tpublic constructor(\n\t\tpropsOrType: DataObjectFactoryProps<TObj, I> | string,\n\t\tmaybeCtor?: new (doProps: IDataObjectProps<I>) => TObj,\n\t\tmaybeSharedObjects?: readonly IChannelFactory[],\n\t\tmaybeOptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tmaybeRegistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tmaybeRuntimeFactory?: typeof FluidDataStoreRuntime,\n\t) {\n\t\tconst newProps =\n\t\t\ttypeof propsOrType === \"string\"\n\t\t\t\t? {\n\t\t\t\t\t\ttype: propsOrType,\n\t\t\t\t\t\t// both the arg and props base constructor require this param\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tctor: maybeCtor!,\n\t\t\t\t\t\tsharedObjects: maybeSharedObjects,\n\t\t\t\t\t\toptionalProviders: maybeOptionalProviders,\n\t\t\t\t\t\tregistryEntries: maybeRegistryEntries,\n\t\t\t\t\t\truntimeClass: maybeRuntimeFactory,\n\t\t\t\t\t}\n\t\t\t\t: propsOrType;\n\n\t\tif (newProps.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tthis.type = newProps.type;\n\n\t\tthis.createProps = {\n\t\t\tctor: newProps.ctor,\n\t\t\toptionalProviders: newProps.optionalProviders ?? {},\n\t\t\tsharedObjectRegistry: new Map(newProps.sharedObjects?.map((ext) => [ext.type, ext])),\n\t\t\truntimeClassArg: newProps.runtimeClass ?? FluidDataStoreRuntime,\n\t\t\tpolicies: newProps.policies,\n\t\t};\n\n\t\tif (newProps.registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(newProps.registryEntries);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject({ ...this.createProps, context, existing });\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: readonly string[],\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated - the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: readonly string[],\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGpF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,qBAAqB,EAErB,mBAAmB,GACnB,MAAM,oCAAoC,CAAC;AAwC5C;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAG7B,EACD,IAAI,EACJ,OAAO,EACP,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,QAAQ,GACwB;IAIhC,OAAO;IACP,IAAI,YAAY,GAAG,eAAe,CAAC;IAEnC,mBAAmB;IACnB,YAAY,GAAG,mBAAmB,CACjC,KAAK,EAAE,OAAiB,EAAE,UAAiC,EAAE,EAAE;QAC9D,iFAAiF;QACjF,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,CAAS,CAAC;QAC/D,MAAM,CACL,UAAU,CAAC,OAAO,KAAK,SAAS,EAChC,KAAK,CAAC,yDAAyD,CAC/D,CAAC;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,EACD,YAAY,CACZ,CAAC;IAEF,gFAAgF;IAChF,+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AAuB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,kBAAkB,CACjC,OAAuC,EACvC,YAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CAAC;YACpD,GAAG,IAAI,CAAC,WAAW;YACnB,OAAO;YACP,QAAQ,EAAE,KAAK;YACf,YAAY;SACZ,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStorePolicies,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\ninterface CreateDataObjectProps<TObj extends PureDataObject, I extends DataObjectTypes> {\n\tctor: new (props: IDataObjectProps<I>) => TObj;\n\tcontext: IFluidDataStoreContext;\n\tsharedObjectRegistry: ISharedObjectRegistry;\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\truntimeClassArg: typeof FluidDataStoreRuntime;\n\texisting: boolean;\n\tinitialState?: I[\"InitialState\"];\n\tpolicies?: Partial<IFluidDataStorePolicies>;\n}\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>({\n\tctor,\n\tcontext,\n\tsharedObjectRegistry,\n\toptionalProviders,\n\truntimeClassArg,\n\texisting,\n\tinitialState: initProps,\n\tpolicies,\n}: CreateDataObjectProps<TObj, I>): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t\tpolicies,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * Represents the properties required to create a DataObjectFactory.\n * This includes the type identifier, constructor, shared objects, optional providers,\n * registry entries, and the runtime class to use for the data object.\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport interface DataObjectFactoryProps<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> {\n\t/**\n\t * The type identifier for the data object factory.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The constructor for the data object.\n\t */\n\treadonly ctor: new (\n\t\tprops: IDataObjectProps<I>,\n\t) => TObj;\n\n\t/**\n\t * The shared objects (DDSes) to be registered with the data object.\n\t */\n\treadonly sharedObjects?: readonly IChannelFactory[];\n\n\t/**\n\t * Optional providers for dependency injection.\n\t */\n\treadonly optionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>;\n\n\t/**\n\t * Registry entries for named data stores.\n\t */\n\treadonly registryEntries?: NamedFluidDataStoreRegistryEntries;\n\n\t/**\n\t * The runtime class to use for the data object.\n\t */\n\treadonly runtimeClass?: typeof FluidDataStoreRuntime;\n\n\t/**\n\t * Optional policies that can be applied to the DataObject.\n\t * These policies define specific behaviors or constraints for the data object.\n\t */\n\treadonly policies?: Partial<IFluidDataStorePolicies>;\n}\n\n/**\n * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy @beta\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\tprivate readonly createProps: Omit<CreateDataObjectProps<TObj, I>, \"existing\" | \"context\">;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t */\n\tpublic readonly type: string;\n\n\t/**\n\t * @remarks Use the props object based constructor instead.\n\t * No new features will be added to this constructor,\n\t * and it will eventually be deprecated and removed.\n\t */\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects?: readonly IChannelFactory[],\n\t\toptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeClass?: typeof FluidDataStoreRuntime,\n\t);\n\tpublic constructor(props: DataObjectFactoryProps<TObj, I>);\n\tpublic constructor(\n\t\tpropsOrType: DataObjectFactoryProps<TObj, I> | string,\n\t\tmaybeCtor?: new (doProps: IDataObjectProps<I>) => TObj,\n\t\tmaybeSharedObjects?: readonly IChannelFactory[],\n\t\tmaybeOptionalProviders?: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tmaybeRegistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tmaybeRuntimeFactory?: typeof FluidDataStoreRuntime,\n\t) {\n\t\tconst newProps =\n\t\t\ttypeof propsOrType === \"string\"\n\t\t\t\t? {\n\t\t\t\t\t\ttype: propsOrType,\n\t\t\t\t\t\t// both the arg and props base constructor require this param\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tctor: maybeCtor!,\n\t\t\t\t\t\tsharedObjects: maybeSharedObjects,\n\t\t\t\t\t\toptionalProviders: maybeOptionalProviders,\n\t\t\t\t\t\tregistryEntries: maybeRegistryEntries,\n\t\t\t\t\t\truntimeClass: maybeRuntimeFactory,\n\t\t\t\t\t}\n\t\t\t\t: propsOrType;\n\n\t\tif (newProps.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tthis.type = newProps.type;\n\n\t\tthis.createProps = {\n\t\t\tctor: newProps.ctor,\n\t\t\toptionalProviders: newProps.optionalProviders ?? {},\n\t\t\tsharedObjectRegistry: new Map(newProps.sharedObjects?.map((ext) => [ext.type, ext])),\n\t\t\truntimeClassArg: newProps.runtimeClass ?? FluidDataStoreRuntime,\n\t\t\tpolicies: newProps.policies,\n\t\t};\n\n\t\tif (newProps.registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(newProps.registryEntries);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject({ ...this.createProps, context, existing });\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: readonly string[],\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: readonly string[],\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject({\n\t\t\t...this.createProps,\n\t\t\tcontext,\n\t\t\texisting: false,\n\t\t\tinitialState,\n\t\t});\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/aqueduct",
|
|
3
|
-
"version": "2.70.0-
|
|
3
|
+
"version": "2.70.0-361248",
|
|
4
4
|
"description": "A set of implementations for Fluid Framework interfaces.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,32 +69,32 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "2.70.0-
|
|
73
|
-
"@fluidframework/container-definitions": "2.70.0-
|
|
74
|
-
"@fluidframework/container-runtime": "2.70.0-
|
|
75
|
-
"@fluidframework/container-runtime-definitions": "2.70.0-
|
|
76
|
-
"@fluidframework/core-interfaces": "2.70.0-
|
|
77
|
-
"@fluidframework/core-utils": "2.70.0-
|
|
78
|
-
"@fluidframework/datastore": "2.70.0-
|
|
79
|
-
"@fluidframework/datastore-definitions": "2.70.0-
|
|
80
|
-
"@fluidframework/map": "2.70.0-
|
|
81
|
-
"@fluidframework/request-handler": "2.70.0-
|
|
82
|
-
"@fluidframework/runtime-definitions": "2.70.0-
|
|
83
|
-
"@fluidframework/runtime-utils": "2.70.0-
|
|
84
|
-
"@fluidframework/shared-object-base": "2.70.0-
|
|
85
|
-
"@fluidframework/synthesize": "2.70.0-
|
|
86
|
-
"@fluidframework/telemetry-utils": "2.70.0-
|
|
87
|
-
"@fluidframework/tree": "2.70.0-
|
|
72
|
+
"@fluid-internal/client-utils": "2.70.0-361248",
|
|
73
|
+
"@fluidframework/container-definitions": "2.70.0-361248",
|
|
74
|
+
"@fluidframework/container-runtime": "2.70.0-361248",
|
|
75
|
+
"@fluidframework/container-runtime-definitions": "2.70.0-361248",
|
|
76
|
+
"@fluidframework/core-interfaces": "2.70.0-361248",
|
|
77
|
+
"@fluidframework/core-utils": "2.70.0-361248",
|
|
78
|
+
"@fluidframework/datastore": "2.70.0-361248",
|
|
79
|
+
"@fluidframework/datastore-definitions": "2.70.0-361248",
|
|
80
|
+
"@fluidframework/map": "2.70.0-361248",
|
|
81
|
+
"@fluidframework/request-handler": "2.70.0-361248",
|
|
82
|
+
"@fluidframework/runtime-definitions": "2.70.0-361248",
|
|
83
|
+
"@fluidframework/runtime-utils": "2.70.0-361248",
|
|
84
|
+
"@fluidframework/shared-object-base": "2.70.0-361248",
|
|
85
|
+
"@fluidframework/synthesize": "2.70.0-361248",
|
|
86
|
+
"@fluidframework/telemetry-utils": "2.70.0-361248",
|
|
87
|
+
"@fluidframework/tree": "2.70.0-361248"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
91
91
|
"@biomejs/biome": "~1.9.3",
|
|
92
|
-
"@fluid-internal/mocha-test-setup": "2.70.0-
|
|
92
|
+
"@fluid-internal/mocha-test-setup": "2.70.0-361248",
|
|
93
93
|
"@fluid-tools/build-cli": "^0.58.3",
|
|
94
94
|
"@fluidframework/aqueduct-previous": "npm:@fluidframework/aqueduct@2.63.0",
|
|
95
95
|
"@fluidframework/build-common": "^2.0.3",
|
|
96
96
|
"@fluidframework/build-tools": "^0.58.3",
|
|
97
|
-
"@fluidframework/eslint-config-fluid": "^6.
|
|
97
|
+
"@fluidframework/eslint-config-fluid": "^6.1.0",
|
|
98
98
|
"@microsoft/api-extractor": "7.52.11",
|
|
99
99
|
"@types/mocha": "^10.0.10",
|
|
100
100
|
"@types/node": "^18.19.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"concurrently": "^8.2.1",
|
|
103
103
|
"copyfiles": "^2.4.1",
|
|
104
104
|
"cross-env": "^7.0.3",
|
|
105
|
-
"eslint": "~8.
|
|
105
|
+
"eslint": "~8.57.1",
|
|
106
106
|
"mocha": "^10.8.2",
|
|
107
107
|
"mocha-multi-reporters": "^1.5.1",
|
|
108
108
|
"rimraf": "^4.4.0",
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
FluidDataStoreRegistry,
|
|
12
12
|
loadContainerRuntime,
|
|
13
13
|
type IContainerRuntimeOptions,
|
|
14
|
-
type MinimumVersionForCollab,
|
|
15
14
|
} from "@fluidframework/container-runtime/internal";
|
|
16
15
|
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
17
16
|
import type { FluidObject } from "@fluidframework/core-interfaces";
|
|
@@ -24,6 +23,7 @@ import {
|
|
|
24
23
|
import type {
|
|
25
24
|
IFluidDataStoreRegistry,
|
|
26
25
|
IProvideFluidDataStoreRegistry,
|
|
26
|
+
MinimumVersionForCollab,
|
|
27
27
|
NamedFluidDataStoreRegistryEntries,
|
|
28
28
|
} from "@fluidframework/runtime-definitions/internal";
|
|
29
29
|
import { RuntimeFactoryHelper } from "@fluidframework/runtime-utils/internal";
|
|
@@ -413,7 +413,7 @@ export class PureDataObjectFactory<
|
|
|
413
413
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
414
414
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
415
415
|
*
|
|
416
|
-
* @deprecated
|
|
416
|
+
* @deprecated the issue is that it does not allow the customer to decide the conflict resolution policy when an
|
|
417
417
|
* aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.
|
|
418
418
|
*/
|
|
419
419
|
public async createRootInstance(
|