@futdevpro/nts-dynamo 1.5.54 → 1.5.58

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 (124) hide show
  1. package/README.md +123 -0
  2. package/lib/_enums/data-model-type.enum.d.ts +7 -0
  3. package/lib/_enums/data-model-type.enum.d.ts.map +1 -1
  4. package/lib/_enums/data-model-type.enum.js +7 -0
  5. package/lib/_enums/data-model-type.enum.js.map +1 -1
  6. package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +5 -0
  7. package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts.map +1 -1
  8. package/lib/_enums/dynamo-nts-data-service-function.enum.js +5 -1
  9. package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -1
  10. package/lib/_enums/dynamo-nts-route-security.enum.d.ts +6 -0
  11. package/lib/_enums/dynamo-nts-route-security.enum.d.ts.map +1 -1
  12. package/lib/_enums/dynamo-nts-route-security.enum.js +6 -0
  13. package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -1
  14. package/lib/_enums/dynamo-nts-socket-security.enum.d.ts +6 -0
  15. package/lib/_enums/dynamo-nts-socket-security.enum.d.ts.map +1 -1
  16. package/lib/_enums/dynamo-nts-socket-security.enum.js +6 -0
  17. package/lib/_enums/dynamo-nts-socket-security.enum.js.map +1 -1
  18. package/lib/_enums/http/http-call-type.enum.d.ts +4 -0
  19. package/lib/_enums/http/http-call-type.enum.d.ts.map +1 -1
  20. package/lib/_enums/http/http-call-type.enum.js +4 -0
  21. package/lib/_enums/http/http-call-type.enum.js.map +1 -1
  22. package/lib/_enums/predefined-data-types.enum.d.ts +3 -0
  23. package/lib/_enums/predefined-data-types.enum.d.ts.map +1 -1
  24. package/lib/_enums/predefined-data-types.enum.js +3 -0
  25. package/lib/_enums/predefined-data-types.enum.js.map +1 -1
  26. package/lib/_models/dynamo-nts-api-call-params.d.ts +61 -2
  27. package/lib/_models/dynamo-nts-api-call-params.d.ts.map +1 -1
  28. package/lib/_models/dynamo-nts-api-call-params.js +24 -7
  29. package/lib/_models/dynamo-nts-api-call-params.js.map +1 -1
  30. package/lib/_models/dynamo-nts-app-params.d.ts +33 -1
  31. package/lib/_models/dynamo-nts-app-params.d.ts.map +1 -1
  32. package/lib/_models/dynamo-nts-app-params.js +1 -1
  33. package/lib/_models/dynamo-nts-app-params.js.map +1 -1
  34. package/lib/_models/dynamo-nts-endpoint-params.d.ts +36 -1
  35. package/lib/_models/dynamo-nts-endpoint-params.d.ts.map +1 -1
  36. package/lib/_models/dynamo-nts-endpoint-params.js +15 -13
  37. package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -1
  38. package/lib/_models/dynamo-nts-global-settings.d.ts +31 -0
  39. package/lib/_models/dynamo-nts-global-settings.d.ts.map +1 -1
  40. package/lib/_models/dynamo-nts-routing-module-settings.d.ts +10 -1
  41. package/lib/_models/dynamo-nts-routing-module-settings.d.ts.map +1 -1
  42. package/lib/_models/dynamo-nts-socket-dictionary.d.ts +3 -0
  43. package/lib/_models/dynamo-nts-socket-dictionary.d.ts.map +1 -1
  44. package/lib/_models/dynamo-nts-socket-dictionary.js +3 -0
  45. package/lib/_models/dynamo-nts-socket-dictionary.js.map +1 -1
  46. package/lib/_models/dynamo-nts-socket-event-params.d.ts +1 -1
  47. package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
  48. package/lib/_models/dynamo-nts-socket-event-params.js +3 -3
  49. package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
  50. package/lib/_models/dynamo-nts-socket-service-params.d.ts +1 -1
  51. package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -1
  52. package/lib/_models/dynamo-nts-socket-service-params.js +3 -3
  53. package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
  54. package/lib/_modules/usage/usage.service.js +1 -1
  55. package/lib/_modules/usage/usage.service.js.map +1 -1
  56. package/lib/_services/dynamo-nts-api.service.d.ts +17 -2
  57. package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -1
  58. package/lib/_services/dynamo-nts-api.service.js +19 -11
  59. package/lib/_services/dynamo-nts-api.service.js.map +1 -1
  60. package/lib/_services/dynamo-nts-app-extended.d.ts +10 -1
  61. package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
  62. package/lib/_services/dynamo-nts-app-extended.js +8 -8
  63. package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
  64. package/lib/_services/dynamo-nts-app.d.ts +30 -3
  65. package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
  66. package/lib/_services/dynamo-nts-app.js +19 -19
  67. package/lib/_services/dynamo-nts-app.js.map +1 -1
  68. package/lib/_services/dynamo-nts-auth.service.d.ts +4 -4
  69. package/lib/_services/dynamo-nts-controller.service.d.ts +55 -0
  70. package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
  71. package/lib/_services/dynamo-nts-controller.service.js +2 -2
  72. package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
  73. package/lib/_services/dynamo-nts-data.service.d.ts +15 -3
  74. package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
  75. package/lib/_services/dynamo-nts-data.service.js +203 -147
  76. package/lib/_services/dynamo-nts-data.service.js.map +1 -1
  77. package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
  78. package/lib/_services/dynamo-nts-db.service.js +132 -83
  79. package/lib/_services/dynamo-nts-db.service.js.map +1 -1
  80. package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
  81. package/lib/_services/dynamo-nts-email.service.js +26 -22
  82. package/lib/_services/dynamo-nts-email.service.js.map +1 -1
  83. package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
  84. package/lib/_services/dynamo-nts-global.service.js +3 -3
  85. package/lib/_services/dynamo-nts-global.service.js.map +1 -1
  86. package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
  87. package/lib/_services/dynamo-nts-routing-module.service.js +1 -2
  88. package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
  89. package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
  90. package/lib/_services/dynamo-nts-socket.service.js +1 -2
  91. package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
  92. package/lib/tsconfig.tsbuildinfo +1 -1
  93. package/package.json +13 -13
  94. package/src/_assets/dynamo-nts-128.png +0 -0
  95. package/src/_assets/dynamo-nts-256.png +0 -0
  96. package/src/_assets/dynamo-nts-512.png +0 -0
  97. package/src/_assets/dynamo-nts-64.png +0 -0
  98. package/src/_enums/data-model-type.enum.ts +7 -0
  99. package/src/_enums/dynamo-nts-data-service-function.enum.ts +5 -1
  100. package/src/_enums/dynamo-nts-route-security.enum.ts +6 -0
  101. package/src/_enums/dynamo-nts-socket-security.enum.ts +6 -0
  102. package/src/_enums/http/http-call-type.enum.ts +4 -0
  103. package/src/_enums/predefined-data-types.enum.ts +3 -0
  104. package/src/_models/dynamo-nts-api-call-params.ts +74 -14
  105. package/src/_models/dynamo-nts-app-params.ts +33 -1
  106. package/src/_models/dynamo-nts-endpoint-params.ts +49 -14
  107. package/src/_models/dynamo-nts-global-settings.ts +31 -0
  108. package/src/_models/dynamo-nts-routing-module-settings.ts +10 -1
  109. package/src/_models/dynamo-nts-socket-dictionary.ts +3 -0
  110. package/src/_models/dynamo-nts-socket-event-params.ts +3 -3
  111. package/src/_models/dynamo-nts-socket-service-params.ts +3 -3
  112. package/src/_modules/usage/usage.service.ts +2 -2
  113. package/src/_services/dynamo-nts-api.service.ts +23 -12
  114. package/src/_services/dynamo-nts-app-extended.ts +17 -8
  115. package/src/_services/dynamo-nts-app.ts +47 -20
  116. package/src/_services/dynamo-nts-auth.service.ts +4 -4
  117. package/src/_services/dynamo-nts-controller.service.ts +57 -2
  118. package/src/_services/dynamo-nts-data.service.ts +200 -132
  119. package/src/_services/dynamo-nts-db.service.ts +122 -83
  120. package/src/_services/dynamo-nts-email.service.ts +33 -23
  121. package/src/_services/dynamo-nts-global.service.ts +3 -4
  122. package/src/_services/dynamo-nts-routing-module.service.ts +2 -3
  123. package/src/_services/dynamo-nts-socket.service.ts +2 -3
  124. package/src/version.json +0 -2
