
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@slimio/alert
Advanced tools
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @slimio/alert
# or
$ yarn add @slimio/alert
A simple addon that will throw an alarm every second...
// Require Dependencies
const Addon = require("@slimio/addon");
const alert = require("@slimio/alert");
const metrics = require("@slimio/metrics");
// Declare addons
const test = new Addon("test");
const { Entity } = metrics(test);
const { Alarm } = alert(test);
let intervalId;
const MyEntity = new Entity("MyEntity", {
description: "Hello world!"
});
test.on("awake", () => {
intervalId = setInterval(() => {
new Alarm("hello world!", {
correlateKey: "test_alarm",
entity: MyEntity
});
}, 1000);
test.ready();
});
test.on("close", () => {
clearInterval(intervalId);
});
module.exports = test;
The alert package return a function described by the following interface:
declare function Alert(addon: Addon): {
Alarm: typeof Alarm;
};
Each instance of Alarm are unique to the local Addon.
This section describe the methods and properties of Alarm Object.
Create a new Alarm Object.
new Alarm("hello world alarm", {
correlateKey: "test_alarm"
});
Available options are described the following interface:
interface ConstructorOptions {
severity?: SlimIO.AlarmSeverity;
entity?: Metrics.Entity | string | number;
correlateKey: string;
}
Return a raw alarm. Refer to @slimio/tsd
for more information.
declare class Alarm extends events {
public cid: SlimIO.CID;
public severity: number;
public entity: Metrics.Entity | number;
public message: string;
public correlateKey: string;
static DefaultSeverity: number;
static Severity: SlimIO.AlarmSeverity;
}
Severity is defined in @slimio/tsd
as follow:
enum AlarmSeverity {
Critical,
Major,
Minor
}
The default severity is defined as 1 for Major.
MIT
FAQs
Alert for SlimIO
We found that @slimio/alert demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.