ismx-nexo-node-app 0.3.54 → 0.3.55

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.
@@ -40,23 +40,26 @@ const Business_1 = __importDefault(require("./Business"));
40
40
  class BusinessServer extends Business_1.default {
41
41
  constructor() {
42
42
  super();
43
+ this.services = [];
43
44
  this.publish = this.publish.bind(this);
44
45
  }
45
46
  init() {
46
- Promise.resolve().then(() => __importStar(require("express"))).then(({ default: express }) => {
47
- Promise.resolve().then(() => __importStar(require("cors"))).then(({ default: cors }) => {
48
- this.app = express();
49
- this.app.use(express.urlencoded({ extended: false }));
50
- this.app.use(express.json());
51
- this.app.use(cors());
52
- });
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ yield Promise.resolve().then(() => __importStar(require("express"))).then((_a) => __awaiter(this, [_a], void 0, function* ({ default: express }) {
49
+ yield Promise.resolve().then(() => __importStar(require("cors"))).then((_a) => __awaiter(this, [_a], void 0, function* ({ default: cors }) {
50
+ this.app = express();
51
+ this.app.use(express.urlencoded({ extended: false }));
52
+ this.app.use(express.json());
53
+ this.app.use(cors());
54
+ }));
55
+ }));
53
56
  });
54
57
  }
55
58
  start(port) {
56
59
  this.app.listen(port, this.onStarted);
57
60
  }
58
61
  setServices(services) {
59
- services.forEach(this.publish);
62
+ (this.services = services).forEach(this.publish);
60
63
  }
61
64
  setOnStarted(listener) {
62
65
  this.onStarted = listener;
@@ -1,9 +1,10 @@
1
1
  import Service, { HttpRequest, HttpResponse } from "../api/Service";
2
2
  import Business from "./Business";
3
3
  export default class BusinessServer extends Business {
4
+ private services;
4
5
  private app;
5
6
  constructor();
6
- init(): void;
7
+ init(): Promise<void>;
7
8
  start(port: number): void;
8
9
  setServices(services: Service<any, any>[]): void;
9
10
  private onStarted?;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.3.54",
3
+ "version": "0.3.55",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -3,6 +3,8 @@ import Business from "./Business";
3
3
 
4
4
  export default class BusinessServer extends Business
5
5
  {
6
+ private services: Service<any, any>[] = []
7
+
6
8
  private app: any;
7
9
 
8
10
  constructor() {
@@ -10,9 +12,9 @@ export default class BusinessServer extends Business
10
12
  this.publish = this.publish.bind(this);
11
13
  }
12
14
 
13
- init() {
14
- import("express").then(({ default: express }) => {
15
- import("cors").then(({ default: cors }) => {
15
+ async init() {
16
+ await import("express").then(async ({ default: express }) => {
17
+ await import("cors").then(async ({ default: cors }) => {
16
18
  this.app = express();
17
19
  this.app.use(express.urlencoded({ extended: false }));
18
20
  this.app.use(express.json());
@@ -26,7 +28,7 @@ export default class BusinessServer extends Business
26
28
  }
27
29
 
28
30
  setServices(services: Service<any, any>[]) {
29
- services.forEach(this.publish);
31
+ (this.services = services).forEach(this.publish);
30
32
  }
31
33
 
32
34
  private onStarted?: ()=>any;