@@ -50,14 +50,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
50
50
  });
51
51
  }
52
52
  }).catch(error => {
53
- throw new Dynamo_Error({
54
- status: 422,
55
- errorCode: 'NTS-DBS-CD0',
56
- addECToUserMsg: true,
57
- message: `Create new ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
58
- userMessage: this.defaultErrorUserMsg,
59
- error
60
- });
53
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
54
+ throw error;
55
+ } else {
56
+ throw new Dynamo_Error({
57
+ status: 422,
58
+ errorCode: 'NTS-DBS-CD0',
59
+ addECToUserMsg: true,
60
+ message: `Create new ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
61
+ userMessage: this.defaultErrorUserMsg,
62
+ error
63
+ });
64
+ }
61
65
  });
62
66
 
63
67
  if (typeof newData._id === 'object') {
@@ -92,14 +96,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
92
96
  });
93
97
  }
94
98
  }).catch(error => {
95
- throw new Dynamo_Error({
96
- status: 417,
97
- errorCode: 'NTS-DBS-FU0',
98
- addECToUserMsg: true,
99
- message: `modify ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
100
- userMessage: this.defaultErrorUserMsg,
101
- error
102
- });
99
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
100
+ throw error;
101
+ } else {
102
+ throw new Dynamo_Error({
103
+ status: 417,
104
+ errorCode: 'NTS-DBS-FU0',
105
+ addECToUserMsg: true,
106
+ message: `modify ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
107
+ userMessage: this.defaultErrorUserMsg,
108
+ error
109
+ });
110
+ }
103
111
  });
