@fluidframework/fluid-static 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.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 (94) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +1 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +10 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor.json +1 -1
  6. package/api-report/fluid-static.api.md +17 -14
  7. package/dist/fluid-static-alpha.d.ts +29 -13
  8. package/dist/fluid-static-beta.d.ts +29 -13
  9. package/dist/fluid-static-public.d.ts +29 -13
  10. package/dist/fluid-static-untrimmed.d.ts +44 -16
  11. package/dist/fluidContainer.d.ts +9 -6
  12. package/dist/fluidContainer.d.ts.map +1 -1
  13. package/dist/fluidContainer.js +3 -1
  14. package/dist/fluidContainer.js.map +1 -1
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +6 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/package.json +3 -0
  20. package/dist/rootDataObject.d.ts +5 -2
  21. package/dist/rootDataObject.d.ts.map +1 -1
  22. package/dist/rootDataObject.js +12 -8
  23. package/dist/rootDataObject.js.map +1 -1
  24. package/dist/serviceAudience.d.ts +13 -6
  25. package/dist/serviceAudience.d.ts.map +1 -1
  26. package/dist/serviceAudience.js +12 -4
  27. package/dist/serviceAudience.js.map +1 -1
  28. package/dist/tsdoc-metadata.json +1 -1
  29. package/dist/types.d.ts +26 -12
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/types.js.map +1 -1
  32. package/dist/utils.d.ts +13 -9
  33. package/dist/utils.d.ts.map +1 -1
  34. package/dist/utils.js +11 -8
  35. package/dist/utils.js.map +1 -1
  36. package/lib/{fluid-static-alpha.d.mts → fluid-static-alpha.d.ts} +35 -13
  37. package/lib/{fluid-static-beta.d.mts → fluid-static-beta.d.ts} +35 -13
  38. package/lib/{fluid-static-public.d.mts → fluid-static-public.d.ts} +35 -13
  39. package/lib/{fluid-static-untrimmed.d.mts → fluid-static-untrimmed.d.ts} +50 -16
  40. package/lib/{fluidContainer.d.mts → fluidContainer.d.ts} +10 -7
  41. package/lib/fluidContainer.d.ts.map +1 -0
  42. package/lib/{fluidContainer.mjs → fluidContainer.js} +8 -2
  43. package/lib/fluidContainer.js.map +1 -0
  44. package/lib/index.d.ts +14 -0
  45. package/lib/index.d.ts.map +1 -0
  46. package/lib/index.js +13 -0
  47. package/lib/index.js.map +1 -0
  48. package/lib/{rootDataObject.d.mts → rootDataObject.d.ts} +6 -3
  49. package/lib/rootDataObject.d.ts.map +1 -0
  50. package/lib/{rootDataObject.mjs → rootDataObject.js} +14 -6
  51. package/lib/rootDataObject.js.map +1 -0
  52. package/lib/serviceAudience.d.ts +22 -0
  53. package/lib/serviceAudience.d.ts.map +1 -0
  54. package/lib/{serviceAudience.mjs → serviceAudience.js} +13 -5
  55. package/lib/serviceAudience.js.map +1 -0
  56. package/lib/test/fluidContainer.spec.js +21 -0
  57. package/lib/test/fluidContainer.spec.js.map +1 -0
  58. package/lib/test/types/validateFluidStaticPrevious.generated.js +46 -0
  59. package/lib/test/types/validateFluidStaticPrevious.generated.js.map +1 -0
  60. package/lib/test/utils.spec.js +86 -0
  61. package/lib/test/utils.spec.js.map +1 -0
  62. package/lib/{types.d.mts → types.d.ts} +27 -13
  63. package/lib/types.d.ts.map +1 -0
  64. package/lib/{types.mjs → types.js} +1 -1
  65. package/lib/types.js.map +1 -0
  66. package/lib/utils.d.ts +34 -0
  67. package/lib/utils.d.ts.map +1 -0
  68. package/lib/{utils.mjs → utils.js} +11 -8
  69. package/lib/utils.js.map +1 -0
  70. package/package.json +45 -58
  71. package/src/fluidContainer.ts +29 -17
  72. package/src/index.ts +23 -22
  73. package/src/rootDataObject.ts +48 -29
  74. package/src/serviceAudience.ts +35 -22
  75. package/src/types.ts +34 -14
  76. package/src/utils.ts +36 -16
  77. package/tsconfig.cjs.json +7 -0
  78. package/tsconfig.json +4 -8
  79. package/lib/fluidContainer.d.mts.map +0 -1
  80. package/lib/fluidContainer.mjs.map +0 -1
  81. package/lib/index.d.mts +0 -9
  82. package/lib/index.d.mts.map +0 -1
  83. package/lib/index.mjs +0 -8
  84. package/lib/index.mjs.map +0 -1
  85. package/lib/rootDataObject.d.mts.map +0 -1
  86. package/lib/rootDataObject.mjs.map +0 -1
  87. package/lib/serviceAudience.d.mts +0 -15
  88. package/lib/serviceAudience.d.mts.map +0 -1
  89. package/lib/serviceAudience.mjs.map +0 -1
  90. package/lib/types.d.mts.map +0 -1
  91. package/lib/types.mjs.map +0 -1
  92. package/lib/utils.d.mts +0 -30
  93. package/lib/utils.d.mts.map +0 -1
  94. package/lib/utils.mjs.map +0 -1
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
8
8
  parserOptions: {
9
9
  project: ["./tsconfig.json", "./src/test/tsconfig.json"],
10
10
  },
