Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

fix(frontend): type the enricher-service and log-service API boundaries

dextmorgn704702f9cec0
diff --git a/flowsint-app/src/api/enricher-service.ts b/flowsint-app/src/api/enricher-service.ts
index 26d0a9aa..8cebacce 100644
--- a/flowsint-app/src/api/enricher-service.ts
+++ b/flowsint-app/src/api/enricher-service.ts
@@ -1,25 +1,28 @@
import { fetchWithAuth } from './api'
+import type { Enricher } from '@/types/enricher'
export const enricherService = {
- get: async (type?: string): Promise<any> => {
+ get: async (type?: string): Promise<Enricher[]> => {
const url = type ? `/api/enrichers?category=${type}` : '/api/enrichers'
return fetchWithAuth(url, {
method: 'GET'
})
},
- getTemplates: async (): Promise<any> => {
+ // No current callers — kept for API parity, typed honestly rather than
+ // guessed since nothing here reads the shape.
+ getTemplates: async (): Promise<unknown> => {
const url = '/api/enrichers/templates'
return fetchWithAuth(url, {
method: 'GET'
})
},
- getTemplateById: async (templateId: string): Promise<any> => {
+ getTemplateById: async (templateId: string): Promise<unknown> => {
const url = `/api/enrichers/templates/${templateId}`
return fetchWithAuth(url, {
method: 'GET'
})
},
- launch: async (enricherName: string, body: BodyInit): Promise<any> => {
+ launch: async (enricherName: string, body: BodyInit): Promise<unknown> => {
return fetchWithAuth(`/api/enrichers/${enricherName}/launch`, {
method: 'POST',
body: body
diff --git a/flowsint-app/src/api/log-service.ts b/flowsint-app/src/api/log-service.ts
index c8bb9eb1..b2885f3c 100644
--- a/flowsint-app/src/api/log-service.ts
+++ b/flowsint-app/src/api/log-service.ts
@@ -1,12 +1,13 @@
import { fetchWithAuth } from './api'
+import type { Event } from '@/types/event'
export const logService = {
- get: async (sketch_id: string): Promise<any> => {
+ get: async (sketch_id: string): Promise<Event[]> => {
return fetchWithAuth(`/api/events/sketch/${sketch_id}/logs`, {
method: 'GET'
})
},
- delete: async (sketch_id: string): Promise<any> => {
+ delete: async (sketch_id: string): Promise<unknown> => {
return fetchWithAuth(`/api/events/sketch/${sketch_id}/logs`, {
method: 'DELETE'
})
diff --git a/flowsint-app/src/hooks/use-events.ts b/flowsint-app/src/hooks/use-events.ts
index 328b926b..6bb27aa5 100644
--- a/flowsint-app/src/hooks/use-events.ts
+++ b/flowsint-app/src/hooks/use-events.ts
@@ -4,6 +4,7 @@ import { logService } from '@/api/log-service'
import { queryKeys } from '@/api/query-keys'
import { useAuthStore } from '@/stores/auth-store'
import { connectSSE } from '@/api/sse'
+import type { Event } from '@/types/event'
const API_URL = import.meta.env.VITE_API_URL ?? ''