Options
All
  • Public
  • Public/Protected
  • All
Menu

@vangware/cron

Index

Type aliases

Variables

Functions

Type aliases

CronDayOfMonth

Cron day of month.

CronDayOfMonthValue

CronDayOfMonthValue: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31

Cron day of the month value (1-31).

CronDayOfWeek

Cron day of week.

CronDayOfWeekValue

Cron day of week value (0-7 | SUN-SAT).

CronDayOfWeekValueNumber

CronDayOfWeekValueNumber: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7

Cron day of week number value (0-7).

CronDayOfWeekValueString

CronDayOfWeekValueString: "FRI" | "MON" | "SAT" | "SUN" | "THU" | "TUE" | "WED"

Cron day of week string value (SUN-SAT).

CronEvery

CronEvery: typeof CRON_EVERY

Cron every (*).

CronHours

Cron hours.

CronHoursValue

CronHoursValue: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23

Cron hours value (0-23).

CronLast

CronLast: typeof CRON_LAST

Cron every (L).

CronLastValue

CronLastValue: { last: CronDayOfWeekValueNumber }

Cron every ({last}L).

Type declaration

CronList

CronList<Value>: ReadonlyArray<CronListItem<Value>>

Cron list (value1,value2,valueN).

Type parameters

  • Value

CronListItem

CronListItem<Value>: CronRange<Value> | CronSteps<Value> | Value

Cron list item.

Type parameters

  • Value

CronMinutes

Cron minutes.

CronMinutesValue

CronMinutesValue: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59

Cron minutes value (0-59).

CronMonth

Cron month.

CronMonthValue

Cron month value (1-12 and JAN-DEC).

CronMonthValueNumber

CronMonthValueNumber: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12

Cron month number value (1-12).

CronMonthValueString

CronMonthValueString: "APR" | "AUG" | "DEC" | "FEB" | "JAN" | "JUL" | "JUN" | "MAR" | "MAY" | "NOV" | "OCT" | "SEP"

Cron month string value (JAN-DEC).

CronNearestDayOfMonth

CronNearestDayOfMonth: { nearest: CronDayOfMonthValue }

Nearest day of month ({nearest}W).

Type declaration

CronPart

CronPart<Value>: CronEvery | CronList<Value> | CronRange<Value> | CronSteps<Value> | Value

Cron part.

Type parameters

  • Value

CronPartExtended

CronPartExtended<Value>: CronLast | CronPart<Value> | CronStartOrBlank

Cron part extended (used by CronDayOfWeek and DayOfMonth).

Type parameters

  • Value

CronQuartz

Cron object (Quartz).

CronQuartzExtension

CronQuartzExtension: { seconds: CronSeconds; year: CronYear }

Cron expression parts coming with Quartz.

Type declaration

  • Readonly seconds: CronSeconds

    Cron CronSeconds object.

  • Readonly year: CronYear

    Cron CronYear object.

CronRange

CronRange<Value>: { from: Value; to: Value }

Cron range (from-to).

Type parameters

  • Value

Type declaration

  • Readonly from: Value
  • Readonly to: Value

CronSeconds

Cron seconds.

CronSecondsValue

CronSecondsValue: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59

Cron seconds value (0-59).

CronSpecificDayOfWeek

CronSpecificDayOfWeek: { day: CronDayOfWeekValueNumber; week: CronWeekValue }