@@ -5,7 +5,7 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
8
+ const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
9
9
 
10
10
  const packageDir = __dirname;
11
11
  const config = getFluidTestMochaConfig(packageDir);
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @fluidframework/fluid-static
2
2
 
3
+ ## 2.0.0-rc.2.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fluid-framework: ContainerSchema is now readonly ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
8
+
9
+ The `ContainerSchema` type is intended for defining input to these packages. This should make the APIs more tolerant and
10
+ thus be non-breaking, however its possible for some users of `ContainerSchema` to use it in ways where this could be a
11
+ breaking change: any such users should remove their mutations and/or use a different type.
12
+
3
13
  ## 2.0.0-rc.1.0.0
4
14
 
5
15
  ### Minor Changes
@@ -1,4 +1,8 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base-esm.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
4
+ // CJS is actually secondary; so, no report.
5
+ "apiReport": {
6
+ "enabled": false
7
+ }
4
8
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-base.esm.primary.json"
4
4
  }
@@ -15,28 +15,31 @@ import { IEventProvider } from '@fluidframework/core-interfaces';
15
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
16
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
17
17
 
18
+ // @public
19
+ export type ContainerAttachProps<T = unknown> = T;
20
+
18
21
  // @public
19
22
  export interface ContainerSchema {
20
- dynamicObjectTypes?: LoadableObjectClass<any>[];
21
- initialObjects: LoadableObjectClassRecord;
23
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
24
+ readonly initialObjects: LoadableObjectClassRecord;
22
25
  }
23
26
 
24
- // @internal (undocumented)
27
+ // @internal
25
28
  export function createDOProviderContainerRuntimeFactory(props: {
26
29
  schema: ContainerSchema;
27
30
  }): IRuntimeFactory;
28
31
 
29
- // @internal (undocumented)
32
+ // @internal
30
33
  export function createFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>(props: {
31
34
  container: IContainer;
32
35
  rootDataObject: IRootDataObject;
33
36
  }): IFluidContainer<TContainerSchema>;
34
37
 
35
- // @internal (undocumented)
36
- export function createServiceAudience<M extends IMember = IMember>(props: {
38
+ // @internal
39
+ export function createServiceAudience<TMember extends IMember = IMember>(props: {
37
40
  container: IContainer;
38
- createServiceMember: (audienceMember: IClient) => M;
39
- }): IServiceAudience<M>;
41
+ createServiceMember: (audienceMember: IClient) => TMember;
42
+ }): IServiceAudience<TMember>;
40
43
 
41
44
  // @public
