@fluidframework/aqueduct 2.40.0-336023 → 2.41.0-337492

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 -6
  16. package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  17. package/dist/data-object-factories/pureDataObjectFactory.js +24 -15
  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 -6
  36. package/lib/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  37. package/lib/data-object-factories/pureDataObjectFactory.js +24 -15
  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 +102 -14
  48. package/src/index.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/aqueduct",
3
- "version": "2.40.0-336023",
3
+ "version": "2.41.0-337492",
4
4
  "description": "A set of implementations for Fluid Framework interfaces.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,27 +69,27 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "2.40.0-336023",
73
- "@fluidframework/container-definitions": "2.40.0-336023",
74
- "@fluidframework/container-runtime": "2.40.0-336023",
75
- "@fluidframework/container-runtime-definitions": "2.40.0-336023",
76
- "@fluidframework/core-interfaces": "2.40.0-336023",
77
- "@fluidframework/core-utils": "2.40.0-336023",
78
- "@fluidframework/datastore": "2.40.0-336023",
79
- "@fluidframework/datastore-definitions": "2.40.0-336023",
80
- "@fluidframework/map": "2.40.0-336023",
81
- "@fluidframework/request-handler": "2.40.0-336023",
82
- "@fluidframework/runtime-definitions": "2.40.0-336023",
83
- "@fluidframework/runtime-utils": "2.40.0-336023",
84
- "@fluidframework/shared-object-base": "2.40.0-336023",
85
- "@fluidframework/synthesize": "2.40.0-336023",
86
- "@fluidframework/telemetry-utils": "2.40.0-336023",
87
- "@fluidframework/tree": "2.40.0-336023"
72
+ "@fluid-internal/client-utils": "2.41.0-337492",
73
+ "@fluidframework/container-definitions": "2.41.0-337492",
74
+ "@fluidframework/container-runtime": "2.41.0-337492",
75
+ "@fluidframework/container-runtime-definitions": "2.41.0-337492",
76
+ "@fluidframework/core-interfaces": "2.41.0-337492",
77
+ "@fluidframework/core-utils": "2.41.0-337492",
78
+ "@fluidframework/datastore": "2.41.0-337492",
79
+ "@fluidframework/datastore-definitions": "2.41.0-337492",
80
+ "@fluidframework/map": "2.41.0-337492",
81
+ "@fluidframework/request-handler": "2.41.0-337492",
82
+ "@fluidframework/runtime-definitions": "2.41.0-337492",
83
+ "@fluidframework/runtime-utils": "2.41.0-337492",
84
+ "@fluidframework/shared-object-base": "2.41.0-337492",
85
+ "@fluidframework/synthesize": "2.41.0-337492",
86
+ "@fluidframework/telemetry-utils": "2.41.0-337492",
87
+ "@fluidframework/tree": "2.41.0-337492"
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.40.0-336023",
92
+ "@fluid-internal/mocha-test-setup": "2.41.0-337492",
93
93
  "@fluid-tools/build-cli": "^0.55.0",
94
94
  "@fluidframework/aqueduct-previous": "npm:@fluidframework/aqueduct@2.33.0",
95
95
  "@fluidframework/build-common": "^2.0.3",
@@ -11,6 +11,7 @@ import {
11
11
  FluidDataStoreRegistry,
12
12
  loadContainerRuntime,
13
13
  type IContainerRuntimeOptions,
14
+ type MinimumVersionForCollab,
14
15
  } from "@fluidframework/container-runtime/internal";
15
16
  import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
16
17
  import type { FluidObject } from "@fluidframework/core-interfaces";
@@ -61,6 +62,11 @@ export interface BaseContainerRuntimeFactoryProps {
61
62
  * created with this factory
62
63
  */
63
64
  provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
65
+ /**
66
+ * The minVersionForCollab passed to the ContainerRuntime when instantiating it.
67
+ * See {@link @fluidframework/container-runtime#LoadContainerRuntimeParams} for more details on this property.
68
+ */
69
+ minVersionForCollab?: MinimumVersionForCollab | undefined;
64
70
  }
65
71
 
