@bee.js/node 0.0.75 → 0.0.77

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
@@ -474,7 +474,7 @@ module.exports = function hive(req = {}, res = {}, model = null) {
474
474
  },
475
475
 
476
476
  response: function (sendData = data, action = null, status) {
477
- let out = { data: sendData, counters, action, error };
477
+ const out = { data: sendData, counters, action, error };
478
478
 
479
479
  if (res.headersSent)
480
480
  return console.error("ERROR beejs: headers already sent");
@@ -501,11 +501,11 @@ module.exports = function hive(req = {}, res = {}, model = null) {
501
501
  },
502
502
 
503
503
  responseError: function (error, errorCode) {
504
- let out = { error: { message: error || "an error has occurred" } };
504
+ const out = { error: { message: error || "an error has occurred" } };
505
505
 
506
506
  if (global.configs.debug) out.debug = debug;
507
507
 
508
- res.status(errorCode || 500).send(out);
508
+ res?.status?.(errorCode || 500).send(out);
509
509
  },
510
510
 
511
511
  ifNull(param) {
package/lib/ORM/beeORM.js CHANGED
@@ -2,32 +2,7 @@ const mysql = require("mysql2/promise"); //https://evertpot.com/executing-a-mysq
2
2
  const beeTools = require("../../tools/beeTools");
3
3
 
4
4
  const escape = function (string) {
5
- return typeof string != "string"
6
- ? string
7
- : string.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
8
- switch (char) {
9
- case "\0":
10
- return "\\0";
11
- case "\x08":
12
- return "\\b";
13
- case "\x09":
14
- return "\\t";
15
- case "\x1a":
16
- return "\\z";
17
- case "\n":
18
- return "\\n";
19
- case "\r":
20
- return "\\r";
21
- case '"':
22
- case "'":
23
- case "\\":
24
- case "%":
25
- return "\\" + char; // prepends a backslash to backslash, percent,
26
- // and double/single quotes
27
- default:
28
- return char;
29
- }
30
- });
5
+ return typeof string === "string" ? string.replace(/'/g, "''") : string;
31
6
  };
32
7
 
33
8
  const parseArray = function (param) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bee.js/node",
3
- "version": "0.0.75",
3
+ "version": "0.0.77",
4
4
  "description": "A JavaScript framework for making Node.js API´s",
5
5
  "main": "index.js",
6
6
  "scripts": {