@soundworks/core 5.5.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +6 -0
- package/package.json +17 -11
- package/src/client/Client.js +7 -4
- package/src/client/ClientSocket.js +2 -3
- package/src/common/BasePlugin.js +2 -2
- package/src/common/BasePluginManager.js +2 -2
- package/src/common/BaseStateManager.js +253 -221
- package/src/common/ParameterBag.js +14 -14
- package/src/common/SharedState.js +405 -247
- package/src/common/SharedStateCollection.js +82 -32
- package/src/common/constants.js +2 -0
- package/src/common/isomorphic/colored-logger.browser.js +17 -0
- package/src/common/isomorphic/colored-logger.node.js +19 -0
- package/src/common/isomorphic/web-socket.browser.js +1 -0
- package/src/common/isomorphic/web-socket.node.js +3 -0
- package/src/common/logs/gated-logger.js +30 -0
- package/src/common/logs/warnings.js +36 -0
- package/src/common/shared-state-utils.js +102 -0
- package/src/common/version.js +1 -1
- package/src/server/Server.js +23 -35
- package/src/server/ServerClient.js +7 -3
- package/src/server/ServerStateManager.js +242 -227
- package/src/server/SharedStatePrivate.js +105 -68
- package/src/server/create-http-server.js +81 -39
- package/src/server/crypto.js +2 -3
- package/types/client/Client.d.ts.map +1 -1
- package/types/client/ClientSocket.d.ts.map +1 -1
- package/types/common/BaseStateManager.d.ts +34 -47
- package/types/common/BaseStateManager.d.ts.map +1 -1
- package/types/common/ParameterBag.d.ts +28 -6
- package/types/common/ParameterBag.d.ts.map +1 -1
- package/types/common/SharedState.d.ts +55 -29
- package/types/common/SharedState.d.ts.map +1 -1
- package/types/common/SharedStateCollection.d.ts +26 -8
- package/types/common/SharedStateCollection.d.ts.map +1 -1
- package/types/common/constants.d.ts +1 -0
- package/types/common/constants.d.ts.map +1 -1
- package/types/common/isomorphic/colored-logger.browser.d.ts +8 -0
- package/types/common/isomorphic/colored-logger.browser.d.ts.map +1 -0
- package/types/common/isomorphic/colored-logger.node.d.ts +8 -0
- package/types/common/isomorphic/colored-logger.node.d.ts.map +1 -0
- package/types/common/isomorphic/web-socket.browser.d.ts +10 -0
- package/types/common/isomorphic/web-socket.browser.d.ts.map +1 -0
- package/types/common/isomorphic/web-socket.node.d.ts +2 -0
- package/types/common/isomorphic/web-socket.node.d.ts.map +1 -0
- package/types/common/logs/gated-logger.d.ts +9 -0
- package/types/common/logs/gated-logger.d.ts.map +1 -0
- package/types/common/logs/warnings.d.ts +7 -0
- package/types/common/logs/warnings.d.ts.map +1 -0
- package/types/common/shared-state-utils.d.ts +12 -0
- package/types/common/shared-state-utils.d.ts.map +1 -0
- package/types/common/version.d.ts +1 -1
- package/types/server/Server.d.ts.map +1 -1
- package/types/server/ServerClient.d.ts.map +1 -1
- package/types/server/ServerStateManager.d.ts +10 -10
- package/types/server/ServerStateManager.d.ts.map +1 -1
- package/types/server/SharedStatePrivate.d.ts +2 -3
- package/types/server/SharedStatePrivate.d.ts.map +1 -1
- package/types/server/create-http-server.d.ts +1 -0
- package/types/server/create-http-server.d.ts.map +1 -1
- package/types/server/crypto.d.ts.map +1 -1
- package/src/common/logger.js +0 -150
- package/types/common/logger.d.ts +0 -19
- package/types/common/logger.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## v5.7.0 - 2026-10-01
|
|
4
|
+
|
|
5
|
+
- Refactor: SharedState callback and instantiation
|
|
6
|
+
- Feat: introduce blackList and whiteList filters on SharedState and SharedStateCollection (backward compatible)
|
|
7
|
+
- Feat: introduce SharedState#onUpdate(paramName, listener) and SharedStateCollection#onUpdate(paramName, listener) signature (backward compatible)
|
|
8
|
+
- Feat: introduce experimental SharedState#waitFor(condition, timeout) method
|
|
9
|
+
|
|
10
|
+
## v5.6.0 - 2026-09-23
|
|
11
|
+
|
|
12
|
+
- Feat: do not propagate values when acknowledge is false and state has no siblings
|
|
13
|
+
|
|
1
14
|
## v5.5.0 - 2026-06-10
|
|
2
15
|
|
|
3
16
|
- CI: move to node 24
|
package/README.md
CHANGED
|
@@ -42,6 +42,12 @@ Note that the `@soundworks/core` package is automatically installed when creatin
|
|
|
42
42
|
npm install @soundworks/core
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
## Developement Notes
|
|
46
|
+
|
|
47
|
+
### Windows
|
|
48
|
+
|
|
49
|
+
On windows machine, tests may fail when run in node.js command line, due to `openssl` not being found. This is fixed when run with git command line.
|
|
50
|
+
|
|
45
51
|
## Share with Us
|
|
46
52
|
|
|
47
53
|
If you made an application using **soundworks** please let us know here: https://github.com/collective-soundworks/soundworks/discussions/61
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soundworks/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"description": "Open-source creative coding framework for distributed applications based on Web technologies",
|
|
5
5
|
"collaborators": [
|
|
6
6
|
"Benjamin Matuszewski",
|
|
@@ -24,6 +24,16 @@
|
|
|
24
24
|
"types": "./types/server/index.d.ts"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
"imports": {
|
|
28
|
+
"#isomorphic/colored-logger.js": {
|
|
29
|
+
"module": "./src/common/isomorphic/colored-logger.browser.js",
|
|
30
|
+
"node": "./src/common/isomorphic/colored-logger.node.js"
|
|
31
|
+
},
|
|
32
|
+
"#isomorphic/web-socket.js": {
|
|
33
|
+
"module": "./src/common/isomorphic/web-socket.browser.js",
|
|
34
|
+
"node": "./src/common/isomorphic/web-socket.node.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
27
37
|
"repository": {
|
|
28
38
|
"type": "git",
|
|
29
39
|
"url": "git+https://github.com/collective-soundworks/soundworks.git"
|
|
@@ -41,7 +51,7 @@
|
|
|
41
51
|
"distributed-system"
|
|
42
52
|
],
|
|
43
53
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
54
|
+
"node": ">=22.0.0"
|
|
45
55
|
},
|
|
46
56
|
"scripts": {
|
|
47
57
|
"doc": "npm run types && rm -rf docs && jsdoc -c .jsdoc --verbose && cp -R misc/assets docs/",
|
|
@@ -56,14 +66,11 @@
|
|
|
56
66
|
"dependencies": {
|
|
57
67
|
"@ircam/sc-utils": "^1.13.0",
|
|
58
68
|
"cancelable-promise": "^4.3.1",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"isomorphic-ws": "^5.0.0",
|
|
69
|
+
"defu": "^6.1.7",
|
|
70
|
+
"dequal": "^2.0.3",
|
|
62
71
|
"keyv": "^5.6.0",
|
|
63
72
|
"keyv-file": "^5.3.3",
|
|
64
|
-
"
|
|
65
|
-
"pem": "^1.14.8",
|
|
66
|
-
"uuid": "^13.0.0",
|
|
73
|
+
"selfsigned": "^5.5.0",
|
|
67
74
|
"ws": "^8.19.0"
|
|
68
75
|
},
|
|
69
76
|
"devDependencies": {
|
|
@@ -73,13 +80,12 @@
|
|
|
73
80
|
"dotenv": "^17.3.1",
|
|
74
81
|
"eslint": "^10.0.3",
|
|
75
82
|
"jsdoc": "^4.0.5",
|
|
76
|
-
"mocha": "^11.7.
|
|
83
|
+
"mocha": "^11.7.6",
|
|
77
84
|
"puppeteer": "^24.39.0",
|
|
78
85
|
"tcp-ping": "^0.1.1",
|
|
79
86
|
"typescript": "^6.0.2"
|
|
80
87
|
},
|
|
81
88
|
"optionalDependencies": {
|
|
82
|
-
"bufferutil": "^4.1.0"
|
|
83
|
-
"utf-8-validate": "^6.0.6"
|
|
89
|
+
"bufferutil": "^4.1.0"
|
|
84
90
|
}
|
|
85
91
|
}
|
package/src/client/Client.js
CHANGED
|
@@ -23,7 +23,10 @@ import {
|
|
|
23
23
|
CLIENT_HANDSHAKE_ERROR,
|
|
24
24
|
AUDIT_STATE_NAME,
|
|
25
25
|
} from '../common/constants.js';
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
import gatedLogger from '../common/logs/gated-logger.js';
|
|
28
|
+
import warnings from '../common/logs/warnings.js';
|
|
29
|
+
|
|
27
30
|
import VERSION from '../common/version.js';
|
|
28
31
|
|
|
29
32
|
// for testing purposes
|
|
@@ -132,7 +135,7 @@ class Client {
|
|
|
132
135
|
|
|
133
136
|
this[kClientOnStatusChangeCallbacks] = new Set();
|
|
134
137
|
|
|
135
|
-
|
|
138
|
+
gatedLogger.verbose = !!this.#config.env.verbose;
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
/**
|
|
@@ -209,7 +212,7 @@ class Client {
|
|
|
209
212
|
* @deprecated Use {@link Client#runtime} instead.
|
|
210
213
|
*/
|
|
211
214
|
get target() {
|
|
212
|
-
|
|
215
|
+
warnings.deprecated('Client#target', 'Client#runtime', '4.0.0-alpha.29');
|
|
213
216
|
return this.runtime;
|
|
214
217
|
}
|
|
215
218
|
|
|
@@ -335,7 +338,7 @@ class Client {
|
|
|
335
338
|
this.#token = token;
|
|
336
339
|
|
|
337
340
|
if (version !== this.#version) {
|
|
338
|
-
|
|
341
|
+
warnings.versionDiscrepancies(this.#role, this.#version, version);
|
|
339
342
|
}
|
|
340
343
|
|
|
341
344
|
resolve();
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isBrowser } from '@ircam/sc-utils';
|
|
2
|
-
import WebSocket from 'isomorphic-ws';
|
|
3
2
|
|
|
3
|
+
import WebSocket from '#isomorphic/web-socket.js';
|
|
4
4
|
import {
|
|
5
5
|
PING_MESSAGE,
|
|
6
6
|
PONG_MESSAGE,
|
|
7
7
|
} from '../common/constants.js';
|
|
8
|
-
import logger from '../common/logger.js';
|
|
9
8
|
import {
|
|
10
9
|
packStringMessage,
|
|
11
10
|
unpackStringMessage,
|
|
@@ -167,7 +166,7 @@ class ClientSocket {
|
|
|
167
166
|
|
|
168
167
|
if (e.error) {
|
|
169
168
|
const msg = `ClientSocket error - code: ${e.error.code}, message: ${e.error.message}`;
|
|
170
|
-
|
|
169
|
+
console.log(msg);
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
// Try to reconnect in all cases. Note that if the socket has been connected,
|
package/src/common/BasePlugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defu } from 'defu';
|
|
2
2
|
|
|
3
3
|
// Notes: we use Symbol.for because we need to override this in helpers test
|
|
4
4
|
export const kBasePluginStatus = Symbol.for('soundworks:base-plugin-status');
|
|
@@ -171,7 +171,7 @@ class BasePlugin {
|
|
|
171
171
|
* @see {@link BasePluginManager#onStateChange}
|
|
172
172
|
*/
|
|
173
173
|
propagateStateChange(updates) {
|
|
174
|
-
this.state =
|
|
174
|
+
this.state = defu(updates, this.state);
|
|
175
175
|
this.#onStateChangeCallbacks.forEach(callback => callback(this.state));
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
kBasePluginStatus,
|
|
5
5
|
} from './BasePlugin.js';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import gatedLogger from './logs/gated-logger.js';
|
|
8
8
|
|
|
9
9
|
export const kPluginManagerStart = Symbol('soundworks:plugin-manager-start');
|
|
10
10
|
export const kPluginManagerStop = Symbol('soundworks:plugin-manager-stop');
|
|
@@ -64,7 +64,7 @@ class BasePluginManager {
|
|
|
64
64
|
* @private
|
|
65
65
|
*/
|
|
66
66
|
async [kPluginManagerStart]() {
|
|
67
|
-
|
|
67
|
+
gatedLogger.title('starting registered plugins');
|
|
68
68
|
|
|
69
69
|
if (this.#status !== 'idle') {
|
|
70
70
|
throw new DOMException(`Cannot execute 'kPluginManagerStart' on BasePluginManager: Lifecycle methods must be called in following order: kPluginManagerStart, kPluginManagerStop`, 'InvalidAccessError');
|