@fluidframework/fluid-static 2.0.0-dev-rc.1.0.0.225277 → 2.0.0-dev-rc.1.0.0.232845

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 (73) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +1 -1
  2. package/CHANGELOG.md +34 -0
  3. package/README.md +0 -6
  4. package/api-report/fluid-static.api.md +10 -7
  5. package/dist/fluid-static-alpha.d.ts +11 -4
  6. package/dist/fluid-static-beta.d.ts +11 -4
  7. package/dist/fluid-static-public.d.ts +11 -4
  8. package/dist/fluid-static-untrimmed.d.ts +26 -7
  9. package/dist/fluidContainer.d.ts +9 -6
  10. package/dist/fluidContainer.d.ts.map +1 -1
  11. package/dist/{fluidContainer.cjs → fluidContainer.js} +4 -2
  12. package/dist/fluidContainer.js.map +1 -0
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/{index.cjs → index.js} +4 -4
  16. package/dist/index.js.map +1 -0
  17. package/dist/rootDataObject.d.ts +5 -2
  18. package/dist/rootDataObject.d.ts.map +1 -1
  19. package/dist/{rootDataObject.cjs → rootDataObject.js} +16 -8
  20. package/dist/rootDataObject.js.map +1 -0
  21. package/dist/serviceAudience.d.ts +13 -6
  22. package/dist/serviceAudience.d.ts.map +1 -1
  23. package/dist/{serviceAudience.cjs → serviceAudience.js} +13 -5
  24. package/dist/serviceAudience.js.map +1 -0
  25. package/dist/tsdoc-metadata.json +1 -1
  26. package/dist/types.d.ts +8 -3
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/{types.cjs → types.js} +1 -1
  29. package/dist/types.js.map +1 -0
  30. package/dist/utils.d.ts +6 -6
  31. package/dist/utils.d.ts.map +1 -1
  32. package/dist/{utils.cjs → utils.js} +7 -4
  33. package/dist/utils.js.map +1 -0
  34. package/lib/fluid-static-alpha.d.mts +11 -4
  35. package/lib/fluid-static-beta.d.mts +11 -4
  36. package/lib/fluid-static-public.d.mts +11 -4
  37. package/lib/fluid-static-untrimmed.d.mts +26 -7
  38. package/lib/fluidContainer.d.mts +9 -6
  39. package/lib/fluidContainer.d.mts.map +1 -1
  40. package/lib/fluidContainer.mjs +3 -1
  41. package/lib/fluidContainer.mjs.map +1 -1
  42. package/lib/index.d.mts +2 -2
  43. package/lib/index.d.mts.map +1 -1
  44. package/lib/index.mjs.map +1 -1
  45. package/lib/rootDataObject.d.mts +5 -2
  46. package/lib/rootDataObject.d.mts.map +1 -1
  47. package/lib/rootDataObject.mjs +14 -6
  48. package/lib/rootDataObject.mjs.map +1 -1
  49. package/lib/serviceAudience.d.mts +13 -6
  50. package/lib/serviceAudience.d.mts.map +1 -1
  51. package/lib/serviceAudience.mjs +12 -4
  52. package/lib/serviceAudience.mjs.map +1 -1
  53. package/lib/types.d.mts +8 -3
  54. package/lib/types.d.mts.map +1 -1
  55. package/lib/types.mjs.map +1 -1
  56. package/lib/utils.d.mts +6 -6
  57. package/lib/utils.d.mts.map +1 -1
  58. package/lib/utils.mjs +6 -3
  59. package/lib/utils.mjs.map +1 -1
  60. package/package.json +29 -29
  61. package/src/fluidContainer.ts +28 -16
  62. package/src/index.ts +19 -18
  63. package/src/rootDataObject.ts +52 -29
  64. package/src/serviceAudience.ts +35 -22
  65. package/src/types.ts +16 -3
  66. package/src/utils.ts +15 -12
  67. package/dist/fluidContainer.cjs.map +0 -1
  68. package/dist/index.cjs.map +0 -1
  69. package/dist/rootDataObject.cjs.map +0 -1
  70. package/dist/serviceAudience.cjs.map +0 -1
  71. package/dist/types.cjs.map +0 -1
  72. package/dist/utils.cjs.map +0 -1
  73. package/tsc-multi.test.json +0 -4
@@ -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
  },
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @fluidframework/fluid-static
2
2
 
