@futdevpro/nts-dynamo 1.7.17 → 1.7.21

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 (129) hide show
  1. package/.eslintrc.json +171 -0
  2. package/lib/_constants/mocks/app-extended-server.mock.d.ts.map +1 -1
  3. package/lib/_constants/mocks/app-extended-server.mock.js.map +1 -1
  4. package/lib/_constants/mocks/app-server.mock.d.ts.map +1 -1
  5. package/lib/_constants/mocks/app-server.mock.js.map +1 -1
  6. package/lib/_constants/mocks/data-model.mock.d.ts.map +1 -1
  7. package/lib/_constants/mocks/data-model.mock.js.map +1 -1
  8. package/lib/_constants/mocks/email-service-collection.mock.d.ts.map +1 -1
  9. package/lib/_constants/mocks/email-service-collection.mock.js.map +1 -1
  10. package/lib/_constants/mocks/email-service.mock.js +3 -3
  11. package/lib/_constants/mocks/email-service.mock.js.map +1 -1
  12. package/lib/_constants/mocks/endpoint.mock.d.ts.map +1 -1
  13. package/lib/_constants/mocks/endpoint.mock.js.map +1 -1
  14. package/lib/_constants/mocks/socket-server.mock.d.ts.map +1 -1
  15. package/lib/_constants/mocks/socket-server.mock.js.map +1 -1
  16. package/lib/_enums/index.js +1 -1
  17. package/lib/_enums/index.js.map +1 -1
  18. package/lib/_models/control-models/api-call-params.control-model.d.ts +2 -2
  19. package/lib/_models/control-models/api-call-params.control-model.d.ts.map +1 -1
  20. package/lib/_models/control-models/api-call-params.control-model.js.map +1 -1
  21. package/lib/_models/control-models/app-system-controls.control-model copy.d.ts.map +1 -1
  22. package/lib/_models/control-models/app-system-controls.control-model copy.js.map +1 -1
  23. package/lib/_models/control-models/app-system-controls.control-model.d.ts.map +1 -1
  24. package/lib/_models/control-models/app-system-controls.control-model.js.map +1 -1
  25. package/lib/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
  26. package/lib/_models/control-models/endpoint-params.control-model.js +15 -9
  27. package/lib/_models/control-models/endpoint-params.control-model.js.map +1 -1
  28. package/lib/_models/control-models/http-settings.control-model.d.ts +1 -1
  29. package/lib/_models/control-models/http-settings.control-model.d.ts.map +1 -1
  30. package/lib/_models/control-models/http-settings.control-model.js +3 -1
  31. package/lib/_models/control-models/http-settings.control-model.js.map +1 -1
  32. package/lib/_models/control-models/socket-client-service-params.control-model.js.map +1 -1
  33. package/lib/_models/control-models/socket-event.control-model.js.map +1 -1
  34. package/lib/_models/control-models/socket-presence.control-model.js.map +1 -1
  35. package/lib/_modules/custom-data/custom-data.controller.d.ts.map +1 -1
  36. package/lib/_modules/custom-data/custom-data.controller.js +2 -1
  37. package/lib/_modules/custom-data/custom-data.controller.js.map +1 -1
  38. package/lib/_modules/custom-data/get-custom-data-routing-module.util.d.ts.map +1 -1
  39. package/lib/_modules/custom-data/get-custom-data-routing-module.util.js.map +1 -1
  40. package/lib/_modules/test/get-test-routing-module.util.d.ts.map +1 -1
  41. package/lib/_modules/test/get-test-routing-module.util.js.map +1 -1
  42. package/lib/_modules/test/test.controller.d.ts.map +1 -1
  43. package/lib/_modules/test/test.controller.js.map +1 -1
  44. package/lib/_modules/usage/get-usage-routing-module.util.d.ts.map +1 -1
  45. package/lib/_modules/usage/get-usage-routing-module.util.js +1 -1
  46. package/lib/_modules/usage/get-usage-routing-module.util.js.map +1 -1
  47. package/lib/_modules/usage/usage.controller.d.ts.map +1 -1
  48. package/lib/_modules/usage/usage.controller.js +15 -14
  49. package/lib/_modules/usage/usage.controller.js.map +1 -1
  50. package/lib/_modules/usage/usage.data-service.d.ts +3 -1
  51. package/lib/_modules/usage/usage.data-service.d.ts.map +1 -1
  52. package/lib/_modules/usage/usage.data-service.js +24 -16
  53. package/lib/_modules/usage/usage.data-service.js.map +1 -1
  54. package/lib/_services/base/data.service.d.ts.map +1 -1
  55. package/lib/_services/base/data.service.js +45 -23
  56. package/lib/_services/base/data.service.js.map +1 -1
  57. package/lib/_services/base/db.service.d.ts.map +1 -1
  58. package/lib/_services/base/db.service.js +82 -53
  59. package/lib/_services/base/db.service.js.map +1 -1
  60. package/lib/_services/base/singleton.service.d.ts.map +1 -1
  61. package/lib/_services/base/singleton.service.js.map +1 -1
  62. package/lib/_services/core/api.service.d.ts +21 -13
  63. package/lib/_services/core/api.service.d.ts.map +1 -1
  64. package/lib/_services/core/api.service.js +192 -143
  65. package/lib/_services/core/api.service.js.map +1 -1
  66. package/lib/_services/core/auth.service.d.ts.map +1 -1
  67. package/lib/_services/core/auth.service.js.map +1 -1
  68. package/lib/_services/core/email.service.d.ts +50 -36
  69. package/lib/_services/core/email.service.d.ts.map +1 -1
  70. package/lib/_services/core/email.service.js +329 -94
  71. package/lib/_services/core/email.service.js.map +1 -1
  72. package/lib/_services/core/global.service.d.ts.map +1 -1
  73. package/lib/_services/core/global.service.js +30 -19
  74. package/lib/_services/core/global.service.js.map +1 -1
  75. package/lib/_services/route/controller.service.d.ts.map +1 -1
  76. package/lib/_services/route/controller.service.js.map +1 -1
  77. package/lib/_services/route/routing-module.service.d.ts.map +1 -1
  78. package/lib/_services/route/routing-module.service.js +2 -2
  79. package/lib/_services/route/routing-module.service.js.map +1 -1
  80. package/lib/_services/server/app-extended.server.d.ts.map +1 -1
  81. package/lib/_services/server/app-extended.server.js +19 -14
  82. package/lib/_services/server/app-extended.server.js.map +1 -1
  83. package/lib/_services/server/app-extended.server.spec.js +1 -0
  84. package/lib/_services/server/app-extended.server.spec.js.map +1 -1
  85. package/lib/_services/server/app.server.d.ts +4 -3
  86. package/lib/_services/server/app.server.d.ts.map +1 -1
  87. package/lib/_services/server/app.server.js +106 -51
  88. package/lib/_services/server/app.server.js.map +1 -1
  89. package/lib/_services/server/app.server.spec.js +1 -0
  90. package/lib/_services/server/app.server.spec.js.map +1 -1
  91. package/lib/_services/shared.static-service.js.map +1 -1
  92. package/lib/_services/socket/socket-client.service.js.map +1 -1
  93. package/lib/_services/socket/socket-server.service.js.map +1 -1
  94. package/lib/tsconfig.tsbuildinfo +1 -1
  95. package/nodemon.json +3 -1
  96. package/package.json +9 -8
  97. package/src/_constants/mocks/app-extended-server.mock.ts +6 -2
  98. package/src/_constants/mocks/app-server.mock.ts +7 -1
  99. package/src/_constants/mocks/data-model.mock.ts +2 -2
  100. package/src/_constants/mocks/email-service-collection.mock.ts +2 -1
  101. package/src/_constants/mocks/email-service.mock.ts +2 -2
  102. package/src/_constants/mocks/endpoint.mock.ts +28 -26
  103. package/src/_constants/mocks/socket-server.mock.ts +12 -4
  104. package/src/_enums/index.ts +1 -1
  105. package/src/_models/control-models/api-call-params.control-model.ts +3 -2
  106. package/src/_models/control-models/app-system-controls.control-model copy.ts +1 -1
  107. package/src/_models/control-models/app-system-controls.control-model.ts +1 -1
  108. package/src/_models/control-models/endpoint-params.control-model.ts +39 -16
  109. package/src/_models/control-models/http-settings.control-model.ts +4 -2
  110. package/src/_modules/custom-data/custom-data.controller.ts +55 -51
  111. package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +7 -3
  112. package/src/_modules/test/get-test-routing-module.util.ts +7 -3
  113. package/src/_modules/test/test.controller.ts +98 -96
  114. package/src/_modules/usage/get-usage-routing-module.util.ts +8 -4
  115. package/src/_modules/usage/usage.controller.ts +108 -102
  116. package/src/_modules/usage/usage.data-service.ts +54 -28
  117. package/src/_services/base/data.service.ts +133 -34
  118. package/src/_services/base/db.service.ts +254 -171
  119. package/src/_services/base/singleton.service.ts +1 -1
  120. package/src/_services/core/api.service.ts +348 -218
  121. package/src/_services/core/auth.service.ts +2 -0
  122. package/src/_services/core/email.service.ts +537 -129
  123. package/src/_services/core/global.service.ts +56 -26
  124. package/src/_services/route/controller.service.ts +3 -1
  125. package/src/_services/route/routing-module.service.ts +33 -16
  126. package/src/_services/server/app-extended.server.spec.ts +22 -17
  127. package/src/_services/server/app-extended.server.ts +108 -45
  128. package/src/_services/server/app.server.spec.ts +17 -12
  129. package/src/_services/server/app.server.ts +264 -138
