@futdevpro/nts-dynamo 1.10.6 → 1.10.8
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/_collections/stack.util.d.ts +7 -0
- package/build/_collections/stack.util.d.ts.map +1 -0
- package/build/_collections/stack.util.js +31 -0
- package/build/_collections/stack.util.js.map +1 -0
- package/build/_collections/stack.util.test.d.ts +2 -0
- package/build/_collections/stack.util.test.d.ts.map +1 -0
- package/build/_collections/stack.util.test.js +96 -0
- package/build/_collections/stack.util.test.js.map +1 -0
- package/build/_models/control-models/api-call-params.control-model.d.ts +4 -30
- package/build/_models/control-models/api-call-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/api-call-params.control-model.js +30 -13
- package/build/_models/control-models/api-call-params.control-model.js.map +1 -1
- package/build/_models/control-models/api-call-params.control-model.spec.js +6 -6
- package/build/_models/control-models/endpoint-params.control-model.d.ts +0 -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 +26 -13
- package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/build/_modules/mock/data-model.mock.d.ts.map +1 -1
- package/build/_modules/mock/data-model.mock.js +0 -1
- package/build/_modules/mock/data-model.mock.js.map +1 -1
- package/build/_modules/mock/data-model.mock.spec.js +0 -1
- package/build/_modules/mock/data-model.mock.spec.js.map +1 -1
- package/build/_modules/socket/_services/socket-client.service.d.ts +1 -1
- package/build/_modules/socket/_services/socket-client.service.d.ts.map +1 -1
- package/build/_modules/socket/_services/socket-client.service.js.map +1 -1
- package/build/_modules/socket/_services/socket-server.service.d.ts.map +1 -1
- package/build/_modules/socket/_services/socket-server.service.js +46 -10
- package/build/_modules/socket/_services/socket-server.service.js.map +1 -1
- package/build/_modules/socket/app-extended.server.d.ts.map +1 -1
- package/build/_modules/socket/app-extended.server.js +11 -2
- package/build/_modules/socket/app-extended.server.js.map +1 -1
- package/build/_modules/test/test.controller.js +6 -6
- package/build/_modules/test/test.controller.js.map +1 -1
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +9 -1
- 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 +42 -39
- package/build/_services/base/db.service.js.map +1 -1
- package/build/_services/core/api.service.d.ts +1 -1
- package/build/_services/core/api.service.d.ts.map +1 -1
- package/build/_services/core/api.service.js +29 -12
- package/build/_services/core/api.service.js.map +1 -1
- package/build/_services/core/api.service.spec.js +4 -3
- package/build/_services/core/api.service.spec.js.map +1 -1
- package/build/_services/core/global.service.d.ts.map +1 -1
- package/build/_services/core/global.service.js +2 -1
- package/build/_services/core/global.service.js.map +1 -1
- package/build/_services/server/app.server.js +5 -5
- package/build/_services/server/app.server.js.map +1 -1
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/package.json +4 -4
- package/src/_collections/stack.util.test.ts +111 -0
- package/src/_collections/stack.util.ts +33 -0
- package/src/_models/control-models/api-call-params.control-model.spec.ts +6 -6
- package/src/_models/control-models/api-call-params.control-model.ts +44 -43
- package/src/_models/control-models/endpoint-params.control-model.ts +26 -19
- package/src/_modules/mock/data-model.mock.spec.ts +0 -1
- package/src/_modules/mock/data-model.mock.ts +0 -1
- package/src/_modules/socket/_services/socket-client.service.ts +1 -1
- package/src/_modules/socket/_services/socket-server.service.ts +65 -21
- package/src/_modules/socket/app-extended.server.ts +21 -6
- package/src/_modules/test/test.controller.ts +7 -7
- package/src/_services/base/data.service.ts +21 -1
- package/src/_services/base/db.service.ts +47 -39
- package/src/_services/core/api.service.spec.ts +3 -3
- package/src/_services/core/api.service.ts +37 -15
- package/src/_services/core/global.service.ts +4 -1
- package/src/_services/server/app.server.ts +7 -7
- package/src/index.ts +2 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { DyFM_HttpCallType, DyFM_HttpResponseType, DyFM_Log, } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
4
|
+
import { DyNTS_getStackLocation } from '../../_collections/stack.util';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* API call params,
|
|
@@ -16,7 +18,7 @@ export class DyNTS_ApiCall_Params {
|
|
|
16
18
|
/**
|
|
17
19
|
* type of the call as; HttpCallType .get, .post, ...ect
|
|
18
20
|
*/
|
|
19
|
-
type: DyFM_HttpCallType;
|
|
21
|
+
type: DyFM_HttpCallType = DyFM_HttpCallType.get;
|
|
20
22
|
/**
|
|
21
23
|
* the endpoint of the API, without the baseUrl:
|
|
22
24
|
* '/user/get/:userId',
|
|
@@ -27,65 +29,64 @@ export class DyNTS_ApiCall_Params {
|
|
|
27
29
|
* baseUrl of the API;
|
|
28
30
|
* 'https://futdevpro.hu/api'
|
|
29
31
|
*/
|
|
30
|
-
|
|
32
|
+
endpoint: string;
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* if this value is true, the call will return the full HTTP call response in raw
|
|
34
36
|
*/
|
|
35
|
-
getFullResponse: boolean;
|
|
37
|
+
getFullResponse: boolean = false;
|
|
36
38
|
/**
|
|
37
39
|
* this setting will be passed to the axios http call
|
|
38
40
|
*/
|
|
39
|
-
httpOptions: any;
|
|
41
|
+
httpOptions: any = {};
|
|
42
|
+
|
|
43
|
+
pathParamKeys: string[] = [];
|
|
44
|
+
|
|
45
|
+
readonly stack: string;
|
|
40
46
|
|
|
41
47
|
constructor(
|
|
42
48
|
/**
|
|
43
49
|
* set of options necessary for setting up an API call
|
|
44
50
|
*/
|
|
45
|
-
set:
|
|
46
|
-
/**
|
|
47
|
-
* name the call to be able to identify it when debugging
|
|
48
|
-
*/
|
|
49
|
-
name: string,
|
|
50
|
-
/**
|
|
51
|
-
* set type as; HttpCallType .get, .post, ...ect
|
|
52
|
-
*/
|
|
53
|
-
type: DyFM_HttpCallType,
|
|
54
|
-
/**
|
|
55
|
-
* the endpoint of the API, without the baseUrl:
|
|
56
|
-
* '/user/get/:userId',
|
|
57
|
-
* where the parts starting with ':', will be used as pathParam
|
|
58
|
-
*/
|
|
59
|
-
endPoint: string,
|
|
60
|
-
/**
|
|
61
|
-
* baseUrl of the API;
|
|
62
|
-
* 'https://futdevpro.hu/api'
|
|
63
|
-
*/
|
|
64
|
-
baseUrl: string,
|
|
65
|
-
/**
|
|
66
|
-
* setting this value to true, will return the full HTTP call response in raw
|
|
67
|
-
*/
|
|
68
|
-
getFullResponse?: boolean,
|
|
69
|
-
/**
|
|
70
|
-
* this setting will pass any kind of http setting used by the axios http messaging package
|
|
71
|
-
*/
|
|
72
|
-
httpOptions?: DyNTS_HttpOptions,
|
|
73
|
-
}
|
|
51
|
+
set: Partial<DyNTS_ApiCall_Params>
|
|
74
52
|
) {
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (set.endPoint.includes('{')) {
|
|
53
|
+
this.stack = DyNTS_getStackLocation();
|
|
54
|
+
|
|
55
|
+
if (!set.name) {
|
|
79
56
|
DyFM_Log.warn(
|
|
80
|
-
|
|
57
|
+
'DyNTS_ApiCall_Params: name is not provided, using stack location!',
|
|
58
|
+
'\nstack:', this.stack
|
|
59
|
+
);
|
|
60
|
+
this.name = this.stack;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!set.baseUrl) {
|
|
64
|
+
DyFM_Log.error(
|
|
65
|
+
'DyNTS_ApiCall_Params: baseUrl is not provided, using global baseUrl!',
|
|
66
|
+
'\nstack:', this.stack
|
|
67
|
+
);
|
|
68
|
+
this.baseUrl = DyNTS_global_settings.baseUrl;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!set.endpoint) {
|
|
72
|
+
DyFM_Log.error(
|
|
73
|
+
'DyNTS_ApiCall_Params: endpoint is not provided, using global endPoint!',
|
|
74
|
+
'\nstack:', this.stack
|
|
75
|
+
);
|
|
76
|
+
this.endpoint = '';
|
|
77
|
+
} else if (set.endpoint.includes('{')) {
|
|
78
|
+
DyFM_Log.warn(
|
|
79
|
+
`using {param} bracets in endpoint definitions will be deprecated... (${set.endpoint})` +
|
|
81
80
|
'use :param instead ({pathparam} --> :pathparam)'
|
|
82
81
|
);
|
|
83
|
-
set.
|
|
82
|
+
set.endpoint = set.endpoint.replace(/{/g, ':').replace(/}/g, '');
|
|
83
|
+
} else {
|
|
84
|
+
this.pathParamKeys = set.endpoint.split('/')
|
|
85
|
+
.filter(part => part.startsWith(':'))
|
|
86
|
+
.map(part => part.slice(1));
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
this
|
|
87
|
-
this.getFullResponse = !!set.getFullResponse;
|
|
88
|
-
this.httpOptions = set.httpOptions ? set.httpOptions : {};
|
|
88
|
+
|
|
89
|
+
Object.assign(this, set);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
10
10
|
import { DyNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
11
11
|
import { DyNTS_GlobalService } from '../../_services/core/global.service';
|
|
12
|
+
import { DyNTS_getStackLocation } from '../../_collections/stack.util';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* High level endpoint for API
|
|
@@ -139,7 +140,7 @@ export class DyNTS_Endpoint_Params<
|
|
|
139
140
|
this.preProcesses = set.preProcesses ?? [];
|
|
140
141
|
this.tasks = set.tasks ?? [];
|
|
141
142
|
|
|
142
|
-
this.stack =
|
|
143
|
+
this.stack = DyNTS_getStackLocation();
|
|
143
144
|
} catch (error) {
|
|
144
145
|
DyFM_Log.error(
|
|
145
146
|
`\nEndpoint params setup failed: name: '${set.name}' ` +
|
|
@@ -182,16 +183,6 @@ export class DyNTS_Endpoint_Params<
|
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
|
|
185
|
-
private getStackLocation(): string {
|
|
186
|
-
let stack: string = new Error().stack;
|
|
187
|
-
|
|
188
|
-
stack = stack?.split('\n')?.[3]?.replace(' at ', '');
|
|
189
|
-
stack = stack?.replace('.setupEndpoints (', ': ');
|
|
190
|
-
stack = stack?.replace(')', '');
|
|
191
|
-
|
|
192
|
-
return stack;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
186
|
/**
|
|
196
187
|
*
|
|
197
188
|
* @returns
|
|
@@ -323,7 +314,13 @@ export class DyNTS_Endpoint_Params<
|
|
|
323
314
|
}
|
|
324
315
|
}
|
|
325
316
|
|
|
326
|
-
|
|
317
|
+
const status = (error as DyFM_Error)?.___status;
|
|
318
|
+
if (status && !isNaN(status)) {
|
|
319
|
+
res.status(status);
|
|
320
|
+
} else {
|
|
321
|
+
res.status(501);
|
|
322
|
+
}
|
|
323
|
+
|
|
327
324
|
res.send(error);
|
|
328
325
|
|
|
329
326
|
if (this.logRequest) {
|
|
@@ -368,21 +365,31 @@ export class DyNTS_Endpoint_Params<
|
|
|
368
365
|
}
|
|
369
366
|
): void {
|
|
370
367
|
if (DyNTS_global_settings.log_settings.highDetailedLogs) {
|
|
371
|
-
|
|
368
|
+
const msg =
|
|
372
369
|
`\n\nDYNAMO MULTILEVEL ERROR:DyNTS_Endpoint_Params: error: ` +
|
|
373
370
|
`(${this.name}, ${this.endpoint})` +
|
|
374
371
|
`\n(DYNAMO MULTILEVEL ERROR means, that the ERROR HANDLING is ALSO FAILED, ` +
|
|
375
372
|
`and the error message was not sent.)` +
|
|
376
|
-
`\
|
|
377
|
-
|
|
378
|
-
)
|
|
373
|
+
`\nthisEndpointStackLocation: ${this.stack}`;
|
|
374
|
+
|
|
375
|
+
if (errorLvl2 instanceof DyFM_Error) {
|
|
376
|
+
errorLvl2.logSimple(msg);
|
|
377
|
+
} else {
|
|
378
|
+
DyFM_Log.H_error(msg, '\nERROR:', errorLvl2, '\n');
|
|
379
|
+
}
|
|
379
380
|
} else {
|
|
380
|
-
|
|
381
|
+
const msg =
|
|
381
382
|
`\n\nDYNAMO MULTILEVEL ERROR:DyNTS_Endpoint_Params: error: ` +
|
|
382
383
|
`(${this.name}, ${this.endpoint})` +
|
|
384
|
+
`\nthisEndpointStackLocation: ${this.stack}` +
|
|
383
385
|
`\n(DYNAMO MULTILEVEL ERROR means, that the ERROR HANDLING is ALSO FAILED, ` +
|
|
384
|
-
`and the error message was not sent.)
|
|
385
|
-
|
|
386
|
+
`and the error message was not sent.)`;
|
|
387
|
+
|
|
388
|
+
if (errorLvl2 instanceof DyFM_Error) {
|
|
389
|
+
errorLvl2.logSimple(msg);
|
|
390
|
+
} else {
|
|
391
|
+
DyFM_Log.H_error(msg, '\nERROR:', errorLvl2, '\n');
|
|
392
|
+
}
|
|
386
393
|
}
|
|
387
394
|
|
|
388
395
|
try {
|
|
@@ -68,7 +68,6 @@ export const dependent_mock_DataParams = new DyFM_DataModel_Params<Dependent_Moc
|
|
|
68
68
|
properties: {
|
|
69
69
|
dependencyId: { type: 'string',
|
|
70
70
|
unique: true, required: true,
|
|
71
|
-
isDependencyHook: true,
|
|
72
71
|
dependencyDataName: dependency_mock_DataParams.dataName,
|
|
73
72
|
},
|
|
74
73
|
string: { type: 'string' },
|
|
@@ -30,7 +30,7 @@ export abstract class DyNTS_SocketClient_ServiceBase extends DyNTS_SingletonServ
|
|
|
30
30
|
protected debugLog: boolean = DyNTS_global_settings.log_settings.setup;
|
|
31
31
|
protected logFn: boolean = DyNTS_global_settings.log_settings.functions;
|
|
32
32
|
|
|
33
|
-
private defaultEvents: DyFM_SocketEvent<any>[] = [
|
|
33
|
+
private readonly defaultEvents: DyFM_SocketEvent<any>[] = [
|
|
34
34
|
new DyFM_SocketEvent<any>({
|
|
35
35
|
eventKey: DyFM_SocketEvent_Key.connect,
|
|
36
36
|
tasks: [
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
DyNTS_SocketServerService_Params
|
|
22
22
|
} from '../_models/socket-server-service-params.control-model';
|
|
23
|
+
import { DyNTS_getStackLocation } from '../../../_collections/stack.util';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* You need to define the following functions:
|
|
@@ -64,9 +65,13 @@ export abstract class DyNTS_SocketServerService<
|
|
|
64
65
|
`We encountered an unhandled Socket Server Error, ` +
|
|
65
66
|
`\nplease contact the responsible development team.`;
|
|
66
67
|
|
|
68
|
+
/* readonly thisLocationStack: string; */
|
|
69
|
+
|
|
67
70
|
protected constructor(){
|
|
68
71
|
super();
|
|
69
72
|
|
|
73
|
+
/* this.thisLocationStack = DyNTS_getStackLocation(); */
|
|
74
|
+
|
|
70
75
|
this.asyncConstructor().catch((error: any) => {
|
|
71
76
|
DyFM_Log.error(
|
|
72
77
|
`Socket Server Service setup failed: "${this.params?.name}" (${this.params?.port})`,
|
|
@@ -308,19 +313,27 @@ export abstract class DyNTS_SocketServerService<
|
|
|
308
313
|
`<-==> socket(${this.params.name}) subscription successful (${issuer})`
|
|
309
314
|
);
|
|
310
315
|
} catch (error) {
|
|
311
|
-
if (
|
|
316
|
+
if (error instanceof DyFM_Error) {
|
|
317
|
+
error.logSimple(
|
|
318
|
+
`Socket Subscription failed: "${this.params.name}" ` +
|
|
319
|
+
`(${this.params.port}) will disconnect now...`
|
|
320
|
+
)
|
|
321
|
+
} else if (DyNTS_global_settings.log_settings.socket_eventContent) {
|
|
312
322
|
DyFM_Log.error(
|
|
313
|
-
`Socket Subscription failed: "${this.params.name}" `
|
|
323
|
+
`Socket Subscription failed: "${this.params.name}" ` +
|
|
314
324
|
`(${this.params.port}) will disconnect now...`,
|
|
325
|
+
/* `${this.thisLocationStack}`, */
|
|
315
326
|
error
|
|
316
327
|
);
|
|
317
328
|
} else {
|
|
318
329
|
DyFM_Log.error(
|
|
319
330
|
`Socket Subscription failed: "${this.params.name}" ` ,
|
|
320
|
-
`(${this.params.port}) will disconnect now
|
|
331
|
+
`(${this.params.port}) will disconnect now...`,
|
|
332
|
+
/* `${this.thisLocationStack}` */
|
|
321
333
|
);
|
|
322
334
|
}
|
|
323
335
|
socket.emit(DyFM_SocketEvent_Key.error, error);
|
|
336
|
+
socket.emit(DyFM_SocketEvent_Key.disconnect);
|
|
324
337
|
socket.disconnect();
|
|
325
338
|
}
|
|
326
339
|
}
|
|
@@ -367,7 +380,12 @@ export abstract class DyNTS_SocketServerService<
|
|
|
367
380
|
`< x > socket(${this.params.name}) unsubscribe successful (${issuer})`
|
|
368
381
|
);
|
|
369
382
|
} catch (error) {
|
|
370
|
-
if (
|
|
383
|
+
if (error instanceof DyFM_Error) {
|
|
384
|
+
error.logSimple(
|
|
385
|
+
`Socket Unsubscription failed: "${this.params.name}" ` +
|
|
386
|
+
`(${this.params.port}) will disconnect now...`
|
|
387
|
+
)
|
|
388
|
+
} else if (DyNTS_global_settings.log_settings.socket_eventContent) {
|
|
371
389
|
DyFM_Log.error(
|
|
372
390
|
`Socket unsubscribe failed: "${this.params.name}" ` ,
|
|
373
391
|
`(${this.params.port}) will disconnect now...`,
|
|
@@ -392,10 +410,16 @@ export abstract class DyNTS_SocketServerService<
|
|
|
392
410
|
try {
|
|
393
411
|
await event.executeEventTasks(content, issuer);
|
|
394
412
|
} catch (error) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
413
|
+
if (error instanceof DyFM_Error) {
|
|
414
|
+
error.logSimple(
|
|
415
|
+
`Socket Event failed: "${this.params.name}" (${this.params.port})`
|
|
416
|
+
)
|
|
417
|
+
} else {
|
|
418
|
+
DyFM_Log.error(
|
|
419
|
+
`Socket Event failed: "${this.params.name}" (${this.params.port})`,
|
|
420
|
+
error
|
|
421
|
+
);
|
|
422
|
+
}
|
|
399
423
|
socket.emit(DyFM_SocketEvent_Key.error, error);
|
|
400
424
|
}
|
|
401
425
|
}
|
|
@@ -406,11 +430,18 @@ export abstract class DyNTS_SocketServerService<
|
|
|
406
430
|
DyFM_Log.success(`< > socket(${this.params.name}): new CONNECTION established`);
|
|
407
431
|
}
|
|
408
432
|
} catch (error) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
433
|
+
if (error instanceof DyFM_Error) {
|
|
434
|
+
error.logSimple(
|
|
435
|
+
`Socket Connection failed: "${this.params.name}" ` +
|
|
436
|
+
`(${this.params.port}) will disconnect now...`
|
|
437
|
+
)
|
|
438
|
+
} else {
|
|
439
|
+
DyFM_Log.error(
|
|
440
|
+
`Socket Connection failed: "${this.params.name}" ` +
|
|
441
|
+
`(${this.params.port}) will disconnect now...`,
|
|
442
|
+
error
|
|
443
|
+
);
|
|
444
|
+
}
|
|
414
445
|
socket.emit(DyFM_SocketEvent_Key.error, error);
|
|
415
446
|
socket.disconnect();
|
|
416
447
|
}
|
|
@@ -435,11 +466,18 @@ export abstract class DyNTS_SocketServerService<
|
|
|
435
466
|
return this.secureSocketServer;
|
|
436
467
|
}
|
|
437
468
|
} catch (error) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
469
|
+
if (error instanceof DyFM_Error) {
|
|
470
|
+
error.logSimple(
|
|
471
|
+
`Socket Server Service - Deep Setup failed: "${this.params?.name}" ` +
|
|
472
|
+
`(${this.params?.port})`
|
|
473
|
+
)
|
|
474
|
+
} else {
|
|
475
|
+
DyFM_Log.error(
|
|
476
|
+
`Socket Server Service - Deep Setup failed: "${this.params?.name}" ` +
|
|
477
|
+
`(${this.params?.port})`,
|
|
478
|
+
error
|
|
479
|
+
);
|
|
480
|
+
}
|
|
443
481
|
|
|
444
482
|
throw error;
|
|
445
483
|
}
|
|
@@ -457,14 +495,20 @@ export abstract class DyNTS_SocketServerService<
|
|
|
457
495
|
this.presences.push(newPresence);
|
|
458
496
|
}
|
|
459
497
|
} catch (error) {
|
|
460
|
-
if (
|
|
498
|
+
if (error instanceof DyFM_Error) {
|
|
499
|
+
error.logSimple(
|
|
500
|
+
`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`
|
|
501
|
+
)
|
|
502
|
+
} else if (DyNTS_global_settings.log_settings.socket_eventContent) {
|
|
461
503
|
DyFM_Log.error(
|
|
462
|
-
`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`,
|
|
504
|
+
`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`,
|
|
505
|
+
/* `${this.thisLocationStack}`, */
|
|
463
506
|
error
|
|
464
507
|
);
|
|
465
508
|
} else {
|
|
466
509
|
DyFM_Log.error(
|
|
467
|
-
`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})
|
|
510
|
+
`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`,
|
|
511
|
+
/* `${this.thisLocationStack}` */
|
|
468
512
|
);
|
|
469
513
|
}
|
|
470
514
|
|
|
@@ -486,6 +486,13 @@ export abstract class DyNTS_AppExtended extends DyNTS_App {
|
|
|
486
486
|
async (service: DyNTS_SocketServerService<any>): Promise<void> => {
|
|
487
487
|
try {
|
|
488
488
|
this.systemControlsExt.httpSocketServer.init = true;
|
|
489
|
+
|
|
490
|
+
if (!service.port) {
|
|
491
|
+
throw new Error(
|
|
492
|
+
`PORT NOT SET: "${service.name}"`
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
489
496
|
const existingPorts: DyNTS_SocketServerService<any>[] = this.socketServices.filter(
|
|
490
497
|
(mod: DyNTS_SocketServerService<any>): boolean => mod.port === service.port
|
|
491
498
|
);
|
|
@@ -495,7 +502,12 @@ export abstract class DyNTS_AppExtended extends DyNTS_App {
|
|
|
495
502
|
this.portSettings.httpPort === service.port ||
|
|
496
503
|
this.portSettings.httpsPort === service.port
|
|
497
504
|
) {
|
|
498
|
-
const error = new Error(
|
|
505
|
+
const error = new Error(
|
|
506
|
+
`PORT DUPLICATION: "${service.port}"` +
|
|
507
|
+
`\n same ports at: ${existingPorts.map(
|
|
508
|
+
(sss: DyNTS_SocketServerService<any>): string => sss.name
|
|
509
|
+
).join(', ')}`
|
|
510
|
+
);
|
|
499
511
|
const errorStack: string[] = error.stack?.split('\n');
|
|
500
512
|
|
|
501
513
|
errorStack.splice(1, 4);
|
|
@@ -562,11 +574,14 @@ export abstract class DyNTS_AppExtended extends DyNTS_App {
|
|
|
562
574
|
throw error;
|
|
563
575
|
}
|
|
564
576
|
} catch (error) {
|
|
565
|
-
|
|
566
|
-
`\nSocket Server service setup failed. (${service?.name})
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
577
|
+
if (error instanceof DyFM_Error) {
|
|
578
|
+
error.logSimple(`\nSocket Server service setup failed. (${service?.name})`)
|
|
579
|
+
} else {
|
|
580
|
+
DyFM_Log.error(
|
|
581
|
+
`\nSocket Server service setup failed. (${service?.name})`,
|
|
582
|
+
error,
|
|
583
|
+
);
|
|
584
|
+
}
|
|
570
585
|
|
|
571
586
|
throw error;
|
|
572
587
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
|
|
4
4
|
import { DyFM_HttpCallType } from '@futdevpro/fsm-dynamo';
|
|
5
|
-
import { DyFM_testModule_settings } from '@futdevpro/fsm-dynamo/test';
|
|
5
|
+
import { DyFM_testModule_settings, DyFM_TestRoute } from '@futdevpro/fsm-dynamo/test';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
DyNTS_Endpoint_Params
|
|
@@ -22,7 +22,7 @@ export class DyNTS_Test_Controller extends DyNTS_Controller {
|
|
|
22
22
|
new DyNTS_Endpoint_Params({
|
|
23
23
|
name: 'testGet',
|
|
24
24
|
type: DyFM_HttpCallType.get,
|
|
25
|
-
endpoint: DyFM_testModule_settings.endPoints.testGet,
|
|
25
|
+
endpoint: DyFM_testModule_settings.endPoints[DyFM_TestRoute.testGet],
|
|
26
26
|
tasks: [
|
|
27
27
|
async (req: Request, res: Response): Promise<void> => {
|
|
28
28
|
res.send({
|
|
@@ -37,7 +37,7 @@ export class DyNTS_Test_Controller extends DyNTS_Controller {
|
|
|
37
37
|
new DyNTS_Endpoint_Params({
|
|
38
38
|
name: 'testPost',
|
|
39
39
|
type: DyFM_HttpCallType.post,
|
|
40
|
-
endpoint: DyFM_testModule_settings.endPoints.testPost,
|
|
40
|
+
endpoint: DyFM_testModule_settings.endPoints[DyFM_TestRoute.testPost],
|
|
41
41
|
tasks: [
|
|
42
42
|
async (req: Request, res: Response): Promise<void> => {
|
|
43
43
|
res.send({
|
|
@@ -52,7 +52,7 @@ export class DyNTS_Test_Controller extends DyNTS_Controller {
|
|
|
52
52
|
/* new DyNTS_Endpoint_Params({
|
|
53
53
|
name: 'testPut',
|
|
54
54
|
type: DyFM_HttpCallType.put,
|
|
55
|
-
endpoint: DyFM_testModule_settings.endPoints.testPut,
|
|
55
|
+
endpoint: DyFM_testModule_settings.endPoints[DyFM_TestRoute.testPut],
|
|
56
56
|
tasks: [
|
|
57
57
|
async (req: Request, res: Response): Promise<void> => {
|
|
58
58
|
res.send({
|
|
@@ -67,7 +67,7 @@ export class DyNTS_Test_Controller extends DyNTS_Controller {
|
|
|
67
67
|
/* new DyNTS_Endpoint_Params({
|
|
68
68
|
name: 'testPatch',
|
|
69
69
|
type: DyFM_HttpCallType.patch,
|
|
70
|
-
endpoint: DyFM_testModule_settings.endPoints.testPatch,
|
|
70
|
+
endpoint: DyFM_testModule_settings.endPoints[DyFM_TestRoute.testPatch],
|
|
71
71
|
tasks: [
|
|
72
72
|
async (req: Request, res: Response): Promise<void> => {
|
|
73
73
|
res.send({
|
|
@@ -82,7 +82,7 @@ export class DyNTS_Test_Controller extends DyNTS_Controller {
|
|
|
82
82
|
new DyNTS_Endpoint_Params({
|
|
83
83
|
name: 'testDelete',
|
|
84
84
|
type: DyFM_HttpCallType.delete,
|
|
85
|
-
endpoint: DyFM_testModule_settings.endPoints.testDelete,
|
|
85
|
+
endpoint: DyFM_testModule_settings.endPoints[DyFM_TestRoute.testDelete],
|
|
86
86
|
tasks: [
|
|
87
87
|
async (req: Request, res: Response): Promise<void> => {
|
|
88
88
|
res.send({
|
|
@@ -97,7 +97,7 @@ export class DyNTS_Test_Controller extends DyNTS_Controller {
|
|
|
97
97
|
new DyNTS_Endpoint_Params({
|
|
98
98
|
name: 'getServerStatus',
|
|
99
99
|
type: DyFM_HttpCallType.get,
|
|
100
|
-
endpoint: DyFM_testModule_settings.endPoints.getServerStatus,
|
|
100
|
+
endpoint: DyFM_testModule_settings.endPoints[DyFM_TestRoute.getServerStatus],
|
|
101
101
|
tasks: [
|
|
102
102
|
async (req: Request, res: Response): Promise<void> => {
|
|
103
103
|
|
|
@@ -1787,8 +1787,28 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1787
1787
|
private lookForDependencyDataSettings(): void {
|
|
1788
1788
|
const dependencyParam: DyFM_DataProperty_Params<any> =
|
|
1789
1789
|
Object.values(this.dataParams.properties).find(
|
|
1790
|
-
(modelParams: DyFM_DataProperty_Params<any>): boolean =>
|
|
1790
|
+
(modelParams: DyFM_DataProperty_Params<any>): boolean =>
|
|
1791
|
+
Boolean(modelParams.dependencyDataName)
|
|
1791
1792
|
);
|
|
1793
|
+
|
|
1794
|
+
if (
|
|
1795
|
+
Object.values(this.dataParams.properties).filter(
|
|
1796
|
+
(modelParams: DyFM_DataProperty_Params<any>): boolean =>
|
|
1797
|
+
Boolean(modelParams.dependencyDataName)
|
|
1798
|
+
).length > 1
|
|
1799
|
+
) {
|
|
1800
|
+
throw new DyFM_Error({
|
|
1801
|
+
...this._getDefaultErrorSettings(
|
|
1802
|
+
'lookForDependencyDataSettings',
|
|
1803
|
+
new Error(
|
|
1804
|
+
`Multiple "dependencyDataName" found for this dataModel (${this.dataParams.dataName}) ` +
|
|
1805
|
+
`(NTS DataService)` +
|
|
1806
|
+
`\nSorry, but this is not supported yet! (Donate to Dynamo to get this feature!)`
|
|
1807
|
+
)
|
|
1808
|
+
),
|
|
1809
|
+
errorCode: 'NTS-DS0-LFDD0',
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1792
1812
|
|
|
1793
1813
|
if (dependencyParam) {
|
|
1794
1814
|
this.depKey = dependencyParam.key;
|