Skip to main content
Version: Current

DeferWhen

@rotorsoft/act-root


@rotorsoft/act-root / act/src / DeferWhen

Type Alias: DeferWhen

DeferWhen = { after: { days?: number; hours?: number; minutes?: number; }; at?: never; } | { after?: never; at: Date; }

Defined in: libs/act/src/types/action.ts:1093

The schedule for a deferred reaction (#1091, RFC 0001), used by both the declarative .defer(when) builder step and the imperative DeferSignal escape hatch. Exactly one form:

  • { after } โ€” a span measured from the triggering event's created time ({ hours: 1, minutes: 30 } is 90 minutes). The drain anchors it to that event, so a worker re-claiming the stream after the wait computes the same due-time.
  • { at } โ€” an absolute Date.

The triggering event is always in hand where a schedule is chosen โ€” the (event) => DeferWhen form of .defer declaratively, the handler scope imperatively โ€” so there is no function form of at: a payload- or state-derived deadline is just { at: computedDate }.