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.19 to 1.0.20

2

dist/lib/index.d.ts

@@ -15,2 +15,4 @@ import { NextFunction, Request, Response } from "express";

whitelistedPaths?: string[];
/** indicates whether critical dependency information should be logged out if critical dependencies fail to become ready */
logOutCriticalDependenciesOnFailure?: boolean;
}

@@ -17,0 +19,0 @@ /** Dependency interface */

30

dist/lib/index.js

@@ -7,3 +7,4 @@ "use strict";

maximumWaitTimeForServiceReadinessInMilliseconds: 30000,
whitelistedPaths: []
whitelistedPaths: [],
logOutCriticalDependenciesOnFailure: true
};

@@ -118,8 +119,21 @@ const dependencyStateItems = [];

};
const maximumWaitTimeExceeded = () => {
(0, exports.stopCheckingReadiness)();
informationLogger?.log('All critical dependencies did not become healthy');
// @ts-ignore
if (global.ExpressServiceReadinessTests === undefined)
process.exit(1);
const maximumWaitTimeExceeded = (config) => {
return () => {
(0, exports.stopCheckingReadiness)();
const items = [];
dependencyStateItems.forEach(item => {
items.push({
name: item.name,
data: item.data,
ready: item.ready
});
});
if (informationLogger) {
const suffix = config.logOutCriticalDependenciesOnFailure === true ? ` Critical dependencies: ${JSON.stringify(items)}` : '';
informationLogger?.log(`All critical dependencies did not become healthy.${suffix}`);
}
// @ts-ignore
if (global.ExpressServiceReadinessTests === undefined)
process.exit(1);
};
};

@@ -133,3 +147,3 @@ const checkServiceReadiness = (dependencies, config) => {

const maximumWaitTimeForServiceReadinessInMilliseconds = config.maximumWaitTimeForServiceReadinessInMilliseconds ?? DefaultConfig.maximumWaitTimeForServiceReadinessInMilliseconds;
maximumWaitTimeTimeout = setTimeout(maximumWaitTimeExceeded, maximumWaitTimeForServiceReadinessInMilliseconds);
maximumWaitTimeTimeout = setTimeout(maximumWaitTimeExceeded(config), maximumWaitTimeForServiceReadinessInMilliseconds);
criticalDependencies.forEach(criticalDependencies => {

@@ -136,0 +150,0 @@ const { name, data, isReady } = criticalDependencies;

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

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

@@ -19,3 +19,3 @@

```bash
$ npm install express-service-readiness-middleware@1.0.19 --save
$ npm install express-service-readiness-middleware@1.0.20 --save
```

@@ -22,0 +22,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