@futdevpro/nts-dynamo 1.5.64 → 1.5.65

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 (44) hide show
  1. package/lib/_models/dynamo-nts-endpoint-params.js +8 -8
  2. package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -1
  3. package/lib/_models/dynamo-nts-socket-event-params.js +1 -1
  4. package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
  5. package/lib/_models/dynamo-nts-socket-service-params.js +1 -1
  6. package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
  7. package/lib/_services/dynamo-nts-api.service.js +8 -8
  8. package/lib/_services/dynamo-nts-api.service.js.map +1 -1
  9. package/lib/_services/dynamo-nts-app-extended.js +3 -3
  10. package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
  11. package/lib/_services/dynamo-nts-app.js +12 -12
  12. package/lib/_services/dynamo-nts-app.js.map +1 -1
  13. package/lib/_services/dynamo-nts-auth.service.d.ts +4 -4
  14. package/lib/_services/dynamo-nts-controller.service.js +1 -1
  15. package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
  16. package/lib/_services/dynamo-nts-data.service.js +6 -6
  17. package/lib/_services/dynamo-nts-data.service.js.map +1 -1
  18. package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
  19. package/lib/_services/dynamo-nts-db.service.js +120 -119
  20. package/lib/_services/dynamo-nts-db.service.js.map +1 -1
  21. package/lib/_services/dynamo-nts-email.service.js +8 -8
  22. package/lib/_services/dynamo-nts-email.service.js.map +1 -1
  23. package/lib/_services/dynamo-nts-global.service.js +2 -2
  24. package/lib/_services/dynamo-nts-global.service.js.map +1 -1
  25. package/lib/_services/dynamo-nts-routing-module.service.js +1 -1
  26. package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
  27. package/lib/_services/dynamo-nts-socket.service.js +1 -1
  28. package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
  29. package/lib/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +1 -1
  31. package/src/_models/dynamo-nts-endpoint-params.ts +8 -8
  32. package/src/_models/dynamo-nts-socket-event-params.ts +1 -1
  33. package/src/_models/dynamo-nts-socket-service-params.ts +1 -1
  34. package/src/_services/dynamo-nts-api.service.ts +8 -8
  35. package/src/_services/dynamo-nts-app-extended.ts +3 -3
  36. package/src/_services/dynamo-nts-app.ts +12 -12
  37. package/src/_services/dynamo-nts-auth.service.ts +4 -4
  38. package/src/_services/dynamo-nts-controller.service.ts +1 -1
  39. package/src/_services/dynamo-nts-data.service.ts +6 -6
  40. package/src/_services/dynamo-nts-db.service.ts +30 -29
  41. package/src/_services/dynamo-nts-email.service.ts +8 -8
  42. package/src/_services/dynamo-nts-global.service.ts +2 -2
  43. package/src/_services/dynamo-nts-routing-module.service.ts +1 -1
  44. package/src/_services/dynamo-nts-socket.service.ts +1 -1
@@ -53,7 +53,7 @@ export class DynamoNTS_ApiService {
53
53
  if (callParams.httpOptions.headers[headerKey]) {
54
54
  privateAxiosInstance.defaults.headers.common[headerKey] = callParams.httpOptions.headers[headerKey];
55
55
  } else {
56
- Dynamo_Log.logError('DYNAMOBE ERROR: \n missing header:', headerKey, '\n\n', new Error());
56
+ Dynamo_Log.error('DYNAMOBE ERROR: \n missing header:', headerKey, '\n\n', new Error());
57
57
  }
58
58
  }
59
59
  }
@@ -70,11 +70,11 @@ export class DynamoNTS_ApiService {
70
70
  url = url.replace(`:${pathParamKey}`, inputParams.pathParams[pathParamKey]);
71
71
  break;
72
72
  default:
73
- Dynamo_Log.logError(`DYNAMOBE ERROR: \n wrong path param type: (${pathParamKey}): ${paramType} \n${inputParams.pathParams[pathParamKey]}\nMUST BE string or number\n\n`, new Error());
73
+ Dynamo_Log.error(`DYNAMOBE ERROR: \n wrong path param type: (${pathParamKey}): ${paramType} \n${inputParams.pathParams[pathParamKey]}\nMUST BE string or number\n\n`, new Error());
74
74
  break;
75
75
  }
