@@ -45,6 +45,7 @@ import {
4545  RunStreamCallback , 
4646  RunSubscription , 
4747  TaskRunShape , 
48+   RealtimeRun , 
4849}  from  "./runStream.js" ; 
4950import  { 
5051  CreateEnvironmentVariableParams , 
@@ -88,7 +89,14 @@ const DEFAULT_ZOD_FETCH_OPTIONS: ZodFetchOptions = {
8889
8990export  {  isRequestOptions  } ; 
9091export  type  {  ApiRequestOptions  } ; 
91- export  type  {  RunShape ,  AnyRunShape ,  TaskRunShape ,  RunStreamCallback ,  RunSubscription  } ; 
92+ export  type  { 
93+   RunShape , 
94+   AnyRunShape , 
95+   TaskRunShape , 
96+   RealtimeRun , 
97+   RunStreamCallback , 
98+   RunSubscription , 
99+ } ; 
92100
93101/** 
94102 * Trigger.dev v3 API client 
@@ -603,15 +611,19 @@ export class ApiClient {
603611    ) ; 
604612  } 
605613
606-   subscribeToRun < TRunTypes  extends  AnyRunTypes > ( runId : string )  { 
614+   subscribeToRun < TRunTypes  extends  AnyRunTypes > ( runId : string ,   options ?:  {   signal ?:  AbortSignal   } )  { 
607615    return  runShapeStream < TRunTypes > ( `${ this . baseUrl }  /realtime/v1/runs/${ runId }  ` ,  { 
608616      closeOnComplete : true , 
609617      headers : this . #getRealtimeHeaders( ) , 
610618      client : this , 
619+       signal : options ?. signal , 
611620    } ) ; 
612621  } 
613622
614-   subscribeToRunsWithTag < TRunTypes  extends  AnyRunTypes > ( tag : string  |  string [ ] )  { 
623+   subscribeToRunsWithTag < TRunTypes  extends  AnyRunTypes > ( 
624+     tag : string  |  string [ ] , 
625+     options ?: {  signal ?: AbortSignal  } 
626+   )  { 
615627    const  searchParams  =  createSearchQueryForSubscribeToRuns ( { 
616628      tags : tag , 
617629    } ) ; 
@@ -622,15 +634,20 @@ export class ApiClient {
622634        closeOnComplete : false , 
623635        headers : this . #getRealtimeHeaders( ) , 
624636        client : this , 
637+         signal : options ?. signal , 
625638      } 
626639    ) ; 
627640  } 
628641
629-   subscribeToBatch < TRunTypes  extends  AnyRunTypes > ( batchId : string )  { 
642+   subscribeToBatch < TRunTypes  extends  AnyRunTypes > ( 
643+     batchId : string , 
644+     options ?: {  signal ?: AbortSignal  } 
645+   )  { 
630646    return  runShapeStream < TRunTypes > ( `${ this . baseUrl }  /realtime/v1/batches/${ batchId }  ` ,  { 
631647      closeOnComplete : false , 
632648      headers : this . #getRealtimeHeaders( ) , 
633649      client : this , 
650+       signal : options ?. signal , 
634651    } ) ; 
635652  } 
636653
0 commit comments