diff --git a/web_src/.eslint-budget-baseline.json b/web_src/.eslint-budget-baseline.json index 1cd4c99540..8461cabfae 100644 --- a/web_src/.eslint-budget-baseline.json +++ b/web_src/.eslint-budget-baseline.json @@ -1,8 +1,8 @@ { - "maxAllowedTotalIssues": 774, + "maxAllowedTotalIssues": 772, "maxAllowedByRule": { "complexity": 245, - "@typescript-eslint/no-explicit-any": 173, + "@typescript-eslint/no-explicit-any": 171, "max-statements": 86, "max-lines-per-function": 83, "@typescript-eslint/no-non-null-asserted-optional-chain": 83, @@ -12,5 +12,5 @@ "max-depth": 9, "max-params": 6 }, - "updatedAt": "2026-04-07T18:57:58.369Z" + "updatedAt": "2026-04-07T19:28:09.729Z" } diff --git a/web_src/src/pages/workflowv2/mappers/approval.ts b/web_src/src/pages/workflowv2/mappers/approval.ts index a04bc6780e..7ccf33f611 100644 --- a/web_src/src/pages/workflowv2/mappers/approval.ts +++ b/web_src/src/pages/workflowv2/mappers/approval.ts @@ -1,4 +1,3 @@ -import type { CanvasesCanvasNodeExecution } from "@/api-client"; import type { ComponentBaseContext, ComponentBaseMapper, @@ -95,7 +94,7 @@ export const APPROVAL_STATE_MAP: EventStateMap = { /** * Approval-specific state logic function */ -export const approvalStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => { +export const approvalStateFunction: StateFunction = (execution: ExecutionInfo): EventState => { if ( execution.resultMessage && (execution.resultReason === "RESULT_REASON_ERROR" || diff --git a/web_src/src/pages/workflowv2/mappers/circleci/run_pipeline.ts b/web_src/src/pages/workflowv2/mappers/circleci/run_pipeline.ts index 9863f2255c..77bf5d4b1e 100644 --- a/web_src/src/pages/workflowv2/mappers/circleci/run_pipeline.ts +++ b/web_src/src/pages/workflowv2/mappers/circleci/run_pipeline.ts @@ -1,4 +1,3 @@ -import type { CanvasesCanvasNodeExecution } from "@/api-client"; import type React from "react"; import CircleCILogo from "@/assets/icons/integrations/circleci.svg"; import type { @@ -47,7 +46,7 @@ export const RUN_PIPELINE_STATE_MAP: EventStateMap = { }, }; -export const runPipelineStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => { +export const runPipelineStateFunction: StateFunction = (execution: ExecutionInfo): EventState => { if (!execution) return "neutral"; if ( diff --git a/web_src/src/pages/workflowv2/mappers/gitlab/run_pipeline.ts b/web_src/src/pages/workflowv2/mappers/gitlab/run_pipeline.ts index 0aad9680b2..d25966ab14 100644 --- a/web_src/src/pages/workflowv2/mappers/gitlab/run_pipeline.ts +++ b/web_src/src/pages/workflowv2/mappers/gitlab/run_pipeline.ts @@ -1,5 +1,4 @@ import type React from "react"; -import type { CanvasesCanvasNodeExecution } from "@/api-client"; import type { ComponentBaseProps, ComponentBaseSpec, EventState, EventStateMap } from "@/ui/componentBase"; import { DEFAULT_EVENT_STATE_MAP } from "@/ui/componentBase"; import type { @@ -7,6 +6,7 @@ import type { ComponentBaseMapper, EventStateRegistry, ExecutionDetailsContext, + ExecutionInfo, OutputPayload, StateFunction, SubtitleContext, @@ -54,7 +54,7 @@ export const RUN_PIPELINE_STATE_MAP: EventStateMap = { }, }; -export const runPipelineStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => { +export const runPipelineStateFunction: StateFunction = (execution: ExecutionInfo): EventState => { if (!execution) return "neutral"; if ( diff --git a/web_src/src/pages/workflowv2/mappers/harness/run_pipeline.ts b/web_src/src/pages/workflowv2/mappers/harness/run_pipeline.ts index 35cb6c0cd0..4deecb0238 100644 --- a/web_src/src/pages/workflowv2/mappers/harness/run_pipeline.ts +++ b/web_src/src/pages/workflowv2/mappers/harness/run_pipeline.ts @@ -23,7 +23,6 @@ import type { MetadataItem } from "@/ui/metadataList"; import HarnessIcon from "@/assets/icons/integrations/harness.svg"; import { renderTimeAgo } from "@/components/TimeAgo"; import { getTriggerRenderer } from ".."; -import type { CanvasesCanvasNodeExecution } from "@/api-client"; export const RUN_PIPELINE_STATE_MAP: EventStateMap = { ...DEFAULT_EVENT_STATE_MAP, @@ -47,7 +46,7 @@ export const RUN_PIPELINE_STATE_MAP: EventStateMap = { }, }; -export const runPipelineStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => { +export const runPipelineStateFunction: StateFunction = (execution: ExecutionInfo): EventState => { if (!execution) return "neutral"; if ( diff --git a/web_src/src/pages/workflowv2/mappers/pagerduty/base.ts b/web_src/src/pages/workflowv2/mappers/pagerduty/base.ts index a917836655..f969ce280d 100644 --- a/web_src/src/pages/workflowv2/mappers/pagerduty/base.ts +++ b/web_src/src/pages/workflowv2/mappers/pagerduty/base.ts @@ -1,12 +1,11 @@ -import type { CanvasesCanvasNodeExecution } from "@/api-client"; -import type { OutputPayload } from "../types"; +import type { ExecutionInfo, OutputPayload } from "../types"; import type { Incident, ResourceRef } from "./types"; /** * Extracts an incident from execution outputs with proper null checks. * Returns null if outputs are missing or empty (e.g., when execution failed with an error). */ -export function getIncidentFromExecution(execution: CanvasesCanvasNodeExecution): Incident | null { +export function getIncidentFromExecution(execution: ExecutionInfo): Incident | null { const outputs = execution.outputs as { default?: OutputPayload[] } | undefined; if (!outputs || !outputs.default || outputs.default.length === 0) { @@ -69,7 +68,7 @@ export function getDetailsForIncident(incident: Incident | undefined, agent?: Re * Includes incident details if available, and adds error in the proper format if execution failed. * This ensures errors are displayed as key/value pairs, not raw text. */ -export function buildIncidentExecutionDetails(execution: CanvasesCanvasNodeExecution): Record { +export function buildIncidentExecutionDetails(execution: ExecutionInfo): Record { const details: Record = {}; // Add execution timestamp diff --git a/web_src/src/pages/workflowv2/mappers/semaphore/run_workflow.ts b/web_src/src/pages/workflowv2/mappers/semaphore/run_workflow.ts index 04aa77b154..82fec66c9a 100644 --- a/web_src/src/pages/workflowv2/mappers/semaphore/run_workflow.ts +++ b/web_src/src/pages/workflowv2/mappers/semaphore/run_workflow.ts @@ -23,7 +23,6 @@ import type { MetadataItem } from "@/ui/metadataList"; import { getTriggerRenderer } from ".."; import SemaphoreLogo from "@/assets/semaphore-logo-sign-black.svg"; import { renderTimeAgo } from "@/components/TimeAgo"; -import type { CanvasesCanvasNodeExecution } from "@/api-client"; import { formatTimestampInUserTimezone } from "@/lib/timezone"; import { stringOrDash } from "../utils"; @@ -162,7 +161,7 @@ export const RUN_WORKFLOW_STATE_MAP: EventStateMap = { /** * Semaphore-specific state logic function */ -export const runWorkflowStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => { +export const runWorkflowStateFunction: StateFunction = (execution: ExecutionInfo): EventState => { if (!execution) return "neutral"; if ( diff --git a/web_src/src/pages/workflowv2/mappers/servicenow/base.ts b/web_src/src/pages/workflowv2/mappers/servicenow/base.ts index ae9f6a5ac6..681952aab9 100644 --- a/web_src/src/pages/workflowv2/mappers/servicenow/base.ts +++ b/web_src/src/pages/workflowv2/mappers/servicenow/base.ts @@ -1,12 +1,11 @@ import type { EventSection } from "@/ui/componentBase"; import { getState, getTriggerRenderer } from ".."; import type { ExecutionInfo, NodeInfo, OutputPayload } from "../types"; -import type { CanvasesCanvasNodeExecution } from "@/api-client"; import { renderTimeAgo } from "@/components/TimeAgo"; import type { IncidentRecord } from "./types"; import { STATE_LABELS, URGENCY_LABELS, IMPACT_LABELS } from "./types"; -export function getIncidentFromExecution(execution: CanvasesCanvasNodeExecution): IncidentRecord | null { +export function getIncidentFromExecution(execution: ExecutionInfo): IncidentRecord | null { const outputs = execution.outputs as { default?: OutputPayload[] } | undefined; if (!outputs || !outputs.default || outputs.default.length === 0) { return null; @@ -29,10 +28,7 @@ export function baseEventSections(nodes: NodeInfo[], execution: ExecutionInfo, c ]; } -export function buildIncidentExecutionDetails( - execution: CanvasesCanvasNodeExecution, - instanceUrl?: string, -): Record { +export function buildIncidentExecutionDetails(execution: ExecutionInfo, instanceUrl?: string): Record { const details: Record = {}; if (execution.createdAt) { details["Executed at"] = new Date(execution.createdAt).toLocaleString(); diff --git a/web_src/src/pages/workflowv2/mappers/slack/wait_for_button_click.ts b/web_src/src/pages/workflowv2/mappers/slack/wait_for_button_click.ts index d9223bed5b..43dd1c697d 100644 --- a/web_src/src/pages/workflowv2/mappers/slack/wait_for_button_click.ts +++ b/web_src/src/pages/workflowv2/mappers/slack/wait_for_button_click.ts @@ -22,7 +22,6 @@ import { getTriggerRenderer } from ".."; import type { MetadataItem } from "@/ui/metadataList"; import slackIcon from "@/assets/icons/integrations/slack.svg"; import { renderTimeAgo } from "@/components/TimeAgo"; -import type { CanvasesCanvasNodeExecution } from "@/api-client"; interface WaitForButtonClickConfiguration { channel?: string; @@ -69,7 +68,7 @@ const WAIT_FOR_BUTTON_CLICK_STATE_MAP: EventStateMap = { }; // State function to determine the state of an execution -const waitForButtonClickStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => { +const waitForButtonClickStateFunction: StateFunction = (execution: ExecutionInfo): EventState => { if (execution.result === "RESULT_CANCELLED") { return "cancelled"; } diff --git a/web_src/src/pages/workflowv2/mappers/telegram/wait_for_button_click.ts b/web_src/src/pages/workflowv2/mappers/telegram/wait_for_button_click.ts index 412f8ef0df..88b436c694 100644 --- a/web_src/src/pages/workflowv2/mappers/telegram/wait_for_button_click.ts +++ b/web_src/src/pages/workflowv2/mappers/telegram/wait_for_button_click.ts @@ -22,7 +22,6 @@ import { getTriggerRenderer } from ".."; import type { MetadataItem } from "@/ui/metadataList"; import telegramIcon from "@/assets/icons/integrations/telegram.svg"; import { renderTimeAgo } from "@/components/TimeAgo"; -import type { CanvasesCanvasNodeExecution } from "@/api-client"; interface WaitForButtonClickConfiguration { chatId?: string; @@ -67,7 +66,7 @@ const WAIT_FOR_BUTTON_CLICK_STATE_MAP: EventStateMap = { }, }; -const waitForButtonClickStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => { +const waitForButtonClickStateFunction: StateFunction = (execution: ExecutionInfo): EventState => { if (execution.result === "RESULT_CANCELLED") { return "cancelled"; } diff --git a/web_src/src/pages/workflowv2/mappers/timegate.tsx b/web_src/src/pages/workflowv2/mappers/timegate.tsx index d681daf132..21a699640a 100644 --- a/web_src/src/pages/workflowv2/mappers/timegate.tsx +++ b/web_src/src/pages/workflowv2/mappers/timegate.tsx @@ -1,5 +1,4 @@ import React from "react"; -import type { CanvasesCanvasNodeExecution } from "@/api-client"; import type { ComponentBaseContext, ComponentBaseMapper, @@ -23,6 +22,17 @@ import { getTriggerRenderer, getState, getStateMap } from "."; import { calcRelativeTimeFromDiff } from "@/lib/utils"; import { renderTimeAgo } from "@/components/TimeAgo"; +interface Configuration { + days?: string[]; + excludeDates?: string[]; + timeRange?: string; + timezone?: string; +} + +interface Metadata { + nextValidTime?: string; +} + export const timeGateMapper: ComponentBaseMapper = { props(context: ComponentBaseContext): ComponentBaseProps { const componentName = context.componentDefinition.name || "timegate"; @@ -171,12 +181,12 @@ const daysOfWeekLabels = { const monthLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; function getTimeGateSpecs(node: NodeInfo): ComponentBaseSpec[] { - const configuration = node.configuration as Record; - const days = (configuration?.days as string[]) || []; - const excludeDates = (configuration?.excludeDates as string[]) || []; - const timeRange = (configuration?.timeRange as string) || "00:00-23:59"; + const configuration = node.configuration as Configuration; + const days = configuration?.days || []; + const excludeDates = configuration?.excludeDates || []; + const timeRange = configuration?.timeRange || "00:00-23:59"; const timeRangeLabel = formatTimeRangeLabel(timeRange); - const timezoneLabel = getTimezoneDisplay((configuration?.timezone as string) || "0"); + const timezoneLabel = getTimezoneDisplay(configuration?.timezone || "0"); const formattedExcludeDates = excludeDates .map((date) => formatDayInYearLabel(date)) @@ -250,7 +260,7 @@ function getTimeGateEventSubtitle(execution: ExecutionInfo, componentName: strin : ""; if (executionState === "waiting") { - const executionMetadata = execution.metadata as { nextValidTime?: string }; + const executionMetadata = execution.metadata as Metadata; if (executionMetadata?.nextValidTime) { return ; } @@ -300,12 +310,12 @@ const TimeGateCountdown: React.FC<{ nextValidTime: string; timeAgo?: string | Re ); }; -function isTimeGatePushedThrough(execution: CanvasesCanvasNodeExecution): boolean { +function isTimeGatePushedThrough(execution: ExecutionInfo): boolean { if (!execution.updatedAt) { return false; } - const metadata = execution.metadata as { nextValidTime?: string } | undefined; + const metadata = execution.metadata as Metadata | undefined; if (!metadata?.nextValidTime) { return false; } diff --git a/web_src/src/pages/workflowv2/mappers/types.ts b/web_src/src/pages/workflowv2/mappers/types.ts index 8c2a4f5c9d..89b5600163 100644 --- a/web_src/src/pages/workflowv2/mappers/types.ts +++ b/web_src/src/pages/workflowv2/mappers/types.ts @@ -76,8 +76,8 @@ export type ExecutionInfo = { result: CanvasNodeExecutionResult; resultReason: CanvasNodeExecutionResultReason; resultMessage: string; - metadata: any; - configuration: any; + metadata: unknown; + configuration: unknown; rootEvent: EventInfo; outputs?: { [key: string]: unknown;