ismx-nexo-node-app 0.4.69 → 0.4.71

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.
@@ -86,8 +86,7 @@ class ServiceRestFormalTemplate {
86
86
  return __awaiter(this, void 0, void 0, function* () {
87
87
  let id = this.getFormalId(request);
88
88
  let entity = yield this.database.one(this.tableName, id);
89
- let result = yield this.extendEntity(entity);
90
- return Service_1.HttpResponse.ok(result);
89
+ return Service_1.HttpResponse.ok(entity ? yield this.extendEntity(entity) : entity);
91
90
  });
92
91
  }
93
92
  /**
@@ -34,8 +34,7 @@ class BusinessState {
34
34
  }
35
35
  notify(data) {
36
36
  var _a, _b;
37
- if (data)
38
- this.data = data;
37
+ this.data = Object.assign({}, (data !== null && data !== void 0 ? data : this.data));
39
38
  for (let l in this.listeners)
40
39
  try {
41
40
  (_b = (_a = this.listeners)[l]) === null || _b === void 0 ? void 0 : _b.call(_a, this.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.69",
3
+ "version": "0.4.71",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -97,8 +97,7 @@ export default class ServiceRestFormalTemplate<Model=any>
97
97
  protected async serveGet(request: HttpRequest): Promise<HttpResponse<Model>> {
98
98
  let id = this.getFormalId(request);
99
99
  let entity = await this.database.one<Model>(this.tableName, id);
100
- let result = await this.extendEntity(entity);
101
- return HttpResponse.ok(result);
100
+ return HttpResponse.ok(entity ? await this.extendEntity(entity) : entity);
102
101
  }
103
102
 
104
103
  /**
@@ -23,7 +23,7 @@ export default class BusinessState<Model>
23
23
  }
24
24
 
25
25
  protected notify(data?: Model): void {
26
- if (data) this.data = data;
26
+ this.data = { ...(data ?? this.data) };
27
27
  for (let l in this.listeners)
28
28
  try { this.listeners[l]?.(this.data); } catch (error) {}
29
29
  }