import { ApiPromise, ApiRequestOptions, DeletedScheduleObject, InitOutput, OffsetLimitPagePromise, ScheduleObject } from "@trigger.dev/core/v3"; import { Task, TaskOptions } from "../shared.js"; import * as SchedulesAPI from "./api.js"; export type ScheduleOptions = TaskOptions & { /** You can optionally specify a CRON schedule on your task. You can also dynamically add a schedule in the dashboard or using the SDK functions. * * 1. Pass a CRON pattern string * ```ts * "0 0 * * *" * ``` * * 2. Or an object with a pattern, optional timezone, and optional environments * ```ts * { * pattern: "0 0 * * *", * timezone: "America/Los_Angeles", * environments: ["PRODUCTION", "STAGING"] * } * ``` * * @link https://trigger.dev/docs/v3/tasks-scheduled */ cron?: string | { pattern: string; timezone?: string; /** You can optionally specify which environments this schedule should run in. * When not specified, the schedule will run in all environments. * * @example * ```ts * environments: ["PRODUCTION", "STAGING"] * ``` * * @example * ```ts * environments: ["PRODUCTION"] // Only run in production * ``` */ environments?: Array<"DEVELOPMENT" | "STAGING" | "PRODUCTION" | "PREVIEW">; }; }; export declare function task(params: ScheduleOptions): Task; /** * Creates a new schedule * @param options * @param options.task - The identifier of the task to be scheduled (Must already exist and be a scheduled task) * @param options.cron - The cron expression for the schedule (e.g. `0 0 * * *`) * @param options.timezone - An optional timezone for the schedule in the IANA format (e.g. `America/Los_Angeles`). Defaults to "UTC". * @param options.externalId - An optional external identifier for the schedule * @param options.deduplicationKey - An optional deduplication key for the schedule * @returns The created schedule */ export declare function create(options: SchedulesAPI.CreateScheduleOptions, requestOptions?: ApiRequestOptions): ApiPromise; /** * Retrieves a schedule * @param scheduleId - The ID of the schedule to retrieve * @returns The retrieved schedule */ export declare function retrieve(scheduleId: string, requestOptions?: ApiRequestOptions): ApiPromise; /** * Updates a schedule * @param scheduleId - The ID of the schedule to update * @param options - The updated schedule options * @param options.task - The identifier of the task to be scheduled (Must already exist and be a scheduled task) * @param options.cron - The cron expression for the schedule (e.g. `0 0 * * *`) * @param options.timezone - An optional timezone for the schedule in the IANA format (e.g. `America/Los_Angeles`). Defaults to "UTC". * @param options.externalId - An optional external identifier for the schedule * @returns The updated schedule */ export declare function update(scheduleId: string, options: SchedulesAPI.UpdateScheduleOptions, requestOptions?: ApiRequestOptions): ApiPromise; /** * Deletes a schedule * @param scheduleId - The ID of the schedule to delete */ export declare function del(scheduleId: string, requestOptions?: ApiRequestOptions): ApiPromise; /** * Deactivates a schedule * @param scheduleId - The ID of the schedule to deactivate */ export declare function deactivate(scheduleId: string, requestOptions?: ApiRequestOptions): ApiPromise; /** * Activates a schedule * @param scheduleId - The ID of the schedule to activate */ export declare function activate(scheduleId: string, requestOptions?: ApiRequestOptions): ApiPromise; /** * Lists schedules * @param options - The list options * @param options.page - The page number * @param options.perPage - The number of schedules per page * @returns The list of schedules */ export declare function list(options?: SchedulesAPI.ListScheduleOptions, requestOptions?: ApiRequestOptions): OffsetLimitPagePromise; /** * Lists the possible timezones we support * @param excludeUtc - By default "UTC" is included and is first. If true, "UTC" will be excluded. */ export declare function timezones(options?: { excludeUtc?: boolean; }): ApiPromise<{ timezones: string[]; }>;