Skip to content

Commit 5b821a2

Browse files
committed
Wire through additional context type in union
1 parent 8889838 commit 5b821a2

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

temporalio/worker/_interceptor.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import temporalio.common
3030
import temporalio.nexus
3131
import temporalio.workflow
32+
from temporalio.nexus import WorkflowRunOperationContext
3233
from temporalio.workflow import VersioningIntent
3334

3435

@@ -301,7 +302,14 @@ class StartNexusOperationInput(Generic[InputT, OutputT]):
301302
nexusrpc.Operation[InputT, OutputT],
302303
Callable[[Any], nexusrpc.handler.OperationHandler[InputT, OutputT]],
303304
Callable[
304-
[Any, nexusrpc.handler.StartOperationContext, InputT],
305+
[
306+
Any,
307+
Union[
308+
nexusrpc.handler.StartOperationContext,
309+
WorkflowRunOperationContext,
310+
],
311+
InputT,
312+
],
305313
Awaitable[temporalio.nexus.WorkflowHandle[OutputT]],
306314
],
307315
str,

temporalio/worker/_workflow_instance.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import temporalio.exceptions
6262
import temporalio.nexus
6363
import temporalio.workflow
64+
from temporalio.nexus import WorkflowRunOperationContext
6465
from temporalio.service import __version__
6566

6667
from ._interceptor import (
@@ -1502,7 +1503,14 @@ async def workflow_start_nexus_operation(
15021503
nexusrpc.Operation[I, O],
15031504
Callable[[Any], nexusrpc.handler.OperationHandler[I, O]],
15041505
Callable[
1505-
[Any, nexusrpc.handler.StartOperationContext, I],
1506+
[
1507+
Any,
1508+
Union[
1509+
nexusrpc.handler.StartOperationContext,
1510+
WorkflowRunOperationContext,
1511+
],
1512+
I,
1513+
],
15061514
Awaitable[temporalio.nexus.WorkflowHandle[O]],
15071515
],
15081516
str,

temporalio/workflow.py

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import temporalio.exceptions
5959
import temporalio.nexus
6060
import temporalio.workflow
61+
from temporalio.nexus import WorkflowRunOperationContext
6162

6263
from .types import (
6364
AnyType,
@@ -858,7 +859,14 @@ async def workflow_start_nexus_operation(
858859
nexusrpc.Operation[I, O],
859860
Callable[[Any], nexusrpc.handler.OperationHandler[I, O]],
860861
Callable[
861-
[S, nexusrpc.handler.StartOperationContext, I],
862+
[
863+
S,
864+
Union[
865+
nexusrpc.handler.StartOperationContext,
866+
WorkflowRunOperationContext,
867+
],
868+
I,
869+
],
862870
Awaitable[temporalio.nexus.WorkflowHandle[O]],
863871
],
864872
str,
@@ -4428,7 +4436,13 @@ async def start_nexus_operation(
44284436
nexusrpc.Operation[I, O],
44294437
Callable[[Any], nexusrpc.handler.OperationHandler[I, O]],
44304438
Callable[
4431-
[S, nexusrpc.handler.StartOperationContext, I],
4439+
[
4440+
S,
4441+
Union[
4442+
nexusrpc.handler.StartOperationContext, WorkflowRunOperationContext
4443+
],
4444+
I,
4445+
],
44324446
Awaitable[temporalio.nexus.WorkflowHandle[O]],
44334447
],
44344448
str,
@@ -5214,7 +5228,14 @@ async def start_operation(
52145228
nexusrpc.Operation[I, O],
52155229
Callable[[S], nexusrpc.handler.OperationHandler[I, O]],
52165230
Callable[
5217-
[S, nexusrpc.handler.StartOperationContext, I],
5231+
[
5232+
S,
5233+
Union[
5234+
nexusrpc.handler.StartOperationContext,
5235+
WorkflowRunOperationContext,
5236+
],
5237+
I,
5238+
],
52185239
Awaitable[temporalio.nexus.WorkflowHandle[O]],
52195240
],
52205241
str,
@@ -5242,7 +5263,14 @@ async def execute_operation(
52425263
nexusrpc.Operation[I, O],
52435264
Callable[[S], nexusrpc.handler.OperationHandler[I, O]],
52445265
Callable[
5245-
[S, nexusrpc.handler.StartOperationContext, I],
5266+
[
5267+
S,
5268+
Union[
5269+
nexusrpc.handler.StartOperationContext,
5270+
WorkflowRunOperationContext,
5271+
],
5272+
I,
5273+
],
52465274
Awaitable[temporalio.nexus.WorkflowHandle[O]],
52475275
],
52485276
str,

0 commit comments

Comments
 (0)