@axis-backstage/plugin-jira-dashboard-backend 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,408 @@
1
+ # @axis-backstage/plugin-jira-dashboard-backend
2
+
3
+ ## 4.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - db452c4: Updated to Backstage v1.42.5
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [db452c4]
12
+ - @axis-backstage/plugin-jira-dashboard-common@1.14.0
13
+
14
+ ## 4.8.1
15
+
16
+ ### Patch Changes
17
+
18
+ - 91be7b5: Only the filter.query was passed to the getIssuesFromFilters function, which cased the filter not to be applied in backend. Now, thw whole jql query is passed to the api.
19
+
20
+ ## 4.8.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 70256ff: Add jql annotation to the Jira plugins to allow fully customization of the issues displayed in the Jira Dashboard
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [70256ff]
29
+ - @axis-backstage/plugin-jira-dashboard-common@1.13.0
30
+
31
+ ## 4.7.0
32
+
33
+ ### Minor Changes
34
+
35
+ - 798d630: Add a new 'apiUrl' config parameter which can be used for scoped API tokens
36
+
37
+ ## 4.6.0
38
+
39
+ ### Minor Changes
40
+
41
+ - 86c01b7: Bumped to Backstage 1.40
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [86c01b7]
46
+ - @axis-backstage/plugin-jira-dashboard-common@1.12.0
47
+
48
+ ## 4.5.1
49
+
50
+ ### Patch Changes
51
+
52
+ - 99c44e9: Fix incorrect 404 response
53
+
54
+ ## 4.5.0
55
+
56
+ ### Minor Changes
57
+
58
+ - 15f1ee8: Support Multiple Jira Project Cards in Tabbed View
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [15f1ee8]
63
+ - @axis-backstage/plugin-jira-dashboard-common@1.11.0
64
+
65
+ ## 4.4.1
66
+
67
+ ### Patch Changes
68
+
69
+ - 39d98e4: Each project key in the JQL query are now wrapped in single qoutes to handle projects that contains reserved JQL words.
70
+
71
+ ## 4.4.0
72
+
73
+ ### Minor Changes
74
+
75
+ - ede8341: Updated to Backstage v1.36.1.
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [ede8341]
80
+ - @axis-backstage/plugin-jira-dashboard-common@1.10.0
81
+
82
+ ## 4.3.1
83
+
84
+ ### Patch Changes
85
+
86
+ - 22754be: Remove unused `@backstage/backend-common` package dependency.
87
+
88
+ ## 4.3.0
89
+
90
+ ### Minor Changes
91
+
92
+ - b3b6065: Adds ability to use an optional provided Jira filter defined in app-config for JiraUserIssuesViewCard
93
+
94
+ ## 4.2.0
95
+
96
+ ### Minor Changes
97
+
98
+ - 3f9ac75: Support Multiple Project Keys in JQL Query Builder
99
+ Issue https://github.com/AxisCommunications/backstage-plugins/issues/232
100
+
101
+ Signed-off-by: enaysaa <saachi.nayyer@ericsson.com>
102
+
103
+ ## 4.1.1
104
+
105
+ ### Patch Changes
106
+
107
+ - 82161b3: Fixed so JiraDashboard content can read config value from app-config file.
108
+
109
+ ## 4.1.0
110
+
111
+ ### Minor Changes
112
+
113
+ - 24aff26: Support for user defined additional filters
114
+ Issue https://github.com/AxisCommunications/backstage-plugins/issues/210
115
+
116
+ Signed-off-by: enaysaa <saachi.nayyer@ericsson.com>
117
+
118
+ ### Patch Changes
119
+
120
+ - 8148766: The `callApi` function is now exported to make it easy to use the `jira-dashboard-backend`
121
+ configuration in any Backstage plugin.
122
+
123
+ ## 4.0.3
124
+
125
+ ### Patch Changes
126
+
127
+ - 1b47182: The backend now exports the `JiraConfig` class. This is needed to create config
128
+ instances for the `searchJira`function.
129
+
130
+ ## 4.0.2
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies [060bcf6]
135
+ - @axis-backstage/plugin-jira-dashboard-common@1.9.1
136
+
137
+ ## 4.0.1
138
+
139
+ ### Patch Changes
140
+
141
+ - eab8f06: Added support for configuring custom headers for API requests
142
+
143
+ ## 4.0.0
144
+
145
+ ### Major Changes
146
+
147
+ - 18fba21: BREAKING: The backend has been migrated to the new backend system. The createRouter function now requires the new auth and httpAuth services to be passed in, instead of the removed identity and tokenManager services. If you are using the new backend system module, this does not affect you.
148
+ - 18fba21: Introduced TypeScript type definitions SearchJiraResponse and JiraQueryResults to represent Jira search responses and pagination details.
149
+ Updated the searchJira function to return search results as a SearchJiraResponse, incorporating the new types.
150
+ The searchJira function now returns an object containing both the search results and the HTTP status code, improving error resilience and clarity in handling search operations.
151
+ The JiraQueryResults type outlines the structure of a paginated Jira search response, facilitating better data handling.
152
+ These changes streamline the Jira Dashboard plugin's codebase, improving error resilience and clarity in handling search operations.
153
+
154
+ ### Minor Changes
155
+
156
+ - 18fba21: Add support for multiple Jira instances
157
+
158
+ ### Patch Changes
159
+
160
+ - 6c9c4b6: Fixed caching of user issues when having multiple Jira instances.
161
+ - Updated dependencies [18fba21]
162
+ - Updated dependencies [18fba21]
163
+ - @axis-backstage/plugin-jira-dashboard-common@1.9.0
164
+
165
+ ## 3.1.0
166
+
167
+ ### Minor Changes
168
+
169
+ - 39b1dbf: Add support for multiple Jira instances
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies [39b1dbf]
174
+ - @axis-backstage/plugin-jira-dashboard-common@1.8.0
175
+
176
+ ## 3.0.0
177
+
178
+ ### Major Changes
179
+
180
+ - b6b406c: BREAKING: The backend has been migrated to the new backend system. The createRouter function now requires the new auth and httpAuth services to be passed in, instead of the removed identity and tokenManager services. If you are using the new backend system module, this does not affect you.
181
+
182
+ ## 2.7.0
183
+
184
+ ### Minor Changes
185
+
186
+ - d3129c0: Adding jql query to support links within JiraTable title
187
+
188
+ ### Patch Changes
189
+
190
+ - Updated dependencies [d3129c0]
191
+ - @axis-backstage/plugin-jira-dashboard-common@1.7.0
192
+
193
+ ## 2.6.1
194
+
195
+ ### Patch Changes
196
+
197
+ - 65ae7b3: Removed deprecated types and fixed the standalone server
198
+ - 1db0ada: Marked `createRouter` and `RouterOptions` as deprecated, to be removed soon after the Backstage `1.32.0` release in October
199
+ - 56e84d6: Quote the incoming status string in the JQL. This makes it possible to have strings that contain whitespace.
200
+
201
+ ## 2.6.0
202
+
203
+ ### Minor Changes
204
+
205
+ - 9bc46fc: New component - JiraUserIssuesCardView - listing user issues view for current logged user
206
+
207
+ ### Patch Changes
208
+
209
+ - Updated dependencies [9bc46fc]
210
+ - @axis-backstage/plugin-jira-dashboard-common@1.6.0
211
+
212
+ ## 2.5.0
213
+
214
+ ### Minor Changes
215
+
216
+ - 6fd284d: Updated to Backstage v1.30.1.
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [6fd284d]
221
+ - @axis-backstage/plugin-jira-dashboard-common@1.5.0
222
+
223
+ ## 2.4.0
224
+
225
+ ### Minor Changes
226
+
227
+ - 0b948ea: Generate pluginIds for plugins and bumping @backstage/cli
228
+
229
+ ### Patch Changes
230
+
231
+ - Updated dependencies [0b948ea]
232
+ - @axis-backstage/plugin-jira-dashboard-common@1.4.0
233
+
234
+ ## 2.3.1
235
+
236
+ ### Patch Changes
237
+
238
+ - Updated dependencies [e416aff]
239
+ - @axis-backstage/plugin-jira-dashboard-common@1.3.0
240
+
241
+ ## 2.3.0
242
+
243
+ ### Minor Changes
244
+
245
+ - 916589b: Bumped Backstage to v.27.7 and removed the TechRadar plugin since it was not used and caused problems with the new version.
246
+
247
+ ### Patch Changes
248
+
249
+ - Updated dependencies [916589b]
250
+ - @axis-backstage/plugin-jira-dashboard-common@1.2.0
251
+
252
+ ## 2.2.0
253
+
254
+ ### Minor Changes
255
+
256
+ - 0ec1f12: Created the incoming-issues-annotation to make it possible for users to define Jira status for Incoming issues other than "New". Made some smaller refactoring in filter.ts to create better consistency among functions.
257
+ - 56c3a07: The Backstage user entity profile email is now used as default for "Assigned to me" filters. Made the JIRA_EMAIL_SUFFIX optional, so it still can be used if Backstage email does not match the one in Jira.
258
+
259
+ ### Patch Changes
260
+
261
+ - 7f0b7cd: Added additional documentation how to authenticate with Jira.
262
+ - Updated dependencies [0ec1f12]
263
+ - @axis-backstage/plugin-jira-dashboard-common@1.1.0
264
+
265
+ ## 2.1.0
266
+
267
+ ### Minor Changes
268
+
269
+ - 5fd2a31: Querying for components that contain spaces should now return the expected results. Component
270
+ names is now wrapped in single quotations.
271
+
272
+ Added the `jqlQueryBuilder` function that will create a JQL query based on the arguments. This is
273
+ exported from the backend plugin to be used outside the context of the plugin together with the
274
+ `searchJira` function.
275
+
276
+ ### Patch Changes
277
+
278
+ - 11822da: Enhance error message when querying for projects
279
+
280
+ ## 2.0.0
281
+
282
+ ### Major Changes
283
+
284
+ - 0535af4: **BREAKING** The Jira dashboard backend now uses the new auth service introduced in Backstage v1.24.0. This is only applicable when using this plugin in the new Backstage backend. This could break the usage in Backstage installations older than v1.24.0 if the new backend system is used.
285
+
286
+ ### Patch Changes
287
+
288
+ - 0535af4: Bumped backstage dependencies to match 1.26.0
289
+ - 0535af4: Updated the installation instructions for the new backend system.
290
+ - Updated dependencies [0535af4]
291
+ - @axis-backstage/plugin-jira-dashboard-common@1.0.1
292
+
293
+ ## 1.0.0
294
+
295
+ ### Major Changes
296
+
297
+ - 9456530: Updated the getIssuesByFilter function to accept an array of components,
298
+ enabling the construction of more flexible JQL queries.
299
+ Introduced a new variable named componentQuery to represent the portion of the JQL query related to components.
300
+
301
+ Enhanced the getIssuesFromFilters function to include support for filtering by components.
302
+ Now, along with project keys and filters, the function also accepts an array of components.
303
+ This change allows for more comprehensive filtering options when retrieving issues from Jira.
304
+
305
+ Modified the router implementation to pass the array of components to the getIssuesFromFilters function.
306
+ By including components in the request, users can now specify additional criteria for filtering Jira issues,
307
+ resulting in more refined search results.
308
+
309
+ The introduced changes provide users with greater flexibility and control when retrieving Jira issues,
310
+ allowing for more precise filtering based on project keys, components, and filter criteria.
311
+ This enhancement improves the overall usability and effectiveness of the Jira integration functionality.
312
+
313
+ ### Patch Changes
314
+
315
+ - Updated dependencies [517c68a]
316
+ - @axis-backstage/plugin-jira-dashboard-common@1.0.0
317
+
318
+ ## 0.7.4
319
+
320
+ ### Patch Changes
321
+
322
+ - f23bacd: added content type header to searchJira call
323
+
324
+ ## 0.7.3
325
+
326
+ ### Patch Changes
327
+
328
+ - f3203e9: Fix dependencies in published packages
329
+
330
+ ## 0.7.2
331
+
332
+ ### Patch Changes
333
+
334
+ - 5bb3330: Added and exported a function `searchJira` that searches for Jira issues using
335
+ JQL. This can be used outside this plugin to search for issues. For more information about the available options see the API documentation at
336
+ [issue search](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-search/#api-rest-api-2-search-post).
337
+
338
+ ## 0.7.1
339
+
340
+ ### Patch Changes
341
+
342
+ - ae965c0: Fix broken workspace dependencies
343
+
344
+ ## 0.7.0
345
+
346
+ ### Minor Changes
347
+
348
+ - 135e3b2: Updated the resolveUserEmailSuffix function to utilize config.getOptionalString method, providing a more concise approach. This modification ensures that an empty string is returned if the Jira user email suffix configuration is missing, effectively preventing failures and enhancing error logging capabilities.
349
+
350
+ Modified the retrieval of project keys in the router module to handle multiple project keys specified in annotations for e.g., jira.com/project-key: abc,def,ghi
351
+ The updated logic now parses multiple project keys properly and supports comma-separated values. It's important to note that in cases where multiple project keys are present, only the first project key (projectKey[0]) is used for display on the project card i.e, in this case project-key "abc", assuming it represents the main project. However, the response table will include data from all project keys specified in the annotations.
352
+
353
+ ## 0.6.0
354
+
355
+ ### Minor Changes
356
+
357
+ - 33497c0: Dashboard and Avatar backend APIs adjusted to consume entityRef as /:kind/:namespace/:name. Fixes a 404 routing issue where a proxy like oauth2Proxy could decode the URI encoded path parameter /:entityRef known to contain the reserved path delimiter '/'.
358
+
359
+ ### Patch Changes
360
+
361
+ - d45e6cb: The Jira Dashboard backend now also looks for the `/component`-annotation, in order to support Roadies annotation.
362
+ - 3adbfd1: Fix inaccuracy in config documentation in README.md
363
+
364
+ ## 0.5.0
365
+
366
+ ### Minor Changes
367
+
368
+ - 97f5bf4: Created optional ANNOTATION_PREFIX config in backend to make it possible to define custom annotations. The jira.com annotation is still used if no config value is provided. Also removed check for annotation in frontend and only return error message 'Could not fetch Jira Dashboard content for defined project key' if no Jira data is returned from backend.
369
+
370
+ ### Patch Changes
371
+
372
+ - Updated dependencies [97f5bf4]
373
+ - @axis-backstage/plugin-jira-dashboard-common@0.4.0
374
+
375
+ ## 0.4.0
376
+
377
+ ### Minor Changes
378
+
379
+ - 864d983: Bumped Backstage version to v.1.22.0
380
+
381
+ ### Patch Changes
382
+
383
+ - 1248d02: Removed the single quotes from documentation config strings
384
+ - Updated dependencies [864d983]
385
+ - @axis-backstage/plugin-jira-dashboard-common@0.3.0
386
+
387
+ ## 0.3.0
388
+
389
+ ### Minor Changes
390
+
391
+ - 23ff76a: Bumped Backstage version to v.1.21.0 in whole monorepo
392
+
393
+ ### Patch Changes
394
+
395
+ - Updated dependencies [23ff76a]
396
+ - @axis-backstage/plugin-jira-dashboard-common@0.2.0
397
+
398
+ ## 0.2.0
399
+
400
+ ### Minor Changes
401
+
402
+ - a67c963: Bumped Backstage to version 1.20.3
403
+
404
+ ### Patch Changes
405
+
406
+ - 1e7ee53: Added missing config.d.ts file to package.json
407
+ - Updated dependencies [9cf5ab1]
408
+ - @axis-backstage/plugin-jira-dashboard-common@0.1.1
@@ -100,16 +100,19 @@ async function getJiraProjectsFromKeys(projectKeys, instance, cache) {
100
100
  const getIssuesFromFilters = async (projectKeys, components, filters, instance, cache, jqlAnnotation) => {
101
101
  const projects = await getJiraProjectsFromKeys(projectKeys, instance, cache);
102
102
  return await Promise.all(
103
- filters.map(async (filter) => ({
104
- name: filter.name,
105
- query: queries.jqlQueryBuilder({
106
- project: projectKeys,
107
- components,
108
- query: `${jqlAnnotation ? `(${jqlAnnotation}) AND ` : ""}${filter.query}`
109
- }),
110
- type: "filter",
111
- issues: await api.getIssuesByFilter(projects, components, filter.query)
112
- }))
103
+ filters.map(async (filter) => {
104
+ const combinedQuery = `${jqlAnnotation ? `(${jqlAnnotation}) AND ` : ""}${filter.query}`;
105
+ return {
106
+ name: filter.name,
107
+ query: queries.jqlQueryBuilder({
108
+ project: projectKeys,
109
+ components,
110
+ query: combinedQuery
111
+ }),
112
+ type: "filter",
113
+ issues: await api.getIssuesByFilter(projects, components, combinedQuery)
114
+ };
115
+ })
113
116
  );
114
117
  };
115
118
  const getIssuesFromComponents = async (projectKeys, componentAnnotations, instance, cache, jqlAnnotation) => {
@@ -1 +1 @@
1
- {"version":3,"file":"service.cjs.js","sources":["../../src/service/service.ts"],"sourcesContent":["import { CacheService } from '@backstage/backend-plugin-api';\nimport {\n type Filter,\n Issue,\n type JiraDataResponse,\n type Project,\n} from '@axis-backstage/plugin-jira-dashboard-common';\nimport {\n getFilterById,\n getIssuesByComponent,\n getIssuesByFilter,\n getProjectInfo,\n searchJira,\n SearchOptions,\n} from '../api';\nimport { jqlQueryBuilder } from '../queries';\nimport type { ConfigInstance } from '../config';\nimport { JiraProject } from '../lib';\n\nexport const getProjectResponse = async (\n project: JiraProject,\n cache: CacheService,\n): Promise<Project> => {\n let projectResponse: Project;\n\n projectResponse = (await cache.get(project.fullProjectKey)) as Project;\n\n if (projectResponse) {\n return projectResponse as Project;\n }\n\n try {\n projectResponse = await getProjectInfo(project);\n cache.set(project.fullProjectKey, projectResponse);\n } catch (err: any) {\n if (err.message !== 200) {\n throw Error(\n `Failed to get project info for project key ${project.fullProjectKey} with error: ${err.message}`,\n );\n }\n }\n return projectResponse;\n};\n\nexport const getJqlResponse = async (\n jql: string,\n config: ConfigInstance,\n cache: CacheService,\n searchOptions: SearchOptions,\n): Promise<Issue[]> => {\n let issuesResponse: Issue[];\n\n const cacheKey = `${config.baseUrl} ${jql}`;\n\n issuesResponse = (await cache.get(cacheKey)) as Issue[];\n\n if (issuesResponse) {\n return issuesResponse;\n }\n\n try {\n issuesResponse = (await searchJira(config, jql, searchOptions)).issues;\n cache.set(cacheKey, issuesResponse);\n } catch (err: any) {\n if (err.message !== 200) {\n throw Error(\n `Failed to get issues for JQL ${jql} with error: ${err.message}`,\n );\n }\n }\n return issuesResponse;\n};\n\nexport const getUserIssues = async (\n username: string,\n maxResults: number,\n config: ConfigInstance,\n cache: CacheService,\n filterName: string,\n): Promise<Issue[]> => {\n let jql = `assignee = \"${username}\" AND resolution = Unresolved ORDER BY priority DESC, updated DESC`;\n if (filterName !== 'default') {\n for (const filter of config.defaultFilters || []) {\n if (filterName === filter.name) {\n jql = `assignee = \"${username}\" AND ${filter.query}`;\n }\n }\n }\n\n return getJqlResponse(jql, config, cache, {\n fields: [\n 'key',\n 'issuetype',\n 'summary',\n 'status',\n 'priority',\n 'created',\n 'updated',\n ],\n maxResults,\n });\n};\n\nexport const getFiltersFromAnnotations = async (\n annotations: string[],\n config: ConfigInstance,\n): Promise<Filter[]> => {\n const filters: Filter[] = [];\n\n for (const filter of annotations) {\n try {\n const response = await getFilterById(filter, config);\n filters.push(response);\n } catch (err: any) {\n console.warn(\n `${err.message} : Could not find filter with filter id ${filter}`,\n );\n }\n }\n return filters;\n};\nasync function getJiraProjectsFromKeys(\n projectKeys: string[],\n instance: ConfigInstance,\n cache: CacheService,\n): Promise<JiraProject[]> {\n const jiraProjects: JiraProject[] = [];\n for (const key of projectKeys) {\n const cachedProject = (await cache.get(key)) as Project;\n let projectInfo: Project;\n\n if (cachedProject) {\n projectInfo = cachedProject;\n } else {\n projectInfo = await getProjectInfo({\n projectKey: key,\n instance,\n fullProjectKey: '',\n });\n cache.set(key, projectInfo);\n }\n\n jiraProjects.push({\n instance,\n fullProjectKey: projectInfo.key,\n projectKey: projectInfo.key,\n });\n }\n return jiraProjects;\n}\nexport const getIssuesFromFilters = async (\n projectKeys: string[],\n components: string[],\n filters: Filter[],\n instance: ConfigInstance,\n cache: CacheService,\n jqlAnnotation?: string,\n): Promise<JiraDataResponse[]> => {\n const projects = await getJiraProjectsFromKeys(projectKeys, instance, cache);\n return await Promise.all(\n filters.map(async filter => ({\n name: filter.name,\n query: jqlQueryBuilder({\n project: projectKeys,\n components,\n query: `${jqlAnnotation ? `(${jqlAnnotation}) AND ` : ''}${\n filter.query\n }`,\n }),\n type: 'filter',\n issues: await getIssuesByFilter(projects, components, filter.query),\n })),\n );\n};\n\nexport const getIssuesFromComponents = async (\n projectKeys: string[],\n componentAnnotations: string[],\n instance: ConfigInstance,\n cache: CacheService,\n jqlAnnotation?: string,\n): Promise<JiraDataResponse[]> => {\n const projects = await getJiraProjectsFromKeys(projectKeys, instance, cache);\n return await Promise.all(\n componentAnnotations.map(async componentKey => ({\n name: componentKey,\n query: jqlQueryBuilder({\n project: projectKeys,\n components: [componentKey],\n query: jqlQueryBuilder({\n project: projectKeys,\n components: componentAnnotations,\n query: jqlAnnotation,\n }),\n }),\n type: 'component',\n issues: await getIssuesByComponent(projects, componentKey, jqlAnnotation),\n })),\n );\n};\n"],"names":["getProjectInfo","searchJira","getFilterById","jqlQueryBuilder","getIssuesByFilter","getIssuesByComponent"],"mappings":";;;;;AAmBa,MAAA,kBAAA,GAAqB,OAChC,OAAA,EACA,KACqB,KAAA;AACrB,EAAI,IAAA,eAAA;AAEJ,EAAA,eAAA,GAAmB,MAAM,KAAA,CAAM,GAAI,CAAA,OAAA,CAAQ,cAAc,CAAA;AAEzD,EAAA,IAAI,eAAiB,EAAA;AACnB,IAAO,OAAA,eAAA;AAAA;AAGT,EAAI,IAAA;AACF,IAAkB,eAAA,GAAA,MAAMA,mBAAe,OAAO,CAAA;AAC9C,IAAM,KAAA,CAAA,GAAA,CAAI,OAAQ,CAAA,cAAA,EAAgB,eAAe,CAAA;AAAA,WAC1C,GAAU,EAAA;AACjB,IAAI,IAAA,GAAA,CAAI,YAAY,GAAK,EAAA;AACvB,MAAM,MAAA,KAAA;AAAA,QACJ,CAA8C,2CAAA,EAAA,OAAA,CAAQ,cAAc,CAAA,aAAA,EAAgB,IAAI,OAAO,CAAA;AAAA,OACjG;AAAA;AACF;AAEF,EAAO,OAAA,eAAA;AACT;AAEO,MAAM,cAAiB,GAAA,OAC5B,GACA,E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BAAqB,CAAA,QAAA,EAAU,cAAc,aAAa;AAAA,KACxE,CAAA;AAAA,GACJ;AACF;;;;;;;;;"}
1
+ {"version":3,"file":"service.cjs.js","sources":["../../src/service/service.ts"],"sourcesContent":["import { CacheService } from '@backstage/backend-plugin-api';\nimport {\n type Filter,\n Issue,\n type JiraDataResponse,\n type Project,\n} from '@axis-backstage/plugin-jira-dashboard-common';\nimport {\n getFilterById,\n getIssuesByComponent,\n getIssuesByFilter,\n getProjectInfo,\n searchJira,\n SearchOptions,\n} from '../api';\nimport { jqlQueryBuilder } from '../queries';\nimport type { ConfigInstance } from '../config';\nimport { JiraProject } from '../lib';\n\nexport const getProjectResponse = async (\n project: JiraProject,\n cache: CacheService,\n): Promise<Project> => {\n let projectResponse: Project;\n\n projectResponse = (await cache.get(project.fullProjectKey)) as Project;\n\n if (projectResponse) {\n return projectResponse as Project;\n }\n\n try {\n projectResponse = await getProjectInfo(project);\n cache.set(project.fullProjectKey, projectResponse);\n } catch (err: any) {\n if (err.message !== 200) {\n throw Error(\n `Failed to get project info for project key ${project.fullProjectKey} with error: ${err.message}`,\n );\n }\n }\n return projectResponse;\n};\n\nexport const getJqlResponse = async (\n jql: string,\n config: ConfigInstance,\n cache: CacheService,\n searchOptions: SearchOptions,\n): Promise<Issue[]> => {\n let issuesResponse: Issue[];\n\n const cacheKey = `${config.baseUrl} ${jql}`;\n\n issuesResponse = (await cache.get(cacheKey)) as Issue[];\n\n if (issuesResponse) {\n return issuesResponse;\n }\n\n try {\n issuesResponse = (await searchJira(config, jql, searchOptions)).issues;\n cache.set(cacheKey, issuesResponse);\n } catch (err: any) {\n if (err.message !== 200) {\n throw Error(\n `Failed to get issues for JQL ${jql} with error: ${err.message}`,\n );\n }\n }\n return issuesResponse;\n};\n\nexport const getUserIssues = async (\n username: string,\n maxResults: number,\n config: ConfigInstance,\n cache: CacheService,\n filterName: string,\n): Promise<Issue[]> => {\n let jql = `assignee = \"${username}\" AND resolution = Unresolved ORDER BY priority DESC, updated DESC`;\n if (filterName !== 'default') {\n for (const filter of config.defaultFilters || []) {\n if (filterName === filter.name) {\n jql = `assignee = \"${username}\" AND ${filter.query}`;\n }\n }\n }\n\n return getJqlResponse(jql, config, cache, {\n fields: [\n 'key',\n 'issuetype',\n 'summary',\n 'status',\n 'priority',\n 'created',\n 'updated',\n ],\n maxResults,\n });\n};\n\nexport const getFiltersFromAnnotations = async (\n annotations: string[],\n config: ConfigInstance,\n): Promise<Filter[]> => {\n const filters: Filter[] = [];\n\n for (const filter of annotations) {\n try {\n const response = await getFilterById(filter, config);\n filters.push(response);\n } catch (err: any) {\n console.warn(\n `${err.message} : Could not find filter with filter id ${filter}`,\n );\n }\n }\n return filters;\n};\nasync function getJiraProjectsFromKeys(\n projectKeys: string[],\n instance: ConfigInstance,\n cache: CacheService,\n): Promise<JiraProject[]> {\n const jiraProjects: JiraProject[] = [];\n for (const key of projectKeys) {\n const cachedProject = (await cache.get(key)) as Project;\n let projectInfo: Project;\n\n if (cachedProject) {\n projectInfo = cachedProject;\n } else {\n projectInfo = await getProjectInfo({\n projectKey: key,\n instance,\n fullProjectKey: '',\n });\n cache.set(key, projectInfo);\n }\n\n jiraProjects.push({\n instance,\n fullProjectKey: projectInfo.key,\n projectKey: projectInfo.key,\n });\n }\n return jiraProjects;\n}\nexport const getIssuesFromFilters = async (\n projectKeys: string[],\n components: string[],\n filters: Filter[],\n instance: ConfigInstance,\n cache: CacheService,\n jqlAnnotation?: string,\n): Promise<JiraDataResponse[]> => {\n const projects = await getJiraProjectsFromKeys(projectKeys, instance, cache);\n return await Promise.all(\n filters.map(async filter => {\n const combinedQuery = `${jqlAnnotation ? `(${jqlAnnotation}) AND ` : ''}${\n filter.query\n }`;\n return {\n name: filter.name,\n query: jqlQueryBuilder({\n project: projectKeys,\n components,\n query: combinedQuery,\n }),\n type: 'filter',\n issues: await getIssuesByFilter(projects, components, combinedQuery),\n };\n }),\n );\n};\n\nexport const getIssuesFromComponents = async (\n projectKeys: string[],\n componentAnnotations: string[],\n instance: ConfigInstance,\n cache: CacheService,\n jqlAnnotation?: string,\n): Promise<JiraDataResponse[]> => {\n const projects = await getJiraProjectsFromKeys(projectKeys, instance, cache);\n return await Promise.all(\n componentAnnotations.map(async componentKey => ({\n name: componentKey,\n query: jqlQueryBuilder({\n project: projectKeys,\n components: [componentKey],\n query: jqlQueryBuilder({\n project: projectKeys,\n components: componentAnnotations,\n query: jqlAnnotation,\n }),\n }),\n type: 'component',\n issues: await getIssuesByComponent(projects, componentKey, jqlAnnotation),\n })),\n );\n};\n"],"names":["getProjectInfo","searchJira","getFilterById","jqlQueryBuilder","getIssuesByFilter","getIssuesByComponent"],"mappings":";;;;;AAmBa,MAAA,kBAAA,GAAqB,OAChC,OAAA,EACA,KACqB,KAAA;AACrB,EAAI,IAAA,eAAA;AAEJ,EAAA,eAAA,GAAmB,MAAM,KAAA,CAAM,GAAI,CAAA,OAAA,CAAQ,cAAc,CAAA;AAEzD,EAAA,IAAI,eAAiB,EAAA;AACnB,IAAO,OAAA,eAAA;AAAA;AAGT,EAAI,IAAA;AACF,IAAkB,eAAA,GAAA,MAAMA,mBAAe,OAAO,CAAA;AAC9C,IAAM,KAAA,CAAA,GAAA,CAAI,OAAQ,CAAA,cAAA,EAAgB,eAAe,CAAA;AAAA,WAC1C,GAAU,EAAA;AACjB,IAAI,IAAA,GAAA,CAAI,YAAY,GAAK,EAAA;AACvB,MAAM,MAAA,KAAA;AAAA,QACJ,CAA8C,2CAAA,EAAA,OAAA,CAAQ,cAAc,CAAA,aAAA,EAAgB,IAAI,OAAO,CAAA;AAAA,OACjG;AAAA;AACF;AAEF,EAAO,OAAA,eAAA;AACT;AAEO,MAAM,cAAiB,GAAA,OAC5B,GACA,EAAA,MAAA,EACA,OACA,aACqB,KAAA;AACrB,EAAI,IAAA,cAAA;AAEJ,EAAA,MAAM,QAAW,GAAA,CAAA,EAAG,MAAO,CAAA,OAAO,IAAI,GAAG,CAAA,CAAA;AAEzC,EAAkB,cAAA,GA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@@
1
1
  {
2
2
  "name": "@axis-backstage/plugin-jira-dashboard-backend",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -32,21 +32,21 @@
32
32
  "postpack": "backstage-cli package postpack"
33
33
  },
34
34
  "dependencies": {
35
- "@axis-backstage/plugin-jira-dashboard-common": "^1.13.0",
36
- "@backstage/backend-defaults": "^0.11.0",
37
- "@backstage/backend-plugin-api": "^1.4.0",
38
- "@backstage/catalog-client": "^1.10.1",
39
- "@backstage/catalog-model": "^1.7.4",
35
+ "@axis-backstage/plugin-jira-dashboard-common": "^1.14.0",
36
+ "@backstage/backend-defaults": "^0.12.0",
37
+ "@backstage/backend-plugin-api": "^1.4.2",
38
+ "@backstage/catalog-client": "^1.11.0",
39
+ "@backstage/catalog-model": "^1.7.5",
40
40
  "@backstage/errors": "^1.2.7",
41
41
  "express": "^4.17.1",
42
42
  "express-promise-router": "^4.1.0",
43
43
  "node-fetch": "^2.6.7"
44
44
  },
45
45
  "devDependencies": {
46
- "@backstage/backend-test-utils": "^1.6.0",
47
- "@backstage/cli": "^0.33.0",
48
- "@backstage/plugin-auth-backend": "^0.25.1",
49
- "@backstage/plugin-auth-backend-module-guest-provider": "^0.2.9",
46
+ "@backstage/backend-test-utils": "^1.8.0",
47
+ "@backstage/cli": "^0.34.1",
48
+ "@backstage/plugin-auth-backend": "^0.25.3",
49
+ "@backstage/plugin-auth-backend-module-guest-provider": "^0.2.11",
50
50
  "@types/express": "*",
51
51
  "@types/supertest": "^2.0.12",
52
52
  "msw": "^2.7.3",
@@ -65,4 +65,4 @@
65
65
  }
66
66
  },
67
67
  "directory": "_release/package"
68
- }
68
+ }