@fluidframework/presence 2.41.0-338401 → 2.42.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 (209) hide show
  1. package/README.md +6 -10
  2. package/dist/alpha.d.ts +18 -14
  3. package/dist/baseTypes.d.ts +1 -1
  4. package/dist/baseTypes.js.map +1 -1
  5. package/dist/beta.d.ts +53 -0
  6. package/dist/broadcastControls.d.ts +4 -5
  7. package/dist/broadcastControls.d.ts.map +1 -1
  8. package/dist/broadcastControls.js +2 -3
  9. package/dist/broadcastControls.js.map +1 -1
  10. package/dist/datastorePresenceManagerFactory.d.ts +4 -1
  11. package/dist/datastorePresenceManagerFactory.d.ts.map +1 -1
  12. package/dist/datastorePresenceManagerFactory.js +24 -3
  13. package/dist/datastorePresenceManagerFactory.js.map +1 -1
  14. package/dist/datastoreSupport.d.ts +7 -2
  15. package/dist/datastoreSupport.d.ts.map +1 -1
  16. package/dist/datastoreSupport.js +6 -4
  17. package/dist/datastoreSupport.js.map +1 -1
  18. package/dist/experimentalAccess.d.ts +12 -4
  19. package/dist/experimentalAccess.d.ts.map +1 -1
  20. package/dist/experimentalAccess.js +24 -17
  21. package/dist/experimentalAccess.js.map +1 -1
  22. package/dist/exposedInternalTypes.d.ts +23 -5
  23. package/dist/exposedInternalTypes.d.ts.map +1 -1
  24. package/dist/exposedInternalTypes.js +1 -1
  25. package/dist/exposedInternalTypes.js.map +1 -1
  26. package/dist/exposedUtilityTypes.d.ts +6 -5
  27. package/dist/exposedUtilityTypes.d.ts.map +1 -1
  28. package/dist/exposedUtilityTypes.js.map +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/internalTypes.d.ts +32 -11
  34. package/dist/internalTypes.d.ts.map +1 -1
  35. package/dist/internalTypes.js.map +1 -1
  36. package/dist/internalUtils.d.ts +34 -11
  37. package/dist/internalUtils.d.ts.map +1 -1
  38. package/dist/internalUtils.js +39 -7
  39. package/dist/internalUtils.js.map +1 -1
  40. package/dist/latestMapValueManager.d.ts +36 -15
  41. package/dist/latestMapValueManager.d.ts.map +1 -1
  42. package/dist/latestMapValueManager.js +11 -10
  43. package/dist/latestMapValueManager.js.map +1 -1
  44. package/dist/latestValueManager.d.ts +21 -7
  45. package/dist/latestValueManager.d.ts.map +1 -1
  46. package/dist/latestValueManager.js +21 -10
  47. package/dist/latestValueManager.js.map +1 -1
  48. package/dist/latestValueTypes.d.ts +14 -4
  49. package/dist/latestValueTypes.d.ts.map +1 -1
  50. package/dist/latestValueTypes.js.map +1 -1
  51. package/dist/notificationsManager.d.ts +3 -3
  52. package/dist/notificationsManager.d.ts.map +1 -1
  53. package/dist/notificationsManager.js +14 -7
  54. package/dist/notificationsManager.js.map +1 -1
  55. package/dist/package.json +5 -4
  56. package/dist/presence.d.ts +26 -13
  57. package/dist/presence.d.ts.map +1 -1
  58. package/dist/presence.js +1 -1
  59. package/dist/presence.js.map +1 -1
  60. package/dist/presenceDatastoreManager.d.ts +9 -41
  61. package/dist/presenceDatastoreManager.d.ts.map +1 -1
  62. package/dist/presenceDatastoreManager.js +50 -36
  63. package/dist/presenceDatastoreManager.js.map +1 -1
  64. package/dist/presenceManager.d.ts +5 -9
  65. package/dist/presenceManager.d.ts.map +1 -1
  66. package/dist/presenceManager.js +13 -13
  67. package/dist/presenceManager.js.map +1 -1
  68. package/dist/presenceStates.d.ts +9 -14
  69. package/dist/presenceStates.d.ts.map +1 -1
  70. package/dist/presenceStates.js +1 -8
  71. package/dist/presenceStates.js.map +1 -1
  72. package/dist/protocol.d.ts +99 -0
  73. package/dist/protocol.d.ts.map +1 -0
  74. package/dist/protocol.js +20 -0
  75. package/dist/protocol.js.map +1 -0
  76. package/dist/stateDatastore.d.ts +9 -8
  77. package/dist/stateDatastore.d.ts.map +1 -1
  78. package/dist/stateDatastore.js +0 -4
  79. package/dist/stateDatastore.js.map +1 -1
  80. package/dist/stateFactory.d.ts +1 -1
  81. package/dist/stateFactory.js +1 -1
  82. package/dist/stateFactory.js.map +1 -1
  83. package/dist/systemWorkspace.d.ts +12 -6
  84. package/dist/systemWorkspace.d.ts.map +1 -1
  85. package/dist/systemWorkspace.js +14 -4
  86. package/dist/systemWorkspace.js.map +1 -1
  87. package/dist/types.d.ts +12 -10
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/types.js.map +1 -1
  90. package/dist/valueManager.d.ts +0 -4
  91. package/dist/valueManager.d.ts.map +1 -1
  92. package/dist/valueManager.js +0 -4
  93. package/dist/valueManager.js.map +1 -1
  94. package/lib/alpha.d.ts +18 -14
  95. package/lib/baseTypes.d.ts +1 -1
  96. package/lib/baseTypes.js.map +1 -1
  97. package/lib/beta.d.ts +53 -0
  98. package/lib/broadcastControls.d.ts +4 -5
  99. package/lib/broadcastControls.d.ts.map +1 -1
  100. package/lib/broadcastControls.js +2 -3
  101. package/lib/broadcastControls.js.map +1 -1
  102. package/lib/datastorePresenceManagerFactory.d.ts +4 -1
  103. package/lib/datastorePresenceManagerFactory.d.ts.map +1 -1
  104. package/lib/datastorePresenceManagerFactory.js +24 -3
  105. package/lib/datastorePresenceManagerFactory.js.map +1 -1
  106. package/lib/datastoreSupport.d.ts +7 -2
  107. package/lib/datastoreSupport.d.ts.map +1 -1
  108. package/lib/datastoreSupport.js +6 -4
  109. package/lib/datastoreSupport.js.map +1 -1
  110. package/lib/experimentalAccess.d.ts +12 -4
  111. package/lib/experimentalAccess.d.ts.map +1 -1
  112. package/lib/experimentalAccess.js +22 -15
  113. package/lib/experimentalAccess.js.map +1 -1
  114. package/lib/exposedInternalTypes.d.ts +23 -5
  115. package/lib/exposedInternalTypes.d.ts.map +1 -1
  116. package/lib/exposedInternalTypes.js +1 -1
  117. package/lib/exposedInternalTypes.js.map +1 -1
  118. package/lib/exposedUtilityTypes.d.ts +6 -5
  119. package/lib/exposedUtilityTypes.d.ts.map +1 -1
  120. package/lib/exposedUtilityTypes.js.map +1 -1
  121. package/lib/index.d.ts +2 -2
  122. package/lib/index.d.ts.map +1 -1
  123. package/lib/index.js +1 -1
  124. package/lib/index.js.map +1 -1
  125. package/lib/internalTypes.d.ts +32 -11
  126. package/lib/internalTypes.d.ts.map +1 -1
  127. package/lib/internalTypes.js.map +1 -1
  128. package/lib/internalUtils.d.ts +34 -11
  129. package/lib/internalUtils.d.ts.map +1 -1
  130. package/lib/internalUtils.js +35 -6
  131. package/lib/internalUtils.js.map +1 -1
  132. package/lib/latestMapValueManager.d.ts +36 -15
  133. package/lib/latestMapValueManager.d.ts.map +1 -1
  134. package/lib/latestMapValueManager.js +12 -11
  135. package/lib/latestMapValueManager.js.map +1 -1
  136. package/lib/latestValueManager.d.ts +21 -7
  137. package/lib/latestValueManager.d.ts.map +1 -1
  138. package/lib/latestValueManager.js +20 -10
  139. package/lib/latestValueManager.js.map +1 -1
  140. package/lib/latestValueTypes.d.ts +14 -4
  141. package/lib/latestValueTypes.d.ts.map +1 -1
  142. package/lib/latestValueTypes.js.map +1 -1
  143. package/lib/notificationsManager.d.ts +3 -3
  144. package/lib/notificationsManager.d.ts.map +1 -1
  145. package/lib/notificationsManager.js +14 -7
  146. package/lib/notificationsManager.js.map +1 -1
  147. package/lib/presence.d.ts +26 -13
  148. package/lib/presence.d.ts.map +1 -1
  149. package/lib/presence.js +1 -1
  150. package/lib/presence.js.map +1 -1
  151. package/lib/presenceDatastoreManager.d.ts +9 -41
  152. package/lib/presenceDatastoreManager.d.ts.map +1 -1
  153. package/lib/presenceDatastoreManager.js +49 -35
  154. package/lib/presenceDatastoreManager.js.map +1 -1
  155. package/lib/presenceManager.d.ts +5 -9
  156. package/lib/presenceManager.d.ts.map +1 -1
  157. package/lib/presenceManager.js +13 -13
  158. package/lib/presenceManager.js.map +1 -1
  159. package/lib/presenceStates.d.ts +9 -14
  160. package/lib/presenceStates.d.ts.map +1 -1
  161. package/lib/presenceStates.js +1 -8
  162. package/lib/presenceStates.js.map +1 -1
  163. package/lib/protocol.d.ts +99 -0
  164. package/lib/protocol.d.ts.map +1 -0
  165. package/lib/protocol.js +17 -0
  166. package/lib/protocol.js.map +1 -0
  167. package/lib/stateDatastore.d.ts +9 -8
  168. package/lib/stateDatastore.d.ts.map +1 -1
  169. package/lib/stateDatastore.js +0 -4
  170. package/lib/stateDatastore.js.map +1 -1
  171. package/lib/stateFactory.d.ts +1 -1
  172. package/lib/stateFactory.js +1 -1
  173. package/lib/stateFactory.js.map +1 -1
  174. package/lib/systemWorkspace.d.ts +12 -6
  175. package/lib/systemWorkspace.d.ts.map +1 -1
  176. package/lib/systemWorkspace.js +14 -4
  177. package/lib/systemWorkspace.js.map +1 -1
  178. package/lib/types.d.ts +12 -10
  179. package/lib/types.d.ts.map +1 -1
  180. package/lib/types.js.map +1 -1
  181. package/lib/valueManager.d.ts +0 -4
  182. package/lib/valueManager.d.ts.map +1 -1
  183. package/lib/valueManager.js +0 -4
  184. package/lib/valueManager.js.map +1 -1
  185. package/package.json +30 -23
  186. package/dist/container-definitions/containerExtensions.d.ts +0 -137
  187. package/dist/container-definitions/containerExtensions.d.ts.map +0 -1
  188. package/dist/container-definitions/containerExtensions.js +0 -7
  189. package/dist/container-definitions/containerExtensions.js.map +0 -1
  190. package/dist/container-definitions/index.d.ts +0 -7
  191. package/dist/container-definitions/index.d.ts.map +0 -1
  192. package/dist/container-definitions/index.js +0 -7
  193. package/dist/container-definitions/index.js.map +0 -1
  194. package/dist/container-definitions/runtime.d.ts +0 -12
  195. package/dist/container-definitions/runtime.d.ts.map +0 -1
  196. package/dist/container-definitions/runtime.js +0 -7
  197. package/dist/container-definitions/runtime.js.map +0 -1
  198. package/lib/container-definitions/containerExtensions.d.ts +0 -137
  199. package/lib/container-definitions/containerExtensions.d.ts.map +0 -1
  200. package/lib/container-definitions/containerExtensions.js +0 -6
  201. package/lib/container-definitions/containerExtensions.js.map +0 -1
  202. package/lib/container-definitions/index.d.ts +0 -7
  203. package/lib/container-definitions/index.d.ts.map +0 -1
  204. package/lib/container-definitions/index.js +0 -6
  205. package/lib/container-definitions/index.js.map +0 -1
  206. package/lib/container-definitions/runtime.d.ts +0 -12
  207. package/lib/container-definitions/runtime.d.ts.map +0 -1
  208. package/lib/container-definitions/runtime.js +0 -6
  209. package/lib/container-definitions/runtime.js.map +0 -1
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
5
+ import type { OpaqueJsonDeserialized } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
6
6
  /**
7
7
  * Collection of value types that are not intended to be used/imported
8
8
  * directly outside of this package.
9
9
  *
10
- * @alpha
10
+ * @beta
11
11
  * @system
12
12
  */