104
112
 
105
113
  if (typeof newData._id === 'object') {
@@ -132,14 +140,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
132
140
  });
133
141
  }
134
142
  }).catch(error => {
135
- throw new Dynamo_Error({
136
- status: 417,
137
- errorCode: 'NTS-DBS-GI0',
138
- addECToUserMsg: true,
139
- message: `get ${this.dataParams.dbName} by ID was unsuccessful (NTS DB)`,
140
- userMessage: this.defaultErrorUserMsg,
141
- error
142
- });
143
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
144
+ throw error;
145
+ } else {
146
+ throw new Dynamo_Error({
147
+ status: 417,
148
+ errorCode: 'NTS-DBS-GI0',
149
+ addECToUserMsg: true,
150
+ message: `get ${this.dataParams.dbName} by ID was unsuccessful (NTS DB)`,
151
+ userMessage: this.defaultErrorUserMsg,
152
+ error
153
+ });
154
+ }
143
155
  });
144
156
 
145
157
  if (data && typeof data._id === 'object') {
@@ -181,14 +193,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
181
193
  });
182
194
  }
183
195
  }).catch(error => {
184
- throw new Dynamo_Error({
185
- status: 417,
186
- errorCode: 'NTS-DBS-GD1',
187
- addECToUserMsg: true,
188
- message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
189
- userMessage: this.defaultErrorUserMsg,
190
- error
191
- });
196
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
197
+ throw error;
198
+ } else {
199
+ throw new Dynamo_Error({
200
+ status: 417,
201
+ errorCode: 'NTS-DBS-GD1',
202
+ addECToUserMsg: true,
203
+ message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
204
+ userMessage: this.defaultErrorUserMsg,
205
+ error
206
+ });
207
+ }
192
208
  });
193
209
 
194
210
  if (data && typeof data._id === 'object') {
@@ -231,14 +247,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
231
247
  });
232
248
  }
233
249
  }).catch(error => {
234
- throw new Dynamo_Error({
235
- status: 417,
236
- errorCode: 'NTS-DBS-GLD1',
237
- addECToUserMsg: true,
238
- message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
239
- userMessage: this.defaultErrorUserMsg,
240
- error
241
- });
250
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
251
+ throw error;
252
+ } else {
253
+ throw new Dynamo_Error({
254
+ status: 417,
255
+ errorCode: 'NTS-DBS-GLD1',
256
+ addECToUserMsg: true,
257
+ message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
258
+ userMessage: this.defaultErrorUserMsg,
259
+ error
260
+ });
261
+ }
242
262
  });
