@bee.js/node 0.0.62 → 0.0.64

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/beehive.js CHANGED
@@ -461,6 +461,9 @@ module.exports = function hive(req = {}, res = {}, model = null) {
461
461
  response: function (sendData = data, action = null, status) {
462
462
  let out = { data: sendData, counters, action, error };
463
463
 
464
+ if (res.headersSent)
465
+ return console.error("ERROR beejs: headers already sent");
466
+
464
467
  if (inserts.length) out.inserts = inserts;
465
468
 
466
469
  if (global.configs.debug) out.debug = debug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bee.js/node",
3
- "version": "0.0.62",
3
+ "version": "0.0.64",
4
4
  "description": "A JavaScript framework for making Node.js API´s",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tools/guid.js CHANGED
@@ -7,9 +7,15 @@ module.exports = {
7
7
  return fn ? uuid[fn](param) : uuid.v4();
8
8
  },
9
9
 
10
- guidToBin: function (param) {
11
- return typeof param == "string" && param.length == 36
12
- ? "0x" + param.replace(/-/g, "")
13
- : param;
10
+ guidToBin: function guiToBin(param) {
11
+ if (typeof param !== "string") return null;
12
+
13
+ const uuidRegex =
14
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
15
+ if (!uuidRegex.test(param)) return null;
16
+
17
+ return "0x" + param.replace(/-/g, "");
14
18
  },
19
+
20
+ uuidToBin: this.guidToBin,
15
21
  };