@soundworks/core 4.0.0-alpha.9 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -0
- package/README.md +14 -29
- package/package.json +24 -42
- package/src/client/Client.js +306 -256
- package/src/client/{Context.js → ClientContext.js} +63 -54
- package/src/client/ClientContextManager.js +115 -0
- package/src/client/{Plugin.js → ClientPlugin.js} +23 -19
- package/src/client/{PluginManager.js → ClientPluginManager.js} +43 -40
- package/src/client/ClientSocket.js +270 -0
- package/src/client/{StateManager.js → ClientStateManager.js} +13 -13
- package/src/client/index.js +36 -39
- package/src/common/BasePlugin.js +64 -58
- package/src/common/BasePluginManager.js +191 -142
- package/src/common/BaseStateManager.js +635 -145
- package/src/common/BatchedTransport.js +73 -0
- package/src/common/ParameterBag.js +90 -93
- package/src/common/PromiseStore.js +54 -0
- package/src/common/SharedState.js +821 -0
- package/src/common/SharedStateCollection.js +492 -0
- package/src/common/constants.js +14 -2
- package/src/common/logger.js +64 -68
- package/src/common/shared-state-types.js +82 -0
- package/src/common/sockets-utils.js +0 -64
- package/src/common/version.js +2 -0
- package/src/server/Server.js +552 -824
- package/src/server/ServerClient.js +74 -0
- package/src/server/{Context.js → ServerContext.js} +96 -77
- package/src/server/{ContextManager.js → ServerContextManager.js} +107 -87
- package/src/server/{Plugin.js → ServerPlugin.js} +30 -32
- package/src/server/ServerPluginManager.js +177 -0
- package/src/server/ServerSocket.js +256 -0
- package/src/server/ServerSockets.js +150 -0
- package/src/server/ServerStateManager.js +706 -0
- package/src/server/SharedStatePrivate.js +277 -0
- package/src/server/audit-network-latency.worker.js +19 -4
- package/src/server/{audit-schema.js → audit-state-class-description.js} +3 -2
- package/src/server/create-http-server.js +127 -0
- package/src/server/crypto.js +8 -7
- package/src/server/index.js +60 -17
- package/types/client/Client.d.ts +95 -70
- package/types/client/{Context.d.ts → ClientContext.d.ts} +59 -34
- package/types/client/{ContextManager.d.ts → ClientContextManager.d.ts} +19 -22
- package/types/client/ClientPlugin.d.ts +51 -0
- package/types/client/ClientPluginManager.d.ts +112 -0
- package/types/client/ClientSocket.d.ts +76 -0
- package/types/client/{StateManager.d.ts → ClientStateManager.d.ts} +18 -21
- package/types/client/index.d.ts +33 -6
- package/types/common/BasePlugin.d.ts +64 -53
- package/types/common/BasePluginManager.d.ts +84 -39
- package/types/common/BaseStateManager.d.ts +227 -49
- package/types/common/BatchedTransport.d.ts +17 -0
- package/types/common/ParameterBag.d.ts +73 -76
- package/types/common/PromiseStore.d.ts +11 -0
- package/types/common/SharedState.d.ts +291 -0
- package/types/common/SharedStateCollection.d.ts +311 -0
- package/types/common/constants.d.ts +10 -3
- package/types/common/logger.d.ts +8 -6
- package/types/common/shared-state-types.d.ts +95 -0
- package/types/common/sockets-utils.d.ts +0 -5
- package/types/common/version.d.ts +2 -0
- package/types/server/Server.d.ts +215 -136
- package/types/server/ServerClient.d.ts +45 -0
- package/types/server/ServerContext.d.ts +209 -0
- package/types/server/ServerContextManager.d.ts +75 -0
- package/types/server/ServerPlugin.d.ts +57 -0
- package/types/server/ServerPluginManager.d.ts +115 -0
- package/types/server/ServerSocket.d.ts +69 -0
- package/types/server/ServerSockets.d.ts +42 -0
- package/types/server/ServerStateManager.d.ts +284 -0
- package/types/server/SharedStatePrivate.d.ts +23 -0
- package/types/server/audit-network-latency.worker.d.ts +2 -2
- package/types/server/{audit-schema.d.ts → audit-state-class-description.d.ts} +8 -9
- package/types/server/create-http-server.d.ts +5 -0
- package/types/server/crypto.d.ts +4 -0
- package/types/server/index.d.ts +51 -3
- package/.eslintrc +0 -15
- package/.github/workflows/gh-pages.yml +0 -31
- package/.github/workflows/unit-tests.yml +0 -18
- package/src/client/ContextManager.js +0 -111
- package/src/client/SharedState.js +0 -84
- package/src/client/SharedStateCollection.js +0 -35
- package/src/client/Socket.js +0 -402
- package/src/common/BaseSharedState.js +0 -583
- package/src/common/BaseSharedStateCollection.js +0 -179
- package/src/common/SharedStatePrivate.js +0 -192
- package/src/common/promise-store.js +0 -25
- package/src/server/Client.js +0 -55
- package/src/server/PluginManager.js +0 -170
- package/src/server/SharedState.js +0 -85
- package/src/server/SharedStateCollection.js +0 -36
- package/src/server/Socket.js +0 -396
- package/src/server/Sockets.js +0 -224
- package/src/server/StateManager.js +0 -620
- package/tsconfig.json +0 -21
- package/types/client/Client.d.ts.map +0 -1
- package/types/client/Context.d.ts.map +0 -1
- package/types/client/ContextManager.d.ts.map +0 -1
- package/types/client/Plugin.d.ts +0 -53
- package/types/client/Plugin.d.ts.map +0 -1
- package/types/client/PluginManager.d.ts +0 -96
- package/types/client/PluginManager.d.ts.map +0 -1
- package/types/client/SharedState.d.ts +0 -85
- package/types/client/SharedState.d.ts.map +0 -1
- package/types/client/Socket.d.ts +0 -138
- package/types/client/Socket.d.ts.map +0 -1
- package/types/client/StateManager.d.ts.map +0 -1
- package/types/client/index.d.ts.map +0 -1
- package/types/common/BasePlugin.d.ts.map +0 -1
- package/types/common/BasePluginManager.d.ts.map +0 -1
- package/types/common/BaseSharedState.d.ts +0 -173
- package/types/common/BaseSharedState.d.ts.map +0 -1
- package/types/common/BaseStateManager.d.ts.map +0 -1
- package/types/common/ParameterBag.d.ts.map +0 -1
- package/types/common/SharedStatePrivate.d.ts +0 -20
- package/types/common/SharedStatePrivate.d.ts.map +0 -1
- package/types/common/constants.d.ts.map +0 -1
- package/types/common/logger.d.ts.map +0 -1
- package/types/common/promise-store.d.ts +0 -4
- package/types/common/promise-store.d.ts.map +0 -1
- package/types/common/sockets-utils.d.ts.map +0 -1
- package/types/common/utils.d.ts +0 -5
- package/types/common/utils.d.ts.map +0 -1
- package/types/server/Client.d.ts +0 -40
- package/types/server/Client.d.ts.map +0 -1
- package/types/server/Context.d.ts +0 -59
- package/types/server/Context.d.ts.map +0 -1
- package/types/server/ContextManager.d.ts +0 -69
- package/types/server/ContextManager.d.ts.map +0 -1
- package/types/server/Plugin.d.ts +0 -70
- package/types/server/Plugin.d.ts.map +0 -1
- package/types/server/PluginManager.d.ts +0 -91
- package/types/server/PluginManager.d.ts.map +0 -1
- package/types/server/Server.d.ts.map +0 -1
- package/types/server/SharedState.d.ts +0 -86
- package/types/server/SharedState.d.ts.map +0 -1
- package/types/server/Socket.d.ts +0 -128
- package/types/server/Socket.d.ts.map +0 -1
- package/types/server/Sockets.d.ts +0 -73
- package/types/server/Sockets.d.ts.map +0 -1
- package/types/server/StateManager.d.ts +0 -190
- package/types/server/StateManager.d.ts.map +0 -1
- package/types/server/audit-network-latency.worker.d.ts.map +0 -1
- package/types/server/audit-schema.d.ts.map +0 -1
- package/types/server/index.d.ts.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
## v5.0.0 - 2025-01-30
|
|
2
|
+
|
|
3
|
+
### Breaking
|
|
4
|
+
|
|
5
|
+
_Note that most breaking changes won't break but trigger a warning._
|
|
6
|
+
|
|
7
|
+
Change `SharedState` semantics:
|
|
8
|
+
|
|
9
|
+
- rename `SharedStateClassSchema` to `SharedStateClassDescription`
|
|
10
|
+
- rename `SharedState#schemaName` to `SharedState#className`
|
|
11
|
+
- rename `SharedState#getSchema()` to `SharedState#getDescription()`
|
|
12
|
+
- rename `SharedStateCollection#schemaName` to `SharedStateCollection#className`
|
|
13
|
+
- rename `SharedStateCollection#getSchema()` to `SharedStateCollection#getDescription()`
|
|
14
|
+
- rename `BaseStateManager.getSchema` to `BaseStateManager.getClassDescription`
|
|
15
|
+
- rename `ServerStateManager.registerSchema` to `ServerStateManager.defineClass`
|
|
16
|
+
- rename `ServerStateManager.deleteSchema` to `ServerStateManager.deleteClass`
|
|
17
|
+
- drop support for `context` in `SharedState.set(updates, context)`
|
|
18
|
+
- rename `ClientDescription.target` to `ClientDescription.runtime`
|
|
19
|
+
- rename `ServerEnvConfig.subpath` to `ServerEnvConfig.baseUlr`
|
|
20
|
+
- move `Server#useDefaultApplicationTemplate` into helpers: `configureHttpRouter(server)`
|
|
21
|
+
- review plugin creation API
|
|
22
|
+
|
|
23
|
+
### Feat
|
|
24
|
+
|
|
25
|
+
- allow `SharedState.set(key, value)`
|
|
26
|
+
- implement `ServerStateManager#registerCreateHook` and `ServerStateManager#registerDeleteHook`
|
|
27
|
+
- implement `SharedStateCollection#onChange` --> `onChange`
|
|
28
|
+
|
|
29
|
+
### Fix
|
|
30
|
+
|
|
31
|
+
- harmonize all error messages
|
|
32
|
+
|
|
33
|
+
## v4.0.0-alpha.29 - 2024-09-23
|
|
34
|
+
|
|
35
|
+
- Feat: add required option for SharedState parameter
|
|
36
|
+
- Chore: Renamed all classes to avoid namespace in doc and improve typescript support
|
|
37
|
+
- Chore: improve shared states abstractions naming
|
|
38
|
+
|
|
39
|
+
## v4.0.0-alpha.28 - 2024-09-06
|
|
40
|
+
|
|
41
|
+
- Fix: make it can work without `node_modules` when bundled to `.cjs` for use in Max
|
|
42
|
+
|
|
43
|
+
## v4.0.0-alpha.27 - 2024-09-06
|
|
44
|
+
|
|
45
|
+
- Fix: assign to `const`
|
|
46
|
+
|
|
47
|
+
## v4.0.0-alpha.26 - 2024-09-05
|
|
48
|
+
|
|
49
|
+
- Fix: improve reconnect strategy in case of socket connection failure
|
|
50
|
+
|
|
51
|
+
## v4.0.0-alpha.25 - 2024-05-24
|
|
52
|
+
|
|
53
|
+
- Fix: better default behavior for WebSocket connection URL
|
|
54
|
+
|
|
55
|
+
## v4.0.0-alpha.24 - 2024-05-24
|
|
56
|
+
|
|
57
|
+
- Fix: unexpected behavior with new `serverAddress` behavior on browser clients and self-signed certificates
|
|
58
|
+
|
|
59
|
+
## v4.0.0-alpha.23 - 2024-05-24
|
|
60
|
+
|
|
61
|
+
- Breaking: remove binary socket
|
|
62
|
+
- Fix: do not terminate socket on missed heartbeat, which seems to create false positive, just warn instead
|
|
63
|
+
- Refactor: some work toward upgrading code to ES2022
|
|
64
|
+
|
|
65
|
+
## v4.0.0-alpha.22 - 2024-05-16
|
|
66
|
+
|
|
67
|
+
- Feat: allow configuring socket endpoint on browser clients
|
|
68
|
+
- Feat: check and warn if version inconsistency between server and client
|
|
69
|
+
|
|
70
|
+
## v4.0.0-alpha.21 - 2024-05-06
|
|
71
|
+
|
|
72
|
+
- Fix: prevent multiple 'close' events
|
|
73
|
+
- Fix: disable heartbeat check on client-side, was unstable
|
|
74
|
+
- Feat: introduce 'local' option for SharedState parameters
|
|
75
|
+
- Feat: ability to filter parameters of interest in SharedState
|
|
76
|
+
|
|
77
|
+
## v4.0.0-alpha.20 - 2024-02-19
|
|
78
|
+
|
|
79
|
+
- Refactor heartbeat - #86
|
|
80
|
+
- Refactor state collection - #85
|
|
81
|
+
- Fix issue with self signed certs and config generated by wizard - #84
|
|
82
|
+
|
|
83
|
+
## v4.0.0-alpha.19 - 2024-01-17
|
|
84
|
+
|
|
85
|
+
- Hot fix for #85
|
|
86
|
+
|
|
87
|
+
## v4.0.0-alpha.18 - 2024-01-15
|
|
88
|
+
|
|
89
|
+
- Batch network message for SharedStates
|
|
90
|
+
|
|
91
|
+
## v4.0.0-alpha.17 - 2023-12-16
|
|
92
|
+
|
|
93
|
+
- Support bundling the server to common js for Max externals
|
|
94
|
+
|
|
95
|
+
## v4.0.0-alpha.16 - 2023-12-15
|
|
96
|
+
|
|
97
|
+
- Improve StateCollection performances
|
|
98
|
+
|
|
99
|
+
## v4.0.0-alpha.15 - 2023-12-13
|
|
100
|
+
|
|
101
|
+
- Fix several issues with shared states
|
|
102
|
+
- **Breaking Change**: by default, `StateManager::observe` and `SharedStateCollection` now retrieve locally created states
|
package/README.md
CHANGED
|
@@ -3,64 +3,49 @@
|
|
|
3
3
|
[](https://badge.fury.io/js/@soundworks%2Fcore)
|
|
4
4
|
[](http://commitizen.github.io/cz-cli/)
|
|
5
5
|
|
|
6
|
-

|
|
6
|
+

|
|
7
7
|
|
|
8
8
|
Open-source creative coding framework for distributed applications based on Web technologies.
|
|
9
9
|
|
|
10
10
|
Primarily focused on music, **soundworks** aims at supporting rapid development of real-time distributed applications using _JavaScript_. It provides abstractions to hide the complexity of the network and to foster very rapid-prototyping and trial-and-error workflows that are typical in artistic practices.
|
|
11
11
|
|
|
12
|
-
*__WARNING: The version 4 of `@soundworks/core` is under heavy development.__*
|
|
13
|
-
|
|
14
|
-
## Getting Started
|
|
15
|
-
|
|
16
|
-
The best and most simple way to start using **soundworks** is to use the `@soundworks/create` wizard.
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
npx @soundworks/create@latest
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-

|
|
23
|
-
|
|
24
|
-
See [https://soundworks.dev/tutorials/getting-started.html](https://soundworks.dev/tutorials/getting-started.html) for more informations on the wizard and how to start with **soundworks**.
|
|
25
|
-
|
|
26
|
-
<!--
|
|
27
12
|
## Documentation
|
|
28
13
|
|
|
29
14
|
- Guides and Tutorials: [https://soundworks.dev](https://soundworks.dev)
|
|
30
15
|
- API: [https://soundworks.dev/api](https://soundworks.dev/api)
|
|
31
|
-
-->
|
|
32
16
|
|
|
33
|
-
##
|
|
17
|
+
## Getting started
|
|
34
18
|
|
|
35
|
-
The
|
|
19
|
+
The best and most simple way to start using **soundworks** is to use the `@soundworks/create` wizard.
|
|
36
20
|
|
|
37
21
|
```sh
|
|
38
|
-
|
|
39
|
-
cd soundworks
|
|
40
|
-
git checkout v4
|
|
41
|
-
serve docs
|
|
22
|
+
npx @soundworks/create@latest
|
|
42
23
|
```
|
|
43
24
|
|
|
44
|
-
|
|
25
|
+

|
|
45
26
|
|
|
46
|
-
|
|
27
|
+
See [https://soundworks.dev/tutorials/getting-started.html](https://soundworks.dev/tutorials/getting-started.html) for more information on the wizard and how to start using **soundworks**.
|
|
47
28
|
|
|
48
|
-
|
|
29
|
+
## Misc
|
|
49
30
|
|
|
50
|
-
|
|
31
|
+
### TypeScript support
|
|
51
32
|
|
|
52
33
|
Basic TypeScript support will be proposed in a (hopefully) near future.
|
|
53
34
|
|
|
54
35
|
However, for maintenance reasons, we aim at following the TC39 and W3C specifications as close as possible. Therefore, we will wait for the https://github.com/tc39/proposal-type-annotations proposal to reach stage 3 to update the source code in a more integrated manner.
|
|
55
36
|
|
|
56
|
-
|
|
37
|
+
### Manual install
|
|
57
38
|
|
|
58
|
-
Note that the `@soundworks/core` package is automatically installed when creating an application using the `@soundworks/create` wizard, so most of the time you should not have to install this package manually. See [https://soundworks.dev/guides/getting-started.html](https://soundworks.dev/guides/getting-started.html) for more
|
|
39
|
+
Note that the `@soundworks/core` package is automatically installed when creating an application using the `@soundworks/create` wizard, so most of the time you should not have to install this package manually. See [https://soundworks.dev/guides/getting-started.html](https://soundworks.dev/guides/getting-started.html) for more information on the **soundworks** wizard.
|
|
59
40
|
|
|
60
41
|
```
|
|
61
42
|
npm install @soundworks/core
|
|
62
43
|
```
|
|
63
44
|
|
|
45
|
+
## Share with Us
|
|
46
|
+
|
|
47
|
+
If you made an application using **soundworks** please let us know here: https://github.com/collective-soundworks/soundworks/discussions/61
|
|
48
|
+
|
|
64
49
|
## Credits
|
|
65
50
|
|
|
66
51
|
[https://soundworks.dev/credits.html](https://soundworks.dev/credits.html)
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soundworks/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Open-source creative coding framework for distributed applications based on Web technologies",
|
|
5
|
-
"
|
|
5
|
+
"collaborators": [
|
|
6
6
|
"Benjamin Matuszewski",
|
|
7
|
+
"Jean-Philippe Lambert",
|
|
7
8
|
"Sébastien Robaszkiewicz",
|
|
8
9
|
"Norbert Schnell"
|
|
9
10
|
],
|
|
@@ -43,59 +44,40 @@
|
|
|
43
44
|
"node": ">=16.0.0"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
|
-
"doc": "rm -
|
|
47
|
+
"doc": "npm run types && rm -rf docs && jsdoc -c .jsdoc --verbose && cp -R misc/assets docs/",
|
|
47
48
|
"lint": "npx eslint src",
|
|
48
|
-
"test": "mocha",
|
|
49
|
-
"
|
|
50
|
-
"types": "rm -
|
|
51
|
-
"preversion": "npm run
|
|
49
|
+
"test": "npx mocha tests/*/*.spec.js",
|
|
50
|
+
"test:only": "npx mocha",
|
|
51
|
+
"types": "rm -rf types && tsc",
|
|
52
|
+
"preversion": "npm run lint && npm run test && node ./misc/scripts/generate-version-file.js $npm_new_version && npm run types",
|
|
53
|
+
"postversion": "node ./misc/scripts/check-changelog.js && git commit -am \"$npm_new_version\" --allow-empty"
|
|
52
54
|
},
|
|
53
55
|
"dependencies": {
|
|
54
|
-
"@ircam/sc-
|
|
55
|
-
"@ircam/sc-utils": "^1.1.1",
|
|
56
|
+
"@ircam/sc-utils": "^1.8.0",
|
|
56
57
|
"chalk": "^5.3.0",
|
|
57
|
-
"columnify": "^1.6.0",
|
|
58
|
-
"compression": "^1.7.1",
|
|
59
|
-
"cross-fetch": "^3.1.8",
|
|
60
|
-
"express": "^4.18.1",
|
|
61
58
|
"fast-deep-equal": "^3.1.3",
|
|
62
|
-
"fast-text-encoding": "^1.0.0",
|
|
63
59
|
"isomorphic-ws": "^5.0.0",
|
|
64
|
-
"keyv": "^4.
|
|
65
|
-
"keyv-file": "^0.
|
|
66
|
-
"lodash
|
|
67
|
-
"lodash.merge": "^4.6.2",
|
|
60
|
+
"keyv": "^4.5.4",
|
|
61
|
+
"keyv-file": "^0.3.1",
|
|
62
|
+
"lodash": "^4.17.21",
|
|
68
63
|
"pem": "^1.14.8",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"window-or-global": "^1.0.1",
|
|
72
|
-
"ws": "^8.12.0"
|
|
64
|
+
"uuid": "^9.0.1",
|
|
65
|
+
"ws": "^8.17.0"
|
|
73
66
|
},
|
|
74
67
|
"devDependencies": {
|
|
75
|
-
"@ircam/eslint-config": "^
|
|
76
|
-
"chai": "^
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"eslint-plugin-jsdoc": "^46.4.3",
|
|
84
|
-
"generate-changelog": "^1.8.0",
|
|
85
|
-
"jsdoc": "^4.0.0",
|
|
86
|
-
"markdown-toc": "^1.2.0",
|
|
87
|
-
"mocha": "^10.2.0",
|
|
88
|
-
"puppeteer": "^20.7.4",
|
|
68
|
+
"@ircam/eslint-config": "^2.0.1",
|
|
69
|
+
"chai": "^5.1.1",
|
|
70
|
+
"docdash": "^2.0.2",
|
|
71
|
+
"dotenv": "^16.4.5",
|
|
72
|
+
"eslint": "^9.18.0",
|
|
73
|
+
"jsdoc": "^4.0.3",
|
|
74
|
+
"mocha": "^10.4.0",
|
|
75
|
+
"puppeteer": "^22.9.0",
|
|
89
76
|
"tcp-ping": "^0.1.1",
|
|
90
|
-
"typescript": "^5.
|
|
77
|
+
"typescript": "^5.4.5"
|
|
91
78
|
},
|
|
92
79
|
"optionalDependencies": {
|
|
93
80
|
"bufferutil": "^4.0.5",
|
|
94
81
|
"utf-8-validate": "^5.0.7"
|
|
95
|
-
},
|
|
96
|
-
"config": {
|
|
97
|
-
"commitizen": {
|
|
98
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
99
|
-
}
|
|
100
82
|
}
|
|
101
83
|
}
|