@fluidframework/presence 2.43.0-343119 → 2.50.0-345060

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 (67) hide show
  1. package/README.md +56 -32
  2. package/dist/alpha.d.ts +14 -5
  3. package/dist/beta.d.ts +14 -5
  4. package/dist/exposedInternalTypes.d.ts +12 -0
  5. package/dist/exposedInternalTypes.d.ts.map +1 -1
  6. package/dist/exposedInternalTypes.js.map +1 -1
  7. package/dist/{experimentalAccess.d.ts → getPresence.d.ts} +1 -1
  8. package/dist/getPresence.d.ts.map +1 -0
  9. package/dist/{experimentalAccess.js → getPresence.js} +1 -1
  10. package/dist/getPresence.js.map +1 -0
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/latestMapValueManager.d.ts +72 -14
  16. package/dist/latestMapValueManager.d.ts.map +1 -1
  17. package/dist/latestMapValueManager.js +15 -9
  18. package/dist/latestMapValueManager.js.map +1 -1
  19. package/dist/latestValueManager.d.ts +68 -13
  20. package/dist/latestValueManager.d.ts.map +1 -1
  21. package/dist/latestValueManager.js +7 -5
  22. package/dist/latestValueManager.js.map +1 -1
  23. package/dist/latestValueTypes.d.ts +60 -5
  24. package/dist/latestValueTypes.d.ts.map +1 -1
  25. package/dist/latestValueTypes.js.map +1 -1
  26. package/dist/presence.d.ts +20 -2
  27. package/dist/presence.d.ts.map +1 -1
  28. package/dist/presence.js.map +1 -1
  29. package/dist/stateFactory.d.ts +15 -10
  30. package/dist/stateFactory.d.ts.map +1 -1
  31. package/dist/stateFactory.js +12 -10
  32. package/dist/stateFactory.js.map +1 -1
  33. package/lib/alpha.d.ts +14 -5
  34. package/lib/beta.d.ts +14 -5
  35. package/lib/exposedInternalTypes.d.ts +12 -0
  36. package/lib/exposedInternalTypes.d.ts.map +1 -1
  37. package/lib/exposedInternalTypes.js.map +1 -1
  38. package/lib/{experimentalAccess.d.ts → getPresence.d.ts} +1 -1
  39. package/lib/getPresence.d.ts.map +1 -0
  40. package/lib/{experimentalAccess.js → getPresence.js} +1 -1
  41. package/{dist/experimentalAccess.js.map → lib/getPresence.js.map} +1 -1
  42. package/lib/index.d.ts +4 -4
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/index.js.map +1 -1
  46. package/lib/latestMapValueManager.d.ts +72 -14
  47. package/lib/latestMapValueManager.d.ts.map +1 -1
  48. package/lib/latestMapValueManager.js +15 -9
  49. package/lib/latestMapValueManager.js.map +1 -1
  50. package/lib/latestValueManager.d.ts +68 -13
  51. package/lib/latestValueManager.d.ts.map +1 -1
  52. package/lib/latestValueManager.js +7 -5
  53. package/lib/latestValueManager.js.map +1 -1
  54. package/lib/latestValueTypes.d.ts +60 -5
  55. package/lib/latestValueTypes.d.ts.map +1 -1
  56. package/lib/latestValueTypes.js.map +1 -1
  57. package/lib/presence.d.ts +20 -2
  58. package/lib/presence.d.ts.map +1 -1
  59. package/lib/presence.js.map +1 -1
  60. package/lib/stateFactory.d.ts +15 -10
  61. package/lib/stateFactory.d.ts.map +1 -1
  62. package/lib/stateFactory.js +11 -9
  63. package/lib/stateFactory.js.map +1 -1
  64. package/package.json +19 -19
  65. package/dist/experimentalAccess.d.ts.map +0 -1
  66. package/lib/experimentalAccess.d.ts.map +0 -1
  67. package/lib/experimentalAccess.js.map +0 -1
package/README.md CHANGED
@@ -42,13 +42,19 @@ API documentation for **@fluidframework/presence** is available at <https://flui
42
42
  <!-- prettier-ignore-end -->
43
43
 
44
44
  <!-- AUTO-GENERATED-CONTENT:END -->
45
- ## Concepts
45
+
46
+ <!-- AUTO-GENERATED-CONTENT:START (INCLUDE:path=../../../docs/docs/build/presence.mdx&start=19) -->
47
+
48
+ <!-- prettier-ignore-start -->
49
+ <!-- NOTE: This section is automatically generated by embedding the referenced file contents. Do not update these generated contents directly. -->
50
+
51
+ A session is a period of time when one or more clients are connected to a Fluid service. Session data and messages may be exchanged among clients, but will disappear once no clients remain. (More specifically once no clients remain that have acquired the session `Presence` interface.) Once fully implemented, no client will require container write permissions to use Presence features.
46
52
 
47
53
  ### Attendees
48
54
 
49
55
  For the lifetime of a session, each client connecting will be established as a unique and stable `Attendee`. The representation is stable because it will remain the same `Attendee` instance independent of connection drops and reconnections.
50
56
 
51
- Client Ids maintained by `Attendee` may be used to associate `Attendee` with quorum, audience, and service audience members.
57
+ Client IDs maintained by `Attendee` may be used to associate `Attendee` with quorum, audience, and service audience members.
52
58
 
53
59
  ### Workspaces
54
60
 
@@ -58,29 +64,28 @@ There are two types of workspaces: States and Notifications.
58
64
 
59
65
  #### States Workspace
60
66
 
61
- A `StatesWorkspace`, allows sharing of simple data across attendees where each attendee maintains their own data values that others may read, but not change. This is distinct from a Fluid DDS where data values might be manipulated by multiple clients and one ultimate value is derived. Shared, independent values are maintained by State objects that specialize in incrementality and history of values.
67
+ A `StatesWorkspace` allows sharing of simple data across attendees where each attendee maintains their own data values that others may read, but not change. This is distinct from a Fluid DDS where data values might be manipulated by multiple clients and one ultimate value is derived. Shared, independent values are maintained by State objects that specialize in incrementality and history of values.
62
68
 
