@fluidframework/fluid-static 2.0.0-internal.7.4.0 → 2.0.0-internal.8.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 (63) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/api-report/fluid-static.api.md +4 -43
  3. package/dist/fluid-static-alpha.d.ts +3 -12
  4. package/dist/fluid-static-beta.d.ts +0 -21
  5. package/dist/fluid-static-public.d.ts +0 -21
  6. package/dist/fluid-static-untrimmed.d.ts +4 -175
  7. package/dist/fluidContainer.cjs +1 -2
  8. package/dist/fluidContainer.cjs.map +1 -1
  9. package/dist/fluidContainer.d.ts +0 -84
  10. package/dist/fluidContainer.d.ts.map +1 -1
  11. package/dist/index.cjs +1 -4
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/rootDataObject.cjs +23 -12
  16. package/dist/rootDataObject.cjs.map +1 -1
  17. package/dist/rootDataObject.d.ts +0 -25
  18. package/dist/rootDataObject.d.ts.map +1 -1
  19. package/dist/serviceAudience.cjs +4 -11
  20. package/dist/serviceAudience.cjs.map +1 -1
  21. package/dist/serviceAudience.d.ts +2 -70
  22. package/dist/serviceAudience.d.ts.map +1 -1
  23. package/dist/types.cjs.map +1 -1
  24. package/dist/types.d.ts +4 -3
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/utils.cjs +3 -1
  27. package/dist/utils.cjs.map +1 -1
  28. package/dist/utils.d.ts +10 -2
  29. package/dist/utils.d.ts.map +1 -1
  30. package/lib/fluid-static-alpha.d.ts +3 -12
  31. package/lib/fluid-static-beta.d.ts +0 -21
  32. package/lib/fluid-static-public.d.ts +0 -21
  33. package/lib/fluid-static-untrimmed.d.ts +4 -175
  34. package/lib/fluidContainer.d.ts +0 -80
  35. package/lib/fluidContainer.d.ts.map +1 -1
  36. package/lib/fluidContainer.mjs +1 -1
  37. package/lib/fluidContainer.mjs.map +1 -1
  38. package/lib/index.d.ts +3 -3
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.mjs +3 -3
  41. package/lib/index.mjs.map +1 -1
  42. package/lib/rootDataObject.d.ts +0 -21
  43. package/lib/rootDataObject.d.ts.map +1 -1
  44. package/lib/rootDataObject.mjs +25 -15
  45. package/lib/rootDataObject.mjs.map +1 -1
  46. package/lib/serviceAudience.d.ts +2 -70
  47. package/lib/serviceAudience.d.ts.map +1 -1
  48. package/lib/serviceAudience.mjs +4 -10
  49. package/lib/serviceAudience.mjs.map +1 -1
  50. package/lib/types.d.ts +4 -3
  51. package/lib/types.d.ts.map +1 -1
  52. package/lib/types.mjs.map +1 -1
  53. package/lib/utils.d.ts +10 -2
  54. package/lib/utils.d.ts.map +1 -1
  55. package/lib/utils.mjs +3 -1
  56. package/lib/utils.mjs.map +1 -1
  57. package/package.json +32 -15
  58. package/src/fluidContainer.ts +1 -1
  59. package/src/index.ts +2 -6
  60. package/src/rootDataObject.ts +33 -18
  61. package/src/serviceAudience.ts +7 -20
  62. package/src/types.ts +2 -3
  63. package/src/utils.ts +20 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @fluidframework/fluid-static
2
2
 
3
+ ## 2.0.0-internal.8.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - azure-client: Removed deprecated FluidStatic classes [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
8
+
9
+ Several FluidStatic classes were unnecessarily exposed and were deprecated in an earlier release. They have been replaced with creation functions. This helps us
10
+ keep implementations decoupled from usage which is easier to maintain and extend. It has very minimal impact on the
11
+ public surface area of downstream packages. The removed classes are as follows:
12
+
13
+ - `AzureAudience` (use `IAzureAudience` instead)
14
+ - `TinyliciousAudience` (use `ITinyliciousAudience` instead)
15
+ - `DOProviderContainerRuntimeFactory`
16
+ - `FluidContainer`
17
+ - `ServiceAudience`
18
+
3
19
  ## 2.0.0-internal.7.4.0
4
20
 
5
21
  ### Minor Changes
