Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nestjs/schedule

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/schedule - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

1

dist/schedule.messages.d.ts
export declare const NO_SCHEDULER_FOUND: (schedulerName: string, name?: string | undefined) => string;
export declare const DUPLICATE_SCHEDULER: (schedulerName: string, name: string) => string;

3

dist/schedule.messages.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NO_SCHEDULER_FOUND = (schedulerName, name) => name
? `No ${schedulerName} was found with the given name (${name}). Check your configuration.`
? `No ${schedulerName} was found with the given name (${name}). Check that you created one with a decorator or with the create API.`
: `No ${schedulerName} was found. Check your configuration.`;
exports.DUPLICATE_SCHEDULER = (schedulerName, name) => `${schedulerName} with the given name (${name}) already exists. Ignored.`;

@@ -61,3 +61,3 @@ "use strict";

this.cronJobs[key].ref = cronJob;
this.schedulerRegistry.addCron(key, cronJob);
this.schedulerRegistry.addCronJob(key, cronJob);
});

@@ -64,0 +64,0 @@ }

@@ -6,8 +6,14 @@ import { CronJob } from 'cron';

private readonly intervals;
getCron(name: string): CronJob;
getCronJob(name: string): CronJob;
getInterval(name: string): number;
getTimeout(name: string): number;
addCron(name: string, job: CronJob): void;
addCronJob(name: string, job: CronJob): void;
addInterval(name: string, intervalId: number): void;
addTimeout(name: string, timeoutId: number): void;
getCronJobs(): Map<string, CronJob>;
deleteCronJob(name: string): void;
getIntervals(): string[];
deleteInterval(name: string): void;
getTimeouts(): string[];
deleteTimeout(name: string): void;
}

@@ -17,6 +17,6 @@ "use strict";

}
getCron(name) {
getCronJob(name) {
const ref = this.cronJobs.get(name);
if (!ref) {
throw new Error(schedule_messages_1.NO_SCHEDULER_FOUND('Cron', name));
throw new Error(schedule_messages_1.NO_SCHEDULER_FOUND('Cron Job', name));
}

@@ -39,11 +39,47 @@ return ref;

}
addCron(name, job) {
addCronJob(name, job) {
const ref = this.cronJobs.get(name);
if (ref) {
throw new Error(schedule_messages_1.DUPLICATE_SCHEDULER('Cron Job', name));
}
this.cronJobs.set(name, job);
}
addInterval(name, intervalId) {
const ref = this.intervals.get(name);
if (ref) {
throw new Error(schedule_messages_1.DUPLICATE_SCHEDULER('Interval', name));
}
this.intervals.set(name, intervalId);
}
addTimeout(name, timeoutId) {
const ref = this.timeouts.get(name);
if (ref) {
throw new Error(schedule_messages_1.DUPLICATE_SCHEDULER('Timeout', name));
}
this.timeouts.set(name, timeoutId);
}
getCronJobs() {
return this.cronJobs;
}
deleteCronJob(name) {
const cronJob = this.getCronJob(name);
cronJob.stop();
this.cronJobs.delete(name);
}
getIntervals() {
return [...this.intervals.keys()];
}
deleteInterval(name) {
const interval = this.getInterval(name);
clearInterval(interval);
this.intervals.delete(name);
}
getTimeouts() {
return [...this.timeouts.keys()];
}
deleteTimeout(name) {
const timeout = this.getTimeout(name);
clearTimeout(timeout);
this.timeouts.delete(name);
}
};

@@ -50,0 +86,0 @@ SchedulerRegistry = __decorate([

{
"name": "@nestjs/schedule",
"version": "0.0.4",
"version": "0.1.0",
"description": "Nest - modern, fast, powerful node.js web framework (@schedule)",

@@ -21,8 +21,8 @@ "author": "Kamil Mysliwiec",

"devDependencies": {
"@nestjs/common": "6.10.11",
"@nestjs/core": "6.10.11",
"@nestjs/platform-express": "6.10.10",
"@nestjs/testing": "6.10.10",
"@nestjs/common": "6.10.12",
"@nestjs/core": "6.10.12",
"@nestjs/platform-express": "6.10.12",
"@nestjs/testing": "6.10.12",
"@types/cron": "1.7.1",
"@types/jest": "24.0.23",
"@types/jest": "24.0.24",
"@types/node": "7.10.8",

@@ -29,0 +29,0 @@ "@types/uuid": "3.4.6",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc