@fluidframework/presence 2.32.0 → 2.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +24 -24
  2. package/dist/alpha.d.ts +29 -25
  3. package/dist/baseTypes.d.ts +3 -3
  4. package/dist/baseTypes.js.map +1 -1
  5. package/dist/broadcastControls.d.ts +1 -1
  6. package/dist/broadcastControls.js.map +1 -1
  7. package/dist/datastorePresenceManagerFactory.d.ts +5 -5
  8. package/dist/datastorePresenceManagerFactory.d.ts.map +1 -1
  9. package/dist/datastorePresenceManagerFactory.js +6 -6
  10. package/dist/datastorePresenceManagerFactory.js.map +1 -1
  11. package/dist/experimentalAccess.d.ts +4 -4
  12. package/dist/experimentalAccess.d.ts.map +1 -1
  13. package/dist/experimentalAccess.js +6 -6
  14. package/dist/experimentalAccess.js.map +1 -1
  15. package/dist/exposedInternalTypes.d.ts +1 -1
  16. package/dist/exposedInternalTypes.js.map +1 -1
  17. package/dist/exposedUtilityTypes.d.ts +0 -8
  18. package/dist/exposedUtilityTypes.d.ts.map +1 -1
  19. package/dist/exposedUtilityTypes.js.map +1 -1
  20. package/dist/index.d.ts +8 -7
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +6 -8
  23. package/dist/index.js.map +1 -1
  24. package/dist/internalTypes.d.ts +3 -3
  25. package/dist/internalTypes.d.ts.map +1 -1
  26. package/dist/internalTypes.js.map +1 -1
  27. package/dist/internalUtils.d.ts +5 -0
  28. package/dist/internalUtils.d.ts.map +1 -1
  29. package/dist/internalUtils.js +8 -1
  30. package/dist/internalUtils.js.map +1 -1
  31. package/dist/latestMapValueManager.d.ts +57 -39
  32. package/dist/latestMapValueManager.d.ts.map +1 -1
  33. package/dist/latestMapValueManager.js +48 -39
  34. package/dist/latestMapValueManager.js.map +1 -1
  35. package/dist/latestValueManager.d.ts +38 -20
  36. package/dist/latestValueManager.d.ts.map +1 -1
  37. package/dist/latestValueManager.js +32 -28
  38. package/dist/latestValueManager.js.map +1 -1
  39. package/dist/latestValueTypes.d.ts +9 -10
  40. package/dist/latestValueTypes.d.ts.map +1 -1
  41. package/dist/latestValueTypes.js.map +1 -1
  42. package/dist/notificationsManager.d.ts +15 -10
  43. package/dist/notificationsManager.d.ts.map +1 -1
  44. package/dist/notificationsManager.js +8 -5
  45. package/dist/notificationsManager.js.map +1 -1
  46. package/dist/presence.d.ts +82 -66
  47. package/dist/presence.d.ts.map +1 -1
  48. package/dist/presence.js +5 -5
  49. package/dist/presence.js.map +1 -1
  50. package/dist/presenceDatastoreManager.d.ts +12 -10
  51. package/dist/presenceDatastoreManager.d.ts.map +1 -1
  52. package/dist/presenceDatastoreManager.js +10 -8
  53. package/dist/presenceDatastoreManager.js.map +1 -1
  54. package/dist/presenceManager.d.ts +2 -2
  55. package/dist/presenceManager.d.ts.map +1 -1
  56. package/dist/presenceManager.js +14 -22
  57. package/dist/presenceManager.js.map +1 -1
  58. package/dist/presenceStates.d.ts +14 -13
  59. package/dist/presenceStates.d.ts.map +1 -1
  60. package/dist/presenceStates.js +22 -15
  61. package/dist/presenceStates.js.map +1 -1
  62. package/dist/stateDatastore.d.ts +5 -4
  63. package/dist/stateDatastore.d.ts.map +1 -1
  64. package/dist/stateDatastore.js.map +1 -1
  65. package/dist/stateFactory.d.ts +22 -0
  66. package/dist/stateFactory.d.ts.map +1 -0
  67. package/dist/stateFactory.js +25 -0
  68. package/dist/stateFactory.js.map +1 -0
  69. package/dist/systemWorkspace.d.ts +7 -7
  70. package/dist/systemWorkspace.d.ts.map +1 -1
  71. package/dist/systemWorkspace.js +23 -23
  72. package/dist/systemWorkspace.js.map +1 -1
  73. package/dist/types.d.ts +50 -33
  74. package/dist/types.d.ts.map +1 -1
  75. package/dist/types.js +0 -1
  76. package/dist/types.js.map +1 -1
  77. package/lib/alpha.d.ts +29 -25
  78. package/lib/baseTypes.d.ts +3 -3
  79. package/lib/baseTypes.js.map +1 -1
  80. package/lib/broadcastControls.d.ts +1 -1
  81. package/lib/broadcastControls.js.map +1 -1
  82. package/lib/datastorePresenceManagerFactory.d.ts +5 -5
  83. package/lib/datastorePresenceManagerFactory.d.ts.map +1 -1
  84. package/lib/datastorePresenceManagerFactory.js +4 -4
  85. package/lib/datastorePresenceManagerFactory.js.map +1 -1
  86. package/lib/experimentalAccess.d.ts +4 -4
  87. package/lib/experimentalAccess.d.ts.map +1 -1
  88. package/lib/experimentalAccess.js +4 -4
  89. package/lib/experimentalAccess.js.map +1 -1
  90. package/lib/exposedInternalTypes.d.ts +1 -1
  91. package/lib/exposedInternalTypes.js.map +1 -1
  92. package/lib/exposedUtilityTypes.d.ts +0 -8
  93. package/lib/exposedUtilityTypes.d.ts.map +1 -1
  94. package/lib/exposedUtilityTypes.js.map +1 -1
  95. package/lib/index.d.ts +8 -7
  96. package/lib/index.d.ts.map +1 -1
  97. package/lib/index.js +4 -5
  98. package/lib/index.js.map +1 -1
  99. package/lib/internalTypes.d.ts +3 -3
  100. package/lib/internalTypes.d.ts.map +1 -1
  101. package/lib/internalTypes.js.map +1 -1
  102. package/lib/internalUtils.d.ts +5 -0
  103. package/lib/internalUtils.d.ts.map +1 -1
  104. package/lib/internalUtils.js +6 -0
  105. package/lib/internalUtils.js.map +1 -1
  106. package/lib/latestMapValueManager.d.ts +57 -39
  107. package/lib/latestMapValueManager.d.ts.map +1 -1
  108. package/lib/latestMapValueManager.js +47 -38
  109. package/lib/latestMapValueManager.js.map +1 -1
  110. package/lib/latestValueManager.d.ts +38 -20
  111. package/lib/latestValueManager.d.ts.map +1 -1
  112. package/lib/latestValueManager.js +31 -27
  113. package/lib/latestValueManager.js.map +1 -1
  114. package/lib/latestValueTypes.d.ts +9 -10
  115. package/lib/latestValueTypes.d.ts.map +1 -1
  116. package/lib/latestValueTypes.js.map +1 -1
  117. package/lib/notificationsManager.d.ts +15 -10
  118. package/lib/notificationsManager.d.ts.map +1 -1
  119. package/lib/notificationsManager.js +8 -5
  120. package/lib/notificationsManager.js.map +1 -1
  121. package/lib/presence.d.ts +82 -66
  122. package/lib/presence.d.ts.map +1 -1
  123. package/lib/presence.js +4 -4
  124. package/lib/presence.js.map +1 -1
  125. package/lib/presenceDatastoreManager.d.ts +12 -10
  126. package/lib/presenceDatastoreManager.d.ts.map +1 -1
  127. package/lib/presenceDatastoreManager.js +10 -8
  128. package/lib/presenceDatastoreManager.js.map +1 -1
  129. package/lib/presenceManager.d.ts +2 -2
  130. package/lib/presenceManager.d.ts.map +1 -1
  131. package/lib/presenceManager.js +14 -22
  132. package/lib/presenceManager.js.map +1 -1
  133. package/lib/presenceStates.d.ts +14 -13
  134. package/lib/presenceStates.d.ts.map +1 -1
  135. package/lib/presenceStates.js +22 -15
  136. package/lib/presenceStates.js.map +1 -1
  137. package/lib/stateDatastore.d.ts +5 -4
  138. package/lib/stateDatastore.d.ts.map +1 -1
  139. package/lib/stateDatastore.js.map +1 -1
  140. package/lib/stateFactory.d.ts +22 -0
  141. package/lib/stateFactory.d.ts.map +1 -0
  142. package/lib/stateFactory.js +22 -0
  143. package/lib/stateFactory.js.map +1 -0
  144. package/lib/systemWorkspace.d.ts +7 -7
  145. package/lib/systemWorkspace.d.ts.map +1 -1
  146. package/lib/systemWorkspace.js +24 -24
  147. package/lib/systemWorkspace.js.map +1 -1
  148. package/lib/tsdoc-metadata.json +1 -1
  149. package/lib/types.d.ts +50 -33
  150. package/lib/types.d.ts.map +1 -1
  151. package/lib/types.js +0 -1
  152. package/lib/types.js.map +1 -1
  153. package/package.json +19 -19