42
45
  export type DataObjectClass<T extends IFluidLoadable> = {
@@ -53,7 +56,7 @@ export interface IConnection {
53
56
 
54
57
  // @public @sealed
55
58
  export interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IEventProvider<IFluidContainerEvents> {
56
- attach(): Promise<string>;
59
+ attach(props?: ContainerAttachProps): Promise<string>;
57
60
  readonly attachState: AttachState;
58
61
  connect(): void;
59
62
  readonly connectionState: ConnectionState;
@@ -114,10 +117,10 @@ export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
114
117
  }
115
118
 
116
119
  // @public
117
- export type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
120
+ export type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
118
121
 
119
122
  // @public
120
- export type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
123
+ export type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
121
124
 
122
125
  // @public
123
126
  export type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
@@ -134,8 +137,8 @@ export type Myself<M extends IMember = IMember> = M & {
134
137
  };
135
138
 
136
139
  // @public
137
- export type SharedObjectClass<T extends IFluidLoadable> = {
138
- readonly getFactory: () => IChannelFactory;
139
- } & LoadableObjectCtor<T>;
140
+ export interface SharedObjectClass<T extends IFluidLoadable> {
141
+ readonly getFactory: () => IChannelFactory<T>;
142
+ }
140
143
 
141
144
  ```
@@ -15,6 +15,12 @@ import { IEventProvider } from '@fluidframework/core-interfaces';
15
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
16
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
17
17
 
18
+ /**
19
+ * Represents properties that can be attached to a container.
20
+ * @public
21
+ */
22
+ export declare type ContainerAttachProps<T = unknown> = T;
23
+
18
24
  /**
19
25
  * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
20
26
  *
@@ -43,7 +49,7 @@ export declare interface ContainerSchema {
43
49
  * }
44
50
  * ```
45
51
  */
46
- initialObjects: LoadableObjectClassRecord;
52
+ readonly initialObjects: LoadableObjectClassRecord;
47
53
  /**
48
54
  * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
49
55
  *
@@ -54,7 +60,7 @@ export declare interface ContainerSchema {
54
60
  * For best practice it's recommended to define all the dynamic types you create even if they are
55
61
  * included via initialObjects.
56
62
  */
57
- dynamicObjectTypes?: LoadableObjectClass<any>[];
63
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
58
64
  }
59
65
 
60
66
  /* Excluded from this release type: createDOProviderContainerRuntimeFactory */
@@ -100,6 +106,7 @@ export declare interface IConnection {
100
106
  * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
101
107
  *
102
108
  * @remarks Note: external implementations of this interface are not supported.
109
+ *
103
110
  * @sealed
104
111
  * @public
105
112
  */
@@ -161,7 +168,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
161
168
  *
162
169
  * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
163
170
  */
164
- attach(): Promise<string>;
171
+ attach(props?: ContainerAttachProps): Promise<string>;
165
172
  /**
166
173
  * Attempts to connect the container to the delta stream and process operations.
167
174
  *
@@ -170,7 +177,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
170
177
  * @remarks
171
178
  *
172
179
  * This should only be called when the container is in the
173
- * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
180
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.
174
181
  *
175
182
  * This can be determined by observing {@link IFluidContainer.connectionState}.
176
183
  */
@@ -181,7 +188,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
181
188
  * @remarks
182
189
  *
183
190
  * This should only be called when the container is in the
184
- * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
191
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.
185
192
  *
186
193
  * This can be determined by observing {@link IFluidContainer.connectionState}.
187
194
  */
@@ -355,15 +362,22 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
355
362
  *
356
363
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
357
364
  * @public
365
+ *
366
+ * @privateRemarks
367
+ * There are some edge cases in TypeScript where the order of the members in a union matter.
368
+ * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
369
+ * In this case, its better to have the desired match and/or the simpler type first.
370
+ * In this case placing SharedObjectClass fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
371
+ * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
358
372
  */
359
- export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
373
+ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
360
374
 
361
375
  /**
362
376
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
363
- * or `SharedObject` in a {@link LoadableObjectRecord}.
377
+ * or `SharedObject`.
364
378
  * @public
365
379
  */
366
- export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
380
+ export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
367
381
 
368
382
  /**
369
383
  * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
@@ -395,14 +409,16 @@ export declare type Myself<M extends IMember = IMember> = M & {
395
409
  };
396
410
 
397
411
  /**
398
- * A class that has a factory that can create a DDSes (`SharedObject`s) and a
399
- * constructor that will return the type of the `DataObject`.
412
+ * A factory that produces a factory that can create a DDSes (`SharedObject`s).
400
413
  *
401
414
  * @typeParam T - The class of the `SharedObject`.
402
415
  * @public
403
416
  */
404
- export declare type SharedObjectClass<T extends IFluidLoadable> = {
405
- readonly getFactory: () => IChannelFactory;
406
- } & LoadableObjectCtor<T>;
417
+ export declare interface SharedObjectClass<T extends IFluidLoadable> {
418
+ /**
419
+ * Gets the factory this factory is a wrapper for.
420
+ */
421
+ readonly getFactory: () => IChannelFactory<T>;
422
+ }
407
423
 
408
424
  export { }
@@ -15,6 +15,12 @@ import { IEventProvider } from '@fluidframework/core-interfaces';
15
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
16
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
17
17
 
18
+ /**
19
+ * Represents properties that can be attached to a container.
20
+ * @public
21
+ */
22
+ export declare type ContainerAttachProps<T = unknown> = T;
23
+
18
24
  /**
19
25
  * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
20
26
  *
@@ -43,7 +49,7 @@ export declare interface ContainerSchema {
43
49
  * }
44
50
  * ```
45
51
  */
46
- initialObjects: LoadableObjectClassRecord;
52
+ readonly initialObjects: LoadableObjectClassRecord;
47
53
  /**
48
54
  * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
49
55
  *
@@ -54,7 +60,7 @@ export declare interface ContainerSchema {
54
60
  * For best practice it's recommended to define all the dynamic types you create even if they are
55
61
  * included via initialObjects.
56
62
  */
57
- dynamicObjectTypes?: LoadableObjectClass<any>[];
63
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
58
64
  }
59
65
 
60
66
  /* Excluded from this release type: createDOProviderContainerRuntimeFactory */
@@ -102,6 +108,7 @@ export declare interface IConnection {
102
108
  * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
103
109
  *
104
110
  * @remarks Note: external implementations of this interface are not supported.
111
+ *
105
112
  * @sealed
106
113
  * @public
107
114
  */
@@ -163,7 +170,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
163
170
  *
164
171
  * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
165
172
  */
166
- attach(): Promise<string>;
173
+ attach(props?: ContainerAttachProps): Promise<string>;
167
174
  /**
168
175
  * Attempts to connect the container to the delta stream and process operations.
169
176
  *
@@ -172,7 +179,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
172
179
  * @remarks
173
180
  *
174
181
  * This should only be called when the container is in the
175
- * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
182
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.
176
183
  *
177
184
  * This can be determined by observing {@link IFluidContainer.connectionState}.
178
185
  */
@@ -183,7 +190,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
183
190
  * @remarks
184
191
  *
185
192
  * This should only be called when the container is in the
186
- * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
193
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.
187
194
  *
188
195
  * This can be determined by observing {@link IFluidContainer.connectionState}.
189
196
  */
@@ -359,15 +366,22 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
359
366
  *
360
367
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
361
368
  * @public
369
+ *
370
+ * @privateRemarks
371
+ * There are some edge cases in TypeScript where the order of the members in a union matter.
372
+ * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
373
+ * In this case, its better to have the desired match and/or the simpler type first.
374
+ * In this case placing SharedObjectClass fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
375
+ * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
362
376
  */
363
- export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
377
+ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
364
378
 
365
379
  /**
366
380
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
367
- * or `SharedObject` in a {@link LoadableObjectRecord}.
381
+ * or `SharedObject`.
368
382
  * @public
369
383
  */
370
- export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
384
+ export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
371
385
 
372
386
  /**
373
387
  * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
@@ -399,14 +413,16 @@ export declare type Myself<M extends IMember = IMember> = M & {
399
413
  };
400
414
 
401
415
  /**
402
- * A class that has a factory that can create a DDSes (`SharedObject`s) and a
403
- * constructor that will return the type of the `DataObject`.
416
+ * A factory that produces a factory that can create a DDSes (`SharedObject`s).
404
417
  *
405
418
  * @typeParam T - The class of the `SharedObject`.
406
419
  * @public
407
420
  */
408
- export declare type SharedObjectClass<T extends IFluidLoadable> = {
409
- readonly getFactory: () => IChannelFactory;
410
- } & LoadableObjectCtor<T>;
421
+ export declare interface SharedObjectClass<T extends IFluidLoadable> {
422
+ /**
423
+ * Gets the factory this factory is a wrapper for.
424
+ */
425
+ readonly getFactory: () => IChannelFactory<T>;
426
+ }
411
427
 
412
428
  export { }
@@ -15,6 +15,12 @@ import { IEventProvider } from '@fluidframework/core-interfaces';
15
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
16
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
17
17
 
18
+ /**
19
+ * Represents properties that can be attached to a container.
20
+ * @public
21
+ */
22
+ export declare type ContainerAttachProps<T = unknown> = T;
23
+
18
24
  /**
19
25
  * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
20
26
  *
@@ -43,7 +49,7 @@ export declare interface ContainerSchema {
43
49
  * }
44
50
  * ```
45
51
  */
46
- initialObjects: LoadableObjectClassRecord;
52
+ readonly initialObjects: LoadableObjectClassRecord;
47
53
  /**
48
54
  * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
49
55
  *
@@ -54,7 +60,7 @@ export declare interface ContainerSchema {
54
60
  * For best practice it's recommended to define all the dynamic types you create even if they are
55
61
  * included via initialObjects.
56
62
  */
57
- dynamicObjectTypes?: LoadableObjectClass<any>[];
63
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
58
64
  }
59
65
 
60
66
  /* Excluded from this release type: createDOProviderContainerRuntimeFactory */
@@ -102,6 +108,7 @@ export declare interface IConnection {
102
108
  * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
103
109
  *
104
110
  * @remarks Note: external implementations of this interface are not supported.
111
+ *
105
112
  * @sealed
106
113
  * @public
107
114
  */
@@ -163,7 +170,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
163
170
  *
164
171
  * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
165
172
  */
166
- attach(): Promise<string>;
173
+ attach(props?: ContainerAttachProps): Promise<string>;
167
174
  /**
168
175
  * Attempts to connect the container to the delta stream and process operations.
169
176
  *
@@ -172,7 +179,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
172
179
  * @remarks
173
180
  *
174
181
  * This should only be called when the container is in the
175
- * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
182
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.
176
183
  *
177
184
  * This can be determined by observing {@link IFluidContainer.connectionState}.
178
185
  */
@@ -183,7 +190,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
183
190
  * @remarks
184
191
  *
185
192
  * This should only be called when the container is in the
186
- * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
193
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.
187
194
  *
188
195
  * This can be determined by observing {@link IFluidContainer.connectionState}.
189
196
  */
@@ -359,15 +366,22 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
359
366
  *
360
367
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
361
368
  * @public
369
+ *
370
+ * @privateRemarks
371
+ * There are some edge cases in TypeScript where the order of the members in a union matter.
372
+ * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
373
+ * In this case, its better to have the desired match and/or the simpler type first.
374
+ * In this case placing SharedObjectClass fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
375
+ * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
362
376
  */
363
- export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
377
+ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
364
378
 
365
379
  /**
366
380
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
367
- * or `SharedObject` in a {@link LoadableObjectRecord}.
381
+ * or `SharedObject`.
368
382
  * @public
369
383
  */
370
- export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
384
+ export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
371
385
 
372
386
  /**
373
387
  * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
@@ -399,14 +413,16 @@ export declare type Myself<M extends IMember = IMember> = M & {
399
413
  };
400
414
 
401
415
  /**
402
- * A class that has a factory that can create a DDSes (`SharedObject`s) and a
403
- * constructor that will return the type of the `DataObject`.
416
+ * A factory that produces a factory that can create a DDSes (`SharedObject`s).
404
417
  *
405
418
  * @typeParam T - The class of the `SharedObject`.
406
419
  * @public
407
420
  */
408
- export declare type SharedObjectClass<T extends IFluidLoadable> = {
409
- readonly getFactory: () => IChannelFactory;
410
- } & LoadableObjectCtor<T>;
421
+ export declare interface SharedObjectClass<T extends IFluidLoadable> {
422
+ /**
423
+ * Gets the factory this factory is a wrapper for.
424
+ */
425
+ readonly getFactory: () => IChannelFactory<T>;
426
+ }
411
427
 
412
428
  export { }
@@ -15,6 +15,12 @@ import { IEventProvider } from '@fluidframework/core-interfaces';
15
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
16
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
17
17
 
18
+ /**
19
+ * Represents properties that can be attached to a container.
20
+ * @public
21
+ */
22
+ export declare type ContainerAttachProps<T = unknown> = T;
23
+
18
24
  /**
19
25
  * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
20
26
  *
@@ -43,7 +49,7 @@ export declare interface ContainerSchema {
43
49
  * }
44
50
  * ```
45
51
  */
46
- initialObjects: LoadableObjectClassRecord;
52
+ readonly initialObjects: LoadableObjectClassRecord;
47
53
  /**
48
54
  * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
49
55
  *
@@ -54,10 +60,13 @@ export declare interface ContainerSchema {
54
60
  * For best practice it's recommended to define all the dynamic types you create even if they are
55
61
  * included via initialObjects.
56
62
  */
57
- dynamicObjectTypes?: LoadableObjectClass<any>[];
63
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
58
64
  }
59
65
 
60
66
  /**
67
+ * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single
68
+ * {@link IRootDataObject}, which is constructed from the provided schema.
69
+ *
61
70
  * @internal
62
71
  */
63
72
  export declare function createDOProviderContainerRuntimeFactory(props: {
@@ -65,6 +74,8 @@ export declare function createDOProviderContainerRuntimeFactory(props: {
65
74
  }): IRuntimeFactory;
66
75
 
67
76
  /**
77
+ * Creates an {@link IFluidContainer} from the provided `container` and `rootDataObject`.
78
+ *
68
79
  * @internal
69
80
  */
70
81
  export declare function createFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>(props: {
@@ -73,12 +84,19 @@ export declare function createFluidContainer<TContainerSchema extends ContainerS
73
84
  }): IFluidContainer<TContainerSchema>;
74
85
 
75
86
  /**
87
+ * Creates a service audience for the provided container.
88
+ *
89
+ * @param container - The container with which the audience is associated.
90
+ * @param createServiceMember - A function for creating audience members.
91
+ *
92
+ * @typeParam TMember - The {@link IMember} representation used by the audience.
93
+ *
76
94
  * @internal
77
95
  */
78
- export declare function createServiceAudience<M extends IMember = IMember>(props: {
96
+ export declare function createServiceAudience<TMember extends IMember = IMember>(props: {
79
97
  container: IContainer;
80
- createServiceMember: (audienceMember: IClient) => M;
81
- }): IServiceAudience<M>;
98
+ createServiceMember: (audienceMember: IClient) => TMember;
99
+ }): IServiceAudience<TMember>;
82
100
 
83
101
  /**
84
102
  * A class that has a factory that can create a `DataObject` and a
@@ -117,6 +135,7 @@ export declare interface IConnection {
117
135
  * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
118
136
  *
119
137
  * @remarks Note: external implementations of this interface are not supported.
138
+ *
120
139
  * @sealed
121
140
  * @public
122
141
  */
@@ -178,7 +197,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
178
197
  *
179
198
  * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
180
199
  */
181
- attach(): Promise<string>;
200
+ attach(props?: ContainerAttachProps): Promise<string>;
182
201
  /**
183
202
  * Attempts to connect the container to the delta stream and process operations.
184
203
  *
@@ -187,7 +206,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
187
206
  * @remarks
188
207
  *
189
208
  * This should only be called when the container is in the
190
- * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
209
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.
191
210
  *
192
211
  * This can be determined by observing {@link IFluidContainer.connectionState}.
193
212
  */
@@ -198,7 +217,7 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
198
217
  * @remarks
199
218
  *
200
219
  * This should only be called when the container is in the
201
- * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
220
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.
202
221
  *
203
222
  * This can be determined by observing {@link IFluidContainer.connectionState}.
204
223
  */
@@ -395,15 +414,22 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
395
414
  *
396
415
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
397
416
  * @public
417
+ *
418
+ * @privateRemarks
419
+ * There are some edge cases in TypeScript where the order of the members in a union matter.
420
+ * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
421
+ * In this case, its better to have the desired match and/or the simpler type first.
422
+ * In this case placing SharedObjectClass fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
423
+ * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
398
424
  */
399
- export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
425
+ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
400
426
 
401
427
  /**
402
428
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
403
- * or `SharedObject` in a {@link LoadableObjectRecord}.
429
+ * or `SharedObject`.
404
430
  * @public
405
431
  */
406
- export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
432
+ export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
407
433
 
408
434
  /**
409
435
  * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
@@ -439,14 +465,16 @@ export declare type Myself<M extends IMember = IMember> = M & {
439
465
  };
440
466
 
441
467
  /**
442
- * A class that has a factory that can create a DDSes (`SharedObject`s) and a
443
- * constructor that will return the type of the `DataObject`.
468
+ * A factory that produces a factory that can create a DDSes (`SharedObject`s).
444
469
  *
445
470
  * @typeParam T - The class of the `SharedObject`.
446
471
  * @public
447
472
  */
448
- export declare type SharedObjectClass<T extends IFluidLoadable> = {
449
- readonly getFactory: () => IChannelFactory;
450
- } & LoadableObjectCtor<T>;
473
+ export declare interface SharedObjectClass<T extends IFluidLoadable> {
474
+ /**
475
+ * Gets the factory this factory is a wrapper for.
476
+ */
477
+ readonly getFactory: () => IChannelFactory<T>;
478
+ }
451
479
 
452
480
  export { }
@@ -1,6 +1,6 @@
1
- import { IEvent, IEventProvider, IFluidLoadable } from "@fluidframework/core-interfaces";
2
- import { AttachState, IContainer, ICriticalContainerError, ConnectionState } from "@fluidframework/container-definitions";
3
- import type { ContainerSchema, IRootDataObject, LoadableObjectClass } from "./types";
1
+ import { type IEvent, type IEventProvider, type IFluidLoadable } from "@fluidframework/core-interfaces";
2
+ import { AttachState, type IContainer, type ICriticalContainerError, type ConnectionState } from "@fluidframework/container-definitions";
3
+ import type { ContainerSchema, ContainerAttachProps, IRootDataObject, LoadableObjectClass } from "./types.js";
4
4
  /**
5
5
  * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
6
6
  * @public
@@ -73,6 +73,7 @@ export interface IFluidContainerEvents extends IEvent {
73
73
  * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
74
74
  *
75
75
  * @remarks Note: external implementations of this interface are not supported.
76
+ *
76
77
  * @sealed
77
78
  * @public
78
79
  */
@@ -134,7 +135,7 @@ export interface IFluidContainer<TContainerSchema extends ContainerSchema = Cont
134
135
  *
135
136
  * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
136
137
  */
137
- attach(): Promise<string>;
138
+ attach(props?: ContainerAttachProps): Promise<string>;
138
139
  /**
139
140
  * Attempts to connect the container to the delta stream and process operations.
140
141
  *
@@ -143,7 +144,7 @@ export interface IFluidContainer<TContainerSchema extends ContainerSchema = Cont
143
144
  * @remarks
144
145
  *
145
146
  * This should only be called when the container is in the
146
- * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
147
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.
147
148
  *
148
149
  * This can be determined by observing {@link IFluidContainer.connectionState}.
149
150
  */
@@ -154,7 +155,7 @@ export interface IFluidContainer<TContainerSchema extends ContainerSchema = Cont
154
155
  * @remarks
155
156
  *
156
157
  * This should only be called when the container is in the
157
- * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
158
+ * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.
158
159
  *
159
160
  * This can be determined by observing {@link IFluidContainer.connectionState}.
160
161
  */
@@ -179,6 +180,8 @@ export interface IFluidContainer<TContainerSchema extends ContainerSchema = Cont
179
180
  dispose(): void;
180
181
  }
181
182
  /**
183
+ * Creates an {@link IFluidContainer} from the provided `container` and `rootDataObject`.
184
+ *
182
185
  * @internal
183
186
  */
184
187
  export declare function createFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>(props: {