@@ -40,8 +40,7 @@ type BuildVerticesParams = {
40
40
logBuilds ?: boolean ;
41
41
session ?: string ;
42
42
playgroundPage ?: boolean ;
43
- stream ?: boolean ;
44
- eventDelivery ?: EventDeliveryType ;
43
+ eventDelivery : EventDeliveryType ;
45
44
} ;
46
45
47
46
function getInactiveVertexData ( vertexId : string ) : VertexBuildTypeAPI {
@@ -148,7 +147,10 @@ export async function buildFlowVerticesWithFallback(
148
147
e . message === POLLING_MESSAGES . STREAMING_NOT_SUPPORTED
149
148
) {
150
149
// Fallback to polling
151
- return await buildFlowVertices ( { ...params , stream : false } ) ;
150
+ return await buildFlowVertices ( {
151
+ ...params ,
152
+ eventDelivery : EventDeliveryType . POLLING ,
153
+ } ) ;
152
154
}
153
155
throw e ;
154
156
}
@@ -176,13 +178,16 @@ async function pollBuildEvents(
176
178
) : Promise < void > {
177
179
let isDone = false ;
178
180
while ( ! isDone ) {
179
- const response = await fetch ( `${ url } ?stream=false` , {
180
- method : "GET" ,
181
- headers : {
182
- "Content-Type" : "application/json" ,
181
+ const response = await fetch (
182
+ `${ url } ?event_delivery=${ EventDeliveryType . POLLING } ` ,
183
+ {
184
+ method : "GET" ,
185
+ headers : {
186
+ "Content-Type" : "application/json" ,
187
+ } ,
188
+ signal : abortController . signal , // Add abort signal to fetch
183
189
} ,
184
- signal : abortController . signal , // Add abort signal to fetch
185
- } ) ;
190
+ ) ;
186
191
187
192
if ( ! response . ok ) {
188
193
const errorData = await response . json ( ) . catch ( ( ) => ( { } ) ) ;
@@ -241,7 +246,6 @@ export async function buildFlowVertices({
241
246
logBuilds,
242
247
session,
243
248
playgroundPage,
244
- stream = true ,
245
249
eventDelivery,
246
250
} : BuildVerticesParams ) {
247
251
const inputs = { } ;
@@ -260,10 +264,10 @@ export async function buildFlowVertices({
260
264
queryParams . append ( "log_builds" , logBuilds . toString ( ) ) ;
261
265
}
262
266
263
- // Add stream parameter when using direct event delivery
264
- if ( eventDelivery === EventDeliveryType . DIRECT ) {
265
- queryParams . append ( "stream" , "true" ) ;
266
- }
267
+ queryParams . append (
268
+ "event_delivery" ,
269
+ eventDelivery ?? EventDeliveryType . POLLING ,
270
+ ) ;
267
271
268
272
if ( queryParams . toString ( ) ) {
269
273
buildUrl = `${ buildUrl } ?${ queryParams . toString ( ) } ` ;
@@ -376,13 +380,12 @@ export async function buildFlowVertices({
376
380
}
377
381
} ) ;
378
382
useFlowStore . getState ( ) . setBuildController ( buildController ) ;
379
-
380
383
// Then stream the events
381
384
const eventsUrl = `${ BASE_URL_API } build/${ job_id } /events` ;
382
385
const buildResults : Array < boolean > = [ ] ;
383
386
const verticesStartTimeMs : Map < string , number > = new Map ( ) ;
384
387
385
- if ( stream ) {
388
+ if ( eventDelivery === EventDeliveryType . STREAMING ) {
386
389
return performStreamingRequest ( {
387
390
method : "GET" ,
388
391
url : eventsUrl ,
0 commit comments