entangld 2.4.0 → 2.6.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/.github/workflows/mocha-tests.yml +26 -0
- package/README.md +4 -0
- package/lib/Datastore.js +4 -3
- package/lib/Message.js +1 -1
- package/package.json +1 -4
- package/tags +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Mocha Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
# Runs on linux
|
|
10
|
+
test-linux:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v2
|
|
16
|
+
|
|
17
|
+
- name: Set up Node.js
|
|
18
|
+
uses: actions/setup-node@v2
|
|
19
|
+
with:
|
|
20
|
+
node-version: 12
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm install
|
|
24
|
+
|
|
25
|
+
- name: Run Mocha tests on Linux
|
|
26
|
+
run: npm test
|
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Synchronized key-value stores with RPCs and pub/sub events. Works over sockets (try it with [Sockhop](https://www.npmjs.com/package/sockhop "Sockhop on NPM")!)
|
|
4
4
|
|
|
5
|
+
## Tests
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
5
9
|
## Examples
|
|
6
10
|
Basic use:
|
|
7
11
|
```js
|
package/lib/Datastore.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { randomUUID: uuidv4 } = require("node:crypto");
|
|
2
2
|
const EventEmitter = require("events");
|
|
3
3
|
const uuid_regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4
4
|
|
|
@@ -37,7 +37,7 @@ class Entangld extends EventEmitter {
|
|
|
37
37
|
// its children to see if they are functions. We will then call those
|
|
38
38
|
// functions and return their values. This should be the default
|
|
39
39
|
// behavior, but it is rather expensive. TODO
|
|
40
|
-
this._deref_mode = deref_mode
|
|
40
|
+
this._deref_mode = deref_mode == undefined ? false : deref_mode;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -408,8 +408,9 @@ class Entangld extends EventEmitter {
|
|
|
408
408
|
* @throws {RPCError} if the rpc call experienced an error
|
|
409
409
|
* @return {Promise} promise resolving to return value of the rpc
|
|
410
410
|
*/
|
|
411
|
-
call_rpc(path, args=[]) {
|
|
411
|
+
async call_rpc(path, args=[]) {
|
|
412
412
|
return this.get(path,args).then((args) => {
|
|
413
|
+
if ( !Array.isArray(args) || args.length != 2) throw new EntangldError(`Endpoint is not configured for RPC: '${path}'`);
|
|
413
414
|
if (args[0] === false) throw RPCError.from_remote_error(args[1]);
|
|
414
415
|
if ( typeof(args[0]) == "string" ) return args[0];
|
|
415
416
|
return args[1];
|
package/lib/Message.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "entangld",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Synchronized key-value stores with RPCs and events",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"jshintConfig": {
|
|
@@ -34,8 +34,5 @@
|
|
|
34
34
|
"mocha": "^10.0.0",
|
|
35
35
|
"nodemon": "^2.0.16",
|
|
36
36
|
"sockhop": "^1.4.3"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"uuid": "^8.3.2"
|
|
40
37
|
}
|
|
41
38
|
}
|
package/tags
CHANGED
|
File without changes
|