Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+20
-1
@@ -3,7 +3,7 @@
|
||||
* import them without dragging in the route module's server-only deps
|
||||
* (PrismaClient, getDbClient, session secret env vars).
|
||||
*/
|
||||
import { computeAuditHash } from "@toolctrl/db/audit-hash";
|
||||
import { computeAuditHash } from "@hivegrid/db/audit-hash";
|
||||
|
||||
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
||||
|
||||
@@ -172,6 +172,25 @@ export function renderAuditExportCsv(rows: ReadonlyArray<AuditExportRow>, integr
|
||||
return `${lines.join("\n")}\n`;
|
||||
}
|
||||
|
||||
/**
|
||||
* NDJSON rendering (AK-P3 DoD 3): one JSON object per line. The first line is a
|
||||
* `{"_integrity": ...}` record mirroring the CSV integrity header so a streamed
|
||||
* export still carries the chain-verification evidence.
|
||||
*/
|
||||
export function renderAuditExportNdjson(rows: ReadonlyArray<AuditExportRow>, integrity: AuditIntegritySummary): string {
|
||||
const lines: string[] = [];
|
||||
lines.push(JSON.stringify({ _integrity: integrity }));
|
||||
for (const row of rows) {
|
||||
const record: Record<string, unknown> = {};
|
||||
for (const col of AUDIT_EXPORT_CSV_COLUMNS) {
|
||||
const value = (row as unknown as Record<string, unknown>)[col];
|
||||
record[col] = value instanceof Date ? value.toISOString() : value;
|
||||
}
|
||||
lines.push(JSON.stringify(record));
|
||||
}
|
||||
return `${lines.join("\n")}\n`;
|
||||
}
|
||||
|
||||
export function csvCell(value: unknown): string {
|
||||
if (value === null || value === undefined) return "";
|
||||
if (Array.isArray(value)) return csvCell(value.join("|"));
|
||||
|
||||
Reference in new issue
Block a user