@lakutata/core 1.0.40 → 1.0.43

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 (52) hide show
  1. package/build/base/abstracts/Exception.d.ts +1 -1
  2. package/build/exceptions/ComponentNotFoundException.d.ts +1 -1
  3. package/build/exceptions/ComponentNotFoundException.js +1 -1
  4. package/build/exceptions/ComponentNotFoundException.js.map +1 -1
  5. package/build/exceptions/CryptoException.d.ts +1 -1
  6. package/build/exceptions/CryptoException.js +1 -1
  7. package/build/exceptions/CryptoException.js.map +1 -1
  8. package/build/exceptions/FatalException.d.ts +1 -1
  9. package/build/exceptions/FatalException.js +1 -1
  10. package/build/exceptions/FatalException.js.map +1 -1
  11. package/build/exceptions/HttpRequestException.d.ts +1 -1
  12. package/build/exceptions/HttpRequestException.js +1 -1
  13. package/build/exceptions/HttpRequestException.js.map +1 -1
  14. package/build/exceptions/InvalidMethodAcceptException.d.ts +1 -1
  15. package/build/exceptions/InvalidMethodAcceptException.js +1 -1
  16. package/build/exceptions/InvalidMethodAcceptException.js.map +1 -1
  17. package/build/exceptions/InvalidMethodReturnException.d.ts +1 -1
  18. package/build/exceptions/InvalidMethodReturnException.js +1 -1
  19. package/build/exceptions/InvalidMethodReturnException.js.map +1 -1
  20. package/build/exceptions/ModuleNotFoundException.d.ts +1 -1
  21. package/build/exceptions/ModuleNotFoundException.js +1 -1
  22. package/build/exceptions/ModuleNotFoundException.js.map +1 -1
  23. package/build/exceptions/ProcessException.d.ts +1 -1
  24. package/build/exceptions/ProcessException.js +1 -1
  25. package/build/exceptions/ProcessException.js.map +1 -1
  26. package/build/exceptions/ThreadException.d.ts +1 -1
  27. package/build/exceptions/ThreadException.js +1 -1
  28. package/build/exceptions/ThreadException.js.map +1 -1
  29. package/build/exceptions/TimeoutException.d.ts +1 -1
  30. package/build/exceptions/TimeoutException.js +1 -1
  31. package/build/exceptions/TimeoutException.js.map +1 -1
  32. package/build/exceptions/ValidationException.d.ts +1 -1
  33. package/build/exceptions/ValidationException.js +1 -1
  34. package/build/exceptions/ValidationException.js.map +1 -1
  35. package/build/lib/multipleRunner/lib/bridges/BaseBridge.js +4 -1
  36. package/build/lib/multipleRunner/lib/bridges/BaseBridge.js.map +1 -1
  37. package/package.json +3 -3
  38. package/src/base/abstracts/Exception.ts +1 -1
  39. package/src/exceptions/ComponentNotFoundException.ts +2 -2
  40. package/src/exceptions/CryptoException.ts +2 -2
  41. package/src/exceptions/FatalException.ts +2 -2
  42. package/src/exceptions/HttpRequestException.ts +2 -2
  43. package/src/exceptions/InvalidMethodAcceptException.ts +2 -2
  44. package/src/exceptions/InvalidMethodReturnException.ts +2 -2
  45. package/src/exceptions/ModuleNotFoundException.ts +2 -2
  46. package/src/exceptions/ProcessException.ts +2 -2
  47. package/src/exceptions/ThreadException.ts +2 -2
  48. package/src/exceptions/TimeoutException.ts +2 -2
  49. package/src/exceptions/ValidationException.ts +2 -2
  50. package/src/lib/multipleRunner/lib/bridges/BaseBridge.ts +112 -109
  51. package/src/tests/exceptions/TestException.ts +1 -1
  52. package/src/tests/processes/TestProcess.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  export declare abstract class Exception extends Error {
2
2
  abstract district: string;
3
- abstract errno: number;
3
+ abstract errno: number | string;
4
4
  readonly appId: string;
5
5
  readonly appName: string;
6
6
  readonly errMsg: string;
@@ -1,6 +1,6 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class ComponentNotFoundException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  protected templates(): string[];
6
6
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class ComponentNotFoundException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 9;
8
+ this.errno = 'E_COMPONENT_NOT_FOUND';
9
9
  }
