@futdevpro/nts-dynamo 1.7.16 → 1.7.20
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/.eslintrc.json +171 -0
- package/lib/_constants/mocks/app-extended-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-extended-server.mock.js.map +1 -1
- package/lib/_constants/mocks/app-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-server.mock.js.map +1 -1
- package/lib/_constants/mocks/data-model.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/data-model.mock.js.map +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.js.map +1 -1
- package/lib/_constants/mocks/email-service.mock.js +3 -3
- package/lib/_constants/mocks/email-service.mock.js.map +1 -1
- package/lib/_constants/mocks/endpoint.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/endpoint.mock.js.map +1 -1
- package/lib/_constants/mocks/socket-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/socket-server.mock.js.map +1 -1
- package/lib/_enums/index.js +1 -1
- package/lib/_enums/index.js.map +1 -1
- package/lib/_models/control-models/api-call-params.control-model.d.ts +2 -2
- 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.map +1 -1
- package/lib/_models/control-models/app-system-controls.control-model copy.d.ts.map +1 -1
- package/lib/_models/control-models/app-system-controls.control-model copy.js.map +1 -1
- package/lib/_models/control-models/app-system-controls.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/app-system-controls.control-model.js.map +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 +15 -9
- package/lib/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/lib/_models/control-models/http-settings.control-model.d.ts +1 -1
- 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 -1
- package/lib/_models/control-models/http-settings.control-model.js.map +1 -1
- 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.map +1 -1
- package/lib/_models/control-models/socket-presence.control-model.js.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.js +2 -1
- package/lib/_modules/custom-data/custom-data.controller.js.map +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.map +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.map +1 -1
- package/lib/_modules/test/test.controller.d.ts.map +1 -1
- package/lib/_modules/test/test.controller.js.map +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 +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.js.map +1 -1
- package/lib/_modules/usage/usage.controller.d.ts.map +1 -1
- package/lib/_modules/usage/usage.controller.js +15 -14
- package/lib/_modules/usage/usage.controller.js.map +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts +3 -1
- package/lib/_modules/usage/usage.data-service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.data-service.js +24 -16
- package/lib/_modules/usage/usage.data-service.js.map +1 -1
- package/lib/_services/base/data.service.d.ts.map +1 -1
- package/lib/_services/base/data.service.js +45 -23
- package/lib/_services/base/data.service.js.map +1 -1
- package/lib/_services/base/db.service.d.ts.map +1 -1
- package/lib/_services/base/db.service.js +82 -53
- package/lib/_services/base/db.service.js.map +1 -1
- package/lib/_services/base/singleton.service.d.ts.map +1 -1
- package/lib/_services/base/singleton.service.js.map +1 -1
- package/lib/_services/core/api.service.d.ts +21 -13
- package/lib/_services/core/api.service.d.ts.map +1 -1
- package/lib/_services/core/api.service.js +192 -143
- package/lib/_services/core/api.service.js.map +1 -1
- package/lib/_services/core/auth.service.d.ts.map +1 -1
- package/lib/_services/core/auth.service.js.map +1 -1
- package/lib/_services/core/email.service.d.ts +50 -36
- package/lib/_services/core/email.service.d.ts.map +1 -1
- package/lib/_services/core/email.service.js +329 -94
- package/lib/_services/core/email.service.js.map +1 -1
- package/lib/_services/core/global.service.d.ts.map +1 -1
- package/lib/_services/core/global.service.js +30 -19
- package/lib/_services/core/global.service.js.map +1 -1
- 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.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.map +1 -1
- package/lib/_services/server/app-extended.server.js +19 -14
- package/lib/_services/server/app-extended.server.js.map +1 -1
- package/lib/_services/server/app-extended.server.spec.js +1 -0
- package/lib/_services/server/app-extended.server.spec.js.map +1 -1
- package/lib/_services/server/app.server.d.ts +4 -3
- package/lib/_services/server/app.server.d.ts.map +1 -1
- package/lib/_services/server/app.server.js +107 -52
- package/lib/_services/server/app.server.js.map +1 -1
- package/lib/_services/server/app.server.spec.js +1 -0
- package/lib/_services/server/app.server.spec.js.map +1 -1
- package/lib/_services/shared.static-service.js.map +1 -1
- package/lib/_services/socket/socket-client.service.js.map +1 -1
- package/lib/_services/socket/socket-server.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/nodemon.json +3 -1
- package/package.json +9 -8
- package/src/_constants/mocks/app-extended-server.mock.ts +6 -2
- package/src/_constants/mocks/app-server.mock.ts +7 -1
- package/src/_constants/mocks/data-model.mock.ts +2 -2
- package/src/_constants/mocks/email-service-collection.mock.ts +2 -1
- package/src/_constants/mocks/email-service.mock.ts +2 -2
- package/src/_constants/mocks/endpoint.mock.ts +28 -26
- package/src/_constants/mocks/socket-server.mock.ts +12 -4
- package/src/_enums/index.ts +1 -1
- package/src/_models/control-models/api-call-params.control-model.ts +3 -2
- package/src/_models/control-models/app-system-controls.control-model copy.ts +1 -1
- package/src/_models/control-models/app-system-controls.control-model.ts +1 -1
- package/src/_models/control-models/endpoint-params.control-model.ts +39 -16
- package/src/_models/control-models/http-settings.control-model.ts +4 -2
- package/src/_modules/custom-data/custom-data.controller.ts +55 -51
- package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +7 -3
- package/src/_modules/test/get-test-routing-module.util.ts +7 -3
- package/src/_modules/test/test.controller.ts +98 -96
- package/src/_modules/usage/get-usage-routing-module.util.ts +8 -4
- package/src/_modules/usage/usage.controller.ts +108 -102
- package/src/_modules/usage/usage.data-service.ts +54 -28
- package/src/_services/base/data.service.ts +133 -34
- package/src/_services/base/db.service.ts +254 -171
- package/src/_services/base/singleton.service.ts +1 -1
- package/src/_services/core/api.service.ts +348 -218
- package/src/_services/core/auth.service.ts +2 -0
- package/src/_services/core/email.service.ts +537 -129
- package/src/_services/core/global.service.ts +56 -26
- package/src/_services/route/controller.service.ts +3 -1
- package/src/_services/route/routing-module.service.ts +33 -16
- package/src/_services/server/app-extended.server.spec.ts +22 -17
- package/src/_services/server/app-extended.server.ts +108 -45
- package/src/_services/server/app.server.spec.ts +17 -12
- package/src/_services/server/app.server.ts +264 -138
|
@@ -8,7 +8,9 @@ import { DynamoNTS_App } from './app.server';
|
|
|
8
8
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
9
9
|
import { DynamoNTS_SocketServerService } from '../socket/socket-server.service';
|
|
10
10
|
import { DynamoNTS_SocketSecurity } from '../../_enums/socket-security.enum';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
DynamoNTS_AppExtSysControls
|
|
13
|
+
} from '../../_models/control-models/app-system-controls.control-model copy';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* This will be the MAIN service of our server project,
|
|
@@ -136,8 +138,8 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
136
138
|
constructor(){
|
|
137
139
|
super(true);
|
|
138
140
|
|
|
139
|
-
this.asyncConstructExt().catch((error: any) => {
|
|
140
|
-
Dynamo_Log.
|
|
141
|
+
this.asyncConstructExt().catch((error: any): void => {
|
|
142
|
+
Dynamo_Log.H_error(
|
|
141
143
|
`\nExtended Application: ${this.params?.name} start failed.` +
|
|
142
144
|
`\n`, error,
|
|
143
145
|
'\n'
|
|
@@ -156,7 +158,10 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
156
158
|
this.setSocketSecurity();
|
|
157
159
|
|
|
158
160
|
await this.setupSocketServerServices();
|
|
159
|
-
|
|
161
|
+
|
|
162
|
+
if (this.logSetup) console.log(
|
|
163
|
+
`\nAll sockets setted up.... sockets using security: ${this.socketSecurity}`
|
|
164
|
+
);
|
|
160
165
|
} else {
|
|
161
166
|
Dynamo_Log.testWarn(
|
|
162
167
|
'No socketServices setted up while using Extended Application.',
|
|
@@ -173,11 +178,12 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
173
178
|
Dynamo_Log.H_success(`${this.params.name} started successfully.`);
|
|
174
179
|
|
|
175
180
|
} catch (error) {
|
|
176
|
-
Dynamo_Log.
|
|
181
|
+
Dynamo_Log.H_error(
|
|
177
182
|
`\nExtended Application: ${this.params?.name} start failed.` +
|
|
178
183
|
`\n`, error,
|
|
179
184
|
'\n'
|
|
180
185
|
);
|
|
186
|
+
|
|
181
187
|
throw new Dynamo_Error({
|
|
182
188
|
errorCode: 'NTS-AES-001',
|
|
183
189
|
error: error,
|
|
@@ -207,7 +213,12 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
207
213
|
const start: number = +new Date();
|
|
208
214
|
|
|
209
215
|
if (this.constructErrors.length) {
|
|
210
|
-
Dynamo_Log.
|
|
216
|
+
Dynamo_Log.H_error(
|
|
217
|
+
`Extended Application: ${this.params?.name} start failed. ERRORS`,
|
|
218
|
+
this.constructErrors,
|
|
219
|
+
'\n'
|
|
220
|
+
);
|
|
221
|
+
|
|
211
222
|
throw new Dynamo_Error({
|
|
212
223
|
message: `${this.params?.name} start failed. ERRORS`,
|
|
213
224
|
additionalContent: this.constructErrors,
|
|
@@ -232,7 +243,12 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
232
243
|
}
|
|
233
244
|
|
|
234
245
|
if (this.constructErrors.length) {
|
|
235
|
-
Dynamo_Log.
|
|
246
|
+
Dynamo_Log.H_error(
|
|
247
|
+
`Extended Application: ${this.params?.name} start failed. TIMEOUT`,
|
|
248
|
+
this.constructErrors,
|
|
249
|
+
'\n'
|
|
250
|
+
);
|
|
251
|
+
|
|
236
252
|
throw new Dynamo_Error({
|
|
237
253
|
message: `${this.params?.name} start failed. TIMEOUT`,
|
|
238
254
|
additionalContent: this.constructErrors,
|
|
@@ -244,19 +260,29 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
244
260
|
this.systemControlsExt.appExtended.started = true;
|
|
245
261
|
|
|
246
262
|
if (this.logFn && this.deepLog) console.log('\nfn:. ready-extended: return');
|
|
263
|
+
|
|
247
264
|
return;
|
|
248
265
|
} else {
|
|
249
266
|
this.systemControlsExt.appExtended.started = false;
|
|
250
267
|
|
|
251
268
|
let msg: string = `${this.params?.name} start failed. UNKNOWN`;
|
|
252
|
-
|
|
269
|
+
|
|
270
|
+
if (
|
|
271
|
+
this.systemControlsExt.httpSocketServer.init &&
|
|
272
|
+
!this.systemControlsExt.httpSocketServer.started
|
|
273
|
+
) {
|
|
253
274
|
msg += '\nhttpSocketServer start failed.';
|
|
254
275
|
}
|
|
255
|
-
|
|
276
|
+
|
|
277
|
+
if (
|
|
278
|
+
this.systemControlsExt.httpsSocketServer.init &&
|
|
279
|
+
!this.systemControlsExt.httpsSocketServer.started
|
|
280
|
+
) {
|
|
256
281
|
msg += '\nhttpsSocketServer start failed.';
|
|
257
282
|
}
|
|
258
283
|
|
|
259
284
|
Dynamo_Log.error(msg, this.constructErrors, '\n');
|
|
285
|
+
|
|
260
286
|
throw new Dynamo_Error({
|
|
261
287
|
errorCode: 'NTS-AES-110',
|
|
262
288
|
message: msg,
|
|
@@ -281,30 +307,34 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
281
307
|
|
|
282
308
|
override async stop(): Promise<void> {
|
|
283
309
|
if (this.logFn) console.log('\nfn:. stop-extended');
|
|
310
|
+
|
|
284
311
|
if (this.started) {
|
|
285
312
|
await super.stop(true);
|
|
286
313
|
|
|
287
314
|
this.systemControlsExt.httpSocketServer.started = false;
|
|
288
315
|
this.systemControlsExt.httpsSocketServer.started = false;
|
|
289
|
-
await Dynamo_Array.asyncForEach(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
316
|
+
await Dynamo_Array.asyncForEach(
|
|
317
|
+
this.allSocketServers,
|
|
318
|
+
async (socketServer: SocketIO.Server): Promise<void> => {
|
|
319
|
+
await new Promise<void>((resolve, reject): void => {
|
|
320
|
+
socketServer.disconnectSockets(true);
|
|
321
|
+
socketServer.close((err): void => {
|
|
322
|
+
if (err) {
|
|
323
|
+
Dynamo_Log.error(`\nHTTP socket server close error`, err);
|
|
324
|
+
reject(
|
|
325
|
+
new Dynamo_Error({
|
|
326
|
+
errorCode: 'NTS-AES-120',
|
|
327
|
+
message: `SocketServer close failed.`,
|
|
328
|
+
error: err
|
|
329
|
+
})
|
|
330
|
+
);
|
|
331
|
+
} else {
|
|
332
|
+
resolve();
|
|
333
|
+
}
|
|
334
|
+
});
|
|
305
335
|
});
|
|
306
|
-
}
|
|
307
|
-
|
|
336
|
+
}
|
|
337
|
+
);
|
|
308
338
|
this.systemControlsExt.httpSocketServer.init = false;
|
|
309
339
|
this.systemControlsExt.httpsSocketServer.init = false;
|
|
310
340
|
|
|
@@ -317,10 +347,13 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
317
347
|
*/
|
|
318
348
|
private setSocketSecurity(): void {
|
|
319
349
|
if (this.logFn) console.log('\nfn:. setSocketSecurity');
|
|
320
|
-
this.socketServices.forEach((service: DynamoNTS_SocketServerService<any>) => {
|
|
350
|
+
this.socketServices.forEach((service: DynamoNTS_SocketServerService<any>): void => {
|
|
321
351
|
if (!this.socketSecurity) {
|
|
322
352
|
this.socketSecurity = DynamoNTS_RouteSecurity[service.security];
|
|
323
|
-
} else if (
|
|
353
|
+
} else if (
|
|
354
|
+
this.socketSecurity !== DynamoNTS_RouteSecurity.both &&
|
|
355
|
+
this.socketSecurity !== DynamoNTS_RouteSecurity[service.security]
|
|
356
|
+
) {
|
|
324
357
|
this.socketSecurity = DynamoNTS_RouteSecurity.both;
|
|
325
358
|
}
|
|
326
359
|
});
|
|
@@ -333,10 +366,12 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
333
366
|
try {
|
|
334
367
|
if (this.logFn) console.log('\nfn:. setupSocketServerServices');
|
|
335
368
|
/* let httpServer: Http.Server; */
|
|
369
|
+
|
|
336
370
|
if (this.socketSecurity !== DynamoNTS_RouteSecurity.secure) {
|
|
337
371
|
if (!this.openExpress) {
|
|
338
372
|
await this.initOpenExpress();
|
|
339
373
|
}
|
|
374
|
+
|
|
340
375
|
if (!this.httpSocketServer) {
|
|
341
376
|
this.httpSocketServer = Http.createServer(this.openExpress);
|
|
342
377
|
}
|
|
@@ -357,18 +392,20 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
357
392
|
`\nin DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
358
393
|
|
|
359
394
|
errorMsg += '\n\nThe socket services setted to use secure server:';
|
|
360
|
-
this.socketServices.forEach((service: DynamoNTS_SocketServerService<any>) => {
|
|
395
|
+
this.socketServices.forEach((service: DynamoNTS_SocketServerService<any>): void => {
|
|
361
396
|
if (service.security != DynamoNTS_SocketSecurity.open) {
|
|
362
397
|
errorMsg += `\n ${service?.name} (port: ${service.port})`;
|
|
363
398
|
}
|
|
364
399
|
});
|
|
365
400
|
|
|
366
|
-
|
|
367
|
-
|
|
401
|
+
const error = new Error('Secure routes cannot be established!');
|
|
402
|
+
const errorStack: string[] = error.stack.split('\n');
|
|
403
|
+
|
|
368
404
|
errorStack.splice(1, 2);
|
|
369
405
|
error.stack = errorStack.join('\n');
|
|
370
406
|
|
|
371
407
|
Dynamo_Log.error(errorMsg);
|
|
408
|
+
|
|
372
409
|
throw error;
|
|
373
410
|
}
|
|
374
411
|
}
|
|
@@ -376,25 +413,33 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
376
413
|
|
|
377
414
|
await Dynamo_Array.asyncForEach(
|
|
378
415
|
this.socketServices,
|
|
379
|
-
async (service: DynamoNTS_SocketServerService<any>) => {
|
|
416
|
+
async (service: DynamoNTS_SocketServerService<any>): Promise<void> => {
|
|
380
417
|
try {
|
|
381
418
|
this.systemControlsExt.httpSocketServer.init = true;
|
|
382
419
|
const existingPorts: DynamoNTS_SocketServerService<any>[] = this.socketServices.filter(
|
|
383
|
-
(mod: DynamoNTS_SocketServerService<any>) => mod.port === service.port
|
|
420
|
+
(mod: DynamoNTS_SocketServerService<any>): boolean => mod.port === service.port
|
|
384
421
|
);
|
|
385
422
|
|
|
386
|
-
if (
|
|
387
|
-
|
|
388
|
-
|
|
423
|
+
if (
|
|
424
|
+
1 < existingPorts.length ||
|
|
425
|
+
this.portSettings.httpPort === service.port ||
|
|
426
|
+
this.portSettings.httpsPort === service.port
|
|
427
|
+
) {
|
|
428
|
+
const error = new Error(`PORT DUPLICATION: ${service.port}`);
|
|
429
|
+
const errorStack: string[] = error.stack.split('\n');
|
|
430
|
+
|
|
389
431
|
errorStack.splice(1, 4);
|
|
390
432
|
error.stack = errorStack.join('\n');
|
|
391
433
|
|
|
392
434
|
Dynamo_Log.error(`\n${error.message}`);
|
|
435
|
+
|
|
393
436
|
throw error;
|
|
394
437
|
}
|
|
395
438
|
|
|
396
439
|
if (service.security === DynamoNTS_SocketSecurity.open) {
|
|
397
|
-
if (this.logSetup) console.log(
|
|
440
|
+
if (this.logSetup) console.log(
|
|
441
|
+
`\nsocket setup (open): ${service?.name}:${service.port}`
|
|
442
|
+
);
|
|
398
443
|
this.httpSocketSettingUpCount++;
|
|
399
444
|
this.systemControlsExt.httpSocketServer.started = false;
|
|
400
445
|
|
|
@@ -402,8 +447,9 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
402
447
|
await service.setupSocketServer(
|
|
403
448
|
new SocketIO.Server(this.httpSocketServer),
|
|
404
449
|
DynamoNTS_SocketSecurity.open,
|
|
405
|
-
() => {
|
|
450
|
+
(): void => {
|
|
406
451
|
this.httpSocketSettingUpCount--;
|
|
452
|
+
|
|
407
453
|
if (this.httpSocketSettingUpCount === 0) {
|
|
408
454
|
this.systemControlsExt.httpSocketServer.started = true;
|
|
409
455
|
}
|
|
@@ -412,7 +458,9 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
412
458
|
);
|
|
413
459
|
|
|
414
460
|
} else if (service.security === DynamoNTS_SocketSecurity.secure) {
|
|
415
|
-
if (this.logSetup) console.log(
|
|
461
|
+
if (this.logSetup) console.log(
|
|
462
|
+
`\nsocket setup (secure): ${service?.name}:${service.port}`
|
|
463
|
+
);
|
|
416
464
|
this.httpsSocketSettingUpCount++;
|
|
417
465
|
this.systemControlsExt.httpsSocketServer.started = false;
|
|
418
466
|
|
|
@@ -420,8 +468,9 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
420
468
|
await service.setupSocketServer(
|
|
421
469
|
new SocketIO.Server(this.httpsServer),
|
|
422
470
|
DynamoNTS_SocketSecurity.secure,
|
|
423
|
-
() => {
|
|
471
|
+
(): void => {
|
|
424
472
|
this.httpsSocketSettingUpCount--;
|
|
473
|
+
|
|
425
474
|
if (this.httpsSocketSettingUpCount === 0) {
|
|
426
475
|
this.systemControlsExt.httpsSocketServer.started = true;
|
|
427
476
|
}
|
|
@@ -430,22 +479,36 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
430
479
|
);
|
|
431
480
|
|
|
432
481
|
} else {
|
|
433
|
-
|
|
434
|
-
|
|
482
|
+
const error = new Error(
|
|
483
|
+
`INVALID Socket Service security: ${service.security} on ${service?.name}`
|
|
484
|
+
);
|
|
485
|
+
const errorStack: string[] = error.stack.split('\n');
|
|
486
|
+
|
|
435
487
|
errorStack.splice(1, 4);
|
|
436
488
|
error.stack = errorStack.join('\n');
|
|
437
489
|
|
|
438
490
|
Dynamo_Log.error(`\n${error.message}`);
|
|
491
|
+
|
|
439
492
|
throw error;
|
|
440
493
|
}
|
|
441
494
|
} catch (error) {
|
|
442
|
-
Dynamo_Log.error(
|
|
495
|
+
Dynamo_Log.error(
|
|
496
|
+
`\nSocket Server service setup failed. (${service?.name})\n`,
|
|
497
|
+
error,
|
|
498
|
+
'\n'
|
|
499
|
+
);
|
|
500
|
+
|
|
443
501
|
throw error;
|
|
444
502
|
}
|
|
445
503
|
}
|
|
446
504
|
);
|
|
447
505
|
} catch (error) {
|
|
448
|
-
Dynamo_Log.error(
|
|
506
|
+
Dynamo_Log.error(
|
|
507
|
+
`\nSocket Server services setup failed. (${this.socketServices?.length} services)\n`,
|
|
508
|
+
error,
|
|
509
|
+
'\n'
|
|
510
|
+
);
|
|
511
|
+
|
|
449
512
|
throw error;
|
|
450
513
|
}
|
|
451
514
|
}
|
|
@@ -1,41 +1,46 @@
|
|
|
1
1
|
|
|
2
2
|
import { Dynamo_Log, delay } from '@futdevpro/fsm-dynamo';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
DynamoNTS_AppBase_Mock, DynamoNTS_AppFull_Mock
|
|
5
|
+
} from '../../_constants/mocks/app-server.mock';
|
|
4
6
|
|
|
5
|
-
describe('DynamoNTS_App AND DynamoNTS_AppExtended?;', () => {
|
|
7
|
+
describe('DynamoNTS_App AND DynamoNTS_AppExtended?;', (): void => {
|
|
6
8
|
// jasmine.DEFAULT_TIMEOUT_INTERVAL = 15 * second;
|
|
7
9
|
|
|
8
|
-
describe('a base instance;', () => {
|
|
10
|
+
describe('a base instance;', (): void => {
|
|
9
11
|
let app: DynamoNTS_AppBase_Mock;
|
|
10
12
|
|
|
11
|
-
beforeEach(async () => {
|
|
13
|
+
beforeEach(async (): Promise<void> => {
|
|
12
14
|
try {
|
|
13
15
|
app = new DynamoNTS_AppBase_Mock();
|
|
16
|
+
|
|
17
|
+
await delay(100);
|
|
18
|
+
|
|
14
19
|
await app.ready();
|
|
15
20
|
} catch (error) {
|
|
16
21
|
Dynamo_Log.test('error', error);
|
|
17
22
|
}
|
|
18
23
|
});
|
|
19
24
|
|
|
20
|
-
afterEach(async () => {
|
|
25
|
+
afterEach(async (): Promise<void> => {
|
|
21
26
|
await app.stop();
|
|
22
27
|
|
|
23
28
|
await delay(100);
|
|
24
29
|
});
|
|
25
30
|
|
|
26
|
-
it('should be created', () => {
|
|
31
|
+
it('should be created', (): void => {
|
|
27
32
|
expect(app).toBeDefined();
|
|
28
33
|
});
|
|
29
34
|
|
|
30
|
-
it('should be started', () => {
|
|
35
|
+
it('should be started', (): void => {
|
|
31
36
|
expect(app.started).toBeTrue();
|
|
32
37
|
});
|
|
33
38
|
});
|
|
34
39
|
|
|
35
|
-
describe('a full instance;', () => {
|
|
40
|
+
describe('a full instance;', (): void => {
|
|
36
41
|
let app: DynamoNTS_AppFull_Mock;
|
|
37
42
|
|
|
38
|
-
beforeEach(async () => {
|
|
43
|
+
beforeEach(async (): Promise<void> => {
|
|
39
44
|
try {
|
|
40
45
|
app = new DynamoNTS_AppFull_Mock();
|
|
41
46
|
await app.ready();
|
|
@@ -44,17 +49,17 @@ describe('DynamoNTS_App AND DynamoNTS_AppExtended?;', () => {
|
|
|
44
49
|
}
|
|
45
50
|
});
|
|
46
51
|
|
|
47
|
-
afterEach(async () => {
|
|
52
|
+
afterEach(async (): Promise<void> => {
|
|
48
53
|
await app.stop();
|
|
49
54
|
|
|
50
55
|
await delay(100);
|
|
51
56
|
});
|
|
52
57
|
|
|
53
|
-
it('should be created', () => {
|
|
58
|
+
it('should be created', (): void => {
|
|
54
59
|
expect(app).toBeDefined();
|
|
55
60
|
});
|
|
56
61
|
|
|
57
|
-
it('should be started', () => {
|
|
62
|
+
it('should be started', (): void => {
|
|
58
63
|
expect(app.started).toBeTrue();
|
|
59
64
|
});
|
|
60
65
|
});
|