File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
packages/core/src/schemas Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @trigger.dev/core " : patch
3
+ ---
4
+
5
+ Add subtasks to the schema/types when getting an individual run
Original file line number Diff line number Diff line change @@ -33,6 +33,15 @@ export const RunTaskSchema = z.object({
33
33
completedAt : z . coerce . date ( ) . nullable ( ) ,
34
34
} ) ;
35
35
36
+ export type RunTaskWithSubtasks = z . infer < typeof RunTaskSchema > & {
37
+ /** The subtasks of the task */
38
+ subtasks ?: RunTaskWithSubtasks [ ] ;
39
+ } ;
40
+
41
+ const RunTaskWithSubtasksSchema : z . ZodType < RunTaskWithSubtasks > = RunTaskSchema . extend ( {
42
+ subtasks : z . lazy ( ( ) => RunTaskWithSubtasksSchema . array ( ) ) . optional ( ) ,
43
+ } ) ;
44
+
36
45
const GetRunOptionsSchema = z . object ( {
37
46
/** Return subtasks, which appear in a `subtasks` array on a task. @default false */
38
47
subtasks : z . boolean ( ) . optional ( ) ,
@@ -68,7 +77,7 @@ export const GetRunSchema = RunSchema.extend({
68
77
/** The output of the run */
69
78
output : z . any ( ) . optional ( ) ,
70
79
/** The tasks from the run */
71
- tasks : z . array ( RunTaskSchema ) ,
80
+ tasks : z . array ( RunTaskWithSubtasksSchema ) ,
72
81
/** If there are more tasks, you can use this to get them */
73
82
nextCursor : z . string ( ) . optional ( ) ,
74
83
} ) ;
You can’t perform that action at this time.
0 commit comments