@fluidframework/presence 2.10.0-307399 → 2.10.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 +6 -2
- package/dist/alpha.d.ts +4 -3
- package/dist/broadcastControls.d.ts +70 -0
- package/dist/broadcastControls.d.ts.map +1 -0
- package/dist/broadcastControls.js +61 -0
- package/dist/broadcastControls.js.map +1 -0
- package/dist/exposedInternalTypes.d.ts +4 -1
- 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/internalTypes.d.ts +2 -2
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/latestMapValueManager.d.ts +3 -3
- package/dist/latestMapValueManager.d.ts.map +1 -1
- package/dist/latestMapValueManager.js +9 -13
- package/dist/latestMapValueManager.js.map +1 -1
- package/dist/latestValueManager.d.ts +3 -3
- package/dist/latestValueManager.d.ts.map +1 -1
- package/dist/latestValueManager.js +7 -11
- package/dist/latestValueManager.js.map +1 -1
- package/dist/notificationsManager.d.ts.map +1 -1
- package/dist/notificationsManager.js +16 -6
- package/dist/notificationsManager.js.map +1 -1
- package/dist/presence.d.ts +3 -1
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js.map +1 -1
- package/dist/presenceDatastoreManager.d.ts +5 -4
- package/dist/presenceDatastoreManager.d.ts.map +1 -1
- package/dist/presenceDatastoreManager.js +6 -6
- package/dist/presenceDatastoreManager.js.map +1 -1
- package/dist/presenceManager.d.ts.map +1 -1
- package/dist/presenceManager.js +2 -2
- package/dist/presenceManager.js.map +1 -1
- package/dist/presenceStates.d.ts +23 -4
- package/dist/presenceStates.d.ts.map +1 -1
- package/dist/presenceStates.js +41 -13
- package/dist/presenceStates.js.map +1 -1
- package/dist/stateDatastore.d.ts +13 -3
- package/dist/stateDatastore.d.ts.map +1 -1
- package/dist/stateDatastore.js.map +1 -1
- package/dist/types.d.ts +27 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/lib/alpha.d.ts +4 -3
- package/lib/broadcastControls.d.ts +70 -0
- package/lib/broadcastControls.d.ts.map +1 -0
- package/lib/broadcastControls.js +56 -0
- package/lib/broadcastControls.js.map +1 -0
- package/lib/exposedInternalTypes.d.ts +4 -1
- 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/internalTypes.d.ts +2 -2
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/latestMapValueManager.d.ts +3 -3
- package/lib/latestMapValueManager.d.ts.map +1 -1
- package/lib/latestMapValueManager.js +9 -13
- package/lib/latestMapValueManager.js.map +1 -1
- package/lib/latestValueManager.d.ts +3 -3
- package/lib/latestValueManager.d.ts.map +1 -1
- package/lib/latestValueManager.js +7 -11
- package/lib/latestValueManager.js.map +1 -1
- package/lib/notificationsManager.d.ts.map +1 -1
- package/lib/notificationsManager.js +16 -6
- package/lib/notificationsManager.js.map +1 -1
- package/lib/presence.d.ts +3 -1
- package/lib/presence.d.ts.map +1 -1
- package/lib/presence.js.map +1 -1
- package/lib/presenceDatastoreManager.d.ts +5 -4
- package/lib/presenceDatastoreManager.d.ts.map +1 -1
- package/lib/presenceDatastoreManager.js +6 -6
- package/lib/presenceDatastoreManager.js.map +1 -1
- package/lib/presenceManager.d.ts.map +1 -1
- package/lib/presenceManager.js +2 -2
- package/lib/presenceManager.js.map +1 -1
- package/lib/presenceStates.d.ts +23 -4
- package/lib/presenceStates.d.ts.map +1 -1
- package/lib/presenceStates.js +41 -13
- package/lib/presenceStates.js.map +1 -1
- package/lib/stateDatastore.d.ts +13 -3
- package/lib/stateDatastore.d.ts.map +1 -1
- package/lib/stateDatastore.js.map +1 -1
- package/lib/types.d.ts +27 -5
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +17 -17
- package/dist/latestValueControls.d.ts +0 -44
- package/dist/latestValueControls.d.ts.map +0 -1
- package/dist/latestValueControls.js +0 -28
- package/dist/latestValueControls.js.map +0 -1
- package/lib/latestValueControls.d.ts +0 -44
- package/lib/latestValueControls.d.ts.map +0 -1
- package/lib/latestValueControls.js +0 -24
- package/lib/latestValueControls.js.map +0 -1
package/dist/presenceStates.d.ts
CHANGED
|
@@ -3,14 +3,33 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { ClientConnectionId } from "./baseTypes.js";
|
|
6
|
+
import type { BroadcastControlSettings } from "./broadcastControls.js";
|
|
6
7
|
import type { InternalTypes } from "./exposedInternalTypes.js";
|
|
7
8
|
import type { ClientRecord } from "./internalTypes.js";
|
|
8
9
|
import type { ClientSessionId, ISessionClient } from "./presence.js";
|
|
9
10
|
import type { PresenceStates, PresenceStatesSchema } from "./types.js";
|
|
10
11
|
/**
|
|
12
|
+
* Extracts `Part` from {@link InternalTypes.ManagerFactory} return type
|
|
13
|
+
* matching the {@link PresenceStatesSchema} `Keys` given.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* If the `Part` is an optional property, undefined will be included in the
|
|
17
|
+
* result. Applying `Required` to the return type prior to extracting `Part`
|
|
18
|
+
* does not work as expected. Use Exclude\<, undefined\> can be used as needed.
|
|
19
|
+
*
|
|
11
20
|
* @internal
|
|
12
21
|
*/
|
|
13
22
|
export type MapSchemaElement<TSchema extends PresenceStatesSchema, Part extends keyof ReturnType<TSchema[keyof TSchema]>, Keys extends keyof TSchema = keyof TSchema> = ReturnType<TSchema[Keys]>[Part];
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export interface RuntimeLocalUpdateOptions {
|
|
27
|
+
allowableUpdateLatencyMs: number;
|
|
28
|
+
/**
|
|
29
|
+
* Special option allowed for unicast notifications.
|
|
30
|
+
*/
|
|
31
|
+
targetClientId?: ClientConnectionId;
|
|
32
|
+
}
|
|
14
33
|
/**
|
|
15
34
|
* @internal
|
|
16
35
|
*/
|
|
@@ -19,13 +38,13 @@ export interface PresenceRuntime {
|
|
|
19
38
|
lookupClient(clientId: ClientConnectionId): ISessionClient;
|
|
20
39
|
localUpdate(states: {
|
|
21
40
|
[key: string]: ClientUpdateEntry;
|
|
22
|
-
},
|
|
41
|
+
}, options: RuntimeLocalUpdateOptions): void;
|
|
23
42
|
}
|
|
24
43
|
/**
|
|
25
44
|
* ValueElementMap is a map of key to a map of clientId to ValueState.
|
|
26
45
|
* It is not restricted to the schema of the map as it may receive updates from other clients
|
|
27
46
|
* with managers that have not been registered locally. Each map node is responsible for keeping
|
|
28
|
-
* all
|
|
47
|
+
* all session's state to be able to pick arbitrary client to rebroadcast to others.
|
|
29
48
|
*
|
|
30
49
|
* This generic aspect makes some typing difficult. The loose typing is not broadcast to the
|
|
31
50
|
* consumers that are expected to maintain their schema over multiple versions of clients.
|
|
@@ -49,7 +68,7 @@ interface ValueUpdateRecord {
|
|
|
49
68
|
* @internal
|
|
50
69
|
*/
|
|
51
70
|
export interface PresenceStatesInternal {
|
|
52
|
-
ensureContent<TSchemaAdditional extends PresenceStatesSchema>(content: TSchemaAdditional): PresenceStates<TSchemaAdditional>;
|
|
71
|
+
ensureContent<TSchemaAdditional extends PresenceStatesSchema>(content: TSchemaAdditional, controls: BroadcastControlSettings | undefined): PresenceStates<TSchemaAdditional>;
|
|
53
72
|
processUpdate(received: number, timeModifier: number, remoteDatastore: ValueUpdateRecord, senderConnectionId: ClientConnectionId): void;
|
|
54
73
|
}
|
|
55
74
|
/**
|
|
@@ -70,7 +89,7 @@ export declare function mergeUntrackedDatastore(key: string, remoteAllKnownState
|
|
|
70
89
|
* Create a new PresenceStates using the DataStoreRuntime provided.
|
|
71
90
|
* @param initialContent - The initial value managers to register.
|
|
72
91
|
*/
|
|
73
|
-
export declare function createPresenceStates<TSchema extends PresenceStatesSchema>(runtime: PresenceRuntime, datastore: ValueElementMap<PresenceStatesSchema>, initialContent: TSchema): {
|
|
92
|
+
export declare function createPresenceStates<TSchema extends PresenceStatesSchema>(runtime: PresenceRuntime, datastore: ValueElementMap<PresenceStatesSchema>, initialContent: TSchema, controls: BroadcastControlSettings | undefined): {
|
|
74
93
|
public: PresenceStates<TSchema>;
|
|
75
94
|
internal: PresenceStatesInternal;
|
|
76
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presenceStates.d.ts","sourceRoot":"","sources":["../src/presenceStates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"presenceStates.d.ts","sourceRoot":"","sources":["../src/presenceStates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,CAC3B,OAAO,SAAS,oBA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AAiB,CAAC,CAAC;IACrC,aAAa,CACZ,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,iBAAiB,EAClC,kBAAkB,EAAE,kBAAkB,GACpC,IAAI,CAAC;CACR;AAsDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,MAAM,EACX,mBAAmB,EAAE,kBAAkB,EACvC,SAAS,EAAE,eAAe,CAAC,oBAAoB,CAAC,EAChD,YAAY,EAAE,MAAM,GAClB,IAAI,CAcN;AAwMD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,oBAAoB,EACxE,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,eAAe,CAAC,oBAAoB,CAAC,EAChD,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,wBAAwB,GAAG,SAAS,GAC5C;IAAE,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAAC,QAAQ,EAAE,sBAAsB,CAAA;CAAE,CAOvE"}
|
package/dist/presenceStates.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.createPresenceStates = exports.mergeUntrackedDatastore = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const broadcastControls_js_1 = require("./broadcastControls.js");
|
|
9
10
|
const internalTypes_js_1 = require("./internalTypes.js");
|
|
10
11
|
const stateDatastore_js_1 = require("./stateDatastore.js");
|
|
11
12
|
const valueManager_js_1 = require("./valueManager.js");
|
|
@@ -69,22 +70,38 @@ function mergeUntrackedDatastore(key, remoteAllKnownState, datastore, timeModifi
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
exports.mergeUntrackedDatastore = mergeUntrackedDatastore;
|
|
73
|
+
/**
|
|
74
|
+
* The default allowable update latency for PresenceStates workspaces in milliseconds.
|
|
75
|
+
*/
|
|
76
|
+
const defaultAllowableUpdateLatencyMs = 60;
|
|
72
77
|
class PresenceStatesImpl {
|
|
73
|
-
constructor(runtime, datastore, initialContent) {
|
|
78
|
+
constructor(runtime, datastore, initialContent, controlsSettings) {
|
|
74
79
|
this.runtime = runtime;
|
|
75
80
|
this.datastore = datastore;
|
|
81
|
+
this.controls = new broadcastControls_js_1.RequiredBroadcastControl(defaultAllowableUpdateLatencyMs);
|
|
82
|
+
if (controlsSettings?.allowableUpdateLatencyMs !== undefined) {
|
|
83
|
+
this.controls.allowableUpdateLatencyMs = controlsSettings.allowableUpdateLatencyMs;
|
|
84
|
+
}
|
|
76
85
|
// Prepare initial map content from initial state
|
|
77
86
|
{
|
|
78
87
|
const clientSessionId = this.runtime.clientSessionId;
|
|
79
88
|
let anyInitialValues = false;
|
|
89
|
+
let cumulativeAllowableUpdateLatencyMs;
|
|
80
90
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
81
91
|
const initial = Object.entries(initialContent).reduce((acc, [key, nodeFactory]) => {
|
|
82
92
|
const newNodeData = nodeFactory(key, (0, stateDatastore_js_1.handleFromDatastore)(this));
|
|
83
93
|
acc.nodes[key] = newNodeData.manager;
|
|
84
|
-
if ("
|
|
94
|
+
if ("initialData" in newNodeData) {
|
|
95
|
+
const { value, allowableUpdateLatencyMs } = newNodeData.initialData;
|
|
85
96
|
acc.datastore[key] = acc.datastore[key] ?? {};
|
|
86
|
-
acc.datastore[key][clientSessionId] =
|
|
87
|
-
acc.newValues[key] =
|
|
97
|
+
acc.datastore[key][clientSessionId] = value;
|
|
98
|
+
acc.newValues[key] = value;
|
|
99
|
+
if (allowableUpdateLatencyMs !== undefined) {
|
|
100
|
+
cumulativeAllowableUpdateLatencyMs =
|
|
101
|
+
cumulativeAllowableUpdateLatencyMs === undefined
|
|
102
|
+
? allowableUpdateLatencyMs
|
|
103
|
+
: Math.min(cumulativeAllowableUpdateLatencyMs, allowableUpdateLatencyMs);
|
|
104
|
+
}
|
|
88
105
|
anyInitialValues = true;
|
|
89
106
|
}
|
|
90
107
|
return acc;
|
|
@@ -101,7 +118,9 @@ class PresenceStatesImpl {
|
|
|
101
118
|
// filter that beguiles the type system. So just reinterpret cast.
|
|
102
119
|
this.props = this.nodes;
|
|
103
120
|
if (anyInitialValues) {
|
|
104
|
-
this.runtime.localUpdate(initial.newValues,
|
|
121
|
+
this.runtime.localUpdate(initial.newValues, {
|
|
122
|
+
allowableUpdateLatencyMs: cumulativeAllowableUpdateLatencyMs ?? this.controls.allowableUpdateLatencyMs,
|
|
123
|
+
});
|
|
105
124
|
}
|
|
106
125
|
}
|
|
107
126
|
}
|
|
@@ -111,8 +130,11 @@ class PresenceStatesImpl {
|
|
|
111
130
|
states: this.datastore[key],
|
|
112
131
|
};
|
|
113
132
|
}
|
|
114
|
-
localUpdate(key, value,
|
|
115
|
-
this.runtime.localUpdate({ [key]: value },
|
|
133
|
+
localUpdate(key, value, options) {
|
|
134
|
+
this.runtime.localUpdate({ [key]: value }, {
|
|
135
|
+
...options,
|
|
136
|
+
allowableUpdateLatencyMs: options.allowableUpdateLatencyMs ?? this.controls.allowableUpdateLatencyMs,
|
|
137
|
+
});
|
|
116
138
|
}
|
|
117
139
|
update(key, clientId, value) {
|
|
118
140
|
const allKnownState = this.datastore[key];
|
|
@@ -125,7 +147,8 @@ class PresenceStatesImpl {
|
|
|
125
147
|
(0, internal_1.assert)(!(key in this.nodes), 0xa3c /* Already have entry for key in map */);
|
|
126
148
|
const nodeData = nodeFactory(key, (0, stateDatastore_js_1.handleFromDatastore)(this));
|
|
127
149
|
this.nodes[key] = nodeData.manager;
|
|
128
|
-
if ("
|
|
150
|
+
if ("initialData" in nodeData) {
|
|
151
|
+
const { value, allowableUpdateLatencyMs } = nodeData.initialData;
|
|
129
152
|
if (key in this.datastore) {
|
|
130
153
|
// Already have received state from other clients. Kept in `all`.
|
|
131
154
|
// TODO: Send current `all` state to state manager.
|
|
@@ -133,11 +156,16 @@ class PresenceStatesImpl {
|
|
|
133
156
|
else {
|
|
134
157
|
this.datastore[key] = {};
|
|
135
158
|
}
|
|
136
|
-
this.datastore[key][this.runtime.clientSessionId] =
|
|
137
|
-
this.runtime.localUpdate({ [key]:
|
|
159
|
+
this.datastore[key][this.runtime.clientSessionId] = value;
|
|
160
|
+
this.runtime.localUpdate({ [key]: value }, {
|
|
161
|
+
allowableUpdateLatencyMs: allowableUpdateLatencyMs ?? this.controls.allowableUpdateLatencyMs,
|
|
162
|
+
});
|
|
138
163
|
}
|
|
139
164
|
}
|
|
140
|
-
ensureContent(content) {
|
|
165
|
+
ensureContent(content, controls) {
|
|
166
|
+
if (controls?.allowableUpdateLatencyMs !== undefined) {
|
|
167
|
+
this.controls.allowableUpdateLatencyMs = controls.allowableUpdateLatencyMs;
|
|
168
|
+
}
|
|
141
169
|
for (const [key, nodeFactory] of Object.entries(content)) {
|
|
142
170
|
if (key in this.nodes) {
|
|
143
171
|
const node = (0, valueManager_js_1.unbrandIVM)(this.nodes[key]);
|
|
@@ -171,8 +199,8 @@ class PresenceStatesImpl {
|
|
|
171
199
|
* Create a new PresenceStates using the DataStoreRuntime provided.
|
|
172
200
|
* @param initialContent - The initial value managers to register.
|
|
173
201
|
*/
|
|
174
|
-
function createPresenceStates(runtime, datastore, initialContent) {
|
|
175
|
-
const impl = new PresenceStatesImpl(runtime, datastore, initialContent);
|
|
202
|
+
function createPresenceStates(runtime, datastore, initialContent, controls) {
|
|
203
|
+
const impl = new PresenceStatesImpl(runtime, datastore, initialContent, controls);
|
|
176
204
|
return {
|
|
177
205
|
public: impl,
|
|
178
206
|
internal: impl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presenceStates.js","sourceRoot":"","sources":["../src/presenceStates.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAK7D,yDAA0D;AAE1D,2DAA+E;AAE/E,uDAA+C;AAgG/C,SAAS,gBAAgB,CAMxB,KAAoD;IAEpD,OAAO,OAAO,IAAI,KAAK,CAAC;AACzB,CAAC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,oBAAoB,CACnC,OAAwB,EACxB,SAAgD,EAChD,cAAuB;IAEvB,MAAM,IAAI,GAAG,IAAI,kBAAkB,CAAU,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAEjF,OAAO;QACN,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;KACd,CAAC;AACH,CAAC;AAXD,oDAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ClientRecord } from \"./internalTypes.js\";\nimport { brandedObjectEntries } from \"./internalTypes.js\";\nimport type { ClientSessionId, ISessionClient } from \"./presence.js\";\nimport { handleFromDatastore, type StateDatastore } from \"./stateDatastore.js\";\nimport type { PresenceStates, PresenceStatesSchema } from \"./types.js\";\nimport { unbrandIVM } from \"./valueManager.js\";\n\n/**\n * @internal\n */\nexport type MapSchemaElement<\n\tTSchema extends PresenceStatesSchema,\n\tPart extends keyof ReturnType<TSchema[keyof TSchema]>,\n\tKeys extends keyof TSchema = keyof TSchema,\n> = ReturnType<TSchema[Keys]>[Part];\n\n/**\n * @internal\n */\nexport interface PresenceRuntime {\n\treadonly clientSessionId: ClientSessionId;\n\tlookupClient(clientId: ClientConnectionId): ISessionClient;\n\tlocalUpdate(states: { [key: string]: ClientUpdateEntry }, forceBroadcast: boolean): void;\n}\n\ntype PresenceSubSchemaFromWorkspaceSchema<\n\tTSchema extends PresenceStatesSchema,\n\tPart extends keyof ReturnType<TSchema[keyof TSchema]>,\n> = {\n\t[Key in keyof TSchema]: MapSchemaElement<TSchema, Part, Key>;\n};\n\ntype MapEntries<TSchema extends PresenceStatesSchema> = PresenceSubSchemaFromWorkspaceSchema<\n\tTSchema,\n\t\"manager\"\n>;\n\n/**\n * ValueElementMap is a map of key to a map of clientId to ValueState.\n * It is not restricted to the schema of the map as it may receive updates from other clients\n * with managers that have not been registered locally. Each map node is responsible for keeping\n * all sessions state to be able to pick arbitrary client to rebroadcast to others.\n *\n * This generic aspect makes some typing difficult. The loose typing is not broadcast to the\n * consumers that are expected to maintain their schema over multiple versions of clients.\n *\n * @internal\n */\nexport interface ValueElementMap<_TSchema extends PresenceStatesSchema> {\n\t[key: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<unknown>>;\n}\n\n// An attempt to make the type more precise, but it is not working.\n// If the casting in support code is too much we could keep two references to the same\n// complete datastore, but with the respective types desired.\n// type ValueElementMap<TSchema extends PresenceStatesNodeSchema> =\n// \t| {\n// \t\t\t[Key in keyof TSchema & string]?: {\n// \t\t\t\t[ClientSessionId: ClientSessionId]: InternalTypes.ValueDirectoryOrState<MapSchemaElement<TSchema,\"value\",Key>>;\n// \t\t\t};\n// \t }\n// \t| {\n// \t\t\t[key: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<unknown>>;\n// \t };\n// interface ValueElementMap<TValue> {\n// \t[Id: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<TValue>>;\n// \t// Version with local packed in is convenient for map, but not for join broadcast to serialize simply.\n// \t// [Id: string]: {\n// \t// \tlocal: InternalTypes.ValueDirectoryOrState<TValue>;\n// \t// \tall: ClientRecord<InternalTypes.ValueDirectoryOrState<TValue>>;\n// \t// };\n// }\n\n/**\n * @internal\n */\nexport type ClientUpdateEntry = InternalTypes.ValueDirectoryOrState<unknown> & {\n\tignoreUnmonitored?: true;\n};\n\ntype ClientUpdateRecord = ClientRecord<ClientUpdateEntry>;\n\ninterface ValueUpdateRecord {\n\t[valueKey: string]: ClientUpdateRecord;\n}\n\n/**\n * @internal\n */\nexport interface PresenceStatesInternal {\n\tensureContent<TSchemaAdditional extends PresenceStatesSchema>(\n\t\tcontent: TSchemaAdditional,\n\t): PresenceStates<TSchemaAdditional>;\n\tprocessUpdate(\n\t\treceived: number,\n\t\ttimeModifier: number,\n\t\tremoteDatastore: ValueUpdateRecord,\n\t\tsenderConnectionId: ClientConnectionId,\n\t): void;\n}\n\nfunction isValueDirectory<\n\tT,\n\tTValueState extends\n\t\t| InternalTypes.ValueRequiredState<T>\n\t\t| InternalTypes.ValueOptionalState<T>,\n>(\n\tvalue: InternalTypes.ValueDirectory<T> | TValueState,\n): value is InternalTypes.ValueDirectory<T> {\n\treturn \"items\" in value;\n}\n\nfunction mergeValueDirectory<\n\tT,\n\tTValueState extends\n\t\t| InternalTypes.ValueRequiredState<T>\n\t\t| InternalTypes.ValueOptionalState<T>,\n>(\n\tbase: TValueState | InternalTypes.ValueDirectory<T> | undefined,\n\tupdate: TValueState | InternalTypes.ValueDirectory<T>,\n\ttimeDelta: number,\n): TValueState | InternalTypes.ValueDirectory<T> {\n\tif (!isValueDirectory(update)) {\n\t\tif (base === undefined || update.rev > base.rev) {\n\t\t\treturn { ...update, timestamp: update.timestamp + timeDelta };\n\t\t}\n\t\treturn base;\n\t}\n\n\tlet mergeBase: InternalTypes.ValueDirectory<T>;\n\tif (base === undefined) {\n\t\tmergeBase = { rev: update.rev, items: {} };\n\t} else {\n\t\tconst baseIsDirectory = isValueDirectory(base);\n\t\tif (base.rev >= update.rev) {\n\t\t\tif (!baseIsDirectory) {\n\t\t\t\t// base is leaf value that is more recent - nothing to do\n\t\t\t\treturn base;\n\t\t\t}\n\t\t\t// While base has more advanced revision, assume mis-ordering or\n\t\t\t// missed and catchup update needs merged in.\n\t\t\tmergeBase = base;\n\t\t} else {\n\t\t\tmergeBase = { rev: update.rev, items: baseIsDirectory ? base.items : {} };\n\t\t}\n\t}\n\tfor (const [key, value] of Object.entries(update.items)) {\n\t\tconst baseElement = mergeBase.items[key];\n\t\tmergeBase.items[key] = mergeValueDirectory(baseElement, value, timeDelta);\n\t}\n\treturn mergeBase;\n}\n\n/**\n * Updates remote state into the local [untracked] datastore.\n *\n * @param key - The key of the datastore to merge the untracked data into.\n * @param remoteAllKnownState - The remote state to merge into the datastore.\n * @param datastore - The datastore to merge the untracked data into.\n *\n * @remarks\n * In the case of ignored unmonitored data, the client entries are not stored,\n * though the value keys will be populated and often remain empty.\n *\n * @internal\n */\nexport function mergeUntrackedDatastore(\n\tkey: string,\n\tremoteAllKnownState: ClientUpdateRecord,\n\tdatastore: ValueElementMap<PresenceStatesSchema>,\n\ttimeModifier: number,\n): void {\n\tif (!(key in datastore)) {\n\t\tdatastore[key] = {};\n\t}\n\tconst localAllKnownState = datastore[key];\n\tfor (const [clientSessionId, value] of brandedObjectEntries(remoteAllKnownState)) {\n\t\tif (!(\"ignoreUnmonitored\" in value)) {\n\t\t\tlocalAllKnownState[clientSessionId] = mergeValueDirectory(\n\t\t\t\tlocalAllKnownState[clientSessionId],\n\t\t\t\tvalue,\n\t\t\t\ttimeModifier,\n\t\t\t);\n\t\t}\n\t}\n}\n\nclass PresenceStatesImpl<TSchema extends PresenceStatesSchema>\n\timplements\n\t\tPresenceStatesInternal,\n\t\tPresenceStates<TSchema>,\n\t\tStateDatastore<\n\t\t\tkeyof TSchema & string,\n\t\t\tMapSchemaElement<TSchema, \"value\", keyof TSchema & string>\n\t\t>\n{\n\tprivate readonly nodes: MapEntries<TSchema>;\n\tpublic readonly props: PresenceStates<TSchema>[\"props\"];\n\n\tpublic constructor(\n\t\tprivate readonly runtime: PresenceRuntime,\n\t\tprivate readonly datastore: ValueElementMap<TSchema>,\n\t\tinitialContent: TSchema,\n\t) {\n\t\t// Prepare initial map content from initial state\n\t\t{\n\t\t\tconst clientSessionId = this.runtime.clientSessionId;\n\t\t\tlet anyInitialValues = false;\n\t\t\t// eslint-disable-next-line unicorn/no-array-reduce\n\t\t\tconst initial = Object.entries(initialContent).reduce(\n\t\t\t\t(acc, [key, nodeFactory]) => {\n\t\t\t\t\tconst newNodeData = nodeFactory(key, handleFromDatastore(this));\n\t\t\t\t\tacc.nodes[key as keyof TSchema] = newNodeData.manager;\n\t\t\t\t\tif (\"value\" in newNodeData) {\n\t\t\t\t\t\tacc.datastore[key] = acc.datastore[key] ?? {};\n\t\t\t\t\t\tacc.datastore[key][clientSessionId] = newNodeData.value;\n\t\t\t\t\t\tacc.newValues[key] = newNodeData.value;\n\t\t\t\t\t\tanyInitialValues = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\t\tnodes: {} as MapEntries<TSchema>,\n\t\t\t\t\tdatastore,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\t\tnewValues: {} as { [key: string]: InternalTypes.ValueDirectoryOrState<unknown> },\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.nodes = initial.nodes;\n\t\t\t// props is the public view of nodes that limits the entries types to\n\t\t\t// the public interface of the value manager with an additional type\n\t\t\t// filter that beguiles the type system. So just reinterpret cast.\n\t\t\tthis.props = this.nodes as unknown as PresenceStates<TSchema>[\"props\"];\n\n\t\t\tif (anyInitialValues) {\n\t\t\t\tthis.runtime.localUpdate(initial.newValues, false);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic knownValues<Key extends keyof TSchema & string>(\n\t\tkey: Key,\n\t): {\n\t\tself: ClientSessionId | undefined;\n\t\tstates: ClientRecord<MapSchemaElement<TSchema, \"value\", Key>>;\n\t} {\n\t\treturn {\n\t\t\tself: this.runtime.clientSessionId,\n\t\t\tstates: this.datastore[key],\n\t\t};\n\t}\n\n\tpublic localUpdate<Key extends keyof TSchema & string>(\n\t\tkey: Key,\n\t\tvalue: MapSchemaElement<TSchema, \"value\", Key> & ClientUpdateEntry,\n\t\tforceBroadcast: boolean,\n\t): void {\n\t\tthis.runtime.localUpdate({ [key]: value }, forceBroadcast);\n\t}\n\n\tpublic update<Key extends keyof TSchema & string>(\n\t\tkey: Key,\n\t\tclientId: ClientSessionId,\n\t\tvalue: Exclude<MapSchemaElement<TSchema, \"value\", Key>, undefined>,\n\t): void {\n\t\tconst allKnownState = this.datastore[key];\n\t\tallKnownState[clientId] = mergeValueDirectory(allKnownState[clientId], value, 0);\n\t}\n\n\tpublic lookupClient(clientId: ClientConnectionId): ISessionClient {\n\t\treturn this.runtime.lookupClient(clientId);\n\t}\n\n\tpublic add<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\t\tTValueManager,\n\t>(\n\t\tkey: TKey,\n\t\tnodeFactory: InternalTypes.ManagerFactory<TKey, TValue, TValueManager>,\n\t): asserts this is PresenceStates<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TValueManager>>\n\t> {\n\t\tassert(!(key in this.nodes), 0xa3c /* Already have entry for key in map */);\n\t\tconst nodeData = nodeFactory(key, handleFromDatastore(this));\n\t\tthis.nodes[key] = nodeData.manager;\n\t\tif (\"value\" in nodeData) {\n\t\t\tif (key in this.datastore) {\n\t\t\t\t// Already have received state from other clients. Kept in `all`.\n\t\t\t\t// TODO: Send current `all` state to state manager.\n\t\t\t} else {\n\t\t\t\tthis.datastore[key] = {};\n\t\t\t}\n\t\t\tthis.datastore[key][this.runtime.clientSessionId] = nodeData.value;\n\t\t\tthis.runtime.localUpdate({ [key]: nodeData.value }, false);\n\t\t}\n\t}\n\n\tpublic ensureContent<TSchemaAdditional extends PresenceStatesSchema>(\n\t\tcontent: TSchemaAdditional,\n\t): PresenceStates<TSchema & TSchemaAdditional> {\n\t\tfor (const [key, nodeFactory] of Object.entries(content)) {\n\t\t\tif (key in this.nodes) {\n\t\t\t\tconst node = unbrandIVM(this.nodes[key]);\n\t\t\t\tif (!(node instanceof nodeFactory.instanceBase)) {\n\t\t\t\t\tthrow new TypeError(`State \"${key}\" previously created by different value manager.`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.add(key, nodeFactory);\n\t\t\t}\n\t\t}\n\t\treturn this as PresenceStates<TSchema & TSchemaAdditional>;\n\t}\n\n\tpublic processUpdate(\n\t\treceived: number,\n\t\ttimeModifier: number,\n\t\tremoteDatastore: ValueUpdateRecord,\n\t): void {\n\t\tfor (const [key, remoteAllKnownState] of Object.entries(remoteDatastore)) {\n\t\t\tif (key in this.nodes) {\n\t\t\t\tconst node = unbrandIVM(this.nodes[key]);\n\t\t\t\tfor (const [clientSessionId, value] of brandedObjectEntries(remoteAllKnownState)) {\n\t\t\t\t\tconst client = this.runtime.lookupClient(clientSessionId);\n\t\t\t\t\tnode.update(client, received, value);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Assume all broadcast state is meant to be kept even if not currently registered.\n\t\t\t\tmergeUntrackedDatastore(key, remoteAllKnownState, this.datastore, timeModifier);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Create a new PresenceStates using the DataStoreRuntime provided.\n * @param initialContent - The initial value managers to register.\n */\nexport function createPresenceStates<TSchema extends PresenceStatesSchema>(\n\truntime: PresenceRuntime,\n\tdatastore: ValueElementMap<PresenceStatesSchema>,\n\tinitialContent: TSchema,\n): { public: PresenceStates<TSchema>; internal: PresenceStatesInternal } {\n\tconst impl = new PresenceStatesImpl<TSchema>(runtime, datastore, initialContent);\n\n\treturn {\n\t\tpublic: impl,\n\t\tinternal: impl,\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"presenceStates.js","sourceRoot":"","sources":["../src/presenceStates.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAI7D,iEAAkE;AAGlE,yDAA0D;AAG1D,2DAA0D;AAE1D,uDAA+C;AAwH/C,SAAS,gBAAgB,CAMxB,KAAoD;IAEpD,OAAO,OAAO,IAAI,KAAK,CAAC;AACzB,CAAC;AAED,SAAS,mBAAmB,CAM3B,IAA+D,EAC/D,MAAqD,EACrD,SAAiB;IAEjB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,IAAI,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACjD,OAAO,EAAE,GA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AmD,CAAC;IAC5D,CAAC;IAEM,aAAa,CACnB,QAAgB,EAChB,YAAoB,EACpB,eAAkC;QAElC,KAAK,MAAM,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;YAC1E,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACvB,MAAM,IAAI,GAAG,IAAA,4BAAU,EAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;gBACzC,KAAK,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,IAAA,uCAAoB,EAAC,mBAAmB,CAAC,EAAE,CAAC;oBAClF,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;oBAC1D,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;gBACtC,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,mFAAmF;gBACnF,uBAAuB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YACjF,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CACnC,OAAwB,EACxB,SAAgD,EAChD,cAAuB,EACvB,QAA8C;IAE9C,MAAM,IAAI,GAAG,IAAI,kBAAkB,CAAU,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;IAE3F,OAAO;QACN,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;KACd,CAAC;AACH,CAAC;AAZD,oDAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { BroadcastControlSettings } from \"./broadcastControls.js\";\nimport { RequiredBroadcastControl } from \"./broadcastControls.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ClientRecord } from \"./internalTypes.js\";\nimport { brandedObjectEntries } from \"./internalTypes.js\";\nimport type { ClientSessionId, ISessionClient } from \"./presence.js\";\nimport type { LocalStateUpdateOptions, StateDatastore } from \"./stateDatastore.js\";\nimport { handleFromDatastore } from \"./stateDatastore.js\";\nimport type { PresenceStates, PresenceStatesSchema } from \"./types.js\";\nimport { unbrandIVM } from \"./valueManager.js\";\n\n/**\n * Extracts `Part` from {@link InternalTypes.ManagerFactory} return type\n * matching the {@link PresenceStatesSchema} `Keys` given.\n *\n * @remarks\n * If the `Part` is an optional property, undefined will be included in the\n * result. Applying `Required` to the return type prior to extracting `Part`\n * does not work as expected. Use Exclude\\<, undefined\\> can be used as needed.\n *\n * @internal\n */\nexport type MapSchemaElement<\n\tTSchema extends PresenceStatesSchema,\n\tPart extends keyof ReturnType<TSchema[keyof TSchema]>,\n\tKeys extends keyof TSchema = keyof TSchema,\n> = ReturnType<TSchema[Keys]>[Part];\n\n/**\n * @internal\n */\nexport interface RuntimeLocalUpdateOptions {\n\tallowableUpdateLatencyMs: number;\n\n\t/**\n\t * Special option allowed for unicast notifications.\n\t */\n\ttargetClientId?: ClientConnectionId;\n}\n\n/**\n * @internal\n */\nexport interface PresenceRuntime {\n\treadonly clientSessionId: ClientSessionId;\n\tlookupClient(clientId: ClientConnectionId): ISessionClient;\n\tlocalUpdate(\n\t\tstates: { [key: string]: ClientUpdateEntry },\n\t\toptions: RuntimeLocalUpdateOptions,\n\t): void;\n}\n\ntype PresenceSubSchemaFromWorkspaceSchema<\n\tTSchema extends PresenceStatesSchema,\n\tPart extends keyof ReturnType<TSchema[keyof TSchema]>,\n> = {\n\t[Key in keyof TSchema]: MapSchemaElement<TSchema, Part, Key>;\n};\n\ntype MapEntries<TSchema extends PresenceStatesSchema> = PresenceSubSchemaFromWorkspaceSchema<\n\tTSchema,\n\t\"manager\"\n>;\n\n/**\n * ValueElementMap is a map of key to a map of clientId to ValueState.\n * It is not restricted to the schema of the map as it may receive updates from other clients\n * with managers that have not been registered locally. Each map node is responsible for keeping\n * all session's state to be able to pick arbitrary client to rebroadcast to others.\n *\n * This generic aspect makes some typing difficult. The loose typing is not broadcast to the\n * consumers that are expected to maintain their schema over multiple versions of clients.\n *\n * @internal\n */\nexport interface ValueElementMap<_TSchema extends PresenceStatesSchema> {\n\t[key: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<unknown>>;\n}\n\n// An attempt to make the type more precise, but it is not working.\n// If the casting in support code is too much we could keep two references to the same\n// complete datastore, but with the respective types desired.\n// type ValueElementMap<TSchema extends PresenceStatesNodeSchema> =\n// \t| {\n// \t\t\t[Key in keyof TSchema & string]?: {\n// \t\t\t\t[ClientSessionId: ClientSessionId]: InternalTypes.ValueDirectoryOrState<MapSchemaElement<TSchema,\"value\",Key>>;\n// \t\t\t};\n// \t }\n// \t| {\n// \t\t\t[key: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<unknown>>;\n// \t };\n// interface ValueElementMap<TValue> {\n// \t[Id: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<TValue>>;\n// \t// Version with local packed in is convenient for map, but not for join broadcast to serialize simply.\n// \t// [Id: string]: {\n// \t// \tlocal: InternalTypes.ValueDirectoryOrState<TValue>;\n// \t// \tall: ClientRecord<InternalTypes.ValueDirectoryOrState<TValue>>;\n// \t// };\n// }\n\n/**\n * @internal\n */\nexport type ClientUpdateEntry = InternalTypes.ValueDirectoryOrState<unknown> & {\n\tignoreUnmonitored?: true;\n};\n\ntype ClientUpdateRecord = ClientRecord<ClientUpdateEntry>;\n\ninterface ValueUpdateRecord {\n\t[valueKey: string]: ClientUpdateRecord;\n}\n\n/**\n * @internal\n */\nexport interface PresenceStatesInternal {\n\tensureContent<TSchemaAdditional extends PresenceStatesSchema>(\n\t\tcontent: TSchemaAdditional,\n\t\tcontrols: BroadcastControlSettings | undefined,\n\t): PresenceStates<TSchemaAdditional>;\n\tprocessUpdate(\n\t\treceived: number,\n\t\ttimeModifier: number,\n\t\tremoteDatastore: ValueUpdateRecord,\n\t\tsenderConnectionId: ClientConnectionId,\n\t): void;\n}\n\nfunction isValueDirectory<\n\tT,\n\tTValueState extends\n\t\t| InternalTypes.ValueRequiredState<T>\n\t\t| InternalTypes.ValueOptionalState<T>,\n>(\n\tvalue: InternalTypes.ValueDirectory<T> | TValueState,\n): value is InternalTypes.ValueDirectory<T> {\n\treturn \"items\" in value;\n}\n\nfunction mergeValueDirectory<\n\tT,\n\tTValueState extends\n\t\t| InternalTypes.ValueRequiredState<T>\n\t\t| InternalTypes.ValueOptionalState<T>,\n>(\n\tbase: TValueState | InternalTypes.ValueDirectory<T> | undefined,\n\tupdate: TValueState | InternalTypes.ValueDirectory<T>,\n\ttimeDelta: number,\n): TValueState | InternalTypes.ValueDirectory<T> {\n\tif (!isValueDirectory(update)) {\n\t\tif (base === undefined || update.rev > base.rev) {\n\t\t\treturn { ...update, timestamp: update.timestamp + timeDelta };\n\t\t}\n\t\treturn base;\n\t}\n\n\tlet mergeBase: InternalTypes.ValueDirectory<T>;\n\tif (base === undefined) {\n\t\tmergeBase = { rev: update.rev, items: {} };\n\t} else {\n\t\tconst baseIsDirectory = isValueDirectory(base);\n\t\tif (base.rev >= update.rev) {\n\t\t\tif (!baseIsDirectory) {\n\t\t\t\t// base is leaf value that is more recent - nothing to do\n\t\t\t\treturn base;\n\t\t\t}\n\t\t\t// While base has more advanced revision, assume mis-ordering or\n\t\t\t// missed and catchup update needs merged in.\n\t\t\tmergeBase = base;\n\t\t} else {\n\t\t\tmergeBase = { rev: update.rev, items: baseIsDirectory ? base.items : {} };\n\t\t}\n\t}\n\tfor (const [key, value] of Object.entries(update.items)) {\n\t\tconst baseElement = mergeBase.items[key];\n\t\tmergeBase.items[key] = mergeValueDirectory(baseElement, value, timeDelta);\n\t}\n\treturn mergeBase;\n}\n\n/**\n * Updates remote state into the local [untracked] datastore.\n *\n * @param key - The key of the datastore to merge the untracked data into.\n * @param remoteAllKnownState - The remote state to merge into the datastore.\n * @param datastore - The datastore to merge the untracked data into.\n *\n * @remarks\n * In the case of ignored unmonitored data, the client entries are not stored,\n * though the value keys will be populated and often remain empty.\n *\n * @internal\n */\nexport function mergeUntrackedDatastore(\n\tkey: string,\n\tremoteAllKnownState: ClientUpdateRecord,\n\tdatastore: ValueElementMap<PresenceStatesSchema>,\n\ttimeModifier: number,\n): void {\n\tif (!(key in datastore)) {\n\t\tdatastore[key] = {};\n\t}\n\tconst localAllKnownState = datastore[key];\n\tfor (const [clientSessionId, value] of brandedObjectEntries(remoteAllKnownState)) {\n\t\tif (!(\"ignoreUnmonitored\" in value)) {\n\t\t\tlocalAllKnownState[clientSessionId] = mergeValueDirectory(\n\t\t\t\tlocalAllKnownState[clientSessionId],\n\t\t\t\tvalue,\n\t\t\t\ttimeModifier,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The default allowable update latency for PresenceStates workspaces in milliseconds.\n */\nconst defaultAllowableUpdateLatencyMs = 60;\n\n/**\n * Produces the value type of a schema element or set of elements.\n */\ntype SchemaElementValueType<\n\tTSchema extends PresenceStatesSchema,\n\tKeys extends keyof TSchema & string,\n> = Exclude<MapSchemaElement<TSchema, \"initialData\", Keys>, undefined>[\"value\"];\n\nclass PresenceStatesImpl<TSchema extends PresenceStatesSchema>\n\timplements\n\t\tPresenceStatesInternal,\n\t\tPresenceStates<TSchema>,\n\t\tStateDatastore<\n\t\t\tkeyof TSchema & string,\n\t\t\tSchemaElementValueType<TSchema, keyof TSchema & string>\n\t\t>\n{\n\tprivate readonly nodes: MapEntries<TSchema>;\n\tpublic readonly props: PresenceStates<TSchema>[\"props\"];\n\n\tpublic readonly controls: RequiredBroadcastControl;\n\n\tpublic constructor(\n\t\tprivate readonly runtime: PresenceRuntime,\n\t\tprivate readonly datastore: ValueElementMap<TSchema>,\n\t\tinitialContent: TSchema,\n\t\tcontrolsSettings: BroadcastControlSettings | undefined,\n\t) {\n\t\tthis.controls = new RequiredBroadcastControl(defaultAllowableUpdateLatencyMs);\n\t\tif (controlsSettings?.allowableUpdateLatencyMs !== undefined) {\n\t\t\tthis.controls.allowableUpdateLatencyMs = controlsSettings.allowableUpdateLatencyMs;\n\t\t}\n\n\t\t// Prepare initial map content from initial state\n\t\t{\n\t\t\tconst clientSessionId = this.runtime.clientSessionId;\n\t\t\tlet anyInitialValues = false;\n\t\t\tlet cumulativeAllowableUpdateLatencyMs: number | undefined;\n\t\t\t// eslint-disable-next-line unicorn/no-array-reduce\n\t\t\tconst initial = Object.entries(initialContent).reduce(\n\t\t\t\t(acc, [key, nodeFactory]) => {\n\t\t\t\t\tconst newNodeData = nodeFactory(key, handleFromDatastore(this));\n\t\t\t\t\tacc.nodes[key as keyof TSchema] = newNodeData.manager;\n\t\t\t\t\tif (\"initialData\" in newNodeData) {\n\t\t\t\t\t\tconst { value, allowableUpdateLatencyMs } = newNodeData.initialData;\n\t\t\t\t\t\tacc.datastore[key] = acc.datastore[key] ?? {};\n\t\t\t\t\t\tacc.datastore[key][clientSessionId] = value;\n\t\t\t\t\t\tacc.newValues[key] = value;\n\t\t\t\t\t\tif (allowableUpdateLatencyMs !== undefined) {\n\t\t\t\t\t\t\tcumulativeAllowableUpdateLatencyMs =\n\t\t\t\t\t\t\t\tcumulativeAllowableUpdateLatencyMs === undefined\n\t\t\t\t\t\t\t\t\t? allowableUpdateLatencyMs\n\t\t\t\t\t\t\t\t\t: Math.min(cumulativeAllowableUpdateLatencyMs, allowableUpdateLatencyMs);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanyInitialValues = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\t\tnodes: {} as MapEntries<TSchema>,\n\t\t\t\t\tdatastore,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\t\tnewValues: {} as { [key: string]: InternalTypes.ValueDirectoryOrState<unknown> },\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.nodes = initial.nodes;\n\t\t\t// props is the public view of nodes that limits the entries types to\n\t\t\t// the public interface of the value manager with an additional type\n\t\t\t// filter that beguiles the type system. So just reinterpret cast.\n\t\t\tthis.props = this.nodes as unknown as PresenceStates<TSchema>[\"props\"];\n\n\t\t\tif (anyInitialValues) {\n\t\t\t\tthis.runtime.localUpdate(initial.newValues, {\n\t\t\t\t\tallowableUpdateLatencyMs:\n\t\t\t\t\t\tcumulativeAllowableUpdateLatencyMs ?? this.controls.allowableUpdateLatencyMs,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic knownValues<Key extends keyof TSchema & string>(\n\t\tkey: Key,\n\t): {\n\t\tself: ClientSessionId | undefined;\n\t\tstates: ClientRecord<SchemaElementValueType<TSchema, Key>>;\n\t} {\n\t\treturn {\n\t\t\tself: this.runtime.clientSessionId,\n\t\t\tstates: this.datastore[key],\n\t\t};\n\t}\n\n\tpublic localUpdate<Key extends keyof TSchema & string>(\n\t\tkey: Key,\n\t\tvalue: SchemaElementValueType<TSchema, Key> & ClientUpdateEntry,\n\t\toptions: LocalStateUpdateOptions,\n\t): void {\n\t\tthis.runtime.localUpdate(\n\t\t\t{ [key]: value },\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tallowableUpdateLatencyMs:\n\t\t\t\t\toptions.allowableUpdateLatencyMs ?? this.controls.allowableUpdateLatencyMs,\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic update<Key extends keyof TSchema & string>(\n\t\tkey: Key,\n\t\tclientId: ClientSessionId,\n\t\tvalue: Exclude<MapSchemaElement<TSchema, \"initialData\", Key>, undefined>[\"value\"],\n\t): void {\n\t\tconst allKnownState = this.datastore[key];\n\t\tallKnownState[clientId] = mergeValueDirectory(allKnownState[clientId], value, 0);\n\t}\n\n\tpublic lookupClient(clientId: ClientConnectionId): ISessionClient {\n\t\treturn this.runtime.lookupClient(clientId);\n\t}\n\n\tpublic add<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\t\tTValueManager,\n\t>(\n\t\tkey: TKey,\n\t\tnodeFactory: InternalTypes.ManagerFactory<TKey, TValue, TValueManager>,\n\t): asserts this is PresenceStates<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TValueManager>>\n\t> {\n\t\tassert(!(key in this.nodes), 0xa3c /* Already have entry for key in map */);\n\t\tconst nodeData = nodeFactory(key, handleFromDatastore(this));\n\t\tthis.nodes[key] = nodeData.manager;\n\t\tif (\"initialData\" in nodeData) {\n\t\t\tconst { value, allowableUpdateLatencyMs } = nodeData.initialData;\n\t\t\tif (key in this.datastore) {\n\t\t\t\t// Already have received state from other clients. Kept in `all`.\n\t\t\t\t// TODO: Send current `all` state to state manager.\n\t\t\t} else {\n\t\t\t\tthis.datastore[key] = {};\n\t\t\t}\n\t\t\tthis.datastore[key][this.runtime.clientSessionId] = value;\n\t\t\tthis.runtime.localUpdate(\n\t\t\t\t{ [key]: value },\n\t\t\t\t{\n\t\t\t\t\tallowableUpdateLatencyMs:\n\t\t\t\t\t\tallowableUpdateLatencyMs ?? this.controls.allowableUpdateLatencyMs,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic ensureContent<TSchemaAdditional extends PresenceStatesSchema>(\n\t\tcontent: TSchemaAdditional,\n\t\tcontrols: BroadcastControlSettings | undefined,\n\t): PresenceStates<TSchema & TSchemaAdditional> {\n\t\tif (controls?.allowableUpdateLatencyMs !== undefined) {\n\t\t\tthis.controls.allowableUpdateLatencyMs = controls.allowableUpdateLatencyMs;\n\t\t}\n\t\tfor (const [key, nodeFactory] of Object.entries(content)) {\n\t\t\tif (key in this.nodes) {\n\t\t\t\tconst node = unbrandIVM(this.nodes[key]);\n\t\t\t\tif (!(node instanceof nodeFactory.instanceBase)) {\n\t\t\t\t\tthrow new TypeError(`State \"${key}\" previously created by different value manager.`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.add(key, nodeFactory);\n\t\t\t}\n\t\t}\n\t\treturn this as PresenceStates<TSchema & TSchemaAdditional>;\n\t}\n\n\tpublic processUpdate(\n\t\treceived: number,\n\t\ttimeModifier: number,\n\t\tremoteDatastore: ValueUpdateRecord,\n\t): void {\n\t\tfor (const [key, remoteAllKnownState] of Object.entries(remoteDatastore)) {\n\t\t\tif (key in this.nodes) {\n\t\t\t\tconst node = unbrandIVM(this.nodes[key]);\n\t\t\t\tfor (const [clientSessionId, value] of brandedObjectEntries(remoteAllKnownState)) {\n\t\t\t\t\tconst client = this.runtime.lookupClient(clientSessionId);\n\t\t\t\t\tnode.update(client, received, value);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Assume all broadcast state is meant to be kept even if not currently registered.\n\t\t\t\tmergeUntrackedDatastore(key, remoteAllKnownState, this.datastore, timeModifier);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Create a new PresenceStates using the DataStoreRuntime provided.\n * @param initialContent - The initial value managers to register.\n */\nexport function createPresenceStates<TSchema extends PresenceStatesSchema>(\n\truntime: PresenceRuntime,\n\tdatastore: ValueElementMap<PresenceStatesSchema>,\n\tinitialContent: TSchema,\n\tcontrols: BroadcastControlSettings | undefined,\n): { public: PresenceStates<TSchema>; internal: PresenceStatesInternal } {\n\tconst impl = new PresenceStatesImpl<TSchema>(runtime, datastore, initialContent, controls);\n\n\treturn {\n\t\tpublic: impl,\n\t\tinternal: impl,\n\t};\n}\n"]}
|
package/dist/stateDatastore.d.ts
CHANGED
|
@@ -9,10 +9,20 @@ import type { ClientSessionId, ISessionClient } from "./presence.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
export interface
|
|
12
|
+
export interface LocalStateUpdateOptions {
|
|
13
|
+
allowableUpdateLatencyMs: number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Special option allowed for unicast notifications.
|
|
16
|
+
*/
|
|
17
|
+
targetClientId?: ClientConnectionId;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export interface StateDatastore<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<any>> {
|
|
13
23
|
localUpdate(key: TKey, value: TValue & {
|
|
14
24
|
ignoreUnmonitored?: true;
|
|
15
|
-
},
|
|
25
|
+
}, options: LocalStateUpdateOptions): void;
|
|
16
26
|
update(key: TKey, clientSessionId: ClientSessionId, value: TValue): void;
|
|
17
27
|
knownValues(key: TKey): {
|
|
18
28
|
self: ClientSessionId | undefined;
|
|
@@ -25,7 +35,7 @@ export interface StateDatastore<TKey extends string, TValue extends InternalType
|
|
|
25
35
|
*
|
|
26
36
|
* @internal
|
|
27
37
|
*/
|
|
28
|
-
export declare function handleFromDatastore<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown
|
|
38
|
+
export declare function handleFromDatastore<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>>(datastore: StateDatastore<TKey, TValue>): InternalTypes.StateDatastoreHandle<TKey, Exclude<TValue, undefined>>;
|
|
29
39
|
/**
|
|
30
40
|
* Helper to get the datastore back from its handle.
|
|
31
41
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateDatastore.d.ts","sourceRoot":"","sources":["../src/stateDatastore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAiBrE;;GAEG;AACH,MAAM,WAAW,cAAc,CAC9B,IAAI,SAAS,MAAM,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AC,EAE3D,SAAS,EAAE,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,GACrC,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAKtE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,GAAG,CAAC,EACtD,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAExF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateDatastore.js","sourceRoot":"","sources":["../src/stateDatastore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"stateDatastore.js","sourceRoot":"","sources":["../src/stateDatastore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwDH;;;;GAIG;AACH,SAAgB,mBAAmB,CAOlC,SAAuC;IAEvC,OAAO,SAGN,CAAC;AACH,CAAC;AAbD,kDAaC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAGjC,MAAwD;IACzD,OAAO,MAAiD,CAAC;AAC1D,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ClientRecord } from \"./internalTypes.js\";\nimport type { ClientSessionId, ISessionClient } from \"./presence.js\";\n\n// type StateDatastoreSchemaNode<\n// \tTValue extends InternalTypes.ValueDirectoryOrState<any> = InternalTypes.ValueDirectoryOrState<unknown>,\n// > = TValue extends InternalTypes.ValueDirectoryOrState<infer T> ? InternalTypes.ValueDirectoryOrState<T> : never;\n\n// /**\n// * @internal\n// */\n// export interface StateDatastoreSchema {\n// \t// This type is not precise. It may\n// \t// need to be replaced with PresenceStates schema pattern\n// \t// similar to what is commented out.\n// \t[key: string]: InternalTypes.ValueDirectoryOrState<unknown>;\n// \t// [key: string]: StateDatastoreSchemaNode;\n// }\n\n/**\n * @internal\n */\nexport interface LocalStateUpdateOptions {\n\tallowableUpdateLatencyMs: number | undefined;\n\n\t/**\n\t * Special option allowed for unicast notifications.\n\t */\n\ttargetClientId?: ClientConnectionId;\n}\n\n/**\n * @internal\n */\nexport interface StateDatastore<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n> {\n\tlocalUpdate(\n\t\tkey: TKey,\n\t\tvalue: TValue & {\n\t\t\tignoreUnmonitored?: true;\n\t\t},\n\t\toptions: LocalStateUpdateOptions,\n\t): void;\n\tupdate(key: TKey, clientSessionId: ClientSessionId, value: TValue): void;\n\tknownValues(key: TKey): {\n\t\tself: ClientSessionId | undefined;\n\t\tstates: ClientRecord<TValue>;\n\t};\n\tlookupClient(clientId: ClientConnectionId): ISessionClient;\n}\n\n/**\n * Helper to get a handle from a datastore.\n *\n * @internal\n */\nexport function handleFromDatastore<\n\t// Constraining TSchema would be great, but it seems nested types (at least with undefined) cause trouble.\n\t// TSchema as `unknown` still provides some type safety.\n\t// TSchema extends StateDatastoreSchema,\n\tTKey extends string /* & keyof TSchema */,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n>(\n\tdatastore: StateDatastore<TKey, TValue>,\n): InternalTypes.StateDatastoreHandle<TKey, Exclude<TValue, undefined>> {\n\treturn datastore as unknown as InternalTypes.StateDatastoreHandle<\n\t\tTKey,\n\t\tExclude<TValue, undefined>\n\t>;\n}\n\n/**\n * Helper to get the datastore back from its handle.\n *\n * @internal\n */\nexport function datastoreFromHandle<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n>(handle: InternalTypes.StateDatastoreHandle<TKey, TValue>): StateDatastore<TKey, TValue> {\n\treturn handle as unknown as StateDatastore<TKey, TValue>;\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import type { BroadcastControls } from "./broadcastControls.js";
|
|
5
6
|
import type { NotificationsManager } from "./notificationsManager.js";
|
|
6
7
|
import type { InternalTypes } from "@fluidframework/presence/internal/exposedInternalTypes";
|
|
7
8
|
/**
|
|
@@ -22,11 +23,11 @@ import type { InternalTypes } from "@fluidframework/presence/internal/exposedInt
|
|
|
22
23
|
*/
|
|
23
24
|
export type PresenceWorkspaceAddress = `${string}:${string}`;
|
|
24
25
|
/**
|
|
25
|
-
* Single entry in {@link PresenceStatesSchema}.
|
|
26
|
+
* Single entry in {@link PresenceStatesSchema} or {@link PresenceNotificationsSchema}.
|
|
26
27
|
*
|
|
27
28
|
* @alpha
|
|
28
29
|
*/
|
|
29
|
-
export type
|
|
30
|
+
export type PresenceWorkspaceEntry<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>, TManager = unknown> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;
|
|
30
31
|
/**
|
|
31
32
|
* Schema for a {@link PresenceStates} workspace.
|
|
32
33
|
*
|
|
@@ -35,7 +36,7 @@ export type PresenceStatesEntry<TKey extends string, TValue extends InternalType
|
|
|
35
36
|
* @alpha
|
|
36
37
|
*/
|
|
37
38
|
export interface PresenceStatesSchema {
|
|
38
|
-
[key: string]:
|
|
39
|
+
[key: string]: PresenceWorkspaceEntry<typeof key, InternalTypes.ValueDirectoryOrState<any>>;
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* Map of `Value Manager`s registered with {@link PresenceStates}.
|
|
@@ -62,7 +63,7 @@ export type PresenceStatesEntries<TSchema extends PresenceStatesSchema> = {
|
|
|
62
63
|
export interface PresenceStates<TSchema extends PresenceStatesSchema, TManagerConstraints = unknown> {
|
|
63
64
|
/**
|
|
64
65
|
* Registers a new `Value Manager` with the {@link PresenceStates}.
|
|
65
|
-
* @param key - new unique key for the `Value Manager`
|
|
66
|
+
* @param key - new unique key for the `Value Manager` within the workspace
|
|
66
67
|
* @param manager - factory for creating a `Value Manager`
|
|
67
68
|
*/
|
|
68
69
|
add<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<any>, TManager extends TManagerConstraints>(key: TKey, manager: InternalTypes.ManagerFactory<TKey, TValue, TManager>): asserts this is PresenceStates<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>, TManagerConstraints>;
|
|
@@ -70,6 +71,10 @@ export interface PresenceStates<TSchema extends PresenceStatesSchema, TManagerCo
|
|
|
70
71
|
* Registry of `Value Manager`s.
|
|
71
72
|
*/
|
|
72
73
|
readonly props: PresenceStatesEntries<TSchema>;
|
|
74
|
+
/**
|
|
75
|
+
* Default controls for management of broadcast updates.
|
|
76
|
+
*/
|
|
77
|
+
readonly controls: BroadcastControls;
|
|
73
78
|
}
|
|
74
79
|
/**
|
|
75
80
|
* Schema for a {@link PresenceNotifications} workspace.
|
|
@@ -85,8 +90,25 @@ export interface PresenceNotificationsSchema {
|
|
|
85
90
|
* `PresenceNotifications` maintains a registry of {@link NotificationsManager}s
|
|
86
91
|
* that facilitate messages across client members in a session.
|
|
87
92
|
*
|
|
93
|
+
* @privateRemarks
|
|
94
|
+
* This should be kept mostly in sync with {@link PresenceStates}. Notably the
|
|
95
|
+
* return type of `add` is limited here and the `controls` property is omitted.
|
|
96
|
+
* The `PresenceStatesImpl` class implements `PresenceStates` and therefore
|
|
97
|
+
* `PresenceNotifications`, so long as this is proper subset.
|
|
98
|
+
*
|
|
88
99
|
* @sealed
|
|
89
100
|
* @alpha
|
|
90
101
|
*/
|
|
91
|
-
export
|
|
102
|
+
export interface PresenceNotifications<TSchema extends PresenceNotificationsSchema> {
|
|
103
|
+
/**
|
|
104
|
+
* Registers a new `Value Manager` with the {@link PresenceNotifications}.
|
|
105
|
+
* @param key - new unique key for the `Value Manager` within the workspace
|
|
106
|
+
* @param manager - factory for creating a `Value Manager`
|
|
107
|
+
*/
|
|
108
|
+
add<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<any>, TManager extends NotificationsManager<any>>(key: TKey, manager: InternalTypes.ManagerFactory<TKey, TValue, TManager>): asserts this is PresenceNotifications<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>>;
|
|
109
|
+
/**
|
|
110
|
+
* Registry of `Value Manager`s.
|
|
111
|
+
*/
|
|
112
|
+
readonly props: PresenceStatesEntries<TSchema>;
|
|
113
|
+
}
|
|
92
114
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,wBAAwB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,wBAAwB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,CACjC,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAq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;;;GAMG;AACH,MAAM,WAAW,2BAA2B;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC,cAAc,CAC1C,OAAO,GAAG,EACV,aAAa,CAAC,kBAAkB,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAChE,oBAAoB,CAAC,GAAG,CAAC,CACzB,CAAC;CACF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,qBAAqB,CAAC,OAAO,SAAS,2BAA2B;IACjF;;;;OAIG;IACH,GAAG,CACF,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,GAAG,CAAC,EACvD,QAAQ,SAAS,oBAAoB,CAAC,GAAG,CAAC,EAE1C,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,GAC3D,OAAO,CAAC,IAAI,IAAI,qBAAqB,CACvC,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAC5E,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;CAC/C"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAmKH,mCAAmC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { BroadcastControls } from \"./broadcastControls.js\";\nimport type { NotificationsManager } from \"./notificationsManager.js\";\n\nimport type { InternalTypes } from \"@fluidframework/presence/internal/exposedInternalTypes\";\n\n/**\n * Unique address within a session.\n *\n * @remarks\n * A string known to all clients working with a certain Workspace and unique\n * among Workspaces. Recommend using specifying concatenation of: type of\n * unique identifier, `:` (required), and unique identifier.\n *\n * @example Examples\n * ```typescript\n * \"guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1\"\n * \"address:object0/sub-object2:pointers\"\n * ```\n *\n * @alpha\n */\nexport type PresenceWorkspaceAddress = `${string}:${string}`;\n\n/**\n * Single entry in {@link PresenceStatesSchema} or {@link PresenceNotificationsSchema}.\n *\n * @alpha\n */\nexport type PresenceWorkspaceEntry<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\tTManager = unknown,\n> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;\n\n// #region PresenceStates\n\n/**\n * Schema for a {@link PresenceStates} workspace.\n *\n * Keys of schema are the keys of the {@link PresenceStates} providing access to `Value Manager`s.\n *\n * @alpha\n */\nexport interface PresenceStatesSchema {\n\t[key: string]: PresenceWorkspaceEntry<typeof key, InternalTypes.ValueDirectoryOrState<any>>;\n}\n\n/**\n * Map of `Value Manager`s registered with {@link PresenceStates}.\n *\n * @sealed\n * @alpha\n */\nexport type PresenceStatesEntries<TSchema extends PresenceStatesSchema> = {\n\t/**\n\t * Registered `Value Manager`s\n\t */\n\treadonly [Key in keyof TSchema]: ReturnType<\n\t\tTSchema[Key]\n\t>[\"manager\"] extends InternalTypes.StateValue<infer TManager>\n\t\t? TManager\n\t\t: never;\n};\n\n/**\n * `PresenceStates` maintains a registry of `Value Manager`s that all share and provide access to\n * presence state values across client members in a session.\n *\n * `Value Manager`s offer variations on how to manage states, but all share same principle that\n * each client's state is independent and may only be updated by originating client.\n *\n * @sealed\n * @alpha\n */\nexport interface PresenceStates<\n\tTSchema extends PresenceStatesSchema,\n\tTManagerConstraints = unknown,\n> {\n\t/**\n\t * Registers a new `Value Manager` with the {@link PresenceStates}.\n\t * @param key - new unique key for the `Value Manager` within the workspace\n\t * @param manager - factory for creating a `Value Manager`\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n\t\tTManager extends TManagerConstraints,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is PresenceStates<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>,\n\t\tTManagerConstraints\n\t>;\n\n\t/**\n\t * Registry of `Value Manager`s.\n\t */\n\treadonly props: PresenceStatesEntries<TSchema>;\n\n\t/**\n\t * Default controls for management of broadcast updates.\n\t */\n\treadonly controls: BroadcastControls;\n}\n\n// #endregion PresenceStates\n\n// #region PresenceNotifications\n\n/**\n * Schema for a {@link PresenceNotifications} workspace.\n *\n * Keys of schema are the keys of the {@link PresenceNotifications} providing access to {@link NotificationsManager}s.\n *\n * @alpha\n */\nexport interface PresenceNotificationsSchema {\n\t[key: string]: InternalTypes.ManagerFactory<\n\t\ttypeof key,\n\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>,\n\t\tNotificationsManager<any>\n\t>;\n}\n\n/**\n * `PresenceNotifications` maintains a registry of {@link NotificationsManager}s\n * that facilitate messages across client members in a session.\n *\n * @privateRemarks\n * This should be kept mostly in sync with {@link PresenceStates}. Notably the\n * return type of `add` is limited here and the `controls` property is omitted.\n * The `PresenceStatesImpl` class implements `PresenceStates` and therefore\n * `PresenceNotifications`, so long as this is proper subset.\n *\n * @sealed\n * @alpha\n */\nexport interface PresenceNotifications<TSchema extends PresenceNotificationsSchema> {\n\t/**\n\t * Registers a new `Value Manager` with the {@link PresenceNotifications}.\n\t * @param key - new unique key for the `Value Manager` within the workspace\n\t * @param manager - factory for creating a `Value Manager`\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n\t\tTManager extends NotificationsManager<any>,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is PresenceNotifications<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>\n\t>;\n\n\t/**\n\t * Registry of `Value Manager`s.\n\t */\n\treadonly props: PresenceStatesEntries<TSchema>;\n}\n\n// #endregion PresenceNotifications\n"]}
|
package/lib/alpha.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Package for client presence within a connected session.
|
|
13
13
|
*
|
|
14
14
|
* See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.
|
|
15
15
|
*
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
export {
|
|
20
20
|
// @alpha APIs
|
|
21
|
+
BroadcastControlSettings,
|
|
22
|
+
BroadcastControls,
|
|
21
23
|
ClientConnectionId,
|
|
22
24
|
ClientSessionId,
|
|
23
25
|
ExperimentalPresenceDO,
|
|
@@ -32,7 +34,6 @@ export {
|
|
|
32
34
|
LatestMapValueManager,
|
|
33
35
|
LatestMapValueManagerEvents,
|
|
34
36
|
LatestValueClientData,
|
|
35
|
-
LatestValueControls,
|
|
36
37
|
LatestValueData,
|
|
37
38
|
LatestValueManager,
|
|
38
39
|
LatestValueManagerEvents,
|
|
@@ -48,9 +49,9 @@ export {
|
|
|
48
49
|
PresenceNotificationsSchema,
|
|
49
50
|
PresenceStates,
|
|
50
51
|
PresenceStatesEntries,
|
|
51
|
-
PresenceStatesEntry,
|
|
52
52
|
PresenceStatesSchema,
|
|
53
53
|
PresenceWorkspaceAddress,
|
|
54
|
+
PresenceWorkspaceEntry,
|
|
54
55
|
SessionClientStatus,
|
|
55
56
|
ValueMap,
|
|
56
57
|
acquirePresence,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Common controls for Value Managers.
|
|
7
|
+
*
|
|
8
|
+
* @sealed
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export interface BroadcastControls {
|
|
12
|
+
/**
|
|
13
|
+
* Maximum time in milliseconds that a local value update is allowed
|
|
14
|
+
* to remain pending before it must be broadcast.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* There is no guarantee of broadcast within time allowed
|
|
18
|
+
* as other conditions such as disconnect or service throttling may
|
|
19
|
+
* cause a delay.
|
|
20
|
+
*
|
|
21
|
+
* Setting to `undefined` will restore to a system default.
|
|
22
|
+
*/
|
|
23
|
+
allowableUpdateLatencyMs: number | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Value set to configure {@link BroadcastControls}.
|
|
27
|
+
*
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export interface BroadcastControlSettings {
|
|
31
|
+
/**
|
|
32
|
+
* {@inheritdoc BroadcastControls.allowableUpdateLatencyMs}
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue 60 [milliseconds]
|
|
35
|
+
*/
|
|
36
|
+
readonly allowableUpdateLatencyMs?: number;
|
|
37
|
+
}
|
|
38
|
+
declare class ForcedRefreshControl implements Pick<BroadcastControls & {
|
|
39
|
+
forcedRefreshIntervalMs: number | undefined;
|
|
40
|
+
}, "forcedRefreshIntervalMs"> {
|
|
41
|
+
private _forcedRefreshInterval;
|
|
42
|
+
constructor(settings?: BroadcastControlSettings);
|
|
43
|
+
get forcedRefreshIntervalMs(): number | undefined;
|
|
44
|
+
set forcedRefreshIntervalMs(value: number | undefined);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare class OptionalBroadcastControl extends ForcedRefreshControl implements BroadcastControls {
|
|
50
|
+
allowableUpdateLatencyMs: number | undefined;
|
|
51
|
+
constructor(settings?: BroadcastControlSettings);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Implements {@link BroadcastControls} but always provides defined value for
|
|
55
|
+
* {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}.
|
|
56
|
+
*
|
|
57
|
+
* If {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}
|
|
58
|
+
* is set to `undefined`, the default will be restored.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare class RequiredBroadcastControl extends ForcedRefreshControl implements BroadcastControls {
|
|
63
|
+
private readonly defaultAllowableUpdateLatencyMs;
|
|
64
|
+
private _allowableUpdateLatencyMs;
|
|
65
|
+
constructor(defaultAllowableUpdateLatencyMs: number);
|
|
66
|
+
get allowableUpdateLatencyMs(): number;
|
|
67
|
+
set allowableUpdateLatencyMs(value: number | undefined);
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=broadcastControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcastControls.d.ts","sourceRoot":"","sources":["../src/broadcastControls.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;;OAUG;IACH,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;CAc7C;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;;OAIG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CAS3C;AAED,cAAM,oBACL,YACC,IAAI,CACH,iBAAiB,GAAG;IAAE,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EACnE,yBAAyB,CACzB;IAEF,OAAO,CAAC,sBAAsB,CAAqB;gBAEhC,QAAQ,CAAC,EAAE,wBAAwB;IAItD,IAAW,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAEvD;IACD,IAAW,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAU3D;CACD;AAED;;GAEG;AACH,qBAAa,wBACZ,SAAQ,oBACR,YAAW,iBAAiB;IAErB,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEjC,QAAQ,CAAC,EAAE,wBAAwB;CAItD;AAED;;;;;;;;GAQG;AACH,qBAAa,wBACZ,SAAQ,oBACR,YAAW,iBAAiB;IAIT,OAAO,CAAC,QAAQ,CAAC,+BAA+B;IAFnE,OAAO,CAAC,yBAAyB,CAAS;gBAEN,+BAA+B,EAAE,MAAM;IAK3E,IAAW,wBAAwB,IAAI,MAAM,CAE5C;IACD,IAAW,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAE5D;CACD"}
|