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

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 (46) hide show
  1. package/.eslintrc.js +1 -1
  2. package/dist/fluidContainer.d.ts +85 -70
  3. package/dist/fluidContainer.d.ts.map +1 -1
  4. package/dist/fluidContainer.js +13 -4
  5. package/dist/fluidContainer.js.map +1 -1
  6. package/dist/index.d.ts +4 -4
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +8 -14
  9. package/dist/index.js.map +1 -1
  10. package/dist/rootDataObject.d.ts +17 -15
  11. package/dist/rootDataObject.d.ts.map +1 -1
  12. package/dist/rootDataObject.js +16 -14
  13. package/dist/rootDataObject.js.map +1 -1
  14. package/dist/serviceAudience.d.ts +27 -15
  15. package/dist/serviceAudience.d.ts.map +1 -1
  16. package/dist/serviceAudience.js +29 -13
  17. package/dist/serviceAudience.js.map +1 -1
  18. package/dist/types.d.ts +100 -70
  19. package/dist/types.d.ts.map +1 -1
  20. package/dist/types.js.map +1 -1
  21. package/lib/fluidContainer.d.ts +85 -70
  22. package/lib/fluidContainer.d.ts.map +1 -1
  23. package/lib/fluidContainer.js +13 -4
  24. package/lib/fluidContainer.js.map +1 -1
  25. package/lib/index.d.ts +4 -4
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/index.js +3 -4
  28. package/lib/index.js.map +1 -1
  29. package/lib/rootDataObject.d.ts +17 -15
  30. package/lib/rootDataObject.d.ts.map +1 -1
  31. package/lib/rootDataObject.js +16 -14
  32. package/lib/rootDataObject.js.map +1 -1
  33. package/lib/serviceAudience.d.ts +27 -15
  34. package/lib/serviceAudience.d.ts.map +1 -1
  35. package/lib/serviceAudience.js +29 -13
  36. package/lib/serviceAudience.js.map +1 -1
  37. package/lib/types.d.ts +100 -70
  38. package/lib/types.d.ts.map +1 -1
  39. package/lib/types.js.map +1 -1
  40. package/package.json +49 -25
  41. package/prettier.config.cjs +8 -0
  42. package/src/fluidContainer.ts +103 -74
  43. package/src/index.ts +19 -4
  44. package/src/rootDataObject.ts +20 -17
  45. package/src/serviceAudience.ts +36 -16
  46. package/src/types.ts +108 -71
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
+ };
@@ -5,71 +5,74 @@
5
5
  import { TypedEventEmitter } from "@fluidframework/common-utils";
6
6
  import { IFluidLoadable } from "@fluidframework/core-interfaces";
7
7
  import { IEvent, IEventProvider } from "@fluidframework/common-definitions";
8
- import { AttachState, IContainer, ConnectionState } from "@fluidframework/container-definitions";
9
- import { LoadableObjectClass, LoadableObjectRecord } from "./types";
10
- import { RootDataObject } from "./rootDataObject";
8
+ import {
9
+ AttachState,
10
+ IContainer,
11
+ ICriticalContainerError,
12
+ ConnectionState,
13
+ } from "@fluidframework/container-definitions";
14
+ import type { IRootDataObject, LoadableObjectClass, LoadableObjectRecord } from "./types";
11
15
 
12
16
  /**
13
17
  * Events emitted from {@link IFluidContainer}.
14
- *
15
- * @remarks
16
- *
17
- * The following is the list of events emitted.
18
- *
19
- * ### "connected"
20
- *
21
- * The "connected" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.
22
- *
23
- * #### Listener signature
24
- *
25
- * ```typescript
26
- * () => void;
27
- * ```
28
- *
29
- * ### "dispose"
30
- *
31
- * The "dispose" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.
32
- *
33
- * #### Listener signature
34
- *
35
- * ```typescript
36
- * () => void;
37
- * ```
38
- *
39
- * ### "disconnected"
40
- *
41
- * The "disconnected" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.
42
- *
43
- * #### Listener signature
44
- *
45
- * ```typescript
46
- * () => void;
47
- * ```
48
- *
49
- * ### "saved"
50
- *
51
- * The "saved" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.
52
- *
53
- * #### Listener signature
54
- *
55
- * ```typescript
56
- * () => void
57
- * ```
58
- *
59
- * ### "dirty"
60
- *
61
- * The "dirty" event is emitted when the `IFluidContainer` has local changes that have not yet
62
- * been acknowledged by the service.
63
- *
64
- * #### Listener signature
65
- *
66
- * ```typescript
67
- * () => void
68
- * ```
69
18
  */
