Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-service-readiness-middleware

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-service-readiness-middleware - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

38

dist/lib/index.js

@@ -48,20 +48,14 @@ "use strict";

const dependenciesHealth = [];
const promises = [];
for (const dependency of dependencies) {
let healthy = false;
try {
const healthyFunc = dependency.isHealthy ? dependency.isHealthy : dependency.isReady;
healthy = await healthyFunc();
if (healthy) {
informationLogger?.log(`critical dependency '${dependency.name}' is healthy`);
}
informationLogger?.log(`critical dependency '${dependency.name}' is not healthy`);
}
catch (err) {
// @ts-ignore
informationLogger?.log(`An error occurred while checking health for dependency '${dependencyStateItem.name}', error: ${err.message || err}`);
}
promises.push(checkDependencyHealth(dependency));
}
const promiseResults = await Promise.allSettled(promises);
for (let i = 0; i < dependencies.length; i++) {
const dependency = dependencies[i];
const promiseResult = promiseResults[i];
dependenciesHealth.push({
name: dependency.name,
data: dependency.data,
healthy,
healthy: promiseResult.status === 'fulfilled' && promiseResult.value,
critical: dependency.critical

@@ -99,2 +93,18 @@ });

exports.stopCheckingReadiness = stopCheckingReadiness;
const checkDependencyHealth = async (dependency) => {
let healthy = false;
try {
const healthyFunc = dependency.isHealthy ? dependency.isHealthy : dependency.isReady;
healthy = await healthyFunc();
if (healthy) {
informationLogger?.log(`critical dependency '${dependency.name}' is healthy`);
}
informationLogger?.log(`critical dependency '${dependency.name}' is not healthy`);
}
catch (err) {
// @ts-ignore
informationLogger?.log(`An error occurred while checking health for dependency '${dependencyStateItem.name}', error: ${err.message || err}`);
}
return healthy;
};
const maximumWaitTimeExceeded = () => {

@@ -101,0 +111,0 @@ (0, exports.stopCheckingReadiness)();

{
"name": "express-service-readiness-middleware",
"version": "1.0.9",
"version": "1.0.10",
"description": "This module provides express middleware for determining whether routes are exposed based on service critical dependency health.",

@@ -5,0 +5,0 @@ "repository": {

@@ -17,3 +17,3 @@

```bash
$ npm install express-service-readiness-middleware@1.0.9 --save
$ npm install express-service-readiness-middleware@1.0.10 --save
```

@@ -20,0 +20,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc