@fluidframework/presence 2.90.0-378676 → 2.90.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 +8 -2
  2. package/dist/beta.d.ts +5 -1
  3. package/dist/exposedInternalTypes.d.ts +7 -2
  4. package/dist/exposedInternalTypes.d.ts.map +1 -1
  5. package/dist/exposedInternalTypes.js.map +1 -1
  6. package/dist/exposedUtilityTypes.d.ts +3 -3
  7. package/dist/exposedUtilityTypes.d.ts.map +1 -1
  8. package/dist/exposedUtilityTypes.js.map +1 -1
  9. package/dist/index.d.ts +5 -5
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/internalUtils.d.ts +2 -2
  13. package/dist/internalUtils.d.ts.map +1 -1
  14. package/dist/internalUtils.js.map +1 -1
  15. package/dist/latestMapTypes.d.ts +36 -2
  16. package/dist/latestMapTypes.d.ts.map +1 -1
  17. package/dist/latestMapTypes.js +0 -1
  18. package/dist/latestMapTypes.js.map +1 -1
  19. package/dist/latestTypes.d.ts +36 -2
  20. package/dist/latestTypes.d.ts.map +1 -1
  21. package/dist/latestTypes.js.map +1 -1
  22. package/dist/legacy.alpha.d.ts +8 -2
  23. package/dist/notificationsManager.d.ts +3 -4
  24. package/dist/notificationsManager.d.ts.map +1 -1
  25. package/dist/notificationsManager.js.map +1 -1
  26. package/dist/notificationsManagerTypes.d.ts +33 -0
  27. package/dist/notificationsManagerTypes.d.ts.map +1 -1
  28. package/dist/notificationsManagerTypes.js.map +1 -1
  29. package/dist/packageVersion.d.ts +1 -1
  30. package/dist/packageVersion.d.ts.map +1 -1
  31. package/dist/packageVersion.js +1 -1
  32. package/dist/packageVersion.js.map +1 -1
  33. package/dist/presence.d.ts +2 -2
  34. package/dist/presence.d.ts.map +1 -1
  35. package/dist/presence.js.map +1 -1
  36. package/dist/presenceDatastoreManager.d.ts +2 -2
  37. package/dist/presenceDatastoreManager.d.ts.map +1 -1
  38. package/dist/presenceDatastoreManager.js.map +1 -1
  39. package/dist/presenceManager.d.ts.map +1 -1
  40. package/dist/presenceManager.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/types.d.ts +15 -17
  45. package/dist/types.d.ts.map +1 -1
  46. package/dist/types.js.map +1 -1
  47. package/dist/validatableTypes.d.ts +3 -3
  48. package/dist/validatableTypes.d.ts.map +1 -1
  49. package/dist/validatableTypes.js.map +1 -1
  50. package/lib/alpha.d.ts +8 -2
  51. package/lib/beta.d.ts +5 -1
  52. package/lib/exposedInternalTypes.d.ts +7 -2
  53. package/lib/exposedInternalTypes.d.ts.map +1 -1
  54. package/lib/exposedInternalTypes.js.map +1 -1
  55. package/lib/exposedUtilityTypes.d.ts +3 -3
  56. package/lib/exposedUtilityTypes.d.ts.map +1 -1
  57. package/lib/exposedUtilityTypes.js.map +1 -1
  58. package/lib/index.d.ts +5 -5
  59. package/lib/index.d.ts.map +1 -1
  60. package/lib/index.js.map +1 -1
  61. package/lib/internalUtils.d.ts +2 -2
  62. package/lib/internalUtils.d.ts.map +1 -1
  63. package/lib/internalUtils.js.map +1 -1
  64. package/lib/latestMapTypes.d.ts +36 -2
  65. package/lib/latestMapTypes.d.ts.map +1 -1
  66. package/lib/latestMapTypes.js +0 -1
  67. package/lib/latestMapTypes.js.map +1 -1
  68. package/lib/latestTypes.d.ts +36 -2
  69. package/lib/latestTypes.d.ts.map +1 -1
  70. package/lib/latestTypes.js.map +1 -1
  71. package/lib/legacy.alpha.d.ts +8 -2
  72. package/lib/notificationsManager.d.ts +3 -4
  73. package/lib/notificationsManager.d.ts.map +1 -1
  74. package/lib/notificationsManager.js.map +1 -1
  75. package/lib/notificationsManagerTypes.d.ts +33 -0
  76. package/lib/notificationsManagerTypes.d.ts.map +1 -1
  77. package/lib/notificationsManagerTypes.js.map +1 -1
  78. package/lib/packageVersion.d.ts +1 -1
  79. package/lib/packageVersion.d.ts.map +1 -1
  80. package/lib/packageVersion.js +1 -1
  81. package/lib/packageVersion.js.map +1 -1
  82. package/lib/presence.d.ts +2 -2
  83. package/lib/presence.d.ts.map +1 -1
  84. package/lib/presence.js.map +1 -1
  85. package/lib/presenceDatastoreManager.d.ts +2 -2
  86. package/lib/presenceDatastoreManager.d.ts.map +1 -1
  87. package/lib/presenceDatastoreManager.js.map +1 -1
  88. package/lib/presenceManager.d.ts.map +1 -1
  89. package/lib/presenceManager.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/types.d.ts +15 -17
  94. package/lib/types.d.ts.map +1 -1
  95. package/lib/types.js.map +1 -1
  96. package/lib/validatableTypes.d.ts +3 -3
  97. package/lib/validatableTypes.d.ts.map +1 -1
  98. package/lib/validatableTypes.js.map +1 -1
  99. package/package.json +17 -17
