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

@gquittet/graceful-server

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gquittet/graceful-server - npm Package Compare versions

Comparing version 2.3.1 to 2.3.3

2

lib/index.js

@@ -1,1 +0,1 @@

module.exports=(()=>{var e={636:(e,t,s)=>{"use strict";s.d(t,{u:()=>r,Z:()=>i});const n={closePromises:[],timeout:1e3,healthCheck:!0,livenessEndpoint:"/live",readinessEndpoint:"/ready"};let o=!0;const r=e=>(o&&(Object.freeze(Object.assign(n,e)),o=!1),n),i=n},751:(e,t,s)=>{"use strict";s.d(t,{Z:()=>y});const n=require("events"),o=[{type:"SIGHUP",code:1},{type:"SIGBREAK",code:1},{type:"SIGINT",code:2},{type:"SIGTERM",code:15},{type:"uncaughtException",code:2}];var r=s(636),i=s(825);const a=(e,t)=>async(s,n,o)=>{const{timeout:a,closePromises:c}=r.Z,u=o&&o.message?o:new Error(s);var d;t.status.set(i.Z.SHUTTING_DOWN,u),await(d=a,new Promise((e=>setTimeout(e,d)))),await Promise.all(c.map((e=>e()))),await e.stop(),t.status.set(i.Z.SHUTDOWN,u),process.exit(128+n)},c=e=>{const t=e||new Set,s=e=>{e.destroy(),t.delete(e)};return{onConnection:e=>{t.add(e),e.once("close",(()=>t.delete(e)))},closeAll:async()=>t.forEach(s)}},{livenessEndpoint:u,readinessEndpoint:d}=r.Z,l=(e,t)=>{const{healthCheck:s}=r.Z,n=c(),o=c();let i=!1;e.on("connection",n.onConnection),e.on("secureConnection",o.onConnection);const a=e.listeners("request");return e.removeAllListeners("request"),s?(e.on("request",(e=>(t,s)=>{const{livenessEndpoint:n,readinessEndpoint:o}=r.Z;if(!s.headersSent)return t.url===n&&"GET"===t.method?(s.statusCode=200,s.setHeader("Content-Type","application/json"),s.end(JSON.stringify({uptime:0|process.uptime()}))):t.url===o&&"GET"===t.method?e.isReady()?(s.statusCode=200,s.setHeader("Content-Type","application/json"),s.end(JSON.stringify({status:"ready"}))):(s.statusCode=503,s.end()):void 0})(t)),a.forEach((s=>e.on("request",((e,n)=>{if(t.isReady()){if(e.url!==u&&e.url!==d||"GET"!==e.method)return s(e,n)}else e.socket.destroy()}))))):a.forEach((s=>e.on("request",((e,n)=>{if(t.isReady())return s(e,n);e.socket.destroy()})))),Object.assign(e,{stop:async()=>{if(e.listening&&!i)return i=!0,e.removeAllListeners("request"),e.on("request",((e,t)=>{if(!t.headersSent)return t.setHeader("connection","close")})),await Promise.all([n.closeAll(),o.closeAll()]),new Promise(((t,s)=>{e.close((e=>{e?s(e):t()}))}))}})},p=e=>{let t=i.Z.STARTING;return{set:function(s,n){return t=s,e.emit(s,n),this},get:()=>t,setReady:function(){this.set(i.Z.READY)},isReady:()=>t===i.Z.READY}},y=e=>{const t=new n.EventEmitter,s=p(t),r=l(e,s);return{status:s,init:function(){return(e=>{for(const t of o)process.on(t.type,(async s=>{await e.shutdown(t.type,t.code,s)}));return e})(this)},shutdown:function(e,t,s){return a(r,this)(e,t,s)},on:(e,s)=>t.on(e,s)}}},825:(e,t,s)=>{"use strict";var n;s.d(t,{Z:()=>o}),function(e){e.STARTING="STARTING",e.READY="READY",e.SHUTTING_DOWN="SHUTTING_DOWN",e.SHUTDOWN="SHUTDOWN"}(n||(n={}));const o=n},809:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var n=s(636),o=s(751),r=s(825),i=s(878),a={};for(const e in i)"default"!==e&&(a[e]=()=>i[e]);s.d(t,a);const c=Object.assign(((e,t)=>{(0,n.u)(t);const s=(0,o.Z)(e).init();return{isReady:()=>s.status.isReady(),setReady:()=>s.status.setReady(),on:s.on}}),r.Z)},878:()=>{}},t={};function s(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n](o,o.exports,s),o.exports}return s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s(809)})();const __export__=module.exports;module.exports=__export__.default,Object.assign(module.exports,__export__);
(()=>{var e={636:(e,t,s)=>{"use strict";s.d(t,{u:()=>r,Z:()=>i});const n={closePromises:[],timeout:1e3,healthCheck:!0,livenessEndpoint:"/live",readinessEndpoint:"/ready"};let o=!0;const r=e=>(o&&(Object.freeze(Object.assign(n,e)),o=!1),n),i=n},751:(e,t,s)=>{"use strict";s.d(t,{Z:()=>y});const n=require("events"),o=[{type:"SIGHUP",code:1},{type:"SIGBREAK",code:1},{type:"SIGINT",code:2},{type:"SIGTERM",code:15},{type:"uncaughtException",code:2}];var r=s(636),i=s(825);const a=(e,t)=>async(s,n,o)=>{const{timeout:a,closePromises:c}=r.Z,u=o&&o.message?o:new Error(s);var d;t.status.set(i.Z.SHUTTING_DOWN,u),await(d=a,new Promise((e=>setTimeout(e,d)))),await Promise.all(c.map((e=>e()))),await e.stop(),t.status.set(i.Z.SHUTDOWN,u),process.exit(128+n)},c=e=>{const t=e||new Set,s=e=>{e.destroy(),t.delete(e)};return{onConnection:e=>{t.add(e),e.once("close",(()=>t.delete(e)))},closeAll:async()=>t.forEach(s)}},{livenessEndpoint:u,readinessEndpoint:d}=r.Z,l=(e,t)=>{const{healthCheck:s}=r.Z,n=c(),o=c();let i=!1;e.on("connection",n.onConnection),e.on("secureConnection",o.onConnection);const a=e.listeners("request");return e.removeAllListeners("request"),s?(e.on("request",(e=>(t,s)=>{const{livenessEndpoint:n,readinessEndpoint:o}=r.Z;if(!s.headersSent)return t.url===n&&"GET"===t.method?(s.statusCode=200,s.setHeader("Content-Type","application/json"),s.end(JSON.stringify({uptime:0|process.uptime()}))):t.url===o&&"GET"===t.method?e.isReady()?(s.statusCode=200,s.setHeader("Content-Type","application/json"),s.end(JSON.stringify({status:"ready"}))):(s.statusCode=503,s.end()):void 0})(t)),a.forEach((s=>e.on("request",((e,n)=>{if(t.isReady()){if(e.url!==u&&e.url!==d||"GET"!==e.method)return s(e,n)}else e.socket.destroy()}))))):a.forEach((s=>e.on("request",((e,n)=>{if(t.isReady())return s(e,n);e.socket.destroy()})))),Object.assign(e,{stop:async()=>{if(e.listening&&!i)return i=!0,e.removeAllListeners("request"),e.on("request",((e,t)=>{if(!t.headersSent)return t.setHeader("connection","close")})),await Promise.all([n.closeAll(),o.closeAll()]),new Promise(((t,s)=>{e.close((e=>{e?s(e):t()}))}))}})},p=e=>{let t=i.Z.STARTING;return{set:function(s,n){return t=s,e.emit(s,n),this},get:()=>t,setReady:function(){this.set(i.Z.READY)},isReady:()=>t===i.Z.READY}},y=e=>{const t=new n.EventEmitter,s=p(t),r=l(e,s);return{status:s,init:function(){return(e=>{for(const t of o)process.on(t.type,(async s=>{await e.shutdown(t.type,t.code,s)}));return e})(this)},shutdown:function(e,t,s){return a(r,this)(e,t,s)},on:(e,s)=>t.on(e,s)}}},825:(e,t,s)=>{"use strict";var n;s.d(t,{Z:()=>o}),function(e){e.STARTING="STARTING",e.READY="READY",e.SHUTTING_DOWN="SHUTTING_DOWN",e.SHUTDOWN="SHUTDOWN"}(n||(n={}));const o=n},878:()=>{}},t={};function s(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";s.r(n),s.d(n,{default:()=>a});var e=s(636),t=s(751),o=s(825),r=s(878),i={};for(const e in r)"default"!==e&&(i[e]=()=>r[e]);s.d(n,i);const a=Object.assign(((s,n)=>{(0,e.u)(n);const o=(0,t.Z)(s).init();return{isReady:()=>o.status.isReady(),setReady:()=>o.status.setReady(),on:o.on}}),o.Z)})(),module.exports=n})();const __export__=module.exports;module.exports=__export__.default,Object.assign(module.exports,__export__);

@@ -15,3 +15,3 @@ {

},
"version": "2.3.1",
"version": "2.3.3",
"main": "./lib/index.js",

@@ -26,3 +26,3 @@ "scripts": {

"lint": "eslint src/**/*.ts",
"prepublishOnly": "npm run preversion",
"prepublishOnly": "pinst --disable && npm run preversion",
"test": "NODE_ENV=test jest",

@@ -33,22 +33,24 @@ "test:coverage": "NODE_ENV=test jest --coverage",

"type-check:watch": "npm run type-check -- --watch",
"preversion": "npm run clean && npm run lint && npm run test:lint && npm run test && npm run build"
"preversion": "npm run clean && npm run lint && npm run test:lint && npm run test && npm run build",
"_postinstall": "husky install",
"postpublish": "pinst --enable"
},
"types": "./lib/types/index.d.ts",
"devDependencies": {
"@babel/cli": "7.12.13",
"@babel/core": "7.12.13",
"@babel/plugin-proposal-class-properties": "7.12.13",
"@babel/plugin-proposal-object-rest-spread": "7.12.13",
"@babel/preset-env": "7.12.13",
"@babel/preset-typescript": "7.12.13",
"@babel/cli": "7.13.10",
"@babel/core": "7.13.10",
"@babel/plugin-proposal-class-properties": "7.13.0",
"@babel/plugin-proposal-object-rest-spread": "7.13.8",
"@babel/preset-env": "7.13.10",
"@babel/preset-typescript": "7.13.0",
"@types/express": "4.17.11",
"@types/jest": "26.0.20",
"@types/node": "14.14.25",
"@typescript-eslint/eslint-plugin": "4.14.2",
"@typescript-eslint/parser": "4.14.2",
"@types/node": "14.14.35",
"@typescript-eslint/eslint-plugin": "4.18.0",
"@typescript-eslint/parser": "4.18.0",
"add-module-exports-webpack-plugin": "2.0.0",
"babel-loader": "8.2.2",
"babel-plugin-module-resolver": "4.1.0",
"eslint": "7.19.0",
"eslint-config-prettier": "7.2.0",
"eslint": "7.22.0",
"eslint-config-prettier": "8.1.0",
"eslint-config-standard": "16.0.2",

@@ -59,8 +61,9 @@ "eslint-import-resolver-babel-module": "5.2.0",

"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-promise": "4.3.1",
"esm": "3.2.25",
"fork-ts-checker-webpack-plugin": "6.1.0",
"husky": "4.3.8",
"fork-ts-checker-webpack-plugin": "6.1.1",
"husky": "^5.1.3",
"jest": "26.6.3",
"lint-staged": "10.5.4",
"pinst": "^2.1.6",
"prettier": "2.2.1",

@@ -70,8 +73,8 @@ "prettier-package-json": "2.1.3",

"rimraf": "3.0.2",
"ts-jest": "26.5.0",
"ts-jest": "26.5.3",
"ts-node": "9.1.1",
"ttypescript": "1.5.12",
"typescript": "4.1.3",
"typescript": "4.2.3",
"typescript-transform-paths": "2.2.3",
"webpack": "5.21.0",
"webpack": "5.26.0",
"webpack-cli": "4.5.0"

@@ -130,7 +133,2 @@ },

},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"jest": {

@@ -137,0 +135,0 @@ "preset": "ts-jest",

@@ -57,2 +57,3 @@ <h1 align="center">

- [Thanks](#thanks)
- [Sponsors](#sponsors)
- [Donate](#donate)

@@ -495,2 +496,10 @@

## Sponsors
<a href="https://jb.gg/OpenSource" target="_blank">
![JetBrains Logo](assets/sponsors/jetbrains.svg)
</a>
## Donate

@@ -497,0 +506,0 @@

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