UNPKG

@pulsecron/nestjs-pulse

Version:

The modern MongoDB-powered scheduling library pulse for NestJS

21 lines 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Every = Every; exports.Schedule = Schedule; exports.Now = Now; const common_1 = require("@nestjs/common"); const constants_1 = require("../constants"); const enums_1 = require("../enums"); function Every(intervalOrOptions) { const options = typeof intervalOrOptions === 'string' ? { interval: intervalOrOptions } : intervalOrOptions; return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(constants_1.PULSE_JOB_OPTIONS, options), (0, common_1.SetMetadata)(constants_1.JOB_PROCESSOR_TYPE, enums_1.JobProcessorType.EVERY)); } function Schedule(whenOrOptions) { const options = typeof whenOrOptions === 'string' ? { when: whenOrOptions } : whenOrOptions; return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(constants_1.PULSE_JOB_OPTIONS, options), (0, common_1.SetMetadata)(constants_1.JOB_PROCESSOR_TYPE, enums_1.JobProcessorType.SCHEDULE)); } function Now(name) { const options = { name }; return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(constants_1.PULSE_JOB_OPTIONS, options), (0, common_1.SetMetadata)(constants_1.JOB_PROCESSOR_TYPE, enums_1.JobProcessorType.NOW)); } //# sourceMappingURL=schedulers.decorator.js.map