@grafana/alerting 13.2.0-28908703397 → 13.2.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 (150) hide show
  1. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/fakes/Receivers.cjs +3 -3
  2. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/fakes/Receivers.cjs.map +1 -0
  3. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/fakes/Routes.cjs +3 -3
  4. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/fakes/Routes.cjs.map +1 -0
  5. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/fakes/common.cjs.map +1 -0
  6. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/createReceiverHandler.cjs +2 -2
  7. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/createReceiverHandler.cjs.map +1 -0
  8. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.cjs +2 -2
  9. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.cjs.map +1 -0
  10. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.cjs +2 -2
  11. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.cjs.map +1 -0
  12. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/getReceiverHandler.cjs +2 -2
  13. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/getReceiverHandler.cjs.map +1 -0
  14. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs +2 -2
  15. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs.map +1 -0
  16. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.cjs +2 -2
  17. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.cjs.map +1 -0
  18. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/updateReceiverHandler.cjs +2 -2
  19. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/updateReceiverHandler.cjs.map +1 -0
  20. package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.cjs +2 -2
  21. package/dist/cjs/grafana/api/notifications/v1beta1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.cjs.map +1 -0
  22. package/dist/cjs/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.cjs +1 -1
  23. package/dist/cjs/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.cjs.map +1 -1
  24. package/dist/cjs/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.cjs +2 -2
  25. package/dist/cjs/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.cjs.map +1 -1
  26. package/dist/cjs/grafana/contactPoints/hooks/{v0alpha1 → v1beta1}/useContactPoints.cjs +2 -2
  27. package/dist/cjs/grafana/contactPoints/hooks/v1beta1/useContactPoints.cjs.map +1 -0
  28. package/dist/cjs/grafana/contactPoints/utils.cjs.map +1 -1
  29. package/dist/cjs/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.cjs.map +1 -1
  30. package/dist/cjs/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.cjs +2 -2
  31. package/dist/cjs/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.cjs.map +1 -1
  32. package/dist/cjs/grafana/notificationPolicies/hooks/useMatchPolicies.cjs +2 -2
  33. package/dist/cjs/grafana/notificationPolicies/hooks/useMatchPolicies.cjs.map +1 -1
  34. package/dist/cjs/grafana/notificationPolicies/hooks/useRoutingTrees.cjs +2 -2
  35. package/dist/cjs/grafana/notificationPolicies/hooks/useRoutingTrees.cjs.map +1 -1
  36. package/dist/cjs/grafana/notificationPolicies/routingTrees.cjs +1 -1
  37. package/dist/cjs/grafana/notificationPolicies/routingTrees.cjs.map +1 -1
  38. package/dist/cjs/grafana/notificationPolicies/utils.cjs.map +1 -1
  39. package/dist/cjs/testing.cjs +12 -12
  40. package/dist/cjs/unstable.cjs +7 -7
  41. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/fakes/Receivers.mjs +1 -1
  42. package/dist/esm/grafana/api/notifications/v1beta1/mocks/fakes/Receivers.mjs.map +1 -0
  43. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/fakes/Routes.mjs +1 -1
  44. package/dist/esm/grafana/api/notifications/v1beta1/mocks/fakes/Routes.mjs.map +1 -0
  45. package/dist/esm/grafana/api/notifications/v1beta1/mocks/fakes/common.mjs.map +1 -0
  46. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/createReceiverHandler.mjs +1 -1
  47. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/createReceiverHandler.mjs.map +1 -0
  48. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.mjs +1 -1
  49. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.mjs.map +1 -0
  50. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.mjs +1 -1
  51. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.mjs.map +1 -0
  52. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/getReceiverHandler.mjs +1 -1
  53. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/getReceiverHandler.mjs.map +1 -0
  54. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/listReceiverHandler.mjs +1 -1
  55. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/listReceiverHandler.mjs.map +1 -0
  56. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.mjs +1 -1
  57. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.mjs.map +1 -0
  58. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/updateReceiverHandler.mjs +1 -1
  59. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/updateReceiverHandler.mjs.map +1 -0
  60. package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.mjs +1 -1
  61. package/dist/esm/grafana/api/notifications/v1beta1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.mjs.map +1 -0
  62. package/dist/esm/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.mjs +1 -1
  63. package/dist/esm/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.mjs.map +1 -1
  64. package/dist/esm/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.mjs +2 -2
  65. package/dist/esm/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.mjs.map +1 -1
  66. package/dist/esm/grafana/contactPoints/hooks/{v0alpha1 → v1beta1}/useContactPoints.mjs +1 -1
  67. package/dist/esm/grafana/contactPoints/hooks/v1beta1/useContactPoints.mjs.map +1 -0
  68. package/dist/esm/grafana/contactPoints/utils.mjs.map +1 -1
  69. package/dist/esm/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.mjs.map +1 -1
  70. package/dist/esm/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.mjs +2 -2
  71. package/dist/esm/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.mjs.map +1 -1
  72. package/dist/esm/grafana/notificationPolicies/hooks/useMatchPolicies.mjs +1 -1
  73. package/dist/esm/grafana/notificationPolicies/hooks/useMatchPolicies.mjs.map +1 -1
  74. package/dist/esm/grafana/notificationPolicies/hooks/useRoutingTrees.mjs +1 -1
  75. package/dist/esm/grafana/notificationPolicies/hooks/useRoutingTrees.mjs.map +1 -1
  76. package/dist/esm/grafana/notificationPolicies/routingTrees.mjs +1 -1
  77. package/dist/esm/grafana/notificationPolicies/routingTrees.mjs.map +1 -1
  78. package/dist/esm/grafana/notificationPolicies/utils.mjs.map +1 -1
  79. package/dist/esm/testing.mjs +12 -12
  80. package/dist/esm/unstable.mjs +3 -3
  81. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/fakes/Receivers.d.ts +108 -108
  82. package/dist/types/grafana/api/notifications/v1beta1/mocks/fakes/Routes.d.ts +41 -0
  83. package/dist/types/grafana/api/notifications/v1beta1/mocks/fakes/common.d.ts +20 -0
  84. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/createReceiverHandler.d.ts +1 -1
  85. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.d.ts +1 -1
  86. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.d.ts +1 -1
  87. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/getReceiverHandler.d.ts +1 -1
  88. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.d.ts +1 -1
  89. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/updateReceiverHandler.d.ts +1 -1
  90. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.d.ts +1 -1
  91. package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/types.d.ts +1 -1
  92. package/dist/types/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.d.ts +2 -2
  93. package/dist/types/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.d.ts +6 -6
  94. package/dist/types/grafana/contactPoints/hooks/{v0alpha1 → v1beta1}/useContactPoints.d.ts +5 -5
  95. package/dist/types/grafana/contactPoints/utils.d.ts +2 -2
  96. package/dist/types/grafana/matchers/types.d.ts +1 -1
  97. package/dist/types/grafana/mocks/util.d.ts +1 -1
  98. package/dist/types/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.d.ts +2 -6
  99. package/dist/types/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.d.ts +3 -3
  100. package/dist/types/grafana/notificationPolicies/hooks/useMatchPolicies.d.ts +2 -2
  101. package/dist/types/grafana/notificationPolicies/hooks/useRoutingTrees.d.ts +5 -6
  102. package/dist/types/grafana/notificationPolicies/routingTrees.d.ts +2 -2
  103. package/dist/types/grafana/notificationPolicies/types.d.ts +1 -1
  104. package/dist/types/grafana/notificationPolicies/utils.d.ts +2 -2
  105. package/dist/types/grafana/rules/components/labels/AlertLabel.d.ts +1 -1
  106. package/dist/types/grafana/rules/components/labels/AlertLabels.d.ts +1 -1
  107. package/dist/types/grafana/rules/components/state/StateDot.d.ts +1 -1
  108. package/dist/types/grafana/rules/components/state/StateIcon.d.ts +1 -1
  109. package/dist/types/grafana/rules/components/state/StateText.d.ts +1 -1
  110. package/dist/types/testing.d.ts +4 -4
  111. package/dist/types/unstable.d.ts +3 -3
  112. package/package.json +14 -12
  113. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/fakes/Receivers.cjs.map +0 -1
  114. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/fakes/Routes.cjs.map +0 -1
  115. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/fakes/common.cjs.map +0 -1
  116. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/createReceiverHandler.cjs.map +0 -1
  117. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.cjs.map +0 -1
  118. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.cjs.map +0 -1
  119. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/getReceiverHandler.cjs.map +0 -1
  120. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs.map +0 -1
  121. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.cjs.map +0 -1
  122. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/updateReceiverHandler.cjs.map +0 -1
  123. package/dist/cjs/grafana/api/notifications/v0alpha1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.cjs.map +0 -1
  124. package/dist/cjs/grafana/contactPoints/hooks/v0alpha1/useContactPoints.cjs.map +0 -1
  125. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/fakes/Receivers.mjs.map +0 -1
  126. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/fakes/Routes.mjs.map +0 -1
  127. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/fakes/common.mjs.map +0 -1
  128. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/createReceiverHandler.mjs.map +0 -1
  129. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.mjs.map +0 -1
  130. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.mjs.map +0 -1
  131. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/getReceiverHandler.mjs.map +0 -1
  132. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/listReceiverHandler.mjs.map +0 -1
  133. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.mjs.map +0 -1
  134. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/updateReceiverHandler.mjs.map +0 -1
  135. package/dist/esm/grafana/api/notifications/v0alpha1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.mjs.map +0 -1
  136. package/dist/esm/grafana/contactPoints/hooks/v0alpha1/useContactPoints.mjs.map +0 -1
  137. package/dist/types/grafana/api/notifications/v0alpha1/mocks/fakes/Routes.d.ts +0 -41
  138. package/dist/types/grafana/api/notifications/v0alpha1/mocks/fakes/common.d.ts +0 -20
  139. /package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/fakes/common.cjs +0 -0
  140. /package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/index.cjs +0 -0
  141. /package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/index.cjs.map +0 -0
  142. /package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/types.cjs +0 -0
  143. /package/dist/cjs/grafana/api/notifications/{v0alpha1 → v1beta1}/types.cjs.map +0 -0
  144. /package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/fakes/common.mjs +0 -0
  145. /package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/index.mjs +0 -0
  146. /package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/index.mjs.map +0 -0
  147. /package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/types.mjs +0 -0
  148. /package/dist/esm/grafana/api/notifications/{v0alpha1 → v1beta1}/types.mjs.map +0 -0
  149. /package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/ReceiverHandlers/listReceiverHandler.d.ts +0 -0
  150. /package/dist/types/grafana/api/notifications/{v0alpha1 → v1beta1}/mocks/handlers/index.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"routingTrees.cjs","sources":["../../../../src/grafana/notificationPolicies/routingTrees.ts"],"sourcesContent":["import { type RoutingTree } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';\n\n/** The name the backend emits for the default (root) routing tree and the name the frontend SENDS. */\nexport const USER_DEFINED_TREE_NAME = 'user-defined';\n\n/** Future canonical name the backend may emit for the default (root) routing tree; accepted on the read side. */\nexport const DEFAULT_ROUTING_TREE_NAME_ALIAS = 'default';\n\n/**\n * Reports whether a routing-tree name refers to the default (root) routing tree.\n *\n * Accepts both the emitted name (`user-defined`) and the future canonical alias (`default`), mirroring the\n * backend's IsDefaultRoutingTreeName. Also treats an absent name (empty string / undefined) as the default,\n * because the frontend uses \"no name\" to mean the root route.\n */\nexport function isDefaultRoutingTreeName(name?: string | null): boolean {\n return (\n name === undefined ||\n name === null ||\n name === '' ||\n name === USER_DEFINED_TREE_NAME ||\n name === DEFAULT_ROUTING_TREE_NAME_ALIAS\n );\n}\n\n/**\n * Check if the given routing tree is the default (root) policy tree.\n */\nexport function isDefaultRoutingTree(tree: RoutingTree): boolean {\n return isDefaultRoutingTreeName(tree.metadata.name);\n}\n"],"names":[],"mappings":";;;;;AAGO,MAAM,sBAAA,GAAyB;AAG/B,MAAM,+BAAA,GAAkC;AASxC,SAAS,yBAAyB,IAAA,EAA+B;AACtE,EAAA,OACE,IAAA,KAAS,UACT,IAAA,KAAS,IAAA,IACT,SAAS,EAAA,IACT,IAAA,KAAS,0BACT,IAAA,KAAS,+BAAA;AAEb;AAKO,SAAS,qBAAqB,IAAA,EAA4B;AAC/D,EAAA,OAAO,wBAAA,CAAyB,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA;AACpD;;;;;;;"}
