Skip to content

v0.18.0

Choose a tag to compare

@kvet kvet released this 15 Nov 07:44
· 59 commits to main since this release
v0.18.0
e3b7dbe

Queuert 0.18 can run synchronously inside your driver's own transaction. It adds experimental MySQL/MariaDB and Redis state adapters, a broker-free IPC notify adapter and a public migrator for your own migrations. Schema fencing protects state across upgrades, and the release reworks tx hooks, the worker runner, job type codecs and adapter conformance, with breaking API changes and a Node.js 24 minimum.

What's Changed

Breaking Changes

  • Node.js 24 or later is required. Every package's engines.node is now >=24.
  • Factories are synchronous. A client, worker runner or adapter factory returns its value directly instead of a promise, so you can build them at module top level. An existing await on the result keeps working.
  • createInProcessWorker → createWorkerRunner (and InProcessWorker → WorkerRunner). The runner gains stop(), close() and [Symbol.asyncDispose], and start() no longer returns a stop function.
  • Transaction hooks are now tx hooks. transactionHooks is renamed to txHooks, and the keyed hook registry is removed. The new txHooks.retryBoundary supports drivers that rerun the transaction callback, such as MongoDB's session.withTransaction.
  • State providers own commit and rollback callbacks. Custom providers must implement onTransactionCommit and onTransactionRollback. txHooks is no longer an option on complete or on the client's mutating methods, and complete succeeds once per attempt.
  • Job type codecs replace parseInput/parseOutput. encodeInput, decodeInput, encodeOutput and decodeOutput run on every write and read, so a Date written through a schema comes back as a Date. Encoded values must be JSON-serializable: a value that used to be coerced silently now throws JobTypeValidationError, and defineJobTypes enforces this at compile time.
  • Adapters are disposable and typed by mode. StateAdapter and NotifyAdapter take a "sync" or "async" mode type parameter and must implement disposal, so you can hold them with await using.
  • In-process adapters default to synchronous mode. They return the adapter directly, and InProcessContext is removed.
  • A client created without notifyAdapter now uses an in-process notify adapter. Its own worker runners and awaitChain calls are woken immediately, without polling.
  • Conformance suites are case lists. Run them with your own test runner, one test per case. The lists are layered into base, concurrent, async-only and end-to-end. The run*Conformance runners, their fixtures and the Expect type are removed, and the State* types moved from queuert/internal to queuert.
  • Schema fencing (PostgreSQL, SQLite). Code running against a newer schema now fails with SchemaFencedError instead of corrupting state. Migration history is squashed into 001_schema_v1, and 0.17 migration records are kept on upgrade. Stop every 0.17 process before running the next fenced migration.
  • classifyError is required on PostgreSQL and SQLite state providers.
  • truncate() is removed from PgStateAdapter and SqliteStateAdapter.
  • Pre-0.17 compatibility is dropped. Worker runners no longer reschedule running jobs that hold no attempt token, and listWorkerJobs no longer accepts workerId: null.
  • SQLite type parameters changed on createSqliteStateAdapter and createSqliteMigrator.
  • Dashboard API: the frontend talks to its server through a single POST {basePath}/api/rpc endpoint. It replaces /api/chains, /api/jobs and /api/workers.

Features

  • Synchronous mode. With a SQLite driver that runs statements synchronously, you can call Queuert inside the driver's own synchronous transaction, such as db.transaction(() => …)(). The client follows its state adapter's mode, and SQLite gains synchronous providers and a Migrator<"sync">.
  • @queuert/mysql (experimental): a MySQL 8.4+ / MariaDB 11.4+ state adapter, with a migrator and conformance entries.
  • Redis state adapter (experimental): createRedisStateAdapter keeps chains, jobs and workers in Redis, standalone or Cluster.
  • @queuert/ipc (experimental): a notify adapter over Unix sockets or named pipes, for multi-process apps on one host without a broker.
  • Public migrator (experimental): createPgMigrator, createSqliteMigrator and createMysqlMigrator run your application's own migrations with the same engine as Queuert's schema (#8).
  • Chain tail jobs (experimental): getChainTailJob and getChainTailJobs read the job each chain is currently on, for a whole batch of chains in a single read (#9).
  • Conformance with your adapter configuration: the state provider conformance helpers accept stateAdapterOptions.
  • Browser support: queuert no longer depends on Node.js built-ins, so the client, worker runner and in-process adapters also run in browsers and service workers.
  • Dashboard: the theme follows a change made in another tab, the favicon adapts to dark mode, the dashboard works under a CSP without unsafe-eval, and it accepts a client in either mode.

Improvements

  • Faster job processing: each job uses about 35–40% less CPU and allocates less memory.
  • PostgreSQL providers open transactions at READ COMMITTED explicitly, so a higher server or role default can't change Queuert's own transactions.
  • SQLite takes its write lock through a no-op write to the {prefix}write_lock table, the same way migrations do.
  • Clearer stack traces: functions that run in both modes carry their real names in stack traces and CPU profiles. A synchronous client given a callback that returns a promise reports that clearly.
  • Stability: @queuert/sqlite and @queuert/dashboard are now marked stable.

Bug Fixes

  • When deduplication matches a createChain/createChains call to an existing multi-step chain, the call now returns that chain's real output.
  • A notify adapter whose unsubscribe fails no longer interrupts the worker or awaitChain; the error is logged instead.
  • Deletes (deleteChains, stopping a worker) are fenced like other writes.

Packages

All packages released at 0.18.0: queuert, @queuert/postgres, @queuert/sqlite, @queuert/mysql, @queuert/redis, @queuert/nats, @queuert/ipc, @queuert/otel, @queuert/dashboard. @queuert/mysql and @queuert/ipc are published for the first time.