@@ -5,20 +5,15 @@
5
5
  ```ts
6
6
 
7
7
  import { AttachState } from '@fluidframework/container-definitions';
8
- import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
9
8
  import { ConnectionState } from '@fluidframework/container-definitions';
10
- import { IAudience } from '@fluidframework/container-definitions';
11
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
12
10
  import { IClient } from '@fluidframework/protocol-definitions';
13
11
  import { IContainer } from '@fluidframework/container-definitions';
14
- import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
15
12
  import { ICriticalContainerError } from '@fluidframework/container-definitions';
16
13
  import { IEvent } from '@fluidframework/core-interfaces';
17
14
  import { IEventProvider } from '@fluidframework/core-interfaces';
18
- import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
19
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
20
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
21
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
22
17
 
23
18
  // @alpha
24
19
  export interface ContainerSchema {
@@ -45,32 +40,11 @@ export function createServiceAudience<M extends IMember = IMember>(props: {
45
40
 
46
41
  // @alpha
47
42
  export type DataObjectClass<T extends IFluidLoadable> = {
48
- readonly factory: IFluidDataStoreFactory;
43
+ readonly factory: {
44
+ IFluidDataStoreFactory: DataObjectClass<T>["factory"];
45
+ };
49
46
  } & LoadableObjectCtor<T>;
50
47
 
51
- // @internal @deprecated
52
- export class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
53
- constructor(schema: ContainerSchema);
54
- // (undocumented)
55
- protected containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void>;
56
- }
57
-
58
- // @internal @deprecated
59
- export class FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer<TContainerSchema> {
60
- constructor(container: IContainer, rootDataObject: IRootDataObject);
61
- attach(): Promise<string>;
62
- get attachState(): AttachState;
63
- connect(): Promise<void>;
64
- get connectionState(): ConnectionState;
65
- create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
66
- disconnect(): Promise<void>;
67
- dispose(): void;
68
- get disposed(): boolean;
69
- get initialObjects(): InitialObjects<TContainerSchema>;
70
- readonly INTERNAL_CONTAINER_DO_NOT_USE?: () => IContainer;
71
- get isDirty(): boolean;
72
- }
73
-
74
48
  // @alpha
75
49
  export interface IConnection {
76
50
  id: string;
@@ -114,7 +88,7 @@ export type InitialObjects<T extends ContainerSchema> = {
114
88
  // @internal (undocumented)
115
89
  export interface IProvideRootDataObject {
116
90
  // (undocumented)
117
- readonly IRootDataObject?: IRootDataObject;
91
+ readonly IRootDataObject: IRootDataObject;
118
92
  }
119
93
 
120
94
  // @internal
@@ -159,19 +133,6 @@ export type Myself<M extends IMember = IMember> = M & {
159
133
  currentConnection: string;
160
134
  };
161
135
 
162
- // @internal @deprecated
163
- export abstract class ServiceAudience<M extends IMember = IMember> extends TypedEventEmitter<IServiceAudienceEvents<M>> implements IServiceAudience<M> {
164
- constructor(
165
- container: IContainer);
166
- protected readonly audience: IAudience;
167
- protected readonly container: IContainer;
168
- protected abstract createServiceMember(audienceMember: IClient): M;
169
- getMembers(): Map<string, M>;
170
- getMyself(): Myself<M> | undefined;
171
- protected lastMembers: Map<string, M>;
172
- protected shouldIncludeAsMember(member: IClient): boolean;
173
- }
174
-
175
136
  // @alpha
176
137
  export type SharedObjectClass<T extends IFluidLoadable> = {
177
138
  readonly getFactory: () => IChannelFactory;
@@ -5,20 +5,15 @@
5
5
  */
6
6
 
7
7
  import { AttachState } from '@fluidframework/container-definitions';
8
- import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
9
8
  import { ConnectionState } from '@fluidframework/container-definitions';
10
- import { IAudience } from '@fluidframework/container-definitions';
11
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
12
10
  import { IClient } from '@fluidframework/protocol-definitions';
13
11
  import { IContainer } from '@fluidframework/container-definitions';
14
- import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
15
12
  import { ICriticalContainerError } from '@fluidframework/container-definitions';
16
13
  import { IEvent } from '@fluidframework/core-interfaces';
17
14
  import { IEventProvider } from '@fluidframework/core-interfaces';
18
- import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
19
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
20
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
21
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
22
17
 
23
18
  /**
24
19
  * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
@@ -76,13 +71,11 @@ export declare interface ContainerSchema {
76
71
  * @alpha
77
72
  */
78
73
  export declare type DataObjectClass<T extends IFluidLoadable> = {
79
- readonly factory: IFluidDataStoreFactory;
74
+ readonly factory: {
75
+ IFluidDataStoreFactory: DataObjectClass<T>["factory"];
76
+ };
80
77
  } & LoadableObjectCtor<T>;
81
78
 
82
- /* Excluded from this release type: DOProviderContainerRuntimeFactory */
83
-
84
- /* Excluded from this release type: FluidContainer */
85
-
86
79
  /**
87
80
  * Base interface for information for each connection made to the Fluid session.
88
81
  *
@@ -401,8 +394,6 @@ export declare type Myself<M extends IMember = IMember> = M & {
401
394
  currentConnection: string;
402
395
  };
403
396
 
404
- /* Excluded from this release type: ServiceAudience */
405
-
406
397
  /**
407
398
  * A class that has a factory that can create a DDSes (`SharedObject`s) and a
408
399
  * constructor that will return the type of the `DataObject`.
@@ -5,25 +5,18 @@
5
5
  */
6
6
 
7
7
  import { AttachState } from '@fluidframework/container-definitions';
8
- import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
9
8
  import { ConnectionState } from '@fluidframework/container-definitions';
10
- import { IAudience } from '@fluidframework/container-definitions';
11
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
12
10
  import { IClient } from '@fluidframework/protocol-definitions';
13
11
  import { IContainer } from '@fluidframework/container-definitions';
14
- import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
15
12
  import { ICriticalContainerError } from '@fluidframework/container-definitions';
16
13
  import { IEvent } from '@fluidframework/core-interfaces';
17
14
  import { IEventProvider } from '@fluidframework/core-interfaces';
18
- import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
19
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
20
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
21
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
22
17
 
23
18
  /* Excluded from this release type: AttachState */
24
19
 
25
- /* Excluded from this release type: BaseContainerRuntimeFactory */
26
-
27
20
  /* Excluded from this release type: ConnectionState */
28
21
 
29
22
  /* Excluded from this release type: ContainerSchema */
@@ -36,20 +29,12 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
36
29
 
37
30
  /* Excluded from this release type: DataObjectClass */
38
31
 
39
- /* Excluded from this release type: DOProviderContainerRuntimeFactory */
40
-
41
- /* Excluded from this release type: FluidContainer */
42
-
43
- /* Excluded from this release type: IAudience */
44
-
45
32
  /* Excluded from this release type: IChannelFactory */
46
33
 
47
34
  /* Excluded from this release type: IConnection */
48
35
 
49
36
  /* Excluded from this release type: IContainer */
50
37
 
51
- /* Excluded from this release type: IContainerRuntime */
52
-
53
38
  /* Excluded from this release type: ICriticalContainerError */
54
39
 
55
40
  /* Excluded from this release type: IEvent */
@@ -60,8 +45,6 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
60
45
 
61
46
  /* Excluded from this release type: IFluidContainerEvents */
62
47
 
63
- /* Excluded from this release type: IFluidDataStoreFactory */
64
-
65
48
  /* Excluded from this release type: IFluidLoadable */
66
49
 
67
50
  /* Excluded from this release type: IMember */
@@ -90,10 +73,6 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
90
73
 
91
74
  /* Excluded from this release type: Myself */
92
75
 
93
- /* Excluded from this release type: ServiceAudience */
94
-
95
76
  /* Excluded from this release type: SharedObjectClass */
96
77
 
97
- /* Excluded from this release type: TypedEventEmitter */
98
-
99
78
  export { }
@@ -5,25 +5,18 @@
5
5
  */
6
6
 
7
7
  import { AttachState } from '@fluidframework/container-definitions';
8
- import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
9
8
  import { ConnectionState } from '@fluidframework/container-definitions';
10
- import { IAudience } from '@fluidframework/container-definitions';
11
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
12
10
  import { IClient } from '@fluidframework/protocol-definitions';
13
11
  import { IContainer } from '@fluidframework/container-definitions';
14
- import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
15
12
  import { ICriticalContainerError } from '@fluidframework/container-definitions';
16
13
  import { IEvent } from '@fluidframework/core-interfaces';
17
14
  import { IEventProvider } from '@fluidframework/core-interfaces';
18
- import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
19
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
20
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
21
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
22
17
 
23
18
  /* Excluded from this release type: AttachState */
24
19
 
25
- /* Excluded from this release type: BaseContainerRuntimeFactory */
26
-
27
20
  /* Excluded from this release type: ConnectionState */
28
21
 
29
22
  /* Excluded from this release type: ContainerSchema */
@@ -36,20 +29,12 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
36
29
 
37
30
  /* Excluded from this release type: DataObjectClass */
38
31
 
39
- /* Excluded from this release type: DOProviderContainerRuntimeFactory */
40
-
41
- /* Excluded from this release type: FluidContainer */
42
-
43
- /* Excluded from this release type: IAudience */
44
-
45
32
  /* Excluded from this release type: IChannelFactory */
46
33
 
47
34
  /* Excluded from this release type: IConnection */
48
35
 
49
36
  /* Excluded from this release type: IContainer */
50
37
 
51
- /* Excluded from this release type: IContainerRuntime */
52
-
53
38
  /* Excluded from this release type: ICriticalContainerError */
54
39
 
55
40
  /* Excluded from this release type: IEvent */
@@ -60,8 +45,6 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
60
45
 
61
46
  /* Excluded from this release type: IFluidContainerEvents */
62
47
 
63
- /* Excluded from this release type: IFluidDataStoreFactory */
64
-
65
48
  /* Excluded from this release type: IFluidLoadable */
66
49
 
67
50
  /* Excluded from this release type: IMember */
@@ -90,10 +73,6 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
90
73
 
91
74
  /* Excluded from this release type: Myself */
92
75
 
93
- /* Excluded from this release type: ServiceAudience */
94
-
95
76
  /* Excluded from this release type: SharedObjectClass */
96
77
 
97
- /* Excluded from this release type: TypedEventEmitter */
98
-
99
78
  export { }
@@ -5,20 +5,15 @@
5
5
  */
6
6
 
7
7
  import { AttachState } from '@fluidframework/container-definitions';
8
- import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
9
8
  import { ConnectionState } from '@fluidframework/container-definitions';
10
- import { IAudience } from '@fluidframework/container-definitions';
11
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
12
10
  import { IClient } from '@fluidframework/protocol-definitions';
13
11
  import { IContainer } from '@fluidframework/container-definitions';
14
- import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
15
12
  import { ICriticalContainerError } from '@fluidframework/container-definitions';
16
13
  import { IEvent } from '@fluidframework/core-interfaces';
17
14
  import { IEventProvider } from '@fluidframework/core-interfaces';
18
- import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
19
15
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
20
16
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
21
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
22
17
 
23
18
  /**
24
19
  * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
@@ -93,109 +88,11 @@ export declare function createServiceAudience<M extends IMember = IMember>(props
93
88
  * @alpha
94
89
  */
95
90
  export declare type DataObjectClass<T extends IFluidLoadable> = {
96
- readonly factory: IFluidDataStoreFactory;
91
+ readonly factory: {
92
+ IFluidDataStoreFactory: DataObjectClass<T>["factory"];
93
+ };
97
94
  } & LoadableObjectCtor<T>;
98
95
 
99
- /**
100
- * Container code that provides a single {@link IRootDataObject}.
101
- *
102
- * @remarks
103
- *
104
- * This data object is dynamically customized (registry and initial objects) based on the schema provided.
105
- * to the container runtime factory.
106
- * @deprecated use {@link createDOProviderContainerRuntimeFactory} instead
107
- * @internal
108
- */
109
- export declare class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
110
- private readonly rootDataObjectFactory;
111
- private readonly initialObjects;
112
- constructor(schema: ContainerSchema);
113
- /**
114
- * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}
115
- */
116
- protected containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void>;
117
- }
118
-
119
- /**
120
- * Base {@link IFluidContainer} implementation.
121
- *
122
- * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
123
- * @remarks
124
- *
125
- * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
126
- * will need to utilize or provide a service-specific implementation of this type that implements that method.
127
- * @deprecated use {@link createFluidContainer} and {@link IFluidContainer} instead
128
- * @internal
129
- */
130
- export declare class FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer<TContainerSchema> {
131
- private readonly container;
132
- private readonly rootDataObject;
133
- private readonly connectedHandler;
134
- private readonly disconnectedHandler;
135
- private readonly disposedHandler;
136
- private readonly savedHandler;
137
- private readonly dirtyHandler;
138
- constructor(container: IContainer, rootDataObject: IRootDataObject);
139
- /**
140
- * {@inheritDoc IFluidContainer.isDirty}
141
- */
142
- get isDirty(): boolean;
143
- /**
144
- * {@inheritDoc IFluidContainer.attachState}
145
- */
146
- get attachState(): AttachState;
147
- /**
148
- * {@inheritDoc IFluidContainer.disposed}
149
- */
150
- get disposed(): boolean;
151
- /**
152
- * {@inheritDoc IFluidContainer.connectionState}
153
- */
154
- get connectionState(): ConnectionState;
155
- /**
156
- * {@inheritDoc IFluidContainer.initialObjects}
157
- */
158
- get initialObjects(): InitialObjects<TContainerSchema>;
159
- /**
160
- * Incomplete base implementation of {@link IFluidContainer.attach}.
161
- *
162
- * @remarks
163
- *
164
- * Note: this implementation will unconditionally throw.
165
- * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type
166
- * that provides an implementation of this method.
167
- *
168
- * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,
169
- * but internally this separation is not there.
170
- */
171
- attach(): Promise<string>;
172
- /**
173
- * {@inheritDoc IFluidContainer.connect}
174
- */
175
- connect(): Promise<void>;
176
- /**
177
- * {@inheritDoc IFluidContainer.connect}
178
- */
179
- disconnect(): Promise<void>;
180
- /**
181
- * {@inheritDoc IFluidContainer.create}
182
- */
183
- create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
184
- /**
185
- * {@inheritDoc IFluidContainer.dispose}
186
- */
187
- dispose(): void;
188
- /**
189
- * FOR INTERNAL USE ONLY. NOT FOR EXTERNAL USE.
190
- * We make no stability guarantees here whatsoever.
191
- *
192
- * Gets the underlying {@link @fluidframework/container-definitions#IContainer}.
193
- *
194
- * @remarks Used to power debug tooling.
195
- */
196
- readonly INTERNAL_CONTAINER_DO_NOT_USE?: () => IContainer;
197
- }
198
-
199
96
  /**
200
97
  * Base interface for information for each connection made to the Fluid session.
201
98
  *
@@ -410,7 +307,7 @@ export declare type InitialObjects<T extends ContainerSchema> = {
410
307
  * @internal
411
308
  */
412
309
  export declare interface IProvideRootDataObject {
413
- readonly IRootDataObject?: IRootDataObject;
310
+ readonly IRootDataObject: IRootDataObject;
414
311
  }
415
312
 
416
313
  /**
@@ -537,74 +434,6 @@ export declare type Myself<M extends IMember = IMember> = M & {
537
434
  currentConnection: string;
538
435
  };
539
436
 
540
- /**
541
- * Base class for providing audience information for sessions interacting with {@link IFluidContainer}
542
- *
543
- * @remarks
544
- *
545
- * This can be extended by different service-specific client packages to additional parameters to
546
- * the user and client details returned in {@link IMember}.
547
- *
548
- * @typeParam M - A service-specific {@link IMember} implementation.
549
- * @deprecated use {@link createServiceAudience} and {@link IServiceAudience} instead
550
- * @internal
551
- */
552
- export declare abstract class ServiceAudience<M extends IMember = IMember> extends TypedEventEmitter<IServiceAudienceEvents<M>> implements IServiceAudience<M> {
553
- /**
554
- * Fluid Container to read the audience from.
555
- */
556
- protected readonly container: IContainer;
557
- /**
558
- * Audience object which includes all the existing members of the {@link IFluidContainer | container}.
559
- */
560
- protected readonly audience: IAudience;
561
- /**
562
- * Retain the most recent member list.
563
- *
564
- * @remarks
565
- *
566
- * This is so we have more information about a member leaving the audience in the `removeMember` event.
567
- *
568
- * It allows us to match the behavior of the `addMember` event where it only fires on a change to the members this
569
- * class exposes (and would actually produce a change in what `getMembers` returns).
570
- *
571
- * It also allows us to provide the client details in the event which makes it easier to find that client connection
572
- * in a map keyed on the `userId` and not `clientId`.
573
- *
574
- * This map will always be up-to-date in a `removeMember` event because it is set once at construction and in
575
- * every `addMember` event. It is mapped `clientId` to `M` to be better work with what the {@link IServiceAudience}
576
- * events provide.
577
- */
578
- protected lastMembers: Map<string, M>;
579
- constructor(
580
- /**
581
- * Fluid Container to read the audience from.
582
- */
583
- container: IContainer);
584
- /**
585
- * Provides ability for inheriting class to modify/extend the audience object.
586
- *
587
- * @param audienceMember - Record of a specific audience member.
588
- */
589
- protected abstract createServiceMember(audienceMember: IClient): M;
590
- /**
591
- * {@inheritDoc IServiceAudience.getMembers}
592
- */
593
- getMembers(): Map<string, M>;
594
- /**
595
- * {@inheritDoc IServiceAudience.getMyself}
596
- */
597
- getMyself(): Myself<M> | undefined;
598
- private getMember;
599
- /**
600
- * Provides ability for the inheriting class to include/omit specific members.
601
- * An example use case is omitting the summarizer client.
602
- *
603
- * @param member - Member to be included/omitted.
604
- */
605
- protected shouldIncludeAsMember(member: IClient): boolean;
606
- }
607
-
608
437
  /**
609
438
  * A class that has a factory that can create a DDSes (`SharedObject`s) and a
610
439
  * constructor that will return the type of the `DataObject`.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FluidContainer = exports.createFluidContainer = void 0;
3
+ exports.createFluidContainer = void 0;
4
4
  /*!
5
5
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
6
6
  * Licensed under the MIT License.
@@ -130,5 +130,4 @@ class FluidContainer extends client_utils_1.TypedEventEmitter {
130
130
  this.container.off("dirty", this.dirtyHandler);
131
131
  }
132
132
  }
133
- exports.FluidContainer = FluidContainer;
134
133
  //# sourceMappingURL=fluidContainer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fluidContainer.cjs","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAiE;AAEjE,iFAK+C;AA0M/C;;GAEG;AACH,SAAgB,oBAAoB,CAElC,KAGD;IACA,OAAO,IAAI,cAAc,CAAmB,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;AACpF,CAAC;AAPD,oDAOC;AAED;;;;;;;;;;GAUG;AACH,MAAa,cACZ,SAAQ,gCAAwC;IAUhD,YACkB,SAAqB,EACrB,cAA+B;QAEhD,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,mBAAc,GAAd,cAAc,CAAiB;QAThC,qBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChD,wBAAmB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACtD,oBAAe,GAAG,CAAC,KAA+B,EAAE,EAAE,CACtE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACb,iBAAY,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,iBAAY,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC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C,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;QACtB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM,CAA2B,WAAmC;QAChF,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,OAAO;QACb,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,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;AAzHD,wCAyHC","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 { IEvent, IEventProvider, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport {\n\tAttachState,\n\tIContainer,\n\tICriticalContainerError,\n\tConnectionState,\n} from \"@fluidframework/container-definitions\";\nimport type { ContainerSchema, IRootDataObject, LoadableObjectClass } from \"./types\";\n\n/**\n * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.\n * @alpha\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 * @alpha\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 * @alpha\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(): 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.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.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 * @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 */\nexport class FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends TypedEventEmitter<IFluidContainerEvents>\n\timplements IFluidContainer<TContainerSchema>\n{\n\tprivate readonly connectedHandler = () => this.emit(\"connected\");\n\tprivate readonly disconnectedHandler = () => this.emit(\"disconnected\");\n\tprivate readonly disposedHandler = (error?: ICriticalContainerError) =>\n\t\tthis.emit(\"disposed\", error);\n\tprivate readonly savedHandler = () => this.emit(\"saved\");\n\tprivate readonly dirtyHandler = () => 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() {\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(): 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() {\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"]}
1
+ {"version":3,"file":"fluidContainer.cjs","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":";;;AAA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QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,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 { IEvent, IEventProvider, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport {\n\tAttachState,\n\tIContainer,\n\tICriticalContainerError,\n\tConnectionState,\n} from \"@fluidframework/container-definitions\";\nimport type { ContainerSchema, IRootDataObject, LoadableObjectClass } from \"./types\";\n\n/**\n * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.\n * @alpha\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 * @alpha\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 * @alpha\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(): 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.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.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 * @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 = () => this.emit(\"connected\");\n\tprivate readonly disconnectedHandler = () => this.emit(\"disconnected\");\n\tprivate readonly disposedHandler = (error?: ICriticalContainerError) =>\n\t\tthis.emit(\"disposed\", error);\n\tprivate readonly savedHandler = () => this.emit(\"saved\");\n\tprivate readonly dirtyHandler = () => 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() {\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(): 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() {\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"]}