1
+ {"version":3,"file":"routingTrees.cjs","sources":["../../../../src/grafana/notificationPolicies/routingTrees.ts"],"sourcesContent":["import { type RoutingTree } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\n/** The name the backend emits for the default (root) routing tree and the name the frontend SENDS. */\nexport const USER_DEFINED_TREE_NAME = 'user-defined';\n\n/** Future canonical name the backend may emit for the default (root) routing tree; accepted on the read side. */\nexport const DEFAULT_ROUTING_TREE_NAME_ALIAS = 'default';\n\n/**\n * Reports whether a routing-tree name refers to the default (root) routing tree.\n *\n * Accepts both the emitted name (`user-defined`) and the future canonical alias (`default`), mirroring the\n * backend's IsDefaultRoutingTreeName. Also treats an absent name (empty string / undefined) as the default,\n * because the frontend uses \"no name\" to mean the root route.\n */\nexport function isDefaultRoutingTreeName(name?: string): boolean {\n return (\n name === undefined || name === '' || name === USER_DEFINED_TREE_NAME || name === DEFAULT_ROUTING_TREE_NAME_ALIAS\n );\n}\n\n/**\n * Check if the given routing tree is the default (root) policy tree.\n */\nexport function isDefaultRoutingTree(tree: RoutingTree): boolean {\n return isDefaultRoutingTreeName(tree.metadata.name);\n}\n"],"names":[],"mappings":";;;;;AAGO,MAAM,sBAAA,GAAyB;AAG/B,MAAM,+BAAA,GAAkC;AASxC,SAAS,yBAAyB,IAAA,EAAwB;AAC/D,EAAA,OACE,SAAS,KAAA,CAAA,IAAa,IAAA,KAAS,EAAA,IAAM,IAAA,KAAS,0BAA0B,IAAA,KAAS,+BAAA;AAErF;AAKO,SAAS,qBAAqB,IAAA,EAA4B;AAC/D,EAAA,OAAO,wBAAA,CAAyB,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA;AACpD;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sources":["../../../../src/grafana/notificationPolicies/utils.ts"],"sourcesContent":["import { groupBy, isArray, pick, reduce, uniqueId } from 'lodash';\n\nimport { type RoutingTree, type RoutingTreeRoute } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';\n\nimport { type Label } from '../matchers/types';\nimport { type LabelMatchDetails, matchLabels } from '../matchers/utils';\n\nimport { type Route, type RouteWithID } from './types';\n\nexport const INHERITABLE_KEYS = ['receiver', 'group_by', 'group_wait', 'group_interval', 'repeat_interval'] as const;\ntype InheritableKeys = typeof INHERITABLE_KEYS;\nexport type InheritableProperties = Pick<Route, InheritableKeys[number]>;\n\n// Represents matching information for a single route in the traversal path\nexport type RouteMatchInfo<T extends Route> = {\n route: T;\n matchDetails: LabelMatchDetails[];\n matched: boolean;\n};\n\nexport interface RouteMatchResult<T extends Route> {\n route: T;\n labels: Label[];\n // Track matching information for each route in the traversal path\n matchingJourney: Array<RouteMatchInfo<T>>;\n}\n\n/**\n * This function performs a depth-first left-to-right search through the route tree and returns the matching routing nodes.\n *\n * If the current node is not a match, return nothing\n * Normalization should have happened earlier in the code\n */\nexport function findMatchingRoutes<T extends Route>(\n route: T,\n labels: Label[],\n matchingJourney: Array<RouteMatchInfo<T>> = []\n): Array<RouteMatchResult<T>> {\n let childMatches: Array<RouteMatchResult<T>> = [];\n\n // Check if the current node matches\n const matchResult = matchLabels(route.matchers ?? [], labels);\n\n // Create matching info for this route\n const currentMatchInfo: RouteMatchInfo<T> = {\n route,\n matchDetails: matchResult.details,\n matched: matchResult.matches,\n };\n\n // Add current route's matching info to the journey\n const currentMatchingJourney = [...matchingJourney, currentMatchInfo];\n\n // If the current node is not a match, return nothing\n if (!matchResult.matches) {\n return [];\n }\n\n // If the current node matches, recurse through child nodes\n if (route.routes) {\n for (const child of route.routes) {\n const matchingChildren = findMatchingRoutes(child, labels, currentMatchingJourney);\n // TODO how do I solve this typescript thingy? It looks correct to me /shrug\n // @ts-ignore\n childMatches = childMatches.concat(matchingChildren);\n // we have matching children and we don't want to continue, so break here\n if (matchingChildren.length && !child.continue) {\n break;\n }\n }\n }\n\n // If no child nodes were matches, the current node itself is a match.\n if (childMatches.length === 0) {\n childMatches.push({\n route,\n labels,\n matchingJourney: currentMatchingJourney,\n });\n }\n\n return childMatches;\n}\n\n/**\n * This function will compute the full tree with inherited properties – this is mostly used for search and filtering\n */\nexport function computeInheritedTree<T extends Route>(parent: T): T {\n return {\n ...parent,\n routes: parent.routes?.map((child) => {\n const inheritedProperties = getInheritedProperties(parent, child);\n\n return computeInheritedTree({\n ...child,\n ...inheritedProperties,\n });\n }),\n };\n}\n\n// inherited properties are config properties that exist on the parent route (or its inherited properties) but not on the child route\nexport function getInheritedProperties<T extends Route>(\n parentRoute: T,\n childRoute: T,\n propertiesParentInherited?: InheritableProperties\n): InheritableProperties {\n const propsFromParent: InheritableProperties = pick(parentRoute, INHERITABLE_KEYS);\n const inheritableProperties: InheritableProperties = {\n ...propsFromParent,\n ...propertiesParentInherited,\n } as const;\n\n // @ts-ignore TS5 & TS6 we're using \"keyof\" for the property so the type checker can help us out but this makes the\n // reduce function signature unhappy\n const inherited = reduce(\n inheritableProperties,\n // @ts-ignore TSGO / TS7 see above comment about the reduce function signature.\n (inheritedProperties: InheritableProperties, parentValue, property: keyof InheritableProperties) => {\n const parentHasValue = parentValue != null;\n\n const inheritableValues = [undefined, '', null];\n const childIsInheriting = inheritableValues.some((value) => childRoute[property] === value);\n const inheritFromValue = childIsInheriting && parentHasValue;\n\n const inheritEmptyGroupByFromParent =\n property === 'group_by' &&\n parentHasValue &&\n isArray(childRoute[property]) &&\n childRoute[property]?.length === 0;\n\n const inheritFromParent = inheritFromValue || inheritEmptyGroupByFromParent;\n\n if (inheritFromParent) {\n // @ts-ignore\n inheritedProperties[property] = parentValue;\n }\n\n return inheritedProperties;\n },\n {}\n );\n\n return inherited;\n}\n\nexport function addUniqueIdentifier(route: Route): RouteWithID {\n return {\n id: uniqueId('route-'),\n ...route,\n routes: route.routes?.map(addUniqueIdentifier) ?? [],\n };\n}\n\n// all policies that were matched of a single tree\nexport type TreeMatch = {\n /* we'll include the entire expanded policy tree for diagnostics */\n expandedTree: RouteWithID;\n /* the routes that matched the labels where the key is a route and the value is an array of instances that match that route */\n matchedPolicies: Map<RouteWithID, Array<RouteMatchResult<RouteWithID>>>;\n};\n\n/**\n * This function will return what notification policies would match a set of labels.\n *\n * ⚠️ This function is rather CPU intensive depending on both the size of the labels list and the size of the notification policy tree.\n * When using this function, consider wrapping it in a web-worker to offload this from the main JavaScript thread.\n *\n * @param instances - A set of labels for which you want to determine the matching policies\n * @param routingTree - A notification policy tree (or subtree)\n */\nexport function matchInstancesToRoute(rootRoute: Route, instances: Label[][]): TreeMatch {\n // initially empty map of matches policies\n const matchedPolicies = new Map();\n\n // compute the entire expanded tree for matching routes and diagnostics\n // this will include inherited properties from parent nodes\n const expandedTree = addUniqueIdentifier(computeInheritedTree(rootRoute));\n\n // let's first find all matching routes for the provided instances\n const matchesArray = instances.flatMap((labels) => findMatchingRoutes(expandedTree, labels));\n\n // now group the matches by route ID\n // this will give us a map of route IDs to their matching instances\n // we use the route ID as the key to ensure uniqueness\n const groupedByRoute = groupBy(matchesArray, (match) => match.route.id);\n Object.entries(groupedByRoute).forEach(([_key, match]) => {\n matchedPolicies.set(match[0].route, match);\n });\n\n return {\n expandedTree,\n matchedPolicies,\n };\n}\n\n/**\n * Converts a RoutingTree to a Route by merging defaults with routes.\n *\n * @param routingTree - The RoutingTree from the API\n * @returns A Route that can be used with the matching functions\n */\nexport function convertRoutingTreeToRoute(routingTree: RoutingTree): Route {\n const convertRoutingTreeRoutes = (routes: RoutingTreeRoute[]): Route[] => {\n return routes.map(\n (route): Route => ({\n ...route,\n routes: route.routes ? convertRoutingTreeRoutes(route.routes) : [],\n })\n );\n };\n\n // Create the root route by merging defaults with the route structure\n const rootRoute: Route = {\n ...routingTree.spec.defaults,\n continue: false,\n active_time_intervals: [],\n mute_time_intervals: [],\n matchers: [], // Root route has no matchers (catch-all)\n routes: convertRoutingTreeRoutes(routingTree.spec.routes),\n };\n\n return rootRoute;\n}\n"],"names":["matchLabels","pick","reduce","isArray","uniqueId","groupBy"],"mappings":";;;;;;;;AASO,MAAM,mBAAmB,CAAC,UAAA,EAAY,UAAA,EAAY,YAAA,EAAc,kBAAkB,iBAAiB;AAwBnG,SAAS,kBAAA,CACd,KAAA,EACA,MAAA,EACA,eAAA,GAA4C,EAAC,EACjB;AArC9B,EAAA,IAAA,EAAA;AAsCE,EAAA,IAAI,eAA2C,EAAC;AAGhD,EAAA,MAAM,cAAcA,iBAAA,CAAA,CAAY,EAAA,GAAA,KAAA,CAAM,aAAN,IAAA,GAAA,EAAA,GAAkB,IAAI,MAAM,CAAA;AAG5D,EAAA,MAAM,gBAAA,GAAsC;AAAA,IAC1C,KAAA;AAAA,IACA,cAAc,WAAA,CAAY,OAAA;AAAA,IAC1B,SAAS,WAAA,CAAY;AAAA,GACvB;AAGA,EAAA,MAAM,sBAAA,GAAyB,CAAC,GAAG,eAAA,EAAiB,gBAAgB,CAAA;AAGpE,EAAA,IAAI,CAAC,YAAY,OAAA,EAAS;AACxB,IAAA,OAAO,EAAC;AAAA,EACV;AAGA,EAAA,IAAI,MAAM,MAAA,EAAQ;AAChB,IAAA,KAAA,MAAW,KAAA,IAAS,MAAM,MAAA,EAAQ;AAChC,MAAA,MAAM,gBAAA,GAAmB,kBAAA,CAAmB,KAAA,EAAO,MAAA,EAAQ,sBAAsB,CAAA;AAGjF,MAAA,YAAA,GAAe,YAAA,CAAa,OAAO,gBAAgB,CAAA;AAEnD,MAAA,IAAI,gBAAA,CAAiB,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,EAAU;AAC9C,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,EAAA,IAAI,YAAA,CAAa,WAAW,CAAA,EAAG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eAAA,CAAgB,GAAA,CAAI,KAAA,CAAM,CAAC,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,EAC3C,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,YAAA;AAAA,IACA;AAAA,GACF;AACF;AAQO,SAAS,0BAA0B,WAAA,EAAiC;AACzE,EAAA,MAAM,wBAAA,GAA2B,CAAC,MAAA,KAAwC;AACxE,IAAA,OAAO,MAAA,CAAO,GAAA;AAAA,MACZ,CAAC,KAAA,MAAkB;AAAA,QACjB,GAAG,KAAA;AAAA,QACH,QAAQ,KAAA,CAAM,MAAA,GAAS,yBAAyB,KAAA,CAAM,MAAM,IAAI;AAAC,OACnE;AAAA,KACF;AAAA,EACF,CAAA;AAGA,EAAA,MAAM,SAAA,GAAmB;AAAA,IACvB,GAAG,YAAY,IAAA,CAAK,QAAA;AAAA,IACpB,QAAA,EAAU,KAAA;AAAA,IACV,uBAAuB,EAAC;AAAA,IACxB,qBAAqB,EAAC;AAAA,IACtB,UAAU,EAAC;AAAA;AAAA,IACX,MAAA,EAAQ,wBAAA,CAAyB,WAAA,CAAY,IAAA,CAAK,MAAM;AAAA,GAC1D;AAEA,EAAA,OAAO,SAAA;AACT;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.cjs","sources":["../../../../src/grafana/notificationPolicies/utils.ts"],"sourcesContent":["import { groupBy, isArray, pick, reduce, uniqueId } from 'lodash';\n\nimport { type RoutingTree, type RoutingTreeRoute } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { type Label } from '../matchers/types';\nimport { type LabelMatchDetails, matchLabels } from '../matchers/utils';\n\nimport { type Route, type RouteWithID } from './types';\n\nexport const INHERITABLE_KEYS = ['receiver', 'group_by', 'group_wait', 'group_interval', 'repeat_interval'] as const;\ntype InheritableKeys = typeof INHERITABLE_KEYS;\nexport type InheritableProperties = Pick<Route, InheritableKeys[number]>;\n\n// Represents matching information for a single route in the traversal path\nexport type RouteMatchInfo<T extends Route> = {\n route: T;\n matchDetails: LabelMatchDetails[];\n matched: boolean;\n};\n\nexport interface RouteMatchResult<T extends Route> {\n route: T;\n labels: Label[];\n // Track matching information for each route in the traversal path\n matchingJourney: Array<RouteMatchInfo<T>>;\n}\n\n/**\n * This function performs a depth-first left-to-right search through the route tree and returns the matching routing nodes.\n *\n * If the current node is not a match, return nothing\n * Normalization should have happened earlier in the code\n */\nexport function findMatchingRoutes<T extends Route>(\n route: T,\n labels: Label[],\n matchingJourney: Array<RouteMatchInfo<T>> = []\n): Array<RouteMatchResult<T>> {\n let childMatches: Array<RouteMatchResult<T>> = [];\n\n // Check if the current node matches\n const matchResult = matchLabels(route.matchers ?? [], labels);\n\n // Create matching info for this route\n const currentMatchInfo: RouteMatchInfo<T> = {\n route,\n matchDetails: matchResult.details,\n matched: matchResult.matches,\n };\n\n // Add current route's matching info to the journey\n const currentMatchingJourney = [...matchingJourney, currentMatchInfo];\n\n // If the current node is not a match, return nothing\n if (!matchResult.matches) {\n return [];\n }\n\n // If the current node matches, recurse through child nodes\n if (route.routes) {\n for (const child of route.routes) {\n const matchingChildren = findMatchingRoutes(child, labels, currentMatchingJourney);\n // TODO how do I solve this typescript thingy? It looks correct to me /shrug\n // @ts-ignore\n childMatches = childMatches.concat(matchingChildren);\n // we have matching children and we don't want to continue, so break here\n if (matchingChildren.length && !child.continue) {\n break;\n }\n }\n }\n\n // If no child nodes were matches, the current node itself is a match.\n if (childMatches.length === 0) {\n childMatches.push({\n route,\n labels,\n matchingJourney: currentMatchingJourney,\n });\n }\n\n return childMatches;\n}\n\n/**\n * This function will compute the full tree with inherited properties – this is mostly used for search and filtering\n */\nexport function computeInheritedTree<T extends Route>(parent: T): T {\n return {\n ...parent,\n routes: parent.routes?.map((child) => {\n const inheritedProperties = getInheritedProperties(parent, child);\n\n return computeInheritedTree({\n ...child,\n ...inheritedProperties,\n });\n }),\n };\n}\n\n// inherited properties are config properties that exist on the parent route (or its inherited properties) but not on the child route\nexport function getInheritedProperties<T extends Route>(\n parentRoute: T,\n childRoute: T,\n propertiesParentInherited?: InheritableProperties\n): InheritableProperties {\n const propsFromParent: InheritableProperties = pick(parentRoute, INHERITABLE_KEYS);\n const inheritableProperties: InheritableProperties = {\n ...propsFromParent,\n ...propertiesParentInherited,\n } as const;\n\n // @ts-ignore TS5 & TS6 we're using \"keyof\" for the property so the type checker can help us out but this makes the\n // reduce function signature unhappy\n const inherited = reduce(\n inheritableProperties,\n // @ts-ignore TSGO / TS7 see above comment about the reduce function signature.\n (inheritedProperties: InheritableProperties, parentValue, property: keyof InheritableProperties) => {\n const parentHasValue = parentValue != null;\n\n const inheritableValues = [undefined, '', null];\n const childIsInheriting = inheritableValues.some((value) => childRoute[property] === value);\n const inheritFromValue = childIsInheriting && parentHasValue;\n\n const inheritEmptyGroupByFromParent =\n property === 'group_by' &&\n parentHasValue &&\n isArray(childRoute[property]) &&\n childRoute[property]?.length === 0;\n\n const inheritFromParent = inheritFromValue || inheritEmptyGroupByFromParent;\n\n if (inheritFromParent) {\n // @ts-ignore\n inheritedProperties[property] = parentValue;\n }\n\n return inheritedProperties;\n },\n {}\n );\n\n return inherited;\n}\n\nexport function addUniqueIdentifier(route: Route): RouteWithID {\n return {\n id: uniqueId('route-'),\n ...route,\n routes: route.routes?.map(addUniqueIdentifier) ?? [],\n };\n}\n\n// all policies that were matched of a single tree\nexport type TreeMatch = {\n /* we'll include the entire expanded policy tree for diagnostics */\n expandedTree: RouteWithID;\n /* the routes that matched the labels where the key is a route and the value is an array of instances that match that route */\n matchedPolicies: Map<RouteWithID, Array<RouteMatchResult<RouteWithID>>>;\n};\n\n/**\n * This function will return what notification policies would match a set of labels.\n *\n * ⚠️ This function is rather CPU intensive depending on both the size of the labels list and the size of the notification policy tree.\n * When using this function, consider wrapping it in a web-worker to offload this from the main JavaScript thread.\n *\n * @param instances - A set of labels for which you want to determine the matching policies\n * @param routingTree - A notification policy tree (or subtree)\n */\nexport function matchInstancesToRoute(rootRoute: Route, instances: Label[][]): TreeMatch {\n // initially empty map of matches policies\n const matchedPolicies = new Map();\n\n // compute the entire expanded tree for matching routes and diagnostics\n // this will include inherited properties from parent nodes\n const expandedTree = addUniqueIdentifier(computeInheritedTree(rootRoute));\n\n // let's first find all matching routes for the provided instances\n const matchesArray = instances.flatMap((labels) => findMatchingRoutes(expandedTree, labels));\n\n // now group the matches by route ID\n // this will give us a map of route IDs to their matching instances\n // we use the route ID as the key to ensure uniqueness\n const groupedByRoute = groupBy(matchesArray, (match) => match.route.id);\n Object.entries(groupedByRoute).forEach(([_key, match]) => {\n matchedPolicies.set(match[0].route, match);\n });\n\n return {\n expandedTree,\n matchedPolicies,\n };\n}\n\n/**\n * Converts a RoutingTree to a Route by merging defaults with routes.\n *\n * @param routingTree - The RoutingTree from the API\n * @returns A Route that can be used with the matching functions\n */\nexport function convertRoutingTreeToRoute(routingTree: RoutingTree): Route {\n const convertRoutingTreeRoutes = (routes: RoutingTreeRoute[]): Route[] => {\n return routes.map(\n (route): Route => ({\n ...route,\n routes: route.routes ? convertRoutingTreeRoutes(route.routes) : [],\n })\n );\n };\n\n // Create the root route by merging defaults with the route structure\n const rootRoute: Route = {\n ...routingTree.spec.defaults,\n continue: false,\n active_time_intervals: [],\n mute_time_intervals: [],\n matchers: [], // Root route has no matchers (catch-all)\n routes: convertRoutingTreeRoutes(routingTree.spec.routes),\n };\n\n return rootRoute;\n}\n"],"names":["matchLabels","pick","reduce","isArray","uniqueId","groupBy"],"mappings":";;;;;;;;AASO,MAAM,mBAAmB,CAAC,UAAA,EAAY,UAAA,EAAY,YAAA,EAAc,kBAAkB,iBAAiB;AAwBnG,SAAS,kBAAA,CACd,KAAA,EACA,MAAA,EACA,eAAA,GAA4C,EAAC,EACjB;AArC9B,EAAA,IAAA,EAAA;AAsCE,EAAA,IAAI,eAA2C,EAAC;AAGhD,EAAA,MAAM,cAAcA,iBAAA,CAAA,CAAY,EAAA,GAAA,KAAA,CAAM,aAAN,IAAA,GAAA,EAAA,GAAkB,IAAI,MAAM,CAAA;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U,KAAA;AAAA,IACV,uBAAuB,EAAC;AAAA,IACxB,qBAAqB,EAAC;AAAA,IACtB,UAAU,EAAC;AAAA;AAAA,IACX,MAAA,EAAQ,wBAAA,CAAyB,WAAA,CAAY,IAAA,CAAK,MAAM;AAAA,GAC1D;AAEA,EAAA,OAAO,SAAA;AACT;;;;;;;;;;"}
@@ -2,20 +2,20 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./grafana/api/notifications/v0alpha1/mocks/handlers/index.cjs');
6
- var common = require('./grafana/api/notifications/v0alpha1/mocks/fakes/common.cjs');
7
- var Receivers = require('./grafana/api/notifications/v0alpha1/mocks/fakes/Receivers.cjs');
8
- var Routes = require('./grafana/api/notifications/v0alpha1/mocks/fakes/Routes.cjs');
5
+ require('./grafana/api/notifications/v1beta1/mocks/handlers/index.cjs');
6
+ var common = require('./grafana/api/notifications/v1beta1/mocks/fakes/common.cjs');
7
+ var Receivers = require('./grafana/api/notifications/v1beta1/mocks/fakes/Receivers.cjs');
8
+ var Routes = require('./grafana/api/notifications/v1beta1/mocks/fakes/Routes.cjs');
9
9
  var ContactPointSelector_scenario = require('./grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.cjs');
