@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.
Files changed (127) hide show
  1. package/.jsdoc +3 -1
  2. package/CHANGELOG.md +11 -5
  3. package/package.json +5 -5
  4. package/src/client/Client.js +78 -83
  5. package/src/client/{Context.js → ClientContext.js} +48 -38
  6. package/src/client/ClientContextManager.js +115 -0
  7. package/src/client/{Plugin.js → ClientPlugin.js} +22 -18
  8. package/src/client/{PluginManager.js → ClientPluginManager.js} +39 -35
  9. package/src/client/{Socket.js → ClientSocket.js} +54 -65
  10. package/src/client/{StateManager.js → ClientStateManager.js} +7 -8
  11. package/src/client/index.js +17 -41
  12. package/src/common/BasePlugin.js +56 -51
  13. package/src/common/BasePluginManager.js +175 -139
  14. package/src/common/BaseStateManager.js +316 -120
  15. package/src/common/BatchedTransport.js +24 -24
  16. package/src/common/ParameterBag.js +18 -6
  17. package/src/common/PromiseStore.js +1 -0
  18. package/src/common/{BaseSharedState.js → SharedState.js} +271 -199
  19. package/src/common/{BaseSharedStateCollection.js → SharedStateCollection.js} +92 -61
  20. package/src/common/logger.js +5 -0
  21. package/src/common/shared-state-types.js +76 -0
  22. package/src/common/version.js +1 -1
  23. package/src/server/Server.js +391 -354
  24. package/src/server/ServerClient.js +73 -0
  25. package/src/server/{Context.js → ServerContext.js} +85 -66
  26. package/src/server/{ContextManager.js → ServerContextManager.js} +98 -85
  27. package/src/server/{Plugin.js → ServerPlugin.js} +10 -24
  28. package/src/server/{PluginManager.js → ServerPluginManager.js} +76 -69
  29. package/src/server/{Socket.js → ServerSocket.js} +19 -18
  30. package/src/server/{Sockets.js → ServerSockets.js} +36 -27
  31. package/src/server/ServerStateManager.js +515 -0
  32. package/src/{common → server}/SharedStatePrivate.js +61 -26
  33. package/src/server/audit-schema.js +1 -1
  34. package/src/server/crypto.js +2 -0
  35. package/src/server/index.js +18 -21
  36. package/types/client/Client.d.ts +74 -95
  37. package/types/client/{Context.d.ts → ClientContext.d.ts} +25 -26
  38. package/types/client/{ContextManager.d.ts → ClientContextManager.d.ts} +19 -22
  39. package/types/client/{Plugin.d.ts → ClientPlugin.d.ts} +17 -20
  40. package/types/client/{PluginManager.d.ts → ClientPluginManager.d.ts} +13 -36
  41. package/types/client/ClientSocket.d.ts +74 -0
  42. package/types/client/{StateManager.d.ts → ClientStateManager.d.ts} +11 -15
  43. package/types/client/index.d.ts +26 -2
  44. package/types/common/BasePlugin.d.ts +52 -46
  45. package/types/common/BasePluginManager.d.ts +68 -44
  46. package/types/common/BaseStateManager.d.ts +207 -97
  47. package/types/common/BatchedTransport.d.ts +1 -5
  48. package/types/common/ParameterBag.d.ts +16 -18
  49. package/types/common/PromiseStore.d.ts +1 -1
  50. package/types/common/SharedState.d.ts +297 -0
  51. package/types/common/{BaseSharedStateCollection.d.ts → SharedStateCollection.d.ts} +34 -18
  52. package/types/common/constants.d.ts +0 -2
  53. package/types/common/logger.d.ts +2 -1
  54. package/types/common/shared-state-types.d.ts +83 -0
  55. package/types/common/sockets-utils.d.ts +0 -5
  56. package/types/common/version.d.ts +1 -2
  57. package/types/server/Server.d.ts +78 -132
  58. package/types/server/ServerClient.d.ts +45 -0
  59. package/types/server/{Context.d.ts → ServerContext.d.ts} +53 -43
  60. package/types/server/ServerContextManager.d.ts +80 -0
  61. package/types/server/{Plugin.d.ts → ServerPlugin.d.ts} +19 -33
  62. package/types/server/{PluginManager.d.ts → ServerPluginManager.d.ts} +39 -37
  63. package/types/server/ServerSocket.d.ts +85 -0
  64. package/types/server/ServerSockets.d.ts +50 -0
  65. package/types/server/ServerStateManager.d.ts +189 -0
  66. package/types/server/SharedStatePrivate.d.ts +21 -0
  67. package/types/server/audit-network-latency.worker.d.ts +1 -2
  68. package/types/server/audit-schema.d.ts +0 -1
  69. package/types/server/crypto.d.ts +2 -1
  70. package/types/server/index.d.ts +24 -2
  71. package/src/client/ContextManager.js +0 -111
  72. package/src/client/SharedState.js +0 -84
  73. package/src/client/SharedStateCollection.js +0 -38
  74. package/src/server/Client.js +0 -55
  75. package/src/server/SharedState.js +0 -85
  76. package/src/server/SharedStateCollection.js +0 -39
  77. package/src/server/StateManager.js +0 -696
  78. package/types/client/Client.d.ts.map +0 -1
  79. package/types/client/Context.d.ts.map +0 -1
  80. package/types/client/ContextManager.d.ts.map +0 -1
  81. package/types/client/Plugin.d.ts.map +0 -1
  82. package/types/client/PluginManager.d.ts.map +0 -1
  83. package/types/client/SharedState.d.ts +0 -85
  84. package/types/client/SharedState.d.ts.map +0 -1
  85. package/types/client/SharedStateCollection.d.ts +0 -41
  86. package/types/client/SharedStateCollection.d.ts.map +0 -1
  87. package/types/client/Socket.d.ts +0 -149
  88. package/types/client/Socket.d.ts.map +0 -1
  89. package/types/client/StateManager.d.ts.map +0 -1
  90. package/types/client/index.d.ts.map +0 -1
  91. package/types/common/BasePlugin.d.ts.map +0 -1
  92. package/types/common/BasePluginManager.d.ts.map +0 -1
  93. package/types/common/BaseSharedState.d.ts +0 -244
  94. package/types/common/BaseSharedState.d.ts.map +0 -1
  95. package/types/common/BaseSharedStateCollection.d.ts.map +0 -1
  96. package/types/common/BaseStateManager.d.ts.map +0 -1
  97. package/types/common/BatchedTransport.d.ts.map +0 -1
  98. package/types/common/ParameterBag.d.ts.map +0 -1
  99. package/types/common/PromiseStore.d.ts.map +0 -1
  100. package/types/common/SharedStatePrivate.d.ts +0 -21
  101. package/types/common/SharedStatePrivate.d.ts.map +0 -1
  102. package/types/common/constants.d.ts.map +0 -1
  103. package/types/common/logger.d.ts.map +0 -1
  104. package/types/common/sockets-utils.d.ts.map +0 -1
  105. package/types/common/version.d.ts.map +0 -1
  106. package/types/server/Client.d.ts +0 -45
  107. package/types/server/Client.d.ts.map +0 -1
  108. package/types/server/Context.d.ts.map +0 -1
  109. package/types/server/ContextManager.d.ts +0 -69
  110. package/types/server/ContextManager.d.ts.map +0 -1
  111. package/types/server/Plugin.d.ts.map +0 -1
  112. package/types/server/PluginManager.d.ts.map +0 -1
  113. package/types/server/Server.d.ts.map +0 -1
  114. package/types/server/SharedState.d.ts +0 -86
  115. package/types/server/SharedState.d.ts.map +0 -1
  116. package/types/server/SharedStateCollection.d.ts +0 -41
  117. package/types/server/SharedStateCollection.d.ts.map +0 -1
  118. package/types/server/Socket.d.ts +0 -164
  119. package/types/server/Socket.d.ts.map +0 -1
  120. package/types/server/Sockets.d.ts +0 -80
  121. package/types/server/Sockets.d.ts.map +0 -1
  122. package/types/server/StateManager.d.ts +0 -405
  123. package/types/server/StateManager.d.ts.map +0 -1
  124. package/types/server/audit-network-latency.worker.d.ts.map +0 -1
  125. package/types/server/audit-schema.d.ts.map +0 -1
  126. package/types/server/crypto.d.ts.map +0 -1
  127. package/types/server/index.d.ts.map +0 -1
