@gitkraken/core-gitlens 0.38.0 → 0.38.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,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.38.1] - 2026-11-14
10
+
11
+ ### Fixed
12
+
13
+ - Fixes git time limits and cancellation not stopping git on Windows when it waits on something other than its input, such as a remote that accepts the connection and never answers. Git for Windows' `cmd\git.exe` runs the real git as its child, and killing only that launcher left git running with the output pipes open, so the run settled only when git ended on its own. The default spawner now ends the whole process tree (`taskkill /T /F`, launched only when it kills) and reports the kill as Node does. A host `spawn` (`GitOptions.spawn`) has to end the tree itself (utils, git-cli)
14
+
9
15
  ## [0.38.0] - 2026-11-13
10
16
 
11
17
  ### Added
@@ -39,6 +45,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
39
45
 
40
46
  ### Fixed
41
47
 
48
+ - Fixes Jira Cloud and Linear autolinks losing known links after failed discovery or restoring older partial lists during overlapping reads. Links now follow the latest cached sites, projects, teams and organization, including site removals and renamed workspace URLs ([#6202](https://github.com/gitkraken/vscode-gitlens/issues/6202)) (plus/integrations)
49
+
42
50
  - Fixes Linear autolinks keeping an incomplete team list cached for the whole discovery TTL instead of retrying discovery ([#6177](https://github.com/gitkraken/vscode-gitlens/issues/6177)) (plus/integrations)
43
51
  - Fixes Jira Cloud and Linear autolinks re-reading, and waiting on, the provider on every call while the sites, a site's projects, the Linear organization or its teams can't be read whole; that set is now kept, with the last prefixes of a site that failed, and retried in the background after a minute ([#6183](https://github.com/gitkraken/vscode-gitlens/issues/6183)) (plus/integrations)
44
52
  - Fixes Jira Cloud and Linear autolinks after a newer read replaces a site's project list or the team list while an autolink build is in flight: a render no longer joins the build started before the replacement, an older read landing last no longer puts its list back for the discovery TTL nor answers with it, a later build's empty fallback no longer blocks the set the retired build kept, a Jira site whose projects keep failing keeps the prefixes of its last list stored once the replacement dropped the set, and the same list read again no longer drops a complete set nor retires the build in flight ([#6184](https://github.com/gitkraken/vscode-gitlens/issues/6184)) (plus/integrations)
@@ -1284,7 +1292,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1284
1292
 
1285
1293
  - 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.
1286
1294
 
1287
- [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.0...HEAD
1295
+ [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.1...HEAD
1296
+ [0.38.1]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.0...gitkraken:releases/core/v0.38.1
1288
1297
  [0.38.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.37.1...gitkraken:releases/core/v0.38.0
1289
1298
  [0.37.1]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.37.0...gitkraken:releases/core/v0.37.1
1290
1299
  [0.37.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.36.0...gitkraken:releases/core/v0.37.0
@@ -1,5 +1,4 @@
1
1
  import { IssueSorting } from "../../../git/models/issue.js";
2
- import "../providerFilters.js";
3
2
  //#region ../plus/integrations/src/providers/issueSorts.d.ts
4
3
  /** GitHub and GHE: one `search` channel serves all three issue reads, so all three order the same way. */
5
4
  export declare const githubIssueSorts: IssueSorting[];
@@ -42,15 +42,6 @@ export declare class JiraIntegration extends IssuesIntegration<IssuesCloudHostIn
42
42
  * from it in `_autolinks` (#6176). Cleared with `_projects`, whose generation then refuses those same writes.
43
43
  */
44
44
  private readonly _projectEvictions;
45
- /**
46
- * Moves whenever `_autolinks` is dropped for a list a build reads, so a build that then fails keeps no fallback
47
- * over lists it didn't read; the next render builds from them instead (#6183). Rule: every writer that stores a
48
- * different project list for a site must bump it and retire the token's build, through {@link onProjectListStored};
49
- * the same list stored again does neither while a complete set is kept (#6184). The connect's clear bumps it too.
50
- * Site-list stores deliberately don't: a build's own site store would then refuse its own fallback. Drops and
51
- * evictions need no bump: they fail a build's `isCurrent`.
52
- */
53
- private _autolinksResets;
54
45
  autolinks(): Promise<(AutolinkReference | DynamicAutolinkReference)[]>;
55
46
  /**
56
47
  * One build per token at a time: concurrent renders share it rather than each re-reading sites and projects. A
@@ -59,20 +50,8 @@ export declare class JiraIntegration extends IssuesIntegration<IssuesCloudHostIn
59
50
  */
60
51
  private buildAutolinks;
61
52
  private buildAutolinksCore;
62
- /**
63
- * A site's project list was stored. A different one drops the autolinks built from the lists, so a build that then
64
- * fails keeps no fallback, and retires the build in flight, which may hold the list as it was. The same one again
65
- * keeps a complete set and the build in flight; otherwise it drops the incomplete set kept, if any, so the next
66
- * render builds from the lists again, and still fences a failing build's fallback (#6183, #6184). Other tokens' sets
67
- * and builds stay; only `_autolinksResets`, shared by all tokens, also stops their failing builds' fallback.
68
- *
69
- * A known limit: a build whose own read stores a different list, or a site's first one (with nothing seeded since a
70
- * start, a clear or an eviction, every first store reads as different), retires itself too. A render in the
71
- * microtasks before that build resumes then starts a second one rather than joining it; that one builds from the
72
- * cache, reading again only the sites the first couldn't read whole. A loss of the sharing core had, with no effect
73
- * on what is kept, and none on an identical list, which retires nothing.
74
- */
75
- private onProjectListStored;
53
+ private deriveAutolinks;
54
+ private onDiscoveryStored;
76
55
  protected getProviderAccountForResource(session: ProviderAuthenticationSession, resource: JiraOrganizationDescriptor): Promise<Account | undefined>;
77
56
  /** Atlassian's account id is the same on every site, so the first site answers for all of them. */
78
57
  protected getProviderCurrentAccount(session: ProviderAuthenticationSession): Promise<Account | undefined>;
@@ -90,15 +69,15 @@ export declare class JiraIntegration extends IssuesIntegration<IssuesCloudHostIn
90
69
  */
91
70
  private readonly _organizations;
92
71
  private readonly _projects;
93
- protected getProviderResourcesForUser(session: ProviderAuthenticationSession, force?: boolean): Promise<JiraOrganizationDescriptor[] | undefined>;
72
+ protected getProviderResourcesForUser(session: ProviderAuthenticationSession, force?: boolean, reader?: () => Promise<unknown> | undefined): Promise<JiraOrganizationDescriptor[] | undefined>;
94
73
  protected getProviderUncachedResourcesForUser(session: ProviderAuthenticationSession): Promise<JiraOrganizationDescriptor[] | undefined>;
95
74
  private readOrganizations;
96
75
  protected getProviderProjectsForResources(session: ProviderAuthenticationSession, resources: JiraOrganizationDescriptor[], force?: boolean): Promise<JiraProjectDescriptor[] | undefined>;
97
- protected getProviderProjectsForResourcesWithMetadata(session: ProviderAuthenticationSession, resources: JiraOrganizationDescriptor[], force?: boolean): Promise<ProviderApiCollectionResult<JiraProjectDescriptor>>;
76
+ protected getProviderProjectsForResourcesWithMetadata(session: ProviderAuthenticationSession, resources: JiraOrganizationDescriptor[], force?: boolean, reader?: () => Promise<unknown> | undefined): Promise<ProviderApiCollectionResult<JiraProjectDescriptor>>;
98
77
  protected getProviderUncachedProjectsForResourcesWithMetadata(session: ProviderAuthenticationSession, resources: JiraOrganizationDescriptor[]): Promise<ProviderApiCollectionResult<JiraProjectDescriptor>>;
99
78
  /**
100
79
  * Reads the projects of each resource from the provider, apart by whether a resource's list came back complete:
101
- * only a complete one may be cached as the resource's project set.
80
+ * incomplete lists remain available for decoration but cannot satisfy a fresh discovery read.
102
81
  */
103
82
  private readProjects;
104
83
  protected getProviderIssuesForProject(session: ProviderAuthenticationSession, project: JiraProjectDescriptor, options?: IssuesForProjectOptions): Promise<IssueShape[] | undefined>;
@@ -1,7 +1,6 @@
1
1
  import { chunk } from "../../../utils/array.js";
2
2
  import { Logger as _logger } from "../../../utils/logger.js";
3
3
  import { mapSettledBounded } from "../../../utils/promise.js";
4
- import { areEqual } from "../../../utils/object.js";
5
4
  import "../constants.js";
6
5
  import { isJiraMissingProjectError } from "./providerErrors.js";
7
6
  import { toCollectionScopeFailure } from "../collectionMetadata.js";
@@ -10,7 +9,7 @@ import { providersMetadata, toAccount, toIssueShape, toProviderIssueStates } fro
10
9
  import { toTokenWithInfo } from "../authentication/models.js";
11
10
  import { IssuesIntegration, groupProjectIssuesSearches } from "../models/issuesIntegration.js";
12
11
  import { createIssueAutolinkReferences } from "./utils/issueAutolinks.js";
13
- import { DiscoveryCache, isAutolinkSetExpired, isEmptyAutolinkFallback } from "./utils/discoveryCache.js";
12
+ import { DiscoveryCache, isAutolinkSetExpired } from "./utils/discoveryCache.js";
14
13
  import { drainJiraIssues, readUserScopedJiraIssues, searchJiraProjectIssues, summarizePageMetadata, toUniqueJiraIssueShapes } from "./utils/jiraIssueDrains.js";
15
14
  import { toJiraIssueEtagFields } from "./jiraIssueByKey.js";
16
15
  import { JIRA_MAX_PROJECT_KEYS_PER_REQUEST } from "@gitkraken/provider-apis";
@@ -66,22 +65,13 @@ var JiraIntegration = class extends IssuesIntegration {
66
65
  * from it in `_autolinks` (#6176). Cleared with `_projects`, whose generation then refuses those same writes.
67
66
  */
68
67
  _projectEvictions = /* @__PURE__ */ new Map();
69
- /**
70
- * Moves whenever `_autolinks` is dropped for a list a build reads, so a build that then fails keeps no fallback
71
- * over lists it didn't read; the next render builds from them instead (#6183). Rule: every writer that stores a
72
- * different project list for a site must bump it and retire the token's build, through {@link onProjectListStored};
73
- * the same list stored again does neither while a complete set is kept (#6184). The connect's clear bumps it too.
74
- * Site-list stores deliberately don't: a build's own site store would then refuse its own fallback. Drops and
75
- * evictions need no bump: they fail a build's `isCurrent`.
76
- */
77
- _autolinksResets = 0;
78
68
  async autolinks() {
79
69
  if (!(this.maybeConnected ?? await this.isConnected()) || this._session == null) return [];
80
70
  const session = this._session;
81
71
  const cached = this._autolinks.get(session.accessToken);
82
72
  if (this.connectionExpired === true) return cached?.autolinks ?? [];
83
- if (cached == null) return this.buildAutolinks(session);
84
- if (isAutolinkSetExpired(cached)) this.buildAutolinks(session);
73
+ if (cached == null || cached.builtAt === 0 && !cached.complete && cached.autolinks.length === 0) return this.buildAutolinks(session);
74
+ if (cached.builtAt === 0 || isAutolinkSetExpired(cached)) this.buildAutolinks(session);
85
75
  return cached.autolinks;
86
76
  }
87
77
  /**
@@ -93,80 +83,47 @@ var JiraIntegration = class extends IssuesIntegration {
93
83
  const { accessToken } = session;
94
84
  let build = this._autolinksBuilds.get(accessToken);
95
85
  if (build == null) {
96
- build = this.buildAutolinksCore(session).finally(() => {
86
+ build = this.buildAutolinksCore(session, () => build).finally(() => {
97
87
  if (this._autolinksBuilds.get(accessToken) === build) this._autolinksBuilds.delete(accessToken);
98
88
  });
99
89
  this._autolinksBuilds.set(accessToken, build);
100
90
  }
101
91
  return build;
102
92
  }
103
- async buildAutolinksCore(session) {
93
+ async buildAutolinksCore(session, reader) {
104
94
  const { accessToken } = session;
105
95
  const generation = this._projects.generation;
106
96
  const evictions = this._projectEvictions.get(accessToken);
107
- const resets = this._autolinksResets;
108
- const held = this._autolinks.get(accessToken);
109
- const isCurrent = () => this._projects.generation === generation && this._projectEvictions.get(accessToken) === evictions;
110
- const keep = (autolinks, complete) => {
111
- const kept = this._autolinks.get(accessToken);
112
- if (isCurrent() && (complete || kept == null || kept === held || isEmptyAutolinkFallback(kept))) this._autolinks.set(accessToken, {
113
- autolinks,
114
- builtAt: Date.now(),
115
- complete
116
- });
117
- return autolinks;
118
- };
119
- const keepHeld = () => this._autolinksResets === resets ? keep(held?.autolinks ?? [], false) : held?.autolinks ?? [];
120
97
  try {
121
- const organizations = await this.getProviderResourcesForUser(session);
122
- if (organizations == null) return keepHeld();
123
- const sitesCached = () => areEqual(this._organizations.peek(accessToken), organizations);
124
- if (!organizations.length) return keep([], sitesCached());
125
- const { values: projects, metadata } = await this.getProviderProjectsForResourcesWithMetadata(session, organizations);
126
- const current = isCurrent();
127
- const heldNone = held == null || isEmptyAutolinkFallback(held);
128
- const failedSites = new Set(metadata?.failures?.map((f) => f.scope?.resourceId));
129
- const refsOf = (organization, siteProjects) => siteProjects.flatMap((project) => createIssueAutolinkReferences(project.key, `${organization.url}/browse/${project.key}-<num>`, organization));
130
- const autolinks = [];
131
- let complete = true;
132
- for (const organization of organizations) {
133
- const key = `${accessToken}:${organization.id}`;
134
- const cachedProjects = current ? this._projects.get(key) : void 0;
135
- const siteProjects = cachedProjects ?? projects.filter((p) => p.resourceId === organization.id);
136
- const refs = refsOf(organization, siteProjects);
137
- autolinks.push(...refs);
138
- if (cachedProjects != null) continue;
139
- complete = false;
140
- if (!(failedSites.has(organization.id) || !siteProjects.length)) continue;
141
- const stored = heldNone && current ? this._projects.peek(key) : void 0;
142
- const had = stored != null ? refsOf(organization, stored) : held?.autolinks.filter((ref) => "prefix" in ref && ref.descriptor?.key === organization.id) ?? [];
143
- const prefixes = new Set(refs.map((r) => r.prefix));
144
- for (const ref of had) if (!prefixes.has(ref.prefix)) autolinks.push(ref);
98
+ const organizations = await this.getProviderResourcesForUser(session, false, reader);
99
+ if (organizations != null && this._projects.generation === generation && this._projectEvictions.get(accessToken) === evictions) {
100
+ const projects = await this.getProviderProjectsForResourcesWithMetadata(session, organizations, false, reader);
101
+ if ((this._projects.generation !== generation || this._projectEvictions.get(accessToken) !== evictions) && (projects.values.length > 0 || !projects.metadata?.failures?.length)) return organizations.flatMap((organization) => getProjectAutolinks(organization, projects.values.filter((p) => p.resourceId === organization.id)));
145
102
  }
146
- return keep(autolinks, complete && sitesCached());
147
103
  } catch (ex) {
148
104
  _logger.error(ex, "JiraIntegration.autolinks");
149
- return keepHeld();
150
105
  }
106
+ return this.deriveAutolinks(accessToken, { store: this._projects.generation === generation && this._projectEvictions.get(accessToken) === evictions });
151
107
  }
152
- /**
153
- * A site's project list was stored. A different one drops the autolinks built from the lists, so a build that then
154
- * fails keeps no fallback, and retires the build in flight, which may hold the list as it was. The same one again
155
- * keeps a complete set and the build in flight; otherwise it drops the incomplete set kept, if any, so the next
156
- * render builds from the lists again, and still fences a failing build's fallback (#6183, #6184). Other tokens' sets
157
- * and builds stay; only `_autolinksResets`, shared by all tokens, also stops their failing builds' fallback.
158
- *
159
- * A known limit: a build whose own read stores a different list, or a site's first one (with nothing seeded since a
160
- * start, a clear or an eviction, every first store reads as different), retires itself too. A render in the
161
- * microtasks before that build resumes then starts a second one rather than joining it; that one builds from the
162
- * cache, reading again only the sites the first couldn't read whole. A loss of the sharing core had, with no effect
163
- * on what is kept, and none on an identical list, which retires nothing.
164
- */
165
- onProjectListStored(accessToken, stored) {
166
- if (stored === "changed") this._autolinksBuilds.delete(accessToken);
167
- else if (this._autolinks.get(accessToken)?.complete === true) return;
168
- this._autolinks.delete(accessToken);
169
- this._autolinksResets++;
108
+ deriveAutolinks(accessToken, options) {
109
+ const organizations = this._organizations.peek(accessToken);
110
+ let complete = this._organizations.get(accessToken) != null;
111
+ const autolinks = [];
112
+ for (const organization of organizations ?? []) {
113
+ const key = `${accessToken}:${organization.id}`;
114
+ complete &&= this._projects.get(key) != null;
115
+ autolinks.push(...getProjectAutolinks(organization, this._projects.peek(key) ?? []));
116
+ }
117
+ if (options?.store !== false) this._autolinks.set(accessToken, {
118
+ autolinks,
119
+ complete,
120
+ builtAt: options?.settled !== false ? Date.now() : this._autolinks.get(accessToken)?.builtAt || (complete ? Date.now() : 0)
121
+ });
122
+ return autolinks;
123
+ }
124
+ onDiscoveryStored(accessToken, reader) {
125
+ if (this._autolinksBuilds.get(accessToken) !== reader?.()) this._autolinksBuilds.delete(accessToken);
126
+ this.deriveAutolinks(accessToken, { settled: false });
170
127
  }
171
128
  async getProviderAccountForResource(session, resource) {
172
129
  const user = await (await this.getProvidersApi()).getCurrentUserForResource(toTokenWithInfo(this.id, session), resource.id);
@@ -196,18 +153,20 @@ var JiraIntegration = class extends IssuesIntegration {
196
153
  */
197
154
  _organizations = new DiscoveryCache();
198
155
  _projects = new DiscoveryCache();
199
- async getProviderResourcesForUser(session, force = false) {
156
+ async getProviderResourcesForUser(session, force = false, reader) {
200
157
  const { accessToken } = session;
201
158
  const cachedResources = this._organizations.get(accessToken);
202
159
  if (cachedResources != null && !force) return cachedResources;
203
160
  const generation = this._organizations.generation;
161
+ const started = this._organizations.startRead();
204
162
  const organizations = await this.readOrganizations(session);
205
- if (organizations == null) {
206
- this._organizations.delete(accessToken);
207
- return;
208
- }
209
- this._organizations.set(accessToken, organizations, { generation });
210
- return organizations;
163
+ if (organizations == null) return void 0;
164
+ const stored = this._organizations.set(accessToken, organizations, {
165
+ generation,
166
+ read: started
167
+ });
168
+ if (stored === "changed") this.onDiscoveryStored(accessToken, reader);
169
+ return stored === false && this._organizations.generation === generation ? this._organizations.peek(accessToken) : organizations;
211
170
  }
212
171
  getProviderUncachedResourcesForUser(session) {
213
172
  return this.readOrganizations(session);
@@ -221,7 +180,7 @@ var JiraIntegration = class extends IssuesIntegration {
221
180
  async getProviderProjectsForResources(session, resources, force = false) {
222
181
  return (await this.getProviderProjectsForResourcesWithMetadata(session, resources, force)).values;
223
182
  }
224
- async getProviderProjectsForResourcesWithMetadata(session, resources, force = false) {
183
+ async getProviderProjectsForResourcesWithMetadata(session, resources, force = false, reader) {
225
184
  const { accessToken } = session;
226
185
  const projectsCache = this._projects;
227
186
  const generation = projectsCache.generation;
@@ -234,56 +193,68 @@ var JiraIntegration = class extends IssuesIntegration {
234
193
  }
235
194
  const resourcesWithoutProjects = force ? resources : resources.filter((resource) => !cachedProjects.has(resource.id));
236
195
  const read = await this.readProjects(session, resourcesWithoutProjects);
237
- const values = [...read.partial];
238
- for (const [resourceId, projects] of read.complete) {
196
+ const values = [];
197
+ let metadata = read.metadata;
198
+ let changed = false;
199
+ for (const [resourceId, projects] of [...read.complete, ...read.incomplete]) {
239
200
  if (this._projectEvictions.get(accessToken) !== evictions) continue;
240
- const stored = projectsCache.set(`${accessToken}:${resourceId}`, projects, {
201
+ if (projectsCache.set(`${accessToken}:${resourceId}`, projects, {
241
202
  generation,
242
- read: started
243
- });
244
- if (stored !== false) this.onProjectListStored(accessToken, stored);
203
+ read: started,
204
+ complete: read.complete.has(resourceId)
205
+ }) === "changed") changed = true;
245
206
  }
207
+ if (changed) this.onDiscoveryStored(accessToken, reader);
246
208
  const current = projectsCache.generation === generation && this._projectEvictions.get(accessToken) === evictions;
247
209
  for (const resource of resources) {
248
- const resourceProjects = read.complete.get(resource.id) ?? cachedProjects.get(resource.id);
210
+ const resourceProjects = read.complete.get(resource.id) ?? read.incomplete.get(resource.id) ?? cachedProjects.get(resource.id);
249
211
  if (resourceProjects == null) continue;
250
212
  const stored = current ? projectsCache.peek(`${accessToken}:${resource.id}`) : void 0;
251
213
  values.push(...stored ?? resourceProjects);
214
+ if (stored != null && projectsCache.get(`${accessToken}:${resource.id}`) == null) metadata = mergeCollectionMetadata(metadata, { completeness: "unknown" });
252
215
  }
253
216
  return {
254
217
  values: uniqueProjects(values),
255
- metadata: read.metadata
218
+ metadata
256
219
  };
257
220
  }
258
221
  async getProviderUncachedProjectsForResourcesWithMetadata(session, resources) {
259
222
  const read = await this.readProjects(session, resources);
260
223
  return {
261
- values: uniqueProjects([...read.partial, ...[...read.complete.values()].flat()]),
224
+ values: uniqueProjects([...read.incomplete.values(), ...read.complete.values()].flat()),
262
225
  metadata: read.metadata
263
226
  };
264
227
  }
265
228
  /**
266
229
  * Reads the projects of each resource from the provider, apart by whether a resource's list came back complete:
267
- * only a complete one may be cached as the resource's project set.
230
+ * incomplete lists remain available for decoration but cannot satisfy a fresh discovery read.
268
231
  */
269
232
  async readProjects(session, resources) {
270
233
  const complete = /* @__PURE__ */ new Map();
271
- const partial = [];
234
+ const incompleteLists = /* @__PURE__ */ new Map();
272
235
  let metadata;
273
236
  if (resources.length === 0) return {
274
237
  complete,
275
- partial,
238
+ incomplete: incompleteLists,
276
239
  metadata
277
240
  };
278
241
  const api = await this.getProvidersApi();
279
242
  const tokenWithInfo = toTokenWithInfo(this.id, session);
280
- (await Promise.allSettled(resources.map(async (resource) => ({
281
- resource,
282
- result: await collectProviderPagedResult((cursor) => api.getJiraProjectsForResource(tokenWithInfo, resource.id, { cursor }), maxPagesPerRequest, {
283
- providerId: this.id,
284
- resourceId: resource.id
285
- })
286
- })))).forEach((drain, index) => {
243
+ (await Promise.allSettled(resources.map(async (resource) => {
244
+ let readPage = false;
245
+ return {
246
+ resource,
247
+ result: await collectProviderPagedResult(async (cursor) => {
248
+ const page = await api.getJiraProjectsForResource(tokenWithInfo, resource.id, { cursor });
249
+ readPage ||= page != null && (page.values.length > 0 || !page.metadata?.failures?.length);
250
+ return page;
251
+ }, maxPagesPerRequest, {
252
+ providerId: this.id,
253
+ resourceId: resource.id
254
+ }),
255
+ readPage
256
+ };
257
+ }))).forEach((drain, index) => {
287
258
  if (drain.status === "rejected") {
288
259
  const resource = resources[index];
289
260
  if (resource == null) return;
@@ -296,11 +267,11 @@ var JiraIntegration = class extends IssuesIntegration {
296
267
  });
297
268
  return;
298
269
  }
299
- const { resource, result } = drain.value;
270
+ const { resource, result, readPage } = drain.value;
300
271
  metadata = mergeCollectionMetadata(metadata, result.metadata);
301
272
  const projects = result.values.filter((project) => project.resourceId === resource.id).map((project) => ({ ...project }));
302
273
  if (result.truncated === true || result.metadata != null && result.metadata.completeness !== "complete") {
303
- partial.push(...projects);
274
+ if (readPage) incompleteLists.set(resource.id, projects);
304
275
  if (result.truncated === true && (result.metadata == null || result.metadata.completeness === "complete")) metadata = mergeCollectionMetadata(metadata, { completeness: "partial" });
305
276
  return;
306
277
  }
@@ -308,7 +279,7 @@ var JiraIntegration = class extends IssuesIntegration {
308
279
  });
309
280
  return {
310
281
  complete,
311
- partial,
282
+ incomplete: incompleteLists,
312
283
  metadata
313
284
  };
314
285
  }
@@ -588,7 +559,6 @@ var JiraIntegration = class extends IssuesIntegration {
588
559
  }
589
560
  async providerOnConnect() {
590
561
  this._autolinks.clear();
591
- this._autolinksResets++;
592
562
  if (this._session == null) return;
593
563
  const session = this._session;
594
564
  const organizations = await this.getProviderResourcesForUser(session, true);
@@ -608,6 +578,9 @@ var JiraIntegration = class extends IssuesIntegration {
608
578
  this._autolinks.clear();
609
579
  }
610
580
  };
581
+ function getProjectAutolinks(organization, projects) {
582
+ return projects.flatMap((project) => createIssueAutolinkReferences(project.key, `${organization.url}/browse/${project.key}-<num>`, organization));
583
+ }
611
584
  /** The projects once each, by site and id. */
612
585
  function uniqueProjects(projects) {
613
586
  const projectsByIdentity = /* @__PURE__ */ new Map();