一键导入
nestjs-durable
nestjs-durable 收录了来自 DavideCarvalho 的 5 个 skills,并提供仓库级职业覆盖和站内 skill 详情页。
这个仓库中的 skills
The one correctness rule for @dudousxd/nestjs-durable workflows — the run(ctx, input) body re-runs top-to-bottom on recovery, so it must be deterministic. Keep Date.now/Math.random/IO out of the body and inside dispatched ctx.step calls; use ctx.now() for a checkpointed timestamp and ctx.sideEffect(fn) for any other non-deterministic capture (an id, a random draw). Covers positional replay, NonDeterminismError, @Workflow version pinning + side-by-side registration for breaking changes, exactly-once vs physical retry idempotency, and self-healing recovery.
Set up @dudousxd/nestjs-durable in a NestJS app — DurableModule.forRootAsync with a StateStore + Transport, register @Workflow / @Step providers, and start runs with WorkflowService. Covers the zero-infra EventEmitterTransport + InMemoryStateStore default, start() enqueues vs waitForRun() settles, autoSchema, drive:false dashboard/API-only replicas, DurableModule as a thin worker (connection only, no store), forRoot vs forRootAsync, app.enableShutdownHooks for graceful drain.
Pause and resume @dudousxd/nestjs-durable workflows — ctx.waitForSignal(token) resumed by WorkflowService.signal(token, payload), ctx.waitForEvent(name, { match }) resumed by publishEvent(name, payload), @OnEvent / @Workflow({ onEvent }) event-triggered starts, durable ctx.sleep(duration) / ctx.sleepUntil(date), ctx.webhook() for third-party callbacks, and signalWithStart for the durable-entity/accumulator pattern. Covers the timeoutMs determinism caveat.
Unit-test @dudousxd/nestjs-durable workflows with @dudousxd/nestjs-durable-testing — createTestEngine gives an in-memory engine/store/transport + a controllable clock. Register a workflow body with engine.register, serve its dispatched ctx.step calls with transport.handle, start runs with engine.start + waitForRun, advance durable sleeps with tick(ms), inject failures with failOnce/failTimes to drive retries, and assert with assertRunStatus, assertOutput, assertStepsRan, assertStepAttempts, recordedSteps. No Postgres, no Redis, no real time.
Author durable workflows with @dudousxd/nestjs-durable — @Workflow({ name, version }) classes with a run(ctx, input) body and ONE durable step primitive: ctx.step(handlerRef | name, input, opts?), always dispatched, always engine-scheduled. @Step()-decorated provider methods carry the routing identity (derived Class.method name, or an explicit override); a method reference dispatches a same-process/typed step, a string name dispatches a cross-runtime one (e.g. a Python worker). Covers retries/backoff and FatalError, Promise.all fan-out, sub-process log.sub/subProcess annotations inside a @Step handler, ctx.child for cross-runtime sub-workflows, and constructor dependency injection inside a workflow class.