fix(m4): typed MitreSyncResult interface — drop the as cast
Mirrors the backend Pydantic `SyncResultOut` in TS so the mutation result is
properly typed end-to-end. `(res as { duration_ms: number })` cast removed
from MitrePage.tsx; `apiPost<MitreSyncResult>` carries the contract.
Also annotated the unused query-key factories in mitre.ts so the next reader
knows they're parked for M5 template-form consumption (not dead).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,10 @@ export interface MitreTag {
|
||||
name: string;
|
||||
}
|
||||
|
||||
// Query keys. `status` + `matrix` drive the M4 picker; the per-list factories
|
||||
// (`tactics`/`techniques`/`subtechniques`) are unused today but the M5
|
||||
// template forms will consume them for the standalone REST endpoints when
|
||||
// users edit a single test's tags inline.
|
||||
export const mitreKeys = {
|
||||
status: ['mitre', 'status'] as const,
|
||||
matrix: ['mitre', 'matrix'] as const,
|
||||
@@ -85,3 +89,17 @@ export interface MatrixTactic {
|
||||
export interface MitreMatrix {
|
||||
tactics: MatrixTactic[];
|
||||
}
|
||||
|
||||
/** Mirror of backend `SyncResultOut` (`api/mitre.py`). */
|
||||
export interface MitreSyncResult {
|
||||
tactics_upserted: number;
|
||||
techniques_upserted: number;
|
||||
subtechniques_upserted: number;
|
||||
subtechniques_skipped_orphan: number;
|
||||
technique_tactic_links: number;
|
||||
version: string | null;
|
||||
source: string;
|
||||
started_at: string;
|
||||
finished_at: string;
|
||||
duration_ms: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user