@@ -34,11 +34,15 @@ const RunListInputOptionsSchema = z.object({
3434 isTest : z . boolean ( ) . optional ( ) ,
3535 rootOnly : z . boolean ( ) . optional ( ) ,
3636 batchId : z . string ( ) . optional ( ) ,
37- runIds : z . array ( z . string ( ) ) . optional ( ) ,
37+ runId : z . array ( z . string ( ) ) . optional ( ) ,
3838 bulkId : z . string ( ) . optional ( ) ,
3939} ) ;
4040
4141export type RunListInputOptions = z . infer < typeof RunListInputOptionsSchema > ;
42+ export type RunListInputFilters = Omit <
43+ RunListInputOptions ,
44+ "organizationId" | "projectId" | "environmentId"
45+ > ;
4246
4347type FilterRunsOptions = Omit < RunListInputOptions , "period" > & {
4448 period : number | undefined ;
@@ -256,13 +260,13 @@ export class RunsRepository {
256260 convertedOptions . bulkId = BulkActionId . toId ( options . bulkId ) ;
257261 }
258262
259- if ( options . runIds ) {
263+ if ( options . runId ) {
260264 //convert to friendlyId
261- convertedOptions . runIds = options . runIds . map ( ( runId ) => RunId . toFriendlyId ( runId ) ) ;
265+ convertedOptions . runId = options . runId . map ( ( r ) => RunId . toFriendlyId ( r ) ) ;
262266 }
263267
264268 // Show all runs if we are filtering by batchId or runId
265- if ( options . batchId || options . runIds ?. length || options . scheduleId || options . tasks ?. length ) {
269+ if ( options . batchId || options . runId ?. length || options . scheduleId || options . tasks ?. length ) {
266270 convertedOptions . rootOnly = false ;
267271 }
268272
@@ -342,9 +346,10 @@ function applyRunFiltersToQueryBuilder<T>(
342346 } ) ;
343347 }
344348
345- if ( options . runIds && options . runIds . length > 0 ) {
349+ if ( options . runId && options . runId . length > 0 ) {
350+ // it's important that in the query it's "runIds", otherwise it clashes with the cursor which is called "runId"
346351 queryBuilder . where ( "friendly_id IN {runIds: Array(String)}" , {
347- runIds : options . runIds . map ( ( runId ) => RunId . toFriendlyId ( runId ) ) ,
352+ runIds : options . runId . map ( ( runId ) => RunId . toFriendlyId ( runId ) ) ,
348353 } ) ;
349354 }
350355}
0 commit comments