@friggframework/core 2.0.0--canary.427.04558b7.0 → 2.0.0--canary.427.9708b13.0
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/handlers/routers/health.js +21 -86
- package/package.json +5 -5
|
@@ -466,129 +466,64 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
466
466
|
const startTime = Date.now();
|
|
467
467
|
const response = buildHealthCheckResponse(startTime);
|
|
468
468
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
databaseResult,
|
|
472
|
-
encryptionResult,
|
|
473
|
-
externalApisResult,
|
|
474
|
-
integrationsResult,
|
|
475
|
-
] = await Promise.allSettled([
|
|
476
|
-
checkDatabaseHealth().catch((error) => ({
|
|
477
|
-
status: 'unhealthy',
|
|
478
|
-
error: error.message,
|
|
479
|
-
})),
|
|
480
|
-
checkEncryptionHealth().catch((error) => ({
|
|
481
|
-
status: 'unhealthy',
|
|
482
|
-
error: error.message,
|
|
483
|
-
})),
|
|
484
|
-
checkExternalAPIs(),
|
|
485
|
-
Promise.resolve().then(() => {
|
|
486
|
-
try {
|
|
487
|
-
return checkIntegrations();
|
|
488
|
-
} catch (error) {
|
|
489
|
-
return {
|
|
490
|
-
status: 'unhealthy',
|
|
491
|
-
error: error.message,
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
}),
|
|
495
|
-
]);
|
|
496
|
-
|
|
497
|
-
// Process database check results
|
|
498
|
-
if (databaseResult.status === 'fulfilled') {
|
|
499
|
-
response.checks.database = databaseResult.value;
|
|
469
|
+
try {
|
|
470
|
+
response.checks.database = await checkDatabaseHealth();
|
|
500
471
|
const dbState = getDatabaseState();
|
|
501
|
-
if (
|
|
502
|
-
!dbState.isConnected ||
|
|
503
|
-
response.checks.database.status === 'unhealthy'
|
|
504
|
-
) {
|
|
472
|
+
if (!dbState.isConnected) {
|
|
505
473
|
response.status = 'unhealthy';
|
|
506
474
|
}
|
|
507
475
|
// eslint-disable-next-line no-console
|
|
508
476
|
console.log('Database check completed:', response.checks.database);
|
|
509
|
-
}
|
|
477
|
+
} catch (error) {
|
|
510
478
|
response.checks.database = {
|
|
511
479
|
status: 'unhealthy',
|
|
512
|
-
error:
|
|
480
|
+
error: error.message,
|
|
513
481
|
};
|
|
514
482
|
response.status = 'unhealthy';
|
|
515
483
|
// eslint-disable-next-line no-console
|
|
516
|
-
console.log('Database check error:',
|
|
484
|
+
console.log('Database check error:', error.message);
|
|
517
485
|
}
|
|
518
486
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
response.checks.encryption = encryptionResult.value;
|
|
487
|
+
try {
|
|
488
|
+
response.checks.encryption = await checkEncryptionHealth();
|
|
522
489
|
if (response.checks.encryption.status === 'unhealthy') {
|
|
523
490
|
response.status = 'unhealthy';
|
|
524
491
|
}
|
|
525
492
|
// eslint-disable-next-line no-console
|
|
526
493
|
console.log('Encryption check completed:', response.checks.encryption);
|
|
527
|
-
}
|
|
494
|
+
} catch (error) {
|
|
528
495
|
response.checks.encryption = {
|
|
529
496
|
status: 'unhealthy',
|
|
530
|
-
error:
|
|
531
|
-
encryptionResult.reason?.message || 'Encryption check failed',
|
|
497
|
+
error: error.message,
|
|
532
498
|
};
|
|
533
499
|
response.status = 'unhealthy';
|
|
534
500
|
// eslint-disable-next-line no-console
|
|
535
|
-
console.log(
|
|
536
|
-
'Encryption check error:',
|
|
537
|
-
encryptionResult.reason?.message
|
|
538
|
-
);
|
|
501
|
+
console.log('Encryption check error:', error.message);
|
|
539
502
|
}
|
|
540
503
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
response.checks.externalApis = apiStatuses;
|
|
545
|
-
if (!allReachable) {
|
|
546
|
-
response.status = 'unhealthy';
|
|
547
|
-
}
|
|
548
|
-
// eslint-disable-next-line no-console
|
|
549
|
-
console.log(
|
|
550
|
-
'External APIs check completed:',
|
|
551
|
-
response.checks.externalApis
|
|
552
|
-
);
|
|
553
|
-
} else {
|
|
554
|
-
response.checks.externalApis = {
|
|
555
|
-
status: 'unhealthy',
|
|
556
|
-
error:
|
|
557
|
-
externalApisResult.reason?.message ||
|
|
558
|
-
'External APIs check failed',
|
|
559
|
-
};
|
|
504
|
+
const { apiStatuses, allReachable } = await checkExternalAPIs();
|
|
505
|
+
response.checks.externalApis = apiStatuses;
|
|
506
|
+
if (!allReachable) {
|
|
560
507
|
response.status = 'unhealthy';
|
|
561
|
-
// eslint-disable-next-line no-console
|
|
562
|
-
console.log(
|
|
563
|
-
'External APIs check error:',
|
|
564
|
-
externalApisResult.reason?.message
|
|
565
|
-
);
|
|
566
508
|
}
|
|
509
|
+
// eslint-disable-next-line no-console
|
|
510
|
+
console.log('External APIs check completed:', response.checks.externalApis);
|
|
567
511
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
response.checks.integrations = integrationsResult.value;
|
|
571
|
-
if (response.checks.integrations.status === 'unhealthy') {
|
|
572
|
-
response.status = 'unhealthy';
|
|
573
|
-
}
|
|
512
|
+
try {
|
|
513
|
+
response.checks.integrations = checkIntegrations();
|
|
574
514
|
// eslint-disable-next-line no-console
|
|
575
515
|
console.log(
|
|
576
516
|
'Integrations check completed:',
|
|
577
517
|
response.checks.integrations
|
|
578
518
|
);
|
|
579
|
-
}
|
|
519
|
+
} catch (error) {
|
|
580
520
|
response.checks.integrations = {
|
|
581
521
|
status: 'unhealthy',
|
|
582
|
-
error:
|
|
583
|
-
integrationsResult.reason?.message ||
|
|
584
|
-
'Integrations check failed',
|
|
522
|
+
error: error.message,
|
|
585
523
|
};
|
|
586
524
|
response.status = 'unhealthy';
|
|
587
525
|
// eslint-disable-next-line no-console
|
|
588
|
-
console.log(
|
|
589
|
-
'Integrations check error:',
|
|
590
|
-
integrationsResult.reason?.message
|
|
591
|
-
);
|
|
526
|
+
console.log('Integrations check error:', error.message);
|
|
592
527
|
}
|
|
593
528
|
|
|
594
529
|
response.responseTime = response.calculateResponseTime();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.427.
|
|
4
|
+
"version": "2.0.0--canary.427.9708b13.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@hapi/boom": "^10.0.1",
|
|
7
7
|
"aws-sdk": "^2.1200.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"uuid": "^9.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@friggframework/eslint-config": "2.0.0--canary.427.
|
|
26
|
-
"@friggframework/prettier-config": "2.0.0--canary.427.
|
|
27
|
-
"@friggframework/test": "2.0.0--canary.427.
|
|
25
|
+
"@friggframework/eslint-config": "2.0.0--canary.427.9708b13.0",
|
|
26
|
+
"@friggframework/prettier-config": "2.0.0--canary.427.9708b13.0",
|
|
27
|
+
"@friggframework/test": "2.0.0--canary.427.9708b13.0",
|
|
28
28
|
"@types/lodash": "4.17.15",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
30
30
|
"chai": "^4.3.6",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "9708b13e311605ac2620ee524dd2f19859fda32e"
|
|
60
60
|
}
|