66
72
  /**
@@ -88,6 +94,7 @@ export class BaseContainerRuntimeFactory
88
94
  // eslint-disable-next-line import/no-deprecated
89
95
  private readonly requestHandlers: RuntimeRequestHandler[];
90
96
  private readonly provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
97
+ private readonly minVersionForCollab: MinimumVersionForCollab | undefined;
91
98
 
92
99
  public constructor(props: BaseContainerRuntimeFactoryProps) {
93
100
  super();
@@ -98,6 +105,7 @@ export class BaseContainerRuntimeFactory
98
105
  this.provideEntryPoint = props.provideEntryPoint;
99
106
  this.requestHandlers = props.requestHandlers ?? [];
100
107
  this.registry = new FluidDataStoreRegistry(this.registryEntries);
108
+ this.minVersionForCollab = props.minVersionForCollab;
101
109
  }
102
110
 
103
111
  /**
@@ -146,6 +154,7 @@ export class BaseContainerRuntimeFactory
146
154
  // eslint-disable-next-line import/no-deprecated
147
155
  requestHandler: buildRuntimeRequestHandler(...this.requestHandlers),
148
156
  provideEntryPoint: this.provideEntryPoint,
157
+ minVersionForCollab: this.minVersionForCollab,
149
158
  });
150
159
  }
151
160
 
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
6
+ import type { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
7
7
  import type { IChannelFactory } from "@fluidframework/datastore-definitions/internal";
8
8
  import {
9
9
  SharedMap,
@@ -16,7 +16,10 @@ import type { FluidObjectSymbolProvider } from "@fluidframework/synthesize/inter
16
16
 
17
17
  import type { DataObject, DataObjectTypes, IDataObjectProps } from "../data-objects/index.js";
18
18
 
19
- import { PureDataObjectFactory } from "./pureDataObjectFactory.js";
19
+ import {
20
+ PureDataObjectFactory,
21
+ type DataObjectFactoryProps,
22
+ } from "./pureDataObjectFactory.js";
20
23
 
21
24
  /**
22
25
  * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
@@ -32,28 +35,55 @@ export class DataObjectFactory<
32
35
  TObj extends DataObject<I>,
33
36
  I extends DataObjectTypes = DataObjectTypes,
34
37
  > extends PureDataObjectFactory<TObj, I> {
38
+ /**
39
+ * @remarks Use the props object based constructor instead.
40
+ * No new features will be added to this constructor,
41
+ * and it will eventually be deprecated and removed.
42
+ */
35
43
  public constructor(
36
44
  type: string,
37
45
  ctor: new (props: IDataObjectProps<I>) => TObj,
38
- sharedObjects: readonly IChannelFactory[] = [],
39
- optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>,
46
+ sharedObjects?: readonly IChannelFactory[],
47
+ optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>,
40
48
  registryEntries?: NamedFluidDataStoreRegistryEntries,
41
- runtimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,
49
+ runtimeFactory?: typeof FluidDataStoreRuntime,
50
+ );
51
+ public constructor(props: DataObjectFactoryProps<TObj, I>);
52
+ public constructor(
53
+ propsOrType: DataObjectFactoryProps<TObj, I> | string,
54
+ maybeCtor?: new (doProps: IDataObjectProps<I>) => TObj,
55
+ maybeSharedObjects?: readonly IChannelFactory[],
56
+ maybeOptionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>,
57
+ maybeRegistryEntries?: NamedFluidDataStoreRegistryEntries,
58
+ maybeRuntimeFactory?: typeof FluidDataStoreRuntime,
42
59
  ) {
43
- const mergedObjects = [...sharedObjects];
60
+ const newProps =
61
+ typeof propsOrType === "string"
62
+ ? {
63
+ type: propsOrType,
64
+ // both the arg and props base constructor require this param
65
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
66
+ ctor: maybeCtor!,
67
+ sharedObjects: maybeSharedObjects,
68
+ optionalProviders: maybeOptionalProviders,
69
+ registryEntries: maybeRegistryEntries,
70
+ runtimeClass: maybeRuntimeFactory,
71
+ }
72
+ : { ...propsOrType };
73
+
74
+ const sharedObjects = (newProps.sharedObjects = [...(newProps.sharedObjects ?? [])]);
44
75
 
45
76
  if (!sharedObjects.some((factory) => factory.type === DirectoryFactory.Type)) {
46
77
  // User did not register for directory
47
- // eslint-disable-next-line import/no-deprecated
48
- mergedObjects.push(SharedDirectory.getFactory());
78
+ sharedObjects.push(SharedDirectory.getFactory());
49
79
  }
50
80
 
51
81
  // TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10
52
82
  if (!sharedObjects.some((factory) => factory.type === MapFactory.Type)) {
53
83
  // User did not register for map
54
- mergedObjects.push(SharedMap.getFactory());
84
+ sharedObjects.push(SharedMap.getFactory());
55
85
  }
56
86
 
57
- super(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);
87
+ super(newProps);
58
88
  }
