@gitkraken/core-gitlens 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/CHANGELOG.md +41 -1
  2. package/dist/git/cache.d.ts +18 -5
  3. package/dist/git/cache.js +26 -8
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/context.d.ts +5 -1
  6. package/dist/git/context.js.map +1 -1
  7. package/dist/git/errors.d.ts +28 -1
  8. package/dist/git/errors.js +45 -1
  9. package/dist/git/errors.js.map +1 -1
  10. package/dist/git/providers/branches.d.ts +5 -1
  11. package/dist/git/providers/commits.d.ts +24 -1
  12. package/dist/git/providers/config.d.ts +7 -1
  13. package/dist/git/providers/operations.d.ts +6 -0
  14. package/dist/git/providers/provider.d.ts +17 -0
  15. package/dist/git/providers/refs.d.ts +38 -3
  16. package/dist/git/providers/revision.d.ts +5 -1
  17. package/dist/git/providers/staging.d.ts +12 -0
  18. package/dist/git/providers/worktrees.d.ts +23 -3
  19. package/dist/git/run.types.d.ts +6 -0
  20. package/dist/git-cli/cliGitProvider.d.ts +17 -1
  21. package/dist/git-cli/cliGitProvider.js +37 -1
  22. package/dist/git-cli/cliGitProvider.js.map +1 -1
  23. package/dist/git-cli/exec/git.d.ts +12 -2
  24. package/dist/git-cli/exec/git.js +47 -16
  25. package/dist/git-cli/exec/git.js.map +1 -1
  26. package/dist/git-cli/exec/gitQueue.d.ts +4 -1
  27. package/dist/git-cli/exec/gitQueue.js +1 -1
  28. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  29. package/dist/git-cli/providers/branches.d.ts +10 -1
  30. package/dist/git-cli/providers/branches.js +15 -8
  31. package/dist/git-cli/providers/branches.js.map +1 -1
  32. package/dist/git-cli/providers/commits.d.ts +23 -1
  33. package/dist/git-cli/providers/commits.js +57 -8
  34. package/dist/git-cli/providers/commits.js.map +1 -1
  35. package/dist/git-cli/providers/config.js +2 -1
  36. package/dist/git-cli/providers/config.js.map +1 -1
  37. package/dist/git-cli/providers/operations.d.ts +1 -0
  38. package/dist/git-cli/providers/operations.js +39 -3
  39. package/dist/git-cli/providers/operations.js.map +1 -1
  40. package/dist/git-cli/providers/patch.js +20 -41
  41. package/dist/git-cli/providers/patch.js.map +1 -1
  42. package/dist/git-cli/providers/refs.d.ts +15 -3
  43. package/dist/git-cli/providers/refs.js +115 -10
  44. package/dist/git-cli/providers/refs.js.map +1 -1
  45. package/dist/git-cli/providers/revision.d.ts +3 -1
  46. package/dist/git-cli/providers/revision.js +9 -5
  47. package/dist/git-cli/providers/revision.js.map +1 -1
  48. package/dist/git-cli/providers/staging.d.ts +8 -0
  49. package/dist/git-cli/providers/staging.js +58 -6
  50. package/dist/git-cli/providers/staging.js.map +1 -1
  51. package/dist/git-cli/providers/worktrees.d.ts +31 -2
  52. package/dist/git-cli/providers/worktrees.js +75 -7
  53. package/dist/git-cli/providers/worktrees.js.map +1 -1
  54. package/dist/plus/git-github/api/github.d.ts +64 -3
  55. package/dist/plus/git-github/api/github.js +237 -24
  56. package/dist/plus/git-github/api/github.js.map +1 -1
  57. package/dist/plus/git-github/providers/github/branches.d.ts +3 -1
  58. package/dist/plus/git-github/providers/github/branches.js +2 -1
  59. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  60. package/dist/plus/git-github/providers/github/refs.d.ts +10 -3
  61. package/dist/plus/git-github/providers/github/refs.js +4 -4
  62. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  63. package/dist/plus/git-github/providers/github/revision.d.ts +3 -1
  64. package/dist/plus/git-github/providers/github/revision.js +1 -1
  65. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  66. package/dist/plus/integrations/index.d.ts +5 -2
  67. package/dist/plus/integrations/index.js.map +1 -1
  68. package/dist/plus/integrations/integrationService.d.ts +35 -9
  69. package/dist/plus/integrations/integrationService.js +16 -3
  70. package/dist/plus/integrations/integrationService.js.map +1 -1
  71. package/dist/plus/integrations/manager.d.ts +107 -37
  72. package/dist/plus/integrations/models/gitHostIntegration.d.ts +128 -13
  73. package/dist/plus/integrations/models/gitHostIntegration.js +130 -17
  74. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  75. package/dist/plus/integrations/models/integration.d.ts +51 -3
  76. package/dist/plus/integrations/models/integration.js +125 -18
  77. package/dist/plus/integrations/models/integration.js.map +1 -1
  78. package/dist/plus/integrations/models/issuesIntegration.d.ts +18 -5
  79. package/dist/plus/integrations/models/issuesIntegration.js +40 -10
  80. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  81. package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
  82. package/dist/plus/integrations/providers/azure/azure.js +13 -17
  83. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  84. package/dist/plus/integrations/providers/azure/models.d.ts +29 -0
  85. package/dist/plus/integrations/providers/azure/models.js +112 -1
  86. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  87. package/dist/plus/integrations/providers/azureDevOps.d.ts +54 -2
  88. package/dist/plus/integrations/providers/azureDevOps.js +80 -2
  89. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  90. package/dist/plus/integrations/providers/azureDevOpsServer.js +2 -1
  91. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  92. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +61 -0
  93. package/dist/plus/integrations/providers/bitbucket/bitbucket.js +165 -23
  94. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  95. package/dist/plus/integrations/providers/bitbucket/models.d.ts +6 -1
  96. package/dist/plus/integrations/providers/bitbucket/models.js +4 -3
  97. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  98. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js +1 -1
  99. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js.map +1 -1
  100. package/dist/plus/integrations/providers/bitbucket-server.d.ts +38 -1
  101. package/dist/plus/integrations/providers/bitbucket-server.js +33 -1
  102. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  103. package/dist/plus/integrations/providers/bitbucket.d.ts +36 -1
  104. package/dist/plus/integrations/providers/bitbucket.js +29 -1
  105. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  106. package/dist/plus/integrations/providers/github.d.ts +48 -4
  107. package/dist/plus/integrations/providers/github.js +101 -6
  108. package/dist/plus/integrations/providers/github.js.map +1 -1
  109. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +35 -0
  110. package/dist/plus/integrations/providers/gitlab/gitlab.js +132 -15
  111. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  112. package/dist/plus/integrations/providers/gitlab/models.d.ts +1 -0
  113. package/dist/plus/integrations/providers/gitlab/models.js +1 -1
  114. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  115. package/dist/plus/integrations/providers/gitlab.d.ts +48 -1
  116. package/dist/plus/integrations/providers/gitlab.js +79 -3
  117. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  118. package/dist/plus/integrations/providers/jira-server.d.ts +3 -3
  119. package/dist/plus/integrations/providers/jira-server.js +3 -3
  120. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  121. package/dist/plus/integrations/providers/models.d.ts +12 -1
  122. package/dist/plus/integrations/providers/models.js +11 -1
  123. package/dist/plus/integrations/providers/models.js.map +1 -1
  124. package/dist/plus/integrations/providers/providerErrors.d.ts +9 -1
  125. package/dist/plus/integrations/providers/providerErrors.js +10 -1
  126. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  127. package/dist/plus/integrations/providers/providersApi.d.ts +59 -0
  128. package/dist/plus/integrations/providers/providersApi.js +136 -1
  129. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  130. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +42 -0
  131. package/dist/plus/integrations/providers/utils/providerPaging.js +58 -1
  132. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  133. package/dist/plus/integrations/providers/utils.d.ts +1 -1
  134. package/dist/plus/integrations/reads/currentAccount.d.ts +35 -0
  135. package/dist/plus/integrations/reads/currentAccount.js +46 -0
  136. package/dist/plus/integrations/reads/currentAccount.js.map +1 -0
  137. package/dist/plus/integrations/reads/drains.d.ts +4 -1
  138. package/dist/plus/integrations/reads/drains.js +7 -3
  139. package/dist/plus/integrations/reads/drains.js.map +1 -1
  140. package/dist/plus/integrations/reads/issueBatch.d.ts +72 -12
  141. package/dist/plus/integrations/reads/issueBatch.js +193 -48
  142. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  143. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +57 -0
  144. package/dist/plus/integrations/reads/pullRequestBatch.js +80 -0
  145. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -0
  146. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +58 -0
  147. package/dist/plus/integrations/reads/pullRequestBranches.js +111 -0
  148. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -0
  149. package/dist/plus/integrations/reads/pullRequests.js +3 -3
  150. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  151. package/dist/plus/integrations/reads/sweeps.js +3 -3
  152. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  153. package/dist/plus/integrations/results.d.ts +5 -2
  154. package/dist/plus/integrations/results.js.map +1 -1
  155. package/dist/utils/env/node/exec.js +1 -1
  156. package/dist/utils/env/node/exec.js.map +1 -1
  157. package/docs/integrations.md +90 -36
  158. package/docs/kepler-git-write-api-parity.md +239 -0
  159. package/docs/kepler-read-api-parity.md +75 -28
  160. package/package.json +1 -1
  161. package/dist/plus/integrations/reads/trackerIssue.d.ts +0 -33
  162. package/dist/plus/integrations/reads/trackerIssue.js +0 -60
  163. package/dist/plus/integrations/reads/trackerIssue.js.map +0 -1
@@ -10,7 +10,9 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
10
10
  private readonly cache;
11
11
  private readonly provider;
12
12
  constructor(cache: Cache, provider: GitHubGitProviderInternal);
