@futdevpro/nts-dynamo 1.5.77 → 1.5.83
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/LICENSE +2 -2
- package/lib/_constants/dynamo-nts-global-settings.d.ts +2 -2
- package/lib/_constants/dynamo-nts-global-settings.js +17 -17
- package/lib/_constants/index.d.ts +1 -1
- package/lib/_constants/index.js +4 -4
- package/lib/_enums/data-model-type.enum.d.ts +12 -12
- package/lib/_enums/data-model-type.enum.js +16 -16
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +12 -12
- package/lib/_enums/dynamo-nts-data-service-function.enum.js +18 -18
- package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts +11 -11
- package/lib/_enums/dynamo-nts-route-security.enum.js +15 -15
- package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-socket-security.enum.d.ts +10 -10
- package/lib/_enums/dynamo-nts-socket-security.enum.js +14 -14
- package/lib/_enums/dynamo-nts-socket-security.enum.js.map +1 -1
- package/lib/_enums/http/http-call-type.enum.d.ts +11 -11
- package/lib/_enums/http/http-call-type.enum.js +15 -15
- package/lib/_enums/http/http-call-type.enum.js.map +1 -1
- package/lib/_enums/http/http-response-type.enum.d.ts +6 -6
- package/lib/_enums/http/http-response-type.enum.js +10 -10
- package/lib/_enums/http/http-response-type.enum.js.map +1 -1
- package/lib/_enums/http/socket-event.enum.d.ts +9 -8
- package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
- package/lib/_enums/http/socket-event.enum.js +13 -12
- package/lib/_enums/http/socket-event.enum.js.map +1 -1
- package/lib/_enums/index.d.ts +8 -8
- package/lib/_enums/index.js +13 -13
- package/lib/_enums/predefined-data-types.enum.d.ts +10 -10
- package/lib/_enums/predefined-data-types.enum.js +14 -14
- package/lib/_enums/predefined-data-types.enum.js.map +1 -1
- package/lib/_interfaces/certification-settings.interface.d.ts +7 -0
- package/lib/_interfaces/certification-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/certification-settings.interface.js +3 -0
- package/lib/_interfaces/certification-settings.interface.js.map +1 -0
- package/lib/_interfaces/global-service-settings.interface.d.ts +18 -0
- package/lib/_interfaces/global-service-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/global-service-settings.interface.js +3 -0
- package/lib/_interfaces/global-service-settings.interface.js.map +1 -0
- package/lib/_interfaces/index.d.ts +1 -0
- package/lib/_interfaces/index.d.ts.map +1 -0
- package/lib/_interfaces/index.js +4 -0
- package/lib/_interfaces/index.js.map +1 -0
- package/lib/_interfaces/port-settings.interface.d.ts +5 -0
- package/lib/_interfaces/port-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/port-settings.interface.js +3 -0
- package/lib/_interfaces/port-settings.interface.js.map +1 -0
- package/lib/_models/dynamo-nts-api-call-params.d.ts +95 -95
- package/lib/_models/dynamo-nts-api-call-params.js +47 -47
- package/lib/_models/dynamo-nts-app-params.d.ts +49 -49
- package/lib/_models/dynamo-nts-app-params.js +17 -17
- package/lib/_models/dynamo-nts-endpoint-params.d.ts +80 -80
- package/lib/_models/dynamo-nts-endpoint-params.js +139 -139
- package/lib/_models/dynamo-nts-global-settings.d.ts +53 -53
- package/lib/_models/dynamo-nts-global-settings.js +2 -2
- package/lib/_models/dynamo-nts-routing-module-settings.d.ts +19 -19
- package/lib/_models/dynamo-nts-routing-module-settings.js +2 -2
- package/lib/_models/dynamo-nts-socket-event-params.d.ts +32 -30
- package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.js +80 -79
- package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-presence.d.ts +21 -0
- package/lib/_models/dynamo-nts-socket-presence.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-socket-presence.js +45 -0
- package/lib/_models/dynamo-nts-socket-presence.js.map +1 -0
- package/lib/_models/dynamo-nts-socket-service-params.d.ts +18 -18
- package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-service-params.js +26 -26
- package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
- package/lib/_models/index.d.ts +7 -8
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +12 -12
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/api-service.index.d.ts +5 -5
- package/lib/_modules/api-service.index.js +11 -11
- package/lib/_modules/app-extended.index.d.ts +15 -12
- package/lib/_modules/app-extended.index.d.ts.map +1 -1
- package/lib/_modules/app-extended.index.js +23 -19
- package/lib/_modules/app-extended.index.js.map +1 -1
- package/lib/_modules/app.index.d.ts +13 -10
- package/lib/_modules/app.index.d.ts.map +1 -1
- package/lib/_modules/app.index.js +21 -17
- package/lib/_modules/app.index.js.map +1 -1
- package/lib/_modules/auth.index.d.ts +3 -3
- package/lib/_modules/auth.index.js +8 -8
- package/lib/_modules/constants.index.d.ts +1 -1
- package/lib/_modules/constants.index.js +4 -4
- package/lib/_modules/controller.index.d.ts +4 -4
- package/lib/_modules/controller.index.js +10 -10
- package/lib/_modules/custom-data/custom-data.controller.d.ts +5 -5
- package/lib/_modules/custom-data/custom-data.controller.js +55 -55
- package/lib/_modules/custom-data/custom-data.service.d.ts +5 -5
- package/lib/_modules/custom-data/custom-data.service.js +11 -11
- package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts +3 -3
- package/lib/_modules/custom-data/get-custom-data-routing-module.js +17 -17
- package/lib/_modules/custom-data/index.d.ts +4 -4
- package/lib/_modules/custom-data/index.js +8 -8
- package/lib/_modules/custom-data-module.index.d.ts +1 -1
- package/lib/_modules/custom-data-module.index.js +4 -4
- package/lib/_modules/data-service.index.d.ts +5 -5
- package/lib/_modules/data-service.index.js +10 -10
- package/lib/_modules/email.index.d.ts +3 -3
- package/lib/_modules/email.index.js +8 -8
- package/lib/_modules/enums.index.d.ts +1 -1
- package/lib/_modules/enums.index.js +4 -4
- package/lib/_modules/models.index.d.ts +1 -1
- package/lib/_modules/models.index.js +4 -4
- package/lib/_modules/services.index.d.ts +1 -1
- package/lib/_modules/services.index.js +4 -4
- package/lib/_modules/test/get-test-routing-module.d.ts +3 -3
- package/lib/_modules/test/get-test-routing-module.js +17 -17
- package/lib/_modules/test/index.d.ts +3 -3
- package/lib/_modules/test/index.js +7 -7
- package/lib/_modules/test/test.controller.d.ts +5 -5
- package/lib/_modules/test/test.controller.js +104 -104
- package/lib/_modules/test-module.index.d.ts +1 -1
- package/lib/_modules/test-module.index.js +4 -4
- package/lib/_modules/usage/get-usage-routing-module.d.ts +3 -3
- package/lib/_modules/usage/get-usage-routing-module.js +17 -17
- package/lib/_modules/usage/index.d.ts +4 -4
- package/lib/_modules/usage/index.js +8 -8
- package/lib/_modules/usage/usage-controller.d.ts +6 -6
- package/lib/_modules/usage/usage-controller.js +88 -88
- package/lib/_modules/usage/usage.service.d.ts +16 -16
- package/lib/_modules/usage/usage.service.js +132 -132
- package/lib/_modules/usage-module.index.d.ts +1 -1
- package/lib/_modules/usage-module.index.js +4 -4
- package/lib/_services/dynamo-nts-api.service.d.ts +34 -34
- package/lib/_services/dynamo-nts-api.service.js +188 -188
- package/lib/_services/dynamo-nts-app-extended.d.ts +128 -128
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.js +212 -212
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
- package/lib/_services/dynamo-nts-app.d.ts +270 -278
- package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app.js +371 -371
- package/lib/_services/dynamo-nts-app.js.map +1 -1
- package/lib/_services/dynamo-nts-app.spec.d.ts +1 -0
- package/lib/_services/dynamo-nts-app.spec.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-app.spec.js +10 -0
- package/lib/_services/dynamo-nts-app.spec.js.map +1 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts +127 -127
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.js +53 -53
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.d.ts +105 -105
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.js +57 -57
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +230 -230
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +689 -689
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db-service-collection.service.d.ts +8 -8
- package/lib/_services/dynamo-nts-db-service-collection.service.js +10 -10
- package/lib/_services/dynamo-nts-db.service.d.ts +386 -312
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +856 -856
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email-service-collection.service.d.ts +18 -18
- package/lib/_services/dynamo-nts-email-service-collection.service.js +20 -20
- package/lib/_services/dynamo-nts-email.service.d.ts +56 -56
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +203 -203
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts +71 -84
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-global.service.js +156 -156
- package/lib/_services/dynamo-nts-global.service.js.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.d.ts +76 -76
- package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +191 -191
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.d.ts +31 -31
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.js +70 -70
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.spec.d.ts +2 -0
- package/lib/_services/dynamo-nts-shared.service.spec.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-shared.service.spec.js +12 -0
- package/lib/_services/dynamo-nts-shared.service.spec.js.map +1 -0
- package/lib/_services/dynamo-nts-singleton.service.d.ts +8 -8
- package/lib/_services/dynamo-nts-singleton.service.js +18 -18
- package/lib/_services/dynamo-nts-singleton.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +9 -9
- package/lib/_services/dynamo-nts-socket-service-collection.service.js +13 -13
- package/lib/_services/dynamo-nts-socket.service.d.ts +57 -45
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +188 -165
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/_services/index.d.ts +14 -16
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/index.js +20 -20
- package/lib/_services/index.js.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.js +14 -14
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package SAVE.json +216 -0
- package/package-NEW with test but not working.json +228 -0
- package/package.json +14 -8
- package/spec/support/jasmine.json +14 -0
- package/src/_enums/http/socket-event.enum.ts +2 -1
- package/src/_interfaces/certification-settings.interface.ts +7 -0
- package/src/_interfaces/global-service-settings.interface.ts +23 -0
- package/src/_interfaces/index.ts +5 -0
- package/src/_interfaces/port-settings.interface.ts +5 -0
- package/src/_models/dynamo-nts-socket-event-params.ts +23 -21
- package/src/_models/{dynamo-nts-socket-dictionary.ts → dynamo-nts-socket-presence.ts} +21 -5
- package/src/_models/dynamo-nts-socket-service-params.ts +1 -0
- package/src/_models/index.ts +2 -2
- package/src/_modules/app-extended.index.ts +7 -2
- package/src/_modules/app.index.ts +5 -0
- package/src/_services/dynamo-nts-app-extended.ts +6 -2
- package/src/_services/dynamo-nts-app.spec.ts +14 -0
- package/src/_services/dynamo-nts-app.ts +8 -14
- package/src/_services/dynamo-nts-auth.service.ts +1 -0
- package/src/_services/dynamo-nts-controller.service.ts +2 -1
- package/src/_services/dynamo-nts-data.service.ts +19 -19
- package/src/_services/dynamo-nts-db.service.ts +195 -115
- package/src/_services/dynamo-nts-email.service.ts +1 -0
- package/src/_services/dynamo-nts-global.service.ts +3 -18
- package/src/_services/dynamo-nts-routing-module.service.ts +1 -0
- package/src/_services/dynamo-nts-shared.service.spec.ts +10 -0
- package/src/_services/dynamo-nts-shared.service.ts +2 -1
- package/src/_services/dynamo-nts-socket.service.ts +80 -41
- package/src/_services/index.ts +2 -2
|
@@ -1,213 +1,213 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamoNTS_AppExtended = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const SocketIO = tslib_1.__importStar(require("socket.io"));
|
|
6
|
-
const Http = tslib_1.__importStar(require("http"));
|
|
7
|
-
const
|
|
8
|
-
const dynamo_nts_app_1 = require("./dynamo-nts-app");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
/**
|
|
12
|
-
* This will be the MAIN service of our server project,
|
|
13
|
-
* follow the types and type instructions while setting up your project
|
|
14
|
-
*
|
|
15
|
-
* In this service, there are abstract functions that you will need to implement,
|
|
16
|
-
* where you need to set up the main params for your application.
|
|
17
|
-
*
|
|
18
|
-
* The extended App is containing socket server tools
|
|
19
|
-
*
|
|
20
|
-
* You need to add socketService definitions to setupRoutingModules
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* export class App extends DynamoNTS_AppExtended {
|
|
24
|
-
*
|
|
25
|
-
* ...
|
|
26
|
-
*
|
|
27
|
-
* // Setting up App params, and preparing project global settings
|
|
28
|
-
* setupAppParams(): void {
|
|
29
|
-
* this.params = new DynamoNTS_AppParams({
|
|
30
|
-
* name: 'Warbots Server',
|
|
31
|
-
* title: warbotsTitleLog,
|
|
32
|
-
* version: version,
|
|
33
|
-
* dbName: 'warbots',
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* // dynamoNTS_GlobalSettings.logRequestsContent = false;
|
|
37
|
-
* }
|
|
38
|
-
*
|
|
39
|
-
* ...
|
|
40
|
-
*
|
|
41
|
-
* // Setting up DBServices
|
|
42
|
-
* setGlobalServiceCollection(): void {
|
|
43
|
-
* DynamoNTS_GlobalService.setServices({
|
|
44
|
-
* authService: AuthService.getInstance(),
|
|
45
|
-
* emailServiceCollection: EmailServiceCollectionService.getInstance(),
|
|
46
|
-
* dbModels: [
|
|
47
|
-
* userModelParams,
|
|
48
|
-
* userDataModelParams,
|
|
49
|
-
* userOptionsModelParams,
|
|
50
|
-
* userStatisticsModelParams,
|
|
51
|
-
* userAchievementsModelParams,
|
|
52
|
-
* userNotificationsModelParams,
|
|
53
|
-
*
|
|
54
|
-
* matchStatisticsModelParams,
|
|
55
|
-
* matchDataModelParams,
|
|
56
|
-
|
|
57
|
-
* usageSessionModelParams,
|
|
58
|
-
* customDataModelParams,
|
|
59
|
-
* ]
|
|
60
|
-
* });
|
|
61
|
-
* }
|
|
62
|
-
*
|
|
63
|
-
* ...
|
|
64
|
-
*
|
|
65
|
-
* // Setting up Routes
|
|
66
|
-
* setupRoutingModules(): void {
|
|
67
|
-
* this.httpPort = env.port;
|
|
68
|
-
|
|
69
|
-
* this.routingModules = [
|
|
70
|
-
* new DynamoNTS_RoutingModule({
|
|
71
|
-
* route: '/user',
|
|
72
|
-
* controllers: [
|
|
73
|
-
* UserController.getInstance(),
|
|
74
|
-
* UserDataController.getInstance(),
|
|
75
|
-
* UserOptionsController.getInstance(),
|
|
76
|
-
* UserStatisticsController.getInstance(),
|
|
77
|
-
* UserAchievementsController.getInstance(),
|
|
78
|
-
* UserNotificationsController.getInstance()
|
|
79
|
-
* ]
|
|
80
|
-
* }),
|
|
81
|
-
* new DynamoNTS_RoutingModule({
|
|
82
|
-
* route: '/match',
|
|
83
|
-
* controllers: [
|
|
84
|
-
* MatchController.getInstance(),
|
|
85
|
-
* MatchDistributionController.getInstance(),
|
|
86
|
-
* MatchStatisticsController.getInstance(),
|
|
87
|
-
* ]
|
|
88
|
-
* }),
|
|
89
|
-
* new DynamoNTS_RoutingModule({
|
|
90
|
-
* route: '/server',
|
|
91
|
-
* controllers: [
|
|
92
|
-
* ServerController.getInstance(),
|
|
93
|
-
* ]
|
|
94
|
-
* }),
|
|
95
|
-
|
|
96
|
-
* getTestRoutingModule(),
|
|
97
|
-
* getUsageRoutingModule()
|
|
98
|
-
* ];
|
|
99
|
-
*
|
|
100
|
-
* ...
|
|
101
|
-
*
|
|
102
|
-
* // Setting up Sockets
|
|
103
|
-
* this.socketServices = [
|
|
104
|
-
* NotificationService.getInstance(),
|
|
105
|
-
* ChatService.getInstance(),
|
|
106
|
-
* ...
|
|
107
|
-
* ];
|
|
108
|
-
* }
|
|
109
|
-
* }
|
|
110
|
-
*/
|
|
111
|
-
class DynamoNTS_AppExtended extends dynamo_nts_app_1.DynamoNTS_App {
|
|
112
|
-
constructor() {
|
|
113
|
-
var _a;
|
|
114
|
-
super();
|
|
115
|
-
try {
|
|
116
|
-
this.socketServices = this.getSocketServices();
|
|
117
|
-
if ((_a = this.socketServices) === null || _a === void 0 ? void 0 : _a.length) {
|
|
118
|
-
this.setSocketSecurity();
|
|
119
|
-
this.mountSocketServices();
|
|
120
|
-
if (this.debugLog)
|
|
121
|
-
console.log(`\nAll sockets setted up.... sockets using security: ${this.socketSecurity}`);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
fsm_dynamo_1.Dynamo_Log.warn('\nNo socketServices setted up while using Extended Application.', '\nYou should use DynamoNTS_App if you don`t need socket services.\n');
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
fsm_dynamo_1.Dynamo_Log.error('\nExtended Application start failed.\n', error, '\n');
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
-
*/
|
|
134
|
-
setSocketSecurity() {
|
|
135
|
-
this.socketServices.forEach((service) => {
|
|
136
|
-
if (!this.socketSecurity) {
|
|
137
|
-
this.socketSecurity = dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity[service.security];
|
|
138
|
-
}
|
|
139
|
-
else if (this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.both && this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity[service.security]) {
|
|
140
|
-
this.socketSecurity = dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.both;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
146
|
-
*/
|
|
147
|
-
mountSocketServices() {
|
|
148
|
-
let httpSocketServer;
|
|
149
|
-
if (this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
150
|
-
if (!this.openExpress) {
|
|
151
|
-
this.initOpenExpress();
|
|
152
|
-
}
|
|
153
|
-
httpSocketServer = Http.createServer(this.openExpress);
|
|
154
|
-
}
|
|
155
|
-
if (this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.open) {
|
|
156
|
-
if (!this.httpsServer) {
|
|
157
|
-
if (this.cert) {
|
|
158
|
-
this.initSecureExpress();
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
let errorMsg = `\nYou have secure socket service, but the certification paths are not set!` +
|
|
162
|
-
`\nset...` +
|
|
163
|
-
`\n cert: {` +
|
|
164
|
-
`\n keyPath: FileSystem.PathLike,` +
|
|
165
|
-
`\n certPath: FileSystem.PathLike,` +
|
|
166
|
-
`\n }` +
|
|
167
|
-
`\nin DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
168
|
-
errorMsg += '\n\nThe socket services setted to use secure server:';
|
|
169
|
-
this.socketServices.forEach((service) => {
|
|
170
|
-
if (service.security != dynamo_nts_socket_security_enum_1.DynamoNTS_SocketSecurity.open) {
|
|
171
|
-
errorMsg += `\n ${service.name} (port: ${service.port})`;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
fsm_dynamo_1.Dynamo_Log.error(errorMsg);
|
|
175
|
-
let error = new Error('Secure routes cannot be established!');
|
|
176
|
-
let errorStack = error.stack.split('\n');
|
|
177
|
-
errorStack.splice(1, 2);
|
|
178
|
-
error.stack = errorStack.join('\n');
|
|
179
|
-
throw error;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
this.socketServices.forEach((service) => {
|
|
184
|
-
const existingPorts = this.socketServices.filter((mod) => mod.port === service.port);
|
|
185
|
-
if (1 < existingPorts.length || this.ports.httpPort === service.port || this.ports.httpsPort === service.port) {
|
|
186
|
-
let error = new Error(`PORT DUPLICATION: ${service.port}`);
|
|
187
|
-
let errorStack = error.stack.split('\n');
|
|
188
|
-
errorStack.splice(1, 4);
|
|
189
|
-
error.stack = errorStack.join('\n');
|
|
190
|
-
throw error;
|
|
191
|
-
}
|
|
192
|
-
if (service.security === dynamo_nts_socket_security_enum_1.DynamoNTS_SocketSecurity.open) {
|
|
193
|
-
if (this.debugLog)
|
|
194
|
-
console.log(`\nsocket setup (open): ${service.name}:${service.port}`);
|
|
195
|
-
service.setupSocketServer(new SocketIO.Server(httpSocketServer));
|
|
196
|
-
}
|
|
197
|
-
else if (service.security === dynamo_nts_socket_security_enum_1.DynamoNTS_SocketSecurity.secure) {
|
|
198
|
-
if (this.debugLog)
|
|
199
|
-
console.log(`\nsocket setup (secure): ${service.name}:${service.port}`);
|
|
200
|
-
service.setupSocketServer(new SocketIO.Server(this.httpsServer));
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
let error = new Error(`INVALID Socket Service security: ${service.security} on ${service.name}`);
|
|
204
|
-
let errorStack = error.stack.split('\n');
|
|
205
|
-
errorStack.splice(1, 4);
|
|
206
|
-
error.stack = errorStack.join('\n');
|
|
207
|
-
throw error;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
exports.DynamoNTS_AppExtended = DynamoNTS_AppExtended;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoNTS_AppExtended = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const SocketIO = tslib_1.__importStar(require("socket.io"));
|
|
6
|
+
const Http = tslib_1.__importStar(require("http"));
|
|
7
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
8
|
+
const dynamo_nts_app_1 = require("./dynamo-nts-app");
|
|
9
|
+
const dynamo_nts_route_security_enum_1 = require("../_enums/dynamo-nts-route-security.enum");
|
|
10
|
+
const dynamo_nts_socket_security_enum_1 = require("../_enums/dynamo-nts-socket-security.enum");
|
|
11
|
+
/**
|
|
12
|
+
* This will be the MAIN service of our server project,
|
|
13
|
+
* follow the types and type instructions while setting up your project
|
|
14
|
+
*
|
|
15
|
+
* In this service, there are abstract functions that you will need to implement,
|
|
16
|
+
* where you need to set up the main params for your application.
|
|
17
|
+
*
|
|
18
|
+
* The extended App is containing socket server tools
|
|
19
|
+
*
|
|
20
|
+
* You need to add socketService definitions to setupRoutingModules
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* export class App extends DynamoNTS_AppExtended {
|
|
24
|
+
*
|
|
25
|
+
* ...
|
|
26
|
+
*
|
|
27
|
+
* // Setting up App params, and preparing project global settings
|
|
28
|
+
* setupAppParams(): void {
|
|
29
|
+
* this.params = new DynamoNTS_AppParams({
|
|
30
|
+
* name: 'Warbots Server',
|
|
31
|
+
* title: warbotsTitleLog,
|
|
32
|
+
* version: version,
|
|
33
|
+
* dbName: 'warbots',
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // dynamoNTS_GlobalSettings.logRequestsContent = false;
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* ...
|
|
40
|
+
*
|
|
41
|
+
* // Setting up DBServices
|
|
42
|
+
* setGlobalServiceCollection(): void {
|
|
43
|
+
* DynamoNTS_GlobalService.setServices({
|
|
44
|
+
* authService: AuthService.getInstance(),
|
|
45
|
+
* emailServiceCollection: EmailServiceCollectionService.getInstance(),
|
|
46
|
+
* dbModels: [
|
|
47
|
+
* userModelParams,
|
|
48
|
+
* userDataModelParams,
|
|
49
|
+
* userOptionsModelParams,
|
|
50
|
+
* userStatisticsModelParams,
|
|
51
|
+
* userAchievementsModelParams,
|
|
52
|
+
* userNotificationsModelParams,
|
|
53
|
+
*
|
|
54
|
+
* matchStatisticsModelParams,
|
|
55
|
+
* matchDataModelParams,
|
|
56
|
+
|
|
57
|
+
* usageSessionModelParams,
|
|
58
|
+
* customDataModelParams,
|
|
59
|
+
* ]
|
|
60
|
+
* });
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* ...
|
|
64
|
+
*
|
|
65
|
+
* // Setting up Routes
|
|
66
|
+
* setupRoutingModules(): void {
|
|
67
|
+
* this.httpPort = env.port;
|
|
68
|
+
|
|
69
|
+
* this.routingModules = [
|
|
70
|
+
* new DynamoNTS_RoutingModule({
|
|
71
|
+
* route: '/user',
|
|
72
|
+
* controllers: [
|
|
73
|
+
* UserController.getInstance(),
|
|
74
|
+
* UserDataController.getInstance(),
|
|
75
|
+
* UserOptionsController.getInstance(),
|
|
76
|
+
* UserStatisticsController.getInstance(),
|
|
77
|
+
* UserAchievementsController.getInstance(),
|
|
78
|
+
* UserNotificationsController.getInstance()
|
|
79
|
+
* ]
|
|
80
|
+
* }),
|
|
81
|
+
* new DynamoNTS_RoutingModule({
|
|
82
|
+
* route: '/match',
|
|
83
|
+
* controllers: [
|
|
84
|
+
* MatchController.getInstance(),
|
|
85
|
+
* MatchDistributionController.getInstance(),
|
|
86
|
+
* MatchStatisticsController.getInstance(),
|
|
87
|
+
* ]
|
|
88
|
+
* }),
|
|
89
|
+
* new DynamoNTS_RoutingModule({
|
|
90
|
+
* route: '/server',
|
|
91
|
+
* controllers: [
|
|
92
|
+
* ServerController.getInstance(),
|
|
93
|
+
* ]
|
|
94
|
+
* }),
|
|
95
|
+
|
|
96
|
+
* getTestRoutingModule(),
|
|
97
|
+
* getUsageRoutingModule()
|
|
98
|
+
* ];
|
|
99
|
+
*
|
|
100
|
+
* ...
|
|
101
|
+
*
|
|
102
|
+
* // Setting up Sockets
|
|
103
|
+
* this.socketServices = [
|
|
104
|
+
* NotificationService.getInstance(),
|
|
105
|
+
* ChatService.getInstance(),
|
|
106
|
+
* ...
|
|
107
|
+
* ];
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
*/
|
|
111
|
+
class DynamoNTS_AppExtended extends dynamo_nts_app_1.DynamoNTS_App {
|
|
112
|
+
constructor() {
|
|
113
|
+
var _a;
|
|
114
|
+
super();
|
|
115
|
+
try {
|
|
116
|
+
this.socketServices = this.getSocketServices();
|
|
117
|
+
if ((_a = this.socketServices) === null || _a === void 0 ? void 0 : _a.length) {
|
|
118
|
+
this.setSocketSecurity();
|
|
119
|
+
this.mountSocketServices();
|
|
120
|
+
if (this.debugLog)
|
|
121
|
+
console.log(`\nAll sockets setted up.... sockets using security: ${this.socketSecurity}`);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
fsm_dynamo_1.Dynamo_Log.warn('\nNo socketServices setted up while using Extended Application.', '\nYou should use DynamoNTS_App if you don`t need socket services.\n');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
fsm_dynamo_1.Dynamo_Log.error('\nExtended Application start failed.\n', error, '\n');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
setSocketSecurity() {
|
|
135
|
+
this.socketServices.forEach((service) => {
|
|
136
|
+
if (!this.socketSecurity) {
|
|
137
|
+
this.socketSecurity = dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity[service.security];
|
|
138
|
+
}
|
|
139
|
+
else if (this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.both && this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity[service.security]) {
|
|
140
|
+
this.socketSecurity = dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.both;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
mountSocketServices() {
|
|
148
|
+
let httpSocketServer;
|
|
149
|
+
if (this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
150
|
+
if (!this.openExpress) {
|
|
151
|
+
this.initOpenExpress();
|
|
152
|
+
}
|
|
153
|
+
httpSocketServer = Http.createServer(this.openExpress);
|
|
154
|
+
}
|
|
155
|
+
if (this.socketSecurity !== dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.open) {
|
|
156
|
+
if (!this.httpsServer) {
|
|
157
|
+
if (this.cert) {
|
|
158
|
+
this.initSecureExpress();
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
let errorMsg = `\nYou have secure socket service, but the certification paths are not set!` +
|
|
162
|
+
`\nset...` +
|
|
163
|
+
`\n cert: {` +
|
|
164
|
+
`\n keyPath: FileSystem.PathLike,` +
|
|
165
|
+
`\n certPath: FileSystem.PathLike,` +
|
|
166
|
+
`\n }` +
|
|
167
|
+
`\nin DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
168
|
+
errorMsg += '\n\nThe socket services setted to use secure server:';
|
|
169
|
+
this.socketServices.forEach((service) => {
|
|
170
|
+
if (service.security != dynamo_nts_socket_security_enum_1.DynamoNTS_SocketSecurity.open) {
|
|
171
|
+
errorMsg += `\n ${service.name} (port: ${service.port})`;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
fsm_dynamo_1.Dynamo_Log.error(errorMsg);
|
|
175
|
+
let error = new Error('Secure routes cannot be established!');
|
|
176
|
+
let errorStack = error.stack.split('\n');
|
|
177
|
+
errorStack.splice(1, 2);
|
|
178
|
+
error.stack = errorStack.join('\n');
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
this.socketServices.forEach((service) => {
|
|
184
|
+
const existingPorts = this.socketServices.filter((mod) => mod.port === service.port);
|
|
185
|
+
if (1 < existingPorts.length || this.ports.httpPort === service.port || this.ports.httpsPort === service.port) {
|
|
186
|
+
let error = new Error(`PORT DUPLICATION: ${service.port}`);
|
|
187
|
+
let errorStack = error.stack.split('\n');
|
|
188
|
+
errorStack.splice(1, 4);
|
|
189
|
+
error.stack = errorStack.join('\n');
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
if (service.security === dynamo_nts_socket_security_enum_1.DynamoNTS_SocketSecurity.open) {
|
|
193
|
+
if (this.debugLog)
|
|
194
|
+
console.log(`\nsocket setup (open): ${service.name}:${service.port}`);
|
|
195
|
+
service.setupSocketServer(new SocketIO.Server(httpSocketServer));
|
|
196
|
+
}
|
|
197
|
+
else if (service.security === dynamo_nts_socket_security_enum_1.DynamoNTS_SocketSecurity.secure) {
|
|
198
|
+
if (this.debugLog)
|
|
199
|
+
console.log(`\nsocket setup (secure): ${service.name}:${service.port}`);
|
|
200
|
+
service.setupSocketServer(new SocketIO.Server(this.httpsServer));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
let error = new Error(`INVALID Socket Service security: ${service.security} on ${service.name}`);
|
|
204
|
+
let errorStack = error.stack.split('\n');
|
|
205
|
+
errorStack.splice(1, 4);
|
|
206
|
+
error.stack = errorStack.join('\n');
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.DynamoNTS_AppExtended = DynamoNTS_AppExtended;
|
|
213
213
|
//# sourceMappingURL=dynamo-nts-app-extended.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamo-nts-app-extended.js","sourceRoot":"","sources":["../../src/_services/dynamo-nts-app-extended.ts"],"names":[],"mappings":";;;;AACA,4DAAsC;AACtC,mDAA6B;AAE7B,
|
|
1
|
+
{"version":3,"file":"dynamo-nts-app-extended.js","sourceRoot":"","sources":["../../src/_services/dynamo-nts-app-extended.ts"],"names":[],"mappings":";;;;AACA,4DAAsC;AACtC,mDAA6B;AAE7B,sDAAmD;AAEnD,qDAAiD;AACjD,6FAAmF;AAEnF,+FAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGG;AACH,MAAsB,qBAAsB,SAAQ,8BAAa;IAe/D;;QACE,KAAK,EAAE,CAAC;QAER,IAAI;YACF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAE/C,IAAI,MAAA,IAAI,CAAC,cAAc,0CAAE,MAAM,EAAE;gBAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBAEzB,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAE3B,IAAI,IAAI,CAAC,QAAQ;oBAAE,OAAO,CAAC,GAAG,CAAC,uDAAuD,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;aAC9G;iBAAM;gBACL,uBAAU,CAAC,IAAI,CACb,iEAAiE,EACjE,qEAAqE,CACtE,CAAC;aACH;SACF;QAAC,OAAO,KAAK,EAAE;YACd,uBAAU,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,EAAE,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