@futdevpro/nts-dynamo 1.7.27 → 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 +14 -3
- 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 +4 -3
- package/lib/_services/base/data.service.d.ts.map +1 -1
- package/lib/_services/base/data.service.js +22 -18
- 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 +11 -7
- 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 +24 -4
- 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 +32 -25
- package/src/_services/base/db.service.ts +17 -14
- 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,19 +3,19 @@
|
|
|
3
3
|
import { Request, Response } from 'express';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
Dynamo_Metadata,
|
|
6
|
+
Dynamo_Metadata, Dynamo_DataModel_Params, Dynamo_Log, Dynamo_Error, Dynamo_Array
|
|
7
7
|
} from '@futdevpro/fsm-dynamo';
|
|
8
|
-
import {
|
|
8
|
+
import { DynamoNTS_App_Params } from '../../_models/control-models/app-params.control-model';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
DynamoNTS_GlobalService_Settings
|
|
12
12
|
} from '../../_models/interfaces/global-service-settings.interface';
|
|
13
13
|
|
|
14
14
|
import { DynamoNTS_AuthService } from './auth.service';
|
|
15
15
|
/* import { DynamoNTS_DBServiceCollection } from './db-service-collection.service'; */
|
|
16
16
|
import { DynamoNTS_DBService } from '../base/db.service';
|
|
17
17
|
import { DynamoNTS_EmailService } from './email.service';
|
|
18
|
-
import {
|
|
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
21
|
|
|
@@ -30,8 +30,8 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
30
30
|
return DynamoNTS_GlobalService.getSingletonInstance();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
private static _params:
|
|
34
|
-
static get params():
|
|
33
|
+
private static _params: DynamoNTS_App_Params;
|
|
34
|
+
static get params(): DynamoNTS_App_Params {
|
|
35
35
|
return this._params;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -44,8 +44,8 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
authService: DynamoNTS_AuthService;
|
|
47
|
-
dbServiceCollection:
|
|
48
|
-
emailServiceCollection:
|
|
47
|
+
dbServiceCollection: DynamoNTS_Service_Collection<DynamoNTS_DBService<any>>;
|
|
48
|
+
emailServiceCollection: DynamoNTS_Service_Collection<DynamoNTS_EmailService>;
|
|
49
49
|
|
|
50
50
|
static globalErrorHandler?: (
|
|
51
51
|
err: any,
|
|
@@ -57,21 +57,35 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
57
57
|
/**
|
|
58
58
|
* You need to setup global Services through this function
|
|
59
59
|
*/
|
|
60
|
-
static async setServices(set:
|
|
60
|
+
static async setServices(set: DynamoNTS_GlobalService_Settings): Promise<void> {
|
|
61
61
|
this.getInstance();
|
|
62
62
|
|
|
63
63
|
try {
|
|
64
64
|
this.instance.dbServiceCollection = {};
|
|
65
|
-
set.dbModels?.forEach((dbModel:
|
|
65
|
+
set.dbModels?.forEach((dbModel: Dynamo_DataModel_Params): void => {
|
|
66
|
+
if (!dbModel.constructed) {
|
|
67
|
+
throw new Dynamo_Error({
|
|
68
|
+
message: `DynamoNTS_GlobalService.setServices failed, ` +
|
|
69
|
+
`ERROR: dbModel is not constructed!`,
|
|
70
|
+
errorCode: 'NTS-GS0-SS1',
|
|
71
|
+
additionalContent: {
|
|
72
|
+
dbModel: dbModel,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
66
77
|
try {
|
|
67
78
|
this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
|
|
68
79
|
} catch (error) {
|
|
69
80
|
Dynamo_Log.error(`Failed to create DynamoNTS_DBService (${dbModel.dataName}).`, error);
|
|
70
81
|
|
|
71
82
|
throw new Dynamo_Error({
|
|
72
|
-
message: `Failed to create DynamoNTS_DBService (${dbModel.dataName})
|
|
83
|
+
message: `Failed to create DynamoNTS_DBService (${dbModel.dataName}).`,
|
|
73
84
|
issuerService: 'DynamoNTS_GlobalService',
|
|
74
85
|
error: error,
|
|
86
|
+
additionalContent: {
|
|
87
|
+
dbModel: dbModel,
|
|
88
|
+
},
|
|
75
89
|
});
|
|
76
90
|
}
|
|
77
91
|
});
|
|
@@ -102,7 +116,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
102
116
|
}
|
|
103
117
|
}
|
|
104
118
|
|
|
105
|
-
static setParams(params:
|
|
119
|
+
static setParams(params: DynamoNTS_App_Params): void {
|
|
106
120
|
this._params = params;
|
|
107
121
|
}
|
|
108
122
|
|
|
@@ -126,7 +140,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
126
140
|
*
|
|
127
141
|
* @returns
|
|
128
142
|
*/
|
|
129
|
-
static getDBServiceCollection():
|
|
143
|
+
static getDBServiceCollection(): DynamoNTS_Service_Collection<DynamoNTS_DBService<any>> {
|
|
130
144
|
if (!this.instance?.dbServiceCollection) {
|
|
131
145
|
throw new Error(
|
|
132
146
|
`\n Unique DataBase Service Collection missing!` +
|
|
@@ -145,7 +159,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
145
159
|
* @returns
|
|
146
160
|
*/
|
|
147
161
|
static getDBService<T extends Dynamo_Metadata>(
|
|
148
|
-
dataParams:
|
|
162
|
+
dataParams: Dynamo_DataModel_Params
|
|
149
163
|
): DynamoNTS_DBService<T> {
|
|
150
164
|
return this.getDBServiceByKey<T>(dataParams.dataName);
|
|
151
165
|
}
|
|
@@ -178,7 +192,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
178
192
|
*
|
|
179
193
|
* @returns
|
|
180
194
|
*/
|
|
181
|
-
static getEmailServiceCollection():
|
|
195
|
+
static getEmailServiceCollection(): DynamoNTS_Service_Collection<DynamoNTS_EmailService> {
|
|
182
196
|
if (!this.instance?.emailServiceCollection) {
|
|
183
197
|
throw new Error(
|
|
184
198
|
`\n Unique Email Service Collection missing!` +
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
DynamoNTS_Endpoint_Params
|
|
6
6
|
} from '../../_models/control-models/endpoint-params.control-model';
|
|
7
7
|
|
|
8
8
|
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
@@ -76,7 +76,7 @@ export abstract class DynamoNTS_Controller extends DynamoNTS_SingletonService {
|
|
|
76
76
|
* }),
|
|
77
77
|
* ];
|
|
78
78
|
*/
|
|
79
|
-
endpoints:
|
|
79
|
+
endpoints: DynamoNTS_Endpoint_Params[];
|
|
80
80
|
|
|
81
81
|
protected constructor(){
|
|
82
82
|
super();
|
|
@@ -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) => {
|