63
69
  #### Notifications Workspace
64
70
 
65
- A `NotificationsWorkspace`, is similar to states workspace, but is dedicated to notification use-cases via `NotificationsManager`.
66
-
71
+ A `NotificationsWorkspace` is similar to states workspace, but is dedicated to notification use-cases via `NotificationsManager`.
67
72
 
68
73
  ### States
69
74
 
70
75
  #### Latest
71
76
 
72
- `Latest` retains the most recent atomic value each attendee has shared. Use `Latest` to add one to `StatesWorkspace`.
77
+ `Latest` retains the most recent atomic value each attendee has shared. Use `StateFactory.latest` to add one to `StatesWorkspace`.
73
78
 
74
79
  #### LatestMap
75
80
 
76
- `LatestMap` retains the most recent atomic value each attendee has shared under arbitrary keys. Values associated with a key may be nullified (appears as deleted). Use `StateFactory.latestMap` to add one to `StatesWorkspace`.
81
+ `LatestMap` retains the most recent atomic value each attendee has shared under arbitrary keys. Values associated with a
82
+ key may be set to `undefined` to represent deletion. Use `StateFactory.latestMap` to add one to a `StatesWorkspace`.
77
83
 
78
84
  #### NotificationsManager
79
85
 
80
- Notifications are special case where no data is retained during a session and all interactions appear as events that are sent and received. Notifications may be mixed into a `StatesWorkspace` for convenience. `NotificationsManager` is the only presence object permitted in a `NotificationsWorkspace`. Use `Notifications` to add one to `NotificationsWorkspace` or `StatesWorkspace`.
86
+ Notifications are a special case where no data is retained during a session and all interactions appear as events that are sent and received. Notifications may be mixed into a `StatesWorkspace` for convenience. `NotificationsManager` is the only presence object permitted in a `NotificationsWorkspace`. Use `Notifications` to add one to a `NotificationsWorkspace` or `StatesWorkspace`.
81
87
 
82
-
83
- ## Onboarding
88
+ ## Using Presence
84
89
 
85
90
  To access Presence APIs, use `getPresence()` with any `IFluidContainer`.
86
91
 
@@ -88,51 +93,65 @@ To access Presence APIs, use `getPresence()` with any `IFluidContainer`.
88
93
  import { getPresence } from "@fluidframework/presence/beta";
89
94
 
90
95
  function usePresence(container: IFluidContainer): void {
91
- const presence = await getPresence(container);
96
+ const presence = getPresence(container);
97
+ }
92
98
  ```
93
99
 
94
- ## Limitations
100
+ ## Other Capabilities
95
101
 
96
- ### States Reliability
102
+ ### Runtime data validation
97
103
 
98
- The current implementation relies on Fluid Framework's Signal infrastructure instead of Ops. This has advantages, but comes with some risk of unreliable messaging. The most common known case of unreliable signals occurs during reconnection periods and current implementation attempts to account for that. Be aware that all clients are not guaranteed to arrive at eventual consistency. Please [file a new issue](https://github.com/microsoft/FluidFramework/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=Presence:%20States:%20) if one is not found under [Presence States issues](https://github.com/microsoft/FluidFramework/issues?q=is%3Aissue+%22Presence%3A+States%3A%22).
104
+ Runtime data validation is not yet implemented. The StateFactory.latest and StateFactory.latestMap APIs do not yet
105
+ accept a `validator` argument. The validator argument is reserved for future use. **Passing the `validator` argument in version 2.43.0 will result in a runtime exception.**
106
+
107
+ ## Limitations
99
108
 
100
109
  ### Compatibility and Versioning
101
110
 
102
- Current API does not provide a mechanism to validate that state and notification data received within session from other clients matches the types declared. The schema of workspace address, states and notifications names, and their types will only be consistent when all clients connected to the session are using the same types for a unique value/notification path (workspace address + name within workspace). In other words, don't mix versions or make sure to change identifiers when changing types in a non-compatible way.
111
+ The schema of workspace address, states and notifications names, and their types will only be consistent when all
112
+ clients connected to the session are using the same types for a unique value/notification path (workspace address + name
113
+ within workspace). In other words, don't mix versions or make sure to change identifiers when changing types in a
114
+ non-compatible way.
103
115
 
104
- Example:
116
+ For example:
105
117
 
106
118
  ```typescript
107
- presence.states.getWorkspace("app:v1states", { myState: StateFactory.latest({x: 0})});
119
+ presence.states.getWorkspace("app:v1states", { myState: StateFactory.latest({ local: { x: 0 }}) });
108
120
  ```
109
- is incompatible with
121
+
122
+ is incompatible with
123
+
110
124
  ```typescript
111
- presence.states.getWorkspace("app:v1states", { myState: StateFactory.latest({x: "text"})});
125
+ presence.states.getWorkspace("app:v1states", { myState: StateFactory.latest({ local: { x: "text" }}) });
112
126
  ```
113
- as "app:v1states"+"myState" have different value type expectations: `{x: number}` versus `{x: string}`.
127
+
128
+ because "app:v1states"+"myState" have different value type expectations: `{x: number}` versus `{x: string}`.
114
129
 
115
130
  ```typescript
