@shipfox/client-workflows 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +1 -0
- package/.storybook/preview.css +10 -0
- package/.storybook/preview.tsx +97 -0
- package/.swcrc +42 -0
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +162 -0
- package/LICENSE +21 -0
- package/dist/components/identifier/identifier.d.ts +6 -0
- package/dist/components/identifier/identifier.d.ts.map +1 -0
- package/dist/components/identifier/identifier.js +144 -0
- package/dist/components/identifier/identifier.js.map +1 -0
- package/dist/components/identifier/index.d.ts +2 -0
- package/dist/components/identifier/index.d.ts.map +1 -0
- package/dist/components/identifier/index.js +3 -0
- package/dist/components/identifier/index.js.map +1 -0
- package/dist/components/job-graph/graph-model.d.ts +27 -0
- package/dist/components/job-graph/graph-model.d.ts.map +1 -0
- package/dist/components/job-graph/graph-model.js +107 -0
- package/dist/components/job-graph/graph-model.js.map +1 -0
- package/dist/components/job-graph/index.d.ts +3 -0
- package/dist/components/job-graph/index.d.ts.map +1 -0
- package/dist/components/job-graph/index.js +3 -0
- package/dist/components/job-graph/index.js.map +1 -0
- package/dist/components/job-graph/job-duration-format.d.ts +4 -0
- package/dist/components/job-graph/job-duration-format.d.ts.map +1 -0
- package/dist/components/job-graph/job-duration-format.js +41 -0
- package/dist/components/job-graph/job-duration-format.js.map +1 -0
- package/dist/components/job-graph/job-duration-label.d.ts +5 -0
- package/dist/components/job-graph/job-duration-label.d.ts.map +1 -0
- package/dist/components/job-graph/job-duration-label.js +33 -0
- package/dist/components/job-graph/job-duration-label.js.map +1 -0
- package/dist/components/job-graph/job-graph-content.d.ts +9 -0
- package/dist/components/job-graph/job-graph-content.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph-content.js +181 -0
- package/dist/components/job-graph/job-graph-content.js.map +1 -0
- package/dist/components/job-graph/job-graph-view.d.ts +11 -0
- package/dist/components/job-graph/job-graph-view.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph-view.js +24 -0
- package/dist/components/job-graph/job-graph-view.js.map +1 -0
- package/dist/components/job-graph/job-graph.d.ts +3 -0
- package/dist/components/job-graph/job-graph.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph.js +21 -0
- package/dist/components/job-graph/job-graph.js.map +1 -0
- package/dist/components/job-graph/job-node.d.ts +16 -0
- package/dist/components/job-graph/job-node.d.ts.map +1 -0
- package/dist/components/job-graph/job-node.js +196 -0
- package/dist/components/job-graph/job-node.js.map +1 -0
- package/dist/components/job-graph/types.d.ts +9 -0
- package/dist/components/job-graph/types.d.ts.map +1 -0
- package/dist/components/job-graph/types.js +3 -0
- package/dist/components/job-graph/types.js.map +1 -0
- package/dist/components/step-list/index.d.ts +3 -0
- package/dist/components/step-list/index.d.ts.map +1 -0
- package/dist/components/step-list/index.js +3 -0
- package/dist/components/step-list/index.js.map +1 -0
- package/dist/components/step-list/step-list-model.d.ts +36 -0
- package/dist/components/step-list/step-list-model.d.ts.map +1 -0
- package/dist/components/step-list/step-list-model.js +135 -0
- package/dist/components/step-list/step-list-model.js.map +1 -0
- package/dist/components/step-list/step-list.d.ts +32 -0
- package/dist/components/step-list/step-list.d.ts.map +1 -0
- package/dist/components/step-list/step-list.js +409 -0
- package/dist/components/step-list/step-list.js.map +1 -0
- package/dist/components/workflow-run-duration-label.d.ts +8 -0
- package/dist/components/workflow-run-duration-label.d.ts.map +1 -0
- package/dist/components/workflow-run-duration-label.js +84 -0
- package/dist/components/workflow-run-duration-label.js.map +1 -0
- package/dist/components/workflow-run-list/index.d.ts +2 -0
- package/dist/components/workflow-run-list/index.d.ts.map +1 -0
- package/dist/components/workflow-run-list/index.js +3 -0
- package/dist/components/workflow-run-list/index.js.map +1 -0
- package/dist/components/workflow-run-list/run-display.d.ts +5 -0
- package/dist/components/workflow-run-list/run-display.d.ts.map +1 -0
- package/dist/components/workflow-run-list/run-display.js +19 -0
- package/dist/components/workflow-run-list/run-display.js.map +1 -0
- package/dist/components/workflow-run-list/types.d.ts +21 -0
- package/dist/components/workflow-run-list/types.d.ts.map +1 -0
- package/dist/components/workflow-run-list/types.js +3 -0
- package/dist/components/workflow-run-list/types.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.d.ts +14 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.js +37 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.d.ts +10 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.js +55 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.d.ts +15 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.js +103 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +3 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.js +46 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list.d.ts +3 -0
- package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list.js +20 -0
- package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-row.d.ts +14 -0
- package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-row.js +172 -0
- package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -0
- package/dist/components/workflow-run-summary/index.d.ts +2 -0
- package/dist/components/workflow-run-summary/index.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/index.js +3 -0
- package/dist/components/workflow-run-summary/index.js.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts +9 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js +138 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +20 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.js +252 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts +7 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts.map +1 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.js +84 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.js.map +1 -0
- package/dist/components/workflow-run-view/index.d.ts +3 -0
- package/dist/components/workflow-run-view/index.d.ts.map +1 -0
- package/dist/components/workflow-run-view/index.js +4 -0
- package/dist/components/workflow-run-view/index.js.map +1 -0
- package/dist/components/workflow-run-view/job-card.d.ts +17 -0
- package/dist/components/workflow-run-view/job-card.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-card.js +476 -0
- package/dist/components/workflow-run-view/job-card.js.map +1 -0
- package/dist/components/workflow-run-view/job-execution-switcher.d.ts +10 -0
- package/dist/components/workflow-run-view/job-execution-switcher.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-execution-switcher.js +171 -0
- package/dist/components/workflow-run-view/job-execution-switcher.js.map +1 -0
- package/dist/components/workflow-run-view/job-execution-time-text.d.ts +6 -0
- package/dist/components/workflow-run-view/job-execution-time-text.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-execution-time-text.js +24 -0
- package/dist/components/workflow-run-view/job-execution-time-text.js.map +1 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts +9 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts.map +1 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.js +152 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-selection.d.ts +14 -0
- package/dist/components/workflow-run-view/workflow-run-selection.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-selection.js +56 -0
- package/dist/components/workflow-run-view/workflow-run-selection.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-states.d.ts +12 -0
- package/dist/components/workflow-run-view/workflow-run-states.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-states.js +91 -0
- package/dist/components/workflow-run-view/workflow-run-states.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-view.d.ts +15 -0
- package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-view.js +285 -0
- package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -0
- package/dist/components/workflow-source-panel/index.d.ts +2 -0
- package/dist/components/workflow-source-panel/index.d.ts.map +1 -0
- package/dist/components/workflow-source-panel/index.js +3 -0
- package/dist/components/workflow-source-panel/index.js.map +1 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.d.ts +13 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.d.ts.map +1 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.js +91 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.js.map +1 -0
- package/dist/components/workflow-status/status-visuals.d.ts +12 -0
- package/dist/components/workflow-status/status-visuals.d.ts.map +1 -0
- package/dist/components/workflow-status/status-visuals.js +54 -0
- package/dist/components/workflow-status/status-visuals.js.map +1 -0
- package/dist/components/workflow-status/workflow-status-icon.d.ts +22 -0
- package/dist/components/workflow-status/workflow-status-icon.d.ts.map +1 -0
- package/dist/components/workflow-status/workflow-status-icon.js +100 -0
- package/dist/components/workflow-status/workflow-status-icon.js.map +1 -0
- package/dist/core/entities/job-execution.d.ts +69 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -0
- package/dist/core/entities/job-execution.js +83 -0
- package/dist/core/entities/job-execution.js.map +1 -0
- package/dist/core/entities/job.d.ts +56 -0
- package/dist/core/entities/job.d.ts.map +1 -0
- package/dist/core/entities/job.js +71 -0
- package/dist/core/entities/job.js.map +1 -0
- package/dist/core/entities/step-attempt.d.ts +49 -0
- package/dist/core/entities/step-attempt.d.ts.map +1 -0
- package/dist/core/entities/step-attempt.js +48 -0
- package/dist/core/entities/step-attempt.js.map +1 -0
- package/dist/core/entities/step.d.ts +41 -0
- package/dist/core/entities/step.d.ts.map +1 -0
- package/dist/core/entities/step.js +51 -0
- package/dist/core/entities/step.js.map +1 -0
- package/dist/core/entities/workflow-run-attempt.d.ts +44 -0
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
- package/dist/core/entities/workflow-run-attempt.js +51 -0
- package/dist/core/entities/workflow-run-attempt.js.map +1 -0
- package/dist/core/entities/workflow-run.d.ts +61 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -0
- package/dist/core/entities/workflow-run.js +104 -0
- package/dist/core/entities/workflow-run.js.map +1 -0
- package/dist/core/workflow-run-url-state.d.ts +13 -0
- package/dist/core/workflow-run-url-state.d.ts.map +1 -0
- package/dist/core/workflow-run-url-state.js +43 -0
- package/dist/core/workflow-run-url-state.js.map +1 -0
- package/dist/core/workflow-run.d.ts +13 -0
- package/dist/core/workflow-run.d.ts.map +1 -0
- package/dist/core/workflow-run.js +8 -0
- package/dist/core/workflow-run.js.map +1 -0
- package/dist/env.d.js +2 -0
- package/dist/env.d.js.map +1 -0
- package/dist/feature.d.ts +20 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/feature.js +27 -0
- package/dist/feature.js.map +1 -0
- package/dist/hooks/api/workflow-runs.d.ts +109 -0
- package/dist/hooks/api/workflow-runs.d.ts.map +1 -0
- package/dist/hooks/api/workflow-runs.js +394 -0
- package/dist/hooks/api/workflow-runs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/workflow-run-first-time-use.d.ts +6 -0
- package/dist/pages/workflow-run-first-time-use.d.ts.map +1 -0
- package/dist/pages/workflow-run-first-time-use.js +17 -0
- package/dist/pages/workflow-run-first-time-use.js.map +1 -0
- package/dist/pages/workflow-run-page.d.ts +8 -0
- package/dist/pages/workflow-run-page.d.ts.map +1 -0
- package/dist/pages/workflow-run-page.js +83 -0
- package/dist/pages/workflow-run-page.js.map +1 -0
- package/dist/routes/run-detail.d.ts +8 -0
- package/dist/routes/run-detail.d.ts.map +1 -0
- package/dist/routes/run-detail.js +21 -0
- package/dist/routes/run-detail.js.map +1 -0
- package/dist/routes/runs.d.ts +8 -0
- package/dist/routes/runs.d.ts.map +1 -0
- package/dist/routes/runs.js +20 -0
- package/dist/routes/runs.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +114 -0
- package/src/components/identifier/identifier.tsx +178 -0
- package/src/components/identifier/index.ts +1 -0
- package/src/components/job-graph/graph-model.test.ts +189 -0
- package/src/components/job-graph/graph-model.ts +178 -0
- package/src/components/job-graph/index.ts +2 -0
- package/src/components/job-graph/job-duration-format.ts +54 -0
- package/src/components/job-graph/job-duration-label.tsx +29 -0
- package/src/components/job-graph/job-graph-content.tsx +225 -0
- package/src/components/job-graph/job-graph-view.test.tsx +298 -0
- package/src/components/job-graph/job-graph-view.tsx +45 -0
- package/src/components/job-graph/job-graph.stories.tsx +182 -0
- package/src/components/job-graph/job-graph.tsx +24 -0
- package/src/components/job-graph/job-node.stories.tsx +364 -0
- package/src/components/job-graph/job-node.test.tsx +347 -0
- package/src/components/job-graph/job-node.tsx +202 -0
- package/src/components/job-graph/types.ts +9 -0
- package/src/components/step-list/index.ts +6 -0
- package/src/components/step-list/step-list-model.test.ts +369 -0
- package/src/components/step-list/step-list-model.ts +205 -0
- package/src/components/step-list/step-list.stories.tsx +419 -0
- package/src/components/step-list/step-list.test.tsx +566 -0
- package/src/components/step-list/step-list.tsx +494 -0
- package/src/components/workflow-run-duration-label.tsx +118 -0
- package/src/components/workflow-run-list/index.ts +1 -0
- package/src/components/workflow-run-list/run-display.test.ts +53 -0
- package/src/components/workflow-run-list/run-display.ts +22 -0
- package/src/components/workflow-run-list/types.ts +22 -0
- package/src/components/workflow-run-list/workflow-run-list-content.tsx +58 -0
- package/src/components/workflow-run-list/workflow-run-list-header.tsx +53 -0
- package/src/components/workflow-run-list/workflow-run-list-states.tsx +86 -0
- package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +178 -0
- package/src/components/workflow-run-list/workflow-run-list-view.tsx +57 -0
- package/src/components/workflow-run-list/workflow-run-list.stories.tsx +111 -0
- package/src/components/workflow-run-list/workflow-run-list.tsx +29 -0
- package/src/components/workflow-run-list/workflow-run-row.tsx +176 -0
- package/src/components/workflow-run-summary/index.ts +1 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +230 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.tsx +146 -0
- package/src/components/workflow-run-summary/workflow-run-summary.stories.tsx +414 -0
- package/src/components/workflow-run-summary/workflow-run-summary.test.tsx +354 -0
- package/src/components/workflow-run-summary/workflow-run-summary.tsx +295 -0
- package/src/components/workflow-run-view/agent-config-failure-callout.stories.tsx +140 -0
- package/src/components/workflow-run-view/agent-config-failure-callout.tsx +93 -0
- package/src/components/workflow-run-view/index.ts +2 -0
- package/src/components/workflow-run-view/job-card.stories.tsx +788 -0
- package/src/components/workflow-run-view/job-card.tsx +566 -0
- package/src/components/workflow-run-view/job-execution-switcher.tsx +170 -0
- package/src/components/workflow-run-view/job-execution-time-text.tsx +34 -0
- package/src/components/workflow-run-view/step-attempt-log-panel.test.tsx +290 -0
- package/src/components/workflow-run-view/step-attempt-log-panel.tsx +152 -0
- package/src/components/workflow-run-view/workflow-run-selection.test.ts +280 -0
- package/src/components/workflow-run-view/workflow-run-selection.ts +89 -0
- package/src/components/workflow-run-view/workflow-run-states.tsx +70 -0
- package/src/components/workflow-run-view/workflow-run-view.test.tsx +1214 -0
- package/src/components/workflow-run-view/workflow-run-view.tsx +341 -0
- package/src/components/workflow-source-panel/index.ts +1 -0
- package/src/components/workflow-source-panel/workflow-source-panel.stories.tsx +110 -0
- package/src/components/workflow-source-panel/workflow-source-panel.test.tsx +96 -0
- package/src/components/workflow-source-panel/workflow-source-panel.tsx +136 -0
- package/src/components/workflow-status/status-visuals.test.ts +38 -0
- package/src/components/workflow-status/status-visuals.ts +36 -0
- package/src/components/workflow-status/workflow-status-icon.stories.tsx +90 -0
- package/src/components/workflow-status/workflow-status-icon.tsx +135 -0
- package/src/core/entities/job-execution.ts +139 -0
- package/src/core/entities/job.ts +149 -0
- package/src/core/entities/step-attempt.ts +89 -0
- package/src/core/entities/step.ts +105 -0
- package/src/core/entities/workflow-run-attempt.ts +87 -0
- package/src/core/entities/workflow-run.ts +183 -0
- package/src/core/workflow-run-url-state.ts +61 -0
- package/src/core/workflow-run.test.ts +640 -0
- package/src/core/workflow-run.ts +66 -0
- package/src/env.d.ts +8 -0
- package/src/feature.ts +26 -0
- package/src/hooks/api/workflow-runs.test.tsx +410 -0
- package/src/hooks/api/workflow-runs.ts +485 -0
- package/src/index.ts +45 -0
- package/src/page-harness-budget.test.ts +33 -0
- package/src/pages/workflow-run-first-time-use.tsx +17 -0
- package/src/pages/workflow-run-page.test.tsx +517 -0
- package/src/pages/workflow-run-page.tsx +89 -0
- package/src/routes/run-detail.tsx +15 -0
- package/src/routes/runs.tsx +11 -0
- package/test/fixtures/logs.ts +13 -0
- package/test/fixtures/workflow-run.ts +311 -0
- package/test/pages.tsx +79 -0
- package/test/render.tsx +40 -0
- package/test/setup.ts +3 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vercel.json +8 -0
- package/vitest.config.ts +70 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentConfigIssueDto,
|
|
3
|
+
StepErrorCategoryDto,
|
|
4
|
+
StepErrorReasonDto,
|
|
5
|
+
StepSourceLocationDto,
|
|
6
|
+
WorkflowRunStepDetailDto,
|
|
7
|
+
} from '@shipfox/api-workflows-dto';
|
|
8
|
+
import {type StepAttempt, toStepAttempt} from './step-attempt.js';
|
|
9
|
+
|
|
10
|
+
export type StepErrorReason = StepErrorReasonDto;
|
|
11
|
+
export type AgentConfigIssue = AgentConfigIssueDto;
|
|
12
|
+
export type StepErrorCategory = StepErrorCategoryDto;
|
|
13
|
+
|
|
14
|
+
export interface StepSourceLocation {
|
|
15
|
+
startLine: number;
|
|
16
|
+
endLine: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface StepError {
|
|
20
|
+
message: string;
|
|
21
|
+
exitCode: number | null;
|
|
22
|
+
signal: string | undefined;
|
|
23
|
+
reason: StepErrorReason | undefined;
|
|
24
|
+
agentConfigIssue: AgentConfigIssue | undefined;
|
|
25
|
+
category: StepErrorCategory | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AgentStepConfig {
|
|
29
|
+
provider: string | null;
|
|
30
|
+
model: string | null;
|
|
31
|
+
thinking: string | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Step {
|
|
35
|
+
id: string;
|
|
36
|
+
jobExecutionId: string;
|
|
37
|
+
key: string | null;
|
|
38
|
+
name: string;
|
|
39
|
+
sourceLocation: StepSourceLocation | null;
|
|
40
|
+
status: string;
|
|
41
|
+
type: string;
|
|
42
|
+
config: Record<string, unknown>;
|
|
43
|
+
agentConfig: AgentStepConfig | null;
|
|
44
|
+
error: StepError | null;
|
|
45
|
+
position: number;
|
|
46
|
+
currentAttempt: number;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
updatedAt: string;
|
|
49
|
+
attempts: StepAttempt[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function toStep(dto: WorkflowRunStepDetailDto): Step {
|
|
53
|
+
return {
|
|
54
|
+
id: dto.id,
|
|
55
|
+
jobExecutionId: dto.job_execution_id,
|
|
56
|
+
key: dto.key,
|
|
57
|
+
name: dto.name,
|
|
58
|
+
sourceLocation: dto.source_location ? toStepSourceLocation(dto.source_location) : null,
|
|
59
|
+
status: dto.status,
|
|
60
|
+
type: dto.type,
|
|
61
|
+
config: dto.config,
|
|
62
|
+
agentConfig: toAgentStepConfig(dto),
|
|
63
|
+
error: dto.error ? toStepError(dto.error) : null,
|
|
64
|
+
position: dto.position,
|
|
65
|
+
currentAttempt: dto.current_attempt,
|
|
66
|
+
createdAt: dto.created_at,
|
|
67
|
+
updatedAt: dto.updated_at,
|
|
68
|
+
attempts: dto.attempts.map((attempt) => toStepAttempt(attempt, dto.job_execution_id)),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function toStepSourceLocation(dto: StepSourceLocationDto): StepSourceLocation {
|
|
73
|
+
return {
|
|
74
|
+
startLine: dto.start_line,
|
|
75
|
+
endLine: dto.end_line,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function toStepError(dto: NonNullable<WorkflowRunStepDetailDto['error']>): StepError {
|
|
80
|
+
return {
|
|
81
|
+
message: dto.message,
|
|
82
|
+
exitCode: dto.exit_code ?? null,
|
|
83
|
+
signal: dto.signal,
|
|
84
|
+
reason: dto.reason,
|
|
85
|
+
agentConfigIssue: dto.agent_config_issue,
|
|
86
|
+
category: dto.category,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function toAgentStepConfig(dto: WorkflowRunStepDetailDto): AgentStepConfig | null {
|
|
91
|
+
if (dto.type !== 'agent') return null;
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
provider: stringConfigValue(dto.config.provider),
|
|
95
|
+
model: stringConfigValue(dto.config.model),
|
|
96
|
+
thinking: stringConfigValue(dto.config.thinking),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function stringConfigValue(value: unknown): string | null {
|
|
101
|
+
if (typeof value !== 'string') return null;
|
|
102
|
+
|
|
103
|
+
const trimmedValue = value.trim();
|
|
104
|
+
return trimmedValue ? trimmedValue : null;
|
|
105
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type {WorkflowRunAttemptDto} from '@shipfox/api-workflows-dto';
|
|
2
|
+
import {type Duration, intervalToDuration} from 'date-fns';
|
|
3
|
+
import type {WorkflowRunStatus} from './workflow-run.js';
|
|
4
|
+
|
|
5
|
+
export type WorkflowRunAttemptDisplayDuration =
|
|
6
|
+
| {state: 'fixed'; elapsed: Duration}
|
|
7
|
+
| {state: 'live'; fromIso: string};
|
|
8
|
+
|
|
9
|
+
interface WorkflowRunAttemptSummaryFields {
|
|
10
|
+
workflowRunId: string;
|
|
11
|
+
attempt: number;
|
|
12
|
+
status: WorkflowRunStatus;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
startedAt: string | null;
|
|
15
|
+
finishedAt: string | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface WorkflowRunAttemptFields extends WorkflowRunAttemptSummaryFields {
|
|
19
|
+
id: string;
|
|
20
|
+
rerunMode: 'all' | 'failed' | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class WorkflowRunAttemptSummary {
|
|
24
|
+
workflowRunId!: string;
|
|
25
|
+
attempt!: number;
|
|
26
|
+
status!: WorkflowRunStatus;
|
|
27
|
+
createdAt!: string;
|
|
28
|
+
startedAt!: string | null;
|
|
29
|
+
finishedAt!: string | null;
|
|
30
|
+
|
|
31
|
+
constructor(fields: WorkflowRunAttemptSummaryFields) {
|
|
32
|
+
Object.assign(this, fields);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get displayDuration(): WorkflowRunAttemptDisplayDuration | null {
|
|
36
|
+
return workflowRunAttemptDisplayDurationFromTimestamps(this);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class WorkflowRunAttempt extends WorkflowRunAttemptSummary {
|
|
41
|
+
id!: string;
|
|
42
|
+
rerunMode!: 'all' | 'failed' | null;
|
|
43
|
+
|
|
44
|
+
constructor(fields: WorkflowRunAttemptFields) {
|
|
45
|
+
super(fields);
|
|
46
|
+
this.id = fields.id;
|
|
47
|
+
this.rerunMode = fields.rerunMode;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function toWorkflowRunAttempt(dto: WorkflowRunAttemptDto): WorkflowRunAttempt {
|
|
52
|
+
return new WorkflowRunAttempt({
|
|
53
|
+
id: dto.id,
|
|
54
|
+
workflowRunId: dto.workflow_run_id,
|
|
55
|
+
attempt: dto.attempt,
|
|
56
|
+
status: dto.status,
|
|
57
|
+
createdAt: dto.created_at,
|
|
58
|
+
startedAt: dto.started_at ?? null,
|
|
59
|
+
finishedAt: dto.finished_at ?? null,
|
|
60
|
+
rerunMode: dto.rerun_mode,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function workflowRunAttemptDisplayDurationFromTimestamps({
|
|
65
|
+
startedAt,
|
|
66
|
+
finishedAt,
|
|
67
|
+
}: {
|
|
68
|
+
startedAt: string | null;
|
|
69
|
+
finishedAt: string | null;
|
|
70
|
+
}): WorkflowRunAttemptDisplayDuration | null {
|
|
71
|
+
if (startedAt === null) return null;
|
|
72
|
+
if (finishedAt === null) return {state: 'live', fromIso: startedAt};
|
|
73
|
+
|
|
74
|
+
const elapsed = durationBetween(startedAt, finishedAt);
|
|
75
|
+
return elapsed === null ? null : {state: 'fixed', elapsed};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function durationBetween(from: string, to: string): Duration | null {
|
|
79
|
+
const start = new Date(from);
|
|
80
|
+
const end = new Date(to);
|
|
81
|
+
if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return null;
|
|
82
|
+
|
|
83
|
+
return intervalToDuration({
|
|
84
|
+
start,
|
|
85
|
+
end: end < start ? start : end,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
WorkflowRunDetailResponseDto,
|
|
3
|
+
WorkflowRunListResponseDto,
|
|
4
|
+
WorkflowRunResponseDto,
|
|
5
|
+
WorkflowRunStatusDto,
|
|
6
|
+
} from '@shipfox/api-workflows-dto';
|
|
7
|
+
import {type Job, toJob, WORKFLOW_JOB_STATUSES} from './job.js';
|
|
8
|
+
import {
|
|
9
|
+
toWorkflowRunAttempt,
|
|
10
|
+
type WorkflowRunAttempt,
|
|
11
|
+
WorkflowRunAttemptSummary,
|
|
12
|
+
} from './workflow-run-attempt.js';
|
|
13
|
+
|
|
14
|
+
export type WorkflowRunStatus = WorkflowRunStatusDto;
|
|
15
|
+
export type WorkflowStatus = WorkflowRunStatus | (typeof WORKFLOW_JOB_STATUSES)[number];
|
|
16
|
+
|
|
17
|
+
export const WORKFLOW_RUN_STATUSES = [
|
|
18
|
+
'pending',
|
|
19
|
+
'running',
|
|
20
|
+
'succeeded',
|
|
21
|
+
'failed',
|
|
22
|
+
'cancelled',
|
|
23
|
+
] as const satisfies readonly WorkflowRunStatus[];
|
|
24
|
+
|
|
25
|
+
export const TERMINAL_WORKFLOW_RUN_STATUSES = [
|
|
26
|
+
'succeeded',
|
|
27
|
+
'failed',
|
|
28
|
+
'cancelled',
|
|
29
|
+
] as const satisfies readonly WorkflowRunStatus[];
|
|
30
|
+
|
|
31
|
+
const WORKFLOW_STATUSES = new Set<WorkflowStatus>([
|
|
32
|
+
...WORKFLOW_RUN_STATUSES,
|
|
33
|
+
...WORKFLOW_JOB_STATUSES,
|
|
34
|
+
]);
|
|
35
|
+
const TERMINAL_WORKFLOW_RUN_STATUS_SET = new Set<WorkflowRunStatus>(TERMINAL_WORKFLOW_RUN_STATUSES);
|
|
36
|
+
|
|
37
|
+
export interface WorkflowSourceSnapshot {
|
|
38
|
+
content: string;
|
|
39
|
+
format: 'yaml';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface WorkflowRun {
|
|
43
|
+
id: string;
|
|
44
|
+
projectId: string;
|
|
45
|
+
definitionId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
currentAttempt: number;
|
|
48
|
+
triggerProvider: string | null;
|
|
49
|
+
triggerSource: string;
|
|
50
|
+
triggerEvent: string;
|
|
51
|
+
triggerDisplayLabel: string;
|
|
52
|
+
triggerLabel: string;
|
|
53
|
+
triggerPayload: Record<string, unknown>;
|
|
54
|
+
inputs: Record<string, unknown> | null;
|
|
55
|
+
sourceSnapshot: WorkflowSourceSnapshot | null;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
shortId: string;
|
|
59
|
+
isTemporary: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface WorkflowRunListItem extends WorkflowRun {
|
|
63
|
+
status: WorkflowRunStatus;
|
|
64
|
+
latestAttempt: number;
|
|
65
|
+
runAttempt: WorkflowRunAttemptSummary;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface WorkflowRunDetail extends WorkflowRun {
|
|
69
|
+
latestAttempt: number;
|
|
70
|
+
runAttempt: WorkflowRunAttempt;
|
|
71
|
+
jobs: Job[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface WorkflowRunListPage {
|
|
75
|
+
runs: WorkflowRunListItem[];
|
|
76
|
+
nextCursor: string | null;
|
|
77
|
+
filteredTotalCount: number | null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function workflowRunShortId(id: string): string {
|
|
81
|
+
return id.length <= 8 ? id : id.slice(0, 8);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function workflowRunTriggerLabel({
|
|
85
|
+
triggerSource,
|
|
86
|
+
triggerEvent,
|
|
87
|
+
}: {
|
|
88
|
+
triggerSource: string;
|
|
89
|
+
triggerEvent: string;
|
|
90
|
+
}): string {
|
|
91
|
+
return [triggerSource, triggerEvent].filter(Boolean).join(' · ');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function workflowRunTriggerDisplayLabel({
|
|
95
|
+
triggerSource,
|
|
96
|
+
triggerEvent,
|
|
97
|
+
}: {
|
|
98
|
+
triggerSource: string;
|
|
99
|
+
triggerEvent: string;
|
|
100
|
+
}): string {
|
|
101
|
+
return triggerEvent || triggerSource;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function isWorkflowRunTerminal(status: WorkflowRunStatus): boolean {
|
|
105
|
+
return TERMINAL_WORKFLOW_RUN_STATUS_SET.has(status);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function isWorkflowStatus(status: string): status is WorkflowStatus {
|
|
109
|
+
return WORKFLOW_STATUSES.has(status as WorkflowStatus);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function toWorkflowRun(dto: WorkflowRunResponseDto): WorkflowRun {
|
|
113
|
+
const triggerLabel = workflowRunTriggerLabel({
|
|
114
|
+
triggerSource: dto.trigger_source,
|
|
115
|
+
triggerEvent: dto.trigger_event,
|
|
116
|
+
});
|
|
117
|
+
const triggerDisplayLabel = workflowRunTriggerDisplayLabel({
|
|
118
|
+
triggerSource: dto.trigger_source,
|
|
119
|
+
triggerEvent: dto.trigger_event,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
id: dto.id,
|
|
124
|
+
projectId: dto.project_id,
|
|
125
|
+
definitionId: dto.definition_id,
|
|
126
|
+
name: dto.name,
|
|
127
|
+
currentAttempt: dto.current_attempt,
|
|
128
|
+
triggerProvider: dto.trigger_provider,
|
|
129
|
+
triggerSource: dto.trigger_source,
|
|
130
|
+
triggerEvent: dto.trigger_event,
|
|
131
|
+
triggerDisplayLabel,
|
|
132
|
+
triggerLabel,
|
|
133
|
+
triggerPayload: dto.trigger_payload,
|
|
134
|
+
inputs: dto.inputs ?? null,
|
|
135
|
+
sourceSnapshot: dto.source_snapshot ? toWorkflowSourceSnapshot(dto.source_snapshot) : null,
|
|
136
|
+
createdAt: dto.created_at,
|
|
137
|
+
updatedAt: dto.updated_at,
|
|
138
|
+
shortId: workflowRunShortId(dto.id),
|
|
139
|
+
isTemporary: dto.id.startsWith('temp-'),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function toWorkflowRunListItem(dto: WorkflowRunResponseDto): WorkflowRunListItem {
|
|
144
|
+
return {
|
|
145
|
+
...toWorkflowRun(dto),
|
|
146
|
+
status: dto.status,
|
|
147
|
+
latestAttempt: dto.latest_attempt,
|
|
148
|
+
runAttempt: new WorkflowRunAttemptSummary({
|
|
149
|
+
workflowRunId: dto.id,
|
|
150
|
+
attempt: dto.current_attempt,
|
|
151
|
+
status: dto.status,
|
|
152
|
+
createdAt: dto.created_at,
|
|
153
|
+
startedAt: dto.started_at ?? null,
|
|
154
|
+
finishedAt: dto.finished_at ?? null,
|
|
155
|
+
}),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function toWorkflowRunDetail(dto: WorkflowRunDetailResponseDto): WorkflowRunDetail {
|
|
160
|
+
return {
|
|
161
|
+
...toWorkflowRun(dto),
|
|
162
|
+
latestAttempt: dto.latest_attempt,
|
|
163
|
+
runAttempt: toWorkflowRunAttempt(dto.run_attempt),
|
|
164
|
+
jobs: dto.jobs.map(toJob),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function toWorkflowRunListPage(dto: WorkflowRunListResponseDto): WorkflowRunListPage {
|
|
169
|
+
return {
|
|
170
|
+
runs: dto.runs.map(toWorkflowRunListItem),
|
|
171
|
+
nextCursor: dto.next_cursor,
|
|
172
|
+
filteredTotalCount: dto.filtered_total_count,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function toWorkflowSourceSnapshot(
|
|
177
|
+
dto: NonNullable<WorkflowRunResponseDto['source_snapshot']>,
|
|
178
|
+
): WorkflowSourceSnapshot {
|
|
179
|
+
return {
|
|
180
|
+
content: dto.content,
|
|
181
|
+
format: dto.format,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface WorkflowRunSelectionInput {
|
|
2
|
+
jobId?: string | undefined;
|
|
3
|
+
jobExecutionId?: string | undefined;
|
|
4
|
+
stepId?: string | undefined;
|
|
5
|
+
stepAttemptId?: string | undefined;
|
|
6
|
+
runAttempt?: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const WORKFLOW_RUN_URL_SELECTION_KEYS = [
|
|
10
|
+
'job',
|
|
11
|
+
'jobExecution',
|
|
12
|
+
'step',
|
|
13
|
+
'stepAttempt',
|
|
14
|
+
'runAttempt',
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
type WorkflowRunSearch = Record<string, unknown>;
|
|
18
|
+
|
|
19
|
+
export function workflowRunSelectionFromSearch(
|
|
20
|
+
search: WorkflowRunSearch,
|
|
21
|
+
): WorkflowRunSelectionInput {
|
|
22
|
+
return {
|
|
23
|
+
jobId: stringSearchParam(search.job),
|
|
24
|
+
jobExecutionId: stringSearchParam(search.jobExecution),
|
|
25
|
+
stepId: stringSearchParam(search.step),
|
|
26
|
+
stepAttemptId: stringSearchParam(search.stepAttempt),
|
|
27
|
+
runAttempt: positiveIntegerSearchParam(search.runAttempt),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function withWorkflowRunSelectionSearch<TSearch extends WorkflowRunSearch>(
|
|
32
|
+
search: TSearch,
|
|
33
|
+
selection: WorkflowRunSelectionInput,
|
|
34
|
+
): TSearch {
|
|
35
|
+
const nextSearch: WorkflowRunSearch = withoutWorkflowRunSelectionSearch(search);
|
|
36
|
+
if (selection.jobId) nextSearch.job = selection.jobId;
|
|
37
|
+
if (selection.jobExecutionId) nextSearch.jobExecution = selection.jobExecutionId;
|
|
38
|
+
if (selection.stepId) nextSearch.step = selection.stepId;
|
|
39
|
+
if (selection.stepAttemptId) nextSearch.stepAttempt = selection.stepAttemptId;
|
|
40
|
+
if (selection.runAttempt) nextSearch.runAttempt = String(selection.runAttempt);
|
|
41
|
+
return nextSearch as TSearch;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function withoutWorkflowRunSelectionSearch<TSearch extends WorkflowRunSearch>(
|
|
45
|
+
search: TSearch,
|
|
46
|
+
): TSearch {
|
|
47
|
+
const nextSearch: WorkflowRunSearch = {...search};
|
|
48
|
+
for (const key of WORKFLOW_RUN_URL_SELECTION_KEYS) {
|
|
49
|
+
delete nextSearch[key];
|
|
50
|
+
}
|
|
51
|
+
return nextSearch as TSearch;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function stringSearchParam(value: unknown): string | undefined {
|
|
55
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function positiveIntegerSearchParam(value: unknown): number | undefined {
|
|
59
|
+
const raw = typeof value === 'string' ? Number(value) : value;
|
|
60
|
+
return typeof raw === 'number' && Number.isInteger(raw) && raw > 0 ? raw : undefined;
|
|
61
|
+
}
|