UNPKG

@openinc/parse-server-opendash

Version:
33 lines (32 loc) 1.46 kB
import Bree from "bree"; import { JobTypes, TimespanFieldType } from ".."; export default class BreeInstance { private static instance; private static jobs; private constructor(); static getBree(): Bree; static getAllJobs(): Bree.Job[]; /** * Converts a cron-like string into a human-readable format. * * @param value - The cron-like string to convert. * @returns A human-readable string representing the cron-like schedule. */ static createHumanReadableFormat(value: string): string; /** * Calculates how much earlier a job should be scheduled based on the user input. * Users can set an offset like "2 weeks" or "3 days" to schedule the job earlier. * This function will substract the offset from startdate and return a new date. */ static calculateOffsetToExecution(startdate: Date, notifyBeforeDue: TimespanFieldType): Date; static addJob(newjob: Bree.Job | Omit<Bree.Job, "timeout"> | undefined): Promise<void>; static removeJob(jobName: string): Promise<void>; static getJobByName(jobName: string): Bree.Job | undefined; /** * Constructs a job name based on the schedule ID and job type. * @param id - The ID of the schedule. * @param jobType - The type of the job (e.g., "notification before due"). * @returns A string representing the constructed job name. */ static constructJobName(id: string, jobType: JobTypes): string; }