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:
2026-08-23 09:50:25 +05:30
parent 8fb96f521f
commit 46195462c3
22 changed files with 283 additions and 15 deletions
+13
View File
@@ -297,3 +297,16 @@ const users = await usersRepo.all({
Repository SQL identifiers are validated and values remain parameterized. Placeholder generation is dialect-aware: PostgreSQL uses `$1`, `$2`, and SQLite/MySQL use `?`. List limits are bounded.
`retryTransaction()` retries recognized serialization, deadlock, and database-lock errors by default. Supply `shouldRetry` for application-specific retryable errors; ordinary validation or business errors are not retried automatically.
## Reusable seed helpers
```ts
import { addSeedData, removeSeedData, runSeedQuery, getDb } from "@wrnexus/db";
await addSeedData(getDb, [{ code: "free", credits: 100 }], "plans", { conflict: "ignore" });
await removeSeedData(getDb(), { code: "legacy" }, "plans");
await runSeedQuery(getDb(), "UPDATE plans SET credits = ? WHERE code = ?", [200, "free"]);
```
Table and column identifiers are validated, values are always parameterized, and empty bulk
deletes are refused unless `{ all: true }` is explicit.