Socket
Socket
Sign inDemoInstall

@nestjs/schedule

Package Overview
Dependencies
Maintainers
3
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.4.1 to 0.4.2

LICENSE

2

dist/schedule.explorer.d.ts

@@ -11,2 +11,3 @@ import { OnModuleInit } from '@nestjs/common';

private readonly metadataScanner;
private readonly logger;
constructor(schedulerOrchestrator: SchedulerOrchestrator, discoveryService: DiscoveryService, metadataAccessor: SchedulerMetadataAccessor, metadataScanner: MetadataScanner);

@@ -16,2 +17,3 @@ onModuleInit(): void;

lookupSchedulers(instance: Record<string, Function>, key: string): void;
private wrapFunctionInTryCatchBlocks;
}

@@ -11,2 +11,11 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -25,2 +34,3 @@ const common_1 = require("@nestjs/common");

this.metadataScanner = metadataScanner;
this.logger = new common_1.Logger('Scheduler');
}

@@ -49,3 +59,4 @@ onModuleInit() {

const cronMetadata = this.metadataAccessor.getCronMetadata(methodRef);
return this.schedulerOrchestrator.addCron(methodRef.bind(instance), cronMetadata);
const cronFn = this.wrapFunctionInTryCatchBlocks(methodRef, instance);
return this.schedulerOrchestrator.addCron(cronFn, cronMetadata);
}

@@ -55,3 +66,4 @@ case scheduler_type_enum_1.SchedulerType.TIMEOUT: {

const name = this.metadataAccessor.getSchedulerName(methodRef);
return this.schedulerOrchestrator.addTimeout(methodRef.bind(instance), timeoutMetadata.timeout, name);
const timeoutFn = this.wrapFunctionInTryCatchBlocks(methodRef, instance);
return this.schedulerOrchestrator.addTimeout(timeoutFn, timeoutMetadata.timeout, name);
}

@@ -61,6 +73,17 @@ case scheduler_type_enum_1.SchedulerType.INTERVAL: {

const name = this.metadataAccessor.getSchedulerName(methodRef);
return this.schedulerOrchestrator.addInterval(methodRef.bind(instance), intervalMetadata.timeout, name);
const intervalFn = this.wrapFunctionInTryCatchBlocks(methodRef, instance);
return this.schedulerOrchestrator.addInterval(intervalFn, intervalMetadata.timeout, name);
}
}
}
wrapFunctionInTryCatchBlocks(methodRef, instance) {
return (...args) => __awaiter(this, void 0, void 0, function* () {
try {
yield methodRef.call(instance, ...args);
}
catch (error) {
this.logger.error(error);
}
});
}
};

@@ -67,0 +90,0 @@ ScheduleExplorer = __decorate([

@@ -6,2 +6,3 @@ import { CronJob } from 'cron';

private readonly intervals;
doesExists(type: 'cron' | 'timeout' | 'interval', name: string): boolean;
getCronJob(name: string): CronJob;

@@ -8,0 +9,0 @@ getInterval(name: string): any;

@@ -17,2 +17,14 @@ "use strict";

}
doesExists(type, name) {
switch (type) {
case 'cron':
return this.cronJobs.has(name);
case 'interval':
return this.intervals.has(name);
case 'timeout':
return this.timeouts.has(name);
default:
return false;
}
}
getCronJob(name) {

@@ -19,0 +31,0 @@ const ref = this.cronJobs.get(name);

42

package.json
{
"name": "@nestjs/schedule",
"version": "0.4.1",
"version": "0.4.2",
"description": "Nest - modern, fast, powerful node.js web framework (@schedule)",

@@ -22,3 +22,3 @@ "author": "Kamil Mysliwiec",

"cron": "1.7.2",
"uuid": "8.3.0"
"uuid": "8.3.2"
},

@@ -28,27 +28,27 @@ "devDependencies": {

"@commitlint/config-angular": "11.0.0",
"@nestjs/common": "7.4.4",
"@nestjs/core": "7.4.4",
"@nestjs/platform-express": "7.4.4",
"@nestjs/testing": "7.4.4",
"@nestjs/common": "7.6.5",
"@nestjs/core": "7.6.5",
"@nestjs/platform-express": "7.6.5",
"@nestjs/testing": "7.6.5",
"@types/cron": "1.7.2",
"@types/jest": "26.0.14",
"@types/jest": "26.0.20",
"@types/node": "7.10.8",
"@types/sinon": "9.0.5",
"@types/sinon": "9.0.10",
"@types/uuid": "8.3.0",
"@typescript-eslint/eslint-plugin": "4.2.0",
"@typescript-eslint/parser": "4.2.0",
"eslint": "7.9.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.22.0",
"husky": "4.3.0",
"jest": "26.4.2",
"lint-staged": "10.4.0",
"prettier": "2.1.2",
"@typescript-eslint/eslint-plugin": "4.14.0",
"@typescript-eslint/parser": "4.14.0",
"eslint": "7.18.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-import": "2.22.1",
"husky": "4.3.8",
"jest": "26.6.3",
"lint-staged": "10.5.3",
"prettier": "2.2.1",
"reflect-metadata": "0.1.13",
"release-it": "14.0.3",
"release-it": "14.2.2",
"rimraf": "3.0.2",
"rxjs": "6.6.3",
"sinon": "9.0.3",
"ts-jest": "26.4.0",
"typescript": "4.0.3"
"sinon": "9.2.3",
"ts-jest": "26.4.4",
"typescript": "4.1.3"
},

@@ -55,0 +55,0 @@ "peerDependencies": {

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