@backstage-community/plugin-apiiro 0.1.0 → 1.0.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +91 -12
  3. package/config.d.ts +14 -0
  4. package/dist/App.esm.js +96 -4
  5. package/dist/App.esm.js.map +1 -1
  6. package/dist/api/index.esm.js +6 -0
  7. package/dist/api/index.esm.js.map +1 -1
  8. package/dist/assets/SettingIcon.esm.js +1 -0
  9. package/dist/assets/SettingIcon.esm.js.map +1 -1
  10. package/dist/components/ApiiroSidebar.esm.js.map +1 -1
  11. package/dist/components/CalendarDatePicker.esm.js.map +1 -1
  12. package/dist/components/DataGrid/DataGrid.esm.js +1 -0
  13. package/dist/components/DataGrid/DataGrid.esm.js.map +1 -1
  14. package/dist/components/MetricsGroup/TabMetricsGroup.esm.js +28 -4
  15. package/dist/components/MetricsGroup/TabMetricsGroup.esm.js.map +1 -1
  16. package/dist/components/MetricsGroup/WidgetMetricsGroup.esm.js +30 -7
  17. package/dist/components/MetricsGroup/WidgetMetricsGroup.esm.js.map +1 -1
  18. package/dist/components/RiskLevel.esm.js +1 -0
  19. package/dist/components/RiskLevel.esm.js.map +1 -1
  20. package/dist/components/charts/GaugeChart.esm.js +8 -6
  21. package/dist/components/charts/GaugeChart.esm.js.map +1 -1
  22. package/dist/components/common/StatusContainer.esm.js +123 -0
  23. package/dist/components/common/StatusContainer.esm.js.map +1 -0
  24. package/dist/components/filters/DiscoveredOnFilter.esm.js +1 -1
  25. package/dist/components/filters/DiscoveredOnFilter.esm.js.map +1 -1
  26. package/dist/components/tiles/MttrVsSLATile.esm.js +31 -14
  27. package/dist/components/tiles/MttrVsSLATile.esm.js.map +1 -1
  28. package/dist/components/tiles/RiskOverTimeTile.esm.js +15 -12
  29. package/dist/components/tiles/RiskOverTimeTile.esm.js.map +1 -1
  30. package/dist/components/tiles/SLAAdherenceTile.esm.js +15 -12
  31. package/dist/components/tiles/SLAAdherenceTile.esm.js.map +1 -1
  32. package/dist/components/tiles/StatusTile.esm.js +98 -66
  33. package/dist/components/tiles/StatusTile.esm.js.map +1 -1
  34. package/dist/components/tiles/TopLanguagesTile.esm.js +1 -0
  35. package/dist/components/tiles/TopLanguagesTile.esm.js.map +1 -1
  36. package/dist/components/tiles/TopRiskTile.esm.js +19 -16
  37. package/dist/components/tiles/TopRiskTile.esm.js.map +1 -1
  38. package/dist/index.d.ts +31 -6
  39. package/dist/index.esm.js +2 -1
  40. package/dist/index.esm.js.map +1 -1
  41. package/dist/pages/Applications/Applications.esm.js +104 -0
  42. package/dist/pages/Applications/Applications.esm.js.map +1 -0
  43. package/dist/pages/Applications/tableConfig.esm.js +147 -0
  44. package/dist/pages/Applications/tableConfig.esm.js.map +1 -0
  45. package/dist/pages/Repositories/Repositories.esm.js +26 -26
  46. package/dist/pages/Repositories/Repositories.esm.js.map +1 -1
  47. package/dist/pages/Repositories/tableConfig.esm.js +3 -2
  48. package/dist/pages/Repositories/tableConfig.esm.js.map +1 -1
  49. package/dist/pages/Risks/Risks.esm.js +9 -3
  50. package/dist/pages/Risks/Risks.esm.js.map +1 -1
  51. package/dist/pages/Risks/tableConfig.esm.js +25 -11
  52. package/dist/pages/Risks/tableConfig.esm.js.map +1 -1
  53. package/dist/pages/tab/ComponentTab.esm.js +72 -0
  54. package/dist/pages/tab/ComponentTab.esm.js.map +1 -0
  55. package/dist/pages/tab/SystemTab.esm.js +159 -0
  56. package/dist/pages/tab/SystemTab.esm.js.map +1 -0
  57. package/dist/pages/tab/TabProvider.esm.js +9 -3
  58. package/dist/pages/tab/TabProvider.esm.js.map +1 -1
  59. package/dist/pages/widget/ComponentWidget.esm.js +67 -0
  60. package/dist/pages/widget/ComponentWidget.esm.js.map +1 -0
  61. package/dist/pages/widget/SystemWidget.esm.js +81 -0
  62. package/dist/pages/widget/SystemWidget.esm.js.map +1 -0
  63. package/dist/pages/widget/WidgetProvider.esm.js +9 -3
  64. package/dist/pages/widget/WidgetProvider.esm.js.map +1 -1
  65. package/dist/plugin.esm.js.map +1 -1
  66. package/dist/queries/application.queries.esm.js +64 -0
  67. package/dist/queries/application.queries.esm.js.map +1 -0
  68. package/dist/queries/mttr-statistics.queries.esm.js +19 -12
  69. package/dist/queries/mttr-statistics.queries.esm.js.map +1 -1
  70. package/dist/queries/repository.queries.esm.js +19 -8
  71. package/dist/queries/repository.queries.esm.js.map +1 -1
  72. package/dist/queries/risk-score-over-time.queries.esm.js +19 -12
  73. package/dist/queries/risk-score-over-time.queries.esm.js.map +1 -1
  74. package/dist/queries/risks.queries.esm.js +19 -7
  75. package/dist/queries/risks.queries.esm.js.map +1 -1
  76. package/dist/queries/sla-breach.queries.esm.js +22 -11
  77. package/dist/queries/sla-breach.queries.esm.js.map +1 -1
  78. package/dist/queries/top-risks.queries.esm.js +19 -7
  79. package/dist/queries/top-risks.queries.esm.js.map +1 -1
  80. package/dist/theme/themeUtils.esm.js +5 -2
  81. package/dist/theme/themeUtils.esm.js.map +1 -1
  82. package/dist/utils/utils.esm.js +3 -2
  83. package/dist/utils/utils.esm.js.map +1 -1
  84. package/package.json +12 -12
  85. package/dist/pages/tab/Tab.esm.js +0 -147
  86. package/dist/pages/tab/Tab.esm.js.map +0 -1
  87. package/dist/pages/widget/Widget.esm.js +0 -161
  88. package/dist/pages/widget/Widget.esm.js.map +0 -1