@@ -1,405 +0,0 @@
1
- export default StateManager;
2
- export namespace server {
3
- /**
4
- * ~schema
5
- *
6
- * Description of a schema to be registered by the {@link server.StateManagerregisterSchema }
7
- *
8
- * A schema is the blueprint, or definition from which shared states can be created.
9
- *
10
- * It consists of a set of key / value pairs where the key is the name of
11
- * the parameter, and the value is an object describing the parameter.
12
- *
13
- * The value can be of any of the foolowing types:
14
- * - {@link server.StateManager ~schemaBooleanDefinition}
15
- * - {@link server.StateManager ~schemaStringDefinition}
16
- * - {@link server.StateManager ~schemaIntegerDefinition}
17
- * - {@link server.StateManager ~schemaFloatDefinition}
18
- * - {@link server.StateManager ~schemaEnumDefinition}
19
- * - {@link server.StateManager ~schemaAnyDefinition}
20
- */
21
- type StateManager = object;
22
- }
23
- /**
24
- * @typedef {object} server.StateManager~schema
25
- *
26
- * Description of a schema to be registered by the {@link server.StateManager#registerSchema}
27
- *
28
- * A schema is the blueprint, or definition from which shared states can be created.
29
- *
30
- * It consists of a set of key / value pairs where the key is the name of
31
- * the parameter, and the value is an object describing the parameter.
32
- *
33
- * The value can be of any of the foolowing types:
34
- * - {@link server.StateManager~schemaBooleanDefinition}
35
- * - {@link server.StateManager~schemaStringDefinition}
36
- * - {@link server.StateManager~schemaIntegerDefinition}
37
- * - {@link server.StateManager~schemaFloatDefinition}
38
- * - {@link server.StateManager~schemaEnumDefinition}
39
- * - {@link server.StateManager~schemaAnyDefinition}
40
- *
41
- * @example
42
- * const mySchema = {
43
- * triggerSound: {
44
- * type: 'boolean',
45
- * event: true,
46
- * },
47
- * volume: {
48
- * type: 'float'
49
- * default: 0,
50
- * min: -80,
51
- * max: 6,
52
- * }
53
- * };
54
- *
55
- * server.stateManager.registerSchema('my-schema-name', mySchema);
56
- */
57
- /**
58
- * Describe a {@link server.StateManager~schema} entry of "boolean" type.
59
- *
60
- * @typedef {object} server.StateManager~schemaBooleanDefinition
61
- * @property {string} type='boolean' - Define a boolean parameter.
62
- * @property {boolean} default - Default value of the parameter.
63
- * @property {boolean} [nullable=false] - Define if the parameter is nullable. If
64
- * set to `true` the parameter `default` is set to `null`.
65
- * @property {boolean} [event=false] - Define if the parameter is a volatile, e.g.
66
- * set its value back to `null` after propagation. When `true`, `nullable` is
67
- * automatically set to `true` and `default` to `null`.
68
- * @property {boolean} [filterChange=true] - Setting this option to `false` forces
69
- * the propagation of a parameter even when its value do not change. It
70
- * offers a kind of middle ground between the default bahavior (e.g. where
71
- * only changed values are propagated) and the behavior of the `event` option
72
- * (which has no state per se). As such, setting this options to `false` if
73
- * `event=true` does not make sens.
74
- * @property {boolean} [immediate=false] - Setting this option to `true` will
75
- * trigger any change (e.g. call the `onUpdate` listeners) immediately on the
76
- * state that generate the update (i.e. calling `set`), before propagating the
77
- * change on the network. This option can be usefull in cases the network
78
- * would introduce a noticeable latency on the client. If for some reason
79
- * the value is overriden server-side (e.g. in an `updateHook`) the listeners
80
- * will be called again on when the "real" / final value will be received.
81
- * @property {object} [metas={}] - Optionnal metadata of the parameter.
82
- */
83
- /**
84
- * Describe a {@link server.StateManager~schema} entry of "string" type.
85
- *
86
- * @typedef {object} server.StateManager~schemaStringDefinition
87
- * @property {string} type='string' - Define a boolean parameter.
88
- * @property {string} default - Default value of the parameter.
89
- * @property {boolean} [nullable=false] - Define if the parameter is nullable. If
90
- * set to `true` the parameter `default` is set to `null`.
91
- * @property {boolean} [event=false] - Define if the parameter is a volatile, e.g.
92
- * set its value back to `null` after propagation. When `true`, `nullable` is
93
- * automatically set to `true` and `default` to `null`.
94
- * @property {boolean} [filterChange=true] - Setting this option to `false` forces
95
- * the propagation of a parameter even when its value do not change. It
96
- * offers a kind of middle ground between the default bahavior (e.g. where
97
- * only changed values are propagated) and the behavior of the `event` option
98
- * (which has no state per se). As such, setting this options to `false` if
99
- * `event=true` does not make sens.
100
- * @property {boolean} [immediate=false] - Setting this option to `true` will
101
- * trigger any change (e.g. call the `onUpdate` listeners) immediately on the
102
- * state that generate the update (i.e. calling `set`), before propagating the
103
- * change on the network. This option can be usefull in cases the network
104
- * would introduce a noticeable latency on the client. If for some reason
105
- * the value is overriden server-side (e.g. in an `updateHook`) the listeners
106
- * will be called again on when the "real" / final value will be received.
107
- * @property {object} [metas={}] - Optionnal metadata of the parameter.
108
- */
109
- /**
110
- * Describe a {@link server.StateManager~schema} entry of "integer" type.
111
- *
112
- * @typedef {object} server.StateManager~schemaIntegerDefinition
113
- * @property {string} type='integer' - Define a boolean parameter.
114
- * @property {number} default - Default value of the parameter.
115
- * @property {number} [min=-Infinity] - Minimum value of the parameter.
116
- * @property {number} [max=+Infinity] - Maximum value of the parameter.
117
- * @property {boolean} [nullable=false] - Define if the parameter is nullable. If
118
- * set to `true` the parameter `default` is set to `null`.
119
- * @property {boolean} [event=false] - Define if the parameter is a volatile, e.g.
120
- * set its value back to `null` after propagation. When `true`, `nullable` is
121
- * automatically set to `true` and `default` to `null`.
122
- * @property {boolean} [filterChange=true] - Setting this option to `false` forces
123
- * the propagation of a parameter even when its value do not change. It
124
- * offers a kind of middle ground between the default bahavior (e.g. where
125
- * only changed values are propagated) and the behavior of the `event` option
126
- * (which has no state per se). As such, setting this options to `false` if
127
- * `event=true` does not make sens.
128
- * @property {boolean} [immediate=false] - Setting this option to `true` will
129
- * trigger any change (e.g. call the `onUpdate` listeners) immediately on the
130
- * state that generate the update (i.e. calling `set`), before propagating the
131
- * change on the network. This option can be usefull in cases the network
132
- * would introduce a noticeable latency on the client. If for some reason
133
- * the value is overriden server-side (e.g. in an `updateHook`) the listeners
134
- * will be called again on when the "real" / final value will be received.
135
- * @property {object} [metas={}] - Optionnal metadata of the parameter.
136
- */
137
- /**
138
- * Describe a {@link server.StateManager~schema} entry of "float" type.
139
- *
140
- * @typedef {object} server.StateManager~schemaFloatDefinition
141
- * @property {string} [type='float'] - Float parameter.
142
- * @property {number} default - Default value.
143
- * @property {number} [min=-Infinity] - Minimum value.
144
- * @property {number} [max=+Infinity] - Maximum value.
145
- * @property {boolean} [nullable=false] - Define if the parameter is nullable. If
146
- * set to `true` the parameter `default` is set to `null`.
147
- * @property {boolean} [event=false] - Define if the parameter is a volatile, e.g.
148
- * set its value back to `null` after propagation. When `true`, `nullable` is
149
- * automatically set to `true` and `default` to `null`.
150
- * @property {boolean} [filterChange=true] - Setting this option to `false` forces
151
- * the propagation of a parameter even when its value do not change. It
152
- * offers a kind of middle ground between the default bahavior (e.g. where
153
- * only changed values are propagated) and the behavior of the `event` option
154
- * (which has no state per se). As such, setting this options to `false` if
155
- * `event=true` does not make sens.
156
- * @property {boolean} [immediate=false] - Setting this option to `true` will
157
- * trigger any change (e.g. call the `onUpdate` listeners) immediately on the
158
- * state that generate the update (i.e. calling `set`), before propagating the
159
- * change on the network. This option can be usefull in cases the network
160
- * would introduce a noticeable latency on the client. If for some reason
161
- * the value is overriden server-side (e.g. in an `updateHook`) the listeners
162
- * will be called again on when the "real" / final value will be received.
163
- * @property {object} [metas={}] - Optionnal metadata of the parameter.
164
- */
165
- /**
166
- * Describe a {@link server.StateManager~schema} entry of "enum" type.
167
- *
168
- * @typedef {object} server.StateManager~schemaEnumDefinition
169
- * @property {string} [type='enum'] - Enum parameter.
170
- * @property {string} default - Default value of the parameter.
171
- * @property {Array} list - Possible values of the parameter.
172
- * @property {boolean} [nullable=false] - Define if the parameter is nullable. If
173
- * set to `true` the parameter `default` is set to `null`.
174
- * @property {boolean} [event=false] - Define if the parameter is a volatile, e.g.
175
- * set its value back to `null` after propagation. When `true`, `nullable` is
176
- * automatically set to `true` and `default` to `null`.
177
- * @property {boolean} [filterChange=true] - Setting this option to `false` forces
178
- * the propagation of a parameter even when its value do not change. It
179
- * offers a kind of middle ground between the default bahavior (e.g. where
180
- * only changed values are propagated) and the behavior of the `event` option
181
- * (which has no state per se). As such, setting this options to `false` if
182
- * `event=true` does not make sens.
183
- * @property {boolean} [immediate=false] - Setting this option to `true` will
184
- * trigger any change (e.g. call the `onUpdate` listeners) immediately on the
185
- * state that generate the update (i.e. calling `set`), before propagating the
186
- * change on the network. This option can be usefull in cases the network
187
- * would introduce a noticeable latency on the client. If for some reason
188
- * the value is overriden server-side (e.g. in an `updateHook`) the listeners
189
- * will be called again on when the "real" / final value will be received.
190
- * @property {object} [metas={}] - Optionnal metadata of the parameter.
191
- */
192
- /**
193
- * Describe a {@link server.StateManager~schema} entry of "any" type.
194
- *
195
- * Note that the `any` type always return a shallow copy of the state internal
196
- * value. Mutating the returned value will therefore not modify the internal state.
197
- *
198
- * @typedef {object} server.StateManager~schemaAnyDefinition
199
- * @property {string} [type='any'] - Parameter of any type.
200
- * @property {*} default - Default value of the parameter.
201
- * @property {boolean} [nullable=false] - Define if the parameter is nullable. If
202
- * set to `true` the parameter `default` is set to `null`.
203
- * @property {boolean} [event=false] - Define if the parameter is a volatile, e.g.
204
- * set its value back to `null` after propagation. When `true`, `nullable` is
205
- * automatically set to `true` and `default` to `null`.
206
- * @property {boolean} [filterChange=true] - Setting this option to `false` forces
207
- * the propagation of a parameter even when its value do not change. It
208
- * offers a kind of middle ground between the default bahavior (e.g. where
209
- * only changed values are propagated) and the behavior of the `event` option
210
- * (which has no state per se). As such, setting this options to `false` if
211
- * `event=true` does not make sens.
212
- * @property {boolean} [immediate=false] - Setting this option to `true` will
213
- * trigger any change (e.g. call the `onUpdate` listeners) immediately on the
214
- * state that generate the update (i.e. calling `set`), before propagating the
215
- * change on the network. This option can be usefull in cases the network
216
- * would introduce a noticeable latency on the client. If for some reason
217
- * the value is overriden server-side (e.g. in an `updateHook`) the listeners
218
- * will be called again on when the "real" / final value will be received.
219
- * @property {object} [metas={}] - Optionnal metadata of the parameter.
220
- */
221
- /**
222
- * @callback server.StateManager~ObserveCallback
223
- * @async
224
- * @param {string} schemaName - name of the schema
225
- * @param {number} stateId - id of the state
226
- * @param {number} nodeId - id of the node that created the state
227
- */
228
- /**
229
- * @callback server.StateManager~updateHook
230
- * @async
231
- *
232
- * @param {object} updates - Update object as given on a set callback, or
233
- * result of the previous hook
234
- * @param {object} currentValues - Current values of the state.
235
- * @param {object} [context=null] - Optionnal context passed by the creator
236
- * of the update.
237
- *
238
- * @return {object} The "real" updates to be applied on the state.
239
- */
240
- /**
241
- * The `StateManager` allows to create new {@link server.SharedState}s, or attach
242
- * to {@link server.SharedState}s created by other nodes (clients or server). It
243
- * can also track all the {@link server.SharedState}s created by other nodes.
244
- *
245
- * An instance of `StateManager` is automatically created by the `soundworks.Server`
246
- * at initialization (cf. {@link server.Server#stateManager}).
247
- *
248
- * Compared to the {@link client.StateManager}, the `server.StateManager` can also
249
- * create and delete schemas, as well as register update hook that are executed when
250
- * a state is updated.
251
- *
252
- * See {@link server.Server#stateManager}
253
- *
254
- * Tutorial: {@link https://soundworks.dev/guide/state-manager.html}
255
- *
256
- * ```
257
- * // server-side
258
- * import { Server } from '@soundworks/server/index.js';
259
- *
260
- * const server = new Server(config);
261
- * // declare and register the schema of a shared state.
262
- * server.stateManager.registerSchema('some-global-state', {
263
- * myRandom: {
264
- * type: 'float',
265
- * default: 0,
266
- * }
267
- * });
268
- *
269
- * await server.start();
270
- *
271
- * // create a global state server-side
272
- * const globalState = await server.stateManager.create('some-global-state');
273
- * // listen and react to the changes made by the clients
274
- * globalState.onUpdate(updates => console.log(updates));
275
- * ```
276
- *
277
- * ```
278
- * // client-side
279
- * import { Client } from '@soundworks/client.index.js';
280
- *
281
- * const client = new Client(config);
282
- * await client.start();
283
- *
284
- * // attach to the global state created by the server
285
- * const globalState = await client.stateManager.attach('some-global-state');
286
- *
287
- * // update the value of a `myRandom` parameter every seconds
288
- * setInterval(() => {
289
- * globalState.set({ myRandom: Math.random() });
290
- * }, 1000);
291
- * ```
292
- *
293
- * @memberof server
294
- * @extends BaseStateManager
295
- * @inheritdoc
296
- * @hideconstructor
297
- */
298
- declare class StateManager extends BaseStateManager {
299
- _clientByNodeId: Map<any, any>;
300
- _sharedStatePrivateById: Map<any, any>;
301
- _schemas: Map<any, any>;
302
- _observers: Set<any>;
303
- _hooksBySchemaName: Map<any, any>;
304
- /**
305
- * Add a client to the manager.
306
- *
307
- * This is automatically handled by the {@link server.Server} when a client connects.
308
- *
309
- * @param {number} nodeId - Id of the client node, as given in
310
- * {@link client.StateManager}
311
- * @param {object} transport - Transport mecanism to communicate with the
312
- * client. Must implement a basic EventEmitter API.
313
- *
314
- * @private
315
- */
316
- private addClient;
317
- /**
318
- * Remove a client from the manager. Clean all created or attached states.
319
- *
320
- * This is automatically handled by the {@link server.Server} when a client disconnects.
321
- *
322
- * @param {number} nodeId - Id of the client node, as given in
323
- * {@link client.StateManager}
324
- *
325
- * @private
326
- */
327
- private removeClient;
328
- /**
329
- * Register a schema from which shared states (cf. {@link common.SharedState})
330
- * can be instanciated.
331
- *
332
- * @param {string} schemaName - Name of the schema.
333
- * @param {server.StateManager~schema} schema - Data structure
334
- * describing the states that will be created from this schema.
335
- *
336
- * @see {@link server.StateManager#create}
337
- * @see {@link client.StateManager#create}
338
- *
339
- * @example
340
- * server.stateManager.registerSchema('my-schema', {
341
- * myBoolean: {
342
- * type: 'boolean'
343
- * default: false,
344
- * },
345
- * myFloat: {
346
- * type: 'float'
347
- * default: 0.1,
348
- * min: -1,
349
- * max: 1
350
- * }
351
- * })
352
- */
353
- registerSchema(schemaName: string, schema: any): void;
354
- /**
355
- * Delete a schema and all associated states.
356
- *
357
- * When a schema is deleted, all states created from this schema are deleted
358
- * as well, therefore all attached clients are detached and the `onDetach`
359
- * and `onDelete` callbacks are called on the related states.
360
- *
361
- * @param {string} schemaName - Name of the schema.
362
- */
363
- deleteSchema(schemaName: string): void;
364
- /**
365
- * Register a function for a given schema (e.g. will be applied on all states
366
- * created from this schema) that will be executed before the update values
367
- * are propagated. For example, this could be used to implement a preset system
368
- * where all the values of the state are updated from e.g. some data stored in
369
- * filesystem while the consumer of the state only want to update the preset name.
370
- *
371
- * The hook is associated to every state of its kind (i.e. schemaName) and
372
- * executed on every update (call of `set`). Note that the hooks are executed
373
- * server-side regarless the node on which `set` has been called and before
374
- * the "actual" update of the state (e.g. before the call of `onUpdate`).
375
- *
376
- * @param {string} schemaName - Kind of states on which applying the hook.
377
- * @param {server.StateManager~updateHook} updateHook - Function
378
- * called between the `set` call and the actual update.
379
- *
380
- * @returns {Fuction} deleteHook - Handler that deletes the hook when executed.
381
- *
382
- * @example
383
- * server.stateManager.registerSchema('hooked', {
384
- * name: { type: 'string', default: null, nullable: true },
385
- * name: { numUpdates: 'integer', default: 0 },
386
- * });
387
- * server.stateManager.registerUpdateHook('hooked', updates => {
388
- * return {
389
- * ...updates
390
- * numUpdates: currentValues.numUpdates + 1,
391
- * };
392
- * });
393
- *
394
- * const state = await server.stateManager.create('hooked');
395
- *
396
- * await state.set({ name: 'test' });
397
- * const values = state.getValues();
398
- * assert.deepEqual(result, { name: 'test', numUpdates: 1 });
399
- */
400
- registerUpdateHook(schemaName: string, updateHook: any): Fuction;
401
- [kIsObservableState](state: any): boolean;
402
- }
403
- import BaseStateManager from '../common/BaseStateManager.js';
404
- declare const kIsObservableState: unique symbol;
405
- //# sourceMappingURL=StateManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StateManager.d.ts","sourceRoot":"","sources":["../../src/server/StateManager.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;wBAkCa,MAAM;;AADnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH;IAII,+BAAgC;IAChC,uCAAwC;IACxC,wBAAyB;IACzB,qBAA2B;IAC3B,kCAAmC;IAerC;;;;;;;;;;;OAWG;IACH,kBA4KC;IAED;;;;;;;;;OASG;IACH,qBAoCC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,2BArBW,MAAM,qBAuChB;IAED;;;;;;;;OAQG;IACH,yBAFW,MAAM,QAwBhB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,+BAxBW,MAAM,4BAkChB;IA5WD,0CAIC;CAyWF;6BAlrB4B,+BAA+B;AA4B5D,gDAAqE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit-network-latency.worker.d.ts","sourceRoot":"","sources":["../../src/server/audit-network-latency.worker.js"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit-schema.d.ts","sourceRoot":"","sources":["../../src/server/audit-schema.js"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/server/crypto.js"],"names":[],"mappings":"AAuBA,8CAKC;AAED,qDAMC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.js"],"names":[],"mappings":""}