13
13
  export declare namespace InternalTypes {
@@ -19,16 +19,34 @@ export declare namespace InternalTypes {
19
19
  timestamp: number;
20
20
  }
21
21
  /**
22
+ * Represents a state that may have a value.
23
+ * And it includes standard metadata.
24
+ *
25
+ * @remarks
26
+ * See {@link InternalTypes.ValueRequiredState}.
27
+ *
22
28
  * @system
23
29
  */
24
30
  interface ValueOptionalState<TValue> extends ValueStateMetadata {
25
- value?: JsonDeserialized<TValue>;
31
+ value?: OpaqueJsonDeserialized<TValue>;
26
32
  }
27
33
  /**
34
+ * Represents a state that must have a value.
35
+ * And it includes standard metadata.
36
+ *
37
+ * @remarks
38
+ * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected
39
+ * to involve generic or unknown types that will be filtered. It is here
40
+ * mostly as a convenience to the many such uses that would otherwise
41
+ * need to specify some wrapper themselves.
42
+ *
43
+ * For known cases, construct a custom interface that extends
44
+ * {@link InternalTypes.ValueStateMetadata}.
45
+ *
28
46
  * @system
29
47
  */
30
48
  interface ValueRequiredState<TValue> extends ValueStateMetadata {
31
- value: JsonDeserialized<TValue>;
49
+ value: OpaqueJsonDeserialized<TValue>;
32
50
  }
33
51
  /**
34
52
  * @system
@@ -97,7 +115,7 @@ export declare namespace InternalTypes {
97
115
  */
98
116
  interface NotificationType {
99
117
  name: string;
100
- args: (JsonSerializable<unknown> & JsonDeserialized<unknown>)[];
118
+ args: unknown[];
101
119
  }
102
120
  }
