@gitkraken/core-gitlens 0.9.0 → 0.9.1

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.1] - 2026-09-29
10
+
11
+ ### Added
12
+
13
+ - Adds GitHub and GitHub Enterprise to the refusals `resolveRepository` names. An organization with OAuth App access restrictions that has not approved the OAuth app a token belongs to hides its private repositories from every listing and search without an error, and GraphQL answers a lookup of one exactly as it answers a missing repository, so such a repository resolved as `not-found`, indistinguishable from a deleted one. A GitHub miss is now confirmed over REST (the new `GitHubApi.getRepositoryAccess`), which refuses such a repository with a `403` saying why; the resolution is then `unauthorized` with a warning scoped to the repository (`scope.repositoryId`) and, once the credential is confirmed with a profile read (the new GitHub `validateCredential`), `cause: { reason: 'oauth-app-not-allowed', remedyUrl }`, where `remedyUrl` is the app's page in the user's authorized OAuth apps, addressed by the client id GitHub reports in `X-OAuth-Client-Id`. A REST read that cannot confirm either way keeps the `not-found`, and any other `403` stays scoped with GitHub's own words and no cause. Neither the confirming read nor the credential check raises the reauthentication prompt (`GitHubApi.getCurrentAccount` takes `silent`). A refusal's facts now also read Octokit's `{ status, headers, data }` response, and carry the refused token's OAuth client id (plus/integrations, plus/git-github)
14
+
15
+ ### Changed
16
+
17
+ - Changes `resolveRepository`'s `unauthorized` on Azure DevOps, Azure DevOps Server, Bitbucket and Bitbucket Data Center: a `401`/`403` for the repository now settles as a batch read's refused target does, so once the credential checks out, the warning is scoped to that repository (and, on Azure DevOps, named by its `cause`) instead of reported for the connection. GitLab, which has no credential check, is unchanged. Also, a GitHub batch read whose every target is refused now checks the credential once and, when it passes, publishes each refusal scoped to its repository, spending no strike and keeping the session, instead of failing as the connection's (plus/integrations)
18
+
9
19
  ## [0.9.0] - 2026-09-29
10
20
 
11
21
  ### Added
@@ -447,7 +457,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
447
457
 
448
458
  - Initial release. Bundles `@gitlens/utils`, `@gitlens/git`, `@gitlens/git-cli`, `@gitlens/ai`, and `@gitlens/git-github` into a single core npm package with subpath exports.
449
459
 
