Skip to content

v1.0.0

Choose a tag to compare

@ahmedrowaihi ahmedrowaihi released this 28 May 18:52
· 30 commits to main since this release
6863ba1

Major Changes

  • 973cd2b: ## v1.0 — durable, iterative workflows on your own Postgres

    const onboard = flow("onboard")
      .input(z.object({ userId: z.string() }))
      .step("create-account", ({ input }) => createAccount(input.userId))
      .sleep("3d")
      .hook("survey", { schema: z.object({ score: z.number() }) })
      .output(({ input }) => ({ score: input.score }))
      .build();
    
    const handle = engine.register(onboard);
    const { runId } = await handle.start({ userId: "u_1" });
    
    // 3 days later, from a webhook:
    await engine.signal(runId, "survey", { score: 9 });

    The run lives in Postgres for three days. Workers can crash, deploys can roll, the process can be killed and restarted — when the timer fires, the workflow resumes from where it left off.

    Inspired by Trigger.dev's workflow SDK and Temporal. Runs inside your Node app on top of graphile-worker and drizzle-orm. No extra service to host.

    Engine

    • Builderflow().step().sleep().hook().loop().output().build() with a single value channel and typed I/O
    • engine.defineWorkflow — raw escape hatch for dynamic graphs and infinite loops
    • Versioned flowsINCOMPATIBLE_VERSION / NON_DETERMINISTIC on graph drift; never silent corruption
    • Transactional outbox — state writes + queue insert commit atomically; reconciler re-enqueues orphans
    • Lock-order ruleruns FOR UPDATE first everywhere; no deadlock by construction
    • Per-step timeoutMs so a hung function can't pin a worker forever
    • Retentionengine.pruneEvents / engine.pruneRuns

    Compatibility

    • Standard Schema for validation — bring your own (zod, valibot, arktype, …)
    • Zero runtime dependency on zod or ms
    • Works with stable drizzle 0.45+ and graphile-worker 0.16+ (also the v1-rc lines)

    Dev + release pipeline

    • Pre-commit / pre-push hooks via lefthook — lint, format, typecheck, tests
    • Oxc toolingoxlint + oxfmt for fast lint + format
    • PR previews via pkg.pr.new — every PR gets an installable build
    • OIDC trusted publishing to npm — no NPM_TOKEN, no token rotation; releases driven entirely by merging the changesets PR

    Full guide: docs/guide.md. Worked examples (checkout, onboarding, multi-agent + human-in-loop, multi-signer, saga, account deletion): docs/examples/.