StaticsanitizeSanitizes a string input by trimming whitespace.
The string to sanitize
Optional default value if input is empty after trimming
Sanitized string
StaticvalidateValidates an API token format.
Basic validation for PagerDuty API tokens. Real validation happens when making API calls, but this catches obvious issues early.
API token to validate
StaticvalidateValidates a date range ensuring 'since' is not greater than 'until'.
Start date string (ISO format)
End date string (ISO format)
StaticvalidateValidates a date string can be parsed as a valid date.
The date string to validate
Name of the field being validated (for error messages)
StaticvalidateValidates a file path for output.
Basic validation to ensure path is not empty and doesn't contain obviously invalid characters.
The file path to validate
StaticvalidateValidates an OnCallUser object for payment calculations.
Ensures the user has all required data for accurate payment calculation.
The user object to validate
StaticvalidateValidates PagerDuty schedule ID format.
PagerDuty schedule IDs typically start with 'P' followed by alphanumeric characters. This validates basic format and non-empty strings.
The schedule ID to validate
StaticvalidateValidates a comma-separated list of schedule IDs.
Comma-separated schedule IDs
Array of validated and trimmed schedule IDs
StaticvalidateValidates an IANA timezone identifier.
Note: This performs basic validation. For comprehensive timezone validation, use Luxon's DateTime.local().setZone() and check if zone.isValid.
IANA timezone identifier (e.g., 'Europe/London', 'America/New_York')
StaticvalidateValidates that a string is non-empty (after trimming whitespace).
Used for validating required string fields like currency codes.
The string to validate
Name of the field being validated (for error messages)
StaticvalidateValidates that a number is positive (greater than 0).
Used for validating configuration values that must be positive, such as compensation rates.
The number to validate
Name of the field being validated (for error messages)
Centralized input validation module for CalOohPay application.
Provides consistent validation rules and error messages across all parts of the application. All validation methods throw descriptive errors with context when validation fails.