76
76
  } else {
77
- Dynamo_Log.logError('DYNAMOBE ERROR: \n missing pathParam:', pathParamKey, '\n\n', new Error());
77
+ Dynamo_Log.error('DYNAMOBE ERROR: \n missing pathParam:', pathParamKey, '\n\n', new Error());
78
78
  }
79
79
  }
80
80
  }
@@ -143,7 +143,7 @@ export class DynamoNTS_ApiService {
143
143
  });
144
144
  break;
145
145
  default:
146
- Dynamo_Log.logError('DYNAMOBE ERROR: \n wrong api call type', '\n\n', new Error());
146
+ Dynamo_Log.error('DYNAMOBE ERROR: \n wrong api call type', '\n\n', new Error());
147
147
  break;
148
148
  }
149
149
 
@@ -153,7 +153,7 @@ export class DynamoNTS_ApiService {
153
153
  return a as T;
154
154
  }
155
155
  } catch (error) {
156
- Dynamo_Log.logError(`\nAPI ERROR: ${callParams?.name} failed...` +
156
+ Dynamo_Log.error(`\nAPI ERROR: ${callParams?.name} failed...` +
157
157
  `\n${callParams?.baseUrl}${callParams?.endPoint}`);
158
158
 
159
159
  if (callParams?.httpOptions?.responseType === HttpResponseType.text) {
@@ -161,7 +161,7 @@ export class DynamoNTS_ApiService {
161
161
  }
162
162
 
163
163
  if (error?.response?.data?.flag === 'DYNAMO ERROR OBJECT') {
164
- Dynamo_Log.logError(`\n${callParams.name} was UNSUCCESSFUL\n\n`, new Error());
164
+ Dynamo_Log.error(`\n${callParams.name} was UNSUCCESSFUL\n\n`, new Error());
165
165
 
166
166
  throw new Dynamo_Error({
167
167
  errorCode: 'NTS-API-002',
@@ -171,7 +171,7 @@ export class DynamoNTS_ApiService {
171
171
  error: error.response.data
172
172
  });
173
173
  } else if (error.code === 'ENOTFOUND') {
174
- Dynamo_Log.logError(`\n${callParams.name} was UNSUCCESSFUL\n\n`, new Error());
174
+ Dynamo_Log.error(`\n${callParams.name} was UNSUCCESSFUL\n\n`, new Error());
175
175
 
176
176
  throw new Dynamo_Error({
177
177
  status: 404,
@@ -191,7 +191,7 @@ export class DynamoNTS_ApiService {
191
191
  error
192
192
  });
193
193
  } else {
194
- Dynamo_Log.logError(`\n${callParams.name} was UNSUCCESSFUL`, error, '\n\n', new Error());
194
+ Dynamo_Log.error(`\n${callParams.name} was UNSUCCESSFUL`, error, '\n\n', new Error());
195
195
 
196
196
  throw error;
197
197
  }
@@ -134,13 +134,13 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
134
134
 
135
135
  if (this.debugLog) console.log(`\nAll sockets setted up.... sockets using security: ${this.socketSecurity}`);
136
136
  } else {
137
- Dynamo_Log.logWarning(
137
+ Dynamo_Log.warn(
138
138
  '\nNo socketServices setted up while using Extended Application.',
139
139
  '\nYou should use DynamoNTS_App if you don`t need socket services.\n'
140
140
  );
141
141
  }
142
142
  } catch (error) {
143
- Dynamo_Log.logError('\nExtended Application start failed.\n', error, '\n');
143
+ Dynamo_Log.error('\nExtended Application start failed.\n', error, '\n');
144
144
  }
145
145
  }
146
146
 
@@ -188,7 +188,7 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
188
188
  errorMsg += `\n ${service.name} (port: ${service.port})`;
189
189
  }
190
190
  });
191
- Dynamo_Log.logError(errorMsg);
191
+ Dynamo_Log.error(errorMsg);
192
192
 
193
193
  let error = new Error('Secure routes cannot be established!');
194
194
  let errorStack: string[] = error.stack.split('\n');
@@ -204,7 +204,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
204
204
  if (this.debugLog) console.log(`\nRoutes mounted.... server using security: ${this.security}`);
205
205
  }
206
206
  } catch (error) {
207
- Dynamo_Log.logError('\nApplication start failed.\n', error);
207
+ Dynamo_Log.error('\nApplication start failed.\n', error);
208
208
  }
209
209
  }
210
210
 
