Skip to content

runWithAuditContext

function runWithAuditContext<T>(scope, fn): T;

Defined in: src/context.ts:52

Run fn inside a scope. Nested scopes inherit and override the outer one (context keys merge).

Type Parameter
T
Parameter Type
scope AuditScope
fn () => T

T

import { runWithAuditContext } from "@xtandard/audit/context";
await runWithAuditContext({ actor: { id: user.id }, tenant: user.orgId }, () =>
audit.record({ action: "invoice.paid", metadata: { invoiceId } }),
);