@intentius/chant-lexicon-grafana 0.97.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
+ * Dashboard JSON (and Grafana's provisioning files) -> `TemplateIR`, for
3
+ * `chant import`.
4
+ *
5
+ * A dashboard's parts refer to each other: panels name datasources and
6
+ * variables, rows hold panels, the dashboard lists them all. So the IR
7
+ * carries one resource per dashboard, of type `Grafana::Dashboard`, whose
8
+ * properties are a `Plan` (./model.ts): the declarations the dashboard
9
+ * becomes and the references between them. The generator lays the plan out
10
+ * in modules, and says so with `ownsLayout` (#2964), so core writes its
11
+ * files as they are.
12
+ *
13
+ * What each JSON key becomes is decided by the tables in ./mappings.ts.
14
+ * Whatever cannot be carried is named in `warnings` and recorded as an
15
+ * edit (./edits.ts) in the resource's metadata; a key left out at the value
16
+ * Grafana assumes anyway (./normalize.ts) is an edit with no warning.
17
+ *
18
+ * Accepted input:
19
+ *
20
+ * - classic dashboard JSON, as the UI exports it, with or without "Export
21
+ * for sharing externally" (`__inputs`, `__requires`, `__elements`);
22
+ * - the same wrapped in a `dashboard.grafana.app` v0/v1 resource (`spec`),
23
+ * or in the `{ dashboard, meta }` of `GET /api/dashboards/uid/<uid>`;
24
+ * - a v2 dashboard (`dashboard.grafana.app/v2` or `v2beta1`, or a bare v2
25
+ * spec), read into classic JSON by ./v2.ts, with a warning for each thing
26
+ * v2 says that the classic model cannot (#2947);
27
+ * - a datasource, dashboard or alerting provisioning file (./alerting.ts).
28
+ *
29
+ * A v0/v1 resource that Grafana stores as v2 (`status.conversion` says so)
30
+ * is refused unless the caller opts in (`acceptLossyV1`): it is a lossy
31
+ * down-conversion that looks like any other v1 dashboard. A dashboard saved
32
+ * before Grafana 5.0 (panels inside a top-level `rows` list) is recognised
33
+ * and reported, and nothing is imported from it.
34
+ *
35
+ * Deliberate changes, each with a warning:
36
+ *
37
+ * - An `__inputs` datasource (`${DS_PROMETHEUS}`) becomes a
38
+ * `DatasourceVariable` of the same name, so every `${DS_PROMETHEUS}` in
39
+ * the dashboard still resolves, now to whatever the variable selects.
40
+ * - An `__inputs` constant is replaced by its value, as Grafana's import
41
+ * dialog would.
42
+ * - The stored copy's `id`, `version` and `iteration` are Grafana's
43
+ * bookkeeping and are dropped without a warning.
44
+ */
45
+ import type { TemplateIR, TemplateParser } from "@intentius/chant/import/parser";
46
+ import { type ImportEdit } from "./edits.js";
47
+ import { type Plan } from "./model.js";
48
+ type Json = Record<string, unknown>;
49
+ /** The IR resource type for one dashboard. */
50
+ export declare const DASHBOARD_RESOURCE_TYPE = "Grafana::Dashboard";
51
+ /** The IR resource type for a datasource or dashboard provisioning file. */
52
+ export declare const PROVISIONING_RESOURCE_TYPE = "Grafana::Provisioning";
53
+ /** `properties` of a `Grafana::Dashboard` or `Grafana::Provisioning` resource. */
54
+ export interface PlanResourceProperties {
55
+ plan: Plan;
56
+ }
57
+ /** `metadata` of a `Grafana::Dashboard` resource. */
58
+ export interface DashboardResourceMetadata {
59
+ /** The dashboard JSON the plan was made from (unwrapped from a resource or API response). */
60
+ source: Json;
61
+ /** What the importer did to it: apply these to `source` to get what the rebuilt dashboard should equal. */
62
+ edits: ImportEdit[];
63
+ /** For a v2 dashboard, the v2 JSON as given; `source` is then its classic form (see ./v2.ts). */
64
+ v2?: Json;
65
+ }
66
+ /** Options for reading dashboard JSON. */
67
+ export interface GrafanaImportOptions {
68
+ /**
69
+ * Import a `dashboard.grafana.app` v0/v1 resource even when Grafana stores
70
+ * the dashboard as v2. That read has already lost what v1 cannot hold (tabs,
71
+ * auto grids, conditional rendering); prefer importing the v2 read. Off by
72
+ * default: such a resource is refused, with a warning saying why.
73
+ */
74
+ acceptLossyV1?: boolean;
75
+ }
76
+ /** `metadata` of an alerting provisioning file's resource. */
77
+ export interface AlertingResourceMetadata {
78
+ /** The file as parsed. */
79
+ source: Json;
80
+ /** What the importer did to it: apply these to `source`, then `normalizeAlerting` both sides, to compare with the rebuilt file. */
81
+ edits: ImportEdit[];
82
+ }
83
+ /** Plan one classic dashboard. */
84
+ export declare function planDashboard(dashboard: Json): {
85
+ plan: Plan;
86
+ edits: ImportEdit[];
87
+ warnings: string[];
88
+ };
89
+ /** Plan a datasource provisioning file: one `Datasource` per entry. */
90
+ export declare function planDatasourceProvisioning(doc: Json): {
91
+ plan: Plan;
92
+ warnings: string[];
93
+ };
94
+ /** Plan a dashboard provisioning file: one `DashboardProvider` per file provider. */
95
+ export declare function planDashboardProvisioning(doc: Json): {
96
+ plan: Plan;
97
+ warnings: string[];
98
+ };
99
+ /** The dashboard inside a resource or API response, and where it came from. */
100
+ export declare function unwrapDashboard(data: Json): Json;
101
+ /** Parse dashboard JSON or a provisioning file into IR. */
102
+ export declare function parseGrafana(content: string, options?: GrafanaImportOptions): TemplateIR;
103
+ /** The Grafana dashboard parser `chant import` runs. */
104
+ export declare class GrafanaParser implements TemplateParser {
105
+ private readonly options;
106
+ constructor(options?: GrafanaImportOptions);
107
+ parse(content: string): TemplateIR;
108
+ }
109
+ export {};
110
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAc,MAAM,gCAAgC,CAAC;AAe7F,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAiBnD,OAAO,EAAyF,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAe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,IAAI,CAShD;AA4BD,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,UAAU,CA4E5F;AAED,wDAAwD;AACxD,qBAAa,aAAc,YAAW,cAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,GAAE,oBAAyB;IAE/D,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;CAGnC"}
@@ -0,0 +1,26 @@
1
+ /** How the importers report what they could not carry: warnings, and the edits that make the source equal the rebuilt output. */
2
+ import type { ImportEdit } from "./edits.js";
3
+ /** `a`, `a and b`, `a, b and c`. */
4
+ export declare function list(keys: string[]): string;
5
+ /** Collects edits, and warnings grouped by what they are about. */
6
+ export declare class Report {
7
+ readonly edits: ImportEdit[];
8
+ private readonly headlines;
9
+ private readonly grouped;
10
+ /** A warning of its own. */
11
+ warn(message: string): void;
12
+ /** `key` of `subject`, at `path`, is not carried. No warning when `why` is undefined (it is at Grafana's default). */
13
+ drop(path: string, subject: string, key: string, why?: string): void;
14
+ /**
15
+ * The value at `path` is written as `value`. No warning when `why` is
16
+ * undefined (Grafana reads both the same); otherwise the warning reads
17
+ * `<subject>: <key> <why>`.
18
+ */
19
+ replace(path: string, value: unknown, subject: string, key: string, why?: string): void;
20
+ edit(edit: ImportEdit): void;
21
+ private note;
22
+ warnings(): string[];
23
+ }
24
+ /** The `why` of a key no prop takes. */
25
+ export declare const NO_PROP = "(no prop takes it)";
26
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/import/report.ts"],"names":[],"mappings":"AAAA,iIAAiI;AAEjI,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,oCAAoC;AACpC,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAE3C;AAED,mEAAmE;AACnE,qBAAa,MAAM;IACjB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,CAAM;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiG;IAEzH,4BAA4B;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,sHAAsH;IACtH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAKpE;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAKvF,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAI5B,OAAO,CAAC,IAAI;IAOZ,QAAQ,IAAI,MAAM,EAAE;CAWrB;AAED,wCAAwC;AACxC,eAAO,MAAM,OAAO,uBAAuB,CAAC"}
@@ -0,0 +1,35 @@
1
+ export declare const pkgDir: string;
2
+ export declare const repoRoot: string;
3
+ export declare const fixturesDir: string;
4
+ /** A fixture file's text, by path under test/fixtures. */
5
+ export declare const read: (...p: string[]) => string;
6
+ /** The classic UI exports (every export but the v1 and v2 resources), as paths under test/fixtures. */
7
+ export declare const UI_EXPORTS: readonly string[];
8
+ /** v2 dashboards (#2947): the checkout V2 Resource UI export, and the tabs dashboard as the v2 API reads it. */
9
+ export declare const V2_EXPORTS: readonly string[];
10
+ /** The tabs dashboard read at dashboard.grafana.app/v1: Grafana's lossy down-conversion of a dashboard it stores as v2. */
11
+ export declare const LOSSY_V1_EXPORT = "exports/grafana-13.2.2/tabs.v1-resource.json";
12
+ /** The grafana.com dashboards, as paths under test/fixtures. */
13
+ export declare const COMMUNITY: readonly string[];
14
+ /** kube-prometheus v0.19.0's dashboards, one file per dashboard, as paths under test/fixtures. */
15
+ export declare const KUBE_PROMETHEUS: readonly string[];
16
+ /**
17
+ * The alerting provisioning corpus (test/fixtures/alerting/, provenance and
18
+ * licenses in its README): Grafana 12.4.11 and 13.2.2 exports, and files
19
+ * from projects that provision Grafana alerting from files.
20
+ */
21
+ export declare const ALERTING: readonly string[];
22
+ /** Every file each example builds, keyed `<example>/<path>`. */
23
+ export declare function exampleOutputs(): Promise<Array<[string, string]>>;
24
+ /** A chant project directory inside the package, so the lexicon resolves as it does for a user. */
25
+ export declare function projectDir(): string;
26
+ /** Write generated files under `dir`, creating their directories. */
27
+ export declare function writeFiles(dir: string, files: ReadonlyArray<{
28
+ path: string;
29
+ content: string;
30
+ }>): string[];
31
+ /** Remove a directory made by `projectDir`. */
32
+ export declare function removeDir(dir: string): void;
33
+ /** Every `.ts` file under a directory, recursively. */
34
+ export declare function tsFiles(dir: string): string[];
35
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/import/testdata/fixtures.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,MAAM,QAA2C,CAAC;AAC/D,eAAO,MAAM,QAAQ,QAA2B,CAAC;AACjD,eAAO,MAAM,WAAW,QAAmC,CAAC;AAE5D,0DAA0D;AAC1D,eAAO,MAAM,IAAI,GAAI,GAAG,GAAG,MAAM,EAAE,KAAG,MAAwD,CAAC;AAE/F,uGAAuG;AACvG,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAKvC,CAAC;AAEF,gHAAgH;AAChH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAyG,CAAC;AAElJ,2HAA2H;AAC3H,eAAO,MAAM,eAAe,iDAAiD,CAAC;AAE9E,gEAAgE;AAChE,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAQtC,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAGR,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAKrC,CAAC;AASF,gEAAgE;AAChE,wBAAsB,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAWvE;AAED,mGAAmG;AACnG,wBAAgB,UAAU,IAAI,MAAM,CAMnC;AAED,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,EAAE,CASzG;AAED,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,uDAAuD;AACvD,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ7C"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Read a v2 dashboard (`dashboard.grafana.app/v2` or `v2beta1`, Grafana 13's
3
+ * default "V2 Resource" export) as the classic (v1) dashboard JSON chant
4
+ * builds, for `chant import` (#2947).
5
+ *
6
+ * The conversion follows Grafana's own v2 -> v1 conversion at v13.2.2
7
+ * (`apps/dashboard/pkg/migration/conversion/v2alpha1_to_v1.go` and
8
+ * `v2_to_v1_layout_conversion.md`), so what comes out is what Grafana itself
9
+ * serves when the same dashboard is read at v1: tabs become expanded rows,
10
+ * an auto grid gets the fixed positions Grafana computes, nested rows are
11
+ * flattened, and row ids follow the largest panel id.
12
+ *
13
+ * Grafana does that silently. Here, everything v2 can say that the classic
14
+ * model cannot is a warning: tabs, auto grids, nested rows, a hidden row
15
+ * header after the first row, conditional rendering, section variables,
16
+ * dashboard preferences, "show in controls menu", and any key the vendored
17
+ * `dashboardv2` schema (`src/spec/schemas/dashboardv2.jsonschema.json`) does
18
+ * not know. `V2_KEYS` names, per schema definition, which keys are carried
19
+ * and which are reported; `v2.test.ts` checks it against the schema, so a
20
+ * pin bump that adds a v2 key fails until the key is placed in one of them.
21
+ *
22
+ * What the classic model can hold but chant cannot yet (library panels,
23
+ * annotations, ad hoc, group by and switch variables) is written to the
24
+ * classic JSON as Grafana would and reported by the classic importer
25
+ * (`./parser.ts`), as for any classic dashboard.
26
+ *
27
+ * A classic read of a dashboard Grafana stores as v2 is the lossy direction:
28
+ * `storedAsV2` recognises it from the resource's
29
+ * `status.conversion.storedVersion`, and the parser refuses it unless the
30
+ * caller opts in.
31
+ */
32
+ type Json = Record<string, unknown>;
33
+ /**
34
+ * Per `dashboardv2` schema definition, the keys this module reads.
35
+ *
36
+ * - `carried`: written into the classic dashboard (or structural, like `kind`).
37
+ * - `reported`: v2-only, with the reason the warning gives when the key is
38
+ * set to anything but its default.
39
+ */
40
+ export declare const V2_KEYS: Readonly<Record<string, {
41
+ carried: readonly string[];
42
+ reported: Readonly<Record<string, string>>;
43
+ }>>;
44
+ /** What reading one v2 dashboard gave. */
45
+ export interface V2Read {
46
+ /** The classic dashboard JSON. */
47
+ dashboard: Json;
48
+ /** What v2 said that the classic dashboard does not. */
49
+ warnings: string[];
50
+ }
51
+ /**
52
+ * Read a v2 dashboard: a `dashboard.grafana.app/v2` or `v2beta1` resource,
53
+ * or a bare v2 spec. Throws for `v2alpha1`, whose panel queries have another
54
+ * shape; Grafana serves every stored dashboard at v2, so the fix is to read
55
+ * it there.
56
+ */
57
+ export declare function readV2Dashboard(data: Json): V2Read;
58
+ /**
59
+ * The version Grafana stores a dashboard at, when a `dashboard.grafana.app`
60
+ * resource read at v0 or v1 says it is stored as v2 (`status.conversion`):
61
+ * that read is a down-conversion that drops whatever v2 has and v1 does not
62
+ * (tabs, auto grids, conditional rendering), with nothing in the spec to show
63
+ * it. Also returns the stored version when the conversion failed. Undefined
64
+ * for everything else.
65
+ */
66
+ export declare function lossyV1Read(data: unknown): {
67
+ apiVersion: string;
68
+ storedVersion: string;
69
+ failed: boolean;
70
+ } | undefined;
71
+ export {};
72
+ //# sourceMappingURL=v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/import/v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC,CA8FxH,CAAC;AA2EF,0CAA0C;AAC1C,MAAM,WAAW,MAAM;IACrB,kCAAkC;IAClC,SAAS,EAAE,IAAI,CAAC;IAChB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AA8hBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAgBlD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CASrH"}
package/dist/index.d.ts CHANGED
@@ -1,17 +1,34 @@
1
1
  export { grafanaPlugin } from "./plugin.js";
2
2
  export { grafanaSerializer } from "./serializer.js";
3
- export { Datasource, DATASOURCE_TYPE, BUILTIN_DATASOURCE_UIDS, isDatasourceEntity, type DatasourceProps, type DatasourceEntity, type DatasourceConstructor, type DatasourceRef, type DatasourceAccess, type KnownDatasourceType, } from "./datasource.js";
3
+ export { Datasource, DATASOURCE_TYPE, ExternalDatasource, EXTERNAL_DATASOURCE_TYPE, BUILTIN_DATASOURCE_UIDS, isDatasourceEntity, isExternalDatasource, isDatasourceDeclaration, type ExternalDatasourceProps, type ExternalDatasourceEntity, type ExternalDatasourceConstructor, type DatasourceProps, type DatasourceEntity, type DatasourceConstructor, type DatasourceRef, type DatasourceAccess, type KnownDatasourceType, } from "./datasource.js";
4
4
  export { Dashboard, DashboardProvider, DASHBOARD_TYPE, DASHBOARD_PROVIDER_TYPE, DEFAULT_DASHBOARDS_PATH, isDashboardEntity, isDashboardProviderEntity, type DashboardProps, type DashboardEntity, type DashboardLinkInput, type DashboardProviderProps, type DashboardProviderEntity, } from "./dashboard.js";
5
- export { TimeSeriesPanel, StatPanel, GaugePanel, TablePanel, LogsPanel, TracesPanel, HeatmapPanel, TextPanel, Row, definePanel, registeredPanels, panelDefinitionFor, isPanelEntity, isRowEntity, PANEL_TYPE_PREFIX, ROW_TYPE, type PanelProps, type PanelFieldConfig, type PanelLink, type PanelDefinition, type PanelEntity, type PanelClass, type RowProps, type RowEntity, } from "./panels.js";
5
+ export { AlertRuleGroup, AlertRule, AlertQuery, ReduceExpression, MathExpression, ThresholdExpression, ResampleExpression, ClassicConditionsExpression, SqlExpression, ContactPoint, NotificationPolicy, MuteTiming, NotificationTemplate, ALERT_RULE_GROUP_TYPE, ALERT_RULE_TYPE, ALERT_QUERY_TYPE, EXPRESSION_TYPE_PREFIX, EXPRESSION_DATASOURCE_UID, CONTACT_POINT_TYPE, NOTIFICATION_POLICY_TYPE, MUTE_TIMING_TYPE, NOTIFICATION_TEMPLATE_TYPE, isAlertRuleGroupEntity, isAlertRuleEntity, isAlertQueryEntity, isExpressionEntity, isContactPointEntity, isNotificationPolicyEntity, isMuteTimingEntity, isNotificationTemplateEntity, type AlertRuleGroupProps, type AlertRuleGroupEntity, type AlertRuleProps, type AlertRuleEntity, type AlertRuleData, type AlertRuleNotificationSettings, type AlertRuleRecord, type AlertQueryProps, type AlertQueryEntity, type AlertDuration, type RelativeTimeRange, type ExpressionEntity, type ExpressionKind, type ReduceExpressionProps, type MathExpressionProps, type ThresholdExpressionProps, type ResampleExpressionProps, type ClassicConditionsExpressionProps, type SqlExpressionProps, type NoDataState, type ExecErrState, type ContactPointProps, type ContactPointEntity, type ContactPointReceiver, type ContactPointIntegrationType, type NotificationPolicyProps, type NotificationPolicyEntity, type PolicyRoute, type ObjectMatcher, type MuteTimingProps, type MuteTimingEntity, type NotificationTemplateProps, type NotificationTemplateEntity, } from "./alerting.js";
6
+ export { buildAlerting, alertingYaml, alertRuleJson, alertQueryJson, ruleGroupJson, contactPointJson, notificationPolicyJson, muteTimingJson, notificationTemplateJson, durationSeconds, ALERTING_FILE, ALERTING_FILE_KEYS, DEFAULT_RELATIVE_TIME_RANGE, DEFAULT_GROUP_INTERVAL, type AlertingFile, type AlertingIndex, type ProvisionedRuleGroup, type ProvisionedAlertRule, type ProvisionedAlertQuery, type ProvisionedContactPoint, type ProvisionedMuteTiming, type ProvisionedTemplate, } from "./alerting-build.js";
7
+ export { CONTACT_POINT_SECRET_SETTINGS } from "./contact-point-secrets.js";
8
+ export { TimeSeriesPanel, StatPanel, GaugePanel, TablePanel, LogsPanel, TracesPanel, HeatmapPanel, TextPanel, BarChartPanel, BarGaugePanel, PieChartPanel, StateTimelinePanel, StatusHistoryPanel, HistogramPanel, NodeGraphPanel, XYChartPanel, TrendPanel, CanvasPanel, GeomapPanel, FlameGraphPanel, AlertListPanel, Row, definePanel, registeredPanels, panelDefinitionFor, isPanelEntity, isRowEntity, PANEL_TYPE_PREFIX, ROW_TYPE, type PanelProps, type PanelFieldConfig, type PanelLink, type PanelDefinition, type PanelEntity, type PanelClass, type RowProps, type RowEntity, } from "./panels.js";
6
9
  export { PromQuery, TempoQuery, LokiQuery, defineQuery, registeredQueries, queryDefinitionFor, isQueryEntity, QUERY_TYPE_PREFIX, type DatasourceInput, type QueryModel, type QueryProps, type QueryDefinition, type QueryEntity, type QueryClass, type PromQueryEntity, type TempoQueryEntity, type LokiQueryEntity, } from "./query.js";
7
10
  export { QueryVariable, CustomVariable, IntervalVariable, DatasourceVariable, ConstantVariable, TextboxVariable, isVariableEntity, isDatasourceVariable, isBuiltinVariable, VARIABLE_NAME, VARIABLE_TYPE_PREFIX, type VariableKind, type VariableHide, type VariableEntity, type VariableDatasource, type DatasourceVariableEntity, type QueryVariableProps, type CustomVariableProps, type IntervalVariableProps, type DatasourceVariableProps, type ConstantVariableProps, type TextboxVariableProps, } from "./variables.js";
8
11
  export * as schema from "./schema/index.js";
9
12
  export { DASHBOARD_SCHEMA_VERSION } from "./schema/index.js";
10
- export { GRAFANA_SCHEMA_PIN, SCHEMA_NAMES, type GrafanaSchemaPin, type SchemaName } from "./pin.js";
11
- export { buildGrafana, grafanaFiles, renderDashboard, dashboardJson, dashboardUid, panelsJson, targetJson, variableModel, datasourceRef, provisionedDatasource, provisionedProvider, datasourcesYaml, dashboardProvidersYaml, GRID_COLUMNS, DATASOURCES_FILE, DASHBOARD_PROVIDERS_FILE, DASHBOARDS_DIR, type BuiltGrafana, type BuiltDashboard, type GrafanaIndex, type ProvisionedDatasource, type ProvisionedProvider, type DashboardJson, type PanelJson, type RowPanelJson, type VariableModel, type DataSourceRef, } from "./build.js";
12
- export { validateGrafanaOutput, issuesFor, variableReferences, type GrafanaIssue, type GrafanaIssueCode, type GrafanaArtifacts, type DashboardDoc, } from "./validate-output.js";
13
- export { validateDashboardSchema, type SchemaProblem } from "./schema-validate.js";
14
- export { looksLikeDashboard, looksLikeDatasourceProvisioning, looksLikeDashboardProvisioning } from "./detect.js";
15
- export { slugUid, isValidUid, UID_PATTERN, type DeepPartial } from "./util.js";
16
- export { RedDashboard, redQueries, SloDashboard, sloQueries, AgentDashboard, agentQueries, type RedDashboardProps, type RedDashboardMembers, type RedDashboardInstance, type SloDashboardProps, type SloDashboardMembers, type SloDashboardInstance, type AgentDashboardProps, type AgentDashboardMembers, type AgentDashboardInstance, type DashboardOptions, } from "./composites/index.js";
13
+ export { GRAFANA_SCHEMA_PIN, SCHEMA_NAMES, IMPORT_ONLY_SCHEMA_NAMES, VENDORED_SCHEMA_NAMES, type GrafanaSchemaPin, type SchemaName, type ImportOnlySchemaName, type VendoredSchemaName, } from "./pin.js";
14
+ export type { AlertListOptions, AlertListSortOrder, AlertListStateFilter, FlameGraphOptions } from "./panel-options.js";
15
+ export { transformation, customTransformation, TRANSFORMATION_IDS, type Transformation, type KnownTransformation, type CustomTransformation, type TransformationCommon, type TransformationId, type TransformationOptionsById, type ReducerId, } from "./transformations.js";
16
+ export { buildGrafana, grafanaFiles, renderDashboard, dashboardJson, dashboardUid, panelsJson, targetJson, variableModel, customVariableOptions, datasourceRef, provisionedDatasource, externalDatasourceRecord, provisionedProvider, datasourcesYaml, dashboardProvidersYaml, GRID_COLUMNS, DATASOURCES_FILE, DASHBOARD_PROVIDERS_FILE, DASHBOARDS_DIR, type BuiltGrafana, type BuiltDashboard, type GrafanaIndex, type ProvisionedDatasource, type ExternalDatasourceRecord, type ProvisionedProvider, type DashboardJson, type PanelJson, type RowPanelJson, type VariableModel, type DataSourceRef, } from "./build.js";
17
+ export { validateGrafanaOutput, issuesFor, knownDatasourcesOf, variableReferences, type GrafanaIssue, type GrafanaIssueCode, type GrafanaArtifacts, type DashboardDoc, } from "./validate-output.js";
18
+ export { datasourceUses, resolveDatasourceRef, knownDatasources, type DatasourceUse, type ResolvedDatasource, type KnownDatasource, type DatasourceRefJson, } from "./datasource-refs.js";
19
+ export { validateDashboardSchema, validateExpressionSchema, type SchemaProblem } from "./schema-validate.js";
20
+ export { looksLikeDashboard, looksLikeDatasourceProvisioning, looksLikeDashboardProvisioning, looksLikeAlertingProvisioning } from "./detect.js";
21
+ export { slugUid, isValidUid, UID_PATTERN, type DeepPartial, type PropsOf } from "./util.js";
22
+ export { RedDashboard, redQueries, RED_DEFAULT_SPAN_KINDS, SloDashboard, sloQueries, AgentDashboard, agentQueries, type RedDashboardProps, type RedDashboardMembers, type RedDashboardInstance, type SpanKind, type SloDashboardProps, type SloDashboardMembers, type SloDashboardInstance, type AgentDashboardProps, type AgentDashboardMembers, type AgentDashboardInstance, type DashboardOptions, SloAlertRules, sloAlertQueries, type SloAlertRulesProps, type SloAlertRulesMembers, type SloAlertRulesInstance, } from "./composites/index.js";
23
+ export { grafanaConfigSchema, resolveGrafanaTarget } from "./config.js";
24
+ export type { GrafanaConfig, GrafanaProfile } from "./config.js";
25
+ export { GRAFANA_OWNERSHIP_KEYS, DEFAULT_PROVIDER_NAME, grafanaOwnershipLabels, dashboardOwnership, } from "./ownership.js";
26
+ export { GrafanaClient, GrafanaApiError, grafanaHttp, namespaceOf, statusVerdict } from "./api/client.js";
27
+ export type { GrafanaAuth, GrafanaHttp, GrafanaResponse, GrafanaTarget, StatusVerdict } from "./api/client.js";
28
+ export { bindGrafana, classifyGrafanaFailure, GrafanaBindingError } from "./api/bind.js";
29
+ export { grafanaApply } from "./op/builders.js";
30
+ export { applyGrafana, planFromDashboards, GRAFANA_APPLY_KINDS } from "./api/apply.js";
31
+ export type { GrafanaApplyPlan, GrafanaApplyOutcome, DashboardPlan, BuiltDashboardInput } from "./api/apply.js";
32
+ export { folderUidFor, foldersForDashboards, type FolderPlan } from "./api/folders.js";
33
+ export { GrafanaActions, grafanaActionsFor, type GrafanaAccessLevel } from "./actions/index.js";
17
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EACL,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,uBAAu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EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EACL,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,EACd,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,kBAAkB,EAClB,4BAA4B,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YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACpF,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAGpF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,22 +1,30 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "5f7d4693dc24cf2a8c26048e831273081d5f49b13ccf1ecb59d392a81c1742c4",
5
- "meta.json": "cc3a6d1fa7baf5fd95c2f454ea1490e15ab88e59194333afb116e9ba0c82b731",
4
+ "manifest.json": "b325c38dff3bc0a339ea4a8fe088db9c347c3a0155e64e95821b3492046054ef",
5
+ "meta.json": "fee34b0c5c2e699e8e797352dd710e42409e33ae2f072f3e5e53d0d11dad34d9",
6
6
  "types/index.d.ts": "ad385264290f2486f7a54be205684de8415a25b74eee5b809ca625ae19fb08da",
7
7
  "rules/grafana-ast.ts": "51f4fac423f7a5c6d6f577074e95b4a70d4ab0a05883a86e04970a50c63d92e8",
8
- "rules/literal-secret.ts": "c3622ec95fdc485c565f9637de95fd856449531f42060d001d4f9e142a0fe6ad",
8
+ "rules/literal-secret.ts": "bc3e13bff3bfa5f4b66f2b43682efb8605ce5ef2fe5c53bca2de07369fca496f",
9
9
  "rules/uid-syntax.ts": "ea6fc0053afcdfb50fd6420d6845cba37352a66411d4f06e7e76876b063e7184",
10
- "rules/graf101.ts": "e30e6fa3eaa184d59a658de275e5fcc5a3248aa8af2dc7120f0c28f7b0bb2113",
11
- "rules/graf102.ts": "6186f51b89133464c78a22a7226d6071956a91189b5f1dd79ff81dd9a89d5c33",
10
+ "rules/graf101.ts": "7e6cf2a1d25ab95b52cd6496924dcde021b18875cb604b00ce7785274d783fe6",
11
+ "rules/graf102.ts": "c05d50461adc8cf6d4e913de77dc1ecdb27e3d0eaa2929fca8757101f58d69ee",
12
12
  "rules/graf103.ts": "d4a035f9fb2dad5e6f415c3fd684789517b0fa38455965b79e221ef2c4c443cf",
13
13
  "rules/graf104.ts": "3a46afbc9afd6840079b5c0053d8b17d878dc6735dcf1d1d09d66971de4bccc8",
14
14
  "rules/graf105.ts": "98264894350f1ce21841922dfefc3dc85abc0ec5c9db91afdfa5c180a8c306f1",
15
15
  "rules/graf106.ts": "c7f96e236eda49e0b782ef064bb6f21ef93d797d435389fa89e26c697b73d69a",
16
- "rules/graf107.ts": "f58f8258c596e66b92eba0ef5d48f3a785f84992c6a78d2cb9f6017d6504e3c1",
17
- "rules/grafana-helpers.ts": "4cf58bcdcfd2c06b8c5c084d77ba780903952487d82773c2f42e6d27c7d3592d",
18
- "skills/chant-grafana.md": "8976cd1dff9729ca655f31e86fce3fff14c90d7c65358947397ccc12bb61f2a4",
19
- "skills/chant-grafana-provisioning.md": "8066d58ef6b8b58724b343cd054b9b210ffffcebe2d1587a6702bae33ab0c12e"
16
+ "rules/graf107.ts": "e43db67d184b967f1f870dd6a4aac8548a54ad5abd0f58080ca68a2d49c2b20c",
17
+ "rules/graf108.ts": "dda5ef25f56af51905aaeb8648733887bf4778b59a19a4ef67979e7180c0df62",
18
+ "rules/graf109.ts": "8b796ee02c0b1bab129805825dee2ef8e0c5afa743a0241d5c251e2b4484039e",
19
+ "rules/graf111.ts": "acd727a91e33526787bb877550d8a3c12674d34b2a660a23fcb20dec0ffebe03",
20
+ "rules/graf112.ts": "cfe779df7f82969b7d7428394d062f46e07540b16889a255b6cb066c7e6e3430",
21
+ "rules/graf113.ts": "81dfb6512e1c0514a5bb105e3fb841110a290c28725ce435283c2c5abd95dd56",
22
+ "rules/graf114.ts": "0732be823ed7d1e6850abffc5374c95c0cfc4c8a3f8490efa1555319cc260587",
23
+ "rules/graf115.ts": "eb6b5cb7b275ab27f9602eb5bdc3e2bc8e698ae6d0ffcd984d71e2315e4d6315",
24
+ "rules/grafana-helpers.ts": "b0cc8adbb43b5846d46d33880174649d89d7d26e271f7076dea3145069dfc877",
25
+ "skills/chant-grafana.md": "113b094f9ee11c50ab990da20393d2e7a4c342a2d959baf8ef11287b0dac8898",
26
+ "skills/chant-grafana-provisioning.md": "55bcf20dbd02b74c880dfb682a4fbe047bd4386158781fe9b94fa76715569e7a",
27
+ "skills/chant-grafana-alerting.md": "d9648dc14c848851bdccbe069dac54ad06115066f9466c90c4137d07dde6d4ad"
20
28
  },
21
- "composite": "2d9bfbe6170caa2d0801ff9ee36248c179d69eafd7b53ec04e006b9561c0b888"
29
+ "composite": "8393c04911568b44f1cb0f3d039d09246768e72b2e69397668ea1794a886b45e"
22
30
  }
package/dist/k8s.d.ts ADDED
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Grafana dashboards and provisioning delivered to Kubernetes as ConfigMaps
3
+ * (#2954), from `@intentius/chant-lexicon-grafana/k8s`.
4
+ *
5
+ * `GrafanaConfigMaps` writes one ConfigMap per dashboard and one for the
6
+ * datasource provisioning file, labelled the way the Grafana Helm chart's
7
+ * sidecar (kiwigrid/k8s-sidecar, also in kube-prometheus-stack) finds them:
8
+ * `grafana_dashboard: "1"` and `grafana_datasource: "1"`. A dashboard's
9
+ * folder goes in the `k8s-sidecar-target-directory` annotation the sidecar
10
+ * reads by default. Each dashboard ConfigMap holds `<uid>.json`, the same
11
+ * text as `dashboardJson(dashboard)`, which is also what the k8s importer
12
+ * turns such a ConfigMap back into (#2962).
13
+ *
14
+ * A Grafana run without the sidecar (a plain Deployment, as in
15
+ * `examples/agent-observability`) mounts the same ConfigMaps with
16
+ * `grafanaVolumes()`, which also needs the dashboard provider file that
17
+ * `GrafanaConfigMaps` writes to a third ConfigMap. The provisioning files go
18
+ * under `/etc/grafana/provisioning` and each dashboard folder is a volume of
19
+ * its own under the provider's path: inside a ConfigMap volume a
20
+ * subdirectory is a symlink, and Grafana's dashboard provider does not
21
+ * follow symlinked directories.
22
+ *
23
+ * This module is the only part of the grafana lexicon that loads the k8s
24
+ * lexicon; nothing else imports it.
25
+ */
26
+ import { type CompositeInstance } from "@intentius/chant/composite";
27
+ import type { Declarable } from "@intentius/chant/declarable";
28
+ import { ConfigMap } from "@intentius/chant-lexicon-k8s/generated/index";
29
+ /** The label the Grafana Helm chart's sidecar looks for on dashboard ConfigMaps (`sidecar.dashboards.label`). */
30
+ export declare const SIDECAR_DASHBOARD_LABEL = "grafana_dashboard";
31
+ /** The label it looks for on datasource ConfigMaps (`sidecar.datasources.label`). */
32
+ export declare const SIDECAR_DATASOURCE_LABEL = "grafana_datasource";
33
+ /** The annotation the sidecar reads a dashboard's target directory from, by default (its `FOLDER_ANNOTATION`). */
34
+ export declare const SIDECAR_FOLDER_ANNOTATION = "k8s-sidecar-target-directory";
35
+ /** Where Grafana reads provisioning files. */
36
+ export declare const GRAFANA_PROVISIONING_PATH = "/etc/grafana/provisioning";
37
+ export interface GrafanaConfigMapsProps {
38
+ /** The grafana declarations to deliver: dashboards, datasources, `DashboardProvider`s. Anything else is ignored. */
39
+ entities: Iterable<Declarable>;
40
+ namespace?: string;
41
+ /** Prefix of every ConfigMap name. Defaults to `grafana`. */
42
+ name?: string;
43
+ /** Labels added to every ConfigMap, beside the sidecar's. */
44
+ labels?: Record<string, string>;
45
+ /** The dashboard label as `[key, value]`, or `false` for none. Defaults to `["grafana_dashboard", "1"]`. */
46
+ dashboardLabel?: readonly [string, string] | false;
47
+ /** The datasource label as `[key, value]`, or `false` for none. Defaults to `["grafana_datasource", "1"]`. */
48
+ datasourceLabel?: readonly [string, string] | false;
49
+ /** The annotation holding a dashboard's folder, or `false` for none. Defaults to `k8s-sidecar-target-directory`. */
50
+ folderAnnotation?: string | false;
51
+ }
52
+ /** The `metadata.name` of each ConfigMap, and which file it holds. */
53
+ export interface GrafanaConfigMapLayout {
54
+ dashboards: Array<{
55
+ configMap: string;
56
+ key: string;
57
+ folder: string;
58
+ uid: string;
59
+ text: string;
60
+ }>;
61
+ datasources?: {
62
+ configMap: string;
63
+ key: string;
64
+ text: string;
65
+ };
66
+ providers?: {
67
+ configMap: string;
68
+ key: string;
69
+ text: string;
70
+ };
71
+ }
72
+ /** Which ConfigMap each file goes in, and under which key. `GrafanaConfigMaps` and `grafanaVolumes` both read it. */
73
+ export declare function grafanaConfigMapLayout(props: Pick<GrafanaConfigMapsProps, "entities" | "name">): GrafanaConfigMapLayout;
74
+ type ConfigMapEntity = InstanceType<typeof ConfigMap> & Declarable;
75
+ export type GrafanaConfigMapsMembers = Record<string, ConfigMapEntity>;
76
+ export type GrafanaConfigMapsInstance = CompositeInstance<GrafanaConfigMapsMembers> & GrafanaConfigMapsMembers;
77
+ /**
78
+ * One ConfigMap per dashboard, one for the datasources and one for the
79
+ * dashboard provider, labelled for the Grafana sidecar. Export the result
80
+ * from a k8s build root; the members are named after the ConfigMaps
81
+ * (`dashboardGenaiAgents`, `datasources`, `dashboardProviders`).
82
+ */
83
+ export declare const GrafanaConfigMaps: import("@intentius/chant/composite").CompositeDefinition<GrafanaConfigMapsProps, GrafanaConfigMapsMembers>;
84
+ export interface GrafanaVolumesOptions {
85
+ /** Where the dashboard provider reads dashboards. Defaults to `/var/lib/grafana/dashboards`, the provider chant writes by default. */
86
+ dashboardsPath?: string;
87
+ /** Prefix of the volume names. Defaults to `grafana`. */
88
+ volumeName?: string;
89
+ }
90
+ export interface GrafanaVolumes {
91
+ volumes: Array<Record<string, unknown>>;
92
+ volumeMounts: Array<{
93
+ name: string;
94
+ mountPath: string;
95
+ readOnly: true;
96
+ }>;
97
+ }
98
+ /**
99
+ * The pod volumes and container mounts that put `GrafanaConfigMaps`'s files
100
+ * where a Grafana without the sidecar reads them: the provisioning files
101
+ * under `/etc/grafana/provisioning`, and each dashboard folder under the
102
+ * provider's path, one projected volume per folder. Pass the same `entities`
103
+ * and `name` as to `GrafanaConfigMaps`.
104
+ */
105
+ export declare function grafanaVolumes(props: Pick<GrafanaConfigMapsProps, "entities" | "name">, options?: GrafanaVolumesOptions): GrafanaVolumes;
106
+ export {};
107
+ //# sourceMappingURL=k8s.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"k8s.d.ts","sourceRoot":"","sources":["../src/k8s.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAIzE,iHAAiH;AACjH,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAC3D,qFAAqF;AACrF,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAC7D,kHAAkH;AAClH,eAAO,MAAM,yBAAyB,iCAAiC,CAAC;AAExE,8CAA8C;AAC9C,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE,MAAM,WAAW,sBAAsB;IACrC,oHAAoH;IACpH,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,4GAA4G;IAC5G,cAAc,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;IACnD,8GAA8G;IAC9G,eAAe,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;IACpD,oHAAoH;IACpH,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACnC;AAED,sEAAsE;AACtE,MAAM,WAAW,sBAAsB;IACrC,U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CAAC,CAAC;CAC1E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,MAAM,CAAC,EAAE,OAAO,GAAE,qBAA0B,GAAG,cAAc,CA2B5I"}
@@ -2,7 +2,8 @@
2
2
  * The grafana lexicon's chant audit catalog, contributed via
3
3
  * `grafanaPlugin.auditCatalog()` (#687, #1346).
4
4
  *
5
- * GRAF101-GRAF107 read the emitted dashboard JSON and provisioning files, so
5
+ * GRAF101-GRAF109, GRAF111-GRAF114 and GRAF115 read the emitted dashboard
6
+ * JSON and provisioning files (alerting included), so
6
7
  * they fire on an audit of files chant didn't build too, and are
7
8
  * `yamlBased`. GRAF001 and GRAF002 read TypeScript source, so they are
8
9
  * constructed with `yamlBased: false`; they are listed for a reader who
@@ -1 +1 @@
1
- {"version":3,"file":"audit-catalog.d.ts","sourceRoot":"","sources":["../../src/lint/audit-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAM1E,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAqExD,CAAC"}
1
+ {"version":3,"file":"audit-catalog.d.ts","sourceRoot":"","sources":["../../src/lint/audit-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAM1E,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CA6HxD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * GRAF101: A panel, query or variable uses a datasource no Datasource in the build declares
2
+ * GRAF101: A panel, query or variable uses a datasource no Datasource or ExternalDatasource in the build declares
3
3
  *
4
- * Grafana shows "datasource not found" on the panel. Typed references cannot go wrong this way, so it mostly catches a { type, uid } ref or a hand-edited dashboard. A panel with queries and no datasource at all is a warning: Grafana sends them to its default datasource. This check joins dashboards against the Datasource declarations of the same build root, so it goes silent across build roots (chant #1939): with no Datasource declared in the build it reports nothing, and a datasource declared in another build root looks undeclared. Keep datasources and the dashboards that use them in one build root.
4
+ * Grafana shows "datasource not found" on the panel. Typed references cannot go wrong this way, so it mostly catches a { type, uid } ref or a hand-edited dashboard. A datasource variable whose plugin type no declared datasource has is an error too. A panel with queries and no datasource at all is a warning: Grafana sends them to its default datasource. This check joins dashboards against the datasources of the same build root (chant #1939): declare one that exists in Grafana but is provisioned elsewhere with ExternalDatasource, which the check counts and the build never provisions. A build that declares no datasource at all gets one warning per dashboard that references any, since nothing can be checked.
5
5
  */
6
6
  import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
7
  export declare const graf101: PostSynthCheck;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * GRAF102: A query is sent to a datasource of another plugin type
3
3
  *
4
- * A PromQL query sent to Tempo fails at query time. The typed classes prevent this at compile time; the check catches refs, datasource variables of the wrong plugin type and hand-edited dashboards. Like GRAF101 it joins against the Datasource declarations of the same build root and goes silent across build roots (chant #1939).
4
+ * A PromQL query sent to Tempo fails at query time. The typed classes prevent this at compile time; the check catches refs, datasource variables of the wrong plugin type and hand-edited dashboards. Like GRAF101 it joins against the Datasource and ExternalDatasource declarations of the same build root (chant #1939).
5
5
  */
6
6
  import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
7
  export declare const graf102: PostSynthCheck;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * GRAF107: A dashboard does not match the pinned Grafana schema
3
3
  *
4
- * The dashboard is validated against the dashboard schema at GRAFANA_SCHEMA_PIN, and each panel's options, fieldConfig.defaults.custom and queries against their plugin's schema with required fields relaxed (Grafana fills those in). What fails is a key the schema does not have or a value it does not allow: the edits Grafana would otherwise need on import.
4
+ * The dashboard is validated against the dashboard schema at GRAFANA_SCHEMA_PIN, with the correction overlay in src/spec/overlay/ applied, and each panel's options, fieldConfig.defaults.custom and queries against their plugin's schema with required fields relaxed (Grafana fills those in). Library panel models embedded in an export's __elements are checked the same way. A value the schema does not allow is an error: the edits Grafana would otherwise need on import. A key the schema does not know is a warning, since newer Grafana versions add keys before the pin catches up.
5
5
  */
6
6
  import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
7
  export declare const graf107: PostSynthCheck;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GRAF108: A query sent to Prometheus is not valid PromQL
3
+ *
4
+ * Each panel query, query variable and alert rule query whose datasource resolves to a prometheus datasource is parsed with the prometheus lexicon's checkPromql (@prometheus-io/lezer-promql), after its template variables ($var, ${var}, [[var]], $__interval, $__rate_interval, $__range and the other $__ macros) are replaced with placeholders that parse where they stand. A query whose datasource can't be told is not parsed; an alert rule query is parsed when its datasourceUid is a declared prometheus datasource or its model says `datasource.type: prometheus`. It is a syntax check: an unbalanced bracket or a bad duration fails, rate over an instant vector does not.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const graf108: PostSynthCheck;
8
+ //# sourceMappingURL=graf108.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graf108.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/graf108.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GRAF109: Dashboard provisioning puts a dashboard somewhere other than its declared folder, or loads it twice
3
+ *
4
+ * Read from the dashboard provisioning file and where each dashboard file sits under dashboards/. Two providers in one org whose paths are the same or nested load every dashboard twice, and Grafana then takes database writes away from both: an error. A provider that sets folder and folderUid with foldersFromFilesStructure is refused by Grafana: an error; with one of them, that folder is ignored: a warning. Dashboards that declare a folder when no provider sets foldersFromFilesStructure all land in the provider's folder: a warning. A nested folder ("Platform/Kubernetes") is a warning: Grafana 13.1 and later nest the folders, 12.4 and 13.0 use only the last level; past Grafana's default depth of 4 it says so, and past its hard limit of 7 it is an error.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const graf109: PostSynthCheck;
8
+ //# sourceMappingURL=graf109.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graf109.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/graf109.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GRAF111: An alert rule's condition, expression inputs or refIds do not fit together
3
+ *
4
+ * Each alert rule's condition, each server-side expression's inputs (a reduce, threshold or resample `expression`, the `$A` references of a math expression, a classic condition's query) and a recording rule's record.from must name a refId of the same rule; refIds must be unique, and a rule needs a condition unless it records. Each expression model is also validated against the pinned `expr` schema (a missing reducer, an unknown evaluator type). Grafana refuses such a rule, and a refused rule stops it provisioning every alerting file at startup.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const graf111: PostSynthCheck;
8
+ //# sourceMappingURL=graf111.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graf111.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/graf111.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GRAF112: An alert rule queries a datasource the build does not declare, or of another type
3
+ *
4
+ * Each alert rule query's datasourceUid must be a datasource the build declares: a Datasource it provisions or an ExternalDatasource that already exists in Grafana. A query whose model states a datasource type (model.datasource.type) must match the declared type, and a recording rule's targetDatasourceUid must be a declared Prometheus datasource. With no datasource declared at all, it warns once that it cannot check.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const graf112: PostSynthCheck;
8
+ //# sourceMappingURL=graf112.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graf112.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/graf112.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}