{{ message }}
feat: cron.parse and cron.validateDetailed (expression introspection)#548
Merged
Conversation
Expression introspection for tooling and DX:
- `cron.validateDetailed(expression)` returns `{ valid, fields?, errors }`,
collecting every problem (field name, offending value, reason) instead of a
plain boolean — and the decomposed fields when valid.
- `cron.parse(expression)` returns the decomposed fields or throws with a
useful message for the first problem.
Both reuse the existing per-field validators; `validate()` (boolean) is
unchanged.
Merged
merencia
added a commit
that referenced
this pull request
Jun 18, 2026
Promote the Unreleased section to 4.4.0 and bump the version. Highlights (all additive, backwards-compatible): - Task introspection: getNextRuns, match, msToNext, isBusy, runsLeft, getPattern (#547) - cron.parse and cron.validateDetailed (#548) - Distributed run coordination: distributed:true + NODE_CRON_RUN default + RunCoordinator (#549)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Phase 1 — expression introspection (DX / tooling).
cron.validateDetailed(expression)→{ valid, fields?, errors }. Unlikevalidate()(boolean), it collects every problem with{ field, value, message }, and returns the decomposed fields when valid.cron.parse(expression)→ the decomposed fields ({ second, minute, hour, dayOfMonth, month, dayOfWeek }), or throws with a useful message (which field, which value) for the first problem.Both reuse the existing per-field validators —
validate()(boolean) is untouched, so no behavior change there. Handles 5/6-field forms, theLtoken in day-of-month, illegal characters, wrong field count, and non-string input.New exported types:
ParsedFields,DetailedValidation,CronFieldError. Full suite green (327 tests).