@soundworks/core 4.0.0-alpha.28 → 4.0.0-alpha.29
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/.jsdoc +3 -1
- package/CHANGELOG.md +11 -5
- package/package.json +5 -5
- package/src/client/Client.js +78 -83
- package/src/client/{Context.js → ClientContext.js} +48 -38
- package/src/client/ClientContextManager.js +115 -0
- package/src/client/{Plugin.js → ClientPlugin.js} +22 -18
- package/src/client/{PluginManager.js → ClientPluginManager.js} +39 -35
- package/src/client/{Socket.js → ClientSocket.js} +54 -65
- package/src/client/{StateManager.js → ClientStateManager.js} +7 -8
- package/src/client/index.js +17 -41
- package/src/common/BasePlugin.js +56 -51
- package/src/common/BasePluginManager.js +175 -139
- package/src/common/BaseStateManager.js +316 -120
- package/src/common/BatchedTransport.js +24 -24
- package/src/common/ParameterBag.js +18 -6
- package/src/common/PromiseStore.js +1 -0
- package/src/common/{BaseSharedState.js → SharedState.js} +271 -199
- package/src/common/{BaseSharedStateCollection.js → SharedStateCollection.js} +92 -61
- package/src/common/logger.js +5 -0
- package/src/common/shared-state-types.js +76 -0
- package/src/common/version.js +1 -1
- package/src/server/Server.js +391 -354
- package/src/server/ServerClient.js +73 -0
- package/src/server/{Context.js → ServerContext.js} +85 -66
- package/src/server/{ContextManager.js → ServerContextManager.js} +98 -85
- package/src/server/{Plugin.js → ServerPlugin.js} +10 -24
- package/src/server/{PluginManager.js → ServerPluginManager.js} +76 -69
- package/src/server/{Socket.js → ServerSocket.js} +19 -18
- package/src/server/{Sockets.js → ServerSockets.js} +36 -27
- package/src/server/ServerStateManager.js +515 -0
- package/src/{common → server}/SharedStatePrivate.js +61 -26
- package/src/server/audit-schema.js +1 -1
- package/src/server/crypto.js +2 -0
- package/src/server/index.js +18 -21
- package/types/client/Client.d.ts +74 -95
- package/types/client/{Context.d.ts → ClientContext.d.ts} +25 -26
- package/types/client/{ContextManager.d.ts → ClientContextManager.d.ts} +19 -22
- package/types/client/{Plugin.d.ts → ClientPlugin.d.ts} +17 -20
- package/types/client/{PluginManager.d.ts → ClientPluginManager.d.ts} +13 -36
- package/types/client/ClientSocket.d.ts +74 -0
- package/types/client/{StateManager.d.ts → ClientStateManager.d.ts} +11 -15
- package/types/client/index.d.ts +26 -2
- package/types/common/BasePlugin.d.ts +52 -46
- package/types/common/BasePluginManager.d.ts +68 -44
- package/types/common/BaseStateManager.d.ts +207 -97
- package/types/common/BatchedTransport.d.ts +1 -5
- package/types/common/ParameterBag.d.ts +16 -18
- package/types/common/PromiseStore.d.ts +1 -1
- package/types/common/SharedState.d.ts +297 -0
- package/types/common/{BaseSharedStateCollection.d.ts → SharedStateCollection.d.ts} +34 -18
- package/types/common/constants.d.ts +0 -2
- package/types/common/logger.d.ts +2 -1
- package/types/common/shared-state-types.d.ts +83 -0
- package/types/common/sockets-utils.d.ts +0 -5
- package/types/common/version.d.ts +1 -2
- package/types/server/Server.d.ts +78 -132
- package/types/server/ServerClient.d.ts +45 -0
- package/types/server/{Context.d.ts → ServerContext.d.ts} +53 -43
- package/types/server/ServerContextManager.d.ts +80 -0
- package/types/server/{Plugin.d.ts → ServerPlugin.d.ts} +19 -33
- package/types/server/{PluginManager.d.ts → ServerPluginManager.d.ts} +39 -37
- package/types/server/ServerSocket.d.ts +85 -0
- package/types/server/ServerSockets.d.ts +50 -0
- package/types/server/ServerStateManager.d.ts +189 -0
- package/types/server/SharedStatePrivate.d.ts +21 -0
- package/types/server/audit-network-latency.worker.d.ts +1 -2
- package/types/server/audit-schema.d.ts +0 -1
- package/types/server/crypto.d.ts +2 -1
- package/types/server/index.d.ts +24 -2
- package/src/client/ContextManager.js +0 -111
- package/src/client/SharedState.js +0 -84
- package/src/client/SharedStateCollection.js +0 -38
- package/src/server/Client.js +0 -55
- package/src/server/SharedState.js +0 -85
- package/src/server/SharedStateCollection.js +0 -39
- package/src/server/StateManager.js +0 -696
- 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.map +0 -1
- 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/SharedStateCollection.d.ts +0 -41
- package/types/client/SharedStateCollection.d.ts.map +0 -1
- package/types/client/Socket.d.ts +0 -149
- 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 -244
- package/types/common/BaseSharedState.d.ts.map +0 -1
- package/types/common/BaseSharedStateCollection.d.ts.map +0 -1
- package/types/common/BaseStateManager.d.ts.map +0 -1
- package/types/common/BatchedTransport.d.ts.map +0 -1
- package/types/common/ParameterBag.d.ts.map +0 -1
- package/types/common/PromiseStore.d.ts.map +0 -1
- package/types/common/SharedStatePrivate.d.ts +0 -21
- 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/sockets-utils.d.ts.map +0 -1
- package/types/common/version.d.ts.map +0 -1
- package/types/server/Client.d.ts +0 -45
- package/types/server/Client.d.ts.map +0 -1
- 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.map +0 -1
- 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/SharedStateCollection.d.ts +0 -41
- package/types/server/SharedStateCollection.d.ts.map +0 -1
- package/types/server/Socket.d.ts +0 -164
- package/types/server/Socket.d.ts.map +0 -1
- package/types/server/Sockets.d.ts +0 -80
- package/types/server/Sockets.d.ts.map +0 -1
- package/types/server/StateManager.d.ts +0 -405
- 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/crypto.d.ts.map +0 -1
- package/types/server/index.d.ts.map +0 -1
|
@@ -1,135 +1,245 @@
|
|
|
1
|
+
export const kStateManagerInit: unique symbol;
|
|
2
|
+
export const kStateManagerDeleteState: unique symbol;
|
|
3
|
+
export const kStateManagerClient: unique symbol;
|
|
1
4
|
export default BaseStateManager;
|
|
5
|
+
/**
|
|
6
|
+
* Callback executed when a state is created on the network.
|
|
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} schemaName - name of the schema
|
|
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
|
+
*/
|
|
2
29
|
/** @private */
|
|
3
30
|
declare class BaseStateManager {
|
|
4
|
-
_statesById: Map<any, any>;
|
|
5
|
-
_cachedSchemas: Map<any, any>;
|
|
6
|
-
_observeListeners: Set<any>;
|
|
7
|
-
_observeRequestCallbacks: Map<any, any>;
|
|
8
|
-
_promiseStore: PromiseStore;
|
|
9
|
-
/**
|
|
10
|
-
* Executed on `client.init`
|
|
11
|
-
* @param {Number} id - Id of the node.
|
|
12
|
-
* @param {Object} transport - Transport to use for synchronizing the states.
|
|
13
|
-
* Must implement a basic EventEmitter API.
|
|
14
|
-
*/
|
|
15
|
-
/** @private */
|
|
16
|
-
private init;
|
|
17
|
-
client: {
|
|
18
|
-
id: any;
|
|
19
|
-
transport: BatchedTransport;
|
|
20
|
-
};
|
|
21
|
-
/** @private */
|
|
22
|
-
private _filterObserve;
|
|
23
31
|
/**
|
|
24
32
|
* Return the schema from a given registered schema name
|
|
25
33
|
*
|
|
26
34
|
* @param {String} schemaName - Name of the schema as given on registration
|
|
27
35
|
* (cf. ServerStateManager)
|
|
36
|
+
* @return {SharedStateSchema}
|
|
28
37
|
* @example
|
|
29
|
-
* const schema = await client.stateManager.getSchema('my-
|
|
38
|
+
* const schema = await client.stateManager.getSchema('my-class');
|
|
30
39
|
*/
|
|
31
|
-
getSchema(schemaName: string):
|
|
40
|
+
getSchema(schemaName: string): SharedStateSchema;
|
|
32
41
|
/**
|
|
33
|
-
* Create a
|
|
42
|
+
* Create a {@link SharedState} instance from a registered schema.
|
|
34
43
|
*
|
|
35
|
-
* @param {
|
|
44
|
+
* @param {string} schemaName - Name of the schema as given on registration
|
|
36
45
|
* (cf. ServerStateManager)
|
|
37
|
-
* @param {Object} [initValues={}] - Default values for the state.
|
|
38
|
-
* @returns {
|
|
39
|
-
* @see {@link client.SharedState}
|
|
40
|
-
* @see {@link server.SharedState}
|
|
46
|
+
* @param {Object.<string, any>} [initValues={}] - Default values for the state.
|
|
47
|
+
* @returns {Promise<SharedState>}
|
|
41
48
|
* @example
|
|
42
|
-
* const state = await client.stateManager.create('my-
|
|
49
|
+
* const state = await client.stateManager.create('my-class');
|
|
43
50
|
*/
|
|
44
|
-
create(schemaName: string, initValues?:
|
|
51
|
+
create(schemaName: string, initValues?: {
|
|
52
|
+
[x: string]: any;
|
|
53
|
+
}): Promise<SharedState>;
|
|
45
54
|
/**
|
|
46
|
-
* Attach to an existing
|
|
55
|
+
* Attach to an existing {@link SharedState} instance.
|
|
47
56
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* - `stateManager.attach(schemaName, filter)`
|
|
52
|
-
* - `stateManager.attach(schemaName, stateId, filter)`
|
|
57
|
+
* @overload
|
|
58
|
+
* @param {string} schemaName
|
|
59
|
+
* @returns {Promise<SharedState>}
|
|
53
60
|
*
|
|
54
|
-
* @
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
63
|
-
* @
|
|
61
|
+
* @example
|
|
62
|
+
* const state = await client.stateManager.attach('my-class');
|
|
63
|
+
*/
|
|
64
|
+
attach(schemaName: string): Promise<SharedState>;
|
|
65
|
+
/**
|
|
66
|
+
* Attach to an existing {@link SharedState} instance.
|
|
67
|
+
*
|
|
68
|
+
* @overload
|
|
69
|
+
* @param {string} schemaName - Name of the schema
|
|
70
|
+
* @param {number} stateId - Id of the state
|
|
71
|
+
* @returns {Promise<SharedState>}
|
|
64
72
|
*
|
|
65
73
|
* @example
|
|
66
|
-
* const state = await client.stateManager.attach('my-
|
|
74
|
+
* const state = await client.stateManager.attach('my-class', stateId);
|
|
67
75
|
*/
|
|
68
|
-
attach(schemaName: string,
|
|
76
|
+
attach(schemaName: string, stateId: number): Promise<SharedState>;
|
|
69
77
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* - The order of execution is not guaranted between nodes, i.e. an state attached
|
|
77
|
-
* in the `observe` callback could be created before the `async create` method resolves.
|
|
78
|
-
* - Filtering, i.e. `observedSchemaName` and `options.excludeLocal` are handled
|
|
79
|
-
* on the node side, the server just notify all state creation activity and
|
|
80
|
-
* the node executes the given callbacks according to the different filter rules.
|
|
81
|
-
* Such strategy allows to share the observe notifications between all observers.
|
|
82
|
-
*
|
|
83
|
-
* Alternative signatures:
|
|
84
|
-
* - `stateManager.observe(callback)`
|
|
85
|
-
* - `stateManager.observe(schemaName, callback)`
|
|
86
|
-
* - `stateManager.observe(callback, options)`
|
|
87
|
-
* - `stateManager.observe(schemaName, callback, options)`
|
|
88
|
-
*
|
|
89
|
-
* @param {string} [schemaName] - optionnal schema name to filter the observed
|
|
90
|
-
* states.
|
|
91
|
-
* @param {server.StateManager~ObserveCallback|client.StateManager~ObserveCallback}
|
|
92
|
-
* callback - Function to be called when a new state is created on the network.
|
|
93
|
-
* @param {object} options - Options.
|
|
94
|
-
* @param {boolean} [options.excludeLocal = false] - If set to true, exclude states
|
|
95
|
-
* created locallly, i.e. by the same node, from the collection.
|
|
96
|
-
* @returns {Promise<Function>} - Returns a Promise that resolves when the given
|
|
97
|
-
* callback as been executed on each existing states. The promise value is a
|
|
98
|
-
* function which allows to stop observing the states on the network.
|
|
78
|
+
* Attach to an existing {@link SharedState} instance.
|
|
79
|
+
*
|
|
80
|
+
* @overload
|
|
81
|
+
* @param {string} schemaName - Name of the schema
|
|
82
|
+
* @param {string[]} filter - List of parameters of interest
|
|
83
|
+
* @returns {Promise<SharedState>}
|
|
99
84
|
*
|
|
100
85
|
* @example
|
|
86
|
+
* const state = await client.stateManager.attach('my-class', ['some-param']);
|
|
87
|
+
*/
|
|
88
|
+
attach(schemaName: string, filter: string[]): Promise<SharedState>;
|
|
89
|
+
/**
|
|
90
|
+
* Attach to an existing {@link SharedState} instance.
|
|
91
|
+
*
|
|
92
|
+
* @overload
|
|
93
|
+
* @param {string} schemaName - Name of the schema
|
|
94
|
+
* @param {number} stateId - Id of the state
|
|
95
|
+
* @param {string[]} filter - List of parameters of interest
|
|
96
|
+
* @returns {Promise<SharedState>}
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* const state = await client.stateManager.attach('my-class', stateId, ['some-param']);
|
|
100
|
+
*/
|
|
101
|
+
attach(schemaName: string, stateId: number, filter: string[]): Promise<SharedState>;
|
|
102
|
+
/**
|
|
103
|
+
* Observe all the {@link SharedState} instances that are created on the network.
|
|
104
|
+
*
|
|
105
|
+
* @overload
|
|
106
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
107
|
+
* new {@link SharedState} is created on the network.
|
|
108
|
+
* @example
|
|
101
109
|
* client.stateManager.observe(async (schemaName, stateId) => {
|
|
102
|
-
* if (schemaName === '
|
|
103
|
-
* const
|
|
104
|
-
* console.log(state.getValues());
|
|
110
|
+
* if (schemaName === 'my-shared-state-class') {
|
|
111
|
+
* const attached = await client.stateManager.attach(schemaName, stateId);
|
|
105
112
|
* }
|
|
106
113
|
* });
|
|
107
114
|
*/
|
|
108
|
-
observe(
|
|
115
|
+
observe(callback: stateManagerObserveCallback): any;
|
|
116
|
+
/**
|
|
117
|
+
* Observe all the {@link SharedState} instances of given {@link SharedStateClassName}
|
|
118
|
+
* that are created on the network.
|
|
119
|
+
*
|
|
120
|
+
* @overload
|
|
121
|
+
* @param {SharedStateClassName} schemaName - Observe only ${@link SharedState}
|
|
122
|
+
* of given name.
|
|
123
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
124
|
+
* new {@link SharedState} is created on the network.
|
|
125
|
+
* @example
|
|
126
|
+
* client.stateManager.observe('my-shared-state-class', async (schemaName, stateId) => {
|
|
127
|
+
* const attached = await client.stateManager.attach(schemaName, stateId);
|
|
128
|
+
* });
|
|
129
|
+
*/
|
|
130
|
+
observe(schemaName: SharedStateClassName, callback: stateManagerObserveCallback): any;
|
|
131
|
+
/**
|
|
132
|
+
* Observe all the {@link SharedState} instances of given excluding the ones
|
|
133
|
+
* created by the current node.
|
|
134
|
+
*
|
|
135
|
+
* @overload
|
|
136
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
137
|
+
* new {@link SharedState} is created on the network.
|
|
138
|
+
* @param {object} options - Options.
|
|
139
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
140
|
+
* created by the same node from the collection.
|
|
141
|
+
* @example
|
|
142
|
+
* client.stateManager.observe(async (schemaName, stateId) => {
|
|
143
|
+
* if (schemaName === 'my-shared-state-class') {
|
|
144
|
+
* const attached = await client.stateManager.attach(schemaName, stateId);
|
|
145
|
+
* }
|
|
146
|
+
* }, { excludeLocal: true });
|
|
147
|
+
*/
|
|
148
|
+
observe(callback: stateManagerObserveCallback, options: {
|
|
149
|
+
excludeLocal: boolean;
|
|
150
|
+
}): any;
|
|
151
|
+
/**
|
|
152
|
+
* Observe all the {@link SharedState} instances of given {@link SharedStateClassName}
|
|
153
|
+
* that are created on the network, excluding the ones created by the current node.
|
|
154
|
+
*
|
|
155
|
+
* @overload
|
|
156
|
+
* @param {SharedStateClassName} schemaName - Observe only ${@link SharedState}
|
|
157
|
+
* of given name.
|
|
158
|
+
* @param {stateManagerObserveCallback} callback - Function to execute when a
|
|
159
|
+
* new {@link SharedState} is created on the network.
|
|
160
|
+
* @param {object} options - Options.
|
|
161
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
162
|
+
* created by the same node from the collection.
|
|
163
|
+
* @example
|
|
164
|
+
* client.stateManager.observe('my-shared-state-class', async (schemaName, stateId) => {
|
|
165
|
+
* const attached = await client.stateManager.attach(schemaName, stateId);
|
|
166
|
+
* }, { excludeLocal: true });
|
|
167
|
+
*/
|
|
168
|
+
observe(schemaName: SharedStateClassName, callback: stateManagerObserveCallback, options: {
|
|
169
|
+
excludeLocal: boolean;
|
|
170
|
+
}): any;
|
|
171
|
+
/**
|
|
172
|
+
* Returns a collection of all the states created from the schema name.
|
|
173
|
+
*
|
|
174
|
+
* @overload
|
|
175
|
+
* @param {string} schemaName - Name of the schema.
|
|
176
|
+
* @returns {Promise<SharedStateCollection>}
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* const collection = await client.stateManager.getCollection(schemaName);
|
|
180
|
+
*/
|
|
181
|
+
getCollection(schemaName: string): Promise<SharedStateCollection>;
|
|
182
|
+
/**
|
|
183
|
+
* Returns a collection of all the states created from the schema name.
|
|
184
|
+
*
|
|
185
|
+
* @overload
|
|
186
|
+
* @param {string} schemaName - Name of the schema.
|
|
187
|
+
* @param {SharedStateParameterName[]} filter - Filter parameter of interest for each
|
|
188
|
+
* state of the collection.
|
|
189
|
+
* @returns {Promise<SharedStateCollection>}
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* const collection = await client.stateManager.getCollection(schemaName, ['my-param']);
|
|
193
|
+
*/
|
|
194
|
+
getCollection(schemaName: string, filter: SharedStateParameterName[]): Promise<SharedStateCollection>;
|
|
109
195
|
/**
|
|
110
196
|
* Returns a collection of all the states created from the schema name.
|
|
111
197
|
*
|
|
112
|
-
*
|
|
113
|
-
* -
|
|
114
|
-
* -
|
|
115
|
-
* -
|
|
116
|
-
*
|
|
198
|
+
* @overload
|
|
199
|
+
* @param {string} schemaName - Name of the schema.
|
|
200
|
+
* @param {object} options - Options.
|
|
201
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
202
|
+
* created by the same node from the collection.
|
|
203
|
+
* @returns {Promise<SharedStateCollection>}
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* const collection = await client.stateManager.getCollection(schemaName, { excludeLocal: true });
|
|
207
|
+
*/
|
|
208
|
+
getCollection(schemaName: string, options: {
|
|
209
|
+
excludeLocal: boolean;
|
|
210
|
+
}): Promise<SharedStateCollection>;
|
|
211
|
+
/**
|
|
212
|
+
* Returns a collection of all the states created from the schema name.
|
|
117
213
|
*
|
|
214
|
+
* @overload
|
|
118
215
|
* @param {string} schemaName - Name of the schema.
|
|
119
|
-
* @param {
|
|
120
|
-
* state of the collection.
|
|
121
|
-
* @param {object}
|
|
122
|
-
* @param {boolean}
|
|
216
|
+
* @param {SharedStateParameterName[]} filter - Filter parameter of interest for each
|
|
217
|
+
* state of the collection.
|
|
218
|
+
* @param {object} options - Options.
|
|
219
|
+
* @param {boolean} options.excludeLocal=false - If set to true, exclude states
|
|
123
220
|
* created by the same node from the collection.
|
|
124
|
-
* @returns {
|
|
221
|
+
* @returns {Promise<SharedStateCollection>}
|
|
125
222
|
*
|
|
126
223
|
* @example
|
|
127
|
-
* const collection = await client.stateManager.getCollection(schemaName);
|
|
224
|
+
* const collection = await client.stateManager.getCollection(schemaName, ['my-param'], { excludeLocal: true });
|
|
128
225
|
*/
|
|
129
|
-
getCollection(schemaName: string,
|
|
130
|
-
excludeLocal
|
|
131
|
-
}
|
|
226
|
+
getCollection(schemaName: string, filter: SharedStateParameterName[], options: {
|
|
227
|
+
excludeLocal: boolean;
|
|
228
|
+
}): Promise<SharedStateCollection>;
|
|
229
|
+
/** @private */
|
|
230
|
+
private [kStateManagerDeleteState];
|
|
231
|
+
/**
|
|
232
|
+
* Executed on `client.init`
|
|
233
|
+
* @param {Number} id - Id of the node.
|
|
234
|
+
* @param {Object} transport - Transport to use for synchronizing the states.
|
|
235
|
+
* Must implement a basic EventEmitter API.
|
|
236
|
+
*
|
|
237
|
+
* @private
|
|
238
|
+
*/
|
|
239
|
+
private [kStateManagerInit];
|
|
240
|
+
/** @private */
|
|
241
|
+
private [kStateManagerClient];
|
|
242
|
+
#private;
|
|
132
243
|
}
|
|
133
|
-
import
|
|
134
|
-
import
|
|
135
|
-
//# sourceMappingURL=BaseStateManager.d.ts.map
|
|
244
|
+
import SharedState from './SharedState.js';
|
|
245
|
+
import SharedStateCollection from './SharedStateCollection.js';
|
|
@@ -9,13 +9,9 @@ export default BatchedTransport;
|
|
|
9
9
|
*/
|
|
10
10
|
declare class BatchedTransport {
|
|
11
11
|
constructor(transport: any);
|
|
12
|
-
_transport: any;
|
|
13
|
-
_listeners: Map<any, any>;
|
|
14
|
-
_stack: any[];
|
|
15
|
-
_sending: boolean;
|
|
16
12
|
addListener(channel: any, callback: any): void;
|
|
17
13
|
emit(channel: any, ...args: any[]): Promise<void>;
|
|
18
14
|
removeListener(channel: any, callback: any): void;
|
|
19
15
|
removeAllListeners(channel?: any): void;
|
|
16
|
+
#private;
|
|
20
17
|
}
|
|
21
|
-
//# sourceMappingURL=BatchedTransport.d.ts.map
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
export namespace sharedOptions {
|
|
2
2
|
let nullable: boolean;
|
|
3
3
|
let event: boolean;
|
|
4
|
+
let required: boolean;
|
|
4
5
|
let metas: {};
|
|
5
6
|
let filterChange: boolean;
|
|
6
7
|
let immediate: boolean;
|
|
7
8
|
}
|
|
8
9
|
export namespace types {
|
|
9
10
|
export namespace boolean {
|
|
10
|
-
let required: string[];
|
|
11
|
-
const defaultOptions: any;
|
|
12
|
-
function coerceFunction(name: any, def: any, value: any): boolean;
|
|
13
|
-
}
|
|
14
|
-
export namespace string {
|
|
15
11
|
let required_1: string[];
|
|
16
12
|
export { required_1 as required };
|
|
13
|
+
export const defaultOptions: any;
|
|
14
|
+
export function coerceFunction(name: any, def: any, value: any): boolean;
|
|
15
|
+
}
|
|
16
|
+
export namespace string {
|
|
17
|
+
let required_2: string[];
|
|
18
|
+
export { required_2 as required };
|
|
17
19
|
const defaultOptions_1: any;
|
|
18
20
|
export { defaultOptions_1 as defaultOptions };
|
|
19
21
|
export function coerceFunction_1(name: any, def: any, value: any): string;
|
|
20
22
|
export { coerceFunction_1 as coerceFunction };
|
|
21
23
|
}
|
|
22
24
|
export namespace integer {
|
|
23
|
-
let
|
|
24
|
-
export {
|
|
25
|
+
let required_3: string[];
|
|
26
|
+
export { required_3 as required };
|
|
25
27
|
const defaultOptions_2: any;
|
|
26
28
|
export { defaultOptions_2 as defaultOptions };
|
|
27
29
|
export function sanitizeSchema(def: any): any;
|
|
@@ -29,8 +31,8 @@ export namespace types {
|
|
|
29
31
|
export { coerceFunction_2 as coerceFunction };
|
|
30
32
|
}
|
|
31
33
|
export namespace float {
|
|
32
|
-
let
|
|
33
|
-
export {
|
|
34
|
+
let required_4: string[];
|
|
35
|
+
export { required_4 as required };
|
|
34
36
|
const defaultOptions_3: any;
|
|
35
37
|
export { defaultOptions_3 as defaultOptions };
|
|
36
38
|
export function sanitizeSchema_1(def: any): any;
|
|
@@ -39,8 +41,8 @@ export namespace types {
|
|
|
39
41
|
export { coerceFunction_3 as coerceFunction };
|
|
40
42
|
}
|
|
41
43
|
export namespace _enum {
|
|
42
|
-
let
|
|
43
|
-
export {
|
|
44
|
+
let required_5: string[];
|
|
45
|
+
export { required_5 as required };
|
|
44
46
|
const defaultOptions_4: any;
|
|
45
47
|
export { defaultOptions_4 as defaultOptions };
|
|
46
48
|
export function coerceFunction_4(name: any, def: any, value: any): any;
|
|
@@ -48,8 +50,8 @@ export namespace types {
|
|
|
48
50
|
}
|
|
49
51
|
export { _enum as enum };
|
|
50
52
|
export namespace any {
|
|
51
|
-
let
|
|
52
|
-
export {
|
|
53
|
+
let required_6: string[];
|
|
54
|
+
export { required_6 as required };
|
|
53
55
|
const defaultOptions_5: any;
|
|
54
56
|
export { defaultOptions_5 as defaultOptions };
|
|
55
57
|
export function coerceFunction_5(name: any, def: any, value: any): any;
|
|
@@ -57,10 +59,7 @@ export namespace types {
|
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
export default ParameterBag;
|
|
60
|
-
/**
|
|
61
|
-
* Bag of parameters.
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
62
|
+
/** @private */
|
|
64
63
|
declare class ParameterBag {
|
|
65
64
|
static validateSchema(schema: any): void;
|
|
66
65
|
constructor(schema: any, initValues?: {});
|
|
@@ -161,4 +160,3 @@ declare class ParameterBag {
|
|
|
161
160
|
getInitValues(): {};
|
|
162
161
|
getDefaults(): {};
|
|
163
162
|
}
|
|
164
|
-
//# sourceMappingURL=ParameterBag.d.ts.map
|