package/nodemon.json CHANGED
@@ -3,7 +3,9 @@
3
3
  "restartable": "rs",
4
4
  "ext": "ts,json,tgz",
5
5
  "watch": [
6
- "./src",
6
+ "./src/*"
7
+ ],
8
+ "DISABLED watch": [
7
9
  "../npm-tgz-collection/dynamo-fsm"
8
10
  ],
9
11
  "ignore": [
package/package.json CHANGED
@@ -1,21 +1,18 @@
1
1
  {
2
2
  "name": "@futdevpro/nts-dynamo",
3
- "version": "01.07.17",
3
+ "version": "01.07.21",
4
4
  "description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
5
5
  "scripts": {
6
6
  "prep": "npm i rimraf nodemon -g",
7
7
  "first-start": "npm run prep && nodemon",
8
8
  "start": "nodemon",
9
-
10
9
  "deploy": "npm run clean && npm run build-all",
11
10
  "build": "npm run build-base && jasmine && npm publish",
12
11
  "build-tgz": "npm run build-base && jasmine && npm pack && move ./*.tgz ../npm-tgz-collection/dynamo-nts",
13
12
  "build-all": "npm run build-tgz && npm run build",
14
-
15
13
  "build-base": "npm i && rimraf ./lib && npx tsc",
16
14
  "clean-build": "npm run clean && npm run build-base",
17
15
  "clean": "rimraf ./lib && rimraf package-lock.json && rimraf ./node_modules",
18
-
19
16
  "test": "npm run build-base && jasmine",
20
17
  "clean-test": "npm run clean-build && jasmine",
21
18
  "clean-start": "npm run clean && npm run start"
@@ -199,8 +196,7 @@
199
196
  },
200
197
  "homepage": "https:/futdevpro.hu/projects/dynamo",
201
198
  "peerDependencies": {
202
- "@futdevpro/fsm-dynamo": "^1.7.2",
203
-
199
+ "@futdevpro/fsm-dynamo": "^1.7.8",
204
200
  "@types/express": "^4.17.17",
205
201
  "@types/geoip-lite": "^1.4.1",
206
202
  "@types/node": "^20.5.7",
@@ -220,10 +216,15 @@
220
216
  "devDependencies": {
221
217
  "@types/jasmine": "^4.3.5",
222
218
  "@types/socket.io-client": "^3.0.0",
219
+ "@typescript-eslint/eslint-plugin": "^6.7.4",
220
+ "@typescript-eslint/parser": "^6.7.4",
221
+ "eslint": "^8.51.0",
222
+ "eslint-plugin-max-params-no-constructor": "^0.0.4",
223
+ "eslint-plugin-unused-imports": "^3.0.0",
223
224
  "jasmine": "^5.0.2",
224
225
  "jasmine-ts": "^0.4.0",
225
- "socket.io": "^4.5.2",
226
226
  "nodemon": "^3.0.1",
227
- "rimraf": "^5.0.1"
227
+ "rimraf": "^5.0.1",
228
+ "socket.io": "^4.5.2"
228
229
  }
229
230
  }
@@ -4,7 +4,9 @@ import { usageSessionModelParams } from '@futdevpro/fsm-dynamo/usage-module';
4
4
  import { customDataModelParams } from '@futdevpro/fsm-dynamo/custom-data-module';
5
5
 
6
6
  import { DynamoNTS_AppParams } from '../../_models/control-models/app-params.control-model';
7
- import { DynamoNTS_GlobalServiceSettings } from '../../_models/interfaces/global-service-settings.interface';
7
+ import {
8
+ DynamoNTS_GlobalServiceSettings
9
+ } from '../../_models/interfaces/global-service-settings.interface';
8
10
  import { DynamoNTS_HttpSettings } from '../../_models/control-models/http-settings.control-model';
9
11
  import { getTestRoutingModule } from '../../_modules/test';
10
12
  import { getUsageRoutingModule } from '../../_modules/usage';
@@ -13,7 +15,9 @@ import { DynamoNTS_RoutingModule } from '../../_services/route/routing-module.se
13
15
  import { DynamoNTS_App } from '../../_services/server/app.server';
14
16
  import { DynamoNTS_Controller_Mock } from './controller.mock';
15
17
  import { AuthService_Mock } from './auth-service.mock';
16
- import { DynamoNTS_AppExtended, dynamoNTS_globalSettings, DynamoNTS_SocketServerService } from '../../_modules/app-extended.index';
18
+ import {
19
+ DynamoNTS_AppExtended, dynamoNTS_globalSettings, DynamoNTS_SocketServerService
20
+ } from '../../_modules/app-extended.index';
17
21
  import { DynamoNTS_SocketServer_Mock } from './socket-server.mock';
18
22
  import { SocketClient_Mock } from './socket-client.mock';
19
23
  import { dependency_mock_DataParams, dependent_mock_DataParams } from './data-model.mock';
@@ -4,7 +4,9 @@ import { usageSessionModelParams } from '@futdevpro/fsm-dynamo/usage-module';
4
4
  import { customDataModelParams } from '@futdevpro/fsm-dynamo/custom-data-module';
5
5
 
6
6
  import { DynamoNTS_AppParams } from '../../_models/control-models/app-params.control-model';
7
- import { DynamoNTS_GlobalServiceSettings } from '../../_models/interfaces/global-service-settings.interface';
7
+ import {
8
+ DynamoNTS_GlobalServiceSettings
9
+ } from '../../_models/interfaces/global-service-settings.interface';
8
10
  import { DynamoNTS_HttpSettings } from '../../_models/control-models/http-settings.control-model';
9
11
  import { getTestRoutingModule } from '../../_modules/test';
10
12
  import { getUsageRoutingModule } from '../../_modules/usage';
@@ -122,15 +124,19 @@ export class DynamoNTS_AppTEST_Mock extends DynamoNTS_App {
122
124
  if (overrides.getAppParams) {
123
125
  DynamoNTS_App.prototype.getAppParams = overrides.getAppParams;
124
126
  }
127
+
125
128
  if (overrides.getGlobalServiceCollection) {
126
129
  DynamoNTS_App.prototype.getGlobalServiceCollection = overrides.getGlobalServiceCollection;
127
130
  }
131
+
128
132
  if (overrides.getPortSettings) {
129
133
  DynamoNTS_App.prototype.getPortSettings = overrides.getPortSettings;
130
134
  }
135
+
131
136
  if (overrides.getRoutingModules) {
132
137
  DynamoNTS_App.prototype.getRoutingModules = overrides.getRoutingModules;
133
138
  }
139
+
134
140
  if (overrides.getRootServices) {
135
141
  DynamoNTS_App.prototype.getRootServices = overrides.getRootServices;
136
142
  }
@@ -34,7 +34,7 @@ export const dependency_mock_DataParams = new Dynamo_DataParams({
34
34
  { key: 'objectArray', type: 'any[]', },
35
35
  { key: 'objectArrayArray', type: 'any[][]', },
36
36
  ]
37
- })
37
+ });
38
38
 
