| 28 | ]; |
| 29 | |
| 30 | export class IntervalTrigger implements Trigger<ScheduledEventSpecification> { |
| 31 | constructor(private options: IntervalOptions) {} |
| 32 | |
| 33 | get event() { |
| 34 | return { |
| 35 | name: "trigger.scheduled", |
| 36 | title: "Schedule", |
| 37 | source: "trigger.dev", |
| 38 | icon: "schedule-interval", |
| 39 | examples, |
| 40 | parsePayload: ScheduledPayloadSchema.parse, |
| 41 | properties: [ |
| 42 | { |
| 43 | label: "Interval", |
| 44 | text: `${this.options.seconds}s`, |
| 45 | }, |
| 46 | ], |
| 47 | }; |
| 48 | } |
| 49 | |
| 50 | attachToJob( |
| 51 | triggerClient: TriggerClient, |
| 52 | job: Job<Trigger<ScheduledEventSpecification>, any> |
| 53 | ): void {} |
| 54 | |
| 55 | get preprocessRuns() { |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | async verifyPayload(payload: ReturnType<ScheduledEventSpecification["parsePayload"]>) { |
| 60 | return { success: true as const }; |
| 61 | } |
| 62 | |
| 63 | toJSON(): TriggerMetadata { |
| 64 | return { |
| 65 | type: "scheduled", |
| 66 | schedule: { |
| 67 | type: "interval", |
| 68 | options: { |
| 69 | seconds: this.options.seconds, |
| 70 | }, |
| 71 | }, |
| 72 | }; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** `intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigger a Job at a recurring interval. |
| 77 | * @param options An object containing options about the interval. |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…