13
- getBranch(repoPath: string, name?: string, cancellation?: AbortSignal): Promise<GitBranch | undefined>;
13
+ getBranch(repoPath: string, name?: string, options?: {
14
+ force?: boolean;
15
+ }, cancellation?: AbortSignal): Promise<GitBranch | undefined>;
14
16
  getBranches(repoPath: string | undefined, options?: {
15
17
  filter?: (b: GitBranch) => boolean;
16
18
  ordering?: 'date' | 'author-date' | 'topo' | null;
@@ -16,8 +16,9 @@ var BranchesGitSubProvider = class {
16
16
  this.cache = cache;
17
17
  this.provider = provider;
18
18
  }
19
- async getBranch(repoPath, name, cancellation) {
19
+ async getBranch(repoPath, name, options, cancellation) {
20
20
  const scope = getScopedLogger();
21
+ if (options?.force) this.cache.evictCaches(repoPath, "branches");
21
22
  if (name != null) {
22
23
  const { values: [branch] } = await this.getBranches(repoPath, { filter: (b) => b.name === name }, cancellation);
23
24
  return branch;
@@ -1 +1 @@
1
- {"version":3,"file":"branches.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/branches.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { BranchContributionsOverview, GitBranchesSubProvider } from '@gitlens/git/providers/branches.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createRevisionRange, stripOrigin } from '@gitlens/git/utils/revision.utils.js';\nimport type { BranchSortOptions } from '@gitlens/git/utils/sorting.js';\nimport { sortBranches, sortContributors } from '@gitlens/git/utils/sorting.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport type { PagedResult, PagingOptions } from '@gitlens/utils/paging.js';\nimport { emptyPagedResult } from '@gitlens/utils/paging.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport type { CacheController } from '@gitlens/utils/promiseCache.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport { HeadType } from '../../context.js';\nimport type { GitHubBranch } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nexport class BranchesGitSubProvider implements GitBranchesSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tasync getBranch(repoPath: string, name?: string, cancellation?: AbortSignal): Promise<GitBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (name != null) {\n\t\t\tconst {\n\t\t\t\tvalues: [branch],\n\t\t\t} = await this.getBranches(repoPath, { filter: b => b.name === name }, cancellation);\n\t\t\treturn branch;\n\t\t}\n\n\t\treturn this.cache.branch.getOrCreate(\n\t\t\trepoPath,\n\t\t\tasync (_cacheable, signal): Promise<GitBranch | undefined> => {\n\t\t\t\t// Prefer the cache-provided aggregate signal (only fires when every joined\n\t\t\t\t// caller aborts); fall back to this caller's cancellation for the first-caller path.\n\t\t\t\tsignal ??= cancellation;\n\t\t\t\tconst {\n\t\t\t\t\tvalues: [branch],\n\t\t\t\t} = await this.getBranches(repoPath, { filter: b => b.current }, signal);\n\t\t\t\tif (branch != null) return branch;\n\n\t\t\t\ttry {\n\t\t\t\t\tconst { metadata } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\t\tswitch (revision.type) {\n\t\t\t\t\t\tcase HeadType.Tag:\n\t\t\t\t\t\tcase HeadType.Commit:\n\t\t\t\t\t\t\treturn new GitBranch(\n\t\t\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\t\t\t`refs/heads/${revision.name}`,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\trevision.revision,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn undefined;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tscope?.error(ex);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ args: repoPath => ({ repoPath: repoPath }) })\n\tasync getBranches(\n\t\trepoPath: string | undefined,\n\t\toptions?: {\n\t\t\tfilter?: (b: GitBranch) => boolean;\n\t\t\tordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t\tpaging?: PagingOptions;\n\t\t\tsort?: boolean | BranchSortOptions;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PagedResult<GitBranch>> {\n\t\tif (repoPath == null) return emptyPagedResult;\n\n\t\tconst path = repoPath;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst load = async (cacheable?: CacheController): Promise<PagedResult<GitBranch>> => {\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(path);\n\n\t\t\t\tconst branches: GitBranch[] = [];\n\n\t\t\t\tconst commitOrdering = options?.ordering;\n\n\t\t\t\tfunction addBranches(branch: GitHubBranch, current: boolean) {\n\t\t\t\t\tconst date = new Date(\n\t\t\t\t\t\tcommitOrdering === 'author-date' ? branch.target.authoredDate : branch.target.committedDate,\n\t\t\t\t\t);\n\t\t\t\t\tconst ref = branch.target.oid;\n\n\t\t\t\t\tbranches.push(\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/heads/${branch.name}`,\n\t\t\t\t\t\t\tcurrent,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: `origin/${branch.name}`,\n\t\t\t\t\t\t\t\tmissing: false,\n\t\t\t\t\t\t\t\tstate: { ahead: 0, behind: 0 },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/remotes/origin/${branch.name}`,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlet currentBranch: string | undefined;\n\n\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\tswitch (revision.type) {\n\t\t\t\t\tcase HeadType.Branch:\n\t\t\t\t\t\tcurrentBranch = revision.name;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase HeadType.RemoteBranch: {\n\t\t\t\t\t\tconst index = revision.name.indexOf(':');\n\t\t\t\t\t\tcurrentBranch = index === -1 ? revision.name : revision.name.substring(index + 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet cursor = options?.paging?.cursor;\n\t\t\t\tconst loadAll = cursor == null;\n\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst result = await github.getBranches(\n\t\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\t\t{ cursor: cursor },\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const branch of result.values) {\n\t\t\t\t\t\taddBranches(branch, branch.name === currentBranch);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!result.paging?.more || !loadAll) return { ...result, values: branches };\n\n\t\t\t\t\tcursor = result.paging.cursor;\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\n\t\t\t\t// Mark the cache entry invalidated so the empty fallback self-evicts on settle\n\t\t\t\t// rather than getting stuck serving stale emptiness to subsequent callers.\n\t\t\t\tcacheable?.invalidate();\n\t\t\t\treturn emptyPagedResult;\n\t\t\t}\n\t\t};\n\n\t\t// Compose cache key with cursor so re-loads of the same page hit the cache;\n\t\t// `repoPath` (no suffix) is reserved for the full \"all branches\" entry.\n\t\t// TODO: `cache.branches` is `PromiseMap<RepoPath, ...>` keyed exactly by repoPath, so\n\t\t// `clearCaches('branches')` / `unregisterRepoPath` will not invalidate composite-key entries.\n\t\t// Acceptable today because branches don't change during a virtual-repo session, but the entries\n\t\t// leak in memory until provider GC. Long-term: switch to RepoPromiseCacheMap or add prefix-invalidate.\n\t\tconst cacheKey = options?.paging?.cursor != null ? `${path}#${options.paging.cursor}` : path;\n\t\tconst branchesPromise = this.cache.branches.getOrCreate(cacheKey, cacheable => load(cacheable), cancellation);\n\n\t\tlet result = await branchesPromise;\n\t\tif (options?.filter != null) {\n\t\t\tresult = {\n\t\t\t\t...result,\n\t\t\t\tvalues: result.values.filter(options.filter),\n\t\t\t};\n\t\t}\n\n\t\tif (options?.sort != null) {\n\t\t\tsortBranches(result.values, typeof options.sort === 'boolean' ? undefined : options.sort);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync getBranchContributionsOverview(\n\t\trepoPath: string,\n\t\tref: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command\n\t\t// queue, so the priority signal has no effect here. Accepted for interface compatibility.\n\t\toptions?: {\n\t\t\tassociatedPullRequest?: Promise<{ refs?: { base?: { branch: string } } } | undefined>;\n\t\t\tpriority?: GitCommandPriority;\n\t\t},\n\t\t_cancellation?: AbortSignal,\n\t): Promise<BranchContributionsOverview | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\t// Expensive body — runs only on cache miss. Closes over `mergeTarget` so the cache key\n\t\t// (`${ref}|${mergeTarget}`) fully captures every input that affects the result.\n\t\tconst fetchBody = async (mergeTarget: string): Promise<BranchContributionsOverview | undefined> => {\n\t\t\tconst mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget);\n\t\t\tif (mergeBase == null) return undefined;\n\n\t\t\t// Fetch the merge-base commit's committer date in parallel with contributors so consumers\n\t\t\t// that just need the date for the scope window don't pay a separate round-trip.\n\t\t\t// `allSettled` so a transient failure in one side doesn't drop the overview entirely.\n\t\t\tconst [contributorsSettled, mergeBaseCommitSettled] = await Promise.allSettled([\n\t\t\t\tthis.provider.contributors.getContributors(repoPath, createRevisionRange(mergeBase, ref, '..'), {\n\t\t\t\t\tstats: true,\n\t\t\t\t}),\n\t\t\t\tthis.provider.commits.getCommit(repoPath, mergeBase),\n\t\t\t]);\n\n\t\t\tconst result = getSettledValue(contributorsSettled) ?? { contributors: [] };\n\t\t\tconst mergeBaseCommit = getSettledValue(mergeBaseCommitSettled);\n\n\t\t\tsortContributors(result.contributors, { orderBy: 'score:desc' });\n\n\t\t\tlet totalCommits = 0;\n\t\t\tlet totalFiles = 0;\n\t\t\tlet totalAdditions = 0;\n\t\t\tlet totalDeletions = 0;\n\t\t\tlet firstCommitTimestamp;\n\t\t\tlet latestCommitTimestamp;\n\n\t\t\tfor (const c of result.contributors) {\n\t\t\t\ttotalCommits += c.contributionCount;\n\t\t\t\ttotalFiles += c.stats?.files ?? 0;\n\t\t\t\ttotalAdditions += c.stats?.additions ?? 0;\n\t\t\t\ttotalDeletions += c.stats?.deletions ?? 0;\n\n\t\t\t\tconst firstTimestamp = c.firstCommitDate?.getTime();\n\t\t\t\tconst latestTimestamp = c.latestCommitDate?.getTime();\n\n\t\t\t\tif (firstTimestamp != null || latestTimestamp != null) {\n\t\t\t\t\tfirstCommitTimestamp =\n\t\t\t\t\t\tfirstCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.min(firstCommitTimestamp, firstTimestamp ?? Infinity, latestTimestamp ?? Infinity)\n\t\t\t\t\t\t\t: (firstTimestamp ?? latestTimestamp);\n\n\t\t\t\t\tlatestCommitTimestamp =\n\t\t\t\t\t\tlatestCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.max(latestCommitTimestamp, firstTimestamp ?? -Infinity, latestTimestamp ?? -Infinity)\n\t\t\t\t\t\t\t: (latestTimestamp ?? firstTimestamp);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tbranch: ref,\n\t\t\t\tmergeTarget: mergeTarget,\n\t\t\t\tmergeBase: mergeBase,\n\t\t\t\tmergeBaseDate: mergeBaseCommit?.committer?.date ?? mergeBaseCommit?.author?.date,\n\n\t\t\t\tcommits: totalCommits,\n\t\t\t\tfiles: totalFiles,\n\t\t\t\tadditions: totalAdditions,\n\t\t\t\tdeletions: totalDeletions,\n\n\t\t\t\tlatestCommitDate: latestCommitTimestamp != null ? new Date(latestCommitTimestamp) : undefined,\n\t\t\t\tfirstCommitDate: firstCommitTimestamp != null ? new Date(firstCommitTimestamp) : undefined,\n\n\t\t\t\tcontributors: result.contributors,\n\t\t\t};\n\t\t};\n\n\t\ttry {\n\t\t\t// Resolve `mergeTarget` (PR base or default branch). Only the expensive body below is\n\t\t\t// cached — keyed on `${ref}|${mergeTarget}` so callers that resolve to the same target\n\t\t\t// share the result, while differing targets get independent slots.\n\t\t\tlet mergeTarget: string | undefined;\n\n\t\t\tif (options?.associatedPullRequest != null) {\n\t\t\t\tconst pr = await options.associatedPullRequest;\n\t\t\t\tif (pr?.refs?.base != null) {\n\t\t\t\t\tmergeTarget = pr.refs.base.branch;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmergeTarget ??= await this.getDefaultBranchName(repoPath);\n\t\t\tif (mergeTarget == null) return undefined;\n\n\t\t\t// Safe to cache despite PR retargeting: the cache key includes the resolved `mergeTarget`,\n\t\t\t// so a retargeted PR resolves to a fresh slot and the old entry is stale-but-unused (and\n\t\t\t// TTL-evicts). The prior \"no outer cache here\" rationale assumed a `ref`-only key.\n\t\t\tconst resolvedTarget = mergeTarget;\n\t\t\treturn await this.cache.getBranchOverview(repoPath, `${ref}|${resolvedTarget}`, () =>\n\t\t\t\tfetchBody(resolvedTarget),\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getBranchesWithCommits(\n\t\trepoPath: string,\n\t\tshas: string[],\n\t\tbranch?: string | undefined,\n\t\toptions?:\n\t\t\t| { all?: boolean; commitDate?: Date; mode?: 'contains' | 'pointsAt' }\n\t\t\t| { commitDate?: Date; mode?: 'contains' | 'pointsAt'; remotes?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tif (repoPath == null || options?.commitDate == null) return [];\n\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\tlet branches;\n\n\t\t\tif (branch) {\n\t\t\t\tbranches = await github.getBranchWithCommit(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tbranch,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbranches = await github.getBranchesWithCommits(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn branches;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@debug()\n\tasync getDefaultBranchName(\n\t\trepoPath: string | undefined,\n\t\tremote?: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command queue, so the\n\t\t// priority signal has no effect here. `local` asks for a network-free resolution (the graph's hot\n\t\t// path): a remote repo has no local symref to read, so honor that contract by returning undefined\n\t\t// rather than making the API round-trip the caller explicitly asked to avoid.\n\t\toptions?: { priority?: GitCommandPriority; local?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return undefined;\n\t\tif (options?.local) return undefined;\n\n\t\tremote ??= 'origin';\n\n\t\tconst scope = getScopedLogger();\n\n\t\t// Throw inside the factory so RepoPromiseCacheMap's default `expireOnError` evicts the\n\t\t// entry — a transient API failure shouldn't poison the cache for the rest of the session.\n\t\t// The outer try/catch preserves the existing `undefined`-on-error contract for callers.\n\t\ttry {\n\t\t\treturn await this.cache.getDefaultBranchName(repoPath, remote, async () => {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\t\treturn github.getDefaultBranchName(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,yBAAb,MAAsE;CAEnD;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,MACM,UAAU,UAAkB,MAAe,cAA4D;EAC5G,MAAM,QAAQ,gBAAgB;EAE9B,IAAI,QAAQ,MAAM;GACjB,MAAM,EACL,QAAQ,CAAC,YACN,MAAM,KAAK,YAAY,UAAU,EAAE,SAAQ,MAAK,EAAE,SAAS,KAAK,GAAG,YAAY;GACnF,OAAO;EACR;EAEA,OAAO,KAAK,MAAM,OAAO,YACxB,UACA,OAAO,YAAY,WAA2C;GAG7D,WAAW;GACX,MAAM,EACL,QAAQ,CAAC,YACN,MAAM,KAAK,YAAY,UAAU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AqB,UAAU,QAAQ,YAAY;IAC1E,MAAM,EAAE,UAAU,QAAQ,YAAY,MAAM,KAAK,SAAS,wBAAwB,QAAQ;IAC1F,OAAO,OAAO,qBACb,YAAY,KAAK,SAAS,0BAA0B,OAAO,GAC3D,SAAS,KAAK,OACd,SAAS,KAAK,IACf;GACD,CAAC;EACF,SAAS,IAAI;GACZ,OAAO,MAAM,EAAE;GACf;GACA;EACD;CACD;AACD;AAxXE,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,aAAA,IAAA;AAqDN,WAAA,CAAA,MAAM,EAAE,OAAM,cAAa,EAAY,SAAS,GAAG,CAAC,CAAA,GAAA,uBAAA,WAAA,eAAA,IAAA;AA+HpD,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,kCAAA,IAAA;AAgHN,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,0BAAA,IAAA;AAgDN,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,wBAAA,IAAA"}
1
+ {"version":3,"file":"branches.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/branches.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { BranchContributionsOverview, GitBranchesSubProvider } from '@gitlens/git/providers/branches.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createRevisionRange, stripOrigin } from '@gitlens/git/utils/revision.utils.js';\nimport type { BranchSortOptions } from '@gitlens/git/utils/sorting.js';\nimport { sortBranches, sortContributors } from '@gitlens/git/utils/sorting.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport type { PagedResult, PagingOptions } from '@gitlens/utils/paging.js';\nimport { emptyPagedResult } from '@gitlens/utils/paging.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport type { CacheController } from '@gitlens/utils/promiseCache.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport { HeadType } from '../../context.js';\nimport type { GitHubBranch } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nexport class BranchesGitSubProvider implements GitBranchesSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tasync getBranch(\n\t\trepoPath: string,\n\t\tname?: string,\n\t\toptions?: { force?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (options?.force) {\n\t\t\tthis.cache.evictCaches(repoPath, 'branches');\n\t\t}\n\n\t\tif (name != null) {\n\t\t\tconst {\n\t\t\t\tvalues: [branch],\n\t\t\t} = await this.getBranches(repoPath, { filter: b => b.name === name }, cancellation);\n\t\t\treturn branch;\n\t\t}\n\n\t\treturn this.cache.branch.getOrCreate(\n\t\t\trepoPath,\n\t\t\tasync (_cacheable, signal): Promise<GitBranch | undefined> => {\n\t\t\t\t// Prefer the cache-provided aggregate signal (only fires when every joined\n\t\t\t\t// caller aborts); fall back to this caller's cancellation for the first-caller path.\n\t\t\t\tsignal ??= cancellation;\n\t\t\t\tconst {\n\t\t\t\t\tvalues: [branch],\n\t\t\t\t} = await this.getBranches(repoPath, { filter: b => b.current }, signal);\n\t\t\t\tif (branch != null) return branch;\n\n\t\t\t\ttry {\n\t\t\t\t\tconst { metadata } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\t\tswitch (revision.type) {\n\t\t\t\t\t\tcase HeadType.Tag:\n\t\t\t\t\t\tcase HeadType.Commit:\n\t\t\t\t\t\t\treturn new GitBranch(\n\t\t\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\t\t\t`refs/heads/${revision.name}`,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\trevision.revision,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn undefined;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tscope?.error(ex);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ args: repoPath => ({ repoPath: repoPath }) })\n\tasync getBranches(\n\t\trepoPath: string | undefined,\n\t\toptions?: {\n\t\t\tfilter?: (b: GitBranch) => boolean;\n\t\t\tordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t\tpaging?: PagingOptions;\n\t\t\tsort?: boolean | BranchSortOptions;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PagedResult<GitBranch>> {\n\t\tif (repoPath == null) return emptyPagedResult;\n\n\t\tconst path = repoPath;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst load = async (cacheable?: CacheController): Promise<PagedResult<GitBranch>> => {\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(path);\n\n\t\t\t\tconst branches: GitBranch[] = [];\n\n\t\t\t\tconst commitOrdering = options?.ordering;\n\n\t\t\t\tfunction addBranches(branch: GitHubBranch, current: boolean) {\n\t\t\t\t\tconst date = new Date(\n\t\t\t\t\t\tcommitOrdering === 'author-date' ? branch.target.authoredDate : branch.target.committedDate,\n\t\t\t\t\t);\n\t\t\t\t\tconst ref = branch.target.oid;\n\n\t\t\t\t\tbranches.push(\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/heads/${branch.name}`,\n\t\t\t\t\t\t\tcurrent,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: `origin/${branch.name}`,\n\t\t\t\t\t\t\t\tmissing: false,\n\t\t\t\t\t\t\t\tstate: { ahead: 0, behind: 0 },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/remotes/origin/${branch.name}`,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlet currentBranch: string | undefined;\n\n\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\tswitch (revision.type) {\n\t\t\t\t\tcase HeadType.Branch:\n\t\t\t\t\t\tcurrentBranch = revision.name;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase HeadType.RemoteBranch: {\n\t\t\t\t\t\tconst index = revision.name.indexOf(':');\n\t\t\t\t\t\tcurrentBranch = index === -1 ? revision.name : revision.name.substring(index + 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet cursor = options?.paging?.cursor;\n\t\t\t\tconst loadAll = cursor == null;\n\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst result = await github.getBranches(\n\t\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\t\t{ cursor: cursor },\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const branch of result.values) {\n\t\t\t\t\t\taddBranches(branch, branch.name === currentBranch);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!result.paging?.more || !loadAll) return { ...result, values: branches };\n\n\t\t\t\t\tcursor = result.paging.cursor;\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\n\t\t\t\t// Mark the cache entry invalidated so the empty fallback self-evicts on settle\n\t\t\t\t// rather than getting stuck serving stale emptiness to subsequent callers.\n\t\t\t\tcacheable?.invalidate();\n\t\t\t\treturn emptyPagedResult;\n\t\t\t}\n\t\t};\n\n\t\t// Compose cache key with cursor so re-loads of the same page hit the cache;\n\t\t// `repoPath` (no suffix) is reserved for the full \"all branches\" entry.\n\t\t// TODO: `cache.branches` is `PromiseMap<RepoPath, ...>` keyed exactly by repoPath, so\n\t\t// `clearCaches('branches')` / `unregisterRepoPath` will not invalidate composite-key entries.\n\t\t// Acceptable today because branches don't change during a virtual-repo session, but the entries\n\t\t// leak in memory until provider GC. Long-term: switch to RepoPromiseCacheMap or add prefix-invalidate.\n\t\tconst cacheKey = options?.paging?.cursor != null ? `${path}#${options.paging.cursor}` : path;\n\t\tconst branchesPromise = this.cache.branches.getOrCreate(cacheKey, cacheable => load(cacheable), cancellation);\n\n\t\tlet result = await branchesPromise;\n\t\tif (options?.filter != null) {\n\t\t\tresult = {\n\t\t\t\t...result,\n\t\t\t\tvalues: result.values.filter(options.filter),\n\t\t\t};\n\t\t}\n\n\t\tif (options?.sort != null) {\n\t\t\tsortBranches(result.values, typeof options.sort === 'boolean' ? undefined : options.sort);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync getBranchContributionsOverview(\n\t\trepoPath: string,\n\t\tref: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command\n\t\t// queue, so the priority signal has no effect here. Accepted for interface compatibility.\n\t\toptions?: {\n\t\t\tassociatedPullRequest?: Promise<{ refs?: { base?: { branch: string } } } | undefined>;\n\t\t\tpriority?: GitCommandPriority;\n\t\t},\n\t\t_cancellation?: AbortSignal,\n\t): Promise<BranchContributionsOverview | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\t// Expensive body — runs only on cache miss. Closes over `mergeTarget` so the cache key\n\t\t// (`${ref}|${mergeTarget}`) fully captures every input that affects the result.\n\t\tconst fetchBody = async (mergeTarget: string): Promise<BranchContributionsOverview | undefined> => {\n\t\t\tconst mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget);\n\t\t\tif (mergeBase == null) return undefined;\n\n\t\t\t// Fetch the merge-base commit's committer date in parallel with contributors so consumers\n\t\t\t// that just need the date for the scope window don't pay a separate round-trip.\n\t\t\t// `allSettled` so a transient failure in one side doesn't drop the overview entirely.\n\t\t\tconst [contributorsSettled, mergeBaseCommitSettled] = await Promise.allSettled([\n\t\t\t\tthis.provider.contributors.getContributors(repoPath, createRevisionRange(mergeBase, ref, '..'), {\n\t\t\t\t\tstats: true,\n\t\t\t\t}),\n\t\t\t\tthis.provider.commits.getCommit(repoPath, mergeBase),\n\t\t\t]);\n\n\t\t\tconst result = getSettledValue(contributorsSettled) ?? { contributors: [] };\n\t\t\tconst mergeBaseCommit = getSettledValue(mergeBaseCommitSettled);\n\n\t\t\tsortContributors(result.contributors, { orderBy: 'score:desc' });\n\n\t\t\tlet totalCommits = 0;\n\t\t\tlet totalFiles = 0;\n\t\t\tlet totalAdditions = 0;\n\t\t\tlet totalDeletions = 0;\n\t\t\tlet firstCommitTimestamp;\n\t\t\tlet latestCommitTimestamp;\n\n\t\t\tfor (const c of result.contributors) {\n\t\t\t\ttotalCommits += c.contributionCount;\n\t\t\t\ttotalFiles += c.stats?.files ?? 0;\n\t\t\t\ttotalAdditions += c.stats?.additions ?? 0;\n\t\t\t\ttotalDeletions += c.stats?.deletions ?? 0;\n\n\t\t\t\tconst firstTimestamp = c.firstCommitDate?.getTime();\n\t\t\t\tconst latestTimestamp = c.latestCommitDate?.getTime();\n\n\t\t\t\tif (firstTimestamp != null || latestTimestamp != null) {\n\t\t\t\t\tfirstCommitTimestamp =\n\t\t\t\t\t\tfirstCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.min(firstCommitTimestamp, firstTimestamp ?? Infinity, latestTimestamp ?? Infinity)\n\t\t\t\t\t\t\t: (firstTimestamp ?? latestTimestamp);\n\n\t\t\t\t\tlatestCommitTimestamp =\n\t\t\t\t\t\tlatestCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.max(latestCommitTimestamp, firstTimestamp ?? -Infinity, latestTimestamp ?? -Infinity)\n\t\t\t\t\t\t\t: (latestTimestamp ?? firstTimestamp);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tbranch: ref,\n\t\t\t\tmergeTarget: mergeTarget,\n\t\t\t\tmergeBase: mergeBase,\n\t\t\t\tmergeBaseDate: mergeBaseCommit?.committer?.date ?? mergeBaseCommit?.author?.date,\n\n\t\t\t\tcommits: totalCommits,\n\t\t\t\tfiles: totalFiles,\n\t\t\t\tadditions: totalAdditions,\n\t\t\t\tdeletions: totalDeletions,\n\n\t\t\t\tlatestCommitDate: latestCommitTimestamp != null ? new Date(latestCommitTimestamp) : undefined,\n\t\t\t\tfirstCommitDate: firstCommitTimestamp != null ? new Date(firstCommitTimestamp) : undefined,\n\n\t\t\t\tcontributors: result.contributors,\n\t\t\t};\n\t\t};\n\n\t\ttry {\n\t\t\t// Resolve `mergeTarget` (PR base or default branch). Only the expensive body below is\n\t\t\t// cached — keyed on `${ref}|${mergeTarget}` so callers that resolve to the same target\n\t\t\t// share the result, while differing targets get independent slots.\n\t\t\tlet mergeTarget: string | undefined;\n\n\t\t\tif (options?.associatedPullRequest != null) {\n\t\t\t\tconst pr = await options.associatedPullRequest;\n\t\t\t\tif (pr?.refs?.base != null) {\n\t\t\t\t\tmergeTarget = pr.refs.base.branch;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmergeTarget ??= await this.getDefaultBranchName(repoPath);\n\t\t\tif (mergeTarget == null) return undefined;\n\n\t\t\t// Safe to cache despite PR retargeting: the cache key includes the resolved `mergeTarget`,\n\t\t\t// so a retargeted PR resolves to a fresh slot and the old entry is stale-but-unused (and\n\t\t\t// TTL-evicts). The prior \"no outer cache here\" rationale assumed a `ref`-only key.\n\t\t\tconst resolvedTarget = mergeTarget;\n\t\t\treturn await this.cache.getBranchOverview(repoPath, `${ref}|${resolvedTarget}`, () =>\n\t\t\t\tfetchBody(resolvedTarget),\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getBranchesWithCommits(\n\t\trepoPath: string,\n\t\tshas: string[],\n\t\tbranch?: string | undefined,\n\t\toptions?:\n\t\t\t| { all?: boolean; commitDate?: Date; mode?: 'contains' | 'pointsAt' }\n\t\t\t| { commitDate?: Date; mode?: 'contains' | 'pointsAt'; remotes?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tif (repoPath == null || options?.commitDate == null) return [];\n\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\tlet branches;\n\n\t\t\tif (branch) {\n\t\t\t\tbranches = await github.getBranchWithCommit(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tbranch,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbranches = await github.getBranchesWithCommits(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn branches;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@debug()\n\tasync getDefaultBranchName(\n\t\trepoPath: string | undefined,\n\t\tremote?: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command queue, so the\n\t\t// priority signal has no effect here. `local` asks for a network-free resolution (the graph's hot\n\t\t// path): a remote repo has no local symref to read, so honor that contract by returning undefined\n\t\t// rather than making the API round-trip the caller explicitly asked to avoid.\n\t\toptions?: { priority?: GitCommandPriority; local?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return undefined;\n\t\tif (options?.local) return undefined;\n\n\t\tremote ??= 'origin';\n\n\t\tconst scope = getScopedLogger();\n\n\t\t// Throw inside the factory so RepoPromiseCacheMap's default `expireOnError` evicts the\n\t\t// entry — a transient API failure shouldn't poison the cache for the rest of the session.\n\t\t// The outer try/catch preserves the existing `undefined`-on-error contract for callers.\n\t\ttry {\n\t\t\treturn await this.cache.getDefaultBranchName(repoPath, remote, async () => {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\t\treturn github.getDefaultBranchName(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,yBAAb,MAAsE;CAEnD;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,MACM,UACL,UACA,MACA,SACA,cACiC;EACjC,MAAM,QAAQ,gBAAgB;EAE9B,IAAI,SAAS,OACZ,KAAK,MAAM,YAAY,UAAU,UAAU;EAG5C,IAAI,QAAQ,MAAM;GACjB,MAAM,EACL,QAAQ,C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f;GACA,OAAO,CAAC;EACT;CACD;CAEA,MACM,qBACL,UACA,QAKA,SACA,eAC8B;EAC9B,IAAI,YAAY,MAAM,OAAO,KAAA;EAC7B,IAAI,SAAS,OAAO,OAAO,KAAA;EAE3B,WAAW;EAEX,MAAM,QAAQ,gBAAgB;EAK9B,IAAI;GACH,OAAO,MAAM,KAAK,MAAM,qBAAqB,UAAU,QAAQ,YAAY;IAC1E,MAAM,EAAE,UAAU,QAAQ,YAAY,MAAM,KAAK,SAAS,wBAAwB,QAAQ;IAC1F,OAAO,OAAO,qBACb,YAAY,KAAK,SAAS,0BAA0B,OAAO,GAC3D,SAAS,KAAK,OACd,SAAS,KAAK,IACf;GACD,CAAC;EACF,SAAS,IAAI;GACZ,OAAO,MAAM,EAAE;GACf;GACA;EACD;CACD;AACD;AAjYE,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,aAAA,IAAA;AA8DN,WAAA,CAAA,MAAM,EAAE,OAAM,cAAa,EAAY,SAAS,GAAG,CAAC,CAAA,GAAA,uBAAA,WAAA,eAAA,IAAA;AA+HpD,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,kCAAA,IAAA;AAgHN,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,0BAAA,IAAA;AAgDN,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,wBAAA,IAAA"}
@@ -15,7 +15,9 @@ export declare class RefsGitSubProvider implements GitRefsSubProvider {
15
15
  forkPoint?: boolean;
16
16
  priority?: GitCommandPriority;
17
17
  }, _cancellation?: AbortSignal): Promise<string | undefined>;
18
- getReference(repoPath: string, ref: string, _cancellation?: AbortSignal): Promise<GitReference | undefined>;
18
+ getReference(repoPath: string, ref: string, options?: {
19
+ force?: boolean;
20
+ }, _cancellation?: AbortSignal): Promise<GitReference | undefined>;
19
21
  getRefTips(_repoPath: string, _options?: {
20
22
  include?: ReadonlyArray<'heads' | 'remotes' | 'tags'>;
21
23
  }, _cancellation?: AbortSignal): Promise<GitRefTip[]>;
@@ -29,8 +31,13 @@ export declare class RefsGitSubProvider implements GitRefsSubProvider {
29
31
  };
30
32
  }, cancellation?: AbortSignal): Promise<boolean>;
31
33
  isValidReference(_repoPath: string, _ref: string, _pathOrUri?: string, _cancellation?: AbortSignal): Promise<boolean>;
32
- validateReference(_repoPath: string, ref: string, _relativePath?: string, _cancellation?: AbortSignal): Promise<string | undefined>;
33
- updateReference(_repoPath: string, _ref: string, _newRef: string, _cancellation?: AbortSignal): Promise<void>;
34
+ validateReference(_repoPath: string, ref: string, _options?: {
35
+ relativePath?: string;
36
+ force?: boolean;
37
+ }, _cancellation?: AbortSignal): Promise<string | undefined>;
38
+ updateReference(_repoPath: string, _ref: string, _sha: string, _options?: {
39
+ expected?: string | 'absent';
40
+ }, _cancellation?: AbortSignal): Promise<void>;
34
41
  }
35
42
  //#endregion
36
43
  //# sourceMappingURL=refs.d.ts.map
@@ -36,11 +36,11 @@ var RefsGitSubProvider = class {
36
36
  }
37
37
  });
