99use Kiboko \Component \Satellite \Cloud \DTO \Composer ;
1010use Kiboko \Component \Satellite \Cloud \DTO \JobCode ;
1111use Kiboko \Component \Satellite \Cloud \DTO \Package ;
12+ use Kiboko \Component \Satellite \Cloud \DTO \Probe ;
1213use Kiboko \Component \Satellite \Cloud \DTO \ProbeList ;
1314use Kiboko \Component \Satellite \Cloud \DTO \ReferencedWorkflow ;
1415use Kiboko \Component \Satellite \Cloud \DTO \RepositoryList ;
@@ -154,7 +155,7 @@ public static function fromApiWithCode(Api\Client $client, string $code): DTO\Re
154155 \assert (1 === \count ($ collection ));
155156 \assert ($ collection [0 ] instanceof Api \Model \WorkflowRead);
156157 } catch (\AssertionError ) {
157- throw new \OverflowException ('There seems to be several pipelines with the same code, please contact your Customer Success Manager. ' );
158+ throw new \OverflowException ('There seems to be several workflows with the same code, please contact your Customer Success Manager. ' );
158159 }
159160
160161 return new ReferencedWorkflow (
@@ -173,21 +174,32 @@ private static function fromApiModel(Api\Client $client, Api\Model\WorkflowRead
173174 $ workflow ->getCode (),
174175 new DTO \JobList (
175176 ...array_map (function (Api \Model \Job $ job , int $ order ) {
176- if (null == $ job ->getPipeline ()) {
177+ if (null ! == $ job ->getPipeline ()) {
177178 return new DTO \Workflow \Pipeline (
178179 $ job ->getLabel (),
179180 new JobCode ($ job ->getCode ()),
180- $ job ->getConfiguration (),
181+ new StepList (...array_map (
182+ fn (Api \Model \PipelineStepRead $ step , int $ order ) => new Step (
183+ $ step ->getLabel (),
184+ new StepCode ($ step ->getCode ()),
185+ $ step ->getConfiguration (),
186+ /** TODO : implement probes when it is enabled */
187+ new ProbeList (),
188+ $ order
189+ ),
190+ $ steps = $ job ->getPipeline ()->getSteps (),
191+ range (0 , \count ((array ) $ steps )),
192+ )),
181193 $ order
182194 );
183195 }
184196
185- if (null == $ job ->getAction ()) {
197+ if (null ! == $ job ->getAction ()) {
186198 return new DTO \Workflow \Action (
187199 $ job ->getLabel (),
188200 new JobCode ($ job ->getCode ()),
189- $ job ->getConfiguration (),
190- $ order
201+ $ job ->getAction ()-> getConfiguration (),
202+ $ order,
191203 );
192204 }
193205
0 commit comments