103
121
  //# sourceMappingURL=exposedInternalTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exposedInternalTypes.d.ts","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE;;;;;;GAMG;AAEH,yBAAiB,aAAa,CAAC;IAC9B;;OAEG;IACH,UAAiB,kBAAkB;QAClC,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KAClB;IAED;;OAEG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;KACjC;IAED;;OAEG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;KAChC;IAED;;OAEG;IACH,UAAiB,cAAc,CAAC,CAAC;QAChC,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAIN,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;SACnE,CAAC;KACF;IAED;;OAEG;IACH,KAAY,qBAAqB,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAEjF;;OAEG;IACH,UAAiB,aAAa,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM;QAC7D,GAAG,EAAE,MAAM,CAAC;QACZ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,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,WAAW,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,CAAC;QAC9E,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KAC9B,CAAC,CAAC;IAEH;;OAEG;IACH,UAAiB,gBAAgB;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,EAAE,CAAC;KAChB;CACD"}
@@ -9,7 +9,7 @@ exports.InternalTypes = void 0;
9
9
  * Collection of value types that are not intended to be used/imported
10
10
  * directly outside of this package.
11
11
  *
12
- * @alpha
12
+ * @beta
13
13
  * @system
14
14
  */
15
15
  // eslint-disable-next-line @typescript-eslint/no-namespace
