feat: make queues durable by default and add seed helpers
Quality / quality (ubuntu-latest) (push) Failing after 11m1s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
Clintchiz committed 2026-08-23 09:50:25 +05:30
1 parent 8fb96f521f
commit 46195462c3
22 files changed
+283 -15

No files matched your search

+4
View File
@@ -40,6 +40,7 @@ import { VALIDATE_RUNTIME } from "@wrnexus/validation";
import { I18N_RUNTIME, type ResolvedI18n } from "@wrnexus/i18n";
import { setDb, registerLazyDb, getDb, hasDb, migrate } from "@wrnexus/db";
import { connectFromConfig } from "@wrnexus/db/connect";
import { configureQueueStorage, type QueueStorageConfig } from "@wrnexus/queue";
import { hasAuthzCatalog, mergeCatalogs, setAuthzCatalog, type AuthzModule } from "@wrnexus/authz";
import {
configureStorage,
@@ -138,6 +139,8 @@ export interface ProdOptions {
db?: { driver: string; url: string };
/** Named databases, reached with `getDb("<name>")`. */
databases?: Record<string, { driver: string; url: string }>;
/** Queue persistence; durable SQLite is used when omitted. */
queue?: QueueStorageConfig;
/**
* Absolute path to the default db's migrations bundled into the build
* (`dist/migrations`). When set, they are applied on startup — like dev.
@@ -499,6 +502,7 @@ export function createProductionHandlers(
for (const [name, cfg] of Object.entries(opts.databases ?? {})) {
registerLazyDb(name, () => connectFromConfig(cfg));
}
configureQueueStorage({ ...opts.queue, appRoot: process.cwd() });
// File-upload storage. Relative local dirs resolve against the deployment cwd
// (NOT dist/, which is rebuilt) so uploads persist across deploys.