19
+ /* eslint-disable @typescript-eslint/unified-signatures */
70
20
  export interface IFluidContainerEvents extends IEvent {
71
- (event: "connected" | "dispose" | "disconnected" | "saved" | "dirty", listener: () => void): void;
21
+ /**
22
+ * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.
23
+ *
24
+ * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.
25
+ *
26
+ * @see
27
+ *
28
+ * - {@link IFluidContainer.connectionState}
29
+ *
30
+ * - {@link IFluidContainer.disconnect}
31
+ */
32
+ (event: "connected", listener: () => void): void;
33
+
34
+ /**
35
+ * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.
36
+ *
37
+ * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.
38
+ *
39
+ * @see
40
+ *
41
+ * - {@link IFluidContainer.connectionState}
42
+ *
43
+ * - {@link IFluidContainer.disconnect}
44
+ */
45
+ (event: "disconnected", listener: () => void): void;
46
+
47
+ /**
48
+ * Emitted when all local changes/edits have been acknowledged by the service.
49
+ *
50
+ * @remarks "dirty" event will be emitted when the next local change has been made.
51
+ *
52
+ * @see {@link IFluidContainer.isDirty}
53
+ */
54
+ (event: "saved", listener: () => void): void;
55
+
56
+ /**
57
+ * Emitted when the first local change has been made, following a "saved" event.
58
+ *
59
+ * @remarks "saved" event will be emitted once all local changes have been acknowledged by the service.
60
+ *
61
+ * @see {@link IFluidContainer.isDirty}
62
+ */
63
+ (event: "dirty", listener: () => void): void;
64
+
65
+ /**
66
+ * Emitted when the {@link IFluidContainer} is closed, which permanently disables it.
67
+ *
68
+ * @remarks
69
+ *
70
+ * If container was closed due to error (as opposed to an explicit call to
71
+ * {@link IFluidContainer.dispose}), optional argument contains further details about the error.
72
+ */
73
+ (event: "disposed", listener: (error?: ICriticalContainerError) => void);
72
74
  }
75
+ /* eslint-enable @typescript-eslint/unified-signatures */
73
76
 
74
77
  /**
75
78
  * Provides an entrypoint into the client side of collaborative Fluid data.
@@ -83,6 +86,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
83
86
 
84
87
  /**
85
88
  * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.
89
+ *
90
+ * @remarks
91
+ *
86
92
  * You should always check the `isDirty` flag before closing the container or navigating away from the page.
87
93
  * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been
88
94
  * acknowledged by the service.
@@ -101,18 +107,23 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
101
107
  readonly isDirty: boolean;
102
108
 
103
109
  /**
104
- * Whether the container is disposed, which permanently disables it.
110
+ * Whether or not the container is disposed, which permanently disables it.
105
111
  */
106
112
  readonly disposed: boolean;
107
113
 
108
114
  /**
109
115
  * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.
110
- * These data objects and DDSes exist for the lifetime of the container.
116
+ *
117
+ * @remarks These data objects and DDSes exist for the lifetime of the container.
111
118
  */
112
119
  readonly initialObjects: LoadableObjectRecord;
113
120
 
114
121
  /**
115
- * The current attachment state of the container. Once a container has been attached, it remains attached.
122
+ * The current attachment state of the container.
123
+ *
124
+ * @remarks
125
+ *
126
+ * Once a container has been attached, it remains attached.
116
127
  * When loading an existing container, it will already be attached.
117
128
  */
118
129
  readonly attachState: AttachState;
@@ -121,7 +132,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
121
132
  * A newly created container starts detached from the collaborative service.
122
133
  * Calling `attach()` uploads the new container to the service and connects to the collaborative service.
123
134
  *
