(input)
| 59 | return getCronFilePath() |
| 60 | }, |
| 61 | async validateInput(input): Promise<ValidationResult> { |
| 62 | const tasks = await listAllCronTasks() |
| 63 | const task = tasks.find(t => t.id === input.id) |
| 64 | if (!task) { |
| 65 | return { |
| 66 | result: false, |
| 67 | message: `No scheduled job with id '${input.id}'`, |
| 68 | errorCode: 1, |
| 69 | } |
| 70 | } |
| 71 | // Teammates may only delete their own crons. |
| 72 | const ctx = getTeammateContext() |
| 73 | if (ctx && task.agentId !== ctx.agentId) { |
| 74 | return { |
| 75 | result: false, |
| 76 | message: `Cannot delete cron job '${input.id}': owned by another agent`, |
| 77 | errorCode: 2, |
| 78 | } |
| 79 | } |
| 80 | return { result: true } |
| 81 | }, |
| 82 | async call({ id }) { |
| 83 | await removeCronTasks([id]) |
| 84 | return { data: { id } } |
nothing calls this directly
no test coverage detected