3
+ ## 2.0.0-rc.1.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
8
+
9
+ The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
10
+
11
+ - @fluidframework/gitresources
12
+ - @fluidframework/server-kafka-orderer
13
+ - @fluidframework/server-lambdas
14
+ - @fluidframework/server-lambdas-driver
15
+ - @fluidframework/server-local-server
16
+ - @fluidframework/server-memory-orderer
17
+ - @fluidframework/protocol-base
18
+ - @fluidframework/server-routerlicious
19
+ - @fluidframework/server-routerlicious-base
20
+ - @fluidframework/server-services
21
+ - @fluidframework/server-services-client
22
+ - @fluidframework/server-services-core
23
+ - @fluidframework/server-services-ordering-kafkanode
24
+ - @fluidframework/server-services-ordering-rdkafka
25
+ - @fluidframework/server-services-ordering-zookeeper
26
+ - @fluidframework/server-services-shared
27
+ - @fluidframework/server-services-telemetry
28
+ - @fluidframework/server-services-utils
29
+ - @fluidframework/server-test-utils
30
+ - tinylicious
31
+
32
+ - Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
33
+
34
+ The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
35
+ changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
36
+
3
37
  ## 2.0.0-internal.8.0.0
4
38
 
5
39
  ### Major Changes
package/README.md CHANGED
@@ -13,12 +13,6 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
13
13
  While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
14
14
  library consumers should always prefer `^`.
15
15
 
16
- Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
17
- you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
18
- Standard `^` and `~` ranges will not work as expected.
19
- See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
20
- package for more information including tools to convert between version schemes.
21
-
22
16
  <!-- prettier-ignore-end -->
23
17
 
24
18
  <!-- AUTO-GENERATED-CONTENT:END -->
@@ -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
23
  dynamicObjectTypes?: LoadableObjectClass<any>[];
21
24
  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;
@@ -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
  *
@@ -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
  */
@@ -360,7 +367,7 @@ export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectCl
360
367
 
361
368
  /**
362
369
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
363
- * or `SharedObject` in a {@link LoadableObjectRecord}.
370
+ * or `SharedObject`.
364
371
  * @public
365
372
  */
366
373
  export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
@@ -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
  *
@@ -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
  */
@@ -364,7 +371,7 @@ export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectCl
364
371
 
365
372
  /**
366
373
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
367
- * or `SharedObject` in a {@link LoadableObjectRecord}.
374
+ * or `SharedObject`.
368
375
  * @public
369
376
  */
370
377
  export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
@@ -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
  *
@@ -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
  */
@@ -364,7 +371,7 @@ export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectCl
364
371
 
365
372
  /**
366
373
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
367
- * or `SharedObject` in a {@link LoadableObjectRecord}.
374
+ * or `SharedObject`.
368
375
  * @public
369
376
  */
370
377
  export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
@@ -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
  *
