@fluidframework/presence 2.81.0 → 2.82.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 (99) hide show
  1. package/dist/alpha.d.ts +1 -1
  2. package/dist/exposedUtilityTypes.d.ts +57 -5
  3. package/dist/exposedUtilityTypes.d.ts.map +1 -1
  4. package/dist/exposedUtilityTypes.js.map +1 -1
  5. package/dist/index.d.ts +3 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/internalUtils.d.ts.map +1 -1
  9. package/dist/internalUtils.js.map +1 -1
  10. package/dist/latestMapTypes.d.ts +309 -0
  11. package/dist/latestMapTypes.d.ts.map +1 -0
  12. package/dist/latestMapTypes.js +8 -0
  13. package/dist/latestMapTypes.js.map +1 -0
  14. package/dist/latestMapValueManager.d.ts +4 -265
  15. package/dist/latestMapValueManager.d.ts.map +1 -1
  16. package/dist/latestMapValueManager.js +3 -4
  17. package/dist/latestMapValueManager.js.map +1 -1
  18. package/dist/latestTypes.d.ts +149 -0
  19. package/dist/latestTypes.d.ts.map +1 -0
  20. package/dist/latestTypes.js +7 -0
  21. package/dist/latestTypes.js.map +1 -0
  22. package/dist/latestValueManager.d.ts +1 -144
  23. package/dist/latestValueManager.d.ts.map +1 -1
  24. package/dist/latestValueManager.js +4 -5
  25. package/dist/latestValueManager.js.map +1 -1
  26. package/dist/latestValueTypes.d.ts +0 -11
  27. package/dist/latestValueTypes.d.ts.map +1 -1
  28. package/dist/latestValueTypes.js +0 -36
  29. package/dist/latestValueTypes.js.map +1 -1
  30. package/dist/legacy.alpha.d.ts +1 -1
  31. package/dist/notificationsManager.d.ts +15 -5
  32. package/dist/notificationsManager.d.ts.map +1 -1
  33. package/dist/notificationsManager.js +0 -4
  34. package/dist/notificationsManager.js.map +1 -1
  35. package/dist/notificationsManagerTypes.d.ts +7 -4
  36. package/dist/notificationsManagerTypes.d.ts.map +1 -1
  37. package/dist/notificationsManagerTypes.js.map +1 -1
  38. package/dist/packageVersion.d.ts +1 -1
  39. package/dist/packageVersion.js +1 -1
  40. package/dist/packageVersion.js.map +1 -1
  41. package/dist/stateFactory.d.ts +2 -2
  42. package/dist/stateFactory.d.ts.map +1 -1
  43. package/dist/stateFactory.js.map +1 -1
  44. package/dist/validatableTypes.d.ts.map +1 -1
  45. package/dist/validatableTypes.js.map +1 -1
  46. package/dist/validatedGetter.d.ts +18 -0
  47. package/dist/validatedGetter.d.ts.map +1 -0
  48. package/dist/validatedGetter.js +43 -0
  49. package/dist/validatedGetter.js.map +1 -0
  50. package/lib/alpha.d.ts +1 -1
  51. package/lib/exposedUtilityTypes.d.ts +57 -5
  52. package/lib/exposedUtilityTypes.d.ts.map +1 -1
  53. package/lib/exposedUtilityTypes.js.map +1 -1
  54. package/lib/index.d.ts +3 -3
  55. package/lib/index.d.ts.map +1 -1
  56. package/lib/index.js.map +1 -1
  57. package/lib/internalUtils.d.ts.map +1 -1
  58. package/lib/internalUtils.js.map +1 -1
  59. package/lib/latestMapTypes.d.ts +309 -0
  60. package/lib/latestMapTypes.d.ts.map +1 -0
  61. package/lib/latestMapTypes.js +7 -0
  62. package/lib/latestMapTypes.js.map +1 -0
  63. package/lib/latestMapValueManager.d.ts +4 -265
  64. package/lib/latestMapValueManager.d.ts.map +1 -1
  65. package/lib/latestMapValueManager.js +1 -2
  66. package/lib/latestMapValueManager.js.map +1 -1
  67. package/lib/latestTypes.d.ts +149 -0
  68. package/lib/latestTypes.d.ts.map +1 -0
  69. package/lib/latestTypes.js +6 -0
  70. package/lib/latestTypes.js.map +1 -0
  71. package/lib/latestValueManager.d.ts +1 -144
  72. package/lib/latestValueManager.d.ts.map +1 -1
  73. package/lib/latestValueManager.js +1 -2
  74. package/lib/latestValueManager.js.map +1 -1
  75. package/lib/latestValueTypes.d.ts +0 -11
  76. package/lib/latestValueTypes.d.ts.map +1 -1
  77. package/lib/latestValueTypes.js +1 -34
  78. package/lib/latestValueTypes.js.map +1 -1
  79. package/lib/legacy.alpha.d.ts +1 -1
  80. package/lib/notificationsManager.d.ts +15 -5
  81. package/lib/notificationsManager.d.ts.map +1 -1
  82. package/lib/notificationsManager.js +0 -4
  83. package/lib/notificationsManager.js.map +1 -1
  84. package/lib/notificationsManagerTypes.d.ts +7 -4
  85. package/lib/notificationsManagerTypes.d.ts.map +1 -1
  86. package/lib/notificationsManagerTypes.js.map +1 -1
  87. package/lib/packageVersion.d.ts +1 -1
  88. package/lib/packageVersion.js +1 -1
  89. package/lib/packageVersion.js.map +1 -1
  90. package/lib/stateFactory.d.ts +2 -2
  91. package/lib/stateFactory.d.ts.map +1 -1
  92. package/lib/stateFactory.js.map +1 -1
  93. package/lib/validatableTypes.d.ts.map +1 -1
  94. package/lib/validatableTypes.js.map +1 -1
  95. package/lib/validatedGetter.d.ts +18 -0
  96. package/lib/validatedGetter.d.ts.map +1 -0
  97. package/lib/validatedGetter.js +39 -0
  98. package/lib/validatedGetter.js.map +1 -0
  99. package/package.json +16 -16
