@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,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: ClassicConditionsExpression
4
+ description: grafana resource type Grafana::Expression::classic_conditions
5
+ name: ClassicConditionsExpression
6
+ lexicon: grafana
7
+ resource_type: Grafana::Expression::classic_conditions
8
+ ---
9
+ `Grafana::Expression::classic_conditions`, a resource type of the grafana lexicon.
@@ -0,0 +1,14 @@
1
+ ---
2
+ type: resource-type
3
+ title: ContactPoint
4
+ description: grafana resource type Grafana::ContactPoint
5
+ name: ContactPoint
6
+ lexicon: grafana
7
+ resource_type: Grafana::ContactPoint
8
+ ---
9
+ `Grafana::ContactPoint`, a resource type of the grafana lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [GRAF002](/rules/GRAF002.md): a datasource or contact point secret written as a literal.
14
+ - [GRAF113](/rules/GRAF113.md): Alerting routes to a contact point or mute timing the build does not declare, or a policy matcher does not parse
@@ -12,3 +12,4 @@ resource_type: Grafana::Dashboard
12
12
 
13
13
  - [GRAF001](/rules/GRAF001.md): a uid Grafana rejects, or a variable name queries cannot reference.
14
14
  - [GRAF104](/rules/GRAF104.md): Two dashboards, datasources, panels, variables or queries share an id
15
+ - [GRAF109](/rules/GRAF109.md): Dashboard provisioning puts a dashboard somewhere other than its declared folder, or loads it twice
@@ -11,6 +11,7 @@ resource_type: Grafana::Datasource
11
11
  ## Governed by
12
12
 
13
13
  - [GRAF001](/rules/GRAF001.md): a uid Grafana rejects, or a variable name queries cannot reference.
14
- - [GRAF002](/rules/GRAF002.md): a datasource secret written as a literal.
15
- - [GRAF101](/rules/GRAF101.md): A panel, query or variable uses a datasource no Datasource in the build declares
14
+ - [GRAF002](/rules/GRAF002.md): a datasource or contact point secret written as a literal.
15
+ - [GRAF101](/rules/GRAF101.md): A panel, query or variable uses a datasource no Datasource or ExternalDatasource in the build declares
16
16
  - [GRAF102](/rules/GRAF102.md): A query is sent to a datasource of another plugin type
