Skip to content

JobClock — @gj-kit/nest-operations-jobs

A public interface from @gj-kit/nest-operations-jobs/core. The signature below is taken directly from the 0.1.1 release declaration.

import { JobClock } from '@gj-kit/nest-operations-jobs/core';
/**
* Injected time source. Every runner decision that depends on time — the
* deadline, the heartbeat cadence, how long a failing heartbeat is tolerated,
* and `durationMs` — reads this and nothing else. `now()` is epoch milliseconds
* because that is what the store port carries, so no date object is ever
* constructed outside this module. Staleness is not on this list: the cutoff
* belongs to the store's clock, not the runner's (obligation S6).
*
* This is the only module in the package allowed to touch ambient time or timers.
*/
interface JobClock {
/** Epoch milliseconds. */
now(): number;
/** Fires once after `delayMs`. */
after(delayMs: number, handler: () => void): JobTimerCancel;
/** Fires repeatedly every `intervalMs`. */
every(intervalMs: number, handler: () => void): JobTimerCancel;
}

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/nest-operations-jobs
  • Version: 0.1.1
  • Public entry: ./core
  • Source: GitHub