@soundworks/core 4.0.0-alpha.9 → 5.0.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/CHANGELOG.md +102 -0
- package/README.md +14 -29
- package/package.json +24 -42
- package/src/client/Client.js +306 -256
- package/src/client/{Context.js → ClientContext.js} +63 -54
- package/src/client/ClientContextManager.js +115 -0
- package/src/client/{Plugin.js → ClientPlugin.js} +23 -19
- package/src/client/{PluginManager.js → ClientPluginManager.js} +43 -40
- package/src/client/ClientSocket.js +270 -0
- package/src/client/{StateManager.js → ClientStateManager.js} +13 -13
- package/src/client/index.js +36 -39
- package/src/common/BasePlugin.js +63 -58
- package/src/common/BasePluginManager.js +191 -142
- package/src/common/BaseStateManager.js +635 -145
- package/src/common/BatchedTransport.js +73 -0
- package/src/common/ParameterBag.js +90 -93
- package/src/common/PromiseStore.js +54 -0
- package/src/common/SharedState.js +821 -0
- package/src/common/SharedStateCollection.js +492 -0
- package/src/common/constants.js +14 -2
- package/src/common/logger.js +64 -68
- package/src/common/shared-state-types.js +82 -0
- package/src/common/sockets-utils.js +0 -64
- package/src/common/version.js +2 -0
- package/src/server/Server.js +552 -824
- package/src/server/ServerClient.js +74 -0
- package/src/server/{Context.js → ServerContext.js} +96 -77
- package/src/server/{ContextManager.js → ServerContextManager.js} +107 -87
- package/src/server/{Plugin.js → ServerPlugin.js} +30 -32
- package/src/server/ServerPluginManager.js +177 -0
- package/src/server/ServerSocket.js +256 -0
- package/src/server/ServerSockets.js +150 -0
- package/src/server/ServerStateManager.js +706 -0
- package/src/server/SharedStatePrivate.js +277 -0
- package/src/server/audit-network-latency.worker.js +19 -4
- package/src/server/{audit-schema.js → audit-state-class-description.js} +3 -2
- package/src/server/create-http-server.js +127 -0
- package/src/server/crypto.js +8 -7
- package/src/server/index.js +60 -17
- package/types/client/Client.d.ts +95 -70
- package/types/client/{Context.d.ts → ClientContext.d.ts} +59 -34
- package/types/client/{ContextManager.d.ts → ClientContextManager.d.ts} +19 -22
- package/types/client/ClientPlugin.d.ts +51 -0
- package/types/client/ClientPluginManager.d.ts +112 -0
- package/types/client/ClientSocket.d.ts +76 -0
- package/types/client/{StateManager.d.ts → ClientStateManager.d.ts} +18 -21
- package/types/client/index.d.ts +33 -6
- package/types/common/BasePlugin.d.ts +64 -53
- package/types/common/BasePluginManager.d.ts +84 -39
- package/types/common/BaseStateManager.d.ts +227 -49
- package/types/common/BatchedTransport.d.ts +17 -0
- package/types/common/ParameterBag.d.ts +73 -76
- package/types/common/PromiseStore.d.ts +11 -0
- package/types/common/SharedState.d.ts +291 -0
- package/types/common/SharedStateCollection.d.ts +311 -0
- package/types/common/constants.d.ts +10 -3
- package/types/common/logger.d.ts +8 -6
- package/types/common/shared-state-types.d.ts +95 -0
- package/types/common/sockets-utils.d.ts +0 -5
- package/types/common/version.d.ts +2 -0
- package/types/server/Server.d.ts +215 -136
- package/types/server/ServerClient.d.ts +45 -0
- package/types/server/ServerContext.d.ts +209 -0
- package/types/server/ServerContextManager.d.ts +75 -0
- package/types/server/ServerPlugin.d.ts +57 -0
- package/types/server/ServerPluginManager.d.ts +115 -0
- package/types/server/ServerSocket.d.ts +69 -0
- package/types/server/ServerSockets.d.ts +42 -0
- package/types/server/ServerStateManager.d.ts +284 -0
- package/types/server/SharedStatePrivate.d.ts +23 -0
- package/types/server/audit-network-latency.worker.d.ts +2 -2
- package/types/server/{audit-schema.d.ts → audit-state-class-description.d.ts} +8 -9
- package/types/server/create-http-server.d.ts +5 -0
- package/types/server/crypto.d.ts +4 -0
- package/types/server/index.d.ts +51 -3
- package/.eslintrc +0 -15
- package/.github/workflows/gh-pages.yml +0 -31
- package/.github/workflows/unit-tests.yml +0 -18
- package/src/client/ContextManager.js +0 -111
- package/src/client/SharedState.js +0 -84
- package/src/client/SharedStateCollection.js +0 -35
- package/src/client/Socket.js +0 -402
- package/src/common/BaseSharedState.js +0 -583
- package/src/common/BaseSharedStateCollection.js +0 -179
- package/src/common/SharedStatePrivate.js +0 -192
- package/src/common/promise-store.js +0 -25
- package/src/server/Client.js +0 -55
- package/src/server/PluginManager.js +0 -170
- package/src/server/SharedState.js +0 -85
- package/src/server/SharedStateCollection.js +0 -36
- package/src/server/Socket.js +0 -396
- package/src/server/Sockets.js +0 -224
- package/src/server/StateManager.js +0 -620
- package/tsconfig.json +0 -21
- package/types/client/Client.d.ts.map +0 -1
- package/types/client/Context.d.ts.map +0 -1
- package/types/client/ContextManager.d.ts.map +0 -1
- package/types/client/Plugin.d.ts +0 -53
- package/types/client/Plugin.d.ts.map +0 -1
- package/types/client/PluginManager.d.ts +0 -96
- package/types/client/PluginManager.d.ts.map +0 -1
- package/types/client/SharedState.d.ts +0 -85
- package/types/client/SharedState.d.ts.map +0 -1
- package/types/client/Socket.d.ts +0 -138
- package/types/client/Socket.d.ts.map +0 -1
- package/types/client/StateManager.d.ts.map +0 -1
- package/types/client/index.d.ts.map +0 -1
- package/types/common/BasePlugin.d.ts.map +0 -1
- package/types/common/BasePluginManager.d.ts.map +0 -1
- package/types/common/BaseSharedState.d.ts +0 -173
- package/types/common/BaseSharedState.d.ts.map +0 -1
- package/types/common/BaseStateManager.d.ts.map +0 -1
- package/types/common/ParameterBag.d.ts.map +0 -1
- package/types/common/SharedStatePrivate.d.ts +0 -20
- package/types/common/SharedStatePrivate.d.ts.map +0 -1
- package/types/common/constants.d.ts.map +0 -1
- package/types/common/logger.d.ts.map +0 -1
- package/types/common/promise-store.d.ts +0 -4
- package/types/common/promise-store.d.ts.map +0 -1
- package/types/common/sockets-utils.d.ts.map +0 -1
- package/types/common/utils.d.ts +0 -5
- package/types/common/utils.d.ts.map +0 -1
- package/types/server/Client.d.ts +0 -40
- package/types/server/Client.d.ts.map +0 -1
- package/types/server/Context.d.ts +0 -59
- package/types/server/Context.d.ts.map +0 -1
- package/types/server/ContextManager.d.ts +0 -69
- package/types/server/ContextManager.d.ts.map +0 -1
- package/types/server/Plugin.d.ts +0 -70
- package/types/server/Plugin.d.ts.map +0 -1
- package/types/server/PluginManager.d.ts +0 -91
- package/types/server/PluginManager.d.ts.map +0 -1
- package/types/server/Server.d.ts.map +0 -1
- package/types/server/SharedState.d.ts +0 -86
- package/types/server/SharedState.d.ts.map +0 -1
- package/types/server/Socket.d.ts +0 -128
- package/types/server/Socket.d.ts.map +0 -1
- package/types/server/Sockets.d.ts +0 -73
- package/types/server/Sockets.d.ts.map +0 -1
- package/types/server/StateManager.d.ts +0 -190
- package/types/server/StateManager.d.ts.map +0 -1
- package/types/server/audit-network-latency.worker.d.ts.map +0 -1
- package/types/server/audit-schema.d.ts.map +0 -1
- package/types/server/index.d.ts.map +0 -1
|
@@ -1,70 +1,248 @@
|
|
|
1
|
+
export const kStateManagerInit: unique symbol;
|
|
2
|
+
export const kStateManagerDeleteState: unique symbol;
|
|
3
|
+
export const kStateManagerClient: unique symbol;
|
|
1
4
|
export default BaseStateManager;
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
6
|
+
* Callback executed when a state is created on the network.
|
|
4
7
|
*/
|
|
8
|
+
export type stateManagerObserveCallback = () => any;
|
|
9
|
+
/**
|
|
10
|
+
* Callback to execute in order to remove a {@link stateManagerObserveCallback}
|
|
11
|
+
* from the list of observer.
|
|
12
|
+
*/
|
|
13
|
+
export type stateManagerDeleteObserveCallback = () => any;
|
|
14
|
+
/**
|
|
15
|
+
* Callback executed when a state is created on the network.
|
|
16
|
+
*
|
|
17
|
+
* @callback stateManagerObserveCallback
|
|
18
|
+
* @async
|
|
19
|
+
* @param {string} className - name of the class
|
|
20
|
+
* @param {number} stateId - id of the state
|
|
21
|
+
* @param {number} nodeId - id of the node that created the state
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Callback to execute in order to remove a {@link stateManagerObserveCallback}
|
|
25
|
+
* from the list of observer.
|
|
26
|
+
*
|
|
27
|
+
* @callback stateManagerDeleteObserveCallback
|
|
28
|
+
*/
|
|
29
|
+
/** @private */
|
|
5
30
|
declare class BaseStateManager {
|
|
6
31
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
32
|
+
* Return a class description from a given class name
|
|
33
|
+
*
|
|
34
|
+
* @param {SharedStateClassName} className - Name of the shared state class.
|
|
35
|
+
* (cf. ServerStateManager)
|
|
36
|
+
* @return {SharedStateClassDescription}
|
|
37
|
+
* @example
|
|
38
|
+
* const classDescription = await client.stateManager.getClassDescription('my-class');
|
|
10
39
|
*/
|
|
11
|
-
|
|
12
|
-
client: {
|
|
13
|
-
id: number;
|
|
14
|
-
transport: any;
|
|
15
|
-
};
|
|
16
|
-
_statesById: Map<any, any>;
|
|
17
|
-
_observeListeners: Set<any>;
|
|
18
|
-
_cachedSchemas: Map<any, any>;
|
|
19
|
-
_observeRequestCallbacks: Map<any, any>;
|
|
40
|
+
getClassDescription(className: SharedStateClassName): SharedStateClassDescription;
|
|
20
41
|
/**
|
|
21
|
-
*
|
|
42
|
+
* @deprecated Use {@link BaseStateManager#getClassDescription} instead.
|
|
43
|
+
*/
|
|
44
|
+
getSchema(className: any): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a {@link SharedState} instance from a registered class.
|
|
22
47
|
*
|
|
23
|
-
* @param {
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
* @returns {client.SharedState|server.SharedState}
|
|
27
|
-
* @see {@link client.SharedState}
|
|
28
|
-
* @see {@link server.SharedState}
|
|
48
|
+
* @param {SharedStateClassName} className - Name of the class.
|
|
49
|
+
* @param {Object.<string, any>} [initValues={}] - Default values of the created shared state.
|
|
50
|
+
* @returns {Promise<SharedState>}
|
|
29
51
|
* @example
|
|
30
|
-
* const state = await client.stateManager.create('my-
|
|
52
|
+
* const state = await client.stateManager.create('my-class');
|
|
31
53
|
*/
|
|
32
|
-
create(
|
|
54
|
+
create(className: SharedStateClassName, initValues?: {
|
|
55
|
+
[x: string]: any;
|
|
56
|
+
}): Promise<SharedState>;
|
|
33
57
|
/**
|
|
34
|
-
* Attach to an existing
|
|
58
|
+
* Attach to an existing {@link SharedState} instance.
|
|
59
|
+
*
|
|
60
|
+
* @overload
|
|
61
|
+
* @param {SharedStateClassName} className - Name of the class.
|
|
62
|
+
* @returns {Promise<SharedState>}
|
|
35
63
|
*
|
|
36
|
-
* @param {String} schemaName - Name of the schema as given on registration
|
|
37
|
-
* (cf. ServerStateManager)
|
|
38
|
-
* @param {Object} [stateId=null] - Id of the state to attach to. If `null`,
|
|
39
|
-
* attach to the first state found with the given schema name (usefull for
|
|
40
|
-
* globally shared states owned by the server).
|
|
41
|
-
* @returns {client.SharedState|server.SharedState}
|
|
42
|
-
* @see {@link client.SharedState}
|
|
43
|
-
* @see {@link server.SharedState}
|
|
44
64
|
* @example
|
|
45
|
-
* const state = await client.stateManager.attach('my-
|
|
65
|
+
* const state = await client.stateManager.attach('my-class');
|
|
46
66
|
*/
|
|
47
|
-
attach(
|
|
67
|
+
attach(className: SharedStateClassName): Promise<SharedState>;
|
|
48
68
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
69
|
+
* Attach to an existing {@link SharedState} instance.
|
|
70
|
+
*
|
|
71
|
+
* @overload
|
|
72
|
+
* @param {SharedStateClassName} className - Name of the class.
|
|
73
|
+
* @param {number} stateId - Id of the state
|
|
74
|
+
* @returns {Promise<SharedState>}
|
|
53
75
|
*
|
|
54
|
-
* @todo Optionnal schema name
|
|
55
|
-
* @param {server.StateManager~ObserveCallback|client.StateManager~ObserveCallback}
|
|
56
|
-
* callback - Function to be called when a new state is created on the network.
|
|
57
|
-
* @returns {Promise<Function>} - Return a Promise that resolves when the callback
|
|
58
|
-
* as been executed for the first time. The promise value is a function which
|
|
59
|
-
* allows to stop observing the network.
|
|
60
76
|
* @example
|
|
61
|
-
* client.stateManager.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
* const state = await client.stateManager.attach('my-class', stateId);
|
|
78
|
+
*/
|
|
79
|
+
attach(className: SharedStateClassName, stateId: number): Promise<SharedState>;
|
|
80
|
+
/**
|
|
81
|
+
* Attach to an existing {@link SharedState} instance.
|
|
82
|
+
*
|
|
83
|
+
* @overload
|
|
84
|
+
* @param {SharedStateClassName} className - Name of the class.
|
|
85
|
+
* @param {string[]} filter - List of parameters of interest
|
|
86
|
+
* @returns {Promise<SharedState>}
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* const state = await client.stateManager.attach('my-class', ['some-param']);
|
|
90
|
+
*/
|
|
91
|
+
attach(className: SharedStateClassName, filter: string[]): Promise<SharedState>;
|
|
92
|
+
/**
|
|
93
|
+
* Attach to an existing {@link SharedState} instance.
|
|
94
|
+
*
|
|
95
|
+
* @overload
|
|
96
|
+
* @param {SharedStateClassName} className - Name of the class.
|
|
97
|
+
* @param {number} stateId - Id of the state
|
|
98
|
+
* @param {string[]} filter - List of parameters of interest
|
|
99
|
+
* @returns {Promise<SharedState>}
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* const state = await client.stateManager.attach('my-class', stateId, ['some-param']);
|
|
103
|
+
*/
|
|
104
|
+
attach(className: SharedStateClassName, stateId: number, filter: string[]): Promise<SharedState>;
|
|
105
|
+
/**
|
|
106
|
+
* Observe all the {@link SharedState} instances that are created on the network.
|
|
107
|
+
*
|
|
108
|
+
* @overload
|
|
109
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
110
|
+
* new {@link SharedState} is created on the network.
|
|
111
|
+
* @example
|
|
112
|
+
* client.stateManager.observe(async (className, stateId) => {
|
|
113
|
+
* if (className === 'my-shared-state-class') {
|
|
114
|
+
* const attached = await client.stateManager.attach(className, stateId);
|
|
65
115
|
* }
|
|
66
116
|
* });
|
|
67
117
|
*/
|
|
68
|
-
observe(callback:
|
|
118
|
+
observe(callback: stateManagerObserveCallback): any;
|
|
119
|
+
/**
|
|
120
|
+
* Observe all the {@link SharedState} instances of given {@link SharedStateClassName}
|
|
121
|
+
* that are created on the network.
|
|
122
|
+
*
|
|
123
|
+
* @overload
|
|
124
|
+
* @param {SharedStateClassName} className - Observe only ${@link SharedState}
|
|
125
|
+
* of given name.
|
|
126
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
127
|
+
* new {@link SharedState} is created on the network.
|
|
128
|
+
* @example
|
|
129
|
+
* client.stateManager.observe('my-shared-state-class', async (className, stateId) => {
|
|
130
|
+
* const attached = await client.stateManager.attach(className, stateId);
|
|
131
|
+
* });
|
|
132
|
+
*/
|
|
133
|
+
observe(className: SharedStateClassName, callback: stateManagerObserveCallback): any;
|
|
134
|
+
/**
|
|
135
|
+
* Observe all the {@link SharedState} instances of given excluding the ones
|
|
136
|
+
* created by the current node.
|
|
137
|
+
*
|
|
138
|
+
* @overload
|
|
139
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
140
|
+
* new {@link SharedState} is created on the network.
|
|
141
|
+
* @param {object} options - Options.
|
|
142
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
143
|
+
* created by the same node from the collection.
|
|
144
|
+
* @example
|
|
145
|
+
* client.stateManager.observe(async (className, stateId) => {
|
|
146
|
+
* if (className === 'my-shared-state-class') {
|
|
147
|
+
* const attached = await client.stateManager.attach(className, stateId);
|
|
148
|
+
* }
|
|
149
|
+
* }, { excludeLocal: true });
|
|
150
|
+
*/
|
|
151
|
+
observe(callback: stateManagerObserveCallback, options: {
|
|
152
|
+
excludeLocal: boolean;
|
|
153
|
+
}): any;
|
|
154
|
+
/**
|
|
155
|
+
* Observe all the {@link SharedState} instances of given {@link SharedStateClassName}
|
|
156
|
+
* that are created on the network, excluding the ones created by the current node.
|
|
157
|
+
*
|
|
158
|
+
* @overload
|
|
159
|
+
* @param {SharedStateClassName} className - Observe only ${@link SharedState}
|
|
160
|
+
* of given name.
|
|
161
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
162
|
+
* new {@link SharedState} is created on the network.
|
|
163
|
+
* @param {object} options - Options.
|
|
164
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
165
|
+
* created by the same node from the collection.
|
|
166
|
+
* @example
|
|
167
|
+
* client.stateManager.observe('my-shared-state-class', async (className, stateId) => {
|
|
168
|
+
* const attached = await client.stateManager.attach(className, stateId);
|
|
169
|
+
* }, { excludeLocal: true });
|
|
170
|
+
*/
|
|
171
|
+
observe(className: SharedStateClassName, callback: stateManagerObserveCallback, options: {
|
|
172
|
+
excludeLocal: boolean;
|
|
173
|
+
}): any;
|
|
174
|
+
/**
|
|
175
|
+
* Returns a collection of all the states created from a given shared state class.
|
|
176
|
+
*
|
|
177
|
+
* @overload
|
|
178
|
+
* @param {SharedStateClassName} className - Name of the shared state class.
|
|
179
|
+
* @returns {Promise<SharedStateCollection>}
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* const collection = await client.stateManager.getCollection(className);
|
|
183
|
+
*/
|
|
184
|
+
getCollection(className: SharedStateClassName): Promise<SharedStateCollection>;
|
|
185
|
+
/**
|
|
186
|
+
* Returns a collection of all the states created from a given shared state class.
|
|
187
|
+
*
|
|
188
|
+
* @overload
|
|
189
|
+
* @param {SharedStateClassName} className - Name of the shared state class.
|
|
190
|
+
* @param {SharedStateParameterName[]} filter - Filter parameter of interest for each
|
|
191
|
+
* state of the collection.
|
|
192
|
+
* @returns {Promise<SharedStateCollection>}
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* const collection = await client.stateManager.getCollection(className, ['my-param']);
|
|
196
|
+
*/
|
|
197
|
+
getCollection(className: SharedStateClassName, filter: SharedStateParameterName[]): Promise<SharedStateCollection>;
|
|
198
|
+
/**
|
|
199
|
+
* Returns a collection of all the states created from a given shared state class.
|
|
200
|
+
*
|
|
201
|
+
* @overload
|
|
202
|
+
* @param {SharedStateClassName} className - Name of the shared state class.
|
|
203
|
+
* @param {object} options - Options.
|
|
204
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
205
|
+
* created by the same node from the collection.
|
|
206
|
+
* @returns {Promise<SharedStateCollection>}
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* const collection = await client.stateManager.getCollection(className, { excludeLocal: true });
|
|
210
|
+
*/
|
|
211
|
+
getCollection(className: SharedStateClassName, options: {
|
|
212
|
+
excludeLocal: boolean;
|
|
213
|
+
}): Promise<SharedStateCollection>;
|
|
214
|
+
/**
|
|
215
|
+
* Returns a collection of all the states created from a given shared state class.
|
|
216
|
+
*
|
|
217
|
+
* @overload
|
|
218
|
+
* @param {SharedStateClassName} className - Name of the shared state class.
|
|
219
|
+
* @param {SharedStateParameterName[]} filter - Filter parameter of interest for each
|
|
220
|
+
* state of the collection.
|
|
221
|
+
* @param {object} options - Options.
|
|
222
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
223
|
+
* created by the same node from the collection.
|
|
224
|
+
* @returns {Promise<SharedStateCollection>}
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const collection = await client.stateManager.getCollection(className, ['my-param'], { excludeLocal: true });
|
|
228
|
+
*/
|
|
229
|
+
getCollection(className: SharedStateClassName, filter: SharedStateParameterName[], options: {
|
|
230
|
+
excludeLocal: boolean;
|
|
231
|
+
}): Promise<SharedStateCollection>;
|
|
232
|
+
/** @private */
|
|
233
|
+
private [kStateManagerDeleteState];
|
|
234
|
+
/**
|
|
235
|
+
* Executed on `client.init`
|
|
236
|
+
* @param {Number} id - Id of the node.
|
|
237
|
+
* @param {Object} transport - Transport to use for synchronizing the states.
|
|
238
|
+
* Must implement a basic EventEmitter API.
|
|
239
|
+
*
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
private [kStateManagerInit];
|
|
243
|
+
/** @private */
|
|
244
|
+
private [kStateManagerClient];
|
|
245
|
+
#private;
|
|
69
246
|
}
|
|
70
|
-
|
|
247
|
+
import SharedState from './SharedState.js';
|
|
248
|
+
import SharedStateCollection from './SharedStateCollection.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default BatchedTransport;
|
|
2
|
+
/**
|
|
3
|
+
* This class proxies transports given the SharedStateManager to batch messages
|
|
4
|
+
*
|
|
5
|
+
* @param {number} [options.wait=0] - Wait for given number of milliseconds
|
|
6
|
+
* for stacking messages before emitting on the network. If 0 is given, network
|
|
7
|
+
* message is emitted on next microtask
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
declare class BatchedTransport {
|
|
11
|
+
constructor(transport: any);
|
|
12
|
+
addListener(channel: any, callback: any): void;
|
|
13
|
+
emit(channel: any, ...args: any[]): Promise<void>;
|
|
14
|
+
removeListener(channel: any, callback: any): void;
|
|
15
|
+
removeAllListeners(channel?: any): void;
|
|
16
|
+
#private;
|
|
17
|
+
}
|
|
@@ -1,126 +1,125 @@
|
|
|
1
1
|
export namespace sharedOptions {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
let nullable: boolean;
|
|
3
|
+
let event: boolean;
|
|
4
|
+
let required: boolean;
|
|
5
|
+
let metas: {};
|
|
6
|
+
let filterChange: boolean;
|
|
7
|
+
let immediate: boolean;
|
|
7
8
|
}
|
|
8
9
|
export namespace types {
|
|
9
10
|
export namespace boolean {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
let required_1: string[];
|
|
12
|
+
export { required_1 as required };
|
|
13
|
+
export const defaultOptions: any;
|
|
14
|
+
export function coerceFunction(name: any, def: any, value: any): boolean;
|
|
12
15
|
}
|
|
13
16
|
export namespace string {
|
|
14
|
-
|
|
15
|
-
export {
|
|
17
|
+
let required_2: string[];
|
|
18
|
+
export { required_2 as required };
|
|
19
|
+
const defaultOptions_1: any;
|
|
20
|
+
export { defaultOptions_1 as defaultOptions };
|
|
16
21
|
export function coerceFunction_1(name: any, def: any, value: any): string;
|
|
17
22
|
export { coerceFunction_1 as coerceFunction };
|
|
18
23
|
}
|
|
19
24
|
export namespace integer {
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
|
|
25
|
+
let required_3: string[];
|
|
26
|
+
export { required_3 as required };
|
|
27
|
+
const defaultOptions_2: any;
|
|
28
|
+
export { defaultOptions_2 as defaultOptions };
|
|
29
|
+
export function sanitizeDescription(def: any): any;
|
|
23
30
|
export function coerceFunction_2(name: any, def: any, value: any): number;
|
|
24
31
|
export { coerceFunction_2 as coerceFunction };
|
|
25
32
|
}
|
|
26
33
|
export namespace float {
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
|
|
30
|
-
export {
|
|
34
|
+
let required_4: string[];
|
|
35
|
+
export { required_4 as required };
|
|
36
|
+
const defaultOptions_3: any;
|
|
37
|
+
export { defaultOptions_3 as defaultOptions };
|
|
38
|
+
export function sanitizeDescription_1(def: any): any;
|
|
39
|
+
export { sanitizeDescription_1 as sanitizeDescription };
|
|
31
40
|
export function coerceFunction_3(name: any, def: any, value: any): number;
|
|
32
41
|
export { coerceFunction_3 as coerceFunction };
|
|
33
42
|
}
|
|
34
43
|
export namespace _enum {
|
|
35
|
-
|
|
36
|
-
export {
|
|
44
|
+
let required_5: string[];
|
|
45
|
+
export { required_5 as required };
|
|
46
|
+
const defaultOptions_4: any;
|
|
47
|
+
export { defaultOptions_4 as defaultOptions };
|
|
37
48
|
export function coerceFunction_4(name: any, def: any, value: any): any;
|
|
38
49
|
export { coerceFunction_4 as coerceFunction };
|
|
39
50
|
}
|
|
40
51
|
export { _enum as enum };
|
|
41
52
|
export namespace any {
|
|
42
|
-
|
|
43
|
-
export {
|
|
53
|
+
let required_6: string[];
|
|
54
|
+
export { required_6 as required };
|
|
55
|
+
const defaultOptions_5: any;
|
|
56
|
+
export { defaultOptions_5 as defaultOptions };
|
|
44
57
|
export function coerceFunction_5(name: any, def: any, value: any): any;
|
|
45
58
|
export { coerceFunction_5 as coerceFunction };
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
61
|
export default ParameterBag;
|
|
49
|
-
|
|
62
|
+
/** @private */
|
|
63
|
+
declare class ParameterBag {
|
|
64
|
+
static validateDescription(description: any): void;
|
|
65
|
+
constructor(description: any, initValues?: {});
|
|
50
66
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* Description of a schema to be register by the {@link server.ServerStateManagerServer }
|
|
54
|
-
* A schema consists of a combinaison of key value pairs where the key is the
|
|
55
|
-
* name of the parameter, and the value is an object describing the parameter.
|
|
67
|
+
* Define if the parameter exists.
|
|
56
68
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* - {@link server.SharedStateManagerServer ~schemaStringDef}
|
|
60
|
-
* - {@link server.SharedStateManagerServer ~schemaIntegerDef}
|
|
61
|
-
* - {@link server.SharedStateManagerServer ~schemaFloatDef}
|
|
62
|
-
* - {@link server.SharedStateManagerServer ~schemaEnumDef}
|
|
63
|
-
* - {@link server.SharedStateManagerServer ~schemaAnyDef}
|
|
69
|
+
* @param {string} name - Name of the parameter.
|
|
70
|
+
* @return {Boolean}
|
|
64
71
|
*/
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Bag of parameters.
|
|
69
|
-
* @private
|
|
70
|
-
*/
|
|
71
|
-
declare class ParameterBag {
|
|
72
|
-
static validateSchema(schema: any): void;
|
|
73
|
-
constructor(schema: any, initValues?: {});
|
|
72
|
+
has(name: string): boolean;
|
|
74
73
|
/**
|
|
75
|
-
*
|
|
74
|
+
* Return values of all parameters as a flat object. If a parameter is of `any`
|
|
75
|
+
* type, a deep copy is made.
|
|
76
76
|
*
|
|
77
|
-
* @
|
|
78
|
-
* @name _params
|
|
79
|
-
* @memberof ParameterBag
|
|
80
|
-
* @instance
|
|
81
|
-
* @private
|
|
77
|
+
* @return {object}
|
|
82
78
|
*/
|
|
83
|
-
|
|
79
|
+
getValues(): object;
|
|
84
80
|
/**
|
|
85
|
-
*
|
|
81
|
+
* Return values of all parameters as a flat object. Similar to `getValues` but
|
|
82
|
+
* returns a reference to the underlying value in case of `any` type. May be
|
|
83
|
+
* useful if the underlying value is big (e.g. sensors recordings, etc.) and
|
|
84
|
+
* deep cloning expensive. Be aware that if changes are made on the returned
|
|
85
|
+
* object, the state of your application will become inconsistent.
|
|
86
86
|
*
|
|
87
|
-
* @
|
|
88
|
-
* @name _schema
|
|
89
|
-
* @memberof ParameterBag
|
|
90
|
-
* @instance
|
|
91
|
-
* @private
|
|
87
|
+
* @return {object}
|
|
92
88
|
*/
|
|
93
|
-
|
|
89
|
+
getValuesUnsafe(): object;
|
|
94
90
|
/**
|
|
95
|
-
*
|
|
91
|
+
* Return the value of the given parameter. If the parameter is of `any` type,
|
|
92
|
+
* a deep copy is returned.
|
|
96
93
|
*
|
|
97
|
-
* @param {
|
|
98
|
-
* @return {
|
|
94
|
+
* @param {string} name - Name of the parameter.
|
|
95
|
+
* @return {Mixed} - Value of the parameter.
|
|
99
96
|
*/
|
|
100
|
-
|
|
97
|
+
get(name: string): Mixed;
|
|
101
98
|
/**
|
|
102
|
-
*
|
|
99
|
+
* Similar to `get` but returns a reference to the underlying value in case of
|
|
100
|
+
* `any` type. May be useful if the underlying value is big (e.g. sensors
|
|
101
|
+
* recordings, etc.) and deep cloning expensive. Be aware that if changes are
|
|
102
|
+
* made on the returned object, the state of your application will become
|
|
103
|
+
* inconsistent.
|
|
103
104
|
*
|
|
104
|
-
* @
|
|
105
|
+
* @param {string} name - Name of the parameter.
|
|
106
|
+
* @return {Mixed} - Value of the parameter.
|
|
105
107
|
*/
|
|
106
|
-
|
|
108
|
+
getUnsafe(name: string): Mixed;
|
|
107
109
|
/**
|
|
108
|
-
*
|
|
109
|
-
* a deep copy is returned.
|
|
110
|
+
* Check that the value is valid according to the class definition and return it coerced.
|
|
110
111
|
*
|
|
111
112
|
* @param {String} name - Name of the parameter.
|
|
112
|
-
* @
|
|
113
|
+
* @param {Mixed} value - Value of the parameter.
|
|
113
114
|
*/
|
|
114
|
-
|
|
115
|
+
coerceValue(name: string, value: Mixed): Mixed;
|
|
115
116
|
/**
|
|
116
117
|
* Set the value of a parameter. If the value of the parameter is updated
|
|
117
118
|
* (aka if previous value is different from new value) all registered
|
|
118
119
|
* callbacks are registered.
|
|
119
120
|
*
|
|
120
|
-
* @param {
|
|
121
|
+
* @param {string} name - Name of the parameter.
|
|
121
122
|
* @param {Mixed} value - Value of the parameter.
|
|
122
|
-
* @param {Boolean} [forcePropagation=false] - if true, propagate value even
|
|
123
|
-
* if the value has not changed.
|
|
124
123
|
* @return {Array} - [new value, updated flag].
|
|
125
124
|
*/
|
|
126
125
|
set(name: string, value: Mixed): any[];
|
|
@@ -129,15 +128,13 @@ declare class ParameterBag {
|
|
|
129
128
|
* @note - prefer `state.set(state.getInitValues())`
|
|
130
129
|
* or `state.set(state.getDefaultValues())`
|
|
131
130
|
*
|
|
132
|
-
* @param {
|
|
131
|
+
* @param {string} [name=null] - Name of the parameter to reset.
|
|
133
132
|
*/
|
|
134
133
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* @return {Object}
|
|
134
|
+
* @return {object}
|
|
138
135
|
*/
|
|
139
|
-
|
|
136
|
+
getDescription(name?: any): object;
|
|
140
137
|
getInitValues(): {};
|
|
141
138
|
getDefaults(): {};
|
|
139
|
+
#private;
|
|
142
140
|
}
|
|
143
|
-
//# sourceMappingURL=ParameterBag.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @private */
|
|
2
|
+
export default class PromiseStore {
|
|
3
|
+
constructor(name: any);
|
|
4
|
+
name: any;
|
|
5
|
+
store: Map<any, any>;
|
|
6
|
+
generateRequestId: any;
|
|
7
|
+
add(resolve: any, reject: any, type: any, localParams: any): any;
|
|
8
|
+
resolve(reqId: any, data: any): void;
|
|
9
|
+
reject(reqId: any, msg: any): void;
|
|
10
|
+
flush(): void;
|
|
11
|
+
}
|