@@ -0,0 +1,81 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { Content } from '@backstage/core-components';
3
+ import { useApi, fetchApiRef } from '@backstage/core-plugin-api';
4
+ import { apiiroApiRef } from '../../api/index.esm.js';
5
+ import '@tanstack/react-query';
6
+ import { useApplicationsData } from '../../queries/application.queries.esm.js';
7
+ import { useEntity } from '@backstage/plugin-catalog-react';
8
+ import { WidgetMetricsGroup } from '../../components/MetricsGroup/WidgetMetricsGroup.esm.js';
9
+ import '../../components/common/ChartBox.esm.js';
10
+ import 'react';
11
+ import 'react-dom';
12
+ import '@mui/material/styles';
13
+ import '@mui/material/Box';
14
+ import '@mui/material/Typography';
15
+ import { StatusContainer } from '../../components/common/StatusContainer.esm.js';
16
+ import { APIIRO_APPLICATION_ANNOTATION } from '@backstage-community/plugin-apiiro-common';
17
+ import { stringifyEntityRef } from '@backstage/catalog-model';
18
+
19
+ const SystemWidget = () => {
20
+ const connectBackendApi = useApi(apiiroApiRef);
21
+ const { fetch } = useApi(fetchApiRef);
22
+ const { entity } = useEntity();
23
+ const enableApplicationsView = connectBackendApi.getEnableApplicationsView();
24
+ const applicationId = entity?.metadata?.annotations?.[APIIRO_APPLICATION_ANNOTATION] || void 0;
25
+ const entityRef = stringifyEntityRef(entity);
26
+ const { applicationsData, applicationsDataLoading, applicationsDataError } = useApplicationsData({
27
+ connectApi: connectBackendApi,
28
+ fetchApi: fetch,
29
+ enabled: enableApplicationsView && !!applicationId,
30
+ applicationId,
31
+ entityRef
32
+ });
33
+ if (!enableApplicationsView) {
34
+ return /* @__PURE__ */ jsx(
35
+ StatusContainer,
36
+ {
37
+ isLoading: false,
38
+ isEmpty: true,
39
+ wrapper: Content,
40
+ notFoundMessage: "Please enable the applications view in the Apiiro plugin configuration.",
41
+ children: null
42
+ }
43
+ );
44
+ }
45
+ if (!applicationId) {
46
+ return /* @__PURE__ */ jsx(
47
+ StatusContainer,
48
+ {
49
+ isLoading: false,
50
+ isEmpty: true,
51
+ wrapper: Content,
52
+ notFoundMessage: "The Apiiro annotation hasn't been configured, or the result for this application is not available in Apiiro.",
53
+ children: null
54
+ }
55
+ );
56
+ }
57
+ const applications = applicationsData?.applications;
58
+ const applicationData = applications?.[0];
59
+ return /* @__PURE__ */ jsx(
60
+ StatusContainer,
61
+ {
62
+ isLoading: applicationsDataLoading,
63
+ error: applicationsDataError,
64
+ isEmpty: !applications || applications.length === 0,
65
+ wrapper: Content,
66
+ notFoundMessage: "Results for this application are either unavailable on Apiiro or can not be accessed.",
67
+ children: /* @__PURE__ */ jsx(
68
+ WidgetMetricsGroup,
69
+ {
70
+ applicationData,
71
+ applicationId,
72
+ entityRef,
73
+ entity
74
+ }
75
+ )
76
+ }
77
+ );
78
+ };
79
+
80
+ export { SystemWidget };
81
+ //# sourceMappingURL=SystemWidget.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SystemWidget.esm.js","sources":["../../../src/pages/widget/SystemWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Content } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { apiiroApiRef } from '../../api';\nimport { fetchApiRef } from '@backstage/core-plugin-api';\nimport { useApplicationsData } from '../../queries';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { WidgetMetricsGroup } from '../../components/MetricsGroup/WidgetMetricsGroup';\nimport { StatusContainer } from '../../components/common';\nimport { APIIRO_APPLICATION_ANNOTATION } from '@backstage-community/plugin-apiiro-common';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\nexport const SystemWidget = () => {\n const connectBackendApi = useApi(apiiroApiRef);\n const { fetch } = useApi(fetchApiRef);\n const { entity } = useEntity();\n const enableApplicationsView = connectBackendApi.getEnableApplicationsView();\n const applicationId =\n entity?.metadata?.annotations?.[APIIRO_APPLICATION_ANNOTATION] || undefined;\n const entityRef = stringifyEntityRef(entity);\n\n const { applicationsData, applicationsDataLoading, applicationsDataError } =\n useApplicationsData({\n connectApi: connectBackendApi,\n fetchApi: fetch,\n enabled: enableApplicationsView && !!applicationId,\n applicationId,\n entityRef,\n });\n\n if (!enableApplicationsView) {\n return (\n <StatusContainer\n isLoading={false}\n isEmpty\n wrapper={Content}\n notFoundMessage=\"Please enable the applications view in the Apiiro plugin configuration.\"\n >\n {null}\n </StatusContainer>\n );\n }\n\n if (!applicationId) {\n return (\n <StatusContainer\n isLoading={false}\n isEmpty\n wrapper={Content}\n notFoundMessage=\"The Apiiro annotation hasn't been configured, or the result for this application is not available in Apiiro.\"\n >\n {null}\n </StatusContainer>\n );\n }\n\n const applications = applicationsData?.applications;\n const applicationData = applications?.[0];\n\n return (\n <StatusContainer\n isLoading={applicationsDataLoading}\n error={applicationsDataError}\n isEmpty={!applications || applications.length === 0}\n wrapper={Content}\n notFoundMessage=\"Results for this application are either unavailable on Apiiro or can not be accessed.\"\n >\n <WidgetMetricsGroup\n applicationData={applicationData!}\n applicationId={applicationId!}\n entityRef={entityRef}\n entity={entity}\n />\n </StatusContainer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA0BO,MAAM,eAAe,MAAM;AAChC,EAAA,MAAM,iBAAA,GAAoB,OAAO,YAAY,CAAA;AAC7C,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,MAAA,CAAO,WAAW,CAAA;AACpC,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,sBAAA,GAAyB,kBAAkB,yBAAA,EAA0B;AAC3E,EAAA,MAAM,aAAA,GACJ,MAAA,EAAQ,QAAA,EAAU,WAAA,GAAc,6BAA6B,CAAA,IAAK,MAAA;AACpE,EAAA,MAAM,SAAA,GAAY,mBAAmB,MAAM,CAAA;AAE3C,EAAA,MAAM,EAAE,gBAAA,EAAkB,uBAAA,EAAyB,qBAAA,KACjD,mBAAA,CAAoB;AAAA,IAClB,UAAA,EAAY,iBAAA;AAAA,IACZ,QAAA,EAAU,KAAA;AAAA,IACV,OAAA,EAAS,sBAAA,IAA0B,CAAC,CAAC,aAAA;AAAA,IACrC,aAAA;AAAA,IACA;AAAA,GACD,CAAA;AAEH,EAAA,IAAI,CAAC,sBAAA,EAAwB;AAC3B,IAAA,uBACE,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,KAAA;AAAA,QACX,OAAA,EAAO,IAAA;AAAA,QACP,OAAA,EAAS,OAAA;AAAA,QACT,eAAA,EAAgB,yEAAA;AAAA,QAEf,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AAEA,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,uBACE,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,KAAA;AAAA,QACX,OAAA,EAAO,IAAA;AAAA,QACP,OAAA,EAAS,OAAA;AAAA,QACT,eAAA,EAAgB,8GAAA;AAAA,QAEf,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AAEA,EAAA,MAAM,eAAe,gBAAA,EAAkB,YAAA;AACvC,EAAA,MAAM,eAAA,GAAkB,eAAe,CAAC,CAAA;AAExC,EAAA,uBACE,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,uBAAA;AAAA,MACX,KAAA,EAAO,qBAAA;AAAA,MACP,OAAA,EAAS,CAAC,YAAA,IAAgB,YAAA,CAAa,MAAA,KAAW,CAAA;AAAA,MAClD,OAAA,EAAS,OAAA;AAAA,MACT,eAAA,EAAgB,uFAAA;AAAA,MAEhB,QAAA,kBAAA,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,eAAA;AAAA,UACA,aAAA;AAAA,UACA,SAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
@@ -1,11 +1,17 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { QueryClientProvider } from '@tanstack/react-query';
3
3
  import { queryClient } from '../../api/index.esm.js';
4
- import { Widget } from './Widget.esm.js';
4
+ import { ComponentWidget } from './ComponentWidget.esm.js';
5
+ import { SystemWidget } from './SystemWidget.esm.js';
5
6
  import { InfoCard } from '@backstage/core-components';
7
+ import { useEntity } from '@backstage/plugin-catalog-react';
6
8
 
