Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
reminder-service
Advanced tools
Small library to help build a service that sends recurring reminders
Small library to help build a service that sends recurring reminders
This module simply defines a convenient interface for having a reminder service where a reminder service is a recurring process that looks for a bunch of entities which may or may not need a reminder action taken against them.
For example, an application which schedules tasks may want to setup reminders for overdue tasks. This provides a microframework for looking for such tasks and updating the next scheduled run time.
Using a template method pattern, you fill in the details of how to find entities, bump their next scheduled time and actually sending the reminder. All of this is asynchronous, of course.
The module returns a constructor function which takes a hash of functions and configuration settings:
var ReminderService = require('reminder-service');
var service = new ReminderService({
getNextReminder: function (retry, callback) {
db.returnNextEntityForNotification(retry, callback);
},
bump: function (task, callback) {
db.bumpNextNotificationTime(task, callback);
},
deserialize: function (nextEligibleEntity) {
return new Task(nextEligibleInstance);
}
});
The properties you specify to the constructor are:
findAndModify
in MongoDB). Passing null
to
the callback signifies no remaining work to do.getNextReminder
. For example, if getNextReminder
just returns a raw object from the database, you may
build a custom object with methods attached to it here. The default implementation just returns the input.deserialize
will have its .remind
method invoked and passed
a callback. You can specify alternatively here what you want to do.getNextReminder
returns null, indicating no further work to do, how long shall we
go to sleep before we wake up and look for more remidners?$ npm install reminder-service
That's all!
$ git clone https://github.com/brandonramirez/reminder-service
$ cd reminder-service
$ npm test
npm test
will execute the unit tests.
Error handling!
FAQs
Small library to help build a service that sends recurring reminders
The npm package reminder-service receives a total of 0 weekly downloads. As such, reminder-service popularity was classified as not popular.
We found that reminder-service 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.