ismx-nexo-node-app 0.4.188 → 0.4.190

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.
@@ -15,37 +15,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const Service_1 = require("./Service");
16
16
  const ServiceRestFormal_1 = __importDefault(require("./ServiceRestFormal"));
17
17
  class ServiceRestFormalTemplate {
18
- constructor(resource, database, tableName) {
18
+ constructor(resource, database, tableName, options = {}) {
19
19
  this.indexer = "id";
20
20
  this.resource = resource;
21
21
  this.database = database;
22
22
  this.tableName = tableName;
23
- this.get = new ServiceRestFormal_1.default("GET", `${resource}`);
24
- this.getList = new ServiceRestFormal_1.default("GET", `${resource}/list`);
25
- this.getKeymap = new ServiceRestFormal_1.default("GET", `${resource}/keymap`);
26
- this.put = new ServiceRestFormal_1.default("PUT", `${resource}`);
27
- this.postList = new ServiceRestFormal_1.default("POST", `${resource}/list`);
28
- this.postKeymap = new ServiceRestFormal_1.default("POST", `${resource}/keymap`);
29
- this.post = new ServiceRestFormal_1.default("POST", `${resource}`);
30
- this.del = new ServiceRestFormal_1.default("DELETE", `${resource}`);
31
- this.page = new ServiceRestFormal_1.default("GET", `${resource}/page`);
32
- this.map = new ServiceRestFormal_1.default("GET", `${resource}/map`);
33
- this.select = new ServiceRestFormal_1.default("GET", `${resource}/select`);
34
- this.exist = new ServiceRestFormal_1.default("GET", `${resource}/exist`);
35
- this.count = new ServiceRestFormal_1.default("GET", `${resource}/count`);
36
- this.get.serveRestFormal = this.serveGet.bind(this);
37
- this.getList.serveRestFormal = this.serveGetList.bind(this);
38
- this.getKeymap.serveRestFormal = this.serveGetKeymap.bind(this);
39
- this.postList.serveRestFormal = this.servePostList.bind(this);
40
- this.postKeymap.serveRestFormal = this.servePostKeymap.bind(this);
41
- this.page.serveRestFormal = this.servePage.bind(this);
42
- this.map.serveRestFormal = this.serveMap.bind(this);
43
- this.select.serveRestFormal = this.serveSelect.bind(this);
44
- this.exist.serveRestFormal = this.serveExist.bind(this);
45
- this.count.serveRestFormal = this.serveCount.bind(this);
46
- this.post.serveRestFormal = this.servePost.bind(this);
47
- this.put.serveRestFormal = this.servePut.bind(this);
48
- this.del.serveRestFormal = this.serveDel.bind(this);
23
+ if (options.get !== '404') {
24
+ this.get = new ServiceRestFormal_1.default("GET", `${resource}`, options.get);
25
+ this.get.serveRestFormal = this.serveGet.bind(this);
26
+ }
27
+ if (options.getList !== '404') {
28
+ this.getList = new ServiceRestFormal_1.default("GET", `${resource}/list`, options.getList);
29
+ this.getList.serveRestFormal = this.serveGetList.bind(this);
30
+ }
31
+ if (options.getKeymap !== '404') {
32
+ this.getKeymap = new ServiceRestFormal_1.default("GET", `${resource}/keymap`, options.getKeymap);
33
+ this.getKeymap.serveRestFormal = this.serveGetKeymap.bind(this);
34
+ }
35
+ if (options.put !== '404') {
36
+ this.put = new ServiceRestFormal_1.default("PUT", `${resource}`, options.put);
37
+ this.put.serveRestFormal = this.servePut.bind(this);
38
+ }
39
+ if (options.postList !== '404') {
40
+ this.postList = new ServiceRestFormal_1.default("POST", `${resource}/list`, options.postList);
41
+ this.postList.serveRestFormal = this.servePostList.bind(this);
42
+ }
43
+ if (options.postKeymap !== '404') {
44
+ this.postKeymap = new ServiceRestFormal_1.default("POST", `${resource}/keymap`, options.postKeymap);
45
+ this.postKeymap.serveRestFormal = this.servePostKeymap.bind(this);
46
+ }
47
+ if (options.post !== '404') {
48
+ this.post = new ServiceRestFormal_1.default("POST", `${resource}`, options.post);
49
+ this.post.serveRestFormal = this.servePost.bind(this);
50
+ }
51
+ if (options.del !== '404') {
52
+ this.del = new ServiceRestFormal_1.default("DELETE", `${resource}`, options.del);
53
+ this.del.serveRestFormal = this.serveDel.bind(this);
54
+ }
55
+ if (options.page !== '404') {
56
+ this.page = new ServiceRestFormal_1.default("GET", `${resource}/page`, options.page);
57
+ this.page.serveRestFormal = this.servePage.bind(this);
58
+ }
59
+ if (options.map !== '404') {
60
+ this.map = new ServiceRestFormal_1.default("GET", `${resource}/map`, options.map);
61
+ this.map.serveRestFormal = this.serveMap.bind(this);
62
+ }
63
+ if (options.select !== '404') {
64
+ this.select = new ServiceRestFormal_1.default("GET", `${resource}/select`, options.select);
65
+ this.select.serveRestFormal = this.serveSelect.bind(this);
66
+ }
67
+ if (options.exist !== '404') {
68
+ this.exist = new ServiceRestFormal_1.default("GET", `${resource}/exist`, options.exist);
69
+ this.exist.serveRestFormal = this.serveExist.bind(this);
70
+ }
71
+ if (options.count !== '404') {
72
+ this.count = new ServiceRestFormal_1.default("GET", `${resource}/count`, options.count);
73
+ this.count.serveRestFormal = this.serveCount.bind(this);
74
+ }
49
75
  }
50
76
  getFormalId(request) {
51
77
  var _a;
@@ -1,4 +1,4 @@
1
- import { HttpRequest, HttpResponse } from "./Service";
1
+ import { HttpRequest, HttpResponse, ServiceType } from "./Service";
2
2
  import ServiceRestFormal from "./ServiceRestFormal";
3
3
  import { Pagination, Transient } from "../repository/Repository";
4
4
  import RepositoryDatabase from "../repository/RepositoryDatabase";
@@ -27,7 +27,7 @@ export default class ServiceRestFormalTemplate<Model = any> {
27
27
  readonly map: ServiceRestFormal<any, {
28
28
  [key: string]: Model;
29
29
  }>;
30
- constructor(resource: string, database: RepositoryDatabase, tableName: string);
30
+ constructor(resource: string, database: RepositoryDatabase, tableName: string, options?: Partial<Record<keyof ServiceRestFormalTemplate, (ServiceType | "404")>>);
31
31
  protected indexer: string;
32
32
  getFormalId(request: HttpRequest): string;
33
33
  getFormalPage(request: HttpRequest): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.188",
3
+ "version": "0.4.190",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -1,4 +1,4 @@
1
- import {HttpRequest, HttpResponse} from "./Service";
1
+ import {HttpRequest, HttpResponse, ServiceType} from "./Service";
2
2
  import ServiceRestFormal, {Wrapper} from "./ServiceRestFormal";
3
3
  import {Pagination, Transient} from "../repository/Repository";
4
4
  import RepositoryDatabase from "../repository/RepositoryDatabase";
@@ -24,41 +24,75 @@ export default class ServiceRestFormalTemplate<Model=any>
24
24
  readonly page!: ServiceRestFormal<any, Pagination<Model>>;
25
25
  readonly map!: ServiceRestFormal<any, { [key:string]: Model }>;
26
26
 
27
- constructor(resource: string, database: RepositoryDatabase, tableName: string) {
27
+ constructor(resource: string, database: RepositoryDatabase, tableName: string, options: Partial<Record<keyof ServiceRestFormalTemplate, (ServiceType | "404")>> = {}) {
28
28
  this.resource = resource;
29
29
  this.database = database;
30
30
  this.tableName = tableName;
31
31
 
32
- this.get = new ServiceRestFormal("GET", `${resource}`);
33
- this.getList = new ServiceRestFormal("GET", `${resource}/list`);
34
- this.getKeymap = new ServiceRestFormal("GET", `${resource}/keymap`);
35
-
36
- this.put = new ServiceRestFormal("PUT", `${resource}`);
37
- this.postList = new ServiceRestFormal("POST", `${resource}/list`);
38
- this.postKeymap = new ServiceRestFormal("POST", `${resource}/keymap`);
39
-
40
- this.post = new ServiceRestFormal("POST", `${resource}`);
41
- this.del = new ServiceRestFormal("DELETE", `${resource}`)
42
-
43
- this.page = new ServiceRestFormal("GET", `${resource}/page`);
44
- this.map = new ServiceRestFormal("GET", `${resource}/map`);
45
- this.select = new ServiceRestFormal("GET", `${resource}/select`);
46
- this.exist = new ServiceRestFormal("GET", `${resource}/exist`);
47
- this.count = new ServiceRestFormal("GET", `${resource}/count`);
48
-
49
- this.get.serveRestFormal = this.serveGet.bind(this);
50
- this.getList.serveRestFormal = this.serveGetList.bind(this);
51
- this.getKeymap.serveRestFormal = this.serveGetKeymap.bind(this);
52
- this.postList.serveRestFormal = this.servePostList.bind(this);
53
- this.postKeymap.serveRestFormal = this.servePostKeymap.bind(this);
54
- this.page.serveRestFormal = this.servePage.bind(this);
55
- this.map.serveRestFormal = this.serveMap.bind(this);
56
- this.select.serveRestFormal = this.serveSelect.bind(this);
57
- this.exist.serveRestFormal = this.serveExist.bind(this);
58
- this.count.serveRestFormal = this.serveCount.bind(this);
59
- this.post.serveRestFormal = this.servePost.bind(this);
60
- this.put.serveRestFormal = this.servePut.bind(this);
61
- this.del.serveRestFormal = this.serveDel.bind(this);
32
+ if (options.get !== '404') {
33
+ this.get = new ServiceRestFormal("GET", `${resource}`, options.get);
34
+ this.get.serveRestFormal = this.serveGet.bind(this);
35
+ }
36
+
37
+ if (options.getList !== '404') {
38
+ this.getList = new ServiceRestFormal("GET", `${resource}/list`, options.getList);
39
+ this.getList.serveRestFormal = this.serveGetList.bind(this);
40
+ }
41
+
42
+ if (options.getKeymap !== '404') {
43
+ this.getKeymap = new ServiceRestFormal("GET", `${resource}/keymap`, options.getKeymap);
44
+ this.getKeymap.serveRestFormal = this.serveGetKeymap.bind(this);
45
+ }
46
+
47
+ if (options.put !== '404') {
48
+ this.put = new ServiceRestFormal("PUT", `${resource}`, options.put);
49
+ this.put.serveRestFormal = this.servePut.bind(this);
50
+ }
51
+
52
+ if (options.postList !== '404') {
53
+ this.postList = new ServiceRestFormal("POST", `${resource}/list`, options.postList);
54
+ this.postList.serveRestFormal = this.servePostList.bind(this);
55
+ }
56
+
57
+ if (options.postKeymap !== '404') {
58
+ this.postKeymap = new ServiceRestFormal("POST", `${resource}/keymap`, options.postKeymap);
59
+ this.postKeymap.serveRestFormal = this.servePostKeymap.bind(this);
60
+ }
61
+
62
+ if (options.post !== '404') {
63
+ this.post = new ServiceRestFormal("POST", `${resource}`, options.post);
64
+ this.post.serveRestFormal = this.servePost.bind(this);
65
+ }
66
+
67
+ if (options.del !== '404') {
68
+ this.del = new ServiceRestFormal("DELETE", `${resource}`, options.del)
69
+ this.del.serveRestFormal = this.serveDel.bind(this);
70
+ }
71
+
72
+ if (options.page !== '404') {
73
+ this.page = new ServiceRestFormal("GET", `${resource}/page`, options.page);
74
+ this.page.serveRestFormal = this.servePage.bind(this);
75
+ }
76
+
77
+ if (options.map !== '404') {
78
+ this.map = new ServiceRestFormal("GET", `${resource}/map`, options.map);
79
+ this.map.serveRestFormal = this.serveMap.bind(this);
80
+ }
81
+
82
+ if (options.select !== '404') {
83
+ this.select = new ServiceRestFormal("GET", `${resource}/select`, options.select);
84
+ this.select.serveRestFormal = this.serveSelect.bind(this);
85
+ }
86
+
87
+ if (options.exist !== '404') {
88
+ this.exist = new ServiceRestFormal("GET", `${resource}/exist`, options.exist);
89
+ this.exist.serveRestFormal = this.serveExist.bind(this);
90
+ }
91
+
92
+ if (options.count !== '404') {
93
+ this.count = new ServiceRestFormal("GET", `${resource}/count`, options.count);
94
+ this.count.serveRestFormal = this.serveCount.bind(this);
95
+ }
62
96
  }
63
97
 
64
98
  protected indexer = "id"