10
10
  var RoutingTreeSelector_scenario = require('./grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.cjs');
11
- var createReceiverHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/createReceiverHandler.cjs');
12
- var deleteReceiverHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.cjs');
13
- var deletecollectionReceiverHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.cjs');
14
- var getReceiverHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/getReceiverHandler.cjs');
15
- var listReceiverHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs');
16
- var listRoutingTreeHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.cjs');
17
- var replaceReceiverHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.cjs');
18
- var updateReceiverHandler = require('./grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/updateReceiverHandler.cjs');
11
+ var createReceiverHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/createReceiverHandler.cjs');
12
+ var deleteReceiverHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.cjs');
13
+ var deletecollectionReceiverHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.cjs');
14
+ var getReceiverHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/getReceiverHandler.cjs');
15
+ var listReceiverHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs');
16
+ var listRoutingTreeHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.cjs');
17
+ var replaceReceiverHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.cjs');
18
+ var updateReceiverHandler = require('./grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/updateReceiverHandler.cjs');
19
19
 
20
20
  "use strict";
21
21
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./grafana/api/notifications/v0alpha1/types.cjs');
6
- var useContactPoints = require('./grafana/contactPoints/hooks/v0alpha1/useContactPoints.cjs');
5
+ require('./grafana/api/notifications/v1beta1/types.cjs');
6
+ var useContactPoints = require('./grafana/contactPoints/hooks/v1beta1/useContactPoints.cjs');
7
7
  var ContactPointSelector = require('./grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.cjs');
8
8
  var utils = require('./grafana/contactPoints/utils.cjs');
9
9
  var useRoutingTrees = require('./grafana/notificationPolicies/hooks/useRoutingTrees.cjs');
@@ -15,8 +15,8 @@ var StateIcon = require('./grafana/rules/components/state/StateIcon.cjs');
15
15
  var AlertLabel = require('./grafana/rules/components/labels/AlertLabel.cjs');
16
16
  var AlertLabels = require('./grafana/rules/components/labels/AlertLabels.cjs');
17
17
  var utils$1 = require('./grafana/matchers/utils.cjs');
18
- var v0alpha1$1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
19
- var v0alpha1$2 = require('@grafana/api-clients/rtkq/rules.alerting/v0alpha1');
18
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
19
+ var v0alpha1$1 = require('@grafana/api-clients/rtkq/rules.alerting/v0alpha1');
20
20
  var v0alpha1 = require('@grafana/api-clients/rtkq/historian.alerting/v0alpha1');
21
21
 
22
22
  "use strict";
@@ -39,13 +39,13 @@ exports.AlertLabels = AlertLabels.AlertLabels;
39
39
  exports.isLabelMatch = utils$1.isLabelMatch;
40
40
  exports.matchLabels = utils$1.matchLabels;
41
41
  exports.matchLabelsSet = utils$1.matchLabelsSet;