package/lib/presence.d.ts CHANGED
@@ -6,42 +6,42 @@ import type { Listenable } from "@fluidframework/core-interfaces";
6
6
  import type { SessionId } from "@fluidframework/id-compressor";
7
7
  import type { ClientConnectionId } from "./baseTypes.js";
8
8
  import type { BroadcastControlSettings } from "./broadcastControls.js";
9
- import type { PresenceNotifications, PresenceNotificationsSchema, PresenceStates, PresenceStatesSchema, PresenceWorkspaceAddress } from "./types.js";
9
+ import type { NotificationsWorkspace, NotificationsWorkspaceSchema, StatesWorkspace, StatesWorkspaceSchema, WorkspaceAddress } from "./types.js";
10
10
  /**
11
11
  * A Fluid client session identifier.
12
12
  *
13
13
  * @remarks
14
14
  * Each client once connected to a session is given a unique identifier for the
15
15
  * duration of the session. If a client disconnects and reconnects, it will
16
- * retain its identifier. Prefer use of {@link ISessionClient} as a way to
17
- * identify clients in a session. {@link ISessionClient.sessionId} will provide
16
+ * retain its identifier. Prefer use of {@link Attendee} as a way to
17
+ * identify clients in a session. {@link Attendee.attendeeId} will provide
18
18
  * the session ID.
19
19
  *
20
20
  * @alpha
21
21
  */
