fix(build): split custom-report registry into client-safe metadata + server query module
The custom-report builder (client component) imported the registry which pulls in @/lib/db (postgres -> tls), breaking the production build. Extract ENTITY_META/ENTITY_KEYS/column defs into registry-meta.ts (no DB imports); registry.ts keeps runQuery + composes ENTITY_REGISTRY. Pre-existing blocker surfaced during pre-merge build validation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,7 @@ import {
|
||||
import { ReportTemplatesButton } from '@/components/reports/shared/report-templates-button';
|
||||
import { apiFetch } from '@/lib/api/client';
|
||||
import { toastError } from '@/lib/api/toast-error';
|
||||
import { ENTITY_KEYS, ENTITY_REGISTRY, type EntityKey } from '@/lib/reports/custom/registry';
|
||||
import { ENTITY_KEYS, ENTITY_META, type EntityKey } from '@/lib/reports/custom/registry-meta';
|
||||
import { formatMoney, formatNumber } from '@/lib/reports/format-currency';
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ interface CustomTemplateConfig extends Record<string, unknown> {
|
||||
}
|
||||
|
||||
function defaultColumnsFor(entity: EntityKey): string[] {
|
||||
return ENTITY_REGISTRY[entity].columns.filter((c) => c.defaultSelected).map((c) => c.key);
|
||||
return ENTITY_META[entity].columns.filter((c) => c.defaultSelected).map((c) => c.key);
|
||||
}
|
||||
|
||||
export function CustomReportBuilder({ portSlug: _portSlug }: { portSlug: string }) {
|
||||
@@ -187,7 +187,7 @@ export function CustomReportBuilder({ portSlug: _portSlug }: { portSlug: string
|
||||
toast.success(`Downloaded ${filename}`);
|
||||
}
|
||||
|
||||
const def = ENTITY_REGISTRY[entity];
|
||||
const def = ENTITY_META[entity];
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
@@ -224,7 +224,7 @@ export function CustomReportBuilder({ portSlug: _portSlug }: { portSlug: string
|
||||
<SelectContent>
|
||||
{ENTITY_KEYS.map((k) => (
|
||||
<SelectItem key={k} value={k}>
|
||||
{ENTITY_REGISTRY[k].label}
|
||||
{ENTITY_META[k].label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
|
||||
Reference in New Issue
Block a user