@sapphire/cron 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +119 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.global.js +703 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +187 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +154 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/lib/constants.ts","../../utilities/src/lib/arrayStrictEquals.ts","../../utilities/src/lib/cast.ts","../../utilities/src/lib/chunk.ts","../../utilities/src/lib/classExtends.ts","../../utilities/src/lib/codeBlock.ts","../../utilities/src/lib/splitText.ts","../../utilities/src/lib/cutText.ts","../../utilities/src/lib/debounce/index.ts","../../utilities/src/lib/isPrimitive.ts","../../utilities/src/lib/deepClone.ts","../../utilities/src/lib/isNullOrUndefined.ts","../../utilities/src/lib/filterNullAndUndefined.ts","../../utilities/src/lib/isNullOrUndefinedOrEmpty.ts","../../utilities/src/lib/filterNullAndUndefinedAndEmpty.ts","../../utilities/src/lib/isNullOrUndefinedOrZero.ts","../../utilities/src/lib/filterNullAndUndefinedAndZero.ts","../../utilities/src/lib/getDeepObjectKeys.ts","../../utilities/src/lib/hasAtLeastOneKeyInMap.ts","../../utilities/src/lib/inlineCodeBlock.ts","../../utilities/src/lib/isClass.ts","../../utilities/src/lib/isFunction.ts","../../utilities/src/lib/isNumber.ts","../../utilities/src/lib/isObject.ts","../../utilities/src/lib/isThenable.ts","../../utilities/src/lib/lazy.ts","../../utilities/src/lib/makeObject.ts","../../utilities/src/lib/mergeDefault.ts","../../utilities/src/lib/mergeObjects.ts","../../utilities/src/lib/noop.ts","../../utilities/src/lib/objectToTuples.ts","../../utilities/src/lib/parseUrl.ts","../../utilities/src/lib/partition.ts","../../utilities/src/lib/range.ts","../../utilities/src/lib/regExpEsc.ts","../../utilities/src/lib/roundNumber.ts","../../utilities/src/lib/toTitleCase.ts","../../utilities/src/lib/tryParse.ts","../src/lib/Cron.ts"],"sourcesContent":["export * from './lib/constants';\nexport * from './lib/Cron';\n","export enum Time {\n\tMillisecond = 1,\n\tSecond = 1000,\n\tMinute = 1000 * 60,\n\tHour = 1000 * 60 * 60,\n\tDay = 1000 * 60 * 60 * 24,\n\tMonth = 1000 * 60 * 60 * 24 * (365 / 12),\n\tYear = 1000 * 60 * 60 * 24 * 365\n}\n\nexport const partRegex = /^(?:(\\*)|(\\d+)(?:-(\\d+))?)(?:\\/(\\d+))?$/;\n\nexport const wildcardRegex = /\\bh\\b|\\B\\?\\B/g;\n\nexport const allowedNum = [\n\t[0, 59],\n\t[0, 23],\n\t[1, 31],\n\t[1, 12],\n\t[0, 6]\n];\n\nexport const predefined = {\n\t'@annually': '0 0 1 1 *',\n\t'@yearly': '0 0 1 1 *',\n\t'@monthly': '0 0 1 * *',\n\t'@weekly': '0 0 * * 0',\n\t'@daily': '0 0 * * *',\n\t'@hourly': '0 * * * *'\n} as const;\n\nexport const cronTokens = {\n\tjan: 1,\n\tfeb: 2,\n\tmar: 3,\n\tapr: 4,\n\tmay: 5,\n\tjun: 6,\n\tjul: 7,\n\taug: 8,\n\tsep: 9,\n\toct: 10,\n\tnov: 11,\n\tdec: 12,\n\tsun: 0,\n\tmon: 1,\n\ttue: 2,\n\twed: 3,\n\tthu: 4,\n\tfri: 5,\n\tsat: 6\n} as const;\n\nexport const tokensRegex = new RegExp(Object.keys(cronTokens).join('|'), 'g');\n","/**\n * Compare if both arrays are strictly equal\n * @param arr1 The array to compare to\n * @param arr2 The array to compare with\n */\nexport function arrayStrictEquals<T extends readonly unknown[]>(arr1: T, arr2: T): boolean {\n\tif (arr1 === arr2) return true;\n\tif (arr1.length !== arr2.length) return false;\n\n\tfor (let i = 0; i < arr1.length; i++) {\n\t\tif (arr1[i] !== arr2[i] || typeof arr1[i] !== typeof arr2[i]) return false;\n\t}\n\treturn true;\n}\n","/**\n * Casts any value to `T`\n *\n * Note that this function is not type-safe, and may cause runtime errors if used incorrectly.\n * Also note that this function is effectively useless in a JavaScript project, it only serves a purpose for TypeScript projects.\n *\n * @param value The value to cast to another type\n * @returns The value but as type `T`\n */\nexport function cast<T>(value: unknown): T {\n\treturn value as T;\n}\n","/**\n * Splits up an array into chunks\n * @param array The array to chunk up\n * @param chunkSize The size of each individual chunk\n */\nexport function chunk<T>(array: readonly T[], chunkSize: number): T[][] {\n\tif (!Array.isArray(array)) throw new TypeError('entries must be an array.');\n\tif (!Number.isInteger(chunkSize)) throw new TypeError('chunkSize must be an integer.');\n\tif (chunkSize < 1) throw new RangeError('chunkSize must be 1 or greater.');\n\tconst clone: T[] = array.slice();\n\tconst chunks: T[][] = [];\n\twhile (clone.length) chunks.push(clone.splice(0, chunkSize));\n\treturn chunks;\n}\n","import type { Ctor } from './utilityTypes';\n\n/**\n * Checks whether or not the value class extends the base class.\n * @param value The constructor to be checked against.\n * @param base The base constructor.\n */\nexport function classExtends<T extends Ctor>(value: Ctor, base: T): value is T {\n\tlet ctor: Ctor | null = value;\n\twhile (ctor !== null) {\n\t\tif (ctor === base) return true;\n\t\tctor = Object.getPrototypeOf(ctor);\n\t}\n\n\treturn false;\n}\n","const zws = String.fromCharCode(8203);\n\n/**\n * Wraps text in a markdown codeblock with optionally a language indicator for syntax highlighting\n * @param language The codeblock language\n * @param expression The expression to be wrapped in the codeblock\n */\nexport function codeBlock<T>(language: string, expression: T): string {\n\tif (typeof expression === 'string') {\n\t\tif (expression.length === 0) return `\\`\\`\\`${zws}\\`\\`\\``;\n\t\treturn `\\`\\`\\`${language}\\n${expression.replace(/```/, `\\`${zws}\\`\\``).replace(/`$/g, `\\`${zws}`)}\\`\\`\\``;\n\t}\n\treturn `\\`\\`\\`${language}\\n${expression || zws}\\`\\`\\``;\n}\n","/**\n * Split a string by its latest space character in a range from the character 0 to the selected one.\n * @param str The text to split.\n * @param length The length of the desired string.\n * @param char The character to split with\n * @copyright 2019 Aura Román\n * @license Apache-2.0\n */\nexport function splitText(str: string, length: number, char = ' ') {\n\tconst x = str.substring(0, length).lastIndexOf(char);\n\tconst pos = x === -1 ? length : x;\n\treturn str.substring(0, pos);\n}\n","import { splitText } from './splitText';\n\n/**\n * Split a text by its latest space character in a range from the character 0 to the selected one.\n * @param str The text to split.\n * @param length The length of the desired string.\n * @copyright 2019 Aura Román\n * @license Apache-2.0\n */\nexport function cutText(str: string, length: number) {\n\tif (str.length < length) return str;\n\tconst cut = splitText(str, length - 3);\n\tif (cut.length < length - 3) return `${cut}...`;\n\treturn `${cut.slice(0, length - 3)}...`;\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\nexport interface DebounceSettings {\n\t/**\n\t * The number of milliseconds to delay.\n\t * @default 0\n\t */\n\twait?: number;\n\n\t/**\n\t * The maximum time `func` is allowed to be delayed before it's invoked\n\t * @default null\n\t */\n\tmaxWait?: number | null;\n}\n\nexport interface DebouncedFunc<FnArgumentsType extends any[], FnReturnType> {\n\t/**\n\t * Call the original function, but applying the debounce rules.\n\t *\n\t * If the debounced function can be run immediately, this calls it and returns its return\n\t * value.\n\t *\n\t * Otherwise, it returns the return value of the last invocation, or undefined if the debounced\n\t * function was not invoked yet.\n\t */\n\t(...args: FnArgumentsType): FnReturnType | undefined;\n\n\t/**\n\t * Throw away any pending invocation of the debounced function.\n\t */\n\tcancel(): void;\n\n\t/**\n\t * If there is a pending invocation of the debounced function, invoke it immediately and return\n\t * its return value.\n\t *\n\t * Otherwise, return the value from the last invocation, or undefined if the debounced function\n\t * was never invoked.\n\t */\n\tflush(): FnReturnType | undefined;\n}\n\n/**\n * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since\n * the last time the debounced function was invoked. The debounced function comes with a cancel method to\n * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to\n * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent\n * calls to the debounced function return the result of the last func invocation.\n *\n * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only\n * if the the debounced function is invoked more than once during the wait timeout.\n *\n * See David Corbacho’s article for details over the differences between _.debounce and _.throttle.\n *\n * @param func The function to debounce.\n * @param wait The number of milliseconds to delay.\n * @param options The options object.\n * @return Returns the new debounced function.\n */\nexport function debounce<FnArgumentsType extends any[], FnReturnType>(\n\tfunc: (...args: FnArgumentsType) => FnReturnType,\n\toptions: DebounceSettings = {}\n): DebouncedFunc<FnArgumentsType, FnReturnType> {\n\tlet lastArgs: FnArgumentsType | undefined;\n\tlet result: FnReturnType | undefined;\n\tlet timerId: NodeJS.Timeout | undefined;\n\tlet lastCallTime: number | undefined;\n\tlet lastInvokeTime = 0;\n\n\tconst wait = options.wait ?? 0;\n\tconst maxWait = typeof options.maxWait === 'number' ? Math.max(options.maxWait, wait) : null;\n\n\tfunction invokeFunc(time: number) {\n\t\tconst args = lastArgs;\n\n\t\tlastArgs = undefined;\n\t\tlastInvokeTime = time;\n\t\tresult = func(...args!);\n\t\treturn result;\n\t}\n\n\tfunction leadingEdge(time: number) {\n\t\t// Reset any `maxWait` timer.\n\t\tlastInvokeTime = time;\n\t\t// Start the timer for the trailing edge.\n\t\ttimerId = setTimeout(timerExpired, wait);\n\t\t// Invoke the leading edge.\n\t\treturn result;\n\t}\n\n\tfunction remainingWait(time: number) {\n\t\tconst timeSinceLastCall = time - lastCallTime!;\n\t\tconst timeSinceLastInvoke = time - lastInvokeTime;\n\t\tconst result = wait - timeSinceLastCall;\n\n\t\treturn maxWait === null ? result : Math.min(result, maxWait - timeSinceLastInvoke);\n\t}\n\n\tfunction shouldInvoke(time: number) {\n\t\tconst timeSinceLastCall = time - lastCallTime!;\n\t\tconst timeSinceLastInvoke = time - lastInvokeTime;\n\n\t\t// Either this is the first call, activity has stopped and we're at the\n\t\t// trailing edge, the system time has gone backwards and we're treating\n\t\t// it as the trailing edge, or we've hit the `maxWait` limit.\n\t\treturn (\n\t\t\tlastCallTime === undefined || //\n\t\t\ttimeSinceLastCall >= wait ||\n\t\t\ttimeSinceLastCall < 0 ||\n\t\t\t(maxWait !== null && timeSinceLastInvoke >= maxWait)\n\t\t);\n\t}\n\n\tfunction timerExpired() {\n\t\tconst time = Date.now();\n\t\tif (shouldInvoke(time)) {\n\t\t\ttrailingEdge(time);\n\t\t\treturn;\n\t\t}\n\t\t// Restart the timer.\n\t\ttimerId = setTimeout(timerExpired, remainingWait(time));\n\t}\n\n\tfunction trailingEdge(time: number) {\n\t\ttimerId = undefined;\n\t\treturn invokeFunc(time);\n\t}\n\n\tfunction cancel() {\n\t\tif (timerId !== undefined) {\n\t\t\tclearTimeout(timerId);\n\t\t}\n\n\t\tlastInvokeTime = 0;\n\t\tlastArgs = undefined;\n\t\tlastCallTime = undefined;\n\t\ttimerId = undefined;\n\t}\n\n\tfunction flush() {\n\t\treturn timerId === undefined ? result : trailingEdge(Date.now());\n\t}\n\n\tfunction debounced(...args: FnArgumentsType) {\n\t\tconst time = Date.now();\n\t\tconst isInvoking = shouldInvoke(time);\n\n\t\tlastArgs = args;\n\t\tlastCallTime = time;\n\n\t\tif (isInvoking) {\n\t\t\tif (timerId === undefined) {\n\t\t\t\treturn leadingEdge(lastCallTime);\n\t\t\t}\n\t\t\tif (maxWait !== null) {\n\t\t\t\t// Handle invocations in a tight loop.\n\t\t\t\ttimerId = setTimeout(timerExpired, wait);\n\t\t\t\treturn invokeFunc(lastCallTime);\n\t\t\t}\n\t\t}\n\n\t\tif (timerId === undefined) {\n\t\t\ttimerId = setTimeout(timerExpired, wait);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tdebounced.cancel = cancel;\n\tdebounced.flush = flush;\n\n\treturn debounced;\n}\n","const primitiveTypes = ['string', 'bigint', 'number', 'boolean'];\n\n/**\n * Check whether a value is a primitive\n * @param input The input to check\n */\nexport function isPrimitive(input: unknown): input is string | bigint | number | boolean {\n\treturn primitiveTypes.includes(typeof input);\n}\n","import { isPrimitive } from './isPrimitive';\n\n/**\n * Deep clone an object\n * @param source The object to clone\n */\nexport function deepClone<T>(source: T): T {\n\t// Check if it's a primitive (with exception of function and null, which is typeof object)\n\tif (source === null || isPrimitive(source)) {\n\t\treturn source;\n\t}\n\n\tif (source instanceof Date) {\n\t\tconst output = new (source.constructor as DateConstructor)(source);\n\n\t\treturn output as unknown as T;\n\t}\n\n\tif (Array.isArray(source)) {\n\t\tconst output = new (source.constructor as ArrayConstructor)(source.length) as unknown as T & T extends (infer S)[] ? S[] : never;\n\n\t\tfor (let i = 0; i < source.length; i++) {\n\t\t\toutput[i] = deepClone(source[i]);\n\t\t}\n\n\t\treturn output as unknown as T;\n\t}\n\n\tif (source instanceof Map) {\n\t\tconst output = new (source.constructor as MapConstructor)() as unknown as T & T extends Map<infer K, infer V> ? Map<K, V> : never;\n\n\t\tfor (const [key, value] of source.entries()) {\n\t\t\toutput.set(key, deepClone(value));\n\t\t}\n\n\t\treturn output as unknown as T;\n\t}\n\n\tif (source instanceof Set) {\n\t\tconst output = new (source.constructor as SetConstructor)() as unknown as T & T extends Set<infer K> ? Set<K> : never;\n\n\t\tfor (const value of source.values()) {\n\t\t\toutput.add(deepClone(value));\n\t\t}\n\n\t\treturn output as unknown as T;\n\t}\n\n\tif (typeof source === 'object') {\n\t\tconst output = new ((source as T & (object | Record<PropertyKey, unknown>)).constructor as ObjectConstructor)() as unknown as Record<\n\t\t\tPropertyKey,\n\t\t\tunknown\n\t\t>;\n\n\t\tfor (const [key, value] of Object.entries(source)) {\n\t\t\tObject.defineProperty(output, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: deepClone(value),\n\t\t\t\twritable: true\n\t\t\t});\n\t\t}\n\n\t\treturn output as unknown as T;\n\t}\n\n\treturn source;\n}\n","import type { Nullish } from './utilityTypes';\n\n/**\n * Checks whether or not a value is `null` or `undefined`\n * @param value The value to check\n */\nexport function isNullOrUndefined(value: unknown): value is Nullish {\n\treturn value === undefined || value === null;\n}\n","import { isNullOrUndefined } from './isNullOrUndefined';\nimport type { Nullish } from './utilityTypes';\n\n/**\n * Checks whether a value is not `null` nor `undefined`.\n * This can be used in {@link Array.filter} to remove `null` and `undefined` from the array type\n * @param value The value to verify that is neither `null` nor `undefined`\n * @returns A boolean that is `true` if the value is neither `null` nor `undefined`, false otherwise.\n * @example\n * ```typescript\n * // TypeScript Type: (string | undefined | null)[]\n * const someArray = ['one', 'two', undefined, null, 'five'];\n *\n * // TypeScript Type: string[]\n * const filteredArray = someArray.filter(filterNullAndUndefined);\n * // Result: ['one', 'two', 'five']\n * ```\n */\nexport function filterNullAndUndefined<TValue>(value: TValue | Nullish): value is TValue {\n\treturn !isNullOrUndefined(value);\n}\n","import { isNullOrUndefined } from './isNullOrUndefined';\nimport type { Nullish } from './utilityTypes';\n\n/**\n * Checks whether or not a value is `null`, `undefined` or `''`, `[]`\n * @param value The value to check\n */\nexport function isNullOrUndefinedOrEmpty(value: unknown): value is Nullish | '' {\n\treturn isNullOrUndefined(value) || (value as string | unknown[]).length === 0;\n}\n","import { isNullOrUndefinedOrEmpty } from './isNullOrUndefinedOrEmpty';\nimport type { Nullish } from './utilityTypes';\n\n/**\n * Checks whether a value is not `null` nor `undefined` nor `''` (empty string).\n * This can be used in {@link Array.filter} to remove `null`, `undefined` from the array type\n * @param value The value to verify that is neither `null`, `undefined` nor `''` (empty string)\n * @returns A boolean that is `true` if the value is neither `null`, `undefined` nor `''` (empty string), false otherwise.\n * @example\n * ```typescript\n * // TypeScript Type: (string | undefined | null)[]\n * const someArray = ['one', 'two', undefined, null, ''];\n *\n * // TypeScript Type: string[]\n * const filteredArray = someArray.filter(filterNullAndUndefinedAndEmpty);\n * // Result: ['one', 'two']\n * ```\n */\nexport function filterNullAndUndefinedAndEmpty<TValue>(value: TValue | Nullish | ''): value is TValue {\n\treturn !isNullOrUndefinedOrEmpty(value);\n}\n","import { isNullOrUndefined } from './isNullOrUndefined';\nimport type { Nullish } from './utilityTypes';\n\n/**\n * Checks whether or not a value is `null`, `undefined` or `0`\n * @param value The value to check\n */\nexport function isNullOrUndefinedOrZero(value: unknown): value is Nullish | 0 {\n\treturn value === 0 || isNullOrUndefined(value);\n}\n","import { isNullOrUndefinedOrZero } from './isNullOrUndefinedOrZero';\nimport type { Nullish } from './utilityTypes';\n\n/**\n * Checks whether a value is not `null` nor `undefined` nor `0`.\n * This can be used in {@link Array.filter} to remove `null`, `undefined` from the array type\n * @param value The value to verify that is neither `null`, `undefined` nor `0`\n * @returns A boolean that is `true` if the value is neither `null`, `undefined` nor `0`, false otherwise.\n * @example\n * ```typescript\n * // TypeScript Type: (string | number | undefined | null)[]\n * const someArray = ['one', 'two', undefined, null, 0, 1];\n *\n * // TypeScript Type: (string | number)[]\n * const filteredArray = someArray.filter(filterNullAndUndefinedAndZero);\n * // Result: ['one', 'two', 1]\n * ```\n */\nexport function filterNullAndUndefinedAndZero<TValue>(value: TValue | Nullish | 0): value is TValue {\n\treturn !isNullOrUndefinedOrZero(value);\n}\n","import { isNullOrUndefinedOrEmpty } from './isNullOrUndefinedOrEmpty';\nimport type { AnyObject } from './utilityTypes';\n\n/**\n * Flattens an object to a list of its keys, traversing deeply into nested objects and arrays of objects.\n *\n * @note By default Nested array values are flattened to `arrayKey.${index}.subKey`.\n * This can be changed to `arrayKey[${index}].subKey` by setting `options.arrayKeysIndexStyle` to `'braces-with-dot'`.\n * Or it can also be changed to `arrayKey[${index}]subKey` by setting `options.arrayKeysIndexStyle` to `'braces'`.\n *\n * @param obj The object of which to deeply retrieve its keys\n * @param options The options with which to customize the output of this function\n * @returns An array of strings holding the keys of the object\n */\nexport function getDeepObjectKeys<T>(obj: AnyObject<T>, options?: GetDeepObjectKeysOptions): string[] {\n\treturn [...getDeepObjectKeysGenerator(obj, options)];\n}\n\nfunction* getDeepObjectKeysGenerator<T>(\n\tobj: AnyObject<T>,\n\t{ arrayKeysIndexStyle = 'dotted' }: GetDeepObjectKeysOptions = { arrayKeysIndexStyle: 'dotted' }\n): Generator<string> {\n\tif (Array.isArray(obj)) {\n\t\tfor (const [index, value] of obj.entries()) {\n\t\t\tyield* getDeepArrayKeysRecursive(value, index, { arrayKeysIndexStyle });\n\t\t}\n\t} else {\n\t\tfor (const [key, value] of Object.entries(obj)) {\n\t\t\tyield* getDeepObjectKeysRecursive(value, `${key}`, { arrayKeysIndexStyle });\n\t\t}\n\t}\n}\n\nfunction* getDeepArrayKeysRecursive(value: unknown, index: number, { arrayKeysIndexStyle }: GetDeepObjectKeysOptions): Generator<string> {\n\tconst resolvedIndex = arrayKeysIndexStyle === 'dotted' ? `${index}` : arrayKeysIndexStyle === 'braces' ? `[${index}]` : `[${index}].`;\n\tyield* getDeepObjectKeysRecursive(value, resolvedIndex, { arrayKeysIndexStyle });\n}\n\nfunction* getDeepObjectKeysRecursive(obj: unknown, prefix: string, { arrayKeysIndexStyle }: GetDeepObjectKeysOptions): Generator<string> {\n\tif (typeof obj !== 'object' || obj === null) {\n\t\tyield prefix;\n\t\treturn;\n\t}\n\n\tif (Array.isArray(obj)) {\n\t\tfor (const [index, value] of obj.entries()) {\n\t\t\tconst resolvedPrefixedIndex = arrayKeysIndexStyle === 'dotted' ? `${prefix}.${index}` : `${prefix}[${index}]`;\n\n\t\t\tyield* getDeepObjectKeysRecursive(value, resolvedPrefixedIndex, { arrayKeysIndexStyle });\n\t\t}\n\t} else {\n\t\tconst objectEntries = Object.entries(obj);\n\t\tif (isNullOrUndefinedOrEmpty(objectEntries) && prefix) {\n\t\t\tyield prefix;\n\t\t} else {\n\t\t\tfor (const [key, value] of objectEntries) {\n\t\t\t\tyield* getDeepObjectKeysRecursive(value, arrayKeysIndexStyle === 'braces' ? `${prefix}${key}` : `${prefix}.${key}`, {\n\t\t\t\t\tarrayKeysIndexStyle\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * The options for {@link getDeepObjectKeys}\n */\nexport interface GetDeepObjectKeysOptions {\n\t/**\n\t * Whether to use `.${index}.` (`'dotted'`), `[${index}].`, (`'braces-with-dot'`) or `[${index}]` (`'braces'`) to separate array keys\n\t * @default 'dotted'\n\t */\n\tarrayKeysIndexStyle?: 'dotted' | 'braces-with-dot' | 'braces';\n}\n","/**\n * Checks whether any of the {@link keys} are in the {@link map}\n * @param map The map to check\n * @param keys The keys to find in the map\n * @returns `true` if at least one of the {@link keys} is in the {@link map}, `false` otherwise.\n */\nexport function hasAtLeastOneKeyInMap<T>(map: ReadonlyMap<T, any>, keys: readonly T[]): boolean {\n\treturn keys.some((key) => map.has(key));\n}\n","const zws = String.fromCharCode(8203);\n\n/**\n * Wraps text in a markdown inline codeblock\n * @param expression The expression to be wrapped in the codeblock\n */\nexport function inlineCodeBlock(input: string): string {\n\treturn `\\`${input.replace(/ /g, '\\u00A0').replace(/`/g, `\\`${zws}`)}\\``;\n}\n","import type { Ctor } from './utilityTypes';\n\n/**\n * Verify if the input is a class constructor.\n * @param input The function to verify\n */\nexport function isClass(input: unknown): input is Ctor {\n\treturn typeof input === 'function' && typeof input.prototype === 'object';\n}\n","/**\n * Verify if the input is a function.\n * @param input The function to verify\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isFunction(input: unknown): input is Function {\n\treturn typeof input === 'function';\n}\n","/**\n * Verify if a number is a finite number.\n * @param input The number to verify\n */\nexport function isNumber(input: unknown): input is number {\n\tif (typeof input === 'string') input = Number(input);\n\treturn typeof input === 'number' && !Number.isNaN(input) && Number.isFinite(input);\n}\n","import type { Constructor, NonNullObject } from './utilityTypes';\n\n/**\n * Verify if the input is an object literal (or class).\n * @param input The object to verify\n * @param constructorType The type of the constructor of the object. Use this if you want a `class` of your choosing to pass the check as well.\n */\nexport function isObject(input: unknown, constructorType?: ObjectConstructor): input is NonNullObject;\nexport function isObject<T extends Constructor<unknown>>(input: unknown, constructorType: T): input is InstanceType<T>;\nexport function isObject<T extends Constructor<unknown> = ObjectConstructor>(input: unknown, constructorType?: T): input is NonNullObject {\n\treturn typeof input === 'object' && input ? input.constructor === (constructorType ?? Object) : false;\n}\n","/* eslint-disable @typescript-eslint/ban-types */\nimport { isFunction } from './isFunction';\n\nexport interface Thenable {\n\tthen: Function;\n\tcatch: Function;\n}\n\nfunction hasThen(input: { then?: Function }): boolean {\n\treturn Reflect.has(input, 'then') && isFunction(input.then);\n}\n\nfunction hasCatch(input: { catch?: Function }): boolean {\n\treturn Reflect.has(input, 'catch') && isFunction(input.catch);\n}\n\n/**\n * Verify if an object is a promise.\n * @param input The promise to verify\n */\nexport function isThenable(input: unknown): input is Thenable {\n\tif (typeof input !== 'object' || input === null) return false;\n\treturn input instanceof Promise || (input !== Promise.prototype && hasThen(input) && hasCatch(input));\n}\n","/**\n * Lazily creates a constant or load a module and caches it internally\n * @param cb The callback to lazily run\n * @returns The value returned by the callback, or the cached value if it was already initialised once.\n */\nexport function lazy<T>(cb: () => T) {\n\tlet defaultValue: T;\n\n\treturn () => (defaultValue ??= cb());\n}\n","/**\n * Turn a dotted path into a json object.\n * @param path The dotted path\n * @param value The value\n * @param obj The object to edit\n */\nexport function makeObject(path: string, value: unknown, obj: Record<string, unknown> = {}): Record<string, unknown> {\n\tif (path.includes('.')) {\n\t\tconst route = path.split('.');\n\t\tconst lastKey = route.pop() as string;\n\t\tlet reference = obj;\n\t\tfor (const key of route) {\n\t\t\tif (!reference[key]) reference[key] = {};\n\t\t\treference = reference[key] as Record<string, unknown>;\n\t\t}\n\t\treference[lastKey] = value;\n\t} else {\n\t\tobj[path] = value;\n\t}\n\treturn obj;\n}\n","import { deepClone } from './deepClone';\nimport { isObject } from './isObject';\nimport type { DeepRequired, NonNullObject } from './utilityTypes';\n\n/**\n * Deep merges 2 objects. Properties from the second parameter are applied to the first.\n * @remark `overwrites` is also mutated!\n * @remark If the value of a key in `overwrites` is `undefined` then the value of that same key in `base` is used instead!\n * @remark This is essentially `{ ...base, ...overwrites }` but recursively\n * @param base Base object\n * @param overwrites Overwrites to apply\n * @example\n * ```typescript\n * const base = { a: 0, b: 1 };\n * const overwrites = {}; // will be { a: 0, b: 1 } after merge\n * mergeDefault(base, overwrites) // { a: 0, b: 1 }\n * ```\n * @example\n * ```typescript\n * const base = { a: 0, b: 1 };\n * const overwrites = { a: 2, i: 3 };\n * mergeDefault(base, overwrites) // { a: 2, i: 3, b: 1 };\n * ```\n * @example\n * ```typescript\n * const base = { a: 0, b: 1 };\n * const overwrites = { a: null };\n * mergeDefault(base, overwrites) // { a: null, b: 1 };\n * ```\n * @example\n * ```typescript\n * const base = { a: 0, b: 1 };\n * const overwrites = { a: undefined };\n * mergeDefault(base, overwrites) // { a: 0, b: 1 };\n * ```\n * @example\n * ```typescript\n * const base = { a: null };\n * const overwrites = { a: { b: 5 } };\n * mergeDefault(base, overwrites) // { a: { b: 5 } };\n * ```\n */\nexport function mergeDefault<A extends NonNullObject, B extends Partial<A>>(base: A, overwrites?: B): DeepRequired<A & B> {\n\t// If no overwrites are specified then deep clone the base\n\tif (!overwrites) return deepClone(base) as DeepRequired<A & B>;\n\n\tfor (const [baseKey, baseValue] of Object.entries(base)) {\n\t\tconst overwritesValueAtBaseKey = Reflect.get(overwrites, baseKey);\n\n\t\tif (typeof overwritesValueAtBaseKey === 'undefined') {\n\t\t\tReflect.set(overwrites, baseKey, deepClone(baseValue));\n\t\t} else if (isObject(overwritesValueAtBaseKey)) {\n\t\t\tReflect.set(overwrites, baseKey, mergeDefault((baseValue ?? {}) as NonNullObject, overwritesValueAtBaseKey));\n\t\t}\n\t}\n\n\treturn overwrites as DeepRequired<A & B>;\n}\n","/* eslint-disable @typescript-eslint/ban-types */\nimport { isObject } from './isObject';\n\n/**\n * Merges two objects\n * @param objTarget The object to be merged\n * @param objSource The object to merge\n */\nexport function mergeObjects<A extends object, B extends object>(objTarget: A, objSource: Readonly<B>): A & B {\n\tfor (const [key, value] of Object.entries(objSource)) {\n\t\tconst targetValue = Reflect.get(objTarget, key);\n\t\tif (isObject(value)) {\n\t\t\tReflect.set(objTarget, key, isObject(targetValue) ? mergeObjects(targetValue, value as object) : value);\n\t\t} else if (!isObject(targetValue)) {\n\t\t\tReflect.set(objTarget, key, value);\n\t\t}\n\t}\n\n\treturn objTarget as A & B;\n}\n","// eslint-disable-next-line @typescript-eslint/no-empty-function\nexport function noop() {}\n","import { isObject } from './isObject';\nimport type { AnyObject } from './utilityTypes';\n\n/**\n * Convert an object to a tuple\n * @param obj The object to convert\n * @param prefix The prefix for the key\n */\nexport function objectToTuples<T>(obj: AnyObject<T>, prefix = ''): [keyof T, T[keyof T]][] {\n\tconst entries: [keyof T, T[keyof T]][] = [];\n\n\tfor (const [key, value] of Object.entries(obj)) {\n\t\tif (isObject(value)) {\n\t\t\tentries.push(...objectToTuples(value, `${prefix}${key}.`));\n\t\t} else {\n\t\t\tentries.push([`${prefix}${key}` as keyof T, value as T[keyof T]]);\n\t\t}\n\t}\n\n\treturn entries;\n}\n","import type { URL } from 'node:url';\n\n/**\n * Parses an URL, returns null if invalid.\n * @param url The url to parse\n */\nexport function parseURL(url: string): URL | null {\n\ttry {\n\t\t// @ts-expect-error URL is global in NodeJS and evergreen Browsers\n\t\treturn new URL(url);\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import { isFunction } from './isFunction';\n\n/**\n * Partitions `array` into a tuple of two arrays,\n * where one array contains all elements that satisfies `predicate`,\n * and the other contains all elements that do not satisfy `predicate`.\n * @param array The array to partition. This array is not mutated.\n * @param predicate The predicate function to determine in which partition the item should be placed.\n * The function should return true for items that should be placed in the first partition, and false for those that should be placed in the second partition.\n * @returns A tuple of two arrays.\n */\nexport function partition<T>(array: T[], predicate: (value: T, index: number) => boolean) {\n\tif (!Array.isArray(array)) throw new TypeError('entries must be an array.');\n\tif (!isFunction(predicate)) throw new TypeError('predicate must be an function that returns a boolean value.');\n\n\tconst partitionOne: T[] = [];\n\tconst partitionTwo: T[] = [];\n\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (predicate(array[i], i)) {\n\t\t\tpartitionOne.push(array[i]);\n\t\t} else {\n\t\t\tpartitionTwo.push(array[i]);\n\t\t}\n\t}\n\n\treturn [partitionOne, partitionTwo];\n}\n","/**\n * Get an array of numbers with the selected range\n * @param min The minimum value\n * @param max The maximum value\n * @param step The step value\n */\nexport function range(min: number, max: number, step: number): number[] {\n\treturn new Array(Math.floor((max - min) / step) + 1).fill(0).map((_val, i) => min + i * step);\n}\n","// eslint-disable-next-line @typescript-eslint/naming-convention\nconst REGEXPESC = /[-/\\\\^$*+?.()|[\\]{}]/g;\n\n/**\n * Cleans a string from regex injection\n * @param str The string to clean\n */\nexport function regExpEsc(str: string): string {\n\treturn str.replace(REGEXPESC, '\\\\$&');\n}\n","/**\n * Properly rounds up or down a number.\n * Also supports strings using an exponent to indicate large or small numbers.\n * @param num The number to round off\n * @param scale The amount of decimals to retain\n */\nexport function roundNumber(num: number | string, scale = 0) {\n\tif (!num.toString().includes('e')) {\n\t\treturn Number(`${Math.round(Number(`${num}e+${scale}`))}e-${scale}`);\n\t}\n\tconst arr = `${num}`.split('e');\n\tlet sig = '';\n\n\tif (Number(arr[1]) + scale > 0) {\n\t\tsig = '+';\n\t}\n\n\treturn Number(`${Math.round(Number(`${Number(arr[0])}e${sig}${Number(arr[1]) + scale}`))}e-${scale}`);\n}\n","const TO_TITLE_CASE = /[A-Za-zÀ-ÖØ-öø-ÿ]\\S*/g;\n\n/**\n * The variants that will not strictly follow the `toTitleCase` algorithm\n * and will instead return the value matched with the key.\n *\n * This table lists how certain terms are converted.\n * Any terms not included are converted to regular `Titlecase`.\n * | Term | Converted To |\n * |:---------------- |:---------------- |\n * | textchannel | TextChannel |\n * | voicechannel | VoiceChannel |\n * | categorychannel | CategoryChannel |\n * | guildmember | GuildMember |\n */\nexport const baseVariants: Record<string, string> = {\n\ttextchannel: 'TextChannel',\n\tvoicechannel: 'VoiceChannel',\n\tcategorychannel: 'CategoryChannel',\n\tguildmember: 'GuildMember'\n};\n\n/**\n * Converts a string to Title Case\n *\n * @description This is designed to also ensure common Discord PascalCased strings\n * are put in their TitleCase {@link baseVariants}.\n *\n * You can also provide your own variants to merge with the {@link baseVariants} for\n * your own functionality use.\n *\n * @param str The string to title case\n * @param options The options to use when converting the string\n */\nexport function toTitleCase(str: string, options: ToTitleCaseOptions = {}): string {\n\tconst { additionalVariants = {}, caseSensitive } = options;\n\tconst titleCaseVariants = {\n\t\t...baseVariants,\n\t\t...(caseSensitive\n\t\t\t? additionalVariants\n\t\t\t: Object.entries(additionalVariants).reduce<Record<string, string>>(\n\t\t\t\t\t(variants, [key, variant]) => ({ ...variants, [key.toLowerCase()]: variant }),\n\t\t\t\t\t{}\n\t\t\t ))\n\t};\n\n\treturn str.replace(\n\t\tTO_TITLE_CASE,\n\t\t(txt) => titleCaseVariants[caseSensitive ? txt : txt.toLowerCase()] ?? txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase()\n\t);\n}\n\n/**\n * The options to use when converting a string to title case\n */\nexport interface ToTitleCaseOptions {\n\t/**\n\t * The optional additional variants to use when converting the string\n\t */\n\tadditionalVariants?: Record<string, string>;\n\n\t/**\n\t * Whether to convert the string to title case in a case sensitive manner.\n\t */\n\tcaseSensitive?: boolean;\n}\n","/* eslint-disable @typescript-eslint/ban-types */\n/**\n * Try parse a stringified JSON string.\n * @param value The value to parse\n */\nexport function tryParse(value: string): object | string {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch (err) {\n\t\treturn value;\n\t}\n}\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { range } from '@sapphire/utilities';\nimport { allowedNum, cronTokens, partRegex, predefined, Time, tokensRegex, wildcardRegex } from './constants';\n\n/**\n * Handles Cron strings and generates dates based on the cron string provided.\n * @see https://en.wikipedia.org/wiki/Cron\n */\nexport class Cron {\n\tpublic cron: string;\n\tpublic normalized: string;\n\tpublic minutes: number[];\n\tpublic hours: number[];\n\tpublic days: number[];\n\tpublic months: number[];\n\tpublic dows: number[];\n\n\t/**\n\t * @param cron The cron pattern to use\n\t */\n\tpublic constructor(cron: string) {\n\t\tthis.cron = cron.toLowerCase();\n\t\tthis.normalized = Cron.normalize(this.cron);\n\t\t[this.minutes, this.hours, this.days, this.months, this.dows] = Cron.parseString(this.normalized);\n\t}\n\n\t/**\n\t * Get the next date that matches with the current pattern\n\t * @param outset The Date instance to compare with\n\t * @param origin Whether this next call is origin\n\t */\n\tpublic next(outset: Date = new Date(), origin = true): Date {\n\t\tif (!this.days.includes(outset.getUTCDate()) || !this.months.includes(outset.getUTCMonth() + 1) || !this.dows.includes(outset.getUTCDay())) {\n\t\t\treturn this.next(new Date(outset.getTime() + Time.Day), false);\n\t\t}\n\t\tif (!origin) return new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), this.hours[0], this.minutes[0]));\n\n\t\tconst now = new Date(outset.getTime() + 60000);\n\n\t\tfor (const hour of this.hours) {\n\t\t\tif (hour < now.getUTCHours()) continue;\n\t\t\tfor (const minute of this.minutes) {\n\t\t\t\tif (hour === now.getUTCHours() && minute < now.getUTCMinutes()) continue;\n\t\t\t\treturn new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), hour, minute));\n\t\t\t}\n\t\t}\n\n\t\treturn this.next(new Date(outset.getTime() + Time.Day), false);\n\t}\n\n\t/**\n\t * Normalize the pattern\n\t * @param cron The pattern to normalize\n\t */\n\tprivate static normalize(cron: string): string {\n\t\tif (Reflect.has(predefined, cron)) return Reflect.get(predefined, cron);\n\t\tconst now = new Date();\n\t\tcron = cron\n\t\t\t.split(' ')\n\t\t\t.map((val, i) =>\n\t\t\t\tval.replace(wildcardRegex, (match) => {\n\t\t\t\t\tif (match === 'h') return (Math.floor(Math.random() * allowedNum[i][1]) + allowedNum[i][0]).toString();\n\n\t\t\t\t\tif (match === '?') {\n\t\t\t\t\t\tswitch (i) {\n\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\treturn now.getUTCMinutes().toString();\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\treturn now.getUTCHours().toString();\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\treturn now.getUTCDate().toString();\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\treturn now.getUTCMonth().toString();\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\treturn now.getUTCDay().toString();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn match;\n\t\t\t\t})\n\t\t\t)\n\t\t\t.join(' ');\n\t\treturn cron.replace(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));\n\t}\n\n\t/**\n\t * Parse the pattern\n\t * @param cron The pattern to parse\n\t */\n\tprivate static parseString(cron: string): Array<number[]> {\n\t\tconst parts = cron.split(' ');\n\t\tif (parts.length !== 5) throw new Error('Invalid Cron Provided');\n\t\treturn parts.map((part, i) => Cron.parsePart(part, i));\n\t}\n\n\t/**\n\t * Parse the current part\n\t * @param cronPart The part of the pattern to parse\n\t * @param id The id that identifies the current part\n\t */\n\tprivate static parsePart(cronPart: string, id: number): number[] {\n\t\tif (cronPart.includes(',')) {\n\t\t\tconst res: number[] = [];\n\t\t\tfor (const part of cronPart.split(',')) res.push(...Cron.parsePart(part, id));\n\t\t\treturn [...new Set(res)].sort((a, b) => a - b);\n\t\t}\n\n\t\t// eslint-disable-next-line prefer-const\n\t\tconst [, wild, minStr, maxStr, step] = partRegex.exec(cronPart)!;\n\t\tlet [min, max] = [parseInt(minStr, 10), parseInt(maxStr, 10)];\n\n\t\t// If '*', set min and max as the minimum and maximum allowed numbers:\n\t\tif (wild) [min, max] = allowedNum[id];\n\t\t// Else if a number was given, but not a maximum nor a step, return it\n\t\t// as only allowed value:\n\t\telse if (!max && !step) return [min];\n\n\t\t// Set min and max as the given numbers, defaulting max to the maximum\n\t\t// allowed, so min is never bigger than max:\n\t\t// This makes min and max be, in the following cases (considering minutes):\n\t\t// -> 1-2 | 1..2\n\t\t// -> 2-1 | 1..2\n\t\t// -> 1/7 | 1, 8, 15, 22, 29, 36, 43, 50, 57\n\t\t[min, max] = [min, max || allowedNum[id][1]].sort((a, b) => a - b);\n\n\t\t// Generate a range\n\t\treturn range(min, max, parseInt(step, 10) || 1);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,MAAK,OAAL,kBAAKA,UAAL;AACN,IAAAA,YAAA,iBAAc,KAAd;AACA,IAAAA,YAAA,YAAS,OAAT;AACA,IAAAA,YAAA,YAAS,OAAT;AACA,IAAAA,YAAA,UAAO,QAAP;AACA,IAAAA,YAAA,SAAM,SAAN;AACA,IAAAA,YAAA,WAAQ,UAAR;AACA,IAAAA,YAAA,UAAO,WAAP;AAPW,WAAAA;AAAA,KAAA;AAUL,MAAM,YAAY;AAElB,MAAM,gBAAgB;AAEtB,MAAM,aAAa;AAAA,IACzB,CAAC,GAAG,EAAE;AAAA,IACN,CAAC,GAAG,EAAE;AAAA,IACN,CAAC,GAAG,EAAE;AAAA,IACN,CAAC,GAAG,EAAE;AAAA,IACN,CAAC,GAAG,CAAC;AAAA,EACN;AAEO,MAAM,aAAa;AAAA,IACzB,aAAa;AAAA,IACb,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,EACZ;AAEO,MAAM,aAAa;AAAA,IACzB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,I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AAI,MAAM,uBAAuB;AAC/D,aAAO,MAAM,IAAI,CAAC,MAAM,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,IACtD;AAAA,IAOA,OAAe,UAAU,UAAkB,IAAsB;AAChE,UAAI,SAAS,SAAS,GAAG,GAAG;AAC3B,cAAM,MAAgB,CAAC;AACvB,mBAAW,QAAQ,SAAS,MAAM,GAAG;AAAG,cAAI,KAAK,GAAG,KAAK,UAAU,MAAM,EAAE,CAAC;AAC5E,eAAO,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,MAC9C;AAGA,YAAM,CAAC,EAAE,MAAM,QAAQ,QAAQ,IAAI,IAAI,UAAU,KAAK,QAAQ;AAC9D,UAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,CAAC;AAG5D,UAAI;AAAM,SAAC,KAAK,GAAG,IAAI,WAAW;AAAA,eAGzB,CAAC,OAAO,CAAC;AAAM,eAAO,CAAC,GAAG;AAQnC,OAAC,KAAK,GAAG,IAAI,CAAC,KAAK,OAAO,WAAW,IAAI,EAAE,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAGjE,aAAO,MAAM,KAAK,KAAK,SAAS,MAAM,EAAE,KAAK,CAAC;AAAA,IAC/C;AAAA,EACD;AAxHa;","names":["Time","__name","result","zws"]}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/index.ts
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
Cron: () => Cron,
|
|
31
|
+
Time: () => Time,
|
|
32
|
+
allowedNum: () => allowedNum,
|
|
33
|
+
cronTokens: () => cronTokens,
|
|
34
|
+
partRegex: () => partRegex,
|
|
35
|
+
predefined: () => predefined,
|
|
36
|
+
tokensRegex: () => tokensRegex,
|
|
37
|
+
wildcardRegex: () => wildcardRegex
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(src_exports);
|
|
40
|
+
|
|
41
|
+
// src/lib/constants.ts
|
|
42
|
+
var Time = /* @__PURE__ */ ((Time2) => {
|
|
43
|
+
Time2[Time2["Millisecond"] = 1] = "Millisecond";
|
|
44
|
+
Time2[Time2["Second"] = 1e3] = "Second";
|
|
45
|
+
Time2[Time2["Minute"] = 6e4] = "Minute";
|
|
46
|
+
Time2[Time2["Hour"] = 36e5] = "Hour";
|
|
47
|
+
Time2[Time2["Day"] = 864e5] = "Day";
|
|
48
|
+
Time2[Time2["Month"] = 2628e6] = "Month";
|
|
49
|
+
Time2[Time2["Year"] = 31536e6] = "Year";
|
|
50
|
+
return Time2;
|
|
51
|
+
})(Time || {});
|
|
52
|
+
var partRegex = /^(?:(\*)|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/;
|
|
53
|
+
var wildcardRegex = /\bh\b|\B\?\B/g;
|
|
54
|
+
var allowedNum = [
|
|
55
|
+
[0, 59],
|
|
56
|
+
[0, 23],
|
|
57
|
+
[1, 31],
|
|
58
|
+
[1, 12],
|
|
59
|
+
[0, 6]
|
|
60
|
+
];
|
|
61
|
+
var predefined = {
|
|
62
|
+
"@annually": "0 0 1 1 *",
|
|
63
|
+
"@yearly": "0 0 1 1 *",
|
|
64
|
+
"@monthly": "0 0 1 * *",
|
|
65
|
+
"@weekly": "0 0 * * 0",
|
|
66
|
+
"@daily": "0 0 * * *",
|
|
67
|
+
"@hourly": "0 * * * *"
|
|
68
|
+
};
|
|
69
|
+
var cronTokens = {
|
|
70
|
+
jan: 1,
|
|
71
|
+
feb: 2,
|
|
72
|
+
mar: 3,
|
|
73
|
+
apr: 4,
|
|
74
|
+
may: 5,
|
|
75
|
+
jun: 6,
|
|
76
|
+
jul: 7,
|
|
77
|
+
aug: 8,
|
|
78
|
+
sep: 9,
|
|
79
|
+
oct: 10,
|
|
80
|
+
nov: 11,
|
|
81
|
+
dec: 12,
|
|
82
|
+
sun: 0,
|
|
83
|
+
mon: 1,
|
|
84
|
+
tue: 2,
|
|
85
|
+
wed: 3,
|
|
86
|
+
thu: 4,
|
|
87
|
+
fri: 5,
|
|
88
|
+
sat: 6
|
|
89
|
+
};
|
|
90
|
+
var tokensRegex = new RegExp(Object.keys(cronTokens).join("|"), "g");
|
|
91
|
+
|
|
92
|
+
// src/lib/Cron.ts
|
|
93
|
+
var import_utilities = require("@sapphire/utilities");
|
|
94
|
+
var Cron = class {
|
|
95
|
+
constructor(cron) {
|
|
96
|
+
__publicField(this, "cron");
|
|
97
|
+
__publicField(this, "normalized");
|
|
98
|
+
__publicField(this, "minutes");
|
|
99
|
+
__publicField(this, "hours");
|
|
100
|
+
__publicField(this, "days");
|
|
101
|
+
__publicField(this, "months");
|
|
102
|
+
__publicField(this, "dows");
|
|
103
|
+
this.cron = cron.toLowerCase();
|
|
104
|
+
this.normalized = Cron.normalize(this.cron);
|
|
105
|
+
[this.minutes, this.hours, this.days, this.months, this.dows] = Cron.parseString(this.normalized);
|
|
106
|
+
}
|
|
107
|
+
next(outset = new Date(), origin = true) {
|
|
108
|
+
if (!this.days.includes(outset.getUTCDate()) || !this.months.includes(outset.getUTCMonth() + 1) || !this.dows.includes(outset.getUTCDay())) {
|
|
109
|
+
return this.next(new Date(outset.getTime() + 864e5 /* Day */), false);
|
|
110
|
+
}
|
|
111
|
+
if (!origin)
|
|
112
|
+
return new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), this.hours[0], this.minutes[0]));
|
|
113
|
+
const now = new Date(outset.getTime() + 6e4);
|
|
114
|
+
for (const hour of this.hours) {
|
|
115
|
+
if (hour < now.getUTCHours())
|
|
116
|
+
continue;
|
|
117
|
+
for (const minute of this.minutes) {
|
|
118
|
+
if (hour === now.getUTCHours() && minute < now.getUTCMinutes())
|
|
119
|
+
continue;
|
|
120
|
+
return new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), hour, minute));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return this.next(new Date(outset.getTime() + 864e5 /* Day */), false);
|
|
124
|
+
}
|
|
125
|
+
static normalize(cron) {
|
|
126
|
+
if (Reflect.has(predefined, cron))
|
|
127
|
+
return Reflect.get(predefined, cron);
|
|
128
|
+
const now = new Date();
|
|
129
|
+
cron = cron.split(" ").map(
|
|
130
|
+
(val, i) => val.replace(wildcardRegex, (match) => {
|
|
131
|
+
if (match === "h")
|
|
132
|
+
return (Math.floor(Math.random() * allowedNum[i][1]) + allowedNum[i][0]).toString();
|
|
133
|
+
if (match === "?") {
|
|
134
|
+
switch (i) {
|
|
135
|
+
case 0:
|
|
136
|
+
return now.getUTCMinutes().toString();
|
|
137
|
+
case 1:
|
|
138
|
+
return now.getUTCHours().toString();
|
|
139
|
+
case 2:
|
|
140
|
+
return now.getUTCDate().toString();
|
|
141
|
+
case 3:
|
|
142
|
+
return now.getUTCMonth().toString();
|
|
143
|
+
case 4:
|
|
144
|
+
return now.getUTCDay().toString();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return match;
|
|
148
|
+
})
|
|
149
|
+
).join(" ");
|
|
150
|
+
return cron.replace(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));
|
|
151
|
+
}
|
|
152
|
+
static parseString(cron) {
|
|
153
|
+
const parts = cron.split(" ");
|
|
154
|
+
if (parts.length !== 5)
|
|
155
|
+
throw new Error("Invalid Cron Provided");
|
|
156
|
+
return parts.map((part, i) => Cron.parsePart(part, i));
|
|
157
|
+
}
|
|
158
|
+
static parsePart(cronPart, id) {
|
|
159
|
+
if (cronPart.includes(",")) {
|
|
160
|
+
const res = [];
|
|
161
|
+
for (const part of cronPart.split(","))
|
|
162
|
+
res.push(...Cron.parsePart(part, id));
|
|
163
|
+
return [...new Set(res)].sort((a, b) => a - b);
|
|
164
|
+
}
|
|
165
|
+
const [, wild, minStr, maxStr, step] = partRegex.exec(cronPart);
|
|
166
|
+
let [min, max] = [parseInt(minStr, 10), parseInt(maxStr, 10)];
|
|
167
|
+
if (wild)
|
|
168
|
+
[min, max] = allowedNum[id];
|
|
169
|
+
else if (!max && !step)
|
|
170
|
+
return [min];
|
|
171
|
+
[min, max] = [min, max || allowedNum[id][1]].sort((a, b) => a - b);
|
|
172
|
+
return (0, import_utilities.range)(min, max, parseInt(step, 10) || 1);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
__name(Cron, "Cron");
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
Cron,
|
|
179
|
+
Time,
|
|
180
|
+
allowedNum,
|
|
181
|
+
cronTokens,
|
|
182
|
+
partRegex,
|
|
183
|
+
predefined,
|
|
184
|
+
tokensRegex,
|
|
185
|
+
wildcardRegex
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/lib/constants.ts","../src/lib/Cron.ts"],"sourcesContent":["export * from './lib/constants';\nexport * from './lib/Cron';\n","export enum Time {\n\tMillisecond = 1,\n\tSecond = 1000,\n\tMinute = 1000 * 60,\n\tHour = 1000 * 60 * 60,\n\tDay = 1000 * 60 * 60 * 24,\n\tMonth = 1000 * 60 * 60 * 24 * (365 / 12),\n\tYear = 1000 * 60 * 60 * 24 * 365\n}\n\nexport const partRegex = /^(?:(\\*)|(\\d+)(?:-(\\d+))?)(?:\\/(\\d+))?$/;\n\nexport const wildcardRegex = /\\bh\\b|\\B\\?\\B/g;\n\nexport const allowedNum = [\n\t[0, 59],\n\t[0, 23],\n\t[1, 31],\n\t[1, 12],\n\t[0, 6]\n];\n\nexport const predefined = {\n\t'@annually': '0 0 1 1 *',\n\t'@yearly': '0 0 1 1 *',\n\t'@monthly': '0 0 1 * *',\n\t'@weekly': '0 0 * * 0',\n\t'@daily': '0 0 * * *',\n\t'@hourly': '0 * * * *'\n} as const;\n\nexport const cronTokens = {\n\tjan: 1,\n\tfeb: 2,\n\tmar: 3,\n\tapr: 4,\n\tmay: 5,\n\tjun: 6,\n\tjul: 7,\n\taug: 8,\n\tsep: 9,\n\toct: 10,\n\tnov: 11,\n\tdec: 12,\n\tsun: 0,\n\tmon: 1,\n\ttue: 2,\n\twed: 3,\n\tthu: 4,\n\tfri: 5,\n\tsat: 6\n} as const;\n\nexport const tokensRegex = new RegExp(Object.keys(cronTokens).join('|'), 'g');\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { range } from '@sapphire/utilities';\nimport { allowedNum, cronTokens, partRegex, predefined, Time, tokensRegex, wildcardRegex } from './constants';\n\n/**\n * Handles Cron strings and generates dates based on the cron string provided.\n * @see https://en.wikipedia.org/wiki/Cron\n */\nexport class Cron {\n\tpublic cron: string;\n\tpublic normalized: string;\n\tpublic minutes: number[];\n\tpublic hours: number[];\n\tpublic days: number[];\n\tpublic months: number[];\n\tpublic dows: number[];\n\n\t/**\n\t * @param cron The cron pattern to use\n\t */\n\tpublic constructor(cron: string) {\n\t\tthis.cron = cron.toLowerCase();\n\t\tthis.normalized = Cron.normalize(this.cron);\n\t\t[this.minutes, this.hours, this.days, this.months, this.dows] = Cron.parseString(this.normalized);\n\t}\n\n\t/**\n\t * Get the next date that matches with the current pattern\n\t * @param outset The Date instance to compare with\n\t * @param origin Whether this next call is origin\n\t */\n\tpublic next(outset: Date = new Date(), origin = true): Date {\n\t\tif (!this.days.includes(outset.getUTCDate()) || !this.months.includes(outset.getUTCMonth() + 1) || !this.dows.includes(outset.getUTCDay())) {\n\t\t\treturn this.next(new Date(outset.getTime() + Time.Day), false);\n\t\t}\n\t\tif (!origin) return new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), this.hours[0], this.minutes[0]));\n\n\t\tconst now = new Date(outset.getTime() + 60000);\n\n\t\tfor (const hour of this.hours) {\n\t\t\tif (hour < now.getUTCHours()) continue;\n\t\t\tfor (const minute of this.minutes) {\n\t\t\t\tif (hour === now.getUTCHours() && minute < now.getUTCMinutes()) continue;\n\t\t\t\treturn new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), hour, minute));\n\t\t\t}\n\t\t}\n\n\t\treturn this.next(new Date(outset.getTime() + Time.Day), false);\n\t}\n\n\t/**\n\t * Normalize the pattern\n\t * @param cron The pattern to normalize\n\t */\n\tprivate static normalize(cron: string): string {\n\t\tif (Reflect.has(predefined, cron)) return Reflect.get(predefined, cron);\n\t\tconst now = new Date();\n\t\tcron = cron\n\t\t\t.split(' ')\n\t\t\t.map((val, i) =>\n\t\t\t\tval.replace(wildcardRegex, (match) => {\n\t\t\t\t\tif (match === 'h') return (Math.floor(Math.random() * allowedNum[i][1]) + allowedNum[i][0]).toString();\n\n\t\t\t\t\tif (match === '?') {\n\t\t\t\t\t\tswitch (i) {\n\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\treturn now.getUTCMinutes().toString();\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\treturn now.getUTCHours().toString();\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\treturn now.getUTCDate().toString();\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\treturn now.getUTCMonth().toString();\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\treturn now.getUTCDay().toString();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn match;\n\t\t\t\t})\n\t\t\t)\n\t\t\t.join(' ');\n\t\treturn cron.replace(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));\n\t}\n\n\t/**\n\t * Parse the pattern\n\t * @param cron The pattern to parse\n\t */\n\tprivate static parseString(cron: string): Array<number[]> {\n\t\tconst parts = cron.split(' ');\n\t\tif (parts.length !== 5) throw new Error('Invalid Cron Provided');\n\t\treturn parts.map((part, i) => Cron.parsePart(part, i));\n\t}\n\n\t/**\n\t * Parse the current part\n\t * @param cronPart The part of the pattern to parse\n\t * @param id The id that identifies the current part\n\t */\n\tprivate static parsePart(cronPart: string, id: number): number[] {\n\t\tif (cronPart.includes(',')) {\n\t\t\tconst res: number[] = [];\n\t\t\tfor (const part of cronPart.split(',')) res.push(...Cron.parsePart(part, id));\n\t\t\treturn [...new Set(res)].sort((a, b) => a - b);\n\t\t}\n\n\t\t// eslint-disable-next-line prefer-const\n\t\tconst [, wild, minStr, maxStr, step] = partRegex.exec(cronPart)!;\n\t\tlet [min, max] = [parseInt(minStr, 10), parseInt(maxStr, 10)];\n\n\t\t// If '*', set min and max as the minimum and maximum allowed numbers:\n\t\tif (wild) [min, max] = allowedNum[id];\n\t\t// Else if a number was given, but not a maximum nor a step, return it\n\t\t// as only allowed value:\n\t\telse if (!max && !step) return [min];\n\n\t\t// Set min and max as the given numbers, defaulting max to the maximum\n\t\t// allowed, so min is never bigger than max:\n\t\t// This makes min and max be, in the following cases (considering minutes):\n\t\t// -> 1-2 | 1..2\n\t\t// -> 2-1 | 1..2\n\t\t// -> 1/7 | 1, 8, 15, 22, 29, 36, 43, 50, 57\n\t\t[min, max] = [min, max || allowedNum[id][1]].sort((a, b) => a - b);\n\n\t\t// Generate a range\n\t\treturn range(min, max, parseInt(step, 10) || 1);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAK,OAAL,kBAAKA,UAAL;AACN,EAAAA,YAAA,iBAAc,KAAd;AACA,EAAAA,YAAA,YAAS,OAAT;AACA,EAAAA,YAAA,YAAS,OAAT;AACA,EAAAA,YAAA,UAAO,QAAP;AACA,EAAAA,YAAA,SAAM,SAAN;AACA,EAAAA,YAAA,WAAQ,UAAR;AACA,EAAAA,YAAA,UAAO,WAAP;AAPW,SAAAA;AAAA,GAAA;AAUL,IAAM,YAAY;AAElB,IAAM,gBAAgB;AAEtB,IAAM,aAAa;AAAA,EACzB,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,CAAC;AACN;AAEO,IAAM,aAAa;AAAA,EACzB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AACZ;AAEO,IAAM,aAAa;AAAA,EACzB,KAAK;AA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,QAAQ,KAAK,MAAM,GAAG;AAC5B,QAAI,MAAM,WAAW;AAAG,YAAM,IAAI,MAAM,uBAAuB;AAC/D,WAAO,MAAM,IAAI,CAAC,MAAM,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACtD;AAAA,EAOA,OAAe,UAAU,UAAkB,IAAsB;AAChE,QAAI,SAAS,SAAS,GAAG,GAAG;AAC3B,YAAM,MAAgB,CAAC;AACvB,iBAAW,QAAQ,SAAS,MAAM,GAAG;AAAG,YAAI,KAAK,GAAG,KAAK,UAAU,MAAM,EAAE,CAAC;AAC5E,aAAO,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,IAC9C;AAGA,UAAM,CAAC,EAAE,MAAM,QAAQ,QAAQ,IAAI,IAAI,UAAU,KAAK,QAAQ;AAC9D,QAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,CAAC;AAG5D,QAAI;AAAM,OAAC,KAAK,GAAG,IAAI,WAAW;AAAA,aAGzB,CAAC,OAAO,CAAC;AAAM,aAAO,CAAC,GAAG;AAQnC,KAAC,KAAK,GAAG,IAAI,CAAC,KAAK,OAAO,WAAW,IAAI,EAAE,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAGjE,eAAO,wBAAM,KAAK,KAAK,SAAS,MAAM,EAAE,KAAK,CAAC;AAAA,EAC/C;AACD;AAxHa;","names":["Time"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// src/lib/constants.ts
|
|
10
|
+
var Time = /* @__PURE__ */ ((Time2) => {
|
|
11
|
+
Time2[Time2["Millisecond"] = 1] = "Millisecond";
|
|
12
|
+
Time2[Time2["Second"] = 1e3] = "Second";
|
|
13
|
+
Time2[Time2["Minute"] = 6e4] = "Minute";
|
|
14
|
+
Time2[Time2["Hour"] = 36e5] = "Hour";
|
|
15
|
+
Time2[Time2["Day"] = 864e5] = "Day";
|
|
16
|
+
Time2[Time2["Month"] = 2628e6] = "Month";
|
|
17
|
+
Time2[Time2["Year"] = 31536e6] = "Year";
|
|
18
|
+
return Time2;
|
|
19
|
+
})(Time || {});
|
|
20
|
+
var partRegex = /^(?:(\*)|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/;
|
|
21
|
+
var wildcardRegex = /\bh\b|\B\?\B/g;
|
|
22
|
+
var allowedNum = [
|
|
23
|
+
[0, 59],
|
|
24
|
+
[0, 23],
|
|
25
|
+
[1, 31],
|
|
26
|
+
[1, 12],
|
|
27
|
+
[0, 6]
|
|
28
|
+
];
|
|
29
|
+
var predefined = {
|
|
30
|
+
"@annually": "0 0 1 1 *",
|
|
31
|
+
"@yearly": "0 0 1 1 *",
|
|
32
|
+
"@monthly": "0 0 1 * *",
|
|
33
|
+
"@weekly": "0 0 * * 0",
|
|
34
|
+
"@daily": "0 0 * * *",
|
|
35
|
+
"@hourly": "0 * * * *"
|
|
36
|
+
};
|
|
37
|
+
var cronTokens = {
|
|
38
|
+
jan: 1,
|
|
39
|
+
feb: 2,
|
|
40
|
+
mar: 3,
|
|
41
|
+
apr: 4,
|
|
42
|
+
may: 5,
|
|
43
|
+
jun: 6,
|
|
44
|
+
jul: 7,
|
|
45
|
+
aug: 8,
|
|
46
|
+
sep: 9,
|
|
47
|
+
oct: 10,
|
|
48
|
+
nov: 11,
|
|
49
|
+
dec: 12,
|
|
50
|
+
sun: 0,
|
|
51
|
+
mon: 1,
|
|
52
|
+
tue: 2,
|
|
53
|
+
wed: 3,
|
|
54
|
+
thu: 4,
|
|
55
|
+
fri: 5,
|
|
56
|
+
sat: 6
|
|
57
|
+
};
|
|
58
|
+
var tokensRegex = new RegExp(Object.keys(cronTokens).join("|"), "g");
|
|
59
|
+
|
|
60
|
+
// src/lib/Cron.ts
|
|
61
|
+
import { range } from "@sapphire/utilities";
|
|
62
|
+
var Cron = class {
|
|
63
|
+
constructor(cron) {
|
|
64
|
+
__publicField(this, "cron");
|
|
65
|
+
__publicField(this, "normalized");
|
|
66
|
+
__publicField(this, "minutes");
|
|
67
|
+
__publicField(this, "hours");
|
|
68
|
+
__publicField(this, "days");
|
|
69
|
+
__publicField(this, "months");
|
|
70
|
+
__publicField(this, "dows");
|
|
71
|
+
this.cron = cron.toLowerCase();
|
|
72
|
+
this.normalized = Cron.normalize(this.cron);
|
|
73
|
+
[this.minutes, this.hours, this.days, this.months, this.dows] = Cron.parseString(this.normalized);
|
|
74
|
+
}
|
|
75
|
+
next(outset = new Date(), origin = true) {
|
|
76
|
+
if (!this.days.includes(outset.getUTCDate()) || !this.months.includes(outset.getUTCMonth() + 1) || !this.dows.includes(outset.getUTCDay())) {
|
|
77
|
+
return this.next(new Date(outset.getTime() + 864e5 /* Day */), false);
|
|
78
|
+
}
|
|
79
|
+
if (!origin)
|
|
80
|
+
return new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), this.hours[0], this.minutes[0]));
|
|
81
|
+
const now = new Date(outset.getTime() + 6e4);
|
|
82
|
+
for (const hour of this.hours) {
|
|
83
|
+
if (hour < now.getUTCHours())
|
|
84
|
+
continue;
|
|
85
|
+
for (const minute of this.minutes) {
|
|
86
|
+
if (hour === now.getUTCHours() && minute < now.getUTCMinutes())
|
|
87
|
+
continue;
|
|
88
|
+
return new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), hour, minute));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return this.next(new Date(outset.getTime() + 864e5 /* Day */), false);
|
|
92
|
+
}
|
|
93
|
+
static normalize(cron) {
|
|
94
|
+
if (Reflect.has(predefined, cron))
|
|
95
|
+
return Reflect.get(predefined, cron);
|
|
96
|
+
const now = new Date();
|
|
97
|
+
cron = cron.split(" ").map(
|
|
98
|
+
(val, i) => val.replace(wildcardRegex, (match) => {
|
|
99
|
+
if (match === "h")
|
|
100
|
+
return (Math.floor(Math.random() * allowedNum[i][1]) + allowedNum[i][0]).toString();
|
|
101
|
+
if (match === "?") {
|
|
102
|
+
switch (i) {
|
|
103
|
+
case 0:
|
|
104
|
+
return now.getUTCMinutes().toString();
|
|
105
|
+
case 1:
|
|
106
|
+
return now.getUTCHours().toString();
|
|
107
|
+
case 2:
|
|
108
|
+
return now.getUTCDate().toString();
|
|
109
|
+
case 3:
|
|
110
|
+
return now.getUTCMonth().toString();
|
|
111
|
+
case 4:
|
|
112
|
+
return now.getUTCDay().toString();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return match;
|
|
116
|
+
})
|
|
117
|
+
).join(" ");
|
|
118
|
+
return cron.replace(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));
|
|
119
|
+
}
|
|
120
|
+
static parseString(cron) {
|
|
121
|
+
const parts = cron.split(" ");
|
|
122
|
+
if (parts.length !== 5)
|
|
123
|
+
throw new Error("Invalid Cron Provided");
|
|
124
|
+
return parts.map((part, i) => Cron.parsePart(part, i));
|
|
125
|
+
}
|
|
126
|
+
static parsePart(cronPart, id) {
|
|
127
|
+
if (cronPart.includes(",")) {
|
|
128
|
+
const res = [];
|
|
129
|
+
for (const part of cronPart.split(","))
|
|
130
|
+
res.push(...Cron.parsePart(part, id));
|
|
131
|
+
return [...new Set(res)].sort((a, b) => a - b);
|
|
132
|
+
}
|
|
133
|
+
const [, wild, minStr, maxStr, step] = partRegex.exec(cronPart);
|
|
134
|
+
let [min, max] = [parseInt(minStr, 10), parseInt(maxStr, 10)];
|
|
135
|
+
if (wild)
|
|
136
|
+
[min, max] = allowedNum[id];
|
|
137
|
+
else if (!max && !step)
|
|
138
|
+
return [min];
|
|
139
|
+
[min, max] = [min, max || allowedNum[id][1]].sort((a, b) => a - b);
|
|
140
|
+
return range(min, max, parseInt(step, 10) || 1);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
__name(Cron, "Cron");
|
|
144
|
+
export {
|
|
145
|
+
Cron,
|
|
146
|
+
Time,
|
|
147
|
+
allowedNum,
|
|
148
|
+
cronTokens,
|
|
149
|
+
partRegex,
|
|
150
|
+
predefined,
|
|
151
|
+
tokensRegex,
|
|
152
|
+
wildcardRegex
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/constants.ts","../src/lib/Cron.ts"],"sourcesContent":["export enum Time {\n\tMillisecond = 1,\n\tSecond = 1000,\n\tMinute = 1000 * 60,\n\tHour = 1000 * 60 * 60,\n\tDay = 1000 * 60 * 60 * 24,\n\tMonth = 1000 * 60 * 60 * 24 * (365 / 12),\n\tYear = 1000 * 60 * 60 * 24 * 365\n}\n\nexport const partRegex = /^(?:(\\*)|(\\d+)(?:-(\\d+))?)(?:\\/(\\d+))?$/;\n\nexport const wildcardRegex = /\\bh\\b|\\B\\?\\B/g;\n\nexport const allowedNum = [\n\t[0, 59],\n\t[0, 23],\n\t[1, 31],\n\t[1, 12],\n\t[0, 6]\n];\n\nexport const predefined = {\n\t'@annually': '0 0 1 1 *',\n\t'@yearly': '0 0 1 1 *',\n\t'@monthly': '0 0 1 * *',\n\t'@weekly': '0 0 * * 0',\n\t'@daily': '0 0 * * *',\n\t'@hourly': '0 * * * *'\n} as const;\n\nexport const cronTokens = {\n\tjan: 1,\n\tfeb: 2,\n\tmar: 3,\n\tapr: 4,\n\tmay: 5,\n\tjun: 6,\n\tjul: 7,\n\taug: 8,\n\tsep: 9,\n\toct: 10,\n\tnov: 11,\n\tdec: 12,\n\tsun: 0,\n\tmon: 1,\n\ttue: 2,\n\twed: 3,\n\tthu: 4,\n\tfri: 5,\n\tsat: 6\n} as const;\n\nexport const tokensRegex = new RegExp(Object.keys(cronTokens).join('|'), 'g');\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { range } from '@sapphire/utilities';\nimport { allowedNum, cronTokens, partRegex, predefined, Time, tokensRegex, wildcardRegex } from './constants';\n\n/**\n * Handles Cron strings and generates dates based on the cron string provided.\n * @see https://en.wikipedia.org/wiki/Cron\n */\nexport class Cron {\n\tpublic cron: string;\n\tpublic normalized: string;\n\tpublic minutes: number[];\n\tpublic hours: number[];\n\tpublic days: number[];\n\tpublic months: number[];\n\tpublic dows: number[];\n\n\t/**\n\t * @param cron The cron pattern to use\n\t */\n\tpublic constructor(cron: string) {\n\t\tthis.cron = cron.toLowerCase();\n\t\tthis.normalized = Cron.normalize(this.cron);\n\t\t[this.minutes, this.hours, this.days, this.months, this.dows] = Cron.parseString(this.normalized);\n\t}\n\n\t/**\n\t * Get the next date that matches with the current pattern\n\t * @param outset The Date instance to compare with\n\t * @param origin Whether this next call is origin\n\t */\n\tpublic next(outset: Date = new Date(), origin = true): Date {\n\t\tif (!this.days.includes(outset.getUTCDate()) || !this.months.includes(outset.getUTCMonth() + 1) || !this.dows.includes(outset.getUTCDay())) {\n\t\t\treturn this.next(new Date(outset.getTime() + Time.Day), false);\n\t\t}\n\t\tif (!origin) return new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), this.hours[0], this.minutes[0]));\n\n\t\tconst now = new Date(outset.getTime() + 60000);\n\n\t\tfor (const hour of this.hours) {\n\t\t\tif (hour < now.getUTCHours()) continue;\n\t\t\tfor (const minute of this.minutes) {\n\t\t\t\tif (hour === now.getUTCHours() && minute < now.getUTCMinutes()) continue;\n\t\t\t\treturn new Date(Date.UTC(outset.getUTCFullYear(), outset.getUTCMonth(), outset.getUTCDate(), hour, minute));\n\t\t\t}\n\t\t}\n\n\t\treturn this.next(new Date(outset.getTime() + Time.Day), false);\n\t}\n\n\t/**\n\t * Normalize the pattern\n\t * @param cron The pattern to normalize\n\t */\n\tprivate static normalize(cron: string): string {\n\t\tif (Reflect.has(predefined, cron)) return Reflect.get(predefined, cron);\n\t\tconst now = new Date();\n\t\tcron = cron\n\t\t\t.split(' ')\n\t\t\t.map((val, i) =>\n\t\t\t\tval.replace(wildcardRegex, (match) => {\n\t\t\t\t\tif (match === 'h') return (Math.floor(Math.random() * allowedNum[i][1]) + allowedNum[i][0]).toString();\n\n\t\t\t\t\tif (match === '?') {\n\t\t\t\t\t\tswitch (i) {\n\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\treturn now.getUTCMinutes().toString();\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\treturn now.getUTCHours().toString();\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\treturn now.getUTCDate().toString();\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\treturn now.getUTCMonth().toString();\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\treturn now.getUTCDay().toString();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn match;\n\t\t\t\t})\n\t\t\t)\n\t\t\t.join(' ');\n\t\treturn cron.replace(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));\n\t}\n\n\t/**\n\t * Parse the pattern\n\t * @param cron The pattern to parse\n\t */\n\tprivate static parseString(cron: string): Array<number[]> {\n\t\tconst parts = cron.split(' ');\n\t\tif (parts.length !== 5) throw new Error('Invalid Cron Provided');\n\t\treturn parts.map((part, i) => Cron.parsePart(part, i));\n\t}\n\n\t/**\n\t * Parse the current part\n\t * @param cronPart The part of the pattern to parse\n\t * @param id The id that identifies the current part\n\t */\n\tprivate static parsePart(cronPart: string, id: number): number[] {\n\t\tif (cronPart.includes(',')) {\n\t\t\tconst res: number[] = [];\n\t\t\tfor (const part of cronPart.split(',')) res.push(...Cron.parsePart(part, id));\n\t\t\treturn [...new Set(res)].sort((a, b) => a - b);\n\t\t}\n\n\t\t// eslint-disable-next-line prefer-const\n\t\tconst [, wild, minStr, maxStr, step] = partRegex.exec(cronPart)!;\n\t\tlet [min, max] = [parseInt(minStr, 10), parseInt(maxStr, 10)];\n\n\t\t// If '*', set min and max as the minimum and maximum allowed numbers:\n\t\tif (wild) [min, max] = allowedNum[id];\n\t\t// Else if a number was given, but not a maximum nor a step, return it\n\t\t// as only allowed value:\n\t\telse if (!max && !step) return [min];\n\n\t\t// Set min and max as the given numbers, defaulting max to the maximum\n\t\t// allowed, so min is never bigger than max:\n\t\t// This makes min and max be, in the following cases (considering minutes):\n\t\t// -> 1-2 | 1..2\n\t\t// -> 2-1 | 1..2\n\t\t// -> 1/7 | 1, 8, 15, 22, 29, 36, 43, 50, 57\n\t\t[min, max] = [min, max || allowedNum[id][1]].sort((a, b) => a - b);\n\n\t\t// Generate a range\n\t\treturn range(min, max, parseInt(step, 10) || 1);\n\t}\n}\n"],"mappings":";;;;;;;;;AAAO,IAAK,OAAL,kBAAKA,UAAL;AACN,EAAAA,YAAA,iBAAc,KAAd;AACA,EAAAA,YAAA,YAAS,OAAT;AACA,EAAAA,YAAA,YAAS,OAAT;AACA,EAAAA,YAAA,UAAO,QAAP;AACA,EAAAA,YAAA,SAAM,SAAN;AACA,EAAAA,YAAA,WAAQ,UAAR;AACA,EAAAA,YAAA,UAAO,WAAP;AAPW,SAAAA;AAAA,GAAA;AAUL,IAAM,YAAY;AAElB,IAAM,gBAAgB;AAEtB,IAAM,aAAa;AAAA,EACzB,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,EAAE;AAAA,EACN,CAAC,GAAG,CAAC;AACN;AAEO,IAAM,aAAa;AAAA,EACzB,aAAa;AAAA,EACb,WAAW;A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",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.mjs",
|
|
9
|
+
"browser": "dist/index.global.js",
|
|
10
|
+
"unpkg": "dist/index.global.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/cron",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
|
|
22
|
+
"build": "tsup",
|
|
23
|
+
"docs": "typedoc-json-parser",
|
|
24
|
+
"prepack": "yarn build",
|
|
25
|
+
"bump": "cliff-jumper",
|
|
26
|
+
"check-update": "cliff-jumper --dry-run"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/sapphiredev/utilities.git",
|
|
31
|
+
"directory": "packages/cron"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist/**/*.js*",
|
|
35
|
+
"dist/**/*.mjs*",
|
|
36
|
+
"dist/**/*.d*"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=v14.0.0",
|
|
40
|
+
"npm": ">=7.0.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"@sapphire/cron",
|
|
44
|
+
"cron",
|
|
45
|
+
"bot",
|
|
46
|
+
"typescript",
|
|
47
|
+
"ts",
|
|
48
|
+
"yarn",
|
|
49
|
+
"discord",
|
|
50
|
+
"sapphire",
|
|
51
|
+
"standalone"
|
|
52
|
+
],
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/sapphiredev/utilities/issues"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@sapphire/utilities": "^3.9.3"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@favware/cliff-jumper": "^1.8.7",
|
|
64
|
+
"@vitest/coverage-c8": "^0.23.4",
|
|
65
|
+
"tsup": "^6.2.3",
|
|
66
|
+
"typedoc": "^0.23.14",
|
|
67
|
+
"typedoc-json-parser": "^4.0.0",
|
|
68
|
+
"typescript": "^4.8.3",
|
|
69
|
+
"vitest": "^0.23.4"
|
|
70
|
+
}
|
|
71
|
+
}
|