@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
@@ -4,14 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var faker = require('@faker-js/faker');
6
6
  var fishery = require('fishery');
7
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
7
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
8
8
  var util = require('../../../../../mocks/util.cjs');
9
9
  var common = require('./common.cjs');
10
10
 
11
11
  "use strict";
12
12
  const ListReceiverApiResponseFactory = fishery.Factory.define(() => ({
13
13
  kind: "ReceiverList",
14
- apiVersion: `${v0alpha1.API_GROUP}/${v0alpha1.API_VERSION}`,
14
+ apiVersion: `${v1beta1.API_GROUP}/${v1beta1.API_VERSION}`,
15
15
  metadata: {
16
16
  resourceVersion: util.generateResourceVersion()
17
17
  },
@@ -21,7 +21,7 @@ const ContactPointFactory = fishery.Factory.define(() => {
21
21
  const title = util.generateTitle();
22
22
  return {
23
23
  kind: "Receiver",
24
- apiVersion: `${v0alpha1.API_GROUP}/${v0alpha1.API_VERSION}`,
24
+ apiVersion: `${v1beta1.API_GROUP}/${v1beta1.API_VERSION}`,
25
25
  metadata: {
26
26
  name: btoa(title),
27
27
  namespace: util.DEFAULT_NAMESPACE,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Receivers.cjs","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":["Factory","API_GROUP","API_VERSION","generateResourceVersion","generateTitle","DEFAULT_NAMESPACE","generateUID","faker","AlertingEntityMetadataAnnotationsFactory"],"mappings":";;;;;;;;;;;AAeO,MAAM,8BAAA,GAAiCA,eAAA,CAAQ,MAAA,CAAwC,OAAO;AAAA,EACnG,IAAA,EAAM,cAAA;AAAA,EACN,UAAA,EAAY,CAAA,EAAGC,iBAAS,CAAA,CAAA,EAAIC,mBAAW,CAAA,CAAA;AAAA,EACvC,QAAA,EAAU;AAAA,IACR,iBAAiBC,4BAAA;AAAwB,GAC3C;AAAA,EACA,KAAA,EAAO,mBAAA,CAAoB,SAAA,CAAU,CAAC;AACxC,CAAA,CAAE;AAEK,MAAM,mBAAA,GAAsBH,eAAA,CAAQ,MAAA,CAAqB,MAAM;AACpE,EAAA,MAAM,QAAQI,kBAAA,EAAc;AAE5B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,UAAA,EAAY,CAAA,EAAGH,iBAAS,CAAA,CAAA,EAAIC,mBAAW,CAAA,CAAA;AAAA,IACvC,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,KAAK,KAAK,CAAA;AAAA,MAChB,SAAA,EAAWG,sBAAA;AAAA,MACX,KAAKC,gBAAA,EAAY;AAAA,MACjB,iBAAiBH,4BAAA,EAAwB;AAAA,MACzC,WAAA,EAAa,uCAAuC,KAAA;AAAM,KAC5D;AAAA,IACA,IAAA,EAAM,uBAAA,CAAwB,KAAA,CAAM,EAAE,OAAO,CAAA;AAAA,IAC7C,QAAQ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EAC3B,oBAAA,EAAsB,MAAA;AAAA,EACtB,GAAGQ,gDAAyC,KAAA;AAC9C,CAAA,CAAE;;;;;;;;;;"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var faker = require('@faker-js/faker');
6
6
  var fishery = require('fishery');
7
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
7
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
8
8
  var util = require('../../../../../mocks/util.cjs');
9
9
  var routingTrees = require('../../../../../notificationPolicies/routingTrees.cjs');
10
10
 
@@ -33,7 +33,7 @@ const RoutingTreeFactory = fishery.Factory.define(({ sequence }) => {
33
33
  const name = sequence === 1 ? routingTrees.USER_DEFINED_TREE_NAME : `policy-tree-${sequence}`;
34
34
  return {
35
35
  kind: "RoutingTree",
36
- apiVersion: `${v0alpha1.API_GROUP}/${v0alpha1.API_VERSION}`,
36
+ apiVersion: `${v1beta1.API_GROUP}/${v1beta1.API_VERSION}`,
37
37
  metadata: {
38
38
  name,
39
39
  namespace: util.DEFAULT_NAMESPACE,
@@ -53,7 +53,7 @@ const RoutingTreeFactory = fishery.Factory.define(({ sequence }) => {
53
53
  });
54
54
  const ListRoutingTreeApiResponseFactory = fishery.Factory.define(() => ({
55
55
  kind: "RoutingTreeList",
56
- apiVersion: `${v0alpha1.API_GROUP}/${v0alpha1.API_VERSION}`,
56
+ apiVersion: `${v1beta1.API_GROUP}/${v1beta1.API_VERSION}`,
57
57
  metadata: {
58
58
  resourceVersion: util.generateResourceVersion()
59
59
  },
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Routes.cjs","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":["Factory","faker","USER_DEFINED_TREE_NAME","API_GROUP","API_VERSION","DEFAULT_NAMESPACE","generateResourceVersion"],"mappings":";;;;;;;;;;;AAeO,MAAM,mBAAA,GAAsBA,eAAA,CAAQ,MAAA,CAAqB,MAAM;AACpE,EAAA,MAAM,SAAA,GAAyC,CAAC,GAAA,EAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAErE,EAAA,OAAO;AAAA,IACL,KAAA,EAAOC,WAAA,CAAM,OAAA,CAAQ,YAAA,CAAa,CAAC,SAAA,EAAW,KAAA,EAAO,MAAA,EAAQ,UAAA,EAAY,QAAA,EAAU,UAAU,CAAC,CAAA;AAAA,IAC9F,IAAA,EAAMA,WAAA,CAAM,OAAA,CAAQ,YAAA,CAAa,SAAS,CAAA;AAAA,IAC1C,KAAA,EAAOA,WAAA,CAAM,OAAA,CAAQ,YAAA,CAAa,CAAC,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,SAAA,EAAW,SAAA,EAAW,SAAS,CAAC;AAAA,GAClH;AACF,CAAC;AAEM,MAAM,YAAA,GAAeD,eAAA,CAAQ,MAAA,CAAc,OAAO;AAAA,EACvD,QAAA,EAAUC,WAAA,CAAM,QAAA,CAAS,OAAA,EAAQ;AAAA,EACjC,QAAA,EAAUA,YAAM,OAAA,CAAQ,YAAA,CAAa,CAAC,UAAA,EAAY,UAAA,EAAY,iBAAA,EAAmB,UAAU,CAAC,CAAA;AAAA,EAC5F,QAAA,EAAU,mBAAA,CAAoB,SAAA,CAAUA,WAAA,CAAM,MAAA,CAAO,GAA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,QAAA,EAAU;AAAA,MACR,IAAA;AAAA,MACA,SAAA,EAAWC,sBAAA;AAAA,MACX,iBAAiBC,4BAAA;AAAwB,KAC3C;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,QAAA,EAAU;AAAA,QACR,QAAA,EAAUL,YAAM,OAAA,CAAQ,YAAA,CAAa,CAAC,UAAA,EAAY,UAAA,EAAY,iBAAA,EAAmB,UAAU,CAAC,CAAA;AAAA,QAC5F,QAAA,EAAU,CAAC,WAAW,CAAA;AAAA,QACtB,UAAA,EAAY,KAAA;AAAA,QACZ,cAAA,EAAgB,IAAA;AAAA,QAChB,eAAA,EAAiB;AAAA,OACnB;AAAA,MACA,QAAQ;AAAC;AACX,GACF;AACF,CAAC;AAEM,MAAM,iCAAA,GAAoCD,eAAA,CAAQ,MAAA,CAAmC,OAAO;AAAA,EACjG,IAAA,EAAM,iBAAA;AAAA,EACN,UAAA,EAAY,CAAA,EAAGG,iBAAS,CAAA,CAAA,EAAIC,mBAAW,CAAA,CAAA;AAAA,EACvC,QAAA,EAAU;AAAA,IACR,iBAAiBE,4BAAA;AAAwB,GAC3C;AAAA,EACA,KAAA,EAAO,kBAAA,CAAmB,SAAA,CAAU,CAAC;AACvC,CAAA,CAAE;;;;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.cjs","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":["Factory"],"mappings":";;;;;;;AAIO,MAAM,wCAAA,GAA2CA,eAAA,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;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function createReceiverHandler(data) {
11
- return msw.http.post(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/receivers"), function handler(info) {
11
+ return msw.http.post(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/receivers"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createReceiverHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAUO,SAAS,sBACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,KAAKC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function deleteReceiverHandler(data) {
11
- return msw.http.delete(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/receivers/:name"), function handler(info) {
11
+ return msw.http.delete(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/receivers/:name"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteReceiverHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAUO,SAAS,sBACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,OAAOC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function deletecollectionReceiverHandler(data) {
11
- return msw.http.delete(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/receivers"), function handler(info) {
11
+ return msw.http.delete(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/receivers"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deletecollectionReceiverHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAUO,SAAS,gCACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,OAAOC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function getReceiverHandler(data) {
11
- return msw.http.get(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/receivers/:name"), function handler(info) {
11
+ return msw.http.get(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/receivers/:name"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getReceiverHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAUO,SAAS,mBACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,IAAIC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function listReceiverHandler(data) {
11
- return msw.http.get(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/receivers"), function handler(info) {
11
+ return msw.http.get(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/receivers"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listReceiverHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAOO,SAAS,oBACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,IAAIC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function replaceReceiverHandler(data) {
11
- return msw.http.put(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/receivers/:name"), function handler(info) {
11
+ return msw.http.put(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/receivers/:name"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replaceReceiverHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAUO,SAAS,uBACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,IAAIC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function updateReceiverHandler(data) {
11
- return msw.http.patch(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/receivers/:name"), function handler(info) {
11
+ return msw.http.patch(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/receivers/:name"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateReceiverHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAUO,SAAS,sBACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,MAAMC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var util = require('../../../../../../mocks/util.cjs');
8
8
 
9
9
  "use strict";
10
10
  function listRoutingTreeHandler(data) {
11
- return msw.http.get(util.getAPIBaseURLForMocks(v0alpha1.API_GROUP, v0alpha1.API_VERSION, "/routingtrees"), function handler(info) {
11
+ return msw.http.get(util.getAPIBaseURLForMocks(v1beta1.API_GROUP, v1beta1.API_VERSION, "/routingtrees"), function handler(info) {
12
12
  if (typeof data === "function") {
13
13
  return data(info);
14
14
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listRoutingTreeHandler.cjs","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":["http","getAPIBaseURLForMocks","API_GROUP","API_VERSION","HttpResponse"],"mappings":";;;;;;;;;AAUO,SAAS,uBACd,IAAA,EACA;AACA,EAAA,OAAOA,QAAA,CAAK,IAAIC,0BAAA,CAAsBC,iBAAA,EAAWC,qBAAa,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,OAAOC,gBAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var lodash = require('lodash');
7
7
  var ui = require('@grafana/ui');
8
- var useContactPoints = require('../../hooks/v0alpha1/useContactPoints.cjs');
8
+ var useContactPoints = require('../../hooks/v1beta1/useContactPoints.cjs');
9
9
  var utils = require('../../utils.cjs');
10
10
 
11
11
  "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPointSelector.cjs","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={isLoading} options={options} onChange={handleChange} />;\n}\n\nexport { ContactPointSelector };\n"],"names":["useListContactPoints","chain","isUsableContactPoint","getContactPointDescription","jsx","Combobox"],"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,GAAIA,qCAAA;AAAA,IAChD,EAAC;AAAA,IACD,EAAE,cAAA,EAAgB,IAAA,EAAM,yBAAA,EAA2B,IAAA;AAAK,GAC1D;AAGA,EAAA,MAAM,sBAAsBC,YAAA,CAAM,aAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,aAAA,CAAe,KAAK,CAAA,CACnD,SAAQ,CACR,MAAA,CAAO,CAAC,YAAA,KAAiB,mBAAmBC,0BAAA,CAAqB,YAAY,CAAC,CAAA,CAC9E,GAAA,CAAI,CAAC,YAAA,KAAc;AArCxB,IAAA,IAAA,EAAA;AAqC4B,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/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":["useListContactPoints","chain","isUsableContactPoint","getContactPointDescription","jsx","Combobox"],"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,GAAIA,qCAAA;AAAA,IAChD,EAAC;AAAA,IACD,EAAE,cAAA,EAAgB,IAAA,EAAM,yBAAA,EAA2B,IAAA;AAAK,GAC1D;AAGA,EAAA,MAAM,sBAAsBC,YAAA,CAAM,aAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,aAAA,CAAe,KAAK,CAAA,CACnD,SAAQ,CACR,MAAA,CAAO,CAAC,YAAA,KAAiB,mBAAmBC,0BAAA,CAAqB,YAAY,CAAC,CAAA,CAC9E,GAAA,CAAI,CAAC,YAAA,KAAc;AArCxB,IAAA,IAAA,EAAA;AAqC4B,IAAA,OAAA;AAAA,MACtB,MAAA,EAAQ;AAAA,QACN,KAAA,EAAO,aAAa,IAAA,CAAK,KAAA;AAAA,QACzB,QAAO,EAAA,GAAA,YAAA,CAAa,QAAA,CAAS,GAAA,KAAtB,IAAA,GAAA,EAAA,GAA6B,aAAa,IAAA,CAAK,KAAA;AAAA,QACtD,WAAA,EAAaC,iCAA2B,YAAY;AAAA,OACtD;AAAA,MACA;AAAA,KACF;AAAA,EAAA,CAAE,CAAA,CACD,KAAA,EAAM,CACN,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAM,QAAA,CAAS,OAAA,CAAQ,EAAE,MAAA,CAAO,KAAA,EAAO,CAAA,CAAE,MAAA,CAAO,KAAK,CAAC,CAAA;AAElE,EAAA,MAAM,UAAU,mBAAA,CAAoB,GAAA,CAAoB,CAAC,IAAA,KAAS,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,uBAAOC,cAAA,CAACC,eAAU,GAAG,aAAA,EAAe,SAAS,SAAA,EAAW,OAAA,EAAkB,UAAU,YAAA,EAAc,CAAA;AACpG;;;;"}
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var Receivers = require('../../../api/notifications/v0alpha1/mocks/fakes/Receivers.cjs');
7
- var listReceiverHandler = require('../../../api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs');
6
+ var Receivers = require('../../../api/notifications/v1beta1/mocks/fakes/Receivers.cjs');
7
+ var listReceiverHandler = require('../../../api/notifications/v1beta1/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs');
8
8
 
9
9
  "use strict";
10
10
  const simpleContactPointsList = Receivers.ListReceiverApiResponseFactory.build({
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPointSelector.scenario.cjs","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":["ListReceiverApiResponseFactory","ContactPointFactory","EmailIntegrationFactory","SlackIntegrationFactory","listReceiverHandler","HttpResponse","ContactPointMetadataAnnotationsFactory"],"mappings":";;;;;;;;;AAWO,MAAM,uBAAA,GAA0BA,yCAA+B,KAAA,CAAM;AAAA,EAC1E,KAAA,EAAO;AAAA;AAAA,IAELC,8BAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,cAAc,CAACC,iCAAA,CAAwB,OAAM,EAAGC,iCAAA,CAAwB,OAAO;AAAA;AACjF,KACD,CAAA;AAAA;AAAA,IAEDF,8BAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,YAAA,EAAcC,iCAAA,CAAwB,SAAA,CAAU,CAAC;AAAA;AACnD,KACD,CAAA;AAAA;AAAA,IAEDD,8BAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM,EAAE,YAAA,EAAc,EAAC;AAAE,KAC1B;AAAA;AAEL,CAAC;AAGM,MAAM,+BAAA,GAAkC,CAACG,uCAAA,CAAoB,uBAAuB,CAAC;AAErF,MAAM,iBAAA,GAAoB,CAACA,uCAAA,CAAoB,MAAM,IAAIC,gBAAA,CAAa,IAAA,EAAM,EAAE,MAAA,EAAQ,GAAA,EAAK,CAAC,CAAC;AAG7F,MAAM,kCAAA,GAAqCL,yCAA+B,KAAA,CAAM;AAAA,EACrF,KAAA,EAAO;AAAA;AAAA,IAELC,8BAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,KAAA,EAAO,uBAAA;AAAA,QACP,YAAA,EAAc,CAACC,iCAAA,CAAwB,KAAA,EAAO;AAAA,OAChD;AAAA,MACA,QAAA,EAAU;AAAA,QACR,WAAA,EAAaI,iDAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B;AAAA,SAC3B;AAAA;AACH,KACD,CAAA;AAAA;AAAA,IAEDL,8BAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,KAAA,EAAO,wBAAA;AAAA,QACP,YAAA,EAAc,CAACE,iCAAA,CAAwB,KAAA,EAAO;AAAA,OAChD;AAAA,MACA,QAAA,EAAU;AAAA,QACR,WAAA,EAAaG,iDAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B,sBAAA;AAAA,UAC1B,oBAAA,EAAsB;AAAA,SACvB;AAAA;AACH,KACD,CAAA;AAAA;AAAA,IAEDL,8BAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,KAAA,EAAO,+BAAA;AAAA,QACP,YAAA,EAAc,CAACC,iCAAA,CAAwB,KAAA,EAAO;AAAA,OAChD;AAAA,MACA,QAAA,EAAU;AAAA,QACR,WAAA,EAAaI,iDAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B;AAAA,SAC3B;AAAA;AACH,KACD;AAAA;AAEL,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAACF,uCAAA,CAAoB,kCAAkC,CAAC;;;;;;;;"}
1
+ {"version":3,"file":"ContactPointSelector.scenario.cjs","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":["ListReceiverApiResponseFactory","ContactPointFactory","EmailIntegrationFactory","SlackIntegrationFactory","listReceiverHandler","HttpResponse","ContactPointMetadataAnnotationsFactory"],"mappings":";;;;;;;;;AAWO,MAAM,uBAAA,GAA0BA,yCAA+B,KAAA,CAAM;AAAA,EAC1E,KAAA,EAAO;AAAA;AA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AA,UAC1B,oBAAA,EAAsB;AAAA,SACvB;AAAA;AACH,KACD,CAAA;AAAA;AAAA,IAEDL,8BAAoB,KAAA,CAAM;AAAA,MACxB,IAAA,EAAM;AAAA,QACJ,KAAA,EAAO,+BAAA;AAAA,QACP,YAAA,EAAc,CAACC,iCAAA,CAAwB,KAAA,EAAO;AAAA,OAChD;AAAA,MACA,QAAA,EAAU;AAAA,QACR,WAAA,EAAaI,iDAAuC,KAAA,CAAM;AAAA,UACxD,wBAAA,EAA0B;AAAA,SAC3B;AAAA;AACH,KACD;AAAA;AAEL,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAACF,uCAAA,CAAoB,kCAAkC,CAAC;;;;;;;;"}
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
5
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
6
6
 
7
7
  "use strict";
8
8
  function useListContactPoints(queryArgs = {}, queryOptions = {}) {
9
- return v0alpha1.generatedAPI.useListReceiverQuery(queryArgs, queryOptions);
9
+ return v1beta1.generatedAPI.useListReceiverQuery(queryArgs, queryOptions);
10
10
  }
11
11
 
12
12
  exports.useListContactPoints = useListContactPoints;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContactPoints.cjs","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,oBAAA,CAAwB,oBAAA,CAAkD,SAAA,EAAW,YAAY,CAAA;AAC1G;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","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":["isEmpty","countBy"],"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,IAAIA,cAAA,CAAQ,YAAA,CAAa,IAAA,CAAK,YAAY,CAAA,EAAG;AAC3C,IAAA,OAAO,uBAAA;AAAA,EACT;AAGA,EAAA,MAAM,iBAAA,GAAoBC,eAAQ,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.cjs","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":["isEmpty","countBy"],"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,IAAIA,cAAA,CAAQ,YAAA,CAAa,IAAA,CAAK,YAAY,CAAA,EAAG;AAC3C,IAAA,OAAO,uBAAA;AAAA,EACT;AAGA,EAAA,MAAM,iBAAA,GAAoBC,eAAQ,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.cjs","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":["routingTrees","useListRoutingTrees","useMemo","isDefaultRoutingTreeName","t","jsx","Alert","handleChange","MultiCombobox","Combobox"],"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,EAAaA,cAAA;AAAA,IACb,SAAA;AAAA,IACA;AAAA,GACF,GAAIC,oCAAoB,EAAC,EAAG,EAAE,cAAA,EAAgB,IAAA,EAAM,yBAAA,EAA2B,IAAA,EAAM,CAAA;AAGrF,EAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAIC,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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,uBAAOF,cAAA,CAACI,eAAU,GAAG,KAAA,EAAO,SAAS,SAAA,EAAW,OAAA,EAAkB,UAAU,YAAA,EAAc,CAAA;AAC5F;;;;"}
1
+ {"version":3,"file":"RoutingTreeSelector.cjs","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":["routingTrees","useListRoutingTrees","useMemo","isDefaultRoutingTreeName","t","jsx","Alert","handleChange","MultiCombobox","Combobox"],"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,EAAaA,cAAA;AAAA,IACb,SAAA;AAAA,IACA;AAAA,GACF,GAAIC,oCAAoB,EAAC,EAAG,EAAE,cAAA,EAAgB,IAAA,EAAM,yBAAA,EAA2B,IAAA,EAAM,CAAA;AAGrF,EAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAIC,cAAQ,MAAM;AAC5C,IAAA,IAAI,EAACF,iDAAc,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,GAAsCA,cAAA,CAAa,KAAA,CACtD,GAAA,CAAI,CAAC,IAAA,KAAS;AA/DrB,MAAA,IAAA,EAAA;AAgEQ,MAAA,MAAM,IAAA,GAAA,CAAO,EAAA,GAAA,IAAA,CAAK,QAAA,CAAS,IAAA,KAAd,IAAA,GAAA,EAAA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A,EAAO,CAAA,EAAG,QAAA,EAAU,GAAG,MAAK,GAAI,KAAA;AAExC,IAAA,MAAMG,aAAAA,GAAe,CAAC,eAAA,KAAmD;AACvE,MAAA,MAAM,KAAA,GAAQ,eAAA,CACX,GAAA,CAAI,CAAC,QAAQ,UAAA,CAAW,GAAA,CAAI,GAAA,CAAI,KAAK,CAAC,CAAA,CACtC,MAAA,CAAO,CAAC,IAAA,KAA8B,QAAQ,IAAI,CAAA;AACrD,MAAA,QAAA,CAAS,KAAK,CAAA;AAAA,IAChB,CAAA;AAGA,IAAA,uBAAOF,cAAA,CAACG,oBAAe,GAAG,IAAA,EAAM,SAAS,SAAA,EAAW,OAAA,EAAkB,UAAUD,aAAAA,EAAc,CAAA;AAAA,EAChG;AAEA,EAAA,MAAM,YAAA,GAAe,CAAC,cAAA,KAAkD;AACtE,IAAA,IAAI,cAAA,IAAkB,IAAA,IAAQ,KAAA,CAAM,WAAA,EAAa;AAC/C,MAAA,KAAA,CAAM,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,uBAAOF,cAAA,CAACI,eAAU,GAAG,KAAA,EAAO,SAAS,SAAA,EAAW,OAAA,EAAkB,UAAU,YAAA,EAAc,CAAA;AAC5F;;;;"}
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var msw = require('msw');
6
- var Routes = require('../../../api/notifications/v0alpha1/mocks/fakes/Routes.cjs');
7
- var listRoutingTreeHandler = require('../../../api/notifications/v0alpha1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.cjs');
6
+ var Routes = require('../../../api/notifications/v1beta1/mocks/fakes/Routes.cjs');
7
+ var listRoutingTreeHandler = require('../../../api/notifications/v1beta1/mocks/handlers/RoutingTreeHandlers/listRoutingTreeHandler.cjs');
8
8
  var routingTrees = require('../../routingTrees.cjs');
9
9
 
10
10
  "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"RoutingTreeSelector.scenario.cjs","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":["ListRoutingTreeApiResponseFactory","RoutingTreeFactory","USER_DEFINED_TREE_NAME","listRoutingTreeHandler","DEFAULT_ROUTING_TREE_NAME_ALIAS","HttpResponse"],"mappings":";;;;;;;;;;AAUO,MAAM,sBAAA,GAAyBA,yCAAkC,KAAA,CAAM;AAAA,EAC5E,KAAA,EAAO;AAAA,IACLC,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAMC,mCAAA;AAAuB,KAC1C,CAAA;AAAA,IACDD,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,eAAA;AAAgB,KACnC,CAAA;AAAA,IACDA,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA;AAAe,KAClC;AAAA;AAEL,CAAC;AAEM,MAAM,8BAAA,GAAiC,CAACE,6CAAA,CAAuB,sBAAsB,CAAC;AAGtF,MAAM,qBAAA,GAAwBH,yCAAkC,KAAA,CAAM;AAAA,EAC3E,KAAA,EAAO;AAAA,IACLC,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAMC,mCAAA;AAAuB,KAC1C;AAAA;AAEL,CAAC;AAEM,MAAM,yBAAA,GAA4B,CAACC,6CAAA,CAAuB,qBAAqB,CAAC;AAKhF,MAAM,kCAAA,GAAqCH,yCAAkC,KAAA,CAAM;AAAA,EACxF,KAAA,EAAO;AAAA,IACLC,yBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAMG,4CAAA,IAAmC,CAAA;AAAA,IAChFH,yBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,SAAA,IAAa,CAAA;AAAA,IAC1DA,yBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA,IAAkB;AAAA;AAEnE,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAACE,6CAAA,CAAuB,kCAAkC,CAAC;AAE9G,MAAM,4BAAA,GAA+B,CAACA,6CAAA,CAAuB,MAAM,IAAIE,gBAAA,CAAa,IAAA,EAAM,EAAE,MAAA,EAAQ,GAAA,EAAK,CAAC,CAAC;;;;;;;;;;"}
1
+ {"version":3,"file":"RoutingTreeSelector.scenario.cjs","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":["ListRoutingTreeApiResponseFactory","RoutingTreeFactory","USER_DEFINED_TREE_NAME","listRoutingTreeHandler","DEFAULT_ROUTING_TREE_NAME_ALIAS","HttpResponse"],"mappings":";;;;;;;;;;AAUO,MAAM,sBAAA,GAAyBA,yCAAkC,KAAA,CAAM;AAAA,EAC5E,KAAA,EAAO;AAAA,IACLC,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAMC,mCAAA;AAAuB,KAC1C,CAAA;AAAA,IACDD,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,eAAA;AAAgB,KACnC,CAAA;AAAA,IACDA,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA;AAAe,KAClC;AAAA;AAEL,CAAC;AAEM,MAAM,8BAAA,GAAiC,CAACE,6CAAA,CAAuB,sBAAsB,CAAC;AAGtF,MAAM,qBAAA,GAAwBH,yCAAkC,KAAA,CAAM;AAAA,EAC3E,KAAA,EAAO;AAAA,IACLC,0BAAmB,KAAA,CAAM;AAAA,MACvB,QAAA,EAAU,EAAE,IAAA,EAAMC,mCAAA;AAAuB,KAC1C;AAAA;AAEL,CAAC;AAEM,MAAM,yBAAA,GAA4B,CAACC,6CAAA,CAAuB,qBAAqB,CAAC;AAKhF,MAAM,kCAAA,GAAqCH,yCAAkC,KAAA,CAAM;AAAA,EACxF,KAAA,EAAO;AAAA,IACLC,yBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAMG,4CAAA,IAAmC,CAAA;AAAA,IAChFH,yBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,SAAA,IAAa,CAAA;AAAA,IAC1DA,yBAAA,CAAmB,MAAM,EAAE,QAAA,EAAU,EAAE,IAAA,EAAM,cAAA,IAAkB;AAAA;AAEnE,CAAC;AAEM,MAAM,0CAAA,GAA6C,CAACE,6CAAA,CAAuB,kCAAkC,CAAC;AAE9G,MAAM,4BAAA,GAA+B,CAACA,6CAAA,CAAuB,MAAM,IAAIE,gBAAA,CAAa,IAAA,EAAM,EAAE,MAAA,EAAQ,GAAA,EAAK,CAAC,CAAC;;;;;;;;;;"}
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
6
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
7
7
  var routingTrees = require('../routingTrees.cjs');
8
8
  var utils = require('../utils.cjs');
9
9
 
10
10
  "use strict";
11
11
  function useMatchInstancesToRouteTrees() {
12
- const { data, ...rest } = v0alpha1.generatedAPI.endpoints.listRoutingTree.useQuery(
12
+ const { data, ...rest } = v1beta1.generatedAPI.endpoints.listRoutingTree.useQuery(
13
13
  {},
14
14
  {
15
15
  refetchOnFocus: true,
@@ -1 +1 @@
1
- {"version":3,"file":"useMatchPolicies.cjs","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","useCallback","useMemo","convertRoutingTreeToRoute","matchInstancesToRoute","USER_DEFINED_TREE_NAME"],"mappings":";;;;;;;;;;AA8CO,SAAS,6BAAA,GAAyE;AACvF,EAAA,MAAM,EAAE,IAAA,EAAM,GAAG,MAAK,GAAIA,qBAAA,CAAyB,UAAU,eAAA,CAAgB,QAAA;AAAA,IAC3E,EAAC;AAAA,IACD;AAAA,MACE,cAAA,EAAgB,IAAA;AAAA,MAChB,kBAAA,EAAoB;AAAA;AACtB,GACF;AAEA,EAAA,MAAM,gBAAA,GAAmBC,iBAAA;AAAA,IACvB,CAAC,SAAA,KAAsB;AAxD3B,MAAA,IAAA,EAAA;AAwD8B,MAAA,OAAA,0BAAA,CAAA,CAA2B,EAAA,GAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAM,KAAA,KAAN,IAAA,GAAA,EAAA,GAAe,IAAI,SAAS,CAAA;AAAA,IAAA,CAAA;AAAA,IACjF,CAAC,6BAAM,KAAK;AAAA,GACd;AAEA,EAAA,OAAO;AAAA,IACL,0BAAA,EAA4B,gBAAA;AAAA,IAC5B,GAAG;AAAA,GACL;AACF;AAqBO,SAAS,oCAAA,CACd,aACA,SAAA,EACkB;AAClB,EAAA,OAAOC,cAAQ,MAAM;AACnB,IAAA,IAAI,CAAC,WAAA,EAAa;AAChB,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,MAAM,SAAA,GAAYC,gCAA0B,WAAW,CAAA;AACvD,IAAA,OAAOC,2BAAA,CAAsB,WAAW,SAAS,CAAA;AAAA,EACnD,CAAA,EAAG,CAAC,WAAA,EAAa,SAAS,CAAC,CAAA;AAC7B;AAOO,SAAS,0BAAA,CAA2B,OAAsB,SAAA,EAA6C;AAE5G,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,GAAA,CAAe,CAAC,IAAA,KAAS;AACjD,IAAA,MAAM,SAAA,GAAYD,gCAA0B,IAAI,CAAA;AAChD,IAAA,OAAOC,2BAAA,CAAsB,WAAW,SAAS,CAAA;AAAA,EACnD,CAAC,CAAA;AAGD,EAAA,OAAO,SAAA,CAAU,GAAA,CAAyB,CAAC,MAAA,KAAW;AAEpD,IAAA,MAAM,gBAAA,GAAmB,YAAY,OAAA,CAAQ,CAAC,EAAE,YAAA,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,YAAsBC,mCAAA,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.cjs","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 };\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;AAChD,IAAA,OAAOC,2BAAA,CAAsB,WAAW,SAAS,CAAA;AAAA,EACnD,CAAC,CAAA;AAGD,EAAA,OAAO,SAAA,CAAU,GAAA,CAAyB,CAAC,MAAA,KAAW;AAEpD,IAAA,MAAM,gBAAA,GAAmB,YAAY,OAAA,CAAQ,CAAC,EAAE,YAAA,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,YAAsBC,mCAAA,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;;;;;;"}
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var v0alpha1 = require('@grafana/api-clients/rtkq/notifications.alerting/v0alpha1');
5
+ var v1beta1 = require('@grafana/api-clients/rtkq/notifications.alerting/v1beta1');
6
6
 
7
7
  "use strict";
8
8
  function useListRoutingTrees(queryArgs = {}, queryOptions = {}) {
9
- return v0alpha1.generatedAPI.useListRoutingTreeQuery(queryArgs, queryOptions);
9
+ return v1beta1.generatedAPI.useListRoutingTreeQuery(queryArgs, queryOptions);
10
10
  }
11
11
 
12
12
  exports.useListRoutingTrees = useListRoutingTrees;
@@ -1 +1 @@
1
- {"version":3,"file":"useRoutingTrees.cjs","sources":["../../../../../src/grafana/notificationPolicies/hooks/useRoutingTrees.ts"],"sourcesContent":["import { type TypedUseQueryHookResult, type fetchBaseQuery } from '@reduxjs/toolkit/query/react';\n\nimport {\n type ListRoutingTreeApiArg,\n type ListRoutingTreeApiResponse,\n generatedAPI as notificationsAPIv0alpha1,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v0alpha1';\n\ntype ListRoutingTreesHookResult = TypedUseQueryHookResult<\n ListRoutingTreeApiResponse,\n ListRoutingTreeApiArg,\n ReturnType<typeof fetchBaseQuery>\n>;\n\ntype ListRoutingTreesQueryArgs = Parameters<\n typeof notificationsAPIv0alpha1.endpoints.listRoutingTree.useQuery<ListRoutingTreesHookResult>\n>[0];\n\ntype ListRoutingTreesQueryOptions = Parameters<\n typeof notificationsAPIv0alpha1.endpoints.listRoutingTree.useQuery<ListRoutingTreesHookResult>\n>[1];\n\n/**\n * useListRoutingTrees is a hook that fetches a list of routing trees (notification policy trees).\n *\n * This function wraps the notificationsAPIv0alpha1.useListRoutingTreeQuery with proper typing.\n *\n * When the `alertingMultiplePolicies` feature toggle is enabled on the backend, this returns all\n * available routing trees. Otherwise, it returns only the default \"user-defined\" tree.\n *\n * @param queryArgs - Optional query arguments for filtering, pagination, etc.\n * @param queryOptions - Optional query options (refetchOnFocus, skip, etc.)\n */\nexport function useListRoutingTrees(\n queryArgs: ListRoutingTreesQueryArgs = {},\n queryOptions: ListRoutingTreesQueryOptions = {}\n): ListRoutingTreesHookResult {\n return notificationsAPIv0alpha1.useListRoutingTreeQuery<ListRoutingTreesHookResult>(queryArgs, queryOptions);\n}\n"],"names":["notificationsAPIv0alpha1"],"mappings":";;;;;;;AAiCO,SAAS,oBACd,SAAA,GAAuC,EAAC,EACxC,YAAA,GAA6C,EAAC,EAClB;AAC5B,EAAA,OAAOA,qBAAA,CAAyB,uBAAA,CAAoD,SAAA,EAAW,YAAY,CAAA;AAC7G;;;;"}
1
+ {"version":3,"file":"useRoutingTrees.cjs","sources":["../../../../../src/grafana/notificationPolicies/hooks/useRoutingTrees.ts"],"sourcesContent":["import { type TypedUseQueryHookResult, type fetchBaseQuery } from '@reduxjs/toolkit/query/react';\n\nimport {\n type ListRoutingTreeApiArg,\n type ListRoutingTreeApiResponse,\n generatedAPI as notificationsAPIv1beta1,\n} from '@grafana/api-clients/rtkq/notifications.alerting/v1beta1';\n\ntype ListRoutingTreesHookResult = TypedUseQueryHookResult<\n ListRoutingTreeApiResponse,\n ListRoutingTreeApiArg,\n ReturnType<typeof fetchBaseQuery>\n>;\n\ntype ListRoutingTreesQueryArgs = Parameters<\n typeof notificationsAPIv1beta1.endpoints.listRoutingTree.useQuery<ListRoutingTreesHookResult>\n>[0];\n\ntype ListRoutingTreesQueryOptions = Parameters<\n typeof notificationsAPIv1beta1.endpoints.listRoutingTree.useQuery<ListRoutingTreesHookResult>\n>[1];\n\n/**\n * useListRoutingTrees is a hook that fetches a list of routing trees (notification policy trees).\n *\n * This function wraps the notificationsAPIv1beta1.useListRoutingTreeQuery with proper typing.\n *\n * The backend returns all available routing trees.\n *\n * @param queryArgs - Optional query arguments for filtering, pagination, etc.\n * @param queryOptions - Optional query options (refetchOnFocus, skip, etc.)\n */\nexport function useListRoutingTrees(\n queryArgs: ListRoutingTreesQueryArgs = {},\n queryOptions: ListRoutingTreesQueryOptions = {}\n): ListRoutingTreesHookResult {\n return notificationsAPIv1beta1.useListRoutingTreeQuery<ListRoutingTreesHookResult>(queryArgs, queryOptions);\n}\n"],"names":["notificationsAPIv1beta1"],"mappings":";;;;;;;AAgCO,SAAS,oBACd,SAAA,GAAuC,EAAC,EACxC,YAAA,GAA6C,EAAC,EAClB;AAC5B,EAAA,OAAOA,oBAAA,CAAwB,uBAAA,CAAoD,SAAA,EAAW,YAAY,CAAA;AAC5G;;;;"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  const USER_DEFINED_TREE_NAME = "user-defined";
7
7
  const DEFAULT_ROUTING_TREE_NAME_ALIAS = "default";
8
8
  function isDefaultRoutingTreeName(name) {
9
- return name === void 0 || name === null || name === "" || name === USER_DEFINED_TREE_NAME || name === DEFAULT_ROUTING_TREE_NAME_ALIAS;
9
+ return name === void 0 || name === "" || name === USER_DEFINED_TREE_NAME || name === DEFAULT_ROUTING_TREE_NAME_ALIAS;
10
10
  }
11
11
  function isDefaultRoutingTree(tree) {
12
12
  return isDefaultRoutingTreeName(tree.metadata.name);