@@ -3,6 +3,7 @@ import * as Schema from "effect/Schema";
33import {
44 EnvironmentId ,
55 PullRequestListEntry ,
6+ PullRequestListProjectError ,
67 PullRequestListResult ,
78 resolvePullRequestAuthorFilter ,
89} from "@t3tools/contracts" ;
@@ -27,6 +28,10 @@ export interface EnvironmentPullRequestStat extends PullRequestDiffStat {
2728 readonly environmentId : EnvironmentId ;
2829}
2930
31+ export interface EnvironmentPullRequestError extends PullRequestListProjectError {
32+ readonly environmentId : EnvironmentId ;
33+ }
34+
3035export type PullRequestGroupKey = "reviewRequested" | "authored" | "others" ;
3136
3237export interface PullRequestGroup < Entry extends PullRequestListEntry = PullRequestListEntry > {
@@ -452,7 +457,7 @@ export interface MergedPullRequestList {
452457 readonly viewers : PullRequestViewers ;
453458 readonly providers : PullRequestListResult [ "providers" ] ;
454459 readonly entries : ReadonlyArray < EnvironmentPullRequestEntry > ;
455- readonly errors : PullRequestListResult [ "errors" ] ;
460+ readonly errors : ReadonlyArray < EnvironmentPullRequestError > ;
456461 readonly truncated : boolean ;
457462 readonly nextCursors : Readonly < Record < string , PullRequestListCursors > > ;
458463 /**
@@ -476,7 +481,7 @@ export function mergePullRequestLists(
476481 const truncatedEnvironments : string [ ] = [ ] ;
477482 const providers = new Map < string , PullRequestListResult [ "providers" ] [ number ] > ( ) ;
478483 const entries : EnvironmentPullRequestEntry [ ] = [ ] ;
479- const errors : Array < PullRequestListResult [ "errors" ] [ number ] > = [ ] ;
484+ const errors : EnvironmentPullRequestError [ ] = [ ] ;
480485 const nextCursors : Record < string , PullRequestListCursors > = { } ;
481486 let truncated = false ;
482487 for ( const [ environmentId , answer ] of answers ) {
@@ -498,7 +503,7 @@ export function mergePullRequestLists(
498503 ) ;
499504 }
500505 entries . push ( ...answer . entries . map ( ( entry ) => ( { ...entry , environmentId } ) ) ) ;
501- errors . push ( ...answer . errors ) ;
506+ errors . push ( ...answer . errors . map ( ( error ) => ( { ... error , environmentId } ) ) ) ;
502507 truncated ||= answer . truncated ;
503508 if ( answer . truncated ) truncatedEnvironments . push ( environmentId ) ;
504509 if ( Object . keys ( answer . nextCursors ) . length > 0 ) {
@@ -559,12 +564,18 @@ const EnvironmentPullRequestEntrySchema = Schema.Struct({
559564 environmentId : EnvironmentId ,
560565} ) ;
561566
567+ const EnvironmentPullRequestErrorSchema = Schema . Struct ( {
568+ ...PullRequestListProjectError . fields ,
569+ environmentId : EnvironmentId ,
570+ } ) ;
571+
562572const decodeSnapshot = Schema . decodeUnknownOption (
563573 Schema . Struct ( {
564574 scope : Schema . String ,
565575 data : Schema . Struct ( {
566576 ...PullRequestListResult . fields ,
567577 entries : Schema . Array ( EnvironmentPullRequestEntrySchema ) ,
578+ errors : Schema . Array ( EnvironmentPullRequestErrorSchema ) ,
568579 // Per environment here, unlike the wire shape, which is per repository within one.
569580 nextCursors : Schema . Record ( Schema . String , PullRequestListResult . fields . nextCursors ) ,
570581 truncatedEnvironments : Schema . Array ( Schema . String ) ,
0 commit comments