@futdevpro/nts-dynamo 1.7.28 → 1.8.5
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/lib/_constants/global-settings.const.d.ts +2 -2
- package/lib/_constants/global-settings.const.d.ts.map +1 -1
- package/lib/_constants/global-settings.const.js +2 -2
- package/lib/_constants/global-settings.const.js.map +1 -1
- package/lib/_constants/mocks/app-extended-server.mock.d.ts +12 -12
- package/lib/_constants/mocks/app-extended-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-extended-server.mock.js +16 -16
- package/lib/_constants/mocks/app-extended-server.mock.js.map +1 -1
- package/lib/_constants/mocks/app-params.mock.d.ts +2 -2
- package/lib/_constants/mocks/app-params.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-params.mock.js +1 -1
- package/lib/_constants/mocks/app-params.mock.js.map +1 -1
- package/lib/_constants/mocks/app-server.mock.d.ts +15 -15
- package/lib/_constants/mocks/app-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-server.mock.js +10 -10
- package/lib/_constants/mocks/app-server.mock.js.map +1 -1
- package/lib/_constants/mocks/data-model.mock.d.ts +3 -3
- package/lib/_constants/mocks/data-model.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/data-model.mock.js +22 -22
- package/lib/_constants/mocks/data-model.mock.js.map +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.d.ts +2 -2
- package/lib/_constants/mocks/email-service-collection.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.js +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.js.map +1 -1
- package/lib/_constants/mocks/endpoint.mock.d.ts +8 -8
- package/lib/_constants/mocks/endpoint.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/endpoint.mock.js +18 -18
- package/lib/_constants/mocks/endpoint.mock.js.map +1 -1
- package/lib/_constants/mocks/socket-client.mock.d.ts +2 -2
- package/lib/_constants/mocks/socket-client.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/socket-client.mock.js +1 -1
- package/lib/_constants/mocks/socket-client.mock.js.map +1 -1
- package/lib/_constants/mocks/socket-server.mock.d.ts +2 -2
- package/lib/_constants/mocks/socket-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/socket-server.mock.js +1 -1
- package/lib/_constants/mocks/socket-server.mock.js.map +1 -1
- package/lib/_enums/data-model-type.enum.d.ts +1 -0
- package/lib/_enums/data-model-type.enum.d.ts.map +1 -1
- package/lib/_enums/data-model-type.enum.js +1 -0
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_models/control-models/api-call-params.control-model.d.ts +3 -3
- package/lib/_models/control-models/api-call-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/api-call-params.control-model.js +5 -5
- package/lib/_models/control-models/api-call-params.control-model.js.map +1 -1
- package/lib/_models/control-models/{app-system-controls.control-model copy.d.ts → app-ext-system-controls.control-model.d.ts} +1 -1
- package/lib/_models/control-models/app-ext-system-controls.control-model.d.ts.map +1 -0
- package/lib/_models/control-models/{app-system-controls.control-model copy.js → app-ext-system-controls.control-model.js} +1 -1
- package/lib/_models/control-models/app-ext-system-controls.control-model.js.map +1 -0
- package/lib/_models/control-models/app-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/app-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/app-params.control-model.js +3 -3
- package/lib/_models/control-models/app-params.control-model.js.map +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.d.ts +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.js +8 -8
- package/lib/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/lib/_models/control-models/http-settings.control-model.d.ts +2 -2
- package/lib/_models/control-models/http-settings.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/http-settings.control-model.js +3 -3
- package/lib/_models/control-models/http-settings.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-client-service-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/socket-client-service-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/socket-client-service-params.control-model.js +3 -3
- package/lib/_models/control-models/socket-client-service-params.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-event.control-model.js +4 -4
- package/lib/_models/control-models/socket-presence.control-model.d.ts +12 -0
- package/lib/_models/control-models/socket-presence.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/socket-presence.control-model.js +4 -0
- package/lib/_models/control-models/socket-presence.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-server-service-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/socket-server-service-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/socket-server-service-params.control-model.js +4 -4
- package/lib/_models/control-models/socket-server-service-params.control-model.js.map +1 -1
- package/lib/_models/interfaces/certification-settings.interface.d.ts +1 -1
- package/lib/_models/interfaces/certification-settings.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/global-service-settings.interface.d.ts +6 -6
- package/lib/_models/interfaces/global-service-settings.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/global-settings.interface.d.ts +1 -1
- package/lib/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/routing-module-settings.interface.d.ts +1 -1
- package/lib/_models/interfaces/routing-module-settings.interface.d.ts.map +1 -1
- package/lib/_models/types/db-filter.type.d.ts.map +1 -1
- package/lib/_models/types/db-update.type.d.ts +2 -1
- package/lib/_models/types/db-update.type.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.d.ts +2 -2
- package/lib/_modules/custom-data/custom-data.controller.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.js +18 -16
- package/lib/_modules/custom-data/custom-data.controller.js.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.d.ts +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.js +4 -4
- package/lib/_modules/custom-data/custom-data.data-service.js.map +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.d.ts +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.d.ts.map +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.js +5 -5
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.js.map +1 -1
- package/lib/_modules/test/get-test-routing-module.util.d.ts +1 -1
- package/lib/_modules/test/get-test-routing-module.util.d.ts.map +1 -1
- package/lib/_modules/test/get-test-routing-module.util.js +5 -5
- package/lib/_modules/test/get-test-routing-module.util.js.map +1 -1
- package/lib/_modules/test/test.controller.d.ts +2 -2
- package/lib/_modules/test/test.controller.d.ts.map +1 -1
- package/lib/_modules/test/test.controller.js +33 -33
- package/lib/_modules/test/test.controller.js.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.d.ts +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.d.ts.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.js +5 -5
- package/lib/_modules/usage/get-usage-routing-module.util.js.map +1 -1
- package/lib/_modules/usage/usage.controller.d.ts +2 -2
- package/lib/_modules/usage/usage.controller.d.ts.map +1 -1
- package/lib/_modules/usage/usage.controller.js +16 -16
- package/lib/_modules/usage/usage.controller.js.map +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.data-service.js +4 -4
- package/lib/_modules/usage/usage.data-service.js.map +1 -1
- package/lib/_services/base/data.service.d.ts +3 -3
- package/lib/_services/base/data.service.d.ts.map +1 -1
- package/lib/_services/base/data.service.js +15 -15
- package/lib/_services/base/data.service.js.map +1 -1
- package/lib/_services/base/db.service.d.ts +3 -3
- package/lib/_services/base/db.service.d.ts.map +1 -1
- package/lib/_services/base/db.service.js +10 -6
- package/lib/_services/base/db.service.js.map +1 -1
- package/lib/_services/core/api.service.d.ts +4 -4
- package/lib/_services/core/api.service.d.ts.map +1 -1
- package/lib/_services/core/api.service.js +9 -9
- package/lib/_services/core/api.service.js.map +1 -1
- package/lib/_services/core/email.service.d.ts +4 -4
- package/lib/_services/core/email.service.d.ts.map +1 -1
- package/lib/_services/core/email.service.js.map +1 -1
- package/lib/_services/core/global.service.d.ts +12 -12
- package/lib/_services/core/global.service.d.ts.map +1 -1
- package/lib/_services/core/global.service.js +14 -1
- package/lib/_services/core/global.service.js.map +1 -1
- package/lib/_services/core/service-collection.service.d.ts +1 -1
- package/lib/_services/core/service-collection.service.d.ts.map +1 -1
- package/lib/_services/core/service-collection.service.js +3 -3
- package/lib/_services/core/service-collection.service.js.map +1 -1
- package/lib/_services/route/controller.service.d.ts +2 -2
- package/lib/_services/route/controller.service.d.ts.map +1 -1
- package/lib/_services/route/controller.service.js.map +1 -1
- package/lib/_services/route/routing-module.service.d.ts +4 -4
- package/lib/_services/route/routing-module.service.d.ts.map +1 -1
- package/lib/_services/route/routing-module.service.js +2 -2
- package/lib/_services/route/routing-module.service.js.map +1 -1
- package/lib/_services/server/app-extended.server.d.ts +2 -2
- package/lib/_services/server/app-extended.server.js +5 -5
- package/lib/_services/server/app-extended.server.js.map +1 -1
- package/lib/_services/server/app-extended.server.spec.js +3 -3
- package/lib/_services/server/app-extended.server.spec.js.map +1 -1
- package/lib/_services/server/app.server.d.ts +14 -14
- package/lib/_services/server/app.server.d.ts.map +1 -1
- package/lib/_services/server/app.server.js +8 -8
- package/lib/_services/server/app.server.js.map +1 -1
- package/lib/_services/server/app.server.spec.js +3 -3
- package/lib/_services/server/app.server.spec.js.map +1 -1
- package/lib/_services/shared.static-service.d.ts +3 -3
- package/lib/_services/shared.static-service.d.ts.map +1 -1
- package/lib/_services/shared.static-service.js +1 -1
- package/lib/_services/shared.static-service.js.map +1 -1
- package/lib/_services/socket/socket-client.service.d.ts +3 -3
- package/lib/_services/socket/socket-client.service.d.ts.map +1 -1
- package/lib/_services/socket/socket-client.service.js +24 -18
- package/lib/_services/socket/socket-client.service.js.map +1 -1
- package/lib/_services/socket/socket-server.service.d.ts +3 -3
- package/lib/_services/socket/socket-server.service.d.ts.map +1 -1
- package/lib/_services/socket/socket-server.service.js +5 -5
- package/lib/_services/socket/socket-server.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/_constants/global-settings.const.ts +2 -2
- package/src/_constants/mocks/app-extended-server.mock.ts +34 -35
- package/src/_constants/mocks/app-params.mock.ts +2 -2
- package/src/_constants/mocks/app-server.mock.ts +30 -30
- package/src/_constants/mocks/data-model.mock.ts +23 -23
- package/src/_constants/mocks/email-service-collection.mock.ts +2 -2
- package/src/_constants/mocks/endpoint.mock.ts +22 -22
- package/src/_constants/mocks/socket-client.mock.ts +3 -3
- package/src/_constants/mocks/socket-server.mock.ts +3 -3
- package/src/_enums/data-model-type.enum.ts +1 -0
- package/src/_models/control-models/api-call-params.control-model.ts +3 -3
- package/src/_models/control-models/app-params.control-model.ts +2 -2
- package/src/_models/control-models/endpoint-params.control-model.ts +7 -7
- package/src/_models/control-models/http-settings.control-model.ts +2 -2
- package/src/_models/control-models/socket-client-service-params.control-model.ts +2 -2
- package/src/_models/control-models/socket-event.control-model.ts +5 -5
- package/src/_models/control-models/socket-presence.control-model.ts +12 -0
- package/src/_models/control-models/socket-server-service-params.control-model.ts +4 -4
- package/src/_models/interfaces/certification-settings.interface.ts +1 -1
- package/src/_models/interfaces/global-service-settings.interface.ts +6 -6
- package/src/_models/interfaces/global-settings.interface.ts +1 -1
- package/src/_models/interfaces/routing-module-settings.interface.ts +1 -1
- package/src/_models/types/db-filter.type.ts +5 -2
- package/src/_models/types/db-update.type.ts +3 -2
- package/src/_modules/custom-data/custom-data.controller.ts +20 -18
- package/src/_modules/custom-data/custom-data.data-service.ts +6 -4
- package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +7 -7
- package/src/_modules/test/get-test-routing-module.util.ts +7 -7
- package/src/_modules/test/test.controller.ts +34 -34
- package/src/_modules/usage/get-usage-routing-module.util.ts +7 -7
- package/src/_modules/usage/usage.controller.ts +18 -19
- package/src/_modules/usage/usage.data-service.ts +3 -3
- package/src/_services/base/data.service.ts +21 -20
- package/src/_services/base/db.service.ts +15 -12
- package/src/_services/core/api.service.ts +22 -22
- package/src/_services/core/email.service.ts +4 -4
- package/src/_services/core/global.service.ts +29 -15
- package/src/_services/core/service-collection.service.ts +1 -1
- package/src/_services/route/controller.service.ts +2 -2
- package/src/_services/route/routing-module.service.ts +12 -12
- package/src/_services/server/app-extended.server.spec.ts +4 -4
- package/src/_services/server/app-extended.server.ts +5 -5
- package/src/_services/server/app.server.spec.ts +4 -4
- package/src/_services/server/app.server.ts +27 -27
- package/src/_services/shared.static-service.ts +7 -4
- package/src/_services/socket/socket-client.service.ts +69 -37
- package/src/_services/socket/socket-server.service.ts +9 -9
- package/tsconfig.json +1 -0
- package/lib/_models/control-models/app-system-controls.control-model copy.d.ts.map +0 -1
- package/lib/_models/control-models/app-system-controls.control-model copy.js.map +0 -1
- /package/src/_models/control-models/{app-system-controls.control-model copy.ts → app-ext-system-controls.control-model.ts} +0 -0
|
@@ -3,15 +3,15 @@ import { Router } from 'express';
|
|
|
3
3
|
|
|
4
4
|
import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { DynamoNTS_globalSettings } from '../../_constants/global-settings.const';
|
|
7
7
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
8
8
|
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
9
9
|
import { DynamoNTS_Controller } from './controller.service';
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
DynamoNTS_RoutingModule_Settings
|
|
12
12
|
} from '../../_models/interfaces/routing-module-settings.interface';
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
DynamoNTS_Endpoint_Params
|
|
15
15
|
} from '../../_models/control-models/endpoint-params.control-model';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -64,23 +64,23 @@ export class DynamoNTS_RoutingModule {
|
|
|
64
64
|
route: string;
|
|
65
65
|
|
|
66
66
|
private controllers: DynamoNTS_Controller[];
|
|
67
|
-
endpoints:
|
|
67
|
+
endpoints: DynamoNTS_Endpoint_Params[] = [];
|
|
68
68
|
|
|
69
69
|
openRouter: Router = Router();
|
|
70
70
|
secureRouter: Router = Router();
|
|
71
71
|
|
|
72
|
-
protected log: boolean =
|
|
72
|
+
protected log: boolean = DynamoNTS_globalSettings.logSetup;
|
|
73
73
|
|
|
74
74
|
defaultErrorUserMsg =
|
|
75
75
|
`We encountered an uncought BackEnd Build Error, ` +
|
|
76
76
|
`\nplease contact the responsible development team.`;
|
|
77
77
|
|
|
78
78
|
constructor(
|
|
79
|
-
set:
|
|
79
|
+
set: DynamoNTS_RoutingModule_Settings
|
|
80
80
|
){
|
|
81
81
|
try {
|
|
82
82
|
this.serviceName = set.route.replace('/', '') + 'RoutingModule';
|
|
83
|
-
this.route =
|
|
83
|
+
this.route = DynamoNTS_globalSettings.baseUrl + set.route;
|
|
84
84
|
this.controllers = set.controllers ?? [];
|
|
85
85
|
this.setupRoutes();
|
|
86
86
|
this.mountRoutes(set.securityOverride);
|
|
@@ -111,7 +111,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
111
111
|
this.security = securityOverride;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
this.endpoints.forEach((endpoint:
|
|
114
|
+
this.endpoints.forEach((endpoint: DynamoNTS_Endpoint_Params): void => {
|
|
115
115
|
if (securityOverride) {
|
|
116
116
|
endpoint.security = securityOverride;
|
|
117
117
|
} else {
|
|
@@ -127,8 +127,8 @@ export class DynamoNTS_RoutingModule {
|
|
|
127
127
|
if (this.log) console.log(
|
|
128
128
|
`endpoint mount (${endpoint.security}): ${this.route}${endpoint.endpoint}`
|
|
129
129
|
);
|
|
130
|
-
const existingEndPoints:
|
|
131
|
-
.filter((ep:
|
|
130
|
+
const existingEndPoints: DynamoNTS_Endpoint_Params[] = this.endpoints
|
|
131
|
+
.filter((ep: DynamoNTS_Endpoint_Params): boolean => ep.endpoint === endpoint.endpoint);
|
|
132
132
|
|
|
133
133
|
if (1 < existingEndPoints.length) {
|
|
134
134
|
const error = new Error(`ENDPOINT DUPLICATION: ${endpoint.endpoint}`);
|
|
@@ -167,7 +167,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
167
167
|
*
|
|
168
168
|
* @param endpointParams
|
|
169
169
|
*/
|
|
170
|
-
private mountOpenRoute(endpointParams:
|
|
170
|
+
private mountOpenRoute(endpointParams: DynamoNTS_Endpoint_Params): void {
|
|
171
171
|
switch(endpointParams.type) {
|
|
172
172
|
|
|
173
173
|
case DynamoNTS_HttpCallType.get:
|
|
@@ -209,7 +209,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
209
209
|
*
|
|
210
210
|
* @param endpointParams
|
|
211
211
|
*/
|
|
212
|
-
private mountSecureRoute(endpointParams:
|
|
212
|
+
private mountSecureRoute(endpointParams: DynamoNTS_Endpoint_Params): void {
|
|
213
213
|
switch(endpointParams.type) {
|
|
214
214
|
case DynamoNTS_HttpCallType.get:
|
|
215
215
|
this.secureRouter.get(endpointParams.endpoint, endpointParams.getFullExecution());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dynamo_delay } from '@futdevpro/fsm-dynamo';
|
|
2
2
|
import {
|
|
3
3
|
DynamoNTS_AppExtendedBase_Mock, DynamoNTS_AppExtendedFull_Mock, DynamoNTS_AppWbMock_Mock
|
|
4
4
|
} from '../../_constants/mocks/app-extended-server.mock';
|
|
@@ -10,7 +10,7 @@ describe('DynamoNTS_AppExtended;', (): void => {
|
|
|
10
10
|
beforeEach(async (): Promise<void> => {
|
|
11
11
|
app = new DynamoNTS_AppExtendedBase_Mock();
|
|
12
12
|
|
|
13
|
-
await
|
|
13
|
+
await Dynamo_delay(100);
|
|
14
14
|
|
|
15
15
|
await app.ready();
|
|
16
16
|
});
|
|
@@ -18,7 +18,7 @@ describe('DynamoNTS_AppExtended;', (): void => {
|
|
|
18
18
|
afterEach(async (): Promise<void> => {
|
|
19
19
|
await app.stop();
|
|
20
20
|
|
|
21
|
-
await
|
|
21
|
+
await Dynamo_delay(100);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it('should be created', (): void => {
|
|
@@ -62,7 +62,7 @@ describe('DynamoNTS_AppExtended;', (): void => {
|
|
|
62
62
|
afterEach(async (): Promise<void> => {
|
|
63
63
|
await app.stop();
|
|
64
64
|
|
|
65
|
-
await
|
|
65
|
+
await Dynamo_delay(100);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
it('should be created', (): void => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as SocketIO from 'socket.io';
|
|
3
3
|
import * as Http from 'http';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Dynamo_Array, Dynamo_Error, Dynamo_Log, second, Dynamo_wait } from '@futdevpro/fsm-dynamo';
|
|
6
6
|
|
|
7
7
|
import { DynamoNTS_App } from './app.server';
|
|
8
8
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
@@ -10,7 +10,7 @@ import { DynamoNTS_SocketServerService } from '../socket/socket-server.service';
|
|
|
10
10
|
import { DynamoNTS_SocketSecurity } from '../../_enums/socket-security.enum';
|
|
11
11
|
import {
|
|
12
12
|
DynamoNTS_AppExtSysControls
|
|
13
|
-
} from '../../_models/control-models/app-system-controls.control-model
|
|
13
|
+
} from '../../_models/control-models/app-ext-system-controls.control-model';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* This will be the MAIN service of our server project,
|
|
@@ -58,8 +58,8 @@ import {
|
|
|
58
58
|
* matchStatisticsModelParams,
|
|
59
59
|
* matchDataModelParams,
|
|
60
60
|
|
|
61
|
-
*
|
|
62
|
-
*
|
|
61
|
+
* Dynamo_usageSessionModel_params,
|
|
62
|
+
* Dynamo_customDataModel_params,
|
|
63
63
|
* ]
|
|
64
64
|
* });
|
|
65
65
|
* }
|
|
@@ -238,7 +238,7 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
if (!ready) {
|
|
241
|
-
await
|
|
241
|
+
await Dynamo_wait(100);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Dynamo_Log,
|
|
2
|
+
import { Dynamo_Log, Dynamo_delay } from '@futdevpro/fsm-dynamo';
|
|
3
3
|
import {
|
|
4
4
|
DynamoNTS_AppBase_Mock, DynamoNTS_AppFull_Mock
|
|
5
5
|
} from '../../_constants/mocks/app-server.mock';
|
|
@@ -14,7 +14,7 @@ describe('DynamoNTS_App AND DynamoNTS_AppExtended?;', (): void => {
|
|
|
14
14
|
try {
|
|
15
15
|
app = new DynamoNTS_AppBase_Mock();
|
|
16
16
|
|
|
17
|
-
await
|
|
17
|
+
await Dynamo_delay(100);
|
|
18
18
|
|
|
19
19
|
await app.ready();
|
|
20
20
|
} catch (error) {
|
|
@@ -25,7 +25,7 @@ describe('DynamoNTS_App AND DynamoNTS_AppExtended?;', (): void => {
|
|
|
25
25
|
afterEach(async (): Promise<void> => {
|
|
26
26
|
await app.stop();
|
|
27
27
|
|
|
28
|
-
await
|
|
28
|
+
await Dynamo_delay(100);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it('should be created', (): void => {
|
|
@@ -52,7 +52,7 @@ describe('DynamoNTS_App AND DynamoNTS_AppExtended?;', (): void => {
|
|
|
52
52
|
afterEach(async (): Promise<void> => {
|
|
53
53
|
await app.stop();
|
|
54
54
|
|
|
55
|
-
await
|
|
55
|
+
await Dynamo_delay(100);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it('should be created', (): void => {
|
|
@@ -13,26 +13,26 @@ import * as BodyParser from 'body-parser';
|
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
15
|
Dynamo_AnyError,
|
|
16
|
-
Dynamo_Array, Dynamo_Error,
|
|
16
|
+
Dynamo_Array, Dynamo_Error, Dynamo_error_defaults,
|
|
17
17
|
Dynamo_Error_Settings,
|
|
18
|
-
Dynamo_ErrorLevel, Dynamo_Log, second,
|
|
18
|
+
Dynamo_ErrorLevel, Dynamo_Log, second, Dynamo_wait
|
|
19
19
|
} from '@futdevpro/fsm-dynamo';
|
|
20
20
|
|
|
21
21
|
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
22
22
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
23
23
|
import { DynamoNTS_RoutingModule } from '../route/routing-module.service';
|
|
24
24
|
import { DynamoNTS_GlobalService } from '../core/global.service';
|
|
25
|
-
import {
|
|
25
|
+
import { DynamoNTS_Http_Settings } from '../../_models/control-models/http-settings.control-model';
|
|
26
26
|
import {
|
|
27
|
-
|
|
27
|
+
DynamoNTS_Certification_Settings
|
|
28
28
|
} from '../../_models/interfaces/certification-settings.interface';
|
|
29
29
|
import {
|
|
30
|
-
|
|
30
|
+
DynamoNTS_GlobalService_Settings
|
|
31
31
|
} from '../../_models/interfaces/global-service-settings.interface';
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
32
|
+
import { DynamoNTS_globalSettings } from '../../_constants/global-settings.const';
|
|
33
|
+
import { DynamoNTS_App_Params } from '../../_models/control-models/app-params.control-model';
|
|
34
34
|
import {
|
|
35
|
-
|
|
35
|
+
DynamoNTS_Endpoint_Params
|
|
36
36
|
} from '../../_models/control-models/endpoint-params.control-model';
|
|
37
37
|
import {
|
|
38
38
|
DynamoNTS_AppSystemControls
|
|
@@ -83,8 +83,8 @@ import {
|
|
|
83
83
|
* matchStatisticsModelParams,
|
|
84
84
|
* matchDataModelParams,
|
|
85
85
|
|
|
86
|
-
*
|
|
87
|
-
*
|
|
86
|
+
* Dynamo_usageSessionModel_params,
|
|
87
|
+
* Dynamo_customDataModel_params,
|
|
88
88
|
* ]
|
|
89
89
|
* });
|
|
90
90
|
* }
|
|
@@ -217,8 +217,8 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
217
217
|
return this.params.name;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
private _params:
|
|
221
|
-
protected get params():
|
|
220
|
+
private _params: DynamoNTS_App_Params;
|
|
221
|
+
protected get params(): DynamoNTS_App_Params {
|
|
222
222
|
return this._params;
|
|
223
223
|
}
|
|
224
224
|
|
|
@@ -229,13 +229,13 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
229
229
|
return this._security;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
protected _portSettings:
|
|
233
|
-
protected get portSettings():
|
|
232
|
+
protected _portSettings: DynamoNTS_Http_Settings = new DynamoNTS_Http_Settings();
|
|
233
|
+
protected get portSettings(): DynamoNTS_Http_Settings {
|
|
234
234
|
return this._portSettings;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
private _cert?:
|
|
238
|
-
protected get cert():
|
|
237
|
+
private _cert?: DynamoNTS_Certification_Settings;
|
|
238
|
+
protected get cert(): DynamoNTS_Certification_Settings {
|
|
239
239
|
return this._cert;
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -315,11 +315,11 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
315
315
|
String.fromCharCode(7)
|
|
316
316
|
);
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
Dynamo_error_defaults.issuerSystem = this._params.systemName;
|
|
319
319
|
|
|
320
320
|
this.overrideDynamoNTSGlobalSettings?.();
|
|
321
321
|
|
|
322
|
-
this.logSetup =
|
|
322
|
+
this.logSetup = DynamoNTS_globalSettings.logSetup;
|
|
323
323
|
|
|
324
324
|
this.globalService = DynamoNTS_GlobalService.getInstance();
|
|
325
325
|
await DynamoNTS_GlobalService.setServices(this.getGlobalServiceCollection());
|
|
@@ -436,7 +436,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
if (!ready) {
|
|
439
|
-
await
|
|
439
|
+
await Dynamo_wait(100);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
|
|
@@ -541,7 +541,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
541
541
|
tryCount++ < 10
|
|
542
542
|
) {
|
|
543
543
|
Dynamo_Log.warn(`Mongoose not even started yet....`);
|
|
544
|
-
await
|
|
544
|
+
await Dynamo_wait(second);
|
|
545
545
|
}
|
|
546
546
|
this.systemControls.mongoose.started = false;
|
|
547
547
|
|
|
@@ -568,7 +568,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
568
568
|
!this.constructErrors.length
|
|
569
569
|
) {
|
|
570
570
|
Dynamo_Log.warn(`\nMongoose still not disconnected....`);
|
|
571
|
-
await
|
|
571
|
+
await Dynamo_wait(second);
|
|
572
572
|
}
|
|
573
573
|
} else {
|
|
574
574
|
Dynamo_Log.error(`\nMongoose not found.`);
|
|
@@ -694,7 +694,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
694
694
|
if (module.security != DynamoNTS_RouteSecurity.secure) {
|
|
695
695
|
errorMsg += `\n ${module.route} (security: ${module.security})`;
|
|
696
696
|
errorMsg += `\n subroutes using open sever:`;
|
|
697
|
-
module.endpoints.forEach((endpoint:
|
|
697
|
+
module.endpoints.forEach((endpoint: DynamoNTS_Endpoint_Params): void => {
|
|
698
698
|
if (endpoint.security != DynamoNTS_RouteSecurity.secure) {
|
|
699
699
|
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
700
700
|
}
|
|
@@ -735,7 +735,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
735
735
|
if (module.security && module.security !== DynamoNTS_RouteSecurity.open) {
|
|
736
736
|
errorMsg += `\n ${module.route} (security: ${module.security})`;
|
|
737
737
|
errorMsg += `\n subroutes using secure sever:`;
|
|
738
|
-
module.endpoints.forEach((endpoint:
|
|
738
|
+
module.endpoints.forEach((endpoint: DynamoNTS_Endpoint_Params): void => {
|
|
739
739
|
if (endpoint.security && endpoint.security !== DynamoNTS_RouteSecurity.open) {
|
|
740
740
|
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
741
741
|
}
|
|
@@ -1112,17 +1112,17 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
1112
1112
|
/**
|
|
1113
1113
|
* MISSING Description (TODO)
|
|
1114
1114
|
*/
|
|
1115
|
-
abstract getAppParams():
|
|
1115
|
+
abstract getAppParams(): DynamoNTS_App_Params;
|
|
1116
1116
|
|
|
1117
1117
|
/**
|
|
1118
1118
|
* MISSING Description (TODO)
|
|
1119
1119
|
*/
|
|
1120
|
-
abstract getGlobalServiceCollection():
|
|
1120
|
+
abstract getGlobalServiceCollection(): DynamoNTS_GlobalService_Settings;
|
|
1121
1121
|
|
|
1122
1122
|
/**
|
|
1123
1123
|
* MISSING Description (TODO)
|
|
1124
1124
|
*/
|
|
1125
|
-
abstract getPortSettings():
|
|
1125
|
+
abstract getPortSettings(): DynamoNTS_Http_Settings;
|
|
1126
1126
|
|
|
1127
1127
|
/**
|
|
1128
1128
|
* MISSING Description (TODO)
|
|
@@ -1142,7 +1142,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
|
|
|
1142
1142
|
/**
|
|
1143
1143
|
* MISSING Description (TODO)
|
|
1144
1144
|
*/
|
|
1145
|
-
getCertificationSettings?():
|
|
1145
|
+
getCertificationSettings?(): DynamoNTS_Certification_Settings;
|
|
1146
1146
|
|
|
1147
1147
|
/**
|
|
1148
1148
|
* MISSING Description (TODO)
|
|
@@ -3,7 +3,7 @@ import * as ReadLine from 'readline';
|
|
|
3
3
|
import * as GeoIp from 'geoip-lite';
|
|
4
4
|
import { Request } from 'express';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { Dynamo_GeoIpLocation, Dynamo_Shared } from '@futdevpro/fsm-dynamo/shared-service';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -17,13 +17,16 @@ export class DynamoNTS_Shared extends Dynamo_Shared {
|
|
|
17
17
|
*/
|
|
18
18
|
static getIpFromRequest(request: Request): string {
|
|
19
19
|
let ip: string;
|
|
20
|
+
|
|
20
21
|
if (request.headers['x-forwarded-for']) {
|
|
21
22
|
const route: string[] = (request.headers['x-forwarded-for'] as string).split(', ');
|
|
23
|
+
|
|
22
24
|
console.log('TESTTTT route:', route);
|
|
23
25
|
ip = route[route.length - 1];
|
|
24
26
|
} else {
|
|
25
27
|
ip = request.socket.remoteAddress;
|
|
26
28
|
}
|
|
29
|
+
|
|
27
30
|
return ip;
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -32,7 +35,7 @@ export class DynamoNTS_Shared extends Dynamo_Shared {
|
|
|
32
35
|
* @param request
|
|
33
36
|
* @returns
|
|
34
37
|
*/
|
|
35
|
-
static getLocationDataByRequest(request: Request):
|
|
38
|
+
static getLocationDataByRequest(request: Request): Dynamo_GeoIpLocation {
|
|
36
39
|
return GeoIp.lookup(this.getIpFromRequest(request));
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -41,7 +44,7 @@ export class DynamoNTS_Shared extends Dynamo_Shared {
|
|
|
41
44
|
* @param request
|
|
42
45
|
* @returns
|
|
43
46
|
*/
|
|
44
|
-
static getLocationByIp(ip: string):
|
|
47
|
+
static getLocationByIp(ip: string): Dynamo_GeoIpLocation {
|
|
45
48
|
return GeoIp.lookup(ip);
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -53,7 +56,7 @@ export class DynamoNTS_Shared extends Dynamo_Shared {
|
|
|
53
56
|
static async prompt(question: string): Promise<string> {
|
|
54
57
|
const readLine = ReadLine.createInterface({
|
|
55
58
|
input: process.stdin,
|
|
56
|
-
output: process.stdout
|
|
59
|
+
output: process.stdout,
|
|
57
60
|
});
|
|
58
61
|
|
|
59
62
|
return new Promise((resolve, reject) => {
|
|
@@ -5,26 +5,28 @@ import * as SocketIO from 'socket.io-client';
|
|
|
5
5
|
|
|
6
6
|
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
7
7
|
import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
8
|
+
import { Dynamo_delay, Dynamo_Array } from '@futdevpro/fsm-dynamo/utils';
|
|
9
|
+
import {
|
|
10
|
+
DynamoNTS_SocketClientService_Params
|
|
11
|
+
} from '../../_models/control-models/socket-client-service-params.control-model';
|
|
12
|
+
import { DynamoNTS_globalSettings } from '../../_constants/global-settings.const';
|
|
11
13
|
import { DynamoNTS_SocketEvent } from '../../_models/control-models/socket-event.control-model';
|
|
12
14
|
import { DynamoNTS_SocketEventKey } from '../../_enums/http/socket-event-type.enum';
|
|
13
15
|
|
|
14
16
|
export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonService {
|
|
15
17
|
|
|
16
|
-
private _params:
|
|
17
|
-
protected get params():
|
|
18
|
+
private _params: DynamoNTS_SocketClientService_Params;
|
|
19
|
+
protected get params(): DynamoNTS_SocketClientService_Params { return this._params; }
|
|
18
20
|
get name(): string { return this.params.name; }
|
|
19
21
|
|
|
20
|
-
protected socket: SocketIO.Socket
|
|
22
|
+
protected socket: SocketIO.Socket;
|
|
21
23
|
|
|
22
24
|
protected incomingEvents: DynamoNTS_SocketEvent<any>[];
|
|
23
25
|
|
|
24
26
|
protected _connected: boolean = false;
|
|
25
27
|
get connected(): boolean { return this._connected; }
|
|
26
28
|
|
|
27
|
-
protected debugLog: boolean =
|
|
29
|
+
protected debugLog: boolean = DynamoNTS_globalSettings.logSetup;
|
|
28
30
|
protected logFn: boolean;
|
|
29
31
|
|
|
30
32
|
private defaultEvents: DynamoNTS_SocketEvent<any>[] = [
|
|
@@ -34,8 +36,8 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
34
36
|
async () => {
|
|
35
37
|
this._connected = true;
|
|
36
38
|
Dynamo_Log.success(`< > socket-client(${this.params.name}) connected!`);
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
+
},
|
|
40
|
+
],
|
|
39
41
|
}),
|
|
40
42
|
|
|
41
43
|
new DynamoNTS_SocketEvent<any>({
|
|
@@ -46,11 +48,11 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
46
48
|
Dynamo_Log.warn(`<x > socket-client(${this.params.name}) disconnected!`);
|
|
47
49
|
|
|
48
50
|
if (this._params.reconnect) {
|
|
49
|
-
await
|
|
51
|
+
await Dynamo_delay(this._params.reconnectDelay);
|
|
50
52
|
this.connectSocket();
|
|
51
53
|
}
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
+
},
|
|
55
|
+
],
|
|
54
56
|
}),
|
|
55
57
|
|
|
56
58
|
new DynamoNTS_SocketEvent<any>({
|
|
@@ -58,8 +60,8 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
58
60
|
tasks: [
|
|
59
61
|
async () => {
|
|
60
62
|
Dynamo_Log.success(`<=--> socket-client(${this.params.name}) subscription successful!`);
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
+
},
|
|
64
|
+
],
|
|
63
65
|
}),
|
|
64
66
|
|
|
65
67
|
new DynamoNTS_SocketEvent<any>({
|
|
@@ -67,8 +69,8 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
67
69
|
tasks: [
|
|
68
70
|
async (content: any) => {
|
|
69
71
|
Dynamo_Log.error(`=--> socket-client(${this.params.name}) ERROR!:`, content);
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
+
},
|
|
73
|
+
],
|
|
72
74
|
}),
|
|
73
75
|
];
|
|
74
76
|
|
|
@@ -84,7 +86,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
84
86
|
try {
|
|
85
87
|
this._params = this.getParams();
|
|
86
88
|
this.incomingEvents = this.getIncomingEvents() ?? [];
|
|
87
|
-
this.socket = SocketIO.io(`${this.params.address}:${this.params.port}
|
|
89
|
+
this.socket = SocketIO.io(`${this.params.address}:${this.params.port}`);
|
|
88
90
|
|
|
89
91
|
await this.setupDefaultEvents();
|
|
90
92
|
|
|
@@ -95,6 +97,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
95
97
|
await this.connectSocket();
|
|
96
98
|
} catch (error) {
|
|
97
99
|
Dynamo_Log.error(`socket-client(${this.params?.name}) Service setup failed!`, error);
|
|
100
|
+
|
|
98
101
|
throw new Dynamo_Error({
|
|
99
102
|
errorCode: 'NTS-SCS-001',
|
|
100
103
|
error: error,
|
|
@@ -108,7 +111,10 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
108
111
|
|
|
109
112
|
this.defaultEvents.forEach((defaultEvent: DynamoNTS_SocketEvent<any>) => {
|
|
110
113
|
defaultEvent.serviceName = this.params.name;
|
|
111
|
-
const eventDeclared = this.incomingEvents.find(
|
|
114
|
+
const eventDeclared = this.incomingEvents.find(
|
|
115
|
+
(event: DynamoNTS_SocketEvent<any>) => event.eventKey === defaultEvent.eventKey
|
|
116
|
+
);
|
|
117
|
+
|
|
112
118
|
if (!eventDeclared) {
|
|
113
119
|
this.incomingEvents.push(defaultEvent);
|
|
114
120
|
} else {
|
|
@@ -116,7 +122,11 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
116
122
|
}
|
|
117
123
|
});
|
|
118
124
|
} catch (error) {
|
|
119
|
-
Dynamo_Log.error(
|
|
125
|
+
Dynamo_Log.error(
|
|
126
|
+
`socket-client(${this.params.name}) Service Setup Default Events failed, ` +
|
|
127
|
+
`ERROR:`, error
|
|
128
|
+
);
|
|
129
|
+
|
|
120
130
|
throw error;
|
|
121
131
|
}
|
|
122
132
|
}
|
|
@@ -125,26 +135,36 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
125
135
|
try {
|
|
126
136
|
if (this.debugLog) console.log(`Setup socket-client(${this.params.name}) Events...`);
|
|
127
137
|
|
|
128
|
-
await Dynamo_Array.asyncForEach(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
await Dynamo_Array.asyncForEach(
|
|
139
|
+
this.incomingEvents,
|
|
140
|
+
async (event: DynamoNTS_SocketEvent<any>) => {
|
|
141
|
+
event.serviceName = this.params.name;
|
|
142
|
+
this.socket.on(event.eventKey, async (content: any) => {
|
|
143
|
+
try {
|
|
144
|
+
await event.executeEventTasks(content, this.params.service);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
Dynamo_Log.error(`socket-client(${this.params.name}) Event failed, ERROR:`, error);
|
|
147
|
+
await this.emitEvent(DynamoNTS_SocketEventKey.error, error);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
);
|
|
139
152
|
} catch (error) {
|
|
140
|
-
Dynamo_Log.error(
|
|
153
|
+
Dynamo_Log.error(
|
|
154
|
+
`socket-client(${this.params.name}) Service Setup Socket Events failed, ` +
|
|
155
|
+
`ERROR:`, error
|
|
156
|
+
);
|
|
157
|
+
|
|
141
158
|
throw error;
|
|
142
159
|
}
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
private async connectSocket(): Promise<void> {
|
|
146
163
|
try {
|
|
147
|
-
Dynamo_Log.info(
|
|
164
|
+
Dynamo_Log.info(
|
|
165
|
+
`< .. > socket-client(${this.params.name}) ` +
|
|
166
|
+
`connecting to ${this.params.address}:${this.params.port} ...`
|
|
167
|
+
);
|
|
148
168
|
|
|
149
169
|
this.socket.connect();
|
|
150
170
|
|
|
@@ -152,7 +172,11 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
152
172
|
await this.tryReconnectIfNeeded();
|
|
153
173
|
}
|
|
154
174
|
} catch (error) {
|
|
155
|
-
Dynamo_Log.error(
|
|
175
|
+
Dynamo_Log.error(
|
|
176
|
+
`socket-client(${this.params.name}) Service Connect Socket failed, ` +
|
|
177
|
+
`ERROR:`, error
|
|
178
|
+
);
|
|
179
|
+
|
|
156
180
|
throw error;
|
|
157
181
|
}
|
|
158
182
|
}
|
|
@@ -160,13 +184,17 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
160
184
|
private async tryReconnectIfNeeded(): Promise<void> {
|
|
161
185
|
try {
|
|
162
186
|
if (this.logFn) console.log(`\nFn:. tryReconnectIfNeeded`);
|
|
163
|
-
await
|
|
187
|
+
await Dynamo_delay(this._params.reconnectDelay);
|
|
164
188
|
|
|
165
189
|
if (!this._connected) {
|
|
166
190
|
await this.connectSocket();
|
|
167
191
|
}
|
|
168
192
|
} catch (error) {
|
|
169
|
-
Dynamo_Log.error(
|
|
193
|
+
Dynamo_Log.error(
|
|
194
|
+
`socket-client(${this.params.name}) Service Try Reconnect failed, ` +
|
|
195
|
+
`ERROR:`, error
|
|
196
|
+
);
|
|
197
|
+
|
|
170
198
|
throw error;
|
|
171
199
|
}
|
|
172
200
|
}
|
|
@@ -181,7 +209,11 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
181
209
|
Dynamo_Log.log(`<=-- outgoing socket-client(${this.params.name}) event: ${eventType}`);
|
|
182
210
|
this.socket.emit(eventType, content);
|
|
183
211
|
} catch (error) {
|
|
184
|
-
Dynamo_Log.error(
|
|
212
|
+
Dynamo_Log.error(
|
|
213
|
+
`socket-client(${this.params.name}) ` +
|
|
214
|
+
`Service Emit Event failed: ${this.params?.name} (${this.params?.port})`, error
|
|
215
|
+
);
|
|
216
|
+
|
|
185
217
|
throw error;
|
|
186
218
|
}
|
|
187
219
|
}
|
|
@@ -189,7 +221,7 @@ export abstract class DynamoNTS_SocketClientService extends DynamoNTS_SingletonS
|
|
|
189
221
|
/**
|
|
190
222
|
* You must setup params for the service in this function
|
|
191
223
|
*/
|
|
192
|
-
abstract getParams():
|
|
224
|
+
abstract getParams(): DynamoNTS_SocketClientService_Params;
|
|
193
225
|
|
|
194
226
|
/**
|
|
195
227
|
* You must setup events and required services in this function
|