59
89
  }
@@ -4,4 +4,7 @@
4
4
  */
5
5
 
6
6
  export { DataObjectFactory } from "./dataObjectFactory.js";
7
- export { PureDataObjectFactory } from "./pureDataObjectFactory.js";
7
+ export {
8
+ type DataObjectFactoryProps,
9
+ PureDataObjectFactory,
10
+ } from "./pureDataObjectFactory.js";
@@ -23,6 +23,7 @@ import type {
23
23
  IFluidDataStoreContext,
24
24
  IFluidDataStoreContextDetached,
25
25
  IFluidDataStoreFactory,
26
+ IFluidDataStorePolicies,
26
27
  IFluidDataStoreRegistry,
27
28
  IProvideFluidDataStoreRegistry,
28
29
  NamedFluidDataStoreRegistryEntries,
@@ -48,6 +49,7 @@ interface CreateDataObjectProps<TObj extends PureDataObject, I extends DataObjec
48
49
  runtimeClassArg: typeof FluidDataStoreRuntime;
49
50
  existing: boolean;
50
51
  initialState?: I["InitialState"];
52
+ policies?: Partial<IFluidDataStorePolicies>;
51
53
  }
52
54
  /**
53
55
  * Proxy over PureDataObject
@@ -64,6 +66,7 @@ async function createDataObject<
64
66
  runtimeClassArg,
65
67
  existing,
66
68
  initialState: initProps,
69
+ policies,
67
70
  }: CreateDataObjectProps<TObj, I>): Promise<{
68
71
  instance: TObj;
69
72
  runtime: FluidDataStoreRuntime;
@@ -101,6 +104,7 @@ async function createDataObject<
101
104
  await instance.finishInitialization(true);
102
105
  return instance;
103
106
  } /* provideEntryPoint */,
107
+ policies,
104
108
  );
105
109
 
106
110
  // Create object right away.
@@ -135,6 +139,58 @@ async function createDataObject<
135
139
  return { instance, runtime };
136
140
  }
137
141
 