450
- [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.0...HEAD
460
+ [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.1...HEAD
461
+ [0.9.1]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.0...gitkraken:releases/core/v0.9.1
451
462
  [0.9.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.8.0...gitkraken:releases/core/v0.9.0
452
463
  [0.8.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.7.2...gitkraken:releases/core/v0.8.0
453
464
  [0.7.2]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.7.1...gitkraken:releases/core/v0.7.2
@@ -81,6 +81,7 @@ export declare class GitHubApi {
81
81
  getCurrentAccount(provider: Provider, token: GitHubTokenInfo, options?: {
82
82
  baseUrl?: string;
83
83
  avatarSize?: number;
84
+ silent?: boolean;
84
85
  }): Promise<Account | undefined>;
85
86
  getAccountForCommit(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, rev: string, options?: {
86
87
  baseUrl?: string;
@@ -169,6 +170,18 @@ export declare class GitHubApi {
169
170
  getTagsWithCommit(token: GitHubTokenInfo, owner: string, repo: string, ref: string, date: Date): Promise<string[]>;
170
171
  getNextCommitRefs(token: GitHubTokenInfo, owner: string, repo: string, ref: string, path: string, sha: string): Promise<string[]>;
171
172
  private getCommitDate;
173
+ /**
174
+ * Whether this credential can read the repository, asked of REST rather than GraphQL. GraphQL answers a
175
+ * repository hidden by its organization's OAuth App access restrictions exactly as it answers one that does not
176
+ * exist (`NOT_FOUND`), while REST answers `403` and says why, so this is how a GraphQL miss is told apart from
177
+ * one. Resolves `false` on a `404`; a refusal throws `AuthenticationError` carrying GitHub's response.
178
+ *
179
+ * Silent: the refusal it exists to surface is one organization's policy, which reauthenticating cannot fix, so it
180
+ * must not raise the reauthentication prompt a failed read otherwise raises.
181
+ */
182
+ getRepositoryAccess(provider: Provider | undefined, token: GitHubTokenInfo, owner: string, repo: string, options?: {
183
+ baseUrl?: string;
184
+ }): Promise<boolean>;
172
185
  getContributors(token: GitHubTokenInfo, owner: string, repo: string): Promise<GitHubContributor[]>;
173
186
  getUserSshSigningKeys(provider: Provider | undefined, token: GitHubTokenInfo, username: string, options?: {
174
187
  baseUrl?: string;
@@ -341,6 +341,7 @@ var GitHubApi = class {
341
341
  }
342
342
  async getCurrentAccount(provider, token, options) {
343
343
  const scope = getScopedLogger();
344
+ const { silent, ...variables } = options ?? {};
344
345
  try {
345
346
  const rsp = await this.graphql(provider, token, `query getCurrentAccount($avatarSize: Int) {
346
347
  viewer {
@@ -350,7 +351,7 @@ var GitHubApi = class {
350
351
  login
351
352
  avatarUrl(size: $avatarSize)
352
353
  }
353
- }`, { ...options }, scope);
354
+ }`, variables, scope);
354
355
  if (rsp?.viewer?.login == null) return void 0;
355
356
  return {
356
357
  provider,
@@ -362,7 +363,7 @@ var GitHubApi = class {
362
363
  };
363
364
  } catch (ex) {
364
365
  if (ex instanceof RequestNotFoundError) return void 0;
365
- throw this.handleException(ex, provider, scope);
366
+ throw this.handleException(ex, provider, scope, silent);
366
367
  }
367
368
  }
368
369
  async getAccountForCommit(provider, token, owner, repo, rev, options) {
@@ -1354,6 +1355,29 @@ var GitHubApi = class {
1354
1355
  throw this.handleException(ex, void 0, scope);
1355
1356
  }
1356
1357
  }
1358
+ /**
1359
+ * Whether this credential can read the repository, asked of REST rather than GraphQL. GraphQL answers a
1360
+ * repository hidden by its organization's OAuth App access restrictions exactly as it answers one that does not
1361
+ * exist (`NOT_FOUND`), while REST answers `403` and says why, so this is how a GraphQL miss is told apart from
1362
+ * one. Resolves `false` on a `404`; a refusal throws `AuthenticationError` carrying GitHub's response.
1363
+ *
1364
+ * Silent: the refusal it exists to surface is one organization's policy, which reauthenticating cannot fix, so it
1365
+ * must not raise the reauthentication prompt a failed read otherwise raises.
1366
+ */
1367
+ async getRepositoryAccess(provider, token, owner, repo, options) {
1368
+ const scope = getScopedLogger();
1369
+ try {
1370
+ await this.request(provider, token, "GET /repos/{owner}/{repo}", {
1371
+ owner,
1372
+ repo,
1373
+ ...options
1374
+ }, scope, void 0, true);
1375
+ return true;
1376
+ } catch (ex) {
1377
+ if (ex instanceof RequestNotFoundError) return false;
1378
+ throw this.handleException(ex, provider, scope, true);
1379
+ }
1380
+ }
1357
1381
  async getContributors(token, owner, repo) {
1358
1382
  const scope = getScopedLogger();
1359
1383
  try {
@@ -1806,8 +1830,8 @@ var GitHubApi = class {
1806
1830
  promise.then(cleanup, cleanup);
1807
1831
  return promise;
1808
1832
  }
1809
- async request(provider, token, route, options, scope, cancellation) {
1810
- return await this.requestCore(provider, token, route, options, scope, cancellation);
1833
+ async request(provider, token, route, options, scope, cancellation, deferFailure) {
1834
+ return await this.requestCore(provider, token, route, options, scope, cancellation, deferFailure);
1811
1835
  }
1812
1836
  /**
1813
1837
  * REST call for routes `@octokit/types` doesn't describe yet — currently the stacked-pull-request
@@ -1817,7 +1841,7 @@ var GitHubApi = class {
1817
1841
  async requestPreview(provider, token, route, options, scope, cancellation) {
1818
1842
  return await this.requestCore(provider, token, route, options, scope, cancellation);
1819
1843
  }
1820
- async requestCore(provider, token, route, options, scope, cancellation) {
1844
+ async requestCore(provider, token, route, options, scope, cancellation, deferFailure) {
1821
1845
  const { accessToken } = token;
1822
1846
  try {
1823
1847
  let signal;
@@ -1836,7 +1860,7 @@ var GitHubApi = class {
1836
1860
  const retryable = method === "GET" || method === "HEAD";
1837
1861
  return await this.requestWithRetries(() => this.config.wrapForForcedInsecureSSL(provider?.getIgnoreSSLErrors() ?? false, () => this.getDefaults(accessToken, request)(route, options)), retryable, signal, scope);
1838
1862
  } catch (ex) {
1839
- if (ex instanceof RequestError || ex.name === "AbortError") this.handleRequestError(provider, token, ex, scope, void 0);
1863
+ if (ex instanceof RequestError || ex.name === "AbortError") this.handleRequestError(provider, token, ex, scope, deferFailure);
1840
1864
  else if (_logger.isDebugging) this.config.onDebugError?.(`GitHub request failed: ${ex.message}`);
1841
1865
  throw ex;
1842
1866
  }
@@ -3138,6 +3162,12 @@ __decorate([trace({ args: (token, owner, repo, ref, path, sha) => ({
3138
3162
  path,
3139
3163
  sha
3140
3164
  }) })], GitHubApi.prototype, "getNextCommitRefs", null);
3165
+ __decorate([trace({ args: (provider, token, owner, repo) => ({
3166
+ provider: provider?.name,
3167
+ token: `<token:${token.microHash}>`,
3168
+ owner,
3169
+ repo
3170
+ }) })], GitHubApi.prototype, "getRepositoryAccess", null);
3141
3171
  __decorate([trace({ args: (token, owner, repo) => ({
3142
3172
  token: `<token:${token.microHash}>`,
3143
3173
  owner,