Command line options containing schedule IDs, date range, timezone, and output settings
Optionallogger: LoggerA Promise that resolves when all schedules have been processed
This function uses async/await to process schedules sequentially rather than concurrently.
This design choice prevents:
API token is retrieved from:
--key or -k) if providedAPI_TOKEN otherwiseThe effective timezone for OOH calculations is determined by priority:
--timeZoneId or -t) if provided (overrides schedule timezone)If outputFile is specified:
// Process single schedule with default settings
await calOohPay({
rotaIds: 'PXXXXXX',
since: '2024-01-01T00:00:00Z',
until: '2024-01-31T23:59:59Z',
timeZoneId: undefined,
key: undefined,
outputFile: undefined
});
// Process multiple schedules with CSV output
await calOohPay({
rotaIds: 'PXXXXXX,PYYYYYY,PZZZZZZ',
since: '2024-01-01T00:00:00Z',
until: '2024-01-31T23:59:59Z',
timeZoneId: 'Europe/London',
key: 'your-api-token',
outputFile: './output/oncall-payments.csv'
});
Main function to calculate out-of-hours (OOH) on-call payments for PagerDuty schedules.
This asynchronous function orchestrates the entire on-call payment calculation workflow: