@gitkraken/core-gitlens 0.15.3 → 0.15.4

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 (66) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/dist/git/cache.d.ts +24 -11
  3. package/dist/git/cache.js +44 -16
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/models/pullRequest.d.ts +7 -5
  6. package/dist/git/models/pullRequest.js.map +1 -1
  7. package/dist/git/models/reference.d.ts +8 -0
  8. package/dist/git/providers/branches.d.ts +43 -0
  9. package/dist/git/watching/changeEvent.d.ts +4 -2
  10. package/dist/git/watching/changeEvent.js +3 -1
  11. package/dist/git/watching/changeEvent.js.map +1 -1
  12. package/dist/git/watching/watchGroup.d.ts +3 -3
  13. package/dist/git/watching/watchGroup.js +1 -0
  14. package/dist/git/watching/watchGroup.js.map +1 -1
  15. package/dist/git/watching/watchService.js.map +1 -1
  16. package/dist/git/watching/watchSession.d.ts +2 -1
  17. package/dist/git/watching/watchSession.js +3 -2
  18. package/dist/git/watching/watchSession.js.map +1 -1
  19. package/dist/git/watching/watcherPatterns.js +1 -0
  20. package/dist/git/watching/watcherPatterns.js.map +1 -1
  21. package/dist/git/watching/worktreeSummary.d.ts +19 -3
  22. package/dist/git/watching/worktreeSummary.js +107 -17
  23. package/dist/git/watching/worktreeSummary.js.map +1 -1
  24. package/dist/git-cli/parsers/refParser.js +2 -1
  25. package/dist/git-cli/parsers/refParser.js.map +1 -1
  26. package/dist/git-cli/providers/branches.d.ts +8 -1
  27. package/dist/git-cli/providers/branches.js +84 -12
  28. package/dist/git-cli/providers/branches.js.map +1 -1
  29. package/dist/git-cli/providers/config.d.ts +32 -9
  30. package/dist/git-cli/providers/config.js +113 -24
  31. package/dist/git-cli/providers/config.js.map +1 -1
  32. package/dist/plus/integrations/models/gitHostIntegration.d.ts +29 -14
  33. package/dist/plus/integrations/models/gitHostIntegration.js +41 -19
  34. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  35. package/dist/plus/integrations/providers/azure/azure.d.ts +16 -16
  36. package/dist/plus/integrations/providers/azure/azure.js +45 -25
  37. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  38. package/dist/plus/integrations/providers/azure/azure.utils.d.ts +12 -0
  39. package/dist/plus/integrations/providers/azure/azure.utils.js +17 -1
  40. package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
  41. package/dist/plus/integrations/providers/azure/search.d.ts +4 -0
  42. package/dist/plus/integrations/providers/azure/search.js +46 -2
  43. package/dist/plus/integrations/providers/azure/search.js.map +1 -1
  44. package/dist/plus/integrations/providers/azure/workItemSearch.d.ts +11 -0
  45. package/dist/plus/integrations/providers/azure/workItemSearch.js +54 -0
  46. package/dist/plus/integrations/providers/azure/workItemSearch.js.map +1 -0
  47. package/dist/plus/integrations/providers/azure/workItemStateCategories.d.ts +2 -2
  48. package/dist/plus/integrations/providers/azure/workItemStateCategories.js +19 -15
  49. package/dist/plus/integrations/providers/azure/workItemStateCategories.js.map +1 -1
  50. package/dist/plus/integrations/providers/azureDevOps.d.ts +33 -20
  51. package/dist/plus/integrations/providers/azureDevOps.js +109 -48
  52. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  53. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +16 -47
  54. package/dist/plus/integrations/providers/azureDevOpsServer.js +52 -91
  55. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  56. package/dist/plus/integrations/providers/models.d.ts +5 -0
  57. package/dist/plus/integrations/providers/models.js +14 -3
  58. package/dist/plus/integrations/providers/models.js.map +1 -1
  59. package/dist/plus/integrations/reads/drains.d.ts +2 -2
  60. package/dist/plus/integrations/reads/drains.js +4 -4
  61. package/dist/plus/integrations/reads/drains.js.map +1 -1
  62. package/dist/plus/integrations/reads/issues.js +7 -4
  63. package/dist/plus/integrations/reads/issues.js.map +1 -1
  64. package/dist/plus/integrations/reads/resolveRepository.js +5 -5
  65. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  66. package/package.json +1 -1
@@ -45,11 +45,19 @@ type MyPullRequestsForReposOptions = {
45
45
  summary?: boolean;
46
46
  };
47
47
  /** A repository as the batch and branch reads name it. */
