@shipfox/client-workflows 5.0.0 → 6.0.1
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +53 -0
- package/dist/components/workflow-run-list/types.d.ts +12 -0
- package/dist/components/workflow-run-list/types.d.ts.map +1 -1
- package/dist/components/workflow-run-list/types.js.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +1 -1
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list-view.js +32 -11
- package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list.d.ts +1 -1
- package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list.js +7 -2
- package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -1
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +2 -3
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -1
- package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -1
- package/dist/components/workflow-run-view/job-card.d.ts.map +1 -1
- package/dist/components/workflow-run-view/job-card.js +9 -8
- package/dist/components/workflow-run-view/job-card.js.map +1 -1
- package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -1
- package/dist/core/entities/job-execution.d.ts +11 -6
- package/dist/core/entities/job-execution.d.ts.map +1 -1
- package/dist/core/entities/job-execution.js +0 -19
- package/dist/core/entities/job-execution.js.map +1 -1
- package/dist/core/entities/job.d.ts +32 -10
- package/dist/core/entities/job.d.ts.map +1 -1
- package/dist/core/entities/job.js +0 -22
- package/dist/core/entities/job.js.map +1 -1
- package/dist/core/entities/step-attempt.d.ts +28 -3
- package/dist/core/entities/step-attempt.d.ts.map +1 -1
- package/dist/core/entities/step-attempt.js +0 -17
- package/dist/core/entities/step-attempt.js.map +1 -1
- package/dist/core/entities/step.d.ts +6 -6
- package/dist/core/entities/step.d.ts.map +1 -1
- package/dist/core/entities/step.js +19 -49
- package/dist/core/entities/step.js.map +1 -1
- package/dist/core/entities/workflow-run-attempt.d.ts +0 -2
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -1
- package/dist/core/entities/workflow-run-attempt.js +0 -12
- package/dist/core/entities/workflow-run-attempt.js.map +1 -1
- package/dist/core/entities/workflow-run.d.ts +6 -7
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js +1 -67
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/core/workflow-run.d.ts +9 -9
- package/dist/core/workflow-run.d.ts.map +1 -1
- package/dist/core/workflow-run.js +6 -6
- package/dist/core/workflow-run.js.map +1 -1
- package/dist/feature.d.ts +13 -0
- package/dist/feature.d.ts.map +1 -1
- package/dist/feature.js +17 -16
- package/dist/feature.js.map +1 -1
- package/dist/hooks/api/workflow-run-mapper.d.ts +12 -0
- package/dist/hooks/api/workflow-run-mapper.d.ts.map +1 -0
- package/dist/hooks/api/workflow-run-mapper.js +207 -0
- package/dist/hooks/api/workflow-run-mapper.js.map +1 -0
- package/dist/hooks/api/workflow-runs.d.ts +25 -55
- package/dist/hooks/api/workflow-runs.d.ts.map +1 -1
- package/dist/hooks/api/workflow-runs.js +95 -51
- package/dist/hooks/api/workflow-runs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pages/project-workflows-page.d.ts.map +1 -1
- package/dist/pages/project-workflows-page.js +14 -14
- package/dist/pages/project-workflows-page.js.map +1 -1
- package/dist/pages/workflow-run-page.d.ts +3 -1
- package/dist/pages/workflow-run-page.d.ts.map +1 -1
- package/dist/pages/workflow-run-page.js +21 -14
- package/dist/pages/workflow-run-page.js.map +1 -1
- package/dist/routes/inputs.d.ts +22 -0
- package/dist/routes/inputs.d.ts.map +1 -0
- package/dist/routes/inputs.js +76 -0
- package/dist/routes/inputs.js.map +1 -0
- package/dist/routes/run-detail.d.ts +2 -0
- package/dist/routes/run-detail.d.ts.map +1 -1
- package/dist/routes/run-detail.js +6 -6
- package/dist/routes/run-detail.js.map +1 -1
- package/dist/routes/runs.d.ts +2 -0
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +6 -6
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/workflows.js +3 -5
- package/dist/routes/workflows.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +13 -14
- package/src/components/workflow-run-list/types.ts +6 -0
- package/src/components/workflow-run-list/workflow-run-list-view.tsx +27 -11
- package/src/components/workflow-run-list/workflow-run-list.tsx +6 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +5 -6
- package/src/components/workflow-run-summary/workflow-run-summary.tsx +3 -3
- package/src/components/workflow-run-view/job-card.tsx +20 -11
- package/src/components/workflow-run-view/workflow-run-view.test.tsx +3 -3
- package/src/components/workflow-run-view/workflow-run-view.tsx +2 -2
- package/src/core/entities/job-execution.ts +12 -28
- package/src/core/entities/job.ts +44 -45
- package/src/core/entities/step-attempt.ts +9 -20
- package/src/core/entities/step.ts +38 -66
- package/src/core/entities/workflow-run-attempt.ts +0 -14
- package/src/core/entities/workflow-run.ts +8 -86
- package/src/core/workflow-run.test.ts +13 -11
- package/src/core/workflow-run.ts +8 -13
- package/src/feature.ts +19 -17
- package/src/hooks/api/workflow-run-mapper.ts +246 -0
- package/src/hooks/api/workflow-runs.test.tsx +57 -59
- package/src/hooks/api/workflow-runs.ts +187 -88
- package/src/index.ts +4 -0
- package/src/pages/project-workflows-page.test.tsx +1 -1
- package/src/pages/project-workflows-page.tsx +31 -26
- package/src/pages/workflow-run-page.test.tsx +4 -2
- package/src/pages/workflow-run-page.tsx +22 -17
- package/src/routes/inputs.test.ts +22 -0
- package/src/routes/inputs.ts +58 -0
- package/src/routes/run-detail.tsx +12 -8
- package/src/routes/runs.tsx +11 -4
- package/src/routes/workflows.tsx +3 -3
- package/test/fixtures/workflow-run.ts +9 -7
- package/test/pages.tsx +20 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/vercel.json +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/workflow-run-view/workflow-run-view.tsx"],"sourcesContent":["import type {WorkflowRunRerunModeDto} from '@shipfox/api-workflows-dto';\nimport {ApiError} from '@shipfox/client-api';\nimport {QueryLoadError} from '@shipfox/client-ui';\nimport {RelativeTimeProvider} from '@shipfox/react-ui/relative-time';\nimport {toast} from '@shipfox/react-ui/toast';\nimport {useNavigate} from '@tanstack/react-router';\nimport {useEffect, useId, useRef, useState} from 'react';\nimport {\n type JobExecution,\n resolveJobExecution,\n type StepSourceLocation,\n} from '#core/workflow-run.js';\nimport {\n type WorkflowRunSelectionInput,\n withoutWorkflowRunSelectionSearch,\n} from '#core/workflow-run-url-state.js';\nimport {\n useCancelWorkflowRunMutation,\n useRerunWorkflowRunMutation,\n useWorkflowRunAttemptQuery,\n} from '#hooks/api/workflow-runs.js';\nimport {JobGraph} from '../job-graph/index.js';\nimport {WorkflowRunSummary} from '../workflow-run-summary/index.js';\nimport {WorkflowSourcePanel} from '../workflow-source-panel/index.js';\nimport {JobCard} from './job-card.js';\nimport {resolveWorkflowRunSelection} from './workflow-run-selection.js';\nimport {\n WorkflowRunNotFound,\n WorkflowRunSkeleton,\n WorkflowRunStaleError,\n} from './workflow-run-states.js';\n\ninterface WorkflowSourceFocus {\n stepId: string;\n location: StepSourceLocation;\n}\n\nexport interface WorkflowRunViewProps {\n workspaceId: string;\n projectId: string;\n workflowRunId?: string | undefined;\n selection?: WorkflowRunSelectionInput | undefined;\n onSelectionChange?: ((selection: WorkflowRunSelectionInput) => void) | undefined;\n}\n\n/**\n * Renders the run for `workflowRunId`, or a skeleton while `workflowRunId` is still unknown (the page is\n * resolving which run to show) or the run is loading, so the page never branches on the\n * loading state itself.\n */\nexport function WorkflowRunView({\n workspaceId,\n projectId,\n workflowRunId,\n selection,\n onSelectionChange,\n}: WorkflowRunViewProps) {\n const runQuery = useWorkflowRunAttemptQuery({workflowRunId, runAttempt: selection?.runAttempt});\n const rerunMutation = useRerunWorkflowRunMutation(projectId);\n\n return (\n <RelativeTimeProvider>\n <div className=\"flex min-h-0 min-w-0 flex-1 overflow-hidden\">\n <RunViewContent\n workspaceId={workspaceId}\n projectId={projectId}\n query={runQuery}\n rerunMutation={rerunMutation}\n selection={selection}\n onSelectionChange={onSelectionChange}\n />\n </div>\n </RelativeTimeProvider>\n );\n}\n\nfunction RunViewContent({\n workspaceId,\n projectId,\n query,\n rerunMutation,\n selection,\n onSelectionChange,\n}: {\n workspaceId: string;\n projectId: string;\n query: ReturnType<typeof useWorkflowRunAttemptQuery>;\n rerunMutation: ReturnType<typeof useRerunWorkflowRunMutation>;\n selection: WorkflowRunSelectionInput | undefined;\n onSelectionChange: ((selection: WorkflowRunSelectionInput) => void) | undefined;\n}) {\n const navigate = useNavigate();\n const [selectedJobId, setSelectedJobId] = useState<string | undefined>();\n const [selectedJobExecutionId, setSelectedJobExecutionId] = useState<string | undefined>();\n const [sourcePanelOpen, setSourcePanelOpen] = useState(false);\n const [sourceFocus, setSourceFocus] = useState<WorkflowSourceFocus | null>(null);\n const sourcePanelId = useId();\n const sourceButtonRef = useRef<HTMLButtonElement>(null);\n // The button that last opened the panel (summary or a step detail), so Escape /\n // Close returns focus to whoever opened it.\n const lastSourceTriggerRef = useRef<HTMLButtonElement | null>(null);\n const selectionControlled = selection !== undefined;\n const sourceAvailable =\n query.data?.sourceSnapshot !== null && query.data?.sourceSnapshot !== undefined;\n const cancelMutation = useCancelWorkflowRunMutation(query.data);\n\n useEffect(() => {\n if (!sourceAvailable) {\n setSourcePanelOpen(false);\n setSourceFocus(null);\n }\n }, [sourceAvailable]);\n\n // If a refetch drops the focused step or its location, degrade to whole-workflow\n // focus so the panel never points at an unmounted Source button.\n useEffect(() => {\n if (!sourceFocus) return;\n const stillLocated = query.data?.jobs.some((job) =>\n job.jobExecutions.some((execution) =>\n execution.steps.some((step) => step.id === sourceFocus.stepId && step.sourceLocation),\n ),\n );\n if (!stillLocated) {\n setSourceFocus(null);\n lastSourceTriggerRef.current = sourceButtonRef.current;\n }\n }, [sourceFocus, query.data]);\n\n if (query.isPending) return <WorkflowRunSkeleton />;\n\n // Only show the full error placeholder when nothing ever loaded. A refetch that fails after\n // a prior success keeps the loaded run on screen (see below) instead of wiping the pane,\n // since active-run polling can hit a transient API error.\n if (query.isError && query.data === undefined) {\n if (query.error instanceof ApiError && query.error.status === 404) {\n return <WorkflowRunNotFound />;\n }\n return <QueryLoadError query={query} subject=\"workflow run\" icon=\"pulseLine\" />;\n }\n\n if (query.data === undefined) return <WorkflowRunSkeleton />;\n\n const runData = query.data;\n const resolvedSelection = selectionControlled\n ? resolveWorkflowRunSelection({run: runData, selection})\n : undefined;\n const selectedJob = selectionControlled\n ? resolvedSelection?.job\n : (runData.jobs.find((job) => job.id === selectedJobId) ?? runData.jobs.at(0));\n const selectedJobExecution = selectionControlled\n ? resolvedSelection?.jobExecution\n : selectedJob\n ? resolveJobExecution(selectedJob, selectedJobExecutionId)\n : undefined;\n const selectedAttemptId = selectionControlled\n ? (resolvedSelection?.selectedAttemptId ?? null)\n : undefined;\n // Explicit per-step focus wins; fall back to the URL-selected step so deep links\n // still pre-highlight when the summary opens the whole-workflow source.\n const highlightedLineRange =\n sourceFocus?.location ?? resolvedSelection?.step?.sourceLocation ?? null;\n const sourceSnapshot = runData.sourceSnapshot;\n async function rerun(mode: WorkflowRunRerunModeDto) {\n try {\n const run = await rerunMutation.mutateAsync({workflowRunId: runData.id, mode});\n toast.success('Re-run started');\n await navigate({\n to: '/workspaces/$wid/projects/$pid/runs/$workflowRunId',\n params: {wid: workspaceId, pid: projectId, workflowRunId: run.id},\n search: ((previous: Record<string, unknown>) =>\n withoutWorkflowRunSelectionSearch(previous)) as never,\n });\n } catch (error) {\n toast.error(error instanceof ApiError ? error.message : 'Could not start re-run');\n }\n }\n\n function selectJob(jobId: string | undefined) {\n if (!selectionControlled) {\n setSelectedJobId(jobId);\n setSelectedJobExecutionId(undefined);\n return;\n }\n\n onSelectionChange?.(\n jobId ? {jobId, runAttempt: selection?.runAttempt} : {runAttempt: selection?.runAttempt},\n );\n }\n\n function selectJobExecution(jobExecutionId: string | undefined) {\n if (!selectionControlled) {\n setSelectedJobExecutionId(jobExecutionId);\n return;\n }\n if (!selectedJob) return;\n\n onSelectionChange?.({\n jobId: selectedJob.id,\n jobExecutionId,\n runAttempt: selection?.runAttempt,\n });\n }\n\n function selectAttempt(attemptId: string | undefined) {\n if (!selectionControlled || !selectedJob || !selectedJobExecution) return;\n\n if (!attemptId) {\n onSelectionChange?.({\n jobId: selectedJob.id,\n jobExecutionId: selectedJobExecution.id,\n runAttempt: selection?.runAttempt,\n });\n return;\n }\n\n const match = findAttemptSelection(selectedJobExecution, attemptId);\n if (!match) return;\n\n onSelectionChange?.({\n jobId: selectedJob.id,\n jobExecutionId: selectedJobExecution.id,\n stepId: match.stepId,\n stepAttemptId: match.attemptId,\n runAttempt: selection?.runAttempt,\n });\n }\n\n function openWholeWorkflowSource() {\n setSourceFocus(null);\n lastSourceTriggerRef.current = sourceButtonRef.current;\n setSourcePanelOpen(true);\n }\n\n function toggleWholeWorkflowSource() {\n if (sourcePanelOpen && sourceFocus === null) {\n closeSourcePanel();\n return;\n }\n openWholeWorkflowSource();\n }\n\n function openStepSource(\n stepId: string,\n location: StepSourceLocation,\n trigger: HTMLButtonElement | null,\n ) {\n setSourceFocus({stepId, location});\n lastSourceTriggerRef.current = trigger;\n setSourcePanelOpen(true);\n }\n\n function closeSourcePanel() {\n const trigger = lastSourceTriggerRef.current;\n const fallbackTrigger = sourceButtonRef.current;\n setSourcePanelOpen(false);\n // Defer so focus lands after the panel unmounts; clear the focus only after\n // focusing so the opener button is still expanded (force-visible) on return.\n window.setTimeout(() => {\n const focusTarget = trigger?.isConnected ? trigger : fallbackTrigger;\n focusTarget?.focus();\n setSourceFocus(null);\n }, 0);\n }\n\n function cancelRun() {\n cancelMutation.mutate(undefined, {\n onError: (error) => {\n toast.error(cancelErrorMessage(error));\n },\n });\n }\n\n return (\n <>\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <WorkflowRunSummary\n workspaceId={workspaceId}\n projectId={projectId}\n run={runData}\n sourceAvailable={sourceAvailable}\n sourceOpen={sourcePanelOpen && sourceFocus === null}\n sourcePanelId={sourcePanelId}\n sourceButtonRef={sourceButtonRef}\n onSourceToggle={toggleWholeWorkflowSource}\n cancelling={cancelMutation.isPending}\n onCancel={cancelRun}\n rerunPending={rerunMutation.isPending}\n onRerun={(mode) => void rerun(mode)}\n latestAttempt={runData.latestAttempt}\n />\n {query.isError ? <WorkflowRunStaleError query={query} /> : null}\n <div className=\"min-h-0 flex-1 overflow-auto bg-background-neutral-base p-16\">\n <div className=\"mx-auto flex w-full max-w-[1280px] flex-col gap-16\">\n <JobGraph\n run={runData}\n selectedJobId={selectedJob?.id}\n onSelectedJobChange={selectJob}\n />\n {selectedJob ? (\n <JobCard\n workspaceId={workspaceId}\n job={selectedJob}\n selectedJobExecution={selectedJobExecution}\n selectedAttemptId={selectedJob.carriedOver ? undefined : selectedAttemptId}\n onSelectedJobExecutionChange={selectJobExecution}\n onSelectedAttemptChange={selectionControlled ? selectAttempt : undefined}\n sourcePanelId={sourcePanelId}\n sourceAvailable={sourceAvailable}\n focusedSourceStepId={sourceFocus?.stepId ?? null}\n onOpenStepSource={openStepSource}\n />\n ) : null}\n </div>\n </div>\n </div>\n <WorkflowSourcePanel\n id={sourcePanelId}\n source={sourceSnapshot}\n open={sourcePanelOpen && sourceAvailable}\n onClose={closeSourcePanel}\n highlightedLineRange={highlightedLineRange}\n scrollHighlightedIntoView\n />\n </>\n );\n}\n\nfunction cancelErrorMessage(error: unknown): string {\n if (error instanceof ApiError && error.code === 'run-already-finished') {\n return 'This workflow run has already finished.';\n }\n return 'Could not cancel workflow run.';\n}\n\nfunction findAttemptSelection(jobExecution: JobExecution, attemptId: string) {\n for (const step of jobExecution.steps) {\n const attempt = step.attempts.find((candidate) => candidate.id === attemptId);\n if (attempt) return {stepId: step.id, attemptId: attempt.id};\n }\n return undefined;\n}\n"],"names":["ApiError","QueryLoadError","RelativeTimeProvider","toast","useNavigate","useEffect","useId","useRef","useState","resolveJobExecution","withoutWorkflowRunSelectionSearch","useCancelWorkflowRunMutation","useRerunWorkflowRunMutation","useWorkflowRunAttemptQuery","JobGraph","WorkflowRunSummary","WorkflowSourcePanel","JobCard","resolveWorkflowRunSelection","WorkflowRunNotFound","WorkflowRunSkeleton","WorkflowRunStaleError","WorkflowRunView","workspaceId","projectId","workflowRunId","selection","onSelectionChange","runQuery","runAttempt","rerunMutation","div","className","RunViewContent","query","navigate","selectedJobId","setSelectedJobId","selectedJobExecutionId","setSelectedJobExecutionId","sourcePanelOpen","setSourcePanelOpen","sourceFocus","setSourceFocus","sourcePanelId","sourceButtonRef","lastSourceTriggerRef","selectionControlled","undefined","sourceAvailable","data","sourceSnapshot","cancelMutation","stillLocated","jobs","some","job","jobExecutions","execution","steps","step","id","stepId","sourceLocation","current","isPending","isError","error","status","subject","icon","runData","resolvedSelection","run","selectedJob","find","at","selectedJobExecution","jobExecution","selectedAttemptId","highlightedLineRange","location","rerun","mode","mutateAsync","success","to","params","wid","pid","search","previous","message","selectJob","jobId","selectJobExecution","jobExecutionId","selectAttempt","attemptId","match","findAttemptSelection","stepAttemptId","openWholeWorkflowSource","toggleWholeWorkflowSource","closeSourcePanel","openStepSource","trigger","fallbackTrigger","window","setTimeout","focusTarget","isConnected","focus","cancelRun","mutate","onError","cancelErrorMessage","sourceOpen","onSourceToggle","cancelling","onCancel","rerunPending","onRerun","latestAttempt","onSelectedJobChange","carriedOver","onSelectedJobExecutionChange","onSelectedAttemptChange","focusedSourceStepId","onOpenStepSource","source","open","onClose","scrollHighlightedIntoView","code","attempt","attempts","candid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mBAAmBjD,KAAc;IACxC,IAAIA,iBAAiBnE,YAAYmE,MAAMmE,IAAI,KAAK,wBAAwB;QACtE,OAAO;IACT;IACA,OAAO;AACT;AAEA,SAASlC,qBAAqBtB,YAA0B,EAAEoB,SAAiB;IACzE,KAAK,MAAMtC,QAAQkB,aAAanB,KAAK,CAAE;QACrC,MAAM4E,UAAU3E,KAAK4E,QAAQ,CAAC7D,IAAI,CAAC,CAAC8D,YAAcA,UAAU5E,EAAE,KAAKqC;QACnE,IAAIqC,SAAS,OAAO;YAACzE,QAAQF,KAAKC,EAAE;YAAEqC,WAAWqC,QAAQ1E,EAAE;QAAA;IAC7D;IACA,OAAOb;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/workflow-run-view/workflow-run-view.tsx"],"sourcesContent":["import {ApiError} from '@shipfox/client-api';\nimport {QueryLoadError} from '@shipfox/client-ui';\nimport {RelativeTimeProvider} from '@shipfox/react-ui/relative-time';\nimport {toast} from '@shipfox/react-ui/toast';\nimport {useNavigate} from '@tanstack/react-router';\nimport {useEffect, useId, useRef, useState} from 'react';\nimport {\n type JobExecution,\n resolveJobExecution,\n type StepSourceLocation,\n type WorkflowRunRerunMode,\n} from '#core/workflow-run.js';\nimport {\n type WorkflowRunSelectionInput,\n withoutWorkflowRunSelectionSearch,\n} from '#core/workflow-run-url-state.js';\nimport {\n useCancelWorkflowRunMutation,\n useRerunWorkflowRunMutation,\n useWorkflowRunAttemptQuery,\n} from '#hooks/api/workflow-runs.js';\nimport {JobGraph} from '../job-graph/index.js';\nimport {WorkflowRunSummary} from '../workflow-run-summary/index.js';\nimport {WorkflowSourcePanel} from '../workflow-source-panel/index.js';\nimport {JobCard} from './job-card.js';\nimport {resolveWorkflowRunSelection} from './workflow-run-selection.js';\nimport {\n WorkflowRunNotFound,\n WorkflowRunSkeleton,\n WorkflowRunStaleError,\n} from './workflow-run-states.js';\n\ninterface WorkflowSourceFocus {\n stepId: string;\n location: StepSourceLocation;\n}\n\nexport interface WorkflowRunViewProps {\n workspaceId: string;\n projectId: string;\n workflowRunId?: string | undefined;\n selection?: WorkflowRunSelectionInput | undefined;\n onSelectionChange?: ((selection: WorkflowRunSelectionInput) => void) | undefined;\n}\n\n/**\n * Renders the run for `workflowRunId`, or a skeleton while `workflowRunId` is still unknown (the page is\n * resolving which run to show) or the run is loading, so the page never branches on the\n * loading state itself.\n */\nexport function WorkflowRunView({\n workspaceId,\n projectId,\n workflowRunId,\n selection,\n onSelectionChange,\n}: WorkflowRunViewProps) {\n const runQuery = useWorkflowRunAttemptQuery({workflowRunId, runAttempt: selection?.runAttempt});\n const rerunMutation = useRerunWorkflowRunMutation(projectId);\n\n return (\n <RelativeTimeProvider>\n <div className=\"flex min-h-0 min-w-0 flex-1 overflow-hidden\">\n <RunViewContent\n workspaceId={workspaceId}\n projectId={projectId}\n query={runQuery}\n rerunMutation={rerunMutation}\n selection={selection}\n onSelectionChange={onSelectionChange}\n />\n </div>\n </RelativeTimeProvider>\n );\n}\n\nfunction RunViewContent({\n workspaceId,\n projectId,\n query,\n rerunMutation,\n selection,\n onSelectionChange,\n}: {\n workspaceId: string;\n projectId: string;\n query: ReturnType<typeof useWorkflowRunAttemptQuery>;\n rerunMutation: ReturnType<typeof useRerunWorkflowRunMutation>;\n selection: WorkflowRunSelectionInput | undefined;\n onSelectionChange: ((selection: WorkflowRunSelectionInput) => void) | undefined;\n}) {\n const navigate = useNavigate();\n const [selectedJobId, setSelectedJobId] = useState<string | undefined>();\n const [selectedJobExecutionId, setSelectedJobExecutionId] = useState<string | undefined>();\n const [sourcePanelOpen, setSourcePanelOpen] = useState(false);\n const [sourceFocus, setSourceFocus] = useState<WorkflowSourceFocus | null>(null);\n const sourcePanelId = useId();\n const sourceButtonRef = useRef<HTMLButtonElement>(null);\n // The button that last opened the panel (summary or a step detail), so Escape /\n // Close returns focus to whoever opened it.\n const lastSourceTriggerRef = useRef<HTMLButtonElement | null>(null);\n const selectionControlled = selection !== undefined;\n const sourceAvailable =\n query.data?.sourceSnapshot !== null && query.data?.sourceSnapshot !== undefined;\n const cancelMutation = useCancelWorkflowRunMutation(query.data);\n\n useEffect(() => {\n if (!sourceAvailable) {\n setSourcePanelOpen(false);\n setSourceFocus(null);\n }\n }, [sourceAvailable]);\n\n // If a refetch drops the focused step or its location, degrade to whole-workflow\n // focus so the panel never points at an unmounted Source button.\n useEffect(() => {\n if (!sourceFocus) return;\n const stillLocated = query.data?.jobs.some((job) =>\n job.jobExecutions.some((execution) =>\n execution.steps.some((step) => step.id === sourceFocus.stepId && step.sourceLocation),\n ),\n );\n if (!stillLocated) {\n setSourceFocus(null);\n lastSourceTriggerRef.current = sourceButtonRef.current;\n }\n }, [sourceFocus, query.data]);\n\n if (query.isPending) return <WorkflowRunSkeleton />;\n\n // Only show the full error placeholder when nothing ever loaded. A refetch that fails after\n // a prior success keeps the loaded run on screen (see below) instead of wiping the pane,\n // since active-run polling can hit a transient API error.\n if (query.isError && query.data === undefined) {\n if (query.error instanceof ApiError && query.error.status === 404) {\n return <WorkflowRunNotFound />;\n }\n return <QueryLoadError query={query} subject=\"workflow run\" icon=\"pulseLine\" />;\n }\n\n if (query.data === undefined) return <WorkflowRunSkeleton />;\n\n const runData = query.data;\n const resolvedSelection = selectionControlled\n ? resolveWorkflowRunSelection({run: runData, selection})\n : undefined;\n const selectedJob = selectionControlled\n ? resolvedSelection?.job\n : (runData.jobs.find((job) => job.id === selectedJobId) ?? runData.jobs.at(0));\n const selectedJobExecution = selectionControlled\n ? resolvedSelection?.jobExecution\n : selectedJob\n ? resolveJobExecution(selectedJob, selectedJobExecutionId)\n : undefined;\n const selectedAttemptId = selectionControlled\n ? (resolvedSelection?.selectedAttemptId ?? null)\n : undefined;\n // Explicit per-step focus wins; fall back to the URL-selected step so deep links\n // still pre-highlight when the summary opens the whole-workflow source.\n const highlightedLineRange =\n sourceFocus?.location ?? resolvedSelection?.step?.sourceLocation ?? null;\n const sourceSnapshot = runData.sourceSnapshot;\n async function rerun(mode: WorkflowRunRerunMode) {\n try {\n const run = await rerunMutation.mutateAsync({workflowRunId: runData.id, mode});\n toast.success('Re-run started');\n await navigate({\n to: '/workspaces/$wid/projects/$pid/runs/$workflowRunId',\n params: {wid: workspaceId, pid: projectId, workflowRunId: run.id},\n search: ((previous: Record<string, unknown>) =>\n withoutWorkflowRunSelectionSearch(previous)) as never,\n });\n } catch (error) {\n toast.error(error instanceof ApiError ? error.message : 'Could not start re-run');\n }\n }\n\n function selectJob(jobId: string | undefined) {\n if (!selectionControlled) {\n setSelectedJobId(jobId);\n setSelectedJobExecutionId(undefined);\n return;\n }\n\n onSelectionChange?.(\n jobId ? {jobId, runAttempt: selection?.runAttempt} : {runAttempt: selection?.runAttempt},\n );\n }\n\n function selectJobExecution(jobExecutionId: string | undefined) {\n if (!selectionControlled) {\n setSelectedJobExecutionId(jobExecutionId);\n return;\n }\n if (!selectedJob) return;\n\n onSelectionChange?.({\n jobId: selectedJob.id,\n jobExecutionId,\n runAttempt: selection?.runAttempt,\n });\n }\n\n function selectAttempt(attemptId: string | undefined) {\n if (!selectionControlled || !selectedJob || !selectedJobExecution) return;\n\n if (!attemptId) {\n onSelectionChange?.({\n jobId: selectedJob.id,\n jobExecutionId: selectedJobExecution.id,\n runAttempt: selection?.runAttempt,\n });\n return;\n }\n\n const match = findAttemptSelection(selectedJobExecution, attemptId);\n if (!match) return;\n\n onSelectionChange?.({\n jobId: selectedJob.id,\n jobExecutionId: selectedJobExecution.id,\n stepId: match.stepId,\n stepAttemptId: match.attemptId,\n runAttempt: selection?.runAttempt,\n });\n }\n\n function openWholeWorkflowSource() {\n setSourceFocus(null);\n lastSourceTriggerRef.current = sourceButtonRef.current;\n setSourcePanelOpen(true);\n }\n\n function toggleWholeWorkflowSource() {\n if (sourcePanelOpen && sourceFocus === null) {\n closeSourcePanel();\n return;\n }\n openWholeWorkflowSource();\n }\n\n function openStepSource(\n stepId: string,\n location: StepSourceLocation,\n trigger: HTMLButtonElement | null,\n ) {\n setSourceFocus({stepId, location});\n lastSourceTriggerRef.current = trigger;\n setSourcePanelOpen(true);\n }\n\n function closeSourcePanel() {\n const trigger = lastSourceTriggerRef.current;\n const fallbackTrigger = sourceButtonRef.current;\n setSourcePanelOpen(false);\n // Defer so focus lands after the panel unmounts; clear the focus only after\n // focusing so the opener button is still expanded (force-visible) on return.\n window.setTimeout(() => {\n const focusTarget = trigger?.isConnected ? trigger : fallbackTrigger;\n focusTarget?.focus();\n setSourceFocus(null);\n }, 0);\n }\n\n function cancelRun() {\n cancelMutation.mutate(undefined, {\n onError: (error) => {\n toast.error(cancelErrorMessage(error));\n },\n });\n }\n\n return (\n <>\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <WorkflowRunSummary\n workspaceId={workspaceId}\n projectId={projectId}\n run={runData}\n sourceAvailable={sourceAvailable}\n sourceOpen={sourcePanelOpen && sourceFocus === null}\n sourcePanelId={sourcePanelId}\n sourceButtonRef={sourceButtonRef}\n onSourceToggle={toggleWholeWorkflowSource}\n cancelling={cancelMutation.isPending}\n onCancel={cancelRun}\n rerunPending={rerunMutation.isPending}\n onRerun={(mode) => void rerun(mode)}\n latestAttempt={runData.latestAttempt}\n />\n {query.isError ? <WorkflowRunStaleError query={query} /> : null}\n <div className=\"min-h-0 flex-1 overflow-auto bg-background-neutral-base p-16\">\n <div className=\"mx-auto flex w-full max-w-[1280px] flex-col gap-16\">\n <JobGraph\n run={runData}\n selectedJobId={selectedJob?.id}\n onSelectedJobChange={selectJob}\n />\n {selectedJob ? (\n <JobCard\n workspaceId={workspaceId}\n job={selectedJob}\n selectedJobExecution={selectedJobExecution}\n selectedAttemptId={selectedJob.carriedOver ? undefined : selectedAttemptId}\n onSelectedJobExecutionChange={selectJobExecution}\n onSelectedAttemptChange={selectionControlled ? selectAttempt : undefined}\n sourcePanelId={sourcePanelId}\n sourceAvailable={sourceAvailable}\n focusedSourceStepId={sourceFocus?.stepId ?? null}\n onOpenStepSource={openStepSource}\n />\n ) : null}\n </div>\n </div>\n </div>\n <WorkflowSourcePanel\n id={sourcePanelId}\n source={sourceSnapshot}\n open={sourcePanelOpen && sourceAvailable}\n onClose={closeSourcePanel}\n highlightedLineRange={highlightedLineRange}\n scrollHighlightedIntoView\n />\n </>\n );\n}\n\nfunction cancelErrorMessage(error: unknown): string {\n if (error instanceof ApiError && error.code === 'run-already-finished') {\n return 'This workflow run has already finished.';\n }\n return 'Could not cancel workflow run.';\n}\n\nfunction findAttemptSelection(jobExecution: JobExecution, attemptId: string) {\n for (const step of jobExecution.steps) {\n const attempt = step.attempts.find((candidate) => candidate.id === attemptId);\n if (attempt) return {stepId: step.id, attemptId: attempt.id};\n }\n return undefined;\n}\n"],"names":["ApiError","QueryLoadError","RelativeTimeProvider","toast","useNavigate","useEffect","useId","useRef","useState","resolveJobExecution","withoutWorkflowRunSelectionSearch","useCancelWorkflowRunMutation","useRerunWorkflowRunMutation","useWorkflowRunAttemptQuery","JobGraph","WorkflowRunSummary","WorkflowSourcePanel","JobCard","resolveWorkflowRunSelection","WorkflowRunNotFound","WorkflowRunSkeleton","WorkflowRunStaleError","WorkflowRunView","workspaceId","projectId","workflowRunId","selection","onSelectionChange","runQuery","runAttempt","rerunMutation","div","className","RunViewContent","query","navigate","selectedJobId","setSelectedJobId","selectedJobExecutionId","setSelectedJobExecutionId","sourcePanelOpen","setSourcePanelOpen","sourceFocus","setSourceFocus","sourcePanelId","sourceButtonRef","lastSourceTriggerRef","selectionControlled","undefined","sourceAvailable","data","sourceSnapshot","cancelMutation","stillLocated","jobs","some","job","jobExecutions","execution","steps","step","id","stepId","sourceLocation","current","isPending","isError","error","status","subject","icon","runData","resolvedSelection","run","selectedJob","find","at","selectedJobExecution","jobExecution","selectedAttemptId","highlightedLineRange","location","rerun","mode","mutateAsync","success","to","params","wid","pid","search","previous","message","selectJob","jobId","selectJobExecution","jobExecutionId","selectAttempt","attemptId","match","findAttemptSelection","stepAttemptId","openWholeWorkflowSource","toggleWholeWorkflowSource","closeSourcePanel","openStepSource","trigger","fallbackTrigger","window","setTimeout","focusTarget","isConnected","focus","cancelRun","mutate","onError","cancelErrorMessage","sourceOpen","onSourceToggle","cancelling","onCancel","rerunPending","onRerun","latestAttempt","onSelectedJobChange","carriedOver","onSelectedJobExecutionChange","onSelectedAttemptChange","focusedSourceStepId","onOpenStepSource","source","open","onClose","scrollHighlightedIntoView","code","attempt","attempts","candidate"],"mappings":";AAAA,SAAQA,QAAQ,QAAO,sBAAsB;AAC7C,SAAQC,cAAc,QAAO,qBAAqB;AAClD,SAAQC,oBAAoB,QAAO,kCAAkC;AACrE,SAAQC,KAAK,QAAO,0BAA0B;AAC9C,SAAQC,WAAW,QAAO,yBAAyB;AACnD,SAAQC,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,QAAO,QAAQ;AACzD,SAEEC,mBAAmB,QAGd,wBAAwB;AAC/B,SAEEC,iCAAiC,QAC5B,kCAAkC;AACzC,SACEC,4BAA4B,EAC5BC,2BAA2B,EAC3BC,0BAA0B,QACrB,8BAA8B;AACrC,SAAQC,QAAQ,QAAO,wBAAwB;AAC/C,SAAQC,kBAAkB,QAAO,mCAAmC;AACpE,SAAQC,mBAAmB,QAAO,oCAAoC;AACtE,SAAQC,OAAO,QAAO,gBAAgB;AACtC,SAAQC,2BAA2B,QAAO,8BAA8B;AACxE,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,qBAAqB,QAChB,2BAA2B;AAelC;;;;CAIC,GACD,OAAO,SAASC,gBAAgB,EAC9BC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,SAAS,EACTC,iBAAiB,EACI;IACrB,MAAMC,WAAWf,2BAA2B;QAACY;QAAeI,YAAYH,WAAWG;IAAU;IAC7F,MAAMC,gBAAgBlB,4BAA4BY;IAElD,qBACE,KAACtB;kBACC,cAAA,KAAC6B;YAAIC,WAAU;sBACb,cAAA,KAACC;gBACCV,aAAaA;gBACbC,WAAWA;gBACXU,OAAON;gBACPE,eAAeA;gBACfJ,WAAWA;gBACXC,mBAAmBA;;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B+E,qBAAqBtF,aAAaoB,UAAU;oCAC5CmE,kBAAkBxB;qCAElB;;;;;;0BAIV,KAACzF;gBACC6C,IAAIjB;gBACJsF,QAAQ/E;gBACRgF,MAAM3F,mBAAmBS;gBACzBmF,SAAS5B;gBACTxB,sBAAsBA;gBACtBqD,yBAAyB;;;;AAIjC;AAEA,SAASjB,mBAAmBjD,KAAc;IACxC,IAAIA,iBAAiBnE,YAAYmE,MAAMmE,IAAI,KAAK,wBAAwB;QACtE,OAAO;IACT;IACA,OAAO;AACT;AAEA,SAASlC,qBAAqBtB,YAA0B,EAAEoB,SAAiB;IACzE,KAAK,MAAMtC,QAAQkB,aAAanB,KAAK,CAAE;QACrC,MAAM4E,UAAU3E,KAAK4E,QAAQ,CAAC7D,IAAI,CAAC,CAAC8D,YAAcA,UAAU5E,EAAE,KAAKqC;QACnE,IAAIqC,SAAS,OAAO;YAACzE,QAAQF,KAAKC,EAAE;YAAEqC,WAAWqC,QAAQ1E,EAAE;QAAA;IAC7D;IACA,OAAOb;AACT"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { WorkflowExecutionEventDto, WorkflowRunJobExecutionDetailDto } from '@shipfox/api-workflows-dto';
|
|
2
1
|
import { type Duration } from 'date-fns';
|
|
3
|
-
import {
|
|
4
|
-
export type JobExecutionStatus =
|
|
2
|
+
import type { Step } from './step.js';
|
|
3
|
+
export type JobExecutionStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
4
|
+
export interface WorkflowExecutionEvent {
|
|
5
|
+
source: string;
|
|
6
|
+
event: string;
|
|
7
|
+
deliveryId: string;
|
|
8
|
+
receivedAt: string;
|
|
9
|
+
data: unknown;
|
|
10
|
+
}
|
|
5
11
|
export type JobExecutionTime = {
|
|
6
12
|
state: 'fixed';
|
|
7
13
|
elapsed: Duration;
|
|
@@ -21,7 +27,7 @@ interface JobExecutionFields {
|
|
|
21
27
|
name: string;
|
|
22
28
|
status: JobExecutionStatus;
|
|
23
29
|
statusReason: string | null;
|
|
24
|
-
triggerEvents:
|
|
30
|
+
triggerEvents: WorkflowExecutionEvent[];
|
|
25
31
|
queuedAt: string | null;
|
|
26
32
|
startedAt: string | null;
|
|
27
33
|
finishedAt: string | null;
|
|
@@ -37,7 +43,7 @@ export declare class JobExecution {
|
|
|
37
43
|
name: string;
|
|
38
44
|
status: JobExecutionStatus;
|
|
39
45
|
statusReason: string | null;
|
|
40
|
-
triggerEvents:
|
|
46
|
+
triggerEvents: WorkflowExecutionEvent[];
|
|
41
47
|
queuedAt: string | null;
|
|
42
48
|
startedAt: string | null;
|
|
43
49
|
finishedAt: string | null;
|
|
@@ -50,7 +56,6 @@ export declare class JobExecution {
|
|
|
50
56
|
get runTime(): JobExecutionTime | null;
|
|
51
57
|
get displayDuration(): JobExecutionDisplayDuration | null;
|
|
52
58
|
}
|
|
53
|
-
export declare function toJobExecution(dto: WorkflowRunJobExecutionDetailDto): JobExecution;
|
|
54
59
|
export declare function jobExecutionQueueTimeFromTimestamps({ queuedAt, startedAt, finishedAt, }: {
|
|
55
60
|
queuedAt: string | null;
|
|
56
61
|
startedAt: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-execution.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"job-execution.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,QAAQ,EAAqB,MAAM,UAAU,CAAC;AAC3D,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC9F,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAA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,IAAI,CAAC;IACzB,SAAS,EAAG,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAG,MAAM,CAAC;IACnB,SAAS,EAAG,MAAM,CAAC;IACnB,KAAK,EAAG,IAAI,EAAE,CAAC;gBAEH,MAAM,EAAE,kBAAkB;IAItC,IAAI,SAAS,IAAI,gBAAgB,GAAG,IAAI,CAEvC;IAED,IAAI,OAAO,IAAI,gBAAgB,GAAG,IAAI,CAErC;IAED,IAAI,eAAe,IAAI,2BAA2B,GAAG,IAAI,CAExD;CACF;AAED,wBAAgB,mCAAmC,CAAC,EAClD,QAAQ,EACR,SAAS,EACT,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,gBAAgB,GAAG,IAAI,CAO1B;AAED,wBAAgB,iCAAiC,CAAC,EAChD,SAAS,EACT,UAAU,GACX,EAAE;IACD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,gBAAgB,GAAG,IAAI,CAM1B;AAED,wBAAgB,yCAAyC,CAAC,UAAU,EAAE;IACpE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,2BAA2B,GAAG,IAAI,CAQrC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { intervalToDuration } from 'date-fns';
|
|
2
|
-
import { toStep } from './step.js';
|
|
3
2
|
export class JobExecution {
|
|
4
3
|
constructor(fields){
|
|
5
4
|
Object.assign(this, fields);
|
|
@@ -14,24 +13,6 @@ export class JobExecution {
|
|
|
14
13
|
return jobExecutionDisplayDurationFromTimestamps(this);
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
export function toJobExecution(dto) {
|
|
18
|
-
return new JobExecution({
|
|
19
|
-
id: dto.id,
|
|
20
|
-
jobId: dto.job_id,
|
|
21
|
-
sequence: dto.sequence,
|
|
22
|
-
name: dto.name,
|
|
23
|
-
status: dto.status,
|
|
24
|
-
statusReason: dto.status_reason,
|
|
25
|
-
triggerEvents: dto.trigger_events ?? [],
|
|
26
|
-
queuedAt: dto.queued_at ?? null,
|
|
27
|
-
startedAt: dto.started_at ?? null,
|
|
28
|
-
finishedAt: dto.finished_at ?? null,
|
|
29
|
-
timedOutAt: dto.timed_out_at ?? null,
|
|
30
|
-
createdAt: dto.created_at,
|
|
31
|
-
updatedAt: dto.updated_at,
|
|
32
|
-
steps: dto.steps.map(toStep)
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
16
|
export function jobExecutionQueueTimeFromTimestamps({ queuedAt, startedAt, finishedAt }) {
|
|
36
17
|
if (queuedAt === null) return null;
|
|
37
18
|
if (finishedAt !== null && startedAt === null) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/job-execution.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/job-execution.ts"],"sourcesContent":["import {type Duration, intervalToDuration} from 'date-fns';\nimport type {Step} from './step.js';\n\nexport type JobExecutionStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\nexport interface WorkflowExecutionEvent {\n source: string;\n event: string;\n deliveryId: string;\n receivedAt: string;\n data: unknown;\n}\nexport type JobExecutionTime =\n | {state: 'fixed'; elapsed: Duration}\n | {state: 'live'; fromIso: string};\nexport type JobExecutionDisplayDuration =\n | ({kind: 'queue'} & JobExecutionTime)\n | ({kind: 'run'} & JobExecutionTime);\n\ninterface JobExecutionFields {\n id: string;\n jobId: string;\n sequence: number;\n name: string;\n status: JobExecutionStatus;\n statusReason: string | null;\n triggerEvents: WorkflowExecutionEvent[];\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n timedOutAt: string | null;\n createdAt: string;\n updatedAt: string;\n steps: Step[];\n}\n\nexport class JobExecution {\n id!: string;\n jobId!: string;\n sequence!: number;\n name!: string;\n status!: JobExecutionStatus;\n statusReason!: string | null;\n triggerEvents!: WorkflowExecutionEvent[];\n queuedAt!: string | null;\n startedAt!: string | null;\n finishedAt!: string | null;\n timedOutAt!: string | null;\n createdAt!: string;\n updatedAt!: string;\n steps!: Step[];\n\n constructor(fields: JobExecutionFields) {\n Object.assign(this, fields);\n }\n\n get queueTime(): JobExecutionTime | null {\n return jobExecutionQueueTimeFromTimestamps(this);\n }\n\n get runTime(): JobExecutionTime | null {\n return jobExecutionRunTimeFromTimestamps(this);\n }\n\n get displayDuration(): JobExecutionDisplayDuration | null {\n return jobExecutionDisplayDurationFromTimestamps(this);\n }\n}\n\nexport function jobExecutionQueueTimeFromTimestamps({\n queuedAt,\n startedAt,\n finishedAt,\n}: {\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionTime | null {\n if (queuedAt === null) return null;\n if (finishedAt !== null && startedAt === null) return null;\n if (startedAt === null) return {state: 'live', fromIso: queuedAt};\n\n const elapsed = durationBetween(queuedAt, startedAt);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nexport function jobExecutionRunTimeFromTimestamps({\n startedAt,\n finishedAt,\n}: {\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionTime | null {\n if (startedAt === null) return null;\n if (finishedAt === null) return {state: 'live', fromIso: startedAt};\n\n const elapsed = durationBetween(startedAt, finishedAt);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nexport function jobExecutionDisplayDurationFromTimestamps(timestamps: {\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionDisplayDuration | null {\n const runTime = jobExecutionRunTimeFromTimestamps(timestamps);\n if (runTime !== null) return {kind: 'run', ...runTime};\n\n const queueTime = jobExecutionQueueTimeFromTimestamps(timestamps);\n if (queueTime !== null) return {kind: 'queue', ...queueTime};\n\n return null;\n}\n\nfunction durationBetween(from: string, to: string): Duration | null {\n const start = new Date(from);\n const end = new Date(to);\n if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return null;\n\n return intervalToDuration({\n start,\n end: end < start ? start : end,\n });\n}\n"],"names":["intervalToDuration","JobExecution","fields","Object","assign","queueTime","jobExecutionQueueTimeFromTimestamps","runTime","jobExecutionRunTimeFromTimestamps","displayDuration","jobExecutionDisplayDurationFromTimestamps","queuedAt","startedAt","finishedAt","state","fromIso","elapsed","durationBetween","timestamps","kind","from","to","start","Date","end","Number","isFinite","getTime"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAO,WAAW;AAmC3D,OAAO,MAAMC;IAgBX,YAAYC,MAA0B,CAAE;QACtCC,OAAOC,MAAM,CAAC,IAAI,EAAEF;IACtB;IAEA,IAAIG,YAAqC;QACvC,OAAOC,oCAAoC,IAAI;IACjD;IAEA,IAAIC,UAAmC;QACrC,OAAOC,kCAAkC,IAAI;IAC/C;IAEA,IAAIC,kBAAsD;QACxD,OAAOC,0CAA0C,IAAI;IACvD;AACF;AAEA,OAAO,SAASJ,oCAAoC,EAClDK,QAAQ,EACRC,SAAS,EACTC,UAAU,EAKX;IACC,IAAIF,aAAa,MAAM,OAAO;IAC9B,IAAIE,eAAe,QAAQD,cAAc,MAAM,OAAO;IACtD,IAAIA,cAAc,MAAM,OAAO;QAACE,OAAO;QAAQC,SAASJ;IAAQ;IAEhE,MAAMK,UAAUC,gBAAgBN,UAAUC;IAC1C,OAAOI,YAAY,OAAO,OAAO;QAACF,OAAO;QAASE;IAAO;AAC3D;AAEA,OAAO,SAASR,kCAAkC,EAChDI,SAAS,EACTC,UAAU,EAIX;IACC,IAAID,cAAc,MAAM,OAAO;IAC/B,IAAIC,eAAe,MAAM,OAAO;QAACC,OAAO;QAAQC,SAASH;IAAS;IAElE,MAAMI,UAAUC,gBAAgBL,WAAWC;IAC3C,OAAOG,YAAY,OAAO,OAAO;QAACF,OAAO;QAASE;IAAO;AAC3D;AAEA,OAAO,SAASN,0CAA0CQ,UAIzD;IACC,MAAMX,UAAUC,kCAAkCU;IAClD,IAAIX,YAAY,MAAM,OAAO;QAACY,MAAM;QAAO,GAAGZ,OAAO;IAAA;IAErD,MAAMF,YAAYC,oCAAoCY;IACtD,IAAIb,cAAc,MAAM,OAAO;QAACc,MAAM;QAAS,GAAGd,SAAS;IAAA;IAE3D,OAAO;AACT;AAEA,SAASY,gBAAgBG,IAAY,EAAEC,EAAU;IAC/C,MAAMC,QAAQ,IAAIC,KAAKH;IACvB,MAAMI,MAAM,IAAID,KAAKF;IACrB,IAAI,CAACI,OAAOC,QAAQ,CAACJ,MAAMK,OAAO,OAAO,CAACF,OAAOC,QAAQ,CAACF,IAAIG,OAAO,KAAK,OAAO;IAEjF,OAAO3B,mBAAmB;QACxBsB;QACAE,KAAKA,MAAMF,QAAQA,QAAQE;IAC7B;AACF"}
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
7
|
-
export
|
|
1
|
+
import type { JobExecution, JobExecutionDisplayDuration } from './job-execution.js';
|
|
2
|
+
export type JobStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';
|
|
3
|
+
export type JobMode = 'one_shot' | 'listening';
|
|
4
|
+
export type ListenerStatus = 'inactive' | 'listening' | 'resolved';
|
|
5
|
+
export type ResolutionReason = 'until' | 'timeout' | 'max_executions' | 'cancelled';
|
|
6
|
+
export type JobStatusReason = 'dependency_not_completed' | 'condition_false' | 'default_gate_rejected' | 'condition_rejected' | 'condition_errored' | 'user_cancelled' | 'run_cancelled' | 'timed_out' | 'runner_lost' | 'step_failed' | 'unknown';
|
|
7
|
+
export interface JobListening {
|
|
8
|
+
on: Array<{
|
|
9
|
+
source: string;
|
|
10
|
+
event: string;
|
|
11
|
+
inputs?: Record<string, unknown> | undefined;
|
|
12
|
+
filter?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
until: Array<{
|
|
15
|
+
source: string;
|
|
16
|
+
event: string;
|
|
17
|
+
inputs?: Record<string, unknown> | undefined;
|
|
18
|
+
filter?: string | undefined;
|
|
19
|
+
}> | null;
|
|
20
|
+
timeoutMs: number | null;
|
|
21
|
+
maxExecutions: number | null;
|
|
22
|
+
batch: {
|
|
23
|
+
debounceMs?: number | undefined;
|
|
24
|
+
maxSize?: number | undefined;
|
|
25
|
+
maxWaitMs?: number | undefined;
|
|
26
|
+
} | null;
|
|
27
|
+
onResolve: 'finish' | 'cancel';
|
|
28
|
+
executionTimeoutMs: number | null;
|
|
29
|
+
name: string | null;
|
|
30
|
+
}
|
|
8
31
|
export type JobDisplayDuration = JobExecutionDisplayDuration;
|
|
9
32
|
export declare const WORKFLOW_JOB_STATUSES: readonly ["pending", "running", "succeeded", "failed", "cancelled", "skipped"];
|
|
10
33
|
export declare const TERMINAL_WORKFLOW_JOB_STATUSES: readonly ["succeeded", "failed", "cancelled", "skipped"];
|
|
@@ -17,7 +40,7 @@ interface JobFields {
|
|
|
17
40
|
status: JobStatus;
|
|
18
41
|
statusReason: JobStatusReason | null;
|
|
19
42
|
carriedOver: boolean;
|
|
20
|
-
listening:
|
|
43
|
+
listening: JobListening | null;
|
|
21
44
|
listenerStatus: ListenerStatus;
|
|
22
45
|
resolutionReason: ResolutionReason | null;
|
|
23
46
|
dependencies: string[];
|
|
@@ -35,7 +58,7 @@ export declare class Job {
|
|
|
35
58
|
status: JobStatus;
|
|
36
59
|
statusReason: JobStatusReason | null;
|
|
37
60
|
carriedOver: boolean;
|
|
38
|
-
listening:
|
|
61
|
+
listening: JobListening | null;
|
|
39
62
|
listenerStatus: ListenerStatus;
|
|
40
63
|
resolutionReason: ResolutionReason | null;
|
|
41
64
|
dependencies: string[];
|
|
@@ -51,6 +74,5 @@ export declare class Job {
|
|
|
51
74
|
export declare function isTerminalJobStatus(status: JobStatus): boolean;
|
|
52
75
|
export declare function resolveJobExecution(job: Job, jobExecutionId: string | undefined): JobExecution | undefined;
|
|
53
76
|
export declare function defaultJobExecution(job: Job): JobExecution | undefined;
|
|
54
|
-
export declare function toJob(dto: WorkflowRunJobDetailDto): Job;
|
|
55
77
|
export {};
|
|
56
78
|
//# sourceMappingURL=job.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,2BAA2B,EAAC,MAAM,oBAAoB,CAAC;AAElF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AACjG,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,gBAAgB,GAAG,WAAW,CAAC;AACpF,MAAM,MAAM,eAAe,GACvB,0BAA0B,GAC1B,iBAAiB,GACjB,uBAAuB,GACvB,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,eAAe,GACf,WAAW,GACX,aAAa,GACb,aAAa,GACb,SAAS,CAAC;AACd,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,KAAK,CAAC;QACR,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CA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 @@
|
|
|
1
|
-
import { toJobExecution } from './job-execution.js';
|
|
2
1
|
export const WORKFLOW_JOB_STATUSES = [
|
|
3
2
|
'pending',
|
|
4
3
|
'running',
|
|
@@ -46,26 +45,5 @@ export function defaultJobExecution(job) {
|
|
|
46
45
|
return jobExecution.sequence > latest.sequence ? jobExecution : latest;
|
|
47
46
|
}, undefined);
|
|
48
47
|
}
|
|
49
|
-
export function toJob(dto) {
|
|
50
|
-
const jobExecutions = dto.job_executions.map(toJobExecution);
|
|
51
|
-
return new Job({
|
|
52
|
-
id: dto.id,
|
|
53
|
-
runAttemptId: dto.run_attempt_id,
|
|
54
|
-
key: dto.key,
|
|
55
|
-
name: dto.name,
|
|
56
|
-
mode: dto.mode,
|
|
57
|
-
status: dto.status,
|
|
58
|
-
statusReason: dto.status_reason,
|
|
59
|
-
carriedOver: dto.carried_over,
|
|
60
|
-
listening: dto.listening,
|
|
61
|
-
listenerStatus: dto.listener_status,
|
|
62
|
-
resolutionReason: dto.resolution_reason,
|
|
63
|
-
dependencies: dto.dependencies,
|
|
64
|
-
position: dto.position,
|
|
65
|
-
createdAt: dto.created_at,
|
|
66
|
-
updatedAt: dto.updated_at,
|
|
67
|
-
jobExecutions
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
48
|
|
|
71
49
|
//# sourceMappingURL=job.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/job.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/job.ts"],"sourcesContent":["import type {JobExecution, JobExecutionDisplayDuration} from './job-execution.js';\n\nexport type JobStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';\nexport type JobMode = 'one_shot' | 'listening';\nexport type ListenerStatus = 'inactive' | 'listening' | 'resolved';\nexport type ResolutionReason = 'until' | 'timeout' | 'max_executions' | 'cancelled';\nexport type JobStatusReason =\n | 'dependency_not_completed'\n | 'condition_false'\n | 'default_gate_rejected'\n | 'condition_rejected'\n | 'condition_errored'\n | 'user_cancelled'\n | 'run_cancelled'\n | 'timed_out'\n | 'runner_lost'\n | 'step_failed'\n | 'unknown';\nexport interface JobListening {\n on: Array<{\n source: string;\n event: string;\n inputs?: Record<string, unknown> | undefined;\n filter?: string | undefined;\n }>;\n until: Array<{\n source: string;\n event: string;\n inputs?: Record<string, unknown> | undefined;\n filter?: string | undefined;\n }> | null;\n timeoutMs: number | null;\n maxExecutions: number | null;\n batch: {\n debounceMs?: number | undefined;\n maxSize?: number | undefined;\n maxWaitMs?: number | undefined;\n } | null;\n onResolve: 'finish' | 'cancel';\n executionTimeoutMs: number | null;\n name: string | null;\n}\n\nexport type JobDisplayDuration = JobExecutionDisplayDuration;\n\nexport const WORKFLOW_JOB_STATUSES = [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n] as const satisfies readonly JobStatus[];\n\nexport const TERMINAL_WORKFLOW_JOB_STATUSES = [\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n] as const satisfies readonly JobStatus[];\n\nconst TERMINAL_JOB_STATUS_SET = new Set<JobStatus>(TERMINAL_WORKFLOW_JOB_STATUSES);\n\ninterface JobFields {\n id: string;\n runAttemptId: string;\n key: string;\n name: string | null;\n mode: JobMode;\n status: JobStatus;\n statusReason: JobStatusReason | null;\n carriedOver: boolean;\n listening: JobListening | null;\n listenerStatus: ListenerStatus;\n resolutionReason: ResolutionReason | null;\n dependencies: string[];\n position: number;\n createdAt: string;\n updatedAt: string;\n jobExecutions: JobExecution[];\n}\n\nexport class Job {\n id!: string;\n runAttemptId!: string;\n key!: string;\n name!: string | null;\n mode!: JobMode;\n status!: JobStatus;\n statusReason!: JobStatusReason | null;\n carriedOver!: boolean;\n listening!: JobListening | null;\n listenerStatus!: ListenerStatus;\n resolutionReason!: ResolutionReason | null;\n dependencies!: string[];\n position!: number;\n createdAt!: string;\n updatedAt!: string;\n jobExecutions!: JobExecution[];\n\n constructor(fields: JobFields) {\n Object.assign(this, fields);\n }\n\n get displayName(): string {\n return this.name || this.key;\n }\n\n get displayDuration(): JobDisplayDuration | null {\n if (this.mode === 'listening') return null;\n if (this.jobExecutions.length !== 1) return null;\n return this.jobExecutions[0]?.displayDuration ?? null;\n }\n\n get executionCountVisible(): boolean {\n return (\n this.jobExecutions.length > 0 && (this.mode === 'listening' || this.jobExecutions.length > 1)\n );\n }\n}\n\nexport function isTerminalJobStatus(status: JobStatus): boolean {\n return TERMINAL_JOB_STATUS_SET.has(status);\n}\n\nexport function resolveJobExecution(\n job: Job,\n jobExecutionId: string | undefined,\n): JobExecution | undefined {\n const selectedExecution = jobExecutionId\n ? job.jobExecutions.find((jobExecution) => jobExecution.id === jobExecutionId)\n : undefined;\n if (selectedExecution) return selectedExecution;\n\n return defaultJobExecution(job);\n}\n\nexport function defaultJobExecution(job: Job): JobExecution | undefined {\n const runningExecution = job.jobExecutions.find(\n (jobExecution) => jobExecution.status === 'running',\n );\n if (runningExecution) return runningExecution;\n\n return job.jobExecutions.reduce<JobExecution | undefined>((latest, jobExecution) => {\n if (!latest) return jobExecution;\n return jobExecution.sequence > latest.sequence ? jobExecution : latest;\n }, undefined);\n}\n"],"names":["WORKFLOW_JOB_STATUSES","TERMINAL_WORKFLOW_JOB_STATUSES","TERMINAL_JOB_STATUS_SET","Set","Job","fields","Object","assign","displayName","name","key","displayDuration","mode","jobExecutions","length","executionCountVisible","isTerminalJobStatus","status","has","resolveJobExecution","job","jobExecutionId","selectedExecution","find","jobExecution","id","undefined","defaultJobExecution","runningExecution","reduce","latest","sequence"],"mappings":"AA6CA,OAAO,MAAMA,wBAAwB;IACnC;IACA;IACA;IACA;IACA;IACA;CACD,CAAyC;AAE1C,OAAO,MAAMC,iCAAiC;IAC5C;IACA;IACA;IACA;CACD,CAAyC;AAE1C,MAAMC,0BAA0B,IAAIC,IAAeF;AAqBnD,OAAO,MAAMG;IAkBX,YAAYC,MAAiB,CAAE;QAC7BC,OAAOC,MAAM,CAAC,IAAI,EAAEF;IACtB;IAEA,IAAIG,cAAsB;QACxB,OAAO,IAAI,CAACC,IAAI,IAAI,IAAI,CAACC,GAAG;IAC9B;IAEA,IAAIC,kBAA6C;QAC/C,IAAI,IAAI,CAACC,IAAI,KAAK,aAAa,OAAO;QACtC,IAAI,IAAI,CAACC,aAAa,CAACC,MAAM,KAAK,GAAG,OAAO;QAC5C,OAAO,IAAI,CAACD,aAAa,CAAC,EAAE,EAAEF,mBAAmB;IACnD;IAEA,IAAII,wBAAiC;QACnC,OACE,IAAI,CAACF,aAAa,CAACC,MAAM,GAAG,KAAM,CAAA,IAAI,CAACF,IAAI,KAAK,eAAe,IAAI,CAACC,aAAa,CAACC,MAAM,GAAG,CAAA;IAE/F;AACF;AAEA,OAAO,SAASE,oBAAoBC,MAAiB;IACnD,OAAOf,wBAAwBgB,GAAG,CAACD;AACrC;AAEA,OAAO,SAASE,oBACdC,GAAQ,EACRC,cAAkC;IAElC,MAAMC,oBAAoBD,iBACtBD,IAAIP,aAAa,CAACU,IAAI,CAAC,CAACC,eAAiBA,aAAaC,EAAE,KAAKJ,kBAC7DK;IACJ,IAAIJ,mBAAmB,OAAOA;IAE9B,OAAOK,oBAAoBP;AAC7B;AAEA,OAAO,SAASO,oBAAoBP,GAAQ;IAC1C,MAAMQ,mBAAmBR,IAAIP,aAAa,CAACU,IAAI,CAC7C,CAACC,eAAiBA,aAAaP,MAAM,KAAK;IAE5C,IAAIW,kBAAkB,OAAOA;IAE7B,OAAOR,IAAIP,aAAa,CAACgB,MAAM,CAA2B,CAACC,QAAQN;QACjE,IAAI,CAACM,QAAQ,OAAON;QACpB,OAAOA,aAAaO,QAAQ,GAAGD,OAAOC,QAAQ,GAAGP,eAAeM;IAClE,GAAGJ;AACL"}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
|
-
import type { StepAttemptDto, StepGateResultDto } from '@shipfox/api-workflows-dto';
|
|
2
1
|
import { type Duration } from 'date-fns';
|
|
3
|
-
export type StepGateResult =
|
|
2
|
+
export type StepGateResult = {
|
|
3
|
+
kind: 'none';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'not_evaluated';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'passed';
|
|
8
|
+
passed: true;
|
|
9
|
+
source: string;
|
|
10
|
+
exitCode: number | null;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'failed';
|
|
13
|
+
passed: false;
|
|
14
|
+
source: string;
|
|
15
|
+
exitCode: number | null;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'uncheckable';
|
|
18
|
+
passed: false;
|
|
19
|
+
uncheckable: true;
|
|
20
|
+
reason: string;
|
|
21
|
+
exitCode: number | null;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'evaluation_error';
|
|
24
|
+
reason: string;
|
|
25
|
+
exitCode: number | null;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'unknown';
|
|
28
|
+
data: Record<string, unknown>;
|
|
29
|
+
} | null;
|
|
4
30
|
export type StepAttemptDisplayDuration = {
|
|
5
31
|
state: 'fixed';
|
|
6
32
|
elapsed: Duration;
|
|
@@ -40,7 +66,6 @@ export declare class StepAttempt {
|
|
|
40
66
|
constructor(fields: StepAttemptFields);
|
|
41
67
|
get displayDuration(): StepAttemptDisplayDuration | null;
|
|
42
68
|
}
|
|
43
|
-
export declare function toStepAttempt(dto: StepAttemptDto, jobExecutionId: string): StepAttempt;
|
|
44
69
|
export declare function stepAttemptDisplayDurationFromTimestamps({ startedAt, finishedAt, }: {
|
|
45
70
|
startedAt: string;
|
|
46
71
|
finishedAt: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-attempt.d.ts","sourceRoot":"","sources":["../../../src/core/entities/step-attempt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"step-attempt.d.ts","sourceRoot":"","sources":["../../../src/core/entities/step-attempt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,Q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
|
|
10
|
-
export function toStepAttempt(dto, jobExecutionId) {
|
|
11
|
-
return new StepAttempt({
|
|
12
|
-
id: dto.id,
|
|
13
|
-
stepId: dto.step_id,
|
|
14
|
-
jobExecutionId,
|
|
15
|
-
attempt: dto.attempt,
|
|
16
|
-
executionOrder: dto.execution_order,
|
|
17
|
-
status: dto.status,
|
|
18
|
-
exitCode: dto.exit_code ?? null,
|
|
19
|
-
output: dto.output ?? null,
|
|
20
|
-
error: dto.error ?? null,
|
|
21
|
-
gateResult: dto.gate_result ?? null,
|
|
22
|
-
restartFeedback: dto.restart_feedback ?? null,
|
|
23
|
-
startedAt: dto.started_at,
|
|
24
|
-
finishedAt: dto.finished_at ?? null
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
10
|
export function stepAttemptDisplayDurationFromTimestamps({ startedAt, finishedAt }) {
|
|
28
11
|
if (finishedAt === null) return {
|
|
29
12
|
state: 'live',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/step-attempt.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/step-attempt.ts"],"sourcesContent":["import {type Duration, intervalToDuration} from 'date-fns';\n\nexport type StepGateResult =\n | {kind: 'none'}\n | {kind: 'not_evaluated'}\n | {kind: 'passed'; passed: true; source: string; exitCode: number | null}\n | {kind: 'failed'; passed: false; source: string; exitCode: number | null}\n | {kind: 'uncheckable'; passed: false; uncheckable: true; reason: string; exitCode: number | null}\n | {kind: 'evaluation_error'; reason: string; exitCode: number | null}\n | {kind: 'unknown'; data: Record<string, unknown>}\n | null;\nexport type StepAttemptDisplayDuration =\n | {state: 'fixed'; elapsed: Duration}\n | {state: 'live'; fromIso: string};\n\ninterface StepAttemptFields {\n id: string;\n stepId: string;\n jobExecutionId: string;\n attempt: number;\n executionOrder: number;\n status: string;\n exitCode: number | null;\n output: Record<string, unknown> | null;\n error: Record<string, unknown> | null;\n gateResult: StepGateResult;\n restartFeedback: string | null;\n startedAt: string;\n finishedAt: string | null;\n}\n\nexport class StepAttempt {\n id!: string;\n stepId!: string;\n jobExecutionId!: string;\n attempt!: number;\n executionOrder!: number;\n status!: string;\n exitCode!: number | null;\n output!: Record<string, unknown> | null;\n error!: Record<string, unknown> | null;\n gateResult!: StepGateResult;\n restartFeedback!: string | null;\n startedAt!: string;\n finishedAt!: string | null;\n\n constructor(fields: StepAttemptFields) {\n Object.assign(this, fields);\n }\n\n get displayDuration(): StepAttemptDisplayDuration | null {\n return stepAttemptDisplayDurationFromTimestamps(this);\n }\n}\n\nexport function stepAttemptDisplayDurationFromTimestamps({\n startedAt,\n finishedAt,\n}: {\n startedAt: string;\n finishedAt: string | null;\n}): StepAttemptDisplayDuration | null {\n if (finishedAt === null) return {state: 'live', fromIso: startedAt};\n\n const elapsed = durationBetween(startedAt, finishedAt);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nfunction durationBetween(from: string, to: string): Duration | null {\n const start = new Date(from);\n const end = new Date(to);\n if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return null;\n\n return intervalToDuration({\n start,\n end: end < start ? start : end,\n });\n}\n"],"names":["intervalToDuration","StepAttempt","fields","Object","assign","displayDuration","stepAttemptDisplayDurationFromTimestamps","startedAt","finishedAt","state","fromIso","elapsed","durationBetween","from","to","start","Date","end","Number","isFinite","getTime"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAO,WAAW;AA+B3D,OAAO,MAAMC;IAeX,YAAYC,MAAyB,CAAE;QACrCC,OAAOC,MAAM,CAAC,IAAI,EAAEF;IACtB;IAEA,IAAIG,kBAAqD;QACvD,OAAOC,yCAAyC,IAAI;IACtD;AACF;AAEA,OAAO,SAASA,yCAAyC,EACvDC,SAAS,EACTC,UAAU,EAIX;IACC,IAAIA,eAAe,MAAM,OAAO;QAACC,OAAO;QAAQC,SAASH;IAAS;IAElE,MAAMI,UAAUC,gBAAgBL,WAAWC;IAC3C,OAAOG,YAAY,OAAO,OAAO;QAACF,OAAO;QAASE;IAAO;AAC3D;AAEA,SAASC,gBAAgBC,IAAY,EAAEC,EAAU;IAC/C,MAAMC,QAAQ,IAAIC,KAAKH;IACvB,MAAMI,MAAM,IAAID,KAAKF;IACrB,IAAI,CAACI,OAAOC,QAAQ,CAACJ,MAAMK,OAAO,OAAO,CAACF,OAAOC,QAAQ,CAACF,IAAIG,OAAO,KAAK,OAAO;IAEjF,OAAOpB,mBAAmB;QACxBe;QACAE,KAAKA,MAAMF,QAAQA,QAAQE;IAC7B;AACF"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export
|
|
1
|
+
import type { StepAttempt } from './step-attempt.js';
|
|
2
|
+
export type StepErrorReason = 'checkout_failed' | 'checkout_auth_failed' | 'checkout_unavailable' | 'git_unavailable' | 'workspace_prep_failed' | 'setup_aborted' | 'config_unresolvable' | 'output_invalid' | 'agent_config_invalid' | 'agent_invocation_failed';
|
|
3
|
+
export type AgentConfigIssue = 'step_config_invalid' | 'provider_not_configured' | 'provider_unsupported' | 'model_unavailable' | 'credentials_invalid';
|
|
4
|
+
export type StepErrorCategory = 'setup' | 'user';
|
|
5
|
+
export declare const STEP_ERROR_REASONS: Set<StepErrorReason>;
|
|
6
|
+
export declare const AGENT_CONFIG_ISSUES: Set<AgentConfigIssue>;
|
|
6
7
|
export interface StepSourceLocation {
|
|
7
8
|
startLine: number;
|
|
8
9
|
endLine: number;
|
|
@@ -37,5 +38,4 @@ export interface Step {
|
|
|
37
38
|
updatedAt: string;
|
|
38
39
|
attempts: StepAttempt[];
|
|
39
40
|
}
|
|
40
|
-
export declare function toStep(dto: WorkflowRunStepDetailDto): Step;
|
|
41
41
|
//# sourceMappingURL=step.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/core/entities/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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AAM,CAAC;IACb,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB"}
|
|
@@ -1,51 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
function toStepSourceLocation(dto) {
|
|
22
|
-
return {
|
|
23
|
-
startLine: dto.start_line,
|
|
24
|
-
endLine: dto.end_line
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function toStepError(dto) {
|
|
28
|
-
return {
|
|
29
|
-
message: dto.message,
|
|
30
|
-
exitCode: dto.exit_code ?? null,
|
|
31
|
-
signal: dto.signal,
|
|
32
|
-
reason: dto.reason,
|
|
33
|
-
agentConfigIssue: dto.agent_config_issue,
|
|
34
|
-
category: dto.category
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function toAgentStepConfig(dto) {
|
|
38
|
-
if (dto.type !== 'agent') return null;
|
|
39
|
-
return {
|
|
40
|
-
provider: stringConfigValue(dto.config.provider),
|
|
41
|
-
model: stringConfigValue(dto.config.model),
|
|
42
|
-
thinking: stringConfigValue(dto.config.thinking)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function stringConfigValue(value) {
|
|
46
|
-
if (typeof value !== 'string') return null;
|
|
47
|
-
const trimmedValue = value.trim();
|
|
48
|
-
return trimmedValue ? trimmedValue : null;
|
|
49
|
-
}
|
|
1
|
+
export const STEP_ERROR_REASONS = new Set([
|
|
2
|
+
'checkout_failed',
|
|
3
|
+
'checkout_auth_failed',
|
|
4
|
+
'checkout_unavailable',
|
|
5
|
+
'git_unavailable',
|
|
6
|
+
'workspace_prep_failed',
|
|
7
|
+
'setup_aborted',
|
|
8
|
+
'config_unresolvable',
|
|
9
|
+
'output_invalid',
|
|
10
|
+
'agent_config_invalid',
|
|
11
|
+
'agent_invocation_failed'
|
|
12
|
+
]);
|
|
13
|
+
export const AGENT_CONFIG_ISSUES = new Set([
|
|
14
|
+
'step_config_invalid',
|
|
15
|
+
'provider_not_configured',
|
|
16
|
+
'provider_unsupported',
|
|
17
|
+
'model_unavailable',
|
|
18
|
+
'credentials_invalid'
|
|
19
|
+
]);
|
|
50
20
|
|
|
51
21
|
//# sourceMappingURL=step.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/step.ts"],"sourcesContent":["import type {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/step.ts"],"sourcesContent":["import type {StepAttempt} from './step-attempt.js';\n\nexport type StepErrorReason =\n | 'checkout_failed'\n | 'checkout_auth_failed'\n | 'checkout_unavailable'\n | 'git_unavailable'\n | 'workspace_prep_failed'\n | 'setup_aborted'\n | 'config_unresolvable'\n | 'output_invalid'\n | 'agent_config_invalid'\n | 'agent_invocation_failed';\nexport type AgentConfigIssue =\n | 'step_config_invalid'\n | 'provider_not_configured'\n | 'provider_unsupported'\n | 'model_unavailable'\n | 'credentials_invalid';\nexport type StepErrorCategory = 'setup' | 'user';\nexport const STEP_ERROR_REASONS = new Set<StepErrorReason>([\n 'checkout_failed',\n 'checkout_auth_failed',\n 'checkout_unavailable',\n 'git_unavailable',\n 'workspace_prep_failed',\n 'setup_aborted',\n 'config_unresolvable',\n 'output_invalid',\n 'agent_config_invalid',\n 'agent_invocation_failed',\n]);\nexport const AGENT_CONFIG_ISSUES = new Set<AgentConfigIssue>([\n 'step_config_invalid',\n 'provider_not_configured',\n 'provider_unsupported',\n 'model_unavailable',\n 'credentials_invalid',\n]);\n\nexport interface StepSourceLocation {\n startLine: number;\n endLine: number;\n}\n\nexport interface StepError {\n message: string;\n exitCode: number | null;\n signal: string | undefined;\n reason: StepErrorReason | undefined;\n agentConfigIssue: AgentConfigIssue | undefined;\n category: StepErrorCategory | undefined;\n}\n\nexport interface AgentStepConfig {\n provider: string | null;\n model: string | null;\n thinking: string | null;\n}\n\nexport interface Step {\n id: string;\n jobExecutionId: string;\n key: string | null;\n name: string;\n sourceLocation: StepSourceLocation | null;\n status: string;\n type: string;\n config: Record<string, unknown>;\n agentConfig: AgentStepConfig | null;\n error: StepError | null;\n position: number;\n currentAttempt: number;\n createdAt: string;\n updatedAt: string;\n attempts: StepAttempt[];\n}\n"],"names":["STEP_ERROR_REASONS","Set","AGENT_CONFIG_ISSUES"],"mappings":"AAoBA,OAAO,MAAMA,qBAAqB,IAAIC,IAAqB;IACzD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AACH,OAAO,MAAMC,sBAAsB,IAAID,IAAsB;IAC3D;IACA;IACA;IACA;IACA;CACD,EAAE"}
|