@@ -1 +1 @@
1
- {"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH;;;;;;GAMG;AACH,2DAA2D;AAC3D,IAAiB,aAAa,CA2G7B;AA3GD,WAAiB,aAAa;AA2G9B,CAAC,EA3GgB,aAAa,6BAAb,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/core-interfaces/internal/exposedUtilityTypes\";\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, Keys extends string | number> {\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 in Keys]: 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 state and notification 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\tinitialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined };\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"]}
1
+ {"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,2DAA2D;AAC3D,IAAiB,aAAa,CA6H7B;AA7HD,WAAiB,aAAa;AA6H9B,CAAC,EA7HgB,aAAa,6BAAb,aAAa,QA6H7B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { OpaqueJsonDeserialized } from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of value types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @beta\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 * Represents a state that may have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * See {@link InternalTypes.ValueRequiredState}.\n\t *\n\t * @system\n\t */\n\texport interface ValueOptionalState<TValue> extends ValueStateMetadata {\n\t\tvalue?: OpaqueJsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * Represents a state that must have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected\n\t * to involve generic or unknown types that will be filtered. It is here\n\t * mostly as a convenience to the many such uses that would otherwise\n\t * need to specify some wrapper themselves.\n\t *\n\t * For known cases, construct a custom interface that extends\n\t * {@link InternalTypes.ValueStateMetadata}.\n\t *\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: OpaqueJsonDeserialized<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, Keys extends string | number> {\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 in Keys]: 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 state and notification 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\tinitialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined };\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: unknown[];\n\t}\n}\n"]}
@@ -12,11 +12,12 @@ import type { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized
12
12
  */
13
13
  export declare namespace InternalUtilityTypes {
14
14
  /**
15
- * `true` iff the given type is an acceptable shape for a notification.
15
+ * Yields `IfListener` when the given type is an acceptable shape for a notification.
16
+ * `Else` otherwise.
16
17
  *
17
18
  * @system
18
19
  */
19
- type IsNotificationListener<Event> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P> & JsonDeserialized<P>, true, false> : false;
20
+ type IfNotificationListener<Event, IfListener, Else> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfListener, Else> : Else;
20
21
  /**
21
22
  * Used to specify the kinds of notifications emitted by a {@link NotificationListenable}.
22
23
  *
@@ -37,19 +38,19 @@ export declare namespace InternalUtilityTypes {
37
38
  * @system
38
39
  */
39
40
  type NotificationListeners<E> = {
40
- [P in string & keyof E as IsNotificationListener<E[P]> extends true ? P : never]: E[P];
41
+ [P in keyof E as IfNotificationListener<E[P], P, never>]: E[P];
41
42
  };
42
43
  /**
43
44
  * {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.
44
45
  *
45
46
  * @system
46
47
  */
47
- type JsonDeserializedParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? JsonDeserialized<P> : never;
48
+ type JsonDeserializedParameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? JsonDeserialized<P> : never;
48
49
  /**
49
50
  * {@link @fluidframework/core-interfaces#JsonSerializable} version of the parameters of a function.
50
51
  *
51
52
  * @system
52
53
  */
53
- type JsonSerializableParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? JsonSerializable<P> : never;
54
+ type JsonSerializableParameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? JsonSerializable<P> : never;
54
55
  }
55
56
  //# sourceMappingURL=exposedUtilityTypes.d.ts.map
@@ -1 +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,8DAA8D,CAAC;AAEtE;;;;;;GAMG;AAEH,yBAAiB,oBAAoB,CAAC;IACrC;;;;OAIG;IACH,KAAY,sBAAsB,CAAC,KAAK,IAAI,KAAK,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,IAAI,GACjF,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,qBAAqB,CAAC,CAAC,IAAI;SACrC,CAAC,IAAI,MAAM,GAAG,MAAM,CAAC,IAA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AC,GAAG,CAAC,CAAC,CAAC,CAAC;KAC9D,CAAC;IAEF;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,SAAS,CACrF,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,EAAE,KAAK,GAAG,IAAI,CAAC,SAAS,CACrF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,GAAG,GACL,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;CACT"}
@@ -1 +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/core-interfaces/internal/exposedUtilityTypes\";\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 * `true` iff the given type is an acceptable shape for a notification.\n\t *\n\t * @system\n\t */\n\texport type IsNotificationListener<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 NotificationListenable}.\n\t *\n\t * @remarks\n\t *\n\t * Any object type is a valid NotificationListeners, 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 NotificationListeners<E> = {\n\t\t[P in string & keyof E as IsNotificationListener<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"]}
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/core-interfaces/internal/exposedUtilityTypes\";\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 * Yields `IfListener` when the given type is an acceptable shape for a notification.\n\t * `Else` otherwise.\n\t *\n\t * @system\n\t */\n\texport type IfNotificationListener<Event, IfListener, Else> = Event extends (\n\t\t...args: infer P\n\t) => void\n\t\t? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfListener, Else>\n\t\t: Else;\n\n\t/**\n\t * Used to specify the kinds of notifications emitted by a {@link NotificationListenable}.\n\t *\n\t * @remarks\n\t *\n\t * Any object type is a valid NotificationListeners, 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 NotificationListeners<E> = {\n\t\t[P in keyof E as IfNotificationListener<E[P], 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/dist/index.d.ts CHANGED
@@ -11,9 +11,9 @@
11
11
  */
