@fluidframework/presence 2.92.0 → 2.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/README.md +4 -4
  2. package/dist/alpha.d.ts +6 -4
  3. package/dist/beta.d.ts +5 -2
  4. package/dist/getPresence.d.ts +4 -9
  5. package/dist/getPresence.d.ts.map +1 -1
  6. package/dist/getPresence.js +6 -86
  7. package/dist/getPresence.js.map +1 -1
  8. package/dist/index.d.ts +4 -13
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +8 -8
  11. package/dist/index.js.map +1 -1
  12. package/dist/legacy.alpha.d.ts +6 -4
  13. package/dist/package.json +1 -15
  14. package/dist/public.d.ts +69 -0
  15. package/lib/alpha.d.ts +6 -4
  16. package/lib/beta.d.ts +5 -2
  17. package/lib/getPresence.d.ts +4 -9
  18. package/lib/getPresence.d.ts.map +1 -1
  19. package/lib/getPresence.js +6 -85
  20. package/lib/getPresence.js.map +1 -1
  21. package/lib/index.d.ts +4 -13
  22. package/lib/index.d.ts.map +1 -1
  23. package/lib/index.js +5 -4
  24. package/lib/index.js.map +1 -1
  25. package/lib/legacy.alpha.d.ts +6 -4
  26. package/lib/public.d.ts +69 -0
  27. package/lib/tsdoc-metadata.json +11 -0
  28. package/package.json +32 -78
  29. package/dist/baseTypes.d.ts +0 -24
  30. package/dist/baseTypes.d.ts.map +0 -1
  31. package/dist/baseTypes.js +0 -7
  32. package/dist/baseTypes.js.map +0 -1
  33. package/dist/broadcastControls.d.ts +0 -37
  34. package/dist/broadcastControls.d.ts.map +0 -1
  35. package/dist/broadcastControls.js +0 -60
  36. package/dist/broadcastControls.js.map +0 -1
  37. package/dist/broadcastControlsTypes.d.ts +0 -38
  38. package/dist/broadcastControlsTypes.d.ts.map +0 -1
  39. package/dist/broadcastControlsTypes.js +0 -7
  40. package/dist/broadcastControlsTypes.js.map +0 -1
  41. package/dist/exposedInternalTypes.d.ts +0 -138
  42. package/dist/exposedInternalTypes.d.ts.map +0 -1
  43. package/dist/exposedInternalTypes.js +0 -19
  44. package/dist/exposedInternalTypes.js.map +0 -1
  45. package/dist/exposedUtilityTypes.d.ts +0 -108
  46. package/dist/exposedUtilityTypes.d.ts.map +0 -1
  47. package/dist/exposedUtilityTypes.js +0 -7
  48. package/dist/exposedUtilityTypes.js.map +0 -1
  49. package/dist/internalUtils.d.ts +0 -125
  50. package/dist/internalUtils.d.ts.map +0 -1
  51. package/dist/internalUtils.js +0 -99
  52. package/dist/internalUtils.js.map +0 -1
  53. package/dist/latestMapTypes.d.ts +0 -343
  54. package/dist/latestMapTypes.d.ts.map +0 -1
  55. package/dist/latestMapTypes.js +0 -7
  56. package/dist/latestMapTypes.js.map +0 -1
  57. package/dist/latestMapValueManager.d.ts +0 -52
  58. package/dist/latestMapValueManager.d.ts.map +0 -1
  59. package/dist/latestMapValueManager.js +0 -250
  60. package/dist/latestMapValueManager.js.map +0 -1
  61. package/dist/latestTypes.d.ts +0 -183
  62. package/dist/latestTypes.d.ts.map +0 -1
  63. package/dist/latestTypes.js +0 -7
  64. package/dist/latestTypes.js.map +0 -1
  65. package/dist/latestValueManager.d.ts +0 -10
  66. package/dist/latestValueManager.d.ts.map +0 -1
  67. package/dist/latestValueManager.js +0 -117
  68. package/dist/latestValueManager.js.map +0 -1
  69. package/dist/latestValueTypes.d.ts +0 -108
  70. package/dist/latestValueTypes.d.ts.map +0 -1
  71. package/dist/latestValueTypes.js +0 -7
  72. package/dist/latestValueTypes.js.map +0 -1
  73. package/dist/notificationsManager.d.ts +0 -27
  74. package/dist/notificationsManager.d.ts.map +0 -1
  75. package/dist/notificationsManager.js +0 -98
  76. package/dist/notificationsManager.js.map +0 -1
  77. package/dist/notificationsManagerTypes.d.ts +0 -144
  78. package/dist/notificationsManagerTypes.d.ts.map +0 -1
  79. package/dist/notificationsManagerTypes.js +0 -7
  80. package/dist/notificationsManagerTypes.js.map +0 -1
  81. package/dist/packageVersion.d.ts +0 -9
  82. package/dist/packageVersion.d.ts.map +0 -1
  83. package/dist/packageVersion.js +0 -12
  84. package/dist/packageVersion.js.map +0 -1
  85. package/dist/presence.d.ts +0 -229
  86. package/dist/presence.d.ts.map +0 -1
  87. package/dist/presence.js +0 -23
  88. package/dist/presence.js.map +0 -1
  89. package/dist/presenceDatastoreManager.d.ts +0 -149
  90. package/dist/presenceDatastoreManager.d.ts.map +0 -1
  91. package/dist/presenceDatastoreManager.js +0 -667
  92. package/dist/presenceDatastoreManager.js.map +0 -1
  93. package/dist/presenceManager.d.ts +0 -16
  94. package/dist/presenceManager.d.ts.map +0 -1
  95. package/dist/presenceManager.js +0 -140
  96. package/dist/presenceManager.js.map +0 -1
  97. package/dist/presenceStates.d.ts +0 -102
  98. package/dist/presenceStates.d.ts.map +0 -1
  99. package/dist/presenceStates.js +0 -231
  100. package/dist/presenceStates.js.map +0 -1
  101. package/dist/protocol.d.ts +0 -111
  102. package/dist/protocol.d.ts.map +0 -1
  103. package/dist/protocol.js +0 -20
  104. package/dist/protocol.js.map +0 -1
  105. package/dist/runtimeTypes.d.ts +0 -26
  106. package/dist/runtimeTypes.d.ts.map +0 -1
  107. package/dist/runtimeTypes.js +0 -7
  108. package/dist/runtimeTypes.js.map +0 -1
  109. package/dist/stateDatastore.d.ts +0 -56
  110. package/dist/stateDatastore.d.ts.map +0 -1
  111. package/dist/stateDatastore.js +0 -22
  112. package/dist/stateDatastore.js.map +0 -1
  113. package/dist/stateFactory.d.ts +0 -18
  114. package/dist/stateFactory.d.ts.map +0 -1
  115. package/dist/stateFactory.js +0 -23
  116. package/dist/stateFactory.js.map +0 -1
  117. package/dist/statesManagerTypes.d.ts +0 -27
  118. package/dist/statesManagerTypes.d.ts.map +0 -1
  119. package/dist/statesManagerTypes.js +0 -7
  120. package/dist/statesManagerTypes.js.map +0 -1
  121. package/dist/systemWorkspace.d.ts +0 -58
  122. package/dist/systemWorkspace.d.ts.map +0 -1
  123. package/dist/systemWorkspace.js +0 -265
  124. package/dist/systemWorkspace.js.map +0 -1
  125. package/dist/timerManager.d.ts +0 -37
  126. package/dist/timerManager.d.ts.map +0 -1
  127. package/dist/timerManager.js +0 -65
  128. package/dist/timerManager.js.map +0 -1
  129. package/dist/types.d.ts +0 -132
  130. package/dist/types.d.ts.map +0 -1
  131. package/dist/types.js +0 -7
  132. package/dist/types.js.map +0 -1
  133. package/dist/validatableTypes.d.ts +0 -69
  134. package/dist/validatableTypes.d.ts.map +0 -1
  135. package/dist/validatableTypes.js +0 -7
  136. package/dist/validatableTypes.js.map +0 -1
  137. package/dist/validatedGetter.d.ts +0 -18
  138. package/dist/validatedGetter.d.ts.map +0 -1
  139. package/dist/validatedGetter.js +0 -43
  140. package/dist/validatedGetter.js.map +0 -1
  141. package/dist/valueManager.d.ts +0 -15
  142. package/dist/valueManager.d.ts.map +0 -1
  143. package/dist/valueManager.js +0 -22
  144. package/dist/valueManager.js.map +0 -1
  145. package/lib/baseTypes.d.ts +0 -24
  146. package/lib/baseTypes.d.ts.map +0 -1
  147. package/lib/baseTypes.js +0 -6
  148. package/lib/baseTypes.js.map +0 -1
  149. package/lib/broadcastControls.d.ts +0 -37
  150. package/lib/broadcastControls.d.ts.map +0 -1
  151. package/lib/broadcastControls.js +0 -55
  152. package/lib/broadcastControls.js.map +0 -1
  153. package/lib/broadcastControlsTypes.d.ts +0 -38
  154. package/lib/broadcastControlsTypes.d.ts.map +0 -1
  155. package/lib/broadcastControlsTypes.js +0 -6
  156. package/lib/broadcastControlsTypes.js.map +0 -1
  157. package/lib/exposedInternalTypes.d.ts +0 -138
  158. package/lib/exposedInternalTypes.d.ts.map +0 -1
  159. package/lib/exposedInternalTypes.js +0 -16
  160. package/lib/exposedInternalTypes.js.map +0 -1
  161. package/lib/exposedUtilityTypes.d.ts +0 -108
  162. package/lib/exposedUtilityTypes.d.ts.map +0 -1
  163. package/lib/exposedUtilityTypes.js +0 -6
  164. package/lib/exposedUtilityTypes.js.map +0 -1
  165. package/lib/internalUtils.d.ts +0 -125
  166. package/lib/internalUtils.d.ts.map +0 -1
  167. package/lib/internalUtils.js +0 -90
  168. package/lib/internalUtils.js.map +0 -1
  169. package/lib/latestMapTypes.d.ts +0 -343
  170. package/lib/latestMapTypes.d.ts.map +0 -1
  171. package/lib/latestMapTypes.js +0 -6
  172. package/lib/latestMapTypes.js.map +0 -1
  173. package/lib/latestMapValueManager.d.ts +0 -52
  174. package/lib/latestMapValueManager.d.ts.map +0 -1
  175. package/lib/latestMapValueManager.js +0 -246
  176. package/lib/latestMapValueManager.js.map +0 -1
  177. package/lib/latestTypes.d.ts +0 -183
  178. package/lib/latestTypes.d.ts.map +0 -1
  179. package/lib/latestTypes.js +0 -6
  180. package/lib/latestTypes.js.map +0 -1
  181. package/lib/latestValueManager.d.ts +0 -10
  182. package/lib/latestValueManager.d.ts.map +0 -1
  183. package/lib/latestValueManager.js +0 -113
  184. package/lib/latestValueManager.js.map +0 -1
  185. package/lib/latestValueTypes.d.ts +0 -108
  186. package/lib/latestValueTypes.d.ts.map +0 -1
  187. package/lib/latestValueTypes.js +0 -6
  188. package/lib/latestValueTypes.js.map +0 -1
  189. package/lib/notificationsManager.d.ts +0 -27
  190. package/lib/notificationsManager.d.ts.map +0 -1
  191. package/lib/notificationsManager.js +0 -94
  192. package/lib/notificationsManager.js.map +0 -1
  193. package/lib/notificationsManagerTypes.d.ts +0 -144
  194. package/lib/notificationsManagerTypes.d.ts.map +0 -1
  195. package/lib/notificationsManagerTypes.js +0 -6
  196. package/lib/notificationsManagerTypes.js.map +0 -1
  197. package/lib/packageVersion.d.ts +0 -9
  198. package/lib/packageVersion.d.ts.map +0 -1
  199. package/lib/packageVersion.js +0 -9
  200. package/lib/packageVersion.js.map +0 -1
  201. package/lib/presence.d.ts +0 -229
  202. package/lib/presence.d.ts.map +0 -1
  203. package/lib/presence.js +0 -20
  204. package/lib/presence.js.map +0 -1
  205. package/lib/presenceDatastoreManager.d.ts +0 -149
  206. package/lib/presenceDatastoreManager.d.ts.map +0 -1
  207. package/lib/presenceDatastoreManager.js +0 -663
  208. package/lib/presenceDatastoreManager.js.map +0 -1
  209. package/lib/presenceManager.d.ts +0 -16
  210. package/lib/presenceManager.d.ts.map +0 -1
  211. package/lib/presenceManager.js +0 -136
  212. package/lib/presenceManager.js.map +0 -1
  213. package/lib/presenceStates.d.ts +0 -102
  214. package/lib/presenceStates.d.ts.map +0 -1
  215. package/lib/presenceStates.js +0 -225
  216. package/lib/presenceStates.js.map +0 -1
  217. package/lib/protocol.d.ts +0 -111
  218. package/lib/protocol.d.ts.map +0 -1
  219. package/lib/protocol.js +0 -17
  220. package/lib/protocol.js.map +0 -1
  221. package/lib/runtimeTypes.d.ts +0 -26
  222. package/lib/runtimeTypes.d.ts.map +0 -1
  223. package/lib/runtimeTypes.js +0 -6
  224. package/lib/runtimeTypes.js.map +0 -1
  225. package/lib/stateDatastore.d.ts +0 -56
  226. package/lib/stateDatastore.d.ts.map +0 -1
  227. package/lib/stateDatastore.js +0 -17
  228. package/lib/stateDatastore.js.map +0 -1
  229. package/lib/stateFactory.d.ts +0 -18
  230. package/lib/stateFactory.d.ts.map +0 -1
  231. package/lib/stateFactory.js +0 -20
  232. package/lib/stateFactory.js.map +0 -1
  233. package/lib/statesManagerTypes.d.ts +0 -27
  234. package/lib/statesManagerTypes.d.ts.map +0 -1
  235. package/lib/statesManagerTypes.js +0 -6
  236. package/lib/statesManagerTypes.js.map +0 -1
  237. package/lib/systemWorkspace.d.ts +0 -58
  238. package/lib/systemWorkspace.d.ts.map +0 -1
  239. package/lib/systemWorkspace.js +0 -261
  240. package/lib/systemWorkspace.js.map +0 -1
  241. package/lib/timerManager.d.ts +0 -37
  242. package/lib/timerManager.d.ts.map +0 -1
  243. package/lib/timerManager.js +0 -61
  244. package/lib/timerManager.js.map +0 -1
  245. package/lib/types.d.ts +0 -132
  246. package/lib/types.d.ts.map +0 -1
  247. package/lib/types.js +0 -6
  248. package/lib/types.js.map +0 -1
  249. package/lib/validatableTypes.d.ts +0 -69
  250. package/lib/validatableTypes.d.ts.map +0 -1
  251. package/lib/validatableTypes.js +0 -6
  252. package/lib/validatableTypes.js.map +0 -1
  253. package/lib/validatedGetter.d.ts +0 -18
  254. package/lib/validatedGetter.d.ts.map +0 -1
  255. package/lib/validatedGetter.js +0 -39
  256. package/lib/validatedGetter.js.map +0 -1
  257. package/lib/valueManager.d.ts +0 -15
  258. package/lib/valueManager.d.ts.map +0 -1
  259. package/lib/valueManager.js +0 -17
  260. package/lib/valueManager.js.map +0 -1
