@ejfdelgado/ejflab-back 1.27.3 → 1.29.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-back",
3
- "version": "1.27.3",
3
+ "version": "1.29.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ejfdelgado/ejflab-back.git"
@@ -8,6 +8,7 @@ export class PostgresSrv {
8
8
  static pool = null;
9
9
  static {
10
10
  PostgresSrv.renderer.registerFunction("noQuotes", PostgresSrv.noQuotes);
11
+ PostgresSrv.renderer.registerFunction("singleWord", PostgresSrv.singleWord);
11
12
  PostgresSrv.renderer.registerFunction("sanitizeNumber", PostgresSrv.sanitizeNumber);
12
13
  PostgresSrv.renderer.registerFunction("sanitizeText", PostgresSrv.sanitizeText);
13
14
  PostgresSrv.renderer.registerFunction("sanitizeTextNull", PostgresSrv.sanitizeTextNull);
@@ -40,6 +41,9 @@ export class PostgresSrv {
40
41
  static noQuotes(val, ...args) {
41
42
  return val.replace(/'/g, "''");
42
43
  }
44
+ static singleWord(val, ...args) {
45
+ return val.split(/\s+/g)[0];
46
+ }
43
47
  static sanitizeText(val, ...args) {
44
48
  let text = val;
45
49
  if ([null, undefined].indexOf(text) >= 0) {
@@ -427,6 +427,9 @@ export class SocketIOCall {
427
427
  const processor = parts[1];
428
428
  const instance = parts[2];
429
429
  decoded['method'] = parts[3];
430
+ decoded['pig'] = {
431
+ now: new Date().getTime(),
432
+ };
430
433
 
431
434
  // Get socket destiny if channel is websocket
432
435
  let socketId = null;
@@ -1,4 +1,5 @@
1
1
  import md5 from 'md5';
2
+ import { MalaPeticionException, ParametrosIncompletosException } from '../MyError.mjs';
2
3
 
3
4
  export class General {
4
5
  static PAGE_SIZE_DEFAULT = "20";
@@ -20,7 +21,7 @@ export class General {
20
21
  offset,
21
22
  };
22
23
  }
23
- static readParam(req, name, pred = null) {
24
+ static readParam(req, name, pred = null, complain = false) {
24
25
  const nameLower = name.toLowerCase();
25
26
  if (req.body && name in req.body) {
26
27
  return req.body[name];
@@ -37,6 +38,9 @@ export class General {
37
38
  return req.locals.extra[name];
38
39
  }
39
40
  }
41
+ if (complain) {
42
+ throw new ParametrosIncompletosException(`Parameter not found but required: ${name}`);
43
+ }
40
44
  return pred;
41
45
  }
42
46
  static getSuffixPath(keyName, suffix) {