@fluidframework/presence 2.10.0-307399
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/LICENSE +21 -0
- package/README.md +216 -0
- package/dist/alpha.d.ts +58 -0
- package/dist/baseTypes.d.ts +24 -0
- package/dist/baseTypes.d.ts.map +1 -0
- package/dist/baseTypes.js +7 -0
- package/dist/baseTypes.js.map +1 -0
- package/dist/container-definitions/containerExtensions.d.ts +137 -0
- package/dist/container-definitions/containerExtensions.d.ts.map +1 -0
- package/dist/container-definitions/containerExtensions.js +7 -0
- package/dist/container-definitions/containerExtensions.js.map +1 -0
- package/dist/container-definitions/index.d.ts +7 -0
- package/dist/container-definitions/index.d.ts.map +1 -0
- package/dist/container-definitions/index.js +7 -0
- package/dist/container-definitions/index.js.map +1 -0
- package/dist/container-definitions/runtime.d.ts +12 -0
- package/dist/container-definitions/runtime.d.ts.map +1 -0
- package/dist/container-definitions/runtime.js +7 -0
- package/dist/container-definitions/runtime.js.map +1 -0
- package/dist/core-interfaces/exposedUtilityTypes.d.ts +446 -0
- package/dist/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
- package/dist/core-interfaces/exposedUtilityTypes.js +11 -0
- package/dist/core-interfaces/exposedUtilityTypes.js.map +1 -0
- package/dist/core-interfaces/index.d.ts +10 -0
- package/dist/core-interfaces/index.d.ts.map +1 -0
- package/dist/core-interfaces/index.js +7 -0
- package/dist/core-interfaces/index.js.map +1 -0
- package/dist/core-interfaces/jsonDeserialized.d.ts +109 -0
- package/dist/core-interfaces/jsonDeserialized.d.ts.map +1 -0
- package/dist/core-interfaces/jsonDeserialized.js +7 -0
- package/dist/core-interfaces/jsonDeserialized.js.map +1 -0
- package/dist/core-interfaces/jsonSerializable.d.ts +120 -0
- package/dist/core-interfaces/jsonSerializable.d.ts.map +1 -0
- package/dist/core-interfaces/jsonSerializable.js +7 -0
- package/dist/core-interfaces/jsonSerializable.js.map +1 -0
- package/dist/core-interfaces/jsonSerializationErrors.d.ts +31 -0
- package/dist/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
- package/dist/core-interfaces/jsonSerializationErrors.js +7 -0
- package/dist/core-interfaces/jsonSerializationErrors.js.map +1 -0
- package/dist/core-interfaces/jsonType.d.ts +29 -0
- package/dist/core-interfaces/jsonType.d.ts.map +1 -0
- package/dist/core-interfaces/jsonType.js +7 -0
- package/dist/core-interfaces/jsonType.js.map +1 -0
- package/dist/datastorePresenceManagerFactory.d.ts +48 -0
- package/dist/datastorePresenceManagerFactory.d.ts.map +1 -0
- package/dist/datastorePresenceManagerFactory.js +79 -0
- package/dist/datastorePresenceManagerFactory.js.map +1 -0
- package/dist/datastoreSupport.d.ts +31 -0
- package/dist/datastoreSupport.d.ts.map +1 -0
- package/dist/datastoreSupport.js +82 -0
- package/dist/datastoreSupport.js.map +1 -0
- package/dist/events/events.d.ts +198 -0
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/events.js +157 -0
- package/dist/events/events.js.map +1 -0
- package/dist/experimentalAccess.d.ts +15 -0
- package/dist/experimentalAccess.d.ts.map +1 -0
- package/dist/experimentalAccess.js +46 -0
- package/dist/experimentalAccess.js.map +1 -0
- package/dist/exposedInternalTypes.d.ts +100 -0
- package/dist/exposedInternalTypes.d.ts.map +1 -0
- package/dist/exposedInternalTypes.js +19 -0
- package/dist/exposedInternalTypes.js.map +1 -0
- package/dist/exposedUtilityTypes.d.ts +63 -0
- package/dist/exposedUtilityTypes.d.ts.map +1 -0
- package/dist/exposedUtilityTypes.js +7 -0
- package/dist/exposedUtilityTypes.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/internalTypes.d.ts +39 -0
- package/dist/internalTypes.d.ts.map +1 -0
- package/dist/internalTypes.js +14 -0
- package/dist/internalTypes.js.map +1 -0
- package/dist/latestMapValueManager.d.ts +182 -0
- package/dist/latestMapValueManager.d.ts.map +1 -0
- package/dist/latestMapValueManager.js +206 -0
- package/dist/latestMapValueManager.js.map +1 -0
- package/dist/latestValueControls.d.ts +44 -0
- package/dist/latestValueControls.d.ts.map +1 -0
- package/dist/latestValueControls.js +28 -0
- package/dist/latestValueControls.js.map +1 -0
- package/dist/latestValueManager.d.ts +69 -0
- package/dist/latestValueManager.d.ts.map +1 -0
- package/dist/latestValueManager.js +100 -0
- package/dist/latestValueManager.js.map +1 -0
- package/dist/latestValueTypes.d.ts +44 -0
- package/dist/latestValueTypes.d.ts.map +1 -0
- package/dist/latestValueTypes.js +7 -0
- package/dist/latestValueTypes.js.map +1 -0
- package/dist/notificationsManager.d.ts +101 -0
- package/dist/notificationsManager.d.ts.map +1 -0
- package/dist/notificationsManager.js +82 -0
- package/dist/notificationsManager.js.map +1 -0
- package/dist/package.json +15 -0
- package/dist/presence.d.ts +180 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +23 -0
- package/dist/presence.js.map +1 -0
- package/dist/presenceDatastoreManager.d.ts +91 -0
- package/dist/presenceDatastoreManager.d.ts.map +1 -0
- package/dist/presenceDatastoreManager.js +248 -0
- package/dist/presenceDatastoreManager.js.map +1 -0
- package/dist/presenceManager.d.ts +20 -0
- package/dist/presenceManager.d.ts.map +1 -0
- package/dist/presenceManager.js +104 -0
- package/dist/presenceManager.js.map +1 -0
- package/dist/presenceStates.d.ts +78 -0
- package/dist/presenceStates.d.ts.map +1 -0
- package/dist/presenceStates.js +182 -0
- package/dist/presenceStates.js.map +1 -0
- package/dist/stateDatastore.d.ts +35 -0
- package/dist/stateDatastore.d.ts.map +1 -0
- package/dist/stateDatastore.js +26 -0
- package/dist/stateDatastore.js.map +1 -0
- package/dist/systemWorkspace.d.ts +51 -0
- package/dist/systemWorkspace.d.ts.map +1 -0
- package/dist/systemWorkspace.js +180 -0
- package/dist/systemWorkspace.js.map +1 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/valueManager.d.ts +19 -0
- package/dist/valueManager.d.ts.map +1 -0
- package/dist/valueManager.js +26 -0
- package/dist/valueManager.js.map +1 -0
- package/lib/alpha.d.ts +58 -0
- package/lib/baseTypes.d.ts +24 -0
- package/lib/baseTypes.d.ts.map +1 -0
- package/lib/baseTypes.js +6 -0
- package/lib/baseTypes.js.map +1 -0
- package/lib/container-definitions/containerExtensions.d.ts +137 -0
- package/lib/container-definitions/containerExtensions.d.ts.map +1 -0
- package/lib/container-definitions/containerExtensions.js +6 -0
- package/lib/container-definitions/containerExtensions.js.map +1 -0
- package/lib/container-definitions/index.d.ts +7 -0
- package/lib/container-definitions/index.d.ts.map +1 -0
- package/lib/container-definitions/index.js +6 -0
- package/lib/container-definitions/index.js.map +1 -0
- package/lib/container-definitions/runtime.d.ts +12 -0
- package/lib/container-definitions/runtime.d.ts.map +1 -0
- package/lib/container-definitions/runtime.js +6 -0
- package/lib/container-definitions/runtime.js.map +1 -0
- package/lib/core-interfaces/exposedUtilityTypes.d.ts +446 -0
- package/lib/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
- package/lib/core-interfaces/exposedUtilityTypes.js +10 -0
- package/lib/core-interfaces/exposedUtilityTypes.js.map +1 -0
- package/lib/core-interfaces/index.d.ts +10 -0
- package/lib/core-interfaces/index.d.ts.map +1 -0
- package/lib/core-interfaces/index.js +6 -0
- package/lib/core-interfaces/index.js.map +1 -0
- package/lib/core-interfaces/jsonDeserialized.d.ts +109 -0
- package/lib/core-interfaces/jsonDeserialized.d.ts.map +1 -0
- package/lib/core-interfaces/jsonDeserialized.js +6 -0
- package/lib/core-interfaces/jsonDeserialized.js.map +1 -0
- package/lib/core-interfaces/jsonSerializable.d.ts +120 -0
- package/lib/core-interfaces/jsonSerializable.d.ts.map +1 -0
- package/lib/core-interfaces/jsonSerializable.js +6 -0
- package/lib/core-interfaces/jsonSerializable.js.map +1 -0
- package/lib/core-interfaces/jsonSerializationErrors.d.ts +31 -0
- package/lib/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
- package/lib/core-interfaces/jsonSerializationErrors.js +6 -0
- package/lib/core-interfaces/jsonSerializationErrors.js.map +1 -0
- package/lib/core-interfaces/jsonType.d.ts +29 -0
- package/lib/core-interfaces/jsonType.d.ts.map +1 -0
- package/lib/core-interfaces/jsonType.js +6 -0
- package/lib/core-interfaces/jsonType.js.map +1 -0
- package/lib/datastorePresenceManagerFactory.d.ts +48 -0
- package/lib/datastorePresenceManagerFactory.d.ts.map +1 -0
- package/lib/datastorePresenceManagerFactory.js +75 -0
- package/lib/datastorePresenceManagerFactory.js.map +1 -0
- package/lib/datastoreSupport.d.ts +31 -0
- package/lib/datastoreSupport.d.ts.map +1 -0
- package/lib/datastoreSupport.js +77 -0
- package/lib/datastoreSupport.js.map +1 -0
- package/lib/events/events.d.ts +198 -0
- package/lib/events/events.d.ts.map +1 -0
- package/lib/events/events.js +152 -0
- package/lib/events/events.js.map +1 -0
- package/lib/experimentalAccess.d.ts +15 -0
- package/lib/experimentalAccess.d.ts.map +1 -0
- package/lib/experimentalAccess.js +42 -0
- package/lib/experimentalAccess.js.map +1 -0
- package/lib/exposedInternalTypes.d.ts +100 -0
- package/lib/exposedInternalTypes.d.ts.map +1 -0
- package/lib/exposedInternalTypes.js +16 -0
- package/lib/exposedInternalTypes.js.map +1 -0
- package/lib/exposedUtilityTypes.d.ts +63 -0
- package/lib/exposedUtilityTypes.d.ts.map +1 -0
- package/lib/exposedUtilityTypes.js +6 -0
- package/lib/exposedUtilityTypes.js.map +1 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/internalTypes.d.ts +39 -0
- package/lib/internalTypes.d.ts.map +1 -0
- package/lib/internalTypes.js +11 -0
- package/lib/internalTypes.js.map +1 -0
- package/lib/latestMapValueManager.d.ts +182 -0
- package/lib/latestMapValueManager.d.ts.map +1 -0
- package/lib/latestMapValueManager.js +202 -0
- package/lib/latestMapValueManager.js.map +1 -0
- package/lib/latestValueControls.d.ts +44 -0
- package/lib/latestValueControls.d.ts.map +1 -0
- package/lib/latestValueControls.js +24 -0
- package/lib/latestValueControls.js.map +1 -0
- package/lib/latestValueManager.d.ts +69 -0
- package/lib/latestValueManager.d.ts.map +1 -0
- package/lib/latestValueManager.js +96 -0
- package/lib/latestValueManager.js.map +1 -0
- package/lib/latestValueTypes.d.ts +44 -0
- package/lib/latestValueTypes.d.ts.map +1 -0
- package/lib/latestValueTypes.js +6 -0
- package/lib/latestValueTypes.js.map +1 -0
- package/lib/notificationsManager.d.ts +101 -0
- package/lib/notificationsManager.d.ts.map +1 -0
- package/lib/notificationsManager.js +78 -0
- package/lib/notificationsManager.js.map +1 -0
- package/lib/presence.d.ts +180 -0
- package/lib/presence.d.ts.map +1 -0
- package/lib/presence.js +20 -0
- package/lib/presence.js.map +1 -0
- package/lib/presenceDatastoreManager.d.ts +91 -0
- package/lib/presenceDatastoreManager.d.ts.map +1 -0
- package/lib/presenceDatastoreManager.js +244 -0
- package/lib/presenceDatastoreManager.js.map +1 -0
- package/lib/presenceManager.d.ts +20 -0
- package/lib/presenceManager.d.ts.map +1 -0
- package/lib/presenceManager.js +100 -0
- package/lib/presenceManager.js.map +1 -0
- package/lib/presenceStates.d.ts +78 -0
- package/lib/presenceStates.d.ts.map +1 -0
- package/lib/presenceStates.js +177 -0
- package/lib/presenceStates.js.map +1 -0
- package/lib/stateDatastore.d.ts +35 -0
- package/lib/stateDatastore.d.ts.map +1 -0
- package/lib/stateDatastore.js +21 -0
- package/lib/stateDatastore.js.map +1 -0
- package/lib/systemWorkspace.d.ts +51 -0
- package/lib/systemWorkspace.d.ts.map +1 -0
- package/lib/systemWorkspace.js +176 -0
- package/lib/systemWorkspace.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types.d.ts +92 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/valueManager.d.ts +19 -0
- package/lib/valueManager.d.ts.map +1 -0
- package/lib/valueManager.js +21 -0
- package/lib/valueManager.js.map +1 -0
- package/package.json +175 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { ISessionClient } from "./presence.js";
|
|
6
|
+
import type { ISubscribable } from "@fluidframework/presence/internal/events";
|
|
7
|
+
import type { InternalTypes } from "@fluidframework/presence/internal/exposedInternalTypes";
|
|
8
|
+
import type { InternalUtilityTypes } from "@fluidframework/presence/internal/exposedUtilityTypes";
|
|
9
|
+
/**
|
|
10
|
+
* @sealed
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export interface NotificationsManagerEvents {
|
|
14
|
+
/**
|
|
15
|
+
* Raised when notification is received, but no subscribers were found.
|
|
16
|
+
*
|
|
17
|
+
* @eventProperty
|
|
18
|
+
*/
|
|
19
|
+
unattendedNotification: (name: string, sender: ISessionClient, ...content: unknown[]) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An object which allows the registration of listeners so that subscribers can be
|
|
23
|
+
* notified when a notification happens.
|
|
24
|
+
*
|
|
25
|
+
* @sealed
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export interface NotificationSubscribable<E extends InternalUtilityTypes.NotificationEvents<E>> {
|
|
29
|
+
/**
|
|
30
|
+
* Register a notification listener.
|
|
31
|
+
* @param notificationName - the name of the notification
|
|
32
|
+
* @param listener - the handler to run when the notification is received from other client
|
|
33
|
+
* @returns a function which will deregister the listener when run. This function
|
|
34
|
+
* has undefined behavior if called more than once.
|
|
35
|
+
*/
|
|
36
|
+
on<K extends keyof InternalUtilityTypes.NotificationEvents<E>>(notificationName: K, listener: (sender: ISessionClient, ...args: InternalUtilityTypes.JsonDeserializedParameters<E[K]>) => void): () => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Record of notification subscriptions.
|
|
40
|
+
*
|
|
41
|
+
* @sealed
|
|
42
|
+
* @alpha
|
|
43
|
+
*/
|
|
44
|
+
export type NotificationSubscriptions<E extends InternalUtilityTypes.NotificationEvents<E>> = {
|
|
45
|
+
[K in string & keyof InternalUtilityTypes.NotificationEvents<E>]: (sender: ISessionClient, ...args: InternalUtilityTypes.JsonDeserializedParameters<E[K]>) => void;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Interface for a notification emitter that can send typed notification to other clients.
|
|
49
|
+
*
|
|
50
|
+
* @sealed
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export interface NotificationEmitter<E extends InternalUtilityTypes.NotificationEvents<E>> {
|
|
54
|
+
/**
|
|
55
|
+
* Emits a notification with the specified name and arguments, notifying all clients.
|
|
56
|
+
* @param notificationName - the name of the notification to fire
|
|
57
|
+
* @param args - the arguments sent with the notification
|
|
58
|
+
*/
|
|
59
|
+
broadcast<K extends string & keyof InternalUtilityTypes.NotificationEvents<E>>(notificationName: K, ...args: Parameters<E[K]>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Emits a notification with the specified name and arguments, notifying a single client.
|
|
62
|
+
* @param notificationName - the name of the notification to fire
|
|
63
|
+
* @param targetClient - the single client to notify
|
|
64
|
+
* @param args - the arguments sent with the notification
|
|
65
|
+
*/
|
|
66
|
+
unicast<K extends string & keyof InternalUtilityTypes.NotificationEvents<E>>(notificationName: K, targetClient: ISessionClient, ...args: Parameters<E[K]>): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Value manager that provides notifications from this client to others and subscription
|
|
70
|
+
* to their notifications.
|
|
71
|
+
*
|
|
72
|
+
* @remarks Create using {@link Notifications} registered to {@link PresenceStates}.
|
|
73
|
+
*
|
|
74
|
+
* @sealed
|
|
75
|
+
* @alpha
|
|
76
|
+
*/
|
|
77
|
+
export interface NotificationsManager<T extends InternalUtilityTypes.NotificationEvents<T>> {
|
|
78
|
+
/**
|
|
79
|
+
* Events for Notifications manager.
|
|
80
|
+
*/
|
|
81
|
+
readonly events: ISubscribable<NotificationsManagerEvents>;
|
|
82
|
+
/**
|
|
83
|
+
* Send notifications to other clients.
|
|
84
|
+
*/
|
|
85
|
+
readonly emit: NotificationEmitter<T>;
|
|
86
|
+
/**
|
|
87
|
+
* Provides subscription to notifications from other clients.
|
|
88
|
+
*/
|
|
89
|
+
readonly notifications: NotificationSubscribable<T>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Factory for creating a {@link NotificationsManager}.
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Typescript inference for `Notifications` is not working correctly yet.
|
|
96
|
+
* Explicitly specify generics to make result types usable.
|
|
97
|
+
*
|
|
98
|
+
* @alpha
|
|
99
|
+
*/
|
|
100
|
+
export declare function Notifications<T extends InternalUtilityTypes.NotificationEvents<T>, Key extends string = string>(initialSubscriptions: Partial<NotificationSubscriptions<T>>): InternalTypes.ManagerFactory<Key, InternalTypes.ValueRequiredState<InternalTypes.NotificationType>, NotificationsManager<T>>;
|
|
101
|
+
//# sourceMappingURL=notificationsManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationsManager.d.ts","sourceRoot":"","sources":["../src/notificationsManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,KAAK,EAAU,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uDAAuD,CAAC;AAElG;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,sBAAsB,EAAE,CACvB,IAAI,EAAE,MAAM,EACZ,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AC,EACnB,YAAY,EAAE,cAAc,EAC5B,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACvB,IAAI,CAAC;CACR;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACzF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,0BAA0B,CAAC,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;CACpD;AA8FD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC5B,CAAC,SAAS,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAAC,EACpD,GAAG,SAAS,MAAM,GAAG,MAAM,EAE3B,oBAAoB,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,GACzD,aAAa,CAAC,cAAc,CAC9B,GAAG,EACH,aAAa,CAAC,kBAAkB,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAChE,oBAAoB,CAAC,CAAC,CAAC,CACvB,CAuBA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { datastoreFromHandle } from "./stateDatastore.js";
|
|
6
|
+
import { brandIVM } from "./valueManager.js";
|
|
7
|
+
import { createEmitter } from "@fluidframework/presence/internal/events";
|
|
8
|
+
/**
|
|
9
|
+
* Object.keys retyped to support specific records keys and
|
|
10
|
+
* branded string-based keys.
|
|
11
|
+
*/
|
|
12
|
+
const recordKeys = Object.keys;
|
|
13
|
+
class NotificationsManagerImpl {
|
|
14
|
+
constructor(key, datastore, initialSubscriptions) {
|
|
15
|
+
this.key = key;
|
|
16
|
+
this.datastore = datastore;
|
|
17
|
+
this.events = createEmitter();
|
|
18
|
+
this.emit = {
|
|
19
|
+
broadcast: (name, ...args) => {
|
|
20
|
+
this.datastore.localUpdate(this.key,
|
|
21
|
+
// @ts-expect-error TODO
|
|
22
|
+
{ rev: 0, timestamp: 0, value: { name, args: [...args] }, ignoreUnmonitored: true }, true);
|
|
23
|
+
},
|
|
24
|
+
unicast: (name, targetClient, ...args) => {
|
|
25
|
+
this.datastore.localUpdate(this.key,
|
|
26
|
+
// @ts-expect-error TODO
|
|
27
|
+
{ rev: 0, timestamp: 0, value: { name, args: [...args] }, ignoreUnmonitored: true }, targetClient);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
// Workaround for types
|
|
31
|
+
this.notificationsInternal =
|
|
32
|
+
// @ts-expect-error TODO
|
|
33
|
+
createEmitter();
|
|
34
|
+
// @ts-expect-error TODO
|
|
35
|
+
this.notifications = this.notificationsInternal;
|
|
36
|
+
// Add event listeners provided at instantiation
|
|
37
|
+
for (const subscriptionName of recordKeys(initialSubscriptions)) {
|
|
38
|
+
// Lingering Event typing issues with Notifications specialization requires
|
|
39
|
+
// this cast. The only thing that really matters is that name is a string.
|
|
40
|
+
const name = subscriptionName;
|
|
41
|
+
const value = initialSubscriptions[subscriptionName];
|
|
42
|
+
// This check should not be needed while using exactOptionalPropertyTypes, but
|
|
43
|
+
// typescript appears to ignore that with Partial<>. Good to be defensive
|
|
44
|
+
// against callers sending `undefined` anyway.
|
|
45
|
+
if (value !== undefined) {
|
|
46
|
+
this.notificationsInternal.on(name, value);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
update(client, _received, value) {
|
|
51
|
+
const eventName = value.value.name;
|
|
52
|
+
if (this.notificationsInternal.hasListeners(eventName)) {
|
|
53
|
+
// Without schema validation, we don't know that the args are the correct type.
|
|
54
|
+
// For now we assume the user is sending the correct types and there is no corruption along the way.
|
|
55
|
+
const args = [client, ...value.value.args];
|
|
56
|
+
this.notificationsInternal.emit(eventName, ...args);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.events.emit("unattendedNotification", value.value.name, client, ...value.value.args);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Factory for creating a {@link NotificationsManager}.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* Typescript inference for `Notifications` is not working correctly yet.
|
|
68
|
+
* Explicitly specify generics to make result types usable.
|
|
69
|
+
*
|
|
70
|
+
* @alpha
|
|
71
|
+
*/
|
|
72
|
+
export function Notifications(initialSubscriptions) {
|
|
73
|
+
const factory = (key, datastoreHandle) => ({
|
|
74
|
+
manager: brandIVM(new NotificationsManagerImpl(key, datastoreFromHandle(datastoreHandle), initialSubscriptions)),
|
|
75
|
+
});
|
|
76
|
+
return Object.assign(factory, { instanceBase: NotificationsManagerImpl });
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=notificationsManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationsManager.js","sourceRoot":"","sources":["../src/notificationsManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAuB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAoHzE;;;GAGG;AACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAiE,CAAC;AAE5F,MAAM,wBAAwB;IAuC7B,YACkB,GAAQ,EACR,SAGhB,EACD,oBAA2D;QAL1C,QAAG,GAAH,GAAG,CAAK;QACR,cAAS,GAAT,SAAS,CAGzB;QAlCc,WAAM,GAAG,aAAa,EAA8B,CAAC;QAErD,SAAI,GAA2B;YAC9C,SAAS,EAAE,CAAC,IAAI,EAAE,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tB,SAAiB,EACjB,KAAuE;QAEvE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,IAAkD,CAAC;QACjF,IAAI,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YACxD,+EAA+E;YAC/E,oGAAoG;YACpG,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAExC,CAAC;YACF,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,MAAM,CAAC,IAAI,CACf,wBAAwB,EACxB,KAAK,CAAC,KAAK,CAAC,IAAI,EAChB,MAAM,EACN,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CACnB,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAI5B,oBAA2D;IAM3D,MAAM,OAAO,GAAG,CACf,GAAQ,EACR,eAGC,EAGA,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,QAAQ,CAKhB,IAAI,wBAAwB,CAC3B,GAAG,EACH,mBAAmB,CAAC,eAAe,CAAC,EACpC,oBAAoB,CACpB,CACD;KACD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,wBAAwB,EAAE,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueManager } from \"./internalTypes.js\";\nimport type { ISessionClient } from \"./presence.js\";\nimport { datastoreFromHandle, type StateDatastore } from \"./stateDatastore.js\";\nimport { brandIVM } from \"./valueManager.js\";\n\nimport type { Events, ISubscribable } from \"@fluidframework/presence/internal/events\";\nimport { createEmitter } from \"@fluidframework/presence/internal/events\";\nimport type { InternalTypes } from \"@fluidframework/presence/internal/exposedInternalTypes\";\nimport type { InternalUtilityTypes } from \"@fluidframework/presence/internal/exposedUtilityTypes\";\n\n/**\n * @sealed\n * @alpha\n */\nexport interface NotificationsManagerEvents {\n\t/**\n\t * Raised when notification is received, but no subscribers were found.\n\t *\n\t * @eventProperty\n\t */\n\tunattendedNotification: (\n\t\tname: string,\n\t\tsender: ISessionClient,\n\t\t...content: unknown[]\n\t) => void;\n}\n\n/**\n * An object which allows the registration of listeners so that subscribers can be\n * notified when a notification happens.\n *\n * @sealed\n * @alpha\n */\nexport interface NotificationSubscribable<\n\tE extends InternalUtilityTypes.NotificationEvents<E>,\n> {\n\t/**\n\t * Register a notification listener.\n\t * @param notificationName - the name of the notification\n\t * @param listener - the handler to run when the notification is received from other client\n\t * @returns a function which will deregister the listener when run. This function\n\t * has undefined behavior if called more than once.\n\t */\n\ton<K extends keyof InternalUtilityTypes.NotificationEvents<E>>(\n\t\tnotificationName: K,\n\t\tlistener: (\n\t\t\tsender: ISessionClient,\n\t\t\t...args: InternalUtilityTypes.JsonDeserializedParameters<E[K]>\n\t\t) => void,\n\t): () => void;\n}\n\n/**\n * Record of notification subscriptions.\n *\n * @sealed\n * @alpha\n */\nexport type NotificationSubscriptions<E extends InternalUtilityTypes.NotificationEvents<E>> = {\n\t[K in string & keyof InternalUtilityTypes.NotificationEvents<E>]: (\n\t\tsender: ISessionClient,\n\t\t...args: InternalUtilityTypes.JsonDeserializedParameters<E[K]>\n\t) => void;\n};\n\n/**\n * Interface for a notification emitter that can send typed notification to other clients.\n *\n * @sealed\n * @alpha\n */\nexport interface NotificationEmitter<E extends InternalUtilityTypes.NotificationEvents<E>> {\n\t/**\n\t * Emits a notification with the specified name and arguments, notifying all clients.\n\t * @param notificationName - the name of the notification to fire\n\t * @param args - the arguments sent with the notification\n\t */\n\tbroadcast<K extends string & keyof InternalUtilityTypes.NotificationEvents<E>>(\n\t\tnotificationName: K,\n\t\t...args: Parameters<E[K]>\n\t): void;\n\n\t/**\n\t * Emits a notification with the specified name and arguments, notifying a single client.\n\t * @param notificationName - the name of the notification to fire\n\t * @param targetClient - the single client to notify\n\t * @param args - the arguments sent with the notification\n\t */\n\tunicast<K extends string & keyof InternalUtilityTypes.NotificationEvents<E>>(\n\t\tnotificationName: K,\n\t\ttargetClient: ISessionClient,\n\t\t...args: Parameters<E[K]>\n\t): void;\n}\n\n/**\n * Value manager that provides notifications from this client to others and subscription\n * to their notifications.\n *\n * @remarks Create using {@link Notifications} registered to {@link PresenceStates}.\n *\n * @sealed\n * @alpha\n */\nexport interface NotificationsManager<T extends InternalUtilityTypes.NotificationEvents<T>> {\n\t/**\n\t * Events for Notifications manager.\n\t */\n\treadonly events: ISubscribable<NotificationsManagerEvents>;\n\n\t/**\n\t * Send notifications to other clients.\n\t */\n\treadonly emit: NotificationEmitter<T>;\n\n\t/**\n\t * Provides subscription to notifications from other clients.\n\t */\n\treadonly notifications: NotificationSubscribable<T>;\n}\n\n/**\n * Object.keys retyped to support specific records keys and\n * branded string-based keys.\n */\nconst recordKeys = Object.keys as <K extends string>(o: Partial<Record<K, unknown>>) => K[];\n\nclass NotificationsManagerImpl<\n\tT extends InternalUtilityTypes.NotificationEvents<T>,\n\tKey extends string,\n> implements\n\t\tNotificationsManager<T>,\n\t\tValueManager<\n\t\t\tInternalTypes.NotificationType,\n\t\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>\n\t\t>\n{\n\tpublic readonly events = createEmitter<NotificationsManagerEvents>();\n\n\tpublic readonly emit: NotificationEmitter<T> = {\n\t\tbroadcast: (name, ...args) => {\n\t\t\tthis.datastore.localUpdate(\n\t\t\t\tthis.key,\n\t\t\t\t// @ts-expect-error TODO\n\t\t\t\t{ rev: 0, timestamp: 0, value: { name, args: [...args] }, ignoreUnmonitored: true },\n\t\t\t\ttrue,\n\t\t\t);\n\t\t},\n\t\tunicast: (name, targetClient, ...args) => {\n\t\t\tthis.datastore.localUpdate(\n\t\t\t\tthis.key,\n\t\t\t\t// @ts-expect-error TODO\n\t\t\t\t{ rev: 0, timestamp: 0, value: { name, args: [...args] }, ignoreUnmonitored: true },\n\t\t\t\ttargetClient,\n\t\t\t);\n\t\t},\n\t};\n\n\t// Workaround for types\n\tprivate readonly notificationsInternal =\n\t\t// @ts-expect-error TODO\n\t\tcreateEmitter<NotificationSubscriptions<T>>();\n\n\t// @ts-expect-error TODO\n\tpublic readonly notifications: NotificationSubscribable<T> = this.notificationsInternal;\n\n\tpublic constructor(\n\t\tprivate readonly key: Key,\n\t\tprivate readonly datastore: StateDatastore<\n\t\t\tKey,\n\t\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>\n\t\t>,\n\t\tinitialSubscriptions: Partial<NotificationSubscriptions<T>>,\n\t) {\n\t\t// Add event listeners provided at instantiation\n\t\tfor (const subscriptionName of recordKeys(initialSubscriptions)) {\n\t\t\t// Lingering Event typing issues with Notifications specialization requires\n\t\t\t// this cast. The only thing that really matters is that name is a string.\n\t\t\tconst name = subscriptionName as keyof Events<NotificationSubscriptions<T>>;\n\t\t\tconst value = initialSubscriptions[subscriptionName];\n\t\t\t// This check should not be needed while using exactOptionalPropertyTypes, but\n\t\t\t// typescript appears to ignore that with Partial<>. Good to be defensive\n\t\t\t// against callers sending `undefined` anyway.\n\t\t\tif (value !== undefined) {\n\t\t\t\tthis.notificationsInternal.on(name, value);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic update(\n\t\tclient: ISessionClient,\n\t\t_received: number,\n\t\tvalue: InternalTypes.ValueRequiredState<InternalTypes.NotificationType>,\n\t): void {\n\t\tconst eventName = value.value.name as keyof Events<NotificationSubscriptions<T>>;\n\t\tif (this.notificationsInternal.hasListeners(eventName)) {\n\t\t\t// Without schema validation, we don't know that the args are the correct type.\n\t\t\t// For now we assume the user is sending the correct types and there is no corruption along the way.\n\t\t\tconst args = [client, ...value.value.args] as Parameters<\n\t\t\t\tNotificationSubscriptions<T>[typeof eventName]\n\t\t\t>;\n\t\t\tthis.notificationsInternal.emit(eventName, ...args);\n\t\t} else {\n\t\t\tthis.events.emit(\n\t\t\t\t\"unattendedNotification\",\n\t\t\t\tvalue.value.name,\n\t\t\t\tclient,\n\t\t\t\t...value.value.args,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Factory for creating a {@link NotificationsManager}.\n *\n * @remarks\n * Typescript inference for `Notifications` is not working correctly yet.\n * Explicitly specify generics to make result types usable.\n *\n * @alpha\n */\nexport function Notifications<\n\tT extends InternalUtilityTypes.NotificationEvents<T>,\n\tKey extends string = string,\n>(\n\tinitialSubscriptions: Partial<NotificationSubscriptions<T>>,\n): InternalTypes.ManagerFactory<\n\tKey,\n\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>,\n\tNotificationsManager<T>\n> {\n\tconst factory = (\n\t\tkey: Key,\n\t\tdatastoreHandle: InternalTypes.StateDatastoreHandle<\n\t\t\tKey,\n\t\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>\n\t\t>,\n\t): {\n\t\tmanager: InternalTypes.StateValue<NotificationsManager<T>>;\n\t} => ({\n\t\tmanager: brandIVM<\n\t\t\tNotificationsManagerImpl<T, Key>,\n\t\t\tInternalTypes.NotificationType,\n\t\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>\n\t\t>(\n\t\t\tnew NotificationsManagerImpl(\n\t\t\t\tkey,\n\t\t\t\tdatastoreFromHandle(datastoreHandle),\n\t\t\t\tinitialSubscriptions,\n\t\t\t),\n\t\t),\n\t});\n\treturn Object.assign(factory, { instanceBase: NotificationsManagerImpl });\n}\n"]}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { SessionId } from "@fluidframework/id-compressor";
|
|
6
|
+
import type { ClientConnectionId } from "./baseTypes.js";
|
|
7
|
+
import type { PresenceNotifications, PresenceNotificationsSchema, PresenceStates, PresenceStatesSchema, PresenceWorkspaceAddress } from "./types.js";
|
|
8
|
+
import type { ISubscribable } from "@fluidframework/presence/internal/events";
|
|
9
|
+
/**
|
|
10
|
+
* A Fluid client session identifier.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Each client once connected to a session is given a unique identifier for the
|
|
14
|
+
* duration of the session. If a client disconnects and reconnects, it will
|
|
15
|
+
* retain its identifier. Prefer use of {@link ISessionClient} as a way to
|
|
16
|
+
* identify clients in a session. {@link ISessionClient.sessionId} will provide
|
|
17
|
+
* the session ID.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export type ClientSessionId = SessionId & {
|
|
22
|
+
readonly ClientSessionId: "ClientSessionId";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The connection status of the {@link ISessionClient}.
|
|
26
|
+
*
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
29
|
+
export declare const SessionClientStatus: {
|
|
30
|
+
/**
|
|
31
|
+
* The session client is connected to the Fluid service.
|
|
32
|
+
*/
|
|
33
|
+
readonly Connected: "Connected";
|
|
34
|
+
/**
|
|
35
|
+
* The session client is not connected to the Fluid service.
|
|
36
|
+
*/
|
|
37
|
+
readonly Disconnected: "Disconnected";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Represents the connection status of an {@link ISessionClient}.
|
|
41
|
+
*
|
|
42
|
+
* This type can be either `'Connected'` or `'Disconnected'`, indicating whether
|
|
43
|
+
* the session client is currently connected to the Fluid service.
|
|
44
|
+
*
|
|
45
|
+
* When `'Disconnected'`:
|
|
46
|
+
* - State changes are kept locally and communicated to others upon reconnect.
|
|
47
|
+
* - Notification requests are discarded (silently).
|
|
48
|
+
*
|
|
49
|
+
* @alpha
|
|
50
|
+
*/
|
|
51
|
+
export type SessionClientStatus = (typeof SessionClientStatus)[keyof typeof SessionClientStatus];
|
|
52
|
+
/**
|
|
53
|
+
* A client within a Fluid session (period of container connectivity to service).
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Note: This is very preliminary session client representation.
|
|
57
|
+
*
|
|
58
|
+
* `ISessionClient` should be used as key to distinguish between different
|
|
59
|
+
* clients as they join, rejoin, and disconnect from a session. While a
|
|
60
|
+
* client's {@link ClientConnectionId} from {@link ISessionClient.getConnectionStatus}
|
|
61
|
+
* may change over time, `ISessionClient` will be fixed.
|
|
62
|
+
*
|
|
63
|
+
* @privateRemarks
|
|
64
|
+
* As this is evolved, pay attention to how this relates to Audience, Service
|
|
65
|
+
* Audience, and Quorum representations of clients and users.
|
|
66
|
+
*
|
|
67
|
+
* @sealed
|
|
68
|
+
* @alpha
|
|
69
|
+
*/
|
|
70
|
+
export interface ISessionClient<SpecificSessionClientId extends ClientSessionId = ClientSessionId> {
|
|
71
|
+
/**
|
|
72
|
+
* The session ID of the client that is stable over all connections.
|
|
73
|
+
*/
|
|
74
|
+
readonly sessionId: SpecificSessionClientId;
|
|
75
|
+
/**
|
|
76
|
+
* Get current client connection ID.
|
|
77
|
+
*
|
|
78
|
+
* @returns Current client connection ID.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* Connection ID will change on reconnect.
|
|
82
|
+
*
|
|
83
|
+
* If {@link ISessionClient.getConnectionStatus} is {@link (SessionClientStatus:variable).Disconnected}, this will represent the last known connection ID.
|
|
84
|
+
*/
|
|
85
|
+
getConnectionId(): ClientConnectionId;
|
|
86
|
+
/**
|
|
87
|
+
* Get connection status of session client.
|
|
88
|
+
*
|
|
89
|
+
* @returns Connection status of session client.
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
getConnectionStatus(): SessionClientStatus;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Utility type limiting to a specific session client. (A session client with
|
|
96
|
+
* a specific session ID - not just any session ID.)
|
|
97
|
+
*
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
export type SpecificSessionClient<SpecificSessionClientId extends ClientSessionId> = string extends SpecificSessionClientId ? never : ISessionClient<SpecificSessionClientId>;
|
|
101
|
+
/**
|
|
102
|
+
* @sealed
|
|
103
|
+
* @alpha
|
|
104
|
+
*/
|
|
105
|
+
export interface PresenceEvents {
|
|
106
|
+
/**
|
|
107
|
+
* Raised when new client joins session.
|
|
108
|
+
*
|
|
109
|
+
* @eventProperty
|
|
110
|
+
*/
|
|
111
|
+
attendeeJoined: (attendee: ISessionClient) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Raised when client appears disconnected from session.
|
|
114
|
+
*
|
|
115
|
+
* @eventProperty
|
|
116
|
+
*/
|
|
117
|
+
attendeeDisconnected: (attendee: ISessionClient) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Raised when a workspace is activated within the session.
|
|
120
|
+
*
|
|
121
|
+
* "Activated" means that a workspace is being used by a client and this
|
|
122
|
+
* client is seeing information for the first time.
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
* Local workspaces may be passively acquired/registered when this event
|
|
126
|
+
* is raised. For a notifications workspace, that lazy registration must
|
|
127
|
+
* be done before the event handler returns to ensure no notifications
|
|
128
|
+
* are missed.
|
|
129
|
+
*/
|
|
130
|
+
workspaceActivated: (workspaceAddress: PresenceWorkspaceAddress, type: "States" | "Notifications" | "Unknown") => void;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Presence represents known clients within a session and their custom states and notifications.
|
|
134
|
+
*
|
|
135
|
+
* @sealed
|
|
136
|
+
* @alpha
|
|
137
|
+
*/
|
|
138
|
+
export interface IPresence {
|
|
139
|
+
/**
|
|
140
|
+
* Events for Notifications manager.
|
|
141
|
+
*/
|
|
142
|
+
readonly events: ISubscribable<PresenceEvents>;
|
|
143
|
+
/**
|
|
144
|
+
* Get all attendees in the session.
|
|
145
|
+
*
|
|
146
|
+
* @remarks
|
|
147
|
+
* Attendee states are dynamic and will change as clients join and leave
|
|
148
|
+
* the session.
|
|
149
|
+
*/
|
|
150
|
+
getAttendees(): ReadonlySet<ISessionClient>;
|
|
151
|
+
/**
|
|
152
|
+
* Lookup a specific attendee in the session.
|
|
153
|
+
*
|
|
154
|
+
* @param clientId - Client connection or session ID
|
|
155
|
+
*/
|
|
156
|
+
getAttendee(clientId: ClientConnectionId | ClientSessionId): ISessionClient;
|
|
157
|
+
/**
|
|
158
|
+
* Get this client's session client.
|
|
159
|
+
*
|
|
160
|
+
* @returns This client's session client.
|
|
161
|
+
*/
|
|
162
|
+
getMyself(): ISessionClient;
|
|
163
|
+
/**
|
|
164
|
+
* Acquires a PresenceStates workspace from store or adds new one.
|
|
165
|
+
*
|
|
166
|
+
* @param workspaceAddress - Address of the requested PresenceStates Workspace
|
|
167
|
+
* @param requestedContent - Requested states for the workspace
|
|
168
|
+
* @returns A PresenceStates workspace
|
|
169
|
+
*/
|
|
170
|
+
getStates<StatesSchema extends PresenceStatesSchema>(workspaceAddress: PresenceWorkspaceAddress, requestedContent: StatesSchema): PresenceStates<StatesSchema>;
|
|
171
|
+
/**
|
|
172
|
+
* Acquires a Notifications workspace from store or adds new one.
|
|
173
|
+
*
|
|
174
|
+
* @param workspaceAddress - Address of the requested Notifications Workspace
|
|
175
|
+
* @param requestedContent - Requested notifications for the workspace
|
|
176
|
+
* @returns A Notifications workspace
|
|
177
|
+
*/
|
|
178
|
+
getNotifications<NotificationsSchema extends PresenceNotificationsSchema>(notificationsId: PresenceWorkspaceAddress, requestedContent: NotificationsSchema): PresenceNotifications<NotificationsSchema>;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=presence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EACX,qBA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;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAE/C;;;;;;OAMG;IACH,YAAY,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC;IAE5C;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,eAAe,GAAG,cAAc,CAAC;IAE5E;;;;OAIG;IACH,SAAS,IAAI,cAAc,CAAC;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,YAAY,SAAS,oBAAoB,EAClD,gBAAgB,EAAE,wBAAwB,EAC1C,gBAAgB,EAAE,YAAY,GAC5B,cAAc,CAAC,YAAY,CAAC,CAAC;IAEhC;;;;;;OAMG;IACH,gBAAgB,CAAC,mBAAmB,SAAS,2BAA2B,EACvE,eAAe,EAAE,wBAAwB,EACzC,gBAAgB,EAAE,mBAAmB,GACnC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CAC9C"}
|
package/lib/presence.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The connection status of the {@link ISessionClient}.
|
|
7
|
+
*
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export const SessionClientStatus = {
|
|
11
|
+
/**
|
|
12
|
+
* The session client is connected to the Fluid service.
|
|
13
|
+
*/
|
|
14
|
+
Connected: "Connected",
|
|
15
|
+
/**
|
|
16
|
+
* The session client is not connected to the Fluid service.
|
|
17
|
+
*/
|
|
18
|
+
Disconnected: "Disconnected",
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=presence.js.map
|
|
@@ -0,0 +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 { SessionId } from \"@fluidframework/id-compressor\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type {\n\tPresenceNotifications,\n\tPresenceNotificationsSchema,\n\tPresenceStates,\n\tPresenceStatesSchema,\n\tPresenceWorkspaceAddress,\n} from \"./types.js\";\n\nimport type { ISubscribable } from \"@fluidframework/presence/internal/events\";\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 Notifications manager.\n\t */\n\treadonly events: ISubscribable<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 * @returns A PresenceStates workspace\n\t */\n\tgetStates<StatesSchema extends PresenceStatesSchema>(\n\t\tworkspaceAddress: PresenceWorkspaceAddress,\n\t\trequestedContent: StatesSchema,\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"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IInboundSignalMessage } from "@fluidframework/runtime-definitions/internal";
|
|
6
|
+
import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
+
import type { ClientConnectionId } from "./baseTypes.js";
|
|
8
|
+
import type { IEphemeralRuntime } from "./internalTypes.js";
|
|
9
|
+
import type { ClientSessionId, ISessionClient } from "./presence.js";
|
|
10
|
+
import type { ClientUpdateEntry, PresenceStatesInternal } from "./presenceStates.js";
|
|
11
|
+
import type { SystemWorkspaceDatastore } from "./systemWorkspace.js";
|
|
12
|
+
import type { PresenceStates, PresenceStatesSchema, PresenceWorkspaceAddress } from "./types.js";
|
|
13
|
+
import type { IExtensionMessage } from "@fluidframework/presence/internal/container-definitions/internal";
|
|
14
|
+
interface PresenceStatesEntry<TSchema extends PresenceStatesSchema> {
|
|
15
|
+
public: PresenceStates<TSchema>;
|
|
16
|
+
internal: PresenceStatesInternal;
|
|
17
|
+
}
|
|
18
|
+
interface SystemDatastore {
|
|
19
|
+
"system:presence": SystemWorkspaceDatastore;
|
|
20
|
+
}
|
|
21
|
+
type InternalWorkspaceAddress = `${"s" | "n"}:${PresenceWorkspaceAddress}`;
|
|
22
|
+
interface GeneralDatastoreMessageContent {
|
|
23
|
+
[WorkspaceAddress: string]: {
|
|
24
|
+
[StateValueManagerKey: string]: {
|
|
25
|
+
[ClientSessionId: ClientSessionId]: ClientUpdateEntry;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
type DatastoreMessageContent = SystemDatastore & GeneralDatastoreMessageContent;
|
|
30
|
+
declare const datastoreUpdateMessageType = "Pres:DatastoreUpdate";
|
|
31
|
+
interface DatastoreUpdateMessage extends IInboundSignalMessage {
|
|
32
|
+
type: typeof datastoreUpdateMessageType;
|
|
33
|
+
content: {
|
|
34
|
+
sendTimestamp: number;
|
|
35
|
+
avgLatency: number;
|
|
36
|
+
isComplete?: true;
|
|
37
|
+
data: DatastoreMessageContent;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
declare const joinMessageType = "Pres:ClientJoin";
|
|
41
|
+
interface ClientJoinMessage extends IInboundSignalMessage {
|
|
42
|
+
type: typeof joinMessageType;
|
|
43
|
+
content: {
|
|
44
|
+
updateProviders: ClientConnectionId[];
|
|
45
|
+
sendTimestamp: number;
|
|
46
|
+
avgLatency: number;
|
|
47
|
+
data: DatastoreMessageContent;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export interface PresenceDatastoreManager {
|
|
54
|
+
joinSession(clientId: ClientConnectionId): void;
|
|
55
|
+
getWorkspace<TSchema extends PresenceStatesSchema>(internalWorkspaceAddress: InternalWorkspaceAddress, requestedContent: TSchema): PresenceStates<TSchema>;
|
|
56
|
+
processSignal(message: IExtensionMessage, local: boolean): void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Manages singleton datastore for all Presence.
|
|
60
|
+
*/
|
|
61
|
+
export declare class PresenceDatastoreManagerImpl implements PresenceDatastoreManager {
|
|
62
|
+
private readonly clientSessionId;
|
|
63
|
+
private readonly runtime;
|
|
64
|
+
private readonly lookupClient;
|
|
65
|
+
private readonly logger;
|
|
66
|
+
private readonly datastore;
|
|
67
|
+
private averageLatency;
|
|
68
|
+
private returnedMessages;
|
|
69
|
+
private refreshBroadcastRequested;
|
|
70
|
+
private readonly workspaces;
|
|
71
|
+
constructor(clientSessionId: ClientSessionId, runtime: IEphemeralRuntime, lookupClient: (clientId: ClientSessionId) => ISessionClient, logger: ITelemetryLoggerExt | undefined, systemWorkspaceDatastore: SystemWorkspaceDatastore, systemWorkspace: PresenceStatesEntry<PresenceStatesSchema>);
|
|
72
|
+
joinSession(clientId: ClientConnectionId): void;
|
|
73
|
+
getWorkspace<TSchema extends PresenceStatesSchema>(internalWorkspaceAddress: InternalWorkspaceAddress, requestedContent: TSchema): PresenceStates<TSchema>;
|
|
74
|
+
private localUpdate;
|
|
75
|
+
private broadcastAllKnownState;
|
|
76
|
+
processSignal(message: IInboundSignalMessage | DatastoreUpdateMessage | ClientJoinMessage, local: boolean): void;
|
|
77
|
+
/**
|
|
78
|
+
* Handles responding to another client joining the session.
|
|
79
|
+
*
|
|
80
|
+
* @param updateProviders - list of client connection id's that requestor selected
|
|
81
|
+
* to provide response
|
|
82
|
+
* @param requestor - `requestor` is only used in telemetry. While it is the requestor's
|
|
83
|
+
* client connection id, that is not most important. It is important that this is a
|
|
84
|
+
* unique shared id across all clients that might respond as we want to monitor the
|
|
85
|
+
* response patterns. The convenience of being client connection id will allow
|
|
86
|
+
* correlation with other telemetry where it is often called just `clientId`.
|
|
87
|
+
*/
|
|
88
|
+
private prepareJoinResponse;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=presenceDatastoreManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presenceDatastoreManager.d.ts","sourceRoot":"","sources":["../src/presenceDatastoreManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,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,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EACX,iBAAiB,EACjB,sBAAsB,EAEtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EACX,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AAE1G,UAAU,mBAAmB,CAAC,OAAO,S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