package/dist/alpha.d.ts CHANGED
@@ -26,12 +26,13 @@ export {
26
26
  BroadcastControlSettings,
27
27
  BroadcastControls,
28
28
  ClientConnectionId,
29
- InternalTypes,
29
+ InternalPresenceTypes,
30
30
  KeySchemaValidator,
31
31
  Latest,
32
32
  LatestArguments,
33
33
  LatestArgumentsRaw,
34
34
  LatestClientData,
35
+ LatestConfiguration,
35
36
  LatestData,
36
37
  LatestEvents,
37
38
  LatestFactory,
@@ -39,14 +40,17 @@ export {
39
40
  LatestMapArguments,
40
41
  LatestMapArgumentsRaw,
41
42
  LatestMapClientData,
43
+ LatestMapConfiguration,
42
44
  LatestMapEvents,
43
45
  LatestMapFactory,
44
46
  LatestMapItemRemovedClientData,
45
47
  LatestMapItemUpdatedClientData,
46
48
  LatestMapRaw,
49
+ LatestMapRawConfiguration,
47
50
  LatestMapRawEvents,
48
51
  LatestMetadata,
49
52
  LatestRaw,
53
+ LatestRawConfiguration,
50
54
  LatestRawEvents,
51
55
  Presence,
52
56
  PresenceEvents,
@@ -65,13 +69,15 @@ export {
65
69
  // #endregion
66
70
 
67
71
  // #region @alpha APIs
68
- InternalUtilityTypes,
72
+ InternalPresenceUtilityTypes,
69
73
  NotificationEmitter,
70
74
  NotificationListenable,
71
75
  NotificationSubscriberSignatures,
72
76
  Notifications,
77
+ NotificationsConfiguration,
73
78
  NotificationsManager,
74
79
  NotificationsManagerEvents,
80
+ NotificationsWithSubscriptionsConfiguration,
75
81
  NotificationsWorkspace,
76
82
  NotificationsWorkspaceSchema,
77
83
  PresenceWithNotifications,
package/dist/beta.d.ts CHANGED
@@ -26,12 +26,13 @@ export {
26
26
  BroadcastControlSettings,
27
27
  BroadcastControls,
28
28
  ClientConnectionId,
29
- InternalTypes,
29
+ InternalPresenceTypes,
30
30
  KeySchemaValidator,
31
31
  Latest,
32
32
  LatestArguments,
33
33
  LatestArgumentsRaw,
34
34
  LatestClientData,
35
+ LatestConfiguration,
35
36
  LatestData,
36
37
  LatestEvents,
37
38
  LatestFactory,
@@ -39,14 +40,17 @@ export {
39
40
  LatestMapArguments,
40
41
  LatestMapArgumentsRaw,
41
42
  LatestMapClientData,
43
+ LatestMapConfiguration,
42
44
  LatestMapEvents,
43
45
  LatestMapFactory,
44
46
  LatestMapItemRemovedClientData,
45
47
  LatestMapItemUpdatedClientData,
46
48
  LatestMapRaw,
49
+ LatestMapRawConfiguration,
47
50
  LatestMapRawEvents,
48
51
  LatestMetadata,
49
52
  LatestRaw,
53
+ LatestRawConfiguration,
50
54
  LatestRawEvents,
51
55
  Presence,
52
56
  PresenceEvents,
@@ -25,7 +25,7 @@ export declare namespace InternalTypes {
25
25
  * And it includes standard metadata.
26
26
  *
27
27
  * @remarks
28
- * See {@link InternalTypes.ValueRequiredState}.
28
+ * See {@link InternalPresenceTypes.ValueRequiredState}.
29
29
  *
30
30
  * @system
31
31
  */
@@ -43,7 +43,7 @@ export declare namespace InternalTypes {
43
43
  * need to specify some wrapper themselves.
44
44
  *
45
45
  * For known cases, construct a custom interface that extends
46
- * {@link InternalTypes.ValueStateMetadata}.
46
+ * {@link InternalPresenceTypes.ValueStateMetadata}.
47
47
  *
48
48
  * @system
49
49
  */
@@ -109,6 +109,11 @@ export declare namespace InternalTypes {
109
109
  /**
110
110
  * Package internal function declaration for state and notification instantiation.
111
111
  *
112
+ * @remarks
113
+ * Direct use of this type is discouraged. If in need, try to use the type
114
+ * returned by the factory functions instead, as those are more specific and
115
+ * stable.
116
+ *
112
117
  * @system
113
118
  */
114
119
  type ManagerFactory<TKey extends string, TValue extends ValueDirectoryOrState<unknown>, TManager> = {
@@ -1 +1 @@
1
- {"version":3,"file":"exposedInternalTypes.d.ts","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAC;AAE3G;;;;;;GAMG;AAEH,yBAAiB,aAAa,CAAC;IAC9B;;;;OAIG;IACH,UAAiB,kBAAkB;QAClC,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KAClB;IAED;;;;;;;;OAQG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;KAMvC;IAED;;;;;;;;;;;;;;OAcG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;KAMtC;IAED;;;;OAIG;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;;;;OAIG;IACH,KAAY,qBAAqB,CAAC,CAAC,IAAI,kBA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AqB,eAAe,CAAC,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;KAC3C;IAED;;;;;;;;;OASG;IACH,KAAY,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAEnD;;;;;;;;;OASG;IACH,KAAY,cAAc,CACzB,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,qBAAqB,CAAC,OAAO,CAAC,EAC7C,QAAQ,IACL;QAAE,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAA;KAAE,GAAG,CAAC,CACxD,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;;;;OAIG;IACH,UAAiB,gBAAgB;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,EAAE,CAAC;KAChB;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,2DAA2D;AAC3D,IAAiB,aAAa,CAsJ7B;AAtJD,WAAiB,aAAa;AAsJ9B,CAAC,EAtJgB,aAAa,6BAAb,aAAa,QAsJ7B","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 * Metadata for a value state.\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\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\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\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\n\t}\n\n\t/**\n\t * A directory of values, where each value may be an optional state or another directory.\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 * Convenience type for a required state or a directory of values.\n\t *\n\t * @system\n\t */\n\texport type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;\n\n\t/**\n\t * Collection of optional values in a \"map\" structure.\n\t *\n\t * @system\n\t */\n\texport interface MapValueState<T, Keys extends string> {\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 * Opaque type representing internal state datastore.\n\t *\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<\n\t\tTKey,\n\t\tTValue extends ValueDirectoryOrState<unknown>,\n\t> {\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<unknown>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => unknown } & ((\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 * Structure of a generic notification \"value\".\n\t *\n\t * @system\n\t */\n\texport interface NotificationType {\n\t\tname: string;\n\t\targs: 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,CA2J7B;AA3JD,WAAiB,aAAa;AA2J9B,CAAC,EA3JgB,aAAa,6BAAb,aAAa,QA2J7B","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 * Metadata for a value state.\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 InternalPresenceTypes.ValueRequiredState}.\n\t *\n\t * @system\n\t */\n\texport interface ValueOptionalState<TValue> extends ValueStateMetadata {\n\t\tvalue?: OpaqueJsonDeserialized<TValue>;\n\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\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 InternalPresenceTypes.ValueStateMetadata}.\n\t *\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: OpaqueJsonDeserialized<TValue>;\n\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\n\t}\n\n\t/**\n\t * A directory of values, where each value may be an optional state or another directory.\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 * Convenience type for a required state or a directory of values.\n\t *\n\t * @system\n\t */\n\texport type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;\n\n\t/**\n\t * Collection of optional values in a \"map\" structure.\n\t *\n\t * @system\n\t */\n\texport interface MapValueState<T, Keys extends string> {\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 * Opaque type representing internal state datastore.\n\t *\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<\n\t\tTKey,\n\t\tTValue extends ValueDirectoryOrState<unknown>,\n\t> {\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 * @remarks\n\t * Direct use of this type is discouraged. If in need, try to use the type\n\t * returned by the factory functions instead, as those are more specific and\n\t * stable.\n\t *\n\t * @system\n\t */\n\texport type ManagerFactory<\n\t\tTKey extends string,\n\t\tTValue extends ValueDirectoryOrState<unknown>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => unknown } & ((\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 * Structure of a generic notification \"value\".\n\t *\n\t * @system\n\t */\n\texport interface NotificationType {\n\t\tname: string;\n\t\targs: unknown[];\n\t}\n}\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 { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
5
+ import type { InternalCoreInterfacesUtilityTypes, JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
6
6
  import type { Attendee } from "./presence.js";
7
7
  /**
8
8
  * Collection of utility types that are not intended to be used/imported
@@ -18,14 +18,14 @@ export declare namespace InternalUtilityTypes {
18
18
  *
19
19
  * @system
20
20
  */
21
- type IfNotificationParametersSignature<Event, IfParametersValid, Else> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfParametersValid, Else> : Else;
21
+ type IfNotificationParametersSignature<Event, IfParametersValid, Else> = Event extends (...args: infer P) => void ? InternalCoreInterfacesUtilityTypes.IfSameType<P, JsonSerializable<P>, IfParametersValid, Else> : Else;
22
22
  /**
23
23
  * Yields `IfSubscriber` when the given type is an acceptable shape for a notification
24
24
  * listener (subscriber) function. `Else` otherwise.
25
25
  *
26
26
  * @system
27
27
  */
28
- type IfNotificationSubscriberSignature<Event, IfSubscriber, Else> = Event extends (sender: Attendee, ...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfSubscriber, Else> : Else;
28
+ type IfNotificationSubscriberSignature<Event, IfSubscriber, Else> = Event extends (sender: Attendee, ...args: infer P) => void ? InternalCoreInterfacesUtilityTypes.IfSameType<P, JsonSerializable<P>, IfSubscriber, Else> : Else;
29
29
  /**
30
30
  * Used to specify the kinds of notifications handled by a {@link NotificationListenable}
31
31
  * by describing the custom parameters in a function signature.
@@ -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,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;GAMG;AAEH,yBAAiB,oBAAoB,CAAC;IACrC;;;;;OAKG;IACH,KAAY,iCAAiC,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,IAC3E,KAAK,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,IAAI,GACrC,wBAAwB,CAAC,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,GACpF,IAAI,CAAC;IAET;;;;;OAKG;IACH,KAAY,iCAAiC,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,IAAI,KAAK,SAAS,CACxF,MAAM,EAAE,QAAQ,EAChB,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,IAAI,GACN,wBAAwB,CAAC,UAAU,CAAC,CAAC,EAAE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AA;;;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"]}
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\tInternalCoreInterfacesUtilityTypes,\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? InternalCoreInterfacesUtilityTypes.IfSameType<\n\t\t\t\t\tP,\n\t\t\t\t\tJsonSerializable<P>,\n\t\t\t\t\tIfParametersValid,\n\t\t\t\t\tElse\n\t\t\t\t>\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? InternalCoreInterfacesUtilityTypes.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,12 +14,12 @@ 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 "./latestMapTypes.js";
18
- export type { Latest, LatestArguments, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./latestTypes.js";
17
+ export type { KeySchemaValidator, LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapConfiguration, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawConfiguration, LatestMapRawEvents, StateMap, } from "./latestMapTypes.js";
18
+ export type { Latest, LatestArguments, LatestArgumentsRaw, LatestConfiguration, LatestEvents, LatestFactory, LatestRaw, LatestRawConfiguration, 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, NotificationSubscriberSignatures, NotificationsManager, NotificationsManagerEvents, } from "./notificationsManagerTypes.js";
21
+ export type { NotificationEmitter, NotificationListenable, NotificationsConfiguration, NotificationSubscriberSignatures, NotificationsManager, NotificationsManagerEvents, NotificationsWithSubscriptionsConfiguration, } from "./notificationsManagerTypes.js";
22
22
  export { StateFactory } from "./stateFactory.js";
23
- export type { InternalTypes } from "./exposedInternalTypes.js";
24
- export type { InternalUtilityTypes } from "./exposedUtilityTypes.js";
23
+ export type { InternalTypes as InternalPresenceTypes } from "./exposedInternalTypes.js";
24
+ export type { InternalUtilityTypes as InternalPresenceUtilityTypes } from "./exposedUtilityTypes.js";
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -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,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;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,EACX,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EAC9B,8BAA8B,EAC9B,YAAY,EACZ,yBAAyB,EACzB,kBAAkB,EAClB,QAAQ,GACR,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACX,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,sBAAsB,EACtB,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,0BAA0B,EAC1B,gCAAgC,EAChC,oBAAoB,EACpB,0BAA0B,EAC1B,2CAA2C,GAC3C,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,YAAY,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACxF,YAAY,EAAE,oBAAoB,IAAI,4BAA4B,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 \"./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
+ {"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;AAyChC,qEAA0D;AAAjD,wHAAA,aAAa,OAAA;AAWtB,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\tLatestMapConfiguration,\n\tLatestMapEvents,\n\tLatestMapFactory,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tLatestMapRaw,\n\tLatestMapRawConfiguration,\n\tLatestMapRawEvents,\n\tStateMap,\n} from \"./latestMapTypes.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestConfiguration,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawConfiguration,\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\tNotificationsConfiguration,\n\tNotificationSubscriberSignatures,\n\tNotificationsManager,\n\tNotificationsManagerEvents,\n\tNotificationsWithSubscriptionsConfiguration,\n} from \"./notificationsManagerTypes.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes as InternalPresenceTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes as InternalPresenceUtilityTypes } from \"./exposedUtilityTypes.js\";\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, InternalUtilityTypes, JsonDeserialized, JsonSerializable, OpaqueJsonDeserialized, OpaqueJsonSerializable } from "@fluidframework/core-interfaces/internal";
5
+ import type { DeepReadonly, InternalCoreInterfacesUtilityTypes, JsonDeserialized, JsonSerializable, OpaqueJsonDeserialized, OpaqueJsonSerializable } from "@fluidframework/core-interfaces/internal";
6
6
  import type { ValidatableOptionalState, ValidatableRequiredState } from "./validatableTypes.js";
7
7
  /**
8
8
  * Returns union of types of values in a record.
@@ -113,7 +113,7 @@ type PickRemainder<T> = Pick<T, keyof T> extends infer Common ? T extends unknow
113
113
  * property. (This can be fixed, but might be best addressed by changing
114
114
  * T to be a tuple of types to be combined.)
115
115
  */
116
- export type FlattenUnionWithOptionals<T> = InternalUtilityTypes.FlattenIntersection<Pick<T, keyof T> & UnionToIntersection<Partial<PickRemainder<T>>>>;
116
+ export type FlattenUnionWithOptionals<T> = InternalCoreInterfacesUtilityTypes.FlattenIntersection<Pick<T, keyof T> & UnionToIntersection<Partial<PickRemainder<T>>>>;
117
117
  /**
118
118
  * Type guard to check if a state is a required state (has a value).
119
119
  *
@@ -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,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,GAA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M,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"]}
1
+ {"version":3,"file":"internalUtils.js","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiCH;;;;;;;GAOG;AACU,QAAA,aAAa,GAAG,MAAM,CAAC,OAA8C,CAAC;AAEnF;;;;;;;GAOG;AACU,QAAA,6BAA6B,GAAG,MAAM,CAAC,OAEN,CAAC;AAE/C;;GAEG;AACU,QAAA,UAAU,GAAG,MAAM,CAAC,IAEU,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,SAAgB,iBAAiB,CAChC,MAAoB,EACpB,GAAM,EACN,YAA2B;IAE3B,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AATD,8CASC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAI,KAAQ;IAC3C,OAAO,KAAwB,CAAC;AACjC,CAAC;AAFD,4CAEC;AASD;;;GAGG;AACH,SAAgB,gCAAgC,CAC/C,KAA4C;IAE5C,OAAO,KAAsD,CAAC;AAC/D,CAAC;AAJD,4EAIC;AAWD;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAI,KAAQ;IAC3C,OAAO,KAAwC,CAAC;AACjD,CAAC;AAFD,4CAEC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC3B,KAA0B;IAE1B,OAAO,KAA8D,CAAC;AACvE,CAAC;AAJD,oCAIC;AA+CD;;;;;GAKG;AACH,SAAgB,oBAAoB,CACnC,KAAgE;IAEhE,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC;AAClC,CAAC;AAJD,oDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tDeepReadonly,\n\tInternalCoreInterfacesUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n\tOpaqueJsonDeserialized,\n\tOpaqueJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type {\n\tValidatableOptionalState,\n\tValidatableRequiredState,\n} from \"./validatableTypes.js\";\n\n/**\n * Returns union of types of values in a record.\n */\nexport type RecordEntryTypes<T> = T[keyof T];\n\ntype MapNumberIndicesToStrings<T> = {\n\t[K in keyof T as K extends number ? `${K}` : K]: T[K];\n};\n\ntype KeyValuePairs<T> = {\n\t[K in keyof MapNumberIndicesToStrings<Required<T>>]: [K, Required<T>[K]];\n}[keyof MapNumberIndicesToStrings<Required<T>>][];\n\ntype RequiredAndNotUndefined<T> = {\n\t[K in keyof T]-?: Exclude<T[K], undefined>;\n};\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @privateRemarks\n * The is a defect in this utility when a string index appears in the object.\n * In such a case, the only result is `[string, T]`, where `T` is the type\n * of the string index entry.\n */\nexport const objectEntries = Object.entries as <const T>(o: T) => KeyValuePairs<T>;\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @remarks\n * Given `T` should not contain `undefined` values. If it does, use\n * {@link objectEntries} instead. Without `undefined` values, this\n * typing provides best handling of objects with optional properties.\n */\nexport const objectEntriesWithoutUndefined = Object.entries as <const T>(\n\to: T,\n) => KeyValuePairs<RequiredAndNotUndefined<T>>;\n\n/**\n * Object.keys retyped to preserve known keys and their types.\n */\nexport const objectKeys = Object.keys as <const T>(\n\to: T,\n) => (keyof MapNumberIndicesToStrings<T>)[];\n\n/**\n * Retrieve a value from a record with the given key, or create a new entry if\n * the key is not in the record.\n *\n * @param record - The record to index/update\n * @param key - The key to lookup in the record\n * @param defaultValue - a function which returns a default value. This is\n * called and used to set an initial value for the given key in the record if\n * none exists.\n * @returns either the existing value for the given key, or the newly-created\n * value (the result of `defaultValue`)\n */\nexport function getOrCreateRecord<const K extends string | number | symbol, const V>(\n\trecord: Record<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tif (!(key in record)) {\n\t\trecord[key] = defaultValue(key);\n\t}\n\treturn record[key];\n}\n\n/**\n * No-runtime-effect helper to apply deep immutability to a value's type.\n */\nexport function asDeeplyReadonly<T>(value: T): DeepReadonly<T> {\n\treturn value as DeepReadonly<T>;\n}\n\n// function overloads\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T>,\n): DeepReadonly<JsonDeserialized<T>>;\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined;\n/**\n * No-runtime-effect helper to apply deep immutability to a value's opaque JSON\n * type, revealing the JSON type.\n */\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined {\n\treturn value as DeepReadonly<JsonDeserialized<T>> | undefined;\n}\n\n/**\n * Conditional type that reveals the underlying JSON type of an opaque JSON value. If `T` is an object, the key values\n * will be revealed.\n */\ntype RevealOpaqueJsonDeserialized<T> =\n\tT extends OpaqueJsonDeserialized<infer U>\n\t\t? JsonDeserialized<U>\n\t\t: { [Key in keyof T]: RevealOpaqueJsonDeserialized<T[Key]> };\n\n/**\n * No-runtime-effect helper to reveal the JSON type from a value's opaque JSON\n * types throughout a structure.\n *\n * @remarks\n * {@link OpaqueJsonDeserialized} instances will be replaced shallowly such\n * that nested instances are retained.\n */\nexport function revealOpaqueJson<T>(value: T): RevealOpaqueJsonDeserialized<T> {\n\treturn value as RevealOpaqueJsonDeserialized<T>;\n}\n\n/**\n * No-runtime-effect helper to automatically cast JSON type to Opaque JSON type\n * at outermost scope.\n *\n * @remarks\n * Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,\n * the return type is both {@link OpaqueJsonSerializable} and\n * {@link OpaqueJsonDeserialized}.\n */\nexport function toOpaqueJson<const T>(\n\tvalue: JsonSerializable<T>,\n): OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T> {\n\treturn value as OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T>;\n}\n\n/**\n * Convert a union of types to an intersection of those types.\n *\n * @privateRemarks\n * First an always true extends clause is used (T extends T) to distribute T\n * into to a union of types contravariant over each member of the T union.\n * Then the constraint on the type parameter in this new context is inferred,\n * giving the intersection.\n *\n * Future: This definition is identical to one in `packages/dds/tree/src/util/typeUtils.ts`\n * and should be consolidated.\n */\ntype UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (\n\tk: infer U,\n) => unknown\n\t? U\n\t: never;\n\n/**\n * Generates a union of types that are the remainder from a simple\n * Pick combination (that is the set of common properties).\n */\ntype PickRemainder<T> =\n\tPick<T, keyof T> extends infer Common\n\t\t? T extends unknown\n\t\t\t? Omit<T, keyof Common>\n\t\t\t: never\n\t\t: never;\n\n/**\n * Combines union of structure into a single structure where common properties\n * are unions of their respective types and optional properties are defined for\n * properties that are not common to each union member.\n *\n * @remarks\n * If a property is common to multiple, but not all union member and the\n * types are incompatible, the resulting type will be `never` for that\n * property. (This can be fixed, but might be best addressed by changing\n * T to be a tuple of types to be combined.)\n */\nexport type FlattenUnionWithOptionals<T> =\n\tInternalCoreInterfacesUtilityTypes.FlattenIntersection<\n\t\tPick<T, keyof T> & UnionToIntersection<Partial<PickRemainder<T>>>\n\t>;\n\n/**\n * Type guard to check if a state is a required state (has a value).\n *\n * @param state - The state to check\n * @returns True if the state has a value and is therefore a {@link ValidatableRequiredState}\n */\nexport function isValueRequiredState<T>(\n\tstate: ValidatableRequiredState<T> | ValidatableOptionalState<T>,\n): state is ValidatableRequiredState<T> {\n\treturn state.value !== undefined;\n}\n"]}
@@ -282,6 +282,40 @@ export interface LatestMapArguments<T, Keys extends string = string> extends Lat
282
282
  */
283
283
  keyValidator?: KeySchemaValidator<Keys>;
284
284
  }
285
+ /**
286
+ * Type alias for the return type of {@link LatestMapFactory} when called with
287
+ * {@link LatestMapArguments}.
288
+ *
289
+ * @remarks
290
+ * Use this type instead of any InternalPresenceTypes that may be revealed from
291
+ * examining factory return type.
292
+ *
293
+ * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
294
+ * allowed registration keys for this State object within a workspace.
295
+ * Specification is recommended to highlight connection between schema and
296
+ * factory when spread across modules.
297
+ *
298
+ * @beta
299
+ * @sealed
300
+ */
301
+ export type LatestMapConfiguration<T, Keys extends string, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
302
+ /**
303
+ * Type alias for the return type of {@link LatestMapFactory} when called with
304
+ * {@link LatestMapArgumentsRaw}.
305
+ *
306
+ * @remarks
307
+ * Use this type instead of any InternalPresenceTypes that may be revealed from
308
+ * examining factory return type.
309
+ *
310
+ * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
311
+ * allowed registration keys for this State object within a workspace.
312
+ * Specification is recommended to highlight connection between schema and
313
+ * factory when spread across modules.
314
+ *
315
+ * @beta
316
+ * @sealed
317
+ */
318
+ export type LatestMapRawConfiguration<T, Keys extends string, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
285
319
  /**
286
320
  * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
287
321
  *
@@ -296,7 +330,7 @@ export interface LatestMapFactory {
296
330
  * This overload is used when called with {@link LatestMapArguments}.
297
331
  * That is, if a validator function is provided.
298
332
  */
299
- <T, Keys extends string = string, RegistrationKey extends string = string>(args: LatestMapArguments<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
333
+ <T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(args: LatestMapArguments<T, Keys>): LatestMapConfiguration<T, Keys, RegistrationKeyRestrictions>;
300
334
  /**
301
335
  * Factory for creating a {@link LatestMapRaw} State object.
302
336
  *
@@ -304,6 +338,6 @@ export interface LatestMapFactory {
304
338
  * This overload is used when called with {@link LatestMapArgumentsRaw}.
305
339
  * That is, if a validator function is _not_ provided.
306
340
  */
307
- <T, Keys extends string = string, RegistrationKey extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
341
+ <T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): LatestMapRawConfiguration<T, Keys, RegistrationKeyRestrictions>;
308
342
  }
309
343
  //#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C,CAAC,EAAE,IAAI,CAAC,GAC/B,sBAAsB,CAAC,CAAC,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAC;IAEhE;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,2BAA2B,SAAS,MAAM,GAAG,MAAM,EACpF,IAAI,CAAC,EAAE,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC,GACnC,yBAAyB,CAAC,CAAC,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAC;CACnE"}
@@ -4,5 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- // #endregion
8
7
  //# sourceMappingURL=latestMapTypes.js.map
@@ -1 +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"]}
1
+ {"version":3,"file":"latestMapTypes.js","sourceRoot":"","sources":["../src/latestMapTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport type {\n\tDeepReadonly,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\nimport type { BroadcastControls, BroadcastControlSettings } from \"./broadcastControlsTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type {\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\nimport type { Attendee, AttendeeId, Presence } from \"./presence.js\";\n\n/**\n * A validator function that can optionally be provided to do runtime validation\n * of the custom key listed in a {@link LatestMap}.\n *\n * @param unvalidatedKey - The unknown key that should be validated.\n *\n * @returns True if the key is valid.\n *\n * @beta\n */\nexport type KeySchemaValidator<Keys extends string> = (\n\tunvalidatedKey: string,\n) => unvalidatedKey is Keys;\n\n/**\n * Collection of latest known values for a specific {@link Attendee}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapClientData<\n\tT,\n\tKeys extends string,\n\tTValueAccessor extends ValueAccessor<T>,\n\tSpecificAttendeeId extends AttendeeId = AttendeeId,\n> {\n\t/**\n\t * Associated {@link Attendee}.\n\t */\n\tattendee: Attendee<SpecificAttendeeId>;\n\n\t/**\n\t * Map of items for the state.\n\t *\n\t * @privateRemarks This could be regular map currently as no Map is\n\t * stored internally and a new instance is created for every request.\n\t */\n\titems: ReadonlyMap<Keys, LatestData<T, TValueAccessor>>;\n}\n\n/**\n * State of a single item value, its key, and its metadata.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapItemUpdatedClientData<\n\tT,\n\tK extends string,\n\tTValueAccessor extends ValueAccessor<T>,\n> extends LatestClientData<T, TValueAccessor> {\n\t/**\n\t * Key of the updated item.\n\t */\n\tkey: K;\n}\n\n/**\n * Identifier and metadata for a removed item.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapItemRemovedClientData<K extends string> {\n\t/**\n\t * Associated {@link Attendee}.\n\t */\n\tattendee: Attendee;\n\n\t/**\n\t * Key of the removed item.\n\t */\n\tkey: K;\n\n\t/**\n\t * Metadata associated with the removal of the item.\n\t */\n\tmetadata: LatestMetadata;\n}\n\n/**\n * Events from {@link LatestMapRaw}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapEvents<\n\tT,\n\tK extends string,\n\tTRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>,\n> {\n\t/**\n\t * Raised when any item's value for remote client is updated.\n\t * @param updates - Map of one or more values updated.\n\t *\n\t * @remarks The event does not include item removals.\n\t *\n\t * @eventProperty\n\t */\n\tremoteUpdated: (updates: LatestMapClientData<T, K, TRemoteValueAccessor>) => void;\n\n\t/**\n\t * Raised when specific item's value of remote client is updated.\n\t * @param updatedItem - Updated item value.\n\t *\n\t * @eventProperty\n\t */\n\tremoteItemUpdated: (\n\t\tupdatedItem: LatestMapItemUpdatedClientData<T, K, TRemoteValueAccessor>,\n\t) => void;\n\n\t/**\n\t * Raised when specific item of remote client is removed.\n\t * @param removedItem - Removed item.\n\t *\n\t * @eventProperty\n\t */\n\tremoteItemRemoved: (removedItem: LatestMapItemRemovedClientData<K>) => void;\n\n\t/**\n\t * Raised when specific local item's value is updated.\n\t * @param updatedItem - Updated item value.\n\t *\n\t * @eventProperty\n\t */\n\tlocalItemUpdated: (updatedItem: {\n\t\tvalue: DeepReadonly<JsonSerializable<T>>;\n\t\tkey: K;\n\t}) => void;\n\n\t/**\n\t * Raised when specific local item is removed.\n\t * @param removedItem - Removed item.\n\t *\n\t * @eventProperty\n\t */\n\tlocalItemRemoved: (removedItem: { key: K }) => void;\n}\n\n/**\n * Events from {@link LatestMapRaw}.\n *\n * @sealed\n * @beta\n */\nexport type LatestMapRawEvents<T, K extends string> = LatestMapEvents<\n\tT,\n\tK,\n\tRawValueAccessor<T>\n>;\n\n/**\n * Map of local client's values. Modifications are transmitted to all other connected clients.\n *\n * @sealed\n * @beta\n */\nexport interface StateMap<K extends string, V> {\n\t/**\n\t * ${@link StateMap.delete}s all elements in the StateMap.\n\t * @remarks This is not yet implemented.\n\t */\n\tclear(): void;\n\n\t/**\n\t * Removes the element with the specified key from the StateMap, if it exists.\n\t *\n\t * @returns true if an element in the StateMap existed and has been removed, or false if\n\t * the element does not exist.\n\t * @remarks No entry is fully removed. Instead an undefined placeholder is locally and\n\t * transmitted to all other clients. For better performance limit the number of deleted\n\t * entries and reuse keys when possible.\n\t * @privateRemarks In the future we may add a mechanism to remove the placeholder, at least\n\t * from transmissions after sufficient time has passed.\n\t */\n\tdelete(key: K): boolean;\n\n\t/**\n\t * Executes a provided function once per each key/value pair in the StateMap, in arbitrary order.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: DeepReadonly<JsonDeserialized<V>>,\n\t\t\tkey: K,\n\t\t\tmap: StateMap<K, V>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void;\n\n\t/**\n\t * Returns the element with the specified key from the StateMap, if it exists.\n\t *\n\t * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.\n\t */\n\tget(key: K): DeepReadonly<JsonDeserialized<V>> | undefined;\n\n\t/**\n\t * Checks if an element with the specified key exists in the StateMap.\n\t * @returns boolean indicating whether an element with the specified key exists or not.\n\t */\n\thas(key: K): boolean;\n\n\t/**\n\t * Adds a new element with a specified key and value to the StateMap. If an element with the same key already exists, the element will be updated.\n\t * The value will be transmitted to all other connected clients.\n\t *\n\t * @remarks Manager assumes ownership of the value and its references.\n\t * Make a deep clone before setting, if needed. No comparison is done to detect changes; all\n\t * sets are transmitted.\n\t */\n\tset(key: K, value: JsonSerializable<V>): this;\n\n\t/**\n\t * The number of elements in the StateMap.\n\t */\n\treadonly size: number;\n\n\t/**\n\t * Returns an iterable of entries in the map.\n\t */\n\t// [Symbol.iterator](): IterableIterator<[K, DeepReadonly<JsonDeserialized<V>>]>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t */\n\t// entries(): IterableIterator<[K, DeepReadonly<JsonDeserialized<V>>]>;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t */\n\tkeys(): IterableIterator<K>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t */\n\t// values(): IterableIterator<DeepReadonly<JsonDeserialized<V>>>;\n}\n\n/**\n * State that provides a `Map` of latest known values from this client to\n * others and read access to their values.\n * Entries in the map may vary over time and by client, but all values are expected to\n * be of the same type, which may be a union type.\n *\n * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMap<\n\tT,\n\tKeys extends string = string,\n\tTRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>,\n> {\n\t/**\n\t * Containing {@link Presence}\n\t */\n\treadonly presence: Presence;\n\n\t/**\n\t * Events for LatestMap.\n\t */\n\treadonly events: Listenable<LatestMapEvents<T, Keys, TRemoteAccessor>>;\n\n\t/**\n\t * Controls for management of sending updates.\n\t */\n\treadonly controls: BroadcastControls;\n\n\t/**\n\t * Current value map for this client.\n\t */\n\treadonly local: StateMap<Keys, T>;\n\n\t/**\n\t * Iterable access to remote clients' map of values.\n\t */\n\tgetRemotes(): IterableIterator<LatestMapClientData<T, Keys, TRemoteAccessor>>;\n\n\t/**\n\t * Array of {@link Attendee}s that have provided states.\n\t */\n\tgetStateAttendees(): Attendee[];\n\n\t/**\n\t * Access to a specific client's map of values.\n\t */\n\tgetRemote(attendee: Attendee): ReadonlyMap<Keys, LatestData<T, TRemoteAccessor>>;\n}\n\n/**\n * State that provides a `Map` of latest known values from this client to\n * others and read access to their values.\n * Entries in the map may vary over time and by client, but all values are expected to\n * be of the same type, which may be a union type.\n *\n * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport type LatestMapRaw<T, Keys extends string = string> = LatestMap<\n\tT,\n\tKeys,\n\tRawValueAccessor<T>\n>;\n\n/**\n * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.\n *\n * @input\n * @beta\n */\nexport interface LatestMapArgumentsRaw<T, Keys extends string = string> {\n\t/**\n\t * The initial value of the local state.\n\t */\n\tlocal?: {\n\t\t[K in Keys]: JsonSerializable<T>;\n\t};\n\n\t/**\n\t * See {@link BroadcastControlSettings}.\n\t */\n\tsettings?: BroadcastControlSettings | undefined;\n}\n\n/**\n * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.\n *\n * @input\n * @beta\n */\nexport interface LatestMapArguments<T, Keys extends string = string>\n\textends LatestMapArgumentsRaw<T, Keys> {\n\t/**\n\t * An optional function that will be called at runtime to validate data value\n\t * under a key. A runtime validator is strongly recommended.\n\t * @see {@link StateSchemaValidator}.\n\t */\n\tvalidator: StateSchemaValidator<T>;\n\n\t/**\n\t * An optional function that will be called at runtime to validate the presence\n\t * data key. A runtime validator is strongly recommended when key type is not\n\t * simply `string`.\n\t * @see {@link KeySchemaValidator}.\n\t */\n\tkeyValidator?: KeySchemaValidator<Keys>;\n}\n\n/**\n * Type alias for the return type of {@link LatestMapFactory} when called with\n * {@link LatestMapArguments}.\n *\n * @remarks\n * Use this type instead of any InternalPresenceTypes that may be revealed from\n * examining factory return type.\n *\n * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain\n * allowed registration keys for this State object within a workspace.\n * Specification is recommended to highlight connection between schema and\n * factory when spread across modules.\n *\n * @beta\n * @sealed\n */\nexport type LatestMapConfiguration<\n\tT,\n\tKeys extends string,\n\tRegistrationKeyRestrictions extends string = string,\n> = InternalTypes.ManagerFactory<\n\tRegistrationKeyRestrictions,\n\tInternalTypes.MapValueState<T, Keys>,\n\tLatestMap<T, Keys>\n>;\n\n/**\n * Type alias for the return type of {@link LatestMapFactory} when called with\n * {@link LatestMapArgumentsRaw}.\n *\n * @remarks\n * Use this type instead of any InternalPresenceTypes that may be revealed from\n * examining factory return type.\n *\n * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain\n * allowed registration keys for this State object within a workspace.\n * Specification is recommended to highlight connection between schema and\n * factory when spread across modules.\n *\n * @beta\n * @sealed\n */\nexport type LatestMapRawConfiguration<\n\tT,\n\tKeys extends string,\n\tRegistrationKeyRestrictions extends string = string,\n> = InternalTypes.ManagerFactory<\n\tRegistrationKeyRestrictions,\n\tInternalTypes.MapValueState<T, Keys>,\n\tLatestMapRaw<T, Keys>\n>;\n\n/**\n * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.\n *\n * @beta\n * @sealed\n */\nexport interface LatestMapFactory {\n\t/**\n\t * Factory for creating a {@link LatestMap} State object.\n\t *\n\t * @remarks\n\t * This overload is used when called with {@link LatestMapArguments}.\n\t * That is, if a validator function is provided.\n\t */\n\t<T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(\n\t\targs: LatestMapArguments<T, Keys>,\n\t): LatestMapConfiguration<T, Keys, RegistrationKeyRestrictions>;\n\n\t/**\n\t * Factory for creating a {@link LatestMapRaw} State object.\n\t *\n\t * @remarks\n\t * This overload is used when called with {@link LatestMapArgumentsRaw}.\n\t * That is, if a validator function is _not_ provided.\n\t */\n\t<T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(\n\t\targs?: LatestMapArgumentsRaw<T, Keys>,\n\t): LatestMapRawConfiguration<T, Keys, RegistrationKeyRestrictions>;\n}\n"]}
@@ -122,6 +122,40 @@ export interface LatestArguments<T extends object | null> extends LatestArgument
122
122
  */
123
123
  validator: StateSchemaValidator<T>;
124
124
  }
125
+ /**
126
+ * Type alias for the return type of {@link LatestFactory} when called with
127
+ * {@link LatestArguments}.
128
+ *
129
+ * @remarks
130
+ * Use this type instead of any InternalPresenceTypes that may be revealed from
131
+ * examining factory return type.
132
+ *
133
+ * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
134
+ * allowed registration keys for this State object within a workspace.
135
+ * Specification is recommended to highlight connection between schema and
136
+ * factory when spread across modules.
137
+ *
138
+ * @beta
139
+ * @sealed
140
+ */
141
+ export type LatestConfiguration<T extends object | null, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.ValueRequiredState<T>, Latest<T>>;
142
+ /**
143
+ * Type alias for the return type of {@link LatestFactory} when called with
144
+ * {@link LatestArgumentsRaw}.
145
+ *
146
+ * @remarks
147
+ * Use this type instead of any InternalPresenceTypes that may be revealed from
148
+ * examining factory return type.
149
+ *
150
+ * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
151
+ * allowed registration keys for this State object within a workspace.
152
+ * Specification is recommended to highlight connection between schema and
153
+ * factory when spread across modules.
154
+ *
155
+ * @beta
156
+ * @sealed
157
+ */
158
+ export type LatestRawConfiguration<T extends object | null, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.ValueRequiredState<T>, LatestRaw<T>>;
125
159
  /**
126
160
  * Factory for creating a {@link Latest} or {@link LatestRaw} State object.
127
161
  *
@@ -136,7 +170,7 @@ export interface LatestFactory {
136
170
  * This overload is used when called with {@link LatestArguments}.
137
171
  * That is, if a validator function is provided.
138
172
  */
139
- <T extends object | null, Key extends string = string>(args: LatestArguments<T>): InternalTypes.ManagerFactory<Key, InternalTypes.ValueRequiredState<T>, Latest<T>>;
173
+ <T extends object | null, RegistrationKeyRestrictions extends string = string>(args: LatestArguments<T>): LatestConfiguration<T, RegistrationKeyRestrictions>;
140
174
  /**
141
175
  * Factory for creating a {@link LatestRaw} State object.
142
176
  *
@@ -144,6 +178,6 @@ export interface LatestFactory {
144
178
  * This overload is used when called with {@link LatestArgumentsRaw}.
145
179
  * That is, if a validator function is _not_ provided.
146
180
  */
147
- <T extends object | null, Key extends string = string>(args: LatestArgumentsRaw<T>): InternalTypes.ManagerFactory<Key, InternalTypes.ValueRequiredState<T>, LatestRaw<T>>;
181
+ <T extends object | null, RegistrationKeyRestrictions extends string = string>(args: LatestArgumentsRaw<T>): LatestRawConfiguration<T, RegistrationKeyRestrictions>;
148
182
  }
149
183
  //# sourceMappingURL=latestTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"latestTypes.d.ts","sourceRoot":"","sources":["../src/latestTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,K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