38
38
  }
39
- async getReference(repoPath, ref, _cancellation) {
39
+ async getReference(repoPath, ref, options, _cancellation) {
40
40
  if (!ref || ref === "0000000000000000000000000000000000000000-") return void 0;
41
41
  if (!await this.isValidReference(repoPath, ref)) return void 0;
42
42
  if (ref !== "HEAD" && !isShaWithOptionalRevisionSuffix(ref)) {
43
- const branch = await this.provider.branches.getBranch(repoPath, ref);
43
+ const branch = await this.provider.branches.getBranch(repoPath, ref, options?.force ? { force: true } : void 0);
44
44
  if (branch != null) return createReference(branch.ref, repoPath, {
45
45
  id: branch.id,
46
46
  refType: "branch",
@@ -77,10 +77,10 @@ var RefsGitSubProvider = class {
77
77
  isValidReference(_repoPath, _ref, _pathOrUri, _cancellation) {
78
78
  return Promise.resolve(true);
79
79
  }
80
- validateReference(_repoPath, ref, _relativePath, _cancellation) {
80
+ validateReference(_repoPath, ref, _options, _cancellation) {
81
81
  return Promise.resolve(ref);
82
82
  }
83
- updateReference(_repoPath, _ref, _newRef, _cancellation) {
83
+ updateReference(_repoPath, _ref, _sha, _options, _cancellation) {
84
84
  return Promise.resolve();
85
85
  }
86
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"refs.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/refs.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { GitReference, GitRefTip } from '@gitlens/git/models/reference.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTag } from '@gitlens/git/models/tag.js';\nimport type { GitRefsSubProvider } from '@gitlens/git/providers/refs.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createReference } from '@gitlens/git/utils/reference.utils.js';\nimport {\n\tcreateRevisionRange,\n\tisShaWithOptionalRevisionSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\n// Since negative lookbehind isn't supported in all browsers, this leaves out the negative lookbehind condition `(?<!\\.lock)` to ensure the branch name doesn't end with `.lock`\n// oxlint-disable-next-line no-control-regex\nconst validBranchOrTagRegex = /^[^/](?!.*\\/\\.)(?!.*\\.\\.)(?!.*\\/\\/)(?!.*@\\{)[^\\x00-\\x1F\\x7F ~^:?*[\\\\]+[^./]$/;\n\nexport class RefsGitSubProvider implements GitRefsSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tcheckIfCouldBeValidBranchOrTagName(_repoPath: string, ref: string): Promise<boolean> {\n\t\treturn Promise.resolve(validBranchOrTagRegex.test(ref));\n\t}\n\n\t@debug()\n\tgetMergeBase(\n\t\trepoPath: string,\n\t\tref1: string,\n\t\tref2: string,\n\t\t_options?: { forkPoint?: boolean; priority?: GitCommandPriority },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\tconst a = stripOrigin(ref1);\n\t\tconst b = stripOrigin(ref2);\n\t\t// `merge-base` is symmetric, so normalize ref order in the cache key to coalesce\n\t\t// `(A, B)` and `(B, A)` lookups onto a single entry.\n\t\tconst [left, right] = a < b ? [a, b] : [b, a];\n\t\tconst cacheKey = `${left}...${right}`;\n\t\tconst queryRange = createRevisionRange(a, b, '...');\n\n\t\treturn this.cache.mergeBase.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\ttry {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tqueryRange,\n\t\t\t\t);\n\t\t\t\treturn result?.merge_base_commit?.sha;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getReference(repoPath: string, ref: string, _cancellation?: AbortSignal): Promise<GitReference | undefined> {\n\t\tif (!ref || ref === deletedOrMissing) return undefined;\n\n\t\tif (!(await this.isValidReference(repoPath, ref))) return undefined;\n\n\t\tif (ref !== 'HEAD' && !isShaWithOptionalRevisionSuffix(ref)) {\n\t\t\tconst branch = await this.provider.branches.getBranch(repoPath, ref);\n\t\t\tif (branch != null) {\n\t\t\t\treturn createReference(branch.ref, repoPath, {\n\t\t\t\t\tid: branch.id,\n\t\t\t\t\trefType: 'branch',\n\t\t\t\t\tname: branch.name,\n\t\t\t\t\tremote: branch.remote,\n\t\t\t\t\tupstream: branch.upstream,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst tag = await this.provider.tags.getTag(repoPath, ref);\n\t\t\tif (tag != null) {\n\t\t\t\treturn createReference(tag.ref, repoPath, {\n\t\t\t\t\tid: tag.id,\n\t\t\t\t\trefType: 'tag',\n\t\t\t\t\tname: tag.name,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn createReference(ref, repoPath, { refType: 'revision' });\n\t}\n\n\t@debug()\n\tgetRefTips(\n\t\t_repoPath: string,\n\t\t_options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitRefTip[]> {\n\t\t// Not implemented for GitHub virtual repos — current consumers (timeline slice-by-branch)\n\t\t// gate this off via `!repo.virtual`. A future implementation can use GraphQL `refs` /\n\t\t// `commit.associatedRefs`.\n\t\treturn Promise.resolve([]);\n\t}\n\n\t@debug()\n\tgetRefsContainingShas(\n\t\t_repoPath: string,\n\t\t_shas: ReadonlySet<string> | readonly string[],\n\t\t_oldestSha: string,\n\t\t_options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<Map<string, GitRefTip[]>> {\n\t\t// See `getRefTips` — gated off for virtual repos until GraphQL `commit.associatedRefs` lands.\n\t\treturn Promise.resolve(new Map<string, GitRefTip[]>());\n\t}\n\n\t@debug()\n\tasync hasBranchOrTag(\n\t\trepoPath: string | undefined,\n\t\toptions?: { filter?: { branches?: (b: GitBranch) => boolean; tags?: (t: GitTag) => boolean } },\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tif (repoPath == null) return false;\n\n\t\tconst [{ values: branches }, { values: tags }] = await Promise.all([\n\t\t\tthis.provider.branches.getBranches(\n\t\t\t\trepoPath,\n\t\t\t\t{ filter: options?.filter?.branches, sort: false },\n\t\t\t\tcancellation,\n\t\t\t),\n\t\t\tthis.provider.tags.getTags(repoPath, { filter: options?.filter?.tags, sort: false }, cancellation),\n\t\t]);\n\n\t\treturn branches.length !== 0 || tags.length !== 0;\n\t}\n\n\t@debug()\n\tisValidReference(\n\t\t_repoPath: string,\n\t\t_ref: string,\n\t\t_pathOrUri?: string,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\treturn Promise.resolve(true);\n\t}\n\n\t@debug()\n\tvalidateReference(\n\t\t_repoPath: string,\n\t\tref: string,\n\t\t_relativePath?: string,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\treturn Promise.resolve(ref);\n\t}\n\n\t@debug()\n\tupdateReference(_repoPath: string, _ref: string, _newRef: string, _cancellation?: AbortSignal): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,wBAAwB;AAE9B,IAAa,qBAAb,MAA8D;CAE3C;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,mCACmC,WAAmB,KAA+B;EACpF,OAAO,QAAQ,QAAQ,sBAAsB,KAAK,GAAG,CAAC;CACvD;CAEA,aAEC,UACA,MACA,MACA,UACA,eAC8B;EAC9B,IAAI,YAAY,MAAM,OAAO,QAAQ,QAAQ,KAAA,CAAS;EAEtD,MAAM,IAAI,YAAY,IAAI;EAC1B,MAAM,IAAI,YAAY,IAAI;EAG1B,MAAM,CAAC,MAAM,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;EAC5C,MAAM,WAAW,GAAG,KAAK,KAAK;EAC9B,MAAM,aAAa,oBAAoB,GAAG,GAAG,KAAK;EAElD,OAAO,KAAK,MAAM,UAAU,YAAY,UAAU,UAAU,YAAY;GACvE,MAAM,QAAQ,gBAAgB;GAE9B,MAAM,EAAE,UAAU,QAAQ,YAAY,MAAM,KAAK,SAAS,wBAAwB,QAAQ;GAE1F,IAAI;IAOH,QAAO,MANc,OAAO,cAC3B,YAAY,KAAK,SAAS,0BAA0B,OAAO,GAC3D,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AAQ,SAAS,QAAQ;GAAM,MAAM;EAAM,GAAG,YAAY,CAClG,CAAC;EAED,OAAO,SAAS,WAAW,KAAK,KAAK,WAAW;CACjD;CAEA,iBAEC,WACA,MACA,YACA,eACmB;EACnB,OAAO,QAAQ,QAAQ,IAAI;CAC5B;CAEA,kBAEC,WACA,KACA,eACA,eAC8B;EAC9B,OAAO,QAAQ,QAAQ,GAAG;CAC3B;CAEA,gBACgB,WAAmB,MAAc,SAAiB,eAA4C;EAC7G,OAAO,QAAQ,QAAQ;CACxB;AACD;AA/IE,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,sCAAA,IAAA;AAKN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,gBAAA,IAAA;AAuCN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,gBAAA,IAAA;AA+BN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,cAAA,IAAA;AAYN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,yBAAA,IAAA;AAYN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,kBAAA,IAAA;AAoBN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,oBAAA,IAAA;AAUN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,qBAAA,IAAA;AAUN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,mBAAA,IAAA"}
1
+ {"version":3,"file":"refs.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/refs.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { GitReference, GitRefTip } from '@gitlens/git/models/reference.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTag } from '@gitlens/git/models/tag.js';\nimport type { GitRefsSubProvider } from '@gitlens/git/providers/refs.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createReference } from '@gitlens/git/utils/reference.utils.js';\nimport {\n\tcreateRevisionRange,\n\tisShaWithOptionalRevisionSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\n// Since negative lookbehind isn't supported in all browsers, this leaves out the negative lookbehind condition `(?<!\\.lock)` to ensure the branch name doesn't end with `.lock`\n// oxlint-disable-next-line no-control-regex\nconst validBranchOrTagRegex = /^[^/](?!.*\\/\\.)(?!.*\\.\\.)(?!.*\\/\\/)(?!.*@\\{)[^\\x00-\\x1F\\x7F ~^:?*[\\\\]+[^./]$/;\n\nexport class RefsGitSubProvider implements GitRefsSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tcheckIfCouldBeValidBranchOrTagName(_repoPath: string, ref: string): Promise<boolean> {\n\t\treturn Promise.resolve(validBranchOrTagRegex.test(ref));\n\t}\n\n\t@debug()\n\tgetMergeBase(\n\t\trepoPath: string,\n\t\tref1: string,\n\t\tref2: string,\n\t\t_options?: { forkPoint?: boolean; priority?: GitCommandPriority },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\tconst a = stripOrigin(ref1);\n\t\tconst b = stripOrigin(ref2);\n\t\t// `merge-base` is symmetric, so normalize ref order in the cache key to coalesce\n\t\t// `(A, B)` and `(B, A)` lookups onto a single entry.\n\t\tconst [left, right] = a < b ? [a, b] : [b, a];\n\t\tconst cacheKey = `${left}...${right}`;\n\t\tconst queryRange = createRevisionRange(a, b, '...');\n\n\t\treturn this.cache.mergeBase.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\ttry {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tqueryRange,\n\t\t\t\t);\n\t\t\t\treturn result?.merge_base_commit?.sha;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getReference(\n\t\trepoPath: string,\n\t\tref: string,\n\t\toptions?: { force?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitReference | undefined> {\n\t\tif (!ref || ref === deletedOrMissing) return undefined;\n\n\t\tif (!(await this.isValidReference(repoPath, ref))) return undefined;\n\n\t\tif (ref !== 'HEAD' && !isShaWithOptionalRevisionSuffix(ref)) {\n\t\t\tconst branch = await this.provider.branches.getBranch(\n\t\t\t\trepoPath,\n\t\t\t\tref,\n\t\t\t\toptions?.force ? { force: true } : undefined,\n\t\t\t);\n\t\t\tif (branch != null) {\n\t\t\t\treturn createReference(branch.ref, repoPath, {\n\t\t\t\t\tid: branch.id,\n\t\t\t\t\trefType: 'branch',\n\t\t\t\t\tname: branch.name,\n\t\t\t\t\tremote: branch.remote,\n\t\t\t\t\tupstream: branch.upstream,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst tag = await this.provider.tags.getTag(repoPath, ref);\n\t\t\tif (tag != null) {\n\t\t\t\treturn createReference(tag.ref, repoPath, {\n\t\t\t\t\tid: tag.id,\n\t\t\t\t\trefType: 'tag',\n\t\t\t\t\tname: tag.name,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn createReference(ref, repoPath, { refType: 'revision' });\n\t}\n\n\t@debug()\n\tgetRefTips(\n\t\t_repoPath: string,\n\t\t_options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitRefTip[]> {\n\t\t// Not implemented for GitHub virtual repos — current consumers (timeline slice-by-branch)\n\t\t// gate this off via `!repo.virtual`. A future implementation can use GraphQL `refs` /\n\t\t// `commit.associatedRefs`.\n\t\treturn Promise.resolve([]);\n\t}\n\n\t@debug()\n\tgetRefsContainingShas(\n\t\t_repoPath: string,\n\t\t_shas: ReadonlySet<string> | readonly string[],\n\t\t_oldestSha: string,\n\t\t_options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<Map<string, GitRefTip[]>> {\n\t\t// See `getRefTips` — gated off for virtual repos until GraphQL `commit.associatedRefs` lands.\n\t\treturn Promise.resolve(new Map<string, GitRefTip[]>());\n\t}\n\n\t@debug()\n\tasync hasBranchOrTag(\n\t\trepoPath: string | undefined,\n\t\toptions?: { filter?: { branches?: (b: GitBranch) => boolean; tags?: (t: GitTag) => boolean } },\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tif (repoPath == null) return false;\n\n\t\tconst [{ values: branches }, { values: tags }] = await Promise.all([\n\t\t\tthis.provider.branches.getBranches(\n\t\t\t\trepoPath,\n\t\t\t\t{ filter: options?.filter?.branches, sort: false },\n\t\t\t\tcancellation,\n\t\t\t),\n\t\t\tthis.provider.tags.getTags(repoPath, { filter: options?.filter?.tags, sort: false }, cancellation),\n\t\t]);\n\n\t\treturn branches.length !== 0 || tags.length !== 0;\n\t}\n\n\t@debug()\n\tisValidReference(\n\t\t_repoPath: string,\n\t\t_ref: string,\n\t\t_pathOrUri?: string,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\treturn Promise.resolve(true);\n\t}\n\n\t@debug()\n\tvalidateReference(\n\t\t_repoPath: string,\n\t\tref: string,\n\t\t_options?: { relativePath?: string; force?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\treturn Promise.resolve(ref);\n\t}\n\n\t@debug()\n\tupdateReference(\n\t\t_repoPath: string,\n\t\t_ref: string,\n\t\t_sha: string,\n\t\t_options?: { expected?: string | 'absent' },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,wBAAwB;AAE9B,IAAa,qBAAb,MAA8D;CAE3C;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,mCACmC,WAAmB,KAA+B;EACpF,OAAO,QAAQ,QAAQ,sBAAsB,KAAK,GAAG,CAAC;CACvD;CAEA,aAEC,UACA,MACA,MACA,UACA,eAC8B;EAC9B,IAAI,YAAY,MAAM,OAAO,QAAQ,QAAQ,KAAA,CAAS;EAEtD,MAAM,IAAI,YAAY,IAAI;EAC1B,MAAM,IAAI,YAAY,IAAI;EAG1B,MAAM,CAAC,MAAM,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;EAC5C,MAAM,WAAW,GAAG,KAAK,KAAK;EAC9B,MAAM,aAAa,oBAAoB,GAAG,GAAG,KAAK;EAElD,OAAO,KAAK,MAAM,UAAU,YAAY,UAAU,UAAU,YAAY;GACvE,MAAM,QAAQ,gBAAgB;GAE9B,MAAM,EAAE,UAAU,QAAQ,YAAY,MAAM,KAAK,SAAS,wBAAwB,QAAQ;GAE1F,IAAI;IAOH,QAAO,MANc,OAAO,cAC3B,YAAY,KAAK,SAAS,0BAA0B,OAAO,GAC3D,SAAS,KAAK,OACd,SAAS,KAAK,MACd,UACD,EAAA,EACe,mBAAmB;GACnC,SAAS,IAAI;IACZ,OAAO,MAAM,EAAE;IACf;IACA;GACD;EACD,CAAC;CACF;CAEA,MACM,aACL,UACA,KACA,SACA,eACoC;EACpC,IAAI,CAAC,OAAO,QAAA,6CAA0B,OAAO,KAAA;EAE7C,IAAI,CAAE,MAAM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WACA,KACA,UACA,eAC8B;EAC9B,OAAO,QAAQ,QAAQ,GAAG;CAC3B;CAEA,gBAEC,WACA,MACA,MACA,UACA,eACgB;EAChB,OAAO,QAAQ,QAAQ;CACxB;AACD;AA9JE,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,sCAAA,IAAA;AAKN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,gBAAA,IAAA;AAuCN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,gBAAA,IAAA;AAwCN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,cAAA,IAAA;AAYN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,yBAAA,IAAA;AAYN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,kBAAA,IAAA;AAoBN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,oBAAA,IAAA;AAUN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,qBAAA,IAAA;AAUN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,mBAAA,IAAA"}
@@ -10,7 +10,9 @@ export declare class RevisionGitSubProvider implements GitRevisionSubProvider {
10
10
  getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined>;
11
11
  getTrackedFiles(repoPath: string): Promise<string[]>;
12
12
  getTreeForRevision(repoPath: string, rev: string): Promise<GitTreeEntry[]>;
13
- resolveRevision(repoPath: string, ref: string, pathOrUri?: string | Uri): Promise<ResolvedRevision>;
13
+ resolveRevision(repoPath: string, ref: string, pathOrUri?: string | Uri, _options?: {
14
+ force?: boolean;
15
+ }): Promise<ResolvedRevision>;
14
16
  }
15
17
  //#endregion
16
18
  //# sourceMappingURL=revision.d.ts.map
@@ -57,7 +57,7 @@ var RevisionGitSubProvider = class {
57
57
  });
58
58
  return result;
59
59
  }
60
- async resolveRevision(repoPath, ref, pathOrUri) {
60
+ async resolveRevision(repoPath, ref, pathOrUri, _options) {
61
61
  if (!ref || ref === "0000000000000000000000000000000000000000-") return {
62
62
  sha: ref,
63
63
  revision: ref
@@ -1 +1 @@
1
- {"version":3,"file":"revision.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/revision.ts"],"sourcesContent":["import { FileType } from '@gitlens/git/context.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTreeEntry } from '@gitlens/git/models/tree.js';\nimport type { GitRevisionSubProvider, ResolvedRevision } from '@gitlens/git/providers/revision.js';\nimport {\n\tisRevisionWithSuffix,\n\tisSha,\n\tisUncommitted,\n\tisUncommittedWithParentSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nexport class RevisionGitSubProvider implements GitRevisionSubProvider {\n\tconstructor(private readonly provider: GitHubGitProviderInternal) {}\n\n\t@gate()\n\t@debug()\n\tgetRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined> {\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\treturn this.provider.context.fs.readFile(uri);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined> {\n\t\tif (repoPath == null || !path) return undefined;\n\n\t\tif (path) {\n\t\t\tpath = this.provider.getRelativePath(path, repoPath);\n\t\t}\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\tconst stats = await this.provider.context.fs.stat(uri);\n\t\tif (stats == null) return undefined;\n\n\t\treturn {\n\t\t\tref: rev,\n\t\t\toid: '',\n\t\t\tpath: this.provider.getRelativePath(uri, repoPath),\n\t\t\tsize: stats.size,\n\t\t\ttype: (stats.type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t};\n\t}\n\n\t@debug()\n\tasync getTrackedFiles(repoPath: string): Promise<string[]> {\n\t\tconst tree = await this.getTreeForRevision(repoPath, 'HEAD');\n\t\treturn tree.filter(f => f.type === 'blob').map(f => f.path);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeForRevision(repoPath: string, rev: string): Promise<GitTreeEntry[]> {\n\t\tif (repoPath == null) return [];\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return [];\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst baseUri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev);\n\n\t\tconst entries = await this.provider.context.fs.readDirectory(baseUri);\n\t\tif (entries == null) return [];\n\n\t\tconst result: GitTreeEntry[] = [];\n\t\tfor (const [path, type] of entries) {\n\t\t\tresult.push({\n\t\t\t\tref: rev,\n\t\t\t\toid: '',\n\t\t\t\tpath: path,\n\t\t\t\tsize: 0,\n\t\t\t\ttype: (type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync resolveRevision(repoPath: string, ref: string, pathOrUri?: string | Uri): Promise<ResolvedRevision> {\n\t\tif (!ref || ref === deletedOrMissing) return { sha: ref, revision: ref };\n\n\t\tlet relativePath;\n\t\tif (pathOrUri == null) {\n\t\t\tif (isSha(ref)) return { sha: ref, revision: ref };\n\t\t\tif (ref.endsWith('^3')) return { sha: ref, revision: ref };\n\t\t} else {\n\t\t\tif (isUncommittedWithParentSuffix(ref)) {\n\t\t\t\tref = 'HEAD';\n\t\t\t}\n\t\t\tif (isUncommitted(ref)) return { sha: ref, revision: ref };\n\n\t\t\trelativePath = this.provider.getRelativePath(pathOrUri, repoPath);\n\t\t}\n\n\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\tif (context == null) return { sha: ref, revision: ref };\n\n\t\tconst { metadata, github, session } = context;\n\n\t\tconst sha = await github.resolveReference(\n\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\tmetadata.repo.owner,\n\t\t\tmetadata.repo.name,\n\t\t\tstripOrigin(ref),\n\t\t\trelativePath,\n\t\t);\n\n\t\tif (sha == null) {\n\t\t\treturn { sha: relativePath ? deletedOrMissing : ref, revision: ref };\n\t\t}\n\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\treturn { sha: sha, revision: isRevisionWithSuffix(ref) ? sha : ref };\n\t}\n}\n"],"mappings":";;;;;;;;AAiBA,IAAa,yBAAb,MAAsE;CACxC;CAA7B,YAAY,UAAsD;EAArC,KAAA,WAAA;CAAsC;CAEnE,mBAEmB,UAAkB,MAAc,KAA8C;EAChG,MAAM,MAAM,MACT,KAAK,SAAS,kBAAkB,UAAU,KAAK,IAAI,IACnD,KAAK,SAAS,iBAAiB,UAAU,KAAK,IAAI;EAErD,OAAO,KAAK,SAAS,QAAQ,GAAG,SAAS,GAAG;CAC7C;CAEA,MAEM,wBAAwB,UAAkB,MAAc,KAAgD;EAC7G,IAAI,YAAY,QAAQ,CAAC,MAAM,OAAO,KAAA;EAEtC,IAAI,MACH,OAAO,KAAK,SAAS,gBAAgB,MAAM,QAAQ;EAGpD,IAAI,QAAQ,QAAQ;GACnB,MAAM,UAAU,MAAM,KAAK,SAAS,wBAAwB,QAAQ;GACpE,IAAI,WAAW,MA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{"version":3,"file":"revision.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/revision.ts"],"sourcesContent":["import { FileType } from '@gitlens/git/context.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTreeEntry } from '@gitlens/git/models/tree.js';\nimport type { GitRevisionSubProvider, ResolvedRevision } from '@gitlens/git/providers/revision.js';\nimport {\n\tisRevisionWithSuffix,\n\tisSha,\n\tisUncommitted,\n\tisUncommittedWithParentSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nexport class RevisionGitSubProvider implements GitRevisionSubProvider {\n\tconstructor(private readonly provider: GitHubGitProviderInternal) {}\n\n\t@gate()\n\t@debug()\n\tgetRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined> {\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\treturn this.provider.context.fs.readFile(uri);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined> {\n\t\tif (repoPath == null || !path) return undefined;\n\n\t\tif (path) {\n\t\t\tpath = this.provider.getRelativePath(path, repoPath);\n\t\t}\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\tconst stats = await this.provider.context.fs.stat(uri);\n\t\tif (stats == null) return undefined;\n\n\t\treturn {\n\t\t\tref: rev,\n\t\t\toid: '',\n\t\t\tpath: this.provider.getRelativePath(uri, repoPath),\n\t\t\tsize: stats.size,\n\t\t\ttype: (stats.type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t};\n\t}\n\n\t@debug()\n\tasync getTrackedFiles(repoPath: string): Promise<string[]> {\n\t\tconst tree = await this.getTreeForRevision(repoPath, 'HEAD');\n\t\treturn tree.filter(f => f.type === 'blob').map(f => f.path);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeForRevision(repoPath: string, rev: string): Promise<GitTreeEntry[]> {\n\t\tif (repoPath == null) return [];\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return [];\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst baseUri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev);\n\n\t\tconst entries = await this.provider.context.fs.readDirectory(baseUri);\n\t\tif (entries == null) return [];\n\n\t\tconst result: GitTreeEntry[] = [];\n\t\tfor (const [path, type] of entries) {\n\t\t\tresult.push({\n\t\t\t\tref: rev,\n\t\t\t\toid: '',\n\t\t\t\tpath: path,\n\t\t\t\tsize: 0,\n\t\t\t\ttype: (type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync resolveRevision(\n\t\trepoPath: string,\n\t\tref: string,\n\t\tpathOrUri?: string | Uri,\n\t\t// Nothing to force here — every call resolves fresh from the GitHub API; there is no cache to bypass.\n\t\t_options?: { force?: boolean },\n\t): Promise<ResolvedRevision> {\n\t\tif (!ref || ref === deletedOrMissing) return { sha: ref, revision: ref };\n\n\t\tlet relativePath;\n\t\tif (pathOrUri == null) {\n\t\t\tif (isSha(ref)) return { sha: ref, revision: ref };\n\t\t\tif (ref.endsWith('^3')) return { sha: ref, revision: ref };\n\t\t} else {\n\t\t\tif (isUncommittedWithParentSuffix(ref)) {\n\t\t\t\tref = 'HEAD';\n\t\t\t}\n\t\t\tif (isUncommitted(ref)) return { sha: ref, revision: ref };\n\n\t\t\trelativePath = this.provider.getRelativePath(pathOrUri, repoPath);\n\t\t}\n\n\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\tif (context == null) return { sha: ref, revision: ref };\n\n\t\tconst { metadata, github, session } = context;\n\n\t\tconst sha = await github.resolveReference(\n\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\tmetadata.repo.owner,\n\t\t\tmetadata.repo.name,\n\t\t\tstripOrigin(ref),\n\t\t\trelativePath,\n\t\t);\n\n\t\tif (sha == null) {\n\t\t\treturn { sha: relativePath ? deletedOrMissing : ref, revision: ref };\n\t\t}\n\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\treturn { sha: sha, revision: isRevisionWithSuffix(ref) ? sha : ref };\n\t}\n}\n"],"mappings":";;;;;;;;AAiBA,IAAa,yBAAb,MAAsE;CACxC;CAA7B,YAAY,UAAsD;EAArC,KAAA,WAAA;CAAsC;CAEnE,mBAEmB,UAAkB,MAAc,KAA8C;EAChG,MAAM,MAAM,MACT,KAAK,SAAS,kBAAkB,UAAU,KAAK,IAAI,IACnD,KAAK,SAAS,iBAAiB,UAAU,KAAK,IAAI;EAErD,OAAO,KAAK,SAAS,QAAQ,GAAG,SAAS,GAAG;CAC7C;CAEA,MAEM,wBAAwB,UAAkB,MAAc,KAAgD;EAC7G,IAAI,YAAY,QAAQ,CAAC,MAAM,OAAO,KAAA;EAEtC,IAAI,MACH,OAAO,KAAK,SAAS,gBAAgB,MAAM,QAAQ;EAGpD,IAAI,QAAQ,QAAQ;GACnB,MAAM,UAAU,MAAM,KAAK,SAAS,wBAAwB,QAAQ;GACpE,IAAI,WAAW,MAAM,OAAO,KAAA;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import { ConfiguredIntegrationsChangeEvent } from "./authentication/configuredIn
9
9
  import { IssueFilter } from "./providerFilters.js";
10
10
  import { ConnectionStateChangeEvent, ProviderBroadenResult, ProviderOrganization, ProviderPageInfo, ProviderPagedResult, ProviderRepositoryShape, ProviderResult, ProviderSweepResult, ProviderWarning, ProviderWarningCause, ProviderWarningCauseReason, ProviderWarningKind, ProviderWarningOmission, ProviderWarningOmissionKind, ProviderWarningOmissionRecovery, ProviderWarningOmissionScope, ProviderWarningScope, RepositoryIdentity, RepositoryResolution, RepositoryResolutionStatus, ResolveRepositoryResult } from "./results.js";
11
11
  import { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestCountScope } from "./reads/counts.js";
12
- import { TrackerIssueResult } from "./reads/trackerIssue.js";
12
+ import { CurrentAccountResult } from "./reads/currentAccount.js";
13
+ import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
14
+ import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
15
+ import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
13
16
  import { ClosedPullRequestSweepOptions, IntegrationManager, ListOrgsOptions, ListProjectsOptions, ProviderBroadenOrg, ProviderRepositoriesInput, ProviderRepositoryInput, ProviderSweepTarget, ProviderSweepTargetEvent, PullRequestSweepOptions } from "./manager.js";
14
17
  import { IntegrationAuthenticationProvider, IntegrationAuthenticationProviderDescriptor, IntegrationAuthenticationSessionDescriptor } from "./authentication/integrationAuthenticationProvider.js";
15
18
  import { AccountProvider, AuthenticationSessionsChangeEvent, ConfigChangeEvent, ConfigProvider, HttpProvider, IntegrationServiceHooks, IntegrationStorageProvider, IntegrationsRemoteConfig, RepositoriesProvider } from "./context.js";
@@ -73,5 +76,5 @@ export interface IntegrationManagerContext {
73
76
  */
74
77
  export declare function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager;
75
78
  //#endregion
76
- export { type AccountProvider, type AuthenticationSessionLike, type AuthenticationSessionsChangeEvent, type ClosedPullRequestSweepOptions, type CloudIntegrationAuthType, type CloudIntegrationConnection, type CloudIntegrationType, type ConfigChangeEvent, type ConfigProvider, type ConfiguredIntegrationDescriptor, type ConfiguredIntegrationsChangeEvent, type ConnectionStateChangeEvent, GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, type HttpProvider, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationIds, type IntegrationManager, type IntegrationServiceHooks, type IntegrationStorageProvider, type IntegrationsRemoteConfig, type IssueCountResult, type IssueCountScope, IssueFilter, type IssueSearchCapabilities, type IssueSearchCriteria, type IssueSearchRelationship, type IssueStateFilter, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId, type ListOrgsOptions, type ListProjectsOptions, type ManualTokenAuthProviderOptions, type ProviderAuthenticationSession, type ProviderBroadenOrg, type ProviderBroadenResult, type ProviderOrganization, type ProviderPageInfo, type ProviderPagedResult, type ProviderRepositoriesInput, type ProviderRepositoryInput, type ProviderRepositoryShape, type ProviderResult, type ProviderSweepResult, type ProviderSweepTarget, type ProviderSweepTargetEvent, type ProviderWarning, type ProviderWarningCause, type ProviderWarningCauseReason, type ProviderWarningKind, type ProviderWarningOmission, type ProviderWarningOmissionKind, type ProviderWarningOmissionRecovery, type ProviderWarningOmissionScope, type ProviderWarningScope, type PullRequestCountResult, type PullRequestCountScope, PullRequestFilter, type PullRequestSearchCapabilities, type PullRequestSearchCriteria, type PullRequestStateFilter, type PullRequestSweepOptions, type RepositoriesProvider, type RepositoryIdentity, type RepositoryResolution, type RepositoryResolutionStatus, type ResolveRepositoryResult, type Source, type Sources, type SupportedCloudIntegrationIds, type TrackerIssueResult, areDomainsOnSameHost, createManualTokenAuthProvider, hostFromDomain, isIntegrationId, isSupportedCloudIntegrationId, toCloudIntegrationType, toIntegrationId };
79
+ export { type Account, type AccountProvider, type AuthenticationSessionLike, type AuthenticationSessionsChangeEvent, type ClosedPullRequestSweepOptions, type CloudIntegrationAuthType, type CloudIntegrationConnection, type CloudIntegrationType, type ConfigChangeEvent, type ConfigProvider, type ConfiguredIntegrationDescriptor, type ConfiguredIntegrationsChangeEvent, type ConnectionStateChangeEvent, type CurrentAccountResult, GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, type HttpProvider, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationIds, type IntegrationManager, type IntegrationServiceHooks, type IntegrationStorageProvider, type IntegrationsRemoteConfig, type IssueBatchResult, type IssueBatchTarget, type IssueCountResult, type IssueCountScope, IssueFilter, type IssueSearchCapabilities, type IssueSearchCriteria, type IssueSearchRelationship, type IssueStateFilter, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId, type ListOrgsOptions, type ListProjectsOptions, type ManualTokenAuthProviderOptions, type ProviderAuthenticationSession, type ProviderBroadenOrg, type ProviderBroadenResult, type ProviderOrganization, type ProviderPageInfo, type ProviderPagedResult, type ProviderRepositoriesInput, type ProviderRepositoryInput, type ProviderRepositoryShape, type ProviderResult, type ProviderSweepResult, type ProviderSweepTarget, type ProviderSweepTargetEvent, type ProviderWarning, type ProviderWarningCause, type ProviderWarningCauseReason, type ProviderWarningKind, type ProviderWarningOmission, type ProviderWarningOmissionKind, type ProviderWarningOmissionRecovery, type ProviderWarningOmissionScope, type ProviderWarningScope, type PullRequestBatchResult, type PullRequestBatchTarget, type PullRequestBranchResult, type PullRequestBranchTarget, type PullRequestCountResult, type PullRequestCountScope, PullRequestFilter, type PullRequestSearchCapabilities, type PullRequestSearchCriteria, type PullRequestStateFilter, type PullRequestSweepOptions, type RepositoriesProvider, type RepositoryIdentity, type RepositoryResolution, type RepositoryResolutionStatus, type ResolveRepositoryResult, type Source, type Sources, type SupportedCloudIntegrationIds, areDomainsOnSameHost, createManualTokenAuthProvider, hostFromDomain, isIntegrationId, isSupportedCloudIntegrationId, toCloudIntegrationType, toIntegrationId };
77
80
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../plus/integrations/src/index.ts"],"sourcesContent":["// Public facade for `@gitlens/integrations`.\n//\n// External consumers should import from this entry point only, not from the\n// package's internal subpaths, with one exception: the lightweight, token-scoped\n// read API is a supported public subpath (`./lite.js`). It's kept out of this\n// facade on purpose so importing the session-managed manager doesn't eagerly pull\n// in every provider API client. The internal classes (IntegrationService,\n// IntegrationAuthenticationService, etc.) are not part of the public API and\n// may be refactored without semver bumps.\n\nimport type { Account } from '@gitlens/git/models/author.js';\nimport { CacheController } from '@gitlens/utils/promiseCache.js';\nimport type { IntegrationIds } from './constants.js';\nimport type {\n\tAccountProvider,\n\tConfigProvider,\n\tHttpProvider,\n\tIntegrationCacheProvider,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n\tRepositoriesProvider,\n} from './context.js';\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\n\n/** A cached provider value, which may still be resolving. */\nexport type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;\n\n/** Produces an account value on a cache miss. */\nexport type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {\n\tvalue: IntegrationManagerCacheResult<T>;\n\texpiresAt?: number;\n};\n\n/** Stable integration identity supplied to the consumer-owned account cache. */\nexport interface IntegrationAccountCacheDescriptor {\n\treadonly id: IntegrationIds;\n\treadonly domain?: string;\n}\n\n/** Cache controls attached to a provider account lookup. */\nexport interface IntegrationManagerCacheOptions {\n\treadonly connectionId?: string;\n\treadonly etag?: string;\n\treadonly expiryOverride?: boolean | number;\n\treadonly expireOnError?: boolean;\n}\n\n/**\n * Optional consumer-owned cache for values reused by the public manager facade.\n *\n * The manager only needs cross-call caching for provider identity lookups. Other caches used by the GitLens\n * extension host are implementation details and deliberately stay out of this contract.\n */\nexport interface IntegrationManagerCacheProvider {\n\tgetCurrentAccount(\n\t\tintegration: IntegrationAccountCacheDescriptor,\n\t\tcacheable: IntegrationManagerCacheLoader<Account>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Account>;\n}\n\nfunction loadUncached<T>(loader: IntegrationManagerCacheLoader<T>): IntegrationManagerCacheResult<T> {\n\treturn loader(new CacheController()).value;\n}\n\nconst uncachedIntegrationCacheProvider: IntegrationCacheProvider = {\n\tgetRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),\n\tgetRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssue: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetCurrentAccount: (_integration, loader) => loadUncached(loader),\n\t// Nothing is cached, so there is nothing to evict.\n\tdeletePullRequests: () => {},\n};\n\nfunction toIntegrationCacheProvider(cache: IntegrationManagerCacheProvider | undefined): IntegrationCacheProvider {\n\tif (cache == null) return uncachedIntegrationCacheProvider;\n\n\treturn {\n\t\t...uncachedIntegrationCacheProvider,\n\t\tgetCurrentAccount: (integration, loader, options) =>\n\t\t\tcache.getCurrentAccount({ id: integration.id, domain: integration.domain }, loader, options),\n\t};\n}\n\n/**\n * Consumer-facing runtime for {@link createIntegrationManager}.\n *\n * External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.\n * The extension host's broader integration context remains private to the implementation.\n */\nexport interface IntegrationManagerContext {\n\treadonly storage: IntegrationStorageProvider;\n\treadonly account: AccountProvider;\n\treadonly config: ConfigProvider;\n\treadonly http: HttpProvider;\n\treadonly cache?: IntegrationManagerCacheProvider;\n\treadonly repositories: RepositoriesProvider;\n\treadonly hooks?: IntegrationServiceHooks;\n}\n\nexport type {\n\tClosedPullRequestSweepOptions,\n\tIntegrationManager,\n\tListOrgsOptions,\n\tListProjectsOptions,\n\t// Every option shape a caller has to BUILD is exported, not just the ones the manager returns:\n\t// `manager.js` is not a public subpath, so a type omitted here can't be named by a consumer at all\n\t// (`broadenIssues`' `orgs` needed `ProviderBroadenOrg` and had to be re-declared downstream).\n\tProviderBroadenOrg,\n\tProviderRepositoriesInput,\n\tProviderRepositoryInput,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestSweepOptions,\n} from './manager.js';\n\n/**\n * Construct an `@gitlens/integrations` manager bound to the supplied runtime.\n *\n * The runtime is the **single** cross-boundary contract — anything the\n * package needs (HTTP, storage, cache, auth, subscription, telemetry, UI,\n * configuration, environment) flows through it. The package never imports\n * `vscode`, `Container`, or any consumer-internal types.\n *\n * The returned manager owns its internal services; dispose it (or its\n * containing scope) to release every cached integration plus the runtime's\n * own VS Code subscriptions.\n */\nexport function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager {\n\treturn createIntegrationService({\n\t\t...ctx,\n\t\tcache: toIntegrationCacheProvider(ctx.cache),\n\t});\n}\n\n// Re-exports for the public API surface.\nexport type {\n\tAccountProvider,\n\tAuthenticationSessionsChangeEvent,\n\tConfigChangeEvent,\n\tConfigProvider,\n\tRepositoriesProvider,\n\tHttpProvider,\n\tIntegrationsRemoteConfig,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n} from './context.js';\nexport type { Source, Sources } from './telemetry.js';\nexport type { IntegrationIds, SupportedCloudIntegrationIds } from './constants.js';\nexport type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';\n\n// Authentication contract — what `IntegrationServiceHooks.createAuthenticationProvider`\n// implementers return. Consumers can plug in any auth strategy (manual token,\n// OAuth, host-managed) by returning an object implementing this interface from\n// the hook.\nexport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationProviderDescriptor,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './authentication/integrationAuthenticationProvider.js';\nexport type {\n\tAuthenticationSessionLike,\n\tCloudIntegrationAuthType,\n\tCloudIntegrationConnection,\n\tCloudIntegrationType,\n\tConfiguredIntegrationDescriptor,\n\tProviderAuthenticationSession,\n} from './authentication/models.js';\n// Provider-id mapping helpers for consumers bridging their own provider ids to `IntegrationIds`\n// (e.g. mapping multi-account connections from `getConfigured` back to a provider) and vice versa.\nexport { toCloudIntegrationType, toIntegrationId } from './authentication/models.js';\n// Domain normalization is part of connection selection and repository resolution; consumers should use the\n// same implementation rather than importing an internal utility subpath or maintaining a divergent copy.\nexport { areDomainsOnSameHost, hostFromDomain } from './utils/domain.utils.js';\n\n// Convenience: wrap a static access token (env var, CLI flag, secret manager)\n// as an `IntegrationAuthenticationProvider`. For OAuth/refresh flows, implement\n// the interface directly — this helper is for non-interactive consumers only.\nexport {\n\tcreateManualTokenAuthProvider,\n\ttype ManualTokenAuthProviderOptions,\n} from './authentication/manualTokenProvider.js';\n\nexport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tisIntegrationId,\n\tisSupportedCloudIntegrationId,\n} from './constants.js';\n\n// Neutral pagination + warning result types the Kepler ProviderBackend adapter maps to its own DTOs.\n// These carry no `@gitkraken/provider-apis` types, so consumers depend only on `@gitkraken/core-gitlens`.\nexport type {\n\tConnectionStateChangeEvent,\n\tProviderBroadenResult,\n\tProviderPagedResult,\n\tProviderPageInfo,\n\tProviderResult,\n\tProviderSweepResult,\n\tProviderWarning,\n\tProviderWarningCause,\n\tProviderWarningCauseReason,\n\tProviderWarningKind,\n\tProviderWarningOmission,\n\tProviderWarningOmissionKind,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningScope,\n\tProviderOrganization,\n\tProviderRepositoryShape,\n\tRepositoryIdentity,\n\tRepositoryResolution,\n\tRepositoryResolutionStatus,\n\tResolveRepositoryResult,\n} from './results.js';\n// Runtime enums — re-exported as values (not `export type`) so consumers can read their members.\nexport { IssueFilter, PullRequestFilter } from './providerFilters.js';\n// The filtered issue search's criteria model and the capability table that says which of it a provider honors.\n// String unions and plain interfaces, so a consumer builds criteria without importing an internal subpath.\nexport type { IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship } from './providerFilters.js';\n// Account-wide pull-request search criteria and the per-provider capability table.\nexport type { PullRequestSearchCapabilities, PullRequestSearchCriteria } from './providerFilters.js';\n// The count-only issue and pull-request probes' input and result shapes.\nexport type {\n\tIssueCountResult,\n\tIssueCountScope,\n\tPullRequestCountResult,\n\tPullRequestCountScope,\n} from './reads/counts.js';\nexport type { TrackerIssueResult } from './reads/trackerIssue.js';\n// Cross-provider PR/issue state filters (string unions in the git models).\nexport type { PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueStateFilter } from '@gitlens/git/models/issue.js';\n"],"mappings":";;;;;;;;;AA8DA,SAAS,aAAgB,QAA4E;CACpG,OAAO,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACtC;AAEA,MAAM,mCAA6D;CAClE,wBAAwB,OAAO,cAAc,WAAW,aAAa,MAAM;CAC3E,6BAA6B,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,uBAAuB,MAAM,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,0BAA0B,SAAS,OAAO,cAAc,WAAW,aAAa,MAAM;CACtF,iBAAiB,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CAC7E,wBAAwB,KAAK,OAAO,WAAW,cAAc,WAAW,aAAa,MAAM;CAC3F,WAAW,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CACvE,oBAAoB,cAAc,WAAW,aAAa,MAAM;CAEhE,0BAA0B,CAAC;AAC5B;AAEA,SAAS,2BAA2B,OAA8E;CACjH,IAAI,SAAS,MAAM,OAAO;CAE1B,OAAO;EACN,GAAG;EACH,oBAAoB,aAAa,QAAQ,YACxC,MAAM,kBAAkB;GAAE,IAAI,YAAY;GAAI,QAAQ,YAAY;EAAO,GAAG,QAAQ,OAAO;CAC7F;AACD;;;;;;;;;;;;;AA8CA,SAAgB,yBAAyB,KAAoD;CAC5F,OAAO,yBAAyB;EAC/B,GAAG;EACH,OAAO,2BAA2B,IAAI,KAAK;CAC5C,CAAC;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../plus/integrations/src/index.ts"],"sourcesContent":["// Public facade for `@gitlens/integrations`.\n//\n// External consumers should import from this entry point only, not from the\n// package's internal subpaths, with one exception: the lightweight, token-scoped\n// read API is a supported public subpath (`./lite.js`). It's kept out of this\n// facade on purpose so importing the session-managed manager doesn't eagerly pull\n// in every provider API client. The internal classes (IntegrationService,\n// IntegrationAuthenticationService, etc.) are not part of the public API and\n// may be refactored without semver bumps.\n\nimport type { Account } from '@gitlens/git/models/author.js';\nimport { CacheController } from '@gitlens/utils/promiseCache.js';\nimport type { IntegrationIds } from './constants.js';\nimport type {\n\tAccountProvider,\n\tConfigProvider,\n\tHttpProvider,\n\tIntegrationCacheProvider,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n\tRepositoriesProvider,\n} from './context.js';\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\n\n/** A cached provider value, which may still be resolving. */\nexport type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;\n\n/** Produces an account value on a cache miss. */\nexport type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {\n\tvalue: IntegrationManagerCacheResult<T>;\n\texpiresAt?: number;\n};\n\n/** Stable integration identity supplied to the consumer-owned account cache. */\nexport interface IntegrationAccountCacheDescriptor {\n\treadonly id: IntegrationIds;\n\treadonly domain?: string;\n}\n\n/** Cache controls attached to a provider account lookup. */\nexport interface IntegrationManagerCacheOptions {\n\treadonly connectionId?: string;\n\treadonly etag?: string;\n\treadonly expiryOverride?: boolean | number;\n\treadonly expireOnError?: boolean;\n}\n\n/**\n * Optional consumer-owned cache for values reused by the public manager facade.\n *\n * The manager only needs cross-call caching for provider identity lookups. Other caches used by the GitLens\n * extension host are implementation details and deliberately stay out of this contract.\n */\nexport interface IntegrationManagerCacheProvider {\n\tgetCurrentAccount(\n\t\tintegration: IntegrationAccountCacheDescriptor,\n\t\tcacheable: IntegrationManagerCacheLoader<Account>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Account>;\n}\n\nfunction loadUncached<T>(loader: IntegrationManagerCacheLoader<T>): IntegrationManagerCacheResult<T> {\n\treturn loader(new CacheController()).value;\n}\n\nconst uncachedIntegrationCacheProvider: IntegrationCacheProvider = {\n\tgetRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),\n\tgetRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssue: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetCurrentAccount: (_integration, loader) => loadUncached(loader),\n\t// Nothing is cached, so there is nothing to evict.\n\tdeletePullRequests: () => {},\n};\n\nfunction toIntegrationCacheProvider(cache: IntegrationManagerCacheProvider | undefined): IntegrationCacheProvider {\n\tif (cache == null) return uncachedIntegrationCacheProvider;\n\n\treturn {\n\t\t...uncachedIntegrationCacheProvider,\n\t\tgetCurrentAccount: (integration, loader, options) =>\n\t\t\tcache.getCurrentAccount({ id: integration.id, domain: integration.domain }, loader, options),\n\t};\n}\n\n/**\n * Consumer-facing runtime for {@link createIntegrationManager}.\n *\n * External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.\n * The extension host's broader integration context remains private to the implementation.\n */\nexport interface IntegrationManagerContext {\n\treadonly storage: IntegrationStorageProvider;\n\treadonly account: AccountProvider;\n\treadonly config: ConfigProvider;\n\treadonly http: HttpProvider;\n\treadonly cache?: IntegrationManagerCacheProvider;\n\treadonly repositories: RepositoriesProvider;\n\treadonly hooks?: IntegrationServiceHooks;\n}\n\nexport type {\n\tClosedPullRequestSweepOptions,\n\tIntegrationManager,\n\tListOrgsOptions,\n\tListProjectsOptions,\n\t// Every option shape a caller has to BUILD is exported, not just the ones the manager returns:\n\t// `manager.js` is not a public subpath, so a type omitted here can't be named by a consumer at all\n\t// (`broadenIssues`' `orgs` needed `ProviderBroadenOrg` and had to be re-declared downstream).\n\tProviderBroadenOrg,\n\tProviderRepositoriesInput,\n\tProviderRepositoryInput,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestSweepOptions,\n} from './manager.js';\n\n/**\n * Construct an `@gitlens/integrations` manager bound to the supplied runtime.\n *\n * The runtime is the **single** cross-boundary contract — anything the\n * package needs (HTTP, storage, cache, auth, subscription, telemetry, UI,\n * configuration, environment) flows through it. The package never imports\n * `vscode`, `Container`, or any consumer-internal types.\n *\n * The returned manager owns its internal services; dispose it (or its\n * containing scope) to release every cached integration plus the runtime's\n * own VS Code subscriptions.\n */\nexport function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager {\n\treturn createIntegrationService({\n\t\t...ctx,\n\t\tcache: toIntegrationCacheProvider(ctx.cache),\n\t});\n}\n\n// Re-exports for the public API surface.\nexport type {\n\tAccountProvider,\n\tAuthenticationSessionsChangeEvent,\n\tConfigChangeEvent,\n\tConfigProvider,\n\tRepositoriesProvider,\n\tHttpProvider,\n\tIntegrationsRemoteConfig,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n} from './context.js';\nexport type { Source, Sources } from './telemetry.js';\nexport type { IntegrationIds, SupportedCloudIntegrationIds } from './constants.js';\nexport type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';\n\n// Authentication contract — what `IntegrationServiceHooks.createAuthenticationProvider`\n// implementers return. Consumers can plug in any auth strategy (manual token,\n// OAuth, host-managed) by returning an object implementing this interface from\n// the hook.\nexport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationProviderDescriptor,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './authentication/integrationAuthenticationProvider.js';\nexport type {\n\tAuthenticationSessionLike,\n\tCloudIntegrationAuthType,\n\tCloudIntegrationConnection,\n\tCloudIntegrationType,\n\tConfiguredIntegrationDescriptor,\n\tProviderAuthenticationSession,\n} from './authentication/models.js';\n// Provider-id mapping helpers for consumers bridging their own provider ids to `IntegrationIds`\n// (e.g. mapping multi-account connections from `getConfigured` back to a provider) and vice versa.\nexport { toCloudIntegrationType, toIntegrationId } from './authentication/models.js';\n// Domain normalization is part of connection selection and repository resolution; consumers should use the\n// same implementation rather than importing an internal utility subpath or maintaining a divergent copy.\nexport { areDomainsOnSameHost, hostFromDomain } from './utils/domain.utils.js';\n\n// Convenience: wrap a static access token (env var, CLI flag, secret manager)\n// as an `IntegrationAuthenticationProvider`. For OAuth/refresh flows, implement\n// the interface directly — this helper is for non-interactive consumers only.\nexport {\n\tcreateManualTokenAuthProvider,\n\ttype ManualTokenAuthProviderOptions,\n} from './authentication/manualTokenProvider.js';\n\nexport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tisIntegrationId,\n\tisSupportedCloudIntegrationId,\n} from './constants.js';\n\n// Neutral pagination + warning result types the Kepler ProviderBackend adapter maps to its own DTOs.\n// These carry no `@gitkraken/provider-apis` types, so consumers depend only on `@gitkraken/core-gitlens`.\nexport type {\n\tConnectionStateChangeEvent,\n\tProviderBroadenResult,\n\tProviderPagedResult,\n\tProviderPageInfo,\n\tProviderResult,\n\tProviderSweepResult,\n\tProviderWarning,\n\tProviderWarningCause,\n\tProviderWarningCauseReason,\n\tProviderWarningKind,\n\tProviderWarningOmission,\n\tProviderWarningOmissionKind,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningScope,\n\tProviderOrganization,\n\tProviderRepositoryShape,\n\tRepositoryIdentity,\n\tRepositoryResolution,\n\tRepositoryResolutionStatus,\n\tResolveRepositoryResult,\n} from './results.js';\n// Runtime enums — re-exported as values (not `export type`) so consumers can read their members.\nexport { IssueFilter, PullRequestFilter } from './providerFilters.js';\n// The filtered issue search's criteria model and the capability table that says which of it a provider honors.\n// String unions and plain interfaces, so a consumer builds criteria without importing an internal subpath.\nexport type { IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship } from './providerFilters.js';\n// Account-wide pull-request search criteria and the per-provider capability table.\nexport type { PullRequestSearchCapabilities, PullRequestSearchCriteria } from './providerFilters.js';\n// The count-only issue and pull-request probes' input and result shapes.\nexport type {\n\tIssueCountResult,\n\tIssueCountScope,\n\tPullRequestCountResult,\n\tPullRequestCountScope,\n} from './reads/counts.js';\nexport type { IssueBatchResult, IssueBatchTarget } from './reads/issueBatch.js';\nexport type { PullRequestBatchResult, PullRequestBatchTarget } from './reads/pullRequestBatch.js';\nexport type { PullRequestBranchResult, PullRequestBranchTarget } from './reads/pullRequestBranches.js';\n// The current-account read's result, and the account shape every identity-bearing read already returns.\nexport type { CurrentAccountResult } from './reads/currentAccount.js';\nexport type { Account } from '@gitlens/git/models/author.js';\n// Cross-provider PR/issue state filters (string unions in the git models).\nexport type { PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueStateFilter } from '@gitlens/git/models/issue.js';\n"],"mappings":";;;;;;;;;AA8DA,SAAS,aAAgB,QAA4E;CACpG,OAAO,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACtC;AAEA,MAAM,mCAA6D;CAClE,wBAAwB,OAAO,cAAc,WAAW,aAAa,MAAM;CAC3E,6BAA6B,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,uBAAuB,MAAM,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,0BAA0B,SAAS,OAAO,cAAc,WAAW,aAAa,MAAM;CACtF,iBAAiB,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CAC7E,wBAAwB,KAAK,OAAO,WAAW,cAAc,WAAW,aAAa,MAAM;CAC3F,WAAW,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CACvE,oBAAoB,cAAc,WAAW,aAAa,MAAM;CAEhE,0BAA0B,CAAC;AAC5B;AAEA,SAAS,2BAA2B,OAA8E;CACjH,IAAI,SAAS,MAAM,OAAO;CAE1B,OAAO;EACN,GAAG;EACH,oBAAoB,aAAa,QAAQ,YACxC,MAAM,kBAAkB;GAAE,IAAI,YAAY;GAAI,QAAQ,YAAY;EAAO,GAAG,QAAQ,OAAO;CAC7F;AACD;;;;;;;;;;;;;AA8CA,SAAgB,yBAAyB,KAAoD;CAC5F,OAAO,yBAAyB;EAC/B,GAAG;EACH,OAAO,2BAA2B,IAAI,KAAK;CAC5C,CAAC;AACF"}
@@ -18,9 +18,11 @@ import { Integration, IntegrationBase, IntegrationById, IntegrationResult } from
18
18
  import { ProviderReposInput } from "./providers/models.js";
19
19
  import { RepositoryResolutionContext } from "./reads/context.js";
20
20
  import { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestCountScope } from "./reads/counts.js";
21
+ import { CurrentAccountResult } from "./reads/currentAccount.js";
21
22
  import { SupportedFilters } from "./reads/filters.js";
22
23
  import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
23
- import { TrackerIssueResult } from "./reads/trackerIssue.js";
24
+ import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
25
+ import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
24
26
  import { ClosedPullRequestSweepOptions, ListOrgsOptions, ListProjectsOptions, ProviderBroadenOrg, PullRequestSweepOptions } from "./manager.js";
25
27
  import "./providers/github/github.js";
26
28
  import { ApiClients } from "./providers/apiClients.js";
@@ -319,22 +321,32 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
319
321
  connectionId?: string;
320
322
  /**
321
323
  * Explicit self-managed host domain. Used only when the requested connection has no configured domain;
322
- * it must come from the trusted authentication configuration, not repository or remote data.
324
+ * it must come from the trusted authentication configuration, not repository or remote data. Unlike the
325
+ * paged reads, a self-managed tracker does not fall back to the primary connection without one; see
326
+ * {@link IntegrationManager.getIssuesBatch}.
323
327
  */
324
328
  domain?: string;
325
329
  }): Promise<ProviderResult<IssueBatchResult>>;
326
- getTrackerIssue(options: {
330
+ getPullRequestsBatch(options: {
331
+ providerId: IntegrationIds;
332
+ targets: readonly PullRequestBatchTarget[];
333
+ connectionId?: string;
334
+ /**
335
+ * Explicit self-managed host domain. Used only when the requested connection has no configured domain;
336
+ * it must come from the trusted authentication configuration, not repository or remote data.
337
+ */
338
+ domain?: string;
339
+ }): Promise<ProviderResult<PullRequestBatchResult>>;
340
+ getPullRequestsForBranches(options: {
327
341
  providerId: IntegrationIds;
328
- resourceId: string;
329
- resourceUrl?: string;
330
- key: string;
342
+ targets: readonly PullRequestBranchTarget[];
331
343
  connectionId?: string;
332
344
  /**
333
- * Explicit self-managed host domain. Unlike the paged reads this one does not fall back to the primary
334
- * connection for a self-managed tracker; see {@link IntegrationManager.getTrackerIssue}.
345
+ * Explicit self-managed host domain. Used only when the requested connection has no configured domain;
346
+ * it must come from the trusted authentication configuration, not repository or remote data.
335
347
  */
336
348
  domain?: string;
337
- }): Promise<ProviderResult<TrackerIssueResult>>;
349
+ }): Promise<ProviderResult<PullRequestBranchResult>>;
338
350
  /**
339
351
  * How many pull requests match each scope, without fetching any — the PR twin of {@link countIssues}. See
340
352
  * {@link IntegrationManager.countPullRequests} for the cost model, the per-scope isolation rules, and why
@@ -439,6 +451,20 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
439
451
  */
440
452
  domain?: string;
441
453
  }): Promise<ResolveRepositoryResult>;
454
+ /**
455
+ * Who the connection is signed in as — "who am I on this provider" — for a git host or issue tracker alike.
456
+ * Goes through {@link Integration.getCurrentAccount}'s own cache, so this and whatever else warms it (see
457
+ * `IntegrationManagerCacheProvider.getCurrentAccount`) stay one cache.
458
+ */
459
+ getCurrentAccount(options: {
460
+ providerId: IntegrationIds;
461
+ connectionId?: string;
462
+ /**
463
+ * Explicit self-managed host domain. Used only when the requested connection has no configured domain;
464
+ * it must come from the trusted authentication configuration, not repository or remote data.
465
+ */
466
+ domain?: string;
467
+ }): Promise<CurrentAccountResult>;
442
468
  /** {@link RepositoryResolutionContext} seam: the user's `remotes` configs, for the remote matcher. */
443
469
  getRemoteConfigs(): readonly IntegrationsRemoteConfig[];
444
470
  /** {@link RepositoryResolutionContext} seam: instance lookup by host, for the cloud-host resolution branch. */
@@ -20,16 +20,18 @@ import { noConnectionWarning } from "./reads/warnings.js";
20
20
  import { getSupportedFilters } from "./reads/filters.js";
21
21
  import { broadenIssues } from "./reads/broaden.js";
22
22
  import { countIssues, countPullRequests } from "./reads/counts.js";
23
+ import { getCurrentAccount } from "./reads/currentAccount.js";
23
24
  import { listOrgs, listProjects, listRepos } from "./reads/hierarchy.js";
24
25
  import { getIssuesBatch } from "./reads/issueBatch.js";
25
26
  import { listIssuesPage } from "./reads/issues.js";
26
27
  import { listIssueTrackerIssuesPage } from "./reads/issueTracker.js";
28
+ import { getPullRequestsBatch } from "./reads/pullRequestBatch.js";
29
+ import { getPullRequestsForBranches } from "./reads/pullRequestBranches.js";
27
30
  import { listPullRequestsPage } from "./reads/pullRequests.js";
28
31
  import { resolveRepository } from "./reads/resolveRepository.js";
29
32
  import { searchIssuesPage } from "./reads/searchIssues.js";
30
33
  import { searchPullRequestsPage } from "./reads/searchPullRequests.js";
31
34
  import { sweepClosedPullRequests, sweepPullRequests } from "./reads/sweeps.js";
32
- import { getTrackerIssue } from "./reads/trackerIssue.js";
33
35
  //#region ../plus/integrations/src/integrationService.ts
34
36
  const maxSmallIntegerV8 = 2 ** 30 - 1;
35
37
  var IntegrationService = class {
@@ -620,8 +622,11 @@ var IntegrationService = class {
620
622
  async getIssuesBatch(options) {
621
623
  return getIssuesBatch(this, options);
622
624
  }
623
- async getTrackerIssue(options) {
624
- return getTrackerIssue(this, options);
625
+ async getPullRequestsBatch(options) {
626
+ return getPullRequestsBatch(this, options);
627
+ }
628
+ async getPullRequestsForBranches(options) {
629
+ return getPullRequestsForBranches(this, options);
625
630
  }
626
631
  /**
627
632
  * How many pull requests match each scope, without fetching any — the PR twin of {@link countIssues}. See
@@ -697,6 +702,14 @@ var IntegrationService = class {
697
702
  async resolveRepository(options) {
698
703
  return resolveRepository(this, options);
699
704
  }
705
+ /**
706
+ * Who the connection is signed in as — "who am I on this provider" — for a git host or issue tracker alike.
707
+ * Goes through {@link Integration.getCurrentAccount}'s own cache, so this and whatever else warms it (see
708
+ * `IntegrationManagerCacheProvider.getCurrentAccount`) stay one cache.
709
+ */
710
+ async getCurrentAccount(options) {
711
+ return getCurrentAccount(this, options);
712
+ }
700
713
  /** {@link RepositoryResolutionContext} seam: the user's `remotes` configs, for the remote matcher. */
701
714
  getRemoteConfigs() {
702
715
  return this.ctx.config.getRemoteConfigs();