@futdevpro/nts-dynamo 1.5.77 → 1.5.83

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 (227) hide show
  1. package/LICENSE +2 -2
  2. package/lib/_constants/dynamo-nts-global-settings.d.ts +2 -2
  3. package/lib/_constants/dynamo-nts-global-settings.js +17 -17
  4. package/lib/_constants/index.d.ts +1 -1
  5. package/lib/_constants/index.js +4 -4
  6. package/lib/_enums/data-model-type.enum.d.ts +12 -12
  7. package/lib/_enums/data-model-type.enum.js +16 -16
  8. package/lib/_enums/data-model-type.enum.js.map +1 -1
  9. package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +12 -12
  10. package/lib/_enums/dynamo-nts-data-service-function.enum.js +18 -18
  11. package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -1
  12. package/lib/_enums/dynamo-nts-route-security.enum.d.ts +11 -11
  13. package/lib/_enums/dynamo-nts-route-security.enum.js +15 -15
  14. package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -1
  15. package/lib/_enums/dynamo-nts-socket-security.enum.d.ts +10 -10
  16. package/lib/_enums/dynamo-nts-socket-security.enum.js +14 -14
  17. package/lib/_enums/dynamo-nts-socket-security.enum.js.map +1 -1
  18. package/lib/_enums/http/http-call-type.enum.d.ts +11 -11
  19. package/lib/_enums/http/http-call-type.enum.js +15 -15
  20. package/lib/_enums/http/http-call-type.enum.js.map +1 -1
  21. package/lib/_enums/http/http-response-type.enum.d.ts +6 -6
  22. package/lib/_enums/http/http-response-type.enum.js +10 -10
  23. package/lib/_enums/http/http-response-type.enum.js.map +1 -1
  24. package/lib/_enums/http/socket-event.enum.d.ts +9 -8
  25. package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
  26. package/lib/_enums/http/socket-event.enum.js +13 -12
  27. package/lib/_enums/http/socket-event.enum.js.map +1 -1
  28. package/lib/_enums/index.d.ts +8 -8
  29. package/lib/_enums/index.js +13 -13
  30. package/lib/_enums/predefined-data-types.enum.d.ts +10 -10
  31. package/lib/_enums/predefined-data-types.enum.js +14 -14
  32. package/lib/_enums/predefined-data-types.enum.js.map +1 -1
  33. package/lib/_interfaces/certification-settings.interface.d.ts +7 -0
  34. package/lib/_interfaces/certification-settings.interface.d.ts.map +1 -0
  35. package/lib/_interfaces/certification-settings.interface.js +3 -0
  36. package/lib/_interfaces/certification-settings.interface.js.map +1 -0
  37. package/lib/_interfaces/global-service-settings.interface.d.ts +18 -0
  38. package/lib/_interfaces/global-service-settings.interface.d.ts.map +1 -0
  39. package/lib/_interfaces/global-service-settings.interface.js +3 -0
  40. package/lib/_interfaces/global-service-settings.interface.js.map +1 -0
  41. package/lib/_interfaces/index.d.ts +1 -0
  42. package/lib/_interfaces/index.d.ts.map +1 -0
  43. package/lib/_interfaces/index.js +4 -0
  44. package/lib/_interfaces/index.js.map +1 -0
  45. package/lib/_interfaces/port-settings.interface.d.ts +5 -0
  46. package/lib/_interfaces/port-settings.interface.d.ts.map +1 -0
  47. package/lib/_interfaces/port-settings.interface.js +3 -0
  48. package/lib/_interfaces/port-settings.interface.js.map +1 -0
  49. package/lib/_models/dynamo-nts-api-call-params.d.ts +95 -95
  50. package/lib/_models/dynamo-nts-api-call-params.js +47 -47
  51. package/lib/_models/dynamo-nts-app-params.d.ts +49 -49
  52. package/lib/_models/dynamo-nts-app-params.js +17 -17
  53. package/lib/_models/dynamo-nts-endpoint-params.d.ts +80 -80
  54. package/lib/_models/dynamo-nts-endpoint-params.js +139 -139
  55. package/lib/_models/dynamo-nts-global-settings.d.ts +53 -53
  56. package/lib/_models/dynamo-nts-global-settings.js +2 -2
  57. package/lib/_models/dynamo-nts-routing-module-settings.d.ts +19 -19
  58. package/lib/_models/dynamo-nts-routing-module-settings.js +2 -2
  59. package/lib/_models/dynamo-nts-socket-event-params.d.ts +32 -30
  60. package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
  61. package/lib/_models/dynamo-nts-socket-event-params.js +80 -79
  62. package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
  63. package/lib/_models/dynamo-nts-socket-presence.d.ts +21 -0
  64. package/lib/_models/dynamo-nts-socket-presence.d.ts.map +1 -0
  65. package/lib/_models/dynamo-nts-socket-presence.js +45 -0
  66. package/lib/_models/dynamo-nts-socket-presence.js.map +1 -0
  67. package/lib/_models/dynamo-nts-socket-service-params.d.ts +18 -18
  68. package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -1
  69. package/lib/_models/dynamo-nts-socket-service-params.js +26 -26
  70. package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
  71. package/lib/_models/index.d.ts +7 -8
  72. package/lib/_models/index.d.ts.map +1 -1
  73. package/lib/_models/index.js +12 -12
  74. package/lib/_models/index.js.map +1 -1
  75. package/lib/_modules/api-service.index.d.ts +5 -5
  76. package/lib/_modules/api-service.index.js +11 -11
  77. package/lib/_modules/app-extended.index.d.ts +15 -12
  78. package/lib/_modules/app-extended.index.d.ts.map +1 -1
  79. package/lib/_modules/app-extended.index.js +23 -19
  80. package/lib/_modules/app-extended.index.js.map +1 -1
  81. package/lib/_modules/app.index.d.ts +13 -10
  82. package/lib/_modules/app.index.d.ts.map +1 -1
  83. package/lib/_modules/app.index.js +21 -17
  84. package/lib/_modules/app.index.js.map +1 -1
  85. package/lib/_modules/auth.index.d.ts +3 -3
  86. package/lib/_modules/auth.index.js +8 -8
  87. package/lib/_modules/constants.index.d.ts +1 -1
  88. package/lib/_modules/constants.index.js +4 -4
  89. package/lib/_modules/controller.index.d.ts +4 -4
  90. package/lib/_modules/controller.index.js +10 -10
  91. package/lib/_modules/custom-data/custom-data.controller.d.ts +5 -5
  92. package/lib/_modules/custom-data/custom-data.controller.js +55 -55
  93. package/lib/_modules/custom-data/custom-data.service.d.ts +5 -5
  94. package/lib/_modules/custom-data/custom-data.service.js +11 -11
  95. package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts +3 -3
  96. package/lib/_modules/custom-data/get-custom-data-routing-module.js +17 -17
  97. package/lib/_modules/custom-data/index.d.ts +4 -4
  98. package/lib/_modules/custom-data/index.js +8 -8
  99. package/lib/_modules/custom-data-module.index.d.ts +1 -1
  100. package/lib/_modules/custom-data-module.index.js +4 -4
  101. package/lib/_modules/data-service.index.d.ts +5 -5
  102. package/lib/_modules/data-service.index.js +10 -10
  103. package/lib/_modules/email.index.d.ts +3 -3
  104. package/lib/_modules/email.index.js +8 -8
  105. package/lib/_modules/enums.index.d.ts +1 -1
  106. package/lib/_modules/enums.index.js +4 -4
  107. package/lib/_modules/models.index.d.ts +1 -1
  108. package/lib/_modules/models.index.js +4 -4
  109. package/lib/_modules/services.index.d.ts +1 -1
  110. package/lib/_modules/services.index.js +4 -4
  111. package/lib/_modules/test/get-test-routing-module.d.ts +3 -3
  112. package/lib/_modules/test/get-test-routing-module.js +17 -17
  113. package/lib/_modules/test/index.d.ts +3 -3
  114. package/lib/_modules/test/index.js +7 -7
  115. package/lib/_modules/test/test.controller.d.ts +5 -5
  116. package/lib/_modules/test/test.controller.js +104 -104
  117. package/lib/_modules/test-module.index.d.ts +1 -1
  118. package/lib/_modules/test-module.index.js +4 -4
  119. package/lib/_modules/usage/get-usage-routing-module.d.ts +3 -3
  120. package/lib/_modules/usage/get-usage-routing-module.js +17 -17
  121. package/lib/_modules/usage/index.d.ts +4 -4
  122. package/lib/_modules/usage/index.js +8 -8
  123. package/lib/_modules/usage/usage-controller.d.ts +6 -6
  124. package/lib/_modules/usage/usage-controller.js +88 -88
  125. package/lib/_modules/usage/usage.service.d.ts +16 -16
  126. package/lib/_modules/usage/usage.service.js +132 -132
  127. package/lib/_modules/usage-module.index.d.ts +1 -1
  128. package/lib/_modules/usage-module.index.js +4 -4
  129. package/lib/_services/dynamo-nts-api.service.d.ts +34 -34
  130. package/lib/_services/dynamo-nts-api.service.js +188 -188
  131. package/lib/_services/dynamo-nts-app-extended.d.ts +128 -128
  132. package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
  133. package/lib/_services/dynamo-nts-app-extended.js +212 -212
  134. package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
  135. package/lib/_services/dynamo-nts-app.d.ts +270 -278
  136. package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
  137. package/lib/_services/dynamo-nts-app.js +371 -371
  138. package/lib/_services/dynamo-nts-app.js.map +1 -1
  139. package/lib/_services/dynamo-nts-app.spec.d.ts +1 -0
  140. package/lib/_services/dynamo-nts-app.spec.d.ts.map +1 -0
  141. package/lib/_services/dynamo-nts-app.spec.js +10 -0
  142. package/lib/_services/dynamo-nts-app.spec.js.map +1 -0
  143. package/lib/_services/dynamo-nts-auth.service.d.ts +127 -127
  144. package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
  145. package/lib/_services/dynamo-nts-auth.service.js +53 -53
  146. package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
  147. package/lib/_services/dynamo-nts-controller.service.d.ts +105 -105
  148. package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
  149. package/lib/_services/dynamo-nts-controller.service.js +57 -57
  150. package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
  151. package/lib/_services/dynamo-nts-data.service.d.ts +230 -230
  152. package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
  153. package/lib/_services/dynamo-nts-data.service.js +689 -689
  154. package/lib/_services/dynamo-nts-data.service.js.map +1 -1
  155. package/lib/_services/dynamo-nts-db-service-collection.service.d.ts +8 -8
  156. package/lib/_services/dynamo-nts-db-service-collection.service.js +10 -10
  157. package/lib/_services/dynamo-nts-db.service.d.ts +386 -312
  158. package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
  159. package/lib/_services/dynamo-nts-db.service.js +856 -856
  160. package/lib/_services/dynamo-nts-db.service.js.map +1 -1
  161. package/lib/_services/dynamo-nts-email-service-collection.service.d.ts +18 -18
  162. package/lib/_services/dynamo-nts-email-service-collection.service.js +20 -20
  163. package/lib/_services/dynamo-nts-email.service.d.ts +56 -56
  164. package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
  165. package/lib/_services/dynamo-nts-email.service.js +203 -203
  166. package/lib/_services/dynamo-nts-email.service.js.map +1 -1
  167. package/lib/_services/dynamo-nts-global.service.d.ts +71 -84
  168. package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
  169. package/lib/_services/dynamo-nts-global.service.js +156 -156
  170. package/lib/_services/dynamo-nts-global.service.js.map +1 -1
  171. package/lib/_services/dynamo-nts-routing-module.service.d.ts +76 -76
  172. package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
  173. package/lib/_services/dynamo-nts-routing-module.service.js +191 -191
  174. package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
  175. package/lib/_services/dynamo-nts-shared.service.d.ts +31 -31
  176. package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
  177. package/lib/_services/dynamo-nts-shared.service.js +70 -70
  178. package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
  179. package/lib/_services/dynamo-nts-shared.service.spec.d.ts +2 -0
  180. package/lib/_services/dynamo-nts-shared.service.spec.d.ts.map +1 -0
  181. package/lib/_services/dynamo-nts-shared.service.spec.js +12 -0
  182. package/lib/_services/dynamo-nts-shared.service.spec.js.map +1 -0
  183. package/lib/_services/dynamo-nts-singleton.service.d.ts +8 -8
  184. package/lib/_services/dynamo-nts-singleton.service.js +18 -18
  185. package/lib/_services/dynamo-nts-singleton.service.js.map +1 -1
  186. package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +9 -9
  187. package/lib/_services/dynamo-nts-socket-service-collection.service.js +13 -13
  188. package/lib/_services/dynamo-nts-socket.service.d.ts +57 -45
  189. package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
  190. package/lib/_services/dynamo-nts-socket.service.js +188 -165
  191. package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
  192. package/lib/_services/index.d.ts +14 -16
  193. package/lib/_services/index.d.ts.map +1 -1
  194. package/lib/_services/index.js +20 -20
  195. package/lib/_services/index.js.map +1 -1
  196. package/lib/index.d.ts +6 -6
  197. package/lib/index.js +14 -14
  198. package/lib/tsconfig.tsbuildinfo +1 -1
  199. package/package SAVE.json +216 -0
  200. package/package-NEW with test but not working.json +228 -0
  201. package/package.json +14 -8
  202. package/spec/support/jasmine.json +14 -0
  203. package/src/_enums/http/socket-event.enum.ts +2 -1
  204. package/src/_interfaces/certification-settings.interface.ts +7 -0
  205. package/src/_interfaces/global-service-settings.interface.ts +23 -0
  206. package/src/_interfaces/index.ts +5 -0
  207. package/src/_interfaces/port-settings.interface.ts +5 -0
  208. package/src/_models/dynamo-nts-socket-event-params.ts +23 -21
  209. package/src/_models/{dynamo-nts-socket-dictionary.ts → dynamo-nts-socket-presence.ts} +21 -5
  210. package/src/_models/dynamo-nts-socket-service-params.ts +1 -0
  211. package/src/_models/index.ts +2 -2
  212. package/src/_modules/app-extended.index.ts +7 -2
  213. package/src/_modules/app.index.ts +5 -0
  214. package/src/_services/dynamo-nts-app-extended.ts +6 -2
  215. package/src/_services/dynamo-nts-app.spec.ts +14 -0
  216. package/src/_services/dynamo-nts-app.ts +8 -14
  217. package/src/_services/dynamo-nts-auth.service.ts +1 -0
  218. package/src/_services/dynamo-nts-controller.service.ts +2 -1
  219. package/src/_services/dynamo-nts-data.service.ts +19 -19
  220. package/src/_services/dynamo-nts-db.service.ts +195 -115
  221. package/src/_services/dynamo-nts-email.service.ts +1 -0
  222. package/src/_services/dynamo-nts-global.service.ts +3 -18
  223. package/src/_services/dynamo-nts-routing-module.service.ts +1 -0
  224. package/src/_services/dynamo-nts-shared.service.spec.ts +10 -0
  225. package/src/_services/dynamo-nts-shared.service.ts +2 -1
  226. package/src/_services/dynamo-nts-socket.service.ts +80 -41
  227. package/src/_services/index.ts +2 -2