@@ -58,6 +64,9 @@ export declare interface ContainerSchema {
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
  */
@@ -400,7 +419,7 @@ export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectCl
400
419
 
401
420
  /**
402
421
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
403
- * or `SharedObject` in a {@link LoadableObjectRecord}.
422
+ * or `SharedObject`.
404
423
  * @public
405
424
  */
406
425
  export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
@@ -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";
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: {
@@ -1 +1 @@
1
- {"version":3,"file":"fluidContainer.d.ts","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,WAAW,EACX,UAAU,EACV,uBAAuB,EACvB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EA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;;;OASG;IACH,UAAU,IAAI,IAAI,CAAC;IAEnB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAElF;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,gBAAgB,SAAS,eAAe,GAAG,eAAe,EACzD,KAAK,EAAE;IACR,SAAS,EAAE,UAAU,CAAC;IACtB,cAAc,EAAE,eAAe,CAAC;CAChC,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAEpC"}
@@ -8,6 +8,8 @@ exports.createFluidContainer = void 0;
8
8
  const client_utils_1 = require("@fluid-internal/client-utils");
9
9
  const container_definitions_1 = require("@fluidframework/container-definitions");
10
10
  /**
11
+ * Creates an {@link IFluidContainer} from the provided `container` and `rootDataObject`.
12
+ *
11
13
  * @internal
12
14
  */
13
15
  function createFluidContainer(props) {
@@ -94,7 +96,7 @@ class FluidContainer extends client_utils_1.TypedEventEmitter {
94
96
  * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,
95
97
  * but internally this separation is not there.
96
98
  */
97
- async attach() {
99
+ async attach(props) {
98
100
  if (this.container.attachState !== container_definitions_1.AttachState.Detached) {
99
101
  throw new Error("Cannot attach container. Container is not in detached state.");
100
102
  }
@@ -130,4 +132,4 @@ class FluidContainer extends client_utils_1.TypedEventEmitter {
130
132
  this.container.off("dirty", this.dirtyHandler);
131
133
  }
132
134
  }
133
- //# sourceMappingURL=fluidContainer.cjs.map
135
+ //# sourceMappingURL=fluidContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAiE;AAMjE,iFAK+C;AAoN/C;;;;GAIG;AACH,SAAgB,oBAAoB,CAElC,KAGD;IAC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CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;CAaD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\ttype IEvent,\n\ttype IEventProvider,\n\ttype IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype ICriticalContainerError,\n\ttype ConnectionState,\n} from \"@fluidframework/container-definitions\";\nimport type {\n\tContainerSchema,\n\tContainerAttachProps,\n\tIRootDataObject,\n\tLoadableObjectClass,\n} from \"./types\";\n\n/**\n * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.\n * @public\n */\nexport type InitialObjects<T extends ContainerSchema> = {\n\t// Construct a LoadableObjectRecord type by enumerating the keys of\n\t// 'ContainerSchema.initialObjects' and infering the value type of each key.\n\t//\n\t// The '? TChannel : never' is required because infer can only be used in\n\t// a conditional 'extends' expression.\n\t[K in keyof T[\"initialObjects\"]]: T[\"initialObjects\"][K] extends LoadableObjectClass<\n\t\tinfer TChannel\n\t>\n\t\t? TChannel\n\t\t: never;\n};\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks Note: external implementations of this interface are not supported.\n * @sealed\n * @public\n */\nexport interface IFluidContainerEvents extends IEvent {\n\t/**\n\t * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.connect}\n\t */\n\t(event: \"connected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.disconnect}\n\t */\n\t(event: \"disconnected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when all local changes/edits have been acknowledged by the service.\n\t *\n\t * @remarks \"dirty\" event will be emitted when the next local change has been made.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"saved\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the first local change has been made, following a \"saved\" event.\n\t *\n\t * @remarks \"saved\" event will be emitted once all local changes have been acknowledged by the service.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"dirty\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} is closed, which permanently disables it.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `error`: If the container was closed due to error (as opposed to an explicit call to\n\t * {@link IFluidContainer.dispose}), this will contain details about the error that caused it.\n\t */\n\t(event: \"disposed\", listener: (error?: ICriticalContainerError) => void);\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n *\n * @remarks Note: external implementations of this interface are not supported.\n *\n * @sealed\n * @public\n */\nexport interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends IEventProvider<IFluidContainerEvents> {\n\t/**\n\t * Provides the current connected state of the container\n\t */\n\treadonly connectionState: ConnectionState;\n\n\t/**\n\t * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n\t *\n\t * @remarks\n\t *\n\t * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n\t * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n\t * acknowledged by the service.\n\t *\n\t * A container is considered dirty in the following cases:\n\t *\n\t * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n\t * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n\t * attached, host may never know if the file was created or not.\n\t *\n\t * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n\t * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n\t * service. In some cases this can be due to lack of network connection. If the network connection is down,\n\t * it needs to be restored for the pending changes to be acknowledged.\n\t */\n\treadonly isDirty: boolean;\n\n\t/**\n\t * Whether or not the container is disposed, which permanently disables it.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n\t *\n\t * @remarks These data objects and DDSes exist for the lifetime of the container.\n\t */\n\treadonly initialObjects: InitialObjects<TContainerSchema>;\n\n\t/**\n\t * The current attachment state of the container.\n\t *\n\t * @remarks\n\t *\n\t * Once a container has been attached, it remains attached.\n\t * When loading an existing container, it will already be attached.\n\t */\n\treadonly attachState: AttachState;\n\n\t/**\n\t * A newly created container starts detached from the collaborative service.\n\t * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.attachState}.\n\t *\n\t * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n\t */\n\tattach(props?: ContainerAttachProps): Promise<string>;\n\n\t/**\n\t * Attempts to connect the container to the delta stream and process operations.\n\t *\n\t * @throws Will throw an error if connection is unsuccessful.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tconnect(): void;\n\n\t/**\n\t * Disconnects the container from the delta stream and stops processing operations.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tdisconnect(): void;\n\n\t/**\n\t * Create a new data object or Distributed Data Store (DDS) of the specified type.\n\t *\n\t * @remarks\n\t *\n\t * In order to share the data object or DDS with other\n\t * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n\t * initialObjects.\n\t *\n\t * @param objectClass - The class of the `DataObject` or `SharedObject` to create.\n\t *\n\t * @typeParam T - The class of the `DataObject` or `SharedObject`.\n\t */\n\tcreate<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n\t/**\n\t * Dispose of the container instance, permanently disabling it.\n\t */\n\tdispose(): void;\n}\n\n/**\n * Creates an {@link IFluidContainer} from the provided `container` and `rootDataObject`.\n *\n * @internal\n */\nexport function createFluidContainer<\n\tTContainerSchema extends ContainerSchema = ContainerSchema,\n>(props: {\n\tcontainer: IContainer;\n\trootDataObject: IRootDataObject;\n}): IFluidContainer<TContainerSchema> {\n\treturn new FluidContainer<TContainerSchema>(props.container, props.rootDataObject);\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n * @remarks\n *\n * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n * @deprecated use {@link createFluidContainer} and {@link IFluidContainer} instead\n * @internal\n */\nclass FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends TypedEventEmitter<IFluidContainerEvents>\n\timplements IFluidContainer<TContainerSchema>\n{\n\tprivate readonly connectedHandler = (): boolean => this.emit(\"connected\");\n\tprivate readonly disconnectedHandler = (): boolean => this.emit(\"disconnected\");\n\tprivate readonly disposedHandler = (error?: ICriticalContainerError): boolean =>\n\t\tthis.emit(\"disposed\", error);\n\tprivate readonly savedHandler = (): boolean => this.emit(\"saved\");\n\tprivate readonly dirtyHandler = (): boolean => this.emit(\"dirty\");\n\n\tpublic constructor(\n\t\tprivate readonly container: IContainer,\n\t\tprivate readonly rootDataObject: IRootDataObject,\n\t) {\n\t\tsuper();\n\t\tcontainer.on(\"connected\", this.connectedHandler);\n\t\tcontainer.on(\"closed\", this.disposedHandler);\n\t\tcontainer.on(\"disconnected\", this.disconnectedHandler);\n\t\tcontainer.on(\"saved\", this.savedHandler);\n\t\tcontainer.on(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.isDirty}\n\t */\n\tpublic get isDirty(): boolean {\n\t\treturn this.container.isDirty;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.attachState}\n\t */\n\tpublic get attachState(): AttachState {\n\t\treturn this.container.attachState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this.container.closed;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connectionState}\n\t */\n\tpublic get connectionState(): ConnectionState {\n\t\treturn this.container.connectionState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.initialObjects}\n\t */\n\tpublic get initialObjects(): InitialObjects<TContainerSchema> {\n\t\treturn this.rootDataObject.initialObjects as InitialObjects<TContainerSchema>;\n\t}\n\n\t/**\n\t * Incomplete base implementation of {@link IFluidContainer.attach}.\n\t *\n\t * @remarks\n\t *\n\t * Note: this implementation will unconditionally throw.\n\t * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n\t * that provides an implementation of this method.\n\t *\n\t * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n\t * but internally this separation is not there.\n\t */\n\tpublic async attach(props?: ContainerAttachProps): Promise<string> {\n\t\tif (this.container.attachState !== AttachState.Detached) {\n\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state.\");\n\t\t}\n\t\tthrow new Error(\"Cannot attach container. Attach method not provided.\");\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async connect(): Promise<void> {\n\t\tthis.container.connect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async disconnect(): Promise<void> {\n\t\tthis.container.disconnect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\treturn this.rootDataObject.create(objectClass);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tthis.container.close();\n\t\tthis.container.off(\"connected\", this.connectedHandler);\n\t\tthis.container.off(\"closed\", this.disposedHandler);\n\t\tthis.container.off(\"disconnected\", this.disconnectedHandler);\n\t\tthis.container.off(\"saved\", this.savedHandler);\n\t\tthis.container.off(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * FOR INTERNAL USE ONLY. NOT FOR EXTERNAL USE.\n\t * We make no stability guarantees here whatsoever.\n\t *\n\t * Gets the underlying {@link @fluidframework/container-definitions#IContainer}.\n\t *\n\t * @remarks Used to power debug tooling.\n\t */\n\tpublic readonly INTERNAL_CONTAINER_DO_NOT_USE?: () => IContainer = () => {\n\t\treturn this.container;\n\t};\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * @packageDocumentation
9
9
  */
10
- export { createFluidContainer, IFluidContainer, IFluidContainerEvents, InitialObjects, } from "./fluidContainer";
10
+ export { createFluidContainer, type IFluidContainer, type IFluidContainerEvents, type InitialObjects, } from "./fluidContainer";
11
11
  export { createDOProviderContainerRuntimeFactory } from "./rootDataObject";
12
12
  export { createServiceAudience } from "./serviceAudience";
13
- export { ContainerSchema, DataObjectClass, IConnection, IMember, IRootDataObject, IServiceAudience, IServiceAudienceEvents, LoadableObjectClass, LoadableObjectClassRecord, LoadableObjectCtor, LoadableObjectRecord, MemberChangedListener, Myself, SharedObjectClass, IProvideRootDataObject, } from "./types";
13
+ export { type ContainerSchema, type ContainerAttachProps, type DataObjectClass, type IConnection, type IMember, type IRootDataObject, type IServiceAudience, type IServiceAudienceEvents, type LoadableObjectClass, type LoadableObjectClassRecord, type LoadableObjectCtor, type LoadableObjectRecord, type MemberChangedListener, type Myself, type SharedObjectClass, type IProvideRootDataObject, } from "./types";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,cAAc,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uCAAuC,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACN,eAAe,EACf,eAAe,EACf,WAAW,EACX,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,EACN,iBAAiB,EACjB,sBAAsB,GACtB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uCAAuC,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC3B,MAAM,SAAS,CAAC"}
@@ -10,10 +10,10 @@ exports.createServiceAudience = exports.createDOProviderContainerRuntimeFactory
10
10
  *
11
11
  * @packageDocumentation
12
12
  */
13
- var fluidContainer_1 = require("./fluidContainer.cjs");
13
+ var fluidContainer_1 = require("./fluidContainer");
14
14
  Object.defineProperty(exports, "createFluidContainer", { enumerable: true, get: function () { return fluidContainer_1.createFluidContainer; } });
15
- var rootDataObject_1 = require("./rootDataObject.cjs");
15
+ var rootDataObject_1 = require("./rootDataObject");
16
16
  Object.defineProperty(exports, "createDOProviderContainerRuntimeFactory", { enumerable: true, get: function () { return rootDataObject_1.createDOProviderContainerRuntimeFactory; } });
17
- var serviceAudience_1 = require("./serviceAudience.cjs");
17
+ var serviceAudience_1 = require("./serviceAudience");
18
18
  Object.defineProperty(exports, "createServiceAudience", { enumerable: true, get: function () { return serviceAudience_1.createServiceAudience; } });
19
- //# sourceMappingURL=index.cjs.map
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,mDAK0B;AAJzB,sHAAA,oBAAoB,OAAA;AAKrB,mDAA2E;AAAlE,yIAAA,uCAAuC,OAAA;AAChD,qDAA0D;AAAjD,wHAAA,qBAAqB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Provides a simple and powerful way to consume collaborative Fluid data.\n *\n * @packageDocumentation\n */\n\nexport {\n\tcreateFluidContainer,\n\ttype IFluidContainer,\n\ttype IFluidContainerEvents,\n\ttype InitialObjects,\n} from \"./fluidContainer\";\nexport { createDOProviderContainerRuntimeFactory } from \"./rootDataObject\";\nexport { createServiceAudience } from \"./serviceAudience\";\nexport {\n\ttype ContainerSchema,\n\ttype ContainerAttachProps,\n\ttype DataObjectClass,\n\ttype IConnection,\n\ttype IMember,\n\ttype IRootDataObject,\n\ttype IServiceAudience,\n\ttype IServiceAudienceEvents,\n\ttype LoadableObjectClass,\n\ttype LoadableObjectClassRecord,\n\ttype LoadableObjectCtor,\n\ttype LoadableObjectRecord,\n\ttype MemberChangedListener,\n\ttype Myself,\n\ttype SharedObjectClass,\n\ttype IProvideRootDataObject,\n} from \"./types\";\n"]}
@@ -1,5 +1,5 @@
1
- import { IRuntimeFactory } from "@fluidframework/container-definitions";
2
- import { ContainerSchema, LoadableObjectClassRecord } from "./types";
1
+ import { type IRuntimeFactory } from "@fluidframework/container-definitions";
2
+ import { type ContainerSchema, type LoadableObjectClassRecord } from "./types";
3
3
  /**
4
4
  * Input props for {@link RootDataObject.initializingFirstTime}.
5
5
  */
@@ -12,6 +12,9 @@ export interface RootDataObjectProps {
12
12
  initialObjects: LoadableObjectClassRecord;
13
13
  }
14
14
  /**
15
+ * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single
16
+ * {@link IRootDataObject}, which is constructed from the provided schema.
17
+ *
15
18
  * @internal
16
19
  */
17
20
  export declare function createDOProviderContainerRuntimeFactory(props: {
@@ -1 +1 @@
1
- {"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,OAAO,EACN,eAAe,EAGf,yBAAyB,EAGzB,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,cAAc,EAAE,yBAAyB,CAAC;CAC1C;AA6GD;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,eAAe,CAAC;CACxB,GAAG,eAAe,CAElB"}
1
+ {"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAK7E,OAAO,EACN,KAAK,eAAe,EAGpB,KAAK,yBAAyB,EAG9B,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,cAAc,EAAE,yBAAyB,CAAC;CAC1C;AA+GD;;;;;GAKG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,eAAe,CAAC;CACxB,GAAG,eAAe,CAElB"}
@@ -8,7 +8,7 @@ exports.createDOProviderContainerRuntimeFactory = void 0;
8
8
  const aqueduct_1 = require("@fluidframework/aqueduct");
9
9
  const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
10
10
  const runtime_utils_1 = require("@fluidframework/runtime-utils");
11
- const utils_1 = require("./utils.cjs");
11
+ const utils_1 = require("./utils");
12
12
  /**
13
13
  * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.
14
14
  * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.
@@ -39,13 +39,13 @@ class RootDataObject extends aqueduct_1.DataObject {
39
39
  this.root.createSubDirectory(this.initialObjectsDirKey);
40
40
  // Create initial objects provided by the developer
41
41
  const initialObjectsP = [];
42
- Object.entries(props.initialObjects).forEach(([id, objectClass]) => {
42
+ for (const [id, objectClass] of Object.entries(props.initialObjects)) {
43
43
  const createObject = async () => {
44
44
  const obj = await this.create(objectClass);
45
45
  this.initialObjectsDir.set(id, obj.handle);
46
46
  };
47
47
  initialObjectsP.push(createObject());
48
- });
48
+ }
49
49
  await Promise.all(initialObjectsP);
50
50
  }
51
51
  /**
@@ -57,8 +57,9 @@ class RootDataObject extends aqueduct_1.DataObject {
57
57
  async hasInitialized() {
58
58
  // We will always load the initial objects so they are available to the developer
59
59
  const loadInitialObjectsP = [];
60
- for (const [key, value] of Array.from(this.initialObjectsDir.entries())) {
60
+ for (const [key, value] of this.initialObjectsDir.entries()) {
61
61
  const loadDir = async () => {
62
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
62
63
  const obj = await value.get();
63
64
  Object.assign(this._initialObjects, { [key]: obj });
64
65
  };
@@ -102,6 +103,9 @@ class RootDataObject extends aqueduct_1.DataObject {
102
103
  }
103
104
  const rootDataStoreId = "rootDOId";
104
105
  /**
106
+ * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single
107
+ * {@link IRootDataObject}, which is constructed from the provided schema.
108
+ *
105
109
  * @internal
106
110
  */
107
111
  function createDOProviderContainerRuntimeFactory(props) {
@@ -143,9 +147,13 @@ class DOProviderContainerRuntimeFactory extends aqueduct_1.BaseContainerRuntimeF
143
147
  super({
144
148
  registryEntries: [rootDataObjectFactory.registryEntry],
145
149
  requestHandlers: [getDefaultObject],
146
- // temporary workaround to disable message batching until the message batch size issue is resolved
147
- // resolution progress is tracked by the Feature 465 work item in AzDO
148
- runtimeOptions: { flushMode: runtime_definitions_1.FlushMode.Immediate },
150
+ runtimeOptions: {
151
+ // temporary workaround to disable message batching until the message batch size issue is resolved
152
+ // resolution progress is tracked by the Feature 465 work item in AzDO
153
+ flushMode: runtime_definitions_1.FlushMode.Immediate,
154
+ // The runtime compressor is required to be on to use @fluidframework/tree.
155
+ enableRuntimeIdCompressor: true,
156
+ },
149
157
  provideEntryPoint,
150
158
  });
151
159
  this.rootDataObjectFactory = rootDataObjectFactory;
@@ -161,4 +169,4 @@ class DOProviderContainerRuntimeFactory extends aqueduct_1.BaseContainerRuntimeF
161
169
  });
162
170
  }
163
171
  }
164
- //# sourceMappingURL=rootDataObject.cjs.map
172
+ //# sourceMappingURL=rootDataObject.js.map