![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@hapi/good-squeeze
Advanced tools
Readme
Simple transform streams useful in creating good data pipelines.
Lead Maintainer: Open Position
good-squeeze is a collection of small transform streams. The Squeeze
stream is useful for filtering events based on the good event options. The SafeJson
stream is useful for stringifying objects to prevent circular object errors.
Squeeze(events, [options])
Creates a new Squeeze transform stream where:
events
an object where each key is a valid good event and the value is one of the following:
string
- a tag to include when filtering. '*' indicates no filtering.array
- array of tags to filter. []
indicates no filtering.object
- an object with the following values
include
- string or array representing tag(s) to include when filteringexclude
- string or array representing tag(s) to exclude when filtering. exclude
takes precedence over any include
tags.[options]
configuration object that gets passed to the Node Stream.Transform
constructor. Note objectMode
is always true
for all Squeeze
objects.The transform stream only passes on events that satisfy the event filtering based on event name and tags. If the upstream event doesn't satisfy the filter, it is not continued down the pipe line.
Squeeze.subscription(events)
A static method on Squeeze
that creates a new event subscription map where:
events
the same arguments used in the Squeeze
constructor.const Squeeze = require('good-squeeze');
Squeeze.subscription({ log: 'user', ops: '*', request: ['hapi', 'foo'] });
// Results in
// {
// log: { include: [ 'user' ], exclude: [] },
// ops: { include: [], exclude: [] },
// request: { include: [ 'hapi', 'foo' ], exclude: [] }
// }
Squeeze.subscription({ log: 'user', ops: { exclude: 'debug' }, request: { include: ['hapi', 'foo'], exclude: 'sensitive' } });
// Results in
// {
// log: { include: [ 'user' ], exclude: [] },
// ops: { include: [], exclude: [ 'debug' ] },
// request: { include: [ 'hapi', 'foo' ], exclude: [ 'sensitive' ] }
// }
Useful for creating an event subscription to be used with Squeeze.filter
if you do not plan on creating a pipeline coming from good and instead want to manage event filtering manually.
Squeeze.filter(subscription, data)
Returns true
if the supplied data.event
+ data.tags
should be reported based on subscription
where:
subscription
- a subscription map created by Squeeze.subscription()
.data
- event object emitted from good/hapi which should contain the following keys:
event
- a string representing the event name of data
tags
- an array of strings representing tags associated with this event.SafeJson([options], [stringify])
Creates a new SafeJson transform stream where:
[options]
configuration object that gets passed to the Node Stream.Transform
constructor. Note objectMode
is always true
for all Squeeze
objects.[stringify]
configuration object for controlling how stringify is handled.
separator
- string to append to each message. Defaults to "\n".space
- number of spaces in pretty printed JSON. Doesn't pretty print when set to 0. Defaults to 0.The transform stream stringifys the incoming data and pipes it forward. It will not crash in the cases of circular references and will instead include a "~Circular" string in the result.
FAQs
Collection of utility transform streams.
The npm package @hapi/good-squeeze receives a total of 21,240 weekly downloads. As such, @hapi/good-squeeze popularity was classified as popular.
We found that @hapi/good-squeeze demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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 now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.