243
263
 
244
264
  if (0 < dataList.length) {
@@ -285,14 +305,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
285
305
  });
286
306
  }
287
307
  }).catch(error => {
288
- throw new Dynamo_Error({
289
- status: 417,
290
- errorCode: 'NTS-DBS-GLDS1',
291
- addECToUserMsg: true,
292
- message: `get ${this.dataParams.dbName}s by ${this.depDataName}s was unsuccessful (NTS DB)`,
293
- userMessage: this.defaultErrorUserMsg,
294
- error
295
- });
308
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
309
+ throw error;
310
+ } else {
311
+ throw new Dynamo_Error({
312
+ status: 417,
313
+ errorCode: 'NTS-DBS-GLDS1',
314
+ addECToUserMsg: true,
315
+ message: `get ${this.dataParams.dbName}s by ${this.depDataName}s was unsuccessful (NTS DB)`,
316
+ userMessage: this.defaultErrorUserMsg,
317
+ error
318
+ });
319
+ }
296
320
  });
297
321
 
298
322
  if (0 < dataList.length) {
@@ -424,14 +448,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
424
448
  });
425
449
  }
426
450
  }).catch(error => {
427
- throw new Dynamo_Error({
428
- status: 417,
429
- errorCode: 'NTS-DBS-GA0',
430
- addECToUserMsg: true,
431
- message: `get all ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
432
- userMessage: this.defaultErrorUserMsg,
433
- error
434
- });
451
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
452
+ throw error;
453
+ } else {
454
+ throw new Dynamo_Error({
455
+ status: 417,
456
+ errorCode: 'NTS-DBS-GA0',
457
+ addECToUserMsg: true,
458
+ message: `get all ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
459
+ userMessage: this.defaultErrorUserMsg,
460
+ error
461
+ });
462
+ }
435
463
  });
436
464
 
437
465
  if (0 < dataList.length && typeof dataList[0]._id === 'object') {
@@ -475,8 +503,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
475
503
  });
476
504
  }
477
505
 
478
- await this.dataModel.deleteMany({ [this.depDataName]: dependencyId })
479
- .catch(error => {
506
+ await this.dataModel.deleteMany({ [this.depDataName]: dependencyId }).catch(error => {
480
507
  throw new Dynamo_Error({
481
508
  status: 417,
482
509
  errorCode: 'NTS-DBS-DDD1',
@@ -534,14 +561,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
534
561
  });
535
562
  }
536
563
  }).catch(error => {
537
- throw new Dynamo_Error({
538
- status: 417,
539
- errorCode: 'NTS-DBS-FO0',
540
- addECToUserMsg: true,
541
- message: `findOne ${this.dataParams.dbName} was unsuccessful (NTS DB) fliter: ${filter}`,
542
- userMessage: this.defaultErrorUserMsg,
543
- error
544
- });
564
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
565
+ throw error;
566
+ } else {
567
+ throw new Dynamo_Error({
568
+ status: 417,
569
+ errorCode: 'NTS-DBS-FO0',
570
+ addECToUserMsg: true,
571
+ message: `findOne ${this.dataParams.dbName} was unsuccessful (NTS DB) fliter: ${filter}`,
572
+ userMessage: this.defaultErrorUserMsg,
573
+ error
574
+ });
575
+ }
545
576
  });
546
577
 
547
578
  if (data && typeof data._id === 'object') {
@@ -594,14 +625,18 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
594
625
  });
595
626
  }
596
627
  }).catch(error => {
597
- throw new Dynamo_Error({
598
- status: 417,
599
- errorCode: 'NTS-DBS-F0',
600
- addECToUserMsg: true,
601
- message: `find ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
602
- userMessage: this.defaultErrorUserMsg,
603
- error
604
- });
628
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
629
+ throw error;
630
+ } else {
631
+ throw new Dynamo_Error({
632
+ status: 417,
633
+ errorCode: 'NTS-DBS-F0',
634
+ addECToUserMsg: true,
635
+ message: `find ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
636
+ userMessage: this.defaultErrorUserMsg,
637
+ error
638
+ });
639
+ }
605
640
  });
