@live-change/server 0.9.203 → 0.9.205
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/README.md +49 -0
- package/package.json +7 -7
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# LiveChange Framework Server
|
|
2
|
+
|
|
3
|
+
This package provides the server-side implementation of the LiveChange framework.
|
|
4
|
+
|
|
5
|
+
## DAO Protocol and Arguments
|
|
6
|
+
|
|
7
|
+
The LiveChange framework uses `@live-change/dao` for communication between the client and the server.
|
|
8
|
+
When calling actions or observing views directly via the raw DAO protocol (e.g., from C++, Python, or other non-JS clients), it's important to understand how arguments are passed.
|
|
9
|
+
|
|
10
|
+
### Arguments as Arrays
|
|
11
|
+
|
|
12
|
+
The DAO protocol is designed to be a generic RPC/observation protocol. It treats arguments like function arguments, meaning **they must always be passed as an array**, even if the action or view only takes a single object as its parameter.
|
|
13
|
+
|
|
14
|
+
When the framework processes a DAO request, it uses the spread operator (`...args`) to pass the arguments to the underlying action or view function. If you pass an object instead of an array, the server will attempt to spread the object, resulting in an error like:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Example: Calling an Action from C++
|
|
21
|
+
|
|
22
|
+
If an action `registerDeviceConnection` in the `deviceManager` service expects a single object with `pairingKey`, `connectionType`, and `capabilities`:
|
|
23
|
+
|
|
24
|
+
**Incorrect (Passing an object):**
|
|
25
|
+
```cpp
|
|
26
|
+
nlohmann::json args = {
|
|
27
|
+
{"pairingKey", "123"},
|
|
28
|
+
{"connectionType", "device"},
|
|
29
|
+
{"capabilities", {"video"}}
|
|
30
|
+
};
|
|
31
|
+
// This will fail on the server!
|
|
32
|
+
connection->request({"deviceManager", "registerDeviceConnection"}, args, settings);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Correct (Passing an array containing the object):**
|
|
36
|
+
```cpp
|
|
37
|
+
nlohmann::json args = {
|
|
38
|
+
nlohmann::json::object({
|
|
39
|
+
{"pairingKey", "123"},
|
|
40
|
+
{"connectionType", "device"},
|
|
41
|
+
{"capabilities", {"video"}}
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
// Or explicitly: nlohmann::json::array({ ... })
|
|
45
|
+
// This works correctly!
|
|
46
|
+
connection->request({"deviceManager", "registerDeviceConnection"}, args, settings);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Always ensure that the `args` parameter in your DAO `request` or `observable` calls is an array.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.205",
|
|
4
4
|
"description": "Live Change Framework - server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"type": "module",
|
|
23
23
|
"homepage": "https://github.com/live-change/live-change-stack",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@live-change/dao": "^0.9.
|
|
26
|
-
"@live-change/dao-sockjs": "^0.9.
|
|
27
|
-
"@live-change/db-server": "^0.9.
|
|
28
|
-
"@live-change/framework": "^0.9.
|
|
25
|
+
"@live-change/dao": "^0.9.205",
|
|
26
|
+
"@live-change/dao-sockjs": "^0.9.205",
|
|
27
|
+
"@live-change/db-server": "^0.9.205",
|
|
28
|
+
"@live-change/framework": "^0.9.205",
|
|
29
29
|
"@live-change/sockjs": "0.4.1",
|
|
30
|
-
"@live-change/uid": "^0.9.
|
|
30
|
+
"@live-change/uid": "^0.9.205",
|
|
31
31
|
"@opentelemetry/api": "^1.9.0",
|
|
32
32
|
"@opentelemetry/auto-instrumentations-node": "^0.67.3",
|
|
33
33
|
"@opentelemetry/exporter-logs-otlp-http": "^0.209.0",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"websocket": "^1.0.34",
|
|
48
48
|
"yargs": "^17.7.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "ef195e51ea283e56d891b11da5d5f586691507db"
|
|
51
51
|
}
|