10
10
  templates() {
11
11
  return [
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentNotFoundException.js","sourceRoot":"","sources":["../../src/exceptions/ComponentNotFoundException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,0BAA2B,SAAQ,qBAAS;IAAzD;;QAEQ,UAAK,GAAW,CAAC,CAAA;IAOzB,CAAC;IALU,SAAS;QAClB,OAAO;YACN,6BAA6B;SAC7B,CAAA;IACF,CAAC;CACD;AATD,gEASC"}
1
+ {"version":3,"file":"ComponentNotFoundException.js","sourceRoot":"","sources":["../../src/exceptions/ComponentNotFoundException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,0BAA2B,SAAQ,qBAAS;IAAzD;;QAEQ,UAAK,GAAoB,uBAAuB,CAAA;IAOxD,CAAC;IALU,SAAS;QAClB,OAAO;YACN,6BAA6B;SAC7B,CAAA;IACF,CAAC;CACD;AATD,gEASC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class CryptoException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class CryptoException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 7;
8
+ this.errno = 'E_CRYPTO';
9
9
  }
10
10
  }
11
11
  exports.CryptoException = CryptoException;
@@ -1 +1 @@
1
- {"version":3,"file":"CryptoException.js","sourceRoot":"","sources":["../../src/exceptions/CryptoException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,eAAgB,SAAQ,qBAAS;IAA9C;;QAEQ,UAAK,GAAW,CAAC,CAAA;IACzB,CAAC;CAAA;AAHD,0CAGC"}
1
+ {"version":3,"file":"CryptoException.js","sourceRoot":"","sources":["../../src/exceptions/CryptoException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,eAAgB,SAAQ,qBAAS;IAA9C;;QAEQ,UAAK,GAAoB,UAAU,CAAA;IAC3C,CAAC;CAAA;AAHD,0CAGC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class FatalException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class FatalException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 1;
8
+ this.errno = 'E_FATAL';
9
9
  }
10
10
  }
11
11
  exports.FatalException = FatalException;
@@ -1 +1 @@
1
- {"version":3,"file":"FatalException.js","sourceRoot":"","sources":["../../src/exceptions/FatalException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,cAAe,SAAQ,qBAAS;IAA7C;;QAEQ,UAAK,GAAW,CAAC,CAAA;IACzB,CAAC;CAAA;AAHD,wCAGC"}
1
+ {"version":3,"file":"FatalException.js","sourceRoot":"","sources":["../../src/exceptions/FatalException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,cAAe,SAAQ,qBAAS;IAA7C;;QAEQ,UAAK,GAAoB,SAAS,CAAA;IAC1C,CAAC;CAAA;AAHD,wCAGC"}
@@ -1,6 +1,6 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class HttpRequestException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  protected templates(): string[];
6
6
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class HttpRequestException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 6;
8
+ this.errno = 'E_HTTP_REQUEST';
9
9
  }
10
10
  templates() {
11
11
  return [
@@ -1 +1 @@
1
- {"version":3,"file":"HttpRequestException.js","sourceRoot":"","sources":["../../src/exceptions/HttpRequestException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,oBAAqB,SAAQ,qBAAS;IAAnD;;QAEQ,UAAK,GAAW,CAAC,CAAA;IAUzB,CAAC;IARU,SAAS;QAClB,OAAO;YACN,kCAAkC;YAClC,oDAAoD;YACpD,6DAA6D;YAC7D,kCAAkC;SAClC,CAAA;IACF,CAAC;CACD;AAZD,oDAYC"}
1
+ {"version":3,"file":"HttpRequestException.js","sourceRoot":"","sources":["../../src/exceptions/HttpRequestException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,oBAAqB,SAAQ,qBAAS;IAAnD;;QAEQ,UAAK,GAAoB,gBAAgB,CAAA;IAUjD,CAAC;IARU,SAAS;QAClB,OAAO;YACN,kCAAkC;YAClC,oDAAoD;YACpD,6DAA6D;YAC7D,kCAAkC;SAClC,CAAA;IACF,CAAC;CACD;AAZD,oDAYC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class InvalidMethodAcceptException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class InvalidMethodAcceptException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 21;
8
+ this.errno = 'E_INVALID_METHOD_ACCEPT';
9
9
  }
10
10
  }
11
11
  exports.InvalidMethodAcceptException = InvalidMethodAcceptException;
@@ -1 +1 @@
1
- {"version":3,"file":"InvalidMethodAcceptException.js","sourceRoot":"","sources":["../../src/exceptions/InvalidMethodAcceptException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,4BAA6B,SAAQ,qBAAS;IAA3D;;QAEQ,UAAK,GAAW,EAAE,CAAA;IAC1B,CAAC;CAAA;AAHD,oEAGC"}
1
+ {"version":3,"file":"InvalidMethodAcceptException.js","sourceRoot":"","sources":["../../src/exceptions/InvalidMethodAcceptException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,4BAA6B,SAAQ,qBAAS;IAA3D;;QAEQ,UAAK,GAAoB,yBAAyB,CAAA;IAC1D,CAAC;CAAA;AAHD,oEAGC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class InvalidMethodReturnException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class InvalidMethodReturnException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 22;
8
+ this.errno = 'E_INVALID_METHOD_RETURN';
9
9
  }
10
10
  }
11
11
  exports.InvalidMethodReturnException = InvalidMethodReturnException;
@@ -1 +1 @@
1
- {"version":3,"file":"InvalidMethodReturnException.js","sourceRoot":"","sources":["../../src/exceptions/InvalidMethodReturnException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,4BAA6B,SAAQ,qBAAS;IAA3D;;QAEQ,UAAK,GAAW,EAAE,CAAA;IAC1B,CAAC;CAAA;AAHD,oEAGC"}
1
+ {"version":3,"file":"InvalidMethodReturnException.js","sourceRoot":"","sources":["../../src/exceptions/InvalidMethodReturnException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,4BAA6B,SAAQ,qBAAS;IAA3D;;QAEQ,UAAK,GAAoB,yBAAyB,CAAA;IAC1D,CAAC;CAAA;AAHD,oEAGC"}
@@ -1,6 +1,6 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class ModuleNotFoundException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  protected templates(): string[];
6
6
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class ModuleNotFoundException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 8;
8
+ this.errno = 'E_MODULE_NOT_FOUND';
9
9
  }
10
10
  templates() {
11
11
  return [
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleNotFoundException.js","sourceRoot":"","sources":["../../src/exceptions/ModuleNotFoundException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,uBAAwB,SAAQ,qBAAS;IAAtD;;QAEQ,UAAK,GAAW,CAAC,CAAA;IAOzB,CAAC;IALU,SAAS;QAClB,OAAO;YACN,0BAA0B;SAC1B,CAAA;IACF,CAAC;CACD;AATD,0DASC"}
1
+ {"version":3,"file":"ModuleNotFoundException.js","sourceRoot":"","sources":["../../src/exceptions/ModuleNotFoundException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,uBAAwB,SAAQ,qBAAS;IAAtD;;QAEQ,UAAK,GAAoB,oBAAoB,CAAA;IAOrD,CAAC;IALU,SAAS;QAClB,OAAO;YACN,0BAA0B;SAC1B,CAAA;IACF,CAAC;CACD;AATD,0DASC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class ProcessException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class ProcessException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 5;
8
+ this.errno = 'E_PROCESS';
9
9
  }
10
10
  }
11
11
  exports.ProcessException = ProcessException;
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessException.js","sourceRoot":"","sources":["../../src/exceptions/ProcessException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,gBAAiB,SAAQ,qBAAS;IAA/C;;QAEQ,UAAK,GAAW,CAAC,CAAA;IACzB,CAAC;CAAA;AAHD,4CAGC"}
1
+ {"version":3,"file":"ProcessException.js","sourceRoot":"","sources":["../../src/exceptions/ProcessException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,gBAAiB,SAAQ,qBAAS;IAA/C;;QAEQ,UAAK,GAAoB,WAAW,CAAA;IAC5C,CAAC;CAAA;AAHD,4CAGC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class ThreadException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class ThreadException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 4;
8
+ this.errno = 'E_THREAD';
9
9
  }
10
10
  }
11
11
  exports.ThreadException = ThreadException;
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadException.js","sourceRoot":"","sources":["../../src/exceptions/ThreadException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,eAAgB,SAAQ,qBAAS;IAA9C;;QAEQ,UAAK,GAAW,CAAC,CAAA;IACzB,CAAC;CAAA;AAHD,0CAGC"}
1
+ {"version":3,"file":"ThreadException.js","sourceRoot":"","sources":["../../src/exceptions/ThreadException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,eAAgB,SAAQ,qBAAS;IAA9C;;QAEQ,UAAK,GAAoB,UAAU,CAAA;IAC3C,CAAC;CAAA;AAHD,0CAGC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class TimeoutException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class TimeoutException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 3;
8
+ this.errno = 'E_TIMEOUT';
9
9
  }
10
10
  }
11
11
  exports.TimeoutException = TimeoutException;
@@ -1 +1 @@
1
- {"version":3,"file":"TimeoutException.js","sourceRoot":"","sources":["../../src/exceptions/TimeoutException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,gBAAiB,SAAQ,qBAAS;IAA/C;;QAEQ,UAAK,GAAW,CAAC,CAAA;IACzB,CAAC;CAAA;AAHD,4CAGC"}
1
+ {"version":3,"file":"TimeoutException.js","sourceRoot":"","sources":["../../src/exceptions/TimeoutException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,gBAAiB,SAAQ,qBAAS;IAA/C;;QAEQ,UAAK,GAAoB,WAAW,CAAA;IAC5C,CAAC;CAAA;AAHD,4CAGC"}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '../base/abstracts/Exception';
2
2
  export declare class ValidationException extends Exception {
3
3
  district: string;
4
- errno: number;
4
+ errno: number | string;
5
5
  }
@@ -5,7 +5,7 @@ const Exception_1 = require("../base/abstracts/Exception");
5
5
  class ValidationException extends Exception_1.Exception {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this.errno = 2;
8
+ this.errno = 'E_VALIDATION';
9
9
  }
10
10
  }
11
11
  exports.ValidationException = ValidationException;
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationException.js","sourceRoot":"","sources":["../../src/exceptions/ValidationException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,mBAAoB,SAAQ,qBAAS;IAAlD;;QAEQ,UAAK,GAAW,CAAC,CAAA;IACzB,CAAC;CAAA;AAHD,kDAGC"}
1
+ {"version":3,"file":"ValidationException.js","sourceRoot":"","sources":["../../src/exceptions/ValidationException.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,MAAa,mBAAoB,SAAQ,qBAAS;IAAlD;;QAEQ,UAAK,GAAoB,cAAc,CAAA;IAC/C,CAAC;CAAA;AAHD,kDAGC"}
@@ -11,8 +11,11 @@ class BaseBridge {
11
11
  constructor(bridgeObject) {
12
12
  this.eventEmitter = new events_1.EventEmitter();
13
13
  this.bridge = bridgeObject;
14
- this.bridge.on('message', data => {
14
+ this.bridge
15
+ .on('message', data => {
15
16
  this.eventEmitter.emit.apply(this.eventEmitter, [data.channel].concat(data.args));
17
+ })
18
+ .on('error', bridgeError => {
16
19
  });
17
20
  }
18
21
  off(channel) {
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,CAAC;IAEM,iBAAiB,CAAC,OAA+C;QACvE,IAAI,CAAC,EAAE,CAAC,yBAAe,EAAE,OAAO,CAAC,CAAA;QACjC,OAAO,IAAI,CAAA;IACZ,CAAC;IAEM,eAAe,CAAC,OAAY,EAAE,OAAgC;QACpE,MAAM,eAAe,GAAW,wBAAwB,IAAI,CAAC,GAAG,EAAE,eAAe,CAAA;QACjF,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YAC7C,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAC7B,CAAC,CAAC,CAAA;QACF,OAAO,eAAe,CAAA;IACvB,CAAC;IAEM,UAAU,CAAC,eAAuB,EAAE,IAAW;QACrD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,IAAI,CAAQ,CAAC,CAAA;QAC5D,OAAO,IAAI,CAAA;IACZ,CAAC;IAEM,KAAK,CAAC,SAAS;QACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC9C,CAAC;CACD;AAjHD,gCAiHC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lakutata/core",
3
- "version": "1.0.40",
3
+ "version": "1.0.43",
4
4
  "description": "Lakutata Framework Core",
5
5
  "main": "./build/Core.js",
6
6
  "types": "./build/Core.d.ts",
@@ -95,8 +95,8 @@
95
95
  "eslint-plugin-import": "^2.25.3",
96
96
  "eslint-plugin-node": "^11.1.0",
97
97
  "eslint-plugin-promise": "^5.2.0",
98
- "shx": "^0.3.3",
99
- "ts-node": "^10.6.0" ,
98
+ "shx": "^0.3.4",
99
+ "ts-node": "^10.7.0" ,
100
100
  "typescript": "^4.6.2"
101
101
  },
102
102
  "engines": {
@@ -3,7 +3,7 @@ import {format} from 'util'
3
3
 
4
4
  export abstract class Exception extends Error {
5
5
  public abstract district: string
6
- public abstract errno: number
6
+ public abstract errno: number | string
7
7
  public readonly appId: string = process.env.appId ? process.env.appId : 'Unknown'
8
8
  public readonly appName: string = process.env.appName ? process.env.appName : 'Unknown'
9
9
  public readonly errMsg: string
@@ -2,11 +2,11 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class ComponentNotFoundException extends Exception {
4
4
  public district: string
5
- public errno: number = 9
5
+ public errno: number | string = 'E_COMPONENT_NOT_FOUND'
6
6
 
7
7
  protected templates(): string[] {
8
8
  return [
9
9
  'Component \'{0}\' not found'
10
10
  ]
11
11
  }
12
- }
12
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class CryptoException extends Exception {
4
4
  public district: string
5
- public errno: number = 7
6
- }
5
+ public errno: number | string = 'E_CRYPTO'
6
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class FatalException extends Exception {
4
4
  public district: string
5
- public errno: number = 1
6
- }
5
+ public errno: number | string = 'E_FATAL'
6
+ }
@@ -2,7 +2,7 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class HttpRequestException extends Exception {
4
4
  public district: string
5
- public errno: number = 6
5
+ public errno: number | string = 'E_HTTP_REQUEST'
6
6
 
7
7
  protected templates(): string[] {
8
8
  return [
@@ -12,4 +12,4 @@ export class HttpRequestException extends Exception {
12
12
  'Http request error occurred: {0}'
13
13
  ]
14
14
  }
15
- }
15
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class InvalidMethodAcceptException extends Exception {
4
4
  public district: string
5
- public errno: number = 21
6
- }
5
+ public errno: number | string = 'E_INVALID_METHOD_ACCEPT'
6
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class InvalidMethodReturnException extends Exception {
4
4
  public district: string
5
- public errno: number = 22
6
- }
5
+ public errno: number | string = 'E_INVALID_METHOD_RETURN'
6
+ }
@@ -2,11 +2,11 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class ModuleNotFoundException extends Exception {
4
4
  public district: string
5
- public errno: number = 8
5
+ public errno: number | string = 'E_MODULE_NOT_FOUND'
6
6
 
7
7
  protected templates(): string[] {
8
8
  return [
9
9
  'Module \'{0}\' not found'
10
10
  ]
11
11
  }
12
- }
12
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class ProcessException extends Exception {
4
4
  public district: string
5
- public errno: number = 5
6
- }
5
+ public errno: number | string = 'E_PROCESS'
6
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class ThreadException extends Exception {
4
4
  public district: string
5
- public errno: number = 4
6
- }
5
+ public errno: number | string = 'E_THREAD'
6
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class TimeoutException extends Exception {
4
4
  public district: string
5
- public errno: number = 3
6
- }
5
+ public errno: number | string = 'E_TIMEOUT'
6
+ }
@@ -2,5 +2,5 @@ import {Exception} from '../base/abstracts/Exception'
2
2
 
3
3
  export class ValidationException extends Exception {
4
4
  public district: string
5
- public errno: number = 2
6
- }
5
+ public errno: number | string = 'E_VALIDATION'
6
+ }
@@ -3,113 +3,116 @@ import random from 'random'
3
3
  import {INVOKE, PROPERTY_CHANGE, READY, SET_PROPERTY, SETUP_ERROR} from '../../constants/Channel'
4
4
 
5
5
  export class BaseBridge {
6
- protected readonly eventEmitter: EventEmitter = new EventEmitter()
7
- protected readonly bridge: any
8
-
9
- constructor(bridgeObject: any) {
10
- this.bridge = bridgeObject
11
- this.bridge.on('message', data => {
12
- this.eventEmitter.emit.apply(this.eventEmitter, [data.channel].concat(data.args) as any)
13
- })
14
- }
15
-
16
- public off(channel: string) {
17
- this.eventEmitter.removeAllListeners(channel)
18
- return this
19
- }
20
-
21
- public on(channel: string, listener: (...args: any[]) => void) {
22
- this.eventEmitter.on.apply(this.eventEmitter, [channel, listener])
23
- return this
24
- }
25
-
26
- public once(channel: string, listener: (...args: any[]) => void) {
27
- this.eventEmitter.once.apply(this.eventEmitter, [channel, listener])
28
- return this
29
- }
30
-
31
- public send(channel: string, ...args: any[]) {
32
- throw new Error('Method did not implemented')
33
- }
34
-
35
- public ready(properties: { [key: string]: any }, propertyValues: { [key: string]: any }) {
36
- this.send(READY, properties, propertyValues)
37
- return this
38
- }
39
-
40
- public onReady(callback: (properties: { [key: string]: any }, propertyValues: { [key: string]: any }) => void) {
41
- this.once(READY, callback)
42
- return this
43
- }
44
-
45
- public error(error: Error) {
46
- this.send('error', error.message)
47
- }
48
-
49
- public setupError(error: Error) {
50
- this.send(SETUP_ERROR, error.message)
51
- }
52
-
53
- public async invoke(method: string, args: Array<any>) {
54
- return new Promise((resolve, reject) => {
55
- const invokeId: string = `ts_${Date.now()}_rnd_${random.int(100, 999999)}`
56
- const responseChannelName: string = `__%$invoke_res_${invokeId}$%__`
57
- this.once(responseChannelName, (errMsg: string, result: any) => {
58
- if (errMsg) {
59
- reject(new Error(errMsg))
60
- } else {
61
- resolve(result)
62
- }
63
- })
64
- this.send(INVOKE, method, args, responseChannelName)
65
- })
66
- }
67
-
68
- public onInvoke(handler: (method: string, args: Array<any>) => Promise<any>): void {
69
- this.on(INVOKE, (method: string, args: Array<any>, responseChannelName: string) => {
70
- handler(method, args).then(result => {
71
- this.send(responseChannelName, null, result)
72
- }).catch(invokeError => {
73
- this.send(responseChannelName, invokeError.message, undefined)
74
- })
75
- })
76
- }
77
-
78
- public set(property: string, value: any) {
79
- this.send(SET_PROPERTY, property, value)
80
- return this
81
- }
82
-
83
- public onSet(handler: (property: string, value: any) => void) {
84
- this.on(SET_PROPERTY, handler)
85
- return this
86
- }
87
-
88
- public propertyChange(property: string, value: any) {
89
- this.send(PROPERTY_CHANGE, property, value)
90
- this.send('property-changed', property, value)
91
- return this
92
- }
93
-
94
- public onPropertyChanged(handler: (property: string, value: any) => void) {
95
- this.on(PROPERTY_CHANGE, handler)
96
- return this
97
- }
98
-
99
- public callbackHandler(thisArg: any, handler: (...args: any[]) => any): string {
100
- const callbackEvtName: string = `__________%$CALLBACK[${Date.now()}]$%__________`
101
- this.once(callbackEvtName, (...args: any[]) => {
102
- handler.apply(thisArg, args)
103
- })
104
- return callbackEvtName
105
- }
106
-
107
- public onCallback(callbackEvtName: string, args: any[]) {
108
- this.send.apply(this, [callbackEvtName].concat(args) as any)
109
- return this
110
- }
111
-
112
- public async terminate(): Promise<void> {
113
- throw new Error('Method did not implemented')
114
- }
6
+ protected readonly eventEmitter: EventEmitter = new EventEmitter()
7
+ protected readonly bridge: any
8
+
9
+ constructor(bridgeObject: any) {
10
+ this.bridge = bridgeObject
11
+ this.bridge
12
+ .on('message', data => {
13
+ this.eventEmitter.emit.apply(this.eventEmitter, [data.channel].concat(data.args) as any)
14
+ })
15
+ .on('error', bridgeError => {
16
+ })
17
+ }
18
+
19
+ public off(channel: string) {
20
+ this.eventEmitter.removeAllListeners(channel)
21
+ return this
22
+ }
23
+
24
+ public on(channel: string, listener: (...args: any[]) => void) {
25
+ this.eventEmitter.on.apply(this.eventEmitter, [channel, listener])
26
+ return this
27
+ }
28
+
29
+ public once(channel: string, listener: (...args: any[]) => void) {
30
+ this.eventEmitter.once.apply(this.eventEmitter, [channel, listener])
31
+ return this
32
+ }
33
+
34
+ public send(channel: string, ...args: any[]) {
35
+ throw new Error('Method did not implemented')
36
+ }
37
+
38
+ public ready(properties: { [key: string]: any }, propertyValues: { [key: string]: any }) {
39
+ this.send(READY, properties, propertyValues)
40
+ return this
41
+ }
42
+
43
+ public onReady(callback: (properties: { [key: string]: any }, propertyValues: { [key: string]: any }) => void) {
44
+ this.once(READY, callback)
45
+ return this
46
+ }
47
+
48
+ public error(error: Error) {
49
+ this.send('error', error.message)
50
+ }
51
+
52
+ public setupError(error: Error) {
53
+ this.send(SETUP_ERROR, error.message)
54
+ }
55
+
56
+ public async invoke(method: string, args: Array<any>) {
57
+ return new Promise((resolve, reject) => {
58
+ const invokeId: string = `ts_${Date.now()}_rnd_${random.int(100, 999999)}`
59
+ const responseChannelName: string = `__%$invoke_res_${invokeId}$%__`
60
+ this.once(responseChannelName, (errMsg: string, result: any) => {
61
+ if (errMsg) {
62
+ reject(new Error(errMsg))
63
+ } else {
64
+ resolve(result)
65
+ }
66
+ })
67
+ this.send(INVOKE, method, args, responseChannelName)
68
+ })
69
+ }
70
+
71
+ public onInvoke(handler: (method: string, args: Array<any>) => Promise<any>): void {
72
+ this.on(INVOKE, (method: string, args: Array<any>, responseChannelName: string) => {
73
+ handler(method, args).then(result => {
74
+ this.send(responseChannelName, null, result)
75
+ }).catch(invokeError => {
76
+ this.send(responseChannelName, invokeError.message, undefined)
77
+ })
78
+ })
79
+ }
80
+
81
+ public set(property: string, value: any) {
82
+ this.send(SET_PROPERTY, property, value)
83
+ return this
84
+ }
85
+
86
+ public onSet(handler: (property: string, value: any) => void) {
87
+ this.on(SET_PROPERTY, handler)
88
+ return this
89
+ }
90
+
91
+ public propertyChange(property: string, value: any) {
92
+ this.send(PROPERTY_CHANGE, property, value)
93
+ this.send('property-changed', property, value)
94
+ return this
95
+ }
96
+
97
+ public onPropertyChanged(handler: (property: string, value: any) => void) {
98
+ this.on(PROPERTY_CHANGE, handler)
99
+ return this
100
+ }
101
+
102
+ public callbackHandler(thisArg: any, handler: (...args: any[]) => any): string {
103
+ const callbackEvtName: string = `__________%$CALLBACK[${Date.now()}]$%__________`
104
+ this.once(callbackEvtName, (...args: any[]) => {
105
+ handler.apply(thisArg, args)
106
+ })
107
+ return callbackEvtName
108
+ }
109
+
110
+ public onCallback(callbackEvtName: string, args: any[]) {
111
+ this.send.apply(this, [callbackEvtName].concat(args) as any)
112
+ return this
113
+ }
114
+
115
+ public async terminate(): Promise<void> {
116
+ throw new Error('Method did not implemented')
117
+ }
115
118
  }
@@ -2,5 +2,5 @@ import {Exception} from '../../Core'
2
2
 
3
3
  export class TestException extends Exception {
4
4
  public district: string
5
- public errno: number = 99999
5
+ public errno: number | string = 'E_TEST'
6
6
  }
@@ -8,4 +8,4 @@ export class TestProcess extends Process {
8
8
  public async procTest() {
9
9
  console.log('this is procTest', process.title)
10
10
  }
11
- }
11
+ }