@gitkraken/core-gitlens 0.9.7 → 0.9.9

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 (38) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/git/models/statusFile.d.ts +3 -2
  3. package/dist/git/models/statusFile.js +4 -1
  4. package/dist/git/models/statusFile.js.map +1 -1
  5. package/dist/git-cli/parsers/statusParser.d.ts +2 -1
  6. package/dist/git-cli/parsers/statusParser.js +53 -27
  7. package/dist/git-cli/parsers/statusParser.js.map +1 -1
  8. package/dist/git-cli/providers/status.js +3 -5
  9. package/dist/git-cli/providers/status.js.map +1 -1
  10. package/dist/plus/integrations/collectionMetadata.d.ts +7 -0
  11. package/dist/plus/integrations/collectionMetadata.js +11 -1
  12. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  13. package/dist/plus/integrations/models/issueReads.d.ts +5 -0
  14. package/dist/plus/integrations/models/issuesIntegration.d.ts +37 -1
  15. package/dist/plus/integrations/models/issuesIntegration.js +118 -2
  16. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  17. package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
  18. package/dist/plus/integrations/providers/jira-server.d.ts +8 -1
  19. package/dist/plus/integrations/providers/jira-server.js +90 -138
  20. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  21. package/dist/plus/integrations/providers/jira.d.ts +11 -1
  22. package/dist/plus/integrations/providers/jira.js +88 -122
  23. package/dist/plus/integrations/providers/jira.js.map +1 -1
  24. package/dist/plus/integrations/providers/linear.d.ts +22 -1
  25. package/dist/plus/integrations/providers/linear.js +84 -35
  26. package/dist/plus/integrations/providers/linear.js.map +1 -1
  27. package/dist/plus/integrations/providers/models.d.ts +5 -9
  28. package/dist/plus/integrations/providers/models.js.map +1 -1
  29. package/dist/plus/integrations/providers/providersApi.d.ts +24 -3
  30. package/dist/plus/integrations/providers/providersApi.js +56 -4
  31. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  32. package/dist/plus/integrations/providers/utils/jiraIssueDrains.d.ts +86 -0
  33. package/dist/plus/integrations/providers/utils/jiraIssueDrains.js +139 -0
  34. package/dist/plus/integrations/providers/utils/jiraIssueDrains.js.map +1 -0
  35. package/dist/plus/integrations/reads/drains.d.ts +0 -1
  36. package/dist/plus/integrations/reads/issueTracker.js +20 -9
  37. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  38. package/package.json +2 -2
@@ -1,14 +1,15 @@
1
1
  import { Logger as _logger } from "../../../utils/logger.js";
2
2
  import "../constants.js";
3
3
  import { isJiraMissingProjectError } from "./providerErrors.js";
4
- import { throwIfCallerContractError, toCollectionScopeFailure } from "../collectionMetadata.js";
4
+ import { toCollectionScopeFailure } from "../collectionMetadata.js";
5
5
  import { toTokenWithInfo } from "../authentication/models.js";
6
- import "../providerFilters.js";
7
6
  import { mergeCollectionMetadata } from "./utils/providerPaging.js";
8
7
  import { areDomainsOnSameHost, baseUrlFromDomain } from "../utils/domain.utils.js";
9
8
  import { providersMetadata, toAccount, toIssueShape, toProviderIssueStates } from "./models.js";
10
- import { IssuesIntegration } from "../models/issuesIntegration.js";
9
+ import { IssuesIntegration, groupProjectIssuesSearches } from "../models/issuesIntegration.js";
11
10
  import { DiscoveryCache } from "./utils/discoveryCache.js";
11
+ import { drainJiraIssues, readUserScopedJiraIssues, searchJiraProjectIssues, toUniqueJiraIssueShapes } from "./utils/jiraIssueDrains.js";
12
+ import { JIRA_MAX_PROJECT_KEYS_PER_REQUEST } from "@gitkraken/provider-apis";
12
13
  //#region ../plus/integrations/src/providers/jira-server.ts
13
14
  const metadata = providersMetadata["jira-server"];
