@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
@@ -0,0 +1,100 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { JsonDeserialized, JsonSerializable } from "@fluidframework/presence/internal/core-interfaces";
6
+ /**
7
+ * Collection of value types that are not intended to be used/imported
8
+ * directly outside of this package.
9
+ *
10
+ * @alpha
11
+ * @system
12
+ */
13
+ export declare namespace InternalTypes {
14
+ /**
15
+ * @system
16
+ */
17
+ interface ValueStateMetadata {
18
+ rev: number;
19
+ timestamp: number;
20
+ }
21
+ /**
22
+ * @system
23
+ */
24
+ interface ValueOptionalState<TValue> extends ValueStateMetadata {
25
+ value?: JsonDeserialized<TValue>;
26
+ }
27
+ /**
28
+ * @system
29
+ */
30
+ interface ValueRequiredState<TValue> extends ValueStateMetadata {
31
+ value: JsonDeserialized<TValue>;
32
+ }
33
+ /**
34
+ * @system
35
+ */
36
+ interface ValueDirectory<T> {
37
+ rev: number;
38
+ items: {
39
+ [name: string | number]: ValueOptionalState<T> | ValueDirectory<T>;
40
+ };
41
+ }
42
+ /**
43
+ * @system
44
+ */
45
+ type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;
46
+ /**
47
+ * @system
48
+ */
49
+ interface MapValueState<T> {
50
+ rev: number;
51
+ items: {
52
+ [name: string | number]: ValueOptionalState<T>;
53
+ };
54
+ }
55
+ /**
56
+ * @system
57
+ */
58
+ class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {
59
+ private readonly StateDatastoreHandle;
60
+ }
61
+ /**
62
+ * Brand to ensure state values internal type safety without revealing
63
+ * internals that are subject to change.
64
+ *
65
+ * @system
66
+ */
67
+ class StateValueBrand<T> {
68
+ private readonly StateValue;
69
+ }
70
+ /**
71
+ * This type provides no additional functionality over the type it wraps.
72
+ * It is used to ensure type safety within package.
73
+ * Users may find it convenient to just use the type it wraps directly.
74
+ *
75
+ * @privateRemarks
76
+ * Checkout filtering omitting unknown from T (`Omit<T,unknown> &`).
77
+ *
78
+ * @system
79
+ */
80
+ type StateValue<T> = T & StateValueBrand<T>;
81
+ /**
82
+ * Package internal function declaration for value manager instantiation.
83
+ *
84
+ * @system
85
+ */
86
+ type ManagerFactory<TKey extends string, TValue extends ValueDirectoryOrState<any>, TManager> = {
87
+ instanceBase: new (...args: any[]) => any;
88
+ } & ((key: TKey, datastoreHandle: StateDatastoreHandle<TKey, TValue>) => {
89
+ value?: TValue;
90
+ manager: StateValue<TManager>;
91
+ });
92
+ /**
93
+ * @system
94
+ */
95
+ interface NotificationType {
96
+ name: string;
97
+ args: (JsonSerializable<unknown> & JsonDeserialized<unknown>)[];
98
+ }
99
+ }
100
+ //# sourceMappingURL=exposedInternalTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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G;IACH,MAAqB,eAAe,CAAC,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;KAC3C;IAED;;;;;;;;;OASG;IACH,KAAY,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAEnD;;;;OAIG;IACH,KAAY,cAAc,CACzB,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,qBAAqB,CAAC,GAAG,CAAC,EACzC,QAAQ,IACL;QAAE,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;KAAE,GAAG,CAAC,CACpD,GAAG,EAAE,IAAI,EACT,eAAe,EAAE,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,KAC/C;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KAC9B,CAAC,CAAC;IAEH;;OAEG;IACH,UAAiB,gBAAgB;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;KAChE;CACD"}
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Collection of value types that are not intended to be used/imported
7
+ * directly outside of this package.
8
+ *
9
+ * @alpha
10
+ * @system
11
+ */
12
+ // eslint-disable-next-line @typescript-eslint/no-namespace
13
+ export var InternalTypes;
14
+ (function (InternalTypes) {
15
+ })(InternalTypes || (InternalTypes = {}));
16
+ //# sourceMappingURL=exposedInternalTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;GAMG;AACH,2DAA2D;AAC3D,MAAM,KAAW,aAAa,CA2G7B;AA3GD,WAAiB,aAAa;AA2G9B,CAAC,EA3GgB,aAAa,KAAb,aAAa,QA2G7B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/presence/internal/core-interfaces\";\n\n/**\n * Collection of value types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @alpha\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalTypes {\n\t/**\n\t * @system\n\t */\n\texport interface ValueStateMetadata {\n\t\trev: number;\n\t\ttimestamp: number;\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport interface ValueOptionalState<TValue> extends ValueStateMetadata {\n\t\tvalue?: JsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: JsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport interface ValueDirectory<T> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name: string | number]: ValueOptionalState<T> | ValueDirectory<T>;\n\t\t};\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;\n\n\t/**\n\t * @system\n\t */\n\texport interface MapValueState<T> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name: string | number]: ValueOptionalState<T>;\n\t\t};\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {\n\t\tprivate readonly StateDatastoreHandle: StateDatastoreHandle<TKey, TValue>;\n\t}\n\n\t/**\n\t * Brand to ensure state values internal type safety without revealing\n\t * internals that are subject to change.\n\t *\n\t * @system\n\t */\n\texport declare class StateValueBrand<T> {\n\t\tprivate readonly StateValue: StateValue<T>;\n\t}\n\n\t/**\n\t * This type provides no additional functionality over the type it wraps.\n\t * It is used to ensure type safety within package.\n\t * Users may find it convenient to just use the type it wraps directly.\n\t *\n\t * @privateRemarks\n\t * Checkout filtering omitting unknown from T (`Omit<T,unknown> &`).\n\t *\n\t * @system\n\t */\n\texport type StateValue<T> = T & StateValueBrand<T>;\n\n\t/**\n\t * Package internal function declaration for value manager instantiation.\n\t *\n\t * @system\n\t */\n\texport type ManagerFactory<\n\t\tTKey extends string,\n\t\tTValue extends ValueDirectoryOrState<any>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => any } & ((\n\t\tkey: TKey,\n\t\tdatastoreHandle: StateDatastoreHandle<TKey, TValue>,\n\t) => {\n\t\tvalue?: TValue;\n\t\tmanager: StateValue<TManager>;\n\t});\n\n\t/**\n\t * @system\n\t */\n\texport interface NotificationType {\n\t\tname: string;\n\t\targs: (JsonSerializable<unknown> & JsonDeserialized<unknown>)[];\n\t}\n}\n"]}
@@ -0,0 +1,63 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized, JsonSerializable } from "@fluidframework/presence/internal/core-interfaces";
6
+ /**
7
+ * Collection of utility types that are not intended to be used/imported
8
+ * directly outside of this package.
9
+ *
10
+ * @alpha
11
+ * @system
12
+ */
13
+ export declare namespace InternalUtilityTypes {
14
+ /**
15
+ * Recursively/deeply makes all properties of a type readonly.
16
+ *
17
+ * @system
18
+ */
19
+ type FullyReadonly<T> = {
20
+ readonly [K in keyof T]: FullyReadonly<T[K]>;
21
+ };
22
+ /**
23
+ * `true` iff the given type is an acceptable shape for a notification.
24
+ *
25
+ * @system
26
+ */
27
+ type IsNotificationEvent<Event> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P> & JsonDeserialized<P>, true, false> : false;
28
+ /**
29
+ * Used to specify the kinds of notifications emitted by a {@link NotificationSubscribable}.
30
+ *
31
+ * @remarks
32
+ *
33
+ * Any object type is a valid NotificationEvents, but only the notification-like
34
+ * properties of that type will be included.
35
+ *
36
+ * @example
37
+ *
38
+ * ```typescript
39
+ * interface MyNotifications {
40
+ * load: (user: string, data: IUserData) => void;
41
+ * requestPause: (period: number) => void;
42
+ * }
43
+ * ```
44
+ *
45
+ * @system
46
+ */
47
+ type NotificationEvents<E> = {
48
+ [P in string & keyof E as IsNotificationEvent<E[P]> extends true ? P : never]: E[P];
49
+ };
50
+ /**
51
+ * {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.
52
+ *
53
+ * @system
54
+ */
55
+ type JsonDeserializedParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? JsonDeserialized<P> : never;
56
+ /**
57
+ * {@link @fluidframework/core-interfaces#JsonSerializable} version of the parameters of a function.
58
+ *
59
+ * @system
60
+ */
61
+ type JsonSerializableParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? JsonSerializable<P> : never;
62
+ }
63
+ //# sourceMappingURL=exposedUtilityTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exposedUtilityTypes.d.ts","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,oBAAoB,IAAI,wBAAwB,EAChD,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,mDAAmD,CAAC;AAE3D;;;;;;GAMG;AAEH,yBAAiB,oBAAoB,CAAC;IACrC;;;;OAIG;IACH,KAAY,aAAa,CAAC,CAAC,IAAI;QAC9B,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5C,CAAC;IAEF;;;;OAIG;IACH,KAAY,mBAAmB,CAAC,KAAK,IAAI,KAAK,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,IAAI,GAC9E,wBAAwB,CAAC,UAAU,CACnC,CAAC,EACD,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,EACzC,IAAI,EACJ,KAAK,CACL,GACA,KAAK,CAAC;IAET;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAY,kBAAkB,CAAC,CAAC,IAAI;SAClC,CAAC,IAAI,MAAM,GAAG,MAAM,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;KACnF,CAAC;IAEF;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,SAAS,CACnF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,GAAG,GACL,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;IAET;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,SAAS,CACnF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,GAAG,GACL,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;CACT"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=exposedUtilityTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exposedUtilityTypes.js","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tInternalUtilityTypes as CoreInternalUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/presence/internal/core-interfaces\";\n\n/**\n * Collection of utility types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @alpha\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalUtilityTypes {\n\t/**\n\t * Recursively/deeply makes all properties of a type readonly.\n\t *\n\t * @system\n\t */\n\texport type FullyReadonly<T> = {\n\t\treadonly [K in keyof T]: FullyReadonly<T[K]>;\n\t};\n\n\t/**\n\t * `true` iff the given type is an acceptable shape for a notification.\n\t *\n\t * @system\n\t */\n\texport type IsNotificationEvent<Event> = Event extends (...args: infer P) => void\n\t\t? CoreInternalUtilityTypes.IfSameType<\n\t\t\t\tP,\n\t\t\t\tJsonSerializable<P> & JsonDeserialized<P>,\n\t\t\t\ttrue,\n\t\t\t\tfalse\n\t\t\t>\n\t\t: false;\n\n\t/**\n\t * Used to specify the kinds of notifications emitted by a {@link NotificationSubscribable}.\n\t *\n\t * @remarks\n\t *\n\t * Any object type is a valid NotificationEvents, but only the notification-like\n\t * properties of that type will be included.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * interface MyNotifications {\n\t * load: (user: string, data: IUserData) => void;\n\t * requestPause: (period: number) => void;\n\t * }\n\t * ```\n\t *\n\t * @system\n\t */\n\texport type NotificationEvents<E> = {\n\t\t[P in string & keyof E as IsNotificationEvent<E[P]> extends true ? P : never]: E[P];\n\t};\n\n\t/**\n\t * {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.\n\t *\n\t * @system\n\t */\n\texport type JsonDeserializedParameters<T extends (...args: any) => any> = T extends (\n\t\t...args: infer P\n\t) => any\n\t\t? JsonDeserialized<P>\n\t\t: never;\n\n\t/**\n\t * {@link @fluidframework/core-interfaces#JsonSerializable} version of the parameters of a function.\n\t *\n\t * @system\n\t */\n\texport type JsonSerializableParameters<T extends (...args: any) => any> = T extends (\n\t\t...args: infer P\n\t) => any\n\t\t? JsonSerializable<P>\n\t\t: never;\n}\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Experimental package for client presence within a connected session.
7
+ *
8
+ * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ export type { ClientConnectionId } from "./baseTypes.js";
13
+ export type { PresenceNotifications, PresenceNotificationsSchema, PresenceStates, PresenceStatesEntries, PresenceStatesEntry, PresenceStatesSchema, PresenceWorkspaceAddress, } from "./types.js";
14
+ export { type ClientSessionId, type IPresence, type ISessionClient, type PresenceEvents, SessionClientStatus, } from "./presence.js";
15
+ export { acquirePresence } from "./experimentalAccess.js";
16
+ export { acquirePresenceViaDataObject, type ExperimentalPresenceDO, ExperimentalPresenceManager, } from "./datastorePresenceManagerFactory.js";
17
+ export type { LatestValueControls } from "./latestValueControls.js";
18
+ export { LatestMap, type LatestMapItemRemovedClientData, type LatestMapItemValueClientData, type LatestMapValueClientData, type LatestMapValueManager, type LatestMapValueManagerEvents, type ValueMap, } from "./latestMapValueManager.js";
19
+ export { Latest, type LatestValueManager, type LatestValueManagerEvents, } from "./latestValueManager.js";
20
+ export type { LatestValueClientData, LatestValueData, LatestValueMetadata, } from "./latestValueTypes.js";
21
+ export { type NotificationEmitter, type NotificationSubscribable, type NotificationSubscriptions, Notifications, type NotificationsManager, type NotificationsManagerEvents, } from "./notificationsManager.js";
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAgBH,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,YAAY,EACX,qBAAqB,EACrB,2BAA2B,EAC3B,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,GACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,mBAAmB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,2BAA2B,GAC3B,MAAM,sCAAsC,CAAC;AAE9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACN,SAAS,EACT,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,QAAQ,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,MAAM,EACN,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,GAC7B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,qBAAqB,EACrB,eAAe,EACf,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,GAC/B,MAAM,2BAA2B,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { SessionClientStatus, } from "./presence.js";
6
+ export { acquirePresence } from "./experimentalAccess.js";
7
+ export { acquirePresenceViaDataObject, ExperimentalPresenceManager, } from "./datastorePresenceManagerFactory.js";
8
+ export { LatestMap, } from "./latestMapValueManager.js";
9
+ export { Latest, } from "./latestValueManager.js";
10
+ export { Notifications, } from "./notificationsManager.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoCH,OAAO,EAKN,mBAAmB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAE5B,2BAA2B,GAC3B,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACN,SAAS,GAOT,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,MAAM,GAGN,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAIN,aAAa,GAGb,MAAM,2BAA2B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Experimental package for client presence within a connected session.\n *\n * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.\n *\n * @packageDocumentation\n */\n\n// If desired these are the \"required\" types from core-interfaces.\n// export type {\n// \tInternalUtilityTypes,\n// \tJsonDeserialized,\n// \tJsonSerializable,\n// } from \"@fluidframework/presence/internal/core-interfaces\";\n\n// If desired these are the \"required\" types from events.\n// export type {\n// \tEvents,\n// \tIsEvent,\n// \tISubscribable,\n// } from \"@fluidframework/presence/internal/events\";\n\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tPresenceNotifications,\n\tPresenceNotificationsSchema,\n\tPresenceStates,\n\tPresenceStatesEntries,\n\tPresenceStatesEntry,\n\tPresenceStatesSchema,\n\tPresenceWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype ClientSessionId,\n\ttype IPresence,\n\ttype ISessionClient,\n\ttype PresenceEvents,\n\tSessionClientStatus,\n} from \"./presence.js\";\n\nexport { acquirePresence } from \"./experimentalAccess.js\";\n\nexport {\n\tacquirePresenceViaDataObject,\n\ttype ExperimentalPresenceDO,\n\tExperimentalPresenceManager,\n} from \"./datastorePresenceManagerFactory.js\";\n\nexport type { LatestValueControls } from \"./latestValueControls.js\";\nexport {\n\tLatestMap,\n\ttype LatestMapItemRemovedClientData,\n\ttype LatestMapItemValueClientData,\n\ttype LatestMapValueClientData,\n\ttype LatestMapValueManager,\n\ttype LatestMapValueManagerEvents,\n\ttype ValueMap,\n} from \"./latestMapValueManager.js\";\nexport {\n\tLatest,\n\ttype LatestValueManager,\n\ttype LatestValueManagerEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tLatestValueClientData,\n\tLatestValueData,\n\tLatestValueMetadata,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationSubscribable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n"]}
@@ -0,0 +1,39 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
6
+ import type { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
7
+ import type { InternalTypes } from "./exposedInternalTypes.js";
8
+ import type { ClientSessionId, ISessionClient } from "./presence.js";
9
+ import type { IRuntimeInternal } from "@fluidframework/presence/internal/container-definitions/internal";
10
+ /**
11
+ * @internal
12
+ */
13
+ export interface ClientRecord<TValue extends InternalTypes.ValueDirectoryOrState<unknown> | undefined> {
14
+ [ClientSessionId: ClientSessionId]: Exclude<TValue, undefined>;
15
+ }
16
+ /**
17
+ * Object.entries retyped to support branded string-based keys.
18
+ *
19
+ * @internal
20
+ */
21
+ export declare const brandedObjectEntries: <K extends string, T>(o: Record<K, T>) => [K, T][];
22
+ /**
23
+ * This interface is a subset of (IContainerRuntime & IRuntimeInternal) and
24
+ * (IFluidDataStoreRuntime) that is needed by the Presence States.
25
+ *
26
+ * @privateRemarks
27
+ * Replace with non-DataStore based interface.
28
+ *
29
+ * @internal
30
+ */
31
+ export type IEphemeralRuntime = Pick<(IContainerRuntime & IRuntimeInternal) | IFluidDataStoreRuntime, "clientId" | "connected" | "getAudience" | "getQuorum" | "off" | "on" | "submitSignal"> & Partial<Pick<IFluidDataStoreRuntime, "logger">>;
32
+ /**
33
+ * @internal
34
+ */
35
+ export interface ValueManager<TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>> {
36
+ readonly value?: TValueState;
37
+ update(client: ISessionClient, received: number, value: TValueState): void;
38
+ }
39
+ //# sourceMappingURL=internalTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalTypes.d.ts","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAE7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kEAAkE,CAAC;AAEzG;;GAEG;AACH,MAAM,WAAW,YAAY,CAC5B,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,SAAS;IAKvE,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,2BAC7B,OAAO,CAAC,EAAE,CAAC,CAAC,KACX,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAEd;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CACnC,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,GAAG,sBAAsB,EAC/D,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,WAAW,GAAG,KAAK,GAAG,IAAI,GAAG,cAAc,CACtF,GACA,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,YAAY,CAC5B,MAAM,EACN,WAAW,SACV,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC;IAG1F,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3E"}
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Object.entries retyped to support branded string-based keys.
7
+ *
8
+ * @internal
9
+ */
10
+ export const brandedObjectEntries = Object.entries;
11
+ //# sourceMappingURL=internalTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAE9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ClientSessionId, ISessionClient } from \"./presence.js\";\n\nimport type { IRuntimeInternal } from \"@fluidframework/presence/internal/container-definitions/internal\";\n\n/**\n * @internal\n */\nexport interface ClientRecord<\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown> | undefined,\n> {\n\t// Caution: any particular item may or may not exist\n\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t[ClientSessionId: ClientSessionId]: Exclude<TValue, undefined>;\n}\n\n/**\n * Object.entries retyped to support branded string-based keys.\n *\n * @internal\n */\nexport const brandedObjectEntries = Object.entries as <K extends string, T>(\n\to: Record<K, T>,\n) => [K, T][];\n\n/**\n * This interface is a subset of (IContainerRuntime & IRuntimeInternal) and\n * (IFluidDataStoreRuntime) that is needed by the Presence States.\n *\n * @privateRemarks\n * Replace with non-DataStore based interface.\n *\n * @internal\n */\nexport type IEphemeralRuntime = Pick<\n\t(IContainerRuntime & IRuntimeInternal) | IFluidDataStoreRuntime,\n\t\"clientId\" | \"connected\" | \"getAudience\" | \"getQuorum\" | \"off\" | \"on\" | \"submitSignal\"\n> &\n\tPartial<Pick<IFluidDataStoreRuntime, \"logger\">>;\n\n/**\n * @internal\n */\nexport interface ValueManager<\n\tTValue,\n\tTValueState extends\n\t\tInternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>,\n> {\n\t// Most value managers should provide value - implement Required<ValueManager<...>>\n\treadonly value?: TValueState;\n\tupdate(client: ISessionClient, received: number, value: TValueState): void;\n}\n"]}
@@ -0,0 +1,182 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { LatestValueControls } from "./latestValueControls.js";
6
+ import type { LatestValueClientData, LatestValueData, LatestValueMetadata } from "./latestValueTypes.js";
7
+ import type { ClientSessionId, ISessionClient } from "./presence.js";
8
+ import type { JsonDeserialized, JsonSerializable } from "@fluidframework/presence/internal/core-interfaces";
9
+ import type { ISubscribable } from "@fluidframework/presence/internal/events";
10
+ import type { InternalTypes } from "@fluidframework/presence/internal/exposedInternalTypes";
11
+ import type { InternalUtilityTypes } from "@fluidframework/presence/internal/exposedUtilityTypes";
12
+ /**
13
+ * Collection of latest known values for a specific client.
14
+ *
15
+ * @sealed
16
+ * @alpha
17
+ */
18
+ export interface LatestMapValueClientData<T, Keys extends string | number, SpecificSessionClientId extends ClientSessionId = ClientSessionId> {
19
+ /**
20
+ * Associated client.
21
+ */
22
+ client: ISessionClient<SpecificSessionClientId>;
23
+ /**
24
+ * @privateRemarks This could be regular map currently as no Map is
25
+ * stored internally and a new instance is created for every request.
26
+ */
27
+ items: ReadonlyMap<Keys, LatestValueData<T>>;
28
+ }
29
+ /**
30
+ * State of a single item value, its key, and its metadata.
31
+ *
32
+ * @sealed
33
+ * @alpha
34
+ */
35
+ export interface LatestMapItemValueClientData<T, K extends string | number> extends LatestValueClientData<T> {
36
+ key: K;
37
+ }
38
+ /**
39
+ * Identifier and metadata for a removed item.
40
+ *
41
+ * @sealed
42
+ * @alpha
43
+ */
44
+ export interface LatestMapItemRemovedClientData<K extends string | number> {
45
+ client: ISessionClient;
46
+ key: K;
47
+ metadata: LatestValueMetadata;
48
+ }
49
+ /**
50
+ * @sealed
51
+ * @alpha
52
+ */
53
+ export interface LatestMapValueManagerEvents<T, K extends string | number> {
54
+ /**
55
+ * Raised when any item's value for remote client is updated.
56
+ * @param updates - Map of one or more values updated.
57
+ *
58
+ * @remarks The event does not include item removals.
59
+ *
60
+ * @eventProperty
61
+ */
62
+ updated: (updates: LatestMapValueClientData<T, K>) => void;
63
+ /**
64
+ * Raised when specific item's value is updated.
65
+ * @param updatedItem - Updated item value.
66
+ *
67
+ * @eventProperty
68
+ */
69
+ itemUpdated: (updatedItem: LatestMapItemValueClientData<T, K>) => void;
70
+ /**
71
+ * Raised when specific item is removed.
72
+ * @param removedItem - Removed item.
73
+ *
74
+ * @eventProperty
75
+ */
76
+ itemRemoved: (removedItem: LatestMapItemRemovedClientData<K>) => void;
77
+ }
78
+ /**
79
+ * Map of local client's values. Modifications are transmitted to all other connected clients.
80
+ *
81
+ * @sealed
82
+ * @alpha
83
+ */
84
+ export interface ValueMap<K extends string | number, V> {
85
+ /**
86
+ * ${@link ValueMap.delete}s all elements in the ValueMap.
87
+ * @remarks This is not yet implemented.
88
+ */
89
+ clear(): void;
90
+ /**
91
+ * @returns true if an element in the ValueMap existed and has been removed, or false if
92
+ * the element does not exist.
93
+ * @remarks No entry is fully removed. Instead an undefined placeholder is locally and
94
+ * transmitted to all other clients. For better performance limit the number of deleted
95
+ * entries and reuse keys when possible.
96
+ * @privateRemarks In the future we may add a mechanism to remove the placeholder, at least
97
+ * from transmissions after sufficient time has passed.
98
+ */
99
+ delete(key: K): boolean;
100
+ /**
101
+ * Executes a provided function once per each key/value pair in the ValueMap, in arbitrary order.
102
+ */
103
+ forEach(callbackfn: (value: InternalUtilityTypes.FullyReadonly<JsonDeserialized<V>>, key: K, map: ValueMap<K, V>) => void, thisArg?: unknown): void;
104
+ /**
105
+ * Returns a specified element from the ValueMap object.
106
+ * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
107
+ */
108
+ get(key: K): InternalUtilityTypes.FullyReadonly<JsonDeserialized<V>> | undefined;
109
+ /**
110
+ * @returns boolean indicating whether an element with the specified key exists or not.
111
+ */
112
+ has(key: K): boolean;
113
+ /**
114
+ * Adds a new element with a specified key and value to the ValueMap. If an element with the same key already exists, the element will be updated.
115
+ * The value will be transmitted to all other connected clients.
116
+ *
117
+ * @remarks Manager assumes ownership of the value and its references.
118
+ * Make a deep clone before setting, if needed. No comparison is done to detect changes; all
119
+ * sets are transmitted.
120
+ */
121
+ set(key: K, value: JsonSerializable<V> & JsonDeserialized<V>): this;
122
+ /**
123
+ * @returns the number of elements in the ValueMap.
124
+ */
125
+ readonly size: number;
126
+ /**
127
+ * Returns an iterable of entries in the map.
128
+ */
129
+ /**
130
+ * Returns an iterable of key, value pairs for every entry in the map.
131
+ */
132
+ /**
133
+ * Returns an iterable of keys in the map.
134
+ */
135
+ keys(): IterableIterator<K>;
136
+ }
137
+ /**
138
+ * Value manager that provides a `Map` of latest known values from this client to
139
+ * others and read access to their values.
140
+ * Entries in the map may vary over time and by client, but all values are expected to
141
+ * be of the same type, which may be a union type.
142
+ *
143
+ * @remarks Create using {@link LatestMap} registered to {@link PresenceStates}.
144
+ *
145
+ * @sealed
146
+ * @alpha
147
+ */
148
+ export interface LatestMapValueManager<T, Keys extends string | number = string | number> {
149
+ /**
150
+ * Events for LatestMap value manager.
151
+ */
152
+ readonly events: ISubscribable<LatestMapValueManagerEvents<T, Keys>>;
153
+ /**
154
+ * Controls for management of sending updates.
155
+ */
156
+ readonly controls: LatestValueControls;
157
+ /**
158
+ * Current value map for this client.
159
+ */
160
+ readonly local: ValueMap<Keys, T>;
161
+ /**
162
+ * Iterable access to remote clients' map of values.
163
+ */
164
+ clientValues(): IterableIterator<LatestMapValueClientData<T, Keys>>;
165
+ /**
166
+ * Array of known clients.
167
+ */
168
+ clients(): ISessionClient[];
169
+ /**
170
+ * Access to a specific client's map of values.
171
+ */
172
+ clientValue(client: ISessionClient): ReadonlyMap<Keys, LatestValueData<T>>;
173
+ }
174
+ /**
175
+ * Factory for creating a {@link LatestMapValueManager}.
176
+ *
177
+ * @alpha
178
+ */
179
+ export declare function LatestMap<T extends object, Keys extends string | number = string | number, RegistrationKey extends string = string>(initialValues?: {
180
+ [K in Keys]: JsonSerializable<T> & JsonDeserialized<T>;
181
+ }, controls?: LatestValueControls): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T>, LatestMapValueManager<T, Keys>>;
182
+ //# sourceMappingURL=latestMapValueManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,mBAAmB,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