@@ -1,99 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isValueRequiredState = exports.toOpaqueJson = exports.revealOpaqueJson = exports.asDeeplyReadonlyDeserializedJson = exports.asDeeplyReadonly = exports.getOrCreateRecord = exports.objectKeys = exports.objectEntriesWithoutUndefined = exports.objectEntries = void 0;
8
- /**
9
- * Object.entries retyped to preserve known keys and their types.
10
- *
11
- * @privateRemarks
12
- * The is a defect in this utility when a string index appears in the object.
13
- * In such a case, the only result is `[string, T]`, where `T` is the type
14
- * of the string index entry.
15
- */
16
- exports.objectEntries = Object.entries;
17
- /**
18
- * Object.entries retyped to preserve known keys and their types.
19
- *
20
- * @remarks
21
- * Given `T` should not contain `undefined` values. If it does, use
22
- * {@link objectEntries} instead. Without `undefined` values, this
23
- * typing provides best handling of objects with optional properties.
24
- */
25
- exports.objectEntriesWithoutUndefined = Object.entries;
26
- /**
27
- * Object.keys retyped to preserve known keys and their types.
28
- */
29
- exports.objectKeys = Object.keys;
30
- /**
31
- * Retrieve a value from a record with the given key, or create a new entry if
32
- * the key is not in the record.
33
- *
34
- * @param record - The record to index/update
35
- * @param key - The key to lookup in the record
36
- * @param defaultValue - a function which returns a default value. This is
37
- * called and used to set an initial value for the given key in the record if
38
- * none exists.
39
- * @returns either the existing value for the given key, or the newly-created
40
- * value (the result of `defaultValue`)
41
- */
42
- function getOrCreateRecord(record, key, defaultValue) {
43
- if (!(key in record)) {
44
- record[key] = defaultValue(key);
45
- }
46
- return record[key];
47
- }
48
- exports.getOrCreateRecord = getOrCreateRecord;
49
- /**
50
- * No-runtime-effect helper to apply deep immutability to a value's type.
51
- */
52
- function asDeeplyReadonly(value) {
53
- return value;
54
- }
55
- exports.asDeeplyReadonly = asDeeplyReadonly;
56
- /**
57
- * No-runtime-effect helper to apply deep immutability to a value's opaque JSON
58
- * type, revealing the JSON type.
59
- */
60
- function asDeeplyReadonlyDeserializedJson(value) {
61
- return value;
62
- }
63
- exports.asDeeplyReadonlyDeserializedJson = asDeeplyReadonlyDeserializedJson;
64
- /**
65
- * No-runtime-effect helper to reveal the JSON type from a value's opaque JSON
66
- * types throughout a structure.
67
- *
68
- * @remarks
69
- * {@link OpaqueJsonDeserialized} instances will be replaced shallowly such
70
- * that nested instances are retained.
71
- */
72
- function revealOpaqueJson(value) {
73
- return value;
74
- }
75
- exports.revealOpaqueJson = revealOpaqueJson;
76
- /**
77
- * No-runtime-effect helper to automatically cast JSON type to Opaque JSON type
78
- * at outermost scope.
79
- *
80
- * @remarks
81
- * Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,
82
- * the return type is both {@link OpaqueJsonSerializable} and
83
- * {@link OpaqueJsonDeserialized}.
84
- */
85
- function toOpaqueJson(value) {
86
- return value;
87
- }
88
- exports.toOpaqueJson = toOpaqueJson;
89
- /**
90
- * Type guard to check if a state is a required state (has a value).
91
- *
92
- * @param state - The state to check
93
- * @returns True if the state has a value and is therefore a {@link ValidatableRequiredState}
94
- */
95
- function isValueRequiredState(state) {
96
- return state.value !== undefined;
97
- }
98
- exports.isValueRequiredState = isValueRequiredState;
99
- //# sourceMappingURL=internalUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internalUtils.js","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiCH;;;;;;;GAOG;AACU,QAAA,aAAa,GAAG,MAAM,CAAC,OAA8C,CAAC;AAEnF;;;;;;;GAOG;AACU,QAAA,6BAA6B,GAAG,MAAM,CAAC,OAEN,CAAC;AAE/C;;GAEG;AACU,QAAA,UAAU,GAAG,MAAM,CAAC,IAEU,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,SAAgB,iBAAiB,CAChC,MAAoB,EACpB,GAAM,EACN,YAA2B;IAE3B,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AATD,8CASC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAI,KAAQ;IAC3C,OAAO,KAAwB,CAAC;AACjC,CAAC;AAFD,4CAEC;AASD;;;GAGG;AACH,SAAgB,gCAAgC,CAC/C,KAA4C;IAE5C,OAAO,KAAsD,CAAC;AAC/D,CAAC;AAJD,4EAIC;AAWD;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAI,KAAQ;IAC3C,OAAO,KAAwC,CAAC;AACjD,CAAC;AAFD,4CAEC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC3B,KAA0B;IAE1B,OAAO,KAA8D,CAAC;AACvE,CAAC;AAJD,oCAIC;AA+CD;;;;;GAKG;AACH,SAAgB,oBAAoB,CACnC,KAAgE;IAEhE,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC;AAClC,CAAC;AAJD,oDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tDeepReadonly,\n\tInternalCoreInterfacesUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n\tOpaqueJsonDeserialized,\n\tOpaqueJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type {\n\tValidatableOptionalState,\n\tValidatableRequiredState,\n} from \"./validatableTypes.js\";\n\n/**\n * Returns union of types of values in a record.\n */\nexport type RecordEntryTypes<T> = T[keyof T];\n\ntype MapNumberIndicesToStrings<T> = {\n\t[K in keyof T as K extends number ? `${K}` : K]: T[K];\n};\n\ntype KeyValuePairs<T> = {\n\t[K in keyof MapNumberIndicesToStrings<Required<T>>]: [K, Required<T>[K]];\n}[keyof MapNumberIndicesToStrings<Required<T>>][];\n\ntype RequiredAndNotUndefined<T> = {\n\t[K in keyof T]-?: Exclude<T[K], undefined>;\n};\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @privateRemarks\n * The is a defect in this utility when a string index appears in the object.\n * In such a case, the only result is `[string, T]`, where `T` is the type\n * of the string index entry.\n */\nexport const objectEntries = Object.entries as <const T>(o: T) => KeyValuePairs<T>;\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @remarks\n * Given `T` should not contain `undefined` values. If it does, use\n * {@link objectEntries} instead. Without `undefined` values, this\n * typing provides best handling of objects with optional properties.\n */\nexport const objectEntriesWithoutUndefined = Object.entries as <const T>(\n\to: T,\n) => KeyValuePairs<RequiredAndNotUndefined<T>>;\n\n/**\n * Object.keys retyped to preserve known keys and their types.\n */\nexport const objectKeys = Object.keys as <const T>(\n\to: T,\n) => (keyof MapNumberIndicesToStrings<T>)[];\n\n/**\n * Retrieve a value from a record with the given key, or create a new entry if\n * the key is not in the record.\n *\n * @param record - The record to index/update\n * @param key - The key to lookup in the record\n * @param defaultValue - a function which returns a default value. This is\n * called and used to set an initial value for the given key in the record if\n * none exists.\n * @returns either the existing value for the given key, or the newly-created\n * value (the result of `defaultValue`)\n */\nexport function getOrCreateRecord<const K extends string | number | symbol, const V>(\n\trecord: Record<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tif (!(key in record)) {\n\t\trecord[key] = defaultValue(key);\n\t}\n\treturn record[key];\n}\n\n/**\n * No-runtime-effect helper to apply deep immutability to a value's type.\n */\nexport function asDeeplyReadonly<T>(value: T): DeepReadonly<T> {\n\treturn value as DeepReadonly<T>;\n}\n\n// function overloads\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T>,\n): DeepReadonly<JsonDeserialized<T>>;\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined;\n/**\n * No-runtime-effect helper to apply deep immutability to a value's opaque JSON\n * type, revealing the JSON type.\n */\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined {\n\treturn value as DeepReadonly<JsonDeserialized<T>> | undefined;\n}\n\n/**\n * Conditional type that reveals the underlying JSON type of an opaque JSON value. If `T` is an object, the key values\n * will be revealed.\n */\ntype RevealOpaqueJsonDeserialized<T> =\n\tT extends OpaqueJsonDeserialized<infer U>\n\t\t? JsonDeserialized<U>\n\t\t: { [Key in keyof T]: RevealOpaqueJsonDeserialized<T[Key]> };\n\n/**\n * No-runtime-effect helper to reveal the JSON type from a value's opaque JSON\n * types throughout a structure.\n *\n * @remarks\n * {@link OpaqueJsonDeserialized} instances will be replaced shallowly such\n * that nested instances are retained.\n */\nexport function revealOpaqueJson<T>(value: T): RevealOpaqueJsonDeserialized<T> {\n\treturn value as RevealOpaqueJsonDeserialized<T>;\n}\n\n/**\n * No-runtime-effect helper to automatically cast JSON type to Opaque JSON type\n * at outermost scope.\n *\n * @remarks\n * Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,\n * the return type is both {@link OpaqueJsonSerializable} and\n * {@link OpaqueJsonDeserialized}.\n */\nexport function toOpaqueJson<const T>(\n\tvalue: JsonSerializable<T>,\n): OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T> {\n\treturn value as OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T>;\n}\n\n/**\n * Convert a union of types to an intersection of those types.\n *\n * @privateRemarks\n * First an always true extends clause is used (T extends T) to distribute T\n * into to a union of types contravariant over each member of the T union.\n * Then the constraint on the type parameter in this new context is inferred,\n * giving the intersection.\n *\n * Future: This definition is identical to one in `packages/dds/tree/src/util/typeUtils.ts`\n * and should be consolidated.\n */\ntype UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (\n\tk: infer U,\n) => unknown\n\t? U\n\t: never;\n\n/**\n * Generates a union of types that are the remainder from a simple\n * Pick combination (that is the set of common properties).\n */\ntype PickRemainder<T> =\n\tPick<T, keyof T> extends infer Common\n\t\t? T extends unknown\n\t\t\t? Omit<T, keyof Common>\n\t\t\t: never\n\t\t: never;\n\n/**\n * Combines union of structure into a single structure where common properties\n * are unions of their respective types and optional properties are defined for\n * properties that are not common to each union member.\n *\n * @remarks\n * If a property is common to multiple, but not all union member and the\n * types are incompatible, the resulting type will be `never` for that\n * property. (This can be fixed, but might be best addressed by changing\n * T to be a tuple of types to be combined.)\n */\nexport type FlattenUnionWithOptionals<T> =\n\tInternalCoreInterfacesUtilityTypes.FlattenIntersection<\n\t\tPick<T, keyof T> & UnionToIntersection<Partial<PickRemainder<T>>>\n\t>;\n\n/**\n * Type guard to check if a state is a required state (has a value).\n *\n * @param state - The state to check\n * @returns True if the state has a value and is therefore a {@link ValidatableRequiredState}\n */\nexport function isValueRequiredState<T>(\n\tstate: ValidatableRequiredState<T> | ValidatableOptionalState<T>,\n): state is ValidatableRequiredState<T> {\n\treturn state.value !== undefined;\n}\n"]}
@@ -1,343 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { Listenable } from "@fluidframework/core-interfaces";
6
- import type { DeepReadonly, JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
7
- import type { BroadcastControls, BroadcastControlSettings } from "./broadcastControlsTypes.js";
8
- import type { InternalTypes } from "./exposedInternalTypes.js";
9
- import type { LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor } from "./latestValueTypes.js";
10
- import type { Attendee, AttendeeId, Presence } from "./presence.js";
11
- /**
12
- * A validator function that can optionally be provided to do runtime validation
13
- * of the custom key listed in a {@link LatestMap}.
14
- *
15
- * @param unvalidatedKey - The unknown key that should be validated.
16
- *
17
- * @returns True if the key is valid.
18
- *
19
- * @beta
20
- */
21
- export type KeySchemaValidator<Keys extends string> = (unvalidatedKey: string) => unvalidatedKey is Keys;
22
- /**
23
- * Collection of latest known values for a specific {@link Attendee}.
24
- *
25
- * @sealed
26
- * @beta
27
- */
28
- export interface LatestMapClientData<T, Keys extends string, TValueAccessor extends ValueAccessor<T>, SpecificAttendeeId extends AttendeeId = AttendeeId> {
29
- /**
30
- * Associated {@link Attendee}.
31
- */
32
- attendee: Attendee<SpecificAttendeeId>;
33
- /**
34
- * Map of items for the state.
35
- *
36
- * @privateRemarks This could be regular map currently as no Map is
37
- * stored internally and a new instance is created for every request.
38
- */
39
- items: ReadonlyMap<Keys, LatestData<T, TValueAccessor>>;
40
- }
41
- /**
42
- * State of a single item value, its key, and its metadata.
43
- *
44
- * @sealed
45
- * @beta
46
- */
47
- export interface LatestMapItemUpdatedClientData<T, K extends string, TValueAccessor extends ValueAccessor<T>> extends LatestClientData<T, TValueAccessor> {
48
- /**
49
- * Key of the updated item.
50
- */
51
- key: K;
52
- }
53
- /**
54
- * Identifier and metadata for a removed item.
55
- *
56
- * @sealed
57
- * @beta
58
- */
59
- export interface LatestMapItemRemovedClientData<K extends string> {
60
- /**
61
- * Associated {@link Attendee}.
62
- */
63
- attendee: Attendee;
64
- /**
65
- * Key of the removed item.
66
- */
67
- key: K;
68
- /**
69
- * Metadata associated with the removal of the item.
70
- */
71
- metadata: LatestMetadata;
72
- }
73
- /**
74
- * Events from {@link LatestMapRaw}.
75
- *
76
- * @sealed
77
- * @beta
78
- */
79
- export interface LatestMapEvents<T, K extends string, TRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
80
- /**
81
- * Raised when any item's value for remote client is updated.
82
- * @param updates - Map of one or more values updated.
83
- *
84
- * @remarks The event does not include item removals.
85
- *
86
- * @eventProperty
87
- */
88
- remoteUpdated: (updates: LatestMapClientData<T, K, TRemoteValueAccessor>) => void;
89
- /**
90
- * Raised when specific item's value of remote client is updated.
91
- * @param updatedItem - Updated item value.
92
- *
93
- * @eventProperty
94
- */
95
- remoteItemUpdated: (updatedItem: LatestMapItemUpdatedClientData<T, K, TRemoteValueAccessor>) => void;
96
- /**
97
- * Raised when specific item of remote client is removed.
98
- * @param removedItem - Removed item.
99
- *
100
- * @eventProperty
101
- */
102
- remoteItemRemoved: (removedItem: LatestMapItemRemovedClientData<K>) => void;
103
- /**
104
- * Raised when specific local item's value is updated.
105
- * @param updatedItem - Updated item value.
106
- *
107
- * @eventProperty
108
- */
109
- localItemUpdated: (updatedItem: {
110
- value: DeepReadonly<JsonSerializable<T>>;
111
- key: K;
112
- }) => void;
113
- /**
114
- * Raised when specific local item is removed.
115
- * @param removedItem - Removed item.
116
- *
117
- * @eventProperty
118
- */
119
- localItemRemoved: (removedItem: {
120
- key: K;
121
- }) => void;
122
- }
123
- /**
124
- * Events from {@link LatestMapRaw}.
125
- *
126
- * @sealed
127
- * @beta
128
- */
129
- export type LatestMapRawEvents<T, K extends string> = LatestMapEvents<T, K, RawValueAccessor<T>>;
130
- /**
131
- * Map of local client's values. Modifications are transmitted to all other connected clients.
132
- *
133
- * @sealed
134
- * @beta
135
- */
136
- export interface StateMap<K extends string, V> {
137
- /**
138
- * ${@link StateMap.delete}s all elements in the StateMap.
139
- * @remarks This is not yet implemented.
140
- */
141
- clear(): void;
142
- /**
143
- * Removes the element with the specified key from the StateMap, if it exists.
144
- *
145
- * @returns true if an element in the StateMap existed and has been removed, or false if
146
- * the element does not exist.
147
- * @remarks No entry is fully removed. Instead an undefined placeholder is locally and
148
- * transmitted to all other clients. For better performance limit the number of deleted
149
- * entries and reuse keys when possible.
150
- * @privateRemarks In the future we may add a mechanism to remove the placeholder, at least
151
- * from transmissions after sufficient time has passed.
152
- */
153
- delete(key: K): boolean;
154
- /**
155
- * Executes a provided function once per each key/value pair in the StateMap, in arbitrary order.
156
- */
157
- forEach(callbackfn: (value: DeepReadonly<JsonDeserialized<V>>, key: K, map: StateMap<K, V>) => void, thisArg?: unknown): void;
158
- /**
159
- * Returns the element with the specified key from the StateMap, if it exists.
160
- *
161
- * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
162
- */
163
- get(key: K): DeepReadonly<JsonDeserialized<V>> | undefined;
164
- /**
165
- * Checks if an element with the specified key exists in the StateMap.
166
- * @returns boolean indicating whether an element with the specified key exists or not.
167
- */
168
- has(key: K): boolean;
169
- /**
170
- * Adds a new element with a specified key and value to the StateMap. If an element with the same key already exists, the element will be updated.
171
- * The value will be transmitted to all other connected clients.
172
- *
173
- * @remarks Manager assumes ownership of the value and its references.
174
- * Make a deep clone before setting, if needed. No comparison is done to detect changes; all
175
- * sets are transmitted.
176
- */
177
- set(key: K, value: JsonSerializable<V>): this;
178
- /**
179
- * The number of elements in the StateMap.
180
- */
181
- readonly size: number;
182
- /**
183
- * Returns an iterable of entries in the map.
184
- */
185
- /**
186
- * Returns an iterable of key, value pairs for every entry in the map.
187
- */
188
- /**
189
- * Returns an iterable of keys in the map.
190
- */
191
- keys(): IterableIterator<K>;
192
- }
193
- /**
194
- * State that provides a `Map` of latest known values from this client to
195
- * others and read access to their values.
196
- * Entries in the map may vary over time and by client, but all values are expected to
197
- * be of the same type, which may be a union type.
198
- *
199
- * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.
200
- *
201
- * @sealed
202
- * @beta
203
- */
204
- export interface LatestMap<T, Keys extends string = string, TRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
205
- /**
206
- * Containing {@link Presence}
207
- */
208
- readonly presence: Presence;
209
- /**
210
- * Events for LatestMap.
211
- */
212
- readonly events: Listenable<LatestMapEvents<T, Keys, TRemoteAccessor>>;
213
- /**
214
- * Controls for management of sending updates.
215
- */
216
- readonly controls: BroadcastControls;
217
- /**
218
- * Current value map for this client.
219
- */
220
- readonly local: StateMap<Keys, T>;
221
- /**
222
- * Iterable access to remote clients' map of values.
223
- */
224
- getRemotes(): IterableIterator<LatestMapClientData<T, Keys, TRemoteAccessor>>;
225
- /**
226
- * Array of {@link Attendee}s that have provided states.
227
- */
228
- getStateAttendees(): Attendee[];
229
- /**
230
- * Access to a specific client's map of values.
231
- */
232
- getRemote(attendee: Attendee): ReadonlyMap<Keys, LatestData<T, TRemoteAccessor>>;
233
- }
234
- /**
235
- * State that provides a `Map` of latest known values from this client to
236
- * others and read access to their values.
237
- * Entries in the map may vary over time and by client, but all values are expected to
238
- * be of the same type, which may be a union type.
239
- *
240
- * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.
241
- *
242
- * @sealed
243
- * @beta
244
- */
245
- export type LatestMapRaw<T, Keys extends string = string> = LatestMap<T, Keys, RawValueAccessor<T>>;
246
- /**
247
- * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.
248
- *
249
- * @input
250
- * @beta
251
- */
252
- export interface LatestMapArgumentsRaw<T, Keys extends string = string> {
253
- /**
254
- * The initial value of the local state.
255
- */
256
- local?: {
257
- [K in Keys]: JsonSerializable<T>;
258
- };
259
- /**
260
- * See {@link BroadcastControlSettings}.
261
- */
262
- settings?: BroadcastControlSettings | undefined;
263
- }
264
- /**
265
- * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.
266
- *
267
- * @input
268
- * @beta
269
- */
270
- export interface LatestMapArguments<T, Keys extends string = string> extends LatestMapArgumentsRaw<T, Keys> {
271
- /**
272
- * An optional function that will be called at runtime to validate data value
273
- * under a key. A runtime validator is strongly recommended.
274
- * @see {@link StateSchemaValidator}.
275
- */
276
- validator: StateSchemaValidator<T>;
277
- /**
278
- * An optional function that will be called at runtime to validate the presence
279
- * data key. A runtime validator is strongly recommended when key type is not
280
- * simply `string`.
281
- * @see {@link KeySchemaValidator}.
282
- */
283
- keyValidator?: KeySchemaValidator<Keys>;
284
- }
285
- /**
286
- * Type alias for the return type of {@link LatestMapFactory} when called with
287
- * {@link LatestMapArguments}.
288
- *
289
- * @remarks
290
- * Use this type instead of any InternalPresenceTypes that may be revealed from
291
- * examining factory return type.
292
- *
293
- * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
294
- * allowed registration keys for this State object within a workspace.
295
- * Specification is recommended to highlight connection between schema and
296
- * factory when spread across modules.
297
- *
298
- * @beta
299
- * @sealed
300
- */
301
- export type LatestMapConfiguration<T, Keys extends string, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
302
- /**
303
- * Type alias for the return type of {@link LatestMapFactory} when called with
304
- * {@link LatestMapArgumentsRaw}.
305
- *
306
- * @remarks
307
- * Use this type instead of any InternalPresenceTypes that may be revealed from
308
- * examining factory return type.
309
- *
310
- * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
311
- * allowed registration keys for this State object within a workspace.
312
- * Specification is recommended to highlight connection between schema and
313
- * factory when spread across modules.
314
- *
315
- * @beta
316
- * @sealed
317
- */
318
- export type LatestMapRawConfiguration<T, Keys extends string, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
319
- /**
320
- * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
321
- *
322
- * @beta
323
- * @sealed
324
- */
325
- export interface LatestMapFactory {
326
- /**
327
- * Factory for creating a {@link LatestMap} State object.
328
- *
329
- * @remarks
330
- * This overload is used when called with {@link LatestMapArguments}.
331
- * That is, if a validator function is provided.
332
- */
333
- <T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(args: LatestMapArguments<T, Keys>): LatestMapConfiguration<T, Keys, RegistrationKeyRestrictions>;
334
- /**
335
- * Factory for creating a {@link LatestMapRaw} State object.
336
- *
337
- * @remarks
338
- * This overload is used when called with {@link LatestMapArgumentsRaw}.
339
- * That is, if a validator function is _not_ provided.
340
- */
341
- <T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): LatestMapRawConfiguration<T, Keys, RegistrationKeyRestrictions>;
342
- }
343
- //# sourceMappingURL=latestMapTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latestMapTypes.d.ts","sourceRoot":"","sources":["../src/latestMapTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EACX,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,CAAC,IAAI,SAAS,MAAM,IAAI,CACrD,cAAc,EAAE,MAAM,KAClB,cAAc,IAAI,IAAI,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CACnC,CAAC,EACD,IAAI,SAAS,MAAM,EACnB,cAAc,SAAS,aAAa,CAAC,CAAC,CAAC,EACvC,kBAAkB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AAE,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC,GACnC,yBAAyB,CAAC,CAAC,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAC;CACnE"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=latestMapTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latestMapTypes.js","sourceRoot":"","sources":["../src/latestMapTypes.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 { Listenable } from \"@fluidframework/core-interfaces\";\nimport type {\n\tDeepReadonly,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\nimport type { BroadcastControls, BroadcastControlSettings } from \"./broadcastControlsTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type {\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\nimport type { Attendee, AttendeeId, Presence } from \"./presence.js\";\n\n/**\n * A validator function that can optionally be provided to do runtime validation\n * of the custom key listed in a {@link LatestMap}.\n *\n * @param unvalidatedKey - The unknown key that should be validated.\n *\n * @returns True if the key is valid.\n *\n * @beta\n */\nexport type KeySchemaValidator<Keys extends string> = (\n\tunvalidatedKey: string,\n) => unvalidatedKey is Keys;\n\n/**\n * Collection of latest known values for a specific {@link Attendee}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapClientData<\n\tT,\n\tKeys extends string,\n\tTValueAccessor extends ValueAccessor<T>,\n\tSpecificAttendeeId extends AttendeeId = AttendeeId,\n> {\n\t/**\n\t * Associated {@link Attendee}.\n\t */\n\tattendee: Attendee<SpecificAttendeeId>;\n\n\t/**\n\t * Map of items for the state.\n\t *\n\t * @privateRemarks This could be regular map currently as no Map is\n\t * stored internally and a new instance is created for every request.\n\t */\n\titems: ReadonlyMap<Keys, LatestData<T, TValueAccessor>>;\n}\n\n/**\n * State of a single item value, its key, and its metadata.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapItemUpdatedClientData<\n\tT,\n\tK extends string,\n\tTValueAccessor extends ValueAccessor<T>,\n> extends LatestClientData<T, TValueAccessor> {\n\t/**\n\t * Key of the updated item.\n\t */\n\tkey: K;\n}\n\n/**\n * Identifier and metadata for a removed item.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapItemRemovedClientData<K extends string> {\n\t/**\n\t * Associated {@link Attendee}.\n\t */\n\tattendee: Attendee;\n\n\t/**\n\t * Key of the removed item.\n\t */\n\tkey: K;\n\n\t/**\n\t * Metadata associated with the removal of the item.\n\t */\n\tmetadata: LatestMetadata;\n}\n\n/**\n * Events from {@link LatestMapRaw}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapEvents<\n\tT,\n\tK extends string,\n\tTRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>,\n> {\n\t/**\n\t * Raised when any item's value for remote client is updated.\n\t * @param updates - Map of one or more values updated.\n\t *\n\t * @remarks The event does not include item removals.\n\t *\n\t * @eventProperty\n\t */\n\tremoteUpdated: (updates: LatestMapClientData<T, K, TRemoteValueAccessor>) => void;\n\n\t/**\n\t * Raised when specific item's value of remote client is updated.\n\t * @param updatedItem - Updated item value.\n\t *\n\t * @eventProperty\n\t */\n\tremoteItemUpdated: (\n\t\tupdatedItem: LatestMapItemUpdatedClientData<T, K, TRemoteValueAccessor>,\n\t) => void;\n\n\t/**\n\t * Raised when specific item of remote client is removed.\n\t * @param removedItem - Removed item.\n\t *\n\t * @eventProperty\n\t */\n\tremoteItemRemoved: (removedItem: LatestMapItemRemovedClientData<K>) => void;\n\n\t/**\n\t * Raised when specific local item's value is updated.\n\t * @param updatedItem - Updated item value.\n\t *\n\t * @eventProperty\n\t */\n\tlocalItemUpdated: (updatedItem: {\n\t\tvalue: DeepReadonly<JsonSerializable<T>>;\n\t\tkey: K;\n\t}) => void;\n\n\t/**\n\t * Raised when specific local item is removed.\n\t * @param removedItem - Removed item.\n\t *\n\t * @eventProperty\n\t */\n\tlocalItemRemoved: (removedItem: { key: K }) => void;\n}\n\n/**\n * Events from {@link LatestMapRaw}.\n *\n * @sealed\n * @beta\n */\nexport type LatestMapRawEvents<T, K extends string> = LatestMapEvents<\n\tT,\n\tK,\n\tRawValueAccessor<T>\n>;\n\n/**\n * Map of local client's values. Modifications are transmitted to all other connected clients.\n *\n * @sealed\n * @beta\n */\nexport interface StateMap<K extends string, V> {\n\t/**\n\t * ${@link StateMap.delete}s all elements in the StateMap.\n\t * @remarks This is not yet implemented.\n\t */\n\tclear(): void;\n\n\t/**\n\t * Removes the element with the specified key from the StateMap, if it exists.\n\t *\n\t * @returns true if an element in the StateMap existed and has been removed, or false if\n\t * the element does not exist.\n\t * @remarks No entry is fully removed. Instead an undefined placeholder is locally and\n\t * transmitted to all other clients. For better performance limit the number of deleted\n\t * entries and reuse keys when possible.\n\t * @privateRemarks In the future we may add a mechanism to remove the placeholder, at least\n\t * from transmissions after sufficient time has passed.\n\t */\n\tdelete(key: K): boolean;\n\n\t/**\n\t * Executes a provided function once per each key/value pair in the StateMap, in arbitrary order.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: DeepReadonly<JsonDeserialized<V>>,\n\t\t\tkey: K,\n\t\t\tmap: StateMap<K, V>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void;\n\n\t/**\n\t * Returns the element with the specified key from the StateMap, if it exists.\n\t *\n\t * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.\n\t */\n\tget(key: K): DeepReadonly<JsonDeserialized<V>> | undefined;\n\n\t/**\n\t * Checks if an element with the specified key exists in the StateMap.\n\t * @returns boolean indicating whether an element with the specified key exists or not.\n\t */\n\thas(key: K): boolean;\n\n\t/**\n\t * Adds a new element with a specified key and value to the StateMap. If an element with the same key already exists, the element will be updated.\n\t * The value will be transmitted to all other connected clients.\n\t *\n\t * @remarks Manager assumes ownership of the value and its references.\n\t * Make a deep clone before setting, if needed. No comparison is done to detect changes; all\n\t * sets are transmitted.\n\t */\n\tset(key: K, value: JsonSerializable<V>): this;\n\n\t/**\n\t * The number of elements in the StateMap.\n\t */\n\treadonly size: number;\n\n\t/**\n\t * Returns an iterable of entries in the map.\n\t */\n\t// [Symbol.iterator](): IterableIterator<[K, DeepReadonly<JsonDeserialized<V>>]>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t */\n\t// entries(): IterableIterator<[K, DeepReadonly<JsonDeserialized<V>>]>;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t */\n\tkeys(): IterableIterator<K>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t */\n\t// values(): IterableIterator<DeepReadonly<JsonDeserialized<V>>>;\n}\n\n/**\n * State that provides a `Map` of latest known values from this client to\n * others and read access to their values.\n * Entries in the map may vary over time and by client, but all values are expected to\n * be of the same type, which may be a union type.\n *\n * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMap<\n\tT,\n\tKeys extends string = string,\n\tTRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>,\n> {\n\t/**\n\t * Containing {@link Presence}\n\t */\n\treadonly presence: Presence;\n\n\t/**\n\t * Events for LatestMap.\n\t */\n\treadonly events: Listenable<LatestMapEvents<T, Keys, TRemoteAccessor>>;\n\n\t/**\n\t * Controls for management of sending updates.\n\t */\n\treadonly controls: BroadcastControls;\n\n\t/**\n\t * Current value map for this client.\n\t */\n\treadonly local: StateMap<Keys, T>;\n\n\t/**\n\t * Iterable access to remote clients' map of values.\n\t */\n\tgetRemotes(): IterableIterator<LatestMapClientData<T, Keys, TRemoteAccessor>>;\n\n\t/**\n\t * Array of {@link Attendee}s that have provided states.\n\t */\n\tgetStateAttendees(): Attendee[];\n\n\t/**\n\t * Access to a specific client's map of values.\n\t */\n\tgetRemote(attendee: Attendee): ReadonlyMap<Keys, LatestData<T, TRemoteAccessor>>;\n}\n\n/**\n * State that provides a `Map` of latest known values from this client to\n * others and read access to their values.\n * Entries in the map may vary over time and by client, but all values are expected to\n * be of the same type, which may be a union type.\n *\n * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport type LatestMapRaw<T, Keys extends string = string> = LatestMap<\n\tT,\n\tKeys,\n\tRawValueAccessor<T>\n>;\n\n/**\n * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.\n *\n * @input\n * @beta\n */\nexport interface LatestMapArgumentsRaw<T, Keys extends string = string> {\n\t/**\n\t * The initial value of the local state.\n\t */\n\tlocal?: {\n\t\t[K in Keys]: JsonSerializable<T>;\n\t};\n\n\t/**\n\t * See {@link BroadcastControlSettings}.\n\t */\n\tsettings?: BroadcastControlSettings | undefined;\n}\n\n/**\n * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.\n *\n * @input\n * @beta\n */\nexport interface LatestMapArguments<T, Keys extends string = string>\n\textends LatestMapArgumentsRaw<T, Keys> {\n\t/**\n\t * An optional function that will be called at runtime to validate data value\n\t * under a key. A runtime validator is strongly recommended.\n\t * @see {@link StateSchemaValidator}.\n\t */\n\tvalidator: StateSchemaValidator<T>;\n\n\t/**\n\t * An optional function that will be called at runtime to validate the presence\n\t * data key. A runtime validator is strongly recommended when key type is not\n\t * simply `string`.\n\t * @see {@link KeySchemaValidator}.\n\t */\n\tkeyValidator?: KeySchemaValidator<Keys>;\n}\n\n/**\n * Type alias for the return type of {@link LatestMapFactory} when called with\n * {@link LatestMapArguments}.\n *\n * @remarks\n * Use this type instead of any InternalPresenceTypes that may be revealed from\n * examining factory return type.\n *\n * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain\n * allowed registration keys for this State object within a workspace.\n * Specification is recommended to highlight connection between schema and\n * factory when spread across modules.\n *\n * @beta\n * @sealed\n */\nexport type LatestMapConfiguration<\n\tT,\n\tKeys extends string,\n\tRegistrationKeyRestrictions extends string = string,\n> = InternalTypes.ManagerFactory<\n\tRegistrationKeyRestrictions,\n\tInternalTypes.MapValueState<T, Keys>,\n\tLatestMap<T, Keys>\n>;\n\n/**\n * Type alias for the return type of {@link LatestMapFactory} when called with\n * {@link LatestMapArgumentsRaw}.\n *\n * @remarks\n * Use this type instead of any InternalPresenceTypes that may be revealed from\n * examining factory return type.\n *\n * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain\n * allowed registration keys for this State object within a workspace.\n * Specification is recommended to highlight connection between schema and\n * factory when spread across modules.\n *\n * @beta\n * @sealed\n */\nexport type LatestMapRawConfiguration<\n\tT,\n\tKeys extends string,\n\tRegistrationKeyRestrictions extends string = string,\n> = InternalTypes.ManagerFactory<\n\tRegistrationKeyRestrictions,\n\tInternalTypes.MapValueState<T, Keys>,\n\tLatestMapRaw<T, Keys>\n>;\n\n/**\n * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.\n *\n * @beta\n * @sealed\n */\nexport interface LatestMapFactory {\n\t/**\n\t * Factory for creating a {@link LatestMap} State object.\n\t *\n\t * @remarks\n\t * This overload is used when called with {@link LatestMapArguments}.\n\t * That is, if a validator function is provided.\n\t */\n\t<T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(\n\t\targs: LatestMapArguments<T, Keys>,\n\t): LatestMapConfiguration<T, Keys, RegistrationKeyRestrictions>;\n\n\t/**\n\t * Factory for creating a {@link LatestMapRaw} State object.\n\t *\n\t * @remarks\n\t * This overload is used when called with {@link LatestMapArgumentsRaw}.\n\t * That is, if a validator function is _not_ provided.\n\t */\n\t<T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(\n\t\targs?: LatestMapArgumentsRaw<T, Keys>,\n\t): LatestMapRawConfiguration<T, Keys, RegistrationKeyRestrictions>;\n}\n"]}
@@ -1,52 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
6
- import type { BroadcastControlSettings } from "./broadcastControlsTypes.js";
7
- import type { KeySchemaValidator, LatestMapFactory } from "./latestMapTypes.js";
8
- import type { StateSchemaValidator } from "./latestValueTypes.js";
9
- /**
10
- * Arguments that are passed to the {@link StateFactory.latestMap} function.
11
- *
12
- * @input
13
- * @beta
14
- */
15
- export interface LatestMapArgumentsRaw<T, Keys extends string = string> {
16
- /**
17
- * The initial value of the local state.
18
- */
19
- local?: {
20
- [K in Keys]: JsonSerializable<T>;
21
- };
22
- /**
23
- * See {@link BroadcastControlSettings}.
24
- */
25
- settings?: BroadcastControlSettings | undefined;
26
- }
27
- /**
28
- * Arguments that are passed to the {@link StateFactory.latestMap} function.
29
- *
30
- * @input
31
- * @beta
32
- */
33
- export interface LatestMapArguments<T, Keys extends string = string> extends LatestMapArgumentsRaw<T, Keys> {
34
- /**
35
- * An optional function that will be called at runtime to validate data value
36
- * under a key. A runtime validator is strongly recommended.
37
- * @see {@link StateSchemaValidator}.
38
- */
39
- validator: StateSchemaValidator<T>;
40
- /**
41
- * An optional function that will be called at runtime to validate the presence
42
- * data key. A runtime validator is strongly recommended when key type is not
43
- * simply `string`.
44
- * @see {@link KeySchemaValidator}.
45
- */
46
- keyValidator?: KeySchemaValidator<Keys>;
47
- }
48
- /**
49
- * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
50
- */
51
- export declare const latestMap: LatestMapFactory;
52
- //# sourceMappingURL=latestMapValueManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAGX,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAGtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAU5E,OAAO,KAAK,EACX,kBAAkB,EAIlB,gBAAgB,EAIhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAc,oBAAoB,EAAiB,MAAM,uBAAuB,CAAC;AAgS7F;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM;IACrE;;OAEG;IACH,KAAK,CAAC,EAAE;SACN,CAAC,IAAI,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC;KAChC,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAChD;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,CAClE,SAAQ,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC;IACtC;;;;OAIG;IACH,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACnC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBA6DvB,CAAC"}