606
641
 
607
642
  if (0 < dataList.length) {
@@ -697,19 +732,23 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
697
732
  status: 204,
698
733
  errorCode: 'NTS-DBS-FIU1',
699
734
  addECToUserMsg: true,
700
- message: `${this.dataParams.dbName} not found! (NTS DB)`,
735
+ message: `${this.dataParams.dbName} not found! (by id: ${id}) (NTS DB)`,
701
736
  userMessage: this.defaultErrorUserMsg
702
737
  });
703
738
  }
704
739
  }).catch(error => {
705
- throw new Dynamo_Error({
706
- status: 417,
707
- errorCode: 'NTS-DBS-FIU0',
708
- addECToUserMsg: true,
709
- message: `findByIdAndUpdate ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
710
- userMessage: this.defaultErrorUserMsg,
711
- error
712
- });
740
+ if (error?.flag == 'DYNAMO ERROR OBJECT') {
741
+ throw error;
742
+ } else {
743
+ throw new Dynamo_Error({
744
+ status: 417,
745
+ errorCode: 'NTS-DBS-FIU0',
746
+ addECToUserMsg: true,
747
+ message: `findByIdAndUpdate ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
748
+ userMessage: this.defaultErrorUserMsg,
749
+ error
750
+ });
751
+ }
713
752
  });
714
753
 
