@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 +0,0 @@
1
- {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/client/Context.js"],"names":[],"mappings":";AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IACE;;;OAGG;IACH,mCAoDC;IA/CC;;;;OAIG;IACH,+BAAoB;IAEpB;;;;OAIG;IACH,iBAHU,MAAM,CAGI;IAqCtB;;;;;;;;;;;;;;;;OAgBG;IACH,4BAEC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,uBAAgB;IAEhB;;;;;;OAMG;IACH,sBAAe;IAEf;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,sBAeC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,qBAUC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContextManager.d.ts","sourceRoot":"","sources":["../../src/client/ContextManager.js"],"names":[],"mappings":";AAuBA;;;;;;;;;GASG;AACH;IAEI,eAAe;IACf,kBAAwC;IACxC,eAAe;IACf,8BAAsC;IAGxC;;;;;OAKG;IACH,iBAMC;IAED;;;;;;OAMG;IACH,oCAyBC;IAED;;;;OAIG;IACH,cAGC;IAED;;;;OAIG;IACH,aAGC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/client/Plugin.js"],"names":[],"mappings":";;;;;2BAMW,aAAa;;AAJxB;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH;IACE;;;;OAIG;IACH,uCAHW,MAAM,EAahB;IAPC;;;;;OAKG;IACH,sBAAoB;CAevB;uBAhEsB,yBAAyB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginManager.d.ts","sourceRoot":"","sources":["../../src/client/PluginManager.js"],"names":[],"mappings":";;;;;4BAQW,MAAM,aACN,gBAAc,IAAI;;AAL7B;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH;IACE;;OAEG;IACH,mCAMC;IAED,kEAQC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAMC;CACF;8BAjI6B,gCAAgC"}
@@ -1,85 +0,0 @@
1
- export default SharedState;
2
- export namespace client {
3
- /**
4
- * ~onUpdateCallback
5
- */
6
- type SharedState = (newValues: any, oldValues: any, context?: Mixed) => any;
7
- }
8
- /**
9
- * @callback client.SharedState~onUpdateCallback
10
- * @param {Object} newValues - Key / value pairs of the updates that have been
11
- * applied to the state.
12
- * @param {Object} oldValues - Key / value pairs of the updated params before
13
- * the updates has been applied to the state.
14
- * @param {Mixed} [context=null] - Optionnal context object that has been passed
15
- * with the values updates in the `set` call.
16
- */
17
- /**
18
- * Delete the registered {@link client.SharedState~onUpdateCallback}.
19
- *
20
- * @callback client.SharedState~deleteOnUpdateCallback
21
- */
22
- /**
23
- * The `SharedState` is one of the most important and versatile abstraction provided
24
- * by `soundworks`. It represents a set of parameters that are synchronized accross
25
- * every nodes of the application (clients and server) that declared some interest
26
- * to the shared state.
27
- *
28
- * A `SharedState` is created according to a "schema" (in the sense of a database
29
- * schema) that must be declared and registered server-side. Any number of `SharedState`s
30
- * can be created from a single schema.
31
- *
32
- * A shared state can be created both by the clients or by the server (in which case
33
- * it is generally considered as a global state of the application). Similarly any
34
- * node of the application (clients or server) can declare interest and "attach" to
35
- * a state created by another node. All node attached to a state can modify its values
36
- * and/or react to the modifications applied by other nodes.
37
- *
38
- * Tutorial: {@link https://soundworks.dev/guide/state-manager.html}
39
- *
40
- * ```
41
- * // server-side
42
- * import { Server } from '@soundworks/server/index.js';
43
- *
44
- * const server = new Server(config);
45
- * // declare and register the schema of a shared state.
46
- * server.stateManager.registerSchema('some-global-state', {
47
- * myRandom: {
48
- * type: 'float',
49
- * default: 0,
50
- * }
51
- * });
52
- *
53
- * await server.start();
54
- *
55
- * // create a global state server-side
56
- * const globalState = await server.stateManager.create('some-global-state');
57
- * // listen and react to the changes made by the clients
58
- * globalState.onUpdate(updates => console.log(updates));
59
- * ```
60
- *
61
- * ```
62
- * // client-side
63
- * import { Client } from '@soundworks/client.index.js';
64
- *
65
- * const client = new Client(config);
66
- * await client.start();
67
- *
68
- * // attach to the global state created by the server
69
- * const globalState = await client.stateManager.attach('some-global-state');
70
- *
71
- * // update the value of a `myRandom` parameter every seconds
72
- * setInterval(() => {
73
- * globalState.set({ myRandom: Math.random() });
74
- * }, 1000);
75
- * ```
76
- *
77
- * @memberof client
78
- * @extends BaseSharedState
79
- * @inheritdoc
80
- * @hideconstructor
81
- */
82
- declare class SharedState extends BaseSharedState {
83
- }
84
- import BaseSharedState from '../common/BaseSharedState.js';
85
- //# sourceMappingURL=SharedState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedState.d.ts","sourceRoot":"","sources":["../../src/client/SharedState.js"],"names":[],"mappings":";;;;;;;AAIA;;;;;;;;GAQG;AAEH;;;;GAIG;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH;CAA4C;4BAjFhB,8BAA8B"}
@@ -1,41 +0,0 @@
1
- export default SharedStateCollection;
2
- export namespace client {
3
- /**
4
- * ~onUpdateCallback
5
- */
6
- type SharedStateCollection = (state: client.SharedState, newValues: any, oldValues: any, context?: Mixed) => any;
7
- }
8
- /**
9
- * @callback client.SharedStateCollection~onUpdateCallback
10
- * @param {client.SharedState} state - State that triggered the update.
11
- * @param {Object} newValues - Key / value pairs of the updates that have been
12
- * applied to the state.
13
- * @param {Object} oldValues - Key / value pairs of the updated params before
14
- * the updates has been applied to the state.
15
- * @param {Mixed} [context=null] - Optionnal context object that has been passed
16
- * with the values updates in the `set` call.
17
- */
18
- /**
19
- * The `SharedStateCollection` interface represent a collection of all states
20
- * created from a given schema name on the network.
21
- *
22
- * It can optionnaly exclude the states created by the current node.
23
- *
24
- * See {@link client.StateManager#getCollection} for factory method API
25
- *
26
- * ```
27
- * const collection = await client.stateManager.getCollection('my-schema');
28
- * const allValues = collection.getValues();
29
- * collection.onUpdate((state, newValues, oldValues, context) => {
30
- * // do something
31
- * });
32
- * ```
33
- * @memberof client
34
- * @extends BaseSharedStateCollection
35
- * @inheritdoc
36
- * @hideconstructor
37
- */
38
- declare class SharedStateCollection extends BaseSharedStateCollection {
39
- }
40
- import BaseSharedStateCollection from '../common/BaseSharedStateCollection.js';
41
- //# sourceMappingURL=SharedStateCollection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedStateCollection.d.ts","sourceRoot":"","sources":["../../src/client/SharedStateCollection.js"],"names":[],"mappings":";;;;;;;AAIA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH;CAAgE;sCAnC1B,wCAAwC"}
@@ -1,149 +0,0 @@
1
- export default Socket;
2
- /**
3
- * The Socket class is a simple publish / subscribe wrapper built on top of the
4
- * [isomorphic-ws](https://github.com/heineiuo/isomorphic-ws) library.
5
- * An instance of `Socket` is automatically created by the `soundworks.Client`
6
- * (see {@link client.Client#socket}).
7
- *
8
- * _Important: In most cases, you should consider using a {@link client.SharedState}
9
- * rather than directly using the sockets._
10
- *
11
- * The Socket class concurrently opens two different WebSockets:
12
- * - a socket configured with `binaryType = 'blob'` for JSON compatible data
13
- * types (i.e. string, number, boolean, object, array and null).
14
- * - a socket configured with `binaryType= 'arraybuffer'` for efficient streaming
15
- * of binary data.
16
- *
17
- * Both sockets re-emits all "native" ws events ('open', 'upgrade', 'close', 'error'
18
- * and 'message'.
19
- *
20
- * @memberof client
21
- * @hideconstructor
22
- */
23
- declare class Socket {
24
- /**
25
- * WebSocket instance configured with `binaryType = 'blob'`.
26
- *
27
- * @private
28
- */
29
- private ws;
30
- /**
31
- * WebSocket instance configured with `binaryType = 'arraybuffer'`.
32
- *
33
- * @private
34
- */
35
- private binaryWs;
36
- /** @private */
37
- private _stringListeners;
38
- /** @private */
39
- private _binaryListeners;
40
- /** @private */
41
- private _heartbeatId;
42
- /**
43
- * Initialize a websocket connection with the server. Automatically called
44
- * during `client.init()`
45
- *
46
- * @param {string} role - Role of the client (see {@link client.Client#role})
47
- * @param {object} config - Configuration of the sockets
48
- * @protected
49
- * @ignore
50
- */
51
- protected init(role: string, config: object): Promise<void>;
52
- /**
53
- * Removes all listeners and immediately close the two sockets. Is automatically
54
- * called on `client.stop()`
55
- *
56
- * Is also called when a disconnection is detected by the heartbeat (note that
57
- * in this case, the launcher will call `client.stop()` but the listeners are
58
- * already cleared so the event will be trigerred only once)
59
- *
60
- * @private
61
- */
62
- private terminate;
63
- /**
64
- * @param {boolean} binary - Emit to either the string or binary socket.
65
- * @param {string} channel - Channel name.
66
- * @param {...*} args - Content of the message.
67
- * @private
68
- */
69
- private _emit;
70
- /**
71
- * @param {Function[]} listeners - List of listeners, either for the string or binary socket.
72
- * @param {string} channel - Channel name.
73
- * @param {Function} callback - The function to be added to the listeners.
74
- * @private
75
- */
76
- private _addListener;
77
- /**
78
- * @param {Function[]} listeners - List of listeners, either for the string or binary socket.
79
- * @param {string} channel - Channel name.
80
- * @param {Function} callback - The function to be removed from the listeners.
81
- * @private
82
- */
83
- private _removeListener;
84
- /**
85
- * @param {Function[]} listeners - List of listeners, either for the string or binary socket.
86
- * @param {string} [channel=null] - Channel name of the listeners to remove. If null
87
- * all the listeners are cleared.
88
- * @private
89
- */
90
- private _removeAllListeners;
91
- /**
92
- * Send messages with JSON compatible data types on a given channel.
93
- *
94
- * @param {string} channel - Channel name.
95
- * @param {...*} args - Payload of the message. As many arguments as needed, of
96
- * JSON compatible data types (i.e. string, number, boolean, object, array and null).
97
- */
98
- send(channel: string, ...args: any[]): void;
99
- /**
100
- * Listen messages with JSON compatible data types on a given channel.
101
- *
102
- * @param {string} channel - Channel name.
103
- * @param {Function} callback - Callback to execute when a message is received,
104
- * arguments of the callback function will match the arguments sent using the
105
- * {@link server.Socket#send} method.
106
- */
107
- addListener(channel: string, callback: Function): void;
108
- /**
109
- * Remove a listener from JSON compatible messages on a given channel.
110
- *
111
- * @param {string} channel - Channel name.
112
- * @param {Function} callback - Callback to remove.
113
- */
114
- removeListener(channel: string, callback: Function): void;
115
- /**
116
- * Remove all listeners of messages with JSON compatible data types.
117
- *
118
- * @param {string} channel - Channel name.
119
- */
120
- removeAllListeners(channel?: string): void;
121
- /**
122
- * Send binary messages on a given channel.
123
- *
124
- * @param {string} channel - Channel name.
125
- * @param {TypedArray} typedArray - Binary data to be sent.
126
- */
127
- sendBinary(channel: string, typedArray: TypedArray): void;
128
- /**
129
- * Listen binary messages on a given channel
130
- *
131
- * @param {string} channel - Channel name.
132
- * @param {Function} callback - Callback to execute when a message is received.
133
- */
134
- addBinaryListener(channel: string, callback: Function): void;
135
- /**
136
- * Remove a listener of binary compatible messages from a given channel
137
- *
138
- * @param {string} channel - Channel name.
139
- * @param {Function} callback - Callback to remove.
140
- */
141
- removeBinaryListener(channel: string, callback: Function): void;
142
- /**
143
- * Remove all listeners of binary compatible messages on a given channel
144
- *
145
- * @param {string} channel - Channel of the message.
146
- */
147
- removeAllBinaryListeners(channel?: string): void;
148
- }
149
- //# sourceMappingURL=Socket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Socket.d.ts","sourceRoot":"","sources":["../../src/client/Socket.js"],"names":[],"mappings":";AAiCA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAEI;;;;OAIG;IACH,WAAc;IACd;;;;OAIG;IACH,iBAAoB;IACpB,eAAe;IACf,yBAAiC;IACjC,eAAe;IACf,yBAAiC;IACjC,eAAe;IACf,qBAAwB;IAG1B;;;;;;;;OAQG;IACH,qBALW,MAAM,UACN,MAAM,iBA+KhB;IAED;;;;;;;;;OASG;IACH,kBAmBC;IAED;;;;;OAKG;IACH,cAOC;IAED;;;;;OAKG;IACH,qBAOC;IAED;;;;;OAKG;IACH,wBASC;IAED;;;;;OAKG;IACH,4BAMC;IAED;;;;;;OAMG;IACH,cAJW,MAAM,wBAOhB;IAED;;;;;;;OAOG;IACH,qBALW,MAAM,4BAOhB;IAED;;;;;OAKG;IACH,wBAHW,MAAM,4BAKhB;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,oBAHW,MAAM,gCAMhB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,4BAKhB;IAED;;;;;OAKG;IACH,8BAHW,MAAM,4BAKhB;IAED;;;;OAIG;IACH,mCAFW,MAAM,QAIhB;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StateManager.d.ts","sourceRoot":"","sources":["../../src/client/StateManager.js"],"names":[],"mappings":";;;;;;;AAEA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH;CAA8C;6BAhEjB,+BAA+B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.js"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BasePlugin.d.ts","sourceRoot":"","sources":["../../src/common/BasePlugin.js"],"names":[],"mappings":";AAEA;;GAEG;AACH;IACE,qBAoCC;IAnCC,eAAe;IACf,YAAa;IACb,eAAe;IACf,cAAkC;IAElC;;;;OAIG;IACH,SAFU,MAAM,CAEC;IAEjB;;;;;;;;;;;OAWG;IACH,iBAPU,MAAM,CAOD;IAEf;;;;OAIG;IACH,QAFU,MAAM,CAEI;IAEpB,eAAe;IACf,gCAAwC;IAG1C;;;;;;;OAOG;IACH,0BAEC;IAED;;;;;;;;;OASG;IACH,4BAEC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,uBAAgB;IAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,sBAAe;IAEf;;;;;;;;;;;;;OAaG;IACH,4CAGC;IAED;;;;;;;;;;OAUG;IACH,8BANW,MAAM,QAShB;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BasePluginManager.d.ts","sourceRoot":"","sources":["../../src/common/BasePluginManager.js"],"names":[],"mappings":";AAIA;;;;GAIG;AACH;IACE,uBAcC;IAZC,eAAe;IACf,cAAiB;IACjB,eAAe;IACf,sBAA8B;IAC9B,eAAe;IACf,mBAA2B;IAC3B,eAAe;IACf,+BAAuC;IACvC,eAAe;IACf,gCAAwC;IAExC,eAAoB;IAGtB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAfW,MAAM,uBAGN,MAAM,sBA6ChB;IAED;;;;OAIG;IACH,sDAGC;IAED;;;OAGG;IACH,wBAFa,MAAM,EAAE,CAIpB;IAED;;;;OAIG;IACH,cAyBC;IAED,eAAe;IACf,aAIC;IAED;;;;;;OAMG;IACH,kBAqDC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,4CAGC;IAED,eAAe;IACf,8BAaC;CACF"}
@@ -1,244 +0,0 @@
1
- export default BaseSharedState;
2
- declare class BaseSharedState {
3
- constructor(id: any, remoteId: any, schemaName: any, schema: any, client: any, isOwner: any, manager: any, initValues: any, filter: any);
4
- /** @private */
5
- private _id;
6
- /** @private */
7
- private _remoteId;
8
- /** @private */
9
- private _schemaName;
10
- /** @private */
11
- private _isOwner;
12
- /** @private */
13
- private _client;
14
- /** @private */
15
- private _manager;
16
- /** @private */
17
- private _filter;
18
- /**
19
- * true is the state has been detached or deleted
20
- * @private
21
- */
22
- private _detached;
23
- _promiseStore: PromiseStore;
24
- /** @private */
25
- private _parameters;
26
- /** @private */
27
- private _onUpdateCallbacks;
28
- /** @private */
29
- private _onDetachCallbacks;
30
- /** @private */
31
- private _onDeleteCallbacks;
32
- /**
33
- * Id of the state
34
- * @type {Number}
35
- * @readonly
36
- */
37
- readonly get id(): number;
38
- /**
39
- * Unique id of the state for the current node
40
- * @readonly
41
- * @type {Number}
42
- * @private
43
- */
44
- private readonly get remoteId();
45
- /**
46
- * Name of the schema
47
- * @type {String}
48
- * @readonly
49
- */
50
- readonly get schemaName(): string;
51
- /**
52
- * Indicates if the node is the owner of the state
53
- * @type {Boolean}
54
- * @readonly
55
- */
56
- readonly get isOwner(): boolean;
57
- /** @private */
58
- private _clearTransport;
59
- /** @private */
60
- private _commit;
61
- /**
62
- * Update values of the state.
63
- *
64
- * The returned `Promise` resolves on the applied updates, when all the `onUpdate`
65
- * callbacks have resolved themselves, i.e.:
66
- *
67
- * ```js
68
- * server.stateManager.registerSchema('test', {
69
- * myBool: { type: 'boolean', default: false },
70
- * });
71
- * const a = await server.stateManager.create('a');
72
- * let asyncCallbackCalled = false;
73
- *
74
- * a.onUpdate(updates => {
75
- * return new Promise(resolve => {
76
- * setTimeout(() => {
77
- * asyncCallbackCalled = true;
78
- * resolve();
79
- * }, 100);
80
- * });
81
- * });
82
- *
83
- * const updates = await a.set({ myBool: true });
84
- * assert.equal(asyncCallbackCalled, true);
85
- * assert.deepEqual(updates, { myBool: true });
86
- * ```
87
- *
88
- * @param {object} updates - key / value pairs of updates to apply to the state.
89
- * @param {mixed} [context=null] - optionnal contextual object that will be propagated
90
- * alongside the updates of the state. The context is valid only for the
91
- * current call and will be passed as third argument to all update listeners.
92
- * @returns {Promise<Object>} A promise to the (coerced) updates.
93
- * @example
94
- * const state = await client.state.attach('globals');
95
- * const updates = await state.set({ myParam: Math.random() });
96
- */
97
- set(updates: object, context?: mixed): Promise<any>;
98
- /**
99
- * Get the value of a parameter of the state. If the parameter is of `any` type,
100
- * a deep copy is returned.
101
- *
102
- * @param {string} name - Name of the param.
103
- * @throws Throws if `name` does not correspond to an existing field
104
- * of the state.
105
- * @return {mixed}
106
- * @example
107
- * const value = state.get('paramName');
108
- */
109
- get(name: string): mixed;
110
- /**
111
- * Similar to `get` but returns a reference to the underlying value in case of
112
- * `any` type. May be usefull if the underlying value is big (e.g. sensors
113
- * recordings, etc.) and deep cloning expensive. Be aware that if changes are
114
- * made on the returned object, the state of your application will become
115
- * inconsistent.
116
- *
117
- * @param {string} name - Name of the param.
118
- * @throws Throws if `name` does not correspond to an existing field
119
- * of the state.
120
- * @return {mixed}
121
- * @example
122
- * const value = state.getUnsafe('paramName');
123
- */
124
- getUnsafe(name: string): mixed;
125
- /**
126
- * Get all the key / value pairs of the state.
127
- *
128
- * If a parameter is of `any` type, a deep copy is made.
129
- *
130
- * @return {object}
131
- * @example
132
- * const values = state.getValues();
133
- */
134
- getValues(): object;
135
- /**
136
- * Get all the key / value pairs of the state.
137
- *
138
- * Similar to `getValues` but returns a reference to the underlying value in
139
- * case of `any` type. May be usefull if the underlying value is big (e.g.
140
- * sensors recordings, etc.) and deep cloning expensive. Be aware that if
141
- * changes are made on the returned object, the state of your application will
142
- * become inconsistent.
143
- *
144
- * @return {object}
145
- * @example
146
- * const values = state.getValues();
147
- */
148
- getValuesUnsafe(): object;
149
- /**
150
- * Definition of schema from which the state has been created.
151
- *
152
- * @param {string} [name=null] - If given, returns only the definition
153
- * corresponding to the given param name.
154
- * @throws Throws if `name` does not correspond to an existing field
155
- * of the schema.
156
- * @return {object}
157
- * @example
158
- * const schema = state.getSchema();
159
- */
160
- getSchema(name?: string): object;
161
- /**
162
- * Get the values with which the state has been created. May defer from the
163
- * default values declared in the schema.
164
- *
165
- * @return {object}
166
- * @example
167
- * const initValues = state.getInitValues();
168
- */
169
- getInitValues(): object;
170
- /**
171
- * Get the default values as declared in the schema.
172
- *
173
- * @return {object}
174
- * @example
175
- * const defaults = state.getDefaults();
176
- */
177
- getDefaults(): object;
178
- /**
179
- * Detach from the state. If the client is the creator of the state, the state
180
- * is deleted and all attached nodes get notified.
181
- *
182
- * @example
183
- * const state = await client.state.attach('globals');
184
- * // later
185
- * await state.detach();
186
- */
187
- detach(): Promise<any>;
188
- /**
189
- * Delete the state. Only the creator/owner of the state can use this method.
190
- *
191
- * All nodes attached to the state will be detached, triggering any registered
192
- * `onDetach` callbacks. The creator of the state will also have its own `onDelete`
193
- * callback triggered. The local `onDeatch` and `onDelete` callbacks will be
194
- * executed *before* the returned Promise resolves
195
- *
196
- * @throws Throws if the method is called by a node which is not the owner of
197
- * the state.
198
- * @example
199
- * const state = await client.state.create('my-schema-name');
200
- * // later
201
- * await state.delete();
202
- */
203
- delete(): Promise<any>;
204
- /**
205
- * Subscribe to state updates.
206
- *
207
- * @param {client.SharedState~onUpdateCallback|server.SharedState~onUpdateCallback} callback
208
- * Callback to execute when an update is applied on the state.
209
- * @param {Boolean} [executeListener=false] - Execute the callback immediately
210
- * with current state values. (`oldValues` will be set to `{}`, and `context` to `null`)
211
- * @returns {client.SharedState~deleteOnUpdateCallback|server.SharedState~deleteOnUpdateCallback}
212
- * @example
213
- * const unsubscribe = state.onUpdate(async (newValues, oldValues, context) => {
214
- * for (let [key, value] of Object.entries(newValues)) {
215
- * switch (key) {
216
- * // do something
217
- * }
218
- * }
219
- * });
220
- *
221
- * // later
222
- * unsubscribe();
223
- */
224
- onUpdate(listener: any, executeListener?: boolean): client.SharedState;
225
- /**
226
- * Register a function to execute when detaching from the state. The function
227
- * will be executed before the `detach` promise resolves.
228
- *
229
- * @param {Function} callback - Callback to execute when detaching from the state.
230
- * Whether the client as called `detach`, or the state has been deleted by its
231
- * creator.
232
- */
233
- onDetach(callback: Function): () => boolean;
234
- /**
235
- * Register a function to execute when the state is deleted. Only called if the
236
- * node was the creator of the state. Is called after `onDetach` and executed
237
- * before the `delete` Promise resolves.
238
- *
239
- * @param {Function} callback - Callback to execute when the state is deleted.
240
- */
241
- onDelete(callback: Function): () => boolean;
242
- }
243
- import PromiseStore from './PromiseStore.js';
244
- //# sourceMappingURL=BaseSharedState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseSharedState.d.ts","sourceRoot":"","sources":["../../src/common/BaseSharedState.js"],"names":[],"mappings":";AAyBA;IACE,yIA8JC;IA7JC,eAAe;IACf,YAAa;IACb,eAAe;IACf,kBAAyB;IACzB,eAAe;IACf,oBAA6B;IAC7B,eAAe;IACf,iBAAuB;IACvB,eAAe;IACf,gBAAqB;IACrB,eAAe;IACf,iBAAuB;IACvB,eAAe;IACf,gBAAqB;IAErB;;;OAGG;IACH,kBAAsB;IAEtB,4BAA4D;IAG1D,eAAe;IACf,oBAAuD;IAQzD,eAAe;IACf,2BAAmC;IACnC,eAAe;IACf,2BAAmC;IACnC,eAAe;IACf,2BAAmC;IAyHrC;;;;OAIG;IACH,0BAEC;IAED;;;;;OAKG;IACH,gCAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;;OAIG;IACH,gCAEC;IAED,eAAe;IACf,wBAcC;IAED,eAAe;IACf,gBAoDC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,aATW,MAAM,oBAIJ,YAAe,CA8G3B;IAED;;;;;;;;;;OAUG;IACH,UAPW,MAAM,SAmBhB;IAED;;;;;;;;;;;;;OAaG;IACH,gBAPW,MAAM,SAmBhB;IAED;;;;;;;;OAQG;IACH,aAJY,MAAM,CAgBjB;IAED;;;;;;;;;;;;OAYG;IACH,mBAJY,MAAM,CAgBjB;IAED;;;;;;;;;;OAUG;IACH,iBARW,MAAM,GAIL,MAAM,CAMjB;IAED;;;;;;;OAOG;IACH,iBAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,eAJY,MAAM,CAMjB;IAED;;;;;;;;OAQG;IACH,uBAmBC;IAED;;;;;;;;;;;;;;OAcG;IACH,uBAUC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,uEAaC;IAED;;;;;;;OAOG;IACH,4CAGC;IAED;;;;;;OAMG;IACH,4CAGC;CACF;yBArrBwB,mBAAmB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseSharedStateCollection.d.ts","sourceRoot":"","sources":["../../src/common/BaseSharedStateCollection.js"],"names":[],"mappings":";AAAA,eAAe;AACf;IACE,4EAaC;IAZC,mBAAiC;IACjC,iBAA6B;IAC7B,aAAqB;IACrB;;MAA+D;IAE/D,aAAmB;IACnB,eAAiB;IAEjB,6BAAmC;IACnC,6BAAmC;IACnC,6BAAmC;IACnC,gBAAsB;IAGxB,eAAe;IACf,cAiCC;IAED;;;;OAIG;IACH,8BAEC;IAED;;;;OAIG;IACH,4BAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;;;;;;;;OAUG;IACH,iBARW,MAAM,GAIL,MAAM,CAUjB;IAED;;;;;;OAMG;IACH,eAJY,MAAM,CAUjB;IAED;;;OAGG;IACH,aAFY,KAAQ,CAInB;IAED;;;;;;;;;;OAUG;IACH,mBAFY,KAAQ,CAInB;IAED;;;;;OAKG;IACH,mBAFY,GAAG,EAAE,CAMhB;IAED;;;;;;;;;OASG;IACH,yBAFY,GAAG,EAAE,CAMhB;IAED;;;;;;OAMG;IACH,aALW,MAAM,mCAUhB;IAED;;;;;;;;;OASG;IACH,6DAcC;IAED;;;;;;;;OAQG;IACH,mEAQC;IAED;;;;;;OAMG;IACH,uCAIC;IAED;;;OAGG;IACH,wBAQC;IAED;;;;;OAKG;IACH,8BAEC;IAED;;;;;;OAMG;IACH,2BAEC;IAED;;;;;;;OAOG;IACH,8BAEC;IAED;;;;OAIG;IACH,2BAEC;IAED;;;;;;;OAOG;IACH,0BAEC;IAED;;OAEG;IACH;;;;;MAYC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseStateManager.d.ts","sourceRoot":"","sources":["../../src/common/BaseStateManager.js"],"names":[],"mappings":";AAwBA,eAAe;AACf;IAEI,2BAA4B;IAC5B,8BAA+B;IAE/B,4BAAkC;IAClC,wCAAyC;IAEzC,4BAAuC;IAGzC;;;;;OAKG;IACH,eAAe;IACf,aAgIC;IA9HC;;;MAAiD;IAgInD,eAAe;IACf,uBAYC;IAED;;;;;;;OAOG;IACH,4CAYC;IAED;;;;;;;;;;;OAWG;IACH,8CANa,uCAAqC,CAYjD;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,2DATW,QAAM,IAAI,mBAER,uCAAqC,CA8CjD;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IAIH,yBAfa,iBAAiB,CAsH7B;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,0BAXW,MAAM;QAIY,YAAY,GAA9B,OAAO;wBAEL,2DAAyD,CA2CrE;CACF;yBA/ewB,mBAAmB;6BAFf,uBAAuB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BatchedTransport.d.ts","sourceRoot":"","sources":["../../src/common/BatchedTransport.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH;IACE,4BAkBC;IAjBC,gBAA2B;IAC3B,0BAA2B;IAC3B,cAAgB;IAChB,kBAAqB;IAgBvB,+CAOC;IAED,kDAWC;IAED,kDAKC;IAED,wCAOC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ParameterBag.d.ts","sourceRoot":"","sources":["../../src/common/ParameterBag.js"],"names":[],"mappings":";;;;;;;;;;;QAiBoB,kEAMf;;;;;;;QAOe,0EAMf;;;;;;;;QAUe,8CAgBf;QACe,0EAMf;;;;;;;;QAUe,gDAgBf;;QACe,0EAMf;;;;;;;;QAOe,uEAOf;;;;;;;;;QAOe,uEAGf;;;;;AAKL;;;GAGG;AACH;IACE,yCAsBC;IAED,0CAqEC;IA7DC;;;;;;;;OAQG;IACH,gBAAiB;IAEjB;;;;;;;;OAQG;IACH,gBAAiB;IA2CnB;;;;;OAKG;IACH,UAHW,MAAM,WAKhB;IAED;;;;;OAKG;IACH,aAFY,MAAM,CAUjB;IAED;;;;;;;;OAQG;IACH,mBAFY,MAAM,CAUjB;IAED;;;;;;OAMG;IACH,UAHW,MAAM,SAehB;IAED;;;;;;;;;OASG;IACH,gBAHW,MAAM,SAShB;IAED;;;;;;OAMG;IACH,+CAiBC;IAED;;;;;;;;OAQG;IACH,UAJW,MAAM,uBAsBhB;IAED;;;;;;OAMG;IAWH;;;;OAIG;IACH,uBAFY,MAAM,CAYjB;IAGD,oBAQC;IAGD,kBAQC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PromiseStore.d.ts","sourceRoot":"","sources":["../../src/common/PromiseStore.js"],"names":[],"mappings":"AAEA;IACE,uBAIC;IAHC,UAAgB;IAChB,qBAAsB;IACtB,uBAAsC;IAGxC,iEAKC;IAED,qCAcC;IAED,mCASC;IAGD,cAOC;CACF"}
@@ -1,21 +0,0 @@
1
- export default SharedStatePrivate;
2
- /**
3
- * The "real" state, this instance is kept private by the server.StateManager.
4
- * It can only be accessed through a SharedState proxy.
5
- *
6
- * @private
7
- */
8
- declare class SharedStatePrivate {
9
- constructor(id: any, schemaName: any, schema: any, manager: any, initValues?: {});
10
- id: any;
11
- schemaName: any;
12
- _manager: any;
13
- _parameters: ParameterBag;
14
- _attachedClients: Map<any, any>;
15
- _creatorRemoteId: any;
16
- _creatorId: any;
17
- _attachClient(remoteId: any, client: any, isOwner: any, filter: any): void;
18
- _detachClient(remoteId: any, client: any): void;
19
- }
20
- import ParameterBag from '../common/ParameterBag.js';
21
- //# sourceMappingURL=SharedStatePrivate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedStatePrivate.d.ts","sourceRoot":"","sources":["../../src/common/SharedStatePrivate.js"],"names":[],"mappings":";AAgCA;;;;;GAKG;AACH;IACE,kFAUC;IATC,QAAY;IACZ,gBAA4B;IAE5B,cAAuB;IACvB,0BAAuD;IACvD,gCAAiC;IAEjC,sBAA4B;IAC5B,gBAAsB;IAGxB,2EAwKC;IAED,gDAMC;CACF;yBApOwB,2BAA2B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.js"],"names":[],"mappings":"AACA,2BAA4B;AAE5B,mCAAuC;AACvC,0CAA2C;AAC3C,oCAAqC;AACrC,oCAAqC;AAGrC,8CAA+C;AAG/C,uCAAwC;AACxC,wCAAyC;AACzC,qCAAsC;AAEtC,wCAAyC;AACzC,yCAA0C;AAC1C,sCAAuC;AACvC,6CAA8C;AAE9C,uCAAwC;AACxC,wCAAyC;AACzC,qCAAsC;AAEtC,wCAAyC;AACzC,yCAA0C;AAC1C,sCAAuC;AAEvC,wCAAyC;AACzC,yCAA0C;AAC1C,sCAAuC;AACvC,6CAA8C;AAE9C,gDAAiD;AAEjD,uCAAwC;AACxC,wCAAyC;AACzC,oCAAqC;AACrC,4CAA6C;AAE7C,oCAAqC;AAErC,2CAA4C;AAC5C,4CAA6C;AAC7C,yCAA0C;AAG1C,+CAAgD;AAChD,gDAAiD;AACjD,6CAA8C;AAE9C,8CAA+C;AAC/C,+CAAgD;AAChD,4CAA6C;AAG7C,kDAAmD;AACnD,mDAAoD;AACpD,gDAAiD;AAGjD,2CAA4C;AAC5C,sCAAiD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/common/logger.js"],"names":[],"mappings":";;;IASE,uCAEC;IAED,+BAOC;IAED,gEAgEC;IAED,0DAMC;IAED,sCAMC;IAED,wCAMC;IAED,sCAMC;IAED,wCAMC;IAED,6BAMC;IAED,8BAMC;IAED,+BAMC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sockets-utils.d.ts","sourceRoot":"","sources":["../../src/common/sockets-utils.js"],"names":[],"mappings":"AAqBA,eAAe;AACf,4EAqBC;AAED,eAAe;AACf,wDAeC;AAED,eAAe;AACf,wEAEC;AAED,eAAe;AACf,oDAEC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/common/version.js"],"names":[],"mappings":""}