@@ -499,6 +499,13 @@ def _workflow_handle_to_workflow_execution_started_event_link(
499
499
)
500
500
501
501
502
+ _LINK_URL_PATH_REGEX = re .compile (
503
+ r"^/namespaces/(?P<namespace>[^/]+)/workflows/(?P<workflow_id>[^/]+)/(?P<run_id>[^/]+)/history$"
504
+ )
505
+ LINK_EVENT_ID_PARAM_NAME = "eventID"
506
+ LINK_EVENT_TYPE_PARAM_NAME = "eventType"
507
+
508
+
502
509
def _workflow_event_to_nexus_link (
503
510
workflow_event : temporalio .api .common .v1 .Link .WorkflowEvent ,
504
511
) -> nexusrpc .Link :
@@ -521,13 +528,6 @@ def _workflow_event_to_nexus_link(
521
528
)
522
529
523
530
524
- _LINK_URL_PATH_REGEX = re .compile (
525
- r"^/namespaces/(?P<namespace>[^/]+)/workflows/(?P<workflow_id>[^/]+)/(?P<run_id>[^/]+)/history$"
526
- )
527
- LINK_EVENT_ID_PARAM_NAME = "eventID"
528
- LINK_EVENT_TYPE_PARAM_NAME = "eventType"
529
-
530
-
531
531
def _nexus_link_to_workflow_event (
532
532
link : nexusrpc .Link ,
533
533
) -> Optional [temporalio .api .common .v1 .Link .WorkflowEvent ]:
@@ -539,7 +539,7 @@ def _nexus_link_to_workflow_event(
539
539
)
540
540
return None
541
541
try :
542
- event_ref = _event_reference_from_query_params (urllib . parse . parse_qs ( url .query ) )
542
+ event_ref = _event_reference_from_query_params (url .query )
543
543
except ValueError as err :
544
544
logger .warning (
545
545
f"Failed to parse event reference from Nexus link URL query parameters: { link } ({ err } )"
@@ -556,11 +556,13 @@ def _nexus_link_to_workflow_event(
556
556
557
557
558
558
def _event_reference_from_query_params (
559
- query_params : Mapping [ str , list [ str ]] ,
559
+ raw_query_params : str ,
560
560
) -> temporalio .api .common .v1 .Link .WorkflowEvent .EventReference :
561
561
"""
562
562
Return an EventReference from the query params or raise ValueError.
563
563
"""
564
+ query_params = urllib .parse .parse_qs (raw_query_params )
565
+
564
566
[reference_type ] = query_params .get ("referenceType" ) or [None ]
565
567
if reference_type != "EventReference" :
566
568
raise ValueError (
0 commit comments