116
- presence.states.getWorkspace("app:v1states", { myState2: StateFactory.latest({x: true})});
131
+ presence.states.getWorkspace("app:v1states", { myState2: StateFactory.latest({ local: { x: true }}) });
117
132
  ```
118
- would be compatible with both of the prior schemas as "myState2" is a different name. Though in this situation none of the different clients would be able to observe each other.
119
133
 
134
+ would be compatible with both of the prior schemas because "myState2" is a different name. Though in this situation none of the different clients would be able to observe each other.
135
+
136
+ ### States Reliability
137
+
138
+ The current implementation relies on Fluid Framework's signal infrastructure instead of ops. This has advantages, but comes with some risk of unreliable messaging. The most common known case of unreliable signals occurs during reconnection periods and the current implementation attempts to account for that. Be aware that all clients are not guaranteed to arrive at eventual consistency. Please [file a new issue](https://github.com/microsoft/FluidFramework/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=Presence:%20States:%20) if one is not found under [Presence States issues](https://github.com/microsoft/FluidFramework/issues?q=is%3Aissue+%22Presence%3A+States%3A%22).
120
139
 
121
140
  ### Notifications
122
141
 
123
- Notifications API is partially implemented. All messages are always broadcast even if `unicast` API is used. Type inferences are not working even with a fully specified `initialSubscriptions` value provided to `Notifications` and schema type must be specified explicitly.
142
+ Notifications API is partially implemented at alpha support level. All messages are always broadcast even if `unicast` API is used. Type inferences are not working even with a fully specified `initialSubscriptions` value provided to `Notifications`, and the schema type must be specified explicitly.
124
143
 
125
- Notifications are fundamentally unreliable at this time as there are no built-in acknowledgements nor retained state. To prevent most common loss of notifications, always check for connection before sending.
144
+ Notifications are fundamentally unreliable at this time as there are no built-in acknowledgements nor retained state. To prevent the most common loss of notifications, always check for connection before sending.
126
145
 
127
- ### Throttling/grouping
146
+ ### Throttling / Grouping
128
147
 
129
148
  Presence updates are grouped together and throttled to prevent flooding the network with messages when presence values are rapidly updated. This means the presence infrastructure will not immediately broadcast updates but will broadcast them after a configurable delay.
130
149
 
131
- The `allowableUpdateLatencyMs` property configures how long a local update may be delayed under normal circumstances, enabling grouping with other updates. The default `allowableUpdateLatencyMs` is **60 milliseconds** but may be (1) specified during configuration of a [States Workspace](#states-workspace) or [States](#states) and/or (2) updated later using the `controls` member of Workspace or States. [States Workspace](#states-workspace) configuration applies when States do not have their own setting.
150
+ The `allowableUpdateLatencyMs` property configures how long a local update may be delayed under normal circumstances, enabling grouping with other updates. The default `allowableUpdateLatencyMs` is **60 milliseconds** but may be (1) specified during configuration of a [States Workspace](#states-workspace) or [States](#states) and/or (2) updated later using the `controls` member of Workspace or States. The [States Workspace](#states-workspace) configuration is used when States do not have their own setting.
132
151
 
133
152
  Notifications are never queued; they effectively always have an `allowableUpdateLatencyMs` of 0. However, they may be grouped with other updates that were already queued.
134
153
 
135
- Note that due to throttling, clients receiving updates may not see updates for all values set by another. For example,
154
+ Note that due to throttling, clients will not receive updates for every intermediate value set by another client. For example,
136
155
  with `Latest` and `LatestMap`, the only value sent is the value at the time the outgoing grouped message is sent. Previous
137
156
  values set by the client will not be broadcast or seen by other clients.
138
157
 
@@ -142,16 +161,17 @@ You can configure the grouping and throttling behavior using the `allowableUpdat
142
161
 
143
162
  ```ts
144
163
  // Configure a states workspace
145
- const stateWorkspace = presence.states.getWorkspace("app:v1states",
164
+ const stateWorkspace = presence.states.getWorkspace(
165
+ "app:v1states",
146
166
  {
147
167
  // This Latest state has an allowable latency of 100ms.
148
- position: StateFactory.latest({ x: 0, y: 0 }, { allowableUpdateLatencyMs: 100 }),
168
+ position: StateFactory.latest({ local: { x: 0, y: 0 }, settings: { allowableUpdateLatencyMs: 100 }}),
149
169
  // This Latest state uses the workspace default.
150
- count: StateFactory.latest({ num: 0 }),
170
+ count: StateFactory.latest({ local: { num: 0 }}),
151
171
  },
152
172
  // Specify the default for all state in this workspace to 200ms,
153
- // overriding the default value of 60ms.
154
- { allowableUpdateLatencyMs: 200 }
173
+ // overriding the default value of 60ms.
174
+ { allowableUpdateLatencyMs: 200 },
155
175
  );
156
176
 
157
177
  // Temporarily set count updates to send as soon as possible
@@ -163,6 +183,10 @@ countState.local = { num: 5000 };
163
183
  countState.controls.allowableUpdateLatencyMs = undefined;
164
184
  ```
165
185
 
186
+ <!-- prettier-ignore-end -->
187
+
188
+ <!-- AUTO-GENERATED-CONTENT:END -->
189
+
166
190
  <!-- AUTO-GENERATED-CONTENT:START (README_FOOTER) -->
167
191
 
168
192
  <!-- prettier-ignore-start -->
package/dist/alpha.d.ts CHANGED
@@ -18,6 +18,7 @@
18
18
 
