Skip to content

Function: readAuditHeaders()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / readAuditHeaders

readAuditHeaders(headers): AuditResponseHeaders

Defined in: src/utils/audit-headers.ts:120

Read the audit ledger’s x-osfkb-* response headers.

Headers

The response headers: response.headers inside an Interceptor, or ApiError.headers on a failure.

AuditResponseHeaders

Each header’s value, or null where the response carries none.

x-osfkb-audit-record is the id to pass as AuditCausalHeaders.causedBy on the next request, and to read with client.compliance.getRecord. When auditError is set, that record does not exist.

let lastRecord: string | null = null;
const client = new ReasoningLayerClient({
baseUrl,
tenantId,
auth: { mode: 'cookie' },
interceptors: [
async (request, next) => {
const response = await next(request);
lastRecord = readAuditHeaders(response.headers).auditRecord;
return response;
},
],
});