@fluidframework/aqueduct 2.33.2 → 2.40.0

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +10 -12
  3. package/api-report/aqueduct.legacy.alpha.api.md +16 -3
  4. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +7 -1
  5. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  6. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js +2 -0
  7. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  8. package/dist/data-object-factories/dataObjectFactory.d.ts +9 -3
  9. package/dist/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  10. package/dist/data-object-factories/dataObjectFactory.js +20 -10
  11. package/dist/data-object-factories/dataObjectFactory.js.map +1 -1
  12. package/dist/data-object-factories/index.d.ts +1 -1
  13. package/dist/data-object-factories/index.d.ts.map +1 -1
  14. package/dist/data-object-factories/index.js.map +1 -1
  15. package/dist/data-object-factories/pureDataObjectFactory.d.ts +48 -9
  16. package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  17. package/dist/data-object-factories/pureDataObjectFactory.js +45 -22
  18. package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/legacy.d.ts +1 -0
  23. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts +7 -1
  24. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  25. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js +2 -0
  26. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  27. package/lib/data-object-factories/dataObjectFactory.d.ts +9 -3
  28. package/lib/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  29. package/lib/data-object-factories/dataObjectFactory.js +18 -8
  30. package/lib/data-object-factories/dataObjectFactory.js.map +1 -1
  31. package/lib/data-object-factories/index.d.ts +1 -1
  32. package/lib/data-object-factories/index.d.ts.map +1 -1
  33. package/lib/data-object-factories/index.js +1 -1
  34. package/lib/data-object-factories/index.js.map +1 -1
  35. package/lib/data-object-factories/pureDataObjectFactory.d.ts +48 -9
  36. package/lib/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  37. package/lib/data-object-factories/pureDataObjectFactory.js +45 -22
  38. package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/legacy.d.ts +1 -0
  43. package/package.json +18 -18
  44. package/src/container-runtime-factories/baseContainerRuntimeFactory.ts +9 -0
  45. package/src/data-object-factories/dataObjectFactory.ts +40 -10
  46. package/src/data-object-factories/index.ts +4 -1
  47. package/src/data-object-factories/pureDataObjectFactory.ts +139 -51
  48. package/src/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/aqueduct
2
2
 
3
+ ## 2.40.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.33.0
4
8
 
5
9
  Dependency updates only.
