Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the new run command #147

Merged
merged 6 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/satellite
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $app->addCommands([
new \Kiboko\Component\Satellite\Console\Command\ValidateCommand(),
new \Kiboko\Component\Satellite\Console\Command\PipelineRunCommand(),
new \Kiboko\Component\Satellite\Console\Command\WorkflowRunCommand(),
new \Kiboko\Component\Satellite\Console\Command\RunCommand(),
]);

$app->run(new Input\ArgvInput(), new Output\ConsoleOutput());
4 changes: 2 additions & 2 deletions src/Action/ConfigurationApplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

final class ConfigurationApplier
{
private ?Action $action = null;
private ?Satellite\Action\Action $action = null;
private array $packages = [];

Check failure on line 14 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan8

Property Kiboko\Component\Satellite\Action\ConfigurationApplier::$packages type has no value type specified in iterable type array.

Check failure on line 14 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan7

Property Kiboko\Component\Satellite\Action\ConfigurationApplier::$packages type has no value type specified in iterable type array.

Check failure on line 14 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan6

Property Kiboko\Component\Satellite\Action\ConfigurationApplier::$packages type has no value type specified in iterable type array.

public function __construct(
private readonly string $plugin,
Expand All @@ -22,7 +22,7 @@

public function withAction(): self
{
$this->action = new Action($this->plugin, clone $this->interpreter);
$this->action = new Satellite\Action\Action($this->plugin, clone $this->interpreter);

return $this;
}
Expand All @@ -34,11 +34,11 @@
return $this;
}

public function appendTo(array $config, Satellite\Builder\Repository\Action $action): void

Check failure on line 37 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan8

Method Kiboko\Component\Satellite\Action\ConfigurationApplier::appendTo() has parameter $config with no value type specified in iterable type array.

Check failure on line 37 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan7

Method Kiboko\Component\Satellite\Action\ConfigurationApplier::appendTo() has parameter $config with no value type specified in iterable type array.

Check failure on line 37 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan6

Method Kiboko\Component\Satellite\Action\ConfigurationApplier::appendTo() has parameter $config with no value type specified in iterable type array.
{
$repository = $this->service->compile($config[$this->plugin]);

($this->action)($config, $action->getBuilder(), $repository);

Check failure on line 41 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan8

Trying to invoke Kiboko\Component\Satellite\Action\Action|null but it might not be a callable.

$action->addPackages(...$this->packages);

Expand Down
4 changes: 2 additions & 2 deletions src/Action/Custom/Factory/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
private readonly Processor $processor;
private readonly ConfigurationInterface $configuration;

public function __construct(

Check failure on line 27 in src/Action/Custom/Factory/Action.php

View workflow job for this annotation

GitHub Actions / phpstan8

Method Kiboko\Component\Satellite\Action\Custom\Factory\Action::__construct() has parameter $providers with no value type specified in iterable type array.

Check failure on line 27 in src/Action/Custom/Factory/Action.php

View workflow job for this annotation

GitHub Actions / phpstan7

Method Kiboko\Component\Satellite\Action\Custom\Factory\Action::__construct() has parameter $providers with no value type specified in iterable type array.

Check failure on line 27 in src/Action/Custom/Factory/Action.php

View workflow job for this annotation

GitHub Actions / phpstan6

Method Kiboko\Component\Satellite\Action\Custom\Factory\Action::__construct() has parameter $providers with no value type specified in iterable type array.
private readonly ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage(),
private readonly array $providers = [],
) {
Expand Down Expand Up @@ -63,7 +63,7 @@
/**
* @throws Configurator\ConfigurationExceptionInterface
*/
public function compile(array $config): Repository\Action
public function compile(array $config): Custom\Factory\Repository\Action
{
$containerName = sprintf('ProjectServiceContainer%s', ByteString::fromRandom(8)->toString());

Expand All @@ -74,14 +74,14 @@

$container = (new SatelliteDependencyInjection(...$this->providers))($config);

$repository = new Repository\Action($builder);
$repository = new Custom\Factory\Repository\Action($builder);

$dumper = new PhpDumper($container);
$repository->addFiles(
new Packaging\File(
sprintf('%s.php', $containerName),
new Packaging\Asset\InMemory(
$dumper->dump(['class' => $containerName, 'namespace' => 'GyroscopsGenerated'])

Check failure on line 84 in src/Action/Custom/Factory/Action.php

View workflow job for this annotation

GitHub Actions / phpstan7

Parameter #1 $content of class Kiboko\Component\Packaging\Asset\InMemory constructor expects string, array|string given.
)
),
);
Expand Down
3 changes: 3 additions & 0 deletions src/Action/Custom/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

#[Configurator\Action(
name: 'custom',
dependencies: [
'symfony/dependency-injection:^6.0'
],
)]
final readonly class Service implements Configurator\ActionInterface
{
Expand Down Expand Up @@ -71,7 +74,7 @@
&& \count($config['expression_language'])
) {
foreach ($config['expression_language'] as $provider) {
$interpreter->registerProvider(new $provider());

Check failure on line 77 in src/Action/Custom/Service.php

View workflow job for this annotation

GitHub Actions / phpstan7

Parameter #1 $provider of method Symfony\Component\ExpressionLanguage\ExpressionLanguage::registerProvider() expects Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface, object given.
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/AdapterChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

final readonly class AdapterChoice
{
public function __construct(

Check failure on line 11 in src/Adapter/AdapterChoice.php

View workflow job for this annotation

GitHub Actions / phpstan6

Method Kiboko\Component\Satellite\Adapter\AdapterChoice::__construct() has parameter $adapters with no value type specified in iterable type array.
private array $adapters,
) {
}

public function __invoke(array $configuration): Configurator\SatelliteBuilderInterface

Check failure on line 16 in src/Adapter/AdapterChoice.php

View workflow job for this annotation

GitHub Actions / phpstan6

Method Kiboko\Component\Satellite\Adapter\AdapterChoice::__invoke() has parameter $configuration with no value type specified in iterable type array.
{
$factory = null;
foreach ($this->adapters as $alias => $adapter) {
Expand All @@ -23,7 +23,7 @@
}
}

\assert($factory instanceof \Kiboko\Contract\Configurator\Adapter\FactoryInterface, new AdapterNotFoundException('No compatible adapter was found for your satellite configuration.'));
\assert($factory instanceof Configurator\Adapter\FactoryInterface, new AdapterNotFoundException('No compatible adapter was found for your satellite configuration.'));

return $factory($configuration);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Cloud/Pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function (string $namespace) {
);
}

public static function fromApiWithId(Api\Client $client, PipelineId $id, array $configuration): DTO\ReferencedPipeline
public static function fromApiWithId(Api\Client $client, PipelineId $id, array $configuration): ReferencedPipeline
{
$item = $client->getPipelineItem($id->asString());

Expand All @@ -99,7 +99,7 @@ public static function fromApiWithId(Api\Client $client, PipelineId $id, array $
);
}

public static function fromApiWithCode(Api\Client $client, string $code, array $configuration): DTO\ReferencedPipeline
public static function fromApiWithCode(Api\Client $client, string $code, array $configuration): ReferencedPipeline
{
$collection = $client->getPipelineCollection(['code' => $code]);

Expand Down Expand Up @@ -199,7 +199,7 @@ public function create(DTO\PipelineInterface $pipeline): DTO\CommandBatch
);
}

public function update(DTO\ReferencedPipeline $actual, DTO\PipelineInterface $desired): DTO\CommandBatch
public function update(ReferencedPipeline $actual, DTO\PipelineInterface $desired): DTO\CommandBatch
{
if ($actual->code() !== $desired->code()) {
throw new \RuntimeException('Code does not match between actual and desired pipeline definition.');
Expand All @@ -220,7 +220,7 @@ public function update(DTO\ReferencedPipeline $actual, DTO\PipelineInterface $de
return new DTO\CommandBatch(...$commands);
}

public function remove(DTO\PipelineId $id): DTO\CommandBatch
public function remove(PipelineId $id): DTO\CommandBatch
{
return new DTO\CommandBatch(
new Command\Pipeline\RemovePipelineCommand($id),
Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/PipelineInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public function create(DTO\PipelineInterface $pipeline): DTO\CommandBatch;

public function update(DTO\ReferencedPipeline $actual, DTO\PipelineInterface $desired): DTO\CommandBatch;

public function remove(DTO\PipelineId $id): DTO\CommandBatch;
public function remove(PipelineId $id): DTO\CommandBatch;
}
4 changes: 2 additions & 2 deletions src/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class ComposerScripts
public static function postInstall(Event $event): void
{
self::updatePlugins(
$packages = new Composer\Accumulator(),
$packages = new Accumulator(),
$repository = $event->getComposer()
->getRepositoryManager()
->getLocalRepository(),
Expand All @@ -26,7 +26,7 @@ public static function postInstall(Event $event): void
public static function postUpdate(Event $event): void
{
self::updatePlugins(
$packages = new Composer\Accumulator(),
$packages = new Accumulator(),
$repository = $event->getComposer()
->getRepositoryManager()
->getLocalRepository(),
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Kiboko\Contract\Configurator\InvalidConfigurationException;
use Symfony\Component\Config;

class ConfigLoader implements ConfigLoaderInterface
class ConfigLoader implements Satellite\ConfigLoaderInterface
{
public function __construct(private readonly string $basePath)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ public function log($level, $message, array $context = []): void
}
}

return \Symfony\Component\Console\Command\Command::SUCCESS;
return Console\Command\Command::SUCCESS;
}
}
2 changes: 1 addition & 1 deletion src/Console/Command/ValidateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O

$style->writeln(json_encode($configuration, \JSON_PRETTY_PRINT));

return \Symfony\Component\Console\Command\Command::SUCCESS;
return Console\Command\Command::SUCCESS;
}
}
2 changes: 1 addition & 1 deletion src/Console/Command/WorkflowRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\Console\Output\OutputInterface;

#[Console\Attribute\AsCommand('run:workflow', 'Run a data flow satellite (pipeline or workflow).', hidden: true)]
final class WorkflowRunCommand extends Console\Command\Command
final class WorkflowRunCommand extends RunCommand
{
protected function configure(): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/ElasticSearchFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Repository\ElasticSearchRepository
public function compile(array $config): Logger\Factory\Repository\ElasticSearchRepository
{
$builder = new Logger\Builder\Monolog\ElasticSearchBuilder($this->interpreter);

Expand All @@ -69,6 +69,6 @@ public function compile(array $config): Repository\ElasticSearchRepository
$builder->withIndex($config['index']);
}

return new Repository\ElasticSearchRepository($builder);
return new Logger\Factory\Repository\ElasticSearchRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/GelfFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Repository\GelfRepository
public function compile(array $config): Logger\Factory\Repository\GelfRepository
{
$builder = new Logger\Builder\Monolog\GelfBuilder();

Expand All @@ -74,6 +74,6 @@ public function compile(array $config): Repository\GelfRepository
);
}

return new Repository\GelfRepository($builder);
return new Logger\Factory\Repository\GelfRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/StreamFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Repository\StreamRepository
public function compile(array $config): Logger\Factory\Repository\StreamRepository
{
$builder = new Logger\Builder\Monolog\StreamBuilder($config['path']);

Expand All @@ -66,6 +66,6 @@ public function compile(array $config): Repository\StreamRepository
$builder->withLocking($config['use_locking']);
}

return new Repository\StreamRepository($builder);
return new Logger\Factory\Repository\StreamRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/SyslogFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Repository\SyslogRepository
public function compile(array $config): Logger\Factory\Repository\SyslogRepository
{
$builder = new Logger\Builder\Monolog\SyslogBuilder($config['ident']);

Expand All @@ -66,6 +66,6 @@ public function compile(array $config): Repository\SyslogRepository
$builder->withLogopts($config['logopts']);
}

return new Repository\SyslogRepository($builder);
return new Logger\Factory\Repository\SyslogRepository($builder);
}
}
16 changes: 8 additions & 8 deletions src/Feature/Rejection/Builder/RabbitMQBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ public function withExchange(
public function getNode(): Node\Expr
{
$args = [
new Node\Arg($this->host, name: new Node\Identifier('host')),
new Node\Arg($this->vhost, name: new Node\Identifier('vhost')),
new Node\Arg($this->topic, name: new Node\Identifier('topic')),
new Node\Arg($this->stepUuid, name: new Node\Identifier('stepUuid')),
new Node\Arg($this->host, name: new Identifier('host')),
new Node\Arg($this->vhost, name: new Identifier('vhost')),
new Node\Arg($this->topic, name: new Identifier('topic')),
new Node\Arg($this->stepUuid, name: new Identifier('stepUuid')),
];

if (null !== $this->exchange) {
$args[] = new Node\Arg($this->exchange, name: new Node\Identifier('exchange'));
$args[] = new Node\Arg($this->exchange, name: new Identifier('exchange'));
}

if (null !== $this->port) {
$args[] = new Node\Arg($this->port, name: new Node\Identifier('port'));
$args[] = new Node\Arg($this->port, name: new Identifier('port'));
}

if (null !== $this->user) {
array_push(
$args,
new Node\Arg($this->user, name: new Node\Identifier('user')),
new Node\Arg($this->password, name: new Node\Identifier('password')),
new Node\Arg($this->user, name: new Identifier('user')),
new Node\Arg($this->password, name: new Identifier('password')),
);

return new Node\Expr\StaticCall(
Expand Down
4 changes: 2 additions & 2 deletions src/Feature/Rejection/Factory/RabbitMQFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Repository\RabbitMQRepository
public function compile(array $config): Rejection\Factory\Repository\RabbitMQRepository
{
$builder = new Rejection\Builder\RabbitMQBuilder(
stepUuid: compileValueWhenExpression($this->interpreter, uniqid()),
Expand All @@ -76,6 +76,6 @@ public function compile(array $config): Repository\RabbitMQRepository
$builder->withExchange(compileValueWhenExpression($this->interpreter, $config['exchange']));
}

return new Repository\RabbitMQRepository($builder);
return new Rejection\Factory\Repository\RabbitMQRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Plugin/Custom/Factory/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function validate(array $config): bool
/**
* @throws Configurator\ConfigurationExceptionInterface
*/
public function compile(array $config): Repository\Extractor
public function compile(array $config): Custom\Factory\Repository\Extractor
{
$containerName = sprintf('ProjectServiceContainer%s', ByteString::fromRandom(8)->toString());

Expand All @@ -74,7 +74,7 @@ public function compile(array $config): Repository\Extractor

$container = (new SatelliteDependencyInjection(...$this->providers))($config);

$repository = new Repository\Extractor($builder);
$repository = new Custom\Factory\Repository\Extractor($builder);

$dumper = new PhpDumper($container);
$repository->addFiles(
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin/Custom/Factory/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function validate(array $config): bool
/**
* @throws Configurator\ConfigurationExceptionInterface
*/
public function compile(array $config): Repository\Loader
public function compile(array $config): Custom\Factory\Repository\Loader
{
$containerName = sprintf('ProjectServiceContainer%s', ByteString::fromRandom(8)->toString());

Expand All @@ -74,7 +74,7 @@ public function compile(array $config): Repository\Loader

$container = (new SatelliteDependencyInjection(...$this->providers))($config);

$repository = new Repository\Loader($builder);
$repository = new Custom\Factory\Repository\Loader($builder);

$dumper = new PhpDumper($container);
$repository->addFiles(
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin/Custom/Factory/Transformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function validate(array $config): bool
/**
* @throws Configurator\ConfigurationExceptionInterface
*/
public function compile(array $config): Repository\Transformer
public function compile(array $config): Custom\Factory\Repository\Transformer
{
$containerName = sprintf('ProjectServiceContainer%s', ByteString::fromRandom(8)->toString());

Expand All @@ -74,7 +74,7 @@ public function compile(array $config): Repository\Transformer

$container = (new SatelliteDependencyInjection(...$this->providers))($config);

$repository = new Repository\Transformer($builder);
$repository = new Custom\Factory\Repository\Transformer($builder);

$dumper = new PhpDumper($container);
$repository->addFiles(
Expand Down
7 changes: 5 additions & 2 deletions src/Plugin/Custom/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@

#[Configurator\Pipeline(
name: 'custom',
dependencies: [
'symfony/dependency-injection:^6.0'
],
steps: [
new Configurator\Pipeline\StepExtractor(),
new Configurator\Pipeline\StepTransformer(),
new Configurator\Pipeline\StepLoader(),
],
]
)] final readonly class Service implements Configurator\PipelinePluginInterface
{
private Processor $processor;
Expand All @@ -27,7 +30,7 @@ public function __construct(
private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage()
) {
$this->processor = new Processor();
$this->configuration = new Configuration();
$this->configuration = new Custom\Configuration();
}

public function interpreter(): ExpressionLanguage
Expand Down
Loading
Loading