feat(editor): Expose View Execution links for erroneous sub-executions (#13185)

This commit is contained in:
Charlie Kolb
2025-02-13 09:44:52 +01:00
committed by GitHub
parent 85deff0b7f
commit 11cf1cd23a
14 changed files with 261 additions and 13 deletions

View File

@@ -0,0 +1,31 @@
import type { ITaskMetadata } from '.';
import { hasKey } from './utils';
function responseHasSubworkflowData(
response: unknown,
): response is { executionId: string; workflowId: string } {
return ['executionId', 'workflowId'].every(
(x) => hasKey(response, x) && typeof response[x] === 'string',
);
}
type ISubWorkflowMetadata = Required<Pick<ITaskMetadata, 'subExecution' | 'subExecutionsCount'>>;
function parseErrorResponseWorkflowMetadata(response: unknown): ISubWorkflowMetadata | undefined {
if (!responseHasSubworkflowData(response)) return undefined;
return {
subExecution: {
executionId: response.executionId,
workflowId: response.workflowId,
},
subExecutionsCount: 1,
};
}
export function parseErrorMetadata(error: unknown): ISubWorkflowMetadata | undefined {
if (hasKey(error, 'errorResponse')) {
return parseErrorResponseWorkflowMetadata(error.errorResponse);
}
return undefined;
}