package/README.md CHANGED
@@ -141,12 +141,11 @@ In the below example we build a `DataObjectFactory` for the [Clicker](#dataobjec
141
141
  `SharedCounter`.
142
142
 
143
143
  ```typescript
144
- export const ClickerInstantiationFactory = new DataObjectFactory(
145
- Clicker.Name,
146
- Clicker,
147
- [SharedCounter.getFactory()], // distributed data structures
148
- {}, // Provider Symbols see below
149
- );
144
+ export const ClickerInstantiationFactory = new DataObjectFactory({
145
+ type: Clicker.Name,
146
+ ctor: Clicker,
147
+ sharedObjects: [SharedCounter.getFactory()],
148
+ });
150
149
  ```
151
150
 
152
151
  This factory can then create Clickers when provided a creating instance context.
@@ -185,12 +184,11 @@ export class MyExample extends DataObject<IFluidUserInfo> {
185
184
  }
186
185
 
187
186
  // Note: we have to define the symbol to the IFluidUserInfo that we declared above. This is compile time checked.
188
- export const ClickerInstantiationFactory = new DataObjectFactory(
189
- Clicker.Name
190
- Clicker,
191
- [], // distributed data structures
192
- {IFluidUserInfo}, // Provider Symbols see below
193
- );
187
+ export const ClickerInstantiationFactory = new DataObjectFactory({
188
+ type: Clicker.Name
189
+ ctor: Clicker,
190
+ optionalProviders: { IFluidUserInfo }, // Provider Symbols see below
191
+ });
194
192
  ```
195
193
 
196
194
  ## Container development
@@ -19,6 +19,7 @@ export class BaseContainerRuntimeFactory extends RuntimeFactoryHelper implements
19
19
  export interface BaseContainerRuntimeFactoryProps {
20
20
  // @deprecated (undocumented)
21
21
  dependencyContainer?: IFluidDependencySynthesizer;
22
+ minVersionForCollab?: MinimumVersionForCollab | undefined;
22
23
  provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
23
24
  registryEntries: NamedFluidDataStoreRegistryEntries;
24
25
  // @deprecated
@@ -58,7 +59,19 @@ export abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> ex
58
59
 
59
60
  // @alpha @legacy
60
61
  export class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes> extends PureDataObjectFactory<TObj, I> {
61
- constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory<unknown>[] | undefined, optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
62
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects?: readonly IChannelFactory[], optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
63
+ constructor(props: DataObjectFactoryProps<TObj, I>);
64
+ }
65
+
66
+ // @alpha @legacy
67
+ export interface DataObjectFactoryProps<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> {
68
+ readonly ctor: new (props: IDataObjectProps<I>) => TObj;
69
+ readonly optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>;
70
+ readonly policies?: Partial<IFluidDataStorePolicies>;
71
+ readonly registryEntries?: NamedFluidDataStoreRegistryEntries;
72
+ readonly runtimeClass?: typeof FluidDataStoreRuntime;
73
+ readonly sharedObjects?: readonly IChannelFactory[];
74
+ readonly type: string;
62
75
  }
63
76
 
64
77
  // @alpha @legacy
@@ -107,8 +120,8 @@ export abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes
107
120
 
108
121
  // @alpha @legacy
109
122
  export class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry> {
110
- constructor(
111
- type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[], optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeClass?: typeof FluidDataStoreRuntime);
123
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects?: readonly IChannelFactory[], optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeClass?: typeof FluidDataStoreRuntime);
124
+ constructor(props: DataObjectFactoryProps<TObj, I>);
112
125
  createChildInstance(parentContext: IFluidDataStoreContext, initialState?: I["InitialState"], loadingGroupId?: string): Promise<TObj>;
113
126
  createInstance(runtime: IContainerRuntimeBase, initialState?: I["InitialState"], loadingGroupId?: string): Promise<TObj>;
114
127
  // (undocumented)
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IContainerContext, IRuntime } from "@fluidframework/container-definitions/internal";
6
- import { type IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
6
+ import { type IContainerRuntimeOptions, type MinimumVersionForCollab } 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";
@@ -38,6 +38,11 @@ export interface BaseContainerRuntimeFactoryProps {
38
38
  * created with this factory
39
39
  */
40
40
  provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
41
+ /**
42
+ * The minVersionForCollab passed to the ContainerRuntime when instantiating it.
43
+ * See {@link @fluidframework/container-runtime#LoadContainerRuntimeParams} for more details on this property.
44
+ */
45
+ minVersionForCollab?: MinimumVersionForCollab | undefined;
41
46
  }
42
47
  /**
43
48
  * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,
@@ -57,6 +62,7 @@ export declare class BaseContainerRuntimeFactory extends RuntimeFactoryHelper im
57
62
  private readonly runtimeOptions?;
58
63
  private readonly requestHandlers;
59
64
  private readonly provideEntryPoint;
65
+ private readonly minVersionForCollab;
60
66
  constructor(props: BaseContainerRuntimeFactoryProps);
61
67
  /**
62
68
  * Called the one time the container is created, and not on any subsequent load.
@@ -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,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,kCAAkC,EACl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;;;;OAIG;cACa,8BAA8B,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAEzF;;;;OAIG;cACa,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAClF"}
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,KAAK,uBAAuB,EAC5B,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,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,2BAA2B,CAAC;IAClD;;;OAGG;IAEH,eAAe,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAC1C;;OAEG;IACH,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C;;;OAGG;IACH,iBAAiB,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACxE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;CAC1D;AAED;;;;;;GAMG;AACH,qBAAa,2BACZ,SAAQ,oBACR,YAAW,8BAA8B;IAEzC;;OAEG;IACH,IAAW,uBAAuB,IAAI,uBAAuB,CAE5D;IACD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IAEnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqC;IACrE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAA8B;IACnE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAA2B;IAE3D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA0B;IAC1D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuD;IACzF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAsC;gBAEvD,KAAK,EAAE,gCAAgC;IAY1D;;;;OAIG;IACU,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5E;;;;OAIG;IACU,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E;;;;OAIG;IACU,aAAa,CACzB,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,iBAAiB,GAAG,QAAQ,CAAC;IAuBxC;;;;OAIG;cACa,8BAA8B,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAEzF;;;;OAIG;cACa,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAClF"}
@@ -31,6 +31,7 @@ class BaseContainerRuntimeFactory extends internal_3.RuntimeFactoryHelper {
31
31
  this.provideEntryPoint = props.provideEntryPoint;
32
32
  this.requestHandlers = props.requestHandlers ?? [];
33
33
  this.registry = new internal_1.FluidDataStoreRegistry(this.registryEntries);
34
+ this.minVersionForCollab = props.minVersionForCollab;
34
35
  }
35
36
  /**
36
37
  * Called the one time the container is created, and not on any subsequent load.
@@ -69,6 +70,7 @@ class BaseContainerRuntimeFactory extends internal_3.RuntimeFactoryHelper {
69
70
  // eslint-disable-next-line import/no-deprecated
70
71
  requestHandler: (0, internal_2.buildRuntimeRequestHandler)(...this.requestHandlers),
71
72
  provideEntryPoint: this.provideEntryPoint,
73
+ minVersionForCollab: this.minVersionForCollab,
72
74
  });
73
75
  }
74
76
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,yEAIoD;AAGpD,uEAKkD;AAMlD,qEAA8E;AAC9E,kEAI6C;AAiC7C;;;;;;GAMG;AACH,MAAa,2BACZ,SAAQ,+BAAoB;IAG5B;;OAEG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAUD,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;IAClE,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;SACzC,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;AA5FD,kEA4FC","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\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 * @alpha\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}\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 * @alpha\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\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}\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});\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"]}
1
+ {"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,yEAKoD;AAGpD,uEAKkD;AAMlD,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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B,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\ttype MinimumVersionForCollab,\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\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 * @alpha\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 * The minVersionForCollab passed to the ContainerRuntime when instantiating it.\n\t * See {@link @fluidframework/container-runtime#LoadContainerRuntimeParams} 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 * @alpha\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"]}
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
5
+ import type { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
6
6
  import type { IChannelFactory } from "@fluidframework/datastore-definitions/internal";
7
7
  import type { NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions/internal";
8
8
  import type { FluidObjectSymbolProvider } from "@fluidframework/synthesize/internal";
9
9
  import type { DataObject, DataObjectTypes, IDataObjectProps } from "../data-objects/index.js";
10
- import { PureDataObjectFactory } from "./pureDataObjectFactory.js";
10
+ import { PureDataObjectFactory, type DataObjectFactoryProps } from "./pureDataObjectFactory.js";
11
11
  /**
12
12
  * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
13
13
  * It facilitates DataObject's features (such as its shared directory) by
@@ -19,6 +19,12 @@ import { PureDataObjectFactory } from "./pureDataObjectFactory.js";
19
19
  * @alpha
20
20
  */
21
21
  export declare class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes> extends PureDataObjectFactory<TObj, I> {
22
- constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory<unknown>[] | undefined, optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
22
+ /**
23
+ * @remarks Use the props object based constructor instead.
24
+ * No new features will be added to this constructor,
25
+ * and it will eventually be deprecated and removed.
26
+ */
27
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects?: readonly IChannelFactory[], optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
28
+ constructor(props: DataObjectFactoryProps<TObj, I>);
23
29
  }
24
30
  //# sourceMappingURL=dataObjectFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAOtF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC7B,IAAI,SAAS,UAAU,CAAC,CAAC,CAAC,EAC1B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;gBAEtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,KAAK,KAAK,EAAE,gBAAgB,CAAC,CAAC,CA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 -5,8 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.DataObjectFactory = void 0;
8
- const internal_1 = require("@fluidframework/datastore/internal");
9
- const internal_2 = require("@fluidframework/map/internal");
8
+ const internal_1 = require("@fluidframework/map/internal");
10
9
  const pureDataObjectFactory_js_1 = require("./pureDataObjectFactory.js");
11
10
  /**
12
11
  * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
@@ -19,19 +18,30 @@ const pureDataObjectFactory_js_1 = require("./pureDataObjectFactory.js");
19
18
  * @alpha
20
19
  */
21
20
  class DataObjectFactory extends pureDataObjectFactory_js_1.PureDataObjectFactory {
22
- constructor(type, ctor, sharedObjects = [], optionalProviders, registryEntries, runtimeFactory = internal_1.FluidDataStoreRuntime) {
23
- const mergedObjects = [...sharedObjects];
24
- if (!sharedObjects.some((factory) => factory.type === internal_2.DirectoryFactory.Type)) {
21
+ constructor(propsOrType, maybeCtor, maybeSharedObjects, maybeOptionalProviders, maybeRegistryEntries, maybeRuntimeFactory) {
22
+ const newProps = typeof propsOrType === "string"
23
+ ? {
24
+ type: propsOrType,
25
+ // both the arg and props base constructor require this param
26
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
27
+ ctor: maybeCtor,
28
+ sharedObjects: maybeSharedObjects,
29
+ optionalProviders: maybeOptionalProviders,
30
+ registryEntries: maybeRegistryEntries,
31
+ runtimeClass: maybeRuntimeFactory,
32
+ }
33
+ : { ...propsOrType };
34
+ const sharedObjects = (newProps.sharedObjects = [...(newProps.sharedObjects ?? [])]);
35
+ if (!sharedObjects.some((factory) => factory.type === internal_1.DirectoryFactory.Type)) {
25
36
  // User did not register for directory
26
- // eslint-disable-next-line import/no-deprecated
27
- mergedObjects.push(internal_2.SharedDirectory.getFactory());
37
+ sharedObjects.push(internal_1.SharedDirectory.getFactory());
28
38
  }
29
39
  // TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10
30
- if (!sharedObjects.some((factory) => factory.type === internal_2.MapFactory.Type)) {
40
+ if (!sharedObjects.some((factory) => factory.type === internal_1.MapFactory.Type)) {
31
41
  // User did not register for map
32
- mergedObjects.push(internal_2.SharedMap.getFactory());
42
+ sharedObjects.push(internal_1.SharedMap.getFactory());
33
43
  }
34
- super(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);
44
+ super(newProps);
35
45
  }
36
46
  }
37
47
  exports.DataObjectFactory = DataObjectFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAA2E;AAE3E,2DAKsC;AAMtC,yEAAmE;AAEnE;;;;;;;;;GASG;AACH,MAAa,iBAGX,SAAQ,gDAA8B;IACvC,YACC,IAAY,EACZ,IAA8C,EAC9C,gBAA4C,EAAE,EAC9C,iBAAoE,EACpE,eAAoD,EACpD,iBAA+C,gCAAqB;QAEpE,MAAM,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,2BAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9E,sCAAsC;YACtC,gDAAgD;YAChD,aAAa,CAAC,IAAI,CAAC,0BAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,oBAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IACtF,CAAC;CACD;AA5BD,8CA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tSharedMap,\n\tDirectoryFactory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions/internal\";\nimport type { FluidObjectSymbolProvider } from \"@fluidframework/synthesize/internal\";\n\nimport type { DataObject, DataObjectTypes, IDataObjectProps } from \"../data-objects/index.js\";\n\nimport { PureDataObjectFactory } from \"./pureDataObjectFactory.js\";\n\n/**\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class DataObjectFactory<\n\tTObj extends DataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObjectFactory<TObj, I> {\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\truntimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tconst mergedObjects = [...sharedObjects];\n\n\t\tif (!sharedObjects.some((factory) => factory.type === DirectoryFactory.Type)) {\n\t\t\t// User did not register for directory\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tmergedObjects.push(SharedDirectory.getFactory());\n\t\t}\n\n\t\t// TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n\t\tif (!sharedObjects.some((factory) => factory.type === MapFactory.Type)) {\n\t\t\t// User did not register for map\n\t\t\tmergedObjects.push(SharedMap.getFactory());\n\t\t}\n\n\t\tsuper(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2DAKsC;AAMtC,yEAGoC;AAEpC;;;;;;;;;GASG;AACH,MAAa,iBAGX,SAAQ,gDAA8B;IAevC,YACC,WAAqD,EACrD,SAAsD,EACtD,kBAA+C,EAC/C,sBAA0E,EAC1E,oBAAyD,EACzD,mBAAkD;QAElD,MAAM,QAAQ,GACb,OAAO,WAAW,KAAK,QAAQ;YAC9B,CAAC,CAAC;gBACA,IAAI,EAAE,WAAW;gBACjB,6DAA6D;gBAC7D,oEAAoE;gBACpE,IAAI,EAAE,SAAU;gBAChB,aAAa,EAAE,kBAAkB;gBACjC,iBAAiB,EAAE,sBAAsB;gBACzC,eAAe,EAAE,oBAAoB;gBACrC,YAAY,EAAE,mBAAmB;aACjC;YACF,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;QAEvB,MAAM,aAAa,GAAG,CAAC,QAAQ,CAAC,aAAa,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAErF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,2BAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9E,sCAAsC;YACtC,aAAa,CAAC,IAAI,CAAC,0BAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,oBAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,CAAC;IACjB,CAAC;CACD;AAvDD,8CAuDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tSharedMap,\n\tDirectoryFactory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions/internal\";\nimport type { FluidObjectSymbolProvider } from \"@fluidframework/synthesize/internal\";\n\nimport type { DataObject, DataObjectTypes, IDataObjectProps } from \"../data-objects/index.js\";\n\nimport {\n\tPureDataObjectFactory,\n\ttype DataObjectFactoryProps,\n} from \"./pureDataObjectFactory.js\";\n\n/**\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class DataObjectFactory<\n\tTObj extends DataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObjectFactory<TObj, I> {\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\truntimeFactory?: 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\tconst sharedObjects = (newProps.sharedObjects = [...(newProps.sharedObjects ?? [])]);\n\n\t\tif (!sharedObjects.some((factory) => factory.type === DirectoryFactory.Type)) {\n\t\t\t// User did not register for directory\n\t\t\tsharedObjects.push(SharedDirectory.getFactory());\n\t\t}\n\n\t\t// TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n\t\tif (!sharedObjects.some((factory) => factory.type === MapFactory.Type)) {\n\t\t\t// User did not register for map\n\t\t\tsharedObjects.push(SharedMap.getFactory());\n\t\t}\n\n\t\tsuper(newProps);\n\t}\n}\n"]}
@@ -3,5 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { DataObjectFactory } from "./dataObjectFactory.js";
6
- export { PureDataObjectFactory } from "./pureDataObjectFactory.js";
6
+ export { type DataObjectFactoryProps, PureDataObjectFactory, } from "./pureDataObjectFactory.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACN,KAAK,sBAAsB,EAC3B,qBAAqB,GACrB,MAAM,4BAA4B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-object-factories/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObjectFactory } from \"./dataObjectFactory.js\";\nexport { PureDataObjectFactory } from \"./pureDataObjectFactory.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-object-factories/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,uEAGoC;AADnC,iIAAA,qBAAqB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObjectFactory } from \"./dataObjectFactory.js\";\nexport {\n\ttype DataObjectFactoryProps,\n\tPureDataObjectFactory,\n} from \"./pureDataObjectFactory.js\";\n"]}
@@ -5,9 +5,49 @@
5
5
  import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
6
6
  import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
7
7
  import type { IChannelFactory } from "@fluidframework/datastore-definitions/internal";
8
- import type { IContainerRuntimeBase, IDataStore, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreFactory, IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries, NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions/internal";
8
+ import type { IContainerRuntimeBase, IDataStore, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreFactory, IFluidDataStorePolicies, IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries, NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions/internal";
9
9
  import type { FluidObjectSymbolProvider } from "@fluidframework/synthesize/internal";
10
10
  import type { DataObjectTypes, IDataObjectProps, PureDataObject } from "../data-objects/index.js";
11
+ /**
12
+ * Represents the properties required to create a DataObjectFactory.
13
+ * This includes the type identifier, constructor, shared objects, optional providers,
14
+ * registry entries, and the runtime class to use for the data object.
15
+ * @typeParam TObj - DataObject (concrete type)
16
+ * @typeParam I - The input types for the DataObject
17
+ * @legacy
18
+ * @alpha
19
+ */
20
+ export interface DataObjectFactoryProps<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> {
21
+ /**
22
+ * The type identifier for the data object factory.
23
+ */
24
+ readonly type: string;
25
+ /**
26
+ * The constructor for the data object.
27
+ */
28
+ readonly ctor: new (props: IDataObjectProps<I>) => TObj;
29
+ /**
30
+ * The shared objects (DDSes) to be registered with the data object.
31
+ */
32
+ readonly sharedObjects?: readonly IChannelFactory[];
33
+ /**
34
+ * Optional providers for dependency injection.
35
+ */
36
+ readonly optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>;
37
+ /**
38
+ * Registry entries for named data stores.
39
+ */
40
+ readonly registryEntries?: NamedFluidDataStoreRegistryEntries;
41
+ /**
42
+ * The runtime class to use for the data object.
43
+ */
44
+ readonly runtimeClass?: typeof FluidDataStoreRuntime;
45
+ /**
46
+ * Optional policies that can be applied to the DataObject.
47
+ * These policies define specific behaviors or constraints for the data object.
48
+ */
49
+ readonly policies?: Partial<IFluidDataStorePolicies>;
50
+ }
11
51
  /**
12
52
  * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.
13
53
  * Consumers should typically use DataObjectFactory instead unless creating
@@ -19,20 +59,19 @@ import type { DataObjectTypes, IDataObjectProps, PureDataObject } from "../data-
19
59
  * @alpha
20
60
  */
21
61
  export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry> {
62
+ private readonly registry;
63
+ private readonly createProps;
22
64
  /**
23
65
  * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory."type"}
24
66
  */
25
67
  readonly type: string;
26
- private readonly ctor;
27
- private readonly optionalProviders;
28
- private readonly runtimeClass;
29
- private readonly sharedObjectRegistry;
30
- private readonly registry;
31
- constructor(
32
68
  /**
33
- * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory."type"}
69
+ * @remarks Use the props object based constructor instead.
70
+ * No new features will be added to this constructor,
71
+ * and it will eventually be deprecated and removed.
34
72
  */
35
- type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[], optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeClass?: typeof FluidDataStoreRuntime);
73
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects?: readonly IChannelFactory[], optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeClass?: typeof FluidDataStoreRuntime);
74
+ constructor(props: DataObjectFactoryProps<TObj, I>);
36
75
  /**
37
76
  * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}
38
77
  */
@@ -1 +1 @@
1
- {"version":3,"file":"pureDataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAGhG,OAAO,EACN,qBAAqB,EAGrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACX,eAAe,EAEf,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,qBAAqB,EACrB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,kCAAkC,EAClC,gCAAgC,EAChC,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAEX,yBAAyB,EAEzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,MAAM,0BAA0B,CAAC;AAwFlC;;;;;;;;;GASG;AACH,qBAAa,qBAAqB,CACjC,IAAI,SAAS,cAAc,CAAC,CAAC,CAAC,EAC9B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,YAAW,sBAAsB,EAAE,OAAO,CAAC,8BAA8B,CAAC;IAM1E;;OAEG;aACa,IAAI,EAAE,MAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAErB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAElC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAZ9B,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAwB;IAC7D,OAAO,CAAC,QAAQ,CAAC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QAAQ,CAAC,MAAM,EAAE,CAAC,EAChC,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAmB9B;;;;;;;;;;;;OAYG;IACU,kBAAkB,CAC9B,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,iBAAiB,EAC1B,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;cAqBA,yBAAyB,CACxC,gBAAgB,EAAE,qBAAqB,EACvC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAC/B,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,EAChC,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;cAKA,kBAAkB,CACjC,OAAO,EAAE,8BAA8B,EACvC,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;CAehB"}
1
+ {"version":3,"file":"pureDataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAGhG,OAAO,EACN,qBAAqB,EAGrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACX,eAAe,EAEf,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,qBAAqB,EACrB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,8BAA8B,EAC9B,kCAAkC,EAClC,gCAAgC,EAChC,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAEX,yBAAyB,EAEzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,MAAM,0BA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YG;IACU,kBAAkB,CAC9B,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,iBAAiB,EAC1B,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;cAkBA,yBAAyB,CACxC,gBAAgB,EAAE,qBAAqB,EACvC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAC/B,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,EAChC,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;cAKA,kBAAkB,CACjC,OAAO,EAAE,8BAA8B,EACvC,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;CAYhB"}
@@ -12,7 +12,7 @@ const internal_3 = require("@fluidframework/datastore/internal");
12
12
  * Proxy over PureDataObject
13
13
  * Does delayed creation & initialization of PureDataObject
14
14
  */
15
- async function createDataObject(ctor, context, sharedObjectRegistry, optionalProviders, runtimeClassArg, existing, initProps) {
15
+ async function createDataObject({ ctor, context, sharedObjectRegistry, optionalProviders, runtimeClassArg, existing, initialState: initProps, policies, }) {
16
16
  // base
17
17
  let runtimeClass = runtimeClassArg;
18
18
  // request mixin in
@@ -34,7 +34,7 @@ async function createDataObject(ctor, context, sharedObjectRegistry, optionalPro
34
34
  // Without this I ran into issues with the load-existing flow not working correctly.
35
35
  await instance.finishInitialization(true);
36
36
  return instance;
37
- } /* provideEntryPoint */);
37
+ } /* provideEntryPoint */, policies);
38
38
  // Create object right away.
39
39
  // This allows object to register various callbacks with runtime before runtime
40
40
  // becomes globally available. But it's not full initialization - constructor can't
@@ -70,22 +70,33 @@ async function createDataObject(ctor, context, sharedObjectRegistry, optionalPro
70
70
  * @alpha
71
71
  */
72
72
  class PureDataObjectFactory {
73
- constructor(
74
- /**
75
- * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory."type"}
76
- */
77
- type, ctor, sharedObjects, optionalProviders, registryEntries, runtimeClass = internal_3.FluidDataStoreRuntime) {
78
- this.type = type;
79
- this.ctor = ctor;
80
- this.optionalProviders = optionalProviders;
81
- this.runtimeClass = runtimeClass;
82
- if (this.type === "") {
73
+ constructor(propsOrType, maybeCtor, maybeSharedObjects, maybeOptionalProviders, maybeRegistryEntries, maybeRuntimeFactory) {
74
+ const newProps = typeof propsOrType === "string"
75
+ ? {
76
+ type: propsOrType,
77
+ // both the arg and props base constructor require this param
78
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
79
+ ctor: maybeCtor,
80
+ sharedObjects: maybeSharedObjects,
81
+ optionalProviders: maybeOptionalProviders,
82
+ registryEntries: maybeRegistryEntries,
83
+ runtimeClass: maybeRuntimeFactory,
84
+ }
85
+ : propsOrType;
86
+ if (newProps.type === "") {
83
87
  throw new Error("undefined type member");
84
88
  }
85
- if (registryEntries !== undefined) {
86
- this.registry = new internal_1.FluidDataStoreRegistry(registryEntries);
89
+ this.type = newProps.type;
90
+ this.createProps = {
91
+ ctor: newProps.ctor,
92
+ optionalProviders: newProps.optionalProviders ?? {},
93
+ sharedObjectRegistry: new Map(newProps.sharedObjects?.map((ext) => [ext.type, ext])),
94
+ runtimeClassArg: newProps.runtimeClass ?? internal_3.FluidDataStoreRuntime,
95
+ policies: newProps.policies,
96
+ };
97
+ if (newProps.registryEntries !== undefined) {
98
+ this.registry = new internal_1.FluidDataStoreRegistry(newProps.registryEntries);
87
99
  }
88
- this.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));
89
100
  }
90
101
  /**
91
102
  * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}
@@ -112,7 +123,7 @@ class PureDataObjectFactory {
112
123
  * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}
113
124
  */
114
125
  async instantiateDataStore(context, existing) {
115
- const { runtime } = await createDataObject(this.ctor, context, this.sharedObjectRegistry, this.optionalProviders, this.runtimeClass, existing);
126
+ const { runtime } = await createDataObject({ ...this.createProps, context, existing });
116
127
  return runtime;
117
128
  }
118
129
  /**
@@ -172,8 +183,12 @@ class PureDataObjectFactory {
172
183
  */
173
184
  async createInstanceWithDataStore(containerRuntime, initialState, packagePath, loadingGroupId) {
174
185
  const context = containerRuntime.createDetachedDataStore(packagePath ?? [this.type], loadingGroupId);
175
- const { instance, runtime } = await createDataObject(this.ctor, context, this.sharedObjectRegistry, this.optionalProviders, this.runtimeClass, false, // existing
176
- initialState);
186
+ const { instance, runtime } = await createDataObject({
187
+ ...this.createProps,
188
+ context,
189
+ existing: false,
190
+ initialState,
191
+ });
177
192
  const dataStore = await context.attachRuntime(this, runtime);
178
193
  return [instance, dataStore];
179
194
  }
@@ -192,8 +207,12 @@ class PureDataObjectFactory {
192
207
  */
193
208
  async createRootInstance(rootDataStoreId, runtime, initialState) {
194
209
  const context = runtime.createDetachedDataStore([this.type]);
195
- const { instance, runtime: dataStoreRuntime } = await createDataObject(this.ctor, context, this.sharedObjectRegistry, this.optionalProviders, this.runtimeClass, false, // existing
196
- initialState);
210
+ const { instance, runtime: dataStoreRuntime } = await createDataObject({
211
+ ...this.createProps,
212
+ context,
213
+ existing: false,
214
+ initialState,
215
+ });
197
216
  const dataStore = await context.attachRuntime(this, dataStoreRuntime);
198
217
  const result = await dataStore.trySetAlias(rootDataStoreId);
199
218
  if (result !== "Success") {
@@ -208,8 +227,12 @@ class PureDataObjectFactory {
208
227
  return this.createInstanceCore(context, initialState);
209
228
  }
210
229
  async createInstanceCore(context, initialState) {
211
- const { instance, runtime } = await createDataObject(this.ctor, context, this.sharedObjectRegistry, this.optionalProviders, this.runtimeClass, false, // existing
212
- initialState);
230
+ const { instance, runtime } = await createDataObject({
231
+ ...this.createProps,
232
+ context,
233
+ existing: false,
234
+ initialState,
235
+ });
213
236
  await context.attachRuntime(this, runtime);
214
237
  return instance;
215
238
  }