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

@nestjs/schedule

Package Overview
Dependencies
Maintainers
2
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 4.0.2 to 4.1.0

dist/interfaces/schedule-module-options.interface.d.ts

3

dist/decorators/cron.decorator.d.ts

@@ -27,3 +27,4 @@ import { CronJobParams } from 'cron';

disabled?: boolean;
} & ({
} & // make timeZone & utcOffset mutually exclusive
({
timeZone?: string;

@@ -30,0 +31,0 @@ utcOffset?: never;

/**
* Schedules an timeout (`setTimeout`).
* Schedules a timeout (`setTimeout`).
*/
export declare function Timeout(timeout: number): MethodDecorator;
/**
* Schedules an timeout (`setTimeout`).
* Schedules a timeout (`setTimeout`).
*/
export declare function Timeout(name: string, timeout: number): MethodDecorator;

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

/**
* Schedules an timeout (`setTimeout`).
* Schedules a timeout (`setTimeout`).
*/

@@ -12,0 +12,0 @@ function Timeout(nameOrTimeout, timeout) {

@@ -56,3 +56,3 @@ export declare enum CronExpression {

EVERY_6_MONTHS = "0 0 1 */6 *",
EVERY_YEAR = "0 0 1 0 *",
EVERY_YEAR = "0 0 1 1 *",
EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",

@@ -59,0 +59,0 @@ EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",

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

CronExpression["EVERY_6_MONTHS"] = "0 0 1 */6 *";
CronExpression["EVERY_YEAR"] = "0 0 1 0 *";
CronExpression["EVERY_YEAR"] = "0 0 1 1 *";
CronExpression["EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM"] = "0 */30 9-17 * * *";

@@ -63,0 +63,0 @@ CronExpression["EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM"] = "0 */30 9-18 * * *";

@@ -6,1 +6,2 @@ export declare const SCHEDULER_NAME = "SCHEDULER_NAME";

export declare const SCHEDULE_TIMEOUT_OPTIONS = "SCHEDULE_TIMEOUT_OPTIONS";
export declare const SCHEDULE_MODULE_OPTIONS = "SCHEDULE_MODULE_OPTIONS";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SCHEDULE_TIMEOUT_OPTIONS = exports.SCHEDULE_INTERVAL_OPTIONS = exports.SCHEDULE_CRON_OPTIONS = exports.SCHEDULER_TYPE = exports.SCHEDULER_NAME = void 0;
exports.SCHEDULE_MODULE_OPTIONS = exports.SCHEDULE_TIMEOUT_OPTIONS = exports.SCHEDULE_INTERVAL_OPTIONS = exports.SCHEDULE_CRON_OPTIONS = exports.SCHEDULER_TYPE = exports.SCHEDULER_NAME = void 0;
exports.SCHEDULER_NAME = 'SCHEDULER_NAME';

@@ -9,1 +9,2 @@ exports.SCHEDULER_TYPE = 'SCHEDULER_TYPE';

exports.SCHEDULE_TIMEOUT_OPTIONS = 'SCHEDULE_TIMEOUT_OPTIONS';
exports.SCHEDULE_MODULE_OPTIONS = 'SCHEDULE_MODULE_OPTIONS';

@@ -6,3 +6,5 @@ import { OnModuleInit } from '@nestjs/common';

import { SchedulerOrchestrator } from './scheduler.orchestrator';
import { ScheduleModuleOptions } from './interfaces/schedule-module-options.interface';
export declare class ScheduleExplorer implements OnModuleInit {
private readonly moduleOptions;
private readonly schedulerOrchestrator;

@@ -13,3 +15,3 @@ private readonly discoveryService;

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

@@ -16,0 +18,0 @@ explore(): void;

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

};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -19,4 +22,6 @@ exports.ScheduleExplorer = void 0;

const scheduler_orchestrator_1 = require("./scheduler.orchestrator");
const schedule_constants_1 = require("./schedule.constants");
let ScheduleExplorer = class ScheduleExplorer {
constructor(schedulerOrchestrator, discoveryService, metadataAccessor, metadataScanner) {
constructor(moduleOptions, schedulerOrchestrator, discoveryService, metadataAccessor, metadataScanner) {
this.moduleOptions = moduleOptions;
this.schedulerOrchestrator = schedulerOrchestrator;

@@ -59,2 +64,5 @@ this.discoveryService = discoveryService;

case scheduler_type_enum_1.SchedulerType.CRON: {
if (!this.moduleOptions.cronJobs) {
return;
}
const cronMetadata = this.metadataAccessor.getCronMetadata(methodRef);

@@ -65,2 +73,5 @@ const cronFn = this.wrapFunctionInTryCatchBlocks(methodRef, instance);

case scheduler_type_enum_1.SchedulerType.TIMEOUT: {
if (!this.moduleOptions.timeouts) {
return;
}
const timeoutMetadata = this.metadataAccessor.getTimeoutMetadata(methodRef);

@@ -72,2 +83,5 @@ const name = this.metadataAccessor.getSchedulerName(methodRef);

case scheduler_type_enum_1.SchedulerType.INTERVAL: {
if (!this.moduleOptions.intervals) {
return;
}
const intervalMetadata = this.metadataAccessor.getIntervalMetadata(methodRef);

@@ -85,2 +99,5 @@ const name = this.metadataAccessor.getSchedulerName(methodRef);

case scheduler_type_enum_1.SchedulerType.CRON: {
if (!this.moduleOptions.cronJobs) {
return;
}
this.logger.warn(`Cannot register cron job "${wrapper.name}@${key}" because it is defined in a non static provider.`);

@@ -90,2 +107,5 @@ break;

case scheduler_type_enum_1.SchedulerType.TIMEOUT: {
if (!this.moduleOptions.timeouts) {
return;
}
this.logger.warn(`Cannot register timeout "${wrapper.name}@${key}" because it is defined in a non static provider.`);

@@ -95,2 +115,5 @@ break;

case scheduler_type_enum_1.SchedulerType.INTERVAL: {
if (!this.moduleOptions.intervals) {
return;
}
this.logger.warn(`Cannot register interval "${wrapper.name}@${key}" because it is defined in a non static provider.`);

@@ -115,3 +138,4 @@ break;

(0, common_1.Injectable)(),
__metadata("design:paramtypes", [scheduler_orchestrator_1.SchedulerOrchestrator,
__param(0, (0, common_1.Inject)(schedule_constants_1.SCHEDULE_MODULE_OPTIONS)),
__metadata("design:paramtypes", [Object, scheduler_orchestrator_1.SchedulerOrchestrator,
core_1.DiscoveryService,

@@ -118,0 +142,0 @@ schedule_metadata_accessor_1.SchedulerMetadataAccessor,

import { DynamicModule } from '@nestjs/common';
import { ScheduleModuleOptions } from './interfaces/schedule-module-options.interface';
export declare class ScheduleModule {
static forRoot(): DynamicModule;
static forRoot(options?: ScheduleModuleOptions): DynamicModule;
}

@@ -17,8 +17,22 @@ "use strict";

const scheduler_registry_1 = require("./scheduler.registry");
const schedule_constants_1 = require("./schedule.constants");
let ScheduleModule = ScheduleModule_1 = class ScheduleModule {
static forRoot() {
static forRoot(options) {
const optionsWithDefaults = {
cronJobs: true,
intervals: true,
timeouts: true,
...options,
};
return {
global: true,
module: ScheduleModule_1,
providers: [schedule_explorer_1.ScheduleExplorer, scheduler_registry_1.SchedulerRegistry],
providers: [
schedule_explorer_1.ScheduleExplorer,
scheduler_registry_1.SchedulerRegistry,
{
provide: schedule_constants_1.SCHEDULE_MODULE_OPTIONS,
useValue: optionsWithDefaults,
},
],
exports: [scheduler_registry_1.SchedulerRegistry],

@@ -25,0 +39,0 @@ };

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

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

"cron": "3.1.7",
"uuid": "9.0.1"
"uuid": "10.0.0"
},
"devDependencies": {
"@commitlint/cli": "19.2.2",
"@commitlint/config-angular": "19.2.2",
"@nestjs/common": "10.3.7",
"@nestjs/core": "10.3.7",
"@nestjs/platform-express": "10.3.7",
"@nestjs/testing": "10.3.7",
"@commitlint/cli": "19.3.0",
"@commitlint/config-angular": "19.3.0",
"@nestjs/common": "10.3.10",
"@nestjs/core": "10.3.10",
"@nestjs/platform-express": "10.3.10",
"@nestjs/testing": "10.3.10",
"@types/jest": "29.5.12",
"@types/node": "20.12.7",
"@types/node": "20.14.9",
"@types/sinon": "17.0.3",
"@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"@types/uuid": "10.0.0",
"@typescript-eslint/eslint-plugin": "7.15.0",
"@typescript-eslint/parser": "7.15.0",
"eslint": "8.57.0",

@@ -43,11 +43,11 @@ "eslint-config-prettier": "9.1.0",

"jest": "29.7.0",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"lint-staged": "15.2.7",
"prettier": "3.3.2",
"reflect-metadata": "0.2.2",
"release-it": "17.2.0",
"rimraf": "5.0.5",
"release-it": "17.4.1",
"rimraf": "5.0.7",
"rxjs": "7.8.1",
"sinon": "17.0.1",
"ts-jest": "29.1.2",
"typescript": "5.4.5"
"sinon": "18.0.0",
"ts-jest": "29.1.5",
"typescript": "5.5.3"
},

@@ -54,0 +54,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