@@ -10,6 +10,7 @@ import { and, eq, inArray } from 'drizzle-orm'
1010import { type NextRequest , NextResponse } from 'next/server'
1111import { checkHybridAuth } from '@/lib/auth/hybrid'
1212import { generateRequestId } from '@/lib/core/utils/request'
13+ import type { TraceSpan , WorkflowExecutionLog } from '@/lib/logs/types'
1314
1415const logger = createLogger ( 'LogsByExecutionIdAPI' )
1516
@@ -79,19 +80,18 @@ export async function GET(
7980 return NextResponse . json ( { error : 'Workflow state snapshot not found' } , { status : 404 } )
8081 }
8182
82- const traceSpans =
83- ( workflowLog . executionData as { traceSpans ?: Array < { [ key : string ] : unknown } > } )
84- ?. traceSpans || [ ]
83+ const executionData = workflowLog . executionData as WorkflowExecutionLog [ 'executionData' ]
84+ const traceSpans = ( executionData ?. traceSpans as TraceSpan [ ] ) || [ ]
8585 const childSnapshotIds = new Set < string > ( )
86- const collectSnapshotIds = ( spans : Array < { [ key : string ] : unknown } > ) => {
86+ const collectSnapshotIds = ( spans : TraceSpan [ ] ) => {
8787 spans . forEach ( ( span ) => {
8888 const snapshotId = span . childWorkflowSnapshotId
8989 if ( typeof snapshotId === 'string' ) {
9090 childSnapshotIds . add ( snapshotId )
9191 }
9292 const children = span . children
9393 if ( Array . isArray ( children ) ) {
94- collectSnapshotIds ( children as Array < { [ key : string ] : unknown } > )
94+ collectSnapshotIds ( children )
9595 }
9696 } )
9797 }
0 commit comments