42
- Object.defineProperty(exports, "notificationsAPIv0alpha1", {
42
+ Object.defineProperty(exports, "notificationsAPIv1beta1", {
43
43
  enumerable: true,
44
- get: function () { return v0alpha1$1.generatedAPI; }
44
+ get: function () { return v1beta1.generatedAPI; }
45
45
  });
46
46
  Object.defineProperty(exports, "rulesAPIv0alpha1", {
47
47
  enumerable: true,
48
- get: function () { return v0alpha1$2.generatedAPI; }
48
+ get: function () { return v0alpha1$1.generatedAPI; }
49
49
  });
50
50
  Object.defineProperty(exports, "historianAPIv0alpha1", {
51
51
  enumerable: true,
@@ -1,6 +1,6 @@
1
1
  import { faker } from '@faker-js/faker';
2
2
  import { Factory } from 'fishery';
3
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
3
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
4
4
  import { generateResourceVersion, generateTitle, DEFAULT_NAMESPACE, generateUID } from '../../../../../mocks/util.mjs';
5
5
  import { AlertingEntityMetadataAnnotationsFactory } from './common.mjs';
6
6
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Receivers.mjs","sources":["../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/fakes/Receivers.ts"],"sourcesContent":["import { faker } from '@faker-js/faker';\nimport { Factory } from 'fishery';\n\nimport { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { DEFAULT_NAMESPACE, generateResourceVersion, generateTitle, generateUID } from '../../../../../mocks/util';\nimport {\n type ContactPoint,\n type ContactPointMetadataAnnotations,\n type EnhancedListReceiverApiResponse,\n type Integration,\n} from '../../types';\n\nimport { AlertingEntityMetadataAnnotationsFactory } from './common';\n\nexport const ListReceiverApiResponseFactory = Factory.define<EnhancedListReceiverApiResponse>(() => ({\n kind: 'ReceiverList',\n apiVersion: `${API_GROUP}/${API_VERSION}`,\n metadata: {\n resourceVersion: generateResourceVersion(),\n },\n items: ContactPointFactory.buildList(5),\n}));\n\nexport const ContactPointFactory = Factory.define<ContactPoint>(() => {\n const title = generateTitle();\n\n return {\n kind: 'Receiver',\n apiVersion: `${API_GROUP}/${API_VERSION}`,\n metadata: {\n name: btoa(title),\n namespace: DEFAULT_NAMESPACE,\n uid: generateUID(),\n resourceVersion: generateResourceVersion(),\n annotations: ContactPointMetadataAnnotationsFactory.build(),\n },\n spec: ContactPointSpecFactory.build({ title }),\n status: {},\n };\n});\n\nexport const ContactPointSpecFactory = Factory.define<ContactPoint['spec']>(() => ({\n title: generateTitle(),\n // use two unique random integrations by default\n integrations: faker.helpers.uniqueArray(IntegrationUnion, 2).map((integration) => integration.build()),\n}));\n\nexport const GenericIntegrationFactory = Factory.define<Integration>(() => ({\n type: 'generic',\n version: '1',\n disableResolveMessage: false,\n settings: {\n foo: 'bar',\n },\n}));\n\nexport const EmailIntegrationFactory = Factory.define<Integration>(() => ({\n type: 'email',\n version: '1',\n secureFields: {},\n settings: {\n addresses: faker.internet.email(),\n },\n}));\n\nexport const SlackIntegrationFactory = Factory.define<Integration>(() => ({\n type: 'slack',\n version: '1',\n secureFields: { token: true },\n settings: {\n mentionChannel: '#alerts',\n },\n}));\n\nconst IntegrationUnion = [EmailIntegrationFactory, SlackIntegrationFactory];\n\n// by default the contact points will be in use by a route and a rule\nexport const ContactPointMetadataAnnotationsFactory = Factory.define<ContactPointMetadataAnnotations>(() => ({\n 'grafana.com/access/canReadSecrets': 'true',\n 'grafana.com/inUse/routes': '1',\n 'grafana.com/inUse/rules': '1',\n 'grafana.com/canUse': 'true',\n ...AlertingEntityMetadataAnnotationsFactory.build(),\n}));\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,8BAAA,GAAiC,OAAA,CAAQ,MAAA,CAAwC,OAAO;AAAA,EACnG,IAAA,EAAM,cAAA;AAAA,EACN,UAAA,EAAY,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,WAAW,CAAA,CAAA;AAAA,EACvC,QAAA,EAAU;AAAA,IACR,iBAAiB,uBAAA;AAAwB,GAC3C;AAAA,EACA,KAAA,EAAO,mBAAA,CAAoB,SAAA,CAAU,CAAC;AACxC,CAAA,CAAE;AAEK,MAAM,mBAAA,GAAsB,OAAA,CAAQ,MAAA,CAAqB,MAAM;AACpE,EAAA,MAAM,QAAQ,aAAA,EAAc;AAE5B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,UAAA,EAAY,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,WAAW,CAAA,CAAA;AAAA,IACvC,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,KAAK,KAAK,CAAA;AAAA,MAChB,SAAA,EAAW,iBAAA;AAAA,MACX,KAAK,WAAA,EAAY;A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,MAAM,sCAAA,GAAyC,OAAA,CAAQ,MAAA,CAAwC,OAAO;AAAA,EAC3G,mCAAA,EAAqC,MAAA;AAAA,EACrC,0BAAA,EAA4B,GAAA;AAAA,EAC5B,yBAAA,EAA2B,GAAA;AAAA,EAC3B,oBAAA,EAAsB,MAAA;AAAA,EACtB,GAAG,yCAAyC,KAAA;AAC9C,CAAA,CAAE;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { faker } from '@faker-js/faker';
2
2
  import { Factory } from 'fishery';
3
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
3
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
4
4
  import { DEFAULT_NAMESPACE, generateResourceVersion } from '../../../../../mocks/util.mjs';
5
5
  import { USER_DEFINED_TREE_NAME } from '../../../../../notificationPolicies/routingTrees.mjs';
6
6
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Routes.mjs","sources":["../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/fakes/Routes.ts"],"sourcesContent":["import { faker } from '@faker-js/faker';\nimport { Factory } from 'fishery';\n\nimport {\n API_GROUP,\n API_VERSION,\n type ListRoutingTreeApiResponse,\n type RoutingTree,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { type LabelMatcher } from '../../../../../matchers/types';\nimport { DEFAULT_NAMESPACE, generateResourceVersion } from '../../../../../mocks/util';\nimport { USER_DEFINED_TREE_NAME } from '../../../../../notificationPolicies/routingTrees';\nimport { type Route } from '../../../../../notificationPolicies/types';\n\nexport const LabelMatcherFactory = Factory.define<LabelMatcher>(() => {\n const operators: Array<LabelMatcher['type']> = ['=', '!=', '=~', '!~'];\n\n return {\n label: faker.helpers.arrayElement(['service', 'env', 'team', 'severity', 'region', 'instance']),\n type: faker.helpers.arrayElement(operators),\n value: faker.helpers.arrayElement(['web', 'api', 'prod', 'staging', 'critical', 'warning', 'us-east', 'us-west']),\n };\n});\n\nexport const RouteFactory = Factory.define<Route>(() => ({\n continue: faker.datatype.boolean(),\n receiver: faker.helpers.arrayElement(['web-team', 'api-team', 'critical-alerts', 'dev-team']),\n matchers: LabelMatcherFactory.buildList(faker.number.int({ min: 1, max: 3 })),\n group_by: faker.helpers.arrayElements(['alertname', 'service', 'severity'], { min: 1, max: 2 }),\n group_wait: faker.helpers.arrayElement(['10s', '30s', '1m']),\n group_interval: faker.helpers.arrayElement(['5m', '10m', '15m']),\n repeat_interval: faker.helpers.arrayElement(['1h', '4h', '12h']),\n active_time_intervals: faker.helpers.arrayElements(['business-hours', 'weekends', 'maintenance'], { min: 1, max: 2 }),\n mute_time_intervals: faker.helpers.arrayElements(['lunch-break', 'night-hours'], { min: 1, max: 2 }),\n routes: [],\n}));\n\nexport const RoutingTreeFactory = Factory.define<RoutingTree>(({ sequence }) => {\n const name = sequence === 1 ? USER_DEFINED_TREE_NAME : `policy-tree-${sequence}`;\n\n return {\n kind: 'RoutingTree',\n apiVersion: `${API_GROUP}/${API_VERSION}`,\n metadata: {\n name,\n namespace: DEFAULT_NAMESPACE,\n resourceVersion: generateResourceVersion(),\n },\n spec: {\n defaults: {\n receiver: faker.helpers.arrayElement(['web-team', 'api-team', 'critical-alerts', 'dev-team']),\n group_by: ['alertname'],\n group_wait: '30s',\n group_interval: '5m',\n repeat_interval: '4h',\n },\n routes: [],\n },\n };\n});\n\nexport const ListRoutingTreeApiResponseFactory = Factory.define<ListRoutingTreeApiResponse>(() => ({\n kind: 'RoutingTreeList',\n apiVersion: `${API_GROUP}/${API_VERSION}`,\n metadata: {\n resourceVersion: generateResourceVersion(),\n },\n items: RoutingTreeFactory.buildList(3),\n}));\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,mBAAA,GAAsB,OAAA,CAAQ,MAAA,CAAqB,MAAM;AACpE,EAAA,MAAM,SAAA,GAAyC,CAAC,GAAA,EAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAErE,EAAA,OAAO;AAAA,I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AM,iBAAA;AAAA,EACN,UAAA,EAAY,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,WAAW,CAAA,CAAA;AAAA,EACvC,QAAA,EAAU;AAAA,IACR,iBAAiB,uBAAA;AAAwB,GAC3C;AAAA,EACA,KAAA,EAAO,kBAAA,CAAmB,SAAA,CAAU,CAAC;AACvC,CAAA,CAAE;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.mjs","sources":["../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/fakes/common.ts"],"sourcesContent":["import { Factory } from 'fishery';\n\nimport { type AlertingEntityMetadataAnnotations } from '../../types';\n\nexport const AlertingEntityMetadataAnnotationsFactory = Factory.define<AlertingEntityMetadataAnnotations>(() => ({\n 'grafana.com/access/canAdmin': 'true',\n 'grafana.com/access/canDelete': 'true',\n 'grafana.com/access/canWrite': 'true',\n 'grafana.com/provenance': '',\n}));\n"],"names":[],"mappings":";;;AAIO,MAAM,wCAAA,GAA2C,OAAA,CAAQ,MAAA,CAA0C,OAAO;AAAA,EAC/G,6BAAA,EAA+B,MAAA;AAAA,EAC/B,8BAAA,EAAgC,MAAA;AAAA,EAChC,6BAAA,EAA+B,MAAA;AAAA,EAC/B,wBAAA,EAA0B;AAC5B,CAAA,CAAE;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/createReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport {\n API_GROUP,\n API_VERSION,\n type CreateReceiverApiResponse,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\n\nexport function createReceiverHandler(\n data: CreateReceiverApiResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Response)\n) {\n return http.post(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/receivers'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,sBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,KAAK,qBAAA,CAAsB,SAAA,EAAW,aAAa,YAAY,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AACnG,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deleteReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport {\n API_GROUP,\n API_VERSION,\n type DeleteReceiverApiResponse,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\n\nexport function deleteReceiverHandler(\n data: DeleteReceiverApiResponse | ((info: Parameters<Parameters<typeof http.delete>[1]>[0]) => Response)\n) {\n return http.delete(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/receivers/:name'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,sBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,OAAO,qBAAA,CAAsB,SAAA,EAAW,aAAa,kBAAkB,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AAC3G,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deletecollectionReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/deletecollectionReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport {\n API_GROUP,\n API_VERSION,\n type DeletecollectionReceiverApiResponse,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\n\nexport function deletecollectionReceiverHandler(\n data: DeletecollectionReceiverApiResponse | ((info: Parameters<Parameters<typeof http.delete>[1]>[0]) => Response)\n) {\n return http.delete(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/receivers'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,gCACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,OAAO,qBAAA,CAAsB,SAAA,EAAW,aAAa,YAAY,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AACrG,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/getReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport {\n API_GROUP,\n API_VERSION,\n type GetReceiverApiResponse,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\n\nexport function getReceiverHandler(\n data: GetReceiverApiResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response)\n) {\n return http.get(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/receivers/:name'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,mBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,IAAI,qBAAA,CAAsB,SAAA,EAAW,aAAa,kBAAkB,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AACxG,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/listReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\nimport { type EnhancedListReceiverApiResponse } from '../../../types';\n\nexport function listReceiverHandler(\n data: EnhancedListReceiverApiResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response)\n) {\n return http.get(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/receivers'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAOO,SAAS,oBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,IAAI,qBAAA,CAAsB,SAAA,EAAW,aAAa,YAAY,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AAClG,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replaceReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/replaceReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport {\n API_GROUP,\n API_VERSION,\n type ReplaceReceiverApiResponse,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\n\nexport function replaceReceiverHandler(\n data: ReplaceReceiverApiResponse | ((info: Parameters<Parameters<typeof http.put>[1]>[0]) => Response)\n) {\n return http.put(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/receivers/:name'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,uBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,IAAI,qBAAA,CAAsB,SAAA,EAAW,aAAa,kBAAkB,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AACxG,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/updateReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport {\n API_GROUP,\n API_VERSION,\n type UpdateReceiverApiResponse,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\n\nexport function updateReceiverHandler(\n data: UpdateReceiverApiResponse | ((info: Parameters<Parameters<typeof http.patch>[1]>[0]) => Response)\n) {\n return http.patch(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/receivers/:name'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,sBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,MAAM,qBAAA,CAAsB,SAAA,EAAW,aAAa,kBAAkB,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AAC1G,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from 'msw';
2
- import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { API_GROUP, API_VERSION } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { getAPIBaseURLForMocks } from '../../../../../../mocks/util.mjs';
4
4
 
5
5
  "use strict";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listRoutingTreeHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v1beta1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport {\n API_GROUP,\n API_VERSION,\n type ListRoutingTreeApiResponse,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\n\nexport function listRoutingTreeHandler(\n data: ListRoutingTreeApiResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response)\n) {\n return http.get(getAPIBaseURLForMocks(API_GROUP, API_VERSION, '/routingtrees'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,uBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,IAAI,qBAAA,CAAsB,SAAA,EAAW,aAAa,eAAe,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AACrG,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { chain } from 'lodash';
3
3
  import { Combobox } from '@grafana/ui';
4
- import { useListContactPoints } from '../../hooks/v0alpha1/useContactPoints.mjs';
4
+ import { useListContactPoints } from '../../hooks/v1beta1/useContactPoints.mjs';
5
5
  import { isUsableContactPoint, getContactPointDescription } from '../../utils.mjs';
6
6
 
7
7
  "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPointSelector.mjs","sources":["../../../../../../src/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.tsx"],"sourcesContent":["import { chain } from 'lodash';\n\nimport { Combobox, type ComboboxOption } from '@grafana/ui';\n\nimport type { ContactPoint } from '../../../api/notifications/v0alpha1/types';\nimport { type CustomComboBoxProps } from '../../../common/ComboBox.types';\nimport { useListContactPoints } from '../../hooks/v0alpha1/useContactPoints';\nimport { getContactPointDescription, isUsableContactPoint } from '../../utils';\n\nconst collator = new Intl.Collator('en', { sensitivity: 'accent' });\n\nexport type ContactPointSelectorProps = CustomComboBoxProps<ContactPoint> & {\n /**\n * Whether to include contact points that are not usable (e.g., imported from external sources).\n * Unusable contact points have the `grafana.com/canUse` annotation set to `false`.\n * @default false\n */\n includeUnusable?: boolean;\n};\n\n/**\n * Contact Point Combobox which lists all available contact points.\n * By default, only shows contact points that can be used (have `grafana.com/canUse: true`).\n * Set `includeUnusable` to `true` to show all contact points including imported ones.\n */\nfunction ContactPointSelector(props: ContactPointSelectorProps) {\n const { includeUnusable = false, ...comboboxProps } = props;\n\n const { currentData: contactPoints, isLoading } = useListContactPoints(\n {},\n { refetchOnFocus: true, refetchOnMountOrArgChange: true }\n );\n\n // Create a mapping of options with their corresponding contact points\n const contactPointOptions = chain(contactPoints?.items)\n .toArray()\n .filter((contactPoint) => includeUnusable || isUsableContactPoint(contactPoint))\n .map((contactPoint) => ({\n option: {\n label: contactPoint.spec.title,\n value: contactPoint.metadata.uid ?? contactPoint.spec.title,\n description: getContactPointDescription(contactPoint),\n } satisfies ComboboxOption<string>,\n contactPoint,\n }))\n .value()\n .sort((a, b) => collator.compare(a.option.label, b.option.label));\n\n const options = contactPointOptions.map<ComboboxOption>((item) => item.option);\n\n const handleChange = (selectedOption: ComboboxOption<string> | null) => {\n if (selectedOption == null && comboboxProps.isClearable) {\n comboboxProps.onChange(null);\n return;\n }\n\n if (selectedOption) {\n const matchedOption = contactPointOptions.find(({ option }) => option.value === selectedOption.value);\n if (!matchedOption) {\n return;\n }\n\n comboboxProps.onChange(matchedOption.contactPoint);\n }\n };\n\n return <Combobox {...comboboxProps} loading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AS,KAAK,MAAM,CAAA;AAE7E,EAAA,MAAM,YAAA,GAAe,CAAC,cAAA,KAAkD;AACtE,IAAA,IAAI,cAAA,IAAkB,IAAA,IAAQ,aAAA,CAAc,WAAA,EAAa;AACvD,MAAA,aAAA,CAAc,SAAS,IAAI,CAAA;AAC3B,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,MAAM,aAAA,GAAgB,mBAAA,CAAoB,IAAA,CAAK,CAAC,EAAE,QAAO,KAAM,MAAA,CAAO,KAAA,KAAU,cAAA,CAAe,KAAK,CAAA;AACpG,MAAA,IAAI,CAAC,aAAA,EAAe;AAClB,QAAA;AAAA,MACF;AAEA,MAAA,aAAA,CAAc,QAAA,CAAS,cAAc,YAAY,CAAA;AAAA,IACnD;AAAA,EACF,CAAA;AAEA,EAAA,uBAAO,GAAA,CAAC,YAAU,GAAG,aAAA,EAAe,SAAS,SAAA,EAAW,OAAA,EAAkB,UAAU,YAAA,EAAc,CAAA;AACpG;;;;"}
1
+ {"version":3,"file":"ContactPointSelector.mjs","sources":["../../../../../../src/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.tsx"],"sourcesContent":["import { chain } from 'lodash';\n\nimport { Combobox, type ComboboxOption } from '@grafana/ui';\n\nimport type { ContactPoint } from '../../../api/notifications/v1beta1/types';\nimport { type CustomComboBoxProps } from '../../../common/ComboBox.types';\nimport { useListContactPoints } from '../../hooks/v1beta1/useContactPoints';\nimport { getContactPointDescription, isUsableContactPoint } from '../../utils';\n\nconst collator = new Intl.Collator('en', { sensitivity: 'accent' });\n\nexport type ContactPointSelectorProps = CustomComboBoxProps<ContactPoint> & {\n /**\n * Whether to include contact points that are not usable (e.g., imported from external sources).\n * Unusable contact points have the `grafana.com/canUse` annotation set to `false`.\n * @default false\n */\n includeUnusable?: boolean;\n};\n\n/**\n * Contact Point Combobox which lists all available contact points.\n * By default, only shows contact points that can be used (have `grafana.com/canUse: true`).\n * Set `includeUnusable` to `true` to show all contact points including imported ones.\n */\nfunction ContactPointSelector(props: ContactPointSelectorProps) {\n const { includeUnusable = false, ...comboboxProps } = props;\n\n const { currentData: contactPoints, isLoading } = useListContactPoints(\n {},\n { refetchOnFocus: true, refetchOnMountOrArgChange: true }\n );\n\n // Create a mapping of options with their corresponding contact points\n const contactPointOptions = chain(contactPoints?.items)\n .toArray()\n .filter((contactPoint) => includeUnusable || isUsableContactPoint(contactPoint))\n .map((contactPoint) => ({\n option: {\n label: contactPoint.spec.title,\n value: contactPoint.metadata.uid ?? contactPoint.spec.title,\n description: getContactPointDescription(contactPoint),\n } satisfies ComboboxOption<string>,\n contactPoint,\n }))\n .value()\n .sort((a, b) => collator.compare(a.option.label, b.option.label));\n\n const options = contactPointOptions.map<ComboboxOption>((item) => item.option);\n\n const handleChange = (selectedOption: ComboboxOption<string> | null) => {\n if (selectedOption == null && comboboxProps.isClearable) {\n comboboxProps.onChange(null);\n return;\n }\n\n if (selectedOption) {\n const matchedOption = contactPointOptions.find(({ option }) => option.value === selectedOption.value);\n if (!matchedOption) {\n return;\n }\n\n comboboxProps.onChange(matchedOption.contactPoint);\n }\n };\n\n return <Combobox {...comboboxProps} loading={isLoading} options={options} onChange={handleChange} />;\n}\n\nexport { ContactPointSelector };\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,QAAA,GAAW,IAAI,IAAA,CAAK,QAAA,CAAS,MAAM,EAAE,WAAA,EAAa,UAAU,CAAA;AAgBlE,SAAS,qBAAqB,KAAA,EAAkC;AAC9D,EAAA,MAAM,EAAE,eAAA,GAAkB,KAAA,EAAO,GAAG,eAAc,GAAI,KAAA;AAEtD,EAAA,MAAM,EAAE,WAAA,EAAa,aAAA,EAAe,SAAA,EAAU,GAAI,oBAAA;AAAA,IAChD,EAAC;AAAA,IACD,EAAE,cAAA,EAAgB,IAAA,EAAM,yBAAA,EAA2B,IAAA;AAAK,GAC1D;AAGA,EAAA,MAAM,sBAAsB,KAAA,CAAM,aAAA,IAAA,IAAA,GAAA,K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AAA;AAEA,EAAA,uBAAO,GAAA,CAAC,YAAU,GAAG,aAAA,EAAe,SAAS,SAAA,EAAW,OAAA,EAAkB,UAAU,YAAA,EAAc,CAAA;AACpG;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { HttpResponse } from 'msw';
2
- import { ListReceiverApiResponseFactory, ContactPointFactory, EmailIntegrationFactory, SlackIntegrationFactory, ContactPointMetadataAnnotationsFactory } from '../../../api/notifications/v0alpha1/mocks/fakes/Receivers.mjs';
3
- import { listReceiverHandler } from '../../../api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/listReceiverHandler.mjs';
2
+ import { ListReceiverApiResponseFactory, ContactPointFactory, EmailIntegrationFactory, SlackIntegrationFactory, ContactPointMetadataAnnotationsFactory } from '../../../api/notifications/v1beta1/mocks/fakes/Receivers.mjs';
3
+ import { listReceiverHandler } from '../../../api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/listReceiverHandler.mjs';
4
4
 
5
5
  "use strict";
6
6
  const simpleContactPointsList = ListReceiverApiResponseFactory.build({
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPointSelector.scenario.mjs","sources":["../../../../../../src/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.ts"],"sourcesContent":["import { HttpResponse } from 'msw';\n\nimport {\n ContactPointFactory,\n ContactPointMetadataAnnotationsFactory,\n EmailIntegrationFactory,\n ListReceiverApiResponseFactory,\n SlackIntegrationFactory,\n} from '../../../api/notifications/v0alpha1/mocks/fakes/Receivers';\nimport { listReceiverHandler } from '../../../api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/listReceiverHandler';\n\nexport const simpleContactPointsList = ListReceiverApiResponseFactory.build({\n items: [\n // contact point with for testing with multiple different integrations – should show \"email, slack\" description\n ContactPointFactory.build({\n spec: {\n integrations: [EmailIntegrationFactory.build(), SlackIntegrationFactory.build()],\n },\n }),\n // contact point for testing \"email (2)\" description\n ContactPointFactory.build({\n spec: {\n integrations: EmailIntegrationFactory.buildList(2),\n },\n }),\n // contact point for testing \"empty contact point\" description\n ContactPointFactory.build({\n spec: { integrations: [] },\n }),\n ],\n});\n\n// export the simple contact points list as a separate list of handlers (scenario) so we can load it in the front-end\nexport const simpleContactPointsListScenario = [listReceiverHandler(simpleContactPointsList)];\n\nexport const withErrorScenario = [listReceiverHandler(() => new HttpResponse(null, { status: 500 }))];\n\n// Contact points with different canUse values for testing filter functionality\nexport const contactPointsListWithUnusableItems = ListReceiverApiResponseFactory.build({\n items: [\n // Regular contact point (canUse: true)\n ContactPointFactory.build({\n spec: {\n title: 'regular-contact-point',\n integrations: [EmailIntegrationFactory.build()],\n },\n metadata: {\n annotations: ContactPointMetadataAnnotationsFactory.build({\n 'grafana.com/provenance': '',\n }),\n },\n }),\n // Imported contact point (canUse: false)\n ContactPointFactory.build({\n spec: {\n title: 'imported-contact-point',\n integrations: [SlackIntegrationFactory.build()],\n },\n metadata: {\n annotations: ContactPointMetadataAnnotationsFactory.build({\n 'grafana.com/provenance': 'converted_prometheus',\n 'grafana.com/canUse': 'false',\n }),\n },\n }),\n // API provisioned contact point (canUse: true)\n ContactPointFactory.build({\n spec: {\n title: 'api-provisioned-contact-point',\n integrations: [EmailIntegrationFactory.build()],\n },\n metadata: {\n annotations: ContactPointMetadataAnnotationsFactory.build({\n 'grafana.com/provenance': 'api',\n }),\n },\n }),\n ],\n});\n\nexport const contactPointsListWithUnusableItemsScenario = [listReceiverHandler(contactPointsListWithUnusableItems)];\n"],"names":[],"mappings":";;;;;AAWO,MAAM,uBAAA,GAA0B,+BAA+B,KAAA,CAAM;AAAA,EAC1E,KAAA,EAAO;AAAA;AAAA,IAEL,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,cAAc,CAAC,uBAAA,CAAwB,OAAM,EAAG,uBAAA,CAAwB,OAAO;AAAA;AACjF,KACD,CAAA;AAAA;AAAA,IAED,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,YAAA,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AAA,QACR,WAAA,EAAa,uCAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B;AAAA,SAC3B;AAAA;AACH,KACD;AAAA;AAEL,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAAC,mBAAA,CAAoB,kCAAkC,CAAC;;;;"}
1
+ {"version":3,"file":"ContactPointSelector.scenario.mjs","sources":["../../../../../../src/grafana/contactPoints/components/ContactPointSelector/ContactPointSelector.scenario.ts"],"sourcesContent":["import { HttpResponse } from 'msw';\n\nimport {\n ContactPointFactory,\n ContactPointMetadataAnnotationsFactory,\n EmailIntegrationFactory,\n ListReceiverApiResponseFactory,\n SlackIntegrationFactory,\n} from '../../../api/notifications/v1beta1/mocks/fakes/Receivers';\nimport { listReceiverHandler } from '../../../api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/listReceiverHandler';\n\nexport const simpleContactPointsList = ListReceiverApiResponseFactory.build({\n items: [\n // contact point with for testing with multiple different integrations – should show \"email, slack\" description\n ContactPointFactory.build({\n spec: {\n integrations: [EmailIntegrationFactory.build(), SlackIntegrationFactory.build()],\n },\n }),\n // contact point for testing \"email (2)\" description\n ContactPointFactory.build({\n spec: {\n integrations: EmailIntegrationFactory.buildList(2),\n },\n }),\n // contact point for testing \"empty contact point\" description\n ContactPointFactory.build({\n spec: { integrations: [] },\n }),\n ],\n});\n\n// export the simple contact points list as a separate list of handlers (scenario) so we can load it in the front-end\nexport const simpleContactPointsListScenario = [listReceiverHandler(simpleContactPointsList)];\n\nexport const withErrorScenario = [listReceiverHandler(() => new HttpResponse(null, { status: 500 }))];\n\n// Contact points with different canUse values for testing filter functionality\nexport const contactPointsListWithUnusableItems = ListReceiverApiResponseFactory.build({\n items: [\n // Regular contact point (canUse: true)\n ContactPointFactory.build({\n spec: {\n title: 'regular-contact-point',\n integrations: [EmailIntegrationFactory.build()],\n },\n metadata: {\n annotations: ContactPointMetadataAnnotationsFactory.build({\n 'grafana.com/provenance': '',\n }),\n },\n }),\n // Imported contact point (canUse: false)\n ContactPointFactory.build({\n spec: {\n title: 'imported-contact-point',\n integrations: [SlackIntegrationFactory.build()],\n },\n metadata: {\n annotations: ContactPointMetadataAnnotationsFactory.build({\n 'grafana.com/provenance': 'converted_prometheus',\n 'grafana.com/canUse': 'false',\n }),\n },\n }),\n // API provisioned contact point (canUse: true)\n ContactPointFactory.build({\n spec: {\n title: 'api-provisioned-contact-point',\n integrations: [EmailIntegrationFactory.build()],\n },\n metadata: {\n annotations: ContactPointMetadataAnnotationsFactory.build({\n 'grafana.com/provenance': 'api',\n }),\n },\n }),\n ],\n});\n\nexport const contactPointsListWithUnusableItemsScenario = [listReceiverHandler(contactPointsListWithUnusableItems)];\n"],"names":[],"mappings":";;;;;AAWO,MAAM,uBAAA,GAA0B,+BAA+B,KAAA,CAAM;AAAA,EAC1E,KAAA,EAAO;AAAA;AAAA,IAEL,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,cAAc,CAAC,uBAAA,CAAwB,OAAM,EAAG,uBAAA,CAAwB,OAAO;AAAA;AACjF,KACD,CAAA;AAAA;AAAA,IAED,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,YAAA,EAAc,uBAAA,CAAwB,SAAA,CAAU,CAAC;AAAA;AACnD,KACD,CAAA;AAAA;AAAA,IAED,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM,EAAE,YAAA,EAAc,EAAC;AAAE,KAC1B;AAAA;AAEL,CAAC;AAGM,MAAM,+BAAA,GAAkC,CAAC,mBAAA,CAAoB,uBAAuB,CAAC;AAErF,MAAM,iBAAA,GAAoB,CAAC,mBAAA,CAAoB,MAAM,IAAI,YAAA,CAAa,IAAA,EAAM,EAAE,MAAA,EAAQ,GAAA,EAAK,CAAC,CAAC;AAG7F,MAAM,kCAAA,GAAqC,+BAA+B,KAAA,CAAM;AAAA,EACrF,KAAA,EAAO;AAAA;AAAA,IAEL,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,KAAA,EAAO,uBAAA;AAAA,QACP,YAAA,EAAc,CAAC,uBAAA,CAAwB,KAAA,EAAO;AAAA,OAChD;AAAA,MACA,QAAA,EAAU;AAAA,QACR,WAAA,EAAa,uCAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B;AAAA,SAC3B;AAAA;AACH,KACD,CAAA;AAAA;AAAA,IAED,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,KAAA,EAAO,wBAAA;AAAA,QACP,YAAA,EAAc,CAAC,uBAAA,CAAwB,KAAA,EAAO;AAAA,OAChD;AAAA,MACA,QAAA,EAAU;AAAA,QACR,WAAA,EAAa,uCAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B,sBAAA;AAAA,UAC1B,oBAAA,EAAsB;AAAA,SACvB;AAAA;AACH,KACD,CAAA;AAAA;AAAA,IAED,oBAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,KAAA,EAAO,+BAAA;AAAA,QACP,YAAA,EAAc,CAAC,uBAAA,CAAwB,KAAA,EAAO;AAAA,OAChD;AAAA,MACA,QAAA,EAAU;AAAA,QACR,WAAA,EAAa,uCAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B;AAAA,SAC3B;AAAA;AACH,KACD;AAAA;AAEL,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAAC,mBAAA,CAAoB,kCAAkC,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- import { generatedAPI } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
1
+ import { generatedAPI } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
2
2
 
3
3
  "use strict";
4
4
  function useListContactPoints(queryArgs = {}, queryOptions = {}) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContactPoints.mjs","sources":["../../../../../../src/grafana/contactPoints/hooks/v1beta1/useContactPoints.tsx"],"sourcesContent":["import { type TypedUseQueryHookResult, type fetchBaseQuery } from '@reduxjs/toolkit/query/react';\n\nimport {\n type ListReceiverApiArg,\n generatedAPI as notificationsAPIv1beta1,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport type { EnhancedListReceiverApiResponse } from '../../../api/notifications/v1beta1/types';\n\n// this is a workaround for the fact that the generated types are not narrow enough\ntype ListContactPointsHookResult = TypedUseQueryHookResult<\n EnhancedListReceiverApiResponse,\n ListReceiverApiArg,\n ReturnType<typeof fetchBaseQuery>\n>;\n\n// Type for the options that can be passed to the hook\n// Based on the pattern used for mutation options in this file\ntype ListContactPointsQueryArgs = Parameters<\n typeof notificationsAPIv1beta1.endpoints.listReceiver.useQuery<ListContactPointsHookResult>\n>[0];\n\ntype ListContactPointsQueryOptions = Parameters<\n typeof notificationsAPIv1beta1.endpoints.listReceiver.useQuery<ListContactPointsHookResult>\n>[1];\n\n/**\n * useListContactPoints is a hook that fetches a list of contact points\n *\n * This function wraps the notificationsAPIv1beta1.useListReceiverQuery with proper typing\n * to ensure that the returned ContactPoints are correctly typed in the data.items array.\n *\n * It automatically uses the configured namespace for the query.\n *\n * @param queryOptions - Optional query options that will be passed to the underlying useListReceiverQuery hook.\n * These options can include refetchOnFocus, refetchOnMountOrArgChange, skip, etc.\n */\nexport function useListContactPoints(\n queryArgs: ListContactPointsQueryArgs = {},\n queryOptions: ListContactPointsQueryOptions = {}\n): ListContactPointsHookResult {\n return notificationsAPIv1beta1.useListReceiverQuery<ListContactPointsHookResult>(queryArgs, queryOptions);\n}\n"],"names":["notificationsAPIv1beta1"],"mappings":";;;AAqCO,SAAS,qBACd,SAAA,GAAwC,EAAC,EACzC,YAAA,GAA8C,EAAC,EAClB;AAC7B,EAAA,OAAOA,YAAA,CAAwB,oBAAA,CAAkD,SAAA,EAAW,YAAY,CAAA;AAC1G;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../../src/grafana/contactPoints/utils.ts"],"sourcesContent":["import { countBy, isEmpty } from 'lodash';\n\nimport { type Receiver } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';\n\nimport { type ContactPoint, type ContactPointMetadataAnnotations } from '../api/notifications/v0alpha1/types';\n\n// Annotation key that indicates whether a contact point can be used in routes and rules\nconst CAN_USE_ANNOTATION = 'grafana.com/canUse';\n\n/**\n * Minimal structural type that any k8s alerting entity satisfies.\n * Accepts ContactPoint, Receiver, and the app-internal EntityToCheck type alike.\n */\ntype WithContactPointAnnotations = {\n metadata?: { annotations?: ContactPointMetadataAnnotations };\n};\n\n/**\n * Checks if a contact point can be used in routes and rules.\n * Contact points that are imported from external sources (e.g., Prometheus Alertmanager)\n * have the `grafana.com/canUse` annotation set to `false` and cannot be used.\n *\n * @param contactPoint - The ContactPoint object to check\n * @returns `true` if the contact point can be used, `false` otherwise\n */\nexport function isUsableContactPoint(contactPoint: ContactPoint | Receiver): boolean {\n const canUse = contactPoint.metadata?.annotations?.[CAN_USE_ANNOTATION];\n return canUse === 'true';\n}\n\n/**\n * Returns the number of notification policy routes that reference this contact point,\n * as reported by the server-set `grafana.com/inUse/routes` annotation.\n * Returns 0 when the annotation is absent.\n */\nexport function getContactPointInUseRoutes(contactPoint: WithContactPointAnnotations): number {\n const value = contactPoint.metadata?.annotations?.['grafana.com/inUse/routes'];\n return Number(value) || 0;\n}\n\n/**\n * Returns the number of alert rules that reference this contact point via simplified routing,\n * as reported by the server-set `grafana.com/inUse/rules` annotation.\n * Returns 0 when the annotation is absent.\n */\nexport function getContactPointInUseRules(contactPoint: WithContactPointAnnotations): number {\n const value = contactPoint.metadata?.annotations?.['grafana.com/inUse/rules'];\n return Number(value) || 0;\n}\n\n/**\n * Returns how many routes and rules currently reference this contact point,\n * as reported by the server-set in-use annotations.\n *\n * @returns `{ routes, rules }` — each count is 0 when the annotation is absent.\n */\nexport function getContactPointInUse(contactPoint: WithContactPointAnnotations): { routes: number; rules: number } {\n return {\n routes: getContactPointInUseRoutes(contactPoint),\n rules: getContactPointInUseRules(contactPoint),\n };\n}\n\n/**\n * Generates a human-readable description of a ContactPoint by summarizing its integrations.\n * If the ContactPoint has no integrations, it returns an empty placeholder text.\n *\n * For integrations, it counts the occurrences of each type and formats them as a comma-separated list.\n * Multiple integrations of the same type are indicated with a count in parentheses.\n *\n * @param contactPoint - The ContactPoint object to describe\n * @returns A string description of the ContactPoint's integrations\n */\nexport function getContactPointDescription(contactPoint: ContactPoint | Receiver): string {\n if (isEmpty(contactPoint.spec.integrations)) {\n return '<empty contact point>';\n }\n\n // Count the occurrences of each integration type\n const integrationCounts = countBy(contactPoint.spec.integrations, (integration) => integration.type);\n\n const description = Object.entries(integrationCounts)\n .map(([type, count]) => {\n // either \"email\" or \"email (2)\" but not \"email (1)\"\n return count > 1 ? `${type} (${count})` : type;\n })\n .join(', ');\n\n return description;\n}\n"],"names":[],"mappings":";;;AAOA,MAAM,kBAAA,GAAqB,oBAAA;AAkBpB,SAAS,qBAAqB,YAAA,EAAgD;AAzBrF,EAAA,IAAA,EAAA,EAAA,EAAA;AA0BE,EAAA,MAAM,MAAA,GAAA,CAAS,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAa,QAAA,KAAb,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAuB,gBAAvB,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAqC,kBAAA,CAAA;AACpD,EAAA,OAAO,MAAA,KAAW,MAAA;AACpB;AAOO,SAAS,2BAA2B,YAAA,EAAmD;AAnC9F,EAAA,IAAA,EAAA,EAAA,EAAA;AAoCE,EAAA,MAAM,KAAA,GAAA,CAAQ,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAa,QAAA,KAAb,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAuB,gBAAvB,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAqC,0BAAA,CAAA;AACnD,EAAA,OAAO,MAAA,CAAO,KAAK,CAAA,IAAK,CAAA;AAC1B;AAOO,SAAS,0BAA0B,YAAA,EAAmD;AA7C7F,EAAA,IAAA,EAAA,EAAA,EAAA;AA8CE,EAAA,MAAM,KAAA,GAAA,CAAQ,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAa,QAAA,KAAb,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAuB,gBAAvB,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAqC,yBAAA,CAAA;AACnD,EAAA,OAAO,MAAA,CAAO,KAAK,CAAA,IAAK,CAAA;AAC1B;AAQO,SAAS,qBAAqB,YAAA,EAA8E;AACjH,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,2BAA2B,YAAY,CAAA;AAAA,IAC/C,KAAA,EAAO,0BAA0B,YAAY;AAAA,GAC/C;AACF;AAYO,SAAS,2BAA2B,YAAA,EAA+C;AACxF,EAAA,IAAI,OAAA,CAAQ,YAAA,CAAa,IAAA,CAAK,YAAY,CAAA,EAAG;AAC3C,IAAA,OAAO,uBAAA;AAAA,EACT;AAGA,EAAA,MAAM,iBAAA,GAAoB,QAAQ,YAAA,CAAa,IAAA,CAAK,cAAc,CAAC,WAAA,KAAgB,YAAY,IAAI,CAAA;AAEnG,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,OAAA,CAAQ,iBAAiB,CAAA,CACjD,IAAI,CAAC,CAAC,IAAA,EAAM,KAAK,CAAA,KAAM;AAEtB,IAAA,OAAO,QAAQ,CAAA,GAAI,CAAA,EAAG,IAAI,CAAA,EAAA,EAAK,KAAK,CAAA,CAAA,CAAA,GAAM,IAAA;AAAA,EAC5C,CAAC,CAAA,CACA,IAAA,CAAK,IAAI,CAAA;AAEZ,EAAA,OAAO,WAAA;AACT;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../../src/grafana/contactPoints/utils.ts"],"sourcesContent":["import { countBy, isEmpty } from 'lodash';\n\nimport { type Receiver } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { type ContactPoint, type ContactPointMetadataAnnotations } from '../api/notifications/v1beta1/types';\n\n// Annotation key that indicates whether a contact point can be used in routes and rules\nconst CAN_USE_ANNOTATION = 'grafana.com/canUse';\n\n/**\n * Minimal structural type that any k8s alerting entity satisfies.\n * Accepts ContactPoint, Receiver, and the app-internal EntityToCheck type alike.\n */\ntype WithContactPointAnnotations = {\n metadata?: { annotations?: ContactPointMetadataAnnotations };\n};\n\n/**\n * Checks if a contact point can be used in routes and rules.\n * Contact points that are imported from external sources (e.g., Prometheus Alertmanager)\n * have the `grafana.com/canUse` annotation set to `false` and cannot be used.\n *\n * @param contactPoint - The ContactPoint object to check\n * @returns `true` if the contact point can be used, `false` otherwise\n */\nexport function isUsableContactPoint(contactPoint: ContactPoint | Receiver): boolean {\n const canUse = contactPoint.metadata?.annotations?.[CAN_USE_ANNOTATION];\n return canUse === 'true';\n}\n\n/**\n * Returns the number of notification policy routes that reference this contact point,\n * as reported by the server-set `grafana.com/inUse/routes` annotation.\n * Returns 0 when the annotation is absent.\n */\nexport function getContactPointInUseRoutes(contactPoint: WithContactPointAnnotations): number {\n const value = contactPoint.metadata?.annotations?.['grafana.com/inUse/routes'];\n return Number(value) || 0;\n}\n\n/**\n * Returns the number of alert rules that reference this contact point via simplified routing,\n * as reported by the server-set `grafana.com/inUse/rules` annotation.\n * Returns 0 when the annotation is absent.\n */\nexport function getContactPointInUseRules(contactPoint: WithContactPointAnnotations): number {\n const value = contactPoint.metadata?.annotations?.['grafana.com/inUse/rules'];\n return Number(value) || 0;\n}\n\n/**\n * Returns how many routes and rules currently reference this contact point,\n * as reported by the server-set in-use annotations.\n *\n * @returns `{ routes, rules }` — each count is 0 when the annotation is absent.\n */\nexport function getContactPointInUse(contactPoint: WithContactPointAnnotations): { routes: number; rules: number } {\n return {\n routes: getContactPointInUseRoutes(contactPoint),\n rules: getContactPointInUseRules(contactPoint),\n };\n}\n\n/**\n * Generates a human-readable description of a ContactPoint by summarizing its integrations.\n * If the ContactPoint has no integrations, it returns an empty placeholder text.\n *\n * For integrations, it counts the occurrences of each type and formats them as a comma-separated list.\n * Multiple integrations of the same type are indicated with a count in parentheses.\n *\n * @param contactPoint - The ContactPoint object to describe\n * @returns A string description of the ContactPoint's integrations\n */\nexport function getContactPointDescription(contactPoint: ContactPoint | Receiver): string {\n if (isEmpty(contactPoint.spec.integrations)) {\n return '<empty contact point>';\n }\n\n // Count the occurrences of each integration type\n const integrationCounts = countBy(contactPoint.spec.integrations, (integration) => integration.type);\n\n const description = Object.entries(integrationCounts)\n .map(([type, count]) => {\n // either \"email\" or \"email (2)\" but not \"email (1)\"\n return count > 1 ? `${type} (${count})` : type;\n })\n .join(', ');\n\n return description;\n}\n"],"names":[],"mappings":";;;AAOA,MAAM,kBAAA,GAAqB,oBAAA;AAkBpB,SAAS,qBAAqB,YAAA,EAAgD;AAzBrF,EAAA,IAAA,EAAA,EAAA,EAAA;AA0BE,EAAA,MAAM,MAAA,GAAA,CAAS,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAa,QAAA,KAAb,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAuB,gBAAvB,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAqC,kBAAA,CAAA;AACpD,EAAA,OAAO,MAAA,KAAW,MAAA;AACpB;AAOO,SAAS,2BAA2B,YAAA,EAAmD;AAnC9F,EAAA,IAAA,EAAA,EAAA,EAAA;AAoCE,EAAA,MAAM,KAAA,GAAA,CAAQ,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAa,QAAA,KAAb,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAuB,gBAAvB,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAqC,0BAAA,CAAA;AACnD,EAAA,OAAO,MAAA,CAAO,KAAK,CAAA,IAAK,CAAA;AAC1B;AAOO,SAAS,0BAA0B,YAAA,EAAmD;AA7C7F,EAAA,IAAA,EAAA,EAAA,EAAA;AA8CE,EAAA,MAAM,KAAA,GAAA,CAAQ,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAa,QAAA,KAAb,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAuB,gBAAvB,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAqC,yBAAA,CAAA;AACnD,EAAA,OAAO,MAAA,CAAO,KAAK,CAAA,IAAK,CAAA;AAC1B;AAQO,SAAS,qBAAqB,YAAA,EAA8E;AACjH,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,2BAA2B,YAAY,CAAA;AAAA,IAC/C,KAAA,EAAO,0BAA0B,YAAY;AAAA,GAC/C;AACF;AAYO,SAAS,2BAA2B,YAAA,EAA+C;AACxF,EAAA,IAAI,OAAA,CAAQ,YAAA,CAAa,IAAA,CAAK,YAAY,CAAA,EAAG;AAC3C,IAAA,OAAO,uBAAA;AAAA,EACT;AAGA,EAAA,MAAM,iBAAA,GAAoB,QAAQ,YAAA,CAAa,IAAA,CAAK,cAAc,CAAC,WAAA,KAAgB,YAAY,IAAI,CAAA;AAEnG,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,OAAA,CAAQ,iBAAiB,CAAA,CACjD,IAAI,CAAC,CAAC,IAAA,EAAM,KAAK,CAAA,KAAM;AAEtB,IAAA,OAAO,QAAQ,CAAA,GAAI,CAAA,EAAG,IAAI,CAAA,EAAA,EAAK,KAAK,CAAA,CAAA,CAAA,GAAM,IAAA;AAAA,EAC5C,CAAC,CAAA,CACA,IAAA,CAAK,IAAI,CAAA;AAEZ,EAAA,OAAO,WAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RoutingTreeSelector.mjs","sources":["../../../../../../src/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.tsx"],"sourcesContent":["import { type ComponentProps, useMemo } from 'react';\n\nimport { type RoutingTree } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';\nimport { t } from '@grafana/i18n';\nimport { Alert, Combobox, type ComboboxOption, MultiCombobox } from '@grafana/ui';\n\nimport { type CustomComboBoxProps } from '../../../common/ComboBox.types';\nimport { useListRoutingTrees } from '../../hooks/useRoutingTrees';\nimport { isDefaultRoutingTreeName } from '../../routingTrees';\n\nconst collator = new Intl.Collator('en', { sensitivity: 'accent' });\n\ntype SingleSelectProps = CustomComboBoxProps<RoutingTree> & { multi?: false };\ntype MultiSelectProps = Omit<ComponentProps<typeof MultiCombobox<string>>, 'options' | 'loading' | 'onChange'> & {\n multi: true;\n onChange: (trees: RoutingTree[]) => void;\n};\n\nexport type RoutingTreeSelectorProps = SingleSelectProps | MultiSelectProps;\n\n/**\n * Routing Tree Combobox which lists all available notification policy trees.\n *\n * When the `alertingMultiplePolicies` feature toggle is enabled on the backend,\n * this shows all available routing trees. Otherwise, it shows only the default\n * \"user-defined\" tree.\n *\n * The default routing tree (named \"user-defined\") is displayed as \"Default policy\"\n * and is always listed first.\n *\n * Supports both single-select (default) and multi-select modes via the `multi` prop.\n *\n * @example\n * ```tsx\n * // Single select\n * <RoutingTreeSelector\n * value={selectedTreeName}\n * onChange={(tree) => setSelectedTree(tree)}\n * />\n *\n * // Multi select\n * <RoutingTreeSelector\n * multi\n * value={selectedTreeNames}\n * onChange={(trees) => setSelectedTrees(trees)}\n * />\n * ```\n */\nfunction RoutingTreeSelector(props: RoutingTreeSelectorProps) {\n const {\n currentData: routingTrees,\n isLoading,\n isError,\n } = useListRoutingTrees({}, { refetchOnFocus: true, refetchOnMountOrArgChange: true });\n\n // Build a lookup map from option value → RoutingTree for resolving onChange\n const { options, treeLookup } = useMemo(() => {\n if (!routingTrees?.items) {\n const empty: { options: Array<ComboboxOption<string>>; treeLookup: Map<string, RoutingTree> } = {\n options: [],\n treeLookup: new Map(),\n };\n return empty;\n }\n\n const lookup = new Map<string, RoutingTree>();\n const opts: Array<ComboboxOption<string>> = routingTrees.items\n .map((tree) => {\n const name = tree.metadata.name ?? '';\n const isDefault = isDefaultRoutingTreeName(name);\n\n lookup.set(name, tree);\n\n return {\n label: isDefault ? t('alerting.routing-tree-selector.default-policy', 'Default policy') : name,\n value: name,\n description: isDefault\n ? t(\n 'alerting.routing-tree-selector.default-policy-desc',\n 'Routes alerts using the default notification policy tree'\n )\n : t('alerting.routing-tree-selector.custom-policy-desc', 'Route alerts through the {{name}} policy tree', {\n name,\n }),\n } satisfies ComboboxOption<string>;\n })\n .sort((a, b) => {\n // Default policy always first\n if (isDefaultRoutingTreeName(a.value)) {\n return -1;\n }\n if (isDefaultRoutingTreeName(b.value)) {\n return 1;\n }\n return collator.compare(a.label, b.label);\n });\n\n return { options: opts, treeLookup: lookup };\n }, [routingTrees?.items]);\n\n if (isError) {\n return (\n <Alert\n severity=\"warning\"\n title={t('alerting.routing-tree-selector.error', 'Failed to load notification policies')}\n />\n );\n }\n\n if (props.multi) {\n const { multi: _, onChange, ...rest } = props;\n\n const handleChange = (selectedOptions: Array<ComboboxOption<string>>) => {\n const trees = selectedOptions\n .map((opt) => treeLookup.get(opt.value))\n .filter((tree): tree is RoutingTree => tree != null);\n onChange(trees);\n };\n\n // @ts-expect-error TypeScript cannot narrow rest-spread from discriminated unions with conditional width types\n return <MultiCombobox {...rest} loading={isLoading} options={options} onChange={handleChange} />;\n }\n\n const handleChange = (selectedOption: ComboboxOption<string> | null) => {\n if (selectedOption == null && props.isClearable) {\n props.onChange(null);\n return;\n }\n\n if (selectedOption) {\n const tree = treeLookup.get(selectedOption.value);\n if (!tree) {\n console.warn(`RoutingTreeSelector: could not find routing tree for value \"${selectedOption.value}\"`);\n return;\n }\n\n props.onChange(tree);\n }\n };\n\n return <Combobox {...props} loading={isLoading} options={options} onChange={handleChange} />;\n}\n\nexport { RoutingTreeSelector };\n"],"names":["handleChange"],"mappings":";;;;;;;;AAUA,MAAM,QAAA,GAAW,IAAI,IAAA,CAAK,QAAA,CAAS,MAAM,EAAE,WAAA,EAAa,UAAU,CAAA;AAsClE,SAAS,oBAAoB,KAAA,EAAiC;AAC5D,EAAA,MAAM;AAAA,IACJ,WAAA,EAAa,YAAA;AAAA,IAC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,SAAS,IAAI,CAAA;AACnB,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,MAAM,IAAA,GAAO,UAAA,CAAW,GAAA,CAAI,cAAA,CAAe,KAAK,CAAA;AAChD,MAAA,IAAI,CAAC,IAAA,EAAM;AACT,QAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,4DAAA,EAA+D,cAAA,CAAe,KAAK,CAAA,CAAA,CAAG,CAAA;AACnG,QAAA;AAAA,MACF;AAEA,MAAA,KAAA,CAAM,SAAS,IAAI,CAAA;AAAA,IACrB;AAAA,EACF,CAAA;AAEA,EAAA,uBAAO,GAAA,CAAC,YAAU,GAAG,KAAA,EAAO,SAAS,SAAA,EAAW,OAAA,EAAkB,UAAU,YAAA,EAAc,CAAA;AAC5F;;;;"}
1
+ {"version":3,"file":"RoutingTreeSelector.mjs","sources":["../../../../../../src/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.tsx"],"sourcesContent":["import { type ComponentProps, useMemo } from 'react';\n\nimport { type RoutingTree } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\nimport { t } from '@grafana/i18n';\nimport { Alert, Combobox, type ComboboxOption, MultiCombobox } from '@grafana/ui';\n\nimport { type CustomComboBoxProps } from '../../../common/ComboBox.types';\nimport { useListRoutingTrees } from '../../hooks/useRoutingTrees';\nimport { isDefaultRoutingTreeName } from '../../routingTrees';\n\nconst collator = new Intl.Collator('en', { sensitivity: 'accent' });\n\ntype SingleSelectProps = CustomComboBoxProps<RoutingTree> & { multi?: false };\ntype MultiSelectProps = Omit<ComponentProps<typeof MultiCombobox<string>>, 'options' | 'loading' | 'onChange'> & {\n multi: true;\n onChange: (trees: RoutingTree[]) => void;\n};\n\nexport type RoutingTreeSelectorProps = SingleSelectProps | MultiSelectProps;\n\n/**\n * Routing Tree Combobox which lists all available notification policy trees.\n *\n * The default routing tree (named \"user-defined\") is displayed as \"Default policy\"\n * and is always listed first.\n *\n * Supports both single-select (default) and multi-select modes via the `multi` prop.\n *\n * @example\n * ```tsx\n * // Single select\n * <RoutingTreeSelector\n * value={selectedTreeName}\n * onChange={(tree) => setSelectedTree(tree)}\n * />\n *\n * // Multi select\n * <RoutingTreeSelector\n * multi\n * value={selectedTreeNames}\n * onChange={(trees) => setSelectedTrees(trees)}\n * />\n * ```\n */\nfunction RoutingTreeSelector(props: RoutingTreeSelectorProps) {\n const {\n currentData: routingTrees,\n isLoading,\n isError,\n } = useListRoutingTrees({}, { refetchOnFocus: true, refetchOnMountOrArgChange: true });\n\n // Build a lookup map from option value → RoutingTree for resolving onChange\n const { options, treeLookup } = useMemo(() => {\n if (!routingTrees?.items) {\n const empty: { options: Array<ComboboxOption<string>>; treeLookup: Map<string, RoutingTree> } = {\n options: [],\n treeLookup: new Map(),\n };\n return empty;\n }\n\n const lookup = new Map<string, RoutingTree>();\n const opts: Array<ComboboxOption<string>> = routingTrees.items\n .map((tree) => {\n const name = tree.metadata.name ?? '';\n const isDefault = isDefaultRoutingTreeName(name);\n\n lookup.set(name, tree);\n\n return {\n label: isDefault ? t('alerting.routing-tree-selector.default-policy', 'Default policy') : name,\n value: name,\n description: isDefault\n ? t(\n 'alerting.routing-tree-selector.default-policy-desc',\n 'Routes alerts using the default notification policy tree'\n )\n : t('alerting.routing-tree-selector.custom-policy-desc', 'Route alerts through the {{name}} policy tree', {\n name,\n }),\n } satisfies ComboboxOption<string>;\n })\n .sort((a, b) => {\n // Default policy always first\n if (isDefaultRoutingTreeName(a.value)) {\n return -1;\n }\n if (isDefaultRoutingTreeName(b.value)) {\n return 1;\n }\n return collator.compare(a.label, b.label);\n });\n\n return { options: opts, treeLookup: lookup };\n }, [routingTrees?.items]);\n\n if (isError) {\n return (\n <Alert\n severity=\"warning\"\n title={t('alerting.routing-tree-selector.error', 'Failed to load notification policies')}\n />\n );\n }\n\n if (props.multi) {\n const { multi: _, onChange, ...rest } = props;\n\n const handleChange = (selectedOptions: Array<ComboboxOption<string>>) => {\n const trees = selectedOptions\n .map((opt) => treeLookup.get(opt.value))\n .filter((tree): tree is RoutingTree => tree != null);\n onChange(trees);\n };\n\n // @ts-expect-error TypeScript cannot narrow rest-spread from discriminated unions with conditional width types\n return <MultiCombobox {...rest} loading={isLoading} options={options} onChange={handleChange} />;\n }\n\n const handleChange = (selectedOption: ComboboxOption<string> | null) => {\n if (selectedOption == null && props.isClearable) {\n props.onChange(null);\n return;\n }\n\n if (selectedOption) {\n const tree = treeLookup.get(selectedOption.value);\n if (!tree) {\n console.warn(`RoutingTreeSelector: could not find routing tree for value \"${selectedOption.value}\"`);\n return;\n }\n\n props.onChange(tree);\n }\n };\n\n return <Combobox {...props} loading={isLoading} options={options} onChange={handleChange} />;\n}\n\nexport { RoutingTreeSelector };\n"],"names":["handleChange"],"mappings":";;;;;;;;AAUA,MAAM,QAAA,GAAW,IAAI,IAAA,CAAK,QAAA,CAAS,MAAM,EAAE,WAAA,EAAa,UAAU,CAAA;AAkClE,SAAS,oBAAoB,KAAA,EAAiC;AAC5D,EAAA,MAAM;AAAA,IACJ,WAAA,EAAa,YAAA;AAAA,IACb,SAAA;AAAA,IACA;AAAA,GACF,GAAI,oBAAoB,EAAC,EAAG,EAAE,cAAA,EAAgB,IAAA,EAAM,yBAAA,EAA2B,IAAA,EAAM,CAAA;AAGrF,EAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAI,QAAQ,MAAM;AAC5C,IAAA,IAAI,EAAC,6CAAc,KAAA,CAAA,EAAO;AACxB,MAAA,MAAM,KAAA,GAA0F;AAAA,QAC9F,SAAS,EAAC;AAAA,QACV,UAAA,sBAAgB,GAAA;AAAI,OACtB;AACA,MAAA,OAAO,KAAA;AAAA,IACT;AAEA,IAAA,MAAM,MAAA,uBAAa,GAAA,EAAyB;AAC5C,IAAA,MAAM,IAAA,GAAsC,YAAA,CAAa,KAAA,CACtD,GAAA,CAAI,CAAC,IAAA,KAAS;AA/DrB,MAAA,IAAA,EAAA;AAgEQ,MAAA,MAAM,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2
- import { ListRoutingTreeApiResponseFactory, RoutingTreeFactory } from '../../../api/notifications/v0alpha1/mocks/fakes/Routes.mjs';
3
- import { listRoutingTreeHandler } from '../../../api/notifications/v0alpha1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.mjs';
2
+ import { ListRoutingTreeApiResponseFactory, RoutingTreeFactory } from '../../../api/notifications/v1beta1/mocks/fakes/Routes.mjs';
3
+ import { listRoutingTreeHandler } from '../../../api/notifications/v1beta1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.mjs';
4
4
  import { USER_DEFINED_TREE_NAME, DEFAULT_ROUTING_TREE_NAME_ALIAS } from '../../routingTrees.mjs';
5
5
 
6
6
  "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"RoutingTreeSelector.scenario.mjs","sources":["../../../../../../src/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.ts"],"sourcesContent":["import { HttpResponse } from 'msw';\n\nimport {\n ListRoutingTreeApiResponseFactory,\n RoutingTreeFactory,\n} from '../../../api/notifications/v0alpha1/mocks/fakes/Routes';\nimport { listRoutingTreeHandler } from '../../../api/notifications/v0alpha1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler';\nimport { DEFAULT_ROUTING_TREE_NAME_ALIAS, USER_DEFINED_TREE_NAME } from '../../routingTrees';\n\n// A simple list with the default tree and two custom trees\nexport const simpleRoutingTreesList = ListRoutingTreeApiResponseFactory.build({\n items: [\n RoutingTreeFactory.build({\n metadata: { name: USER_DEFINED_TREE_NAME },\n }),\n RoutingTreeFactory.build({\n metadata: { name: 'team-platform' },\n }),\n RoutingTreeFactory.build({\n metadata: { name: 'team-backend' },\n }),\n ],\n});\n\nexport const simpleRoutingTreesListScenario = [listRoutingTreeHandler(simpleRoutingTreesList)];\n\n// A list with only the default tree (feature toggle off or no custom trees)\nexport const singleDefaultTreeList = ListRoutingTreeApiResponseFactory.build({\n items: [\n RoutingTreeFactory.build({\n metadata: { name: USER_DEFINED_TREE_NAME },\n }),\n ],\n});\n\nexport const singleDefaultTreeScenario = [listRoutingTreeHandler(singleDefaultTreeList)];\n\n// The same simple list, but the default tree is presented with the future canonical name (`default`),\n// modelling a backend that emits `default` for the root tree. `billing` sorts alphabetically BEFORE\n// `default`, so the default tree only ends up first if it is recognised and force-sorted (not merely alphabetical).\nexport const simpleRoutingTreesListDefaultAlias = ListRoutingTreeApiResponseFactory.build({\n items: [\n RoutingTreeFactory.build({ metadata: { name: DEFAULT_ROUTING_TREE_NAME_ALIAS } }),\n RoutingTreeFactory.build({ metadata: { name: 'billing' } }),\n RoutingTreeFactory.build({ metadata: { name: 'team-backend' } }),\n ],\n});\n\nexport const simpleRoutingTreesListDefaultAliasScenario = [listRoutingTreeHandler(simpleRoutingTreesListDefaultAlias)];\n\nexport const routingTreeWithErrorScenario = [listRoutingTreeHandler(() => new HttpResponse(null, { status: 500 }))];\n"],"names":[],"mappings":";;;;;;AAUO,MAAM,sBAAA,GAAyB,kCAAkC,KAAA,CAAM;AAAA,EAC5E,KAAA,EAAO;AAAA,IACL,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,sBAAA;AAAuB,KAC1C,CAAA;AAAA,IACD,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,eAAA;AAAgB,KACnC,CAAA;AAAA,IACD,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA;AAAe,KAClC;AAAA;AAEL,CAAC;AAEM,MAAM,8BAAA,GAAiC,CAAC,sBAAA,CAAuB,sBAAsB,CAAC;AAGtF,MAAM,qBAAA,GAAwB,kCAAkC,KAAA,CAAM;AAAA,EAC3E,KAAA,EAAO;AAAA,IACL,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,sBAAA;AAAuB,KAC1C;AAAA;AAEL,CAAC;AAEM,MAAM,yBAAA,GAA4B,CAAC,sBAAA,CAAuB,qBAAqB,CAAC;AAKhF,MAAM,kCAAA,GAAqC,kCAAkC,KAAA,CAAM;AAAA,EACxF,KAAA,EAAO;AAAA,IACL,kBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,+BAAA,IAAmC,CAAA;AAAA,IAChF,kBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,SAAA,IAAa,CAAA;AAAA,IAC1D,kBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA,IAAkB;AAAA;AAEnE,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAAC,sBAAA,CAAuB,kCAAkC,CAAC;AAE9G,MAAM,4BAAA,GAA+B,CAAC,sBAAA,CAAuB,MAAM,IAAI,YAAA,CAAa,IAAA,EAAM,EAAE,MAAA,EAAQ,GAAA,EAAK,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"RoutingTreeSelector.scenario.mjs","sources":["../../../../../../src/grafana/notificationPolicies/components/RoutingTreeSelector/RoutingTreeSelector.scenario.ts"],"sourcesContent":["import { HttpResponse } from 'msw';\n\nimport {\n ListRoutingTreeApiResponseFactory,\n RoutingTreeFactory,\n} from '../../../api/notifications/v1beta1/mocks/fakes/Routes';\nimport { listRoutingTreeHandler } from '../../../api/notifications/v1beta1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler';\nimport { DEFAULT_ROUTING_TREE_NAME_ALIAS, USER_DEFINED_TREE_NAME } from '../../routingTrees';\n\n// A simple list with the default tree and two custom trees\nexport const simpleRoutingTreesList = ListRoutingTreeApiResponseFactory.build({\n items: [\n RoutingTreeFactory.build({\n metadata: { name: USER_DEFINED_TREE_NAME },\n }),\n RoutingTreeFactory.build({\n metadata: { name: 'team-platform' },\n }),\n RoutingTreeFactory.build({\n metadata: { name: 'team-backend' },\n }),\n ],\n});\n\nexport const simpleRoutingTreesListScenario = [listRoutingTreeHandler(simpleRoutingTreesList)];\n\n// A list with only the default tree (feature toggle off or no custom trees)\nexport const singleDefaultTreeList = ListRoutingTreeApiResponseFactory.build({\n items: [\n RoutingTreeFactory.build({\n metadata: { name: USER_DEFINED_TREE_NAME },\n }),\n ],\n});\n\nexport const singleDefaultTreeScenario = [listRoutingTreeHandler(singleDefaultTreeList)];\n\n// The same simple list, but the default tree is presented with the future canonical name (`default`),\n// modelling a backend that emits `default` for the root tree. `billing` sorts alphabetically BEFORE\n// `default`, so the default tree only ends up first if it is recognised and force-sorted (not merely alphabetical).\nexport const simpleRoutingTreesListDefaultAlias = ListRoutingTreeApiResponseFactory.build({\n items: [\n RoutingTreeFactory.build({ metadata: { name: DEFAULT_ROUTING_TREE_NAME_ALIAS } }),\n RoutingTreeFactory.build({ metadata: { name: 'billing' } }),\n RoutingTreeFactory.build({ metadata: { name: 'team-backend' } }),\n ],\n});\n\nexport const simpleRoutingTreesListDefaultAliasScenario = [listRoutingTreeHandler(simpleRoutingTreesListDefaultAlias)];\n\nexport const routingTreeWithErrorScenario = [listRoutingTreeHandler(() => new HttpResponse(null, { status: 500 }))];\n"],"names":[],"mappings":";;;;;;AAUO,MAAM,sBAAA,GAAyB,kCAAkC,KAAA,CAAM;AAAA,EAC5E,KAAA,EAAO;AAAA,IACL,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,sBAAA;AAAuB,KAC1C,CAAA;AAAA,IACD,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,eAAA;AAAgB,KACnC,CAAA;AAAA,IACD,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA;AAAe,KAClC;AAAA;AAEL,CAAC;AAEM,MAAM,8BAAA,GAAiC,CAAC,sBAAA,CAAuB,sBAAsB,CAAC;AAGtF,MAAM,qBAAA,GAAwB,kCAAkC,KAAA,CAAM;AAAA,EAC3E,KAAA,EAAO;AAAA,IACL,mBAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,sBAAA;AAAuB,KAC1C;AAAA;AAEL,CAAC;AAEM,MAAM,yBAAA,GAA4B,CAAC,sBAAA,CAAuB,qBAAqB,CAAC;AAKhF,MAAM,kCAAA,GAAqC,kCAAkC,KAAA,CAAM;AAAA,EACxF,KAAA,EAAO;AAAA,IACL,kBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,+BAAA,IAAmC,CAAA;AAAA,IAChF,kBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,SAAA,IAAa,CAAA;AAAA,IAC1D,kBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA,IAAkB;AAAA;AAEnE,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAAC,sBAAA,CAAuB,kCAAkC,CAAC;AAE9G,MAAM,4BAAA,GAA+B,CAAC,sBAAA,CAAuB,MAAM,IAAI,YAAA,CAAa,IAAA,EAAM,EAAE,MAAA,EAAQ,GAAA,EAAK,CAAC,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useMemo } from 'react';
2
- import { generatedAPI } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
2
+ import { generatedAPI } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
3
3
  import { USER_DEFINED_TREE_NAME } from '../routingTrees.mjs';
4
4
  import { convertRoutingTreeToRoute, matchInstancesToRoute } from '../utils.mjs';
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"useMatchPolicies.mjs","sources":["../../../../../src/grafana/notificationPolicies/hooks/useMatchPolicies.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\n\nimport {\n type RoutingTree,\n generatedAPI as notificationsAPIv0alpha1,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';\n\nimport { type Label } from '../../matchers/types';\nimport { USER_DEFINED_TREE_NAME } from '../routingTrees';\nimport { type Route, type RouteWithID } from '../types';\nimport { type RouteMatchResult, type TreeMatch, convertRoutingTreeToRoute, matchInstancesToRoute } from '../utils';\n\nexport type RouteMatch = {\n route: Route;\n routeTree: {\n // Add some metadata about the tree that is useful for displaying diagnostics\n metadata: Pick<RoutingTree['metadata'], 'name'>;\n // We'll include the entire expanded policy tree for diagnostics\n expandedSpec: RouteWithID;\n };\n matchDetails: RouteMatchResult<RouteWithID>;\n};\n\nexport type InstanceMatchResult = {\n // The labels we used to match to our policies\n labels: Label[];\n // The routes that matched the labels where the key is a route and the value is an array of instances that match that route\n matchedRoutes: RouteMatch[];\n};\n\ninterface UseMatchInstancesToRouteTreesReturnType\n extends ReturnType<typeof notificationsAPIv0alpha1.endpoints.listRoutingTree.useQuery> {\n matchInstancesToRouteTrees: (instances: Label[][]) => InstanceMatchResult[];\n}\n\n/**\n * React hook that finds notification policy routes in all routing trees that match the provided set of alert instances.\n *\n * This hook queries the routing tree API and processes each tree to:\n * 1. Convert RoutingTree structures to Route structures\n * 2. Compute the inherited properties for each node in the tree\n * 3. Find routes within each tree that match the given set of labels\n *\n * @returns An object containing a `matchInstancesToRoutingTrees` function that takes alert instances\n * and returns an array of InstanceMatchResult objects, each containing the matched routes and matching details\n */\nexport function useMatchInstancesToRouteTrees(): UseMatchInstancesToRouteTreesReturnType {\n const { data, ...rest } = notificationsAPIv0alpha1.endpoints.listRoutingTree.useQuery(\n {},\n {\n refetchOnFocus: true,\n refetchOnReconnect: true,\n }\n );\n\n const memoizedFunction = useCallback(\n (instances: Label[][]) => matchInstancesToRouteTrees(data?.items ?? [], instances),\n [data?.items]\n );\n\n return {\n matchInstancesToRouteTrees: memoizedFunction,\n ...rest,\n };\n}\n\n/**\n * React hook that finds notification policy routes in a single routing tree that match the provided set of alert instances.\n *\n * Unlike `useMatchInstancesToRouteTrees` which matches against all trees,\n * this hook matches against a specific tree (e.g. one selected via the RoutingTreeSelector).\n *\n * @param routingTree - The routing tree to match against, or null if none selected\n * @param instances - Array of label sets to match against the tree\n *\n * @example\n * ```tsx\n * const [selectedTree, setSelectedTree] = useState<RoutingTree | null>(null);\n * const labels: Label[] = [['severity', 'critical'], ['team', 'platform']];\n *\n * const result = useMatchInstancesToSpecificRouteTree(selectedTree, [labels]);\n * // result.matchedPolicies → Map<Route, MatchResult[]>\n * // result.expandedTree → full tree with inherited properties\n * ```\n */\nexport function useMatchInstancesToSpecificRouteTree(\n routingTree: RoutingTree | null,\n instances: Label[][]\n): TreeMatch | null {\n return useMemo(() => {\n if (!routingTree) {\n return null;\n }\n\n const rootRoute = convertRoutingTreeToRoute(routingTree);\n return matchInstancesToRoute(rootRoute, instances);\n }, [routingTree, instances]);\n}\n\n/**\n * This function will match a set of labels to multiple routing trees. Assumes a list of routing trees has already been fetched.\n *\n * Use \"useMatchInstancesToRouteTrees\" if you want the hook to automatically fetch the latest definition of routing trees.\n */\nexport function matchInstancesToRouteTrees(trees: RoutingTree[], instances: Label[][]): InstanceMatchResult[] {\n // Process each tree and get matches for all instances\n const treeMatches = trees.map<TreeMatch>((tree) => {\n const rootRoute = convertRoutingTreeToRoute(tree);\n return matchInstancesToRoute(rootRoute, instances);\n });\n\n // Group results by instance\n return instances.map<InstanceMatchResult>((labels) => {\n // Collect matches for this specific instance from all trees\n const allMatchedRoutes = treeMatches.flatMap(({ expandedTree, matchedPolicies }, index) => {\n const tree = trees[index];\n\n return Array.from(matchedPolicies.entries()).flatMap(([route, results]) =>\n results\n .filter((matchDetails) => matchDetails.labels === labels)\n .map((matchDetails) => ({\n route,\n routeTree: {\n metadata: { name: tree.metadata.name ?? USER_DEFINED_TREE_NAME },\n expandedSpec: expandedTree,\n },\n matchDetails,\n }))\n );\n });\n\n return {\n labels,\n matchedRoutes: allMatchedRoutes,\n };\n });\n}\n"],"names":["notificationsAPIv0alpha1"],"mappings":";;;;;;AA8CO,SAAS,6BAAA,GAAyE;AACvF,EAAA,MAAM,EAAE,IAAA,EAAM,GAAG,MAAK,GAAIA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AAA,EAAc,eAAA,IAAmB,KAAA,KAAU;AACzF,MAAA,MAAM,IAAA,GAAO,MAAM,KAAK,CAAA;AAExB,MAAA,OAAO,KAAA,CAAM,IAAA,CAAK,eAAA,CAAgB,OAAA,EAAS,CAAA,CAAE,OAAA;AAAA,QAAQ,CAAC,CAAC,KAAA,EAAO,OAAO,MACnE,OAAA,CACG,MAAA,CAAO,CAAC,YAAA,KAAiB,aAAa,MAAA,KAAW,MAAM,CAAA,CACvD,GAAA,CAAI,CAAC,YAAA,KAAc;AAxH9B,UAAA,IAAA,EAAA;AAwHkC,UAAA,OAAA;AAAA,YACtB,KAAA;AAAA,YACA,SAAA,EAAW;AAAA,cACT,UAAU,EAAE,IAAA,EAAA,CAAM,UAAK,QAAA,CAAS,IAAA,KAAd,YAAsB,sBAAA,EAAuB;AAAA,cAC/D,YAAA,EAAc;AAAA,aAChB;AAAA,YACA;AAAA,WACF;AAAA,QAAA,CAAE;AAAA,OACN;AAAA,IACF,CAAC,CAAA;AAED,IAAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,aAAA,EAAe;AAAA,KACjB;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useMatchPolicies.mjs","sources":["../../../../../src/grafana/notificationPolicies/hooks/useMatchPolicies.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\n\nimport {\n type RoutingTree,\n generatedAPI as notificationsAPIv1beta1,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\nimport { type Label } from '../../matchers/types';\nimport { USER_DEFINED_TREE_NAME } from '../routingTrees';\nimport { type Route, type RouteWithID } from '../types';\nimport { type RouteMatchResult, type TreeMatch, convertRoutingTreeToRoute, matchInstancesToRoute } from '../utils';\n\nexport type RouteMatch = {\n route: Route;\n routeTree: {\n // Add some metadata about the tree that is useful for displaying diagnostics\n metadata: Pick<RoutingTree['metadata'], 'name'>;\n // We'll include the entire expanded policy tree for diagnostics\n expandedSpec: RouteWithID;\n };\n matchDetails: RouteMatchResult<RouteWithID>;\n};\n\nexport type InstanceMatchResult = {\n // The labels we used to match to our policies\n labels: Label[];\n // The routes that matched the labels where the key is a route and the value is an array of instances that match that route\n matchedRoutes: RouteMatch[];\n};\n\ninterface UseMatchInstancesToRouteTreesReturnType\n extends ReturnType<typeof notificationsAPIv1beta1.endpoints.listRoutingTree.useQuery> {\n matchInstancesToRouteTrees: (instances: Label[][]) => InstanceMatchResult[];\n}\n\n/**\n * React hook that finds notification policy routes in all routing trees that match the provided set of alert instances.\n *\n * This hook queries the routing tree API and processes each tree to:\n * 1. Convert RoutingTree structures to Route structures\n * 2. Compute the inherited properties for each node in the tree\n * 3. Find routes within each tree that match the given set of labels\n *\n * @returns An object containing a `matchInstancesToRoutingTrees` function that takes alert instances\n * and returns an array of InstanceMatchResult objects, each containing the matched routes and matching details\n */\nexport function useMatchInstancesToRouteTrees(): UseMatchInstancesToRouteTreesReturnType {\n const { data, ...rest } = notificationsAPIv1beta1.endpoints.listRoutingTree.useQuery(\n {},\n {\n refetchOnFocus: true,\n refetchOnReconnect: true,\n }\n );\n\n const memoizedFunction = useCallback(\n (instances: Label[][]) => matchInstancesToRouteTrees(data?.items ?? [], instances),\n [data?.items]\n );\n\n return {\n matchInstancesToRouteTrees: memoizedFunction,\n ...rest,\n };\n}\n\n/**\n * React hook that finds notification policy routes in a single routing tree that match the provided set of alert instances.\n *\n * Unlike `useMatchInstancesToRouteTrees` which matches against all trees,\n * this hook matches against a specific tree (e.g. one selected via the RoutingTreeSelector).\n *\n * @param routingTree - The routing tree to match against, or null if none selected\n * @param instances - Array of label sets to match against the tree\n *\n * @example\n * ```tsx\n * const [selectedTree, setSelectedTree] = useState<RoutingTree | null>(null);\n * const labels: Label[] = [['severity', 'critical'], ['team', 'platform']];\n *\n * const result = useMatchInstancesToSpecificRouteTree(selectedTree, [labels]);\n * // result.matchedPolicies → Map<Route, MatchResult[]>\n * // result.expandedTree → full tree with inherited properties\n * ```\n */\nexport function useMatchInstancesToSpecificRouteTree(\n routingTree: RoutingTree | null,\n instances: Label[][]\n): TreeMatch | null {\n return useMemo(() => {\n if (!routingTree) {\n return null;\n }\n\n const rootRoute = convertRoutingTreeToRoute(routingTree);\n return matchInstancesToRoute(rootRoute, instances);\n }, [routingTree, instances]);\n}\n\n/**\n * This function will match a set of labels to multiple routing trees. Assumes a list of routing trees has already been fetched.\n *\n * Use \"useMatchInstancesToRouteTrees\" if you want the hook to automatically fetch the latest definition of routing trees.\n */\nexport function matchInstancesToRouteTrees(trees: RoutingTree[], instances: Label[][]): InstanceMatchResult[] {\n // Process each tree and get matches for all instances\n const treeMatches = trees.map<TreeMatch>((tree) => {\n const rootRoute = convertRoutingTreeToRoute(tree);\n return matchInstancesToRoute(rootRoute, instances);\n });\n\n // Group results by instance\n return instances.map<InstanceMatchResult>((labels) => {\n // Collect matches for this specific instance from all trees\n const allMatchedRoutes = treeMatches.flatMap(({ expandedTree, matchedPolicies }, index) => {\n const tree = trees[index];\n\n return Array.from(matchedPolicies.entries()).flatMap(([route, results]) =>\n results\n .filter((matchDetails) => matchDetails.labels === labels)\n .map((matchDetails) => ({\n route,\n routeTree: {\n metadata: { name: tree.metadata.name ?? USER_DEFINED_TREE_NAME },\n expandedSpec: expandedTree,\n },\n matchDetails,\n }))\n );\n });\n\n return {\n labels,\n matchedRoutes: allMatchedRoutes,\n };\n });\n}\n"],"names":["notificationsAPIv1beta1"],"mappings":";;;;;;AA8CO,SAAS,6BAAA,GAAyE;AACvF,EAAA,MAAM,EAAE,IAAA,EAAM,GAAG,MAAK,GAAIA,YAAA,CAAwB,UAAU,eAAA,CAAgB,QAAA;AAAA,IAC1E,EAAC;AAAA,IACD;AAAA,MACE,cAAA,EAAgB,IAAA;AAAA,MAChB,kBAAA,EAAoB;AAAA;AACtB,GACF;AAEA,EAAA,MAAM,gBAAA,GAAmB,WAAA;AAAA,IACvB,CAAC,SAAA,KAAsB;AAxD3B,MAAA,IAAA,EAAA;AAwD8B,MAAA,OAAA,0BAA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a,MAAA,KAAW,MAAM,CAAA,CACvD,GAAA,CAAI,CAAC,YAAA,KAAc;AAxH9B,UAAA,IAAA,EAAA;AAwHkC,UAAA,OAAA;AAAA,YACtB,KAAA;AAAA,YACA,SAAA,EAAW;AAAA,cACT,UAAU,EAAE,IAAA,EAAA,CAAM,UAAK,QAAA,CAAS,IAAA,KAAd,YAAsB,sBAAA,EAAuB;AAAA,cAC/D,YAAA,EAAc;AAAA,aAChB;AAAA,YACA;AAAA,WACF;AAAA,QAAA,CAAE;AAAA,OACN;AAAA,IACF,CAAC,CAAA;AAED,IAAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,aAAA,EAAe;AAAA,KACjB;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
@@ -1,4 +1,4 @@
1
- import { generatedAPI } from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';
1
+ import { generatedAPI } from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';
2
2
 
3
3
  "use strict";
4
4
  function useListRoutingTrees(queryArgs = {}, queryOptions = {}) {