124
- * @remarks This should only be called when the container is in the
135
+ * @remarks
136
+ *
137
+ * This should only be called when the container is in the
125
138
  * {@link @fluidframework/container-definitions#AttachState.Detatched} state.
126
139
  *
127
140
  * This can be determined by observing {@link IFluidContainer.attachState}.
@@ -134,7 +147,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
134
147
  * Attempts to connect the container to the delta stream and process operations.
135
148
  * Will throw an error if unsuccessful.
136
149
  *
137
- * @remarks This should only be called when the container is in the
150
+ * @remarks
151
+ *
152
+ * This should only be called when the container is in the
138
153
  * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
139
154
  *
140
155
  * This can be determined by observing {@link IFluidContainer.connectionState}.
@@ -144,7 +159,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
144
159
  /**
145
160
  * Disconnects the container from the delta stream and stops processing operations.
146
161
  *
147
- * @remarks This should only be called when the container is in the
162
+ * @remarks
163
+ *
164
+ * This should only be called when the container is in the
148
165
  * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
149
166
  *
150
167
  * This can be determined by observing {@link IFluidContainer.connectionState}.
@@ -154,11 +171,15 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
154
171
  /**
155
172
  * Create a new data object or Distributed Data Store (DDS) of the specified type.
156
173
  *
157
- * @remarks In order to share the data object or DDS with other
174
+ * @remarks
175
+ *
176
+ * In order to share the data object or DDS with other
158
177
  * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your
159
178
  * initialObjects.
160
179
  *
161
- * @param objectClass - The class of data object or DDS to create
180
+ * @param objectClass - The class of the `DataObject` or `SharedObject` to create.
181
+ *
182
+ * @typeParam T - The class of the `DataObject` or `SharedObject`.
162
183
  */
163
184
  create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
164
185
 
@@ -171,19 +192,21 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
171
192
  /**
172
193
  * Base {@link IFluidContainer} implementation.
173
194
  *
174
- * @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
195
+ * @remarks
196
+ *
197
+ * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
175
198
  * will need to utilize or provide a service-specific implementation of this type that implements that method.
176
199
  */
177
200
  export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {
178
201
  private readonly connectedHandler = () => this.emit("connected");
179
202
  private readonly disconnectedHandler = () => this.emit("disconnected");
180
- private readonly disposedHandler = () => this.emit("disposed");
203
+ private readonly disposedHandler = (error?: ICriticalContainerError) => this.emit("disposed", error);
181
204
  private readonly savedHandler = () => this.emit("saved");
182
205
  private readonly dirtyHandler = () => this.emit("dirty");
183
206
 
184
207
  public constructor(
185
208
  private readonly container: IContainer,
186
- private readonly rootDataObject: RootDataObject,
209
+ private readonly rootDataObject: IRootDataObject,
187
210
  ) {
188
211
  super();
189
212
  container.on("connected", this.connectedHandler);
@@ -196,7 +219,7 @@ export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> imp
196
219
  /**
197
220
  * {@inheritDoc IFluidContainer.isDirty}
198
221
  */
199
- public get isDirty(): boolean {
222
+ public get isDirty(): boolean {
200
223
  return this.container.isDirty;
201
224
  }
202
225
 
@@ -217,7 +240,7 @@ export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> imp
217
240
  /**
218
241
  * {@inheritDoc IFluidContainer.connectionState}
219
242
  */
220
- public get connectionState(): ConnectionState {
243
+ public get connectionState(): ConnectionState {
221
244
  return this.container.connectionState;
222
245
  }
223
246
 
@@ -230,7 +253,10 @@ export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> imp
230
253
 
231
254
  /**
232
255
  * Incomplete base implementation of {@link IFluidContainer.attach}.
233
- * @remarks Note: this implementation will unconditionally throw.
256
+ *
257
+ * @remarks
258
+ *
259
+ * Note: this implementation will unconditionally throw.
234
260
  * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type
235
261
  * that provides an implementation of this method.
236
262
  *
@@ -238,7 +264,10 @@ export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> imp
238
264
  * but internally this separation is not there.
239
265
  */
240
266
  public async attach(): Promise<string> {
241
- throw new Error("Cannot attach container. Container is not in detached state");
267
+ if (this.container.attachState !== AttachState.Detached) {
268
+ throw new Error("Cannot attach container. Container is not in detached state.");
269
+ }
270
+ throw new Error("Cannot attach container. Attach method not provided.");
242
271
  }
243
272
 
244
273
  /**
package/src/index.ts CHANGED
@@ -9,7 +9,22 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
 
12
- export * from "./fluidContainer";
13
- export * from "./rootDataObject";
14
- export * from "./serviceAudience";
15
- export * from "./types";
12
+ export { FluidContainer, IFluidContainer, IFluidContainerEvents } from "./fluidContainer";
13
+ export { DOProviderContainerRuntimeFactory, RootDataObject, RootDataObjectProps } from "./rootDataObject";
14
+ export { ServiceAudience } from "./serviceAudience";
15
+ export {
16
+ ContainerSchema,
17
+ DataObjectClass,
18
+ IConnection,
19
+ IMember,
20
+ IRootDataObject,
21
+ IServiceAudience,
22
+ IServiceAudienceEvents,
23
+ LoadableObjectClass,
24
+ LoadableObjectClassRecord,
25
+ LoadableObjectCtor,
26
+ LoadableObjectRecord,
27
+ MemberChangedListener,
28
+ SharedObjectClass,
29
+ Myself,
30
+ } from "./types";
@@ -11,10 +11,10 @@ import {
11
11
  import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
12
12
  import { IFluidLoadable } from "@fluidframework/core-interfaces";
13
13
  import { FlushMode } from "@fluidframework/runtime-definitions";
14
- import { requestFluidObject } from "@fluidframework/runtime-utils";
15
14
  import {
16
15
  ContainerSchema,
17
16
  DataObjectClass,
17
+ IRootDataObject,
18
18
  LoadableObjectClass,
19
19
  LoadableObjectClassRecord,
20
20
  LoadableObjectRecord,
@@ -23,22 +23,22 @@ import {
23
23
  import { isDataObjectClass, isSharedObjectClass, parseDataObjectsFromSharedObjects } from "./utils";
24
24
 
25
25
  /**
26
- * Input props for {@link RootDataObject.initializingFirstTime}
26
+ * Input props for {@link RootDataObject.initializingFirstTime}.
27
27
  */
28
28
  export interface RootDataObjectProps {
29
29
  /**
30
30
  * Initial object structure with which the {@link RootDataObject} will be first-time initialized.
31
- * See {@link RootDataObject.initializingFirstTime}
31
+ *
32
+ * @see {@link RootDataObject.initializingFirstTime}
32
33
  */
33
34
  initialObjects: LoadableObjectClassRecord;
34
35
  }
35
36
 
36
37
  /**
37
- * The entry-point/root collaborative object of the Fluid Container.
38
- * This class abstracts the dynamic code required to build a Fluid Container into a static representation
39
- * for end customers.
38
+ * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.
39
+ * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.
40
40
  */
41
- export class RootDataObject extends DataObject<{ InitialState: RootDataObjectProps; }> {
41
+ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectProps; }> implements IRootDataObject {
42
42
  private readonly initialObjectsDirKey = "initial-objects-key";
43
43
  private readonly _initialObjects: LoadableObjectRecord = {};
44
44
 
@@ -54,7 +54,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
54
54
  * The first time this object is initialized, creates each object identified in
55
55
  * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.
56
56
  *
57
- * See {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}
57
+ * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}
58
58
  */
59
59
  protected async initializingFirstTime(props: RootDataObjectProps) {
60
60
  this.root.createSubDirectory(this.initialObjectsDirKey);
@@ -76,7 +76,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
76
76
  * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be
77
77
  * accessed immediately.
78
78
  *
79
- * See {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}
79
+ * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}
80
80
  */
81
81
  protected async hasInitialized() {
82
82
  // We will always load the initial objects so they are available to the developer
@@ -93,8 +93,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
93
93
  }
94
94
 
95
95
  /**
96
- * Provides a record of the initial objects defined on creation.
97
- * See {@link RootDataObject.initializingFirstTime}
96
+ * {@inheritDoc IRootDataObject.initialObjects}
98
97
  */
99
98
  public get initialObjects(): LoadableObjectRecord {
100
99
  if (Object.keys(this._initialObjects).length === 0) {
@@ -104,8 +103,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
104
103
  }
105
104
 
106
105
  /**
107
- * Dynamically creates a new detached collaborative object (DDS/DataObject).
108
- * @param objectClass - Type of the collaborative object to be created.
106
+ * {@inheritDoc IRootDataObject.create}
109
107
  */
110
108
  public async create<T extends IFluidLoadable>(
111
109
  objectClass: LoadableObjectClass<T>,
@@ -121,8 +119,9 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
121
119
  private async createDataObject<T extends IFluidLoadable>(dataObjectClass: DataObjectClass<T>): Promise<T> {
122
120
  const factory = dataObjectClass.factory;
123
121
  const packagePath = [...this.context.packagePath, factory.type];
124
- const router = await this.context.containerRuntime.createDataStore(packagePath);
125
- return requestFluidObject<T>(router, "/");
122
+ const dataStore = await this.context.containerRuntime.createDataStore(packagePath);
123
+ const entryPoint = await dataStore.entryPoint?.get();
124
+ return entryPoint as unknown as T;
126
125
  }
127
126
 
128
127
  private createSharedObject<T extends IFluidLoadable>(
@@ -137,8 +136,12 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
137
136
  const rootDataStoreId = "rootDOId";
138
137
 
139
138
  /**
140
- * Container code that provides a single {@link RootDataObject}. This data object is
141
- * dynamically customized (registry and initial objects) based on the schema provided to the container runtime factory.
139
+ * Container code that provides a single {@link RootDataObject}.
140
+ *
141
+ * @remarks
142
+ *
143
+ * This data object is dynamically customized (registry and initial objects) based on the schema provided.
144
+ * to the container runtime factory.
142
145
  */
143
146
  export class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
144
147
  private readonly rootDataObjectFactory: DataObjectFactory<RootDataObject, {
@@ -6,32 +6,42 @@
6
6
  import { TypedEventEmitter } from "@fluidframework/common-utils";
7
7
  import { IAudience, IContainer } from "@fluidframework/container-definitions";
8
8
  import { IClient } from "@fluidframework/protocol-definitions";
9
- import { IServiceAudience, IServiceAudienceEvents, IMember } from "./types";
9
+ import { IServiceAudience, IServiceAudienceEvents, IMember, Myself } from "./types";
10
10
 
11
11
  /**
12
- * Base class for providing audience information for sessions interacting with FluidContainer
12
+ * Base class for providing audience information for sessions interacting with {@link IFluidContainer}
13
+ *
14
+ * @remarks
15
+ *
13
16
  * This can be extended by different service-specific client packages to additional parameters to
14
- * the user and client details returned in IMember
15
- * @typeParam M - A service-specific member type.
17
+ * the user and client details returned in {@link IMember}.
18
+ *
19
+ * @typeParam M - A service-specific {@link IMember} implementation.
16
20
  */
17
21
  export abstract class ServiceAudience<M extends IMember = IMember>
18
22
  extends TypedEventEmitter<IServiceAudienceEvents<M>>
19
23
  implements IServiceAudience<M> {
20
24
  /**
21
- * Audience object which includes all the existing members of the container.
25
+ * Audience object which includes all the existing members of the {@link IFluidContainer | container}.
22
26
  */
23
27
  protected readonly audience: IAudience;
24
28
 
25
29
  /**
26
- * Retain the most recent member list. This is so we have more information about a member
27
- * leaving the audience in the removeMember event. It allows us to match the behavior of the
28
- * addMember event where it only fires on a change to the members this class exposes (and would
29
- * actually produce a change in what getMembers returns). It also allows us to provide the
30
- * client details in the event which makes it easier to find that client connection in a map
31
- * keyed on the userId and not clientId.
32
- * This map will always be up-to-date in a removeMember event because it is set once at
33
- * construction and in every addMember event.
34
- * It is mapped clientId to M to be better work with what the IAudience event provides
30
+ * Retain the most recent member list.
31
+ *
32
+ * @remarks
33
+ *
34
+ * This is so we have more information about a member leaving the audience in the `removeMember` event.
35
+ *
36
+ * It allows us to match the behavior of the `addMember` event where it only fires on a change to the members this
37
+ * class exposes (and would actually produce a change in what `getMembers` returns).
38
+ *
39
+ * It also allows us to provide the client details in the event which makes it easier to find that client connection
40
+ * in a map keyed on the `userId` and not `clientId`.
41
+ *
42
+ * This map will always be up-to-date in a `removeMember` event because it is set once at construction and in
43
+ * every `addMember` event. It is mapped `clientId` to `M` to be better work with what the {@link IServiceAudience}
44
+ * events provide.
35
45
  */
36
46
  protected lastMembers: Map<string, M> = new Map();
37
47
 
@@ -68,6 +78,7 @@ export abstract class ServiceAudience<M extends IMember = IMember>
68
78
 
69
79
  /**
70
80
  * Provides ability for inheriting class to modify/extend the audience object.
81
+ *
71
82
  * @param audienceMember - Record of a specific audience member.
72
83
  */
73
84
  protected abstract createServiceMember(audienceMember: IClient): M;
@@ -101,12 +112,20 @@ export abstract class ServiceAudience<M extends IMember = IMember>
101
112
  /**
102
113
  * {@inheritDoc IServiceAudience.getMyself}
103
114
  */
104
- public getMyself(): M | undefined {
115
+ public getMyself(): Myself<M> | undefined {
105
116
  const clientId = this.container.clientId;
106
117
  if (clientId === undefined) {
107
118
  return undefined;
108
119
  }
109
- return this.getMember(clientId);
120
+
121
+ const member = this.getMember(clientId);
122
+ if (member === undefined) {
123
+ return undefined;
124
+ }
125
+
126
+ const myself: Myself<M> = { ...member, currentConnection: clientId };
127
+
128
+ return myself;
110
129
  }
111
130
 
112
131
  private getMember(clientId: string): M | undefined {
@@ -127,6 +146,7 @@ export abstract class ServiceAudience<M extends IMember = IMember>
127
146
  /**
128
147
  * Provides ability for the inheriting class to include/omit specific members.
129
148
  * An example use case is omitting the summarizer client.
149
+ *
130
150
  * @param member - Member to be included/omitted.
131
151
  */
132
152
  protected shouldIncludeAsMember(member: IClient): boolean {