@webda/core
Version:
Expose API with Lambda
74 lines (73 loc) • 1.87 kB
TypeScript
import { CancelablePromise } from "../index.js";
import { Service } from "./service.js";
/**
* Cron item
*/
export declare class CronDefinition {
/**
* Cron definition
* * * * 0 3
*/
cron: string;
/**
* Description of the task
*/
description: string;
/**
* Argument to be passed to the function
*/
args: any[];
/**
* Method to call
*/
method: string;
/**
* Webda service name
*/
serviceName: string;
/**
*
* @param cron
* @param args
* @param serviceName
* @param method
* @param description
*/
constructor(cron: string, args?: any[], serviceName?: string, method?: string, description?: string);
toString(): string;
}
/**
* @WebdaModda
*/
declare class CronService extends Service {
enable: boolean;
crons: {
cron: string;
description?: string;
serviceName?: string;
method?: string;
context?: string;
args?: any[];
cb?: () => void;
}[];
crontabSchedule: any;
private _scanned;
static Annotation(cron: string, description?: string, ...args: any[]): (_target: any, property: string, descriptor: PropertyDescriptor) => void;
static getCronId(cron: CronDefinition, name?: string): string;
static loadAnnotations(services: any): CronDefinition[];
addAnnotations(): void;
getCrontab(): {
cron: string;
description?: string;
serviceName?: string;
method?: string;
context?: string;
args?: any[];
cb?: () => void;
}[];
work(annotations?: string): CancelablePromise;
run(annotations?: boolean): CancelablePromise;
schedule(cron: string, cb: () => any, description?: string): void;
}
declare const Cron: typeof CronService.Annotation;
export { Cron, CronService };