Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@pulsecron/nestjs-pulse
Advanced tools
The modern MongoDB-powered scheduling library pulse for NestJS
The modern MongoDB-powered scheduling library for NestJS
$ npm install --save @pulsecron/nestjs-pulse @pulsecron/pulse
// src/app.module.ts
import { Module } from '@nestjs/common';
import { PulseModule } from '@pulsecron/nestjs-pulse';
import { NotificationsModule } from './notification/notification.module';
@Module({
imports: [
PulseModule.forRoot({
db: {
address: 'mongodb://localhost:27017/pulse',
},
}),
NotificationsModule,
],
providers: [],
})
export class AppModule {}
// src/notification/notification.module.ts
import { Module } from '@nestjs/common';
import { PulseModule } from '@pulsecron/nestjs-pulse';
import { NotificationsQueue } from './notification.processor';
@Module({
imports: [
PulseModule.registerQueue('notifications', {
processEvery: '1 minutes',
autoStart: false, // default: true
}),
],
providers: [NotificationsQueue],
exports: [],
})
export class NotificationsModule {}
// src/notification/notification.processor.ts
import { Job } from '@pulsecron/nestjs-pulse';
import { Every, Queue, Define, Schedule } from '@pulsecron/nestjs-pulse';
@Queue('notifications')
export class NotificationsQueue {
@Every({ name: 'send notifications', interval: '1 minutes' })
async sendNotifications(job: Job) {
console.log('Sending notifications[1]');
}
@Schedule({ name: 'send notifications', when: 'tomorrow at noon' })
async sendNotifications(job: Job) {
console.log('Sending notifications[2]');
}
@Now()
async sendNotifications(job: Job) {
console.log('Sending notifications[3]');
}
@Define({ name: 'emailJob' })
async test(job: Job) {
console.log('Sending email to:', job.data.to);
}
}
import { Injectable } from '@nestjs/common';
import { Inject } from '@nestjs/common';
@Injectable()
export class NotificationService {
constructor(@Inject('notifications') private pulse: Pulse) {}
async scheduleEmail(email: string) {
const emailJob = this.pulse.create('emailJob', { to: email });
emailJob.unique(
{
'data.to': email,
},
{
insertOnly: true,
}
);
emailJob.schedule('5 seconds').save();
}
}
Contributions are welcome! Here are several ways you can contribute:
pulse
project.git clone https://github.com/pulsecron/nestjs-pulse
git checkout -b new-feature-x
git commit -m 'Implemented new feature x.'
git push origin new-feature-x
This project is protected under the MIT License. For more details, refer to the LICENSE file.
FAQs
The modern MongoDB-powered scheduling library pulse for NestJS
The npm package @pulsecron/nestjs-pulse receives a total of 174 weekly downloads. As such, @pulsecron/nestjs-pulse popularity was classified as not popular.
We found that @pulsecron/nestjs-pulse demonstrated a healthy version release cadence and project activity because the last version was released less than 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.