715
754
  if (typeof newData._id === 'object') {
@@ -3,9 +3,7 @@ import * as FileSystem from 'fs';
3
3
  import * as Path from 'path';
4
4
  import * as NodeMailer from 'nodemailer';
5
5
  import { Options as MailOptions, Attachment } from 'nodemailer/lib/mailer';
6
- import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
7
-
8
- import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
6
+ import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
9
7
 
10
8
  /**
11
9
  *
@@ -57,7 +55,7 @@ export class DynamoNTS_EmailService {
57
55
  this.constructionFinished();
58
56
  }
59
57
  } catch (error) {
60
- DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
58
+ Dynamo_Log.logError(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
61
59
  }
62
60
  }
63
61
 
@@ -65,7 +63,7 @@ export class DynamoNTS_EmailService {
65
63
  *
66
64
  */
67
65
  private constructionFinished(): void {
68
- DynamoNTS_Shared.logSuccess(`\nEmailService construction (${this.senderName}) Finished!\n`)
66
+ Dynamo_Log.logSuccess(`\nEmailService construction (${this.senderName}) Finished!\n`)
69
67
  }
70
68
 
71
69
  /**
@@ -87,15 +85,25 @@ export class DynamoNTS_EmailService {
87
85
 
88
86
  if (set.content) {
89
87
  content = set.content
90
- } else if (set.useTemplate) {
91
- if (!this.templates[set.useTemplate]) {
88
+ } else {
89
+ if (!set.useTemplate) {
92
90
  throw new Dynamo_Error({
93
91
  errorCode: 'NTS-ES4-101',
94
92
  addECToUserMsg: true,
93
+ message: 'No content setting passsed to emailSending!',
94
+ userMessage: this.defaultErrorUserMsg,
95
+ });
96
+ }
97
+
98
+ if (!this.templates[set.useTemplate]) {
99
+ throw new Dynamo_Error({
100
+ errorCode: 'NTS-ES4-102',
101
+ addECToUserMsg: true,
95
102
  message: `No email template found with this parameter! (${set.useTemplate})`,
96
103
  userMessage: this.defaultErrorUserMsg
97
104
  });
98
105
  }
106
+
99
107
  content = this.templates[set.useTemplate];
100
108
 
101
109
  if (0 < this.templatePropertyKeys[set.useTemplate].length) {
@@ -104,9 +112,10 @@ export class DynamoNTS_EmailService {
104
112
  this.templatePropertyKeys[set.useTemplate].forEach((key: string, index: number) => {
105
113
  props += `${key}${index != this.templatePropertyKeys[set.useTemplate].length - 1 ? ', ' : ''}`;
106
114
  });
107
- DynamoNTS_Shared.logError('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
115
+ Dynamo_Log.logError('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
116
+
108
117
  throw new Dynamo_Error({
109
- errorCode: 'NTS-ES4-102',
118
+ errorCode: 'NTS-ES4-103',
110
119
  addECToUserMsg: true,
111
120
  message: `TemplateProperties missing! properties needed: ${props}`,
112
121
  userMessage: this.defaultErrorUserMsg
@@ -114,19 +123,12 @@ export class DynamoNTS_EmailService {
114
123
  }
115
124
  this.templatePropertyKeys[set.useTemplate].forEach((propertyKey: string) => {
116
125
  if (!set.templateProperties[propertyKey]) {
117
- DynamoNTS_Shared.logError(`TemplateProperty missing! (${propertyKey})`);
126
+ Dynamo_Log.logError(`TemplateProperty missing! (${propertyKey})`);
118
127
  }
119
128
  const reg = new RegExp(`{{${propertyKey}}}`, 'g')
120
129
  content = content.replace(reg, set.templateProperties[propertyKey]);
121
130
  });
122
131
  }
123
- } else {
124
- throw new Dynamo_Error({
125
- errorCode: 'NTS-ES4-100',
126
- addECToUserMsg: true,
127
- message: 'No content setting passsed to emailSending!',
128
- userMessage: this.defaultErrorUserMsg,
129
- });
130
132
  }
131
133
 
132
134
  let mailOptions: MailOptions = {
@@ -148,8 +150,13 @@ export class DynamoNTS_EmailService {
148
150
  });
149
151
  });
150
152
  } catch (error) {
151
- DynamoNTS_Shared.logError('\nDynamoBEEmailService ERROR: email sending error', error);
152
- throw error;
153
+ throw new Dynamo_Error({
154
+ errorCode: 'NTS-ES4-100',
155
+ addECToUserMsg: true,
156
+ message: `SendEmail failed!`,
157
+ userMessage: this.defaultErrorUserMsg,
158
+ error
159
+ });
153
160
  }
154
161
  }
155
162
 
@@ -167,7 +174,7 @@ export class DynamoNTS_EmailService {
167
174
  templatePath = Path.join(rootPath, templatePath);
168
175
  FileSystem.readFile(templatePath, 'utf8' , (err, template) => {
169
176
  if (err) {
170
- DynamoNTS_Shared.logError(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
177
+ Dynamo_Log.logError(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
171
178
  reject(err);
172
179
  return;
173
180
  } else {
@@ -183,7 +190,7 @@ export class DynamoNTS_EmailService {
183
190
  });
184
191
  });
185
192
  } catch (error) {
186
- DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
193
+ Dynamo_Log.logError(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
187
194
  }
188
195
  }
189
196
 
@@ -197,9 +204,10 @@ export class DynamoNTS_EmailService {
197
204
  const propertyKeys: string[] = [];
198
205
  let propertyOpenTagIndex = template.indexOf('{{');
199
206
  let propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
207
+
200
208
  while (propertyOpenTagIndex >= 0) {
201
209
  if (propertyCloseTagIndex === -1) {
202
- DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
210
+ Dynamo_Log.logError(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
203
211
  throw new Dynamo_Error({
204
212
  errorCode: 'NTS-ES4-200',
205
213
  addECToUserMsg: true,
@@ -207,17 +215,19 @@ export class DynamoNTS_EmailService {
207
215
  userMessage: this.defaultErrorUserMsg
208
216
  });
209
217
  }
218
+
210
219
  const newKey: string = template.substring(propertyOpenTagIndex + 2, propertyCloseTagIndex);
211
220
  if (!propertyKeys.includes(newKey)) {
212
221
  propertyKeys.push(newKey);
213
222
  }
223
+
214
224
  propertyOpenTagIndex = template.indexOf('{{', propertyOpenTagIndex + 2);
215
225
  propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
216
226
  }
217
227
  // console.log('\n\n\nTEST propertyKeys: ', propertyKeys);
218
228
  return propertyKeys;
219
229
  } catch (error) {
220
- DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
230
+ Dynamo_Log.logError(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
221
231
  }
222
232
  }
223
233
  }
@@ -1,12 +1,11 @@
1
1
 
2
2
 
3
- import { Dynamo_Metadata, DynamoNTS_DataParams } from '@futdevpro/fsm-dynamo';
3
+ import { Dynamo_Metadata, DynamoNTS_DataParams, Dynamo_Log } from '@futdevpro/fsm-dynamo';
4
4
 
5
5
  import { DynamoNTS_AuthService } from './dynamo-nts-auth.service';
6
6
  import { DynamoNTS_DBServiceCollection } from './dynamo-nts-db-service-collection.service';
7
7
  import { DynamoNTS_DBService } from './dynamo-nts-db.service';
8
8
  import { DynamoNTS_EmailServiceCollection } from './dynamo-nts-email-service-collection.service';
9
- import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
10
9
  import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
11
10
  import { DynamoNTS_SocketServiceCollection } from './dynamo-nts-socket-service-collection.service';
12
11
  import { DynamoNTS_SocketService } from './dynamo-nts-socket.service';
@@ -57,14 +56,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
57
56
  try {
58
57
  this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
59
58
  } catch (error) {
60
- DynamoNTS_Shared.logError(`\nFailed to create DynamoBEDBService (${dbModel.dataName}).\n`, dbModel, `\n`, error);
59
+ Dynamo_Log.logError(`\nFailed to create DynamoBEDBService (${dbModel.dataName}).\n`, dbModel, `\n`, error);
61
60
  }
62
61
  });
63
62
 
64
63
  this.instance.authService = set.authService;
65
64
  this.instance.emailServiceCollection = set.emailServiceCollection;
66
65
  } catch (error) {
67
- DynamoNTS_Shared.logError('\nsetServices failed on DBE_Global_S.\n', error);
66
+ Dynamo_Log.logError('\nsetServices failed on DBE_Global_S.\n', error);
68
67
  }
69
68
  }
70
69
 
@@ -1,13 +1,12 @@
1
1
 
2
2
  import { Router } from 'express';
3
- import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
3
+ import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
4
4
 
5
5
  import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global-settings';
6
6
  import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
7
7
  import { HttpCallType } from '../_enums/http/http-call-type.enum';
8
8
  import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
9
9
  import { DynamoNTS_Controller } from './dynamo-nts-controller.service';
10
- import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
11
10
  import { DynamoNTS_RoutingModuleSettings } from '../_models/dynamo-nts-routing-module-settings';
12
11
 
13
12
  /**
@@ -78,7 +77,7 @@ export class DynamoNTS_RoutingModule {
78
77
 
79
78
  if (this.log) console.log(`routing module setup done: ${this.route} serurity: ${this.security}\n`);
80
79
  } catch (error) {
81
- DynamoNTS_Shared.logError(`Routing module setup failed (${this.route})`, error);
80
+ Dynamo_Log.logError(`Routing module setup failed (${this.route})`, error);
82
81
  }
83
82
  }
84
83
 
@@ -2,12 +2,11 @@
2
2
  import * as SocketIO from 'socket.io';
3
3
 
4
4
  import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global-settings';
5
- import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
6
5
  import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
7
6
  import { DynamoNTS_SocketEventParams } from '../_models/dynamo-nts-socket-event-params';
8
7
  import { DynamoNTS_SocketEvent } from '../_enums/http/socket-event.enum';
9
8
  import { DynamoNTS_GlobalService } from './dynamo-nts-global.service';
10
- import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
9
+ import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
11
10
  import { DynamoNTS_SocketServiceParams } from '../_models/dynamo-nts-socket-service-params';
12
11
  import { DynamoNTS_SocketDictionary } from '../_models/dynamo-nts-socket-dictionary';
13
12
  import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
@@ -46,7 +45,7 @@ export abstract class DynamoNTS_SocketService<T extends DynamoNTS_SocketDictiona
46
45
 
47
46
  if (this.log) console.log(`Socket Controller setup done: ${this.params.name} (${this.params.port}) serurity: ${this.params.security}\n`);
48
47
  } catch (error) {
49
- DynamoNTS_Shared.logError(`Socket Controller setup failed: ${this.params.name} (${this.params.port})`, error);
48
+ Dynamo_Log.logError(`Socket Controller setup failed: ${this.params.name} (${this.params.port})`, error);
50
49
  }
51
50
  }
52
51
 
package/src/version.json DELETED
@@ -1,2 +0,0 @@
1
-
2
- "v01.04.03"