import { DailyConfig, HourlyConfig, MinutesConfig, MonthlyConfig, MonthlyDateDay, RecurrenceType, WeeklyConfig, WeekType, YearlyConfig, YearlyDateDay } from './types'; export type GetFrequency = (freq: string) => string; export type IsInRange = (val: string, min: number, max: number) => boolean; export type IsValidValue = (val: string, minVal: number, maxVal: number, checkSpecial?: boolean, isValueInRange?: IsInRange) => boolean; export type IsValidCron = (cron: string, isValidValue?: IsValidValue) => boolean; export type GetDateOrDayConfig = (type: RecurrenceType.YEARLY | RecurrenceType.MONTHLY, dayOfMonth: string, mon: string, dayOfWeek: string) => MonthlyDateDay | YearlyDateDay; export type GetConfigs = { buildConfigForMinutesRecurrence: (minutes: string, hours?: string) => MinutesConfig; buildConfigForHourlyRecurrence: (hour: string) => HourlyConfig; buildConfigForDailyRecurrence: (dayOfMonth: string, dayOfWeek: string) => DailyConfig; buildConfigForWeeklyRecurrence: (dayOfWeek: string) => WeeklyConfig; buildConfigForMonthlyRecurrence: (dayOfMonth: string, mon: string, dayOfWeek: string) => MonthlyConfig; buildConfigForYearlyRecurrence: (dayOfMonth: string, mon: string, dayOfWeek: string) => YearlyConfig; }; export declare const formatFrequency: GetFrequency; /** * generates a cron expression for RecurrenceType.HOURLY on the basis of provided config * @param config {@link HourlyConfig}- the config object that contains Hourly recurrence details * @returns The cron expression string (e.g. `"0 30 0/2 ? * *"` runs every 2 hours at 30 minutes * * @example * ```ts * const cron = getCronExpressionForHourly({ * seconds: "0", * minutes: "30", * frequency: 2, * }); * console.log(cron); // "0 30 0/2 ? * *" * ``` * @internal */ export declare function getCronExpressionForHourly(config: HourlyConfig): string; /** * generates a cron expression for RecurrenceType.MINUTES on the basis of provided config * @param config {@link MinutesConfig}- the config object that contains Minutes recurrence details * @returns The cron expression string (e.g. `"0 0/5 * ? * *"` runs every 5 minutes * * @example * ```ts * const cron = getCronExpressionForMinutes({ * seconds: "0", * frequency: 5, * }); * console.log(cron); // "0 0/5 * ? * *" * ``` * @internal */ export declare function getCronExpressionForMinutes(config: MinutesConfig): string; /** * generates a cron expression for RecurrenceType.DAILY on the basis of provided config * @param config {@link DailyConfig}- the config object that contains Daily recurrence details * @returns The cron expression string (e.g. `"0 30 10 ? * 2-6"` runs on weekdays from monday-friday at 10:30 * * @example * ```ts * const cron = getCronExpressionForDaily({ * seconds: "0", * hours: "10", * minutes: "30", * frequency: 2, weekType: 'Work week' * }); * console.log(cron); // "0 30 10 ? * 2-6" * ``` * @internal */ export declare function getCronExpressionForDaily(config: DailyConfig, formatFrequencyInput?: GetFrequency): string; /** * generates a cron expression for RecurrenceType.WEEKLY on the basis of provided config * @param config {@link WeeklyConfig}- the config object that contains Weekly recurrence details * @returns The cron expression string (e.g. `"0 30 10 ? * 1,3"` runs every sunday and tuesday at 10:30 * * @example * ```ts * const cron = getCronExpressionForWeekly({ * seconds: "0", * hours: "10", * minutes: "30", selectedDays: new Set(['1','3']) * }); * console.log(cron); // "0 30 10 ? * 1,3" * ``` * @internal */ export declare function getCronExpressionForWeekly(config: WeeklyConfig): string; /** * generates a cron expression for RecurrenceType.MONTHLY on the basis of provided config * @param config {@link MonthlyConfig}- the config object that contains Monthly recurrence details * * allows user to specify either Date of the month when dateOrDay is of 'Date' type or * Day of week and weekNumber when dateOrDay is of type 'Day of month' * @returns The cron expression string (e.g. `"0 30 10 15 *'/4 ?"` runs every 4 months on 15th at 10:30 am) * * @example with dateOrDay type = 'Date' * ```ts * const cron = getCronExpressionForMonth({ * seconds: "0", * hours: "10", * minutes: "30", * frequency: 4, * dateOrDay: { * type: "Date", * dayDate: 15, * } * }); * console.log(cron); // "0 30 10 15 *'/4 ?" * ``` * @example with dateOrDay type = 'Day of month' * Runs on second friday of every 4th month at 10:30 * ```ts * const cron = getCronExpressionForMonth({ * seconds: "0", * hours: "10", * minutes: "30", * frequency: 4, * dateOrDay: { * type: "Day of month", * weekNumber: 2, * day: '5' * } * }); * console.log(cron); // "0 30 10 ? *'/4 5#2" * ``` */ /** @internal */ export declare function getCronExpressionForMonth(config: MonthlyConfig, formatFrequencyInput?: GetFrequency): string; /** * generates a cron expression for RecurrenceType.YEARLY on the basis of provided config * @param config {@link YearlyConfig}- the config object that contains Yearly recurrence details * allows user to specify either Date of the month and month when dateOrDay is of 'Date' type or * Day of week, weekNumber and month when dateOrDay is of type 'Day of month' * @returns The cron expression string (e.g. `"0 30 10 15 3 ?"` runs every year on March 15 at 10:30 am) * * @example with dateOrDay type = 'Date' * ```ts * const cron = getCronExpressionForYear({ * seconds: "0", * hours: "10", * minutes: "30", * frequency: 2, * dateOrDay: { * type: "Date", * month: '3', * dayDate: 15, * } * }); * console.log(cron); // "0 30 10 15 3 ?" * ``` * @example with dateOrDay type = 'Day of month' * Runs on second friday of march, every 2 years * ```ts * const cron = getCronExpressionForYear({ * seconds: "0", * hours: "10", * minutes: "30", * frequency: 2, * dateOrDay: { * type: "Day of month", * month: '3', * weekNumber: 2, * day: '5' * } * }); * console.log(cron); // "0 30 10 ? 3 5#2" * ``` * @internal */ export declare function getCronExpressionForYear(config: YearlyConfig): string; /** * @internal */ export declare const isInRange: IsInRange; /** * @internal */ export declare function isValidValue(val: string, minVal: number, maxVal: number, checkSpecial?: boolean, isValueInRange?: IsInRange): any; /** * used to validate cron expression, * checks no of parts should be exactly 6 and verify each part * @internal */ export declare const isValidCron: IsValidCron; /** * similar to {@link getCronExpressionForDaily} * this is used to generate cronConfig object for Daily recurrence from cron string parts passed as params * @internal */ export declare function buildConfigForDailyRecurrence(dayOfMonth: string, dayOfWeek: string): DailyConfig; /** * similar to {@link getCronExpressionForHourly} * this is used to generate cronConfig object for Hourly recurrence from cron string parts passed as params * @internal */ export declare function buildConfigForHourlyRecurrence(hours: string): HourlyConfig; /** * similar to {@link getCronExpressionForMinutes} * this is used to generate cronConfig object for Minutes recurrence from cron string parts passed as params * @internal */ export declare function buildConfigForMinutesRecurrence(minutes: string, hours?: string): MinutesConfig; /** * similar to {@link getCronExpressionForWeekly} * this is used to generate cronConfig object for weekly recurrence from cron string parts passed as params * @internal */ export declare function buildConfigForWeeklyRecurrence(dayOfWeek: string): WeeklyConfig; /** * used to build dateOrDay object for yearly and monthly recurrence * @internal */ export declare const getDateOrDay: GetDateOrDayConfig; /** * similar to {@link getCronExpressionForYearly} * this is used to generate cronConfig object for yearly recurrence from cron string parts passed as params * @internal */ export declare function buildConfigForYearlyRecurrence(dayOfMonth: string, mon: string, dayOfWeek: string, getDateOrDayConfig?: GetDateOrDayConfig): YearlyConfig; /** * similar to {@link getCronExpressionForMonth} * this is used to generate cronConfig object for monthly recurrence from cron string parts passed as params * @internal */ export declare function buildConfigForMonthlyRecurrence(dayOfMonth: string, mon: string, dayOfWeek: string, getDateOrDayConfig?: GetDateOrDayConfig): MonthlyConfig; /** * * @param cron - cron expression representing either Daily, weekly, monthly or yearly recurrence * @returns the cron config of a specific recurrence after determining the recurrenceType * * @example * ```ts * const config = parseCronExpression('0 30 10 ? * 2-6'); * console.log(config); // {type: 'Daily', frequency: 2, weekType: 'Work week', time: '10:30'} * ``` * @internal */ export declare function parseCronExpression(cron: string, methods: GetConfigs): { seconds: string; hours?: string; frequency?: string; type: RecurrenceType.MINUTES; during?: "every_hour" | "specific_hours"; } | { frequency?: string; hours?: string; minutes: string; seconds: string; type: RecurrenceType.HOURLY; during?: "every_hour" | "specific_hours"; } | { type: RecurrenceType.DAILY; weekType: WeekType; frequency?: string; hours: string; minutes: string; seconds: string; } | { type: RecurrenceType.WEEKLY; selectedDays: Set; frequency?: string; hours: string; minutes: string; seconds: string; } | { type: RecurrenceType.YEARLY; dateOrDay: YearlyDateDay; frequency?: string; hours: string; minutes: string; seconds: string; } | { type: RecurrenceType.MONTHLY; dateOrDay: MonthlyDateDay; frequency?: string; hours: string; minutes: string; seconds: string; }; //# sourceMappingURL=helpers.d.ts.map