
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
heartisans-core
Advanced tools
The following services are implemented
const core = require('heartisans-core')
core.<module> // to get the service required
*path can be mulit-level
// Usage
core.config.get('name') // = 'symptom_api'
core.config.getAll()
/*
= {name: 'symptom_api', ...}
*/
Get single config in path such as
Get all configs
Change config during runtime. However, this is not durable and will not survive a process restart.
*path is a single level and store in a hash on Redis
// Usage
core.setting.get('returnCount') // = 20
core.setting.getAll() /* = {returnCount: 20, ...} */
Get single setting in path
Get all settings
const logger = core.logger.create('test:module')
logger.error({err: err}, 'this is a message')
logger.warn({some: data}, 'this is a message')
logger.info('this is a message with no data')
logger.debug({err: err}, 'this is a message')
logger.trace('this is a message with no data')
Create a logger instance for the module that you are currently working on, a string namespace must be supplied.
Communicate between services / task queue
// Send a message / task to a service / work, no immediate reply
// send (to, subject, message, callback)
core.message.send('medical_history', 'newRecord', {data: 'newData'}, function(err) {
// err if not successful
})
// Receive a message / task wait for one reply and stop
// receive (subject, callback)
core.message.send('newRecord', function(err, content, message, ack) {
// err - if not successful
// content - data replied (JSON)
// message - the meta data
// ack - callback to acknowledge that the message is received
})
// Receive a message / task wait for one reply and stop
// listen (subject, handler, callback)
core.message.listen('newRecord', function handler (err, content, message, ack) {
// err - if not successful
// content - data replied (JSON)
// message - the meta data
// ack - callback to acknowledge that the message is received
ack()
}, function (err) {
// err - if unable to register a listener
})
// Broadcast a message
// publish (subject, message, callback)
core.message.publish('pushToUser', {id: 10, message: 'Test...'}, function(err) {
// err if not successful
})
// Subscribe to a broadcast
// subscribe (who, subject, handler, callback)
core.message.subscribe('medical_history', 'newRecord', function handler (err, content, message, ack) {
// err - if not successful
// content - data replied (JSON)
// message - the meta data
// ack - callback to acknowledge that the message is received
}, function (err) {
// err - if unable to register a listener
})
// Send a request and expect a immediate response, default timeout 30sec
// request (to, subject, message, callback)
core.message.request('user', 'read', {id: 10}, function(err, user) {
// err if not successful
})
// Receive a message / task wait for one reply and stop
// response (subject, handler, callback)
core.message.response('newRecord', function handler (err, content, message, res) {
// err - if not successful
// content - data replied (JSON)
// message - the meta data
// ack - callback to acknowledge that the message is received
// example replies
res(new Error('Stinks'))
res(null, 'new name', {yucks: 'great'})
}, function (err) {
// err - if unable to register a listener
})
Queue a message / task to be process at a later time
Receive a single message / task; needs to acknowledge after processing
Listen for message / task continuously; needs to acknowledge after processing
Publish a message to all subscriber of a subject
Subscribe to a subject
Send a request and expect a immediate response
Response to request
Get a shared redis client
Get a new Redis Client
// just use like bookshelf
const bookshelf = core.bookshelf
// just use like mongoose
const mongoose = core.mongoose
FAQs
Core for heartisans.
The npm package heartisans-core receives a total of 2 weekly downloads. As such, heartisans-core popularity was classified as not popular.
We found that heartisans-core 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.