@futdevpro/nts-dynamo 1.15.154 → 1.15.155
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/README.md +28 -24
- package/__documentations/2026-08-22-content-free-process-error-boundary.md +91 -91
- package/build/_services/shared.static-service.d.ts +11 -4
- package/build/_services/shared.static-service.d.ts.map +1 -1
- package/build/_services/shared.static-service.js +26 -6
- package/build/_services/shared.static-service.js.map +1 -1
- package/package.json +15 -9
- package/src/_models/control-models/app-params.control-model.spec.ts +23 -23
- package/src/_models/control-models/app-params.control-model.ts +10 -10
- package/src/_modules/server/index.ts +8 -8
- package/src/_modules/server/safe-diagnostic/safe-diagnostic-cause.type-enum.ts +8 -8
- package/src/_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum.ts +19 -19
- package/src/_modules/server/safe-diagnostic/safe-diagnostic.control-service.spec.ts +124 -124
- package/src/_modules/server/safe-diagnostic/safe-diagnostic.control-service.ts +99 -99
- package/src/_modules/server/safe-diagnostic/safe-diagnostic.interface.ts +20 -20
- package/src/_services/core/global.service.ts +55 -55
- package/src/_services/server/app-safe-diagnostic.spec.ts +124 -124
- package/src/_services/server/app.server.ts +294 -294
- package/src/_services/shared.static-service.spec.ts +57 -23
- package/src/_services/shared.static-service.ts +48 -19
|
@@ -66,13 +66,13 @@ import { DyNTS_GlobalService } from '../core/global.service';
|
|
|
66
66
|
import { DyNTS_CollectionGrowthMonitor } from '../core/collection-growth-monitor.service';
|
|
67
67
|
import { DyNTS_MemoryGuard } from '../core/memory-guard.service';
|
|
68
68
|
import { DyNTS_EventLoopDiag } from '../core/event-loop-diag.service';
|
|
69
|
-
import { DyNTS_RoutingModule } from '../route/routing-module.service';
|
|
70
|
-
import { DyNTS_getStarRoute } from '../../_collections/star.controller';
|
|
71
|
-
import { DyNTS_SafeDiagnosticStage_Type } from '../../_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum';
|
|
72
|
-
import { DyNTS_SafeDiagnostic_Interface } from '../../_modules/server/safe-diagnostic/safe-diagnostic.interface';
|
|
73
|
-
import {
|
|
74
|
-
DyNTS_SafeDiagnostic_ControlService
|
|
75
|
-
} from '../../_modules/server/safe-diagnostic/safe-diagnostic.control-service';
|
|
69
|
+
import { DyNTS_RoutingModule } from '../route/routing-module.service';
|
|
70
|
+
import { DyNTS_getStarRoute } from '../../_collections/star.controller';
|
|
71
|
+
import { DyNTS_SafeDiagnosticStage_Type } from '../../_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum';
|
|
72
|
+
import { DyNTS_SafeDiagnostic_Interface } from '../../_modules/server/safe-diagnostic/safe-diagnostic.interface';
|
|
73
|
+
import {
|
|
74
|
+
DyNTS_SafeDiagnostic_ControlService
|
|
75
|
+
} from '../../_modules/server/safe-diagnostic/safe-diagnostic.control-service';
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
*
|
|
@@ -348,78 +348,78 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
348
348
|
}
|
|
349
349
|
get fnLogs(): boolean {
|
|
350
350
|
return DyNTS_global_settings.log_settings.functions;
|
|
351
|
-
}
|
|
352
|
-
debugLog: boolean = DyNTS_global_settings.log_settings.server_debug;
|
|
353
|
-
|
|
354
|
-
private reportSafeDiagnostic(
|
|
355
|
-
code: string,
|
|
356
|
-
stage: DyNTS_SafeDiagnosticStage_Type,
|
|
357
|
-
error?: unknown,
|
|
358
|
-
status: number = 500
|
|
359
|
-
): DyNTS_SafeDiagnostic_Interface {
|
|
360
|
-
const configuredPrefix: string | undefined = DyNTS_global_settings.systemShortCodeName;
|
|
361
|
-
const prefix: string = configuredPrefix && /^[A-Z][A-Z0-9_-]{1,31}$/.test(configuredPrefix)
|
|
362
|
-
? configuredPrefix
|
|
363
|
-
: 'DYNTS';
|
|
364
|
-
|
|
365
|
-
return DyNTS_SafeDiagnostic_ControlService.report({
|
|
366
|
-
code: `${prefix}|${code}`,
|
|
367
|
-
stage: stage,
|
|
368
|
-
error: error,
|
|
369
|
-
status: status,
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
private forwardSafeDiagnostic(diagnostic: DyNTS_SafeDiagnostic_Interface): void {
|
|
374
|
-
try {
|
|
375
|
-
const pending: Promise<void> | undefined = DyNTS_GlobalService.globalErrorHandler?.(
|
|
376
|
-
DyNTS_SafeDiagnostic_ControlService.toError(diagnostic)
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
void pending?.catch((error: unknown): void => {
|
|
380
|
-
this.reportSafeDiagnostic(
|
|
381
|
-
'DYNTS-AS0-GLOBAL-HANDLER-REJECTED',
|
|
382
|
-
DyNTS_SafeDiagnosticStage_Type.globalErrorHandler,
|
|
383
|
-
error
|
|
384
|
-
);
|
|
385
|
-
});
|
|
386
|
-
} catch (error) {
|
|
387
|
-
this.reportSafeDiagnostic(
|
|
388
|
-
'DYNTS-AS0-GLOBAL-HANDLER-THREW',
|
|
389
|
-
DyNTS_SafeDiagnosticStage_Type.globalErrorHandler,
|
|
390
|
-
error
|
|
391
|
-
);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
constructor(/* extended?: boolean */){
|
|
351
|
+
}
|
|
352
|
+
debugLog: boolean = DyNTS_global_settings.log_settings.server_debug;
|
|
353
|
+
|
|
354
|
+
private reportSafeDiagnostic(
|
|
355
|
+
code: string,
|
|
356
|
+
stage: DyNTS_SafeDiagnosticStage_Type,
|
|
357
|
+
error?: unknown,
|
|
358
|
+
status: number = 500
|
|
359
|
+
): DyNTS_SafeDiagnostic_Interface {
|
|
360
|
+
const configuredPrefix: string | undefined = DyNTS_global_settings.systemShortCodeName;
|
|
361
|
+
const prefix: string = configuredPrefix && /^[A-Z][A-Z0-9_-]{1,31}$/.test(configuredPrefix)
|
|
362
|
+
? configuredPrefix
|
|
363
|
+
: 'DYNTS';
|
|
364
|
+
|
|
365
|
+
return DyNTS_SafeDiagnostic_ControlService.report({
|
|
366
|
+
code: `${prefix}|${code}`,
|
|
367
|
+
stage: stage,
|
|
368
|
+
error: error,
|
|
369
|
+
status: status,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
private forwardSafeDiagnostic(diagnostic: DyNTS_SafeDiagnostic_Interface): void {
|
|
374
|
+
try {
|
|
375
|
+
const pending: Promise<void> | undefined = DyNTS_GlobalService.globalErrorHandler?.(
|
|
376
|
+
DyNTS_SafeDiagnostic_ControlService.toError(diagnostic)
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
void pending?.catch((error: unknown): void => {
|
|
380
|
+
this.reportSafeDiagnostic(
|
|
381
|
+
'DYNTS-AS0-GLOBAL-HANDLER-REJECTED',
|
|
382
|
+
DyNTS_SafeDiagnosticStage_Type.globalErrorHandler,
|
|
383
|
+
error
|
|
384
|
+
);
|
|
385
|
+
});
|
|
386
|
+
} catch (error) {
|
|
387
|
+
this.reportSafeDiagnostic(
|
|
388
|
+
'DYNTS-AS0-GLOBAL-HANDLER-THREW',
|
|
389
|
+
DyNTS_SafeDiagnosticStage_Type.globalErrorHandler,
|
|
390
|
+
error
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
constructor(/* extended?: boolean */){
|
|
396
396
|
super();
|
|
397
397
|
|
|
398
398
|
/* dotenv.config() */
|
|
399
399
|
|
|
400
|
-
process.on(
|
|
401
|
-
'unhandledRejection',
|
|
402
|
-
(reason: unknown): void => {
|
|
403
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
404
|
-
'DYNTS-AS0-BASE-UR',
|
|
405
|
-
DyNTS_SafeDiagnosticStage_Type.unhandledRejection,
|
|
406
|
-
reason
|
|
407
|
-
);
|
|
408
|
-
|
|
409
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
410
|
-
}
|
|
411
|
-
);
|
|
412
|
-
|
|
413
|
-
this.asyncConstruct(/* extended */).catch((error: unknown): void => {
|
|
414
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
415
|
-
'DYNTS-AS0-BOOTSTRAP-FAILED',
|
|
416
|
-
DyNTS_SafeDiagnosticStage_Type.bootstrap,
|
|
417
|
-
error
|
|
418
|
-
);
|
|
419
|
-
|
|
420
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
421
|
-
|
|
422
|
-
process.exit(1);
|
|
400
|
+
process.on(
|
|
401
|
+
'unhandledRejection',
|
|
402
|
+
(reason: unknown): void => {
|
|
403
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
404
|
+
'DYNTS-AS0-BASE-UR',
|
|
405
|
+
DyNTS_SafeDiagnosticStage_Type.unhandledRejection,
|
|
406
|
+
reason
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
this.asyncConstruct(/* extended */).catch((error: unknown): void => {
|
|
414
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
415
|
+
'DYNTS-AS0-BOOTSTRAP-FAILED',
|
|
416
|
+
DyNTS_SafeDiagnosticStage_Type.bootstrap,
|
|
417
|
+
error
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
421
|
+
|
|
422
|
+
process.exit(1);
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
|
|
@@ -555,17 +555,17 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
555
555
|
this._rootServices = await this.getRootServices();
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
-
if (this.postProcess) {
|
|
559
|
-
await this.postProcess().catch((error: unknown): void => {
|
|
560
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
561
|
-
'DYNTS-AS0-POST-PROCESS-FAILED',
|
|
562
|
-
DyNTS_SafeDiagnosticStage_Type.postProcess,
|
|
563
|
-
error
|
|
564
|
-
);
|
|
565
|
-
|
|
566
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
567
|
-
});
|
|
568
|
-
}
|
|
558
|
+
if (this.postProcess) {
|
|
559
|
+
await this.postProcess().catch((error: unknown): void => {
|
|
560
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
561
|
+
'DYNTS-AS0-POST-PROCESS-FAILED',
|
|
562
|
+
DyNTS_SafeDiagnosticStage_Type.postProcess,
|
|
563
|
+
error
|
|
564
|
+
);
|
|
565
|
+
|
|
566
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
569
|
|
|
570
570
|
// FR-193 — bedrock OOM korai-figyelmeztetés: feltelepítjük a heap-watchdogot, ha
|
|
571
571
|
// engedélyezve (DyNTS_global_settings.memoryGuard.enabled, default true). Biztonságos:
|
|
@@ -575,25 +575,25 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
575
575
|
if (DyNTS_global_settings.memoryGuard?.enabled) {
|
|
576
576
|
DyNTS_MemoryGuard.getInstance().install();
|
|
577
577
|
}
|
|
578
|
-
} catch (memoryGuardError: unknown) {
|
|
579
|
-
this.reportSafeDiagnostic(
|
|
580
|
-
'DYNTS-AS0-MEMORY-GUARD-SKIPPED',
|
|
581
|
-
DyNTS_SafeDiagnosticStage_Type.memoryGuard,
|
|
582
|
-
memoryGuardError
|
|
583
|
-
);
|
|
584
|
-
}
|
|
578
|
+
} catch (memoryGuardError: unknown) {
|
|
579
|
+
this.reportSafeDiagnostic(
|
|
580
|
+
'DYNTS-AS0-MEMORY-GUARD-SKIPPED',
|
|
581
|
+
DyNTS_SafeDiagnosticStage_Type.memoryGuard,
|
|
582
|
+
memoryGuardError
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
585
|
|
|
586
586
|
// BFR-OVERSEER-007 — event-loop-lag diag a MemoryGuard MELLÉ: a „process él, HTTP néma" wedge
|
|
587
587
|
// belső mérése (natív histogram, olcsó). Observation-only, sosem dob; a /server/diag olvas belőle.
|
|
588
588
|
try {
|
|
589
589
|
DyNTS_EventLoopDiag.getInstance().install();
|
|
590
|
-
} catch (eventLoopDiagError: unknown) {
|
|
591
|
-
this.reportSafeDiagnostic(
|
|
592
|
-
'DYNTS-AS0-EVENT-LOOP-DIAG-SKIPPED',
|
|
593
|
-
DyNTS_SafeDiagnosticStage_Type.eventLoopDiagnostic,
|
|
594
|
-
eventLoopDiagError
|
|
595
|
-
);
|
|
596
|
-
}
|
|
590
|
+
} catch (eventLoopDiagError: unknown) {
|
|
591
|
+
this.reportSafeDiagnostic(
|
|
592
|
+
'DYNTS-AS0-EVENT-LOOP-DIAG-SKIPPED',
|
|
593
|
+
DyNTS_SafeDiagnosticStage_Type.eventLoopDiagnostic,
|
|
594
|
+
eventLoopDiagError
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
597
|
|
|
598
598
|
// FR-258 / SR-4 — proactive collection-growth monitor (companion to the MemoryGuard). Warns
|
|
599
599
|
// into the Errors-sink when a collection grows unbounded, BEFORE it can be loaded into heap and
|
|
@@ -602,13 +602,13 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
602
602
|
if (DyNTS_global_settings.collectionGrowthMonitor?.enabled) {
|
|
603
603
|
DyNTS_CollectionGrowthMonitor.getInstance().install();
|
|
604
604
|
}
|
|
605
|
-
} catch (cgmError: unknown) {
|
|
606
|
-
this.reportSafeDiagnostic(
|
|
607
|
-
'DYNTS-AS0-COLLECTION-GROWTH-MONITOR-SKIPPED',
|
|
608
|
-
DyNTS_SafeDiagnosticStage_Type.collectionGrowthMonitor,
|
|
609
|
-
cgmError
|
|
610
|
-
);
|
|
611
|
-
}
|
|
605
|
+
} catch (cgmError: unknown) {
|
|
606
|
+
this.reportSafeDiagnostic(
|
|
607
|
+
'DYNTS-AS0-COLLECTION-GROWTH-MONITOR-SKIPPED',
|
|
608
|
+
DyNTS_SafeDiagnosticStage_Type.collectionGrowthMonitor,
|
|
609
|
+
cgmError
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
612
|
|
|
613
613
|
if (!extended) {
|
|
614
614
|
await this.ready();
|
|
@@ -620,10 +620,10 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
620
620
|
/* DyFM_Log.info(`NTS Version: ${this.ntsVersion}`); */
|
|
621
621
|
DyFM_Log.H_success(`${this.params.name} started successfully.`);
|
|
622
622
|
}
|
|
623
|
-
} catch (error) {
|
|
624
|
-
this.constructErrors.push(error);
|
|
625
|
-
|
|
626
|
-
throw new DyFM_Error({
|
|
623
|
+
} catch (error) {
|
|
624
|
+
this.constructErrors.push(error);
|
|
625
|
+
|
|
626
|
+
throw new DyFM_Error({
|
|
627
627
|
...this._getDefaultErrorSettings('asyncConstruct', error),
|
|
628
628
|
|
|
629
629
|
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-AS0-001`,
|
|
@@ -648,14 +648,14 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
648
648
|
await DyFM_Async.delay(100);
|
|
649
649
|
|
|
650
650
|
let ready: boolean = false;
|
|
651
|
-
const start: number = +new Date();
|
|
652
|
-
|
|
653
|
-
if (this.constructErrors.length) {
|
|
654
|
-
this.reportSafeDiagnostic(
|
|
655
|
-
'DYNTS-AS0-READINESS-CONSTRUCT-ERROR',
|
|
656
|
-
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
657
|
-
this.constructErrors[0]
|
|
658
|
-
);
|
|
651
|
+
const start: number = +new Date();
|
|
652
|
+
|
|
653
|
+
if (this.constructErrors.length) {
|
|
654
|
+
this.reportSafeDiagnostic(
|
|
655
|
+
'DYNTS-AS0-READINESS-CONSTRUCT-ERROR',
|
|
656
|
+
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
657
|
+
this.constructErrors[0]
|
|
658
|
+
);
|
|
659
659
|
|
|
660
660
|
throw new DyFM_Error({
|
|
661
661
|
...this._getDefaultErrorSettings(
|
|
@@ -678,19 +678,19 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
678
678
|
this.systemControls.httpServer.getIsReady() &&
|
|
679
679
|
this.systemControls.httpsServer.getIsReady()
|
|
680
680
|
);
|
|
681
|
-
}
|
|
681
|
+
}
|
|
682
682
|
|
|
683
683
|
if (!ready) {
|
|
684
684
|
await DyFM_Async.wait(100);
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
-
if (timeout < +new Date() - start) {
|
|
689
|
-
this.reportSafeDiagnostic(
|
|
690
|
-
'DYNTS-AS0-READINESS-TIMEOUT',
|
|
691
|
-
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
692
|
-
this.constructErrors[0] ?? new Error('readiness-timeout')
|
|
693
|
-
);
|
|
688
|
+
if (timeout < +new Date() - start) {
|
|
689
|
+
this.reportSafeDiagnostic(
|
|
690
|
+
'DYNTS-AS0-READINESS-TIMEOUT',
|
|
691
|
+
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
692
|
+
this.constructErrors[0] ?? new Error('readiness-timeout')
|
|
693
|
+
);
|
|
694
694
|
|
|
695
695
|
throw new DyFM_Error({
|
|
696
696
|
...this._getDefaultErrorSettings(
|
|
@@ -711,12 +711,12 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
711
711
|
});
|
|
712
712
|
}
|
|
713
713
|
|
|
714
|
-
if (this.constructErrors.length) {
|
|
715
|
-
this.reportSafeDiagnostic(
|
|
716
|
-
'DYNTS-AS0-READINESS-LATE-CONSTRUCT-ERROR',
|
|
717
|
-
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
718
|
-
this.constructErrors[0]
|
|
719
|
-
);
|
|
714
|
+
if (this.constructErrors.length) {
|
|
715
|
+
this.reportSafeDiagnostic(
|
|
716
|
+
'DYNTS-AS0-READINESS-LATE-CONSTRUCT-ERROR',
|
|
717
|
+
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
718
|
+
this.constructErrors[0]
|
|
719
|
+
);
|
|
720
720
|
|
|
721
721
|
throw new DyFM_Error({
|
|
722
722
|
...this._getDefaultErrorSettings(
|
|
@@ -753,11 +753,11 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
753
753
|
msg += `\nHTTPS Server start failed.`;
|
|
754
754
|
}
|
|
755
755
|
|
|
756
|
-
this.reportSafeDiagnostic(
|
|
757
|
-
'DYNTS-AS0-READINESS-UNKNOWN',
|
|
758
|
-
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
759
|
-
this.constructErrors[0] ?? new Error('readiness-unknown')
|
|
760
|
-
);
|
|
756
|
+
this.reportSafeDiagnostic(
|
|
757
|
+
'DYNTS-AS0-READINESS-UNKNOWN',
|
|
758
|
+
DyNTS_SafeDiagnosticStage_Type.readiness,
|
|
759
|
+
this.constructErrors[0] ?? new Error('readiness-unknown')
|
|
760
|
+
);
|
|
761
761
|
|
|
762
762
|
throw new DyFM_Error({
|
|
763
763
|
...this._getDefaultErrorSettings('ready', new Error(msg)),
|
|
@@ -928,9 +928,9 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
928
928
|
this.systemControls.mongoose.init = true;
|
|
929
929
|
|
|
930
930
|
this.mongoose.connection
|
|
931
|
-
.once('open', (): void => {
|
|
932
|
-
this.systemControls.mongoose.started = true;
|
|
933
|
-
DyFM_Log.success('\nConnected to MongoDB.\n');
|
|
931
|
+
.once('open', (): void => {
|
|
932
|
+
this.systemControls.mongoose.started = true;
|
|
933
|
+
DyFM_Log.success('\nConnected to MongoDB.\n');
|
|
934
934
|
|
|
935
935
|
resolve();
|
|
936
936
|
|
|
@@ -955,27 +955,27 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
955
955
|
// beállítja a started flag-et, így a runtime DB-műveletek elindulnak.
|
|
956
956
|
this.systemControls.mongoose.init = false;
|
|
957
957
|
|
|
958
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
959
|
-
'DYNTS-AS0-SDB1',
|
|
960
|
-
DyNTS_SafeDiagnosticStage_Type.databaseConnect,
|
|
961
|
-
error,
|
|
962
|
-
503
|
|
963
|
-
);
|
|
964
|
-
|
|
965
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
966
|
-
|
|
967
|
-
resolve();
|
|
968
|
-
|
|
969
|
-
} else {
|
|
970
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
971
|
-
'DYNTS-AS0-SDB2',
|
|
972
|
-
DyNTS_SafeDiagnosticStage_Type.databaseRuntime,
|
|
973
|
-
error,
|
|
974
|
-
503
|
|
975
|
-
);
|
|
976
|
-
|
|
977
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
978
|
-
}
|
|
958
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
959
|
+
'DYNTS-AS0-SDB1',
|
|
960
|
+
DyNTS_SafeDiagnosticStage_Type.databaseConnect,
|
|
961
|
+
error,
|
|
962
|
+
503
|
|
963
|
+
);
|
|
964
|
+
|
|
965
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
966
|
+
|
|
967
|
+
resolve();
|
|
968
|
+
|
|
969
|
+
} else {
|
|
970
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
971
|
+
'DYNTS-AS0-SDB2',
|
|
972
|
+
DyNTS_SafeDiagnosticStage_Type.databaseRuntime,
|
|
973
|
+
error,
|
|
974
|
+
503
|
|
975
|
+
);
|
|
976
|
+
|
|
977
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
978
|
+
}
|
|
979
979
|
});
|
|
980
980
|
|
|
981
981
|
try {
|
|
@@ -1017,22 +1017,22 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1017
1017
|
await this.mongoose.disconnect().catch((): void => undefined);
|
|
1018
1018
|
await this.mongoose.connect(this._params.dbUri, this._params.dbOptions);
|
|
1019
1019
|
},
|
|
1020
|
-
log: (msg: string): void => {
|
|
1021
|
-
this.reportSafeDiagnostic(
|
|
1022
|
-
'DYNTS-AS0-MONGO-RECONNECT-EVENT',
|
|
1023
|
-
DyNTS_SafeDiagnosticStage_Type.mongoReconnectGuard,
|
|
1024
|
-
msg,
|
|
1025
|
-
503
|
|
1026
|
-
);
|
|
1027
|
-
},
|
|
1028
|
-
});
|
|
1029
|
-
} catch (guardErr) {
|
|
1030
|
-
this.reportSafeDiagnostic(
|
|
1031
|
-
'DYNTS-AS0-MONGO-RECONNECT-FAILED',
|
|
1032
|
-
DyNTS_SafeDiagnosticStage_Type.mongoReconnectGuard,
|
|
1033
|
-
guardErr,
|
|
1034
|
-
503
|
|
1035
|
-
);
|
|
1020
|
+
log: (msg: string): void => {
|
|
1021
|
+
this.reportSafeDiagnostic(
|
|
1022
|
+
'DYNTS-AS0-MONGO-RECONNECT-EVENT',
|
|
1023
|
+
DyNTS_SafeDiagnosticStage_Type.mongoReconnectGuard,
|
|
1024
|
+
msg,
|
|
1025
|
+
503
|
|
1026
|
+
);
|
|
1027
|
+
},
|
|
1028
|
+
});
|
|
1029
|
+
} catch (guardErr) {
|
|
1030
|
+
this.reportSafeDiagnostic(
|
|
1031
|
+
'DYNTS-AS0-MONGO-RECONNECT-FAILED',
|
|
1032
|
+
DyNTS_SafeDiagnosticStage_Type.mongoReconnectGuard,
|
|
1033
|
+
guardErr,
|
|
1034
|
+
503
|
|
1035
|
+
);
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
@@ -1076,32 +1076,32 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1076
1076
|
`${Math.round(ttlSeconds / 86400)}d (${ttlSeconds}s)`,
|
|
1077
1077
|
);
|
|
1078
1078
|
}
|
|
1079
|
-
} else if (action === 'differs') {
|
|
1080
|
-
// Live index has a different TTL — left untouched at boot (see ensureRetentionTtlIndex doc).
|
|
1081
|
-
this.reportSafeDiagnostic(
|
|
1082
|
-
'DYNTS-AS0-RETENTION-INDEX-DIFFERS',
|
|
1083
|
-
DyNTS_SafeDiagnosticStage_Type.retention,
|
|
1084
|
-
new Error('retention-index-differs')
|
|
1085
|
-
);
|
|
1086
|
-
}
|
|
1087
|
-
} catch (idxErr: unknown) {
|
|
1088
|
-
this.reportSafeDiagnostic(
|
|
1089
|
-
'DYNTS-AS0-RETENTION-INDEX-FAILED',
|
|
1090
|
-
DyNTS_SafeDiagnosticStage_Type.retention,
|
|
1091
|
-
idxErr
|
|
1092
|
-
);
|
|
1079
|
+
} else if (action === 'differs') {
|
|
1080
|
+
// Live index has a different TTL — left untouched at boot (see ensureRetentionTtlIndex doc).
|
|
1081
|
+
this.reportSafeDiagnostic(
|
|
1082
|
+
'DYNTS-AS0-RETENTION-INDEX-DIFFERS',
|
|
1083
|
+
DyNTS_SafeDiagnosticStage_Type.retention,
|
|
1084
|
+
new Error('retention-index-differs')
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
} catch (idxErr: unknown) {
|
|
1088
|
+
this.reportSafeDiagnostic(
|
|
1089
|
+
'DYNTS-AS0-RETENTION-INDEX-FAILED',
|
|
1090
|
+
DyNTS_SafeDiagnosticStage_Type.retention,
|
|
1091
|
+
idxErr
|
|
1092
|
+
);
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
if (ensured > 0) {
|
|
1097
1097
|
DyFM_Log.success(`[FR-258 retention] ${ensured} TTL index(es) ensured (auto-retention active).`);
|
|
1098
1098
|
}
|
|
1099
|
-
} catch (err: unknown) {
|
|
1100
|
-
this.reportSafeDiagnostic(
|
|
1101
|
-
'DYNTS-AS0-RETENTION-INSTALLER-FAILED',
|
|
1102
|
-
DyNTS_SafeDiagnosticStage_Type.retention,
|
|
1103
|
-
err
|
|
1104
|
-
);
|
|
1099
|
+
} catch (err: unknown) {
|
|
1100
|
+
this.reportSafeDiagnostic(
|
|
1101
|
+
'DYNTS-AS0-RETENTION-INSTALLER-FAILED',
|
|
1102
|
+
DyNTS_SafeDiagnosticStage_Type.retention,
|
|
1103
|
+
err
|
|
1104
|
+
);
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
|
|
@@ -1176,11 +1176,11 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1176
1176
|
errorStack.splice(1, 2);
|
|
1177
1177
|
error.stack = errorStack.join('\n');
|
|
1178
1178
|
|
|
1179
|
-
this.reportSafeDiagnostic(
|
|
1180
|
-
'DYNTS-AS0-OPEN-ROUTE-CONFIGURATION',
|
|
1181
|
-
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1182
|
-
error
|
|
1183
|
-
);
|
|
1179
|
+
this.reportSafeDiagnostic(
|
|
1180
|
+
'DYNTS-AS0-OPEN-ROUTE-CONFIGURATION',
|
|
1181
|
+
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1182
|
+
error
|
|
1183
|
+
);
|
|
1184
1184
|
|
|
1185
1185
|
throw error;
|
|
1186
1186
|
}
|
|
@@ -1226,11 +1226,11 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1226
1226
|
errorStack.splice(1, 2);
|
|
1227
1227
|
error.stack = errorStack.join('\n');
|
|
1228
1228
|
|
|
1229
|
-
this.reportSafeDiagnostic(
|
|
1230
|
-
'DYNTS-AS0-SECURE-ROUTE-CONFIGURATION',
|
|
1231
|
-
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1232
|
-
error
|
|
1233
|
-
);
|
|
1229
|
+
this.reportSafeDiagnostic(
|
|
1230
|
+
'DYNTS-AS0-SECURE-ROUTE-CONFIGURATION',
|
|
1231
|
+
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1232
|
+
error
|
|
1233
|
+
);
|
|
1234
1234
|
|
|
1235
1235
|
throw error;
|
|
1236
1236
|
}
|
|
@@ -1319,14 +1319,14 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1319
1319
|
);
|
|
1320
1320
|
|
|
1321
1321
|
resolve();
|
|
1322
|
-
})
|
|
1323
|
-
.on('error', (error: unknown): void => {
|
|
1324
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1325
|
-
'DYNTS-AS0-HTTPS-ERROR',
|
|
1326
|
-
DyNTS_SafeDiagnosticStage_Type.httpsServer,
|
|
1327
|
-
error,
|
|
1328
|
-
503
|
|
1329
|
-
);
|
|
1322
|
+
})
|
|
1323
|
+
.on('error', (error: unknown): void => {
|
|
1324
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1325
|
+
'DYNTS-AS0-HTTPS-ERROR',
|
|
1326
|
+
DyNTS_SafeDiagnosticStage_Type.httpsServer,
|
|
1327
|
+
error,
|
|
1328
|
+
503
|
|
1329
|
+
);
|
|
1330
1330
|
|
|
1331
1331
|
if (!this.systemControls.httpsServer.started) {
|
|
1332
1332
|
const d_error: DyFM_Error = new DyFM_Error({
|
|
@@ -1334,26 +1334,26 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1334
1334
|
|
|
1335
1335
|
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-AS0-SE1`,
|
|
1336
1336
|
message: `HTTPS (secure) start server ERROR`,
|
|
1337
|
-
});
|
|
1338
|
-
|
|
1339
|
-
this.constructErrors.push(d_error);
|
|
1340
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
this.constructErrors.push(d_error);
|
|
1340
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1341
1341
|
|
|
1342
1342
|
reject(d_error);
|
|
1343
1343
|
|
|
1344
|
-
} else {
|
|
1345
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1346
|
-
}
|
|
1347
|
-
})
|
|
1348
|
-
.on('uncaughtException', (exception): void => {
|
|
1349
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1350
|
-
'DYNTS-AS0-HTTPS-UNCAUGHT',
|
|
1351
|
-
DyNTS_SafeDiagnosticStage_Type.httpsServer,
|
|
1352
|
-
exception
|
|
1353
|
-
);
|
|
1354
|
-
|
|
1355
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1356
|
-
});
|
|
1344
|
+
} else {
|
|
1345
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1346
|
+
}
|
|
1347
|
+
})
|
|
1348
|
+
.on('uncaughtException', (exception): void => {
|
|
1349
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1350
|
+
'DYNTS-AS0-HTTPS-UNCAUGHT',
|
|
1351
|
+
DyNTS_SafeDiagnosticStage_Type.httpsServer,
|
|
1352
|
+
exception
|
|
1353
|
+
);
|
|
1354
|
+
|
|
1355
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1356
|
+
});
|
|
1357
1357
|
});
|
|
1358
1358
|
}
|
|
1359
1359
|
|
|
@@ -1385,13 +1385,13 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1385
1385
|
resolve();
|
|
1386
1386
|
}
|
|
1387
1387
|
)
|
|
1388
|
-
.on('error', (error: unknown): void => {
|
|
1389
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1390
|
-
'DYNTS-AS0-HTTP-ERROR',
|
|
1391
|
-
DyNTS_SafeDiagnosticStage_Type.httpServer,
|
|
1392
|
-
error,
|
|
1393
|
-
503
|
|
1394
|
-
);
|
|
1388
|
+
.on('error', (error: unknown): void => {
|
|
1389
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1390
|
+
'DYNTS-AS0-HTTP-ERROR',
|
|
1391
|
+
DyNTS_SafeDiagnosticStage_Type.httpServer,
|
|
1392
|
+
error,
|
|
1393
|
+
503
|
|
1394
|
+
);
|
|
1395
1395
|
|
|
1396
1396
|
if (!this.systemControls.httpServer.started) {
|
|
1397
1397
|
const d_error: DyFM_Error = new DyFM_Error({
|
|
@@ -1401,24 +1401,24 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1401
1401
|
message: `HTTP (open) start server ERROR`,
|
|
1402
1402
|
});
|
|
1403
1403
|
|
|
1404
|
-
this.constructErrors.push(d_error);
|
|
1405
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1404
|
+
this.constructErrors.push(d_error);
|
|
1405
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1406
1406
|
|
|
1407
1407
|
reject(d_error);
|
|
1408
1408
|
|
|
1409
|
-
} else {
|
|
1410
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1411
|
-
}
|
|
1412
|
-
})
|
|
1413
|
-
.on('uncaughtException', (exception): void => {
|
|
1414
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1415
|
-
'DYNTS-AS0-HTTP-UNCAUGHT',
|
|
1416
|
-
DyNTS_SafeDiagnosticStage_Type.httpServer,
|
|
1417
|
-
exception
|
|
1418
|
-
);
|
|
1419
|
-
|
|
1420
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1421
|
-
});
|
|
1409
|
+
} else {
|
|
1410
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1411
|
+
}
|
|
1412
|
+
})
|
|
1413
|
+
.on('uncaughtException', (exception): void => {
|
|
1414
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1415
|
+
'DYNTS-AS0-HTTP-UNCAUGHT',
|
|
1416
|
+
DyNTS_SafeDiagnosticStage_Type.httpServer,
|
|
1417
|
+
exception
|
|
1418
|
+
);
|
|
1419
|
+
|
|
1420
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1421
|
+
});
|
|
1422
1422
|
});
|
|
1423
1423
|
}
|
|
1424
1424
|
} catch (error) {
|
|
@@ -1433,39 +1433,39 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1433
1433
|
/**
|
|
1434
1434
|
*
|
|
1435
1435
|
*/
|
|
1436
|
-
private async expressErrorHandling(error, req, res, next): Promise<void> {
|
|
1437
|
-
try {
|
|
1438
|
-
if (error) {
|
|
1439
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1440
|
-
'DYNTS-AS0-EXPRESS-ERROR',
|
|
1441
|
-
DyNTS_SafeDiagnosticStage_Type.expressFallback,
|
|
1442
|
-
error
|
|
1443
|
-
);
|
|
1444
|
-
|
|
1445
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1436
|
+
private async expressErrorHandling(error, req, res, next): Promise<void> {
|
|
1437
|
+
try {
|
|
1438
|
+
if (error) {
|
|
1439
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1440
|
+
'DYNTS-AS0-EXPRESS-ERROR',
|
|
1441
|
+
DyNTS_SafeDiagnosticStage_Type.expressFallback,
|
|
1442
|
+
error
|
|
1443
|
+
);
|
|
1444
|
+
|
|
1445
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1446
1446
|
|
|
1447
1447
|
// Kliens-safe strip (BFR-FDPAUTHSERVICE-002): az express-error út eddig NYERS error-t küldött
|
|
1448
1448
|
// (0 strip) — DyFM-nél belső stack/verzió/issuer, axios-jellegű error-nál akár auth-header is
|
|
1449
|
-
// kimehetett. A strip-szabályok SSOT-ja a DyNTS_ClientSafeError_Util.
|
|
1450
|
-
res.send(DyNTS_ClientSafeError_Util.toClientSafe(error))
|
|
1451
|
-
} else {
|
|
1452
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1453
|
-
'DYNTS-AS0-EXPRESS-MISSING-ERROR',
|
|
1454
|
-
DyNTS_SafeDiagnosticStage_Type.expressFallback
|
|
1455
|
-
);
|
|
1456
|
-
|
|
1457
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1458
|
-
}
|
|
1459
|
-
} catch (error) {
|
|
1460
|
-
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1461
|
-
'DYNTS-AS0-EXPRESS-MULTILEVEL',
|
|
1462
|
-
DyNTS_SafeDiagnosticStage_Type.expressFallback,
|
|
1463
|
-
error
|
|
1464
|
-
);
|
|
1465
|
-
|
|
1466
|
-
this.forwardSafeDiagnostic(diagnostic);
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1449
|
+
// kimehetett. A strip-szabályok SSOT-ja a DyNTS_ClientSafeError_Util.
|
|
1450
|
+
res.send(DyNTS_ClientSafeError_Util.toClientSafe(error))
|
|
1451
|
+
} else {
|
|
1452
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1453
|
+
'DYNTS-AS0-EXPRESS-MISSING-ERROR',
|
|
1454
|
+
DyNTS_SafeDiagnosticStage_Type.expressFallback
|
|
1455
|
+
);
|
|
1456
|
+
|
|
1457
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1458
|
+
}
|
|
1459
|
+
} catch (error) {
|
|
1460
|
+
const diagnostic: DyNTS_SafeDiagnostic_Interface = this.reportSafeDiagnostic(
|
|
1461
|
+
'DYNTS-AS0-EXPRESS-MULTILEVEL',
|
|
1462
|
+
DyNTS_SafeDiagnosticStage_Type.expressFallback,
|
|
1463
|
+
error
|
|
1464
|
+
);
|
|
1465
|
+
|
|
1466
|
+
this.forwardSafeDiagnostic(diagnostic);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
1469
|
|
|
1470
1470
|
/**
|
|
1471
1471
|
*
|
|
@@ -1507,11 +1507,11 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1507
1507
|
error.stack = errorStack.join('\n'); */
|
|
1508
1508
|
error.stack = module.stackLocation;
|
|
1509
1509
|
|
|
1510
|
-
this.reportSafeDiagnostic(
|
|
1511
|
-
'DYNTS-AS0-SECURE-ROUTE-DUPLICATION',
|
|
1512
|
-
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1513
|
-
error
|
|
1514
|
-
);
|
|
1510
|
+
this.reportSafeDiagnostic(
|
|
1511
|
+
'DYNTS-AS0-SECURE-ROUTE-DUPLICATION',
|
|
1512
|
+
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1513
|
+
error
|
|
1514
|
+
);
|
|
1515
1515
|
|
|
1516
1516
|
throw new DyFM_Error({
|
|
1517
1517
|
...this._getDefaultErrorSettings('mountSecureRoutes', error),
|
|
@@ -1572,11 +1572,11 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1572
1572
|
error.stack = errorStack.join('\n'); */
|
|
1573
1573
|
error.stack = module.stackLocation;
|
|
1574
1574
|
|
|
1575
|
-
this.reportSafeDiagnostic(
|
|
1576
|
-
'DYNTS-AS0-OPEN-ROUTE-DUPLICATION',
|
|
1577
|
-
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1578
|
-
error
|
|
1579
|
-
);
|
|
1575
|
+
this.reportSafeDiagnostic(
|
|
1576
|
+
'DYNTS-AS0-OPEN-ROUTE-DUPLICATION',
|
|
1577
|
+
DyNTS_SafeDiagnosticStage_Type.routing,
|
|
1578
|
+
error
|
|
1579
|
+
);
|
|
1580
1580
|
|
|
1581
1581
|
throw new DyFM_Error({
|
|
1582
1582
|
...this._getDefaultErrorSettings('mountOpenRoutes', error),
|