7
9
  const ApiiroWidget = () => {
8
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(InfoCard, { title: "Apiiro Metrics", children: /* @__PURE__ */ jsx(Widget, {}) }) });
10
+ const { entity } = useEntity();
11
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxs(InfoCard, { title: "Apiiro Metrics", children: [
12
+ entity.kind === "Component" && /* @__PURE__ */ jsx(ComponentWidget, {}),
13
+ entity.kind === "System" && /* @__PURE__ */ jsx(SystemWidget, {})
14
+ ] }) });
9
15
  };
10
16
 
11
17
  export { ApiiroWidget };
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetProvider.esm.js","sources":["../../../src/pages/widget/WidgetProvider.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { QueryClientProvider } from '@tanstack/react-query';\nimport { queryClient } from '../../api';\nimport { Widget } from './Widget';\nimport { InfoCard } from '@backstage/core-components';\n\n/** @public */\nexport const ApiiroWidget = () => {\n return (\n <QueryClientProvider client={queryClient}>\n <InfoCard title=\"Apiiro Metrics\">\n <Widget />\n </InfoCard>\n </QueryClientProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,eAAe,MAAM;AAChC,EAAA,uBACE,GAAA,CAAC,mBAAA,EAAA,EAAoB,MAAA,EAAQ,WAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAM,gBAAA,EACd,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,CAAA,EACV,CAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"WidgetProvider.esm.js","sources":["../../../src/pages/widget/WidgetProvider.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { QueryClientProvider } from '@tanstack/react-query';\nimport { queryClient } from '../../api';\nimport { ComponentWidget } from './ComponentWidget';\nimport { SystemWidget } from './SystemWidget';\nimport { InfoCard } from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\n/**\n * Widget component that displays Apiiro metrics summary for system and component entities.\n * Can be added to entity overview pages to show key security metrics at a glance.\n * @public\n */\nexport const ApiiroWidget = () => {\n const { entity } = useEntity();\n return (\n <QueryClientProvider client={queryClient}>\n <InfoCard title=\"Apiiro Metrics\">\n {entity.kind === 'Component' && <ComponentWidget />}\n {entity.kind === 'System' && <SystemWidget />}\n </InfoCard>\n </QueryClientProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA2BO,MAAM,eAAe,MAAM;AAChC,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,2BACG,mBAAA,EAAA,EAAoB,MAAA,EAAQ,aAC3B,QAAA,kBAAA,IAAA,CAAC,QAAA,EAAA,EAAS,OAAM,gBAAA,EACb,QAAA,EAAA;AAAA,IAAA,MAAA,CAAO,IAAA,KAAS,WAAA,oBAAe,GAAA,CAAC,eAAA,EAAA,EAAgB,CAAA;AAAA,IAChD,MAAA,CAAO,IAAA,KAAS,QAAA,oBAAY,GAAA,CAAC,YAAA,EAAA,EAAa;AAAA,GAAA,EAC7C,CAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n configApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport { apiiroApiRef, ApiiroClient } from './api';\n\n/** @public */\nexport const apiiroPlugin = createPlugin({\n id: 'apiiro-plugin',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: apiiroApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, configApi }) =>\n new ApiiroClient({ discoveryApi, configApi }),\n }),\n ],\n});\n\n/** @public */\nexport const ApiiroPage = apiiroPlugin.provide(\n createRoutableExtension({\n name: 'ApiiroPage',\n component: () => import('./App').then(m => m.App),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;AA2BO,MAAM,eAAe,YAAA,CAAa;AAAA,EACvC,EAAA,EAAI,eAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,YAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,YAAA,EAAc,eAAA;AAAA,QACd,SAAA,EAAW;AAAA,OACb;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,SAAA,EAAU,KAClC,IAAI,YAAA,CAAa,EAAE,YAAA,EAAc,SAAA,EAAW;AAAA,KAC/C;AAAA;AAEL,CAAC;AAGM,MAAM,aAAa,YAAA,CAAa,OAAA;AAAA,EACrC,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,YAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,cAAO,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,GAAG,CAAA;AAAA,IAChD,UAAA,EAAY;AAAA,GACb;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n configApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport { apiiroApiRef, ApiiroClient } from './api';\n\n/**\n * Backstage plugin for Apiiro security insights integration.\n * Provides routes, API clients, and components for displaying security data.\n * @public\n */\nexport const apiiroPlugin = createPlugin({\n id: 'apiiro-plugin',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: apiiroApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, configApi }) =>\n new ApiiroClient({ discoveryApi, configApi }),\n }),\n ],\n});\n\n/**\n * Main page component for the Apiiro plugin.\n * Displays repositories, applications, and risks in a dedicated page.\n * @public\n */\nexport const ApiiroPage = apiiroPlugin.provide(\n createRoutableExtension({\n name: 'ApiiroPage',\n component: () => import('./App').then(m => m.App),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;AA+BO,MAAM,eAAe,YAAA,CAAa;AAAA,EACvC,EAAA,EAAI,eAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,YAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,YAAA,EAAc,eAAA;AAAA,QACd,SAAA,EAAW;AAAA,OACb;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,SAAA,EAAU,KAClC,IAAI,YAAA,CAAa,EAAE,YAAA,EAAc,SAAA,EAAW;AAAA,KAC/C;AAAA;AAEL,CAAC;AAOM,MAAM,aAAa,YAAA,CAAa,OAAA;AAAA,EACrC,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,YAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,cAAO,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,GAAG,CAAA;AAAA,IAChD,UAAA,EAAY;AAAA,GACb;AACH;;;;"}
@@ -0,0 +1,64 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { post } from '../api/index.esm.js';
3
+
4
+ const getApplicationsData = async ({
5
+ fetchApi,
6
+ signal,
7
+ connectApi,
8
+ applicationId,
9
+ entityRef
10
+ }) => {
11
+ const url = await connectApi.discoveryApi.getBaseUrl("apiiro");
12
+ const body = {};
13
+ if (applicationId) {
14
+ body.applicationId = applicationId;
15
+ }
16
+ if (entityRef) {
17
+ body.entityRef = entityRef;
18
+ }
19
+ const requestBody = Object.keys(body).length > 0 ? body : void 0;
20
+ return await post(
21
+ fetchApi,
22
+ `${url}/applications`,
23
+ {
24
+ signal,
25
+ body: requestBody
26
+ }
27
+ );
28
+ };
29
+ function useApplicationsData({
30
+ fetchApi,
31
+ connectApi,
32
+ enabled = true,
33
+ applicationId,
34
+ entityRef
35
+ }) {
36
+ const {
37
+ data: applicationsData,
38
+ error: queryError,
39
+ isLoading: applicationsDataLoading
40
+ } = useQuery({
41
+ queryKey: [
42
+ "GET_APPLICATIONS" /* GET_APPLICATIONS */,
43
+ applicationId,
44
+ entityRef
45
+ ],
46
+ queryFn: ({ signal }) => getApplicationsData({
47
+ fetchApi,
48
+ signal,
49
+ connectApi,
50
+ applicationId,
51
+ entityRef
52
+ }),
53
+ enabled
54
+ });
55
+ const applicationsDataError = queryError ? queryError : null;
56
+ return {
57
+ applicationsData,
58
+ applicationsDataError,
59
+ applicationsDataLoading
60
+ };
61
+ }
62
+
63
+ export { useApplicationsData };
64
+ //# sourceMappingURL=application.queries.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.queries.esm.js","sources":["../../src/queries/application.queries.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport {\n ApiError,\n Query,\n ApplicationSuccessResponseData,\n} from './queries.type';\n\ntype UseApplicationsDataResult = {\n applicationsData: ApplicationSuccessResponseData | undefined;\n applicationsDataError: ApiError | null;\n applicationsDataLoading: boolean;\n};\n\nexport enum APPLICATION_QUERY_KEY {\n GET_APPLICATIONS = 'GET_APPLICATIONS',\n}\n\nconst getApplicationsData = async ({\n fetchApi,\n signal,\n connectApi,\n applicationId,\n entityRef,\n}: Query & { applicationId?: string; entityRef?: string }) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (applicationId) {\n body.applicationId = applicationId;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n const requestBody = Object.keys(body).length > 0 ? body : undefined;\n\n return await post<ApplicationSuccessResponseData>(\n fetchApi,\n `${url}/applications`,\n {\n signal,\n body: requestBody,\n },\n );\n};\n\nexport function useApplicationsData({\n fetchApi,\n connectApi,\n enabled = true,\n applicationId,\n entityRef,\n}: Omit<Query, 'signal'> & {\n enabled?: boolean;\n applicationId?: string;\n entityRef?: string;\n}): UseApplicationsDataResult {\n const {\n data: applicationsData,\n error: queryError,\n isLoading: applicationsDataLoading,\n } = useQuery({\n queryKey: [\n APPLICATION_QUERY_KEY.GET_APPLICATIONS,\n applicationId,\n entityRef,\n ],\n queryFn: ({ signal }) =>\n getApplicationsData({\n fetchApi,\n signal,\n connectApi,\n applicationId,\n entityRef,\n }),\n enabled,\n });\n\n // Transform the error to match ApiError\n const applicationsDataError = queryError ? (queryError as ApiError) : null;\n\n return {\n applicationsData,\n applicationsDataError,\n applicationsDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AAiCA,MAAM,sBAAsB,OAAO;AAAA,EACjC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAA8D;AAC5D,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,OAAY,EAAC;AAEnB,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AAAA,EACvB;AAEA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAEA,EAAA,MAAM,cAAc,MAAA,CAAO,IAAA,CAAK,IAAI,CAAA,CAAE,MAAA,GAAS,IAAI,IAAA,GAAO,MAAA;AAE1D,EAAA,OAAO,MAAM,IAAA;AAAA,IACX,QAAA;AAAA,IACA,GAAG,GAAG,CAAA,aAAA,CAAA;AAAA,IACN;AAAA,MACE,MAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACF,CAAA;AAEO,SAAS,mBAAA,CAAoB;AAAA,EAClC,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA,GAAU,IAAA;AAAA,EACV,aAAA;AAAA,EACA;AACF,CAAA,EAI8B;AAC5B,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,UAAA;AAAA,IACP,SAAA,EAAW;AAAA,MACT,QAAA,CAAS;AAAA,IACX,QAAA,EAAU;AAAA,MACR,kBAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,MAAA,OACV,mBAAA,CAAoB;AAAA,MAClB,QAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACH;AAAA,GACD,CAAA;AAGD,EAAA,MAAM,qBAAA,GAAwB,aAAc,UAAA,GAA0B,IAAA;AAEtE,EAAA,OAAO;AAAA,IACL,gBAAA;AAAA,IACA,qBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -5,17 +5,21 @@ const getMttrStatisticsData = async ({
5
5
  fetchApi,
6
6
  signal,
7
7
  connectApi,
8
- repositoryKey,
9
- entityRef
8
+ repositoryId,
9
+ entityRef,
10
+ applicationId
10
11
  }) => {
11
12
  const url = await connectApi.discoveryApi.getBaseUrl("apiiro");
12
13
  const body = {};
13
- if (repositoryKey) {
14
- body.repositoryKey = repositoryKey;
14
+ if (repositoryId) {
15
+ body.repositoryId = repositoryId;
15
16
  }
16
17
  if (entityRef) {
17
18
  body.entityRef = entityRef;
18
19
  }
20
+ if (applicationId) {
21
+ body.applicationId = applicationId;
22
+ }
19
23
  return await post(
20
24
  fetchApi,
21
25
  `${url}/mttr-statistics`,
@@ -28,8 +32,9 @@ const getMttrStatisticsData = async ({
28
32
  function useMttrStatisticsData({
29
33
  fetchApi,
30
34
  connectApi,
31
- repositoryKey,
32
- entityRef
35
+ repositoryId,
36
+ entityRef,
37
+ applicationId
33
38
  }) {
34
39
  const {
35
40
  data: mttrStatisticsData,
@@ -38,17 +43,19 @@ function useMttrStatisticsData({
38
43
  } = useQuery({
39
44
  queryKey: [
40
45
  "GET_MTTR_STATISTICS" /* GET_MTTR_STATISTICS */,
41
- repositoryKey,
42
- entityRef
46
+ repositoryId,
47
+ entityRef,
48
+ applicationId
43
49
  ],
44
- queryFn: ({ signal }) => repositoryKey || entityRef ? getMttrStatisticsData({
50
+ queryFn: ({ signal }) => repositoryId || applicationId ? getMttrStatisticsData({
45
51
  fetchApi,
46
52
  signal,
47
53
  connectApi,
48
- repositoryKey,
49
- entityRef
54
+ repositoryId,
55
+ entityRef,
56
+ applicationId
50
57
  }) : Promise.resolve([]),
51
- enabled: !!(repositoryKey || entityRef)
58
+ enabled: !!repositoryId || !!applicationId
52
59
  });
53
60
  return {
54
61
  mttrStatisticsData,
@@ -1 +1 @@
1
- {"version":3,"file":"mttr-statistics.queries.esm.js","sources":["../../src/queries/mttr-statistics.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query, MttrStatisticsSuccessResponseData } from './queries.type';\n\nexport enum MTTR_STATISTICS_QUERY_KEY {\n GET_MTTR_STATISTICS = 'GET_MTTR_STATISTICS',\n}\n\nconst getMttrStatisticsData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n}: Query & {\n repositoryKey?: string;\n entityRef?: string;\n}) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryKey) {\n body.repositoryKey = repositoryKey;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n return await post<MttrStatisticsSuccessResponseData>(\n fetchApi,\n `${url}/mttr-statistics`,\n {\n signal,\n body,\n },\n );\n};\n\nexport function useMttrStatisticsData({\n fetchApi,\n connectApi,\n repositoryKey,\n entityRef,\n}: Omit<Query, 'signal'> & {\n repositoryKey?: string;\n entityRef?: string;\n}) {\n const {\n data: mttrStatisticsData,\n error: mttrStatisticsDataError,\n isLoading: mttrStatisticsDataLoading,\n } = useQuery({\n queryKey: [\n MTTR_STATISTICS_QUERY_KEY.GET_MTTR_STATISTICS,\n repositoryKey,\n entityRef,\n ],\n queryFn: ({ signal }) =>\n repositoryKey || entityRef\n ? getMttrStatisticsData({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n })\n : Promise.resolve([]),\n enabled: !!(repositoryKey || entityRef),\n });\n\n return {\n mttrStatisticsData,\n mttrStatisticsDataError,\n mttrStatisticsDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AAuBA,MAAM,wBAAwB,OAAO;AAAA,EACnC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,OAAY,EAAC;AAEnB,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AAAA,EACvB;AAEA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAEA,EAAA,OAAO,MAAM,IAAA;AAAA,IACX,QAAA;AAAA,IACA,GAAG,GAAG,CAAA,gBAAA,CAAA;AAAA,IACN;AAAA,MACE,MAAA;AAAA,MACA;AAAA;AACF,GACF;AACF,CAAA;AAEO,SAAS,qBAAA,CAAsB;AAAA,EACpC,QAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,kBAAA;AAAA,IACN,KAAA,EAAO,uBAAA;AAAA,IACP,SAAA,EAAW;AAAA,MACT,QAAA,CAAS;AAAA,IACX,QAAA,EAAU;AAAA,MACR,qBAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,SAAS,CAAC,EAAE,QAAO,KACjB,aAAA,IAAiB,YACb,qBAAA,CAAsB;AAAA,MACpB,QAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACD,CAAA,GACD,OAAA,CAAQ,OAAA,CAAQ,EAAE,CAAA;AAAA,IACxB,OAAA,EAAS,CAAC,EAAE,aAAA,IAAiB,SAAA;AAAA,GAC9B,CAAA;AAED,EAAA,OAAO;AAAA,IACL,kBAAA;AAAA,IACA,uBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"mttr-statistics.queries.esm.js","sources":["../../src/queries/mttr-statistics.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query, MttrStatisticsSuccessResponseData } from './queries.type';\n\nexport enum MTTR_STATISTICS_QUERY_KEY {\n GET_MTTR_STATISTICS = 'GET_MTTR_STATISTICS',\n}\n\nconst getMttrStatisticsData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n}: Query & {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryId) {\n body.repositoryId = repositoryId;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n if (applicationId) {\n body.applicationId = applicationId;\n }\n\n return await post<MttrStatisticsSuccessResponseData>(\n fetchApi,\n `${url}/mttr-statistics`,\n {\n signal,\n body,\n },\n );\n};\n\nexport function useMttrStatisticsData({\n fetchApi,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n}: Omit<Query, 'signal'> & {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}) {\n const {\n data: mttrStatisticsData,\n error: mttrStatisticsDataError,\n isLoading: mttrStatisticsDataLoading,\n } = useQuery({\n queryKey: [\n MTTR_STATISTICS_QUERY_KEY.GET_MTTR_STATISTICS,\n repositoryId,\n entityRef,\n applicationId,\n ],\n queryFn: ({ signal }) =>\n repositoryId || applicationId\n ? getMttrStatisticsData({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n })\n : Promise.resolve([]),\n enabled: !!repositoryId || !!applicationId,\n });\n\n return {\n mttrStatisticsData,\n mttrStatisticsDataError,\n mttrStatisticsDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AAuBA,MAAM,wBAAwB,OAAO;AAAA,EACnC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ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;AAAA,GACF;AACF;;;;"}
@@ -5,13 +5,17 @@ const getRepositoriesData = async ({
5
5
  fetchApi,
6
6
  signal,
7
7
  connectApi,
8
- repositoryKey,
9
- entityRef
8
+ repositoryId,
9
+ entityRef,
10
+ applicationId
10
11
  }) => {
11
12
  const url = await connectApi.discoveryApi.getBaseUrl("apiiro");
12
13
  const body = {};
13
- if (repositoryKey) {
14
- body.repositoryKey = repositoryKey;
14
+ if (repositoryId) {
15
+ body.repositoryId = repositoryId;
16
+ }
17
+ if (applicationId) {
18
+ body.applicationId = applicationId;
15
19
  }
16
20
  if (entityRef) {
17
21
  body.entityRef = entityRef;
@@ -30,7 +34,8 @@ function useRepositoriesData({
30
34
  fetchApi,
31
35
  connectApi,
32
36
  enabled = true,
33
- repositoryKey,
37
+ repositoryId,
38
+ applicationId,
34
39
  entityRef
35
40
  }) {
36
41
  const {
@@ -38,13 +43,19 @@ function useRepositoriesData({
38
43
  error: queryError,
39
44
  isLoading: repositoriesDataLoading
40
45
  } = useQuery({
41
- queryKey: ["GET_REPOSITORIES" /* GET_REPOSITORIES */, repositoryKey, entityRef],
46
+ queryKey: [
47
+ "GET_REPOSITORIES" /* GET_REPOSITORIES */,
48
+ repositoryId,
49
+ entityRef,
50
+ applicationId
51
+ ],
42
52
  queryFn: ({ signal }) => getRepositoriesData({
43
53
  fetchApi,
44
54
  signal,
45
55
  connectApi,
46
- repositoryKey,
47
- entityRef
56
+ repositoryId,
57
+ entityRef,
58
+ applicationId
48
59
  }),
49
60
  enabled
50
61
  });
@@ -1 +1 @@
1
- {"version":3,"file":"repository.queries.esm.js","sources":["../../src/queries/repository.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { ApiError, Query, RepositorySuccessResponseData } from './queries.type';\n\ntype UseRepositoriesDataResult = {\n repositoriesData: RepositorySuccessResponseData | undefined;\n repositoriesDataError: ApiError | null;\n repositoriesDataLoading: boolean;\n};\n\nexport enum REPOSITORY_QUERY_KEY {\n GET_REPOSITORIES = 'GET_REPOSITORIES',\n}\n\nconst getRepositoriesData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n}: Query & { repositoryKey?: string; entityRef?: string }) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryKey) {\n body.repositoryKey = repositoryKey;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n const requestBody = Object.keys(body).length > 0 ? body : undefined;\n\n return await post<RepositorySuccessResponseData>(\n fetchApi,\n `${url}/repositories`,\n {\n signal,\n body: requestBody,\n },\n );\n};\n\nexport function useRepositoriesData({\n fetchApi,\n connectApi,\n enabled = true,\n repositoryKey,\n entityRef,\n}: Omit<Query, 'signal'> & {\n enabled?: boolean;\n repositoryKey?: string;\n entityRef?: string;\n}): UseRepositoriesDataResult {\n const {\n data: repositoriesData,\n error: queryError,\n isLoading: repositoriesDataLoading,\n } = useQuery({\n queryKey: [REPOSITORY_QUERY_KEY.GET_REPOSITORIES, repositoryKey, entityRef],\n queryFn: ({ signal }) =>\n getRepositoriesData({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n }),\n enabled,\n });\n\n // Transform the error to match ApiError\n const repositoriesDataError = queryError ? (queryError as ApiError) : null;\n\n return {\n repositoriesData,\n repositoriesDataError,\n repositoriesDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AA6BA,MAAM,sBAAsB,OAAO;AAAA,EACjC,QAAA;AAAA,EACA,MAAA;AAAA,EAC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;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"repository.queries.esm.js","sources":["../../src/queries/repository.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { ApiError, Query, RepositorySuccessResponseData } from './queries.type';\n\ntype UseRepositoriesDataResult = {\n repositoriesData: RepositorySuccessResponseData | undefined;\n repositoriesDataError: ApiError | null;\n repositoriesDataLoading: boolean;\n};\n\nexport enum REPOSITORY_QUERY_KEY {\n GET_REPOSITORIES = 'GET_REPOSITORIES',\n}\n\nconst getRepositoriesData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n}: Query & {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryId) {\n body.repositoryId = repositoryId;\n }\n if (applicationId) {\n body.applicationId = applicationId;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n const requestBody = Object.keys(body).length > 0 ? body : undefined;\n\n return await post<RepositorySuccessResponseData>(\n fetchApi,\n `${url}/repositories`,\n {\n signal,\n body: requestBody,\n },\n );\n};\n\nexport function useRepositoriesData({\n fetchApi,\n connectApi,\n enabled = true,\n repositoryId,\n applicationId,\n entityRef,\n}: Omit<Query, 'signal'> & {\n enabled?: boolean;\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}): UseRepositoriesDataResult {\n const {\n data: repositoriesData,\n error: queryError,\n isLoading: repositoriesDataLoading,\n } = useQuery({\n queryKey: [\n REPOSITORY_QUERY_KEY.GET_REPOSITORIES,\n repositoryId,\n entityRef,\n applicationId,\n ],\n queryFn: ({ signal }) =>\n getRepositoriesData({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n }),\n enabled,\n });\n\n // Transform the error to match ApiError\n const repositoriesDataError = queryError ? (queryError as ApiError) : null;\n\n return {\n repositoriesData,\n repositoriesDataError,\n repositoriesDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AA6BA,MAAM,sBAAsB,OAAO;AAAA,EACjC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,OAAY,EAAC;AAEnB,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AAAA,EACtB;AACA,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AAAA,EACvB;AAEA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAEA,EAAA,MAAM,cAAc,MAAA,CAAO,IAAA,CAAK,IAAI,CAAA,CAAE,MAAA,GAAS,IAAI,IAAA,GAAO,MAAA;AAE1D,EAAA,OAAO,MAAM,IAAA;AAAA,IACX,QAAA;AAAA,IACA,GAAG,GAAG,CAAA,aAAA,CAAA;AAAA,IACN;AAAA,MACE,MAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACF,CAAA;AAEO,SAAS,mBAAA,CAAoB;AAAA,EAClC,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA,GAAU,IAAA;AAAA,EACV,YAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,EAK8B;AAC5B,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,UAAA;AAAA,IACP,SAAA,EAAW;AAAA,MACT,QAAA,CAAS;AAAA,IACX,QAAA,EAAU;AAAA,MACR,kBAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,MAAA,OACV,mBAAA,CAAoB;AAAA,MAClB,QAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACH;AAAA,GACD,CAAA;AAGD,EAAA,MAAM,qBAAA,GAAwB,aAAc,UAAA,GAA0B,IAAA;AAEtE,EAAA,OAAO;AAAA,IACL,gBAAA;AAAA,IACA,qBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -5,17 +5,21 @@ const getRiskScoreOverTimeData = async ({
5
5
  fetchApi,
6
6
  signal,
7
7
  connectApi,
8
- repositoryKey,
9
- entityRef
8
+ repositoryId,
9
+ entityRef,
10
+ applicationId
10
11
  }) => {
11
12
  const url = await connectApi.discoveryApi.getBaseUrl("apiiro");
12
13
  const body = {};
13
- if (repositoryKey) {
14
- body.repositoryKey = repositoryKey;
14
+ if (repositoryId) {
15
+ body.repositoryId = repositoryId;
15
16
  }
16
17
  if (entityRef) {
17
18
  body.entityRef = entityRef;
18
19
  }
20
+ if (applicationId) {
21
+ body.applicationId = applicationId;
22
+ }
19
23
  return await post(
20
24
  fetchApi,
21
25
  `${url}/risk-score-over-time`,
@@ -28,8 +32,9 @@ const getRiskScoreOverTimeData = async ({
28
32
  function useRiskScoreOverTimeData({
29
33
  fetchApi,
30
34
  connectApi,
31
- repositoryKey,
32
- entityRef
35
+ repositoryId,
36
+ entityRef,
37
+ applicationId
33
38
  }) {
34
39
  const {
35
40
  data: riskScoreOverTimeData,
@@ -38,17 +43,19 @@ function useRiskScoreOverTimeData({
38
43
  } = useQuery({
39
44
  queryKey: [
40
45
  "GET_RISK_SCORE_OVER_TIME" /* GET_RISK_SCORE_OVER_TIME */,
41
- repositoryKey,
42
- entityRef
46
+ repositoryId,
47
+ entityRef,
48
+ applicationId
43
49
  ],
44
- queryFn: ({ signal }) => repositoryKey || entityRef ? getRiskScoreOverTimeData({
50
+ queryFn: ({ signal }) => repositoryId || applicationId ? getRiskScoreOverTimeData({
45
51
  fetchApi,
46
52
  signal,
47
53
  connectApi,
48
- repositoryKey,
49
- entityRef
54
+ repositoryId,
55
+ entityRef,
56
+ applicationId
50
57
  }) : Promise.resolve([]),
51
- enabled: !!(repositoryKey || entityRef)
58
+ enabled: !!repositoryId || !!applicationId
52
59
  });
53
60
  return {
54
61
  riskScoreOverTimeData,
@@ -1 +1 @@
1
- {"version":3,"file":"risk-score-over-time.queries.esm.js","sources":["../../src/queries/risk-score-over-time.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query, RiskScoreOverTimeSuccessResponseData } from './queries.type';\n\nexport enum RISK_SCORE_OVER_TIME_QUERY_KEY {\n GET_RISK_SCORE_OVER_TIME = 'GET_RISK_SCORE_OVER_TIME',\n}\n\nconst getRiskScoreOverTimeData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n}: Query & { repositoryKey?: string; entityRef?: string }) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryKey) {\n body.repositoryKey = repositoryKey;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n return await post<RiskScoreOverTimeSuccessResponseData>(\n fetchApi,\n `${url}/risk-score-over-time`,\n {\n signal,\n body,\n },\n );\n};\n\nexport function useRiskScoreOverTimeData({\n fetchApi,\n connectApi,\n repositoryKey,\n entityRef,\n}: Omit<Query, 'signal'> & { repositoryKey?: string; entityRef?: string }) {\n const {\n data: riskScoreOverTimeData,\n error: riskScoreOverTimeDataError,\n isLoading: riskScoreOverTimeDataLoading,\n } = useQuery({\n queryKey: [\n RISK_SCORE_OVER_TIME_QUERY_KEY.GET_RISK_SCORE_OVER_TIME,\n repositoryKey,\n entityRef,\n ],\n queryFn: ({ signal }) =>\n repositoryKey || entityRef\n ? getRiskScoreOverTimeData({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n })\n : Promise.resolve([]),\n enabled: !!(repositoryKey || entityRef),\n });\n\n return {\n riskScoreOverTimeData,\n riskScoreOverTimeDataError,\n riskScoreOverTimeDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AAuBA,MAAM,2BAA2B,OAAO;AAAA,EACtC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAA8D;AAC5D,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,OAAY,EAAC;AAEnB,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AAAA,EACvB;AAEA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAEA,EAAA,OAAO,MAAM,IAAA;AAAA,IACX,QAAA;AAAA,IACA,GAAG,GAAG,CAAA,qBAAA,CAAA;AAAA,IACN;AAAA,MACE,MAAA;AAAA,MACA;AAAA;AACF,GACF;AACF,CAAA;AAEO,SAAS,wBAAA,CAAyB;AAAA,EACvC,QAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,EAA2E;AACzE,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,qBAAA;AAAA,IACN,KAAA,EAAO,0BAAA;AAAA,IACP,SAAA,EAAW;AAAA,MACT,QAAA,CAAS;AAAA,IACX,QAAA,EAAU;AAAA,MACR,0BAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,SAAS,CAAC,EAAE,QAAO,KACjB,aAAA,IAAiB,YACb,wBAAA,CAAyB;AAAA,MACvB,QAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACD,CAAA,GACD,OAAA,CAAQ,OAAA,CAAQ,EAAE,CAAA;AAAA,IACxB,OAAA,EAAS,CAAC,EAAE,aAAA,IAAiB,SAAA;AAAA,GAC9B,CAAA;AAED,EAAA,OAAO;AAAA,IACL,qBAAA;AAAA,IACA,0BAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"risk-score-over-time.queries.esm.js","sources":["../../src/queries/risk-score-over-time.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query, RiskScoreOverTimeSuccessResponseData } from './queries.type';\n\nexport enum RISK_SCORE_OVER_TIME_QUERY_KEY {\n GET_RISK_SCORE_OVER_TIME = 'GET_RISK_SCORE_OVER_TIME',\n}\n\nconst getRiskScoreOverTimeData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n}: Query & {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryId) {\n body.repositoryId = repositoryId;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n if (applicationId) {\n body.applicationId = applicationId;\n }\n\n return await post<RiskScoreOverTimeSuccessResponseData>(\n fetchApi,\n `${url}/risk-score-over-time`,\n {\n signal,\n body,\n },\n );\n};\n\nexport function useRiskScoreOverTimeData({\n fetchApi,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n}: Omit<Query, 'signal'> & {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}) {\n const {\n data: riskScoreOverTimeData,\n error: riskScoreOverTimeDataError,\n isLoading: riskScoreOverTimeDataLoading,\n } = useQuery({\n queryKey: [\n RISK_SCORE_OVER_TIME_QUERY_KEY.GET_RISK_SCORE_OVER_TIME,\n repositoryId,\n entityRef,\n applicationId,\n ],\n queryFn: ({ signal }) =>\n repositoryId || applicationId\n ? getRiskScoreOverTimeData({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n })\n : Promise.resolve([]),\n enabled: !!repositoryId || !!applicationId,\n });\n\n return {\n riskScoreOverTimeData,\n riskScoreOverTimeDataError,\n riskScoreOverTimeDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AAuBA,MAAM,2BAA2B,OAAO;AAAA,EACtC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,OAAY,EAAC;AAEnB,EAAA,I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
9
9
  entityRef,
10
+ applicationId,
10
11
  filters
11
12
  }) => {
12
13
  const url = await connectApi.discoveryApi.getBaseUrl("apiiro");
13
14
  const body = { filters };
14
- if (repositoryKey) {
15
- body.repositoryKey = repositoryKey;
15
+ if (repositoryId) {
16
+ body.repositoryId = repositoryId;
16
17
  }
17
18
  if (entityRef) {
18
19
  body.entityRef = entityRef;
19
20
  }
21
+ if (applicationId) {
22
+ body.applicationId = applicationId;
23
+ }
20
24
  return await post(fetchApi, `${url}/risks`, {
21
25
  signal,
22
26
  body
@@ -25,8 +29,9 @@ const getRisksData = async ({
25
29
  function useRisksData({
26
30
  fetchApi,
27
31
  connectApi,
28
- repositoryKey,
32
+ repositoryId,
29
33
  entityRef,
34
+ applicationId,
30
35
  filters
31
36
  }) {
32
37
  const {
@@ -34,16 +39,23 @@ function useRisksData({
34
39
  error: risksDataError,
35
40
  isLoading: risksDataLoading
36
41
  } = useQuery({
37
- queryKey: ["GET_RISKS" /* GET_RISKS */, repositoryKey, entityRef, filters],
42
+ queryKey: [
43
+ "GET_RISKS" /* GET_RISKS */,
44
+ repositoryId,
45
+ entityRef,
46
+ applicationId,
47
+ filters
48
+ ],
38
49
  queryFn: ({ signal }) => getRisksData({
39
50
  fetchApi,
40
51
  signal,
41
52
  connectApi,
42
- repositoryKey,
53
+ repositoryId,
43
54
  entityRef,
55
+ applicationId,
44
56
  filters
45
57
  }),
46
- enabled: !!(repositoryKey || entityRef),
58
+ enabled: !!repositoryId || !!applicationId,
47
59
  staleTime: 2 * 60 * 1e3,
48
60
  // Consider data fresh for 2 minutes
49
61
  gcTime: 5 * 60 * 1e3,
@@ -1 +1 @@
1
- {"version":3,"file":"risks.queries.esm.js","sources":["../../src/queries/risks.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query } from './queries.type';\n\nexport enum RISK_QUERY_KEY {\n GET_RISKS = 'GET_RISKS',\n}\n\ninterface RisksQuery extends Query {\n repositoryKey?: string;\n entityRef?: string;\n filters?: {\n RiskCategory?: string[];\n RiskLevel?: string[];\n FindingCategory?: string[];\n RiskInsight?: string[];\n DiscoveredOn?: {\n start?: string;\n end?: string;\n };\n };\n}\n\nconst getRisksData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n filters,\n}: RisksQuery) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = { filters };\n\n if (repositoryKey) {\n body.repositoryKey = repositoryKey;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n return await post<any>(fetchApi, `${url}/risks`, {\n signal,\n body,\n });\n};\n\nexport function useRisksData({\n fetchApi,\n connectApi,\n repositoryKey,\n entityRef,\n filters,\n}: Omit<RisksQuery, 'signal'>) {\n const {\n data: risksData,\n error: risksDataError,\n isLoading: risksDataLoading,\n } = useQuery({\n queryKey: [RISK_QUERY_KEY.GET_RISKS, repositoryKey, entityRef, filters],\n queryFn: ({ signal }) =>\n getRisksData({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n filters,\n }),\n enabled: !!(repositoryKey || entityRef),\n staleTime: 2 * 60 * 1000, // Consider data fresh for 2 minutes\n gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes\n refetchOnMount: 'always', // Always refetch but don't block with loading if cache exists\n refetchOnWindowFocus: false, // Don't refetch on window focus to avoid unnecessary calls\n });\n\n return {\n risksData,\n risksDataError,\n risksDataLoading, // Only show loading on initial load, not during background refetch\n };\n}\n"],"names":[],"mappings":";;;AA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AK,GAAA;AAAA;AAAA,IACjB,cAAA,EAAgB,QAAA;AAAA;AAAA,IAChB,oBAAA,EAAsB;AAAA;AAAA,GACvB,CAAA;AAED,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"risks.queries.esm.js","sources":["../../src/queries/risks.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query } from './queries.type';\n\nexport enum RISK_QUERY_KEY {\n GET_RISKS = 'GET_RISKS',\n}\n\ninterface RisksQuery extends Query {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n filters?: {\n RiskCategory?: string[];\n RiskLevel?: string[];\n FindingCategory?: string[];\n RiskInsight?: string[];\n DiscoveredOn?: {\n start?: string;\n end?: string;\n };\n };\n}\n\nconst getRisksData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n filters,\n}: RisksQuery) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = { filters };\n\n if (repositoryId) {\n body.repositoryId = repositoryId;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n if (applicationId) {\n body.applicationId = applicationId;\n }\n\n return await post<any>(fetchApi, `${url}/risks`, {\n signal,\n body,\n });\n};\n\nexport function useRisksData({\n fetchApi,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n filters,\n}: Omit<RisksQuery, 'signal'>) {\n const {\n data: risksData,\n error: risksDataError,\n isLoading: risksDataLoading,\n } = useQuery({\n queryKey: [\n RISK_QUERY_KEY.GET_RISKS,\n repositoryId,\n entityRef,\n applicationId,\n filters,\n ],\n queryFn: ({ signal }) =>\n getRisksData({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n filters,\n }),\n enabled: !!repositoryId || !!applicationId,\n staleTime: 2 * 60 * 1000, // Consider data fresh for 2 minutes\n gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes\n refetchOnMount: 'always', // Always refetch but don't block with loading if cache exists\n refetchOnWindowFocus: false, // Don't refetch on window focus to avoid unnecessary calls\n });\n\n return {\n risksData,\n risksDataError,\n risksDataLoading, // Only show loading on initial load, not during background refetch\n };\n}\n"],"names":[],"mappings":";;;AAuCA,MAAM,eAAe,OAAO;AAAA,EAC1B,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAAkB;AAChB,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,IAAA,GAAY,EAAE,OAAA,EAAQ;AAE5B,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AAAA,EACtB;AAEA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAEA,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AAAA,EACvB;AAEA,EAAA,OAAO,MAAM,IAAA,CAAU,QAAA,EAAU,CAAA,EAAG,GAAG,CAAA,MAAA,CAAA,EAAU;AAAA,IAC/C,MAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH,CAAA;AAEO,SAAS,YAAA,CAAa;AAAA,EAC3B,QAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,EAA+B;AAC7B,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,SAAA;AAAA,IACN,KAAA,EAAO,cAAA;AAAA,IACP,SAAA,EAAW;AAAA,MACT,QAAA,CAAS;AAAA,IACX,QAAA,EAAU;AAAA,MACR,WAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,MAAA,OACV,YAAA,CAAa;AAAA,MACX,QAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACH,OAAA,EAAS,CAAC,CAAC,YAAA,IAAgB,CAAC,CAAC,aAAA;AAAA,IAC7B,SAAA,EAAW,IAAI,EAAA,GAAK,GAAA;AAAA;AAAA,IACpB,MAAA,EAAQ,IAAI,EAAA,GAAK,GAAA;AAAA;AAAA,IACjB,cAAA,EAAgB,QAAA;AAAA;AAAA,IAChB,oBAAA,EAAsB;AAAA;AAAA,GACvB,CAAA;AAED,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA;AAAA,GACF;AACF;;;;"}
@@ -5,17 +5,21 @@ const getSlaBreachData = async ({
5
5
  fetchApi,
6
6
  signal,
7
7
  connectApi,
8
- repositoryKey,
9
- entityRef
8
+ repositoryId,
9
+ entityRef,
10
+ applicationId
10
11
  }) => {
11
12
  const url = await connectApi.discoveryApi.getBaseUrl("apiiro");
12
13
  const body = {};
13
- if (repositoryKey) {
14
- body.repositoryKey = repositoryKey;
14
+ if (repositoryId) {
15
+ body.repositoryId = repositoryId;
15
16
  }
16
17
  if (entityRef) {
17
18
  body.entityRef = entityRef;
18
19
  }
20
+ if (applicationId) {
21
+ body.applicationId = applicationId;
22
+ }
19
23
  return await post(
20
24
  fetchApi,
21
25
  `${url}/sla-breach`,
@@ -28,23 +32,30 @@ const getSlaBreachData = async ({
28
32
  function useSlaBreachData({
29
33
  fetchApi,
30
34
  connectApi,
31
- repositoryKey,
32
- entityRef
35
+ repositoryId,
36
+ entityRef,
37
+ applicationId
33
38
  }) {
34
39
  const {
35
40
  data: slaBreachData,
36
41
  error: slaBreachDataError,
37
42
  isLoading: slaBreachDataLoading
38
43
  } = useQuery({
39
- queryKey: ["GET_SLA_BREACH" /* GET_SLA_BREACH */, repositoryKey, entityRef],
40
- queryFn: ({ signal }) => repositoryKey || entityRef ? getSlaBreachData({
44
+ queryKey: [
45
+ "GET_SLA_BREACH" /* GET_SLA_BREACH */,
46
+ repositoryId,
47
+ entityRef,
48
+ applicationId
49
+ ],
50
+ queryFn: ({ signal }) => repositoryId || applicationId ? getSlaBreachData({
41
51
  fetchApi,
42
52
  signal,
43
53
  connectApi,
44
- repositoryKey,
45
- entityRef
54
+ repositoryId,
55
+ entityRef,
56
+ applicationId
46
57
  }) : Promise.resolve([]),
47
- enabled: !!(repositoryKey || entityRef)
58
+ enabled: !!repositoryId || !!applicationId
48
59
  });
49
60
  return {
50
61
  slaBreachData,
@@ -1 +1 @@
1
- {"version":3,"file":"sla-breach.queries.esm.js","sources":["../../src/queries/sla-breach.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query, SlaBreachSuccessResponseData } from './queries.type';\n\nexport enum SLA_BREACH_QUERY_KEY {\n GET_SLA_BREACH = 'GET_SLA_BREACH',\n}\n\nconst getSlaBreachData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n}: Query & { repositoryKey?: string; entityRef?: string }) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryKey) {\n body.repositoryKey = repositoryKey;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n return await post<SlaBreachSuccessResponseData>(\n fetchApi,\n `${url}/sla-breach`,\n {\n signal,\n body,\n },\n );\n};\n\nexport function useSlaBreachData({\n fetchApi,\n connectApi,\n repositoryKey,\n entityRef,\n}: Omit<Query, 'signal'> & { repositoryKey?: string; entityRef?: string }) {\n const {\n data: slaBreachData,\n error: slaBreachDataError,\n isLoading: slaBreachDataLoading,\n } = useQuery({\n queryKey: [SLA_BREACH_QUERY_KEY.GET_SLA_BREACH, repositoryKey, entityRef],\n queryFn: ({ signal }) =>\n repositoryKey || entityRef\n ? getSlaBreachData({\n fetchApi,\n signal,\n connectApi,\n repositoryKey,\n entityRef,\n })\n : Promise.resolve([]),\n enabled: !!(repositoryKey || entityRef),\n });\n\n return {\n slaBreachData,\n slaBreachDataError,\n slaBreachDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AAuBA,MAAM,mBAAmB,OAAO;AAAA,EAC9B,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAA8D;AAC5D,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,OAAY,EAAC;AAEnB,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AAAA,EACvB;AAEA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAEA,EAAA,OAAO,MAAM,IAAA;AAAA,IACX,QAAA;AAAA,IACA,GAAG,GAAG,CAAA,WAAA,CAAA;AAAA,IACN;AAAA,MACE,MAAA;AAAA,MACA;AAAA;AACF,GACF;AACF,CAAA;AAEO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,QAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,EAA2E;AACzE,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,aAAA;AAAA,IACN,KAAA,EAAO,kBAAA;AAAA,IACP,SAAA,EAAW;AAAA,MACT,QAAA,CAAS;AAAA,IACX,QAAA,EAAU,CAAC,gBAAA,uBAAqC,aAAA,EAAe,SAAS,CAAA;AAAA,IACxE,SAAS,CAAC,EAAE,QAAO,KACjB,aAAA,IAAiB,YACb,gBAAA,CAAiB;AAAA,MACf,QAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACD,CAAA,GACD,OAAA,CAAQ,OAAA,CAAQ,EAAE,CAAA;AAAA,IACxB,OAAA,EAAS,CAAC,EAAE,aAAA,IAAiB,SAAA;AAAA,GAC9B,CAAA;AAED,EAAA,OAAO;AAAA,IACL,aAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"sla-breach.queries.esm.js","sources":["../../src/queries/sla-breach.queries.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useQuery } from '@tanstack/react-query';\nimport { post } from '../api';\nimport { Query, SlaBreachSuccessResponseData } from './queries.type';\n\nexport enum SLA_BREACH_QUERY_KEY {\n GET_SLA_BREACH = 'GET_SLA_BREACH',\n}\n\nconst getSlaBreachData = async ({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n}: Query & {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}) => {\n const url = await connectApi.discoveryApi.getBaseUrl('apiiro');\n const body: any = {};\n\n if (repositoryId) {\n body.repositoryId = repositoryId;\n }\n\n if (entityRef) {\n body.entityRef = entityRef;\n }\n\n if (applicationId) {\n body.applicationId = applicationId;\n }\n\n return await post<SlaBreachSuccessResponseData>(\n fetchApi,\n `${url}/sla-breach`,\n {\n signal,\n body,\n },\n );\n};\n\nexport function useSlaBreachData({\n fetchApi,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n}: Omit<Query, 'signal'> & {\n repositoryId?: string;\n entityRef?: string;\n applicationId?: string;\n}) {\n const {\n data: slaBreachData,\n error: slaBreachDataError,\n isLoading: slaBreachDataLoading,\n } = useQuery({\n queryKey: [\n SLA_BREACH_QUERY_KEY.GET_SLA_BREACH,\n repositoryId,\n entityRef,\n applicationId,\n ],\n queryFn: ({ signal }) =>\n repositoryId || applicationId\n ? getSlaBreachData({\n fetchApi,\n signal,\n connectApi,\n repositoryId,\n entityRef,\n applicationId,\n })\n : Promise.resolve([]),\n enabled: !!repositoryId || !!applicationId,\n });\n\n return {\n slaBreachData,\n slaBreachDataError,\n slaBreachDataLoading,\n };\n}\n"],"names":[],"mappings":";;;AAuBA,MAAM,mBAAmB,OAAO;AAAA,EAC9B,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,GAAA,GAAM,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,QAAQ,CAAA;AAC7D,EAAA,MAAM,OAAY,EAAC;AAEnB,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,IAA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