@fluidframework/fluid-static 2.0.0-dev.1.3.0.96595 → 2.0.0-dev.1.4.6.106135

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.
@@ -1 +1 @@
1
- {"version":3,"file":"serviceAudience.js","sourceRoot":"","sources":["../src/serviceAudience.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAKjE;;;;;;;;;GASG;AACH,MAAsB,eACpB,SAAQ,gCAA4C;IA0BpD;IACE;;OAEG;IACgB,SAAqB;QAExC,KAAK,EAAE,CAAC;QAFW,cAAS,GAAT,SAAS,CAAY;QAvB1C;;;;;;;;;;;;;;;;WAgBG;QACO,gBAAW,GAAmB,IAAI,GAAG,EAAE,CAAC;QAShD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QAEnC,iFAAiF;QACjF,+EAA+E;QAC/E,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAgB,EAAE,OAAgB,EAAE,EAAE;YACnE,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE;gBACvC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBACxC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAC3C,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aAC7B;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE;YACpD,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;gBAClC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,C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ACzC,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAEO,SAAS,CAAC,QAAgB;QAChC,oEAAoE;QACpE,MAAM,sBAAsB,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,sBAAsB,KAAK,SAAS,EAAE;YACxC,OAAO,SAAS,CAAC;SAClB;QACD,2EAA2E;QAC3E,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/D,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,KAAK,CAAC,6BAA6B,QAAQ,8CAA8C,CAAC,CAAC;SAClG;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACO,qBAAqB,CAAC,MAAe;QAC7C,6BAA6B;QAC7B,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC;IACjD,CAAC;CACF;AA/HD,0CA+HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IAudience, IContainer } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { IServiceAudience, IServiceAudienceEvents, IMember } from \"./types\";\n\n/**\n * Base class for providing audience information for sessions interacting with {@link IFluidContainer}\n *\n * @remarks\n *\n * This can be extended by different service-specific client packages to additional parameters to\n * the user and client details returned in {@link IMember}.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n */\nexport abstract class ServiceAudience<M extends IMember = IMember>\n extends TypedEventEmitter<IServiceAudienceEvents<M>>\n implements IServiceAudience<M> {\n /**\n * Audience object which includes all the existing members of the {@link IFluidContainer | container}.\n */\n protected readonly audience: IAudience;\n\n /**\n * Retain the most recent member list.\n *\n * @remarks\n *\n * This is so we have more information about a member leaving the audience in the `removeMember` event.\n *\n * It allows us to match the behavior of the `addMember` event where it only fires on a change to the members this\n * class exposes (and would actually produce a change in what `getMembers` returns).\n *\n * It also allows us to provide the client details in the event which makes it easier to find that client connection\n * in a map keyed on the `userId` and not `clientId`.\n *\n * This map will always be up-to-date in a `removeMember` event because it is set once at construction and in\n * every `addMember` event. It is mapped `clientId` to `M` to be better work with what the {@link IServiceAudience}\n * events provide.\n */\n protected lastMembers: Map<string, M> = new Map();\n\n constructor(\n /**\n * Fluid Container to read the audience from.\n */\n protected readonly container: IContainer,\n ) {\n super();\n this.audience = container.audience;\n\n // getMembers will assign lastMembers so the removeMember event has what it needs\n // in case it would fire before getMembers otherwise gets called the first time\n this.getMembers();\n\n this.audience.on(\"addMember\", (clientId: string, details: IClient) => {\n if (this.shouldIncludeAsMember(details)) {\n const member = this.getMember(clientId);\n this.emit(\"memberAdded\", clientId, member);\n this.emit(\"membersChanged\");\n }\n });\n\n this.audience.on(\"removeMember\", (clientId: string) => {\n if (this.lastMembers.has(clientId)) {\n this.emit(\"memberRemoved\", clientId, this.lastMembers.get(clientId));\n this.emit(\"membersChanged\");\n }\n });\n\n this.container.on(\"connected\", () => this.emit(\"membersChanged\"));\n }\n\n /**\n * Provides ability for inheriting class to modify/extend the audience object.\n *\n * @param audienceMember - Record of a specific audience member.\n */\n protected abstract createServiceMember(audienceMember: IClient): M;\n\n /**\n * {@inheritDoc IServiceAudience.getMembers}\n */\n public getMembers(): Map<string, M> {\n const users = new Map<string, M>();\n const clientMemberMap = new Map<string, M>();\n // Iterate through the members and get the user specifics.\n this.audience.getMembers().forEach((member: IClient, clientId: string) => {\n if (this.shouldIncludeAsMember(member)) {\n const userId = member.user.id;\n // Ensure we're tracking the user\n let user = users.get(userId);\n if (user === undefined) {\n user = this.createServiceMember(member);\n users.set(userId, user);\n }\n\n // Add this connection to their collection\n user.connections.push({ id: clientId, mode: member.mode });\n clientMemberMap.set(clientId, user);\n }\n });\n this.lastMembers = clientMemberMap;\n return users;\n }\n\n /**\n * {@inheritDoc IServiceAudience.getMyself}\n */\n public getMyself(): M | undefined {\n const clientId = this.container.clientId;\n if (clientId === undefined) {\n return undefined;\n }\n return this.getMember(clientId);\n }\n\n private getMember(clientId: string): M | undefined {\n // Fetch the user ID assoicated with this client ID from the runtime\n const internalAudienceMember = this.audience.getMember(clientId);\n if (internalAudienceMember === undefined) {\n return undefined;\n }\n // Return the member object with any other clients associated for this user\n const allMembers = this.getMembers();\n const member = allMembers.get(internalAudienceMember?.user.id);\n if (member === undefined) {\n throw Error(`Attempted to fetch client ${clientId} that is not part of the current member list`);\n }\n return member;\n }\n\n /**\n * Provides ability for the inheriting class to include/omit specific members.\n * An example use case is omitting the summarizer client.\n *\n * @param member - Member to be included/omitted.\n */\n protected shouldIncludeAsMember(member: IClient): boolean {\n // Include only human members\n return member.details.capabilities.interactive;\n }\n}\n"]}
1
+ {"version":3,"file":"serviceAudience.js","sourceRoot":"","sources":["../src/serviceAudience.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAKjE;;;;;GAKG;AACH,MAAsB,eACpB,SAAQ,gCAA4C;IAoBpD;IACE;;OAEG;IACgB,SAAqB;QAExC,KAAK,EAAE,CAAC;QAFW,cAAS,GAAT,SAAS,CAAY;QAjB1C;;;;;;;;;;WAUG;QACO,gBAAW,GAAmB,IAAI,GAAG,EAAE,CAAC;QAShD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QAEnC,iFAAiF;QACjF,+EAA+E;QAC/E,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAgB,EAAE,OAAgB,EAAE,EAA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QAC7C,6BAA6B;QAC7B,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC;IACjD,CAAC;CACF;AAvHD,0CAuHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IAudience, IContainer } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { IServiceAudience, IServiceAudienceEvents, IMember } from \"./types\";\n\n/**\n * Base class for providing audience information for sessions interacting with FluidContainer\n * This can be extended by different service-specific client packages to additional parameters to\n * the user and client details returned in IMember\n * @typeParam M - A service-specific member type.\n */\nexport abstract class ServiceAudience<M extends IMember = IMember>\n extends TypedEventEmitter<IServiceAudienceEvents<M>>\n implements IServiceAudience<M> {\n /**\n * Audience object which includes all the existing members of the container.\n */\n protected readonly audience: IAudience;\n\n /**\n * Retain the most recent member list. This is so we have more information about a member\n * leaving the audience in the removeMember event. It allows us to match the behavior of the\n * addMember event where it only fires on a change to the members this class exposes (and would\n * actually produce a change in what getMembers returns). It also allows us to provide the\n * client details in the event which makes it easier to find that client connection in a map\n * keyed on the userId and not clientId.\n * This map will always be up-to-date in a removeMember event because it is set once at\n * construction and in every addMember event.\n * It is mapped clientId to M to be better work with what the IAudience event provides\n */\n protected lastMembers: Map<string, M> = new Map();\n\n constructor(\n /**\n * Fluid Container to read the audience from.\n */\n protected readonly container: IContainer,\n ) {\n super();\n this.audience = container.audience;\n\n // getMembers will assign lastMembers so the removeMember event has what it needs\n // in case it would fire before getMembers otherwise gets called the first time\n this.getMembers();\n\n this.audience.on(\"addMember\", (clientId: string, details: IClient) => {\n if (this.shouldIncludeAsMember(details)) {\n const member = this.getMember(clientId);\n this.emit(\"memberAdded\", clientId, member);\n this.emit(\"membersChanged\");\n }\n });\n\n this.audience.on(\"removeMember\", (clientId: string) => {\n if (this.lastMembers.has(clientId)) {\n this.emit(\"memberRemoved\", clientId, this.lastMembers.get(clientId));\n this.emit(\"membersChanged\");\n }\n });\n\n this.container.on(\"connected\", () => this.emit(\"membersChanged\"));\n }\n\n /**\n * Provides ability for inheriting class to modify/extend the audience object.\n * @param audienceMember - Record of a specific audience member.\n */\n protected abstract createServiceMember(audienceMember: IClient): M;\n\n /**\n * {@inheritDoc IServiceAudience.getMembers}\n */\n public getMembers(): Map<string, M> {\n const users = new Map<string, M>();\n const clientMemberMap = new Map<string, M>();\n // Iterate through the members and get the user specifics.\n this.audience.getMembers().forEach((member: IClient, clientId: string) => {\n if (this.shouldIncludeAsMember(member)) {\n const userId = member.user.id;\n // Ensure we're tracking the user\n let user = users.get(userId);\n if (user === undefined) {\n user = this.createServiceMember(member);\n users.set(userId, user);\n }\n\n // Add this connection to their collection\n user.connections.push({ id: clientId, mode: member.mode });\n clientMemberMap.set(clientId, user);\n }\n });\n this.lastMembers = clientMemberMap;\n return users;\n }\n\n /**\n * {@inheritDoc IServiceAudience.getMyself}\n */\n public getMyself(): M | undefined {\n const clientId = this.container.clientId;\n if (clientId === undefined) {\n return undefined;\n }\n return this.getMember(clientId);\n }\n\n private getMember(clientId: string): M | undefined {\n // Fetch the user ID assoicated with this client ID from the runtime\n const internalAudienceMember = this.audience.getMember(clientId);\n if (internalAudienceMember === undefined) {\n return undefined;\n }\n // Return the member object with any other clients associated for this user\n const allMembers = this.getMembers();\n const member = allMembers.get(internalAudienceMember?.user.id);\n if (member === undefined) {\n throw Error(`Attempted to fetch client ${clientId} that is not part of the current member list`);\n }\n return member;\n }\n\n /**\n * Provides ability for the inheriting class to include/omit specific members.\n * An example use case is omitting the summarizer client.\n * @param member - Member to be included/omitted.\n */\n protected shouldIncludeAsMember(member: IClient): boolean {\n // Include only human members\n return member.details.capabilities.interactive;\n }\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -7,65 +7,56 @@ import { IFluidLoadable } from "@fluidframework/core-interfaces";
7
7
  import { IChannelFactory } from "@fluidframework/datastore-definitions";
8
8
  import { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions";
9
9
  /**
10
- * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
10
+ * A mapping of string identifiers to instantiated DataObjects or SharedObjects.
11
11
  */
12
12
  export declare type LoadableObjectRecord = Record<string, IFluidLoadable>;
13
13
  /**
14
- * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
15
- * or `SharedObject` in a {@link LoadableObjectRecord}.
14
+ * A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject
15
+ * or SharedObject in a LoadableObjectRecord.
16
16
  */
17
17
  export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
18
18
  /**
19
- * A class object of `DataObject` or `SharedObject`.
20
- *
21
- * @typeParam T - The class of the `DataObject` or `SharedObject`.
19
+ * A LoadableObjectClass is an class object of DataObject or SharedObject
20
+ * @typeParam T - The class of the DataObject or SharedObject
22
21
  */
23
22
  export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
24
23
  /**
25
- * A class that has a factory that can create a `DataObject` and a
26
- * constructor that will return the type of the `DataObject`.
27
- *
28
- * @typeParam T - The class of the `DataObject`.
24
+ * A DataObjectClass is a class that has a factory that can create a DataObject and a
25
+ * constructor that will return the type of the DataObject.
26
+ * @typeParam T - The class of the DataObject
29
27
  */
30
28
  export declare type DataObjectClass<T extends IFluidLoadable> = {
31
29
  readonly factory: IFluidDataStoreFactory;
32
30
  } & LoadableObjectCtor<T>;
33
31
  /**
34
- * A class that has a factory that can create a DDSes (`SharedObject`s) and a
35
- * constructor that will return the type of the `DataObject`.
36
- *
37
- * @typeParam T - The class of the `SharedObject`.
32
+ * A SharedObjectClass is a class that has a factory that can create a DDS (SharedObject) and a
33
+ * constructor that will return the type of the DataObject.
34
+ * @typeParam T - The class of the SharedObject
38
35
  */
39
36
  export declare type SharedObjectClass<T extends IFluidLoadable> = {
40
37
  readonly getFactory: () => IChannelFactory;
41
38
  } & LoadableObjectCtor<T>;
42
39
  /**
43
- * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
44
- *
45
- * @typeParam T - The class of the loadable object.
40
+ * An object with a constructor that will return an `IFluidLoadable`.
41
+ * @typeParam T - The class of the loadable object
46
42
  */
47
43
  export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
48
44
  /**
49
- * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
50
- *
51
- * @remarks
52
- *
53
- * It includes both the instances of objects that are initially available upon `Container` creation, as well
54
- * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.
45
+ * The ContainerSchema declares the Fluid objects that will be available in the container. It includes both the
46
+ * instances of objects that are initially available upon container creation, as well as the types of objects that may
47
+ * be dynamically created throughout the lifetime of the container.
55
48
  */
56
49
  export interface ContainerSchema {
57
50
  /**
58
- * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.
59
- *
60
- * @remarks It uses the key as the id and the value as the loadable object to create.
51
+ * Defines loadable objects that will be created when the `Container` is first created.
52
+ * It uses the key as the id and the value as the loadable object to create.
61
53
  *
62
54
  * @example
63
- *
64
- * In the example below two objects will be created when the `Container` is first
55
+ * In the example below two objects will be created when the Container is first
65
56
  * created. One with id "map1" that will return a `SharedMap` and the other with
66
57
  * id "pair1" that will return a `KeyValueDataObject`.
67
58
  *
68
- * ```typescript
59
+ * ```
69
60
  * {
70
61
  * map1: SharedMap,
71
62
  * pair1: KeyValueDataObject,
@@ -74,9 +65,7 @@ export interface ContainerSchema {
74
65
  */
75
66
  initialObjects: LoadableObjectClassRecord;
76
67
  /**
77
- * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
78
- *
79
- * @remarks
68
+ * Dynamic objects are Loadable objects that can be created after the initial Container creation.
80
69
  *
81
70
  * Types defined in `initialObjects` will always be available and are not required to be provided here.
82
71
  *
@@ -85,54 +74,61 @@ export interface ContainerSchema {
85
74
  */
86
75
  dynamicObjectTypes?: LoadableObjectClass<any>[];
87
76
  }
88
- /**
89
- * Signature for {@link IMember} change events.
90
- *
91
- * @param clientId - A unique identifier for the client.
92
- * @param member - The service-specific member object for the client.
93
- *
94
- * @see See {@link IServiceAudienceEvents} for usage details.
95
- */
96
- export declare type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
97
77
  /**
98
78
  * Events that trigger when the roster of members in the Fluid session change.
79
+ * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
80
+ * {@link IServiceAudience.getMembers} method will emit events.
99
81
  *
100
82
  * @remarks
101
83
  *
102
- * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
103
- * {@link IServiceAudience.getMembers} method will emit events.
84
+ * The following is the list of events emitted.
85
+ *
86
+ * ### "membersChanged"
87
+ *
88
+ * The "membersChanged" event is emitted when a member is either added or removed.
89
+ *
90
+ * #### Listener signature
91
+ *
92
+ * ```typescript
93
+ * () => void;
94
+ * ```
95
+ *
96
+ * ### "memberAdded"
104
97
  *
105
- * @typeParam M - A service-specific {@link IMember} implementation.
98
+ * The "memberAdded" event is emitted when a member joins the audience.
99
+ *
100
+ * #### Listener signature
101
+ *
102
+ * ```typescript
103
+ * (clientId: string, member: M) => void;
104
+ * ```
105
+ * - `clientId` - A unique identifier for the client
106
+ *
107
+ * - `member` - The service-specific member object for the client
108
+ *
109
+ * ### "memberRemoved"
110
+ *
111
+ * The "memberRemoved" event is emitted when a member leaves the audience.
112
+ *
113
+ * #### Listener signature
114
+ *
115
+ * ```typescript
116
+ * (clientId: string, member: M) => void;
117
+ * ```
118
+ * - `clientId` - A unique identifier for the client
119
+ *
120
+ * - `member` - The service-specific member object for the client
121
+ * @typeParam M - A service-specific member type.
106
122
  */
107
123
  export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
108
- /**
109
- * Emitted when a {@link IMember | member}(s) are either added or removed.
110
- *
111
- * @eventProperty
112
- */
113
124
  (event: "membersChanged", listener: () => void): void;
114
- /**
115
- * Emitted when a {@link IMember | member} joins the audience.
116
- *
117
- * @eventProperty
118
- */
119
- (event: "memberAdded", listener: MemberChangedListener<M>): void;
120
- /**
121
- * Emitted when a {@link IMember | member} leaves the audience.
122
- *
123
- * @eventProperty
124
- */
125
- (event: "memberRemoved", listener: MemberChangedListener<M>): void;
125
+ (event: "memberAdded" | "memberRemoved", listener: (clientId: string, member: M) => void): void;
126
126
  }
127
127
  /**
128
- * Base interface to be implemented to fetch each service's audience.
129
- *
130
- * @remarks
131
- *
132
- * The type parameter `M` allows consumers to further extend the client object with service-specific
133
- * details about the connecting client, such as device information, environment, or a username.
134
- *
135
- * @typeParam M - A service-specific {@link IMember} type.
128
+ * Base interface to be implemented to fetch each service's audience. The generic M allows consumers to further
129
+ * extend the client object with service-specific details about the connecting client, such as device information,
130
+ * environment, or a username.
131
+ * @typeParam M - A service-specific member type.
136
132
  */
137
133
  export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
138
134
  /**
@@ -147,9 +143,8 @@ export interface IServiceAudience<M extends IMember> extends IEventProvider<ISer
147
143
  getMyself(): M | undefined;
148
144
  }
149
145
  /**
150
- * Base interface for information for each connection made to the Fluid session.
151
- *
152
- * @remarks This interface can be extended to provide additional information specific to each service.
146
+ * Base interface for information for each connection made to the Fluid session. This interface can be extended
147
+ * to provide additional information specific to each service.
153
148
  */
154
149
  export interface IConnection {
155
150
  /**
@@ -162,9 +157,8 @@ export interface IConnection {
162
157
  mode: "write" | "read";
163
158
  }
164
159
  /**
165
- * Base interface to be implemented to fetch each service's member.
166
- *
167
- * @remarks This interface can be extended by each service to provide additional service-specific user metadata.
160
+ * Base interface to be implemented to fetch each service's member. This interface can be extended by each service
161
+ * to provide additional service-specific user metadata.
168
162
  */
169
163
  export interface IMember {
170
164
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oCAAoC,CA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AG,eAAe,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC;CACnG;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAClG;;;;OAIG;IACH,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,EAAE,WAAW,EAAE,CAAC;CAC9B"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`\n * or `SharedObject` in a {@link LoadableObjectRecord}.\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;\n\n/**\n * A class object of `DataObject` or `SharedObject`.\n *\n * @typeParam T - The class of the `DataObject` or `SharedObject`.\n */\nexport type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;\n\n/**\n * A class that has a factory that can create a `DataObject` and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `DataObject`.\n */\nexport type DataObjectClass<T extends IFluidLoadable>\n = { readonly factory: IFluidDataStoreFactory; } & LoadableObjectCtor<T>;\n\n/**\n * A class that has a factory that can create a DDSes (`SharedObject`s) and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `SharedObject`.\n */\nexport type SharedObjectClass<T extends IFluidLoadable>\n = { readonly getFactory: () => IChannelFactory; } & LoadableObjectCtor<T>;\n\n/**\n * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.\n *\n * @typeParam T - The class of the loadable object.\n */\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new(...args: any[]) => T;\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the instances of objects that are initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n */\nexport interface ContainerSchema {\n /**\n * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.\n *\n * @remarks It uses the key as the id and the value as the loadable object to create.\n *\n * @example\n *\n * In the example below two objects will be created when the `Container` is first\n * created. One with id \"map1\" that will return a `SharedMap` and the other with\n * id \"pair1\" that will return a `KeyValueDataObject`.\n *\n * ```typescript\n * {\n * map1: SharedMap,\n * pair1: KeyValueDataObject,\n * }\n * ```\n */\n initialObjects: LoadableObjectClassRecord;\n\n /**\n * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.\n *\n * @remarks\n *\n * Types defined in `initialObjects` will always be available and are not required to be provided here.\n *\n * For best practice it's recommended to define all the dynamic types you create even if they are\n * included via initialObjects.\n */\n dynamicObjectTypes?: LoadableObjectClass<any>[];\n}\n\n/**\n * Signature for {@link IMember} change events.\n *\n * @param clientId - A unique identifier for the client.\n * @param member - The service-specific member object for the client.\n *\n * @see See {@link IServiceAudienceEvents} for usage details.\n */\nexport type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n *\n * @remarks\n *\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n /* eslint-disable @typescript-eslint/unified-signatures */\n /**\n * Emitted when a {@link IMember | member}(s) are either added or removed.\n *\n * @eventProperty\n */\n (event: \"membersChanged\", listener: () => void): void;\n\n /**\n * Emitted when a {@link IMember | member} joins the audience.\n *\n * @eventProperty\n */\n (event: \"memberAdded\", listener: MemberChangedListener<M>): void;\n\n /**\n * Emitted when a {@link IMember | member} leaves the audience.\n *\n * @eventProperty\n */\n (event: \"memberRemoved\", listener: MemberChangedListener<M>): void;\n /* eslint-enable @typescript-eslint/unified-signatures */\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience.\n *\n * @remarks\n *\n * The type parameter `M` allows consumers to further extend the client object with service-specific\n * details about the connecting client, such as device information, environment, or a username.\n *\n * @typeParam M - A service-specific {@link IMember} type.\n */\nexport interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {\n /**\n * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n * member object. The implementation may choose to exclude certain connections from the returned map.\n * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n */\n getMembers(): Map<string, M>;\n\n /**\n * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n */\n getMyself(): M | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session.\n *\n * @remarks This interface can be extended to provide additional information specific to each service.\n */\nexport interface IConnection {\n /**\n * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n */\n id: string;\n\n /**\n * Whether the connection is in read or read/write mode.\n */\n mode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member.\n *\n * @remarks This interface can be extended by each service to provide additional service-specific user metadata.\n */\nexport interface IMember {\n /**\n * An ID for the user, unique among each individual user connecting to the session.\n */\n userId: string;\n\n /**\n * The set of connections the user has made, e.g. from multiple tabs or devices.\n */\n connections: IConnection[];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated DataObjects or SharedObjects.\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject\n * or SharedObject in a LoadableObjectRecord.\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;\n\n/**\n * A LoadableObjectClass is an class object of DataObject or SharedObject\n * @typeParam T - The class of the DataObject or SharedObject\n */\nexport type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;\n\n/**\n * A DataObjectClass is a class that has a factory that can create a DataObject and a\n * constructor that will return the type of the DataObject.\n * @typeParam T - The class of the DataObject\n */\nexport type DataObjectClass<T extends IFluidLoadable>\n = { readonly factory: IFluidDataStoreFactory; } & LoadableObjectCtor<T>;\n\n/**\n * A SharedObjectClass is a class that has a factory that can create a DDS (SharedObject) and a\n * constructor that will return the type of the DataObject.\n * @typeParam T - The class of the SharedObject\n */\nexport type SharedObjectClass<T extends IFluidLoadable>\n = { readonly getFactory: () => IChannelFactory; } & LoadableObjectCtor<T>;\n\n/**\n * An object with a constructor that will return an `IFluidLoadable`.\n * @typeParam T - The class of the loadable object\n */\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new(...args: any[]) => T;\n\n/**\n * The ContainerSchema declares the Fluid objects that will be available in the container. It includes both the\n * instances of objects that are initially available upon container creation, as well as the types of objects that may\n * be dynamically created throughout the lifetime of the container.\n */\nexport interface ContainerSchema {\n /**\n * Defines loadable objects that will be created when the `Container` is first created.\n * It uses the key as the id and the value as the loadable object to create.\n *\n * @example\n * In the example below two objects will be created when the Container is first\n * created. One with id \"map1\" that will return a `SharedMap` and the other with\n * id \"pair1\" that will return a `KeyValueDataObject`.\n *\n * ```\n * {\n * map1: SharedMap,\n * pair1: KeyValueDataObject,\n * }\n * ```\n */\n initialObjects: LoadableObjectClassRecord;\n\n /**\n * Dynamic objects are Loadable objects that can be created after the initial Container creation.\n *\n * Types defined in `initialObjects` will always be available and are not required to be provided here.\n *\n * For best practice it's recommended to define all the dynamic types you create even if they are\n * included via initialObjects.\n */\n dynamicObjectTypes?: LoadableObjectClass<any>[];\n}\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"membersChanged\"\n *\n * The \"membersChanged\" event is emitted when a member is either added or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"memberAdded\"\n *\n * The \"memberAdded\" event is emitted when a member joins the audience.\n *\n * #### Listener signature\n *\n * ```typescript\n * (clientId: string, member: M) => void;\n * ```\n * - `clientId` - A unique identifier for the client\n *\n * - `member` - The service-specific member object for the client\n *\n * ### \"memberRemoved\"\n *\n * The \"memberRemoved\" event is emitted when a member leaves the audience.\n *\n * #### Listener signature\n *\n * ```typescript\n * (clientId: string, member: M) => void;\n * ```\n * - `clientId` - A unique identifier for the client\n *\n * - `member` - The service-specific member object for the client\n * @typeParam M - A service-specific member type.\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n (event: \"membersChanged\", listener: () => void): void;\n (event: \"memberAdded\" | \"memberRemoved\", listener: (clientId: string, member: M) => void): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience. The generic M allows consumers to further\n * extend the client object with service-specific details about the connecting client, such as device information,\n * environment, or a username.\n * @typeParam M - A service-specific member type.\n */\nexport interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {\n /**\n * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n * member object. The implementation may choose to exclude certain connections from the returned map.\n * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n */\n getMembers(): Map<string, M>;\n\n /**\n * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n */\n getMyself(): M | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session. This interface can be extended\n * to provide additional information specific to each service.\n */\nexport interface IConnection {\n /**\n * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n */\n id: string;\n\n /**\n * Whether the connection is in read or read/write mode.\n */\n mode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member. This interface can be extended by each service\n * to provide additional service-specific user metadata.\n */\nexport interface IMember {\n /**\n * An ID for the user, unique among each individual user connecting to the session.\n */\n userId: string;\n\n /**\n * The set of connections the user has made, e.g. from multiple tabs or devices.\n */\n connections: IConnection[];\n}\n"]}
@@ -10,38 +10,64 @@ import { LoadableObjectClass, LoadableObjectRecord } from "./types";
10
10
  import { RootDataObject } from "./rootDataObject";
11
11
  /**
12
12
  * Events emitted from {@link IFluidContainer}.
13
+ *
14
+ * @remarks
15
+ *
16
+ * The following is the list of events emitted.
17
+ *
18
+ * ### "connected"
19
+ *
20
+ * The "connected" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.
21
+ *
22
+ * #### Listener signature
23
+ *
24
+ * ```typescript
25
+ * () => void;
26
+ * ```
27
+ *
28
+ * ### "dispose"
29
+ *
30
+ * The "dispose" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.
31
+ *
32
+ * #### Listener signature
33
+ *
34
+ * ```typescript
35
+ * () => void;
36
+ * ```
37
+ *
38
+ * ### "disconnected"
39
+ *
40
+ * The "disconnected" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.
41
+ *
42
+ * #### Listener signature
43
+ *
44
+ * ```typescript
45
+ * () => void;
46
+ * ```
47
+ *
48
+ * ### "saved"
49
+ *
50
+ * The "saved" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.
51
+ *
52
+ * #### Listener signature
53
+ *
54
+ * ```typescript
55
+ * () => void
56
+ * ```
57
+ *
58
+ * ### "dirty"
59
+ *
60
+ * The "dirty" event is emitted when the `IFluidContainer` has local changes that have not yet
61
+ * been acknowledged by the service.
62
+ *
63
+ * #### Listener signature
64
+ *
65
+ * ```typescript
66
+ * () => void
67
+ * ```
13
68
  */
14
69
  export interface IFluidContainerEvents extends IEvent {
15
- /**
16
- * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.
17
- *
18
- * @eventProperty
19
- */
20
- (event: "connected", listener: () => void): void;
21
- /**
22
- * Emitted when the {@link IFluidContainer} is disposed, which permanently disables it.
23
- *
24
- * @eventProperty
25
- */
26
- (event: "dispose", listener: () => void): void;
27
- /**
28
- * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.
29
- *
30
- * @eventProperty
31
- */
32
- (event: "disconnected", listener: () => void): void;
33
- /**
34
- * Emitted when all of the {@link IFluidContainer}'s local changes have been acknowledged by the service.
35
- *
36
- * @eventProperty
37
- */
38
- (event: "saved", listener: () => void): void;
39
- /**
40
- * Emitted when the {@link IFluidContainer} has local changes that have not yet been acknowledged by the service.
41
- *
42
- * @eventProperty
43
- */
44
- (event: "dirty", listener: () => void): void;
70
+ (event: "connected" | "dispose" | "disconnected" | "saved" | "dirty", listener: () => void): void;
45
71
  }
46
72
  /**
47
73
  * Provides an entrypoint into the client side of collaborative Fluid data.
@@ -54,9 +80,6 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
54
80
  readonly connectionState: ConnectionState;
55
81
  /**
56
82
  * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.
57
- *
58
- * @remarks
59
- *
60
83
  * You should always check the `isDirty` flag before closing the container or navigating away from the page.
61
84
  * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been
62
85
  * acknowledged by the service.
@@ -74,21 +97,16 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
74
97
  */
75
98
  readonly isDirty: boolean;
76
99
  /**
77
- * Whether or not the container is disposed, which permanently disables it.
100
+ * Whether the container is disposed, which permanently disables it.
78
101
  */
79
102
  readonly disposed: boolean;
80
103
  /**
81
104
  * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.
82
- *
83
- * @remarks These data objects and DDSes exist for the lifetime of the container.
105
+ * These data objects and DDSes exist for the lifetime of the container.
84
106
  */
85
107
  readonly initialObjects: LoadableObjectRecord;
86
108
  /**
87
- * The current attachment state of the container.
88
- *
89
- * @remarks
90
- *
91
- * Once a container has been attached, it remains attached.
109
+ * The current attachment state of the container. Once a container has been attached, it remains attached.
92
110
  * When loading an existing container, it will already be attached.
93
111
  */
94
112
  readonly attachState: AttachState;
@@ -96,9 +114,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
96
114
  * A newly created container starts detached from the collaborative service.
97
115
  * Calling `attach()` uploads the new container to the service and connects to the collaborative service.
98
116
  *
99
- * @remarks
100
- *
101
- * This should only be called when the container is in the
117
+ * @remarks This should only be called when the container is in the
102
118
  * {@link @fluidframework/container-definitions#AttachState.Detatched} state.
103
119
  *
104
120
  * This can be determined by observing {@link IFluidContainer.attachState}.
@@ -110,9 +126,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
110
126
  * Attempts to connect the container to the delta stream and process operations.
111
127
  * Will throw an error if unsuccessful.
112
128
  *
113
- * @remarks
114
- *
115
- * This should only be called when the container is in the
129
+ * @remarks This should only be called when the container is in the
116
130
  * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
117
131
  *
118
132
  * This can be determined by observing {@link IFluidContainer.connectionState}.
@@ -121,9 +135,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
121
135
  /**
122
136
  * Disconnects the container from the delta stream and stops processing operations.
123
137
  *
124
- * @remarks
125
- *
126
- * This should only be called when the container is in the
138
+ * @remarks This should only be called when the container is in the
127
139
  * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
128
140
  *
129
141
  * This can be determined by observing {@link IFluidContainer.connectionState}.
@@ -132,15 +144,11 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
132
144
  /**
133
145
  * Create a new data object or Distributed Data Store (DDS) of the specified type.
134
146
  *
135
- * @remarks
136
- *
137
- * In order to share the data object or DDS with other
147
+ * @remarks In order to share the data object or DDS with other
138
148
  * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your
139
149
  * initialObjects.
140
150
  *
141
- * @param objectClass - The class of the `DataObject` or `SharedObject` to create.
142
- *
143
- * @typeParam T - The class of the `DataObject` or `SharedObject`.
151
+ * @param objectClass - The class of data object or DDS to create
144
152
  */
145
153
  create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
146
154
  /**
@@ -151,9 +159,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
151
159
  /**
152
160
  * Base {@link IFluidContainer} implementation.
153
161
  *
154
- * @remarks
155
- *
156
- * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
162
+ * @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
157
163
  * will need to utilize or provide a service-specific implementation of this type that implements that method.
158
164
  */
159
165
  export declare class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {
@@ -187,10 +193,7 @@ export declare class FluidContainer extends TypedEventEmitter<IFluidContainerEve
187
193
  get initialObjects(): LoadableObjectRecord;
188
194
  /**
189
195
  * Incomplete base implementation of {@link IFluidContainer.attach}.
190
- *
191
- * @remarks
192
- *
193
- * Note: this implementation will unconditionally throw.
196
+ * @remarks Note: this implementation will unconditionally throw.
194
197
  * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type
195
198
  * that provides an implementation of this method.
196
199
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fluidContainer.d.ts","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,MAAM;IAEjD;;;;OAIG;IACH,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEjD;;;;OAIG;IACF,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEhD;;;;OAIG;IACH,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEpD;;;;OAIG;IACF,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAE9C;;;;OAIG;IACH,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CA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WAAW,IAAI,WAAW,CAEpC;IAED;;OAEG;IACH,IAAW,QAAQ,YAElB;IAED;;OAEG;IACF,IAAW,eAAe,IAAI,eAAe,CAE7C;IAED;;OAEG;IACH,IAAW,cAAc,yBAExB;IAED;;;;;;;;OAQG;IACU,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;OAEG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxC;;OAEG;IACU,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAI9F;;OAEG;IACI,OAAO;CAQjB"}
@@ -6,9 +6,7 @@ import { TypedEventEmitter } from "@fluidframework/common-utils";
6
6
  /**
7
7
  * Base {@link IFluidContainer} implementation.
8
8
  *
9
- * @remarks
10
- *
11
- * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
9
+ * @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
12
10
  * will need to utilize or provide a service-specific implementation of this type that implements that method.
13
11
  */
14
12
  export class FluidContainer extends TypedEventEmitter {
@@ -59,10 +57,7 @@ export class FluidContainer extends TypedEventEmitter {
59
57
  }
60
58
  /**
61
59
  * Incomplete base implementation of {@link IFluidContainer.attach}.
62
- *
63
- * @remarks
64
- *
65
- * Note: this implementation will unconditionally throw.
60
+ * @remarks Note: this implementation will unconditionally throw.
66
61
  * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type
67
62
  * that provides an implementation of this method.
68
63
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAqKjE;;;;;;;GAOG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAA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,CAAC,eAAe,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC;IAC9C,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,MAAM;QACf,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACnF,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO;;QAChB,MAAA,MAAA,IAAI,CAAC,SAAS,EAAC,OAAO,kDAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;;QACnB,MAAA,MAAA,IAAI,CAAC,SAAS,EAAC,UAAU,kDAAI,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM,CAA2B,WAAmC;QAC7E,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACI,OAAO;QACV,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;IACnD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { AttachState, IContainer, ConnectionState } from \"@fluidframework/container-definitions\";\nimport { LoadableObjectClass, LoadableObjectRecord } from \"./types\";\nimport { RootDataObject } from \"./rootDataObject\";\n\n/**\n * Events emitted from {@link IFluidContainer}.\n */\nexport interface IFluidContainerEvents extends IEvent {\n /* eslint-disable @typescript-eslint/unified-signatures */\n /**\n * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.\n *\n * @eventProperty\n */\n (event: \"connected\", listener: () => void): void;\n\n /**\n * Emitted when the {@link IFluidContainer} is disposed, which permanently disables it.\n *\n * @eventProperty\n */\n (event: \"dispose\", listener: () => void): void;\n\n /**\n * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.\n *\n * @eventProperty\n */\n (event: \"disconnected\", listener: () => void): void;\n\n /**\n * Emitted when all of the {@link IFluidContainer}'s local changes have been acknowledged by the service.\n *\n * @eventProperty\n */\n (event: \"saved\", listener: () => void): void;\n\n /**\n * Emitted when the {@link IFluidContainer} has local changes that have not yet been acknowledged by the service.\n *\n * @eventProperty\n */\n (event: \"dirty\", listener: () => void): void;\n\n /* eslint-enable @typescript-eslint/unified-signatures */\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 */\nexport interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {\n /**\n * Provides the current connected state of the container\n */\n readonly connectionState: ConnectionState;\n\n /**\n * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n *\n * @remarks\n *\n * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n * acknowledged by the service.\n *\n * A container is considered dirty in the following cases:\n *\n * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n * attached, host may never know if the file was created or not.\n *\n * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n * service. In some cases this can be due to lack of network connection. If the network connection is down,\n * it needs to be restored for the pending changes to be acknowledged.\n */\n readonly isDirty: boolean;\n\n /**\n * Whether or not the container is disposed, which permanently disables it.\n */\n readonly disposed: boolean;\n\n /**\n * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n *\n * @remarks These data objects and DDSes exist for the lifetime of the container.\n */\n readonly initialObjects: LoadableObjectRecord;\n\n /**\n * The current attachment state of the container.\n *\n * @remarks\n *\n * Once a container has been attached, it remains attached.\n * When loading an existing container, it will already be attached.\n */\n readonly attachState: AttachState;\n\n /**\n * A newly created container starts detached from the collaborative service.\n * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n *\n * @remarks\n *\n * This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n *\n * This can be determined by observing {@link IFluidContainer.attachState}.\n *\n * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n */\n attach(): Promise<string>;\n\n /**\n * Attempts to connect the container to the delta stream and process operations.\n * Will throw an error if unsuccessful.\n *\n * @remarks\n *\n * This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n connect(): void;\n\n /**\n * Disconnects the container from the delta stream and stops processing operations.\n *\n * @remarks\n *\n * This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n disconnect(): void;\n\n /**\n * Create a new data object or Distributed Data Store (DDS) of the specified type.\n *\n * @remarks\n *\n * In order to share the data object or DDS with other\n * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n * initialObjects.\n *\n * @param objectClass - The class of the `DataObject` or `SharedObject` to create.\n *\n * @typeParam T - The class of the `DataObject` or `SharedObject`.\n */\n create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n /**\n * Dispose of the container instance, permanently disabling it.\n */\n dispose(): void;\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\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 */\nexport class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {\n private readonly connectedHandler = () => this.emit(\"connected\");\n private readonly disconnectedHandler = () => this.emit(\"disconnected\");\n private readonly disposedHandler = () => this.emit(\"disposed\");\n private readonly savedHandler = () => this.emit(\"saved\");\n private readonly dirtyHandler = () => this.emit(\"dirty\");\n\n public constructor(\n private readonly container: IContainer,\n private readonly rootDataObject: RootDataObject,\n ) {\n super();\n container.on(\"connected\", this.connectedHandler);\n container.on(\"closed\", this.disposedHandler);\n container.on(\"disconnected\", this.disconnectedHandler);\n container.on(\"saved\", this.savedHandler);\n container.on(\"dirty\", this.dirtyHandler);\n }\n\n /**\n * {@inheritDoc IFluidContainer.isDirty}\n */\n public get isDirty(): boolean {\n return this.container.isDirty;\n }\n\n /**\n * {@inheritDoc IFluidContainer.attachState}\n */\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.disposed}\n */\n public get disposed() {\n return this.container.closed;\n }\n\n /**\n * {@inheritDoc IFluidContainer.connectionState}\n */\n public get connectionState(): ConnectionState {\n return this.container.connectionState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.initialObjects}\n */\n public get initialObjects() {\n return this.rootDataObject.initialObjects;\n }\n\n /**\n * Incomplete base implementation of {@link IFluidContainer.attach}.\n *\n * @remarks\n *\n * Note: this implementation will unconditionally throw.\n * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n * that provides an implementation of this method.\n *\n * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n * but internally this separation is not there.\n */\n public async attach(): Promise<string> {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async connect(): Promise<void> {\n this.container.connect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async disconnect(): Promise<void> {\n this.container.disconnect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.create}\n */\n public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n return this.rootDataObject.create(objectClass);\n }\n\n /**\n * {@inheritDoc IFluidContainer.dispose}\n */\n public dispose() {\n this.container.close();\n this.container.off(\"connected\", this.connectedHandler);\n this.container.off(\"closed\", this.disposedHandler);\n this.container.off(\"disconnected\", this.disconnectedHandler);\n this.container.off(\"saved\", this.savedHandler);\n this.container.off(\"dirty\", this.dirtyHandler);\n }\n}\n"]}
1
+ {"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAsKjE;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAwC;IAOxE,YACqB,SAAqB,EACrB,cAA8B;QAE/C,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,mBAAc,GAAd,cAAc,CAAgB;QARlC,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,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,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;QAOrD,SAAS,CAAC,EAAE,CAAC,WAAW,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IACnD,CAAC;IAED;;OAEG;IACI,OAAO;QACV,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;IACnD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { AttachState, IContainer, ConnectionState } from \"@fluidframework/container-definitions\";\nimport { LoadableObjectClass, LoadableObjectRecord } from \"./types\";\nimport { RootDataObject } from \"./rootDataObject\";\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"connected\"\n *\n * The \"connected\" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"dispose\"\n *\n * The \"dispose\" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"disconnected\"\n *\n * The \"disconnected\" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"saved\"\n *\n * The \"saved\" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n *\n * ### \"dirty\"\n *\n * The \"dirty\" event is emitted when the `IFluidContainer` has local changes that have not yet\n * been acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n */\nexport interface IFluidContainerEvents extends IEvent {\n (event: \"connected\" | \"dispose\" | \"disconnected\" | \"saved\" | \"dirty\", listener: () => void): 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 */\nexport interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {\n /**\n * Provides the current connected state of the container\n */\n readonly connectionState: ConnectionState;\n\n /**\n * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n * acknowledged by the service.\n *\n * A container is considered dirty in the following cases:\n *\n * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n * attached, host may never know if the file was created or not.\n *\n * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n * service. In some cases this can be due to lack of network connection. If the network connection is down,\n * it needs to be restored for the pending changes to be acknowledged.\n */\n readonly isDirty: boolean;\n\n /**\n * Whether the container is disposed, which permanently disables it.\n */\n readonly disposed: boolean;\n\n /**\n * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n * These data objects and DDSes exist for the lifetime of the container.\n */\n readonly initialObjects: LoadableObjectRecord;\n\n /**\n * The current attachment state of the container. Once a container has been attached, it remains attached.\n * When loading an existing container, it will already be attached.\n */\n readonly attachState: AttachState;\n\n /**\n * A newly created container starts detached from the collaborative service.\n * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n *\n * This can be determined by observing {@link IFluidContainer.attachState}.\n *\n * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n */\n attach(): Promise<string>;\n\n /**\n * Attempts to connect the container to the delta stream and process operations.\n * Will throw an error if unsuccessful.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n connect(): void;\n\n /**\n * Disconnects the container from the delta stream and stops processing operations.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n disconnect(): void;\n\n /**\n * Create a new data object or Distributed Data Store (DDS) of the specified type.\n *\n * @remarks In order to share the data object or DDS with other\n * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n * initialObjects.\n *\n * @param objectClass - The class of data object or DDS to create\n */\n create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n /**\n * Dispose of the container instance, permanently disabling it.\n */\n dispose(): void;\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @remarks 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 */\nexport class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {\n private readonly connectedHandler = () => this.emit(\"connected\");\n private readonly disconnectedHandler = () => this.emit(\"disconnected\");\n private readonly disposedHandler = () => this.emit(\"disposed\");\n private readonly savedHandler = () => this.emit(\"saved\");\n private readonly dirtyHandler = () => this.emit(\"dirty\");\n\n public constructor(\n private readonly container: IContainer,\n private readonly rootDataObject: RootDataObject,\n ) {\n super();\n container.on(\"connected\", this.connectedHandler);\n container.on(\"closed\", this.disposedHandler);\n container.on(\"disconnected\", this.disconnectedHandler);\n container.on(\"saved\", this.savedHandler);\n container.on(\"dirty\", this.dirtyHandler);\n }\n\n /**\n * {@inheritDoc IFluidContainer.isDirty}\n */\n public get isDirty(): boolean {\n return this.container.isDirty;\n }\n\n /**\n * {@inheritDoc IFluidContainer.attachState}\n */\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.disposed}\n */\n public get disposed() {\n return this.container.closed;\n }\n\n /**\n * {@inheritDoc IFluidContainer.connectionState}\n */\n public get connectionState(): ConnectionState {\n return this.container.connectionState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.initialObjects}\n */\n public get initialObjects() {\n return this.rootDataObject.initialObjects;\n }\n\n /**\n * Incomplete base implementation of {@link IFluidContainer.attach}.\n * @remarks Note: this implementation will unconditionally throw.\n * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n * that provides an implementation of this method.\n *\n * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n * but internally this separation is not there.\n */\n public async attach(): Promise<string> {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async connect(): Promise<void> {\n this.container.connect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async disconnect(): Promise<void> {\n this.container.disconnect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.create}\n */\n public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n return this.rootDataObject.create(objectClass);\n }\n\n /**\n * {@inheritDoc IFluidContainer.dispose}\n */\n public dispose() {\n this.container.close();\n this.container.off(\"connected\", this.connectedHandler);\n this.container.off(\"closed\", this.disposedHandler);\n this.container.off(\"disconnected\", this.disconnectedHandler);\n this.container.off(\"saved\", this.savedHandler);\n this.container.off(\"dirty\", this.dirtyHandler);\n }\n}\n"]}