Cron specific day of week ({day}#{week}).

Type declaration

CronStartOrBlank

CronStartOrBlank: typeof CRON_START_OR_BLANK

Cron start or blank value (?).

CronSteps

CronSteps<Value>: { every: number; start: CronEvery | CronRange<Value> | Value }

Cron steps (start/every).

Type parameters

  • Value

Type declaration

CronUnix

CronUnix: { dayOfMonth: CronDayOfMonth; dayOfWeek: CronDayOfWeek; hours: CronHours; minutes: CronMinutes; month: CronMonth }

Cron expression (UNIX).

Type declaration

CronValueParser

CronValueParser<Value>: (value: Value) => string | undefined

Type parameters

  • Value

Type declaration

    • (value: Value): string | undefined
    • Parses a value into a string or undefined if invalid.

      Parameters

      • value: Value

      Returns string | undefined

CronWeekValue

CronWeekValue: 1 | 2 | 3 | 4 | 5

Cron week value (1-5).

CronYear

Cron year.

CronYearValue

CronYearValue: 1970 | 1971 | 1972 | 1973 | 1974 | 1975 | 1976 | 1977 | 1978 | 1979 | 1980 | 1981 | 1982 | 1983 | 1984 | 1985 | 1986 | 1987 | 1988 | 1989 | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | 1999 | 2000 | 2001 | 2002 | 2003 | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | 2027 | 2028 | 2029 | 2030 | 2031 | 2032 | 2033 | 2034 | 2035 | 2036 | 2037 | 2038 | 2039 | 2040 | 2041 | 2042 | 2043 | 2044 | 2045 | 2046 | 2047 | 2048 | 2049 | 2050 | 2051 | 2052 | 2053 | 2054 | 2055 | 2056 | 2057 | 2058 | 2059 | 2060 | 2061 | 2062 | 2063 | 2064 | 2065 | 2066 | 2067 | 2068 | 2069 | 2070 | 2071 | 2072 | 2073 | 2074 | 2075 | 2076 | 2077 | 2078 | 2079 | 2080 | 2081 | 2082 | 2083 | 2084 | 2085 | 2086 | 2087 | 2088 | 2089 | 2090 | 2091 | 2092 | 2093 | 2094 | 2095 | 2096 | 2097 | 2098 | 2099

Cron year value (1970-2099).

LimitTuple

LimitTuple: readonly [lowerLimit: number, upperLimit: number]

Lower and upper limit of a number value.

StringValueParser

StringValueParser<Value>: (value: string) => Value | undefined

Type parameters

  • Value

Type declaration

    • (value: string): Value | undefined
    • Parses a string into a value of given type or undefined if invalid

      Parameters

      • value: string

      Returns Value | undefined

Variables

CRON_EVERY

CRON_EVERY: "*" = "*"

CRON_LAST

CRON_LAST: "L" = "L"

CRON_LIST_SEPARATOR

CRON_LIST_SEPARATOR: "," = ","

CRON_RANGE_SEPARATOR

CRON_RANGE_SEPARATOR: "-" = "-"

CRON_SPECIFIC_SEPARATOR

CRON_SPECIFIC_SEPARATOR: "#" = "#"

CRON_START_OR_BLANK

CRON_START_OR_BLANK: "?" = "?"

CRON_STEPS_SEPARATOR

CRON_STEPS_SEPARATOR: "/" = "/"

QUARTZ_DAY_OF_MONTH_POSITION

QUARTZ_DAY_OF_MONTH_POSITION: 3 = 3

QUARTZ_DAY_OF_WEEK_POSITION

QUARTZ_DAY_OF_WEEK_POSITION: 5 = 5

QUARTZ_HOURS_POSITION

QUARTZ_HOURS_POSITION: 2 = 2

QUARTZ_MINUTES_POSITION

QUARTZ_MINUTES_POSITION: 1 = 1

QUARTZ_MONTH_POSITION

QUARTZ_MONTH_POSITION: 4 = 4

QUARTZ_SECONDS_POSITION

QUARTZ_SECONDS_POSITION: 0 = 0

QUARTZ_YEAR_POSITION

QUARTZ_YEAR_POSITION: 6 = 6

UNIX_DAY_OF_MONTH_POSITION

UNIX_DAY_OF_MONTH_POSITION: 2 = 2

UNIX_DAY_OF_WEEK_POSITION

UNIX_DAY_OF_WEEK_POSITION: 4 = 4

UNIX_HOURS_POSITION

UNIX_HOURS_POSITION: 1 = 1

UNIX_MINUTES_POSITION

UNIX_MINUTES_POSITION: 0 = 0

UNIX_MONTH_POSITION

UNIX_MONTH_POSITION: 3 = 3

Functions

Const isCronDayOfMonthValue

Const isCronDayOfWeekValue

Const isCronDayOfWeekValueNumber

Const isCronDayOfWeekValueString

Const isCronEvery

  • isCronEvery(value: unknown): value is "*"

Const isCronHoursValue

Const isCronLast

  • isCronLast(value: unknown): value is "L"

Const isCronLastValue

Const isCronList

  • isCronList<Value>(value: unknown): value is CronList<Value>

Const isCronMinutesValue

Const isCronMonthValue

Const isCronMonthValueNumber

Const isCronMonthValueString

Const isCronNearestDayOfMonth

Const isCronRange

  • isCronRange<Value>(value: unknown): value is CronRange<Value>

Const isCronSecondsValue

Const isCronSpecificDayOfWeek

Const isCronStartOrBlank

  • isCronStartOrBlank(value: unknown): value is "?"

Const isCronSteps

  • isCronSteps<Value>(value: unknown): value is CronSteps<Value>

Const isCronWeekValue

Const isCronYearValue

Const isStringDayOfMonthValue

  • isStringDayOfMonthValue(value: unknown): value is string

Const isStringDayOfWeekValue

  • isStringDayOfWeekValue(value: unknown): boolean

Const isStringDayOfWeekValueNumber

  • isStringDayOfWeekValueNumber(value: unknown): value is string

Const isStringHoursValue

  • isStringHoursValue(value: unknown): value is string

Const isStringLastValue

  • isStringLastValue(value: unknown): value is string

Const isStringList

  • isStringList(value: unknown): value is string
  • Check if given is a string representing a CronList.

    Parameters

    • value: unknown

      Value to check.

    Returns value is string

Const isStringMinutesValue

  • isStringMinutesValue(value: unknown): value is string

Const isStringMonthValue

  • isStringMonthValue(value: unknown): boolean

Const isStringMonthValueNumber

  • isStringMonthValueNumber(value: unknown): value is string

Const isStringNearestDayOfMonth

  • isStringNearestDayOfMonth(value: unknown): value is string

Const isStringRange

  • isStringRange(value: unknown): value is string
  • Check if given is a string representing a CronRange.

    Parameters

    • value: unknown

      Value to check.

    Returns value is string

Const isStringSecondsValue

  • isStringSecondsValue(value: unknown): value is string

Const isStringSpecificDayOfWeek

  • isStringSpecificDayOfWeek(value: unknown): value is string

Const isStringSteps

  • isStringSteps(value: unknown): value is string
  • Check if given is a string representing a CronSteps.

    Parameters

    • value: unknown

      Value to check.

    Returns value is string

Const isStringWeekValue

  • isStringWeekValue(value: unknown): value is string

Const isStringYearValue

  • isStringYearValue(value: unknown): value is string

Const parseCronDayOfMonth

Const parseCronDayOfMonthValue

Const parseCronDayOfWeek

Const parseCronDayOfWeekValue

Const parseCronEvery

  • parseCronEvery(source: string): undefined | "*"
  • Parses a CronEvery into a string.

    Parameters

    • source: string

      CronEvery to be parsed.

    Returns undefined | "*"

    A string or undefined if invalid.

Const parseCronHours

Const parseCronHoursValue

Const parseCronLast

  • parseCronLast(source: string): undefined | "L"
  • Parses CronLast into a string.

    Parameters

    • source: string

      CronLast to be parsed.

    Returns undefined | "L"

    A string or undefined if invalid.

Const parseCronLastValue

Const parseCronList

  • Parses CronList into a string.

    Parameters

    • limit: LimitTuple

      LimitTuple to be used when parsing CronSteps.

    Returns <Value>(parser: CronValueParser<Value>) => (source: CronList<Value>) => undefined | string

    Curried function with limit on context.

      • Type parameters

        • Value

        Parameters

        Returns (source: CronList<Value>) => undefined | string

          • (source: CronList<Value>): undefined | string
          • Parameters

            Returns undefined | string

            Curried function with limit and parser on context.

Const parseCronMinutes

Const parseCronMinutesValue

Const parseCronMonth

Const parseCronMonthValue

Const parseCronNearestDayOfMonth

Const parseCronPart

Const parseCronQuartz

  • parseCronQuartz(__namedParameters: CronQuartz): undefined | string

Const parseCronRange

  • Parses CronRange into a string.

    Type parameters

    • Value

    Parameters

    Returns (source: CronRange<Value>) => undefined | string

    Curried function with parser in context.

      • (source: CronRange<Value>): undefined | string
      • Parameters

        Returns undefined | string

Const parseCronSeconds

Const parseCronSecondsValue

Const parseCronSpecificDayOfWeek

Const parseCronStartOrBlank

  • parseCronStartOrBlank(source: string): undefined | "?"
  • Parses CronStartOrBlank into a string.

    Parameters

    • source: string

      CronStartOrBlank to be parsed.

    Returns undefined | "?"

    A string or undefined if invalid.

Const parseCronSteps

Const parseCronUnix

  • parseCronUnix(__namedParameters: CronUnix): undefined | string

Const parseCronYear

Const parseCronYearValue

Const parseStringDayOfMonth

Const parseStringDayOfMonthValue

Const parseStringDayOfWeek

Const parseStringDayOfWeekValue

Const parseStringHours

Const parseStringHoursValue

Const parseStringLastValue

Const parseStringList

  • Parses a string into a CronList.

    Parameters

    • limit: LimitTuple

      LimitTuple to be used when parsing CronSteps.

    Returns <Value>(parser: StringValueParser<Value>) => (source: string) => undefined | CronList<Value>

    Curried function with limit in context.

      • Type parameters

        • Value

        Parameters

        Returns (source: string) => undefined | CronList<Value>

          • (source: string): undefined | CronList<Value>
          • Parameters

            • source: string

            Returns undefined | CronList<Value>

            Curried function with limit and parser in context.

Const parseStringMinutes

Const parseStringMinutesValue

Const parseStringMonth

Const parseStringMonthValue

Const parseStringNearestDayOfMonth

Const parseStringPart

  • Parses a string into a CronPart.

    Parameters

    • limit: LimitTuple

      LimitTuple to be used when parsing CronSteps.

    Returns <Value>(parser: StringValueParser<Value>) => (source: string) => undefined | CronPart<Value>

    Curried function with limit in context.

      • Type parameters

        • Value

        Parameters

        Returns (source: string) => undefined | CronPart<Value>

          • (source: string): undefined | CronPart<Value>
          • Parameters

            • source: string

            Returns undefined | CronPart<Value>

            Curried function with limit and parser in context.

Const parseStringQuartz

  • parseStringQuartz(source: string): undefined | CronQuartz

Const parseStringQuartzExpression

  • parseStringQuartzExpression(source: string): undefined | readonly [string, string, string, string, string, string, string]
  • Parses given string expression.

    Parameters

    • source: string

      string to be parsed.

    Returns undefined | readonly [string, string, string, string, string, string, string]

    An array of 7 elements or undefined if invalid.

Const parseStringRange

  • Parses a string into a CronRange.

    Type parameters

    • Value

    Parameters

    Returns (source: string) => undefined | CronRange<Value>

    Curried function with parser in context.

      • (source: string): undefined | CronRange<Value>
      • Parameters

        • source: string

        Returns undefined | CronRange<Value>

Const parseStringSeconds

Const parseStringSecondsValue

Const parseStringSpecificDayOfWeek

Const parseStringSteps

Const parseStringUnix

  • parseStringUnix(source: string): undefined | CronUnix

Const parseStringUnixExpression

  • parseStringUnixExpression(source: string): undefined | readonly [string, string, string, string, string]
  • Parses given expression or undefined if invalid.

    Parameters

    • source: string

      string to be parsed.

    Returns undefined | readonly [string, string, string, string, string]

    An array of 5 elements or undefined if invalid.

Const parseStringYear

Const parseStringYearValue

Const splitExpression

  • splitExpression(source: string): string[]
  • Splits given string by spaces (even if multiple).

    Parameters

    • source: string

      string to be parsed.

    Returns string[]

    An array with all elements of the given expression.

Const stringIncludesOnlyOnce

  • stringIncludesOnlyOnce(search: string): (value: unknown) => value is string
  • Checks if given search value appears just onces in given value.

    Parameters

    • search: string

      Value to search.

    Returns (value: unknown) => value is string

    Curried function with search in context.

      • (value: unknown): value is string
      • Parameters

        • value: unknown

        Returns value is string

Const validateOr

  • validateOr(validations: readonly ((value: unknown) => boolean)[]): (value: unknown) => boolean
  • Run several validations in the same string, true if any is true.

    Parameters

    • validations: readonly ((value: unknown) => boolean)[]

      List of validations.

    Returns (value: unknown) => boolean

    Curried function with validations in context.

      • (value: unknown): boolean
      • Parameters

        • value: unknown

        Returns boolean