Skip to content

Commit

Permalink
Add updateWithStart method into WorkflowClientCallsInterceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Nov 20, 2024
1 parent 83bb0fe commit 0ba224c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
37 changes: 37 additions & 0 deletions src/Interceptor/WorkflowClient/UpdateWithStartInput.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

/**
* This file is part of Temporal package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Temporal\Interceptor\WorkflowClient;

/**
* @psalm-immutable
*/
class UpdateWithStartInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
public readonly StartInput $workflowStartInput,
public readonly UpdateInput $updateInput,
) {}

public function with(
StartInput $workflowStartInput = null,
UpdateInput $updateInput = null,
): self {
return new self(
$workflowStartInput ?? $this->workflowStartInput,
$updateInput ?? $this->updateInput,
);
}
}
10 changes: 10 additions & 0 deletions src/Interceptor/WorkflowClientCallsInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Temporal\Interceptor;

use Temporal\Client\Update\UpdateHandle;
use Temporal\Client\Workflow\WorkflowExecutionDescription;
use Temporal\DataConverter\ValuesInterface;
use Temporal\Interceptor\Trait\WorkflowClientCallsInterceptorTrait;
Expand All @@ -24,6 +25,7 @@
use Temporal\Interceptor\WorkflowClient\StartUpdateOutput;
use Temporal\Interceptor\WorkflowClient\TerminateInput;
use Temporal\Interceptor\WorkflowClient\UpdateInput;
use Temporal\Interceptor\WorkflowClient\UpdateWithStartInput;
use Temporal\Internal\Interceptor\Interceptor;
use Temporal\Workflow\WorkflowExecution;

Expand Down Expand Up @@ -81,6 +83,14 @@ public function update(UpdateInput $input, callable $next): StartUpdateOutput;
*/
public function signalWithStart(SignalWithStartInput $input, callable $next): WorkflowExecution;

/**
* @param UpdateWithStartInput $input
* @param callable(UpdateWithStartInput): WorkflowExecution $next
*
* @return UpdateHandle
*/
public function updateWithStart(UpdateWithStartInput $input, callable $next): UpdateHandle;

/**
* @param GetResultInput $input
* @param callable(GetResultInput): ?ValuesInterface $next
Expand Down
2 changes: 1 addition & 1 deletion src/Interceptor/WorkflowInbound/QueryInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(

public function with(
?ValuesInterface $arguments = null,
?workflowInfo $info = null,
?WorkflowInfo $info = null,
): self {
return new self(
$this->queryName,
Expand Down

0 comments on commit 0ba224c

Please sign in to comment.