142
+ /**
143
+ * Represents the properties required to create a DataObjectFactory.
144
+ * This includes the type identifier, constructor, shared objects, optional providers,
145
+ * registry entries, and the runtime class to use for the data object.
146
+ * @typeParam TObj - DataObject (concrete type)
147
+ * @typeParam I - The input types for the DataObject
148
+ * @legacy
149
+ * @alpha
150
+ */
151
+ export interface DataObjectFactoryProps<
152
+ TObj extends PureDataObject<I>,
153
+ I extends DataObjectTypes = DataObjectTypes,
154
+ > {
155
+ /**
156
+ * The type identifier for the data object factory.
157
+ */
158
+ readonly type: string;
159
+
160
+ /**
161
+ * The constructor for the data object.
162
+ */
163
+ readonly ctor: new (
164
+ props: IDataObjectProps<I>,
165
+ ) => TObj;
166
+
167
+ /**
168
+ * The shared objects (DDSes) to be registered with the data object.
169
+ */
170
+ readonly sharedObjects?: readonly IChannelFactory[];
171
+
172
+ /**
173
+ * Optional providers for dependency injection.
174
+ */
175
+ readonly optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>;
176
+
177
+ /**
178
+ * Registry entries for named data stores.
179
+ */
180
+ readonly registryEntries?: NamedFluidDataStoreRegistryEntries;
181
+
182
+ /**
183
+ * The runtime class to use for the data object.
184
+ */
185
+ readonly runtimeClass?: typeof FluidDataStoreRuntime;
186
+
187
+ /**
188
+ * Optional policies that can be applied to the DataObject.
189
+ * These policies define specific behaviors or constraints for the data object.
190
+ */
191
+ readonly policies?: Partial<IFluidDataStorePolicies>;
192
+ }
193
+
138
194
  /**
139
195
  * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.
140
196
  * Consumers should typically use DataObjectFactory instead unless creating
@@ -153,30 +209,62 @@ export class PureDataObjectFactory<
153
209
  private readonly registry: IFluidDataStoreRegistry | undefined;
154
210
  private readonly createProps: Omit<CreateDataObjectProps<TObj, I>, "existing" | "context">;
155
211
 
212
+ /**
213
+ * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory."type"}
214
+ */
215
+ public readonly type: string;
216
+
217
+ /**
218
+ * @remarks Use the props object based constructor instead.
219
+ * No new features will be added to this constructor,
220
+ * and it will eventually be deprecated and removed.
221
+ */
156
222
  public constructor(
157
- /**
158
- * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory."type"}
159
- */
160
- public readonly type: string,
223
+ type: string,
161
224
  ctor: new (props: IDataObjectProps<I>) => TObj,
162
- sharedObjects: readonly IChannelFactory[],
163
- optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>,
225
+ sharedObjects?: readonly IChannelFactory[],
226
+ optionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>,
164
227
  registryEntries?: NamedFluidDataStoreRegistryEntries,
165
- runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,
228
+ runtimeClass?: typeof FluidDataStoreRuntime,
229
+ );
230
+ public constructor(props: DataObjectFactoryProps<TObj, I>);
231
+ public constructor(
232
+ propsOrType: DataObjectFactoryProps<TObj, I> | string,
233
+ maybeCtor?: new (doProps: IDataObjectProps<I>) => TObj,
234
+ maybeSharedObjects?: readonly IChannelFactory[],
235
+ maybeOptionalProviders?: FluidObjectSymbolProvider<I["OptionalProviders"]>,
236
+ maybeRegistryEntries?: NamedFluidDataStoreRegistryEntries,
237
+ maybeRuntimeFactory?: typeof FluidDataStoreRuntime,
166
238
  ) {
167
- if (this.type === "") {
239
+ const newProps =
240
+ typeof propsOrType === "string"
241
+ ? {
242
+ type: propsOrType,
243
+ // both the arg and props base constructor require this param
244
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
245
+ ctor: maybeCtor!,
246
+ sharedObjects: maybeSharedObjects,
247
+ optionalProviders: maybeOptionalProviders,
248
+ registryEntries: maybeRegistryEntries,
249
+ runtimeClass: maybeRuntimeFactory,
250
+ }
251
+ : propsOrType;
252
+
253
+ if (newProps.type === "") {
168
254
  throw new Error("undefined type member");
169
255
  }
256
+ this.type = newProps.type;
170
257
 
171
258
  this.createProps = {
172
- ctor,
173
- optionalProviders,
174
- sharedObjectRegistry: new Map(sharedObjects.map((ext) => [ext.type, ext])),
175
- runtimeClassArg: runtimeClass,
259
+ ctor: newProps.ctor,
260
+ optionalProviders: newProps.optionalProviders ?? {},
261
+ sharedObjectRegistry: new Map(newProps.sharedObjects?.map((ext) => [ext.type, ext])),
262
+ runtimeClassArg: newProps.runtimeClass ?? FluidDataStoreRuntime,
263
+ policies: newProps.policies,
176
264
  };
177
265
 
178
- if (registryEntries !== undefined) {
179
- this.registry = new FluidDataStoreRegistry(registryEntries);
266
+ if (newProps.registryEntries !== undefined) {
267
+ this.registry = new FluidDataStoreRegistry(newProps.registryEntries);
180
268
  }
181
269
  }
182
270
 
package/src/index.ts CHANGED
@@ -21,6 +21,7 @@
21
21
  export {
22
22
  DataObjectFactory,
23
23
  PureDataObjectFactory,
24
+ type DataObjectFactoryProps,
24
25
  } from "./data-object-factories/index.js";
25
26
  export {
26
27
  DataObject,