Setu-TS
    Preparing search index...

    Type Alias SchedulerJobDefinition

    SchedulerJobDefinition:
        | {
            data?: unknown;
            expression: string;
            handler: SchedulerJobHandler;
            name: string;
            retry?: RetryOptions;
            trigger: "cron";
        }
        | {
            data?: unknown;
            handler: SchedulerJobHandler;
            intervalMs: number;
            name: string;
            retry?: RetryOptions;
            trigger: "every";
        }
        | {
            data?: unknown;
            delayMs: number;
            handler: SchedulerJobHandler;
            name: string;
            retry?: RetryOptions;
            trigger: "delay";
        }

    The declarative form of one scheduler job registration — the entry an application writes instead of calling cron()/every()/delay() imperatively after start().

    A union discriminated on trigger: each arm carries exactly the field its scheduling strategy needs (expression for cron, intervalMs for every, delayMs for delay), so a cron entry without an expression — the one mistake that would otherwise produce a job that silently never fires — is a COMPILE error rather than a runtime one.

    Type Declaration

    • {
          data?: unknown;
          expression: string;
          handler: SchedulerJobHandler;
          name: string;
          retry?: RetryOptions;
          trigger: "cron";
      }
      • Optional Readonlydata?: unknown

        Optional payload handed to the handler.

      • Readonlyexpression: string

        5-field cron expression (UTC). Required on the cron arm.

      • Readonlyhandler: SchedulerJobHandler

        Invoked on each fire, exactly as the imperative cron() accepts.

      • Readonlyname: string

        Unique job name (the cron() name argument).

      • Optional Readonlyretry?: RetryOptions

        Optional retry configuration, exactly as the imperative cron() accepts.

      • Readonlytrigger: "cron"

        Discriminator: this job fires on a 5-field cron expression (UTC).

    • {
          data?: unknown;
          handler: SchedulerJobHandler;
          intervalMs: number;
          name: string;
          retry?: RetryOptions;
          trigger: "every";
      }
      • Optional Readonlydata?: unknown

        Optional payload handed to the handler.

      • Readonlyhandler: SchedulerJobHandler

        Invoked on each fire, exactly as the imperative every() accepts.

      • ReadonlyintervalMs: number

        Interval in milliseconds. Required on the every arm.

      • Readonlyname: string

        Unique job name (the every() name argument).

      • Optional Readonlyretry?: RetryOptions

        Optional retry configuration, exactly as the imperative every() accepts.

      • Readonlytrigger: "every"

        Discriminator: this job fires on a fixed interval.

    • {
          data?: unknown;
          delayMs: number;
          handler: SchedulerJobHandler;
          name: string;
          retry?: RetryOptions;
          trigger: "delay";
      }
      • Optional Readonlydata?: unknown

        Optional payload handed to the handler.

      • ReadonlydelayMs: number

        Delay in milliseconds. Required on the delay arm.

      • Readonlyhandler: SchedulerJobHandler

        Invoked when the delay expires, exactly as the imperative delay() accepts.

      • Readonlyname: string

        Unique job name (the delay() name argument).

      • Optional Readonlyretry?: RetryOptions

        Optional retry configuration, exactly as the imperative delay() accepts.

      • Readonlytrigger: "delay"

        Discriminator: this job fires once, after a delay.

    0.3.0