@futdevpro/nts-dynamo 1.9.9 → 1.9.11
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/_constants/global-settings.const.d.ts.map +1 -1
- package/build/_constants/global-settings.const.js +1 -0
- package/build/_constants/global-settings.const.js.map +1 -1
- package/build/_constants/mocks/auth-service.mock.d.ts +3 -3
- package/build/_constants/mocks/auth-service.mock.d.ts.map +1 -1
- package/build/_constants/mocks/auth-service.mock.js +3 -3
- package/build/_constants/mocks/auth-service.mock.js.map +1 -1
- package/build/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/endpoint-params.control-model.js +5 -0
- package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/build/_models/interfaces/global-settings.interface.d.ts +4 -0
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/usage/usage.controller.js +1 -1
- package/build/_modules/usage/usage.controller.js.map +1 -1
- package/build/_services/core/auth.service.d.ts +3 -3
- package/build/_services/core/auth.service.d.ts.map +1 -1
- package/build/_services/core/global.service.d.ts.map +1 -1
- package/build/_services/core/global.service.js +5 -2
- 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 -6
- package/build/_services/server/app.server.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/_constants/global-settings.const.ts +2 -0
- package/src/_constants/mocks/auth-service.mock.ts +3 -3
- package/src/_models/control-models/endpoint-params.control-model.ts +9 -0
- package/src/_models/interfaces/global-settings.interface.ts +5 -0
- package/src/_modules/usage/usage.controller.ts +1 -1
- package/src/_services/core/auth.service.ts +3 -3
- package/src/_services/core/global.service.ts +6 -2
- package/src/_services/server/app.server.ts +13 -6
- package/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.09.
|
|
3
|
+
"version": "01.09.11",
|
|
4
4
|
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prep": "npm i rimraf nodemon -g",
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
},
|
|
200
200
|
"homepage": "https:/futdevpro.hu/projects/dynamo",
|
|
201
201
|
"peerDependencies": {
|
|
202
|
-
"@futdevpro/fsm-dynamo": "^1.9.
|
|
202
|
+
"@futdevpro/fsm-dynamo": "^1.9.5",
|
|
203
203
|
"@types/express": "^4.17.17",
|
|
204
204
|
"@types/geoip-lite": "^1.4.1",
|
|
205
205
|
"@types/node": "^20.5.7",
|
|
@@ -10,11 +10,11 @@ export class AuthService_Mock extends DynamoNTS_AuthService {
|
|
|
10
10
|
return AuthService_Mock.getSingletonInstance();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
async
|
|
13
|
+
authenticate_token = async (req: Request, res: Response): Promise<void> => {};
|
|
14
14
|
|
|
15
|
-
async
|
|
15
|
+
authenticate_tokenSelf = async (req: Request, res: Response): Promise<void> => {};
|
|
16
16
|
|
|
17
|
-
async
|
|
17
|
+
authenticate_tokenPermAccUsageData = async (req: Request, res: Response): Promise<void> => {};
|
|
18
18
|
|
|
19
19
|
getIssuerFromRequest(req: Request): string {
|
|
20
20
|
return 'accountId_mock';
|
|
@@ -247,6 +247,13 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
247
247
|
DynamoFM_Log.warn('It will proceed as normal.');
|
|
248
248
|
});
|
|
249
249
|
|
|
250
|
+
if (
|
|
251
|
+
(error as DynamoFM_Error)?.flag?.includes('DYNAMO') &&
|
|
252
|
+
(error as DynamoFM_Error).confidentialContent
|
|
253
|
+
) {
|
|
254
|
+
delete (error as DynamoFM_Error).confidentialContent;
|
|
255
|
+
}
|
|
256
|
+
|
|
250
257
|
res.status((error as DynamoFM_Error)?.___status ?? 501);
|
|
251
258
|
res.send(error);
|
|
252
259
|
|
|
@@ -264,6 +271,8 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
264
271
|
);
|
|
265
272
|
}
|
|
266
273
|
}
|
|
274
|
+
|
|
275
|
+
DynamoFM_Log.error('');
|
|
267
276
|
|
|
268
277
|
} catch (error) {
|
|
269
278
|
DynamoFM_Log.H_error(
|
|
@@ -75,4 +75,9 @@ export interface DynamoNTS_Global_Settings {
|
|
|
75
75
|
* this is an application wide default setting for api debug logs
|
|
76
76
|
*/
|
|
77
77
|
logApiResponseContents?: boolean;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* this is an application wide default setting for detailed error logs
|
|
81
|
+
*/
|
|
82
|
+
logDetailedErrors?: boolean;
|
|
78
83
|
}
|
|
@@ -99,7 +99,7 @@ export class DynamoNTS_Usage_Controller extends DynamoNTS_Controller {
|
|
|
99
99
|
name: 'getUsageData',
|
|
100
100
|
type: DynamoNTS_HttpCallType.get,
|
|
101
101
|
endpoint: DynamoFM_usageModule_settings.endPoints.getUsageData,
|
|
102
|
-
preProcesses: [this.authService.
|
|
102
|
+
preProcesses: [ this.authService.authenticate_tokenPermAccUsageData ],
|
|
103
103
|
tasks: [
|
|
104
104
|
async (req: Request, res: Response): Promise<void> => {
|
|
105
105
|
const range: DynamoFM_RelativeDate = req.params.range as DynamoFM_RelativeDate;
|
|
@@ -92,7 +92,7 @@ export abstract class DynamoNTS_AuthService extends DynamoNTS_SingletonService {
|
|
|
92
92
|
* }
|
|
93
93
|
* }
|
|
94
94
|
* */
|
|
95
|
-
abstract
|
|
95
|
+
abstract authenticate_token: (req: Request, res: Response) => Promise<void>;
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* You need to implement a token validation logic,
|
|
@@ -128,7 +128,7 @@ export abstract class DynamoNTS_AuthService extends DynamoNTS_SingletonService {
|
|
|
128
128
|
* }
|
|
129
129
|
*
|
|
130
130
|
*/
|
|
131
|
-
abstract
|
|
131
|
+
abstract authenticate_tokenSelf: (req: Request, res: Response) => Promise<void>;
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* Authenticate Token for Permission to Access UsageData
|
|
@@ -144,7 +144,7 @@ export abstract class DynamoNTS_AuthService extends DynamoNTS_SingletonService {
|
|
|
144
144
|
* AuthService.authTokenAndPerm(req, res, next, Permission.accessUsageData);
|
|
145
145
|
* }
|
|
146
146
|
*/
|
|
147
|
-
abstract
|
|
147
|
+
abstract authenticate_tokenPermAccUsageData: (req: Request, res: Response) => Promise<void>;
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* The DynamoBE System is using this to get issuer, that will be set on DBServices
|
|
@@ -18,6 +18,7 @@ import { DynamoNTS_EmailService } from './email.service';
|
|
|
18
18
|
import { DynamoNTS_Service_Collection } from './service-collection.service';
|
|
19
19
|
/* import { DynamoNTS_EmailServiceCollection } from './email-service-collection.service'; */
|
|
20
20
|
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
21
|
+
import { DynamoNTS_globalSettings } from '../../_constants';
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
@@ -105,7 +106,10 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
105
106
|
set.errorHandler ??
|
|
106
107
|
(async (error: any): Promise<void> => {
|
|
107
108
|
DynamoFM_Log.warn(`globalErrorHandler not set!`);
|
|
108
|
-
|
|
109
|
+
|
|
110
|
+
if (DynamoNTS_globalSettings.logDetailedErrors) {
|
|
111
|
+
DynamoFM_Log.error(`ERROR:\n`, error);
|
|
112
|
+
}
|
|
109
113
|
|
|
110
114
|
if (error?.flag?.includes?.('DYNAMO-ERROR-OBJECT')) {
|
|
111
115
|
DynamoFM_Log.error(`\nErrorMessage: ${(error as DynamoFM_Error)._message}`);
|
|
@@ -130,7 +134,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
130
134
|
* @returns
|
|
131
135
|
*/
|
|
132
136
|
static getAuthService(): DynamoNTS_AuthService {
|
|
133
|
-
if (!this.instance?.authService?.
|
|
137
|
+
if (!(this.instance?.authService as DynamoNTS_AuthService)?.authenticate_token) {
|
|
134
138
|
throw new Error(
|
|
135
139
|
`\n Unique Authentication Service missing!` +
|
|
136
140
|
`\n Please create a Unique Authentication Service extending DynamoNTS_AuthService, ` +
|
|
@@ -389,7 +389,11 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
389
389
|
}
|
|
390
390
|
} catch (error) {
|
|
391
391
|
this.constructErrors.push(error);
|
|
392
|
-
DynamoFM_Log.error(
|
|
392
|
+
DynamoFM_Log.error(
|
|
393
|
+
`${this._params.name} start failed. ERRORS`,
|
|
394
|
+
this.constructErrors,
|
|
395
|
+
error
|
|
396
|
+
);
|
|
393
397
|
|
|
394
398
|
throw new DynamoFM_Error({
|
|
395
399
|
...this._getDefaultErrorSettings(
|
|
@@ -418,7 +422,10 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
418
422
|
const start: number = +new Date();
|
|
419
423
|
|
|
420
424
|
if (this.constructErrors.length) {
|
|
421
|
-
DynamoFM_Log.error(
|
|
425
|
+
DynamoFM_Log.error(
|
|
426
|
+
`${this._params.name} start failed. \nERRORS:`,
|
|
427
|
+
this.constructErrors
|
|
428
|
+
);
|
|
422
429
|
|
|
423
430
|
throw new DynamoFM_Error({
|
|
424
431
|
...this._getDefaultErrorSettings(
|
|
@@ -426,7 +433,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
426
433
|
new Error(`${this._params.name} start failed. ERRORS`)
|
|
427
434
|
),
|
|
428
435
|
|
|
429
|
-
errorCode: 'NTS-AS0-
|
|
436
|
+
errorCode: 'NTS-AS0-R01',
|
|
430
437
|
additionalContent:
|
|
431
438
|
this.constructErrors.length === 1 ?
|
|
432
439
|
this.constructErrors[0] :
|
|
@@ -459,7 +466,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
459
466
|
new Error(`${this._params.name} start failed. TIMEOUT`)
|
|
460
467
|
),
|
|
461
468
|
|
|
462
|
-
errorCode: 'NTS-AS0-
|
|
469
|
+
errorCode: 'NTS-AS0-R02',
|
|
463
470
|
additionalContent: {
|
|
464
471
|
constructErrors: this.constructErrors,
|
|
465
472
|
systemControls: this.systemControls,
|
|
@@ -481,7 +488,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
481
488
|
new Error(`${this._params.name} start failed. ERROR`)
|
|
482
489
|
),
|
|
483
490
|
|
|
484
|
-
errorCode: 'NTS-AS0-
|
|
491
|
+
errorCode: 'NTS-AS0-R03',
|
|
485
492
|
additionalContent: this.constructErrors,
|
|
486
493
|
});
|
|
487
494
|
}
|
|
@@ -517,7 +524,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
517
524
|
new Error(msg)
|
|
518
525
|
),
|
|
519
526
|
|
|
520
|
-
errorCode: 'NTS-AS0-
|
|
527
|
+
errorCode: 'NTS-AS0-R04',
|
|
521
528
|
additionalContent: {
|
|
522
529
|
constructErrors: this.constructErrors,
|
|
523
530
|
systemControls: this.systemControls,
|
package/tsconfig.json
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"moduleResolution": "node",
|
|
19
19
|
"esModuleInterop": true,
|
|
20
20
|
"skipLibCheck": true,
|
|
21
|
+
"noImplicitOverride": true,
|
|
21
22
|
"allowSyntheticDefaultImports": true,
|
|
22
23
|
"forceConsistentCasingInFileNames": true,
|
|
23
|
-
"noImplicitOverride": true,
|
|
24
24
|
"resolveJsonModule": true,
|
|
25
25
|
"paths": {
|
|
26
26
|
|