Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@iad-os/irene-kills-es
Advanced tools
Yes ... only if necessary, but ... Irene Kills!
Irene Kills is a library written in TypeScript that allows you to easily manage the application life-cycle. We created this library to build applications that respect cloud native principles and to find a standard and tested way to manage the life cycle of our microservices.
IK - goals It allows you to create applications that are resilient, able to detect changes in the system, detect errors and react accordingly, for example by killing itself or going into a sick state.
Ensures that when the application is in a "healthy" state it is actually ready to respond. If an error occurs in the system that could affect the operation of the application, the application will notice the change and change its status.
npm install @iad-os/irene-kills
Instantiate and configure examples:
import { IreneKills } from '@iad-os/irene-kills';
import { introspectCredentials } from '../main-auth';
import * as dbService from '../main-db';
import * as apiService from '../main-http';
import log from '../config/log';
const irene = new IreneKills({ logger: log({ tags: ['ik'] }) });
irene.resource<{ logger: ReturnType<typeof log> }>('database', {
value: { logger: log({ tags: ['db'] }) },
need: async ({ value: { logger } }) => {
logger.info('⏳ initialize db connection');
await dbService.start();
return { logger };
},
check: async ({ value: { logger } }) => {
try {
await dbService.checkDb();
logger.info('✅ OK check db connection');
return true;
} catch (err) {
logger.error({ error: err }, '💥 KO check db connection');
return false;
}
},
on: {
healthcheck: async () => {
await dbService.checkDb();
return { healthy: true, kill: false };
},
},
});
irene.resource('http', {
activate: async () => {
try {
await apiService.start();
log({ tags: ['server'] }).info('✅ Application started');
return { kill: false, healthy: true };
} catch (err) {
return { kill: true, healthy: false };
}
},
});
irene.resource<{ logger: ReturnType<typeof log> }>('oidc', {
value: { logger: log({ tags: ['odic'] }) },
check: async ({ value: { logger } }) => {
try {
await introspectCredentials();
logger.info(`✅ OK Credentials`);
return true;
} catch (error) {
logger.error(error, `💥 KO Credentials`);
return false;
}
},
});
export default irene;
Wake up Irene in main.ts
:
irene
.wakeUp()
.finally(() =>
log({ tags: ['wakeup', 'application', 'status'] }).info(
`⚙️ APPLICATION STATUS -> ${irene.mood()}`
)
);
Current application status:
irene.mood()
Trigger healthcheck:
irene.healthcheck();
For more examples check under __test__
folder.
npm run test
👤 Daniele Fiungo daniele.fiungo@iad2.it
Give a ⭐️ if this project helped you!
Licensed under the APLv2. See the LICENSE file for details.
Made with ❤️ by IAD
FAQs
Yes ... only if necessary, but ... Irene Kills!
We found that @iad-os/irene-kills-es demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.