콘텐츠로 이동

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

@gj-kit/nest-operations-jobs에서 공개하는 function입니다. package version 0.1.1의 release declaration을 그대로 표시합니다.

import { runOperationsJobCli } from '@gj-kit/nest-operations-jobs';
/**
* Shared entry point for container job runners, Kubernetes CronJobs and manual
* runs. The same runner as the HTTP trigger, so run records, overlap prevention
* and timeouts apply identically.
*
* Returns the exit code instead of setting a global, and never terminates the
* process: the caller decides. A context the CLI created is always closed,
* including on failure, so pooled database connections cannot leak.
*
* `SUCCEEDED` and `SKIPPED` exit 0 — a skipped duplicate is not an error.
* `FAILED`, `TIMED_OUT` and any throw exit 1. A missing job key exits 2 without
* booting the application. A run whose record is not `'settled'` still uses the
* status-derived code and reports the mismatch as a warning: that fact is for an
* operator to read, not a retry signal for the scheduler.
*/
declare function runOperationsJobCli(options: OperationsJobCliOptions): Promise<0 | 1 | 2>;

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/nest-operations-jobs
  • 버전: 0.1.1
  • 공개 entry: .
  • 소스: GitHub

Shared entry point for container job runners, Kubernetes CronJobs and manual runs. The same runner as the HTTP trigger, so run records, overlap prevention and timeouts apply identically.

Returns the exit code instead of setting a global, and never terminates the process: the caller decides. A context the CLI created is always closed, including on failure, so pooled database connections cannot leak.

SUCCEEDED and SKIPPED exit 0 — a skipped duplicate is not an error. FAILED, TIMED_OUT and any throw exit 1. A missing job key exits 2 without booting the application. A run whose record is not 'settled' still uses the status-derived code and reports the mismatch as a warning: that fact is for an operator to read, not a retry signal for the scheduler.