14
15
  const authProvider = Object.freeze({
@@ -16,6 +17,33 @@ const authProvider = Object.freeze({
16
17
  scopes: metadata.scopes
17
18
  });
18
19
  const maxPagesPerRequest = 10;
20
+ /**
21
+ * Every clause is scoped by the HANDLE, and `options.userId` is deliberately ignored here — the one
22
+ * place this provider diverges from Jira Cloud's, which applies it to `assignee`/`creator` (#5857).
23
+ *
24
+ * The two are not interchangeable because `Account.id` means something different per deployment. On
25
+ * Cloud it is the `accountId`, which JQL resolves, so scoping by it fixes the deactivated-account case
26
+ * where the display name no longer resolves. On Server it is the user KEY (`JIRAUSER10224`), which JQL
27
+ * does not resolve at all: measured against a live Jira Server 8.20.13 site, `assignee in
28
+ * ("JIRAUSER10224")` returns 0 with `"The value 'JIRAUSER10224' does not exist for the field
29
+ * 'assignee'"` — the identical warning a genuinely nonexistent user produces — while the username and
30
+ * the display name both return the real 4.
31
+ *
32
+ * So applying `userId` here would silently empty the read rather than harden it. Do not "fix" this
33
+ * asymmetry to match Cloud without re-measuring against a Server instance.
34
+ *
35
+ * The handle itself is already the right one: `provider-apis` 0.60.0 maps `Account.username` from the
36
+ * Server payload's `name` (falling back to `displayName` when absent), so these clauses are scoped by the
37
+ * real username rather than a display name (GKDEV-3629). That is what makes the `mention` clause work at
38
+ * all — it is a free-text `comment ~ "..."` over comment bodies, and a Jira mention is stored as
39
+ * `[~username]`, which a display name never matches.
40
+ */
41
+ function toUserIdentities(user) {
42
+ return {
43
+ userField: user,
44
+ mention: user
45
+ };
46
+ }
19
47
  var JiraServerIntegration = class extends IssuesIntegration {
20
48
  _domain;
21
49
  authProvider = authProvider;
@@ -93,151 +121,43 @@ var JiraServerIntegration = class extends IssuesIntegration {
93
121
  const tokenWithInfo = toTokenWithInfo(this.id, session);
94
122
  const api = await this.getProvidersApi();
95
123
  const baseUrl = this.apiBaseUrlFor(session);
96
- const projectJqlKey = project.id;
97
- const projectScope = {
98
- providerId: this.id,
99
- resourceId: project.resourceId,
100
- projectId: project.id
101
- };
102
124
  const states = toProviderIssueStates(options?.state);
103
- const drainIssues = async (scope) => {
104
- const collected = [];
105
- let cursor;
106
- let status = "complete";
107
- let metadata;
108
- for (let i = 0; i < maxPagesPerRequest; i++) {
109
- let result;
110
- try {
111
- result = await api.getJiraServerIssuesForProjectPaged(tokenWithInfo, baseUrl, projectJqlKey, {
112
- ...scope,
113
- cursor,
114
- states,
115
- sort: options?.sort
116
- });
117
- } catch (ex) {
118
- if (collected.length === 0 && isJiraMissingProjectError(ex)) {
119
- _logger.warn(`Jira Server project '${project.name}' (${project.id}) no longer exists or is not visible`);
120
- this._projects.delete(this.projectsCacheKey(session));
121
- return {
122
- issues: [],
123
- status: "complete"
124
- };
125
- }
126
- if (collected.length === 0) throw ex;
127
- status = "incomplete";
128
- metadata = mergeCollectionMetadata(metadata, {
129
- completeness: "partial",
130
- failures: [toCollectionScopeFailure(projectScope, ex)]
131
- });
132
- break;
133
- }
134
- if (result == null) {
135
- if (cursor == null) break;
136
- status = "incomplete";
137
- metadata = mergeCollectionMetadata(metadata, {
138
- completeness: "partial",
139
- failures: [toCollectionScopeFailure(projectScope, /* @__PURE__ */ new Error("Jira Server returned no page after advertising a continuation"))]
140
- });
141
- break;
142
- }
143
- collected.push(...result.data);
144
- if (!result.hasMore) break;
145
- if (result.nextCursor == null || result.nextCursor === cursor) {
146
- status = "incomplete";
147
- metadata = mergeCollectionMetadata(metadata, {
148
- completeness: "partial",
149
- failures: [toCollectionScopeFailure(projectScope, /* @__PURE__ */ new Error("Jira Server returned no advancing issue continuation"))]
150
- });
151
- break;
152
- }
153
- cursor = result.nextCursor;
154
- if (i === 9) status = "backstop";
125
+ const fetchPage = (scope, cursor) => api.getJiraServerIssuesForProjectPaged(tokenWithInfo, baseUrl, project.id, {
126
+ ...scope,
127
+ cursor,
128
+ states,
129
+ sort: options?.sort
130
+ });
131
+ const drainOptions = {
132
+ maxPages: maxPagesPerRequest,
133
+ failureScope: {
134
+ providerId: this.id,
135
+ resourceId: project.resourceId,
136
+ projectId: project.id
137
+ },
138
+ providerName: "Jira Server",
139
+ isEmptyFailure: (ex) => {
140
+ if (!isJiraMissingProjectError(ex)) return false;
141
+ _logger.warn(`Jira Server project '${project.name}' (${project.id}) no longer exists or is not visible`);
142
+ this._projects.delete(this.projectsCacheKey(session));
143
+ return true;
155
144
  }
156
- return {
157
- issues: collected,
158
- status,
159
- metadata
160
- };
161
- };
162
- /**
163
- * Every clause is scoped by the HANDLE, and `options.userId` is deliberately ignored here — the one
164
- * place this provider diverges from Jira Cloud's, which applies it to `assignee`/`creator` (#5857).
165
- *
166
- * The two are not interchangeable because `Account.id` means something different per deployment. On
167
- * Cloud it is the `accountId`, which JQL resolves, so scoping by it fixes the deactivated-account case
168
- * where the display name no longer resolves. On Server it is the user KEY (`JIRAUSER10224`), which JQL
169
- * does not resolve at all: measured against a live Jira Server 8.20.13 site, `assignee in
170
- * ("JIRAUSER10224")` returns 0 with `"The value 'JIRAUSER10224' does not exist for the field
171
- * 'assignee'"` — the identical warning a genuinely nonexistent user produces — while the username and
172
- * the display name both return the real 4.
173
- *
174
- * So applying `userId` here would silently empty the read rather than harden it. Do not "fix" this
175
- * asymmetry to match Cloud without re-measuring against a Server instance.
176
- *
177
- * The handle itself is already the right one: `provider-apis` 0.60.0 maps `Account.username` from the
178
- * Server payload's `name` (falling back to `displayName` when absent), so these clauses are scoped by the
179
- * real username rather than a display name (GKDEV-3629). That is what makes the `mention` clause work at
180
- * all — it is a free-text `comment ~ "..."` over comment bodies, and a Jira mention is stored as
181
- * `[~username]`, which a display name never matches.
182
- */
183
- const getSearchedUserIssuesForFilter = async (user, filter) => {
184
- const result = await drainIssues({
185
- authorLogin: filter === "author" ? user : void 0,
186
- assigneeLogins: filter === "assignee" ? [user] : void 0,
187
- mentionLogin: filter === "mention" ? user : void 0
188
- });
189
- return {
190
- issues: result.issues.map((issue) => toIssueShape(issue, this, { projection: "project" })).filter((r) => r !== void 0),
191
- status: result.status,
192
- metadata: result.metadata
193
- };
194
145
  };
195
146
  if (options?.user != null) {
196
- const user = options.user;
197
- const filters = options.filters?.length ? options.filters : ["assignee"];
198
- const settled = await Promise.allSettled(filters.map((filter) => getSearchedUserIssuesForFilter(user, filter)));
199
- if (settled.every((r) => r.status === "rejected")) {
200
- for (let i = 1; i < settled.length; i++) {
201
- const outcome = settled[i];
202
- if (outcome.status === "rejected") _logger.error(outcome.reason, `getProviderIssuesForProjectWithTruncation: filter '${filters[i]}' failed`);
203
- }
204
- throw settled[0].status === "rejected" ? settled[0].reason : /* @__PURE__ */ new Error("Jira Server issue read failed");
205
- }
206
- let truncated = false;
207
- let metadata;
208
- const resultsById = /* @__PURE__ */ new Map();
209
- for (let i = 0; i < settled.length; i++) {
210
- const outcome = settled[i];
211
- const filter = filters[i];
212
- if (outcome.status !== "fulfilled") {
213
- throwIfCallerContractError(outcome.reason);
214
- truncated = true;
215
- const failure = toCollectionScopeFailure(projectScope, outcome.reason);
216
- metadata = mergeCollectionMetadata(metadata, {
217
- completeness: "partial",
218
- failures: [{
219
- ...failure,
220
- message: `Issue filter '${filter}' could not be read${failure.message != null ? `: ${failure.message}` : ""}`
221
- }]
222
- });
223
- continue;
224
- }
225
- if (outcome.value.status !== "complete") truncated = true;
226
- if (outcome.value.metadata != null) metadata = mergeCollectionMetadata(metadata, outcome.value.metadata);
227
- for (const resultIssue of outcome.value.issues) if (!resultsById.has(resultIssue.id)) resultsById.set(resultIssue.id, resultIssue);
228
- }
229
- return truncated ? {
230
- values: [...resultsById.values()],
147
+ const read = await readUserScopedJiraIssues(fetchPage, options.filters, toUserIdentities(options.user), drainOptions);
148
+ const values = toUniqueJiraIssueShapes(read.issues, this);
149
+ return read.truncated ? {
150
+ values,
231
151
  truncated: true,
232
152
  recovery: "none",
233
- metadata
153
+ metadata: read.metadata
234
154
  } : {
235
- values: [...resultsById.values()],
155
+ values,
236
156
  truncated: false,
237
- metadata
157
+ metadata: read.metadata
238
158
  };
239
159
  }
240
- const unscoped = await drainIssues({});
160
+ const unscoped = await drainJiraIssues(fetchPage, {}, drainOptions);
241
161
  const values = unscoped.issues.map((issue) => toIssueShape(issue, this, { projection: "project" })).filter((result) => result !== void 0);
242
162
  return unscoped.status !== "complete" ? {
243
163
  values,
@@ -250,6 +170,38 @@ var JiraServerIntegration = class extends IssuesIntegration {
250
170
  metadata: unscoped.metadata
251
171
  };
252
172
  }
173
+ /**
174
+ * Searches the instance's projects together for a user-scoped read, as Jira Cloud does per site: one JQL names
175
+ * up to {@link JIRA_MAX_PROJECT_KEYS_PER_REQUEST} projects of one user scope. An unscoped read stays per project,
176
+ * since its backstop is reported as `narrow-scope` per project.
177
+ */
178
+ getProjectIssuesSearches(requests) {
179
+ return groupProjectIssuesSearches(requests, ({ options }) => options.user != null ? [
180
+ options.user,
181
+ options.sort ?? "",
182
+ options.state ?? "",
183
+ options.filters?.join(",") ?? ""
184
+ ].join("\0") : void 0, JIRA_MAX_PROJECT_KEYS_PER_REQUEST);
185
+ }
186
+ async searchProviderProjectIssues(session, requests) {
187
+ const { options } = requests[0];
188
+ if (options.user == null) return void 0;
189
+ const tokenWithInfo = toTokenWithInfo(this.id, session);
190
+ const api = await this.getProvidersApi();
191
+ const baseUrl = this.apiBaseUrlFor(session);
192
+ const projectIds = requests.map((request) => request.project.id);
193
+ const states = toProviderIssueStates(options.state);
194
+ return searchJiraProjectIssues((userScope, cursor) => api.getJiraServerIssuesForProjectsPaged(tokenWithInfo, baseUrl, projectIds, {
195
+ ...userScope,
196
+ cursor,
197
+ states,
198
+ sort: options.sort
199
+ }), projectIds, options.filters, toUserIdentities(options.user), {
200
+ maxPages: maxPagesPerRequest,
201
+ failureScope: { providerId: this.id },
202
+ providerName: "Jira Server"
203
+ }, this);
204
+ }
253
205
  async searchProviderMyIssues(session, resources, cancellation) {
254
206
  return (await this.searchProviderMyIssuesWithTruncation(session, resources, cancellation))?.values;
255
207
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jira-server.js","names":[],"sources":["../../../../../plus/integrations/src/providers/jira-server.ts"],"sourcesContent":["import type { CollectionMetadata } from '@gitkraken/provider-apis';\nimport type { Account } from '@gitlens/git/models/author.js';\nimport type { Issue, IssueProjection, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { IssueResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { Emitter } from '@gitlens/utils/event.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider.js';\nimport type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService.js';\nimport type { ProviderAuthenticationSession } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { throwIfCallerContractError, toCollectionScopeFailure } from '../collectionMetadata.js';\nimport { IssuesSelfManagedHostIntegrationId } from '../constants.js';\nimport type { IntegrationServiceContext } from '../context.js';\nimport type { IntegrationConnectionChangeEvent } from '../integrationService.js';\nimport type { IntegrationKey } from '../models/integration.js';\nimport type {\n\tAccountWideIssuesResult,\n\tIssuesForProjectOptions,\n\tProjectIssuesDrain,\n\tSearchMyIssuesOptions,\n} from '../models/issueReads.js';\nimport { IssuesIntegration } from '../models/issuesIntegration.js';\nimport { areDomainsOnSameHost, baseUrlFromDomain } from '../utils/domain.utils.js';\nimport type { ProviderIssue } from './models.js';\nimport { IssueFilter, providersMetadata, toAccount, toIssueShape, toProviderIssueStates } from './models.js';\nimport { isJiraMissingProjectError } from './providerErrors.js';\nimport type { ProvidersApi } from './providersApi.js';\nimport { DiscoveryCache } from './utils/discoveryCache.js';\nimport { mergeCollectionMetadata } from './utils/providerPaging.js';\n\n/**\n * Why three states rather than a boolean, matching `jira.ts`: the backstop is recoverable by narrowing the\n * scope, a page error or a stalled cursor is not, and {@link ProjectIssuesDrain} makes the caller say which.\n */\ntype JiraServerProjectIssuesDrain<T> = {\n\tissues: T[];\n\tstatus: 'complete' | 'backstop' | 'incomplete';\n\tmetadata?: CollectionMetadata;\n};\n\nconst metadata = providersMetadata[IssuesSelfManagedHostIntegrationId.JiraServer];\nconst authProvider = Object.freeze({ id: metadata.id, scopes: metadata.scopes });\nconst maxPagesPerRequest = 10;\n\n/**\n * The single resource a Jira Server connection has: the instance itself.\n *\n * Jira Cloud's account spans many sites, so its resources come from an API call that lists them. A\n * self-hosted instance IS the one site the connection addresses, so there is nothing to enumerate — this\n * descriptor is synthesized from the configured host. Modelling it as a resource anyway keeps the\n * resource → project contract of {@link IssuesIntegration} intact, so every tracker read (`listOrgs`,\n * `listProjects`, `listIssueTrackerIssuesPage`) works unchanged.\n */\nexport interface JiraServerResourceDescriptor extends IssueResourceDescriptor {\n\turl: string;\n}\n\nexport interface JiraServerProjectDescriptor extends IssueResourceDescriptor {\n\tresourceId: string;\n}\n\nexport class JiraServerIntegration extends IssuesIntegration<IssuesSelfManagedHostIntegrationId.JiraServer> {\n\treadonly authProvider: IntegrationAuthenticationProviderDescriptor = authProvider;\n\treadonly id = IssuesSelfManagedHostIntegrationId.JiraServer;\n\tprotected readonly key: IntegrationKey<IssuesSelfManagedHostIntegrationId.JiraServer>;\n\treadonly name: string = 'Jira Data Center';\n\n\tconstructor(\n\t\tctx: IntegrationServiceContext,\n\t\tauthenticationService: IntegrationAuthenticationService,\n\t\tgetProvidersApi: () => Promise<ProvidersApi>,\n\t\tdidChangeConnection: Emitter<IntegrationConnectionChangeEvent>,\n\t\tprivate readonly _domain: string,\n\t) {\n\t\tsuper(ctx, authenticationService, getProvidersApi, didChangeConnection);\n\t\tthis.key = `${this.id}:${this._domain}`;\n\t}\n\n\tget domain(): string {\n\t\treturn this._domain;\n\t}\n\n\t/**\n\t * The URL every request for this connection is addressed to, built from the SESSION's domain rather than\n\t * the integration's.\n\t *\n\t * `this.domain` is the host-keyed identity — `IntegrationService.get()` runs it through `hostFromDomain`\n\t * so one host can't build two instances — which means it has had any context path stripped, and so has\n\t * `session.domain`, which is stored as that same normalized host. Jira Data Center officially supports\n\t * being mounted below a context path (`https://jira.example.com/jira`), so the address comes from\n\t * {@link ProviderAuthenticationSession.baseUrl}, which carries the configured value verbatim; it falls\n\t * back to the host when the backend reported nothing more, which is the common case.\n\t *\n\t * Takes the session rather than reading `_session` so a per-connection (multi-account) read is addressed\n\t * to the host of the connection it resolved, not to whichever one happens to be current.\n\t */\n\tprotected apiBaseUrlFor(session: ProviderAuthenticationSession | undefined): string {\n\t\tconst configured = baseUrlFromDomain(session?.baseUrl, session?.protocol);\n\t\t// A `baseUrl` from another host is not this connection's address — refuse it rather than routing this\n\t\t// integration's reads somewhere its key never named.\n\t\tif (configured != null && areDomainsOnSameHost(session?.baseUrl, this.domain)) return configured;\n\n\t\treturn (\n\t\t\tbaseUrlFromDomain(session?.domain, session?.protocol) ??\n\t\t\tbaseUrlFromDomain(this.domain, session?.protocol) ??\n\t\t\t`${session?.protocol ?? 'https:'}//${this.domain}`\n\t\t);\n\t}\n\n\t/** The one resource this connection has — see {@link JiraServerResourceDescriptor}. */\n\tprivate resourceFor(session: ProviderAuthenticationSession | undefined): JiraServerResourceDescriptor {\n\t\treturn { id: this.domain, key: this.domain, name: this.domain, url: this.apiBaseUrlFor(session) };\n\t}\n\n\t// No `autolinks()` override, unlike Jira Cloud: an autolink prefix has to be the Jira project KEY, which\n\t// is what a commit message or branch name carries (`PROJ-123`). `/rest/api/2/project` reports no key — see\n\t// `getProviderProjectsForResources`, which falls back to the name because JQL accepts it — so the only\n\t// prefix this class could build is the display name, which matches nothing and yields a `/browse/` URL that\n\t// is not an issue. Registering that would be worse than registering none. Restore the override once the SDK\n\t// surfaces the project key (GKDEV-3629's sibling gap).\n\n\tprotected override async getProviderAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: JiraServerResourceDescriptor,\n\t): Promise<Account | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst user = await api.getJiraServerCurrentUser(toTokenWithInfo(this.id, session), this.apiBaseUrlFor(session));\n\n\t\tif (user == null) return undefined;\n\t\treturn toAccount(user, this);\n\t}\n\n\tprotected override getProviderResourcesForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_force?: boolean,\n\t): Promise<JiraServerResourceDescriptor[] | undefined> {\n\t\t// Synthesized from the configured host rather than fetched, so there is nothing to cache or force.\n\t\treturn Promise.resolve([this.resourceFor(session)]);\n\t}\n\n\t/** Expires, and is dropped on a re-sync, so a project created or deleted mid-session is picked up (#5907). */\n\tprivate readonly _projects = new DiscoveryCache<JiraServerProjectDescriptor[]>();\n\tprotected override async getProviderProjectsForResources(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: JiraServerResourceDescriptor[],\n\t\tforce: boolean = false,\n\t): Promise<JiraServerProjectDescriptor[] | undefined> {\n\t\t// Every resource here is this instance (see `getProviderResourcesForUser`), so one read serves them\n\t\t// all; a caller that passes none is asking for nothing.\n\t\tif (resources.length === 0) return [];\n\n\t\tconst cacheKey = this.projectsCacheKey(session);\n\t\tconst cached = this._projects.get(cacheKey);\n\t\tif (cached != null && !force) return cached;\n\n\t\tconst generation = this._projects.generation;\n\t\tconst api = await this.getProvidersApi();\n\t\tconst projects = await api.getJiraServerProjects(\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tthis.apiBaseUrlFor(session),\n\t\t);\n\t\tif (projects == null) return undefined;\n\n\t\tconst resourceId = this.resourceFor(session).id;\n\t\tconst descriptors = projects.map<JiraServerProjectDescriptor>(p => ({\n\t\t\tid: p.id,\n\t\t\t// The display name, NOT what the reads address the project by. `/rest/api/2/project` reports no\n\t\t\t// project key (GKDEV-3629's sibling gap) and the SDK's `JiraServerProject` carries only `id` and\n\t\t\t// `name`, so there is no key to put here; the reads below use `id` instead, because JQL resolves a\n\t\t\t// `project = \"<value>\"` clause against key before name, and a display name that collides with\n\t\t\t// ANOTHER project's key would silently return that project's issues.\n\t\t\tkey: p.name,\n\t\t\tname: p.name,\n\t\t\tresourceId: resourceId,\n\t\t}));\n\n\t\tthis._projects.set(cacheKey, descriptors, { generation: generation });\n\n\t\treturn descriptors;\n\t}\n\n\tprotected override async getProviderIssuesForProject(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: JiraServerProjectDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.getProviderIssuesForProjectWithTruncation(session, project, options))?.values;\n\t}\n\n\tprotected override async getProviderIssuesForProjectWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: JiraServerProjectDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<ProjectIssuesDrain | undefined> {\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst api = await this.getProvidersApi();\n\t\tconst baseUrl = this.apiBaseUrlFor(session);\n\n\t\t// Mirrors Jira Cloud's drain (see `jira.ts`): page to a defensive backstop, and report `truncated` plus\n\t\t// a structured failure rather than discarding an already-fetched prefix, so the facade can warn and set\n\t\t// fetchFailed while still publishing what was read.\n\t\t// The numeric project id, not the name: JQL resolves `project = \"<value>\"` against key first, so a\n\t\t// display name that matches another project's key reads that project's issues instead. A Jira project\n\t\t// key must begin with a letter, so a purely numeric value can only be an id.\n\t\tconst projectJqlKey = project.id;\n\t\tconst projectScope = {\n\t\t\tproviderId: this.id,\n\t\t\tresourceId: project.resourceId,\n\t\t\tprojectId: project.id,\n\t\t};\n\t\tconst states = toProviderIssueStates(options?.state);\n\t\tconst drainIssues = async (scope: {\n\t\t\tauthorLogin?: string;\n\t\t\tassigneeLogins?: string[];\n\t\t\tmentionLogin?: string;\n\t\t}): Promise<JiraServerProjectIssuesDrain<ProviderIssue>> => {\n\t\t\tconst collected: ProviderIssue[] = [];\n\t\t\tlet cursor: string | undefined;\n\t\t\tlet status: JiraServerProjectIssuesDrain<ProviderIssue>['status'] = 'complete';\n\t\t\tlet metadata: CollectionMetadata | undefined;\n\t\t\tfor (let i = 0; i < maxPagesPerRequest; i++) {\n\t\t\t\tlet result: Awaited<ReturnType<typeof api.getJiraServerIssuesForProjectPaged>> | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tresult = await api.getJiraServerIssuesForProjectPaged(tokenWithInfo, baseUrl, projectJqlKey, {\n\t\t\t\t\t\t...scope,\n\t\t\t\t\t\tcursor: cursor,\n\t\t\t\t\t\tstates: states,\n\t\t\t\t\t\tsort: options?.sort,\n\t\t\t\t\t});\n\t\t\t\t} catch (ex) {\n\t\t\t\t\t// A project this connection can no longer see (deleted, or its browse permission removed) holds\n\t\t\t\t\t// no issues for it, and the project list that named it is stale: drop that list so the next read\n\t\t\t\t\t// re-reads it, instead of failing the whole provider on every read until a restart (#5907).\n\t\t\t\t\tif (collected.length === 0 && isJiraMissingProjectError(ex)) {\n\t\t\t\t\t\tLogger.warn(\n\t\t\t\t\t\t\t`Jira Server project '${project.name}' (${project.id}) no longer exists or is not visible`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis._projects.delete(this.projectsCacheKey(session));\n\t\t\t\t\t\treturn { issues: [], status: 'complete' };\n\t\t\t\t\t}\n\n\t\t\t\t\t// A page failure after the first leaves the drained prefix intact; record it at the project\n\t\t\t\t\t// scope instead of re-throwing. With nothing fetched yet the original throw is preserved, so\n\t\t\t\t\t// the caller sees a hard error rather than an empty partial success.\n\t\t\t\t\tif (collected.length === 0) throw ex;\n\n\t\t\t\t\tstatus = 'incomplete';\n\t\t\t\t\tmetadata = mergeCollectionMetadata(metadata, {\n\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\tfailures: [toCollectionScopeFailure(projectScope, ex)],\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (result == null) {\n\t\t\t\t\tif (cursor == null) break;\n\n\t\t\t\t\tstatus = 'incomplete';\n\t\t\t\t\tmetadata = mergeCollectionMetadata(metadata, {\n\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\tfailures: [\n\t\t\t\t\t\t\ttoCollectionScopeFailure(\n\t\t\t\t\t\t\t\tprojectScope,\n\t\t\t\t\t\t\t\tnew Error('Jira Server returned no page after advertising a continuation'),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t],\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcollected.push(...result.data);\n\t\t\t\tif (!result.hasMore) break;\n\n\t\t\t\t// More pages are claimed but no advancing cursor came back: the drain can't continue, so flag it\n\t\t\t\t// rather than stopping silently.\n\t\t\t\tif (result.nextCursor == null || result.nextCursor === cursor) {\n\t\t\t\t\tstatus = 'incomplete';\n\t\t\t\t\tmetadata = mergeCollectionMetadata(metadata, {\n\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\tfailures: [\n\t\t\t\t\t\t\ttoCollectionScopeFailure(\n\t\t\t\t\t\t\t\tprojectScope,\n\t\t\t\t\t\t\t\tnew Error('Jira Server returned no advancing issue continuation'),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t],\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcursor = result.nextCursor;\n\t\t\t\t// Pages remain but this was the last allowed iteration: the backstop stopped the drain, which a\n\t\t\t\t// narrower scope would avoid.\n\t\t\t\tif (i === maxPagesPerRequest - 1) {\n\t\t\t\t\tstatus = 'backstop';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { issues: collected, status: status, metadata: metadata };\n\t\t};\n\n\t\t/**\n\t\t * Every clause is scoped by the HANDLE, and `options.userId` is deliberately ignored here — the one\n\t\t * place this provider diverges from Jira Cloud's, which applies it to `assignee`/`creator` (#5857).\n\t\t *\n\t\t * The two are not interchangeable because `Account.id` means something different per deployment. On\n\t\t * Cloud it is the `accountId`, which JQL resolves, so scoping by it fixes the deactivated-account case\n\t\t * where the display name no longer resolves. On Server it is the user KEY (`JIRAUSER10224`), which JQL\n\t\t * does not resolve at all: measured against a live Jira Server 8.20.13 site, `assignee in\n\t\t * (\"JIRAUSER10224\")` returns 0 with `\"The value 'JIRAUSER10224' does not exist for the field\n\t\t * 'assignee'\"` — the identical warning a genuinely nonexistent user produces — while the username and\n\t\t * the display name both return the real 4.\n\t\t *\n\t\t * So applying `userId` here would silently empty the read rather than harden it. Do not \"fix\" this\n\t\t * asymmetry to match Cloud without re-measuring against a Server instance.\n\t\t *\n\t\t * The handle itself is already the right one: `provider-apis` 0.60.0 maps `Account.username` from the\n\t\t * Server payload's `name` (falling back to `displayName` when absent), so these clauses are scoped by the\n\t\t * real username rather than a display name (GKDEV-3629). That is what makes the `mention` clause work at\n\t\t * all — it is a free-text `comment ~ \"...\"` over comment bodies, and a Jira mention is stored as\n\t\t * `[~username]`, which a display name never matches.\n\t\t */\n\t\tconst getSearchedUserIssuesForFilter = async (\n\t\t\tuser: string,\n\t\t\tfilter: IssueFilter,\n\t\t): Promise<JiraServerProjectIssuesDrain<IssueShape>> => {\n\t\t\tconst result = await drainIssues({\n\t\t\t\tauthorLogin: filter === IssueFilter.Author ? user : undefined,\n\t\t\t\tassigneeLogins: filter === IssueFilter.Assignee ? [user] : undefined,\n\t\t\t\tmentionLogin: filter === IssueFilter.Mention ? user : undefined,\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tissues: result.issues\n\t\t\t\t\t.map(issue => toIssueShape(issue, this, { projection: 'project' }))\n\t\t\t\t\t.filter((r): r is IssueShape => r !== undefined),\n\t\t\t\tstatus: result.status,\n\t\t\t\tmetadata: result.metadata,\n\t\t\t};\n\t\t};\n\n\t\tif (options?.user != null) {\n\t\t\tconst user = options.user;\n\t\t\t// A resolved user always scopes the read, defaulting to \"my issues\" when no explicit filters are\n\t\t\t// given — otherwise it would fall through to the unscoped fetch and return the whole project (#5438).\n\t\t\tconst filters = options.filters?.length ? options.filters : [IssueFilter.Assignee];\n\t\t\tconst settled = await Promise.allSettled(\n\t\t\t\tfilters.map(filter => getSearchedUserIssuesForFilter(user, filter)),\n\t\t\t);\n\n\t\t\t// Every branch rejected: the read failed outright, so propagate the first reason as-is (not wrapped)\n\t\t\t// to keep its auth/rate-limit classification, and log the rest, which would otherwise be discarded.\n\t\t\tif (settled.every(r => r.status === 'rejected')) {\n\t\t\t\tfor (let i = 1; i < settled.length; i++) {\n\t\t\t\t\tconst outcome = settled[i];\n\t\t\t\t\tif (outcome.status === 'rejected') {\n\t\t\t\t\t\tLogger.error(\n\t\t\t\t\t\t\toutcome.reason,\n\t\t\t\t\t\t\t`getProviderIssuesForProjectWithTruncation: filter '${filters[i]}' failed`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow settled[0].status === 'rejected' ? settled[0].reason : new Error('Jira Server issue read failed');\n\t\t\t}\n\n\t\t\tlet truncated = false;\n\t\t\tlet metadata: CollectionMetadata | undefined;\n\t\t\tconst resultsById = new Map<string, IssueShape>();\n\t\t\tfor (let i = 0; i < settled.length; i++) {\n\t\t\t\tconst outcome = settled[i];\n\t\t\t\tconst filter = filters[i];\n\t\t\t\t// One rejected branch with a succeeding sibling means this project's issues are incomplete: keep\n\t\t\t\t// the sibling results and record a per-filter failure so the facade can warn on it specifically.\n\t\t\t\tif (outcome.status !== 'fulfilled') {\n\t\t\t\t\t// Identical for every branch, so degrading it would report one failure per filter for a\n\t\t\t\t\t// single invalid call — see `throwIfCallerContractError`.\n\t\t\t\t\tthrowIfCallerContractError(outcome.reason);\n\n\t\t\t\t\ttruncated = true;\n\t\t\t\t\tconst failure = toCollectionScopeFailure(projectScope, outcome.reason);\n\t\t\t\t\tmetadata = mergeCollectionMetadata(metadata, {\n\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\tfailures: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t...failure,\n\t\t\t\t\t\t\t\tmessage: `Issue filter '${filter}' could not be read${\n\t\t\t\t\t\t\t\t\tfailure.message != null ? `: ${failure.message}` : ''\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (outcome.value.status !== 'complete') {\n\t\t\t\t\ttruncated = true;\n\t\t\t\t}\n\t\t\t\tif (outcome.value.metadata != null) {\n\t\t\t\t\tmetadata = mergeCollectionMetadata(metadata, outcome.value.metadata);\n\t\t\t\t}\n\t\t\t\tfor (const resultIssue of outcome.value.issues) {\n\t\t\t\t\tif (!resultsById.has(resultIssue.id)) {\n\t\t\t\t\t\tresultsById.set(resultIssue.id, resultIssue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// `recovery: 'none'` for the whole set: the filter branches merge here, so even a pure backstop in one\n\t\t\t// branch is not fixable by narrowing this read's scope.\n\t\t\treturn truncated\n\t\t\t\t? { values: [...resultsById.values()], truncated: true, recovery: 'none', metadata: metadata }\n\t\t\t\t: { values: [...resultsById.values()], truncated: false, metadata: metadata };\n\t\t}\n\n\t\tconst unscoped = await drainIssues({});\n\t\tconst values = unscoped.issues\n\t\t\t.map(issue => toIssueShape(issue, this, { projection: 'project' }))\n\t\t\t.filter((result): result is IssueShape => result !== undefined);\n\t\treturn unscoped.status !== 'complete'\n\t\t\t? {\n\t\t\t\t\tvalues: values,\n\t\t\t\t\ttruncated: true,\n\t\t\t\t\trecovery: unscoped.status === 'backstop' ? 'narrow-scope' : 'none',\n\t\t\t\t\tmetadata: unscoped.metadata,\n\t\t\t\t}\n\t\t\t: { values: values, truncated: false, metadata: unscoped.metadata };\n\t}\n\n\tprotected override async searchProviderMyIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources?: JiraServerResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.searchProviderMyIssuesWithTruncation(session, resources, cancellation))?.values;\n\t}\n\n\t/**\n\t * Account-wide \"my issues\" for this instance, drained to the backstop and reporting whether it got there.\n\t *\n\t * The override exists for the same reason the project drain reports `status`: the default\n\t * implementation wraps whatever the normalized read returned as `truncated: false`, so a run that stopped\n\t * at `maxPagesPerRequest` with pages left, or on a continuation the server never advanced, would be\n\t * published as a complete account. Cancellation is NOT truncation — the caller asked for the stop and\n\t * already knows the prefix is partial — so it breaks without setting the flag.\n\t */\n\tprotected override async searchProviderMyIssuesWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resources?: JiraServerResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyIssuesOptions,\n\t): Promise<AccountWideIssuesResult | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst states = toProviderIssueStates(options?.state);\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst baseUrl = this.apiBaseUrlFor(session);\n\n\t\t// Errors propagate, unlike Jira Cloud's sibling. Cloud swallows per resource because it loops over the\n\t\t// account's many sites and one bad site must not discard the others; this connection addresses exactly\n\t\t// one instance, so there is no sibling to protect and swallowing would turn every failure — an expired\n\t\t// token, an unreachable host — into an empty success. `searchMyIssuesWithTruncationResult` recovers the\n\t\t// throw into `{ error }`, which is what lets the caller warn instead of reporting \"no issues\".\n\t\t// Only the provider: the instance is this connection's single resource, so naming it would publish a\n\t\t// failure of the whole connection as one confined to a sub-scope (see `ProviderWarning.scope`).\n\t\tconst accountScope = { providerId: this.id };\n\t\tconst results: IssueShape[] = [];\n\t\tlet cursor: string | undefined;\n\t\tlet truncated = false;\n\t\tlet metadata: CollectionMetadata | undefined;\n\n\t\tconst stopIncomplete = (reason: string) => {\n\t\t\ttruncated = true;\n\t\t\tmetadata = mergeCollectionMetadata(metadata, {\n\t\t\t\tcompleteness: 'partial',\n\t\t\t\tfailures: [toCollectionScopeFailure(accountScope, new Error(reason))],\n\t\t\t});\n\t\t};\n\n\t\tfor (let i = 0; i < maxPagesPerRequest; i++) {\n\t\t\tif (cancellation?.aborted) break;\n\n\t\t\tconst page = await api.getJiraServerIssuesForCurrentUser(tokenWithInfo, baseUrl, {\n\t\t\t\tcursor: cursor,\n\t\t\t\tstates: states,\n\t\t\t});\n\t\t\tif (page == null) {\n\t\t\t\t// Nothing fetched yet and no page is an empty account, not a failure; after a continuation it\n\t\t\t\t// means the server dropped the drain mid-way.\n\t\t\t\tif (cursor != null) {\n\t\t\t\t\tstopIncomplete('Jira Server returned no page after advertising a continuation');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tresults.push(\n\t\t\t\t...page.data\n\t\t\t\t\t.map(issue => toIssueShape(issue, this, { projection: 'account' }))\n\t\t\t\t\t.filter((r): r is IssueShape => r != null),\n\t\t\t);\n\n\t\t\tif (!page.hasMore) break;\n\n\t\t\t// More pages are claimed but no advancing cursor came back: the drain can't continue, so flag it\n\t\t\t// rather than stopping silently.\n\t\t\tif (page.nextCursor == null || page.nextCursor === cursor) {\n\t\t\t\tstopIncomplete('Jira Server returned no advancing issue continuation');\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcursor = page.nextCursor;\n\t\t\t// Pages remain but this was the last allowed iteration: the backstop stopped the drain.\n\t\t\tif (i === maxPagesPerRequest - 1) {\n\t\t\t\tstopIncomplete(\n\t\t\t\t\t`Jira Server account-wide issue drain stopped at the ${maxPagesPerRequest}-page backstop`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn { values: results, truncated: truncated, metadata: metadata };\n\t}\n\n\tprotected override async getProviderLinkedIssueOrPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: JiraServerResourceDescriptor,\n\t\t{ key }: { id: string; key: string },\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst issue = await api.getJiraServerIssue(toTokenWithInfo(this.id, session), this.apiBaseUrlFor(session), key);\n\t\treturn issue != null ? toIssueShape(issue, this, { projection: 'point' }) : undefined;\n\t}\n\n\tprotected override async getProviderIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: JiraServerResourceDescriptor,\n\t\tid: string,\n\t): Promise<Issue | undefined> {\n\t\treturn this.readIssue(session, id, 'point');\n\t}\n\n\tprivate async readIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\tid: string,\n\t\tprojection: IssueProjection,\n\t): Promise<Issue | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst apiResult = await api.getJiraServerIssue(\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tthis.apiBaseUrlFor(session),\n\t\t\tid,\n\t\t);\n\t\tconst issue = apiResult != null ? toIssueShape(apiResult, this, { projection: projection }) : undefined;\n\t\treturn issue != null ? { ...issue, type: 'issue' } : undefined;\n\t}\n\n\t/**\n\t * The point read behind `getIssuesBatch`'s tracker targets (#5872). `resourceId` is this connection's single\n\t * synthetic resource — the host itself, see {@link JiraServerResourceDescriptor} — so it selects nothing further\n\t * here: the host was chosen upstream by `domain` (or the connection's configured domain) and the request is\n\t * addressed to the SESSION's base URL like every other read. No `resourceUrl` is needed either, unlike Jira\n\t * Cloud: its REST `self` link is an API endpoint, whereas `getJiraServerIssue` builds the browser link from\n\t * the base URL it was addressed to. A key that names no issue resolves to `undefined`, a proven absence.\n\t */\n\tprotected override getProviderIssueByResourceId(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resourceId: string,\n\t\tid: string,\n\t\t_resourceUrl: string | undefined,\n\t): Promise<Issue | undefined> {\n\t\treturn this.readIssue(session, id, 'batch');\n\t}\n\n\t/**\n\t * Caches are keyed by the ADDRESS the read was made against as well as the token: one integration instance\n\t * exists per configured host and two hosts can hold the same token, so a token-only key would serve one\n\t * host's projects for the other — and the host alone is not enough either, because a connection re-pointed\n\t * to another context path on the same host keeps its token and would otherwise be served the old path's\n\t * projects.\n\t */\n\tprivate projectsCacheKey(session: ProviderAuthenticationSession): string {\n\t\treturn `${this.apiBaseUrlFor(session)}:${session.accessToken}`;\n\t}\n\n\toverride invalidateDiscoveryCaches(): void {\n\t\tthis._projects.clear();\n\t}\n\n\tprotected override providerOnDisconnect(): void {\n\t\tthis._projects.clear();\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAyCA,MAAM,WAAW,kBAAA;AACjB,MAAM,eAAe,OAAO,OAAO;CAAE,IAAI,SAAS;CAAI,QAAQ,SAAS;AAAO,CAAC;AAC/E,MAAM,qBAAqB;AAmB3B,IAAa,wBAAb,cAA2C,kBAAiE;CAWzF;CAVlB,eAAqE;CACrE,K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;;CASA,iBAAyB,SAAgD;EACxE,OAAO,GAAG,KAAK,cAAc,OAAO,EAAE,GAAG,QAAQ;CAClD;CAEA,4BAA2C;EAC1C,KAAK,UAAU,MAAM;CACtB;CAEA,uBAAgD;EAC/C,KAAK,UAAU,MAAM;CACtB;AACD"}
1
+ {"version":3,"file":"jira-server.js","names":[],"sources":["../../../../../plus/integrations/src/providers/jira-server.ts"],"sourcesContent":["import type { CollectionMetadata } from '@gitkraken/provider-apis';\nimport { JIRA_MAX_PROJECT_KEYS_PER_REQUEST } from '@gitkraken/provider-apis';\nimport type { Account } from '@gitlens/git/models/author.js';\nimport type { Issue, IssueProjection, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { IssueResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { Emitter } from '@gitlens/utils/event.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider.js';\nimport type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService.js';\nimport type { ProviderAuthenticationSession } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { toCollectionScopeFailure } from '../collectionMetadata.js';\nimport { IssuesSelfManagedHostIntegrationId } from '../constants.js';\nimport type { IntegrationServiceContext } from '../context.js';\nimport type { IntegrationConnectionChangeEvent } from '../integrationService.js';\nimport type { IntegrationKey } from '../models/integration.js';\nimport type {\n\tAccountWideIssuesResult,\n\tIssuesForProjectOptions,\n\tProjectIssuesDrain,\n\tProjectIssuesRequest,\n\tSearchMyIssuesOptions,\n} from '../models/issueReads.js';\nimport { groupProjectIssuesSearches, IssuesIntegration } from '../models/issuesIntegration.js';\nimport { areDomainsOnSameHost, baseUrlFromDomain } from '../utils/domain.utils.js';\nimport { providersMetadata, toAccount, toIssueShape, toProviderIssueStates } from './models.js';\nimport { isJiraMissingProjectError } from './providerErrors.js';\nimport type { ProvidersApi } from './providersApi.js';\nimport { DiscoveryCache } from './utils/discoveryCache.js';\nimport type { JiraDrainOptions, JiraIssuePageFetcher } from './utils/jiraIssueDrains.js';\nimport {\n\tdrainJiraIssues,\n\treadUserScopedJiraIssues,\n\tsearchJiraProjectIssues,\n\ttoUniqueJiraIssueShapes,\n} from './utils/jiraIssueDrains.js';\nimport { mergeCollectionMetadata } from './utils/providerPaging.js';\n\nconst metadata = providersMetadata[IssuesSelfManagedHostIntegrationId.JiraServer];\nconst authProvider = Object.freeze({ id: metadata.id, scopes: metadata.scopes });\nconst maxPagesPerRequest = 10;\n\n/**\n * Every clause is scoped by the HANDLE, and `options.userId` is deliberately ignored here — the one\n * place this provider diverges from Jira Cloud's, which applies it to `assignee`/`creator` (#5857).\n *\n * The two are not interchangeable because `Account.id` means something different per deployment. On\n * Cloud it is the `accountId`, which JQL resolves, so scoping by it fixes the deactivated-account case\n * where the display name no longer resolves. On Server it is the user KEY (`JIRAUSER10224`), which JQL\n * does not resolve at all: measured against a live Jira Server 8.20.13 site, `assignee in\n * (\"JIRAUSER10224\")` returns 0 with `\"The value 'JIRAUSER10224' does not exist for the field\n * 'assignee'\"` — the identical warning a genuinely nonexistent user produces — while the username and\n * the display name both return the real 4.\n *\n * So applying `userId` here would silently empty the read rather than harden it. Do not \"fix\" this\n * asymmetry to match Cloud without re-measuring against a Server instance.\n *\n * The handle itself is already the right one: `provider-apis` 0.60.0 maps `Account.username` from the\n * Server payload's `name` (falling back to `displayName` when absent), so these clauses are scoped by the\n * real username rather than a display name (GKDEV-3629). That is what makes the `mention` clause work at\n * all — it is a free-text `comment ~ \"...\"` over comment bodies, and a Jira mention is stored as\n * `[~username]`, which a display name never matches.\n */\nfunction toUserIdentities(user: string): { userField: string; mention: string } {\n\treturn { userField: user, mention: user };\n}\n\n/**\n * The single resource a Jira Server connection has: the instance itself.\n *\n * Jira Cloud's account spans many sites, so its resources come from an API call that lists them. A\n * self-hosted instance IS the one site the connection addresses, so there is nothing to enumerate — this\n * descriptor is synthesized from the configured host. Modelling it as a resource anyway keeps the\n * resource → project contract of {@link IssuesIntegration} intact, so every tracker read (`listOrgs`,\n * `listProjects`, `listIssueTrackerIssuesPage`) works unchanged.\n */\nexport interface JiraServerResourceDescriptor extends IssueResourceDescriptor {\n\turl: string;\n}\n\nexport interface JiraServerProjectDescriptor extends IssueResourceDescriptor {\n\tresourceId: string;\n}\n\nexport class JiraServerIntegration extends IssuesIntegration<IssuesSelfManagedHostIntegrationId.JiraServer> {\n\treadonly authProvider: IntegrationAuthenticationProviderDescriptor = authProvider;\n\treadonly id = IssuesSelfManagedHostIntegrationId.JiraServer;\n\tprotected readonly key: IntegrationKey<IssuesSelfManagedHostIntegrationId.JiraServer>;\n\treadonly name: string = 'Jira Data Center';\n\n\tconstructor(\n\t\tctx: IntegrationServiceContext,\n\t\tauthenticationService: IntegrationAuthenticationService,\n\t\tgetProvidersApi: () => Promise<ProvidersApi>,\n\t\tdidChangeConnection: Emitter<IntegrationConnectionChangeEvent>,\n\t\tprivate readonly _domain: string,\n\t) {\n\t\tsuper(ctx, authenticationService, getProvidersApi, didChangeConnection);\n\t\tthis.key = `${this.id}:${this._domain}`;\n\t}\n\n\tget domain(): string {\n\t\treturn this._domain;\n\t}\n\n\t/**\n\t * The URL every request for this connection is addressed to, built from the SESSION's domain rather than\n\t * the integration's.\n\t *\n\t * `this.domain` is the host-keyed identity — `IntegrationService.get()` runs it through `hostFromDomain`\n\t * so one host can't build two instances — which means it has had any context path stripped, and so has\n\t * `session.domain`, which is stored as that same normalized host. Jira Data Center officially supports\n\t * being mounted below a context path (`https://jira.example.com/jira`), so the address comes from\n\t * {@link ProviderAuthenticationSession.baseUrl}, which carries the configured value verbatim; it falls\n\t * back to the host when the backend reported nothing more, which is the common case.\n\t *\n\t * Takes the session rather than reading `_session` so a per-connection (multi-account) read is addressed\n\t * to the host of the connection it resolved, not to whichever one happens to be current.\n\t */\n\tprotected apiBaseUrlFor(session: ProviderAuthenticationSession | undefined): string {\n\t\tconst configured = baseUrlFromDomain(session?.baseUrl, session?.protocol);\n\t\t// A `baseUrl` from another host is not this connection's address — refuse it rather than routing this\n\t\t// integration's reads somewhere its key never named.\n\t\tif (configured != null && areDomainsOnSameHost(session?.baseUrl, this.domain)) return configured;\n\n\t\treturn (\n\t\t\tbaseUrlFromDomain(session?.domain, session?.protocol) ??\n\t\t\tbaseUrlFromDomain(this.domain, session?.protocol) ??\n\t\t\t`${session?.protocol ?? 'https:'}//${this.domain}`\n\t\t);\n\t}\n\n\t/** The one resource this connection has — see {@link JiraServerResourceDescriptor}. */\n\tprivate resourceFor(session: ProviderAuthenticationSession | undefined): JiraServerResourceDescriptor {\n\t\treturn { id: this.domain, key: this.domain, name: this.domain, url: this.apiBaseUrlFor(session) };\n\t}\n\n\t// No `autolinks()` override, unlike Jira Cloud: an autolink prefix has to be the Jira project KEY, which\n\t// is what a commit message or branch name carries (`PROJ-123`). `/rest/api/2/project` reports no key — see\n\t// `getProviderProjectsForResources`, which falls back to the name because JQL accepts it — so the only\n\t// prefix this class could build is the display name, which matches nothing and yields a `/browse/` URL that\n\t// is not an issue. Registering that would be worse than registering none. Restore the override once the SDK\n\t// surfaces the project key (GKDEV-3629's sibling gap).\n\n\tprotected override async getProviderAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: JiraServerResourceDescriptor,\n\t): Promise<Account | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst user = await api.getJiraServerCurrentUser(toTokenWithInfo(this.id, session), this.apiBaseUrlFor(session));\n\n\t\tif (user == null) return undefined;\n\t\treturn toAccount(user, this);\n\t}\n\n\tprotected override getProviderResourcesForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_force?: boolean,\n\t): Promise<JiraServerResourceDescriptor[] | undefined> {\n\t\t// Synthesized from the configured host rather than fetched, so there is nothing to cache or force.\n\t\treturn Promise.resolve([this.resourceFor(session)]);\n\t}\n\n\t/** Expires, and is dropped on a re-sync, so a project created or deleted mid-session is picked up (#5907). */\n\tprivate readonly _projects = new DiscoveryCache<JiraServerProjectDescriptor[]>();\n\tprotected override async getProviderProjectsForResources(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: JiraServerResourceDescriptor[],\n\t\tforce: boolean = false,\n\t): Promise<JiraServerProjectDescriptor[] | undefined> {\n\t\t// Every resource here is this instance (see `getProviderResourcesForUser`), so one read serves them\n\t\t// all; a caller that passes none is asking for nothing.\n\t\tif (resources.length === 0) return [];\n\n\t\tconst cacheKey = this.projectsCacheKey(session);\n\t\tconst cached = this._projects.get(cacheKey);\n\t\tif (cached != null && !force) return cached;\n\n\t\tconst generation = this._projects.generation;\n\t\tconst api = await this.getProvidersApi();\n\t\tconst projects = await api.getJiraServerProjects(\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tthis.apiBaseUrlFor(session),\n\t\t);\n\t\tif (projects == null) return undefined;\n\n\t\tconst resourceId = this.resourceFor(session).id;\n\t\tconst descriptors = projects.map<JiraServerProjectDescriptor>(p => ({\n\t\t\tid: p.id,\n\t\t\t// The display name, NOT what the reads address the project by. `/rest/api/2/project` reports no\n\t\t\t// project key (GKDEV-3629's sibling gap) and the SDK's `JiraServerProject` carries only `id` and\n\t\t\t// `name`, so there is no key to put here; the reads below use `id` instead, because JQL resolves a\n\t\t\t// `project = \"<value>\"` clause against key before name, and a display name that collides with\n\t\t\t// ANOTHER project's key would silently return that project's issues.\n\t\t\tkey: p.name,\n\t\t\tname: p.name,\n\t\t\tresourceId: resourceId,\n\t\t}));\n\n\t\tthis._projects.set(cacheKey, descriptors, { generation: generation });\n\n\t\treturn descriptors;\n\t}\n\n\tprotected override async getProviderIssuesForProject(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: JiraServerProjectDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.getProviderIssuesForProjectWithTruncation(session, project, options))?.values;\n\t}\n\n\tprotected override async getProviderIssuesForProjectWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: JiraServerProjectDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<ProjectIssuesDrain | undefined> {\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst api = await this.getProvidersApi();\n\t\tconst baseUrl = this.apiBaseUrlFor(session);\n\n\t\t// The same drain as Jira Cloud's (`jiraIssueDrains.ts`): page to a defensive backstop, and report `truncated`\n\t\t// plus a structured failure rather than discarding an already-fetched prefix.\n\t\tconst states = toProviderIssueStates(options?.state);\n\t\t// The numeric project id, not the name: JQL resolves `project = \"<value>\"` against key first, so a display\n\t\t// name that matches another project's key reads that project's issues instead. A Jira project key must begin\n\t\t// with a letter, so a purely numeric value can only be an id.\n\t\tconst fetchPage: JiraIssuePageFetcher = (scope, cursor) =>\n\t\t\tapi.getJiraServerIssuesForProjectPaged(tokenWithInfo, baseUrl, project.id, {\n\t\t\t\t...scope,\n\t\t\t\tcursor: cursor,\n\t\t\t\tstates: states,\n\t\t\t\tsort: options?.sort,\n\t\t\t});\n\t\tconst drainOptions: JiraDrainOptions = {\n\t\t\tmaxPages: maxPagesPerRequest,\n\t\t\tfailureScope: { providerId: this.id, resourceId: project.resourceId, projectId: project.id },\n\t\t\tproviderName: 'Jira Server',\n\t\t\t// A project this connection can no longer see (deleted, or its browse permission removed) holds\n\t\t\t// no issues for it, and the project list that named it is stale: drop that list so the next read\n\t\t\t// re-reads it, instead of failing the whole provider on every read until a restart (#5907).\n\t\t\tisEmptyFailure: ex => {\n\t\t\t\tif (!isJiraMissingProjectError(ex)) return false;\n\n\t\t\t\tLogger.warn(`Jira Server project '${project.name}' (${project.id}) no longer exists or is not visible`);\n\t\t\t\tthis._projects.delete(this.projectsCacheKey(session));\n\t\t\t\treturn true;\n\t\t\t},\n\t\t};\n\n\t\tif (options?.user != null) {\n\t\t\tconst read = await readUserScopedJiraIssues(\n\t\t\t\tfetchPage,\n\t\t\t\toptions.filters,\n\t\t\t\ttoUserIdentities(options.user),\n\t\t\t\tdrainOptions,\n\t\t\t);\n\t\t\tconst values = toUniqueJiraIssueShapes(read.issues, this);\n\t\t\t// `recovery: 'none'` for the whole set: the filter branches merge here, so even a pure backstop in one\n\t\t\t// branch is not fixable by narrowing this read's scope.\n\t\t\treturn read.truncated\n\t\t\t\t? { values: values, truncated: true, recovery: 'none', metadata: read.metadata }\n\t\t\t\t: { values: values, truncated: false, metadata: read.metadata };\n\t\t}\n\n\t\tconst unscoped = await drainJiraIssues(fetchPage, {}, drainOptions);\n\t\tconst values = unscoped.issues\n\t\t\t.map(issue => toIssueShape(issue, this, { projection: 'project' }))\n\t\t\t.filter((result): result is IssueShape => result !== undefined);\n\t\treturn unscoped.status !== 'complete'\n\t\t\t? {\n\t\t\t\t\tvalues: values,\n\t\t\t\t\ttruncated: true,\n\t\t\t\t\trecovery: unscoped.status === 'backstop' ? 'narrow-scope' : 'none',\n\t\t\t\t\tmetadata: unscoped.metadata,\n\t\t\t\t}\n\t\t\t: { values: values, truncated: false, metadata: unscoped.metadata };\n\t}\n\n\t/**\n\t * Searches the instance's projects together for a user-scoped read, as Jira Cloud does per site: one JQL names\n\t * up to {@link JIRA_MAX_PROJECT_KEYS_PER_REQUEST} projects of one user scope. An unscoped read stays per project,\n\t * since its backstop is reported as `narrow-scope` per project.\n\t */\n\tprotected override getProjectIssuesSearches(\n\t\trequests: readonly ProjectIssuesRequest<JiraServerProjectDescriptor>[],\n\t): number[][] | undefined {\n\t\treturn groupProjectIssuesSearches(\n\t\t\trequests,\n\t\t\t({ options }) =>\n\t\t\t\toptions.user != null\n\t\t\t\t\t? [options.user, options.sort ?? '', options.state ?? '', options.filters?.join(',') ?? ''].join(\n\t\t\t\t\t\t\t'\\0',\n\t\t\t\t\t\t)\n\t\t\t\t\t: undefined,\n\t\t\tJIRA_MAX_PROJECT_KEYS_PER_REQUEST,\n\t\t);\n\t}\n\n\tprotected override async searchProviderProjectIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\trequests: readonly ProjectIssuesRequest<JiraServerProjectDescriptor>[],\n\t): Promise<IssueShape[][] | undefined> {\n\t\t// Every request of a search shares its user scope (see `getProjectIssuesSearches`).\n\t\tconst { options } = requests[0];\n\t\tif (options.user == null) return undefined;\n\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst api = await this.getProvidersApi();\n\t\tconst baseUrl = this.apiBaseUrlFor(session);\n\t\t// By numeric id, as the per-project read names them (see there).\n\t\tconst projectIds = requests.map(request => request.project.id);\n\t\tconst states = toProviderIssueStates(options.state);\n\n\t\treturn searchJiraProjectIssues(\n\t\t\t(userScope, cursor) =>\n\t\t\t\tapi.getJiraServerIssuesForProjectsPaged(tokenWithInfo, baseUrl, projectIds, {\n\t\t\t\t\t...userScope,\n\t\t\t\t\tcursor: cursor,\n\t\t\t\t\tstates: states,\n\t\t\t\t\tsort: options.sort,\n\t\t\t\t}),\n\t\t\tprojectIds,\n\t\t\toptions.filters,\n\t\t\ttoUserIdentities(options.user),\n\t\t\t{ maxPages: maxPagesPerRequest, failureScope: { providerId: this.id }, providerName: 'Jira Server' },\n\t\t\tthis,\n\t\t);\n\t}\n\n\tprotected override async searchProviderMyIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources?: JiraServerResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.searchProviderMyIssuesWithTruncation(session, resources, cancellation))?.values;\n\t}\n\n\t/**\n\t * Account-wide \"my issues\" for this instance, drained to the backstop and reporting whether it got there.\n\t *\n\t * The override exists for the same reason the project drain reports `status`: the default\n\t * implementation wraps whatever the normalized read returned as `truncated: false`, so a run that stopped\n\t * at `maxPagesPerRequest` with pages left, or on a continuation the server never advanced, would be\n\t * published as a complete account. Cancellation is NOT truncation — the caller asked for the stop and\n\t * already knows the prefix is partial — so it breaks without setting the flag.\n\t */\n\tprotected override async searchProviderMyIssuesWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resources?: JiraServerResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyIssuesOptions,\n\t): Promise<AccountWideIssuesResult | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst states = toProviderIssueStates(options?.state);\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst baseUrl = this.apiBaseUrlFor(session);\n\n\t\t// Errors propagate, unlike Jira Cloud's sibling. Cloud swallows per resource because it loops over the\n\t\t// account's many sites and one bad site must not discard the others; this connection addresses exactly\n\t\t// one instance, so there is no sibling to protect and swallowing would turn every failure — an expired\n\t\t// token, an unreachable host — into an empty success. `searchMyIssuesWithTruncationResult` recovers the\n\t\t// throw into `{ error }`, which is what lets the caller warn instead of reporting \"no issues\".\n\t\t// Only the provider: the instance is this connection's single resource, so naming it would publish a\n\t\t// failure of the whole connection as one confined to a sub-scope (see `ProviderWarning.scope`).\n\t\tconst accountScope = { providerId: this.id };\n\t\tconst results: IssueShape[] = [];\n\t\tlet cursor: string | undefined;\n\t\tlet truncated = false;\n\t\tlet metadata: CollectionMetadata | undefined;\n\n\t\tconst stopIncomplete = (reason: string) => {\n\t\t\ttruncated = true;\n\t\t\tmetadata = mergeCollectionMetadata(metadata, {\n\t\t\t\tcompleteness: 'partial',\n\t\t\t\tfailures: [toCollectionScopeFailure(accountScope, new Error(reason))],\n\t\t\t});\n\t\t};\n\n\t\tfor (let i = 0; i < maxPagesPerRequest; i++) {\n\t\t\tif (cancellation?.aborted) break;\n\n\t\t\tconst page = await api.getJiraServerIssuesForCurrentUser(tokenWithInfo, baseUrl, {\n\t\t\t\tcursor: cursor,\n\t\t\t\tstates: states,\n\t\t\t});\n\t\t\tif (page == null) {\n\t\t\t\t// Nothing fetched yet and no page is an empty account, not a failure; after a continuation it\n\t\t\t\t// means the server dropped the drain mid-way.\n\t\t\t\tif (cursor != null) {\n\t\t\t\t\tstopIncomplete('Jira Server returned no page after advertising a continuation');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tresults.push(\n\t\t\t\t...page.data\n\t\t\t\t\t.map(issue => toIssueShape(issue, this, { projection: 'account' }))\n\t\t\t\t\t.filter((r): r is IssueShape => r != null),\n\t\t\t);\n\n\t\t\tif (!page.hasMore) break;\n\n\t\t\t// More pages are claimed but no advancing cursor came back: the drain can't continue, so flag it\n\t\t\t// rather than stopping silently.\n\t\t\tif (page.nextCursor == null || page.nextCursor === cursor) {\n\t\t\t\tstopIncomplete('Jira Server returned no advancing issue continuation');\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcursor = page.nextCursor;\n\t\t\t// Pages remain but this was the last allowed iteration: the backstop stopped the drain.\n\t\t\tif (i === maxPagesPerRequest - 1) {\n\t\t\t\tstopIncomplete(\n\t\t\t\t\t`Jira Server account-wide issue drain stopped at the ${maxPagesPerRequest}-page backstop`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn { values: results, truncated: truncated, metadata: metadata };\n\t}\n\n\tprotected override async getProviderLinkedIssueOrPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: JiraServerResourceDescriptor,\n\t\t{ key }: { id: string; key: string },\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst issue = await api.getJiraServerIssue(toTokenWithInfo(this.id, session), this.apiBaseUrlFor(session), key);\n\t\treturn issue != null ? toIssueShape(issue, this, { projection: 'point' }) : undefined;\n\t}\n\n\tprotected override async getProviderIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: JiraServerResourceDescriptor,\n\t\tid: string,\n\t): Promise<Issue | undefined> {\n\t\treturn this.readIssue(session, id, 'point');\n\t}\n\n\tprivate async readIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\tid: string,\n\t\tprojection: IssueProjection,\n\t): Promise<Issue | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst apiResult = await api.getJiraServerIssue(\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tthis.apiBaseUrlFor(session),\n\t\t\tid,\n\t\t);\n\t\tconst issue = apiResult != null ? toIssueShape(apiResult, this, { projection: projection }) : undefined;\n\t\treturn issue != null ? { ...issue, type: 'issue' } : undefined;\n\t}\n\n\t/**\n\t * The point read behind `getIssuesBatch`'s tracker targets (#5872). `resourceId` is this connection's single\n\t * synthetic resource — the host itself, see {@link JiraServerResourceDescriptor} — so it selects nothing further\n\t * here: the host was chosen upstream by `domain` (or the connection's configured domain) and the request is\n\t * addressed to the SESSION's base URL like every other read. No `resourceUrl` is needed either, unlike Jira\n\t * Cloud: its REST `self` link is an API endpoint, whereas `getJiraServerIssue` builds the browser link from\n\t * the base URL it was addressed to. A key that names no issue resolves to `undefined`, a proven absence.\n\t */\n\tprotected override getProviderIssueByResourceId(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resourceId: string,\n\t\tid: string,\n\t\t_resourceUrl: string | undefined,\n\t): Promise<Issue | undefined> {\n\t\treturn this.readIssue(session, id, 'batch');\n\t}\n\n\t/**\n\t * Caches are keyed by the ADDRESS the read was made against as well as the token: one integration instance\n\t * exists per configured host and two hosts can hold the same token, so a token-only key would serve one\n\t * host's projects for the other — and the host alone is not enough either, because a connection re-pointed\n\t * to another context path on the same host keeps its token and would otherwise be served the old path's\n\t * projects.\n\t */\n\tprivate projectsCacheKey(session: ProviderAuthenticationSession): string {\n\t\treturn `${this.apiBaseUrlFor(session)}:${session.accessToken}`;\n\t}\n\n\toverride invalidateDiscoveryCaches(): void {\n\t\tthis._projects.clear();\n\t}\n\n\tprotected override providerOnDisconnect(): void {\n\t\tthis._projects.clear();\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,WAAW,kBAAA;AACjB,MAAM,eAAe,OAAO,OAAO;CAAE,IAAI,SAAS;CAAI,QAAQ,SAAS;AAAO,CAAC;AAC/E,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;AAuB3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ication/models.js";
7
7
  import { IssuesCloudHostIntegrationId } from "../constants.js";
8
8
  import { ProviderRefusal } from "../collectionMetadata.js";
9
9
  import { ProviderApiCollectionResult } from "./models.js";
10
- import { AccountWideIssuesResult, IssuesForProjectOptions, ProjectIssuesDrain, SearchMyIssuesOptions } from "../models/issueReads.js";
10
+ import { AccountWideIssuesResult, IssuesForProjectOptions, ProjectIssuesDrain, ProjectIssuesRequest, SearchMyIssuesOptions } from "../models/issueReads.js";
11
11
  import { IssuesIntegration } from "../models/issuesIntegration.js";
12
12
  import { IssueEtagFields } from "../models/integration.js";
13
13
  import { IntegrationAuthenticationProviderDescriptor } from "../authentication/integrationAuthenticationProvider.js";
@@ -61,6 +61,16 @@ export declare class JiraIntegration extends IssuesIntegration<IssuesCloudHostIn
61
61
  protected getProviderProjectsForResourcesWithMetadata(session: ProviderAuthenticationSession, resources: JiraOrganizationDescriptor[], force?: boolean): Promise<ProviderApiCollectionResult<JiraProjectDescriptor>>;
62
62
  protected getProviderIssuesForProject(session: ProviderAuthenticationSession, project: JiraProjectDescriptor, options?: IssuesForProjectOptions): Promise<IssueShape[] | undefined>;
63
63
  protected getProviderIssuesForProjectWithTruncation(session: ProviderAuthenticationSession, project: JiraProjectDescriptor, options?: IssuesForProjectOptions): Promise<ProjectIssuesDrain | undefined>;
64
+ /**
65
+ * Searches a site's projects together for a user-scoped read: one JQL names up to
66
+ * {@link JIRA_MAX_PROJECT_KEYS_PER_REQUEST} projects of one site and one user scope, past which the SDK refuses
67
+ * the call rather than risk a query string Jira rejects.
68
+ *
69
+ * An unscoped read is never searched across projects: it drains every issue in the project, and its backstop is
70
+ * reported as `narrow-scope` per project, which one search across projects could not attribute.
71
+ */
72
+ protected getProjectIssuesSearches(requests: readonly ProjectIssuesRequest<JiraProjectDescriptor>[]): number[][] | undefined;
73
+ protected searchProviderProjectIssues(session: ProviderAuthenticationSession, requests: readonly ProjectIssuesRequest<JiraProjectDescriptor>[]): Promise<IssueShape[][] | undefined>;
64
74
  protected searchProviderMyIssues(session: ProviderAuthenticationSession, resources?: JiraOrganizationDescriptor[], cancellation?: AbortSignal): Promise<IssueShape[] | undefined>;
65
75
  /**
66
76
  * Overridden so `state` reaches the per-site read, which the default drops. Still reports `truncated: false`,