@@ -214,10 +214,10 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
214
214
  private startDB(): void {
215
215
  this.mongoose.connection
216
216
  .on('error', (error) => {
217
- Dynamo_Log.logError('\nUnable to connect to MongoDB server, ERROR: ', error);
217
+ Dynamo_Log.error('\nUnable to connect to MongoDB server, ERROR: ', error);
218
218
  })
219
219
  .once('open', () => {
220
- Dynamo_Log.logSuccess('\nConnected to MongoDB\n');
220
+ Dynamo_Log.success('\nConnected to MongoDB\n');
221
221
  });
222
222
 
223
223
  this.mongoose.connect(
@@ -251,7 +251,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
251
251
  });
252
252
  }
253
253
  });
254
- Dynamo_Log.logError(errorMsg);
254
+ Dynamo_Log.error(errorMsg);
255
255
 
256
256
  let error = new Error('Open routes cannot be established!');
257
257
  let errorStack: string[] = error.stack.split('\n');
@@ -288,7 +288,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
288
288
  });
289
289
  }
290
290
  });
291
- Dynamo_Log.logError(errorMsg);
291
+ Dynamo_Log.error(errorMsg);
292
292
 
293
293
  let error = new Error('Secure routes cannot be established!');
294
294
  let errorStack: string[] = error.stack.split('\n');
@@ -334,30 +334,30 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
334
334
  if (this.security !== DynamoNTS_RouteSecurity.open) {
335
335
  this.httpsServer
336
336
  .listen(this.httpsPort, 'localhost', 0, () => {
337
- Dynamo_Log.logSuccess(`\nHTTPS (secure) server is listening on port ${this.httpsPort}\n`);
337
+ Dynamo_Log.success(`\nHTTPS (secure) server is listening on port ${this.httpsPort}\n`);
338
338
  })
339
339
  .on('error', (error) => {
340
- Dynamo_Log.logError(`\nHTTPS (secure) server ERROR`, error);
340
+ Dynamo_Log.error(`\nHTTPS (secure) server ERROR`, error);
341
341
  })
342
342
  .on('uncaughtException', (ex) => {
343
- Dynamo_Log.logWarning(`\nHTTPS (secure) server uncaughtException`, ex);
343
+ Dynamo_Log.warn(`\nHTTPS (secure) server uncaughtException`, ex);
344
344
  });
345
345
  }
346
346
 
347
347
  if (this.security !== DynamoNTS_RouteSecurity.secure) {
348
348
  this.openExpress
349
349
  .listen(this.httpPort, () => {
350
- Dynamo_Log.logSuccess(`\nHTTP (-open-) server is listening on port ${this.httpPort}\n`);
350
+ Dynamo_Log.success(`\nHTTP (-open-) server is listening on port ${this.httpPort}\n`);
351
351
  })
352
352
  .on('error', (error) => {
353
- Dynamo_Log.logError(`\nHTTP (-open-) server ERROR`, error);
353
+ Dynamo_Log.error(`\nHTTP (-open-) server ERROR`, error);
354
354
  })
355
355
  .on('uncaughtException', (ex) => {
356
- Dynamo_Log.logWarning(`\nHTTP (-open-) server uncaughtException`, ex);
356
+ Dynamo_Log.warn(`\nHTTP (-open-) server uncaughtException`, ex);
357
357
  });
358
358
  }
359
359
  } catch (error) {
360
- Dynamo_Log.logError(`startExpresses failed...`, error);
360
+ Dynamo_Log.error(`startExpresses failed...`, error);
361
361
  }
362
362
  }
363
363
 
@@ -67,7 +67,7 @@ export abstract class DynamoNTS_AuthService extends DynamoNTS_SingletonService {
67
67
  * let token = AuthService.getTokenFromRequest(req);
68
68
  * token = await AuthService.verifyToken(token);
69
69
  *
70
- * Dynamo_Log.logSuccess('token authenticated');
70
+ * Dynamo_Log.success('token authenticated');
71
71
  * res.setHeader('authorization', `Bearer ${token}`);
72
72
  * next();
73
73
  * } catch (error) {
@@ -78,7 +78,7 @@ export abstract class DynamoNTS_AuthService extends DynamoNTS_SingletonService {
78
78
  * userMessage: `Authorization failed.`,
79
79
  * error
80
80
  * });
81
- * Dynamo_Log.logError(error?.message, error);
81
+ * Dynamo_Log.error(error?.message, error);
82
82
  *
