@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.
- package/README.md +24 -24
- package/dist/alpha.d.ts +29 -25
- package/dist/baseTypes.d.ts +3 -3
- package/dist/baseTypes.js.map +1 -1
- package/dist/broadcastControls.d.ts +1 -1
- package/dist/broadcastControls.js.map +1 -1
- package/dist/datastorePresenceManagerFactory.d.ts +5 -5
- package/dist/datastorePresenceManagerFactory.d.ts.map +1 -1
- package/dist/datastorePresenceManagerFactory.js +6 -6
- package/dist/datastorePresenceManagerFactory.js.map +1 -1
- package/dist/experimentalAccess.d.ts +4 -4
- package/dist/experimentalAccess.d.ts.map +1 -1
- package/dist/experimentalAccess.js +6 -6
- package/dist/experimentalAccess.js.map +1 -1
- package/dist/exposedInternalTypes.d.ts +1 -1
- package/dist/exposedInternalTypes.js.map +1 -1
- package/dist/exposedUtilityTypes.d.ts +0 -8
- package/dist/exposedUtilityTypes.d.ts.map +1 -1
- package/dist/exposedUtilityTypes.js.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +3 -3
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/internalUtils.d.ts +5 -0
- package/dist/internalUtils.d.ts.map +1 -1
- package/dist/internalUtils.js +8 -1
- package/dist/internalUtils.js.map +1 -1
- package/dist/latestMapValueManager.d.ts +57 -39
- package/dist/latestMapValueManager.d.ts.map +1 -1
- package/dist/latestMapValueManager.js +48 -39
- package/dist/latestMapValueManager.js.map +1 -1
- package/dist/latestValueManager.d.ts +38 -20
- package/dist/latestValueManager.d.ts.map +1 -1
- package/dist/latestValueManager.js +32 -28
- package/dist/latestValueManager.js.map +1 -1
- package/dist/latestValueTypes.d.ts +9 -10
- package/dist/latestValueTypes.d.ts.map +1 -1
- package/dist/latestValueTypes.js.map +1 -1
- package/dist/notificationsManager.d.ts +15 -10
- package/dist/notificationsManager.d.ts.map +1 -1
- package/dist/notificationsManager.js +8 -5
- package/dist/notificationsManager.js.map +1 -1
- package/dist/presence.d.ts +82 -66
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +5 -5
- package/dist/presence.js.map +1 -1
- package/dist/presenceDatastoreManager.d.ts +12 -10
- package/dist/presenceDatastoreManager.d.ts.map +1 -1
- package/dist/presenceDatastoreManager.js +10 -8
- package/dist/presenceDatastoreManager.js.map +1 -1
- package/dist/presenceManager.d.ts +2 -2
- package/dist/presenceManager.d.ts.map +1 -1
- package/dist/presenceManager.js +14 -22
- package/dist/presenceManager.js.map +1 -1
- package/dist/presenceStates.d.ts +14 -13
- package/dist/presenceStates.d.ts.map +1 -1
- package/dist/presenceStates.js +22 -15
- package/dist/presenceStates.js.map +1 -1
- package/dist/stateDatastore.d.ts +5 -4
- package/dist/stateDatastore.d.ts.map +1 -1
- package/dist/stateDatastore.js.map +1 -1
- package/dist/stateFactory.d.ts +22 -0
- package/dist/stateFactory.d.ts.map +1 -0
- package/dist/stateFactory.js +25 -0
- package/dist/stateFactory.js.map +1 -0
- package/dist/systemWorkspace.d.ts +7 -7
- package/dist/systemWorkspace.d.ts.map +1 -1
- package/dist/systemWorkspace.js +23 -23
- package/dist/systemWorkspace.js.map +1 -1
- package/dist/types.d.ts +50 -33
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/dist/types.js.map +1 -1
- package/lib/alpha.d.ts +29 -25
- package/lib/baseTypes.d.ts +3 -3
- package/lib/baseTypes.js.map +1 -1
- package/lib/broadcastControls.d.ts +1 -1
- package/lib/broadcastControls.js.map +1 -1
- package/lib/datastorePresenceManagerFactory.d.ts +5 -5
- package/lib/datastorePresenceManagerFactory.d.ts.map +1 -1
- package/lib/datastorePresenceManagerFactory.js +4 -4
- package/lib/datastorePresenceManagerFactory.js.map +1 -1
- package/lib/experimentalAccess.d.ts +4 -4
- package/lib/experimentalAccess.d.ts.map +1 -1
- package/lib/experimentalAccess.js +4 -4
- package/lib/experimentalAccess.js.map +1 -1
- package/lib/exposedInternalTypes.d.ts +1 -1
- package/lib/exposedInternalTypes.js.map +1 -1
- package/lib/exposedUtilityTypes.d.ts +0 -8
- package/lib/exposedUtilityTypes.d.ts.map +1 -1
- package/lib/exposedUtilityTypes.js.map +1 -1
- package/lib/index.d.ts +8 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -5
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +3 -3
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/internalUtils.d.ts +5 -0
- package/lib/internalUtils.d.ts.map +1 -1
- package/lib/internalUtils.js +6 -0
- package/lib/internalUtils.js.map +1 -1
- package/lib/latestMapValueManager.d.ts +57 -39
- package/lib/latestMapValueManager.d.ts.map +1 -1
- package/lib/latestMapValueManager.js +47 -38
- package/lib/latestMapValueManager.js.map +1 -1
- package/lib/latestValueManager.d.ts +38 -20
- package/lib/latestValueManager.d.ts.map +1 -1
- package/lib/latestValueManager.js +31 -27
- package/lib/latestValueManager.js.map +1 -1
- package/lib/latestValueTypes.d.ts +9 -10
- package/lib/latestValueTypes.d.ts.map +1 -1
- package/lib/latestValueTypes.js.map +1 -1
- package/lib/notificationsManager.d.ts +15 -10
- package/lib/notificationsManager.d.ts.map +1 -1
- package/lib/notificationsManager.js +8 -5
- package/lib/notificationsManager.js.map +1 -1
- package/lib/presence.d.ts +82 -66
- package/lib/presence.d.ts.map +1 -1
- package/lib/presence.js +4 -4
- package/lib/presence.js.map +1 -1
- package/lib/presenceDatastoreManager.d.ts +12 -10
- package/lib/presenceDatastoreManager.d.ts.map +1 -1
- package/lib/presenceDatastoreManager.js +10 -8
- package/lib/presenceDatastoreManager.js.map +1 -1
- package/lib/presenceManager.d.ts +2 -2
- package/lib/presenceManager.d.ts.map +1 -1
- package/lib/presenceManager.js +14 -22
- package/lib/presenceManager.js.map +1 -1
- package/lib/presenceStates.d.ts +14 -13
- package/lib/presenceStates.d.ts.map +1 -1
- package/lib/presenceStates.js +22 -15
- package/lib/presenceStates.js.map +1 -1
- package/lib/stateDatastore.d.ts +5 -4
- package/lib/stateDatastore.d.ts.map +1 -1
- package/lib/stateDatastore.js.map +1 -1
- package/lib/stateFactory.d.ts +22 -0
- package/lib/stateFactory.d.ts.map +1 -0
- package/lib/stateFactory.js +22 -0
- package/lib/stateFactory.js.map +1 -0
- package/lib/systemWorkspace.d.ts +7 -7
- package/lib/systemWorkspace.d.ts.map +1 -1
- package/lib/systemWorkspace.js +24 -24
- package/lib/systemWorkspace.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types.d.ts +50 -33
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +0 -1
- package/lib/types.js.map +1 -1
- 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 {
|
|
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
|
|
17
|
-
* identify clients in a session. {@link
|
|
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
|
|
23
|
-
readonly
|
|
22
|
+
export type AttendeeId = SessionId & {
|
|
23
|
+
readonly AttendeeId: "AttendeeId";
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* The connection status of the {@link
|
|
26
|
+
* The connection status of the {@link Attendee}.
|
|
27
27
|
*
|
|
28
28
|
* @alpha
|
|
29
29
|
*/
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const AttendeeStatus: {
|
|
31
31
|
/**
|
|
32
|
-
* The
|
|
32
|
+
* The {@link Attendee} is connected to the Fluid service.
|
|
33
33
|
*/
|
|
34
34
|
readonly Connected: "Connected";
|
|
35
35
|
/**
|
|
36
|
-
* The
|
|
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
|
|
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
|
|
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
|
|
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
|
|
57
|
+
* Note: This is very preliminary attendee representation.
|
|
58
58
|
*
|
|
59
|
-
*
|
|
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
|
|
62
|
-
* may change over time, `
|
|
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
|
|
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
|
|
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
|
|
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
|
|
88
|
+
* Get connection status of attendee.
|
|
89
89
|
*
|
|
90
|
-
* @returns Connection status of
|
|
90
|
+
* @returns Connection status of attendee.
|
|
91
91
|
*
|
|
92
92
|
*/
|
|
93
|
-
getConnectionStatus():
|
|
93
|
+
getConnectionStatus(): AttendeeStatus;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* Utility type limiting to a specific
|
|
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
|
|
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
|
|
106
|
+
export interface AttendeesEvents {
|
|
107
107
|
/**
|
|
108
108
|
* Raised when new client joins session.
|
|
109
109
|
*
|
|
110
110
|
* @eventProperty
|
|
111
111
|
*/
|
|
112
|
-
|
|
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:
|
|
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:
|
|
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
|
|
145
|
+
export interface Presence {
|
|
140
146
|
/**
|
|
141
147
|
* Events for Presence.
|
|
142
148
|
*/
|
|
143
149
|
readonly events: Listenable<PresenceEvents>;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
package/lib/presence.d.ts.map
CHANGED
|
@@ -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,
|
|
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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9B;;;;;;;;;;;OAWG;IACH,kBAAkB,EAAE,CACnB,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,QAAQ,GAAG,eAAe,GAAG,SAAS,KACxC,IAAI,CAAC;CACV;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACxB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IAE5C,QAAQ,CAAC,SAAS,EAAE;QACnB;;WAEG;QACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;QAE7C;;;;;;WAMG;QACH,YAAY,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEtC;;;;WAIG;QACH,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,UAAU,GAAG,QAAQ,CAAC;QAEjE;;;;WAIG;QACH,SAAS,IAAI,QAAQ,CAAC;KACtB,CAAC;IAEF,QAAQ,CAAC,MAAM,EAAE;QAChB;;;;;;;WAOG;QACH,YAAY,CAAC,YAAY,SAAS,qBAAqB,EACtD,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,YAAY,EAC7B,QAAQ,CAAC,EAAE,wBAAwB,GACjC,eAAe,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
|
|
6
|
+
* The connection status of the {@link Attendee}.
|
|
7
7
|
*
|
|
8
8
|
* @alpha
|
|
9
9
|
*/
|
|
10
|
-
export const
|
|
10
|
+
export const AttendeeStatus = {
|
|
11
11
|
/**
|
|
12
|
-
* The
|
|
12
|
+
* The {@link Attendee} is connected to the Fluid service.
|
|
13
13
|
*/
|
|
14
14
|
Connected: "Connected",
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
16
|
+
* The {@link Attendee} is not connected to the Fluid service.
|
|
17
17
|
*/
|
|
18
18
|
Disconnected: "Disconnected",
|
|
19
19
|
};
|
package/lib/presence.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH;;;;GAIG;AACH,MAAM,CAAC,MAAM,
|
|
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 {
|
|
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 {
|
|
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
|
|
17
|
-
public:
|
|
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"}:${
|
|
23
|
+
type InternalWorkspaceAddress = `${"s" | "n"}:${WorkspaceAddress}`;
|
|
24
24
|
interface GeneralDatastoreMessageContent {
|
|
25
25
|
[WorkspaceAddress: string]: {
|
|
26
26
|
[StateValueManagerKey: string]: {
|
|
27
|
-
[
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,oBAAoB,CAAC;AAE9E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"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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 [
|
|
30
|
+
for (const [attendeeId, value] of objectEntries(valueManagerValue)) {
|
|
31
31
|
const mergeObject = (mergedData[valueManagerKey] ??= {});
|
|
32
|
-
const oldData = mergeObject[
|
|
33
|
-
mergeObject[
|
|
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(
|
|
47
|
-
this.
|
|
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.
|
|
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
|
-
|
|
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 `
|
|
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.
|