From 9d2bd50113109af24e9f0d23a9dac011bd43d069 Mon Sep 17 00:00:00 2001 From: solimant Date: Fri, 27 Dec 2024 22:38:33 +0000 Subject: [PATCH] Pull some types from the spec Signed-off-by: solimant --- plugins/scaffolder-common/src/api.ts | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/plugins/scaffolder-common/src/api.ts b/plugins/scaffolder-common/src/api.ts index f9a5dbcb17..c54b090c56 100644 --- a/plugins/scaffolder-common/src/api.ts +++ b/plugins/scaffolder-common/src/api.ts @@ -20,7 +20,12 @@ import type { TemplateEntityV1beta3, TemplateParameterSchema, } from './TemplateEntityV1beta3'; -import { TaskStatus } from '../client/src/schema/openapi'; +import type { + TaskEventType, + TaskStatus as ScaffolderTaskStatus, +} from '../client/src/schema/openapi'; + +export type { ScaffolderTaskStatus }; /** * Options you can pass into a Scaffolder request for additional information. @@ -31,19 +36,6 @@ export interface ScaffolderRequestOptions { token?: string; } -/** - * The status of each task in a Scaffolder Job - * - * @public - */ -export type ScaffolderTaskStatus = - | 'cancelled' - | 'completed' - | 'failed' - | 'open' - | 'processing' - | 'skipped'; - /** * The shape of each task returned from the `scaffolder-backend` * @@ -74,10 +66,7 @@ export type ScaffolderUsageExample = { * @public * @deprecated in favor of ScaffolderUsageExample */ -export type ActionExample = { - description: string; - example: string; -}; +export type ActionExample = ScaffolderUsageExample; /** * The response shape for a single action in the `listActions` call to the `scaffolder-backend` @@ -183,7 +172,7 @@ export type ScaffolderTaskOutput = { * @public */ export type LogEvent = { - type: 'log' | 'completion' | 'cancelled' | 'recovered'; + type: TaskEventType; body: { message: string; stepId?: string; @@ -297,7 +286,7 @@ export interface ScaffolderApi { cancelTask( taskId: string, options?: ScaffolderRequestOptions, - ): Promise<{ status?: TaskStatus }>; + ): Promise<{ status?: ScaffolderTaskStatus }>; /** * Starts the task again from the point where it failed.