83
83
  * res.status(error.status);
84
84
  * res.send(error);
@@ -101,7 +101,7 @@ export abstract class DynamoNTS_AuthService extends DynamoNTS_SingletonService {
101
101
  * try {
102
102
  * let token = AuthService.getTokenFromRequest(req);
103
103
  * token = await AuthService.verifyTokenSelf(token, req?.params?.userId);
104
- * Dynamo_Log.logSuccess('selftoken authenticated');
104
+ * Dynamo_Log.success('selftoken authenticated');
105
105
  *
106
106
  * res.setHeader('authorization', `Bearer ${token}`);
107
107
  * next();
@@ -113,7 +113,7 @@ export abstract class DynamoNTS_AuthService extends DynamoNTS_SingletonService {
113
113
  * userMessage: `Authorization failed.`,
114
114
  * error
115
115
  * });
116
- * Dynamo_Log.logError(error?.message, error);
116
+ * Dynamo_Log.error(error?.message, error);
117
117
  *
118
118
  * res.status(error.status);
119
119
  * res.send(error);
@@ -81,7 +81,7 @@ export abstract class DynamoNTS_Controller extends DynamoNTS_SingletonService {
81
81
  try {
82
82
  this.setupEndpoints();
83
83
  } catch (error) {
84
- Dynamo_Log.logError(`DynamoBEController ERROR setup failed:`, error);
84
+ Dynamo_Log.error(`DynamoBEController ERROR setup failed:`, error);
85
85
  }
86
86
  }
87
87
 
@@ -70,7 +70,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
70
70
  try {
71
71
  const dataListExists: T[] = await this.dataDBService.getAll().catch(error => {
72
72
  if (error?.errorCode === 'NTS-DBS-GA1') {
73
- Dynamo_Log.logWarning(`getAll ${this.dataParams.dataName} didn't found any.`);
73
+ Dynamo_Log.warn(`getAll ${this.dataParams.dataName} didn't found any.`);
74
74
  return [];
75
75
  } else {
76
76
  throw error;
@@ -122,7 +122,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
122
122
 
123
123
  const dataExists: T = await this.dataDBService.getDataById(id ?? this.data._id).catch(error => {
124
124
  if (error?.errorCode == 'NTS-DBS-GI1') {
125
- Dynamo_Log.logWarning(`getDataById ${this.dataParams.dataName} (${id ?? this.data._id}) didn't found any.`);
125
+ Dynamo_Log.warn(`getDataById ${this.dataParams.dataName} (${id ?? this.data._id}) didn't found any.`);
126
126
  return null;
127
127
  } else {
128
128
  throw error;
@@ -177,7 +177,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
177
177
 
178
178
  const dataExists: T = await this.dataDBService.getDataByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
179
179
  if (error?.errorCode === 'NTS-DBS-GD2') {
180
- Dynamo_Log.logWarning(`getDataByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
180
+ Dynamo_Log.warn(`getDataByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
181
181
  return null;
182
182
  } else {
183
183
  throw error;
@@ -232,7 +232,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
232
232
 
233
233
  const dataListExists: T[] = await this.dataDBService.getDataListByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
234
234
  if (error?.errorCode === 'NTS-DBS-GLD2') {
235
- Dynamo_Log.logWarning(`getDataListByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
235
+ Dynamo_Log.warn(`getDataListByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
236
236
  return [];
237
237
  } else {
238
238
  throw error;
@@ -293,7 +293,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
293
293
  try {
294
294
  const dataExists: T = await this.dataDBService.findOne(findBy).catch(error => {
295
295
  if (error?.errorCode === 'NTS-DBS-FO1') {
296
- Dynamo_Log.logWarning(`findData ${this.dataParams.dataName} didn't found any.`);
296
+ Dynamo_Log.warn(`findData ${this.dataParams.dataName} didn't found any.`);
297
297
  return null;
298
298
  } else {
299
299
  throw error;
@@ -350,7 +350,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
350
350
  try {
351
351
  const dataListExists: T[] = await this.dataDBService.find(findBy).catch(error => {
352
352
  if (error?.errorCode === 'NTS-DBS-F1') {
353
- Dynamo_Log.logWarning(`findDatas ${this.dataParams.dataName} didn't found any.`);
353
+ Dynamo_Log.warn(`findDatas ${this.dataParams.dataName} didn't found any.`);
354
354
  return [];
355
355
  } else {
356
356
  throw error;
@@ -86,7 +86,8 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
86
86
 
87
87
  const dataModel = new this.dataModel(data);
88
88
  let newData: T = await this.dataModel.findByIdAndUpdate(data._id, dataModel).then(res => {
89
- if (res) {
89
+ return res?.toObject() as T ?? null;
90
+ /* if (res) {
90
91
  return res.toObject() as T;
91
92
  } else {
92
93
  throw new Dynamo_Error({
@@ -96,7 +97,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
96
97
  message: `update ${this.dataParams.dbName} result not found! (NTS DB)`,
97
98
  userMessage: this.defaultErrorUserMsg
98
99
  });
99
- }
100
+ } */
100
101
  }).catch(error => {
101
102
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
102
103
  throw error;
@@ -129,10 +130,10 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
129
130
  */
130
131
  async getDataById(id: string): Promise<T> {
131
132
  let data: T = await this.dataModel.findById(id).then(res => {
132
- if (res) {
133
+ return res?.toObject() as T ?? null;
134
+ /* if (res) {
133
135
  return res.toObject() as T;
134
136
  } else {
135
- /* return null; */
136
137
  throw new Dynamo_Error({
137
138
  status: 417,
138
139
  errorCode: 'NTS-DBS-GI1',
@@ -140,7 +141,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
140
141
  message: `get ${this.dataParams.dbName} by ID was unsuccessful: data not found by id: ${id} (NTS DB)`,
141
142
  userMessage: this.defaultErrorUserMsg
142
143
  });
143
- }
144
+ } */
144
145
  }).catch(error => {
145
146
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
146
147
  throw error;
@@ -182,10 +183,10 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
182
183
  }
183
184
 
184
185
  let data: T = await this.dataModel.findOne({ [this.depDataName]: dependencyId }).then(res => {
185
- if (res) {
186
+ return res.toObject() as T ?? null;
187
+ /* if (res) {
186
188
  return res.toObject() as T;
187
189
  } else {
188
- /* return null; */
189
190
  throw new Dynamo_Error({
190
191
  status: 417,
191
192
  errorCode: 'NTS-DBS-GD2',
@@ -193,7 +194,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
193
194
  message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful: data not found by id: ${dependencyId} (NTS DB)`,
194
195
  userMessage: this.defaultErrorUserMsg
195
196
  });
196
- }
197
+ } */
197
198
  }).catch(error => {
198
199
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
199
200
  throw error;
@@ -234,12 +235,11 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
234
235
  });
235
236
  }
236
237
 
237
- let dataList: T[] = await this.dataModel.find({ [this.depDataName]: dependencyId })
238
- .then(res => {
239
- if (res) {
238
+ let dataList: T[] = await this.dataModel.find({ [this.depDataName]: dependencyId }).then(res => {
239
+ return res as T[] ?? [];
240
+ /* if (res) {
240
241
  return res as T[];
241
242
  } else {
242
- /* return []; */
243
243
  throw new Dynamo_Error({
244
244
  status: 417,
245
245
  errorCode: 'NTS-DBS-GLD2',
@@ -247,7 +247,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
247
247
  message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful: no data found by id: ${dependencyId} (NTS DB)`,
248
248
  userMessage: this.defaultErrorUserMsg
249
249
  });
250
- }
250
+ } */
251
251
  }).catch(error => {
252
252
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
253
253
  throw error;
@@ -292,12 +292,11 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
292
292
  });
293
293
  }
294
294
 
295
- let dataList: T[] = await this.dataModel.find({ [this.depDataName]: { $in: ids }})
296
- .then(res => {
297
- if (res) {
295
+ let dataList: T[] = await this.dataModel.find({ [this.depDataName]: { $in: ids }}).then(res => {
296
+ return res as T[] ?? [];
297
+ /* if (res) {
298
298
  return res as T[];
299
299
  } else {
300
- /* return []; */
301
300
  throw new Dynamo_Error({
302
301
  status: 417,
303
302
  errorCode: 'NTS-DBS-GLDS2',
@@ -305,7 +304,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
305
304
  message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful: no data found by ids: ${ids} (NTS DB)`,
306
305
  userMessage: this.defaultErrorUserMsg
307
306
  });
308
- }
307
+ } */
309
308
  }).catch(error => {
310
309
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
311
310
  throw error;
@@ -437,10 +436,10 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
437
436
  async getAll(): Promise<T[]> {
438
437
  let dataList: T[] = await this.dataModel.find({})
439
438
  .then(res => {
440
- if (res) {
439
+ return res as T[] ?? [];
440
+ /* if (res) {
441
441
  return res as T[];
442
442
  } else {
443
- /* return null; */
444
443
  throw new Dynamo_Error({
445
444
  status: 417,
446
445
  errorCode: 'NTS-DBS-GA1',
@@ -448,7 +447,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
448
447
  message: `get all ${this.dataParams.dbName} was unsuccessful: no data found (NTS DB)`,
449
448
  userMessage: this.defaultErrorUserMsg
450
449
  });
451
- }
450
+ } */
452
451
  }).catch(error => {
453
452
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
454
453
  throw error;
@@ -550,10 +549,11 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
550
549
  */
551
550
  async findOne(filter: any): Promise<T> {
552
551
  let data: T = await this.dataModel.findOne(filter).then(res => {
553
- if (res) {
552
+ return res as T ?? null;
553
+ /* if (res) {
554
554
  return res as T;
555
555
  } else {
556
- /* return null; */
556
+ return null;
557
557
  throw new Dynamo_Error({
558
558
  status: 417,
559
559
  errorCode: 'NTS-DBS-FO1',
@@ -561,7 +561,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
561
561
  message: `findOne ${this.dataParams.dbName} was unsuccessful, no data found (NTS DB) fliter: ${filter}`,
562
562
  userMessage: this.defaultErrorUserMsg
563
563
  });
564
- }
564
+ } */
565
565
  }).catch(error => {
566
566
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
567
567
  throw error;
@@ -614,10 +614,10 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
614
614
  async find(filter: any): Promise<T[]> {
615
615
  let dataList: T[] = await this.dataModel.find(filter)
616
616
  .then(res => {
617
- if (res) {
617
+ return res as T[] ?? [];
618
+ /* if (res) {
618
619
  return res as T[];
619
620
  } else {
620
- /* return null; */
621
621
  throw new Dynamo_Error({
622
622
  status: 417,
623
623
  errorCode: 'NTS-DBS-F1',
@@ -625,7 +625,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
625
625
  message: `find ${this.dataParams.dbName} was unsuccessful, no data found (NTS DB) fliter: ${filter}`,
626
626
  userMessage: this.defaultErrorUserMsg
627
627
  });
628
- }
628
+ } */
629
629
  }).catch(error => {
630
630
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
631
631
  throw error;
@@ -727,7 +727,8 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
727
727
  update.__lastModifiedBy = modifier;
728
728
 
729
729
  let newData: T = await this.dataModel.findByIdAndUpdate(id, update).then(res => {
730
- if (res) {
730
+ return res.toObject() as T ?? null;
731
+ /* if (res) {
731
732
  return res.toObject() as T;
732
733
  } else {
733
734
  throw new Dynamo_Error({
@@ -737,7 +738,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
737
738
  message: `${this.dataParams.dbName} not found! (by id: ${id}) (NTS DB)`,
738
739
  userMessage: this.defaultErrorUserMsg
739
740
  });
740
- }
741
+ } */
741
742
  }).catch(error => {
742
743
  if (error?.flag == 'DYNAMO ERROR OBJECT') {
743
744
  throw error;
@@ -57,7 +57,7 @@ export class DynamoNTS_EmailService {
57
57
  this.constructionFinished();
58
58
  }
59
59
  } catch (error) {
60
- Dynamo_Log.logError(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
60
+ Dynamo_Log.error(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
61
61
  }
62
62
  }
63
63
 
@@ -65,7 +65,7 @@ export class DynamoNTS_EmailService {
65
65
  *
66
66
  */
67
67
  private constructionFinished(): void {
68
- Dynamo_Log.logSuccess(`\nEmailService construction (${this.senderName}) Finished!\n`)
68
+ Dynamo_Log.success(`\nEmailService construction (${this.senderName}) Finished!\n`)
69
69
  }
70
70
 
71
71
  /**
@@ -114,7 +114,7 @@ export class DynamoNTS_EmailService {
114
114
  this.templatePropertyKeys[set.useTemplate].forEach((key: string, index: number) => {
115
115
  props += `${key}${index != this.templatePropertyKeys[set.useTemplate].length - 1 ? ', ' : ''}`;
116
116
  });
117
- Dynamo_Log.logError('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
117
+ Dynamo_Log.error('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
118
118
 
119
119
  throw new Dynamo_Error({
120
120
  errorCode: 'NTS-ES4-103',
@@ -125,7 +125,7 @@ export class DynamoNTS_EmailService {
125
125
  }
126
126
  this.templatePropertyKeys[set.useTemplate].forEach((propertyKey: string) => {
127
127
  if (!set.templateProperties[propertyKey]) {
128
- Dynamo_Log.logError(`TemplateProperty missing! (${propertyKey})`);
128
+ Dynamo_Log.error(`TemplateProperty missing! (${propertyKey})`);
129
129
  }
130
130
  const reg = new RegExp(`{{${propertyKey}}}`, 'g')
131
131
  content = content.replace(reg, set.templateProperties[propertyKey]);
@@ -176,7 +176,7 @@ export class DynamoNTS_EmailService {
176
176
  templatePath = Path.join(rootPath, templatePath);
177
177
  FileSystem.readFile(templatePath, 'utf8' , (err, template) => {
178
178
  if (err) {
179
- Dynamo_Log.logError(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
179
+ Dynamo_Log.error(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
180
180
  reject(err);
181
181
  return;
182
182
  } else {
@@ -192,7 +192,7 @@ export class DynamoNTS_EmailService {
192
192
  });
193
193
  });
194
194
  } catch (error) {
195
- Dynamo_Log.logError(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
195
+ Dynamo_Log.error(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
196
196
  }
197
197
  }
198
198
 
@@ -209,7 +209,7 @@ export class DynamoNTS_EmailService {
209
209
 
210
210
  while (propertyOpenTagIndex >= 0) {
211
211
  if (propertyCloseTagIndex === -1) {
212
- Dynamo_Log.logError(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
212
+ Dynamo_Log.error(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
213
213
  throw new Dynamo_Error({
214
214
  errorCode: 'NTS-ES4-200',
215
215
  addECToUserMsg: true,
@@ -229,7 +229,7 @@ export class DynamoNTS_EmailService {
229
229
  // console.log('\n\n\nTEST propertyKeys: ', propertyKeys);
230
230
  return propertyKeys;
231
231
  } catch (error) {
232
- Dynamo_Log.logError(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
232
+ Dynamo_Log.error(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
233
233
  }
234
234
  }
235
235
  }
@@ -56,14 +56,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
56
56
  try {
57
57
  this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
58
58
  } catch (error) {
59
- Dynamo_Log.logError(`\nFailed to create DynamoBEDBService (${dbModel.dataName}).\n`, dbModel, `\n`, error);
59
+ Dynamo_Log.error(`\nFailed to create DynamoBEDBService (${dbModel.dataName}).\n`, dbModel, `\n`, error);
60
60
  }
61
61
  });
62
62
 
63
63
  this.instance.authService = set.authService;
64
64
  this.instance.emailServiceCollection = set.emailServiceCollection;
65
65
  } catch (error) {
66
- Dynamo_Log.logError('\nsetServices failed on DBE_Global_S.\n', error);
66
+ Dynamo_Log.error('\nsetServices failed on DBE_Global_S.\n', error);
67
67
  }
68
68
  }
69
69
 
@@ -79,7 +79,7 @@ export class DynamoNTS_RoutingModule {
79
79
 
80
80
  if (this.log) console.log(`routing module setup done: ${this.route} serurity: ${this.security}\n`);
81
81
  } catch (error) {
82
- Dynamo_Log.logError(`Routing module setup failed (${this.route})`, error);
82
+ Dynamo_Log.error(`Routing module setup failed (${this.route})`, error);
83
83
  }
84
84
  }
85
85
 
@@ -47,7 +47,7 @@ export abstract class DynamoNTS_SocketService<T extends DynamoNTS_SocketDictiona
47
47
 
48
48
  if (this.log) console.log(`Socket Controller setup done: ${this.params.name} (${this.params.port}) serurity: ${this.params.security}\n`);
49
49
  } catch (error) {
50
- Dynamo_Log.logError(`Socket Controller setup failed: ${this.params.name} (${this.params.port})`, error);
50
+ Dynamo_Log.error(`Socket Controller setup failed: ${this.params.name} (${this.params.port})`, error);
51
51
  }
52
52
  }
53
53