@intentius/chant-lexicon-grafana 0.98.0 → 0.99.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 (451) hide show
  1. package/README.md +15 -5
  2. package/dist/actions/grafana.d.ts +24 -0
  3. package/dist/actions/grafana.d.ts.map +1 -0
  4. package/dist/actions/index.d.ts +2 -0
  5. package/dist/actions/index.d.ts.map +1 -0
  6. package/dist/alerting-build.d.ts +128 -0
  7. package/dist/alerting-build.d.ts.map +1 -0
  8. package/dist/alerting.d.ts +273 -0
  9. package/dist/alerting.d.ts.map +1 -0
  10. package/dist/api/apply.d.ts +156 -0
  11. package/dist/api/apply.d.ts.map +1 -0
  12. package/dist/api/bind.d.ts +32 -0
  13. package/dist/api/bind.d.ts.map +1 -0
  14. package/dist/api/client.d.ts +76 -0
  15. package/dist/api/client.d.ts.map +1 -0
  16. package/dist/api/converge.d.ts +33 -0
  17. package/dist/api/converge.d.ts.map +1 -0
  18. package/dist/api/dashboards.d.ts +102 -0
  19. package/dist/api/dashboards.d.ts.map +1 -0
  20. package/dist/api/datasources.d.ts +26 -0
  21. package/dist/api/datasources.d.ts.map +1 -0
  22. package/dist/api/fake-grafana-writes.d.ts +41 -0
  23. package/dist/api/fake-grafana-writes.d.ts.map +1 -0
  24. package/dist/api/fake-grafana.d.ts +61 -0
  25. package/dist/api/fake-grafana.d.ts.map +1 -0
  26. package/dist/api/folders.d.ts +110 -0
  27. package/dist/api/folders.d.ts.map +1 -0
  28. package/dist/api/library-panels.d.ts +52 -0
  29. package/dist/api/library-panels.d.ts.map +1 -0
  30. package/dist/build.d.ts +30 -2
  31. package/dist/build.d.ts.map +1 -1
  32. package/dist/catalog.d.ts +1 -1
  33. package/dist/catalog.d.ts.map +1 -1
  34. package/dist/codegen/docs.d.ts.map +1 -1
  35. package/dist/codegen/schema-types.d.ts +3 -3
  36. package/dist/codegen/schema-types.d.ts.map +1 -1
  37. package/dist/composites/agent-dashboard.d.ts.map +1 -1
  38. package/dist/composites/catalog.d.ts.map +1 -1
  39. package/dist/composites/index.d.ts +4 -2
  40. package/dist/composites/index.d.ts.map +1 -1
  41. package/dist/composites/red-dashboard.d.ts +21 -2
  42. package/dist/composites/red-dashboard.d.ts.map +1 -1
  43. package/dist/composites/shared.d.ts +7 -0
  44. package/dist/composites/shared.d.ts.map +1 -1
  45. package/dist/composites/slo-alert-rules.d.ts +92 -0
  46. package/dist/composites/slo-alert-rules.d.ts.map +1 -0
  47. package/dist/config.d.ts +111 -0
  48. package/dist/config.d.ts.map +1 -0
  49. package/dist/contact-point-secrets.d.ts +17 -0
  50. package/dist/contact-point-secrets.d.ts.map +1 -0
  51. package/dist/dashboard.d.ts +16 -2
  52. package/dist/dashboard.d.ts.map +1 -1
  53. package/dist/datasource-refs.d.ts +95 -0
  54. package/dist/datasource-refs.d.ts.map +1 -0
  55. package/dist/datasource.d.ts +29 -0
  56. package/dist/datasource.d.ts.map +1 -1
  57. package/dist/deep-observe-hooks.d.ts +64 -0
  58. package/dist/deep-observe-hooks.d.ts.map +1 -0
  59. package/dist/deep-observe.d.ts +42 -0
  60. package/dist/deep-observe.d.ts.map +1 -0
  61. package/dist/describe-resources.d.ts +49 -0
  62. package/dist/describe-resources.d.ts.map +1 -0
  63. package/dist/detect.d.ts +28 -1
  64. package/dist/detect.d.ts.map +1 -1
  65. package/dist/export-resources.d.ts +38 -0
  66. package/dist/export-resources.d.ts.map +1 -0
  67. package/dist/import/alerting.d.ts +40 -0
  68. package/dist/import/alerting.d.ts.map +1 -0
  69. package/dist/import/edits.d.ts +47 -0
  70. package/dist/import/edits.d.ts.map +1 -0
  71. package/dist/import/embedded.d.ts +14 -0
  72. package/dist/import/embedded.d.ts.map +1 -0
  73. package/dist/import/generator.d.ts +60 -0
  74. package/dist/import/generator.d.ts.map +1 -0
  75. package/dist/import/live-export.d.ts +108 -0
  76. package/dist/import/live-export.d.ts.map +1 -0
  77. package/dist/import/mappings.d.ts +83 -0
  78. package/dist/import/mappings.d.ts.map +1 -0
  79. package/dist/import/model.d.ts +98 -0
  80. package/dist/import/model.d.ts.map +1 -0
  81. package/dist/import/normalize-alerting.d.ts +26 -0
  82. package/dist/import/normalize-alerting.d.ts.map +1 -0
  83. package/dist/import/normalize.d.ts +74 -0
  84. package/dist/import/normalize.d.ts.map +1 -0
  85. package/dist/import/parser.d.ts +110 -0
  86. package/dist/import/parser.d.ts.map +1 -0
  87. package/dist/import/report.d.ts +26 -0
  88. package/dist/import/report.d.ts.map +1 -0
  89. package/dist/import/testdata/fixtures.d.ts +35 -0
  90. package/dist/import/testdata/fixtures.d.ts.map +1 -0
  91. package/dist/import/v2.d.ts +72 -0
  92. package/dist/import/v2.d.ts.map +1 -0
  93. package/dist/index.d.ts +26 -9
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/integrity.json +18 -10
  96. package/dist/k8s.d.ts +107 -0
  97. package/dist/k8s.d.ts.map +1 -0
  98. package/dist/lint/audit-catalog.d.ts +2 -1
  99. package/dist/lint/audit-catalog.d.ts.map +1 -1
  100. package/dist/lint/post-synth/graf101.d.ts +2 -2
  101. package/dist/lint/post-synth/graf102.d.ts +1 -1
  102. package/dist/lint/post-synth/graf107.d.ts +1 -1
  103. package/dist/lint/post-synth/graf108.d.ts +8 -0
  104. package/dist/lint/post-synth/graf108.d.ts.map +1 -0
  105. package/dist/lint/post-synth/graf109.d.ts +8 -0
  106. package/dist/lint/post-synth/graf109.d.ts.map +1 -0
  107. package/dist/lint/post-synth/graf111.d.ts +8 -0
  108. package/dist/lint/post-synth/graf111.d.ts.map +1 -0
  109. package/dist/lint/post-synth/graf112.d.ts +8 -0
  110. package/dist/lint/post-synth/graf112.d.ts.map +1 -0
  111. package/dist/lint/post-synth/graf113.d.ts +8 -0
  112. package/dist/lint/post-synth/graf113.d.ts.map +1 -0
  113. package/dist/lint/post-synth/graf114.d.ts +8 -0
  114. package/dist/lint/post-synth/graf114.d.ts.map +1 -0
  115. package/dist/lint/post-synth/graf115.d.ts +8 -0
  116. package/dist/lint/post-synth/graf115.d.ts.map +1 -0
  117. package/dist/lint/post-synth/grafana-helpers.d.ts +7 -5
  118. package/dist/lint/post-synth/grafana-helpers.d.ts.map +1 -1
  119. package/dist/lint/post-synth/index.d.ts.map +1 -1
  120. package/dist/lint/rules/literal-secret.d.ts +7 -3
  121. package/dist/lint/rules/literal-secret.d.ts.map +1 -1
  122. package/dist/lsp/hover.d.ts.map +1 -1
  123. package/dist/manifest.json +1 -1
  124. package/dist/members.d.ts +27 -0
  125. package/dist/members.d.ts.map +1 -0
  126. package/dist/meta.json +135 -0
  127. package/dist/okf/index.md +36 -2
  128. package/dist/okf/rules/GRAF002.md +3 -2
  129. package/dist/okf/rules/GRAF101.md +3 -2
  130. package/dist/okf/rules/GRAF102.md +1 -0
  131. package/dist/okf/rules/GRAF108.md +11 -0
  132. package/dist/okf/rules/GRAF109.md +15 -0
  133. package/dist/okf/rules/GRAF111.md +11 -0
  134. package/dist/okf/rules/GRAF112.md +16 -0
  135. package/dist/okf/rules/GRAF113.md +16 -0
  136. package/dist/okf/rules/GRAF114.md +11 -0
  137. package/dist/okf/rules/GRAF115.md +11 -0
  138. package/dist/okf/types/AlertListPanel.md +9 -0
  139. package/dist/okf/types/AlertQuery.md +9 -0
  140. package/dist/okf/types/AlertRule.md +9 -0
  141. package/dist/okf/types/AlertRuleGroup.md +9 -0
  142. package/dist/okf/types/BarChartPanel.md +9 -0
  143. package/dist/okf/types/BarGaugePanel.md +9 -0
  144. package/dist/okf/types/CanvasPanel.md +9 -0
  145. package/dist/okf/types/ClassicConditionsExpression.md +9 -0
  146. package/dist/okf/types/ContactPoint.md +14 -0
  147. package/dist/okf/types/Dashboard.md +1 -0
  148. package/dist/okf/types/Datasource.md +3 -2
  149. package/dist/okf/types/ExternalDatasource.md +15 -0
  150. package/dist/okf/types/FlameGraphPanel.md +9 -0
  151. package/dist/okf/types/GeomapPanel.md +9 -0
  152. package/dist/okf/types/HistogramPanel.md +9 -0
  153. package/dist/okf/types/MathExpression.md +9 -0
  154. package/dist/okf/types/MuteTiming.md +13 -0
  155. package/dist/okf/types/NodeGraphPanel.md +9 -0
  156. package/dist/okf/types/NotificationPolicy.md +9 -0
  157. package/dist/okf/types/NotificationTemplate.md +9 -0
  158. package/dist/okf/types/PieChartPanel.md +9 -0
  159. package/dist/okf/types/ReduceExpression.md +9 -0
  160. package/dist/okf/types/ResampleExpression.md +9 -0
  161. package/dist/okf/types/SqlExpression.md +9 -0
  162. package/dist/okf/types/StateTimelinePanel.md +9 -0
  163. package/dist/okf/types/StatusHistoryPanel.md +9 -0
  164. package/dist/okf/types/ThresholdExpression.md +9 -0
  165. package/dist/okf/types/TrendPanel.md +9 -0
  166. package/dist/okf/types/XYChartPanel.md +9 -0
  167. package/dist/op/activities/grafana-apply.d.ts +75 -0
  168. package/dist/op/activities/grafana-apply.d.ts.map +1 -0
  169. package/dist/op/activities/index.d.ts +9 -0
  170. package/dist/op/activities/index.d.ts.map +1 -0
  171. package/dist/op/builders.d.ts +24 -0
  172. package/dist/op/builders.d.ts.map +1 -0
  173. package/dist/ownership.d.ts +67 -0
  174. package/dist/ownership.d.ts.map +1 -0
  175. package/dist/panel-options.d.ts +65 -0
  176. package/dist/panel-options.d.ts.map +1 -0
  177. package/dist/panels.d.ts +46 -9
  178. package/dist/panels.d.ts.map +1 -1
  179. package/dist/pin.d.ts +29 -7
  180. package/dist/pin.d.ts.map +1 -1
  181. package/dist/plugin.d.ts.map +1 -1
  182. package/dist/promql-check.d.ts +51 -0
  183. package/dist/promql-check.d.ts.map +1 -0
  184. package/dist/query.d.ts +9 -8
  185. package/dist/query.d.ts.map +1 -1
  186. package/dist/rules/graf101.ts +3 -3
  187. package/dist/rules/graf102.ts +1 -1
  188. package/dist/rules/graf107.ts +1 -1
  189. package/dist/rules/graf108.ts +17 -0
  190. package/dist/rules/graf109.ts +17 -0
  191. package/dist/rules/graf111.ts +17 -0
  192. package/dist/rules/graf112.ts +17 -0
  193. package/dist/rules/graf113.ts +17 -0
  194. package/dist/rules/graf114.ts +17 -0
  195. package/dist/rules/graf115.ts +17 -0
  196. package/dist/rules/grafana-helpers.ts +15 -8
  197. package/dist/rules/literal-secret.ts +60 -6
  198. package/dist/schema/barchart.gen.d.ts +198 -0
  199. package/dist/schema/barchart.gen.d.ts.map +1 -0
  200. package/dist/schema/bargauge.gen.d.ts +97 -0
  201. package/dist/schema/bargauge.gen.d.ts.map +1 -0
  202. package/dist/schema/canvas.gen.d.ts +152 -0
  203. package/dist/schema/canvas.gen.d.ts.map +1 -0
  204. package/dist/schema/dashboard.gen.d.ts +196 -21
  205. package/dist/schema/dashboard.gen.d.ts.map +1 -1
  206. package/dist/schema/expr.gen.d.ts +606 -0
  207. package/dist/schema/expr.gen.d.ts.map +1 -0
  208. package/dist/schema/gauge.gen.d.ts.map +1 -1
  209. package/dist/schema/geomap.gen.d.ts +100 -0
  210. package/dist/schema/geomap.gen.d.ts.map +1 -0
  211. package/dist/schema/heatmap.gen.d.ts.map +1 -1
  212. package/dist/schema/histogram.gen.d.ts +132 -0
  213. package/dist/schema/histogram.gen.d.ts.map +1 -0
  214. package/dist/schema/index.d.ts +12 -0
  215. package/dist/schema/index.d.ts.map +1 -1
  216. package/dist/schema/logs.gen.d.ts +1 -0
  217. package/dist/schema/logs.gen.d.ts.map +1 -1
  218. package/dist/schema/loki.gen.d.ts.map +1 -1
  219. package/dist/schema/nodegraph.gen.d.ts +49 -0
  220. package/dist/schema/nodegraph.gen.d.ts.map +1 -0
  221. package/dist/schema/piechart.gen.d.ts +127 -0
  222. package/dist/schema/piechart.gen.d.ts.map +1 -0
  223. package/dist/schema/prometheus.gen.d.ts.map +1 -1
  224. package/dist/schema/stat.gen.d.ts.map +1 -1
  225. package/dist/schema/statetimeline.gen.d.ts +124 -0
  226. package/dist/schema/statetimeline.gen.d.ts.map +1 -0
  227. package/dist/schema/statushistory.gen.d.ts +114 -0
  228. package/dist/schema/statushistory.gen.d.ts.map +1 -0
  229. package/dist/schema/table.gen.d.ts +22 -3
  230. package/dist/schema/table.gen.d.ts.map +1 -1
  231. package/dist/schema/tempo.gen.d.ts.map +1 -1
  232. package/dist/schema/text.gen.d.ts.map +1 -1
  233. package/dist/schema/timeseries.gen.d.ts +5 -1
  234. package/dist/schema/timeseries.gen.d.ts.map +1 -1
  235. package/dist/schema/trend.gen.d.ts +180 -0
  236. package/dist/schema/trend.gen.d.ts.map +1 -0
  237. package/dist/schema/xychart.gen.d.ts +145 -0
  238. package/dist/schema/xychart.gen.d.ts.map +1 -0
  239. package/dist/schema-validate.d.ts +30 -4
  240. package/dist/schema-validate.d.ts.map +1 -1
  241. package/dist/serializer.d.ts +11 -3
  242. package/dist/serializer.d.ts.map +1 -1
  243. package/dist/skill-defs.d.ts.map +1 -1
  244. package/dist/skills/chant-grafana-alerting.md +49 -0
  245. package/dist/skills/chant-grafana-provisioning.md +3 -3
  246. package/dist/skills/chant-grafana.md +12 -6
  247. package/dist/spec/fetch-units-cli.d.ts +3 -0
  248. package/dist/spec/fetch-units-cli.d.ts.map +1 -0
  249. package/dist/spec/overlay.d.ts +43 -0
  250. package/dist/spec/overlay.d.ts.map +1 -0
  251. package/dist/spec/schemas.d.ts +13 -7
  252. package/dist/spec/schemas.d.ts.map +1 -1
  253. package/dist/spec/units.d.ts +35 -0
  254. package/dist/spec/units.d.ts.map +1 -0
  255. package/dist/spec/units.gen.d.ts +2 -0
  256. package/dist/spec/units.gen.d.ts.map +1 -0
  257. package/dist/transformations.d.ts +459 -0
  258. package/dist/transformations.d.ts.map +1 -0
  259. package/dist/util.d.ts +6 -0
  260. package/dist/util.d.ts.map +1 -1
  261. package/dist/validate-alerting.d.ts +65 -0
  262. package/dist/validate-alerting.d.ts.map +1 -0
  263. package/dist/validate-output.d.ts +49 -9
  264. package/dist/validate-output.d.ts.map +1 -1
  265. package/dist/validate.d.ts.map +1 -1
  266. package/dist/variables.d.ts +7 -2
  267. package/dist/variables.d.ts.map +1 -1
  268. package/package.json +12 -4
  269. package/src/actions/actions.test.ts +24 -0
  270. package/src/actions/grafana.ts +40 -0
  271. package/src/actions/index.ts +1 -0
  272. package/src/alerting-build.ts +376 -0
  273. package/src/alerting.e2e.test.ts +212 -0
  274. package/src/alerting.test.ts +272 -0
  275. package/src/alerting.ts +435 -0
  276. package/src/api/apply.test.ts +238 -0
  277. package/src/api/apply.ts +384 -0
  278. package/src/api/bind.ts +58 -0
  279. package/src/api/client.ts +148 -0
  280. package/src/api/converge.ts +63 -0
  281. package/src/api/dashboards.ts +247 -0
  282. package/src/api/datasources.ts +33 -0
  283. package/src/api/fake-grafana-writes.ts +201 -0
  284. package/src/api/fake-grafana.ts +186 -0
  285. package/src/api/folders.ts +265 -0
  286. package/src/api/library-panels.ts +101 -0
  287. package/src/build.test.ts +210 -5
  288. package/src/build.ts +180 -43
  289. package/src/catalog.ts +86 -2
  290. package/src/codegen/docs.ts +42 -9
  291. package/src/codegen/schema-types.ts +16 -6
  292. package/src/composites/agent-dashboard.ts +6 -3
  293. package/src/composites/catalog.test.ts +2 -2
  294. package/src/composites/catalog.ts +82 -0
  295. package/src/composites/composites.test.ts +73 -9
  296. package/src/composites/index.ts +4 -2
  297. package/src/composites/queries.e2e.test.ts +374 -0
  298. package/src/composites/red-dashboard.ts +83 -12
  299. package/src/composites/shared.ts +11 -0
  300. package/src/composites/slo-alert-rules.ts +149 -0
  301. package/src/config.test.ts +61 -0
  302. package/src/config.ts +138 -0
  303. package/src/contact-point-secrets.ts +63 -0
  304. package/src/dashboard.ts +16 -2
  305. package/src/datasource-refs.test.ts +56 -0
  306. package/src/datasource-refs.ts +189 -0
  307. package/src/datasource.ts +52 -0
  308. package/src/deep-observe-hooks.ts +252 -0
  309. package/src/deep-observe.test.ts +265 -0
  310. package/src/deep-observe.ts +164 -0
  311. package/src/describe-resources.test.ts +255 -0
  312. package/src/describe-resources.ts +209 -0
  313. package/src/detect.ts +79 -2
  314. package/src/export-resources.test.ts +129 -0
  315. package/src/export-resources.ts +84 -0
  316. package/src/generated/lexicon-grafana.json +135 -0
  317. package/src/import/alerting-roundtrip.test.ts +161 -0
  318. package/src/import/alerting.ts +500 -0
  319. package/src/import/edits.ts +95 -0
  320. package/src/import/embedded.test.ts +45 -0
  321. package/src/import/embedded.ts +47 -0
  322. package/src/import/generated-types.e2e.test.ts +118 -0
  323. package/src/import/generator.test.ts +210 -0
  324. package/src/import/generator.ts +462 -0
  325. package/src/import/live-export.ts +264 -0
  326. package/src/import/mappings.ts +264 -0
  327. package/src/import/model.ts +110 -0
  328. package/src/import/normalize-alerting.ts +101 -0
  329. package/src/import/normalize.test.ts +117 -0
  330. package/src/import/normalize.ts +364 -0
  331. package/src/import/parser.test.ts +440 -0
  332. package/src/import/parser.ts +1236 -0
  333. package/src/import/report.ts +62 -0
  334. package/src/import/roundtrip.test.ts +468 -0
  335. package/src/import/testdata/fixtures.ts +129 -0
  336. package/src/import/v2.test.ts +292 -0
  337. package/src/import/v2.ts +803 -0
  338. package/src/import.e2e.test.ts +31 -84
  339. package/src/import.test.ts +9 -3
  340. package/src/index.ts +190 -5
  341. package/src/k8s.test.ts +98 -0
  342. package/src/k8s.ts +197 -0
  343. package/src/lint/audit-catalog.ts +60 -3
  344. package/src/lint/core-lint.test.ts +43 -0
  345. package/src/lint/post-synth/graf101.ts +3 -3
  346. package/src/lint/post-synth/graf102.ts +1 -1
  347. package/src/lint/post-synth/graf107.ts +1 -1
  348. package/src/lint/post-synth/graf108.ts +17 -0
  349. package/src/lint/post-synth/graf109.ts +17 -0
  350. package/src/lint/post-synth/graf111.ts +17 -0
  351. package/src/lint/post-synth/graf112.ts +17 -0
  352. package/src/lint/post-synth/graf113.ts +17 -0
  353. package/src/lint/post-synth/graf114.ts +17 -0
  354. package/src/lint/post-synth/graf115.ts +17 -0
  355. package/src/lint/post-synth/grafana-helpers.ts +15 -8
  356. package/src/lint/post-synth/index.ts +14 -0
  357. package/src/lint/post-synth/post-synth.test.ts +235 -11
  358. package/src/lint/rules/literal-secret.ts +60 -6
  359. package/src/lint/rules/rules.test.ts +27 -0
  360. package/src/lsp/completions.test.ts +5 -0
  361. package/src/lsp/hover.test.ts +7 -0
  362. package/src/lsp/hover.ts +8 -1
  363. package/src/members.ts +68 -0
  364. package/src/observe.e2e.test.ts +255 -0
  365. package/src/op/activities/grafana-apply.e2e.test.ts +175 -0
  366. package/src/op/activities/grafana-apply.test.ts +229 -0
  367. package/src/op/activities/grafana-apply.ts +171 -0
  368. package/src/op/activities/index.ts +8 -0
  369. package/src/op/builders.test.ts +40 -0
  370. package/src/op/builders.ts +34 -0
  371. package/src/ownership.ts +103 -0
  372. package/src/panel-options.ts +66 -0
  373. package/src/panels.test.ts +51 -0
  374. package/src/panels.ts +148 -10
  375. package/src/pin.ts +57 -6
  376. package/src/plugin.test.ts +5 -2
  377. package/src/plugin.ts +66 -0
  378. package/src/promql-check.test.ts +108 -0
  379. package/src/promql-check.ts +189 -0
  380. package/src/query.ts +13 -8
  381. package/src/schema/barchart.gen.ts +221 -0
  382. package/src/schema/bargauge.gen.ts +111 -0
  383. package/src/schema/canvas.gen.ts +176 -0
  384. package/src/schema/dashboard.gen.ts +206 -22
  385. package/src/schema/expr.gen.ts +618 -0
  386. package/src/schema/gauge.gen.ts +2 -1
  387. package/src/schema/geomap.gen.ts +112 -0
  388. package/src/schema/heatmap.gen.ts +2 -1
  389. package/src/schema/histogram.gen.ts +151 -0
  390. package/src/schema/index.ts +12 -0
  391. package/src/schema/logs.gen.ts +3 -1
  392. package/src/schema/loki.gen.ts +2 -1
  393. package/src/schema/nodegraph.gen.ts +58 -0
  394. package/src/schema/piechart.gen.ts +146 -0
  395. package/src/schema/prometheus.gen.ts +2 -1
  396. package/src/schema/stat.gen.ts +2 -1
  397. package/src/schema/statetimeline.gen.ts +143 -0
  398. package/src/schema/statushistory.gen.ts +132 -0
  399. package/src/schema/table.gen.ts +27 -4
  400. package/src/schema/tempo.gen.ts +2 -1
  401. package/src/schema/text.gen.ts +2 -1
  402. package/src/schema/timeseries.gen.ts +7 -2
  403. package/src/schema/trend.gen.ts +208 -0
  404. package/src/schema/xychart.gen.ts +167 -0
  405. package/src/schema-overlay.test.ts +282 -0
  406. package/src/schema-validate.ts +141 -50
  407. package/src/schema.test.ts +4 -2
  408. package/src/serializer.test.ts +13 -1
  409. package/src/serializer.ts +11 -3
  410. package/src/skill-defs.ts +17 -0
  411. package/src/skills/chant-grafana-alerting.md +49 -0
  412. package/src/skills/chant-grafana-provisioning.md +3 -3
  413. package/src/skills/chant-grafana.md +12 -6
  414. package/src/spec/fetch-cli.ts +3 -3
  415. package/src/spec/fetch-units-cli.ts +37 -0
  416. package/src/spec/overlay/canvas.overlay.json +142 -0
  417. package/src/spec/overlay/dashboard.overlay.json +378 -0
  418. package/src/spec/overlay/expr.overlay.json +14 -0
  419. package/src/spec/overlay/geomap.overlay.json +35 -0
  420. package/src/spec/overlay/logs.overlay.json +14 -0
  421. package/src/spec/overlay/nodegraph.overlay.json +31 -0
  422. package/src/spec/overlay/piechart.overlay.json +17 -0
  423. package/src/spec/overlay/table.overlay.json +84 -0
  424. package/src/spec/overlay/timeseries.overlay.json +21 -0
  425. package/src/spec/overlay/trend.overlay.json +17 -0
  426. package/src/spec/overlay/xychart.overlay.json +16 -0
  427. package/src/spec/overlay.ts +105 -0
  428. package/src/spec/schemas/barchart.jsonschema.json +419 -0
  429. package/src/spec/schemas/bargauge.jsonschema.json +224 -0
  430. package/src/spec/schemas/canvas.jsonschema.json +356 -0
  431. package/src/spec/schemas/dashboardv2.jsonschema.json +3387 -0
  432. package/src/spec/schemas/expr.jsonschema.json +987 -0
  433. package/src/spec/schemas/geomap.jsonschema.json +220 -0
  434. package/src/spec/schemas/histogram.jsonschema.json +308 -0
  435. package/src/spec/schemas/nodegraph.jsonschema.json +77 -0
  436. package/src/spec/schemas/piechart.jsonschema.json +275 -0
  437. package/src/spec/schemas/statetimeline.jsonschema.json +324 -0
  438. package/src/spec/schemas/statushistory.jsonschema.json +292 -0
  439. package/src/spec/schemas/trend.jsonschema.json +449 -0
  440. package/src/spec/schemas/xychart.jsonschema.json +428 -0
  441. package/src/spec/schemas.ts +22 -10
  442. package/src/spec/units.gen.ts +281 -0
  443. package/src/spec/units.ts +77 -0
  444. package/src/transformations.test.ts +65 -0
  445. package/src/transformations.ts +574 -0
  446. package/src/util.ts +8 -0
  447. package/src/validate-alerting.test.ts +255 -0
  448. package/src/validate-alerting.ts +428 -0
  449. package/src/validate-output.ts +332 -101
  450. package/src/validate.ts +14 -0
  451. package/src/variables.ts +7 -2
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Folders, for the API applier (#2948). Every folder decision the applier
3
+ * makes is in this module: which folders a build needs, the uid each gets,
4
+ * how one is read, written, listed and deleted, and on which API.
5
+ *
6
+ * ## What the lexicon models today
7
+ *
8
+ * A dashboard names its folder by title (`Dashboard.folder`), and a title
9
+ * holds no nesting (the build flattens `/` in it). So the applier derives
10
+ * one root-level folder per distinct title, with a stable uid made from the
11
+ * title ({@link folderUidFor}), and a second apply finds it again by that
12
+ * uid. {@link FolderPlan} already carries `parentUid`, and the writers
13
+ * already send it, so #2953 (folder uid and nesting on the declaration) only
14
+ * has to change {@link foldersForDashboards}.
15
+ *
16
+ * ## Which API
17
+ *
18
+ * Grafana 12.4 serves `folder.grafana.app/v1beta1` and 13.x also serves
19
+ * `v1`, both keeping `metadata.labels` as written (checked against 12.4.11
20
+ * and 13.2.2), so a folder carries chant's ownership labels the same way a
21
+ * dashboard does. The parent is the `grafana.app/folder` annotation, as on a
22
+ * dashboard. A server without the group (Grafana 11) is written over
23
+ * `/api/folders`, which has `parentUid` but no labels: a folder written
24
+ * there cannot be told apart from anyone else's, so it is never pruned.
25
+ */
26
+ import { type GrafanaClient } from "./client.js";
27
+ export declare const FOLDER_GROUP = "folder.grafana.app";
28
+ /** Folder API versions chant writes, newest first. */
29
+ export declare const FOLDER_VERSIONS: readonly string[];
30
+ /** The annotation that names a folder's (or a dashboard's) parent folder on `/apis`. */
31
+ export declare const FOLDER_ANNOTATION = "grafana.app/folder";
32
+ /** How this server serves folders. */
33
+ export type FolderApi = {
34
+ readonly kind: "apis";
35
+ readonly version: string;
36
+ } | {
37
+ readonly kind: "legacy";
38
+ };
39
+ /** One folder a build needs. */
40
+ export interface FolderPlan {
41
+ readonly uid: string;
42
+ readonly title: string;
43
+ /** The parent folder's uid; absent for a root-level folder. */
44
+ readonly parentUid?: string;
45
+ }
46
+ /** A folder as Grafana holds it. */
47
+ export interface LiveFolder {
48
+ readonly uid: string;
49
+ readonly title: string;
50
+ readonly parentUid?: string;
51
+ /** `metadata.labels`; empty on the legacy API. */
52
+ readonly labels: Readonly<Record<string, string>>;
53
+ readonly via: "apis" | "legacy";
54
+ /** The request path it lives at. */
55
+ readonly address: string;
56
+ /** The legacy folder's `version`, which its update needs. */
57
+ readonly version?: number;
58
+ }
59
+ /**
60
+ * The uid chant gives the folder a dashboard names by title. Stable, so a
61
+ * second apply finds the folder the first one made; Grafana's own limit is
62
+ * 40 characters, which `slugUid` keeps to.
63
+ */
64
+ export declare function folderUidFor(title: string): string;
65
+ /**
66
+ * The folders a set of dashboards needs, one per distinct title, sorted by
67
+ * uid. The one place a dashboard's folder becomes a folder plan.
68
+ */
69
+ export declare function foldersForDashboards(dashboards: Iterable<{
70
+ folder?: string;
71
+ }>): FolderPlan[];
72
+ /** The folder API the server behind `client` serves, discovered once per client. */
73
+ export declare function folderApi(client: GrafanaClient): Promise<FolderApi>;
74
+ /** The request path for one folder on this API. */
75
+ export declare function folderPath(api: FolderApi, namespace: string, uid: string): string;
76
+ /** Read one folder; undefined when there is none with that uid. */
77
+ export declare function readFolder(client: GrafanaClient, uid: string): Promise<LiveFolder | undefined>;
78
+ /** Every folder in the organisation over `/apis`, paged. The legacy API has no labels to list by, so it is not listed. */
79
+ export declare function listFolders(client: GrafanaClient): Promise<LiveFolder[]>;
80
+ /** Send one write; throws {@link GrafanaApiError} on anything but a 2xx. */
81
+ export declare function send(client: GrafanaClient, method: string, path: string, body?: unknown): Promise<unknown>;
82
+ /**
83
+ * Create or update one folder so it matches `plan`, with chant's `labels`
84
+ * on it where the API keeps labels. Unchanged when title, parent and labels
85
+ * already match; nothing is written then.
86
+ */
87
+ export declare function ensureFolder(client: GrafanaClient, plan: FolderPlan, labels: Readonly<Record<string, string>>): Promise<{
88
+ action: "created" | "updated" | "unchanged";
89
+ address: string;
90
+ via: "apis" | "legacy";
91
+ }>;
92
+ /**
93
+ * How many things a folder holds (dashboards, folders, library panels, alert
94
+ * rules), from `GET /api/folders/<uid>/counts`. Grafana 12.4 and 13.2 name
95
+ * the keys differently, so every numeric value is summed.
96
+ */
97
+ export declare function folderContentCount(client: GrafanaClient, uid: string): Promise<number>;
98
+ /**
99
+ * Delete one folder over `/apis`. Only ever called for a folder that holds
100
+ * nothing: Grafana 12.4 and 13.2 refuse to delete a folder with anything in
101
+ * it over `/apis`, and the applier checks first, so a foreign dashboard in a
102
+ * folder chant made is never removed with it. False when it was already gone.
103
+ */
104
+ export declare function deleteFolder(client: GrafanaClient, folder: LiveFolder): Promise<boolean>;
105
+ /**
106
+ * Order folders so a child comes before its parent: the order to delete
107
+ * them in. Parents outside the set count as depth 0.
108
+ */
109
+ export declare function childrenFirst(folders: readonly LiveFolder[]): LiveFolder[];
110
+ //# sourceMappingURL=folders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folders.d.ts","sourceRoot":"","sources":["../../src/api/folders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAc/D,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAEjD,sDAAsD;AACtD,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAsB,CAAC;AAEpE,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,sCAAsC;AACtC,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;I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nE,wBAAsB,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAMpG;AAED,0HAA0H;AAC1H,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAkB9E;AAED,4EAA4E;AAC5E,wBAAsB,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAIhH;AAMD;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACvC,OAAO,CAAC;IAAE,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAC,CA6BnG;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI5F;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAM9F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE,CAS1E"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Library panels, for the API applier (#2948).
3
+ *
4
+ * A dashboard that uses a library panel holds only a reference to it
5
+ * (`{ libraryPanel: { uid, name } }`); the panel itself lives in Grafana's
6
+ * library, and an exported dashboard carries its model in `__elements`,
7
+ * keyed by uid. The applier writes each element to the library over
8
+ * `/api/library-elements` before the dashboards that reference it, and
9
+ * sends the dashboards without `__elements`, `__inputs` or `__requires`,
10
+ * which are export-only keys Grafana does not store.
11
+ *
12
+ * The library elements API is the same on Grafana 11, 12.4 and 13.2. It has
13
+ * no labels, so a library panel cannot carry chant's marker and is never
14
+ * pruned (the applier reports that as `not-prunable`). An update needs the
15
+ * element's current `version`, which the read supplies.
16
+ */
17
+ import type { GrafanaClient } from "./client.js";
18
+ type Json = Record<string, unknown>;
19
+ /** `kind` of a library panel in the library elements API (2 is a library variable). */
20
+ export declare const LIBRARY_PANEL_KIND = 1;
21
+ /** Keys an exported dashboard carries that Grafana does not store. */
22
+ export declare const EXPORT_ONLY_KEYS: readonly string[];
23
+ /** One library panel a build needs. */
24
+ export interface LibraryPanelPlan {
25
+ readonly uid: string;
26
+ readonly name: string;
27
+ readonly model: Json;
28
+ /** The folder it goes in: that of the first dashboard that carries it. Absent for the General folder. */
29
+ readonly folderUid?: string;
30
+ }
31
+ /**
32
+ * The library panels in a dashboard's `__elements`. An element that is not a
33
+ * panel (a library variable), or that has no uid, name or model, is not
34
+ * something the library panel API can take; it is returned in `skipped`.
35
+ */
36
+ export declare function libraryPanelsOf(dashboard: Json, folderUid?: string): {
37
+ panels: LibraryPanelPlan[];
38
+ skipped: string[];
39
+ };
40
+ /** A dashboard without the export-only keys, as the applier sends it. */
41
+ export declare function withoutExportKeys(dashboard: Json): Json;
42
+ export declare function libraryPanelPath(uid: string): string;
43
+ /**
44
+ * Create or update one library panel. Unchanged when its name, folder and
45
+ * model already match; nothing is written then.
46
+ */
47
+ export declare function ensureLibraryPanel(client: GrafanaClient, plan: LibraryPanelPlan): Promise<{
48
+ action: "created" | "updated" | "unchanged";
49
+ address: string;
50
+ }>;
51
+ export {};
52
+ //# sourceMappingURL=library-panels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library-panels.d.ts","sourceRoot":"","sources":["../../src/api/library-panels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAMpC,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAA6C,CAAC;AAE5F,uCAAuC;AACvC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,yGAAyG;IACzG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAmBtH;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,CAIvD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC;IAAE,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAc3E"}
package/dist/build.d.ts CHANGED
@@ -8,12 +8,13 @@
8
8
  * `buildGrafana()`.
9
9
  */
10
10
  import type { Declarable } from "@intentius/chant/declarable";
11
- import { type DatasourceEntity } from "./datasource.js";
11
+ import { type DatasourceEntity, type ExternalDatasourceEntity } from "./datasource.js";
12
12
  import { type DashboardEntity, type DashboardProviderProps } from "./dashboard.js";
13
13
  import { type PanelEntity, type RowEntity } from "./panels.js";
14
14
  import { type QueryEntity, type DatasourceInput } from "./query.js";
15
15
  import { type VariableEntity } from "./variables.js";
16
16
  import type { Dashboard as DashboardJson, DataSourceRef, Panel as PanelJson, RowPanel as RowPanelJson, VariableModel } from "./schema/dashboard.gen.js";
17
+ import { type AlertingFile, type AlertingIndex } from "./alerting-build.js";
17
18
  export type { DashboardJson, PanelJson, RowPanelJson, VariableModel, DataSourceRef };
18
19
  /** Grafana's grid is 24 columns wide. */
19
20
  export declare const GRID_COLUMNS = 24;
@@ -66,7 +67,11 @@ export interface BuiltDashboard {
66
67
  export interface BuiltGrafana {
67
68
  dashboards: BuiltDashboard[];
68
69
  datasources: ProvisionedDatasource[];
70
+ /** `ExternalDatasource` declarations: the checks count them, the provisioning file leaves them out. */
71
+ externalDatasources: ExternalDatasourceRecord[];
69
72
  providers: ProvisionedProvider[];
73
+ /** The alerting provisioning file, when the build declares any alerting. */
74
+ alerting?: AlertingFile;
70
75
  /** Every output file by path, ready to write. */
71
76
  files: Record<string, string>;
72
77
  /** A short summary of what was built: the serializer's primary output. */
@@ -85,10 +90,31 @@ export interface GrafanaIndex {
85
90
  type: string;
86
91
  uid: string;
87
92
  }>;
93
+ /** Datasources declared with `ExternalDatasource`: referenced, never provisioned. */
94
+ externalDatasources?: ExternalDatasourceRecord[];
95
+ /** Rule groups, contact points, policies, mute timings and templates, when the build declares any. */
96
+ alerting?: AlertingIndex;
88
97
  files: string[];
89
98
  }
90
- /** The `{ type, uid }` Grafana stores for a datasource, a datasource variable, or a ref. */
99
+ /** An `ExternalDatasource` as the checks and the index see it. */
100
+ export interface ExternalDatasourceRecord {
101
+ type: string;
102
+ uid: string;
103
+ name?: string;
104
+ }
105
+ /** The `{ type, uid }` Grafana stores for a datasource (declared or external), a datasource variable, or a ref. */
91
106
  export declare function datasourceRef(input: DatasourceInput | undefined): DataSourceRef | undefined;
107
+ /**
108
+ * The options Grafana makes of a custom variable's `query`: split on commas
109
+ * not escaped as `\\,`, and `text : value` (spaces around the colon) read as
110
+ * an option showing `text` that sets `value`. The same parse as Grafana's
111
+ * custom variable (public/app/features/variables/custom/reducer.ts, and
112
+ * CustomVariable in @grafana/scenes).
113
+ */
114
+ export declare function customVariableOptions(query: string): Array<{
115
+ text: string;
116
+ value: string;
117
+ }>;
92
118
  /** One variable as Grafana's `templating.list` entry. */
93
119
  export declare function variableModel(variable: VariableEntity): VariableModel;
94
120
  /** One query as a panel target. */
@@ -103,6 +129,8 @@ export declare function renderDashboard(dashboard: DashboardEntity, exportName?:
103
129
  export declare function dashboardJson(dashboard: DashboardEntity, exportName?: string): string;
104
130
  /** One datasource as a provisioning entry. */
105
131
  export declare function provisionedDatasource(ds: DatasourceEntity): ProvisionedDatasource;
132
+ /** One `ExternalDatasource` as the checks and the index see it. */
133
+ export declare function externalDatasourceRecord(ds: ExternalDatasourceEntity): ExternalDatasourceRecord;
106
134
  /** One dashboard provider as a provisioning entry. */
107
135
  export declare function provisionedProvider(p: DashboardProviderProps): ProvisionedProvider;
108
136
  /** The datasource provisioning file for these datasources. */
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAsB,KAAK,gBAAgB,EAAsB,MAAM,cAAc,CAAC;AAC7F,OAAO,EAIL,KAAK,eAAe,EAEpB,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAA8B,KAAK,WAAW,EAAE,KAAK,SAAS,EAAkB,MAAM,UAAU,CAAC;AACxG,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAA0C,KAAK,cAAc,EAAqB,MAAM,aAAa,CAA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AAU,CAAC,GAAG,YAAY,CAoDnG;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE7G"}
package/dist/catalog.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * completions and hover, and the docs.
5
5
  */
6
6
  import type { LexiconEntry } from "@intentius/chant/lsp/lexicon-providers";
7
- export type CatalogKind = "dashboard" | "datasource" | "provider" | "panel" | "row" | "query" | "variable";
7
+ export type CatalogKind = "dashboard" | "datasource" | "provider" | "panel" | "row" | "query" | "variable" | "alerting" | "expression";
8
8
  export interface CatalogEntry {
9
9
  className: string;
10
10
  entityType: string;
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAO3E,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,CAAC;AAE3G,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,WAAW,CAAC;IAClB,wEAAwE;IACxE,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;IACpC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAqCD,eAAO,MAAM,eAAe,EAAE,YAAY,EAwCzC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAM9D"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAiB3E,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;AAEvI,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,WAAW,CAAC;IAClB,wEAAwE;IACxE,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;IACpC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AA8CD,eAAO,MAAM,eAAe,EAAE,YAAY,EAyGzC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAM9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsEH,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB9E"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuGH,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB9E"}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * JSON Schema (draft-07, the subset cog emits) to TypeScript declarations.
3
3
  *
4
- * Each vendored schema becomes one module under `src/schema/`: one exported
5
- * type per entry in `definitions`, with the schema's descriptions as doc
6
- * comments. `required` is kept, so the types say what the schema says; the
4
+ * Each vendored schema, with its correction overlay applied, becomes one
5
+ * module under `src/schema/`: one exported type per entry in `definitions`,
6
+ * with the schema's descriptions as doc comments. `required` is kept, so the types say what the schema says; the
7
7
  * entity props wrap panel options in `DeepPartial` where Grafana fills the
8
8
  * rest in on import.
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schema-types.d.ts","sourceRoot":"","sources":["../../src/codegen/schema-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,UAAU,IAAI;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClC,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAWD,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AA2DD,+CAA+C;AAC/C,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,EAAE,MAAM,SA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6CrD;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,sGAoHP,CAAC"}
1
+ {"version":3,"file":"agent-dashboard.d.ts","sourceRoot":"","sources":["../../src/composites/agent-dashboard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAE5G,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/D,OAAO,EAUL,KAAK,gBAAgB,EAEtB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,kIAAkI;IAClI,KAAK,EAAE,YAAY,GAAG;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE,CAAC;IAChD,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAAE,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC;AAEnE,yEAAyE;AACzE,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;AAiBtG,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,SAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CrD;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,sGAuHP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/composites/catalog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAyN5C,CAAC"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/composites/catalog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA2S5C,CAAC"}
@@ -2,11 +2,13 @@
2
2
  * Grafana lexicon composites: dashboards built from the declarations they
3
3
  * read, so renaming a metric at its source moves it in the panels.
4
4
  */
5
- export { RedDashboard, redQueries } from "./red-dashboard.js";
6
- export type { RedDashboardProps, RedDashboardMembers, RedDashboardInstance } from "./red-dashboard.js";
5
+ export { RedDashboard, redQueries, RED_DEFAULT_SPAN_KINDS } from "./red-dashboard.js";
6
+ export type { RedDashboardProps, RedDashboardMembers, RedDashboardInstance, SpanKind } from "./red-dashboard.js";
7
7
  export { SloDashboard, sloQueries } from "./slo-dashboard.js";
8
8
  export type { SloDashboardProps, SloDashboardMembers, SloDashboardInstance } from "./slo-dashboard.js";
9
9
  export { AgentDashboard, agentQueries } from "./agent-dashboard.js";
10
10
  export type { AgentDashboardProps, AgentDashboardMembers, AgentDashboardInstance } from "./agent-dashboard.js";
11
11
  export type { DashboardOptions } from "./shared.js";
12
+ export { SloAlertRules, sloAlertQueries } from "./slo-alert-rules.js";
13
+ export type { SloAlertRulesProps, SloAlertRulesMembers, SloAlertRulesInstance } from "./slo-alert-rules.js";
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composites/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC5G,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composites/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACnF,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC5G,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -6,6 +6,10 @@
6
6
  * lexicon's `spanMetricsNames()`: its namespace, its histogram unit, the
7
7
  * default dimensions it keeps, and optionally the `prometheus` exporter's
8
8
  * namespace. Renaming the connector's namespace moves every query here.
9
+ *
10
+ * The queries count server and consumer spans only by default, the spans
11
+ * that handle a request or a message, so a service's outgoing calls and
12
+ * its internal spans don't inflate its rate or dilute its error ratio.
9
13
  */
10
14
  import { type CompositeInstance } from "@intentius/chant/composite";
11
15
  import { type PrometheusNaming, type SpanMetricsNames } from "@intentius/chant-lexicon-otel/metric-names";
@@ -24,14 +28,29 @@ export interface RedDashboardProps extends DashboardOptions {
24
28
  exporter?: OTelComponent<"exporter", "prometheus", PrometheusExporterConfig> | PrometheusNaming;
25
29
  /** Duration quantiles, one panel each (default p50, p95 and p99). */
26
30
  quantiles?: number[];
31
+ /**
32
+ * The span kinds the queries count (default server and consumer spans).
33
+ * `[]` counts every kind. With the default, a connector that excludes
34
+ * `span.kind` gets no kind filter; naming kinds for such a connector is
35
+ * an error.
36
+ */
37
+ spanKinds?: SpanKind[];
27
38
  }
39
+ /** The `span_kind` label values the spanmetrics connector writes. */
40
+ export type SpanKind = "SPAN_KIND_UNSPECIFIED" | "SPAN_KIND_INTERNAL" | "SPAN_KIND_SERVER" | "SPAN_KIND_CLIENT" | "SPAN_KIND_PRODUCER" | "SPAN_KIND_CONSUMER";
41
+ /** The kinds `RedDashboard` counts unless told otherwise: the spans that serve a request or consume a message. */
42
+ export declare const RED_DEFAULT_SPAN_KINDS: readonly SpanKind[];
28
43
  export type RedDashboardMembers = {
29
44
  dashboard: DashboardEntity;
30
45
  };
31
46
  /** What `RedDashboard(...)` returns: its dashboard, as `dashboard`. */
32
47
  export type RedDashboardInstance = CompositeInstance<RedDashboardMembers> & RedDashboardMembers;
33
- /** The PromQL the RED dashboard runs, from the connector's names. Exposed for tests and for panels of your own. */
34
- export declare function redQueries(names: SpanMetricsNames, quantiles?: number[], serviceFilter?: string): {
48
+ /**
49
+ * The PromQL the RED dashboard runs, from the connector's names. Exposed for
50
+ * tests and for panels of your own. `spanKinds` defaults to server and
51
+ * consumer spans; `[]` counts every kind.
52
+ */
53
+ export declare function redQueries(names: SpanMetricsNames, quantiles?: number[], serviceFilter?: string, spanKinds?: readonly SpanKind[]): {
35
54
  rate: string;
36
55
  errorRatio: string;
37
56
  duration: {
@@ -1 +1 @@
1
- {"version":3,"file":"red-dashboard.d.ts","sourceRoot":"","sources":["../../src/composites/red-dashboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;GA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AgB,EACvB,SAAS,GAAE,MAAM,EAAsB,EACvC,aAAa,SAAa,EAC1B,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE;;;;;;;;EAiBhC;AAUD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,kGAuEP,CAAC"}
@@ -31,6 +31,13 @@ export type Matcher = [label: string, op: "=" | "!=" | "=~" | "!~", value: strin
31
31
  export declare function selector(metric: string, matchers: Matcher[]): string;
32
32
  /** `sum by (labels) (rate(sel[range]))`, or `sum (...)` with no labels. */
33
33
  export declare function sumRate(sel: string, by: string[], range?: string): string;
34
+ /**
35
+ * `errors / all` as rates summed by `by`, with the numerator padded to zero:
36
+ * `(errors or all * 0) / all`. A group with calls but no error series gets
37
+ * 0 instead of dropping out of the result, so a panel shows 0% rather than
38
+ * "No data" for a service that has had no errors.
39
+ */
40
+ export declare function errorRatio(errorSel: string, allSel: string, by: string[]): string;
34
41
  /** `histogram_quantile(q, sum by (le, labels) (rate(bucket[range])))`. */
35
42
  export declare function quantile(q: number, bucketSel: string, by: string[]): string;
36
43
  /** A number as PromQL and Grafana thresholds write it, without float noise. */
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/composites/shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,yIAAyI;IACzI,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,E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AE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;;;;;;cA9DhH,MAAM;YAAM,MAAM;;EA0ElC;AAED,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,CAMtE"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * `SloAlertRules`: an `Slo`'s multiwindow, multi-burn-rate alerts as
3
+ * Grafana-managed alert rules, for teams that page from Grafana rather
4
+ * than from Prometheus and Alertmanager.
5
+ *
6
+ * The windows, factors, thresholds and labels come from the prometheus
7
+ * lexicon's `sloMetrics()`, the same numbers the `Slo`'s own Prometheus
8
+ * alerts use. Each burn-rate pair becomes one rule that reads the two
9
+ * error ratios the `Slo` records (`slo:sli_error:ratio_rate<window>`) as
10
+ * instant Prometheus queries, and a math expression that holds while both
11
+ * are above the pair's threshold:
12
+ *
13
+ * A = slo:sli_error:ratio_rate1h{slo="checkout"}
14
+ * B = slo:sli_error:ratio_rate5m{slo="checkout"}
15
+ * C = $A > 0.0144 && $B > 0.0144 (condition)
16
+ *
17
+ * So the `Slo`'s rule group must be loaded into the Prometheus the rules
18
+ * query: the recording rules are what make a 3-day window cheap to
19
+ * evaluate every minute.
20
+ */
21
+ import { type CompositeInstance } from "@intentius/chant/composite";
22
+ import { type SloInstance, type SloMetrics } from "@intentius/chant-lexicon-prometheus/composites/slo";
23
+ import type { RuleGroupEntity } from "@intentius/chant-lexicon-prometheus/rules";
24
+ import { type AlertRuleGroupEntity, type ContactPointEntity, type ExecErrState, type NoDataState } from "../alerting.js";
25
+ import { type DatasourceInput } from "../query.js";
26
+ export interface SloAlertRulesProps {
27
+ /** The `Slo(...)` the rules alert on, its rule group, or what `sloMetrics()` returned for it. It must have alerting on. */
28
+ slo: SloInstance | RuleGroupEntity | SloMetrics;
29
+ /** The Prometheus holding the `Slo`'s recorded series: a declared `Datasource`, an `ExternalDatasource`, or `{ type: "prometheus", uid }`. */
30
+ datasource: DatasourceInput<"prometheus">;
31
+ /** The Grafana folder the rules are stored in, by title. */
32
+ folder: string;
33
+ /** The rule group's name. Defaults to the `Slo`'s group name, `slo-<name>`. */
34
+ group?: string;
35
+ /** How often the rules are evaluated, a multiple of 10s. Defaults to `1m`. */
36
+ interval?: string;
37
+ /**
38
+ * Send the alerts straight to this contact point. Left out, they go
39
+ * through the notification policy tree, which can route on the
40
+ * `severity` label (`page` or `ticket` by default).
41
+ */
42
+ contactPoint?: ContactPointEntity | string;
43
+ /** How long a pair must hold before its alert fires. Default: none; the short window already filters blips. */
44
+ for?: string;
45
+ /** More labels on every rule, e.g. `team`. */
46
+ labels?: Record<string, string>;
47
+ /** More annotations on every rule, e.g. `runbook_url`. */
48
+ annotations?: Record<string, string>;
49
+ /** What no data does. Defaults to `OK`: no recorded ratio means no traffic, so no budget is burning. */
50
+ noDataState?: NoDataState;
51
+ /** What a query error does. Defaults to `Error`. */
52
+ execErrState?: ExecErrState;
53
+ }
54
+ export type SloAlertRulesMembers = {
55
+ /** One rule per burn-rate pair, page tier first. */
56
+ rules: AlertRuleGroupEntity;
57
+ };
58
+ /** What `SloAlertRules(...)` returns: its rule group, as `rules`. */
59
+ export type SloAlertRulesInstance = CompositeInstance<SloAlertRulesMembers> & SloAlertRulesMembers;
60
+ /** The queries and condition of each burn-rate rule, from `sloMetrics()`. Exposed for tests and for rules of your own. */
61
+ export declare function sloAlertQueries(m: SloMetrics): {
62
+ uid: string;
63
+ longExpr: string;
64
+ shortExpr: string;
65
+ condition: string;
66
+ tier: "page" | "ticket";
67
+ severity: string;
68
+ long: string;
69
+ short: string;
70
+ factor: number;
71
+ threshold: number;
72
+ longRecord: string;
73
+ shortRecord: string;
74
+ alert: string;
75
+ labels: import("lexicons/prometheus/src/model").LabelSet;
76
+ exhaustsIn: string;
77
+ }[];
78
+ /**
79
+ * Grafana-managed burn-rate alerts for an `Slo`: one rule per window pair,
80
+ * with the labels and annotations the `Slo`'s Prometheus alerts carry.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * import { Slo } from "@intentius/chant-lexicon-prometheus";
85
+ * import { SloAlertRules } from "@intentius/chant-lexicon-grafana";
86
+ *
87
+ * export const checkout = Slo({ name: "checkout", objective: 0.999, window: "30d", sli: { ... } });
88
+ * export const checkoutAlerts = SloAlertRules({ slo: checkout, datasource: prometheus, folder: "SLOs" });
89
+ * ```
90
+ */
91
+ export declare const SloAlertRules: import("@intentius/chant/composite").CompositeDefinition<SloAlertRulesProps, SloAlertRulesMembers>;
92
+ //# sourceMappingURL=slo-alert-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slo-alert-rules.d.ts","sourceRoot":"","sources":["../../src/composites/slo-alert-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,oDAAoD,CAAC;AACnH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAI3D,MAAM,WAAW,kBAAkB;IACjC,2HAA2H;IAC3H,GAAG,EAAE,WAAW,GAAG,eAAe,GAAG,UAAU,CAAC;IAChD,8IAA8I;IAC9I,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC1C,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,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