39
39
  ////////////////////////////////////////////////////////////////////
40
40
  ////////////////////////////////////////////////////////////////////
@@ -80,4 +80,4 @@ export const dependent_mock_DataParams = new Dynamo_DataParams({
80
80
  { key: 'objectArray', type: 'any[]', },
81
81
  { key: 'objectArrayArray', type: 'any[][]', },
82
82
  ]
83
- })
83
+ });
@@ -1,7 +1,8 @@
1
1
  import { DynamoNTS_EmailService, DynamoNTS_ServiceCollection } from '../../_services';
2
2
  import { EmailService_Mock } from './email-service.mock';
3
3
 
4
- export class EmailServiceCollection_Mock extends DynamoNTS_ServiceCollection<DynamoNTS_EmailService> {
4
+ export class EmailServiceCollection_Mock extends
5
+ DynamoNTS_ServiceCollection<DynamoNTS_EmailService> {
5
6
 
6
7
  static getInstance(): EmailServiceCollection_Mock {
7
8
  return EmailServiceCollection_Mock.getSingletonInstance();
@@ -10,9 +10,9 @@ export class EmailService_Mock extends DynamoNTS_EmailService {
10
10
  email: 'auto@futdevpro.hu',
11
11
  pass: 'a9wY992H4CpxYAG#',
12
12
  rootPath: __dirname,
13
- templatePaths: {
13
+ /* templatePaths: {
14
14
  // test: './email-template.mock.html',
15
- },
15
+ }, */
16
16
  });
17
17
  }
18
18
  }
@@ -9,23 +9,24 @@ export const DynamoNTS_endpointBase_mock: DynamoNTS_EndpointParams = new DynamoN
9
9
  endpoint: '/test-base',
10
10
  preProcessess: [],
11
11
  tasks: [
12
- async (req, res) => {
12
+ async (req, res): Promise<void> => {
13
13
  res.send('test-base');
14
14
  }
15
15
  ]
16
16
  });
