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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,397 @@
1
+ # @axis-backstage/plugin-jira-dashboard-backend
2
+
3
+ ## 4.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 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.
8
+
9
+ ## 4.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 70256ff: Add jql annotation to the Jira plugins to allow fully customization of the issues displayed in the Jira Dashboard
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [70256ff]
18
+ - @axis-backstage/plugin-jira-dashboard-common@1.13.0
19
+
20
+ ## 4.7.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 798d630: Add a new 'apiUrl' config parameter which can be used for scoped API tokens
25
+
26
+ ## 4.6.0
27
+
28
+ ### Minor Changes
29
+
30
+ - 86c01b7: Bumped to Backstage 1.40
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [86c01b7]
35
+ - @axis-backstage/plugin-jira-dashboard-common@1.12.0
36
+
37
+ ## 4.5.1
38
+
39
+ ### Patch Changes
40
+
41
+ - 99c44e9: Fix incorrect 404 response
42
+
43
+ ## 4.5.0
44
+
45
+ ### Minor Changes
46
+
47
+ - 15f1ee8: Support Multiple Jira Project Cards in Tabbed View
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [15f1ee8]
52
+ - @axis-backstage/plugin-jira-dashboard-common@1.11.0
53
+
54
+ ## 4.4.1
55
+
56
+ ### Patch Changes
57
+
58
+ - 39d98e4: Each project key in the JQL query are now wrapped in single qoutes to handle projects that contains reserved JQL words.
59
+
60
+ ## 4.4.0
61
+
62
+ ### Minor Changes
63
+
64
+ - ede8341: Updated to Backstage v1.36.1.
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies [ede8341]
69
+ - @axis-backstage/plugin-jira-dashboard-common@1.10.0
70
+
71
+ ## 4.3.1
72
+
73
+ ### Patch Changes
74
+
75
+ - 22754be: Remove unused `@backstage/backend-common` package dependency.
76
+
77
+ ## 4.3.0
78
+
79
+ ### Minor Changes
80
+
81
+ - b3b6065: Adds ability to use an optional provided Jira filter defined in app-config for JiraUserIssuesViewCard
82
+
83
+ ## 4.2.0
84
+
85
+ ### Minor Changes
86
+
87
+ - 3f9ac75: Support Multiple Project Keys in JQL Query Builder
88
+ Issue https://github.com/AxisCommunications/backstage-plugins/issues/232
89
+
90
+ Signed-off-by: enaysaa <saachi.nayyer@ericsson.com>
91
+
92
+ ## 4.1.1
93
+
94
+ ### Patch Changes
95
+
96
+ - 82161b3: Fixed so JiraDashboard content can read config value from app-config file.
97
+
98
+ ## 4.1.0
99
+
100
+ ### Minor Changes
101
+
102
+ - 24aff26: Support for user defined additional filters
103
+ Issue https://github.com/AxisCommunications/backstage-plugins/issues/210
104
+
105
+ Signed-off-by: enaysaa <saachi.nayyer@ericsson.com>
106
+
107
+ ### Patch Changes
108
+
109
+ - 8148766: The `callApi` function is now exported to make it easy to use the `jira-dashboard-backend`
110
+ configuration in any Backstage plugin.
111
+
112
+ ## 4.0.3
113
+
114
+ ### Patch Changes
115
+
116
+ - 1b47182: The backend now exports the `JiraConfig` class. This is needed to create config
117
+ instances for the `searchJira`function.
118
+
119
+ ## 4.0.2
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [060bcf6]
124
+ - @axis-backstage/plugin-jira-dashboard-common@1.9.1
125
+
126
+ ## 4.0.1
127
+
128
+ ### Patch Changes
129
+
130
+ - eab8f06: Added support for configuring custom headers for API requests
131
+
132
+ ## 4.0.0
133
+
134
+ ### Major Changes
135
+
136
+ - 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.
137
+ - 18fba21: Introduced TypeScript type definitions SearchJiraResponse and JiraQueryResults to represent Jira search responses and pagination details.
138
+ Updated the searchJira function to return search results as a SearchJiraResponse, incorporating the new types.
139
+ 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.
140
+ The JiraQueryResults type outlines the structure of a paginated Jira search response, facilitating better data handling.
141
+ These changes streamline the Jira Dashboard plugin's codebase, improving error resilience and clarity in handling search operations.
142
+
143
+ ### Minor Changes
144
+
145
+ - 18fba21: Add support for multiple Jira instances
146
+
147
+ ### Patch Changes
148
+
149
+ - 6c9c4b6: Fixed caching of user issues when having multiple Jira instances.
150
+ - Updated dependencies [18fba21]
151
+ - Updated dependencies [18fba21]
152
+ - @axis-backstage/plugin-jira-dashboard-common@1.9.0
153
+
154
+ ## 3.1.0
155
+
156
+ ### Minor Changes
157
+
158
+ - 39b1dbf: Add support for multiple Jira instances
159
+
160
+ ### Patch Changes
161
+
162
+ - Updated dependencies [39b1dbf]
163
+ - @axis-backstage/plugin-jira-dashboard-common@1.8.0
164
+
165
+ ## 3.0.0
166
+
167
+ ### Major Changes
168
+
169
+ - 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.
170
+
171
+ ## 2.7.0
172
+
173
+ ### Minor Changes
174
+
175
+ - d3129c0: Adding jql query to support links within JiraTable title
176
+
177
+ ### Patch Changes
178
+
179
+ - Updated dependencies [d3129c0]
180
+ - @axis-backstage/plugin-jira-dashboard-common@1.7.0
181
+
182
+ ## 2.6.1
183
+
184
+ ### Patch Changes
185
+
186
+ - 65ae7b3: Removed deprecated types and fixed the standalone server
187
+ - 1db0ada: Marked `createRouter` and `RouterOptions` as deprecated, to be removed soon after the Backstage `1.32.0` release in October
188
+ - 56e84d6: Quote the incoming status string in the JQL. This makes it possible to have strings that contain whitespace.
189
+
190
+ ## 2.6.0
191
+
192
+ ### Minor Changes
193
+
194
+ - 9bc46fc: New component - JiraUserIssuesCardView - listing user issues view for current logged user
195
+
196
+ ### Patch Changes
197
+
198
+ - Updated dependencies [9bc46fc]
199
+ - @axis-backstage/plugin-jira-dashboard-common@1.6.0
200
+
201
+ ## 2.5.0
202
+
203
+ ### Minor Changes
204
+
205
+ - 6fd284d: Updated to Backstage v1.30.1.
206
+
207
+ ### Patch Changes
208
+
209
+ - Updated dependencies [6fd284d]
210
+ - @axis-backstage/plugin-jira-dashboard-common@1.5.0
211
+
212
+ ## 2.4.0
213
+
214
+ ### Minor Changes
215
+
216
+ - 0b948ea: Generate pluginIds for plugins and bumping @backstage/cli
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [0b948ea]
221
+ - @axis-backstage/plugin-jira-dashboard-common@1.4.0
222
+
223
+ ## 2.3.1
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [e416aff]
228
+ - @axis-backstage/plugin-jira-dashboard-common@1.3.0
229
+
230
+ ## 2.3.0
231
+
232
+ ### Minor Changes
233
+
234
+ - 916589b: Bumped Backstage to v.27.7 and removed the TechRadar plugin since it was not used and caused problems with the new version.
235
+
236
+ ### Patch Changes
237
+
238
+ - Updated dependencies [916589b]
239
+ - @axis-backstage/plugin-jira-dashboard-common@1.2.0
240
+
241
+ ## 2.2.0
242
+
243
+ ### Minor Changes
244
+
245
+ - 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.
246
+ - 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.
247
+
248
+ ### Patch Changes
249
+
250
+ - 7f0b7cd: Added additional documentation how to authenticate with Jira.
251
+ - Updated dependencies [0ec1f12]
252
+ - @axis-backstage/plugin-jira-dashboard-common@1.1.0
253
+
254
+ ## 2.1.0
255
+
256
+ ### Minor Changes
257
+
258
+ - 5fd2a31: Querying for components that contain spaces should now return the expected results. Component
259
+ names is now wrapped in single quotations.
260
+
261
+ Added the `jqlQueryBuilder` function that will create a JQL query based on the arguments. This is
262
+ exported from the backend plugin to be used outside the context of the plugin together with the
263
+ `searchJira` function.
264
+
265
+ ### Patch Changes
266
+
267
+ - 11822da: Enhance error message when querying for projects
268
+
269
+ ## 2.0.0
270
+
271
+ ### Major Changes
272
+
273
+ - 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.
274
+
275
+ ### Patch Changes
276
+
277
+ - 0535af4: Bumped backstage dependencies to match 1.26.0
278
+ - 0535af4: Updated the installation instructions for the new backend system.
279
+ - Updated dependencies [0535af4]
280
+ - @axis-backstage/plugin-jira-dashboard-common@1.0.1
281
+
282
+ ## 1.0.0
283
+
284
+ ### Major Changes
285
+
286
+ - 9456530: Updated the getIssuesByFilter function to accept an array of components,
287
+ enabling the construction of more flexible JQL queries.
288
+ Introduced a new variable named componentQuery to represent the portion of the JQL query related to components.
289
+
290
+ Enhanced the getIssuesFromFilters function to include support for filtering by components.
291
+ Now, along with project keys and filters, the function also accepts an array of components.
292
+ This change allows for more comprehensive filtering options when retrieving issues from Jira.
293
+
294
+ Modified the router implementation to pass the array of components to the getIssuesFromFilters function.
295
+ By including components in the request, users can now specify additional criteria for filtering Jira issues,
296
+ resulting in more refined search results.
297
+
298
+ The introduced changes provide users with greater flexibility and control when retrieving Jira issues,
299
+ allowing for more precise filtering based on project keys, components, and filter criteria.
300
+ This enhancement improves the overall usability and effectiveness of the Jira integration functionality.
301
+
302
+ ### Patch Changes
303
+
304
+ - Updated dependencies [517c68a]
305
+ - @axis-backstage/plugin-jira-dashboard-common@1.0.0
306
+
307
+ ## 0.7.4
308
+
309
+ ### Patch Changes
310
+
311
+ - f23bacd: added content type header to searchJira call
312
+
313
+ ## 0.7.3
314
+
315
+ ### Patch Changes
316
+
317
+ - f3203e9: Fix dependencies in published packages
318
+
319
+ ## 0.7.2
320
+
321
+ ### Patch Changes
322
+
323
+ - 5bb3330: Added and exported a function `searchJira` that searches for Jira issues using
324
+ JQL. This can be used outside this plugin to search for issues. For more information about the available options see the API documentation at
325
+ [issue search](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-search/#api-rest-api-2-search-post).
326
+
327
+ ## 0.7.1
328
+
329
+ ### Patch Changes
330
+
331
+ - ae965c0: Fix broken workspace dependencies
332
+
333
+ ## 0.7.0
334
+
335
+ ### Minor Changes
336
+
337
+ - 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.
338
+
339
+ 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
340
+ 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.
341
+
342
+ ## 0.6.0
343
+
344
+ ### Minor Changes
345
+
346
+ - 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 '/'.
347
+
348
+ ### Patch Changes
349
+
350
+ - d45e6cb: The Jira Dashboard backend now also looks for the `/component`-annotation, in order to support Roadies annotation.
351
+ - 3adbfd1: Fix inaccuracy in config documentation in README.md
352
+
353
+ ## 0.5.0
354
+
355
+ ### Minor Changes
356
+
357
+ - 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.
358
+
359
+ ### Patch Changes
360
+
361
+ - Updated dependencies [97f5bf4]
362
+ - @axis-backstage/plugin-jira-dashboard-common@0.4.0
363
+
364
+ ## 0.4.0
365
+
366
+ ### Minor Changes
367
+
368
+ - 864d983: Bumped Backstage version to v.1.22.0
369
+
370
+ ### Patch Changes
371
+
372
+ - 1248d02: Removed the single quotes from documentation config strings
373
+ - Updated dependencies [864d983]
374
+ - @axis-backstage/plugin-jira-dashboard-common@0.3.0
375
+
376
+ ## 0.3.0
377
+
378
+ ### Minor Changes
379
+
380
+ - 23ff76a: Bumped Backstage version to v.1.21.0 in whole monorepo
381
+
382
+ ### Patch Changes
383
+
384
+ - Updated dependencies [23ff76a]
385
+ - @axis-backstage/plugin-jira-dashboard-common@0.2.0
386
+
387
+ ## 0.2.0
388
+
389
+ ### Minor Changes
390
+
391
+ - a67c963: Bumped Backstage to version 1.20.3
392
+
393
+ ### Patch Changes
394
+
395
+ - 1e7ee53: Added missing config.d.ts file to package.json
396
+ - Updated dependencies [9cf5ab1]
397
+ - @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,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,G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A,GAAA;AAAA,IACnB,OAAA,CAAQ,GAAI,CAAA,OAAM,MAAW,MAAA;AAAA,MAC3B,MAAM,MAAO,CAAA,IAAA;AAAA,MACb,OAAOG,uBAAgB,CAAA;AAAA,QACrB,OAAS,EAAA,WAAA;AAAA,QACT,UAAA;AAAA,QACA,KAAA,EAAO,GAAG,aAAgB,GAAA,CAAA,CAAA,EAAI,aAAa,CAAW,MAAA,CAAA,GAAA,EAAE,CACtD,EAAA,MAAA,CAAO,KACT,CAAA;AAAA,OACD,CAAA;AAAA,MACD,IAAM,EAAA,QAAA;AAAA,MACN,QAAQ,MAAMC,qBAAA,CAAkB,QAAU,EAAA,UAAA,EAAY,OAAO,KAAK;AAAA,KAClE,CAAA;AAAA,GACJ;AACF;AAEO,MAAM,0BAA0B,OACrC,WAAA,EACA,oBACA,EAAA,QAAA,EACA,OACA,aACgC,KAAA;AAChC,EAAA,MAAM,QAAW,GAAA,MAAM,uBAAwB,CAAA,WAAA,EAAa,UAAU,KAAK,CAAA;AAC3E,EAAA,OAAO,MAAM,OAAQ,CAAA,GAAA;AAAA,IACnB,oBAAA,CAAqB,GAAI,CAAA,OAAM,YAAiB,MAAA;AAAA,MAC9C,IAAM,EAAA,YAAA;AAAA,MACN,OAAOD,uBAAgB,CAAA;AAAA,QACrB,OAAS,EAAA,WAAA;AAAA,QACT,UAAA,EAAY,CAAC,YAAY,CAAA;AAAA,QACzB,OAAOA,uBAAgB,CAAA;AAAA,UACrB,OAAS,EAAA,WAAA;AAAA,UACT,UAAY,EAAA,oBAAA;AAAA,UACZ,KAAO,EAAA;AAAA,SACR;AAAA,OACF,CAAA;AAAA,MACD,IAAM,EAAA,WAAA;AAAA,MACN,MAAQ,EAAA,MAAME,wBAAqB,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,GAAA,MAAM,KAAM,CAAA,GAAA,CAAI,QAAQ,CAAA;AAE1C,EAAA,IAAI,cAAgB,EAAA;AAClB,IAAO,OAAA,cAAA;AAAA;AAGT,EAAI,IAAA;AACF,IAAA,cAAA,GAAA,CAAkB,MAAMC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AAE,CACrE,EAAA,MAAA,CAAO,KACT,CAAA,CAAA;AACA,MAAO,OAAA;AAAA,QACL,MAAM,MAAO,CAAA,IAAA;AAAA,QACb,OAAOG,uBAAgB,CAAA;AAAA,UACrB,OAAS,EAAA,WAAA;AAAA,UACT,UAAA;AAAA,UACA,KAAO,EAAA;AAAA,SACR,CAAA;AAAA,QACD,IAAM,EAAA,QAAA;AAAA,QACN,MAAQ,EAAA,MAAMC,qBAAkB,CAAA,QAAA,EAAU,YAAY,aAAa;AAAA,OACrE;AAAA,KACD;AAAA,GACH;AACF;AAEO,MAAM,0BAA0B,OACrC,WAAA,EACA,oBACA,EAAA,QAAA,EACA,OACA,aACgC,KAAA;AAChC,EAAA,MAAM,QAAW,GAAA,MAAM,uBAAwB,CAAA,WAAA,EAAa,UAAU,KAAK,CAAA;AAC3E,EAAA,OAAO,MAAM,OAAQ,CAAA,GAAA;AAAA,IACnB,oBAAA,CAAqB,GAAI,CAAA,OAAM,YAAiB,MAAA;AAAA,MAC9C,IAAM,EAAA,YAAA;AAAA,MACN,OAAOD,uBAAgB,CAAA;AAAA,QACrB,OAAS,EAAA,WAAA;AAAA,QACT,UAAA,EAAY,CAAC,YAAY,CAAA;AAAA,QACzB,OAAOA,uBAAgB,CAAA;AAAA,UACrB,OAAS,EAAA,WAAA;AAAA,UACT,UAAY,EAAA,oBAAA;AAAA,UACZ,KAAO,EAAA;AAAA,SACR;AAAA,OACF,CAAA;AAAA,MACD,IAAM,EAAA,WAAA;AAAA,MACN,MAAQ,EAAA,MAAME,wBAAqB,CAAA,QAAA,EAAU,cAAc,aAAa;AAAA,KACxE,CAAA;AAAA,GACJ;AACF;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axis-backstage/plugin-jira-dashboard-backend",
3
- "version": "4.8.0",
3
+ "version": "4.8.1",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -65,4 +65,4 @@
65
65
  }
66
66
  },
67
67
  "directory": "_release/package"
68
- }
68
+ }