12
12
  export type { ClientConnectionId } from "./baseTypes.js";
13
13
  export type { NotificationsWorkspace, NotificationsWorkspaceSchema, StatesWorkspace, StatesWorkspaceEntries, StatesWorkspaceSchema, StatesWorkspaceEntry, WorkspaceAddress, } from "./types.js";
14
- export { type Attendee, type AttendeesEvents, type AttendeeId, AttendeeStatus, type Presence, type PresenceEvents, } from "./presence.js";
14
+ export { type Attendee, type AttendeesEvents, type AttendeeId, AttendeeStatus, type Presence, type PresenceEvents, type PresenceWithNotifications, } from "./presence.js";
15
15
  export type { BroadcastControls, BroadcastControlSettings, } from "./broadcastControls.js";
16
- export { getPresence } from "./experimentalAccess.js";
16
+ export { getPresence, getPresenceAlpha } from "./experimentalAccess.js";
17
17
  export { getPresenceViaDataObject, type ExperimentalPresenceDO, ExperimentalPresenceManager, } from "./datastorePresenceManagerFactory.js";
18
18
  export type { latestMap, LatestMapArguments, LatestMapRaw, LatestMapClientData, LatestMapRawEvents, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, StateMap, } from "./latestMapValueManager.js";
19
19
  export type { latest, LatestArguments, LatestRaw, LatestRawEvents, } from "./latestValueManager.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,YAAY,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,cAAc,GACnB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACX,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACN,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,2BAA2B,GAC3B,MAAM,sCAAsC,CAAC;AAE9C,YAAY,EACX,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,8BAA8B,EAC9B,8BAA8B,EAC9B,QAAQ,GACR,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACX,MAAM,EACN,eAAe,EACf,SAAS,EACT,eAAe,GACf,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,gBAAgB,EAChB,UAAU,EACV,cAAc,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,yB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KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,GAC/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -4,11 +4,12 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.StateFactory = exports.Notifications = exports.ExperimentalPresenceManager = exports.getPresenceViaDataObject = exports.getPresence = exports.AttendeeStatus = void 0;
7
+ exports.StateFactory = exports.Notifications = exports.ExperimentalPresenceManager = exports.getPresenceViaDataObject = exports.getPresenceAlpha = exports.getPresence = exports.AttendeeStatus = void 0;
8
8
  var presence_js_1 = require("./presence.js");
9
9
  Object.defineProperty(exports, "AttendeeStatus", { enumerable: true, get: function () { return presence_js_1.AttendeeStatus; } });
10
10
  var experimentalAccess_js_1 = require("./experimentalAccess.js");
11
11
  Object.defineProperty(exports, "getPresence", { enumerable: true, get: function () { return experimentalAccess_js_1.getPresence; } });
12
+ Object.defineProperty(exports, "getPresenceAlpha", { enumerable: true, get: function () { return experimentalAccess_js_1.getPresenceAlpha; } });
12
13
  var datastorePresenceManagerFactory_js_1 = require("./datastorePresenceManagerFactory.js");
13
14
  Object.defineProperty(exports, "getPresenceViaDataObject", { enumerable: true, get: function () { return datastorePresenceManagerFactory_js_1.getPresenceViaDataObject; } });
