docs: correct the dead-output component count from 11 to 9
Quality / quality (ubuntu-latest) (push) Failing after 12m8s
Quality / quality (windows-latest) (push) Canceled after 0s

Counted from source: the 22 remaining outputs sit in 9 components, not 11.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 10:14:28 +05:30
co-authored by Claude Opus 5
parent 8389d9674e
commit 9ed896d2b9
12 changed files with 436 additions and 18 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
import type { Context } from "@wrnexus/core";
import { exportSubjectContext, importSubjectContext, type SubjectContext } from "@wrnexus/rpc";
import type { AddOptions, Job, Queue } from "./index.ts";
import type { DurableQueue } from "./durable.ts";
const QUEUE_AUDIENCE = "wrnexus-queue";
interface SubjectEnvelope<T> {
@@ -27,7 +28,8 @@ export interface SubjectQueue {
}
/** Queue adapter that persists a signed end-user context alongside job data. */
export function subjectQueue(queue: Queue): SubjectQueue {
/** Works with both the in-memory Queue and createDurableQueue(). */
export function subjectQueue(queue: Queue | DurableQueue): SubjectQueue {
return {
async add(ctx, name, data, options) {
const identity = await exportSubjectContext(ctx, QUEUE_AUDIENCE);
+15 -1
View File
@@ -1,5 +1,5 @@
import { afterEach, expect, test } from "bun:test";
import { createQueue, subjectQueue } from "../src/index.ts";
import { createDurableQueue, createQueue, subjectQueue } from "../src/index.ts";
const secret = process.env.WRNEXUS_RPC_SECRET;
const app = process.env.WRNEXUS_APP_NAME;
@@ -24,3 +24,17 @@ test("subjectQueue supplies a verified subject to the worker", async () => {
await queue.drain();
expect(seen).toBe("u1");
});
test("subjectQueue preserves identity when a durable queue persists the job", async () => {
process.env.WRNEXUS_RPC_SECRET = "test-rpc-secret-at-least-32-chars-long";
process.env.WRNEXUS_APP_NAME = "orders";
const queue = createDurableQueue();
const subjectAware = subjectQueue(queue);
let seen: string | undefined;
subjectAware.process<{ orderId: string }>("email", (job) => {
seen = job.subject?.subjectId;
});
await subjectAware.add({ user: { id: "u1" }, locals: {} } as never, "email", { orderId: "o1" });
await queue.drain();
expect(seen).toBe("u1");
});