17
+ - [GRAF112](/rules/GRAF112.md): An alert rule queries a datasource the build does not declare, or of another type
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: resource-type
3
+ title: ExternalDatasource
4
+ description: grafana resource type Grafana::ExternalDatasource
5
+ name: ExternalDatasource
6
+ lexicon: grafana
7
+ resource_type: Grafana::ExternalDatasource
8
+ ---
9
+ `Grafana::ExternalDatasource`, a resource type of the grafana lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [GRAF101](/rules/GRAF101.md): A panel, query or variable uses a datasource no Datasource or ExternalDatasource in the build declares
14
+ - [GRAF102](/rules/GRAF102.md): A query is sent to a datasource of another plugin type
15
+ - [GRAF112](/rules/GRAF112.md): An alert rule queries a datasource the build does not declare, or of another type
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: FlameGraphPanel
4
+ description: grafana resource type Grafana::Panel::flamegraph
5
+ name: FlameGraphPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::flamegraph
8
+ ---
9
+ `Grafana::Panel::flamegraph`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: GeomapPanel
4
+ description: grafana resource type Grafana::Panel::geomap
5
+ name: GeomapPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::geomap
8
+ ---
9
+ `Grafana::Panel::geomap`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: HistogramPanel
4
+ description: grafana resource type Grafana::Panel::histogram
5
+ name: HistogramPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::histogram
8
+ ---
9
+ `Grafana::Panel::histogram`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: MathExpression
4
+ description: grafana resource type Grafana::Expression::math
5
+ name: MathExpression
6
+ lexicon: grafana
7
+ resource_type: Grafana::Expression::math
8
+ ---
9
+ `Grafana::Expression::math`, a resource type of the grafana lexicon.
@@ -0,0 +1,13 @@
1
+ ---
2
+ type: resource-type
3
+ title: MuteTiming
4
+ description: grafana resource type Grafana::MuteTiming
5
+ name: MuteTiming
6
+ lexicon: grafana
7
+ resource_type: Grafana::MuteTiming
8
+ ---
9
+ `Grafana::MuteTiming`, a resource type of the grafana lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [GRAF113](/rules/GRAF113.md): Alerting routes to a contact point or mute timing the build does not declare, or a policy matcher does not parse
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: NodeGraphPanel
4
+ description: grafana resource type Grafana::Panel::nodeGraph
5
+ name: NodeGraphPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::nodeGraph
8
+ ---
9
+ `Grafana::Panel::nodeGraph`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: NotificationPolicy
4
+ description: grafana resource type Grafana::NotificationPolicy
5
+ name: NotificationPolicy
6
+ lexicon: grafana
7
+ resource_type: Grafana::NotificationPolicy
8
+ ---
9
+ `Grafana::NotificationPolicy`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: NotificationTemplate
4
+ description: grafana resource type Grafana::NotificationTemplate
5
+ name: NotificationTemplate
6
+ lexicon: grafana
7
+ resource_type: Grafana::NotificationTemplate
8
+ ---
9
+ `Grafana::NotificationTemplate`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: PieChartPanel
4
+ description: grafana resource type Grafana::Panel::piechart
5
+ name: PieChartPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::piechart
8
+ ---
9
+ `Grafana::Panel::piechart`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: ReduceExpression
4
+ description: grafana resource type Grafana::Expression::reduce
5
+ name: ReduceExpression
6
+ lexicon: grafana
7
+ resource_type: Grafana::Expression::reduce
8
+ ---
9
+ `Grafana::Expression::reduce`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: ResampleExpression
4
+ description: grafana resource type Grafana::Expression::resample
5
+ name: ResampleExpression
6
+ lexicon: grafana
7
+ resource_type: Grafana::Expression::resample
8
+ ---
9
+ `Grafana::Expression::resample`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: SqlExpression
4
+ description: grafana resource type Grafana::Expression::sql
5
+ name: SqlExpression
6
+ lexicon: grafana
7
+ resource_type: Grafana::Expression::sql
8
+ ---
9
+ `Grafana::Expression::sql`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: StateTimelinePanel
4
+ description: grafana resource type Grafana::Panel::state-timeline
5
+ name: StateTimelinePanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::state-timeline
8
+ ---
9
+ `Grafana::Panel::state-timeline`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: StatusHistoryPanel
4
+ description: grafana resource type Grafana::Panel::status-history
5
+ name: StatusHistoryPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::status-history
8
+ ---
9
+ `Grafana::Panel::status-history`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: ThresholdExpression
4
+ description: grafana resource type Grafana::Expression::threshold
5
+ name: ThresholdExpression
6
+ lexicon: grafana
7
+ resource_type: Grafana::Expression::threshold
8
+ ---
9
+ `Grafana::Expression::threshold`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: TrendPanel
4
+ description: grafana resource type Grafana::Panel::trend
5
+ name: TrendPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::trend
8
+ ---
9
+ `Grafana::Panel::trend`, a resource type of the grafana lexicon.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: resource-type
3
+ title: XYChartPanel
4
+ description: grafana resource type Grafana::Panel::xychart
5
+ name: XYChartPanel
6
+ lexicon: grafana
7
+ resource_type: Grafana::Panel::xychart
8
+ ---
9
+ `Grafana::Panel::xychart`, a resource type of the grafana lexicon.
@@ -0,0 +1,75 @@
1
+ /**
2
+ * `grafanaApply`, the Op activity for the Grafana API applier (#2948), and
3
+ * `toApplyResult`, its projection onto core's apply envelope (#1446).
4
+ *
5
+ * It reads a build's output (the index the serializer writes as its primary
6
+ * output, and the dashboard files beside it), binds the environment's
7
+ * Grafana the way observe and export do (`grafana.profiles.<env>`, else
8
+ * `GRAFANA_URL`; ../../api/bind.ts), and hands the plan to `applyGrafana`
9
+ * (../../api/apply.ts), which holds the API decisions.
10
+ *
11
+ * The ownership marker is the project's: `ownership.stack` and
12
+ * `ownership.env` from `chant.config.ts`, or `stack`/`ownershipEnv` passed
13
+ * in. Without a stack the apply still runs, stamping only the managed-by
14
+ * label, and a prune declines (as `not-prunable`) rather than delete
15
+ * another stack's dashboards.
16
+ */
17
+ import type { ChantConfig } from "@intentius/chant/config";
18
+ import type { OwnershipMarker } from "@intentius/chant/ownership";
19
+ import { type ApplyResult } from "@intentius/chant/apply";
20
+ import type { GrafanaHttp } from "../../api/client.js";
21
+ import { type BuiltDashboardInput, type GrafanaApplyOutcome } from "../../api/apply.js";
22
+ export type { GrafanaApplyOutcome } from "../../api/apply.js";
23
+ export interface GrafanaApplyArgs {
24
+ /**
25
+ * The build's primary output: the index the grafana serializer writes
26
+ * (`chant build -o dist/grafana.json`). The dashboard files it lists are
27
+ * read from the same directory. A combined multi-lexicon output works too;
28
+ * its `grafana` key is used.
29
+ */
30
+ indexPath: string;
31
+ /** The chant environment, which selects `grafana.profiles.<environment>`. */
32
+ environment?: string;
33
+ /**
34
+ * Delete this project's dashboards and folders that the build no longer
35
+ * declares: only those carrying its ownership marker, stack and env.
36
+ * Destructive, so off by default.
37
+ */
38
+ prune?: boolean;
39
+ /** Ownership stack. Default: `ownership.stack` in `chant.config.ts`. */
40
+ stack?: string;
41
+ /** Ownership env. Default: `ownership.env` in `chant.config.ts` (a literal; a `{ param }` reference needs this). */
42
+ ownershipEnv?: string;
43
+ /** Project directory for `chant.config.ts`. Default: the working directory. */
44
+ cwd?: string;
45
+ }
46
+ /** What a test (or an embedding caller) may inject instead of the project's config, the process env and `fetch`. */
47
+ export interface GrafanaApplyDeps {
48
+ http?: GrafanaHttp;
49
+ config?: Pick<ChantConfig, "grafana" | "ownership">;
50
+ env?: Record<string, string | undefined>;
51
+ }
52
+ /**
53
+ * The dashboards a build wrote, read from its index and the files beside
54
+ * it. Pure but for the file reads.
55
+ */
56
+ export declare function readBuiltDashboards(indexPath: string, read?: (path: string) => string): BuiltDashboardInput[];
57
+ /** The marker to stamp and prune by: the arguments, else the project's `ownership` config. */
58
+ export declare function resolveMarker(args: Pick<GrafanaApplyArgs, "stack" | "ownershipEnv">, config: Pick<ChantConfig, "ownership"> | undefined): OwnershipMarker | undefined;
59
+ /**
60
+ * Apply a grafana build to the environment's Grafana over its HTTP API.
61
+ * Dashboards and folders get chant's ownership labels; with `prune`, this
62
+ * project's dashboards and folders the build no longer has are deleted.
63
+ * A target that cannot be bound returns every resource as not attempted,
64
+ * with the binding's reason.
65
+ */
66
+ export declare function grafanaApply(args: GrafanaApplyArgs, signal?: AbortSignal, deps?: GrafanaApplyDeps): Promise<GrafanaApplyOutcome>;
67
+ /**
68
+ * Project a grafana apply outcome onto core's apply envelope. The outcome
69
+ * keeps what the envelope has no room for (the request path, the API
70
+ * version, the binding's source); a kind the prune could not consider has no
71
+ * single resource name, so it is reported as `<kind>/*`, `not-prunable`,
72
+ * as the gcp applier does.
73
+ */
74
+ export declare function toApplyResult(outcome: GrafanaApplyOutcome): ApplyResult;
75
+ //# sourceMappingURL=grafana-apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grafana-apply.d.ts","sourceRoot":"","sources":["../../../src/op/activities/grafana-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAIL,KAAK,WAAW,EAEjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAkE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAErJ,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oHAAoH;IACpH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,oHAAoH;AACpH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAQD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAuC,GAAG,mBAAmB,EAAE,CAW7I;AAWD,8FAA8F;AAC9F,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,cAAc,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAUrK;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqC1I;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAOvE"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Grafana Op activities, resolved by the core activity registry when a
3
+ * project's `chant.config.ts` lists the `grafana` lexicon. Contributes the
4
+ * API applier (`grafanaApply`, #2948) and its envelope projection
5
+ * (`toApplyResult`), which core's apply activity looks up by name.
6
+ */
7
+ export { grafanaApply, toApplyResult, readBuiltDashboards, resolveMarker } from "./grafana-apply.js";
8
+ export type { GrafanaApplyArgs, GrafanaApplyDeps, GrafanaApplyOutcome } from "./grafana-apply.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClG,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Typed step builder for this lexicon's activity (chant #1288 Stage 2),
3
+ * beside its `*Args` interface for the reason `lexicons/k8s/src/op/builders.ts`
4
+ * gives: core cannot import a lexicon's types. `opts` is
5
+ * {@link GrafanaApplyArgs} itself (via `Omit`/`WithStepRefs`), never
6
+ * restated.
7
+ */
8
+ import { type ActivityStep, type NamedActivityStep, type WithStepRefs } from "@intentius/chant/op";
9
+ import type { GrafanaApplyArgs } from "./activities/grafana-apply.js";
10
+ /** Extra opts the builder accepts alongside the activity's own fields. */
11
+ type StepOpts = {
12
+ profile?: ActivityStep["profile"];
13
+ id?: string;
14
+ };
15
+ /**
16
+ * Apply a grafana build to the environment's Grafana over its HTTP API
17
+ * (#2948): folders, library panels and dashboards, stamped with chant's
18
+ * ownership labels, and with `prune`, this project's orphans deleted.
19
+ * `opts` is {@link GrafanaApplyArgs} minus the positional `indexPath`.
20
+ * Defaults to the `longInfra` profile, as the other API appliers do.
21
+ */
22
+ export declare const grafanaApply: (indexPath: string, opts?: WithStepRefs<Omit<GrafanaApplyArgs, "indexPath">> & StepOpts) => NamedActivityStep;
23
+ export {};
24
+ //# sourceMappingURL=builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,0EAA0E;AAC1E,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GACvB,WAAW,MAAM,EACjB,OAAO,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC,GAAG,QAAQ,KAClE,iBAGF,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Whose a live dashboard is (#2946).
3
+ *
4
+ * `serializer.ts` used to say Grafana had no metadata channel. It has two,
5
+ * both on the `dashboard.grafana.app` resource and neither in the dashboard
6
+ * JSON:
7
+ *
8
+ * - **`metadata.labels`**, which Grafana keeps as written for a dashboard
9
+ * created or updated through `/apis`. chant's marker there is the shared
10
+ * Kubernetes label convention, `LABEL_OWNERSHIP_KEYS`
11
+ * (`app.kubernetes.io/managed-by: chant` plus the stack and env labels).
12
+ * The API applier (#2948) stamps it with {@link grafanaOwnershipLabels};
13
+ * this reads it back, stack and env included.
14
+ * - **`metadata.annotations`**, which Grafana writes itself for a
15
+ * file-provisioned dashboard: `grafana.app/managedBy:
16
+ * classic-file-provisioning` and `grafana.app/managerId: <provider name>`.
17
+ * The provider name is the one chant writes into
18
+ * `provisioning/dashboards/chant.yaml` (`chant` unless a
19
+ * `DashboardProvider` names another), so a dashboard whose manager is one
20
+ * of the project's providers is chant's. That channel carries no stack or
21
+ * env, so it gives a verdict and never a marker.
22
+ *
23
+ * Anything else a read can see (a dashboard saved in the UI, one another
24
+ * provider or tool manages) is `foreign`.
25
+ *
26
+ * Two reads have no channel at all, and say `unknown` rather than guess:
27
+ * the legacy `/api/dashboards/uid` read Grafana 11 is observed through, and
28
+ * every datasource read (`/api/datasources` returns no labels, and the
29
+ * `readOnly` flag says a datasource is provisioned, not by whom).
30
+ */
31
+ import { type ChannelKeys, type OwnershipMarker } from "@intentius/chant/ownership";
32
+ import type { LiveDashboard } from "./api/dashboards.js";
33
+ /** The label keys chant's marker uses on a `dashboard.grafana.app` resource. */
34
+ export declare const GRAFANA_OWNERSHIP_KEYS: ChannelKeys;
35
+ export declare const MANAGED_BY_ANNOTATION = "grafana.app/managedBy";
36
+ export declare const MANAGER_ID_ANNOTATION = "grafana.app/managerId";
37
+ /** `grafana.app/managedBy` for a dashboard loaded by a file provider. */
38
+ export declare const FILE_PROVISIONING_MANAGER = "classic-file-provisioning";
39
+ /**
40
+ * The provider name the build writes when a project declares none. It is
41
+ * chant's managed-by value on purpose: it comes back from Grafana as the
42
+ * `grafana.app/managerId` of every dashboard the provider loads.
43
+ */
44
+ export declare const DEFAULT_PROVIDER_NAME = "chant";
45
+ export type OwnershipVerdict = "owned" | "foreign" | "unknown";
46
+ /** The labels the API applier (#2948) writes on a dashboard it creates, for this build's stack and env. */
47
+ export declare function grafanaOwnershipLabels(ownership: {
48
+ stack: string;
49
+ env?: string;
50
+ }): Record<string, string>;
51
+ /**
52
+ * The provider names that load this project's dashboards: every declared
53
+ * `DashboardProvider`, or the default one the build writes when there is
54
+ * none.
55
+ */
56
+ export declare function chantProviderNames(entities: Iterable<{
57
+ entityType: string;
58
+ props: Record<string, unknown>;
59
+ }>): Set<string>;
60
+ /** Why a verdict is what it is, for an `owned: true` read to put in its `filtered` detail. */
61
+ export declare function ownershipGap(dashboard: LiveDashboard): string;
62
+ /** A dashboard's ownership verdict, and the stack/env marker when its labels carry one. */
63
+ export declare function dashboardOwnership(dashboard: LiveDashboard, providers: ReadonlySet<string>): {
64
+ ownership: OwnershipVerdict;
65
+ marker?: OwnershipMarker;
66
+ };
67
+ //# sourceMappingURL=ownership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../src/ownership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,EAAE,WAAkC,CAAC;AAExE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAA6B,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/D,2GAA2G;AAC3G,wBAAgB,sBAAsB,CAAC,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAO1H;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CAI7D;AAED,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B;IAAE,SAAS,EAAE,gBAAgB,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,CAW3D"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Hand-written option types for the built-in panels that have no schema.
3
+ *
4
+ * The alert list and flame graph panels define their options in TypeScript
5
+ * inside Grafana's frontend, with no CUE kind, so foundation-sdk publishes
6
+ * no JSON Schema for them and `npm run generate` has nothing to read. The
7
+ * types here follow Grafana's source at v13.2.2, cited per type. GRAF107
8
+ * checks these panels' envelope (the dashboard schema's `Panel`) but not
9
+ * their `options`; the traces panel is in the same position and keeps
10
+ * untyped options.
11
+ */
12
+ import type { ThresholdsConfig, ValueMapping } from "./schema/dashboard.gen.js";
13
+ /**
14
+ * How the alert list orders rules: `SortOrder` in
15
+ * public/app/plugins/panel/alertlist/types.ts:4-10 (a numeric enum starting at 1).
16
+ * 1 alphabetical ascending, 2 descending, 3 by importance, 4 time ascending, 5 time descending.
17
+ */
18
+ export type AlertListSortOrder = 1 | 2 | 3 | 4 | 5;
19
+ /** Which rule states the alert list shows: `StateFilter`, public/app/plugins/panel/alertlist/types.ts:22-30. */
20
+ export interface AlertListStateFilter {
21
+ firing: boolean;
22
+ pending: boolean;
23
+ /** Kept for dashboards saved before 9.x. */
24
+ inactive: boolean;
25
+ recovering: boolean;
26
+ noData: boolean;
27
+ normal: boolean;
28
+ error: boolean;
29
+ }
30
+ /**
31
+ * The alert list panel's options: `UnifiedAlertListOptions`,
32
+ * public/app/plugins/panel/alertlist/types.ts:32-49 at v13.2.2. Defaults are in
33
+ * public/app/plugins/panel/alertlist/module.tsx.
34
+ */
35
+ export interface AlertListOptions {
36
+ maxItems: number;
37
+ sortOrder: AlertListSortOrder;
38
+ /** Only rules from the dashboard the panel is on. */
39
+ dashboardAlerts: boolean;
40
+ groupMode: "default" | "custom";
41
+ groupBy: string[];
42
+ alertName: string;
43
+ showInstances: boolean;
44
+ /** Only rules in this folder; null for any. */
45
+ folder: {
46
+ uid: string;
47
+ title: string;
48
+ } | null;
49
+ stateFilter: AlertListStateFilter;
50
+ alertInstanceLabelFilter: string;
51
+ /** The rule source's datasource name, or null for all. */
52
+ datasource: string | null;
53
+ viewMode: "list" | "stat";
54
+ showInactiveAlerts: boolean;
55
+ /** `BigValueColorMode`, packages/grafana-ui/src/components/BigValue/BigValueTypes.ts:8-13. */
56
+ statColorMode: "background" | "background_solid" | "none" | "value";
57
+ statThresholds: ThresholdsConfig;
58
+ statValueMappings: ValueMapping[];
59
+ }
60
+ /** The flame graph panel's options: `Options`, public/app/plugins/panel/flamegraph/types.ts:1-3 at v13.2.2. */
61
+ export interface FlameGraphOptions {
62
+ /** Hide the top table and show only the flame graph. */
63
+ showFlameGraphOnly: boolean;
64
+ }
65
+ //# sourceMappingURL=panel-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel-options.d.ts","sourceRoot":"","sources":["../src/panel-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEnD,gHAAgH;AAChH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,qDAAqD;IACrD,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,WAAW,EAAE,oBAAoB,CAAC;IAClC,wBAAwB,EAAE,MAAM,CAAC;IACjC,0DAA0D;IAC1D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,8FAA8F;IAC9F,aAAa,EAAE,YAAY,GAAG,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAAC;IACpE,cAAc,EAAE,gBAAgB,CAAC;IACjC,iBAAiB,EAAE,YAAY,EAAE,CAAC;CACnC;AAED,+GAA+G;AAC/G,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,kBAAkB,EAAE,OAAO,CAAC;CAC7B"}
package/dist/panels.d.ts CHANGED
@@ -11,15 +11,17 @@
11
11
  *
12
12
  * `gridPos` is optional. A panel without `x` and `y` is placed by the
13
13
  * dashboard: left to right in declaration order, wrapping at Grafana's
14
- * 24-column width, below the previous row of panels. A panel with both is
15
- * placed exactly there, and GRAF105 reports overlaps.
14
+ * 24-column width, below the previous row of panels, and around any cells
15
+ * already taken. A panel with both is placed exactly there and reserves its
16
+ * cells first; GRAF105 reports overlaps between explicit panels. A panel
17
+ * with only `x` or only `y` keeps that column or line.
16
18
  */
17
19
  import type { Declarable } from "@intentius/chant/declarable";
18
20
  import type { DeepPartial } from "./util.js";
19
21
  import type { DatasourceInput, QueryEntity } from "./query.js";
20
22
  import type { VariableEntity } from "./variables.js";
21
23
  import type { SchemaName } from "./pin.js";
22
- import type { DashboardLink, DataTransformerConfig, FieldConfig, FieldConfigSource, GridPos } from "./schema/dashboard.gen.js";
24
+ import type { DashboardLink, FieldConfig, FieldConfigSource, GridPos } from "./schema/dashboard.gen.js";
23
25
  import type * as timeseries from "./schema/timeseries.gen.js";
24
26
  import type * as stat from "./schema/stat.gen.js";
25
27
  import type * as gauge from "./schema/gauge.gen.js";
@@ -27,6 +29,19 @@ import type * as table from "./schema/table.gen.js";
27
29
  import type * as logs from "./schema/logs.gen.js";
28
30
  import type * as heatmap from "./schema/heatmap.gen.js";
29
31
  import type * as text from "./schema/text.gen.js";
32
+ import type * as barchart from "./schema/barchart.gen.js";
33
+ import type * as bargauge from "./schema/bargauge.gen.js";
34
+ import type * as piechart from "./schema/piechart.gen.js";
35
+ import type * as statetimeline from "./schema/statetimeline.gen.js";
36
+ import type * as statushistory from "./schema/statushistory.gen.js";
37
+ import type * as histogram from "./schema/histogram.gen.js";
38
+ import type * as nodegraph from "./schema/nodegraph.gen.js";
39
+ import type * as xychart from "./schema/xychart.gen.js";
40
+ import type * as trend from "./schema/trend.gen.js";
41
+ import type * as canvas from "./schema/canvas.gen.js";
42
+ import type * as geomap from "./schema/geomap.gen.js";
43
+ import type { AlertListOptions, FlameGraphOptions } from "./panel-options.js";
44
+ import type { Transformation } from "./transformations.js";
30
45
  /** `fieldConfig` with `defaults.custom` typed for the panel. */
31
46
  export interface PanelFieldConfig<C> {
32
47
  defaults?: DeepPartial<Omit<FieldConfig, "custom">> & {
@@ -51,7 +66,8 @@ export interface PanelProps<O = Record<string, unknown>, C = Record<string, unkn
51
66
  /** The panel plugin's own options, typed from its schema. */
52
67
  options?: DeepPartial<O>;
53
68
  fieldConfig?: PanelFieldConfig<C>;
54
- transformations?: DataTransformerConfig[];
69
+ /** Typed per transformer: `{ id: "organize", options: { ... } }`, `transformation(id, options)`, or `customTransformation()` for an id or option the types don't know. */
70
+ transformations?: Transformation[];
55
71
  links?: PanelLink[];
56
72
  /** Repeat the panel once per value of this variable. */
57
73
  repeat?: VariableEntity | string;
@@ -100,12 +116,12 @@ export declare function panelDefinitionFor(type: string): PanelDefinition | unde
100
116
  *
101
117
  * @example
102
118
  * ```ts
103
- * interface PieOptions { pieType?: "pie" | "donut"; legend?: { showLegend?: boolean } }
119
+ * interface ClockOptions { mode?: "time" | "countdown"; clockType?: "24 hour" | "12 hour" }
104
120
  *
105
- * export const PieChartPanel = definePanel<PieOptions>()({
106
- * type: "piechart",
107
- * className: "PieChartPanel",
108
- * defaultSize: { w: 8, h: 8 },
121
+ * export const ClockPanel = definePanel<ClockOptions>()({
122
+ * type: "grafana-clock-panel",
123
+ * className: "ClockPanel",
124
+ * defaultSize: { w: 6, h: 4 },
109
125
  * });
110
126
  * ```
111
127
  */
@@ -119,6 +135,19 @@ export declare const LogsPanel: PanelClass<"logs", logs.Options, Record<string,
119
135
  export declare const TracesPanel: PanelClass<"traces", Record<string, unknown>, Record<string, unknown>>;
120
136
  export declare const HeatmapPanel: PanelClass<"heatmap", heatmap.Options, heatmap.FieldConfig>;
121
137
  export declare const TextPanel: PanelClass<"text", text.Options, Record<string, unknown>>;
138
+ export declare const BarChartPanel: PanelClass<"barchart", barchart.Options, barchart.FieldConfig>;
139
+ export declare const BarGaugePanel: PanelClass<"bargauge", bargauge.Options, Record<string, unknown>>;
140
+ export declare const PieChartPanel: PanelClass<"piechart", piechart.Options, piechart.HideableFieldConfig>;
141
+ export declare const StateTimelinePanel: PanelClass<"state-timeline", statetimeline.Options, statetimeline.FieldConfig>;
142
+ export declare const StatusHistoryPanel: PanelClass<"status-history", statushistory.Options, statushistory.FieldConfig>;
143
+ export declare const HistogramPanel: PanelClass<"histogram", histogram.Options, histogram.FieldConfig>;
144
+ export declare const NodeGraphPanel: PanelClass<"nodeGraph", nodegraph.Options, Record<string, unknown>>;
145
+ export declare const XYChartPanel: PanelClass<"xychart", xychart.Options, xychart.FieldConfig>;
146
+ export declare const TrendPanel: PanelClass<"trend", trend.Options, trend.GraphFieldConfig>;
147
+ export declare const CanvasPanel: PanelClass<"canvas", canvas.Options, Record<string, unknown>>;
148
+ export declare const GeomapPanel: PanelClass<"geomap", geomap.Options, Record<string, unknown>>;
149
+ export declare const FlameGraphPanel: PanelClass<"flamegraph", FlameGraphOptions, Record<string, unknown>>;
150
+ export declare const AlertListPanel: PanelClass<"alertlist", AlertListOptions, Record<string, unknown>>;
122
151
  export interface RowProps {
123
152
  title: string;
124
153
  /** Collapsed rows keep their panels inside the row until opened. */
@@ -128,6 +157,14 @@ export interface RowProps {
128
157
  repeat?: VariableEntity | string;
129
158
  datasource?: DatasourceInput<any>;
130
159
  id?: number;
160
+ /**
161
+ * The grid line the row header sits on. Without it, the row goes on the
162
+ * first free line below everything declared before it. A row header is
163
+ * always full width and one line high, so `y` is all it takes.
164
+ */
165
+ gridPos?: {
166
+ y: number;
167
+ };
131
168
  }
132
169
  export interface RowEntity extends Declarable {
133
170
  readonly props: RowProps;