@@ -4,7 +4,7 @@ import type { Container } from './container';
4
4
import type { Account } from './git/models/author' ;
5
5
import type { DefaultBranch } from './git/models/defaultBranch' ;
6
6
import type { Issue } from './git/models/issue' ;
7
- import type { IssueOrPullRequest } from './git/models/issueOrPullRequest' ;
7
+ import type { IssueOrPullRequest , IssueOrPullRequestType } from './git/models/issueOrPullRequest' ;
8
8
import type { PullRequest } from './git/models/pullRequest' ;
9
9
import type { RepositoryMetadata } from './git/models/repositoryMetadata' ;
10
10
import type { HostingIntegration , IntegrationBase , ResourceDescriptor } from './plus/integrations/integration' ;
@@ -111,6 +111,7 @@ export class CacheProvider implements Disposable {
111
111
112
112
getIssueOrPullRequest (
113
113
id : string ,
114
+ type : IssueOrPullRequestType | undefined ,
114
115
resource : ResourceDescriptor ,
115
116
integration : IntegrationBase | undefined ,
116
117
cacheable : Cacheable < IssueOrPullRequest > ,
@@ -119,11 +120,11 @@ export class CacheProvider implements Disposable {
119
120
const { key, etag } = getResourceKeyAndEtag ( resource , integration ) ;
120
121
121
122
if ( resource == null ) {
122
- return this . get ( 'issuesOrPrsById' , `id:${ id } :${ key } ` , etag , cacheable , options ) ;
123
+ return this . get ( 'issuesOrPrsById' , `id:${ id } :${ key } : ${ type ?? 'unknown' } ` , etag , cacheable , options ) ;
123
124
}
124
125
return this . get (
125
126
'issuesOrPrsByIdAndRepo' ,
126
- `id:${ id } :${ key } :${ JSON . stringify ( resource ) } }` ,
127
+ `id:${ id } :${ key } :${ type ?? 'unknown' } : ${ JSON . stringify ( resource ) } }` ,
127
128
etag ,
128
129
cacheable ,
129
130
options ,
@@ -140,11 +141,17 @@ export class CacheProvider implements Disposable {
140
141
const { key, etag } = getResourceKeyAndEtag ( resource , integration ) ;
141
142
142
143
if ( resource == null ) {
143
- return this . get ( 'issuesById' , `id:${ id } :${ key } ` , etag , cacheable , options ) ;
144
+ return this . get (
145
+ 'issuesById' ,
146
+ `id:${ id } :${ key } :${ 'issue' satisfies IssueOrPullRequestType } ` ,
147
+ etag ,
148
+ cacheable ,
149
+ options ,
150
+ ) ;
144
151
}
145
152
return this . get (
146
153
'issuesByIdAndResource' ,
147
- `id:${ id } :${ key } :${ JSON . stringify ( resource ) } }` ,
154
+ `id:${ id } :${ key } :${ 'issue' satisfies IssueOrPullRequestType } : ${ JSON . stringify ( resource ) } }` ,
148
155
etag ,
149
156
cacheable ,
150
157
options ,
@@ -161,9 +168,21 @@ export class CacheProvider implements Disposable {
161
168
const { key, etag } = getResourceKeyAndEtag ( resource , integration ) ;
162
169
163
170
if ( resource == null ) {
164
- return this . get ( 'prsById' , `id:${ id } :${ key } ` , etag , cacheable , options ) ;
171
+ return this . get (
172
+ 'prsById' ,
173
+ `id:${ id } :${ key } :${ 'pullrequest' satisfies IssueOrPullRequestType } ` ,
174
+ etag ,
175
+ cacheable ,
176
+ options ,
177
+ ) ;
165
178
}
166
- return this . get ( 'prsById' , `id:${ id } :${ key } :${ JSON . stringify ( resource ) } }` , etag , cacheable , options ) ;
179
+ return this . get (
180
+ 'prsById' ,
181
+ `id:${ id } :${ key } :${ 'pullrequest' satisfies IssueOrPullRequestType } :${ JSON . stringify ( resource ) } }` ,
182
+ etag ,
183
+ cacheable ,
184
+ options ,
185
+ ) ;
167
186
}
168
187
169
188
getPullRequestForBranch (
@@ -264,7 +283,12 @@ export class CacheProvider implements Disposable {
264
283
if ( isPromise ( item . value ) ) {
265
284
void item . value . then ( v => {
266
285
if ( v != null ) {
267
- this . set ( 'issuesOrPrsById' , `id:${ v . id } :${ key } ` , v , etag ) ;
286
+ this . set (
287
+ 'issuesOrPrsById' ,
288
+ `id:${ v . id } :${ key } :${ 'pullrequest' satisfies IssueOrPullRequestType } ` ,
289
+ v ,
290
+ etag ,
291
+ ) ;
268
292
}
269
293
} ) ;
270
294
}
0 commit comments