ismx-nexo-node-app 0.3.67 → 0.3.69

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.
@@ -75,6 +75,16 @@ class BusinessErrors {
75
75
  this.except("0013");
76
76
  return body;
77
77
  }
78
+ getBodyParam(param, body) {
79
+ let path = param.split(".");
80
+ let value = body;
81
+ for (let key of path) {
82
+ value = value[key];
83
+ if (value === undefined || value === null)
84
+ this.except("0014", param);
85
+ }
86
+ return value;
87
+ }
78
88
  getHeaders(key, headers) {
79
89
  if (!headers[key])
80
90
  this.except("0015", key);
package/dist/js/index.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RestUtils = exports.QueryUtils = exports.RepositoryRestFormalTemplate = exports.RepositoryRestFormal = exports.RepositoryRest = exports.RepositoryDatabasePostgres = exports.RepositoryDatabase = exports.Repository = exports.StringUtils = exports.NumberUtils = exports.CryptoUtils = exports.BusinessLogger = exports.BusinessErrors = exports.BusinessThread = exports.BusinessServer = exports.BusinessProxy = exports.BusinessState = exports.Business = exports.ColorUtils = exports.ServiceRestFormalTemplate = exports.ServiceRestFormal = exports.ServiceRest = exports.HttpResponse = exports.Service = void 0;
29
+ exports.RestUtils = exports.QueryUtils = exports.RepositoryRestFormalTemplate = exports.RepositoryRestFormal = exports.RepositoryRest = exports.RepositoryDatabasePostgres = exports.RepositoryDatabase = exports.Repository = exports.StringUtils = exports.NumberUtils = exports.CryptoUtils = exports.BusinessLogger = exports.FormalError = exports.BusinessErrors = exports.BusinessThread = exports.BusinessServer = exports.BusinessProxy = exports.BusinessState = exports.Business = exports.ColorUtils = exports.ServiceRestFormalTemplate = exports.ServiceRestFormal = exports.ServiceRest = exports.HttpResponse = exports.Service = void 0;
30
30
  const Service_1 = __importStar(require("./api/Service"));
31
31
  class Service extends Service_1.default {
32
32
  }
@@ -71,10 +71,13 @@ const BusinessThread_1 = __importDefault(require("./business/BusinessThread"));
71
71
  class BusinessThread extends BusinessThread_1.default {
72
72
  }
73
73
  exports.BusinessThread = BusinessThread;
74
- const BusinessErrors_1 = __importDefault(require("./business/BusinessErrors"));
74
+ const BusinessErrors_1 = __importStar(require("./business/BusinessErrors"));
75
75
  class BusinessErrors extends BusinessErrors_1.default {
76
76
  }
77
77
  exports.BusinessErrors = BusinessErrors;
78
+ class FormalError extends BusinessErrors_1.FormalError {
79
+ }
80
+ exports.FormalError = FormalError;
78
81
  const BusinessLogger_1 = __importDefault(require("./business/BusinessLogger"));
79
82
  class BusinessLogger extends BusinessLogger_1.default {
80
83
  }
@@ -34,6 +34,7 @@ export default class BusinessErrors {
34
34
  [key: string]: string;
35
35
  }): string;
36
36
  getBody<T>(body?: T): T;
37
+ getBodyParam(param: string, body: any): any;
37
38
  getHeaders(key: string, headers: {
38
39
  [key: string]: string;
39
40
  }): string;
@@ -37,10 +37,12 @@ export declare class BusinessServer extends _BusinessServer {
37
37
  import BaseBusinessThread from "./business/BusinessThread";
38
38
  export declare abstract class BusinessThread extends BaseBusinessThread {
39
39
  }
40
- import BaseBusinessErrors, { ErrorType as BaseFormalError } from "./business/BusinessErrors";
40
+ import BaseBusinessErrors, { ErrorType as _ErrorType, FormalError as _FormalError } from "./business/BusinessErrors";
41
41
  export declare class BusinessErrors extends BaseBusinessErrors {
42
42
  }
43
- export interface FormalError extends BaseFormalError {
43
+ export interface ErrorType extends _ErrorType {
44
+ }
45
+ export declare class FormalError extends _FormalError {
44
46
  }
45
47
  import BaseBusinessLogger from "./business/BusinessLogger";
46
48
  export declare class BusinessLogger extends BaseBusinessLogger {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.3.67",
3
+ "version": "0.3.69",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -72,6 +72,16 @@ export default class BusinessErrors {
72
72
  return body!;
73
73
  }
74
74
 
75
+ getBodyParam(param: string, body: any): any {
76
+ let path = param.split(".");
77
+ let value = body;
78
+ for (let key of path) {
79
+ value = value[key];
80
+ if (value === undefined || value === null) this.except("0014", param);
81
+ }
82
+ return value;
83
+ }
84
+
75
85
  getHeaders(key: string, headers: {[key: string]: string}): string {
76
86
  if (!headers[key]) this.except("0015", key)
77
87
  return headers[key];
@@ -34,9 +34,10 @@ export class BusinessServer extends _BusinessServer {}
34
34
  import BaseBusinessThread from "./business/BusinessThread";
35
35
  export abstract class BusinessThread extends BaseBusinessThread {}
36
36
 
37
- import BaseBusinessErrors, { ErrorType as BaseFormalError } from "./business/BusinessErrors";
37
+ import BaseBusinessErrors, { ErrorType as _ErrorType, FormalError as _FormalError} from "./business/BusinessErrors";
38
38
  export class BusinessErrors extends BaseBusinessErrors {}
39
- export interface FormalError extends BaseFormalError {}
39
+ export interface ErrorType extends _ErrorType {}
40
+ export class FormalError extends _FormalError {}
40
41
 
41
42
  import BaseBusinessLogger from "./business/BusinessLogger";
42
43
  export class BusinessLogger extends BaseBusinessLogger {}
@@ -52,7 +52,7 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
52
52
  return call.then(async (res: Response) => {
53
53
  let headers: any = {}; res.headers.forEach((value, key) => headers[key] = value);
54
54
  let response: HttpResponse<E> = {
55
- httpCode: res.status, content: (await res.json()) as E, headers
55
+ httpCode: res.status, content: (await res.json()) as E, headers
56
56
  };
57
57
  this.options?.onResponse?.(response);
58
58
  return response;