@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
@@ -1,140 +1,140 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DynamoNTS_EndpointParams = void 0;
4
- const tslib_1 = require("tslib");
5
- const dynamo_nts_global_service_1 = require("../_services/dynamo-nts-global.service");
6
- const _constants_1 = require("../_constants");
7
- const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
8
- /**
9
- * High level endpoint for API
10
- * used for specific events such as saving or getting data,
11
- * triggering events, logging in or out, and much more
12
- */
13
- class DynamoNTS_EndpointParams {
14
- constructor(set) {
15
- var _a, _b, _c, _d, _e, _f;
16
- try {
17
- this.name = (_a = set.name) !== null && _a !== void 0 ? _a : set.endpoint;
18
- this.security = (_b = set.security) !== null && _b !== void 0 ? _b : _constants_1.dynamoNTS_GlobalSettings.defaultRouteSecurity;
19
- this.type = set.type;
20
- this.endpoint = set.endpoint;
21
- if (!this.endpoint) {
22
- throw new fsm_dynamo_1.Dynamo_Error({
23
- status: 406,
24
- errorCode: 'NTS-EP0-C00',
25
- addECToUserMsg: true,
26
- message: 'trying to create DynamoNTS_EndpointParams without endpoint value',
27
- userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
28
- });
29
- }
30
- let pathParts = this.endpoint.split('/');
31
- pathParts = pathParts.filter((part) => part[0] === ':');
32
- pathParts = pathParts.map((part) => part = part.replace(':', ''));
33
- this.pathParams = pathParts;
34
- this.preProcessess = (_c = set.preProcessess) !== null && _c !== void 0 ? _c : [];
35
- this.tasks = set.tasks;
36
- this.logRequest = (_d = set.logRequest) !== null && _d !== void 0 ? _d : _constants_1.dynamoNTS_GlobalSettings.logRequest;
37
- this.logRequestsContent = (_e = set.logRequestsContent) !== null && _e !== void 0 ? _e : _constants_1.dynamoNTS_GlobalSettings.logRequestsContent;
38
- this.logResponseContent = (_f = set.logResponseContent) !== null && _f !== void 0 ? _f : _constants_1.dynamoNTS_GlobalSettings.logResponseContent;
39
- if (this.logRequest) {
40
- this.preProcessess.unshift(this.getPreLog());
41
- }
42
- }
43
- catch (error) {
44
- fsm_dynamo_1.Dynamo_Log.error(`\nEndpoint params setup failed: name: '${set.name}' (security: ${set.security}) endpoint: ${set.endpoint}\nERROR:\n`, error);
45
- throw error;
46
- }
47
- }
48
- /**
49
- *
50
- * @returns
51
- */
52
- getPreLog() {
53
- return (req, res, next) => tslib_1.__awaiter(this, void 0, void 0, function* () {
54
- try {
55
- if (this.logRequest) {
56
- if (this.logRequestsContent) {
57
- let inputs = '';
58
- for (let i = 0; i < this.pathParams.length; i++) {
59
- inputs += ` ${this.pathParams[i]}: ${req.params[this.pathParams[i]]}`;
60
- if (i + 1 < this.pathParams.length || req.body && `${req.body}` !== '{}') {
61
- inputs += ',';
62
- }
63
- }
64
- if (req.body && 0 < Object.keys(req.body).length) {
65
- console.log(`==> incoming ${this.name} request...${inputs} body:`, req.body);
66
- }
67
- else {
68
- console.log(`==> incoming ${this.name} request...${inputs}`);
69
- }
70
- }
71
- else {
72
- console.log(`==> incoming ${this.name} request...`);
73
- }
74
- }
75
- next();
76
- }
77
- catch (error) {
78
- this.error(res, error);
79
- }
80
- });
81
- }
82
- /**
83
- *
84
- * @returns
85
- */
86
- getTasksExecution() {
87
- return (req, res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
88
- var _a;
89
- try {
90
- const issuer = (_a = dynamo_nts_global_service_1.DynamoNTS_GlobalService === null || dynamo_nts_global_service_1.DynamoNTS_GlobalService === void 0 ? void 0 : dynamo_nts_global_service_1.DynamoNTS_GlobalService.getAuthService()) === null || _a === void 0 ? void 0 : _a.getAccountIdFromRequest(req);
91
- for (let i = 0; i < this.tasks.length; i++) {
92
- yield this.tasks[i](req, res, issuer);
93
- }
94
- if (this.logRequest) {
95
- if (this.logResponseContent) {
96
- fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
97
- fsm_dynamo_1.Dynamo_Log.success('sorry, the logResponseContent is not implemented yet.');
98
- }
99
- else {
100
- fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
101
- }
102
- }
103
- }
104
- catch (error) {
105
- this.error(res, error);
106
- }
107
- });
108
- }
109
- /**
110
- *
111
- * @param res
112
- * @param error
113
- */
114
- error(res, error) {
115
- var _a;
116
- try {
117
- fsm_dynamo_1.Dynamo_Log.error(`Endpoint catched an error. ${this.name} (${this.endpoint})` +
118
- `\nERROR:`, error, '\n');
119
- res.status((_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : 501);
120
- res.send(error);
121
- if (this.logRequest) {
122
- if (this.logResponseContent) {
123
- fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
124
- (error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
125
- fsm_dynamo_1.Dynamo_Log.error('sorry, the logResponseContent is not implemented yet.');
126
- }
127
- else {
128
- fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
129
- (error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
130
- }
131
- }
132
- }
133
- catch (error) {
134
- console.error(`DYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams:error: (${this.name}, ${this.endpoint})` +
135
- `\nERROR:`, error, '\n');
136
- }
137
- }
138
- }
139
- exports.DynamoNTS_EndpointParams = DynamoNTS_EndpointParams;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoNTS_EndpointParams = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const dynamo_nts_global_service_1 = require("../_services/dynamo-nts-global.service");
6
+ const _constants_1 = require("../_constants");
7
+ const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
8
+ /**
9
+ * High level endpoint for API
10
+ * used for specific events such as saving or getting data,
11
+ * triggering events, logging in or out, and much more
12
+ */
13
+ class DynamoNTS_EndpointParams {
14
+ constructor(set) {
15
+ var _a, _b, _c, _d, _e, _f;
16
+ try {
17
+ this.name = (_a = set.name) !== null && _a !== void 0 ? _a : set.endpoint;
18
+ this.security = (_b = set.security) !== null && _b !== void 0 ? _b : _constants_1.dynamoNTS_GlobalSettings.defaultRouteSecurity;
19
+ this.type = set.type;
20
+ this.endpoint = set.endpoint;
21
+ if (!this.endpoint) {
22
+ throw new fsm_dynamo_1.Dynamo_Error({
23
+ status: 406,
24
+ errorCode: 'NTS-EP0-C00',
25
+ addECToUserMsg: true,
26
+ message: 'trying to create DynamoNTS_EndpointParams without endpoint value',
27
+ userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
28
+ });
29
+ }
30
+ let pathParts = this.endpoint.split('/');
31
+ pathParts = pathParts.filter((part) => part[0] === ':');
32
+ pathParts = pathParts.map((part) => part = part.replace(':', ''));
33
+ this.pathParams = pathParts;
34
+ this.preProcessess = (_c = set.preProcessess) !== null && _c !== void 0 ? _c : [];
35
+ this.tasks = set.tasks;
36
+ this.logRequest = (_d = set.logRequest) !== null && _d !== void 0 ? _d : _constants_1.dynamoNTS_GlobalSettings.logRequest;
37
+ this.logRequestsContent = (_e = set.logRequestsContent) !== null && _e !== void 0 ? _e : _constants_1.dynamoNTS_GlobalSettings.logRequestsContent;
38
+ this.logResponseContent = (_f = set.logResponseContent) !== null && _f !== void 0 ? _f : _constants_1.dynamoNTS_GlobalSettings.logResponseContent;
39
+ if (this.logRequest) {
40
+ this.preProcessess.unshift(this.getPreLog());
41
+ }
42
+ }
43
+ catch (error) {
44
+ fsm_dynamo_1.Dynamo_Log.error(`\nEndpoint params setup failed: name: '${set.name}' (security: ${set.security}) endpoint: ${set.endpoint}\nERROR:\n`, error);
45
+ throw error;
46
+ }
47
+ }
48
+ /**
49
+ *
50
+ * @returns
51
+ */
52
+ getPreLog() {
53
+ return (req, res, next) => tslib_1.__awaiter(this, void 0, void 0, function* () {
54
+ try {
55
+ if (this.logRequest) {
56
+ if (this.logRequestsContent) {
57
+ let inputs = '';
58
+ for (let i = 0; i < this.pathParams.length; i++) {
59
+ inputs += ` ${this.pathParams[i]}: ${req.params[this.pathParams[i]]}`;
60
+ if (i + 1 < this.pathParams.length || req.body && `${req.body}` !== '{}') {
61
+ inputs += ',';
62
+ }
63
+ }
64
+ if (req.body && 0 < Object.keys(req.body).length) {
65
+ console.log(`==> incoming ${this.name} request...${inputs} body:`, req.body);
66
+ }
67
+ else {
68
+ console.log(`==> incoming ${this.name} request...${inputs}`);
69
+ }
70
+ }
71
+ else {
72
+ console.log(`==> incoming ${this.name} request...`);
73
+ }
74
+ }
75
+ next();
76
+ }
77
+ catch (error) {
78
+ this.error(res, error);
79
+ }
80
+ });
81
+ }
82
+ /**
83
+ *
84
+ * @returns
85
+ */
86
+ getTasksExecution() {
87
+ return (req, res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
88
+ var _a;
89
+ try {
90
+ const issuer = (_a = dynamo_nts_global_service_1.DynamoNTS_GlobalService === null || dynamo_nts_global_service_1.DynamoNTS_GlobalService === void 0 ? void 0 : dynamo_nts_global_service_1.DynamoNTS_GlobalService.getAuthService()) === null || _a === void 0 ? void 0 : _a.getAccountIdFromRequest(req);
91
+ for (let i = 0; i < this.tasks.length; i++) {
92
+ yield this.tasks[i](req, res, issuer);
93
+ }
94
+ if (this.logRequest) {
95
+ if (this.logResponseContent) {
96
+ fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
97
+ fsm_dynamo_1.Dynamo_Log.success('sorry, the logResponseContent is not implemented yet.');
98
+ }
99
+ else {
100
+ fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
101
+ }
102
+ }
103
+ }
104
+ catch (error) {
105
+ this.error(res, error);
106
+ }
107
+ });
108
+ }
109
+ /**
110
+ *
111
+ * @param res
112
+ * @param error
113
+ */
114
+ error(res, error) {
115
+ var _a;
116
+ try {
117
+ fsm_dynamo_1.Dynamo_Log.error(`Endpoint catched an error. ${this.name} (${this.endpoint})` +
118
+ `\nERROR:`, error, '\n');
119
+ res.status((_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : 501);
120
+ res.send(error);
121
+ if (this.logRequest) {
122
+ if (this.logResponseContent) {
123
+ fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
124
+ (error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
125
+ fsm_dynamo_1.Dynamo_Log.error('sorry, the logResponseContent is not implemented yet.');
126
+ }
127
+ else {
128
+ fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
129
+ (error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
130
+ }
131
+ }
132
+ }
133
+ catch (error) {
134
+ console.error(`DYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams:error: (${this.name}, ${this.endpoint})` +
135
+ `\nERROR:`, error, '\n');
136
+ }
137
+ }
138
+ }
139
+ exports.DynamoNTS_EndpointParams = DynamoNTS_EndpointParams;
140
140
  //# sourceMappingURL=dynamo-nts-endpoint-params.js.map
@@ -1,54 +1,54 @@
1
- import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
2
- import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
3
- /**
4
- *
5
- *
6
- * @param logRequestsContent only will log if the specific logRequest is also true
7
- *
8
- * @param logEventContent only will log if the specific socket event is also set to log
9
- *
10
- */
11
- export interface DynamoNTS_GlobalSettings {
12
- /**
13
- * this will be used as the main baseUrl for the application,
14
- * this is not required, but we suggest to use at least a '/api' as base route
15
- */
16
- baseUrl: string;
17
- /**
18
- * this sets the default security for routes
19
- */
20
- defaultRouteSecurity: DynamoNTS_RouteSecurity;
21
- /**
22
- * this sets the default security for sockets
23
- */
24
- defaultSocketSecurity: DynamoNTS_SocketSecurity;
25
- /**
26
- * this setting will enable debug logs for setting up the application
27
- */
28
- logSetup?: boolean;
29
- /**
30
- * this is an application wide default setting for route debug logs
31
- */
32
- logRequest?: boolean;
33
- /**
34
- * this is an application wide default setting for route debug logs
35
- */
36
- logRequestsContent?: boolean;
37
- /**
38
- * this is an application wide default setting for route debug logs
39
- */
40
- logResponseContent?: boolean;
41
- /**
42
- * this is an application wide default setting for socket debug logs
43
- */
44
- logMainSocketEvent?: boolean;
45
- /**
46
- * this is an application wide default setting for socket debug logs
47
- */
48
- logAllSocketEvent?: boolean;
49
- /**
50
- * this is an application wide default setting for socket debug logs
51
- */
52
- logEventContent?: boolean;
53
- }
1
+ import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
2
+ import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
3
+ /**
4
+ *
5
+ *
6
+ * @param logRequestsContent only will log if the specific logRequest is also true
7
+ *
8
+ * @param logEventContent only will log if the specific socket event is also set to log
9
+ *
10
+ */
11
+ export interface DynamoNTS_GlobalSettings {
12
+ /**
13
+ * this will be used as the main baseUrl for the application,
14
+ * this is not required, but we suggest to use at least a '/api' as base route
15
+ */
16
+ baseUrl: string;
17
+ /**
18
+ * this sets the default security for routes
19
+ */
20
+ defaultRouteSecurity: DynamoNTS_RouteSecurity;
21
+ /**
22
+ * this sets the default security for sockets
23
+ */
24
+ defaultSocketSecurity: DynamoNTS_SocketSecurity;
25
+ /**
26
+ * this setting will enable debug logs for setting up the application
27
+ */
28
+ logSetup?: boolean;
29
+ /**
30
+ * this is an application wide default setting for route debug logs
31
+ */
32
+ logRequest?: boolean;
33
+ /**
34
+ * this is an application wide default setting for route debug logs
35
+ */
36
+ logRequestsContent?: boolean;
37
+ /**
38
+ * this is an application wide default setting for route debug logs
39
+ */
40
+ logResponseContent?: boolean;
41
+ /**
42
+ * this is an application wide default setting for socket debug logs
43
+ */
44
+ logMainSocketEvent?: boolean;
45
+ /**
46
+ * this is an application wide default setting for socket debug logs
47
+ */
48
+ logAllSocketEvent?: boolean;
49
+ /**
50
+ * this is an application wide default setting for socket debug logs
51
+ */
52
+ logEventContent?: boolean;
53
+ }
54
54
  //# sourceMappingURL=dynamo-nts-global-settings.d.ts.map
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=dynamo-nts-global-settings.js.map
@@ -1,20 +1,20 @@
1
- import { DynamoNTS_RouteSecurity } from '../_enums';
2
- import { DynamoNTS_Controller } from '../_services';
3
- /**
4
- * This is a main route point handler, which collects a list of controllers for the API
5
- */
6
- export interface DynamoNTS_RoutingModuleSettings {
7
- /**
8
- * main route of the module
9
- */
10
- route: string;
11
- /**
12
- * the collection of controllers (sub-routes, with differentlogical parts, to different db elements)
13
- */
14
- controllers: DynamoNTS_Controller[];
15
- /**
16
- * securityOverride will be used to create different security for a single module without changing the default security (http/https/both)
17
- */
18
- securityOverride?: DynamoNTS_RouteSecurity;
19
- }
1
+ import { DynamoNTS_RouteSecurity } from '../_enums';
2
+ import { DynamoNTS_Controller } from '../_services';
3
+ /**
4
+ * This is a main route point handler, which collects a list of controllers for the API
5
+ */
6
+ export interface DynamoNTS_RoutingModuleSettings {
7
+ /**
8
+ * main route of the module
9
+ */
10
+ route: string;
11
+ /**
12
+ * the collection of controllers (sub-routes, with differentlogical parts, to different db elements)
13
+ */
14
+ controllers: DynamoNTS_Controller[];
15
+ /**
16
+ * securityOverride will be used to create different security for a single module without changing the default security (http/https/both)
17
+ */
18
+ securityOverride?: DynamoNTS_RouteSecurity;
19
+ }
20
20
  //# sourceMappingURL=dynamo-nts-routing-module-settings.d.ts.map
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=dynamo-nts-routing-module-settings.js.map
@@ -1,31 +1,33 @@
1
- import { DynamoNTS_SocketEvent } from '../_enums/http/socket-event.enum';
2
- /**
3
- * socket handling and clarification is under development
4
- */
5
- export declare class DynamoNTS_SocketEventParams<T> {
6
- socketName?: string;
7
- event: DynamoNTS_SocketEvent | string;
8
- preProcessess?: ((content?: T) => Promise<T>)[];
9
- tasks: ((content?: T, issuer?: string) => Promise<void>)[];
10
- logEvent: boolean;
11
- logEventContent: boolean;
12
- constructor(set: {
13
- socketName?: string;
14
- event: DynamoNTS_SocketEvent | string;
15
- preProcessess?: ((content?: T) => Promise<T>)[];
16
- tasks: ((content?: T, issuer?: string) => Promise<void>)[];
17
- logEvent?: boolean;
18
- logEventContent?: boolean;
19
- });
20
- /**
21
- *
22
- * @returns
23
- */
24
- getPreLog(): (content: T) => Promise<T>;
25
- /**
26
- *
27
- * @returns
28
- */
29
- getFullExecution(issuer?: string): (content?: T) => Promise<void>;
30
- }
1
+ import { DynamoNTS_SocketEvent } from '../_enums/http/socket-event.enum';
2
+ export type DynamoNTS_SocketEventPreprocessTask<T_EventContent> = (content?: any, issuer?: string) => Promise<T_EventContent>;
3
+ export type DynamoNTS_SocketEventTask = (content?: any, issuer?: string) => Promise<void>;
4
+ /**
5
+ * socket handling and clarification is under development
6
+ */
7
+ export declare class DynamoNTS_SocketEventParams<T_EventContent> {
8
+ socketName?: string;
9
+ event: DynamoNTS_SocketEvent | string;
10
+ preProcessess?: DynamoNTS_SocketEventPreprocessTask<T_EventContent>[];
11
+ tasks: DynamoNTS_SocketEventTask[];
12
+ logEvent: boolean;
13
+ logEventContent: boolean;
14
+ constructor(set: {
15
+ socketName?: string;
16
+ event: DynamoNTS_SocketEvent | string;
17
+ preProcessess?: DynamoNTS_SocketEventPreprocessTask<T_EventContent>[];
18
+ tasks?: DynamoNTS_SocketEventTask[];
19
+ logEvent?: boolean;
20
+ logEventContent?: boolean;
21
+ });
22
+ /**
23
+ *
24
+ * @returns
25
+ */
26
+ getPreLog(): DynamoNTS_SocketEventPreprocessTask<T_EventContent>;
27
+ /**
28
+ *
29
+ * @returns
30
+ */
31
+ executeEventTasks(issuer?: string, content?: T_EventContent): Promise<void>;
32
+ }
31
33
  //# sourceMappingURL=dynamo-nts-socket-event-params.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamo-nts-socket-event-params.d.ts","sourceRoot":"","sources":["../../src/_models/dynamo-nts-socket-event-params.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qB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