19
19
  export {
20
20
  // @beta APIs
21
+ Accessor,
21
22
  Attendee,
22
23
  AttendeeId,
23
24
  AttendeeStatus,
@@ -26,11 +27,17 @@ export {
26
27
  BroadcastControls,
27
28
  ClientConnectionId,
28
29
  InternalTypes,
29
- LatestArguments,
30
+ Latest,
31
+ LatestArgumentsRaw,
30
32
  LatestClientData,
31
33
  LatestData,
32
- LatestMapArguments,
34
+ LatestEvents,
35
+ LatestFactory,
36
+ LatestMap,
37
+ LatestMapArgumentsRaw,
33
38
  LatestMapClientData,
39
+ LatestMapEvents,
40
+ LatestMapFactory,
34
41
  LatestMapItemRemovedClientData,
35
42
  LatestMapItemUpdatedClientData,
36
43
  LatestMapRaw,
@@ -40,16 +47,18 @@ export {
40
47
  LatestRawEvents,
41
48
  Presence,
42
49
  PresenceEvents,
50
+ ProxiedValueAccessor,
51
+ RawValueAccessor,
43
52
  StateFactory,
44
53
  StateMap,
54
+ StateSchemaValidator,
45
55
  StatesWorkspace,
46
56
  StatesWorkspaceEntries,
47
57
  StatesWorkspaceEntry,
48
58
  StatesWorkspaceSchema,
59
+ ValueAccessor,
49
60
  WorkspaceAddress,
50
- getPresence,
51
- latest,
52
- latestMap,
61
+ getPresence,
53
62
 
54
63
  // @alpha APIs
55
64
  ExperimentalPresenceDO,
package/dist/beta.d.ts CHANGED
@@ -18,6 +18,7 @@
18
18
 
19
19
  export {
20
20
  // @beta APIs
21
+ Accessor,
21
22
  Attendee,
22
23
  AttendeeId,
23
24
  AttendeeStatus,
@@ -26,11 +27,17 @@ export {
26
27
  BroadcastControls,
27
28
  ClientConnectionId,
28
29
  InternalTypes,
29
- LatestArguments,
30
+ Latest,
31
+ LatestArgumentsRaw,
30
32
  LatestClientData,
31
33
  LatestData,
32
- LatestMapArguments,
34
+ LatestEvents,
35
+ LatestFactory,
36
+ LatestMap,
37
+ LatestMapArgumentsRaw,
33
38
  LatestMapClientData,
39
+ LatestMapEvents,
40
+ LatestMapFactory,
34
41
  LatestMapItemRemovedClientData,
35
42
  LatestMapItemUpdatedClientData,
36
43
  LatestMapRaw,
@@ -40,14 +47,16 @@ export {
40
47
  LatestRawEvents,
41
48
  Presence,
42
49
  PresenceEvents,
50
+ ProxiedValueAccessor,
51
+ RawValueAccessor,
43
52
  StateFactory,
44
53
  StateMap,
54
+ StateSchemaValidator,
45
55
  StatesWorkspace,
46
56
  StatesWorkspaceEntries,
47
57
  StatesWorkspaceEntry,
48
58
  StatesWorkspaceSchema,
59
+ ValueAccessor,
49
60
  WorkspaceAddress,
50
- getPresence,
51
- latest,
52
- latestMap
61
+ getPresence
53
62
  } from "./index.js";
@@ -12,6 +12,8 @@ import type { OpaqueJsonDeserialized } from "@fluidframework/core-interfaces/int
12
12
  */
13
13
  export declare namespace InternalTypes {
14
14
  /**
15
+ * Metadata for a value state.
16
+ *
15
17
  * @system
16
18
  */
17
19
  interface ValueStateMetadata {
@@ -49,6 +51,8 @@ export declare namespace InternalTypes {
49
51
  value: OpaqueJsonDeserialized<TValue>;
50
52
  }
51
53
  /**
54
+ * A directory of values, where each value may be an optional state or another directory.
55
+ *
52
56
  * @system
53
57
  */
54
58
  interface ValueDirectory<T> {
@@ -58,10 +62,14 @@ export declare namespace InternalTypes {
58
62
  };
59
63
  }
60
64
  /**
65
+ * Convenience type for a required state or a directory of values.
66
+ *
61
67
  * @system
62
68
  */
63
69
  type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;
64
70
  /**
71
+ * Collection of optional values in a "map" structure.
72
+ *
65
73
  * @system
66
74
  */
67
75
  interface MapValueState<T, Keys extends string | number> {
@@ -71,6 +79,8 @@ export declare namespace InternalTypes {
71
79
  };
72
80
  }
73
81
  /**
82
+ * Opaque type representing internal state datastore.
83
+ *
74
84
  * @system
75
85
  */
76
86
  class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {
@@ -111,6 +121,8 @@ export declare namespace InternalTypes {
111
121
  manager: StateValue<TManager>;
112
122
  });
113
123
  /**
124
+ * Structure of a generic notification "value".
125
+ *
114
126
  * @system
115
127
  */
116
128
  interface NotificationType {
@@ -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;;;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AAE,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,CA6H7B;AA7HD,WAAiB,aAAa;AA6H9B,CAAC,EA7HgB,aAAa,6BAAb,aAAa,QA6H7B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { OpaqueJsonDeserialized } from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of value types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @beta\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalTypes {\n\t/**\n\t * @system\n\t */\n\texport interface ValueStateMetadata {\n\t\trev: number;\n\t\ttimestamp: number;\n\t}\n\n\t/**\n\t * Represents a state that may have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * See {@link InternalTypes.ValueRequiredState}.\n\t *\n\t * @system\n\t */\n\texport interface ValueOptionalState<TValue> extends ValueStateMetadata {\n\t\tvalue?: OpaqueJsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * Represents a state that must have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected\n\t * to involve generic or unknown types that will be filtered. It is here\n\t * mostly as a convenience to the many such uses that would otherwise\n\t * need to specify some wrapper themselves.\n\t *\n\t * For known cases, construct a custom interface that extends\n\t * {@link InternalTypes.ValueStateMetadata}.\n\t *\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: OpaqueJsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport interface ValueDirectory<T> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name: string | number]: ValueOptionalState<T> | ValueDirectory<T>;\n\t\t};\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;\n\n\t/**\n\t * @system\n\t */\n\texport interface MapValueState<T, Keys extends string | number> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name in Keys]: ValueOptionalState<T>;\n\t\t};\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {\n\t\tprivate readonly StateDatastoreHandle: StateDatastoreHandle<TKey, TValue>;\n\t}\n\n\t/**\n\t * Brand to ensure state values internal type safety without revealing\n\t * internals that are subject to change.\n\t *\n\t * @system\n\t */\n\texport declare class StateValueBrand<T> {\n\t\tprivate readonly StateValue: StateValue<T>;\n\t}\n\n\t/**\n\t * This type provides no additional functionality over the type it wraps.\n\t * It is used to ensure type safety within package.\n\t * Users may find it convenient to just use the type it wraps directly.\n\t *\n\t * @privateRemarks\n\t * Checkout filtering omitting unknown from T (`Omit<T,unknown> &`).\n\t *\n\t * @system\n\t */\n\texport type StateValue<T> = T & StateValueBrand<T>;\n\n\t/**\n\t * Package internal function declaration for state and notification instantiation.\n\t *\n\t * @system\n\t */\n\texport type ManagerFactory<\n\t\tTKey extends string,\n\t\tTValue extends ValueDirectoryOrState<any>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => any } & ((\n\t\tkey: TKey,\n\t\tdatastoreHandle: StateDatastoreHandle<TKey, TValue>,\n\t) => {\n\t\tinitialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined };\n\t\tmanager: StateValue<TManager>;\n\t});\n\n\t/**\n\t * @system\n\t */\n\texport interface NotificationType {\n\t\tname: string;\n\t\targs: unknown[];\n\t}\n}\n"]}
1
+ {"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,2DAA2D;AAC3D,IAAiB,aAAa,CAyI7B;AAzID,WAAiB,aAAa;AAyI9B,CAAC,EAzIgB,aAAa,6BAAb,aAAa,QAyI7B","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\t}\n\n\t/**\n\t * Represents a state that must have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected\n\t * to involve generic or unknown types that will be filtered. It is here\n\t * mostly as a convenience to the many such uses that would otherwise\n\t * need to specify some wrapper themselves.\n\t *\n\t * For known cases, construct a custom interface that extends\n\t * {@link InternalTypes.ValueStateMetadata}.\n\t *\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: OpaqueJsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * 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 | number> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name in Keys]: ValueOptionalState<T>;\n\t\t};\n\t}\n\n\t/**\n\t * Opaque type representing internal state datastore.\n\t *\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {\n\t\tprivate readonly StateDatastoreHandle: StateDatastoreHandle<TKey, TValue>;\n\t}\n\n\t/**\n\t * Brand to ensure state values internal type safety without revealing\n\t * internals that are subject to change.\n\t *\n\t * @system\n\t */\n\texport declare class StateValueBrand<T> {\n\t\tprivate readonly StateValue: StateValue<T>;\n\t}\n\n\t/**\n\t * This type provides no additional functionality over the type it wraps.\n\t * It is used to ensure type safety within package.\n\t * Users may find it convenient to just use the type it wraps directly.\n\t *\n\t * @privateRemarks\n\t * Checkout filtering omitting unknown from T (`Omit<T,unknown> &`).\n\t *\n\t * @system\n\t */\n\texport type StateValue<T> = T & StateValueBrand<T>;\n\n\t/**\n\t * Package internal function declaration for state and notification instantiation.\n\t *\n\t * @system\n\t */\n\texport type ManagerFactory<\n\t\tTKey extends string,\n\t\tTValue extends ValueDirectoryOrState<any>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => any } & ((\n\t\tkey: TKey,\n\t\tdatastoreHandle: StateDatastoreHandle<TKey, TValue>,\n\t) => {\n\t\tinitialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined };\n\t\tmanager: StateValue<TManager>;\n\t});\n\n\t/**\n\t * 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"]}
@@ -20,4 +20,4 @@ export declare const getPresence: (fluidContainer: IFluidContainer) => Presence;
20
20
  * @alpha
21
21
  */
22
22
  export declare function getPresenceAlpha(fluidContainer: IFluidContainer): PresenceWithNotifications;
23
- //# sourceMappingURL=experimentalAccess.d.ts.map
23
+ //# sourceMappingURL=getPresence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPresence.d.ts","sourceRoot":"","sources":["../src/getPresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AA6CzE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,cAAc,EAAE,eAAe,KAAK,QAA2B,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,eAAe,GAAG,yBAAyB,CAW3F"}
@@ -50,4 +50,4 @@ function getPresenceAlpha(fluidContainer) {
50
50
  return presence;
51
51
  }
52
52
  exports.getPresenceAlpha = getPresenceAlpha;
53
- //# sourceMappingURL=experimentalAccess.js.map
53
+ //# sourceMappingURL=getPresence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPresence.js","sourceRoot":"","sources":["../src/getPresence.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,kEAA6D;AAE7D,oEAAiF;AAKjF,6DAA6D;AAG7D;;GAEG;AACH,MAAM,wBAAwB;IAa7B,YAAmB,IAAmB;QAJtB,cAAS,GAAG,IAAI,CAAC;QAKhC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,GAAG,IAAA,0CAAqB,EAAC;YACrD,GAAG,IAAI;YACP,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE;gBACzB,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;IAEM,QAAQ;QACd,QAAQ;IACT,CAAC;IAIM,aAAa,CACnB,YAAsB,EACtB,OAAgD,EAChD,KAAc;QAEd,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;;AARsB,oCAAW,GAAG,0CAA0C,AAA7C,CAA8C;AAWjF;;;;;;GAMG;AACU,QAAA,WAAW,GAAkD,gBAAgB,CAAC;AAE3F;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,cAA+B;IAC/D,IAAA,iBAAM,EACL,IAAA,mCAAwB,EAAC,cAAc,CAAC,EACxC,KAAK,CAAC,yGAAyG,CAC/G,CAAC;IAEF,MAAM,QAAQ,GAAG,cAAc,CAAC,gBAAgB,CAC/C,wBAAwB,CAAC,WAAW,EACpC,wBAAwB,CACxB,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC;AAXD,4CAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tContainerExtension,\n\tContainerExtensionFactory,\n\tInboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { isInternalFluidContainer } from \"@fluidframework/fluid-static/internal\";\n\nimport type { ExtensionHost, ExtensionRuntimeProperties } from \"./internalTypes.js\";\nimport type { Presence, PresenceWithNotifications } from \"./presence.js\";\nimport type { PresenceExtensionInterface } from \"./presenceManager.js\";\nimport { createPresenceManager } from \"./presenceManager.js\";\nimport type { SignalMessages } from \"./protocol.js\";\n\n/**\n * Common Presence manager for a container\n */\nclass ContainerPresenceManager\n\timplements\n\t\tContainerExtension<ExtensionRuntimeProperties>,\n\t\tInstanceType<\n\t\t\tContainerExtensionFactory<PresenceWithNotifications, ExtensionRuntimeProperties>\n\t\t>\n{\n\t// ContainerExtensionFactory return elements\n\tpublic readonly interface: PresenceWithNotifications;\n\tpublic readonly extension = this;\n\n\tprivate readonly manager: PresenceExtensionInterface;\n\n\tpublic constructor(host: ExtensionHost) {\n\t\tthis.interface = this.manager = createPresenceManager({\n\t\t\t...host,\n\t\t\tsubmitSignal: (message) => {\n\t\t\t\thost.submitAddressedSignal([], message);\n\t\t\t},\n\t\t});\n\t}\n\n\tpublic onNewUse(): void {\n\t\t// No-op\n\t}\n\n\tpublic static readonly extensionId = \"dis:bb89f4c0-80fd-4f0c-8469-4f2848ee7f4a\";\n\n\tpublic processSignal(\n\t\taddressChain: string[],\n\t\tmessage: InboundExtensionMessage<SignalMessages>,\n\t\tlocal: boolean,\n\t): void {\n\t\tthis.manager.processSignal(addressChain, message, local);\n\t}\n}\n\n/**\n * Acquire a {@link Presence} from a Fluid Container\n * @param fluidContainer - Fluid Container to acquire the map from\n * @returns the {@link Presence}\n *\n * @beta\n */\nexport const getPresence: (fluidContainer: IFluidContainer) => Presence = getPresenceAlpha;\n\n/**\n * Acquire a {@link PresenceWithNotifications} from a Fluid Container\n * @param fluidContainer - Fluid Container to acquire the map from\n * @returns the {@link PresenceWithNotifications}\n *\n * @alpha\n */\nexport function getPresenceAlpha(fluidContainer: IFluidContainer): PresenceWithNotifications {\n\tassert(\n\t\tisInternalFluidContainer(fluidContainer),\n\t\t0xa2f /* IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported. */,\n\t);\n\n\tconst presence = fluidContainer.acquireExtension(\n\t\tContainerPresenceManager.extensionId,\n\t\tContainerPresenceManager,\n\t);\n\treturn presence;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -13,11 +13,11 @@ export type { ClientConnectionId } from "./baseTypes.js";
13
13
  export type { NotificationsWorkspace, NotificationsWorkspaceSchema, StatesWorkspace, StatesWorkspaceEntries, StatesWorkspaceSchema, StatesWorkspaceEntry, WorkspaceAddress, } from "./types.js";
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 "./broadcastControls.js";
16
- export { getPresence, getPresenceAlpha } from "./experimentalAccess.js";
16
+ export { getPresence, getPresenceAlpha } from "./getPresence.js";
17
17
  export { getPresenceViaDataObject, type ExperimentalPresenceDO, ExperimentalPresenceManager, } from "./datastorePresenceManagerFactory.js";
18
- export type { latestMap, LatestMapArguments, LatestMapRaw, LatestMapClientData, LatestMapRawEvents, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, StateMap, } from "./latestMapValueManager.js";
19
- export type { latest, LatestArguments, LatestRaw, LatestRawEvents, } from "./latestValueManager.js";
20
- export type { LatestClientData, LatestData, LatestMetadata, } from "./latestValueTypes.js";
18
+ export type { LatestMap, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./latestMapValueManager.js";
19
+ export type { Latest, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./latestValueManager.js";
20
+ export type { Accessor, LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor, } from "./latestValueTypes.js";
21
21
  export { type NotificationEmitter, type NotificationListenable, type NotificationSubscriptions, Notifications, type NotificationsManager, type NotificationsManagerEvents, } from "./notificationsManager.js";
22
22
  export { StateFactory } from "./stateFactory.js";
23
23
  export type { InternalTypes } from "./exposedInternalTypes.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,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EACN,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,2BAA2B,GAC3B,MAAM,sCAAsC,CAAC;AAE9C,YAAY,EACX,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,8BAA8B,EAC9B,8BAA8B,EAC9B,QAAQ,GACR,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACX,MAAM,EACN,eAAe,EACf,SAAS,EACT,eAAe,GACf,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,gBAAgB,EAChB,UAAU,EACV,cAAc,GACd,MAAM,uB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,SAAS,EACT,eAAe,GACf,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,GAC/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.StateFactory = exports.Notifications = exports.ExperimentalPresenceManager = exports.getPresenceViaDataObject = exports.getPresenceAlpha = exports.getPresence = exports.AttendeeStatus = void 0;
8
8
  var presence_js_1 = require("./presence.js");
9
9
  Object.defineProperty(exports, "AttendeeStatus", { enumerable: true, get: function () { return presence_js_1.AttendeeStatus; } });
10
- var experimentalAccess_js_1 = require("./experimentalAccess.js");
11
- Object.defineProperty(exports, "getPresence", { enumerable: true, get: function () { return experimentalAccess_js_1.getPresence; } });
12
- Object.defineProperty(exports, "getPresenceAlpha", { enumerable: true, get: function () { return experimentalAccess_js_1.getPresenceAlpha; } });
10
+ var getPresence_js_1 = require("./getPresence.js");
11
+ Object.defineProperty(exports, "getPresence", { enumerable: true, get: function () { return getPresence_js_1.getPresence; } });
12
+ Object.defineProperty(exports, "getPresenceAlpha", { enumerable: true, get: function () { return getPresence_js_1.getPresenceAlpha; } });
13
13
  var datastorePresenceManagerFactory_js_1 = require("./datastorePresenceManagerFactory.js");
14
14
  Object.defineProperty(exports, "getPresenceViaDataObject", { enumerable: true, get: function () { return datastorePresenceManagerFactory_js_1.getPresenceViaDataObject; } });
15
15
  Object.defineProperty(exports, "ExperimentalPresenceManager", { enumerable: true, get: function () { return datastorePresenceManagerFactory_js_1.ExperimentalPresenceManager; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,iEAAwE;AAA/D,oHAAA,WAAW,OAAA;AAAE,yHAAA,gBAAgB,OAAA;AAEtC,2FAI8C;AAH7C,8IAAA,wBAAwB,OAAA;AAExB,iJAAA,2BAA2B,OAAA;AAyB5B,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Package for client presence within a connected session.\n *\n * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.\n *\n * @packageDocumentation\n */\n\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n\ttype PresenceWithNotifications,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport { getPresence, getPresenceAlpha } from \"./experimentalAccess.js\";\n\nexport {\n\tgetPresenceViaDataObject,\n\ttype ExperimentalPresenceDO,\n\tExperimentalPresenceManager,\n} from \"./datastorePresenceManagerFactory.js\";\n\nexport type {\n\tlatestMap,\n\tLatestMapArguments,\n\tLatestMapRaw,\n\tLatestMapClientData,\n\tLatestMapRawEvents,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tlatest,\n\tLatestArguments,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,mDAAiE;AAAxD,6GAAA,WAAW,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAEtC,2FAI8C;AAH7C,8IAAA,wBAAwB,OAAA;AAExB,iJAAA,2BAA2B,OAAA;AAoC5B,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Package for client presence within a connected session.\n *\n * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.\n *\n * @packageDocumentation\n */\n\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n\ttype PresenceWithNotifications,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport { getPresence, getPresenceAlpha } from \"./getPresence.js\";\n\nexport {\n\tgetPresenceViaDataObject,\n\ttype ExperimentalPresenceDO,\n\tExperimentalPresenceManager,\n} from \"./datastorePresenceManagerFactory.js\";\n\nexport type {\n\tLatestMap,\n\t// LatestMapArguments,\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\t// LatestArguments,\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 {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
@@ -6,7 +6,7 @@ import type { Listenable } from "@fluidframework/core-interfaces";
6
6
  import type { DeepReadonly, JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
7
7
  import type { BroadcastControls, BroadcastControlSettings } from "./broadcastControls.js";
8
8
  import type { InternalTypes } from "./exposedInternalTypes.js";
9
- import type { LatestClientData, LatestData, LatestMetadata } from "./latestValueTypes.js";
9
+ import type { LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor } from "./latestValueTypes.js";
10
10
  import type { AttendeeId, Attendee, Presence } from "./presence.js";
11
11
  /**
12
12
  * Collection of latest known values for a specific {@link Attendee}.
@@ -14,7 +14,7 @@ import type { AttendeeId, Attendee, Presence } from "./presence.js";
14
14
  * @sealed
15
15
  * @beta
16
16
  */
17
- export interface LatestMapClientData<T, Keys extends string | number, SpecificAttendeeId extends AttendeeId = AttendeeId> {
17
+ export interface LatestMapClientData<T, Keys extends string | number, TValueAccessor extends ValueAccessor<T>, SpecificAttendeeId extends AttendeeId = AttendeeId> {
18
18
  /**
19
19
  * Associated {@link Attendee}.
20
20
  */
@@ -25,7 +25,7 @@ export interface LatestMapClientData<T, Keys extends string | number, SpecificAt
25
25
  * @privateRemarks This could be regular map currently as no Map is
26
26
  * stored internally and a new instance is created for every request.
27
27
  */
28
- items: ReadonlyMap<Keys, LatestData<T>>;
28
+ items: ReadonlyMap<Keys, LatestData<T, TValueAccessor>>;
29
29
  }
30
30
  /**
31
31
  * State of a single item value, its key, and its metadata.
@@ -33,7 +33,7 @@ export interface LatestMapClientData<T, Keys extends string | number, SpecificAt
33
33
  * @sealed
34
34
  * @beta
35
35
  */
36
- export interface LatestMapItemUpdatedClientData<T, K extends string | number> extends LatestClientData<T> {
36
+ export interface LatestMapItemUpdatedClientData<T, K extends string | number, TValueAccessor extends ValueAccessor<T>> extends LatestClientData<T, TValueAccessor> {
37
37
  /**
38
38
  * Key of the updated item.
39
39
  */
@@ -65,7 +65,7 @@ export interface LatestMapItemRemovedClientData<K extends string | number> {
65
65
  * @sealed
66
66
  * @beta
67
67
  */
68
- export interface LatestMapRawEvents<T, K extends string | number> {
68
+ export interface LatestMapEvents<T, K extends string | number, TRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
69
69
  /**
70
70
  * Raised when any item's value for remote client is updated.
71
71
  * @param updates - Map of one or more values updated.
@@ -74,14 +74,14 @@ export interface LatestMapRawEvents<T, K extends string | number> {
74
74
  *
75
75
  * @eventProperty
76
76
  */
77
- remoteUpdated: (updates: LatestMapClientData<T, K>) => void;
77
+ remoteUpdated: (updates: LatestMapClientData<T, K, TRemoteValueAccessor>) => void;
78
78
  /**
79
79
  * Raised when specific item's value of remote client is updated.
80
80
  * @param updatedItem - Updated item value.
81
81
  *
82
82
  * @eventProperty
83
83
  */
84
- remoteItemUpdated: (updatedItem: LatestMapItemUpdatedClientData<T, K>) => void;
84
+ remoteItemUpdated: (updatedItem: LatestMapItemUpdatedClientData<T, K, TRemoteValueAccessor>) => void;
85
85
  /**
86
86
  * Raised when specific item of remote client is removed.
87
87
  * @param removedItem - Removed item.
@@ -109,6 +109,13 @@ export interface LatestMapRawEvents<T, K extends string | number> {
109
109
  key: K;
110
110
  }) => void;
111
111
  }
112
+ /**
113
+ * Events from {@link LatestMapRaw}.
114
+ *
115
+ * @sealed
116
+ * @beta
117
+ */
118
+ export type LatestMapRawEvents<T, K extends string | number> = LatestMapEvents<T, K, RawValueAccessor<T>>;
112
119
  /**
113
120
  * Map of local client's values. Modifications are transmitted to all other connected clients.
114
121
  *
@@ -183,15 +190,15 @@ export interface StateMap<K extends string | number, V> {
183
190
  * @sealed
184
191
  * @beta
185
192
  */
186
- export interface LatestMapRaw<T, Keys extends string | number = string | number> {
193
+ export interface LatestMap<T, Keys extends string | number = string | number, TRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
187
194
  /**
188
195
  * Containing {@link Presence}
189
196
  */
190
197
  readonly presence: Presence;
191
198
  /**
192
- * Events for LatestMapRaw.
199
+ * Events for LatestMap.
193
200
  */
194
- readonly events: Listenable<LatestMapRawEvents<T, Keys>>;
201
+ readonly events: Listenable<LatestMapEvents<T, Keys, TRemoteAccessor>>;
195
202
  /**
196
203
  * Controls for management of sending updates.
197
204
  */
@@ -203,7 +210,7 @@ export interface LatestMapRaw<T, Keys extends string | number = string | number>
203
210
  /**
204
211
  * Iterable access to remote clients' map of values.
205
212
  */
206
- getRemotes(): IterableIterator<LatestMapClientData<T, Keys>>;
213
+ getRemotes(): IterableIterator<LatestMapClientData<T, Keys, TRemoteAccessor>>;
207
214
  /**
208
215
  * Array of {@link Attendee}s that have provided states.
209
216
  */
@@ -211,15 +218,27 @@ export interface LatestMapRaw<T, Keys extends string | number = string | number>
211
218
  /**
212
219
  * Access to a specific client's map of values.
213
220
  */
214
- getRemote(attendee: Attendee): ReadonlyMap<Keys, LatestData<T>>;
221
+ getRemote(attendee: Attendee): ReadonlyMap<Keys, LatestData<T, TRemoteAccessor>>;
215
222
  }
223
+ /**
224
+ * State that provides a `Map` of latest known values from this client to
225
+ * others and read access to their values.
226
+ * Entries in the map may vary over time and by client, but all values are expected to
227
+ * be of the same type, which may be a union type.
228
+ *
229
+ * @remarks Create using {@link StateFactory.latestMap} registered to {@link StatesWorkspace}.
230
+ *
231
+ * @sealed
232
+ * @beta
233
+ */
234
+ export type LatestMapRaw<T, Keys extends string | number = string | number> = LatestMap<T, Keys, RawValueAccessor<T>>;
216
235
  /**
217
236
  * Arguments that are passed to the {@link StateFactory.latestMap} function.
218
237
  *
219
238
  * @input
220
239
  * @beta
221
240
  */
222
- export interface LatestMapArguments<T, Keys extends string | number = string | number> {
241
+ export interface LatestMapArgumentsRaw<T, Keys extends string | number = string | number> {
223
242
  /**
224
243
  * The initial value of the local state.
225
244
  */
@@ -231,10 +250,49 @@ export interface LatestMapArguments<T, Keys extends string | number = string | n
231
250
  */
232
251
  settings?: BroadcastControlSettings | undefined;
233
252
  }
253
+ /**
254
+ * Arguments that are passed to the {@link StateFactory.latestMap} function.
255
+ *
256
+ * @input
257
+ * @beta
258
+ */
259
+ export interface LatestMapArguments<T, Keys extends string | number = string | number> extends LatestMapArgumentsRaw<T, Keys> {
260
+ /**
261
+ * A validator function that will be called to do runtime validation of the custom data stored in a presence state
262
+ * workspace.
263
+ */
264
+ validator: StateSchemaValidator<T>;
265
+ }
234
266
  /**
235
267
  * Factory for creating a {@link LatestMapRaw} State object.
236
268
  *
237
269
  * @beta
270
+ * @sealed
271
+ */
272
+ export interface LatestMapFactory {
273
+ /**
274
+ * Factory for creating a {@link LatestMapRaw} State object.
275
+ *
276
+ * @privateRemarks (change to `remarks` when adding signature overload)
277
+ * This overload is used when called with {@link LatestMapArgumentsRaw}.
278
+ * That is, if a validator function is _not_ provided.
279
+ */
280
+ <T, Keys extends string | number = string | number, RegistrationKey extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
281
+ }
282
+ /**
283
+ * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
284
+ */
285
+ export interface LatestMapFactoryInternal extends LatestMapFactory {
286
+ /**
287
+ * Factory for creating a {@link LatestMap} State object.
288
+ *
289
+ * @remarks
290
+ * This overload is used when called with {@link LatestMapArguments}. That is, if a validator function is provided.
291
+ */
292
+ <T, Keys extends string | number = string | number, RegistrationKey extends string = string>(args: LatestMapArguments<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
293
+ }
294
+ /**
295
+ * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
238
296
  */
239
- export declare function latestMap<T, Keys extends string | number = string | number, RegistrationKey extends string = string>(args?: LatestMapArguments<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
297
+ export declare const latestMap: LatestMapFactoryInternal;
240
298
  //# sourceMappingURL=latestMapValueManager.d.ts.map