@friggframework/core 2.0.0--canary.490.7426521.0 → 2.0.0--canary.490.125492c.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 +28 -13
- package/package.json +5 -5
|
@@ -32,7 +32,14 @@ const {
|
|
|
32
32
|
} = require('../use-cases/check-integrations-health-use-case');
|
|
33
33
|
|
|
34
34
|
const router = Router();
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
let healthCheckRepository;
|
|
37
|
+
function getHealthCheckRepository() {
|
|
38
|
+
if (!healthCheckRepository) {
|
|
39
|
+
healthCheckRepository = createHealthCheckRepository({ prismaClient: prisma });
|
|
40
|
+
}
|
|
41
|
+
return healthCheckRepository;
|
|
42
|
+
}
|
|
36
43
|
|
|
37
44
|
// Load integrations and create factories just like auth router does
|
|
38
45
|
// This verifies the system can properly load integrations
|
|
@@ -55,15 +62,23 @@ try {
|
|
|
55
62
|
integrationClasses = [];
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
function getTestEncryptionUseCase() {
|
|
66
|
+
return new TestEncryptionUseCase({
|
|
67
|
+
healthCheckRepository: getHealthCheckRepository(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function getCheckDatabaseHealthUseCase() {
|
|
72
|
+
return new CheckDatabaseHealthUseCase({
|
|
73
|
+
healthCheckRepository: getHealthCheckRepository(),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function getCheckEncryptionHealthUseCase() {
|
|
78
|
+
return new CheckEncryptionHealthUseCase({
|
|
79
|
+
testEncryptionUseCase: getTestEncryptionUseCase(),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
67
82
|
const checkExternalApisHealthUseCase = new CheckExternalApisHealthUseCase();
|
|
68
83
|
const checkIntegrationsHealthUseCase = new CheckIntegrationsHealthUseCase({
|
|
69
84
|
moduleFactory,
|
|
@@ -418,7 +433,7 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
418
433
|
}
|
|
419
434
|
|
|
420
435
|
try {
|
|
421
|
-
response.checks.database = await
|
|
436
|
+
response.checks.database = await getCheckDatabaseHealthUseCase().execute();
|
|
422
437
|
if (response.checks.database.status === 'unhealthy') {
|
|
423
438
|
response.status = 'unhealthy';
|
|
424
439
|
}
|
|
@@ -433,7 +448,7 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
433
448
|
}
|
|
434
449
|
|
|
435
450
|
try {
|
|
436
|
-
response.checks.encryption = await
|
|
451
|
+
response.checks.encryption = await getCheckEncryptionHealthUseCase().execute();
|
|
437
452
|
if (response.checks.encryption.status === 'unhealthy') {
|
|
438
453
|
response.status = 'unhealthy';
|
|
439
454
|
}
|
|
@@ -496,7 +511,7 @@ router.get('/health/live', (_req, res) => {
|
|
|
496
511
|
});
|
|
497
512
|
|
|
498
513
|
router.get('/health/ready', async (_req, res) => {
|
|
499
|
-
const dbHealth = await
|
|
514
|
+
const dbHealth = await getCheckDatabaseHealthUseCase().execute();
|
|
500
515
|
const isDbReady = dbHealth.status === 'healthy';
|
|
501
516
|
|
|
502
517
|
const integrationsHealth = checkIntegrationsHealthUseCase.execute();
|
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.490.
|
|
4
|
+
"version": "2.0.0--canary.490.125492c.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.588.0",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@friggframework/eslint-config": "2.0.0--canary.490.
|
|
42
|
-
"@friggframework/prettier-config": "2.0.0--canary.490.
|
|
43
|
-
"@friggframework/test": "2.0.0--canary.490.
|
|
41
|
+
"@friggframework/eslint-config": "2.0.0--canary.490.125492c.0",
|
|
42
|
+
"@friggframework/prettier-config": "2.0.0--canary.490.125492c.0",
|
|
43
|
+
"@friggframework/test": "2.0.0--canary.490.125492c.0",
|
|
44
44
|
"@prisma/client": "^6.17.0",
|
|
45
45
|
"@types/lodash": "4.17.15",
|
|
46
46
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "125492c5f61ca24ed183bcb197dbec0d4675c1e3"
|
|
84
84
|
}
|