14
15
  Object.defineProperty(exports, "ExperimentalPresenceManager", { enumerable: true, get: function () { return datastorePresenceManagerFactory_js_1.ExperimentalPresenceManager; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAOuB;AAHtB,6GAAA,cAAc,OAAA;AAUf,iEAAsD;AAA7C,oHAAA,WAAW,OAAA;AAEpB,2FAI8C;AAH7C,8IAAA,wBAAwB,OAAA;AAExB,iJAAA,2BAA2B,OAAA;AAyB5B,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * 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\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport { getPresence } from \"./experimentalAccess.js\";\n\nexport {\n\tgetPresenceViaDataObject,\n\ttype ExperimentalPresenceDO,\n\tExperimentalPresenceManager,\n} from \"./datastorePresenceManagerFactory.js\";\n\nexport type {\n\tlatestMap,\n\tLatestMapArguments,\n\tLatestMapRaw,\n\tLatestMapClientData,\n\tLatestMapRawEvents,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tlatest,\n\tLatestArguments,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,iEAAwE;AAA/D,oHAAA,WAAW,OAAA;AAAE,yHAAA,gBAAgB,OAAA;AAEtC,2FAI8C;AAH7C,8IAAA,wBAAwB,OAAA;AAExB,iJAAA,2BAA2B,OAAA;AAyB5B,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * 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\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n\ttype PresenceWithNotifications,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport { getPresence, getPresenceAlpha } from \"./experimentalAccess.js\";\n\nexport {\n\tgetPresenceViaDataObject,\n\ttype ExperimentalPresenceDO,\n\tExperimentalPresenceManager,\n} from \"./datastorePresenceManagerFactory.js\";\n\nexport type {\n\tlatestMap,\n\tLatestMapArguments,\n\tLatestMapRaw,\n\tLatestMapClientData,\n\tLatestMapRawEvents,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tlatest,\n\tLatestArguments,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
@@ -2,36 +2,57 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
6
- import type { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
5
+ import type { ExtensionHost as ContainerExtensionHost } from "@fluidframework/container-runtime-definitions/internal";
7
6
  import type { InternalTypes } from "./exposedInternalTypes.js";
8
7
  import type { AttendeeId, Attendee } from "./presence.js";
9
- import type { IRuntimeInternal } from "@fluidframework/presence/internal/container-definitions/internal";
8
+ import type { OutboundAcknowledgementMessage, OutboundClientJoinMessage, OutboundDatastoreUpdateMessage, SignalMessages } from "./protocol.js";
10
9
  /**
11
- * @internal
10
+ * Presence {@link ContainerExtension} version of {@link @fluidframework/container-runtime-definitions#ExtensionRuntimeProperties}
11
+ */
12
+ export interface ExtensionRuntimeProperties {
13
+ SignalMessages: SignalMessages;
14
+ }
15
+ /**
16
+ * Presence specific ExtensionHost
17
+ */
18
+ export type ExtensionHost = ContainerExtensionHost<ExtensionRuntimeProperties>;
19
+ /**
20
+ * Basic structure of set of {@link Attendee} records within Presence datastore
21
+ *
22
+ * @remarks
23
+ * This is commonly exists per named state in State Managers.
12
24
  */
13
25
  export interface ClientRecord<TValue extends InternalTypes.ValueDirectoryOrState<unknown>> {
14
26
  [AttendeeId: AttendeeId]: TValue;
15
27
  }
16
28
  /**
17
- * This interface is a subset of (IContainerRuntime & IRuntimeInternal) and
18
- * (IFluidDataStoreRuntime) that is needed by the Presence States.
29
+ * This interface is a subset of ExtensionHost (and mostly of
30
+ * FluidDataStoreRuntime) that is needed by the Presence States.
19
31
  *
20
32
  * @privateRemarks
21
33
  * Replace with non-DataStore based interface.
22
- *
23
- * @internal
24
34
  */
25
- export type IEphemeralRuntime = Pick<(IContainerRuntime & IRuntimeInternal) | IFluidDataStoreRuntime, "clientId" | "connected" | "getAudience" | "getQuorum" | "off" | "on" | "submitSignal"> & Partial<Pick<IFluidDataStoreRuntime, "logger">>;
35
+ export type IEphemeralRuntime = Omit<ExtensionHost, "logger" | "submitAddressedSignal"> & Partial<Pick<ExtensionHost, "logger">> & {
36
+ /**
37
+ * Submits the signal to be sent to other clients.
38
+ * @param type - Type of the signal.
39
+ * @param content - Content of the signal. Should be a JSON serializable object or primitive.
40
+ * @param targetClientId - When specified, the signal is only sent to the provided client id.
41
+ */
42
+ submitSignal: (message: OutboundAcknowledgementMessage | OutboundClientJoinMessage | OutboundDatastoreUpdateMessage) => void;
43
+ };
26
44
  /**
27
- * @internal
45
+ * Contract for State Managers as used by a States Workspace (`PresenceStatesImpl`)
46
+ *
47
+ * @remarks
48
+ * See uses of `unbrandIVM`.
28
49
  */
29
50
  export interface ValueManager<TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>> {
30
51
  readonly value?: TValueState;
31
52
  update(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];
32
53
  }
33
54
  /**
34
- * @internal
55
+ * A function to be called at the end of an update frame
35
56
  */
36
57
  export type PostUpdateAction = () => void;
37
58
  //# sourceMappingURL=internalTypes.d.ts.map
@@ -1 +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,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kEAAkE,CAAC;AAEzG;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC;IAIxF,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;CACjC;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,QAAQ,EAAE,Q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CAAC,GAAG,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC;IAG1F,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAAC;CACrF;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.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 { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { AttendeeId, Attendee } from \"./presence.js\";\n\nimport type { IRuntimeInternal } from \"@fluidframework/presence/internal/container-definitions/internal\";\n\n/**\n * @internal\n */\nexport interface ClientRecord<TValue extends InternalTypes.ValueDirectoryOrState<unknown>> {\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[AttendeeId: AttendeeId]: TValue;\n}\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// State objects should provide value - implement Required<ValueManager<...>>\n\treadonly value?: TValueState;\n\tupdate(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];\n}\n\n/**\n * @internal\n */\nexport type PostUpdateAction = () => void;\n"]}
1
+ {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.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 { ExtensionHost as ContainerExtensionHost } from \"@fluidframework/container-runtime-definitions/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { AttendeeId, Attendee } from \"./presence.js\";\nimport type {\n\tOutboundAcknowledgementMessage,\n\tOutboundClientJoinMessage,\n\tOutboundDatastoreUpdateMessage,\n\tSignalMessages,\n} from \"./protocol.js\";\n\n/**\n * Presence {@link ContainerExtension} version of {@link @fluidframework/container-runtime-definitions#ExtensionRuntimeProperties}\n */\nexport interface ExtensionRuntimeProperties {\n\tSignalMessages: SignalMessages;\n}\n/**\n * Presence specific ExtensionHost\n */\nexport type ExtensionHost = ContainerExtensionHost<ExtensionRuntimeProperties>;\n\n/**\n * Basic structure of set of {@link Attendee} records within Presence datastore\n *\n * @remarks\n * This is commonly exists per named state in State Managers.\n */\nexport interface ClientRecord<TValue extends InternalTypes.ValueDirectoryOrState<unknown>> {\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[AttendeeId: AttendeeId]: TValue;\n}\n\n/**\n * This interface is a subset of ExtensionHost (and mostly of\n * FluidDataStoreRuntime) that is needed by the Presence States.\n *\n * @privateRemarks\n * Replace with non-DataStore based interface.\n */\nexport type IEphemeralRuntime = Omit<ExtensionHost, \"logger\" | \"submitAddressedSignal\"> &\n\t// Apart from tests, there is always a logger. So this could be promoted to required.\n\tPartial<Pick<ExtensionHost, \"logger\">> & {\n\t\t/**\n\t\t * Submits the signal to be sent to other clients.\n\t\t * @param type - Type of the signal.\n\t\t * @param content - Content of the signal. Should be a JSON serializable object or primitive.\n\t\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t\t */\n\t\tsubmitSignal: (\n\t\t\tmessage:\n\t\t\t\t| OutboundAcknowledgementMessage\n\t\t\t\t| OutboundClientJoinMessage\n\t\t\t\t| OutboundDatastoreUpdateMessage,\n\t\t) => void;\n\t};\n\n/**\n * Contract for State Managers as used by a States Workspace (`PresenceStatesImpl`)\n *\n * @remarks\n * See uses of `unbrandIVM`.\n */\nexport interface ValueManager<\n\tTValue,\n\tTValueState extends\n\t\tInternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>,\n> {\n\t// State objects should provide value - implement Required<ValueManager<...>>\n\treadonly value?: TValueState;\n\tupdate(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];\n}\n\n/**\n * A function to be called at the end of an update frame\n */\nexport type PostUpdateAction = () => void;\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { DeepReadonly } from "@fluidframework/core-interfaces/internal";
5
+ import type { DeepReadonly, JsonDeserialized, JsonSerializable, OpaqueJsonDeserialized, OpaqueJsonSerializable } from "@fluidframework/core-interfaces/internal";
6
6
  /**
7
7
  * Returns union of types of values in a record.
8
8
  */
@@ -19,9 +19,12 @@ type RequiredAndNotUndefined<T> = {
19
19
  /**
20
20
  * Object.entries retyped to preserve known keys and their types.
21
21
  *
22
- * @internal
22
+ * @privateRemarks
23
+ * The is a defect in this utility when a string index appears in the object.
24
+ * In such a case, the only result is `[string, T]`, where `T` is the type
25
+ * of the string index entry.
23
26
  */
24
- export declare const objectEntries: <T>(o: T) => KeyValuePairs<T>;
27
+ export declare const objectEntries: <const T>(o: T) => KeyValuePairs<T>;
25
28
  /**
26
29
  * Object.entries retyped to preserve known keys and their types.
27
30
  *
@@ -29,16 +32,12 @@ export declare const objectEntries: <T>(o: T) => KeyValuePairs<T>;
29
32
  * Given `T` should not contain `undefined` values. If it does, use
30
33
  * {@link objectEntries} instead. Without `undefined` values, this
31
34
  * typing provides best handling of objects with optional properties.
32
- *
33
- * @internal
34
35
  */
35
- export declare const objectEntriesWithoutUndefined: <T>(o: T) => KeyValuePairs<RequiredAndNotUndefined<T>>;
36
+ export declare const objectEntriesWithoutUndefined: <const T>(o: T) => KeyValuePairs<RequiredAndNotUndefined<T>>;
36
37
  /**
37
38
  * Object.keys retyped to preserve known keys and their types.
38
- *
39
- * @internal
40
39
  */
41
- export declare const objectKeys: <T>(o: T) => (keyof MapNumberIndicesToStrings<T>)[];
40
+ export declare const objectKeys: <const T>(o: T) => (keyof MapNumberIndicesToStrings<T>)[];
42
41
  /**
43
42
  * Retrieve a value from a record with the given key, or create a new entry if
44
43
  * the key is not in the record.
@@ -51,10 +50,34 @@ export declare const objectKeys: <T>(o: T) => (keyof MapNumberIndicesToStrings<T
51
50
  * @returns either the existing value for the given key, or the newly-created
52
51
  * value (the result of `defaultValue`)
53
52
  */
54
- export declare function getOrCreateRecord<K extends string | number | symbol, V>(record: Record<K, V>, key: K, defaultValue: (key: K) => V): V;
53
+ export declare function getOrCreateRecord<const K extends string | number | symbol, const V>(record: Record<K, V>, key: K, defaultValue: (key: K) => V): V;
55
54
  /**
56
- * Do nothing helper to apply deep immutability to a value's type.
55
+ * No-runtime-effect helper to apply deep immutability to a value's type.
57
56
  */
58
57
  export declare function asDeeplyReadonly<T>(value: T): DeepReadonly<T>;
58
+ export declare function asDeeplyReadonlyDeserializedJson<T>(value: OpaqueJsonDeserialized<T>): DeepReadonly<JsonDeserialized<T>>;
59
+ export declare function asDeeplyReadonlyDeserializedJson<T>(value: OpaqueJsonDeserialized<T> | undefined): DeepReadonly<JsonDeserialized<T>> | undefined;
60
+ type RevealOpaqueJsonDeserialized<T> = T extends OpaqueJsonDeserialized<infer U> ? JsonDeserialized<U> : {
61
+ [Key in keyof T]: RevealOpaqueJsonDeserialized<T[Key]>;
62
+ };
63
+ /**
64
+ * No-runtime-effect helper to reveal the JSON type from a value's opaque JSON
65
+ * types throughout a structure.
66
+ *
67
+ * @remarks
68
+ * {@link OpaqueJsonDeserialized} instances will be replaced shallowly such
69
+ * that nested instances are retained.
70
+ */
71
+ export declare function revealOpaqueJson<T>(value: T): RevealOpaqueJsonDeserialized<T>;
72
+ /**
73
+ * No-runtime-effect helper to automatically cast JSON type to Opaque JSON type
74
+ * at outermost scope.
75
+ *
76
+ * @remarks
77
+ * Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,
78
+ * the return type is both {@link OpaqueJsonSerializable} and
79
+ * {@link OpaqueJsonDeserialized}.
80
+ */
81
+ export declare function toOpaqueJson<const T>(value: JsonSerializable<T>): OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T>;
59
82
  export {};
60
83
  //# sourceMappingURL=internalUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internalUtils.d.ts","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7C,KAAK,yBAAyB,CAAC,CAAC,IAAI;KAClC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC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AAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAE7D;AAED,wBAAgB,gCAAgC,CAAC,CAAC,EACjD,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAC9B,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,wBAAgB,gCAAgC,CAAC,CAAC,EACjD,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,SAAS,GAC1C,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAWjD,KAAK,4BAA4B,CAAC,CAAC,IAAI,CAAC,SAAS,sBAAsB,CAAC,MAAM,CAAC,CAAC,GAC7E,gBAAgB,CAAC,CAAC,CAAC,GACnB;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAE7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,EACnC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAEvD"}
@@ -4,11 +4,14 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.asDeeplyReadonly = exports.getOrCreateRecord = exports.objectKeys = exports.objectEntriesWithoutUndefined = exports.objectEntries = void 0;
7
+ exports.toOpaqueJson = exports.revealOpaqueJson = exports.asDeeplyReadonlyDeserializedJson = exports.asDeeplyReadonly = exports.getOrCreateRecord = exports.objectKeys = exports.objectEntriesWithoutUndefined = exports.objectEntries = void 0;
8
8
  /**
9
9
  * Object.entries retyped to preserve known keys and their types.
10
10
  *
11
- * @internal
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.
12
15
  */
13
16
  exports.objectEntries = Object.entries;
14
17
  /**
@@ -18,14 +21,10 @@ exports.objectEntries = Object.entries;
18
21
  * Given `T` should not contain `undefined` values. If it does, use
19
22
  * {@link objectEntries} instead. Without `undefined` values, this
20
23
  * typing provides best handling of objects with optional properties.
21
- *
22
- * @internal
23
24
  */
24
25
  exports.objectEntriesWithoutUndefined = Object.entries;
25
26
  /**
26
27
  * Object.keys retyped to preserve known keys and their types.
27
- *
28
- * @internal
29
28
  */
30
29
  exports.objectKeys = Object.keys;
31
30
  /**
@@ -48,10 +47,43 @@ function getOrCreateRecord(record, key, defaultValue) {
48
47
  }
49
48
  exports.getOrCreateRecord = getOrCreateRecord;
50
49
  /**
51
- * Do nothing helper to apply deep immutability to a value's type.
50
+ * No-runtime-effect helper to apply deep immutability to a value's type.
52
51
  */
53
52
  function asDeeplyReadonly(value) {
54
53
  return value;
55
54
  }
56
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;
57
89
  //# sourceMappingURL=internalUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internalUtils.js","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAqBH;;;;GAIG;AACU,QAAA,aAAa,GAAG,MAAM,CAAC,OAAwC,CAAC;AAE7E;;;;;;;;;GASG;AACU,QAAA,6BAA6B,GAAG,MAAM,CAAC,OAEN,CAAC;AAE/C;;;;GAIG;AACU,QAAA,UAAU,GAAG,MAAM,CAAC,IAA2D,CAAC;AAE7F;;;;;;;;;;;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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { DeepReadonly } from \"@fluidframework/core-interfaces/internal\";\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 * @internal\n */\nexport const objectEntries = Object.entries as <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 *\n * @internal\n */\nexport const objectEntriesWithoutUndefined = Object.entries as <T>(\n\to: T,\n) => KeyValuePairs<RequiredAndNotUndefined<T>>;\n\n/**\n * Object.keys retyped to preserve known keys and their types.\n *\n * @internal\n */\nexport const objectKeys = Object.keys as <T>(o: T) => (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<K extends string | number | symbol, 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 * Do nothing 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"]}
1
+ {"version":3,"file":"internalUtils.js","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2BH;;;;;;;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;AAQD;;;GAGG;AACH,SAAgB,gCAAgC,CAC/C,KAA4C;IAE5C,OAAO,KAAsD,CAAC;AAC/D,CAAC;AAJD,4EAIC;AAMD;;;;;;;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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tDeepReadonly,\n\tJsonDeserialized,\n\tJsonSerializable,\n\tOpaqueJsonDeserialized,\n\tOpaqueJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal\";\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\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\ntype RevealOpaqueJsonDeserialized<T> = T extends OpaqueJsonDeserialized<infer U>\n\t? JsonDeserialized<U>\n\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"]}