@@ -588,6 +588,45 @@ test('getClient is available in handler context', async (t) => {
588588 } ) ;
589589} ) ;
590590
591+ test ( 'operationInfo is available in handler context' , async ( t ) => {
592+ const { env, taskQueue, httpPort, endpointId } = t . context ;
593+
594+ const w = await Worker . create ( {
595+ connection : env . nativeConnection ,
596+ namespace : env . namespace ,
597+ taskQueue,
598+ nexusServices : [
599+ nexus . serviceHandler (
600+ nexus . service ( 'testService' , {
601+ testSyncOp : nexus . operation < void , { namespace : string ; taskQueue : string } > ( ) ,
602+ } ) ,
603+ {
604+ async testSyncOp ( ) {
605+ const info = temporalnexus . operationInfo ( ) ;
606+ return {
607+ namespace : info . namespace ,
608+ taskQueue : info . taskQueue ,
609+ } ;
610+ } ,
611+ }
612+ ) ,
613+ ] ,
614+ } ) ;
615+
616+ await w . runUntil ( async ( ) => {
617+ const res = await fetch (
618+ `http://127.0.0.1:${ httpPort } /nexus/endpoints/${ endpointId } /services/testService/testSyncOp` ,
619+ {
620+ method : 'POST' ,
621+ }
622+ ) ;
623+ t . true ( res . ok ) ;
624+ const output = ( await res . json ( ) ) as { namespace : string ; taskQueue : string } ;
625+ t . is ( output . namespace , 'default' ) ;
626+ t . is ( output . taskQueue , taskQueue ) ;
627+ } ) ;
628+ } ) ;
629+
591630test ( 'WorkflowRunOperationHandler attaches callback, link, and request ID' , async ( t ) => {
592631 const { env, taskQueue, httpPort, endpointId } = t . context ;
593632 const requestId1 = randomUUID ( ) ;
0 commit comments