17
17
 
18
- export const DynamoNTS_endpointSimple_mock: DynamoNTS_EndpointParams = new DynamoNTS_EndpointParams({
19
- name: 'testSimple',
20
- type: DynamoNTS_HttpCallType.get,
21
- endpoint: '/test-simple',
22
- preProcessess: [],
23
- tasks: [
24
- async (req, res) => {
25
- res.send('test-simple');
26
- }
27
- ]
28
- });
18
+ export const DynamoNTS_endpointSimple_mock: DynamoNTS_EndpointParams =
19
+ new DynamoNTS_EndpointParams({
20
+ name: 'testSimple',
21
+ type: DynamoNTS_HttpCallType.get,
22
+ endpoint: '/test-simple',
23
+ preProcessess: [],
24
+ tasks: [
25
+ async (req, res): Promise<void> => {
26
+ res.send('test-simple');
27
+ }
28
+ ]
29
+ });
29
30
 
30
31
  export const DynamoNTS_endpointPost_mock: DynamoNTS_EndpointParams = new DynamoNTS_EndpointParams({
31
32
  name: 'testPost',
@@ -33,7 +34,7 @@ export const DynamoNTS_endpointPost_mock: DynamoNTS_EndpointParams = new DynamoN
33
34
  endpoint: '/test-post',
34
35
  preProcessess: [],
35
36
  tasks: [
36
- async (req, res) => {
37
+ async (req, res): Promise<void> => {
37
38
  res.send('test-post');
38
39
  }
39
40
  ]
@@ -45,23 +46,24 @@ export const DynamoNTS_endpointPut_mock: DynamoNTS_EndpointParams = new DynamoNT
45
46
  endpoint: '/test-put',
46
47
  preProcessess: [],
47
48
  tasks: [
48
- async (req, res) => {
49
+ async (req, res): Promise<void> => {
49
50
  res.send('test-put');
50
51
  }
51
52
  ]
52
53
  });
53
54
 
54
- export const DynamoNTS_endpointDelete_mock: DynamoNTS_EndpointParams = new DynamoNTS_EndpointParams({
55
- name: 'testDelete',
56
- type: DynamoNTS_HttpCallType.delete,
57
- endpoint: '/test-delete',
58
- preProcessess: [],
59
- tasks: [
60
- async (req, res) => {
61
- res.send('test-delete');
62
- }
63
- ]
64
- });
55
+ export const DynamoNTS_endpointDelete_mock: DynamoNTS_EndpointParams =
56
+ new DynamoNTS_EndpointParams({
57
+ name: 'testDelete',
58
+ type: DynamoNTS_HttpCallType.delete,
59
+ endpoint: '/test-delete',
60
+ preProcessess: [],
61
+ tasks: [
62
+ async (req, res): Promise<void> => {
63
+ res.send('test-delete');
64
+ }
65
+ ]
66
+ });
65
67
 
66
68
  export const DynamoNTS_endpointThrow_mock: DynamoNTS_EndpointParams = new DynamoNTS_EndpointParams({
67
69
  name: 'testThrow',
@@ -69,7 +71,7 @@ export const DynamoNTS_endpointThrow_mock: DynamoNTS_EndpointParams = new Dynamo
69
71
  endpoint: '/test-throw',
70
72
  preProcessess: [],
71
73
  tasks: [
72
- async (req, res) => {
74
+ async (req, res): Promise<void> => {
73
75
  throw new Error('test-throw');
74
76
  }
75
77
  ]
@@ -1,12 +1,17 @@
1
1
  import { Socket } from 'socket.io';
2
2
  import { DynamoNTS_SocketEvent } from '../../_models/control-models/socket-event.control-model';
3
- import { DynamoNTS_SocketPresence } from '../../_models/control-models/socket-presence.control-model';
4
- import { DynamoNTS_SocketServerServiceParams } from '../../_models/control-models/socket-server-service-params.control-model';
3
+ import {
4
+ DynamoNTS_SocketPresence
5
+ } from '../../_models/control-models/socket-presence.control-model';
6
+ import {
7
+ DynamoNTS_SocketServerServiceParams
8
+ } from '../../_models/control-models/socket-server-service-params.control-model';
5
9
  import { DynamoNTS_SocketServerService } from '../../_services/socket/socket-server.service';
6
10
 
7
11
 
8
12
 
9
- export class DynamoNTS_SocketServer_Mock extends DynamoNTS_SocketServerService<DynamoNTS_SocketPresence> {
13
+ export class DynamoNTS_SocketServer_Mock extends
14
+ DynamoNTS_SocketServerService<DynamoNTS_SocketPresence> {
10
15
 
11
16
  static getInstance(): DynamoNTS_SocketServer_Mock {
12
17
  return DynamoNTS_SocketServer_Mock.getSingletonInstance();
@@ -23,7 +28,10 @@ export class DynamoNTS_SocketServer_Mock extends DynamoNTS_SocketServerService<D
23
28
  return [];
24
29
  }
25
30
 
26
- protected async getPresenceFromSubscrioptionEventContent(socketSubscription: any, socket: Socket): Promise<DynamoNTS_SocketPresence> {
31
+ protected async getPresenceFromSubscrioptionEventContent(
32
+ socketSubscription: any,
33
+ socket: Socket
34
+ ): Promise<DynamoNTS_SocketPresence> {
27
35
  return new DynamoNTS_SocketPresence({
28
36
  issuerId: socketSubscription.issuerId,
29
37
  sockets: [ socket ],
@@ -6,7 +6,7 @@ export * from './data-service-function.enum';
6
6
  export * from './route-security.enum';
7
7
  export * from './socket-security.enum';
8
8
  export * from './predefined-data-types.enum';
9
- // HTTP ENUMS
9
+ //// HTTP ENUMS
10
10
  export * from './http/http-call-type.enum';
11
11
  export * from './http/http-response-type.enum';
12
12
  export * from './http/socket-event-type.enum';
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
3
- import { DynamoNTS_HttpCallType } from "../../_enums/http/http-call-type.enum";
4
- import { DynamoNTS_HttpResponseType } from "../../_enums/http/http-response-type.enum";
3
+ import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
4
+ import { DynamoNTS_HttpResponseType } from '../../_enums/http/http-response-type.enum';
5
5
 
6
6
  /**
7
7
  * API call params,
@@ -76,6 +76,7 @@ export class DynamoNTS_ApiCallParams {
76
76
  ) {
77
77
  this.name = set.name;
78
78
  this.type = set.type;
79
+
79
80
  if (set.endPoint.includes('{')) {
80
81
  Dynamo_Log.warn(
81
82
  `using {param} bracets in endpoint definitions will be deprecated... (${set.endPoint})` +
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- import { DynamoNTS_SystemControl } from './system-control.control-model'
3
+ import { DynamoNTS_SystemControl } from './system-control.control-model';
4
4
 
5
5
  export class DynamoNTS_AppExtSysControls {
6
6
  appExtended: DynamoNTS_SystemControl = new DynamoNTS_SystemControl();
@@ -1,5 +1,5 @@
1
- import { DynamoNTS_SystemControl } from './system-control.control-model'
2
1
 
2
+ import { DynamoNTS_SystemControl } from './system-control.control-model';
3
3
 
4
4
  export class DynamoNTS_AppSystemControls {
5
5
  app: DynamoNTS_SystemControl = new DynamoNTS_SystemControl();
@@ -22,7 +22,7 @@ export class DynamoNTS_EndpointParams{
22
22
 
23
23
  private pathParams: string[];
24
24
 
25
- private preProcessess: ((req: Request, res: Response) => Promise<void>)[]
25
+ private preProcessess: ((req: Request, res: Response) => Promise<void>)[];
26
26
  private tasks: ((req: Request, res: Response, issuer?: string) => Promise<void>)[];
27
27
 
28
28
  private logRequest: boolean;
@@ -96,28 +96,35 @@ export class DynamoNTS_EndpointParams{
96
96
  errorCode: 'NTS-EP0-C00',
97
97
  addECToUserMsg: true,
98
98
  message: 'trying to create DynamoNTS_EndpointParams without endpoint value',
99
- userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
99
+ userMessage:
100
+ 'We encountered an unhandled Server Error, ' +
101
+ 'please contact the responsible development team.'
100
102
  });
101
103
  }
102
104
 
103
105
  let pathParts: string[] = this.endpoint.split('/');
104
- pathParts = pathParts.filter((part: string) => part[0] === ':');
105
- pathParts = pathParts.map((part: string) => part = part.replace(':', ''));
106
+
107
+ pathParts = pathParts.filter((part: string): boolean => part[0] === ':');
108
+ pathParts = pathParts.map((part: string): string => part.replace(':', ''));
106
109
  this.pathParams = pathParts;
107
110
 
108
111
  this.preProcessess = set.preProcessess ?? [];
109
- this.tasks = set.tasks;
112
+ this.tasks = set.tasks ?? [];
110
113
 
111
114
  this.logRequest = set.logRequest ?? dynamoNTS_globalSettings.logRequest;
112
115
  this.logRequestsParams = set.logRequestsParams ?? dynamoNTS_globalSettings.logRequestsParams;
113
- this.logRequestsContent = set.logRequestsContent ?? dynamoNTS_globalSettings.logRequestsContent;
114
- this.logResponseContent = set.logResponseContent ?? dynamoNTS_globalSettings.logResponseContent;
116
+ this.logRequestsContent =
117
+ set.logRequestsContent ?? dynamoNTS_globalSettings.logRequestsContent;
118
+ this.logResponseContent =
119
+ set.logResponseContent ?? dynamoNTS_globalSettings.logResponseContent;
115
120
  } catch (error) {
116
121
  Dynamo_Log.error(
117
- `\nEndpoint params setup failed: name: '${set.name}' (security: ${set.security}) endpoint: ${set.endpoint}` +
122
+ `\nEndpoint params setup failed: name: '${set.name}' ` +
123
+ `(security: ${set.security}) endpoint: ${set.endpoint}` +
118
124
  `\nERROR:` +
119
125
  `\n`, error
120
126
  );
127
+
121
128
  throw error;
122
129
  }
123
130
  }
@@ -133,6 +140,7 @@ export class DynamoNTS_EndpointParams{
133
140
 
134
141
  if (this.logRequestsParams) {
135
142
  const params = this.getPathParamsLogContent(req);
143
+
136
144
  msg += `\npathParams: ${params}`;
137
145
  }
138
146
 
@@ -155,7 +163,7 @@ export class DynamoNTS_EndpointParams{
155
163
  getFullExecution(): (req: Request, res: Response) => Promise<void> {
156
164
  let issuer: string;
157
165
 
158
- return async (req: Request, res: Response) => {
166
+ return async (req: Request, res: Response): Promise<void> => {
159
167
  try {
160
168
  issuer = DynamoNTS_GlobalService?.getAuthService()?.getIssuerFromRequest(req);
161
169
 
@@ -164,13 +172,15 @@ export class DynamoNTS_EndpointParams{
164
172
  }
165
173
 
166
174
  await Dynamo_Array.asyncForEach(this.preProcessess,
167
- async (preProcess: (req: Request, res: Response) => Promise<void>) => {
175
+ async (preProcess: (req: Request, res: Response) => Promise<void>): Promise<void> => {
168
176
  await preProcess(req, res);
169
177
  }
170
178
  );
171
179
 
172
180
  await Dynamo_Array.asyncForEach(this.tasks,
173
- async (task: (req: Request, res: Response, issuer?: string) => Promise<void>) => {
181
+ async (
182
+ task: (req: Request, res: Response, issuer?: string) => Promise<void>
183
+ ): Promise<void> => {
174
184
  await task(req, res, issuer);
175
185
  }
176
186
  );
@@ -194,9 +204,15 @@ export class DynamoNTS_EndpointParams{
194
204
  * @param res
195
205
  * @param error
196
206
  */
197
- private async error(req: Request, res: Response, error: Error | Dynamo_Error, issuer: string): Promise<void> {
207
+ private async error(
208
+ req: Request,
209
+ res: Response,
210
+ error: Error | Dynamo_Error,
211
+ issuer: string
212
+ ): Promise<void> {
198
213
  try {
199
214
  let msg: string = `Endpoint catched an error. ${this.name} (${this.endpoint})`;
215
+
200
216
  msg += this.getPathParamsLogContent(req);
201
217
 
202
218
  Dynamo_Log.error(msg);
@@ -215,7 +231,12 @@ export class DynamoNTS_EndpointParams{
215
231
  (error as Dynamo_Error).additionalContent.endpointInfo = msg;
216
232
  }
217
233
 
218
- await DynamoNTS_GlobalService.globalErrorHandler?.(error, req, res, issuer).catch(err => {
234
+ await DynamoNTS_GlobalService.globalErrorHandler?.(
235
+ error,
236
+ req,
237
+ res,
238
+ issuer
239
+ ).catch((err): void => {
219
240
  Dynamo_Log.warn('DynamoNTS_GlobalService.globalErrorHandler failed to handle error: ', err);
220
241
  Dynamo_Log.warn('It will proceed as normal.');
221
242
  });
@@ -239,8 +260,10 @@ export class DynamoNTS_EndpointParams{
239
260
  }
240
261
  } catch (error) {
241
262
  Dynamo_Log.H_error(
242
- `\n\nDYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams: error: (${this.name}, ${this.endpoint})` +
243
- `\n(DYNAMO MULTILEVEL ERROR means, that the ERRORHANDLING is ALSO FAILED, and the error message was not sent.)` +
263
+ `\n\nDYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams: error: ` +
264
+ `(${this.name}, ${this.endpoint})` +
265
+ `\n(DYNAMO MULTILEVEL ERROR means, that the ERRORHANDLING is ALSO FAILED, ` +
266
+ `and the error message was not sent.)` +
244
267
  `\nERROR:`, error,
245
268
  '\n'
246
269
  );
@@ -250,7 +273,7 @@ export class DynamoNTS_EndpointParams{
250
273
  private getPathParamsLogContent(req: Request): string {
251
274
  let params: string = '';
252
275
 
253
- this.pathParams.forEach((param: string) => {
276
+ this.pathParams.forEach((param: string): void => {
254
277
  params += `\n${param}: ${req.params[param]}`;
255
278
  });
256
279
 
@@ -20,8 +20,10 @@ export class DynamoNTS_HttpSettings {
20
20
  };
21
21
 
22
22
  constructor(
23
- set: DynamoNTS_HttpSettings
23
+ set?: DynamoNTS_HttpSettings
24
24
  ) {
25
- Object.assign(this, set);
25
+ if (set) {
26
+ Object.assign(this, set);
27
+ }
26
28
  }
27
29
  }
@@ -1,63 +1,67 @@
1
1
 
2
2
  import { Request, Response } from 'express';
3
-
3
+
4
4
  import { customDataModuleSettings } from '@futdevpro/fsm-dynamo';
5
5
 
6
6
  import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
7
7
  import { DynamoNTS_Controller } from '../../_services/route/controller.service';
8
8
  import { Dynamo_CustomDataService } from './custom-data.data-service';
9
- import { DynamoNTS_EndpointParams } from '../../_models/control-models/endpoint-params.control-model';
9
+ import {
10
+ DynamoNTS_EndpointParams
11
+ } from '../../_models/control-models/endpoint-params.control-model';
10
12
 
11
13
  export class CustomDataController extends DynamoNTS_Controller {
12
14
 
13
- static getInstance(): CustomDataController {
14
- return CustomDataController.getSingletonInstance();
15
- }
16
-
17
- setupEndpoints(): void {
18
- this.endpoints = [
19
- // CUSTOM DATA
20
- new DynamoNTS_EndpointParams({
21
- name: 'getCustomData',
22
- type: DynamoNTS_HttpCallType.get,
23
- endpoint: customDataModuleSettings.endPoints.getCustomData,
24
- tasks: [
25
- async (req: Request, res: Response) => {
26
- const customDataService = new Dynamo_CustomDataService({ _id: req.params.customId });
27
-
28
- await customDataService.getDataById();
29
-
30
- res.send({
31
- url: req.url,
32
- result: 'get custom call was successful!',
33
- response: customDataService.data,
34
- request: `.../custom/get/${req.params.customId}`
35
- });
36
- }
37
- ]
38
- }),
39
-
40
- new DynamoNTS_EndpointParams({
41
- name: 'modifyCustomData',
42
- type: DynamoNTS_HttpCallType.post,
43
- endpoint: customDataModuleSettings.endPoints.modifyCustomData,
44
- tasks: [
45
- async (req: Request, res: Response, issuer: string) => {
46
- const customDataService = new Dynamo_CustomDataService(req.body, issuer);
47
-
48
- await customDataService.saveData();
49
-
50
- res.send({
51
- url: req.url,
52
- result: 'post custom call was successful!',
53
- response: customDataService.data,
54
- warning: 'keep in mind that this is a playground DB, and it will be cleared out from time to time',
55
- request: req.body
56
- });
57
- }
58
- ]
59
- }),
60
- ];
61
- }
15
+ static getInstance(): CustomDataController {
16
+ return CustomDataController.getSingletonInstance();
17
+ }
18
+
19
+ setupEndpoints(): void {
20
+ this.endpoints = [
21
+ // CUSTOM DATA
22
+ new DynamoNTS_EndpointParams({
23
+ name: 'getCustomData',
24
+ type: DynamoNTS_HttpCallType.get,
25
+ endpoint: customDataModuleSettings.endPoints.getCustomData,
26
+ tasks: [
27
+ async (req: Request, res: Response): Promise<void> => {
28
+ const customDataService = new Dynamo_CustomDataService({ _id: req.params.customId });
29
+
30
+ await customDataService.getDataById();
31
+
32
+ res.send({
33
+ url: req.url,
34
+ result: 'get custom call was successful!',
35
+ response: customDataService.data,
36
+ request: `.../custom/get/${req.params.customId}`
37
+ });
38
+ }
39
+ ]
40
+ }),
41
+
42
+ new DynamoNTS_EndpointParams({
43
+ name: 'modifyCustomData',
44
+ type: DynamoNTS_HttpCallType.post,
45
+ endpoint: customDataModuleSettings.endPoints.modifyCustomData,
46
+ tasks: [
47
+ async (req: Request, res: Response, issuer: string): Promise<void> => {
48
+ const customDataService = new Dynamo_CustomDataService(req.body, issuer);
49
+
50
+ await customDataService.saveData();
51
+
52
+ res.send({
53
+ url: req.url,
54
+ result: 'post custom call was successful!',
55
+ response: customDataService.data,
56
+ warning:
57
+ 'keep in mind that this is a playground DB, ' +
58
+ 'and it will be cleared out from time to time',
59
+ request: req.body
60
+ });
61
+ }
62
+ ]
63
+ }),
64
+ ];
65
+ }
62
66
  }
63
67
 
@@ -1,15 +1,19 @@
1
1
 
2
2
  import { customDataModuleSettings } from '@futdevpro/fsm-dynamo';
3
3
  import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
4
- import { DynamoNTS_RoutingModuleSettings } from '../../_models/interfaces/routing-module-settings.interface';
4
+ import {
5
+ DynamoNTS_RoutingModuleSettings
6
+ } from '../../_models/interfaces/routing-module-settings.interface';
5
7
  import { DynamoNTS_RoutingModule } from '../../_services/route/routing-module.service';
6
8
  import { CustomDataController } from './custom-data.controller';
7
9
 
8
- export function getCustomDataRoutingModule(securityOverride?: DynamoNTS_RouteSecurity): DynamoNTS_RoutingModule {
10
+ export function getCustomDataRoutingModule(
11
+ securityOverride?: DynamoNTS_RouteSecurity
12
+ ): DynamoNTS_RoutingModule {
9
13
  const set: DynamoNTS_RoutingModuleSettings = {
10
14
  route: customDataModuleSettings.mainRoute,
11
15
  controllers: [ CustomDataController.getInstance() ]
12
- }
16
+ };
13
17
 
14
18
  if (securityOverride) {
15
19
  set.securityOverride = securityOverride;
@@ -1,15 +1,19 @@
1
1
 
2
2
  import { testModuleSettings } from '@futdevpro/fsm-dynamo/test-module';
3
3
  import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
4
- import { DynamoNTS_RoutingModuleSettings } from '../../_models/interfaces/routing-module-settings.interface';
4
+ import {
5
+ DynamoNTS_RoutingModuleSettings
6
+ } from '../../_models/interfaces/routing-module-settings.interface';
5
7
  import { DynamoNTS_RoutingModule } from '../../_services/route/routing-module.service';
6
8
  import { TestController } from './test.controller';
7
9
 
8
- export function getTestRoutingModule(securityOverride?: DynamoNTS_RouteSecurity): DynamoNTS_RoutingModule {
10
+ export function getTestRoutingModule(
11
+ securityOverride?: DynamoNTS_RouteSecurity
12
+ ): DynamoNTS_RoutingModule {
9
13
  const set: DynamoNTS_RoutingModuleSettings = {
10
14
  route: testModuleSettings.mainRoute,
11
15
  controllers: [ TestController.getInstance() ]
12
- }
16
+ };
13
17
 
14
18
  if (securityOverride) {
15
19
  set.securityOverride = securityOverride;