@rvkang/batch-cli
v0.1.0
Published
Operational CLI for running and inspecting nest-batch jobs.
Readme
@rvkang/batch-cli
Operational command parsing and executable entrypoint for nest-batch jobs.
Install
pnpm add @rvkang/batch-cli @rvkang/batch-core @rvkang/batch-inmemoryThe published executable can always print its command summary:
nest-batch --helpSupply application context
import { defineJob, defineStep } from "@rvkang/batch-core";
import { runCli } from "@rvkang/batch-cli";
import { InMemoryBatchStorage } from "@rvkang/batch-inmemory";
const storage = new InMemoryBatchStorage();
const job = defineJob({
name: "hello",
steps: [defineStep({ name: "log", execute: async () => "done" })]
});
const result = await runCli(["run", "--job", "hello"], {
storage,
jobs: [job]
});The executable does not discover your application's storage or jobs on its own.
Embed runCli(args, context) in an application bootstrap that supplies the
storage and job registry (and queue or schedule context for those commands).
Use durable storage for operational restart and multi-process work; the
in-memory adapter above is only a local example.
