withAuditContext
@nmi-agro/fdm-source / fdm-core/src / withAuditContext
Function: withAuditContext()
withAuditContext<
T>(context,fn):Promise<T>
Defined in: fdm-core/src/authorization.ts:1174
Runs fn with the given audit context active for its entire async subtree.
Safe for concurrent requests — each call gets its own isolated store.
Type Parameters
T
T
Parameters
context
fn
() => T | Promise<T>
Returns
Promise<T>
Example
await withAuditContext({ channel: "api", credential_id: apiKeyId }, async () => {
await getFarm(fdm, principalId, farmId)
})