package/dist/alpha.d.ts CHANGED
@@ -68,7 +68,7 @@ export {
68
68
  InternalUtilityTypes,
69
69
  NotificationEmitter,
70
70
  NotificationListenable,
71
- NotificationSubscriptions,
71
+ NotificationSubscriberSignatures,
72
72
  Notifications,
73
73
  NotificationsManager,
74
74
  NotificationsManagerEvents,
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
6
+ import type { Attendee } from "./presence.js";
6
7
  /**
7
8
  * Collection of utility types that are not intended to be used/imported
8
9
  * directly outside of this package.
@@ -12,14 +13,22 @@ import type { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized
12
13
  */
13
14
  export declare namespace InternalUtilityTypes {
14
15
  /**
15
- * Yields `IfListener` when the given type is an acceptable shape for a notification.
16
- * `Else` otherwise.
16
+ * Yields `IfParametersValid` when the given type is an acceptable shape for a
17
+ * notification. `Else` otherwise.
17
18
  *
18
19
  * @system
19
20
  */
20
- type IfNotificationListener<Event, IfListener, Else> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfListener, Else> : Else;
21
+ type IfNotificationParametersSignature<Event, IfParametersValid, Else> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfParametersValid, Else> : Else;
21
22
  /**
22
- * Used to specify the kinds of notifications emitted by a {@link NotificationListenable}.
23
+ * Yields `IfSubscriber` when the given type is an acceptable shape for a notification
24
+ * listener (subscriber) function. `Else` otherwise.
25
+ *
26
+ * @system
27
+ */
28
+ type IfNotificationSubscriberSignature<Event, IfSubscriber, Else> = Event extends (sender: Attendee, ...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfSubscriber, Else> : Else;
29
+ /**
30
+ * Used to specify the kinds of notifications handled by a {@link NotificationListenable}
31
+ * by describing the custom parameters in a function signature.
23
32
  *
24
33
  * @remarks
25
34
  *
@@ -38,8 +47,51 @@ export declare namespace InternalUtilityTypes {
38
47
  * @system
39
48
  */
40
49
  type NotificationListeners<E> = {
41
- [P in keyof E as IfNotificationListener<E[P], P, never>]: E[P];
50
+ [P in keyof E as IfNotificationParametersSignature<E[P], P, never>]: E[P];
42
51
  };
52
+ /**
53
+ * Converts a notification subscriber signature into parameters signature
54
+ * (by removing the `sender: Attendee` parameter).
55
+ *
56
+ * @remarks
57
+ * No attempt is made to validate that the original signature is valid with
58
+ * all parameters being JSON-serializable.
59
+ *
60
+ * @system
61
+ */
62
+ type NotificationParametersSignatureFromSubscriberSignature<Event> = Event extends (sender: Attendee, ...args: infer P) => void ? (...args: P) => void : never;
63
+ /**
64
+ * Used to specify the kinds of notifications handled by a {@link NotificationListenable}
65
+ * by describing the subscriber signatures.
66
+ *
67
+ * @remarks
68
+ *
69
+ * Any object type is a valid NotificationListenersWithSubscriberSignatures,
70
+ * but only the notification-like properties of that type will be included.
71
+ *
72
+ * @example
73
+ *
74
+ * ```typescript
75
+ * interface MyNotifications {
76
+ * load: (sender: Attendee, user: string, data: IUserData) => void;
77
+ * requestPause: (sender: Attendee, period: number) => void;
78
+ * }
79
+ * ```
80
+ *
81
+ * @system
82
+ */
83
+ type NotificationListenersWithSubscriberSignatures<E> = {
84
+ [P in keyof E as IfNotificationSubscriberSignature<E[P], P, never>]: E[P];
85
+ };
86
+ /**
87
+ * Converts a record of notification subscriber signatures into
88
+ * a record of base parameter signatures (which are the canonical form).
89
+ *
90
+ * @system
91
+ */
92
+ type NotificationListenersFromSubscriberSignatures<E extends NotificationListenersWithSubscriberSignatures<E>> = {
93
+ [K in keyof NotificationListenersWithSubscriberSignatures<E>]: NotificationParametersSignatureFromSubscriberSignature<E[K]>;
94
+ } extends infer TListeners ? NotificationListeners<TListeners> : never;
43
95
  /**
44
96
  * {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.
45
97
  *
@@ -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;;;;;OAKG;IACH,KAAY,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,KAAK,SAAS,CAC3E,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,IAAI,GACN,wBAAwB,CAAC,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,GAC7E,IAAI,CAAC;IAER;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAY,qBAAqB,CAAC,CAAC,IAAI;SACrC,CAAC,IAAI,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AE,MAAM,CAAC,KACZ,OAAO,GACT,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;IAET;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,IAAI,CAAC,SAAS,CACzF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,OAAO,GACT,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 * 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[]) => unknown> = T extends (\n\t\t...args: infer P\n\t) => unknown\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[]) => unknown> = T extends (\n\t\t...args: infer P\n\t) => unknown\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\nimport type { Attendee } from \"./presence.js\";\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 `IfParametersValid` when the given type is an acceptable shape for a\n\t * notification. `Else` otherwise.\n\t *\n\t * @system\n\t */\n\texport type IfNotificationParametersSignature<Event, IfParametersValid, Else> =\n\t\tEvent extends (...args: infer P) => void\n\t\t\t? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfParametersValid, Else>\n\t\t\t: Else;\n\n\t/**\n\t * Yields `IfSubscriber` when the given type is an acceptable shape for a notification\n\t * listener (subscriber) function. `Else` otherwise.\n\t *\n\t * @system\n\t */\n\texport type IfNotificationSubscriberSignature<Event, IfSubscriber, Else> = Event extends (\n\t\tsender: Attendee,\n\t\t...args: infer P\n\t) => void\n\t\t? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfSubscriber, Else>\n\t\t: Else;\n\n\t/**\n\t * Used to specify the kinds of notifications handled by a {@link NotificationListenable}\n\t * by describing the custom parameters in a function signature.\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 IfNotificationParametersSignature<E[P], P, never>]: E[P];\n\t};\n\n\t/**\n\t * Converts a notification subscriber signature into parameters signature\n\t * (by removing the `sender: Attendee` parameter).\n\t *\n\t * @remarks\n\t * No attempt is made to validate that the original signature is valid with\n\t * all parameters being JSON-serializable.\n\t *\n\t * @system\n\t */\n\texport type NotificationParametersSignatureFromSubscriberSignature<Event> = Event extends (\n\t\tsender: Attendee,\n\t\t...args: infer P\n\t) => void\n\t\t? (...args: P) => void\n\t\t: never;\n\n\t/**\n\t * Used to specify the kinds of notifications handled by a {@link NotificationListenable}\n\t * by describing the subscriber signatures.\n\t *\n\t * @remarks\n\t *\n\t * Any object type is a valid NotificationListenersWithSubscriberSignatures,\n\t * but only the notification-like properties of that type will be included.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * interface MyNotifications {\n\t * load: (sender: Attendee, user: string, data: IUserData) => void;\n\t * requestPause: (sender: Attendee, period: number) => void;\n\t * }\n\t * ```\n\t *\n\t * @system\n\t */\n\texport type NotificationListenersWithSubscriberSignatures<E> = {\n\t\t[P in keyof E as IfNotificationSubscriberSignature<E[P], P, never>]: E[P];\n\t};\n\n\t/**\n\t * Converts a record of notification subscriber signatures into\n\t * a record of base parameter signatures (which are the canonical form).\n\t *\n\t * @system\n\t */\n\texport type NotificationListenersFromSubscriberSignatures<\n\t\tE extends NotificationListenersWithSubscriberSignatures<E>,\n\t> = {\n\t\t[K in keyof NotificationListenersWithSubscriberSignatures<E>]: NotificationParametersSignatureFromSubscriberSignature<\n\t\t\tE[K]\n\t\t>;\n\t} extends infer TListeners\n\t\t? // Additional filter is needed to convince TypeScript that the result is NotificationListeners shape\n\t\t\tNotificationListeners<TListeners>\n\t\t: never;\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[]) => unknown> = T extends (\n\t\t...args: infer P\n\t) => unknown\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[]) => unknown> = T extends (\n\t\t...args: infer P\n\t) => unknown\n\t\t? JsonSerializable<P>\n\t\t: never;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -14,11 +14,11 @@ export type { NotificationsWorkspace, NotificationsWorkspaceSchema, StatesWorksp
14
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 "./broadcastControlsTypes.js";
16
16
  export { getPresence, getPresenceAlpha, getPresenceFromDataStoreContext, } from "./getPresence.js";
17
- export type { KeySchemaValidator, LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./latestMapValueManager.js";
18
- export type { Latest, LatestArguments, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./latestValueManager.js";
17
+ export type { KeySchemaValidator, LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./latestMapTypes.js";
18
+ export type { Latest, LatestArguments, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./latestTypes.js";
19
19
  export type { Accessor, LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor, } from "./latestValueTypes.js";
20
20
  export { Notifications } from "./notificationsManager.js";
21
- export type { NotificationEmitter, NotificationListenable, NotificationSubscriptions, NotificationsManager, NotificationsManagerEvents, } from "./notificationsManagerTypes.js";
21
+ export type { NotificationEmitter, NotificationListenable, NotificationSubscriberSignatures, NotificationsManager, NotificationsManagerEvents, } from "./notificationsManagerTypes.js";
22
22
  export { StateFactory } from "./stateFactory.js";
23
23
  export type { InternalTypes } from "./exposedInternalTypes.js";
24
24
  export type { InternalUtilityTypes } from "./exposedUtilityTypes.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,EACnB,KAAK,yBAAyB,GAC9B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACX,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,+BAA+B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,YAAY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BAAiB,EACjB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,+BAA+B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACX,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EAC9B,8BAA8B,EAC9B,YAAY,EACZ,kBAAkB,EAClB,QAAQ,GACR,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACX,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,eAAe,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACX,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EACX,mBAAmB,EACnB,sBAAsB,EACtB,gCAAgC,EAChC,oBAAoB,EACpB,0BAA0B,GAC1B,MAAM,gCAAgC,CAAC;AAExC,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.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,mDAI0B;AAHzB,6GAAA,WAAW,OAAA;AACX,kHAAA,gBAAgB,OAAA;AAChB,iIAAA,+BAA+B,OAAA;AAqChC,qEAA0D;AAAjD,wHAAA,aAAa,OAAA;AAStB,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 \"./broadcastControlsTypes.js\";\n\nexport {\n\tgetPresence,\n\tgetPresenceAlpha,\n\tgetPresenceFromDataStoreContext,\n} from \"./getPresence.js\";\n\nexport type {\n\tKeySchemaValidator,\n\tLatestMap,\n\tLatestMapArguments,\n\tLatestMapArgumentsRaw,\n\tLatestMapClientData,\n\tLatestMapEvents,\n\tLatestMapFactory,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tLatestMapRaw,\n\tLatestMapRawEvents,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tAccessor,\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\n\nexport { Notifications } from \"./notificationsManager.js\";\nexport type {\n\tNotificationEmitter,\n\tNotificationListenable,\n\tNotificationSubscriptions,\n\tNotificationsManager,\n\tNotificationsManagerEvents,\n} from \"./notificationsManagerTypes.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,mDAI0B;AAHzB,6GAAA,WAAW,OAAA;AACX,kHAAA,gBAAgB,OAAA;AAChB,iIAAA,+BAA+B,OAAA;AAqChC,qEAA0D;AAAjD,wHAAA,aAAa,OAAA;AAStB,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 \"./broadcastControlsTypes.js\";\n\nexport {\n\tgetPresence,\n\tgetPresenceAlpha,\n\tgetPresenceFromDataStoreContext,\n} from \"./getPresence.js\";\n\nexport type {\n\tKeySchemaValidator,\n\tLatestMap,\n\tLatestMapArguments,\n\tLatestMapArgumentsRaw,\n\tLatestMapClientData,\n\tLatestMapEvents,\n\tLatestMapFactory,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tLatestMapRaw,\n\tLatestMapRawEvents,\n\tStateMap,\n} from \"./latestMapTypes.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestTypes.js\";\nexport type {\n\tAccessor,\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\n\nexport { Notifications } from \"./notificationsManager.js\";\nexport type {\n\tNotificationEmitter,\n\tNotificationListenable,\n\tNotificationSubscriberSignatures,\n\tNotificationsManager,\n\tNotificationsManagerEvents,\n} from \"./notificationsManagerTypes.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internalUtils.d.ts","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EACX,wBAAwB,EACxB,wBAAwB,EACxB,MAAM,uBAAuB,CAAC;AAE/B;;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,C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Utils.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;AAUD;;;;;;;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;AA6CD;;;;;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\tInternalUtilityTypes,\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> = 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\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> = Pick<T, keyof T> extends infer Common\n\t? T extends unknown\n\t\t? Omit<T, keyof Common>\n\t\t: never\n\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> = InternalUtilityTypes.FlattenIntersection<\n\tPick<T, keyof T> & UnionToIntersection<Partial<PickRemainder<T>>>\n>;\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
+ {"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;AA8CD;;;;;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\tInternalUtilityTypes,\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> = InternalUtilityTypes.FlattenIntersection<\n\tPick<T, keyof T> & UnionToIntersection<Partial<PickRemainder<T>>>\n>;\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"]}
@@ -0,0 +1,309 @@
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
+ * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
287
+ *
288
+ * @beta
289
+ * @sealed
290
+ */
291
+ export interface LatestMapFactory {
292
+ /**
293
+ * Factory for creating a {@link LatestMap} State object.
294
+ *
295
+ * @remarks
296
+ * This overload is used when called with {@link LatestMapArguments}.
297
+ * That is, if a validator function is provided.
298
+ */
299
+ <T, Keys extends string = string, RegistrationKey extends string = string>(args: LatestMapArguments<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
300
+ /**
301
+ * Factory for creating a {@link LatestMapRaw} State object.
302
+ *
303
+ * @remarks
304
+ * This overload is used when called with {@link LatestMapArgumentsRaw}.
305
+ * That is, if a validator function is _not_ provided.
306
+ */
307
+ <T, Keys extends string = string, RegistrationKey extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
308
+ }
309
+ //# sourceMappingURL=latestMapTypes.d.ts.map
@@ -0,0 +1 @@
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,M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AE,IAAI,CAAC,CAClB,CAAC;IAEF;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,EACxE,IAAI,CAAC,EAAE,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC,GACnC,aAAa,CAAC,cAAc,CAC9B,eAAe,EACf,aAAa,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,EACpC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CACrB,CAAC;CACF"}
@@ -0,0 +1,8 @@
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
+ // #endregion
8
+ //# sourceMappingURL=latestMapTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latestMapTypes.js","sourceRoot":"","sources":["../src/latestMapTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA8ZH,aAAa","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// #region factory function overloads\n// Overloads should be ordered from most specific to least specific when combined.\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, RegistrationKey extends string = string>(\n\t\targs: LatestMapArguments<T, Keys>,\n\t): InternalTypes.ManagerFactory<\n\t\tRegistrationKey,\n\t\tInternalTypes.MapValueState<T, Keys>,\n\t\tLatestMap<T, Keys>\n\t>;\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, RegistrationKey extends string = string>(\n\t\targs?: LatestMapArgumentsRaw<T, Keys>,\n\t): InternalTypes.ManagerFactory<\n\t\tRegistrationKey,\n\t\tInternalTypes.MapValueState<T, Keys>,\n\t\tLatestMapRaw<T, Keys>\n\t>;\n}\n\n// #endregion\n"]}