@nodii/approval
v0.11.0
Published
Approval library for the Nodii microservice stack — defineApprovalKinds + requestApproval + bindApprovalHandlers + per-tenant policies + completion-event consumer + migrate-gen. Polyglot ship: TS + Python + Go in parity. Spec: planning hub docKey=approval
Readme
@nodii/approval
Approval library for the Nodii microservice stack. Implements the platform-wide
approval contract locked in 10-approval-doctrine.md. Polyglot ship: TS + Python + Go
at v0.1.0.
Public surface (v0.1.0)
defineApprovalKinds(serviceName, defs)— type-safe kind registry per spec § 5.3.initApproval({...})— boot-time wiring (pg, redis, telemetry, task-tracking).bindApprovalHandlers({...})— registeronApproved/onRejected/onExpired.requestApproval({...})— the canonical 7-step request sequence per spec § 5.2.startApprovalConsumer({...})/stopApprovalConsumer({...})— BullMQ-leased completion-event consumer per spec § 5.8.getApprovalMigrationSQL(serviceName)— emit per-service<service>_approval_policies<service>_deferred_actionsmigration SQL per spec § 5.4 / § 5.6.
Spec: planning hub feature_doc docKey=approval. See
10-approval-doctrine.md
for the canonical contract.
Boot
import { initApproval, startApprovalConsumer } from "@nodii/approval";
import Redis from "ioredis";
import postgres from "postgres";
const pgPool = postgres(process.env.DATABASE_URL!);
const redis = new Redis(process.env.REDIS_URL!);
await initApproval({
serviceName: "billing",
pgPool,
redis,
taskServiceUrl: process.env.TASK_TRACKING_GRPC_URL!,
});
await startApprovalConsumer({ serviceName: "billing" });See tests/integration.test.ts for an end-to-end example that wires the
library against postgres + redis + an in-process task-tracking gRPC stub.
