@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.
Files changed (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -0
  3. package/dist/alpha.d.ts +58 -0
  4. package/dist/baseTypes.d.ts +24 -0
  5. package/dist/baseTypes.d.ts.map +1 -0
  6. package/dist/baseTypes.js +7 -0
  7. package/dist/baseTypes.js.map +1 -0
  8. package/dist/container-definitions/containerExtensions.d.ts +137 -0
  9. package/dist/container-definitions/containerExtensions.d.ts.map +1 -0
  10. package/dist/container-definitions/containerExtensions.js +7 -0
  11. package/dist/container-definitions/containerExtensions.js.map +1 -0
  12. package/dist/container-definitions/index.d.ts +7 -0
  13. package/dist/container-definitions/index.d.ts.map +1 -0
  14. package/dist/container-definitions/index.js +7 -0
  15. package/dist/container-definitions/index.js.map +1 -0
  16. package/dist/container-definitions/runtime.d.ts +12 -0
  17. package/dist/container-definitions/runtime.d.ts.map +1 -0
  18. package/dist/container-definitions/runtime.js +7 -0
  19. package/dist/container-definitions/runtime.js.map +1 -0
  20. package/dist/core-interfaces/exposedUtilityTypes.d.ts +446 -0
  21. package/dist/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
  22. package/dist/core-interfaces/exposedUtilityTypes.js +11 -0
  23. package/dist/core-interfaces/exposedUtilityTypes.js.map +1 -0
  24. package/dist/core-interfaces/index.d.ts +10 -0
  25. package/dist/core-interfaces/index.d.ts.map +1 -0
  26. package/dist/core-interfaces/index.js +7 -0
  27. package/dist/core-interfaces/index.js.map +1 -0
  28. package/dist/core-interfaces/jsonDeserialized.d.ts +109 -0
  29. package/dist/core-interfaces/jsonDeserialized.d.ts.map +1 -0
  30. package/dist/core-interfaces/jsonDeserialized.js +7 -0
  31. package/dist/core-interfaces/jsonDeserialized.js.map +1 -0
  32. package/dist/core-interfaces/jsonSerializable.d.ts +120 -0
  33. package/dist/core-interfaces/jsonSerializable.d.ts.map +1 -0
  34. package/dist/core-interfaces/jsonSerializable.js +7 -0
  35. package/dist/core-interfaces/jsonSerializable.js.map +1 -0
  36. package/dist/core-interfaces/jsonSerializationErrors.d.ts +31 -0
  37. package/dist/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
  38. package/dist/core-interfaces/jsonSerializationErrors.js +7 -0
  39. package/dist/core-interfaces/jsonSerializationErrors.js.map +1 -0
  40. package/dist/core-interfaces/jsonType.d.ts +29 -0
  41. package/dist/core-interfaces/jsonType.d.ts.map +1 -0
  42. package/dist/core-interfaces/jsonType.js +7 -0
  43. package/dist/core-interfaces/jsonType.js.map +1 -0
  44. package/dist/datastorePresenceManagerFactory.d.ts +48 -0
  45. package/dist/datastorePresenceManagerFactory.d.ts.map +1 -0
  46. package/dist/datastorePresenceManagerFactory.js +79 -0
  47. package/dist/datastorePresenceManagerFactory.js.map +1 -0
  48. package/dist/datastoreSupport.d.ts +31 -0
  49. package/dist/datastoreSupport.d.ts.map +1 -0
  50. package/dist/datastoreSupport.js +82 -0
  51. package/dist/datastoreSupport.js.map +1 -0
  52. package/dist/events/events.d.ts +198 -0
  53. package/dist/events/events.d.ts.map +1 -0
  54. package/dist/events/events.js +157 -0
  55. package/dist/events/events.js.map +1 -0
  56. package/dist/experimentalAccess.d.ts +15 -0
  57. package/dist/experimentalAccess.d.ts.map +1 -0
  58. package/dist/experimentalAccess.js +46 -0
  59. package/dist/experimentalAccess.js.map +1 -0
  60. package/dist/exposedInternalTypes.d.ts +100 -0
  61. package/dist/exposedInternalTypes.d.ts.map +1 -0
  62. package/dist/exposedInternalTypes.js +19 -0
  63. package/dist/exposedInternalTypes.js.map +1 -0
  64. package/dist/exposedUtilityTypes.d.ts +63 -0
  65. package/dist/exposedUtilityTypes.d.ts.map +1 -0
  66. package/dist/exposedUtilityTypes.js +7 -0
  67. package/dist/exposedUtilityTypes.js.map +1 -0
  68. package/dist/index.d.ts +22 -0
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +21 -0
  71. package/dist/index.js.map +1 -0
  72. package/dist/internalTypes.d.ts +39 -0
  73. package/dist/internalTypes.d.ts.map +1 -0
  74. package/dist/internalTypes.js +14 -0
  75. package/dist/internalTypes.js.map +1 -0
  76. package/dist/latestMapValueManager.d.ts +182 -0
  77. package/dist/latestMapValueManager.d.ts.map +1 -0
  78. package/dist/latestMapValueManager.js +206 -0
  79. package/dist/latestMapValueManager.js.map +1 -0
  80. package/dist/latestValueControls.d.ts +44 -0
  81. package/dist/latestValueControls.d.ts.map +1 -0
  82. package/dist/latestValueControls.js +28 -0
  83. package/dist/latestValueControls.js.map +1 -0
  84. package/dist/latestValueManager.d.ts +69 -0
  85. package/dist/latestValueManager.d.ts.map +1 -0
  86. package/dist/latestValueManager.js +100 -0
  87. package/dist/latestValueManager.js.map +1 -0
  88. package/dist/latestValueTypes.d.ts +44 -0
  89. package/dist/latestValueTypes.d.ts.map +1 -0
  90. package/dist/latestValueTypes.js +7 -0
  91. package/dist/latestValueTypes.js.map +1 -0
  92. package/dist/notificationsManager.d.ts +101 -0
  93. package/dist/notificationsManager.d.ts.map +1 -0
  94. package/dist/notificationsManager.js +82 -0
  95. package/dist/notificationsManager.js.map +1 -0
  96. package/dist/package.json +15 -0
  97. package/dist/presence.d.ts +180 -0
  98. package/dist/presence.d.ts.map +1 -0
  99. package/dist/presence.js +23 -0
  100. package/dist/presence.js.map +1 -0
  101. package/dist/presenceDatastoreManager.d.ts +91 -0
  102. package/dist/presenceDatastoreManager.d.ts.map +1 -0
  103. package/dist/presenceDatastoreManager.js +248 -0
  104. package/dist/presenceDatastoreManager.js.map +1 -0
  105. package/dist/presenceManager.d.ts +20 -0
  106. package/dist/presenceManager.d.ts.map +1 -0
  107. package/dist/presenceManager.js +104 -0
  108. package/dist/presenceManager.js.map +1 -0
  109. package/dist/presenceStates.d.ts +78 -0
  110. package/dist/presenceStates.d.ts.map +1 -0
  111. package/dist/presenceStates.js +182 -0
  112. package/dist/presenceStates.js.map +1 -0
  113. package/dist/stateDatastore.d.ts +35 -0
  114. package/dist/stateDatastore.d.ts.map +1 -0
  115. package/dist/stateDatastore.js +26 -0
  116. package/dist/stateDatastore.js.map +1 -0
  117. package/dist/systemWorkspace.d.ts +51 -0
  118. package/dist/systemWorkspace.d.ts.map +1 -0
  119. package/dist/systemWorkspace.js +180 -0
  120. package/dist/systemWorkspace.js.map +1 -0
  121. package/dist/types.d.ts +92 -0
  122. package/dist/types.d.ts.map +1 -0
  123. package/dist/types.js +8 -0
  124. package/dist/types.js.map +1 -0
  125. package/dist/valueManager.d.ts +19 -0
  126. package/dist/valueManager.d.ts.map +1 -0
  127. package/dist/valueManager.js +26 -0
  128. package/dist/valueManager.js.map +1 -0
  129. package/lib/alpha.d.ts +58 -0
  130. package/lib/baseTypes.d.ts +24 -0
  131. package/lib/baseTypes.d.ts.map +1 -0
  132. package/lib/baseTypes.js +6 -0
  133. package/lib/baseTypes.js.map +1 -0
  134. package/lib/container-definitions/containerExtensions.d.ts +137 -0
  135. package/lib/container-definitions/containerExtensions.d.ts.map +1 -0
  136. package/lib/container-definitions/containerExtensions.js +6 -0
  137. package/lib/container-definitions/containerExtensions.js.map +1 -0
  138. package/lib/container-definitions/index.d.ts +7 -0
  139. package/lib/container-definitions/index.d.ts.map +1 -0
  140. package/lib/container-definitions/index.js +6 -0
  141. package/lib/container-definitions/index.js.map +1 -0
  142. package/lib/container-definitions/runtime.d.ts +12 -0
  143. package/lib/container-definitions/runtime.d.ts.map +1 -0
  144. package/lib/container-definitions/runtime.js +6 -0
  145. package/lib/container-definitions/runtime.js.map +1 -0
  146. package/lib/core-interfaces/exposedUtilityTypes.d.ts +446 -0
  147. package/lib/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
  148. package/lib/core-interfaces/exposedUtilityTypes.js +10 -0
  149. package/lib/core-interfaces/exposedUtilityTypes.js.map +1 -0
  150. package/lib/core-interfaces/index.d.ts +10 -0
  151. package/lib/core-interfaces/index.d.ts.map +1 -0
  152. package/lib/core-interfaces/index.js +6 -0
  153. package/lib/core-interfaces/index.js.map +1 -0
  154. package/lib/core-interfaces/jsonDeserialized.d.ts +109 -0
  155. package/lib/core-interfaces/jsonDeserialized.d.ts.map +1 -0
  156. package/lib/core-interfaces/jsonDeserialized.js +6 -0
  157. package/lib/core-interfaces/jsonDeserialized.js.map +1 -0
  158. package/lib/core-interfaces/jsonSerializable.d.ts +120 -0
  159. package/lib/core-interfaces/jsonSerializable.d.ts.map +1 -0
  160. package/lib/core-interfaces/jsonSerializable.js +6 -0
  161. package/lib/core-interfaces/jsonSerializable.js.map +1 -0
  162. package/lib/core-interfaces/jsonSerializationErrors.d.ts +31 -0
  163. package/lib/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
  164. package/lib/core-interfaces/jsonSerializationErrors.js +6 -0
  165. package/lib/core-interfaces/jsonSerializationErrors.js.map +1 -0
  166. package/lib/core-interfaces/jsonType.d.ts +29 -0
  167. package/lib/core-interfaces/jsonType.d.ts.map +1 -0
  168. package/lib/core-interfaces/jsonType.js +6 -0
  169. package/lib/core-interfaces/jsonType.js.map +1 -0
  170. package/lib/datastorePresenceManagerFactory.d.ts +48 -0
  171. package/lib/datastorePresenceManagerFactory.d.ts.map +1 -0
  172. package/lib/datastorePresenceManagerFactory.js +75 -0
  173. package/lib/datastorePresenceManagerFactory.js.map +1 -0
  174. package/lib/datastoreSupport.d.ts +31 -0
  175. package/lib/datastoreSupport.d.ts.map +1 -0
  176. package/lib/datastoreSupport.js +77 -0
  177. package/lib/datastoreSupport.js.map +1 -0
  178. package/lib/events/events.d.ts +198 -0
  179. package/lib/events/events.d.ts.map +1 -0
  180. package/lib/events/events.js +152 -0
  181. package/lib/events/events.js.map +1 -0
  182. package/lib/experimentalAccess.d.ts +15 -0
  183. package/lib/experimentalAccess.d.ts.map +1 -0
  184. package/lib/experimentalAccess.js +42 -0
  185. package/lib/experimentalAccess.js.map +1 -0
  186. package/lib/exposedInternalTypes.d.ts +100 -0
  187. package/lib/exposedInternalTypes.d.ts.map +1 -0
  188. package/lib/exposedInternalTypes.js +16 -0
  189. package/lib/exposedInternalTypes.js.map +1 -0
  190. package/lib/exposedUtilityTypes.d.ts +63 -0
  191. package/lib/exposedUtilityTypes.d.ts.map +1 -0
  192. package/lib/exposedUtilityTypes.js +6 -0
  193. package/lib/exposedUtilityTypes.js.map +1 -0
  194. package/lib/index.d.ts +22 -0
  195. package/lib/index.d.ts.map +1 -0
  196. package/lib/index.js +11 -0
  197. package/lib/index.js.map +1 -0
  198. package/lib/internalTypes.d.ts +39 -0
  199. package/lib/internalTypes.d.ts.map +1 -0
  200. package/lib/internalTypes.js +11 -0
  201. package/lib/internalTypes.js.map +1 -0
  202. package/lib/latestMapValueManager.d.ts +182 -0
  203. package/lib/latestMapValueManager.d.ts.map +1 -0
  204. package/lib/latestMapValueManager.js +202 -0
  205. package/lib/latestMapValueManager.js.map +1 -0
  206. package/lib/latestValueControls.d.ts +44 -0
  207. package/lib/latestValueControls.d.ts.map +1 -0
  208. package/lib/latestValueControls.js +24 -0
  209. package/lib/latestValueControls.js.map +1 -0
  210. package/lib/latestValueManager.d.ts +69 -0
  211. package/lib/latestValueManager.d.ts.map +1 -0
  212. package/lib/latestValueManager.js +96 -0
  213. package/lib/latestValueManager.js.map +1 -0
  214. package/lib/latestValueTypes.d.ts +44 -0
  215. package/lib/latestValueTypes.d.ts.map +1 -0
  216. package/lib/latestValueTypes.js +6 -0
  217. package/lib/latestValueTypes.js.map +1 -0
  218. package/lib/notificationsManager.d.ts +101 -0
  219. package/lib/notificationsManager.d.ts.map +1 -0
  220. package/lib/notificationsManager.js +78 -0
  221. package/lib/notificationsManager.js.map +1 -0
  222. package/lib/presence.d.ts +180 -0
  223. package/lib/presence.d.ts.map +1 -0
  224. package/lib/presence.js +20 -0
  225. package/lib/presence.js.map +1 -0
  226. package/lib/presenceDatastoreManager.d.ts +91 -0
  227. package/lib/presenceDatastoreManager.d.ts.map +1 -0
  228. package/lib/presenceDatastoreManager.js +244 -0
  229. package/lib/presenceDatastoreManager.js.map +1 -0
  230. package/lib/presenceManager.d.ts +20 -0
  231. package/lib/presenceManager.d.ts.map +1 -0
  232. package/lib/presenceManager.js +100 -0
  233. package/lib/presenceManager.js.map +1 -0
  234. package/lib/presenceStates.d.ts +78 -0
  235. package/lib/presenceStates.d.ts.map +1 -0
  236. package/lib/presenceStates.js +177 -0
  237. package/lib/presenceStates.js.map +1 -0
  238. package/lib/stateDatastore.d.ts +35 -0
  239. package/lib/stateDatastore.d.ts.map +1 -0
  240. package/lib/stateDatastore.js +21 -0
  241. package/lib/stateDatastore.js.map +1 -0
  242. package/lib/systemWorkspace.d.ts +51 -0
  243. package/lib/systemWorkspace.d.ts.map +1 -0
  244. package/lib/systemWorkspace.js +176 -0
  245. package/lib/systemWorkspace.js.map +1 -0
  246. package/lib/tsdoc-metadata.json +11 -0
  247. package/lib/types.d.ts +92 -0
  248. package/lib/types.d.ts.map +1 -0
  249. package/lib/types.js +7 -0
  250. package/lib/types.js.map +1 -0
  251. package/lib/valueManager.d.ts +19 -0
  252. package/lib/valueManager.d.ts.map +1 -0
  253. package/lib/valueManager.js +21 -0
  254. package/lib/valueManager.js.map +1 -0
  255. package/package.json +175 -0
package/lib/types.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { NotificationsManager } from "./notificationsManager.js";
6
+ import type { InternalTypes } from "@fluidframework/presence/internal/exposedInternalTypes";
7
+ /**
8
+ * Unique address within a session.
9
+ *
10
+ * @remarks
11
+ * A string known to all clients working with a certain Workspace and unique
12
+ * among Workspaces. Recommend using specifying concatenation of: type of
13
+ * unique identifier, `:` (required), and unique identifier.
14
+ *
15
+ * @example Examples
16
+ * ```typescript
17
+ * "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
18
+ * "address:object0/sub-object2:pointers"
19
+ * ```
20
+ *
21
+ * @alpha
22
+ */
23
+ export type PresenceWorkspaceAddress = `${string}:${string}`;
24
+ /**
25
+ * Single entry in {@link PresenceStatesSchema}.
26
+ *
27
+ * @alpha
28
+ */
29
+ export type PresenceStatesEntry<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>, TManager = unknown> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;
30
+ /**
31
+ * Schema for a {@link PresenceStates} workspace.
32
+ *
33
+ * Keys of schema are the keys of the {@link PresenceStates} providing access to `Value Manager`s.
34
+ *
35
+ * @alpha
36
+ */
37
+ export interface PresenceStatesSchema {
38
+ [key: string]: PresenceStatesEntry<typeof key, InternalTypes.ValueDirectoryOrState<any>>;
39
+ }
40
+ /**
41
+ * Map of `Value Manager`s registered with {@link PresenceStates}.
42
+ *
43
+ * @sealed
44
+ * @alpha
45
+ */
46
+ export type PresenceStatesEntries<TSchema extends PresenceStatesSchema> = {
47
+ /**
48
+ * Registered `Value Manager`s
49
+ */
50
+ readonly [Key in keyof TSchema]: ReturnType<TSchema[Key]>["manager"] extends InternalTypes.StateValue<infer TManager> ? TManager : never;
51
+ };
52
+ /**
53
+ * `PresenceStates` maintains a registry of `Value Manager`s that all share and provide access to
54
+ * presence state values across client members in a session.
55
+ *
56
+ * `Value Manager`s offer variations on how to manage states, but all share same principle that
57
+ * each client's state is independent and may only be updated by originating client.
58
+ *
59
+ * @sealed
60
+ * @alpha
61
+ */
62
+ export interface PresenceStates<TSchema extends PresenceStatesSchema, TManagerConstraints = unknown> {
63
+ /**
64
+ * Registers a new `Value Manager` with the {@link PresenceStates}.
65
+ * @param key - new unique key for the `Value Manager`
66
+ * @param manager - factory for creating a `Value Manager`
67
+ */
68
+ add<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<any>, TManager extends TManagerConstraints>(key: TKey, manager: InternalTypes.ManagerFactory<TKey, TValue, TManager>): asserts this is PresenceStates<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>, TManagerConstraints>;
69
+ /**
70
+ * Registry of `Value Manager`s.
71
+ */
72
+ readonly props: PresenceStatesEntries<TSchema>;
73
+ }
74
+ /**
75
+ * Schema for a {@link PresenceNotifications} workspace.
76
+ *
77
+ * Keys of schema are the keys of the {@link PresenceNotifications} providing access to {@link NotificationsManager}s.
78
+ *
79
+ * @alpha
80
+ */
81
+ export interface PresenceNotificationsSchema {
82
+ [key: string]: InternalTypes.ManagerFactory<typeof key, InternalTypes.ValueRequiredState<InternalTypes.NotificationType>, NotificationsManager<any>>;
83
+ }
84
+ /**
85
+ * `PresenceNotifications` maintains a registry of {@link NotificationsManager}s
86
+ * that facilitate messages across client members in a session.
87
+ *
88
+ * @sealed
89
+ * @alpha
90
+ */
91
+ export type PresenceNotifications<TSchema extends PresenceNotificationsSchema> = PresenceStates<TSchema, NotificationsManager<any>>;
92
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,wBAAwB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAI7D;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAC9B,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAC3D,QAAQ,GAAG,OAAO,IACf,aAAa,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC,OAAO,GAAG,EAAE,aAAa,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC;CACzF;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,CAAC,OAAO,SAAS,oBAAoB,IAAI;IACzE;;OAEG;IACH,QAAQ,EAAE,GAAG,IAAI,MAAM,OAAO,GAAG,UAAU,CAC1C,OAAO,CAAC,GAAG,CAAC,CACZ,CAAC,SAAS,CAAC,SAAS,aAAa,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,GAC1D,QAAQ,GACR,KAAK;CACR,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc,CAC9B,OAAO,SAAS,oBAAoB,EACpC,mBAAmB,GAAG,OAAO;IAE7B;;;;OAIG;IACH,GAAG,CACF,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,GAAG,CAAC,EACvD,QAAQ,SAAS,mBAAmB,EAEpC,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,GAC3D,OAAO,CAAC,IAAI,IAAI,cAAc,CAChC,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,EAC5E,mBAAmB,CACnB,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;CAC/C;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,2BAA2B;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC,cAAc,CAC1C,OAAO,GAAG,EACV,aAAa,CAAC,kBAAkB,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAChE,oBAAoB,CAAC,GAAG,CAAC,CACzB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,CAAC,OAAO,SAAS,2BAA2B,IAC5E,cAAc,CAAC,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC"}
package/lib/types.js ADDED
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ // #endregion PresenceNotifications
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAmIH,mCAAmC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NotificationsManager } from \"./notificationsManager.js\";\n\nimport type { InternalTypes } from \"@fluidframework/presence/internal/exposedInternalTypes\";\n\n/**\n * Unique address within a session.\n *\n * @remarks\n * A string known to all clients working with a certain Workspace and unique\n * among Workspaces. Recommend using specifying concatenation of: type of\n * unique identifier, `:` (required), and unique identifier.\n *\n * @example Examples\n * ```typescript\n * \"guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1\"\n * \"address:object0/sub-object2:pointers\"\n * ```\n *\n * @alpha\n */\nexport type PresenceWorkspaceAddress = `${string}:${string}`;\n\n// #region PresenceStates\n\n/**\n * Single entry in {@link PresenceStatesSchema}.\n *\n * @alpha\n */\nexport type PresenceStatesEntry<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\tTManager = unknown,\n> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;\n\n/**\n * Schema for a {@link PresenceStates} workspace.\n *\n * Keys of schema are the keys of the {@link PresenceStates} providing access to `Value Manager`s.\n *\n * @alpha\n */\nexport interface PresenceStatesSchema {\n\t[key: string]: PresenceStatesEntry<typeof key, InternalTypes.ValueDirectoryOrState<any>>;\n}\n\n/**\n * Map of `Value Manager`s registered with {@link PresenceStates}.\n *\n * @sealed\n * @alpha\n */\nexport type PresenceStatesEntries<TSchema extends PresenceStatesSchema> = {\n\t/**\n\t * Registered `Value Manager`s\n\t */\n\treadonly [Key in keyof TSchema]: ReturnType<\n\t\tTSchema[Key]\n\t>[\"manager\"] extends InternalTypes.StateValue<infer TManager>\n\t\t? TManager\n\t\t: never;\n};\n\n/**\n * `PresenceStates` maintains a registry of `Value Manager`s that all share and provide access to\n * presence state values across client members in a session.\n *\n * `Value Manager`s offer variations on how to manage states, but all share same principle that\n * each client's state is independent and may only be updated by originating client.\n *\n * @sealed\n * @alpha\n */\nexport interface PresenceStates<\n\tTSchema extends PresenceStatesSchema,\n\tTManagerConstraints = unknown,\n> {\n\t/**\n\t * Registers a new `Value Manager` with the {@link PresenceStates}.\n\t * @param key - new unique key for the `Value Manager`\n\t * @param manager - factory for creating a `Value Manager`\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n\t\tTManager extends TManagerConstraints,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is PresenceStates<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>,\n\t\tTManagerConstraints\n\t>;\n\n\t/**\n\t * Registry of `Value Manager`s.\n\t */\n\treadonly props: PresenceStatesEntries<TSchema>;\n}\n\n// #endregion PresenceStates\n\n// #region PresenceNotifications\n\n/**\n * Schema for a {@link PresenceNotifications} workspace.\n *\n * Keys of schema are the keys of the {@link PresenceNotifications} providing access to {@link NotificationsManager}s.\n *\n * @alpha\n */\nexport interface PresenceNotificationsSchema {\n\t[key: string]: InternalTypes.ManagerFactory<\n\t\ttypeof key,\n\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>,\n\t\tNotificationsManager<any>\n\t>;\n}\n\n/**\n * `PresenceNotifications` maintains a registry of {@link NotificationsManager}s\n * that facilitate messages across client members in a session.\n *\n * @sealed\n * @alpha\n */\nexport type PresenceNotifications<TSchema extends PresenceNotificationsSchema> =\n\tPresenceStates<TSchema, NotificationsManager<any>>;\n\n// #endregion PresenceNotifications\n"]}
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { InternalTypes } from "./exposedInternalTypes.js";
6
+ import type { ValueManager } from "./internalTypes.js";
7
+ /**
8
+ * Given a value manager, return opaque InternalTypes.StateValue.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function brandIVM<TManagerInterface, TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue>>(manager: TManagerInterface & ValueManager<TValue, TValueState>): InternalTypes.StateValue<TManagerInterface>;
13
+ /**
14
+ * Extract the value manager from an opaque InternalTypes.StateValue.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare function unbrandIVM<TManagerInterface, TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue>>(branded: InternalTypes.StateValue<TManagerInterface>): ValueManager<TValue, TValueState>;
19
+ //# sourceMappingURL=valueManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valueManager.d.ts","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,QAAQ,CACvB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAE/D,OAAO,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,GAC5D,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAC9D,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAEzF"}
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Given a value manager, return opaque InternalTypes.StateValue.
7
+ *
8
+ * @internal
9
+ */
10
+ export function brandIVM(manager) {
11
+ return manager;
12
+ }
13
+ /**
14
+ * Extract the value manager from an opaque InternalTypes.StateValue.
15
+ *
16
+ * @internal
17
+ */
18
+ export function unbrandIVM(branded) {
19
+ return branded;
20
+ }
21
+ //# sourceMappingURL=valueManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valueManager.js","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAKvB,OAA8D;IAE9D,OAAO,OAA2E,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAIxB,OAAoD;IACrD,OAAO,OAAuD,CAAC;AAChE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ValueManager } from \"./internalTypes.js\";\n\n/**\n * Given a value manager, return opaque InternalTypes.StateValue.\n *\n * @internal\n */\nexport function brandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(\n\tmanager: TManagerInterface & ValueManager<TValue, TValueState>,\n): InternalTypes.StateValue<TManagerInterface> {\n\treturn manager as TManagerInterface as InternalTypes.StateValue<TManagerInterface>;\n}\n\n/**\n * Extract the value manager from an opaque InternalTypes.StateValue.\n *\n * @internal\n */\nexport function unbrandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(branded: InternalTypes.StateValue<TManagerInterface>): ValueManager<TValue, TValueState> {\n\treturn branded as unknown as ValueManager<TValue, TValueState>;\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,175 @@
1
+ {
2
+ "name": "@fluidframework/presence",
3
+ "version": "2.10.0-307399",
4
+ "description": "A component for lightweight data sharing within a single session",
5
+ "homepage": "https://fluidframework.com",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/microsoft/FluidFramework.git",
9
+ "directory": "packages/framework/presence"
10
+ },
11
+ "license": "MIT",
12
+ "author": "Microsoft and contributors",
13
+ "sideEffects": false,
14
+ "type": "module",
15
+ "exports": {
16
+ "./alpha": {
17
+ "import": {
18
+ "types": "./lib/alpha.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/alpha.d.ts",
23
+ "default": "./dist/index.js"
24
+ }
25
+ },
26
+ "./internal/container-definitions/internal": {
27
+ "import": "./lib/container-definitions/index.js",
28
+ "require": "./dist/container-definitions/index.js"
29
+ },
30
+ "./internal/core-interfaces": {
31
+ "import": "./lib/core-interfaces/index.js",
32
+ "require": "./dist/core-interfaces/index.js"
33
+ },
34
+ "./internal/events": {
35
+ "import": "./lib/events/events.js",
36
+ "require": "./dist/events/events.js"
37
+ },
38
+ "./internal/exposedInternalTypes": {
39
+ "import": "./lib/exposedInternalTypes.js",
40
+ "require": "./dist/exposedInternalTypes.js"
41
+ },
42
+ "./internal/exposedUtilityTypes": {
43
+ "import": "./lib/exposedUtilityTypes.js",
44
+ "require": "./dist/exposedUtilityTypes.js"
45
+ }
46
+ },
47
+ "files": [
48
+ "dist/**/*",
49
+ "lib/**/*",
50
+ "*.d.ts",
51
+ "!**/test/**"
52
+ ],
53
+ "c8": {
54
+ "all": true,
55
+ "cache-dir": "nyc/.cache",
56
+ "exclude": [
57
+ "src/test/**/*.*ts",
58
+ "dist/test/**/*.*js",
59
+ "lib/test/**/*.*js"
60
+ ],
61
+ "exclude-after-remap": false,
62
+ "include": [
63
+ "src/**/*.*ts",
64
+ "dist/**/*.*js",
65
+ "lib/**/*.*js"
66
+ ],
67
+ "report-dir": "nyc/report",
68
+ "reporter": [
69
+ "cobertura",
70
+ "html",
71
+ "text"
72
+ ],
73
+ "temp-directory": "nyc/.nyc_output"
74
+ },
75
+ "dependencies": {
76
+ "@fluidframework/container-definitions": "2.10.0-307399",
77
+ "@fluidframework/container-loader": "2.10.0-307399",
78
+ "@fluidframework/container-runtime-definitions": "2.10.0-307399",
79
+ "@fluidframework/core-interfaces": "2.10.0-307399",
80
+ "@fluidframework/core-utils": "2.10.0-307399",
81
+ "@fluidframework/datastore": "2.10.0-307399",
82
+ "@fluidframework/datastore-definitions": "2.10.0-307399",
83
+ "@fluidframework/fluid-static": "2.10.0-307399",
84
+ "@fluidframework/id-compressor": "2.10.0-307399",
85
+ "@fluidframework/runtime-definitions": "2.10.0-307399",
86
+ "@fluidframework/runtime-utils": "2.10.0-307399",
87
+ "@fluidframework/shared-object-base": "2.10.0-307399",
88
+ "@fluidframework/telemetry-utils": "2.10.0-307399"
89
+ },
90
+ "devDependencies": {
91
+ "@arethetypeswrong/cli": "^0.16.4",
92
+ "@biomejs/biome": "~1.9.3",
93
+ "@fluid-tools/build-cli": "^0.51.0",
94
+ "@fluidframework/build-common": "^2.0.3",
95
+ "@fluidframework/build-tools": "^0.51.0",
96
+ "@fluidframework/driver-definitions": "2.10.0-307399",
97
+ "@fluidframework/eslint-config-fluid": "^5.4.0",
98
+ "@fluidframework/presence-previous": "npm:@fluid-experimental/presence@2.5.0",
99
+ "@fluidframework/test-runtime-utils": "2.10.0-307399",
100
+ "@fluidframework/test-utils": "2.10.0-307399",
101
+ "@microsoft/api-extractor": "7.47.8",
102
+ "@types/mocha": "^9.1.1",
103
+ "@types/node": "^18.19.0",
104
+ "@types/sinon": "^17.0.3",
105
+ "c8": "^8.0.1",
106
+ "concurrently": "^8.2.1",
107
+ "copyfiles": "^2.4.1",
108
+ "cross-env": "^7.0.3",
109
+ "eslint": "~8.55.0",
110
+ "mocha": "^10.2.0",
111
+ "mocha-multi-reporters": "^1.5.1",
112
+ "prettier": "~3.0.3",
113
+ "rimraf": "^4.4.0",
114
+ "sinon": "^18.0.1",
115
+ "typescript": "~5.4.5"
116
+ },
117
+ "fluidBuild": {
118
+ "tasks": {
119
+ "build:test:esm:core-interfaces-no-exactOptionalPropertyTypes": [
120
+ "build:esnext"
121
+ ],
122
+ "check:exports:bundle-release-tags": [
123
+ "build:esnext"
124
+ ],
125
+ "eslint": [
126
+ "build:esnext",
127
+ "^build:test:esm"
128
+ ]
129
+ }
130
+ },
131
+ "typeValidation": {
132
+ "disabled": true,
133
+ "broken": {},
134
+ "entrypoint": "internal"
135
+ },
136
+ "scripts": {
137
+ "api": "fluid-build . --task api",
138
+ "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
139
+ "api-extractor:esnext": "flub generate entrypoints --outDir ./lib",
140
+ "build": "fluid-build . --task build",
141
+ "build:commonjs": "fluid-build . --task commonjs",
142
+ "build:compile": "fluid-build . --task compile",
143
+ "build:docs": "api-extractor run --local",
144
+ "build:esnext": "tsc --project ./tsconfig.json",
145
+ "build:test": "npm run build:test:esm && npm run build:test:cjs && npm run build:test:esm:core-interfaces-no-exactOptionalPropertyTypes",
146
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
147
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
148
+ "build:test:esm:core-interfaces-no-exactOptionalPropertyTypes": "tsc --project ./src/test/core-interfaces/tsconfig.no-exactOptionalPropertyTypes.json",
149
+ "check:are-the-types-wrong": "echo skip per issue #112 - node10 requirement: attw --pack .",
150
+ "check:biome": "biome check .",
151
+ "check:exports": "concurrently \"npm:check:exports:*\"",
152
+ "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
153
+ "check:exports:cjs:alpha": "api-extractor run --config api-extractor/api-extractor-lint-alpha.cjs.json",
154
+ "check:exports:esm:alpha": "api-extractor run --config api-extractor/api-extractor-lint-alpha.esm.json",
155
+ "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
156
+ "ci:build:docs": "api-extractor run",
157
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
158
+ "eslint": "eslint --format stylish src",
159
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
160
+ "format": "npm run format:biome",
161
+ "format:biome": "biome check . --write",
162
+ "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
163
+ "lint": "fluid-build . --task lint",
164
+ "lint:fix": "fluid-build . --task eslint:fix --task format",
165
+ "test": "npm run test:mocha",
166
+ "test:coverage": "c8 npm test",
167
+ "test:mocha": "npm run test:mocha:esm && npm run test:mocha:cjs",
168
+ "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
169
+ "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
170
+ "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
171
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ./src/cjs/package.json ./dist",
172
+ "typetests:gen": "flub generate typetests --dir . -v",
173
+ "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
174
+ }
175
+ }