@futdevpro/nts-dynamo 1.9.8 → 1.9.9
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.
- package/build/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/endpoint-params.control-model.js +6 -0
- package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +16 -5
- package/build/_services/base/data.service.js.map +1 -1
- package/build/_services/base/db.service.d.ts.map +1 -1
- package/build/_services/base/db.service.js +13 -3
- package/build/_services/base/db.service.js.map +1 -1
- package/build/_services/core/api.service.d.ts.map +1 -1
- package/build/_services/core/api.service.js +37 -10
- package/build/_services/core/api.service.js.map +1 -1
- package/build/_services/core/global.service.d.ts.map +1 -1
- package/build/_services/core/global.service.js +4 -0
- package/build/_services/core/global.service.js.map +1 -1
- package/build/_services/server/app.server.d.ts.map +1 -1
- package/build/_services/server/app.server.js +6 -5
- package/build/_services/server/app.server.js.map +1 -1
- package/build/_services/socket/socket-client.service.d.ts.map +1 -1
- package/build/_services/socket/socket-client.service.js +4 -0
- package/build/_services/socket/socket-client.service.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_models/control-models/endpoint-params.control-model.ts +8 -0
- package/src/_services/base/data.service.ts +12 -3
- package/src/_services/base/db.service.ts +11 -3
- package/src/_services/core/api.service.ts +51 -16
- package/src/_services/core/global.service.ts +5 -0
- package/src/_services/server/app.server.ts +7 -5
- package/src/_services/socket/socket-client.service.ts +5 -0
package/package.json
CHANGED
|
@@ -230,6 +230,8 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
230
230
|
(error as DynamoFM_Error).additionalContent = {};
|
|
231
231
|
}
|
|
232
232
|
(error as DynamoFM_Error).additionalContent.endpointInfo = msg;
|
|
233
|
+
DynamoFM_Log.error(`ErrorMessage: ${(error as DynamoFM_Error)._message}`);
|
|
234
|
+
DynamoFM_Log.error(`ErrorCode: ${(error as DynamoFM_Error)._errorCode}`);
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
await DynamoNTS_GlobalService.globalErrorHandler?.(
|
|
@@ -262,6 +264,7 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
262
264
|
);
|
|
263
265
|
}
|
|
264
266
|
}
|
|
267
|
+
|
|
265
268
|
} catch (error) {
|
|
266
269
|
DynamoFM_Log.H_error(
|
|
267
270
|
`\n\nDYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams: error: ` +
|
|
@@ -271,6 +274,11 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
271
274
|
`\nERROR:`, error,
|
|
272
275
|
'\n'
|
|
273
276
|
);
|
|
277
|
+
|
|
278
|
+
if (error?.flag?.includes?.('DYNAMO-ERROR-OBJECT')) {
|
|
279
|
+
DynamoFM_Log.error(`ErrorMessage: ${(error as DynamoFM_Error)._message}`);
|
|
280
|
+
DynamoFM_Log.error(`ErrorCode: ${(error as DynamoFM_Error)._errorCode}`);
|
|
281
|
+
}
|
|
274
282
|
}
|
|
275
283
|
}
|
|
276
284
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {
|
|
3
3
|
DynamoFM_Metadata, DynamoFM_DataModel_Params, DynamoFM_DataProperty_Params, DynamoFM_Error,
|
|
4
|
-
DynamoFM_Log, DynamoFM_AnyError, DynamoFM_Error_Settings
|
|
4
|
+
DynamoFM_Log, DynamoFM_AnyError, DynamoFM_Error_Settings, DynamoFM_ErrorLevel
|
|
5
5
|
} from '@futdevpro/fsm-dynamo';
|
|
6
6
|
import { DynamoNTS_DBFilter } from '../../_models/types/db-filter.type';
|
|
7
7
|
import { DynamoNTS_DBUpdate } from '../../_models/types/db-update.type';
|
|
@@ -74,14 +74,23 @@ export class DynamoNTS_DataService<T extends DynamoFM_Metadata> {
|
|
|
74
74
|
this.lookForDependencyDataSettings();
|
|
75
75
|
this.issuer = issuer;
|
|
76
76
|
} catch (error) {
|
|
77
|
-
|
|
77
|
+
throw new DynamoFM_Error({
|
|
78
|
+
...this._getDefaultErrorSettings('constructor', error),
|
|
79
|
+
message: `The dataService construction failed for ${dataParams?.dataName}. ` +
|
|
80
|
+
`${this.serviceName} (${this.constructor.name})` +
|
|
81
|
+
`\nMaybe you forgot to add the dbService to the GlobalService?\n\n`,
|
|
82
|
+
level: DynamoFM_ErrorLevel.critical,
|
|
83
|
+
|
|
84
|
+
errorCode: 'NTS-DS0-C00',
|
|
85
|
+
});
|
|
86
|
+
/* DynamoFM_Log.error(
|
|
78
87
|
`\nDynamoNTS_DataService ERROR: ` +
|
|
79
88
|
`\nThe dataService construction failed for ` +
|
|
80
89
|
`${dataParams?.dataName}. ${this.serviceName} (${this.constructor.name})` +
|
|
81
90
|
`\nMaybe you forgot to add the dbService to the GlobalService?` +
|
|
82
91
|
`\n\n`,
|
|
83
92
|
new Error()
|
|
84
|
-
);
|
|
93
|
+
); */
|
|
85
94
|
}
|
|
86
95
|
}
|
|
87
96
|
|
|
@@ -4,7 +4,7 @@ import { Schema } from 'mongoose';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
DynamoFM_Metadata, DynamoFM_DataModel_Params, DynamoFM_DataProperty_Params, DynamoFM_Error,
|
|
7
|
-
DynamoFM_Log, DynamoFM_AnyError, DynamoFM_Error_Settings
|
|
7
|
+
DynamoFM_Log, DynamoFM_AnyError, DynamoFM_Error_Settings, DynamoFM_ErrorLevel
|
|
8
8
|
} from '@futdevpro/fsm-dynamo';
|
|
9
9
|
import { DynamoNTS_DBFilter } from '../../_models/types/db-filter.type';
|
|
10
10
|
import { DynamoNTS_DBUpdate } from '../../_models/types/db-update.type';
|
|
@@ -48,12 +48,20 @@ export class DynamoNTS_DBService<T extends DynamoFM_Metadata> {
|
|
|
48
48
|
|
|
49
49
|
this.lookForDependencyDataSettings();
|
|
50
50
|
} catch (error) {
|
|
51
|
-
|
|
51
|
+
throw new DynamoFM_Error({
|
|
52
|
+
message:
|
|
53
|
+
`DynamoNTS_DBService construction failed! ${dataParams.dataName} - ${this.serviceName}`,
|
|
54
|
+
errorCode: 'NTS-DBS-C00',
|
|
55
|
+
level: DynamoFM_ErrorLevel.critical,
|
|
56
|
+
additionalContent: { dataParams: this.dataParams },
|
|
57
|
+
error,
|
|
58
|
+
});
|
|
59
|
+
/* DynamoFM_Log.error(
|
|
52
60
|
`\nDynamoNTS_DBService ERROR, ` +
|
|
53
61
|
`The dbService construction failed for ${dataParams.dataName}. ${this.serviceName}` +
|
|
54
62
|
`\nERROR: `, error,
|
|
55
63
|
new Error()
|
|
56
|
-
);
|
|
64
|
+
); */
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
67
|
|
|
@@ -106,7 +106,18 @@ export class DynamoNTS_ApiService {
|
|
|
106
106
|
break;
|
|
107
107
|
|
|
108
108
|
default:
|
|
109
|
-
|
|
109
|
+
throw new DynamoFM_Error({
|
|
110
|
+
...this._getDefaultErrorSettings(
|
|
111
|
+
'startApiCall',
|
|
112
|
+
new Error('wrong api call type')
|
|
113
|
+
),
|
|
114
|
+
errorCode: 'NTS-API-SAC0',
|
|
115
|
+
additionalContent: {
|
|
116
|
+
callParams,
|
|
117
|
+
inputParams,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
//DynamoFM_Log.error('DYNAMO-NTS ERROR: \n wrong api call type'/* , '\n\n', new Error() */);
|
|
110
121
|
break;
|
|
111
122
|
}
|
|
112
123
|
|
|
@@ -137,7 +148,7 @@ export class DynamoNTS_ApiService {
|
|
|
137
148
|
break;
|
|
138
149
|
|
|
139
150
|
default:
|
|
140
|
-
console.error('
|
|
151
|
+
console.error('DYNAMO-NTS ERROR: \n wrong query param type', '\n\n', new Error());
|
|
141
152
|
break;
|
|
142
153
|
}
|
|
143
154
|
}
|
|
@@ -212,11 +223,11 @@ export class DynamoNTS_ApiService {
|
|
|
212
223
|
|
|
213
224
|
status: 404,
|
|
214
225
|
errorCode: 'NTS-API-SAC3',
|
|
215
|
-
message: `Can't connect to the
|
|
226
|
+
message: `Can't connect to the endpoint!`,
|
|
216
227
|
additionalContent: {
|
|
217
228
|
callParams,
|
|
218
229
|
inputParams,
|
|
219
|
-
}
|
|
230
|
+
},
|
|
220
231
|
});
|
|
221
232
|
|
|
222
233
|
} else if (error.config && error.message) {
|
|
@@ -235,7 +246,10 @@ export class DynamoNTS_ApiService {
|
|
|
235
246
|
},
|
|
236
247
|
});
|
|
237
248
|
} else {
|
|
238
|
-
DynamoFM_Log.error(
|
|
249
|
+
DynamoFM_Log.error(
|
|
250
|
+
`\n${callParams.name} was UNSUCCESSFUL`,
|
|
251
|
+
error /*, '\n\n' , new Error() */
|
|
252
|
+
);
|
|
239
253
|
|
|
240
254
|
throw error;
|
|
241
255
|
}
|
|
@@ -345,10 +359,13 @@ export class DynamoNTS_ApiService {
|
|
|
345
359
|
axios.defaults.headers.common[headerKey] = callParams.httpOptions.headers[headerKey];
|
|
346
360
|
|
|
347
361
|
} else {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
362
|
+
throw new DynamoFM_Error({
|
|
363
|
+
...this._getDefaultErrorSettings(
|
|
364
|
+
'setupHeaders',
|
|
365
|
+
new Error(`missing header: ${headerKey}`)
|
|
366
|
+
),
|
|
367
|
+
errorCode: 'NTS-API-SH0',
|
|
368
|
+
});
|
|
352
369
|
}
|
|
353
370
|
}
|
|
354
371
|
}
|
|
@@ -374,20 +391,38 @@ export class DynamoNTS_ApiService {
|
|
|
374
391
|
break;
|
|
375
392
|
|
|
376
393
|
default:
|
|
377
|
-
DynamoFM_Log.error(
|
|
378
|
-
`
|
|
394
|
+
/* DynamoFM_Log.error(
|
|
395
|
+
`DYNAMO-NTS ERROR:`+
|
|
396
|
+
`\nwrong path param type: (${pathParamKey}): ${paramType} ` +
|
|
379
397
|
`\n${pathParams[pathParamKey]}` +
|
|
380
398
|
`\nMUST BE string or number` +
|
|
381
399
|
`\n\n`,
|
|
382
400
|
new Error()
|
|
383
|
-
);
|
|
401
|
+
); */
|
|
402
|
+
throw new DynamoFM_Error({
|
|
403
|
+
...this._getDefaultErrorSettings(
|
|
404
|
+
'setupPathParams',
|
|
405
|
+
new Error(
|
|
406
|
+
`wrong path param type: (${pathParamKey}): ${paramType}` +
|
|
407
|
+
`\n${pathParams[pathParamKey]}`
|
|
408
|
+
)
|
|
409
|
+
),
|
|
410
|
+
errorCode: 'NTS-API-SP1',
|
|
411
|
+
additionalContent: {
|
|
412
|
+
pathParams: pathParams,
|
|
413
|
+
url: url,
|
|
414
|
+
},
|
|
415
|
+
});
|
|
384
416
|
break;
|
|
385
417
|
}
|
|
386
418
|
} else {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
419
|
+
throw new DynamoFM_Error({
|
|
420
|
+
...this._getDefaultErrorSettings(
|
|
421
|
+
'setupPathParams',
|
|
422
|
+
new Error(`missing pathParam: ${pathParamKey}`)
|
|
423
|
+
),
|
|
424
|
+
errorCode: 'NTS-API-SP0',
|
|
425
|
+
});
|
|
391
426
|
}
|
|
392
427
|
}
|
|
393
428
|
|
|
@@ -106,6 +106,11 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
106
106
|
(async (error: any): Promise<void> => {
|
|
107
107
|
DynamoFM_Log.warn(`globalErrorHandler not set!`);
|
|
108
108
|
DynamoFM_Log.error(`ERROR:\n`, error);
|
|
109
|
+
|
|
110
|
+
if (error?.flag?.includes?.('DYNAMO-ERROR-OBJECT')) {
|
|
111
|
+
DynamoFM_Log.error(`\nErrorMessage: ${(error as DynamoFM_Error)._message}`);
|
|
112
|
+
DynamoFM_Log.error(`ErrorCode: ${(error as DynamoFM_Error)._errorCode}`);
|
|
113
|
+
}
|
|
109
114
|
});
|
|
110
115
|
} catch (error) {
|
|
111
116
|
throw new DynamoFM_Error({
|
|
@@ -288,7 +288,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
288
288
|
);
|
|
289
289
|
|
|
290
290
|
} catch (error) {
|
|
291
|
-
DynamoFM_Log.error('
|
|
291
|
+
DynamoFM_Log.error('globalErrorHandler (MULTILEVEL) ERROR:', error);
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
294
|
|
|
@@ -299,7 +299,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
299
299
|
);
|
|
300
300
|
|
|
301
301
|
if (error?.flag?.includes?.('DYNAMO-ERROR-OBJECT')) {
|
|
302
|
-
DynamoFM_Log.error(`\
|
|
302
|
+
DynamoFM_Log.error(`\nErrorMessage: ${(error as DynamoFM_Error)._message}`);
|
|
303
303
|
DynamoFM_Log.error(`ErrorCode: ${(error as DynamoFM_Error)._errorCode}`);
|
|
304
304
|
}
|
|
305
305
|
});
|
|
@@ -915,11 +915,11 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
915
915
|
DynamoNTS_GlobalService.globalErrorHandler?.(d_error);
|
|
916
916
|
}
|
|
917
917
|
})
|
|
918
|
-
.on('uncaughtException', (
|
|
918
|
+
.on('uncaughtException', (exception): void => {
|
|
919
919
|
const d_error: DynamoFM_Error = new DynamoFM_Error({
|
|
920
920
|
...this._getDefaultErrorSettings(
|
|
921
921
|
'httpServer.on(uncaughtException)',
|
|
922
|
-
|
|
922
|
+
exception
|
|
923
923
|
),
|
|
924
924
|
|
|
925
925
|
errorCode: 'NTS-AS0-SE5',
|
|
@@ -927,7 +927,9 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
927
927
|
level: DynamoFM_ErrorLevel.critical,
|
|
928
928
|
});
|
|
929
929
|
|
|
930
|
-
if (this.debugLog)
|
|
930
|
+
if (this.debugLog) {
|
|
931
|
+
DynamoFM_Log.warn(`\nHTTP (open) server uncaughtException`, d_error);
|
|
932
|
+
}
|
|
931
933
|
|
|
932
934
|
DynamoNTS_GlobalService.globalErrorHandler?.(d_error);
|
|
933
935
|
});
|
|
@@ -79,6 +79,11 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
79
79
|
|
|
80
80
|
this.asyncConstructor().catch((error: any) => {
|
|
81
81
|
DynamoFM_Log.error(`socket-client(${this.params?.name}) Service setup failed! ERROR:`, error);
|
|
82
|
+
|
|
83
|
+
if (error?.flag?.includes?.('DYNAMO-ERROR-OBJECT')) {
|
|
84
|
+
DynamoFM_Log.error(`\nErrorMessage: ${(error as DynamoFM_Error)._message}`);
|
|
85
|
+
DynamoFM_Log.error(`ErrorCode: ${(error as DynamoFM_Error)._errorCode}`);
|
|
86
|
+
}
|
|
82
87
|
});
|
|
83
88
|
}
|
|
84
89
|
|