How aquarela-io/time-to-cron works
┌─ Input Layer ─────────────┐
• Numeric Time Values │
• Predefined Schedules │
• ┬────────────┘
• ↓
┌─ Core Processing Layer ───┐
• Validation Logic │
• Conversion Logic │
• ┬────────────┘
• ↓
┌─ Output Layer ───────────┐
• Cron Expression │
• ┘
Component Details
a. Input Layer (Blue):
• Numeric input path: (value: number, unit: TimeUnit)
• Predefined schedule path: (@yearly, @monthly, etc.)
b. Core Processing Layer (Green):
• Seconds/Minutes: <60 or multiple of 60
• Hours: <24 or multiple of 24
• Days: positive integers
c. Output Layer (Orange):
• Cron expression format (6-segment string)
Flow Indicators
• Error handling returns to calling context
Additional Elements
Supporting components:
• Validation rules reference
• Common usage patterns
• Error scenarios
Technical Details
A technical specification section showing:
• TypeScript implementation
• Build process (esbuild)
• Testing framework (vitest)
• CI/CD workflow (GitHub Actions)
Notes for Implementation
• The library's single responsibility principle
• Clear input/output contract
• Validation rules
• Error handling paths
• Type safety (TypeScript)
Remember to include version control and CI/CD information in a separate section, as indicated by the presence of GitHub workflows in the file tree.