entangld 2.1.5 → 2.1.6

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 (2) hide show
  1. package/index.js +11 -11
  2. package/package.json +5 -6
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const Uuid = require("uuid");
1
+ const { v4:uuidv4 } = require("uuid");
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
 
@@ -58,7 +58,7 @@ class Entangld_Message {
58
58
  type: "get",
59
59
  path : tree, // path needs to be relative to downstream store
60
60
  value : get_params,
61
- uuid : Uuid() // Gets generate a new uuid
61
+ uuid : uuidv4() // Gets generate a new uuid
62
62
  });
63
63
  }
64
64
 
@@ -102,7 +102,7 @@ class Entangld_Message {
102
102
  * Construct subscribe message
103
103
  *
104
104
  * @param {string} tree - the path (relative to the downstream datastore)
105
- * @param {Uuid} uuid - the subscription uuid
105
+ * @param {uuidv4} uuid - the subscription uuid
106
106
  * @return {Entangld_Message} the `subscribe` message
107
107
  */
108
108
  static subscribe(tree, uuid, every = null) {
@@ -119,7 +119,7 @@ class Entangld_Message {
119
119
  *
120
120
  * @param {string} path - the path (relative to the downstream store)
121
121
  * @param {*} value - the updated datastore value at the path
122
- * @param {Uuid} uuid - the uuid of the subscribe being triggered
122
+ * @param {uuidv4} uuid - the uuid of the subscribe being triggered
123
123
  * @return {Entangld_Message} the `event` message
124
124
  */
125
125
  static event(path, value, uuid) {
@@ -170,7 +170,7 @@ class Subscription {
170
170
  * @param {Object} obj - the configuration object
171
171
  * @param {string} obj.path - the datastore path (relative to this datastore)
172
172
  * of the subscription
173
- * @param {Uuid} obj.uuid - the uuid of the subscription chain
173
+ * @param {uuidv4} obj.uuid - the uuid of the subscription chain
174
174
  * @param {function} obj.callback - the callback function, with signature (path, value),
175
175
  * where path is relative to this datastore
176
176
  * @param {(Entangld|null)} obj.downstream - the downstream datastore (if any)
@@ -323,7 +323,7 @@ class Subscription {
323
323
  /**
324
324
  * Check if a provided uuid matches this uuid
325
325
  *
326
- * @param {Uuid} uuid - a uuid string to check against
326
+ * @param {uuidv4} uuid - a uuid string to check against
327
327
  * @return {Boolean} - true if the path matches
328
328
  */
329
329
  matches_uuid(uuid) {
@@ -1062,7 +1062,7 @@ class Entangld extends EventEmitter {
1062
1062
  * @param {number|null} [every=null] the number of `set` messages to wait before calling callback
1063
1063
  *
1064
1064
  * @throws {TypeError} if path is not a string.
1065
- * @return {Uuid} - the uuid of the subscription
1065
+ * @return {uuidv4} - the uuid of the subscription
1066
1066
  */
1067
1067
  subscribe(path, func, every = null) {
1068
1068
 
@@ -1079,19 +1079,19 @@ class Entangld extends EventEmitter {
1079
1079
  * @param {string} path the path to watch.
1080
1080
  * @param {function} func the callback - will be of the form (path, value).
1081
1081
  * @param {(Entangld|null)} [upstream=null] the Engangld next upstream in the path.
1082
- * @param {(Uuid|null)} [uuid=null] the UUID to use for this subscription.
1082
+ * @param {(uuidv4|null)} [uuid=null] the UUID to use for this subscription.
1083
1083
  *
1084
1084
  * @emits {str} subscription - when this datastore is the terminal datastore of a
1085
1085
  * subscription request, this datastore emits the path
1086
1086
  * and uuid.
1087
1087
  * @throws {TypeError} if path is not a string.
1088
- * @return {Uuid} - the uuid of the subscription
1088
+ * @return {uuidv4} - the uuid of the subscription
1089
1089
  */
1090
1090
  _subscribe(path, func, upstream = null, uuid = null, every = null) {
1091
1091
 
1092
1092
 
1093
1093
  // Supply a UUID if none provided
1094
- uuid = uuid || Uuid();
1094
+ uuid = uuid || uuidv4();
1095
1095
 
1096
1096
 
1097
1097
  // Sanity check
@@ -1159,7 +1159,7 @@ class Entangld extends EventEmitter {
1159
1159
  * path will be deleted, so if you have multiple subscriptions on a single path,
1160
1160
  * and only want one of them to be removed, you must provide the uuid instead.
1161
1161
  *
1162
- * @param {(String|Uuid)} path_or_uuid - the path (or uuid) to unwatch.
1162
+ * @param {(String|uuidv4)} path_or_uuid - the path (or uuid) to unwatch.
1163
1163
  * @throws {EntangldError} if no subscriptions were found.
1164
1164
  * @return {number} count of subscriptions removed.
1165
1165
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "entangld",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Synchronized key-value stores with RPCs and events",
5
5
  "main": "index.js",
6
6
  "jshintConfig": {
@@ -29,15 +29,14 @@
29
29
  "homepage": "https://daxbot.com/open-source",
30
30
  "devDependencies": {
31
31
  "fs-then-native": "^2.0.0",
32
- "jsdoc-to-markdown": "^6.0.1",
32
+ "jsdoc-to-markdown": "^7.1.1",
33
33
  "jshint": "^2.13.1",
34
34
  "jshint-stylish": "^2.2.1",
35
- "mocha": "^8.4.0",
36
- "nodemon": "^1.11.0",
35
+ "mocha": "^10.0.0",
36
+ "nodemon": "^2.0.16",
37
37
  "sockhop": "^1.4.3"
38
38
  },
39
39
  "dependencies": {
40
- "package-lock": "^1.0.5",
41
- "uuid": "^3.0.1"
40
+ "uuid": "^8.3.2"
42
41
  }
43
42
  }