diff --git a/src/Builder/Pipeline.php b/src/Builder/Pipeline.php index 80aa8c8c..12d38a2a 100644 --- a/src/Builder/Pipeline.php +++ b/src/Builder/Pipeline.php @@ -16,6 +16,7 @@ public function __construct( ) {} public function addExtractor( + Node\Expr|Builder $stepCode, Node\Expr|Builder $extractor, Node\Expr|Builder $rejection, Node\Expr|Builder $state, @@ -24,6 +25,7 @@ public function addExtractor( var: $runtime, name: new Node\Identifier('extract'), args: [ + new Node\Arg($stepCode instanceof Builder ? $stepCode->getNode() : $stepCode), new Node\Arg($extractor instanceof Builder ? $extractor->getNode() : $extractor), new Node\Arg($rejection instanceof Builder ? $rejection->getNode() : $rejection), new Node\Arg($state instanceof Builder ? $state->getNode() : $state), @@ -34,6 +36,7 @@ public function addExtractor( } public function addTransformer( + Node\Expr|Builder $stepCode, Node\Expr|Builder $transformer, Node\Expr|Builder $rejection, Node\Expr|Builder $state, @@ -42,6 +45,7 @@ public function addTransformer( var: $runtime, name: new Node\Identifier('transform'), args: [ + new Node\Arg($stepCode instanceof Builder ? $stepCode->getNode() : $stepCode), new Node\Arg($transformer instanceof Builder ? $transformer->getNode() : $transformer), new Node\Arg($rejection instanceof Builder ? $rejection->getNode() : $rejection), new Node\Arg($state instanceof Builder ? $state->getNode() : $state), @@ -52,6 +56,7 @@ public function addTransformer( } public function addLoader( + Node\Expr|Builder $stepCode, Node\Expr|Builder $loader, Node\Expr|Builder $rejection, Node\Expr|Builder $state, @@ -60,6 +65,7 @@ public function addLoader( var: $runtime, name: new Node\Identifier('load'), args: [ + new Node\Arg($stepCode instanceof Builder ? $stepCode->getNode() : $stepCode), new Node\Arg($loader instanceof Builder ? $loader->getNode() : $loader), new Node\Arg($rejection instanceof Builder ? $rejection->getNode() : $rejection), new Node\Arg($state instanceof Builder ? $state->getNode() : $state), diff --git a/src/Pipeline/Extractor.php b/src/Pipeline/Extractor.php index c362d0bf..1e2ecc75 100644 --- a/src/Pipeline/Extractor.php +++ b/src/Pipeline/Extractor.php @@ -62,6 +62,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf } $pipeline->addExtractor( + new Node\Scalar\String_($config['code']), $repository->getBuilder() ->withLogger($logger) ->withRejection($rejection) diff --git a/src/Pipeline/Loader.php b/src/Pipeline/Loader.php index 7f8748d6..0910ee24 100644 --- a/src/Pipeline/Loader.php +++ b/src/Pipeline/Loader.php @@ -62,6 +62,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf } $pipeline->addLoader( + new Node\Scalar\String_($config['code']), $repository->getBuilder() ->withLogger($logger) ->withRejection($rejection) diff --git a/src/Pipeline/Transformer.php b/src/Pipeline/Transformer.php index f710cf6c..0a9396d7 100644 --- a/src/Pipeline/Transformer.php +++ b/src/Pipeline/Transformer.php @@ -62,6 +62,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf } $pipeline->addTransformer( + new Node\Scalar\String_($config['code']), $repository->getBuilder() ->withLogger($logger) ->withRejection($rejection) diff --git a/src/Runtime/Pipeline/Configuration.php b/src/Runtime/Pipeline/Configuration.php index a3086eeb..efb317fd 100644 --- a/src/Runtime/Pipeline/Configuration.php +++ b/src/Runtime/Pipeline/Configuration.php @@ -49,12 +49,12 @@ public function getStepsTreeBuilder(): TreeBuilder ->isRequired() ->fixXmlConfig('step') ->validate() - ->ifTrue(fn ($value) => 1 <= array_reduce( - array_keys($this->plugins), - fn (int $count, string $plugin) => \array_key_exists($plugin, $value) ? $count + 1 : $count, - 0 - )) - ->thenInvalid(sprintf('You should only specify one plugin between %s.', implode('", "', array_map(fn (string $plugin) => sprintf('"%s"', $plugin), array_keys($this->plugins))))) + ->ifTrue(fn ($value) => 1 <= array_reduce( + array_keys($this->plugins), + fn (int $count, string $plugin) => \array_key_exists($plugin, $value) ? $count + 1 : $count, + 0 + )) + ->thenInvalid(sprintf('You should only specify one plugin between %s.', implode('", "', array_map(fn (string $plugin) => sprintf('"%s"', $plugin), array_keys($this->plugins))))) ->end() ; @@ -80,7 +80,9 @@ public function getConfigTreeBuilder(): TreeBuilder ->scalarPrototype()->end() ->end() ->scalarNode('name')->end() - ->scalarNode('code')->end() + ->scalarNode('code') + ->isRequired() + ->end() ->append($this->getStepsTreeBuilder()->getRootNode()) ->end() ; @@ -95,7 +97,9 @@ private function applyPlugins(ArrayNodeDefinition $node): self $node ->children() ->scalarNode('name')->end() - ->scalarNode('code')->end() + ->scalarNode('code') + ->isRequired() + ->end() ->end() ->append($plugin->getConfigTreeBuilder()->getRootNode()) ; @@ -110,7 +114,9 @@ private function applyFeatures(ArrayNodeDefinition $node): self /* @phpstan-ignore-next-line */ $node->children() ->scalarNode('name')->end() - ->scalarNode('code')->end() + ->scalarNode('code') + ->isRequired() + ->end() ->end() ->append($feature->getConfigTreeBuilder()->getRootNode()) ; diff --git a/src/Runtime/Workflow/Action/Configuration.php b/src/Runtime/Workflow/Action/Configuration.php index 0b11a899..4d5602e7 100644 --- a/src/Runtime/Workflow/Action/Configuration.php +++ b/src/Runtime/Workflow/Action/Configuration.php @@ -26,7 +26,14 @@ public function getConfigTreeBuilder(): TreeBuilder $builder = new TreeBuilder('action'); /** @var ArrayNodeDefinition $node */ - $node = $builder->getRootNode(); + $node = $builder->getRootNode() + ->children() + ->scalarNode('name')->end() + ->scalarNode('code') + ->isRequired() + ->end() + ->end() + ; foreach ($this->actions as $action) { $node->append($action->getConfigTreeBuilder()->getRootNode()); diff --git a/src/Service.php b/src/Service.php index e55a0ca8..32bc011c 100644 --- a/src/Service.php +++ b/src/Service.php @@ -325,8 +325,8 @@ private function compilePipelineJob(array $config): Satellite\Builder\Repository $repository = new Satellite\Builder\Repository\Pipeline($pipeline); $repository->addPackages( - 'php-etl/pipeline-contracts:0.4.*', - 'php-etl/pipeline:*', + 'php-etl/pipeline-contracts:dev-main', + 'php-etl/pipeline:dev-main', 'php-etl/console-state:*', 'php-etl/pipeline-console-runtime:*', 'php-etl/workflow-console-runtime:*',