@@ -5,26 +5,41 @@ import * as SocketIO from 'socket.io';
5
5
  /**
6
6
  * socket handling and clarification is under development
7
7
  */
8
- export class DynamoNTS_SocketDictionary {
8
+ export class DynamoNTS_SocketPresence {
9
9
  issuerId: string;
10
10
  sockets: SocketIO.Socket[];
11
+ onDestroy: (issuerId: string) => void;
11
12
 
12
13
  constructor(
13
- set?: {
14
+ set: {
14
15
  issuerId: string,
15
16
  sockets: SocketIO.Socket[],
17
+ onDestroy?: (issuerId: string) => void,
16
18
  }
17
19
  ) {
18
- this.issuerId = set.issuerId;
19
- if (!set.sockets.length) {
20
+ if (!set?.issuerId) {
20
21
  throw new Dynamo_Error({
21
22
  status: 406,
22
23
  errorCode: 'NTS-SD0-C00',
23
24
  addECToUserMsg: true,
24
- message: 'trying to create DynamoNTS_SocketDictionary without a single active socket',
25
+ message: 'trying to create DynamoNTS_SocketPresence without a valid issuerId!',
26
+ userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
27
+ });
28
+ }
29
+
30
+ this.issuerId = set.issuerId;
31
+ this.onDestroy = set.onDestroy ?? (id => {});
32
+
33
+ if (!set?.sockets?.length) {
34
+ throw new Dynamo_Error({
35
+ status: 406,
36
+ errorCode: 'NTS-SD0-C01',
37
+ addECToUserMsg: true,
38
+ message: 'trying to create DynamoNTS_SocketPresence without a single active socket!',
25
39
  userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
26
40
  });
27
41
  }
42
+
28
43
  this.sockets = set.sockets;
29
44
  }
30
45
 
@@ -38,5 +53,6 @@ export class DynamoNTS_SocketDictionary {
38
53
  socket.emit(event, content);
39
54
  });
40
55
  }
56
+
41
57
  }
42
58
 
@@ -30,6 +30,7 @@ export class DynamoNTS_SocketServiceParams {
30
30
 
31
31
  if (set.getIdFromSubscrioption) {
32
32
  this.getIdFromSubscrioption = set.getIdFromSubscrioption;
33
+
33
34
  if (set.groupActiveSocketsBy) {
34
35
  Dynamo_Log.error(
35
36
  `setting groupActiveSocketsBy on DynamoNTS_SocketService (${this.name}) won't take effect, ` +
@@ -2,11 +2,11 @@
2
2
 
3
3
  // MODELS
4
4
  export * from './dynamo-nts-api-call-params';
5
- export * from './dynamo-nts-app-params';
5
+ //export * from './dynamo-nts-app-params';
6
6
  export * from './dynamo-nts-endpoint-params';
7
7
  export * from './dynamo-nts-global-settings';
8
8
  export * from './dynamo-nts-routing-module-settings';
9
9
  export * from './dynamo-nts-socket-event-params';
10
10
  export * from './dynamo-nts-socket-service-params';
11
- export * from './dynamo-nts-socket-dictionary';
11
+ export * from './dynamo-nts-socket-presence';
12
12
 
@@ -1,17 +1,22 @@
1
1
 
2
2
  // SERVICES
3
- export * from '../_services/dynamo-nts-app';
4
3
  export * from '../_services/dynamo-nts-app-extended';
5
4
  export * from '../_services/dynamo-nts-global.service';
6
5
  export * from '../_services/dynamo-nts-routing-module.service';
7
6
  export * from '../_services/dynamo-nts-shared.service';
7
+ export * from '../_services/dynamo-nts-socket.service';
8
+
9
+ // INTERFACES
10
+ export * from '../_interfaces/global-service-settings.interface';
11
+ export * from '../_interfaces/port-settings.interface';
12
+ export * from '../_interfaces/certification-settings.interface';
8
13
 
9
14
  // MODELS
10
15
  export * from '../_models/dynamo-nts-app-params';
11
16
  export * from '../_models/dynamo-nts-endpoint-params';
12
17
  export * from '../_models/dynamo-nts-global-settings';
13
18
  export * from '../_models/dynamo-nts-routing-module-settings';
14
- export * from '../_models/dynamo-nts-socket-dictionary';
19
+ export * from '../_models/dynamo-nts-socket-presence';
15
20
 
16
21
  // ENUMS
17
22
  export * from '../_enums/dynamo-nts-route-security.enum';
@@ -5,6 +5,11 @@ export * from '../_services/dynamo-nts-global.service';
5
5
  export * from '../_services/dynamo-nts-routing-module.service';
6
6
  export * from '../_services/dynamo-nts-shared.service';
7
7
 
8
+ // INTERFACES
9
+ export * from '../_interfaces/global-service-settings.interface';
10
+ export * from '../_interfaces/port-settings.interface';
11
+ export * from '../_interfaces/certification-settings.interface';
12
+
8
13
  // MODELS
9
14
  export * from '../_models/dynamo-nts-app-params';
10
15
  export * from '../_models/dynamo-nts-endpoint-params';
@@ -2,11 +2,12 @@
2
2
  import * as SocketIO from 'socket.io';
3
3
  import * as Http from 'http';
4
4
 
5
- import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
5
+ import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
6
+
6
7
  import { DynamoNTS_App } from './dynamo-nts-app';
8
+ import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
7
9
  import { DynamoNTS_SocketService } from './dynamo-nts-socket.service';
8
10
  import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
9
- import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
10
11
 
11
12
  /**
12
13
  * This will be the MAIN service of our server project,
@@ -170,6 +171,7 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
170
171
  }
171
172
  httpSocketServer = Http.createServer(this.openExpress);
172
173
  }
174
+
173
175
  if (this.socketSecurity !== DynamoNTS_RouteSecurity.open) {
174
176
  if (!this.httpsServer) {
175
177
  if (this.cert) {
@@ -219,9 +221,11 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
219
221
  if (service.security === DynamoNTS_SocketSecurity.open) {
220
222
  if (this.debugLog) console.log(`\nsocket setup (open): ${service.name}:${service.port}`);
221
223
  service.setupSocketServer(new SocketIO.Server(httpSocketServer));
224
+
222
225
  } else if (service.security === DynamoNTS_SocketSecurity.secure) {
223
226
  if (this.debugLog) console.log(`\nsocket setup (secure): ${service.name}:${service.port}`);
224
227
  service.setupSocketServer(new SocketIO.Server(this.httpsServer));
228
+
225
229
  } else {
226
230
  let error = new Error(`INVALID Socket Service security: ${service.security} on ${service.name}`);
227
231
  let errorStack: string[] = error.stack.split('\n');
@@ -0,0 +1,14 @@
1
+
2
+
3
+ describe('DynamoNTS_App', () => {
4
+ it('should create an instance', () => {
5
+ expect(true).toBeTruthy();
6
+ });
7
+
8
+ /* it('should ') */
9
+
10
+ xit('should create an instance NOT', () => {
11
+ expect(false).toBeTruthy();
12
+ });
13
+ });
14
+
@@ -1,28 +1,22 @@
1
1
 
2
- import { DynamoNTS_AppParams } from '../_models/dynamo-nts-app-params';
3
2
  import Mongoose = require("mongoose");
4
3
  import Express = require("express");
5
4
  import * as Https from 'https';
6
5
  import * as FileSystem from 'fs';
7
6
  import * as BodyParser from 'body-parser';
8
7
 
8
+ import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
9
+
10
+ import { DynamoNTS_AppParams } from '../_models/dynamo-nts-app-params';
9
11
  import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
10
12
  import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
11
13
  import { DynamoNTS_RoutingModule } from './dynamo-nts-routing-module.service';
12
14
  import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
13
- import { dynamoNTS_GlobalSettings } from '../_constants';
14
- import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
15
- import { DynamoNTS_GlobalService, DynamoNTS_GlobalServiceSettings } from './dynamo-nts-global.service';
16
-
17
- export interface DynamoNTS_CertificationSettings {
18
- keyPath: FileSystem.PathLike,
19
- certPath: FileSystem.PathLike,
20
- }
21
-
22
- export interface DynamoNTS_PortSettings {
23
- httpPort?: number,
24
- httpsPort?: number,
25
- }
15
+ import { DynamoNTS_GlobalService } from './dynamo-nts-global.service';
16
+ import { DynamoNTS_PortSettings } from '../_interfaces/port-settings.interface';
17
+ import { DynamoNTS_CertificationSettings } from '../_interfaces/certification-settings.interface';
18
+ import { DynamoNTS_GlobalServiceSettings } from '../_interfaces/global-service-settings.interface';
19
+ import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global-settings';
26
20
 
27
21
  /**
28
22
  * This will be the MAIN service of our server project,
@@ -1,5 +1,6 @@
1
1
 
2
2
  import { NextFunction, Request, Response } from 'express';
3
+
3
4
  import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
4
5
 
5
6
  import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
@@ -1,8 +1,9 @@
1
1
 
2
2
 
3
3
  import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
4
- import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
4
+
5
5
  import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
6
+ import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
6
7
 
7
8
  /**
8
9
  * Basic controller for endpoint handlings
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { Dynamo_Metadata, Dynamo_DataParams, Dynamo_DataPropertyParams, Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
3
3
 
4
- import { DynamoNTS_DBService } from './dynamo-nts-db.service';
4
+ import { DynamoNTS_DBFilter, DynamoNTS_DBService, DynamoNTS_DBUpdate } from './dynamo-nts-db.service';
5
5
  import { DynamoNTS_GlobalService } from './dynamo-nts-global.service';
6
6
 
7
7
  /**
@@ -117,7 +117,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
117
117
  status: 417,
118
118
  errorCode: 'NTS-DS0-GI1',
119
119
  addECToUserMsg: true,
120
- message: `ID is missing! (maybe you wanted to use getDataByDependencyId() instead...) (${this.dataParams.dataName})`,
120
+ message: `getDataById failed, ID is missing! (maybe you wanted to use getDataByDependencyId() instead...) (${this.dataParams.dataName})`,
121
121
  userMessage: this.defaultErrorUserMsg
122
122
  });
123
123
  }
@@ -156,7 +156,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
156
156
  status: 417,
157
157
  errorCode: 'NTS-DS0-GD1',
158
158
  addECToUserMsg: true,
159
- message: `'dependencyDataIdKey is missing from service! (${this.dataParams.dataName})`,
159
+ message: `getDataByDependencyId failed, dependencyDataIdKey is missing from service! (${this.dataParams.dataName})`,
160
160
  userMessage: this.defaultErrorUserMsg
161
161
  });
162
162
  }
@@ -166,14 +166,14 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
166
166
  status: 417,
167
167
  errorCode: 'NTS-DS0-GD2',
168
168
  addECToUserMsg: true,
169
- message: `${this.depKey} is missing! (${this.dataParams.dataName})`,
169
+ message: `getDataByDependencyId failed, ${this.depKey} is missing! (${this.dataParams.dataName})`,
170
170
  userMessage: this.defaultErrorUserMsg
171
171
  });
172
172
  }
173
173
 
174
174
  const dataExists: T = await this.dataDBService.getDataByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
175
175
  if (error?.errorCode === 'NTS-DBS-GD2') {
176
- Dynamo_Log.warn(`getDataByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
176
+ Dynamo_Log.warn(`getDataByDependencyId failed; ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
177
177
  return null;
178
178
  } else {
179
179
  throw error;
@@ -221,7 +221,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
221
221
  status: 417,
222
222
  errorCode: 'NTS-DS0-GLD2',
223
223
  addECToUserMsg: true,
224
- message: `${this.depKey} is missing (${this.dataParams.dataName})`,
224
+ message: `getDataListByDependencyId failed, ${this.depKey} is missing (${this.dataParams.dataName})`,
225
225
  userMessage: this.defaultErrorUserMsg
226
226
  });
227
227
  }
@@ -285,9 +285,9 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
285
285
  * //
286
286
  * @returns {T} data: T
287
287
  */
288
- async findData(findBy: any, dontSetToService?: boolean): Promise<T> {
288
+ async findData(filterBy: DynamoNTS_DBFilter<T>, dontSetToService?: boolean): Promise<T> {
289
289
  try {
290
- const dataExists: T = await this.dataDBService.findOne(findBy).catch(error => {
290
+ const dataExists: T = await this.dataDBService.findOne(filterBy).catch(error => {
291
291
  if (error?.errorCode === 'NTS-DBS-FO1') {
292
292
  Dynamo_Log.warn(`findData ${this.dataParams.dataName} didn't found any.`);
293
293
  return null;
@@ -342,9 +342,9 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
342
342
  * //
343
343
  * @returns {T[]} dataList: T[]
344
344
  */
345
- async findDatas(findBy: any, dontSetToService?: boolean): Promise<T[]> {
345
+ async findDatas(filterBy: DynamoNTS_DBFilter<T>, dontSetToService?: boolean): Promise<T[]> {
346
346
  try {
347
- const dataListExists: T[] = await this.dataDBService.find(findBy).catch(error => {
347
+ const dataListExists: T[] = await this.dataDBService.find(filterBy).catch(error => {
348
348
  if (error?.errorCode === 'NTS-DBS-F1') {
349
349
  Dynamo_Log.warn(`findDatas ${this.dataParams.dataName} didn't found any.`);
350
350
  return [];
@@ -425,14 +425,14 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
425
425
  * $unset: // Removes the specified field from a document. (set: "" to value)
426
426
  * //
427
427
  */
428
- async updateData(set: { updateBy?: any, update: any }): Promise<void> {
428
+ async updateData(set: { filterBy?: DynamoNTS_DBFilter<T>, update: DynamoNTS_DBUpdate<T> }): Promise<void> {
429
429
  try {
430
- if (set.updateBy) {
431
- await this.dataDBService.updateOne(set.updateBy, set.update, this.issuer);
430
+ if (set.filterBy) {
431
+ await this.dataDBService.updateOne(set.filterBy, set.update, this.issuer);
432
432
  } else if (this.data._id) {
433
- await this.dataDBService.updateOne({ _id: this.data._id }, set.update, this.issuer);
433
+ await this.dataDBService.updateOne({ _id: this.data._id } as DynamoNTS_DBFilter<T>, set.update, this.issuer);
434
434
  } else if (this.depKey && this.data[this.depKey]) {
435
- await this.dataDBService.updateOne({ [this.depKey]: this.data[this.depKey] }, set.update, this.issuer);
435
+ await this.dataDBService.updateOne({ [this.depKey]: this.data[this.depKey] } as DynamoNTS_DBFilter<T>, set.update, this.issuer);
436
436
  } else {
437
437
  throw new Dynamo_Error({
438
438
  status: 417,
@@ -552,7 +552,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
552
552
  status: 417,
553
553
  errorCode: 'NTS-DS0-SD0',
554
554
  addECToUserMsg: true,
555
- message: `modifyData was unsuccessful (${this.dataParams.dataName})`,
555
+ message: `saveData was unsuccessful (${this.dataParams.dataName})`,
556
556
  userMessage: this.defaultErrorUserMsg,
557
557
  error: error
558
558
  });
@@ -570,7 +570,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
570
570
  status: 417,
571
571
  errorCode: 'NTS-DS0-DD1',
572
572
  addECToUserMsg: true,
573
- message: `ID is missing! (${this.dataParams.dataName})` ,
573
+ message: `deleteData failed, ID is missing! (${this.dataParams.dataName})` ,
574
574
  userMessage: this.defaultErrorUserMsg,
575
575
  });
576
576
  }
@@ -614,7 +614,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
614
614
  status: 422,
615
615
  errorCode: 'NTS-DS0-VD1',
616
616
  addECToUserMsg: true,
617
- message: `${this.dataParams.modelParams[i].key} is missing! (${this.dataParams.modelParams[i].required ? 'required' : 'index'}) (${this.dataParams.dataName})`,
617
+ message: `validateForSave failed, ${this.dataParams.modelParams[i].key} is missing! (${this.dataParams.modelParams[i].required ? 'required' : 'index'}) (${this.dataParams.dataName})`,
618
618
  userMessage: this.defaultValidationErrorUserMsg
619
619
  });
620
620
  }
@@ -627,7 +627,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
627
627
  status: 422,
628
628
  errorCode: 'NTS-DS0-VD2',
629
629
  addECToUserMsg: true,
630
- message: `${this.dataParams.modelParams[i].key} is not a date! (${this.dataParams.dataName})`,
630
+ message: `validateForSave failed, ${this.dataParams.modelParams[i].key} is not a date! (${this.dataParams.dataName})`,
631
631
  userMessage: this.defaultValidationErrorUserMsg
632
632
  });
633
633
  }