@friggframework/core 2.0.0--canary.427.68e753a.0 → 2.0.0--canary.427.04558b7.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.
@@ -466,64 +466,129 @@ router.get('/health/detailed', async (_req, res) => {
466
466
  const startTime = Date.now();
467
467
  const response = buildHealthCheckResponse(startTime);
468
468
 
469
- try {
470
- response.checks.database = await checkDatabaseHealth();
469
+ // Run all async health checks concurrently
470
+ const [
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;
471
500
  const dbState = getDatabaseState();
472
- if (!dbState.isConnected) {
501
+ if (
502
+ !dbState.isConnected ||
503
+ response.checks.database.status === 'unhealthy'
504
+ ) {
473
505
  response.status = 'unhealthy';
474
506
  }
475
507
  // eslint-disable-next-line no-console
476
508
  console.log('Database check completed:', response.checks.database);
477
- } catch (error) {
509
+ } else {
478
510
  response.checks.database = {
479
511
  status: 'unhealthy',
480
- error: error.message,
512
+ error: databaseResult.reason?.message || 'Database check failed',
481
513
  };
482
514
  response.status = 'unhealthy';
483
515
  // eslint-disable-next-line no-console
484
- console.log('Database check error:', error.message);
516
+ console.log('Database check error:', databaseResult.reason?.message);
485
517
  }
486
518
 
487
- try {
488
- response.checks.encryption = await checkEncryptionHealth();
519
+ // Process encryption check results
520
+ if (encryptionResult.status === 'fulfilled') {
521
+ response.checks.encryption = encryptionResult.value;
489
522
  if (response.checks.encryption.status === 'unhealthy') {
490
523
  response.status = 'unhealthy';
491
524
  }
492
525
  // eslint-disable-next-line no-console
493
526
  console.log('Encryption check completed:', response.checks.encryption);
494
- } catch (error) {
527
+ } else {
495
528
  response.checks.encryption = {
496
529
  status: 'unhealthy',
497
- error: error.message,
530
+ error:
531
+ encryptionResult.reason?.message || 'Encryption check failed',
498
532
  };
499
533
  response.status = 'unhealthy';
500
534
  // eslint-disable-next-line no-console
501
- console.log('Encryption check error:', error.message);
535
+ console.log(
536
+ 'Encryption check error:',
537
+ encryptionResult.reason?.message
538
+ );
502
539
  }
503
540
 
504
- const { apiStatuses, allReachable } = await checkExternalAPIs();
505
- response.checks.externalApis = apiStatuses;
506
- if (!allReachable) {
541
+ // Process external APIs check results
542
+ if (externalApisResult.status === 'fulfilled') {
543
+ const { apiStatuses, allReachable } = externalApisResult.value;
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
+ };
507
560
  response.status = 'unhealthy';
561
+ // eslint-disable-next-line no-console
562
+ console.log(
563
+ 'External APIs check error:',
564
+ externalApisResult.reason?.message
565
+ );
508
566
  }
509
- // eslint-disable-next-line no-console
510
- console.log('External APIs check completed:', response.checks.externalApis);
511
567
 
512
- try {
513
- response.checks.integrations = checkIntegrations();
568
+ // Process integrations check results
569
+ if (integrationsResult.status === 'fulfilled') {
570
+ response.checks.integrations = integrationsResult.value;
571
+ if (response.checks.integrations.status === 'unhealthy') {
572
+ response.status = 'unhealthy';
573
+ }
514
574
  // eslint-disable-next-line no-console
515
575
  console.log(
516
576
  'Integrations check completed:',
517
577
  response.checks.integrations
518
578
  );
519
- } catch (error) {
579
+ } else {
520
580
  response.checks.integrations = {
521
581
  status: 'unhealthy',
522
- error: error.message,
582
+ error:
583
+ integrationsResult.reason?.message ||
584
+ 'Integrations check failed',
523
585
  };
524
586
  response.status = 'unhealthy';
525
587
  // eslint-disable-next-line no-console
526
- console.log('Integrations check error:', error.message);
588
+ console.log(
589
+ 'Integrations check error:',
590
+ integrationsResult.reason?.message
591
+ );
527
592
  }
528
593
 
529
594
  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.68e753a.0",
4
+ "version": "2.0.0--canary.427.04558b7.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.68e753a.0",
26
- "@friggframework/prettier-config": "2.0.0--canary.427.68e753a.0",
27
- "@friggframework/test": "2.0.0--canary.427.68e753a.0",
25
+ "@friggframework/eslint-config": "2.0.0--canary.427.04558b7.0",
26
+ "@friggframework/prettier-config": "2.0.0--canary.427.04558b7.0",
27
+ "@friggframework/test": "2.0.0--canary.427.04558b7.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": "68e753a98bf315deb2004e4f5c6ab58495e04d2b"
59
+ "gitHead": "04558b7a08b166c687327d9635bf872ca33f8b94"
60
60
  }