mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
fix(typecheck): resolve TypeScript errors introduced by lint fixes
- ExecutionMonitor: fix null checks, align metrics with ExecutionMetrics type - error-reporting: handle undefined match groups and status message lookups - multi-tenant-context.examples: use executionId instead of id, fix type casts - multi-tenant-context: add type assertion for request data - workflow-error-handler: spread ErrorContext to satisfy Record<string, unknown> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -109,7 +109,7 @@ export const ExecutionMonitor: React.FC<ExecutionMonitorProps> = ({
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{listError !== undefined && (
|
||||
{listError != null && (
|
||||
<div className={styles.error}>
|
||||
<p>Error loading executions: {listError.message}</p>
|
||||
</div>
|
||||
@@ -125,7 +125,7 @@ export const ExecutionMonitor: React.FC<ExecutionMonitorProps> = ({
|
||||
/>
|
||||
))}
|
||||
|
||||
{executions.length === 0 && listError === undefined && (
|
||||
{executions.length === 0 && listError == null && (
|
||||
<p className={styles.noResults}>No executions yet</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -380,8 +380,9 @@ const MetricsGrid: React.FC<MetricsGridProps> = ({ metrics }) => {
|
||||
<MetricCard label="Retried" value={metrics.retriedNodes} />
|
||||
<MetricCard label="Total Retries" value={metrics.totalRetries} />
|
||||
<MetricCard label="Peak Memory" value={`${metrics.peakMemory} MB`} />
|
||||
<MetricCard label="Data Processed" value={`${metrics.dataProcessed} KB`} />
|
||||
<MetricCard label="API Calls" value={metrics.apiCallsMade} />
|
||||
<MetricCard label="Validation Failures" value={metrics.validationFailures} />
|
||||
<MetricCard label="Recovery Attempts" value={metrics.recoveryAttempts} />
|
||||
<MetricCard label="Recovery Successes" value={metrics.recoverySuccesses} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ class ErrorReportingService {
|
||||
private extractStatusCode(error: Error | string): number | undefined {
|
||||
const message = typeof error === 'string' ? error : error.message
|
||||
const match = message.match(/(\d{3})/)
|
||||
return match != null ? parseInt(match[1], 10) : undefined
|
||||
return match?.[1] != null ? parseInt(match[1], 10) : undefined
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,7 +254,7 @@ class ErrorReportingService {
|
||||
504: 'Gateway timeout. Please try again later.',
|
||||
}
|
||||
|
||||
return messages[statusCode]
|
||||
return messages[statusCode] ?? 'An unexpected error occurred.'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,7 +134,7 @@ export async function manualWorkflowExecution(req: NextRequest) {
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
variables,
|
||||
secrets,
|
||||
secrets: secrets as Record<string, string> | undefined,
|
||||
})
|
||||
|
||||
console.warn(`[${executionId}] Context built for user ${user.id}`)
|
||||
@@ -150,9 +150,8 @@ export async function manualWorkflowExecution(req: NextRequest) {
|
||||
// 6. Return result
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
executionId: record.id,
|
||||
executionId: record.executionId,
|
||||
status: record.status,
|
||||
duration: record.duration,
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(`[${executionId}] Execution failed:`, error)
|
||||
@@ -367,12 +366,11 @@ export async function executeScheduledWorkflow(
|
||||
// 4. Log to database
|
||||
const executionLogOps = db.entity('ExecutionLog')
|
||||
await executionLogOps.create({
|
||||
executionId: record.id,
|
||||
executionId: record.executionId,
|
||||
tenantId,
|
||||
workflowId: workflow.id,
|
||||
triggeredBy: 'schedule',
|
||||
status: record.status,
|
||||
duration: record.duration,
|
||||
createdAt: new Date(),
|
||||
})
|
||||
|
||||
@@ -530,7 +528,7 @@ export async function adminExecuteWorkflow(req: NextRequest) {
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
executionId: record.id,
|
||||
executionId: record.executionId,
|
||||
status: record.status,
|
||||
note: 'Cross-tenant execution by super-admin',
|
||||
})
|
||||
@@ -561,8 +559,8 @@ export async function logExecutionContext(context: ExtendedWorkflowContext) {
|
||||
workflow: sanitized.workflowId,
|
||||
tenant: sanitized.tenantId,
|
||||
user: sanitized.userId,
|
||||
mode: sanitized.multiTenant.executionMode,
|
||||
timestamp: sanitized.multiTenant.requestedAt,
|
||||
mode: (sanitized.multiTenant as Record<string, unknown>)?.executionMode,
|
||||
timestamp: (sanitized.multiTenant as Record<string, unknown>)?.requestedAt,
|
||||
// Variables listed as keys only, no values
|
||||
variables: sanitized.variables,
|
||||
// Limits included for monitoring
|
||||
|
||||
@@ -189,7 +189,7 @@ export class MultiTenantContextBuilder {
|
||||
triggerData: requestData?.triggerData ?? {},
|
||||
variables: this.buildVariables(requestData?.variables),
|
||||
secrets: requestData?.secrets ?? {},
|
||||
request: this.options.captureRequestData ? requestData?.request : undefined,
|
||||
request: this.options.captureRequestData ? requestData?.request as WorkflowContext['request'] : undefined,
|
||||
multiTenant: multiTenantMeta,
|
||||
requestMetadata: {
|
||||
ipAddress: this.requestContext.ipAddress,
|
||||
|
||||
@@ -484,7 +484,7 @@ export class WorkflowErrorHandler {
|
||||
code: WorkflowErrorCode.NOT_FOUND,
|
||||
message: `${resource} not found`,
|
||||
statusCode: 404,
|
||||
details: context,
|
||||
details: { ...context },
|
||||
},
|
||||
diagnostics: {
|
||||
hint: ERROR_HINTS[WorkflowErrorCode.NOT_FOUND],
|
||||
|
||||
Reference in New Issue
Block a user