registerCron and unregisterCron jsdocs
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@trigger.dev/sdk": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
registerCron and unregisterCron jsdocs
|
||||||
@@ -18,6 +18,9 @@ export const IntervalOptionsSchema = z.object({
|
|||||||
export type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
|
export type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
|
||||||
|
|
||||||
export const CronOptionsSchema = z.object({
|
export const CronOptionsSchema = z.object({
|
||||||
|
/** A CRON expression that defines the schedule. A useful tool when writing CRON
|
||||||
|
expressions is [crontab guru](https://crontab.guru). Note that the timezone
|
||||||
|
used is UTC. */
|
||||||
cron: z.string(),
|
cron: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ export class IO {
|
|||||||
|
|
||||||
/** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
|
/** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
|
||||||
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
||||||
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
|
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
|
||||||
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
||||||
*/
|
*/
|
||||||
async unregisterInterval(
|
async unregisterInterval(
|
||||||
@@ -314,6 +314,12 @@ export class IO {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** `io.registerCron()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular CRON schedule.
|
||||||
|
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
||||||
|
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
|
||||||
|
* @param id A unique id for the schedule. This is used to identify and unregister the schedule later.
|
||||||
|
* @param options The options for the CRON schedule.
|
||||||
|
*/
|
||||||
async registerCron(
|
async registerCron(
|
||||||
key: string | any[],
|
key: string | any[],
|
||||||
dynamicSchedule: DynamicSchedule,
|
dynamicSchedule: DynamicSchedule,
|
||||||
@@ -340,6 +346,11 @@ export class IO {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** `io.unregisterCron()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerCron()`.
|
||||||
|
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
||||||
|
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
|
||||||
|
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
||||||
|
*/
|
||||||
async unregisterCron(
|
async unregisterCron(
|
||||||
key: string | any[],
|
key: string | any[],
|
||||||
dynamicSchedule: DynamicSchedule,
|
dynamicSchedule: DynamicSchedule,
|
||||||
|
|||||||
@@ -546,7 +546,10 @@ export class TriggerClient {
|
|||||||
return this.#client.getAuth(this.id, id);
|
return this.#client.getAuth(this.id, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** You can call this function from anywhere in your code to send an event. The other way to send an event is by using `io.sendEvent()` from inside a `run()` function.
|
/** You can call this function from anywhere in your code to send an event. The other way to send an event is by using [`io.sendEvent()`](https://trigger.dev/docs/sdk/io/sendevent) from inside a `run()` function.
|
||||||
|
* @param event The event to send.
|
||||||
|
* @param options Options for sending the event.
|
||||||
|
* @returns A promise that resolves to the event details
|
||||||
*/
|
*/
|
||||||
async sendEvent(event: SendEvent, options?: SendEventOptions) {
|
async sendEvent(event: SendEvent, options?: SendEventOptions) {
|
||||||
return this.#client.sendEvent(event, options);
|
return this.#client.sendEvent(event, options);
|
||||||
|
|||||||
Reference in New Issue
Block a user