diff --git a/src/Interceptor/WorkflowInbound/QueryInput.php b/src/Interceptor/WorkflowInbound/QueryInput.php index adb882a91..668e02787 100644 --- a/src/Interceptor/WorkflowInbound/QueryInput.php +++ b/src/Interceptor/WorkflowInbound/QueryInput.php @@ -12,6 +12,7 @@ namespace Temporal\Interceptor\WorkflowInbound; use Temporal\DataConverter\ValuesInterface; +use Temporal\Workflow\WorkflowInfo; /** * @psalm-immutable @@ -25,14 +26,17 @@ class QueryInput public function __construct( public readonly string $queryName, public readonly ValuesInterface $arguments, + public readonly WorkflowInfo $info, ) {} public function with( - ValuesInterface $arguments = null, + ?ValuesInterface $arguments = null, + ?workflowInfo $info = null, ): self { return new self( $this->queryName, $arguments ?? $this->arguments, + $info ?? $this->info, ); } } diff --git a/src/Interceptor/WorkflowInbound/SignalInput.php b/src/Interceptor/WorkflowInbound/SignalInput.php index 5dc9b4da4..74377efbd 100644 --- a/src/Interceptor/WorkflowInbound/SignalInput.php +++ b/src/Interceptor/WorkflowInbound/SignalInput.php @@ -31,6 +31,7 @@ public function __construct( public readonly WorkflowInfo $info, public readonly ValuesInterface $arguments, public readonly HeaderInterface $header, + public readonly bool $isReplaying, ) {} public function with( @@ -43,6 +44,7 @@ public function with( $info ?? $this->info, $arguments ?? $this->arguments, $header ?? $this->header, + $this->isReplaying, ); } } diff --git a/src/Interceptor/WorkflowInbound/UpdateInput.php b/src/Interceptor/WorkflowInbound/UpdateInput.php index c033d1923..09a705bb5 100644 --- a/src/Interceptor/WorkflowInbound/UpdateInput.php +++ b/src/Interceptor/WorkflowInbound/UpdateInput.php @@ -32,6 +32,7 @@ public function __construct( public readonly WorkflowInfo $info, public readonly ValuesInterface $arguments, public readonly HeaderInterface $header, + public readonly bool $isReplaying, ) {} public function with( @@ -45,6 +46,7 @@ public function with( $info ?? $this->info, $arguments ?? $this->arguments, $header ?? $this->header, + $this->isReplaying, ); } } diff --git a/src/Interceptor/WorkflowInbound/WorkflowInput.php b/src/Interceptor/WorkflowInbound/WorkflowInput.php index 0485c5c1f..2126df22c 100644 --- a/src/Interceptor/WorkflowInbound/WorkflowInput.php +++ b/src/Interceptor/WorkflowInbound/WorkflowInput.php @@ -28,6 +28,7 @@ public function __construct( public readonly WorkflowInfo $info, public readonly ValuesInterface $arguments, public readonly HeaderInterface $header, + public readonly bool $isReplaying, ) {} public function with( @@ -39,6 +40,7 @@ public function with( $info ?? $this->info, $arguments ?? $this->arguments, $header ?? $this->header, + $this->isReplaying, ); } } diff --git a/src/Internal/Transport/Router/InvokeQuery.php b/src/Internal/Transport/Router/InvokeQuery.php index 87a1fc8dc..caa749be9 100644 --- a/src/Internal/Transport/Router/InvokeQuery.php +++ b/src/Internal/Transport/Router/InvokeQuery.php @@ -75,7 +75,7 @@ static function () use ($name, $request, $resolver, $handler, $context, $headers /** @psalm-suppress InaccessibleProperty */ $info->shouldContinueAsNew = $tickInfo->continueAsNewSuggested; - $result = $handler(new QueryInput($name, $request->getPayloads())); + $result = $handler(new QueryInput($name, $request->getPayloads(), $info)); $resolver->resolve(EncodedValues::fromValues([$result])); } catch (\Throwable $e) { $resolver->reject($e); diff --git a/src/Internal/Transport/Router/InvokeUpdate.php b/src/Internal/Transport/Router/InvokeUpdate.php index b7282cd25..f0f9deb25 100644 --- a/src/Internal/Transport/Router/InvokeUpdate.php +++ b/src/Internal/Transport/Router/InvokeUpdate.php @@ -55,6 +55,7 @@ public function handle(ServerRequestInterface $request, array $headers, Deferred info: $context->getInfo(), arguments: $request->getPayloads(), header: $request->getHeader(), + isReplaying: $context->isReplaying(), ); // Validation diff --git a/src/Internal/Transport/Router/StartWorkflow.php b/src/Internal/Transport/Router/StartWorkflow.php index d24608d59..99f968355 100644 --- a/src/Internal/Transport/Router/StartWorkflow.php +++ b/src/Internal/Transport/Router/StartWorkflow.php @@ -112,7 +112,12 @@ public function handle(ServerRequestInterface $request, array $headers, Deferred /** @see WorkflowInboundCallsInterceptor::execute() */ 'execute', )( - new WorkflowInput($context->getInfo(), $context->getInput(), $context->getHeader()), + new WorkflowInput( + $context->getInfo(), + $context->getInput(), + $context->getHeader(), + $context->isReplaying(), + ), ); } diff --git a/src/Internal/Workflow/Process/Process.php b/src/Internal/Workflow/Process/Process.php index bbf30e9aa..29cdca489 100644 --- a/src/Internal/Workflow/Process/Process.php +++ b/src/Internal/Workflow/Process/Process.php @@ -155,6 +155,7 @@ function (?\Throwable $error): void { $this->scopeContext->getInfo(), $arguments, $this->scopeContext->getHeader(), + $this->scopeContext->isReplaying(), )); }, );