11// import type { EnrichedAutolink } from './annotations/autolinks';
22import type { Disposable } from './api/gitlens' ;
3+ import { AutolinkType } from './autolinks/models/autolinks' ;
34import type { Container } from './container' ;
45import type { Account } from './git/models/author' ;
56import type { DefaultBranch } from './git/models/defaultBranch' ;
@@ -111,6 +112,7 @@ export class CacheProvider implements Disposable {
111112
112113 getIssueOrPullRequest (
113114 id : string ,
115+ type : AutolinkType | undefined ,
114116 resource : ResourceDescriptor ,
115117 integration : IntegrationBase | undefined ,
116118 cacheable : Cacheable < IssueOrPullRequest > ,
@@ -119,11 +121,11 @@ export class CacheProvider implements Disposable {
119121 const { key, etag } = getResourceKeyAndEtag ( resource , integration ) ;
120122
121123 if ( resource == null ) {
122- return this . get ( 'issuesOrPrsById' , `id:${ id } :${ key } ` , etag , cacheable , options ) ;
124+ return this . get ( 'issuesOrPrsById' , `id:${ id } :${ key } : ${ type ?? 'unknown' } ` , etag , cacheable , options ) ;
123125 }
124126 return this . get (
125127 'issuesOrPrsByIdAndRepo' ,
126- `id:${ id } :${ key } :${ JSON . stringify ( resource ) } }` ,
128+ `id:${ id } :${ key } :${ type ?? 'unknown' } : ${ JSON . stringify ( resource ) } }` ,
127129 etag ,
128130 cacheable ,
129131 options ,
@@ -140,11 +142,17 @@ export class CacheProvider implements Disposable {
140142 const { key, etag } = getResourceKeyAndEtag ( resource , integration ) ;
141143
142144 if ( resource == null ) {
143- return this . get ( 'issuesById' , `id:${ id } :${ key } ` , etag , cacheable , options ) ;
145+ return this . get (
146+ 'issuesById' ,
147+ `id:${ id } :${ key } :${ 'issue' satisfies AutolinkType } ` ,
148+ etag ,
149+ cacheable ,
150+ options ,
151+ ) ;
144152 }
145153 return this . get (
146154 'issuesByIdAndResource' ,
147- `id:${ id } :${ key } :${ JSON . stringify ( resource ) } }` ,
155+ `id:${ id } :${ key } :${ 'issue' satisfies AutolinkType } : ${ JSON . stringify ( resource ) } }` ,
148156 etag ,
149157 cacheable ,
150158 options ,
@@ -161,9 +169,21 @@ export class CacheProvider implements Disposable {
161169 const { key, etag } = getResourceKeyAndEtag ( resource , integration ) ;
162170
163171 if ( resource == null ) {
164- return this . get ( 'prsById' , `id:${ id } :${ key } ` , etag , cacheable , options ) ;
172+ return this . get (
173+ 'prsById' ,
174+ `id:${ id } :${ key } :${ 'pullrequest' satisfies AutolinkType } ` ,
175+ etag ,
176+ cacheable ,
177+ options ,
178+ ) ;
165179 }
166- return this . get ( 'prsById' , `id:${ id } :${ key } :${ JSON . stringify ( resource ) } }` , etag , cacheable , options ) ;
180+ return this . get (
181+ 'prsById' ,
182+ `id:${ id } :${ key } :${ 'pullrequest' satisfies AutolinkType } :${ JSON . stringify ( resource ) } }` ,
183+ etag ,
184+ cacheable ,
185+ options ,
186+ ) ;
167187 }
168188
169189 getPullRequestForBranch (
@@ -264,7 +284,12 @@ export class CacheProvider implements Disposable {
264284 if ( isPromise ( item . value ) ) {
265285 void item . value . then ( v => {
266286 if ( v != null ) {
267- this . set ( 'issuesOrPrsById' , `id:${ v . id } :${ key } ` , v , etag ) ;
287+ this . set (
288+ 'issuesOrPrsById' ,
289+ `id:${ v . id } :${ key } :${ 'pullrequest' satisfies AutolinkType } ` ,
290+ v ,
291+ etag ,
292+ ) ;
268293 }
269294 } ) ;
270295 }
0 commit comments