@fluidframework/presence 2.43.0-343119 → 2.43.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.
- package/README.md +56 -32
- package/dist/alpha.d.ts +14 -5
- package/dist/beta.d.ts +14 -5
- package/dist/exposedInternalTypes.d.ts +12 -0
- package/dist/exposedInternalTypes.d.ts.map +1 -1
- package/dist/exposedInternalTypes.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/latestMapValueManager.d.ts +72 -14
- package/dist/latestMapValueManager.d.ts.map +1 -1
- package/dist/latestMapValueManager.js +15 -9
- package/dist/latestMapValueManager.js.map +1 -1
- package/dist/latestValueManager.d.ts +68 -13
- package/dist/latestValueManager.d.ts.map +1 -1
- package/dist/latestValueManager.js +7 -5
- package/dist/latestValueManager.js.map +1 -1
- package/dist/latestValueTypes.d.ts +60 -5
- package/dist/latestValueTypes.d.ts.map +1 -1
- package/dist/latestValueTypes.js.map +1 -1
- package/dist/presence.d.ts +20 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js.map +1 -1
- package/dist/stateFactory.d.ts +15 -10
- package/dist/stateFactory.d.ts.map +1 -1
- package/dist/stateFactory.js +12 -10
- package/dist/stateFactory.js.map +1 -1
- package/lib/alpha.d.ts +14 -5
- package/lib/beta.d.ts +14 -5
- package/lib/exposedInternalTypes.d.ts +12 -0
- package/lib/exposedInternalTypes.d.ts.map +1 -1
- package/lib/exposedInternalTypes.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/latestMapValueManager.d.ts +72 -14
- package/lib/latestMapValueManager.d.ts.map +1 -1
- package/lib/latestMapValueManager.js +15 -9
- package/lib/latestMapValueManager.js.map +1 -1
- package/lib/latestValueManager.d.ts +68 -13
- package/lib/latestValueManager.d.ts.map +1 -1
- package/lib/latestValueManager.js +7 -5
- package/lib/latestValueManager.js.map +1 -1
- package/lib/latestValueTypes.d.ts +60 -5
- package/lib/latestValueTypes.d.ts.map +1 -1
- package/lib/latestValueTypes.js.map +1 -1
- package/lib/presence.d.ts +20 -2
- package/lib/presence.d.ts.map +1 -1
- package/lib/presence.js.map +1 -1
- package/lib/stateFactory.d.ts +15 -10
- package/lib/stateFactory.d.ts.map +1 -1
- package/lib/stateFactory.js +11 -9
- package/lib/stateFactory.js.map +1 -1
- package/package.json +19 -19
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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 `
|
|
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
|
|
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
|
|
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 =
|
|
96
|
+
const presence = getPresence(container);
|
|
97
|
+
}
|
|
92
98
|
```
|
|
93
99
|
|
|
94
|
-
##
|
|
100
|
+
## Other Capabilities
|
|
95
101
|
|
|
96
|
-
###
|
|
102
|
+
### Runtime data validation
|
|
97
103
|
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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/
|
|
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
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
30
|
+
Latest,
|
|
31
|
+
LatestArgumentsRaw,
|
|
30
32
|
LatestClientData,
|
|
31
33
|
LatestData,
|
|
32
|
-
|
|
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
|
-
|
|
30
|
+
Latest,
|
|
31
|
+
LatestArgumentsRaw,
|
|
30
32
|
LatestClientData,
|
|
31
33
|
LatestData,
|
|
32
|
-
|
|
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;;;;;;GAMG;AAEH,yBAAiB,aAAa,CAAC;IAC9B
|
|
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;KACvC;IAED;;;;;;;;;;;;;;OAcG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;KACtC;IAED;;;;OAIG;IACH,UAAiB,cAAc,CAAC,CAAC;QAChC,GAAG,EAAE,MAAM,CAAC;QACZ,KA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AC,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,
|
|
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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,9 +15,9 @@ export { type Attendee, type AttendeesEvents, type AttendeeId, AttendeeStatus, t
|
|
|
15
15
|
export type { BroadcastControls, BroadcastControlSettings, } from "./broadcastControls.js";
|
|
16
16
|
export { getPresence, getPresenceAlpha } from "./experimentalAccess.js";
|
|
17
17
|
export { getPresenceViaDataObject, type ExperimentalPresenceDO, ExperimentalPresenceManager, } from "./datastorePresenceManagerFactory.js";
|
|
18
|
-
export type {
|
|
19
|
-
export type {
|
|
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";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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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"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;
|
|
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;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 \"./experimentalAccess.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
|
|
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
|
|
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
|
|
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
|
|
199
|
+
* Events for LatestMap.
|
|
193
200
|
*/
|
|
194
|
-
readonly events: Listenable<
|
|
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
|
|
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
|
|
297
|
+
export declare const latestMap: LatestMapFactoryInternal;
|
|
240
298
|
//# sourceMappingURL=latestMapValueManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAE1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAS/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,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