22
- export type ClientSessionId = SessionId & {
23
- readonly ClientSessionId: "ClientSessionId";
22
+ export type AttendeeId = SessionId & {
23
+ readonly AttendeeId: "AttendeeId";
24
24
  };
25
25
  /**
26
- * The connection status of the {@link ISessionClient}.
26
+ * The connection status of the {@link Attendee}.
27
27
  *
28
28
  * @alpha
29
29
  */
30
- export declare const SessionClientStatus: {
30
+ export declare const AttendeeStatus: {
31
31
  /**
32
- * The session client is connected to the Fluid service.
32
+ * The {@link Attendee} is connected to the Fluid service.
33
33
  */
34
34
  readonly Connected: "Connected";
35
35
  /**
36
- * The session client is not connected to the Fluid service.
36
+ * The {@link Attendee} is not connected to the Fluid service.
37
37
  */
38
38
  readonly Disconnected: "Disconnected";
39
39
  };
40
40
  /**
41
- * Represents the connection status of an {@link ISessionClient}.
41
+ * Represents the connection status of an {@link Attendee}.
42
42
  *
43
43
  * This type can be either `'Connected'` or `'Disconnected'`, indicating whether
44
- * the session client is currently connected to the Fluid service.
44
+ * the attendee is currently connected to the Fluid service.
45
45
  *
46
46
  * When `'Disconnected'`:
47
47
  * - State changes are kept locally and communicated to others upon reconnect.
@@ -49,17 +49,17 @@ export declare const SessionClientStatus: {
49
49
  *
50
50
  * @alpha
51
51
  */
52
- export type SessionClientStatus = (typeof SessionClientStatus)[keyof typeof SessionClientStatus];
52
+ export type AttendeeStatus = (typeof AttendeeStatus)[keyof typeof AttendeeStatus];
53
53
  /**
54
54
  * A client within a Fluid session (period of container connectivity to service).
55
55
  *
56
56
  * @remarks
57
- * Note: This is very preliminary session client representation.
57
+ * Note: This is very preliminary attendee representation.
58
58
  *
59
- * `ISessionClient` should be used as key to distinguish between different
59
+ * {@link Attendee} should be used as key to distinguish between different
60
60
  * clients as they join, rejoin, and disconnect from a session. While a
61
- * client's {@link ClientConnectionId} from {@link ISessionClient.getConnectionStatus}
62
- * may change over time, `ISessionClient` will be fixed.
61
+ * client's {@link ClientConnectionId} from {@link Attendee.getConnectionStatus}
62
+ * may change over time, `Attendee` will be fixed.
63
63
  *
64
64
  * @privateRemarks
65
65
  * As this is evolved, pay attention to how this relates to Audience, Service
@@ -68,11 +68,11 @@ export type SessionClientStatus = (typeof SessionClientStatus)[keyof typeof Sess
68
68
  * @sealed
69
69
  * @alpha
70
70
  */
71
- export interface ISessionClient<SpecificSessionClientId extends ClientSessionId = ClientSessionId> {
71
+ export interface Attendee<SpecificAttendeeId extends AttendeeId = AttendeeId> {
72
72
  /**
73
73
  * The session ID of the client that is stable over all connections.
74
74
  */
75
- readonly sessionId: SpecificSessionClientId;
75
+ readonly attendeeId: SpecificAttendeeId;
76
76
  /**
77
77
  * Get current client connection ID.
78
78
  *
@@ -81,41 +81,47 @@ export interface ISessionClient<SpecificSessionClientId extends ClientSessionId
81
81
  * @remarks
82
82
  * Connection ID will change on reconnect.
83
83
  *
84
- * If {@link ISessionClient.getConnectionStatus} is {@link (SessionClientStatus:variable).Disconnected}, this will represent the last known connection ID.
84
+ * If {@link Attendee.getConnectionStatus} is {@link (AttendeeStatus:variable).Disconnected}, this will represent the last known connection ID.
85
85
  */
86
86
  getConnectionId(): ClientConnectionId;
87
87
  /**
88
- * Get connection status of session client.
88
+ * Get connection status of attendee.
89
89
  *
90
- * @returns Connection status of session client.
90
+ * @returns Connection status of attendee.
91
91
  *
92
92
  */
93
- getConnectionStatus(): SessionClientStatus;
93
+ getConnectionStatus(): AttendeeStatus;
94
94
  }
95
95
  /**
96
- * Utility type limiting to a specific session client. (A session client with
96
+ * Utility type limiting to a specific attendee. (A attendee with
97
97
  * a specific session ID - not just any session ID.)
98
98
  *
99
99
  * @internal
100
100
  */
101
- export type SpecificSessionClient<SpecificSessionClientId extends ClientSessionId> = string extends SpecificSessionClientId ? never : ISessionClient<SpecificSessionClientId>;
101
+ export type SpecificAttendee<SpecificAttendeeId extends AttendeeId> = string extends SpecificAttendeeId ? never : Attendee<SpecificAttendeeId>;
102
102
  /**
103
103
  * @sealed
104
104
  * @alpha
105
105
  */
106
- export interface PresenceEvents {
106
+ export interface AttendeesEvents {
107
107
  /**
108
108
  * Raised when new client joins session.
109
109
  *
110
110
  * @eventProperty
111
111
  */
112
- attendeeJoined: (attendee: ISessionClient) => void;
112
+ attendeeConnected: (attendee: Attendee) => void;
113
113
  /**
114
114
  * Raised when client appears disconnected from session.
115
115
  *
116
116
  * @eventProperty
117
117
  */
118
- attendeeDisconnected: (attendee: ISessionClient) => void;
118
+ attendeeDisconnected: (attendee: Attendee) => void;
119
+ }
120
+ /**
121
+ * @sealed
122
+ * @alpha
123
+ */
124
+ export interface PresenceEvents {
119
125
  /**
120
126
  * Raised when a workspace is activated within the session.
121
127
  *
@@ -128,7 +134,7 @@ export interface PresenceEvents {
128
134
  * be done before the event handler returns to ensure no notifications
129
135
  * are missed.
130
136
  */
131
- workspaceActivated: (workspaceAddress: PresenceWorkspaceAddress, type: "States" | "Notifications" | "Unknown") => void;
137
+ workspaceActivated: (workspaceAddress: WorkspaceAddress, type: "States" | "Notifications" | "Unknown") => void;
132
138
  }
133
139
  /**
134
140
  * Presence represents known clients within a session and their custom states and notifications.
@@ -136,47 +142,57 @@ export interface PresenceEvents {
136
142
  * @sealed
137
143
  * @alpha
138
144
  */
139
- export interface IPresence {
145
+ export interface Presence {
140
146
  /**
141
147
  * Events for Presence.
142
148
  */
143
149
  readonly events: Listenable<PresenceEvents>;
144
- /**
145
- * Get all attendees in the session.
146
- *
147
- * @remarks
148
- * Attendee states are dynamic and will change as clients join and leave
149
- * the session.
150
- */
151
- getAttendees(): ReadonlySet<ISessionClient>;
152
- /**
153
- * Lookup a specific attendee in the session.
154
- *
155
- * @param clientId - Client connection or session ID
156
- */
157
- getAttendee(clientId: ClientConnectionId | ClientSessionId): ISessionClient;
158
- /**
159
- * Get this client's session client.
160
- *
161
- * @returns This client's session client.
162
- */
163
- getMyself(): ISessionClient;
164
- /**
165
- * Acquires a PresenceStates workspace from store or adds new one.
166
- *
167
- * @param workspaceAddress - Address of the requested PresenceStates Workspace
168
- * @param requestedContent - Requested states for the workspace
169
- * @param controls - Optional settings for default broadcast controls
170
- * @returns A PresenceStates workspace
171
- */
172
- getStates<StatesSchema extends PresenceStatesSchema>(workspaceAddress: PresenceWorkspaceAddress, requestedContent: StatesSchema, controls?: BroadcastControlSettings): PresenceStates<StatesSchema>;
173
- /**
174
- * Acquires a Notifications workspace from store or adds new one.
175
- *
176
- * @param workspaceAddress - Address of the requested Notifications Workspace
177
- * @param requestedContent - Requested notifications for the workspace
178
- * @returns A Notifications workspace
179
- */
180
- getNotifications<NotificationsSchema extends PresenceNotificationsSchema>(notificationsId: PresenceWorkspaceAddress, requestedContent: NotificationsSchema): PresenceNotifications<NotificationsSchema>;
150
+ readonly attendees: {
151
+ /**
152
+ * Events for {@link Attendee}s.
153
+ */
154
+ readonly events: Listenable<AttendeesEvents>;
155
+ /**
156
+ * Get all {@link Attendee}s in the session.
157
+ *
158
+ * @remarks
159
+ * Attendee states are dynamic and will change as clients join and leave
160
+ * the session.
161
+ */
162
+ getAttendees(): ReadonlySet<Attendee>;
163
+ /**
164
+ * Lookup a specific {@link Attendee} in the session.
165
+ *
166
+ * @param clientId - Client connection or session ID
167
+ */
168
+ getAttendee(clientId: ClientConnectionId | AttendeeId): Attendee;
169
+ /**
170
+ * Get this client's {@link Attendee}.
171
+ *
172
+ * @returns This client's attendee.
173
+ */
174
+ getMyself(): Attendee;
175
+ };
176
+ readonly states: {
177
+ /**
178
+ * Acquires a StatesWorkspace from store or adds new one.
179
+ *
180
+ * @param workspaceAddress - Address of the requested StatesWorkspace
181
+ * @param requestedStates - Requested states for the workspace
182
+ * @param controls - Optional settings for default broadcast controls
183
+ * @returns A StatesWorkspace
184
+ */
185
+ getWorkspace<StatesSchema extends StatesWorkspaceSchema>(workspaceAddress: WorkspaceAddress, requestedStates: StatesSchema, controls?: BroadcastControlSettings): StatesWorkspace<StatesSchema>;
186
+ };
187
+ readonly notifications: {
188
+ /**
189
+ * Acquires a Notifications workspace from store or adds new one.
190
+ *
191
+ * @param workspaceAddress - Address of the requested Notifications Workspace
192
+ * @param requestedNotifications - Requested notifications for the workspace
193
+ * @returns A Notifications workspace
194
+ */
195
+ getWorkspace<NotificationsSchema extends NotificationsWorkspaceSchema>(notificationsId: WorkspaceAddress, requestedNotifications: NotificationsSchema): NotificationsWorkspace<NotificationsSchema>;
196
+ };
181
197
  }
182
198
  //# sourceMappingURL=presence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EACX,qBAAqB,EACrB,2BAA2B,EAC3B,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAE1F;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC/B;;OAEG;;IAGH;;OAEG;;CAEM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e,CAAC,YAAY,CAAC,CAAC;KACjC,CAAC;IAEF,QAAQ,CAAC,aAAa,EAAE;QACvB;;;;;;WAMG;QACH,YAAY,CAAC,mBAAmB,SAAS,4BAA4B,EACpE,eAAe,EAAE,gBAAgB,EACjC,sBAAsB,EAAE,mBAAmB,GACzC,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;KAC/C,CAAC;CACF"}
package/lib/presence.js CHANGED
@@ -3,17 +3,17 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /**
6
- * The connection status of the {@link ISessionClient}.
6
+ * The connection status of the {@link Attendee}.
7
7
  *
8
8
  * @alpha
9
9
  */
10
- export const SessionClientStatus = {
10
+ export const AttendeeStatus = {
11
11
  /**
12
- * The session client is connected to the Fluid service.
12
+ * The {@link Attendee} is connected to the Fluid service.
13
13
  */
14
14
  Connected: "Connected",
15
15
  /**
16
- * The session client is not connected to the Fluid service.
16
+ * The {@link Attendee} is not connected to the Fluid service.
17
17
  */
18
18
  Disconnected: "Disconnected",
19
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"presence.js","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,YAAY,EAAE,cAAc;CACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { BroadcastControlSettings } from \"./broadcastControls.js\";\nimport type {\n\tPresenceNotifications,\n\tPresenceNotificationsSchema,\n\tPresenceStates,\n\tPresenceStatesSchema,\n\tPresenceWorkspaceAddress,\n} from \"./types.js\";\n\n/**\n * A Fluid client session identifier.\n *\n * @remarks\n * Each client once connected to a session is given a unique identifier for the\n * duration of the session. If a client disconnects and reconnects, it will\n * retain its identifier. Prefer use of {@link ISessionClient} as a way to\n * identify clients in a session. {@link ISessionClient.sessionId} will provide\n * the session ID.\n *\n * @alpha\n */\nexport type ClientSessionId = SessionId & { readonly ClientSessionId: \"ClientSessionId\" };\n\n/**\n * The connection status of the {@link ISessionClient}.\n *\n * @alpha\n */\nexport const SessionClientStatus = {\n\t/**\n\t * The session client is connected to the Fluid service.\n\t */\n\tConnected: \"Connected\",\n\n\t/**\n\t * The session client is not connected to the Fluid service.\n\t */\n\tDisconnected: \"Disconnected\",\n} as const;\n\n/**\n * Represents the connection status of an {@link ISessionClient}.\n *\n * This type can be either `'Connected'` or `'Disconnected'`, indicating whether\n * the session client is currently connected to the Fluid service.\n *\n * When `'Disconnected'`:\n * - State changes are kept locally and communicated to others upon reconnect.\n * - Notification requests are discarded (silently).\n *\n * @alpha\n */\nexport type SessionClientStatus =\n\t(typeof SessionClientStatus)[keyof typeof SessionClientStatus];\n\n/**\n * A client within a Fluid session (period of container connectivity to service).\n *\n * @remarks\n * Note: This is very preliminary session client representation.\n *\n * `ISessionClient` should be used as key to distinguish between different\n * clients as they join, rejoin, and disconnect from a session. While a\n * client's {@link ClientConnectionId} from {@link ISessionClient.getConnectionStatus}\n * may change over time, `ISessionClient` will be fixed.\n *\n * @privateRemarks\n * As this is evolved, pay attention to how this relates to Audience, Service\n * Audience, and Quorum representations of clients and users.\n *\n * @sealed\n * @alpha\n */\nexport interface ISessionClient<\n\tSpecificSessionClientId extends ClientSessionId = ClientSessionId,\n> {\n\t/**\n\t * The session ID of the client that is stable over all connections.\n\t */\n\treadonly sessionId: SpecificSessionClientId;\n\n\t/**\n\t * Get current client connection ID.\n\t *\n\t * @returns Current client connection ID.\n\t *\n\t * @remarks\n\t * Connection ID will change on reconnect.\n\t *\n\t * If {@link ISessionClient.getConnectionStatus} is {@link (SessionClientStatus:variable).Disconnected}, this will represent the last known connection ID.\n\t */\n\tgetConnectionId(): ClientConnectionId;\n\n\t/**\n\t * Get connection status of session client.\n\t *\n\t * @returns Connection status of session client.\n\t *\n\t */\n\tgetConnectionStatus(): SessionClientStatus;\n}\n\n/**\n * Utility type limiting to a specific session client. (A session client with\n * a specific session ID - not just any session ID.)\n *\n * @internal\n */\nexport type SpecificSessionClient<SpecificSessionClientId extends ClientSessionId> =\n\tstring extends SpecificSessionClientId ? never : ISessionClient<SpecificSessionClientId>;\n\n/**\n * @sealed\n * @alpha\n */\nexport interface PresenceEvents {\n\t/**\n\t * Raised when new client joins session.\n\t *\n\t * @eventProperty\n\t */\n\tattendeeJoined: (attendee: ISessionClient) => void;\n\n\t/**\n\t * Raised when client appears disconnected from session.\n\t *\n\t * @eventProperty\n\t */\n\tattendeeDisconnected: (attendee: ISessionClient) => void;\n\n\t/**\n\t * Raised when a workspace is activated within the session.\n\t *\n\t * \"Activated\" means that a workspace is being used by a client and this\n\t * client is seeing information for the first time.\n\t *\n\t * @remarks\n\t * Local workspaces may be passively acquired/registered when this event\n\t * is raised. For a notifications workspace, that lazy registration must\n\t * be done before the event handler returns to ensure no notifications\n\t * are missed.\n\t */\n\tworkspaceActivated: (\n\t\tworkspaceAddress: PresenceWorkspaceAddress,\n\t\ttype: \"States\" | \"Notifications\" | \"Unknown\",\n\t) => void;\n}\n\n/**\n * Presence represents known clients within a session and their custom states and notifications.\n *\n * @sealed\n * @alpha\n */\nexport interface IPresence {\n\t/**\n\t * Events for Presence.\n\t */\n\treadonly events: Listenable<PresenceEvents>;\n\n\t/**\n\t * Get all attendees in the session.\n\t *\n\t * @remarks\n\t * Attendee states are dynamic and will change as clients join and leave\n\t * the session.\n\t */\n\tgetAttendees(): ReadonlySet<ISessionClient>;\n\n\t/**\n\t * Lookup a specific attendee in the session.\n\t *\n\t * @param clientId - Client connection or session ID\n\t */\n\tgetAttendee(clientId: ClientConnectionId | ClientSessionId): ISessionClient;\n\n\t/**\n\t * Get this client's session client.\n\t *\n\t * @returns This client's session client.\n\t */\n\tgetMyself(): ISessionClient;\n\n\t/**\n\t * Acquires a PresenceStates workspace from store or adds new one.\n\t *\n\t * @param workspaceAddress - Address of the requested PresenceStates Workspace\n\t * @param requestedContent - Requested states for the workspace\n\t * @param controls - Optional settings for default broadcast controls\n\t * @returns A PresenceStates workspace\n\t */\n\tgetStates<StatesSchema extends PresenceStatesSchema>(\n\t\tworkspaceAddress: PresenceWorkspaceAddress,\n\t\trequestedContent: StatesSchema,\n\t\tcontrols?: BroadcastControlSettings,\n\t): PresenceStates<StatesSchema>;\n\n\t/**\n\t * Acquires a Notifications workspace from store or adds new one.\n\t *\n\t * @param workspaceAddress - Address of the requested Notifications Workspace\n\t * @param requestedContent - Requested notifications for the workspace\n\t * @returns A Notifications workspace\n\t */\n\tgetNotifications<NotificationsSchema extends PresenceNotificationsSchema>(\n\t\tnotificationsId: PresenceWorkspaceAddress,\n\t\trequestedContent: NotificationsSchema,\n\t): PresenceNotifications<NotificationsSchema>;\n}\n"]}
1
+ {"version":3,"file":"presence.js","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,YAAY,EAAE,cAAc;CACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { BroadcastControlSettings } from \"./broadcastControls.js\";\nimport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceSchema,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\n/**\n * A Fluid client session identifier.\n *\n * @remarks\n * Each client once connected to a session is given a unique identifier for the\n * duration of the session. If a client disconnects and reconnects, it will\n * retain its identifier. Prefer use of {@link Attendee} as a way to\n * identify clients in a session. {@link Attendee.attendeeId} will provide\n * the session ID.\n *\n * @alpha\n */\nexport type AttendeeId = SessionId & { readonly AttendeeId: \"AttendeeId\" };\n\n/**\n * The connection status of the {@link Attendee}.\n *\n * @alpha\n */\nexport const AttendeeStatus = {\n\t/**\n\t * The {@link Attendee} is connected to the Fluid service.\n\t */\n\tConnected: \"Connected\",\n\n\t/**\n\t * The {@link Attendee} is not connected to the Fluid service.\n\t */\n\tDisconnected: \"Disconnected\",\n} as const;\n\n/**\n * Represents the connection status of an {@link Attendee}.\n *\n * This type can be either `'Connected'` or `'Disconnected'`, indicating whether\n * the attendee is currently connected to the Fluid service.\n *\n * When `'Disconnected'`:\n * - State changes are kept locally and communicated to others upon reconnect.\n * - Notification requests are discarded (silently).\n *\n * @alpha\n */\nexport type AttendeeStatus = (typeof AttendeeStatus)[keyof typeof AttendeeStatus];\n\n/**\n * A client within a Fluid session (period of container connectivity to service).\n *\n * @remarks\n * Note: This is very preliminary attendee representation.\n *\n * {@link Attendee} should be used as key to distinguish between different\n * clients as they join, rejoin, and disconnect from a session. While a\n * client's {@link ClientConnectionId} from {@link Attendee.getConnectionStatus}\n * may change over time, `Attendee` will be fixed.\n *\n * @privateRemarks\n * As this is evolved, pay attention to how this relates to Audience, Service\n * Audience, and Quorum representations of clients and users.\n *\n * @sealed\n * @alpha\n */\nexport interface Attendee<SpecificAttendeeId extends AttendeeId = AttendeeId> {\n\t/**\n\t * The session ID of the client that is stable over all connections.\n\t */\n\treadonly attendeeId: SpecificAttendeeId;\n\n\t/**\n\t * Get current client connection ID.\n\t *\n\t * @returns Current client connection ID.\n\t *\n\t * @remarks\n\t * Connection ID will change on reconnect.\n\t *\n\t * If {@link Attendee.getConnectionStatus} is {@link (AttendeeStatus:variable).Disconnected}, this will represent the last known connection ID.\n\t */\n\tgetConnectionId(): ClientConnectionId;\n\n\t/**\n\t * Get connection status of attendee.\n\t *\n\t * @returns Connection status of attendee.\n\t *\n\t */\n\tgetConnectionStatus(): AttendeeStatus;\n}\n\n/**\n * Utility type limiting to a specific attendee. (A attendee with\n * a specific session ID - not just any session ID.)\n *\n * @internal\n */\nexport type SpecificAttendee<SpecificAttendeeId extends AttendeeId> =\n\tstring extends SpecificAttendeeId ? never : Attendee<SpecificAttendeeId>;\n\n/**\n * @sealed\n * @alpha\n */\nexport interface AttendeesEvents {\n\t/**\n\t * Raised when new client joins session.\n\t *\n\t * @eventProperty\n\t */\n\tattendeeConnected: (attendee: Attendee) => void;\n\n\t/**\n\t * Raised when client appears disconnected from session.\n\t *\n\t * @eventProperty\n\t */\n\tattendeeDisconnected: (attendee: Attendee) => void;\n}\n\n/**\n * @sealed\n * @alpha\n */\nexport interface PresenceEvents {\n\t/**\n\t * Raised when a workspace is activated within the session.\n\t *\n\t * \"Activated\" means that a workspace is being used by a client and this\n\t * client is seeing information for the first time.\n\t *\n\t * @remarks\n\t * Local workspaces may be passively acquired/registered when this event\n\t * is raised. For a notifications workspace, that lazy registration must\n\t * be done before the event handler returns to ensure no notifications\n\t * are missed.\n\t */\n\tworkspaceActivated: (\n\t\tworkspaceAddress: WorkspaceAddress,\n\t\ttype: \"States\" | \"Notifications\" | \"Unknown\",\n\t) => void;\n}\n\n/**\n * Presence represents known clients within a session and their custom states and notifications.\n *\n * @sealed\n * @alpha\n */\nexport interface Presence {\n\t/**\n\t * Events for Presence.\n\t */\n\treadonly events: Listenable<PresenceEvents>;\n\n\treadonly attendees: {\n\t\t/**\n\t\t * Events for {@link Attendee}s.\n\t\t */\n\t\treadonly events: Listenable<AttendeesEvents>;\n\n\t\t/**\n\t\t * Get all {@link Attendee}s in the session.\n\t\t *\n\t\t * @remarks\n\t\t * Attendee states are dynamic and will change as clients join and leave\n\t\t * the session.\n\t\t */\n\t\tgetAttendees(): ReadonlySet<Attendee>;\n\n\t\t/**\n\t\t * Lookup a specific {@link Attendee} in the session.\n\t\t *\n\t\t * @param clientId - Client connection or session ID\n\t\t */\n\t\tgetAttendee(clientId: ClientConnectionId | AttendeeId): Attendee;\n\n\t\t/**\n\t\t * Get this client's {@link Attendee}.\n\t\t *\n\t\t * @returns This client's attendee.\n\t\t */\n\t\tgetMyself(): Attendee;\n\t};\n\n\treadonly states: {\n\t\t/**\n\t\t * Acquires a StatesWorkspace from store or adds new one.\n\t\t *\n\t\t * @param workspaceAddress - Address of the requested StatesWorkspace\n\t\t * @param requestedStates - Requested states for the workspace\n\t\t * @param controls - Optional settings for default broadcast controls\n\t\t * @returns A StatesWorkspace\n\t\t */\n\t\tgetWorkspace<StatesSchema extends StatesWorkspaceSchema>(\n\t\t\tworkspaceAddress: WorkspaceAddress,\n\t\t\trequestedStates: StatesSchema,\n\t\t\tcontrols?: BroadcastControlSettings,\n\t\t): StatesWorkspace<StatesSchema>;\n\t};\n\n\treadonly notifications: {\n\t\t/**\n\t\t * Acquires a Notifications workspace from store or adds new one.\n\t\t *\n\t\t * @param workspaceAddress - Address of the requested Notifications Workspace\n\t\t * @param requestedNotifications - Requested notifications for the workspace\n\t\t * @returns A Notifications workspace\n\t\t */\n\t\tgetWorkspace<NotificationsSchema extends NotificationsWorkspaceSchema>(\n\t\t\tnotificationsId: WorkspaceAddress,\n\t\t\trequestedNotifications: NotificationsSchema,\n\t\t): NotificationsWorkspace<NotificationsSchema>;\n\t};\n}\n"]}
@@ -8,23 +8,23 @@ import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/intern
8
8
  import type { ClientConnectionId } from "./baseTypes.js";
9
9
  import type { BroadcastControlSettings } from "./broadcastControls.js";
10
10
  import type { IEphemeralRuntime } from "./internalTypes.js";
11
- import type { ClientSessionId, ISessionClient, PresenceEvents } from "./presence.js";
11
+ import type { AttendeeId, Attendee, Presence, PresenceEvents } from "./presence.js";
12
12
  import type { ClientUpdateEntry, PresenceStatesInternal } from "./presenceStates.js";
13
13
  import type { SystemWorkspaceDatastore } from "./systemWorkspace.js";
14
- import type { PresenceStates, PresenceStatesSchema, PresenceWorkspaceAddress } from "./types.js";
14
+ import type { AnyWorkspace, NotificationsWorkspace, NotificationsWorkspaceSchema, StatesWorkspace, StatesWorkspaceSchema, WorkspaceAddress } from "./types.js";
15
15
  import type { IExtensionMessage } from "@fluidframework/presence/internal/container-definitions/internal";
16
- interface PresenceWorkspaceEntry<TSchema extends PresenceStatesSchema> {
17
- public: PresenceStates<TSchema>;
16
+ interface AnyWorkspaceEntry<TSchema extends StatesWorkspaceSchema> {
17
+ public: AnyWorkspace<TSchema>;
18
18
  internal: PresenceStatesInternal;
19
19
  }
20
20
  interface SystemDatastore {
21
21
  "system:presence": SystemWorkspaceDatastore;
22
22
  }
23
- type InternalWorkspaceAddress = `${"s" | "n"}:${PresenceWorkspaceAddress}`;
23
+ type InternalWorkspaceAddress = `${"s" | "n"}:${WorkspaceAddress}`;
24
24
  interface GeneralDatastoreMessageContent {
25
25
  [WorkspaceAddress: string]: {
26
26
  [StateValueManagerKey: string]: {
27
- [ClientSessionId: ClientSessionId]: ClientUpdateEntry;
27
+ [AttendeeId: AttendeeId]: ClientUpdateEntry;
28
28
  };
29
29
  };
30
30
  }
@@ -54,27 +54,29 @@ interface ClientJoinMessage extends IInboundSignalMessage {
54
54
  */
55
55
  export interface PresenceDatastoreManager {
56
56
  joinSession(clientId: ClientConnectionId): void;
57
- getWorkspace<TSchema extends PresenceStatesSchema>(internalWorkspaceAddress: InternalWorkspaceAddress, requestedContent: TSchema, controls?: BroadcastControlSettings): PresenceStates<TSchema>;
57
+ getWorkspace<TSchema extends StatesWorkspaceSchema>(internalWorkspaceAddress: `s:${WorkspaceAddress}`, requestedContent: TSchema, controls?: BroadcastControlSettings): StatesWorkspace<TSchema>;
58
+ getWorkspace<TSchema extends NotificationsWorkspaceSchema>(internalWorkspaceAddress: `n:${WorkspaceAddress}`, requestedContent: TSchema): NotificationsWorkspace<TSchema>;
58
59
  processSignal(message: IExtensionMessage, local: boolean): void;
59
60
  }
60
61
  /**
61
62
  * Manages singleton datastore for all Presence.
62
63
  */
63
64
  export declare class PresenceDatastoreManagerImpl implements PresenceDatastoreManager {
64
- private readonly clientSessionId;
65
+ private readonly attendeeId;
65
66
  private readonly runtime;
66
67
  private readonly lookupClient;
67
68
  private readonly logger;
68
69
  private readonly events;
70
+ private readonly presence;
69
71
  private readonly datastore;
70
72
  private averageLatency;
71
73
  private returnedMessages;
72
74
  private refreshBroadcastRequested;
73
75
  private readonly timer;
74
76
  private readonly workspaces;
75
- constructor(clientSessionId: ClientSessionId, runtime: IEphemeralRuntime, lookupClient: (clientId: ClientSessionId) => ISessionClient, logger: ITelemetryLoggerExt | undefined, events: IEmitter<Pick<PresenceEvents, "workspaceActivated">>, systemWorkspaceDatastore: SystemWorkspaceDatastore, systemWorkspace: PresenceWorkspaceEntry<PresenceStatesSchema>);
77
+ constructor(attendeeId: AttendeeId, runtime: IEphemeralRuntime, lookupClient: (clientId: AttendeeId) => Attendee, logger: ITelemetryLoggerExt | undefined, events: IEmitter<PresenceEvents>, presence: Presence, systemWorkspaceDatastore: SystemWorkspaceDatastore, systemWorkspace: AnyWorkspaceEntry<StatesWorkspaceSchema>);
76
78
  joinSession(clientId: ClientConnectionId): void;
77
- getWorkspace<TSchema extends PresenceStatesSchema>(internalWorkspaceAddress: InternalWorkspaceAddress, requestedContent: TSchema, controls?: BroadcastControlSettings): PresenceStates<TSchema>;
79
+ getWorkspace<TSchema extends StatesWorkspaceSchema>(internalWorkspaceAddress: InternalWorkspaceAddress, requestedContent: TSchema, controls?: BroadcastControlSettings): AnyWorkspace<TSchema>;
78
80
  /**
79
81
  * The combined contents of all queued updates. Will be undefined when no messages are queued.
80
82
  */
@@ -1 +1 @@
1
- {"version":3,"file":"presenceDatastoreManager.d.ts","sourceRoot":"","sources":["../src/presenceDatastoreManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAEzE,OAAO,KAAK,EAAE,qBAAqB,EA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AAK;IAC7B,OAAO,CAAC,yBAAyB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+D;gBAGxE,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAK,QAAQ,EAChD,MAAM,EAAE,mBAAmB,GAAG,SAAS,EACvC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,EAChC,QAAQ,EAAE,QAAQ,EACnC,wBAAwB,EAAE,wBAAwB,EAClD,eAAe,EAAE,iBAAiB,CAAC,qBAAqB,CAAC;IAOnD,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAkB/C,YAAY,CAAC,OAAO,SAAS,qBAAqB,EACxD,wBAAwB,EAAE,wBAAwB,EAClD,gBAAgB,EAAE,OAAO,EACzB,QAAQ,CAAC,EAAE,wBAAwB,GACjC,YAAY,CAAC,OAAO,CAAC;IAkDxB;;OAEG;IACH,OAAO,CAAC,UAAU,CAA6C;IAE/D;;;OAGG;IACH,OAAO,CAAC,cAAc;IAuCtB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2CzB,OAAO,CAAC,sBAAsB;IAUvB,aAAa,CAOnB,OAAO,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,iBAAiB,EAC3E,KAAK,EAAE,OAAO,GACZ,IAAI;IA+FP;;;;;;;;;;OAUG;IACH,OAAO,CAAC,mBAAmB;CAgE3B"}
@@ -27,10 +27,10 @@ function mergeGeneralDatastoreMessageContent(base, newData) {
27
27
  const mergedData = queueDatastore[workspaceName] ?? {};
28
28
  // Iterate over each value manager and its data, merging it as needed.
29
29
  for (const [valueManagerKey, valueManagerValue] of objectEntries(workspaceData)) {
30
- for (const [clientSessionId, value] of objectEntries(valueManagerValue)) {
30
+ for (const [attendeeId, value] of objectEntries(valueManagerValue)) {
31
31
  const mergeObject = (mergedData[valueManagerKey] ??= {});
32
- const oldData = mergeObject[clientSessionId];
33
- mergeObject[clientSessionId] = mergeValueDirectory(oldData, value, 0);
32
+ const oldData = mergeObject[attendeeId];
33
+ mergeObject[attendeeId] = mergeValueDirectory(oldData, value, 0);
34
34
  }
35
35
  }
36
36
  // Store the merged data in the function-local queue workspace. The whole contents of this
@@ -43,12 +43,13 @@ function mergeGeneralDatastoreMessageContent(base, newData) {
43
43
  * Manages singleton datastore for all Presence.
44
44
  */
45
45
  export class PresenceDatastoreManagerImpl {
46
- constructor(clientSessionId, runtime, lookupClient, logger, events, systemWorkspaceDatastore, systemWorkspace) {
47
- this.clientSessionId = clientSessionId;
46
+ constructor(attendeeId, runtime, lookupClient, logger, events, presence, systemWorkspaceDatastore, systemWorkspace) {
47
+ this.attendeeId = attendeeId;
48
48
  this.runtime = runtime;
49
49
  this.lookupClient = lookupClient;
50
50
  this.logger = logger;
51
51
  this.events = events;
52
+ this.presence = presence;
52
53
  this.averageLatency = 0;
53
54
  this.returnedMessages = 0;
54
55
  this.refreshBroadcastRequested = false;
@@ -89,14 +90,15 @@ export class PresenceDatastoreManagerImpl {
89
90
  }
90
91
  const updates = {};
91
92
  for (const [key, value] of Object.entries(states)) {
92
- updates[key] = { [this.clientSessionId]: value };
93
+ updates[key] = { [this.attendeeId]: value };
93
94
  }
94
95
  this.enqueueMessage({
95
96
  [internalWorkspaceAddress]: updates,
96
97
  }, options);
97
98
  };
98
99
  const entry = createPresenceStates({
99
- clientSessionId: this.clientSessionId,
100
+ presence: this.presence,
101
+ attendeeId: this.attendeeId,
100
102
  lookupClient: this.lookupClient,
101
103
  localUpdate,
102
104
  }, workspaceDatastore, requestedContent, controls);
@@ -190,7 +192,7 @@ export class PresenceDatastoreManagerImpl {
190
192
  processSignal(
191
193
  // Note: IInboundSignalMessage is used here in place of IExtensionMessage
192
194
  // as IExtensionMessage's strictly JSON `content` creates type compatibility
193
- // issues with `ClientSessionId` keys and really unknown value content.
195
+ // issues with `AttendeeId` keys and really unknown value content.
194
196
  // IExtensionMessage is a subset of IInboundSignalMessage so this is safe.
195
197
  // Change types of DatastoreUpdateMessage | ClientJoinMessage to
196
198
  // IExtensionMessage<> derivatives to see the issues.