@bee.js/node 0.0.76 → 0.0.78

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/beehive.js +4 -4
  2. package/package.json +1 -1
package/beehive.js CHANGED
@@ -268,7 +268,7 @@ module.exports = function hive(req = {}, res = {}, model = null) {
268
268
  let val = row[field];
269
269
 
270
270
  // TODO colocar escape para sql injection
271
- switch (model.schema[field].type) {
271
+ switch (model.schema[field]?.type) {
272
272
  case "char":
273
273
  case "varchar":
274
274
  case "text":
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bee.js/node",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "description": "A JavaScript framework for making Node.js API´s",
5
5
  "main": "index.js",
6
6
  "scripts": {