48
- type RepositoryCoordinate = {
48
+ export type RepositoryCoordinate = {
49
49
  owner: string;
50
50
  repo: string;
51
51
  project?: string;
52
52
  };
53
+ /**
54
+ * Repository scopes as the host settled them ({@link GitHostIntegration.resolveRepositoryScopes}), with the `unsettled`
55
+ * flag of each, in order. A repo-scoped read given these reads them as given rather than settling them again.
56
+ */
57
+ export type SettledRepositoryScopes = {
58
+ repos: ProviderReposInput;
59
+ unsettled?: readonly boolean[];
60
+ };
53
61
  export declare abstract class GitHostIntegration<ID extends IntegrationIds = IntegrationIds, T extends ResourceDescriptor = ResourceDescriptor> extends IntegrationBase<ID> {
54
62
  readonly type: IntegrationType;
55
63
  /** The self-managed installation `session` addresses, validated against this integration's host. */
@@ -60,28 +68,34 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
60
68
  * order: those, unless the host names a caller's repository differently than the caller parsed it (see the Azure
61
69
  * DevOps Server override). `unsettled` flags a coordinate the host couldn't place, read as given; a batch or
62
70
  * branch slot that then reads nothing is rejected rather than reported as absent ({@link rejectUnsettledMisses}).
71
+ *
72
+ * The only hook a host overrides to settle a caller's repository: every read settles through it, the list and search
73
+ * reads by way of {@link resolveRepositoryInputs}.
63
74
  */
64
75
  protected resolveRepositoryCoordinates<T extends RepositoryCoordinate>(_session: ProviderAuthenticationSession, coordinates: readonly T[], _cancellation?: AbortSignal): Promise<{
65
76
  coordinates: readonly T[];
66
77
  unsettled?: readonly boolean[];
67
78
  }>;
68
79
  /**
69
- * {@link resolveRepositoryCoordinates} for the repository descriptors the list and search reads take: those, unless
70
- * the host overrides both. A scope flagged `unsettled` that then reads nothing is reported as a failure of the read
71
- * ({@link toUnsettledScopeFailure}) rather than as an empty scope.
80
+ * {@link resolveRepositoryCoordinates} for the repository descriptors the list and search reads take. Not an override
81
+ * point: a host settles its coordinates, which this maps `repos` through. A scope flagged `unsettled` that then reads
82
+ * nothing is reported as a failure of the read ({@link toUnsettledScopeFailure}) rather than as an empty scope.
72
83
  */
73
- protected resolveRepositoryInputs(_session: ProviderAuthenticationSession, repos: readonly ProviderRepoInput[], _cancellation?: AbortSignal): Promise<{
84
+ protected resolveRepositoryInputs(session: ProviderAuthenticationSession, repos: readonly ProviderRepoInput[], cancellation?: AbortSignal): Promise<{
74
85
  repos: ProviderRepoInput[];
75
86
  unsettled?: readonly boolean[];
76
87
  }>;
77
88
  /**
78
89
  * The repositories a repo-scoped read of `repos` addresses ({@link resolveRepositoryInputs}), for a caller that
79
- * shapes the read by them before making it. Resolves the session as that read does, and fails as it would: a
80
- * session that can't be resolved is the read's own failure (refreshing a refused token is claimed here), so the
81
- * caller reports it rather than making the read. Settling that fails leaves `repos` as given, for the read to
82
- * settle or report.
90
+ * shapes the read by them before making it, and then hands them to that read so it doesn't settle them again.
91
+ * Resolves the session as that read does, and fails as it would: a session that can't be resolved is the read's own
92
+ * failure (refreshing a refused token is claimed here), so the caller reports it rather than making the read.
93
+ * Settling that fails is the read's failure too, handled as the issue read handles it. Only the issue list hands its
94
+ * read settled scopes today.
83
95
  */
84
- resolveRepositoryScopes(repos: ProviderReposInput, connectionId?: string): Promise<IntegrationResult<ProviderReposInput>>;
96
+ resolveRepositoryScopes(repos: ProviderReposInput, connectionId?: string): Promise<IntegrationResult<SettledRepositoryScopes>>;
97
+ /** `repos` as a repo-scoped read addresses them: settled by the caller already, or here. */
98
+ private settleRepositoryScopes;
85
99
  /**
86
100
  * A batch or branch read's slots, settled against the repositories {@link resolveRepositoryCoordinates} settled
87
101
  * its coordinates to: a miss for one it couldn't settle is rejected ({@link rejectUnsettledMisses}), and a refusal
@@ -294,7 +308,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
294
308
  * thrown errors and validation failures into `{ error }` so callers can surface them as warnings
295
309
  * rather than swallowing them to `undefined`.
296
310
  */
297
- getMyIssuesForReposResult(repos: ProviderReposInput, options?: MyIssuesForReposOptions, connectionId?: string): Promise<IntegrationResult<(PagedResult<ProviderIssue> & {
311
+ getMyIssuesForReposResult(repos: ProviderReposInput | SettledRepositoryScopes, options?: MyIssuesForReposOptions, connectionId?: string): Promise<IntegrationResult<(PagedResult<ProviderIssue> & {
298
312
  metadata?: CollectionMetadata;
299
313
  }) | undefined>>;
300
314
  /**
@@ -307,7 +321,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
307
321
  * `ProviderIssue` round-trip. No provider does today: the one candidate (Bitbucket Cloud's legacy
308
322
  * `getUsersIssuesForRepo`) reports `supportsIssues: false`, so the facade never reaches this for it.
309
323
  */
310
- getMyIssuesForReposAsShapesResult(reposOrRepoIds: ProviderReposInput, options?: MyIssuesForReposOptions, connectionId?: string): Promise<IntegrationResult<(PagedResult<IssueShape> & {
324
+ getMyIssuesForReposAsShapesResult(reposOrRepoIds: ProviderReposInput | SettledRepositoryScopes, options?: MyIssuesForReposOptions, connectionId?: string): Promise<IntegrationResult<(PagedResult<IssueShape> & {
311
325
  metadata?: CollectionMetadata;
312
326
  }) | undefined>>;
313
327
  getMyPullRequestsForRepos(reposOrRepoIds: ProviderReposInput, options?: MyPullRequestsForReposOptions, connectionId?: string): Promise<ProviderApiPagedResult<ProviderPullRequest> | undefined>;
@@ -365,8 +379,9 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
365
379
  /**
366
380
  * The current account as each of `pullRequests` identifies its members, in order: what a raw row's
367
381
  * `authoredByMe` and `viewer` are resolved against when it's mapped. Most hosts give a person one id, so every
368
- * row gets the account itself; Azure DevOps Server answers per collection (see `AzureDevOpsServerIntegration`).
369
- * Throws only when the account itself can't be read.
382
+ * row gets the account itself; Azure DevOps answers per organization (see `AzureDevOpsIntegrationBase`).
383
+ * Throws only when the account itself can't be read. Azure DevOps never throws: a session it can't resolve leaves
384
+ * the rows it hadn't already resolved unknown.
370
385
  */
371
386
  getPullRequestViewers(pullRequests: readonly (ProviderPullRequest | PullRequest)[], connectionId?: string): Promise<({
372
387
  id: string;
@@ -95,35 +95,58 @@ var GitHostIntegration = class extends IntegrationBase {
95
95
  * order: those, unless the host names a caller's repository differently than the caller parsed it (see the Azure
96
96
  * DevOps Server override). `unsettled` flags a coordinate the host couldn't place, read as given; a batch or
97
97
  * branch slot that then reads nothing is rejected rather than reported as absent ({@link rejectUnsettledMisses}).
98
+ *
99
+ * The only hook a host overrides to settle a caller's repository: every read settles through it, the list and search
100
+ * reads by way of {@link resolveRepositoryInputs}.
98
101
  */
99
102
  resolveRepositoryCoordinates(_session, coordinates, _cancellation) {
100
103
  return Promise.resolve({ coordinates });
101
104
  }
102
105
  /**
103
- * {@link resolveRepositoryCoordinates} for the repository descriptors the list and search reads take: those, unless
104
- * the host overrides both. A scope flagged `unsettled` that then reads nothing is reported as a failure of the read
105
- * ({@link toUnsettledScopeFailure}) rather than as an empty scope.
106
+ * {@link resolveRepositoryCoordinates} for the repository descriptors the list and search reads take. Not an override
107
+ * point: a host settles its coordinates, which this maps `repos` through. A scope flagged `unsettled` that then reads
108
+ * nothing is reported as a failure of the read ({@link toUnsettledScopeFailure}) rather than as an empty scope.
106
109
  */
107
- resolveRepositoryInputs(_session, repos, _cancellation) {
108
- return Promise.resolve({ repos: [...repos] });
110
+ async resolveRepositoryInputs(session, repos, cancellation) {
111
+ const { coordinates, unsettled } = await this.resolveRepositoryCoordinates(session, repos.map((r) => ({
112
+ ...r,
113
+ owner: r.namespace,
114
+ repo: r.name
115
+ })), cancellation);
116
+ return {
117
+ repos: coordinates.map(({ owner, repo, ...r }) => ({
118
+ ...r,
119
+ namespace: owner,
120
+ name: repo
121
+ })),
122
+ unsettled
123
+ };
109
124
  }
110
125
  /**
111
126
  * The repositories a repo-scoped read of `repos` addresses ({@link resolveRepositoryInputs}), for a caller that
112
- * shapes the read by them before making it. Resolves the session as that read does, and fails as it would: a
113
- * session that can't be resolved is the read's own failure (refreshing a refused token is claimed here), so the
114
- * caller reports it rather than making the read. Settling that fails leaves `repos` as given, for the read to
115
- * settle or report.
127
+ * shapes the read by them before making it, and then hands them to that read so it doesn't settle them again.
128
+ * Resolves the session as that read does, and fails as it would: a session that can't be resolved is the read's own
129
+ * failure (refreshing a refused token is claimed here), so the caller reports it rather than making the read.
130
+ * Settling that fails is the read's failure too, handled as the issue read handles it. Only the issue list hands its
131
+ * read settled scopes today.
116
132
  */
117
133
  async resolveRepositoryScopes(repos, connectionId) {
118
- if (isRepoIdsInput(repos)) return { value: repos };
134
+ if (isRepoIdsInput(repos)) return { value: { repos } };
119
135
  const session = await this.resolveReadSession(connectionId, void 0);
120
136
  if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
121
137
  try {
122
- return { value: (await this.resolveRepositoryInputs(session, repos)).repos };
123
- } catch {
124
- return { value: repos };
138
+ return { value: await this.resolveRepositoryInputs(session, repos) };
139
+ } catch (ex) {
140
+ this.handleProviderException("getIssuesForRepos", ex, { connectionId });
141
+ return { error: toError(ex) };
125
142
  }
126
143
  }
144
+ /** `repos` as a repo-scoped read addresses them: settled by the caller already, or here. */
145
+ settleRepositoryScopes(session, repos) {
146
+ if (!Array.isArray(repos)) return Promise.resolve(repos);
147
+ if (isRepoIdsInput(repos)) return Promise.resolve({ repos });
148
+ return this.resolveRepositoryInputs(session, repos);
149
+ }
127
150
  /**
128
151
  * A batch or branch read's slots, settled against the repositories {@link resolveRepositoryCoordinates} settled
129
152
  * its coordinates to: a miss for one it couldn't settle is rejected ({@link rejectUnsettledMisses}), and a refusal
@@ -550,8 +573,7 @@ var GitHostIntegration = class extends IntegrationBase {
550
573
  let customUrl;
551
574
  let api;
552
575
  try {
553
- if (isRepoIdsInput(repos)) resolvedRepos = repos;
554
- else ({repos: resolvedRepos, unsettled} = await this.resolveRepositoryInputs(session, repos));
576
+ ({repos: resolvedRepos, unsettled} = await this.settleRepositoryScopes(session, repos));
555
577
  customUrl = options?.customUrl ?? (isGitSelfManagedHostIntegrationId(providerId) ? this.getRepositoriesApiBaseUrl(session, resolvedRepos) : void 0);
556
578
  api = await this.getProvidersApi();
557
579
  } catch (ex) {
@@ -897,8 +919,7 @@ var GitHostIntegration = class extends IntegrationBase {
897
919
  let customUrl;
898
920
  let api;
899
921
  try {
900
- if (isRepoIdsInput(repos)) resolvedRepos = repos;
901
- else ({repos: resolvedRepos, unsettled} = await this.resolveRepositoryInputs(session, repos));
922
+ ({repos: resolvedRepos, unsettled} = await this.settleRepositoryScopes(session, repos));
902
923
  customUrl = options?.customUrl ?? (isGitSelfManagedHostIntegrationId(providerId) ? this.getRepositoriesApiBaseUrl(session, resolvedRepos) : void 0);
903
924
  api = await this.getProvidersApi();
904
925
  } catch (ex) {
@@ -1165,8 +1186,9 @@ var GitHostIntegration = class extends IntegrationBase {
1165
1186
  /**
1166
1187
  * The current account as each of `pullRequests` identifies its members, in order: what a raw row's
1167
1188
  * `authoredByMe` and `viewer` are resolved against when it's mapped. Most hosts give a person one id, so every
1168
- * row gets the account itself; Azure DevOps Server answers per collection (see `AzureDevOpsServerIntegration`).
1169
- * Throws only when the account itself can't be read.
1189
+ * row gets the account itself; Azure DevOps answers per organization (see `AzureDevOpsIntegrationBase`).
1190
+ * Throws only when the account itself can't be read. Azure DevOps never throws: a session it can't resolve leaves
1191
+ * the rows it hadn't already resolved unknown.
1170
1192
  */
1171
1193
  async getPullRequestViewers(pullRequests, connectionId) {
1172
1194
  const account = await this.getCurrentAccount({ connectionId });