chore: cleanup the types a little bit

Signed-off-by: benjdlambert <ben@blam.sh>

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
benjdlambert
2025-06-16 13:35:55 +02:00
parent 77f713137e
commit f63877526a
3 changed files with 12 additions and 39 deletions
+9 -15
View File
@@ -33,31 +33,25 @@ export type CheckpointContext<T extends JsonValue | void = JsonValue> = {
fn: () => Promise<T> | T;
};
// @alpha
export type CheckpointFailedState = {
status: 'failed';
reason: string;
};
// @alpha
export type CheckpointState = {
[key: string]: CheckpointStateValue;
};
// @alpha
export type CheckpointStateValue =
| CheckpointSuccessState
| CheckpointFailedState;
export type CheckpointStateValue<T extends JsonValue = JsonValue> =
| {
status: 'failed';
reason: string;
}
| {
status: 'success';
value: T;
};
// @alpha
export type CheckpointStatus = 'failed' | 'success';
// @alpha
export type CheckpointSuccessState<T extends JsonValue = JsonValue> = {
status: 'success';
value: T;
};
// @alpha (undocumented)
export type CreatedTemplateFilter<
TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]],
@@ -22,34 +22,14 @@ import { JsonValue } from '@backstage/types';
*/
export type CheckpointStatus = 'failed' | 'success';
/**
* Represents a successful checkpoint state with a value.
*
* @alpha
*/
export type CheckpointSuccessState<T extends JsonValue = JsonValue> = {
status: 'success';
value: T;
};
/**
* Represents a failed checkpoint state with a reason for failure.
*
* @alpha
*/
export type CheckpointFailedState = {
status: 'failed';
reason: string;
};
/**
* Represents the union of all possible checkpoint state values.
*
* @alpha
*/
export type CheckpointStateValue =
| CheckpointSuccessState
| CheckpointFailedState;
export type CheckpointStateValue<T extends JsonValue = JsonValue> =
| { status: 'failed'; reason: string }
| { status: 'success'; value: T };
/**
* A map of checkpoint keys to their states.
@@ -25,5 +25,4 @@ export type {
TaskContext,
TaskEventType,
TaskStatus,
// UpdateTaskCheckpointOptions,
} from './types';