@intentius/chant-lexicon-grafana 0.96.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 (259) hide show
  1. package/README.md +50 -0
  2. package/dist/build.d.ts +116 -0
  3. package/dist/build.d.ts.map +1 -0
  4. package/dist/catalog.d.ts +26 -0
  5. package/dist/catalog.d.ts.map +1 -0
  6. package/dist/codegen/docs-cli.d.ts +3 -0
  7. package/dist/codegen/docs-cli.d.ts.map +1 -0
  8. package/dist/codegen/docs.d.ts +8 -0
  9. package/dist/codegen/docs.d.ts.map +1 -0
  10. package/dist/codegen/generate-cli.d.ts +3 -0
  11. package/dist/codegen/generate-cli.d.ts.map +1 -0
  12. package/dist/codegen/generate.d.ts +21 -0
  13. package/dist/codegen/generate.d.ts.map +1 -0
  14. package/dist/codegen/package.d.ts +7 -0
  15. package/dist/codegen/package.d.ts.map +1 -0
  16. package/dist/codegen/schema-types.d.ts +41 -0
  17. package/dist/codegen/schema-types.d.ts.map +1 -0
  18. package/dist/composites/agent-dashboard.d.ts +70 -0
  19. package/dist/composites/agent-dashboard.d.ts.map +1 -0
  20. package/dist/composites/catalog.d.ts +3 -0
  21. package/dist/composites/catalog.d.ts.map +1 -0
  22. package/dist/composites/index.d.ts +12 -0
  23. package/dist/composites/index.d.ts.map +1 -0
  24. package/dist/composites/red-dashboard.d.ts +58 -0
  25. package/dist/composites/red-dashboard.d.ts.map +1 -0
  26. package/dist/composites/shared.d.ts +68 -0
  27. package/dist/composites/shared.d.ts.map +1 -0
  28. package/dist/composites/slo-dashboard.d.ts +62 -0
  29. package/dist/composites/slo-dashboard.d.ts.map +1 -0
  30. package/dist/dashboard.d.ts +84 -0
  31. package/dist/dashboard.d.ts.map +1 -0
  32. package/dist/datasource.d.ts +67 -0
  33. package/dist/datasource.d.ts.map +1 -0
  34. package/dist/detect.d.ts +20 -0
  35. package/dist/detect.d.ts.map +1 -0
  36. package/dist/index.d.ts +17 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/integrity.json +22 -0
  39. package/dist/lint/audit-catalog.d.ts +13 -0
  40. package/dist/lint/audit-catalog.d.ts.map +1 -0
  41. package/dist/lint/post-synth/graf101.d.ts +8 -0
  42. package/dist/lint/post-synth/graf101.d.ts.map +1 -0
  43. package/dist/lint/post-synth/graf102.d.ts +8 -0
  44. package/dist/lint/post-synth/graf102.d.ts.map +1 -0
  45. package/dist/lint/post-synth/graf103.d.ts +8 -0
  46. package/dist/lint/post-synth/graf103.d.ts.map +1 -0
  47. package/dist/lint/post-synth/graf104.d.ts +8 -0
  48. package/dist/lint/post-synth/graf104.d.ts.map +1 -0
  49. package/dist/lint/post-synth/graf105.d.ts +8 -0
  50. package/dist/lint/post-synth/graf105.d.ts.map +1 -0
  51. package/dist/lint/post-synth/graf106.d.ts +8 -0
  52. package/dist/lint/post-synth/graf106.d.ts.map +1 -0
  53. package/dist/lint/post-synth/graf107.d.ts +8 -0
  54. package/dist/lint/post-synth/graf107.d.ts.map +1 -0
  55. package/dist/lint/post-synth/grafana-helpers.d.ts +16 -0
  56. package/dist/lint/post-synth/grafana-helpers.d.ts.map +1 -0
  57. package/dist/lint/post-synth/index.d.ts +3 -0
  58. package/dist/lint/post-synth/index.d.ts.map +1 -0
  59. package/dist/lint/rules/grafana-ast.d.ts +21 -0
  60. package/dist/lint/rules/grafana-ast.d.ts.map +1 -0
  61. package/dist/lint/rules/index.d.ts +6 -0
  62. package/dist/lint/rules/index.d.ts.map +1 -0
  63. package/dist/lint/rules/literal-secret.d.ts +12 -0
  64. package/dist/lint/rules/literal-secret.d.ts.map +1 -0
  65. package/dist/lint/rules/uid-syntax.d.ts +12 -0
  66. package/dist/lint/rules/uid-syntax.d.ts.map +1 -0
  67. package/dist/lsp/completions.d.ts +4 -0
  68. package/dist/lsp/completions.d.ts.map +1 -0
  69. package/dist/lsp/hover.d.ts +4 -0
  70. package/dist/lsp/hover.d.ts.map +1 -0
  71. package/dist/manifest.json +8 -0
  72. package/dist/meta.json +107 -0
  73. package/dist/okf/index.md +39 -0
  74. package/dist/okf/rules/GRAF001.md +16 -0
  75. package/dist/okf/rules/GRAF002.md +15 -0
  76. package/dist/okf/rules/GRAF101.md +15 -0
  77. package/dist/okf/rules/GRAF102.md +15 -0
  78. package/dist/okf/rules/GRAF103.md +11 -0
  79. package/dist/okf/rules/GRAF104.md +15 -0
  80. package/dist/okf/rules/GRAF105.md +11 -0
  81. package/dist/okf/rules/GRAF106.md +11 -0
  82. package/dist/okf/rules/GRAF107.md +11 -0
  83. package/dist/okf/types/ConstantVariable.md +9 -0
  84. package/dist/okf/types/CustomVariable.md +9 -0
  85. package/dist/okf/types/Dashboard.md +14 -0
  86. package/dist/okf/types/DashboardProvider.md +9 -0
  87. package/dist/okf/types/Datasource.md +16 -0
  88. package/dist/okf/types/DatasourceVariable.md +9 -0
  89. package/dist/okf/types/GaugePanel.md +9 -0
  90. package/dist/okf/types/HeatmapPanel.md +9 -0
  91. package/dist/okf/types/IntervalVariable.md +9 -0
  92. package/dist/okf/types/LogsPanel.md +9 -0
  93. package/dist/okf/types/LokiQuery.md +9 -0
  94. package/dist/okf/types/PromQuery.md +9 -0
  95. package/dist/okf/types/QueryVariable.md +9 -0
  96. package/dist/okf/types/Row.md +9 -0
  97. package/dist/okf/types/StatPanel.md +9 -0
  98. package/dist/okf/types/TablePanel.md +9 -0
  99. package/dist/okf/types/TempoQuery.md +9 -0
  100. package/dist/okf/types/TextPanel.md +9 -0
  101. package/dist/okf/types/TextboxVariable.md +9 -0
  102. package/dist/okf/types/TimeSeriesPanel.md +9 -0
  103. package/dist/okf/types/TracesPanel.md +9 -0
  104. package/dist/package-cli.d.ts +3 -0
  105. package/dist/package-cli.d.ts.map +1 -0
  106. package/dist/panels.d.ts +138 -0
  107. package/dist/panels.d.ts.map +1 -0
  108. package/dist/pin.d.ts +32 -0
  109. package/dist/pin.d.ts.map +1 -0
  110. package/dist/plugin.d.ts +12 -0
  111. package/dist/plugin.d.ts.map +1 -0
  112. package/dist/query.d.ts +81 -0
  113. package/dist/query.d.ts.map +1 -0
  114. package/dist/rules/graf101.ts +17 -0
  115. package/dist/rules/graf102.ts +17 -0
  116. package/dist/rules/graf103.ts +17 -0
  117. package/dist/rules/graf104.ts +17 -0
  118. package/dist/rules/graf105.ts +17 -0
  119. package/dist/rules/graf106.ts +17 -0
  120. package/dist/rules/graf107.ts +17 -0
  121. package/dist/rules/grafana-ast.ts +70 -0
  122. package/dist/rules/grafana-helpers.ts +68 -0
  123. package/dist/rules/literal-secret.ts +48 -0
  124. package/dist/rules/uid-syntax.ts +56 -0
  125. package/dist/schema/dashboard.gen.d.ts +1231 -0
  126. package/dist/schema/dashboard.gen.d.ts.map +1 -0
  127. package/dist/schema/gauge.gen.d.ts +57 -0
  128. package/dist/schema/gauge.gen.d.ts.map +1 -0
  129. package/dist/schema/heatmap.gen.d.ts +295 -0
  130. package/dist/schema/heatmap.gen.d.ts.map +1 -0
  131. package/dist/schema/index.d.ts +18 -0
  132. package/dist/schema/index.d.ts.map +1 -0
  133. package/dist/schema/logs.gen.d.ts +29 -0
  134. package/dist/schema/logs.gen.d.ts.map +1 -0
  135. package/dist/schema/loki.gen.d.ts +69 -0
  136. package/dist/schema/loki.gen.d.ts.map +1 -0
  137. package/dist/schema/prometheus.gen.d.ts +169 -0
  138. package/dist/schema/prometheus.gen.d.ts.map +1 -0
  139. package/dist/schema/stat.gen.d.ts +75 -0
  140. package/dist/schema/stat.gen.d.ts.map +1 -0
  141. package/dist/schema/table.gen.d.ts +295 -0
  142. package/dist/schema/table.gen.d.ts.map +1 -0
  143. package/dist/schema/tempo.gen.d.ts +136 -0
  144. package/dist/schema/tempo.gen.d.ts.map +1 -0
  145. package/dist/schema/text.gen.d.ts +16 -0
  146. package/dist/schema/text.gen.d.ts.map +1 -0
  147. package/dist/schema/timeseries.gen.d.ts +179 -0
  148. package/dist/schema/timeseries.gen.d.ts.map +1 -0
  149. package/dist/schema-validate.d.ts +20 -0
  150. package/dist/schema-validate.d.ts.map +1 -0
  151. package/dist/serializer.d.ts +22 -0
  152. package/dist/serializer.d.ts.map +1 -0
  153. package/dist/skill-defs.d.ts +3 -0
  154. package/dist/skill-defs.d.ts.map +1 -0
  155. package/dist/skills/chant-grafana-provisioning.md +42 -0
  156. package/dist/skills/chant-grafana.md +93 -0
  157. package/dist/spec/fetch-cli.d.ts +3 -0
  158. package/dist/spec/fetch-cli.d.ts.map +1 -0
  159. package/dist/spec/schemas.d.ts +25 -0
  160. package/dist/spec/schemas.d.ts.map +1 -0
  161. package/dist/types/index.d.ts +3 -0
  162. package/dist/util.d.ts +17 -0
  163. package/dist/util.d.ts.map +1 -0
  164. package/dist/validate-cli.d.ts +3 -0
  165. package/dist/validate-cli.d.ts.map +1 -0
  166. package/dist/validate-output.d.ts +42 -0
  167. package/dist/validate-output.d.ts.map +1 -0
  168. package/dist/validate.d.ts +12 -0
  169. package/dist/validate.d.ts.map +1 -0
  170. package/dist/variables.d.ts +100 -0
  171. package/dist/variables.d.ts.map +1 -0
  172. package/package.json +79 -0
  173. package/src/build.test.ts +210 -0
  174. package/src/build.ts +573 -0
  175. package/src/catalog.ts +116 -0
  176. package/src/codegen/docs-cli.ts +4 -0
  177. package/src/codegen/docs.ts +97 -0
  178. package/src/codegen/generate-cli.ts +8 -0
  179. package/src/codegen/generate.ts +83 -0
  180. package/src/codegen/package.ts +41 -0
  181. package/src/codegen/schema-types.ts +173 -0
  182. package/src/composites/agent-dashboard.ts +235 -0
  183. package/src/composites/catalog.test.ts +37 -0
  184. package/src/composites/catalog.ts +223 -0
  185. package/src/composites/composites.test.ts +314 -0
  186. package/src/composites/index.ts +12 -0
  187. package/src/composites/red-dashboard.ts +159 -0
  188. package/src/composites/shared.ts +94 -0
  189. package/src/composites/slo-dashboard.ts +177 -0
  190. package/src/dashboard.ts +123 -0
  191. package/src/datasource.ts +93 -0
  192. package/src/detect.ts +30 -0
  193. package/src/generated/lexicon-grafana.json +107 -0
  194. package/src/import.e2e.test.ts +147 -0
  195. package/src/import.test.ts +45 -0
  196. package/src/index.ts +178 -0
  197. package/src/lint/audit-catalog.ts +87 -0
  198. package/src/lint/post-synth/graf101.ts +17 -0
  199. package/src/lint/post-synth/graf102.ts +17 -0
  200. package/src/lint/post-synth/graf103.ts +17 -0
  201. package/src/lint/post-synth/graf104.ts +17 -0
  202. package/src/lint/post-synth/graf105.ts +17 -0
  203. package/src/lint/post-synth/graf106.ts +17 -0
  204. package/src/lint/post-synth/graf107.ts +17 -0
  205. package/src/lint/post-synth/grafana-helpers.ts +68 -0
  206. package/src/lint/post-synth/index.ts +19 -0
  207. package/src/lint/post-synth/post-synth.test.ts +231 -0
  208. package/src/lint/rules/grafana-ast.ts +70 -0
  209. package/src/lint/rules/index.ts +9 -0
  210. package/src/lint/rules/literal-secret.ts +48 -0
  211. package/src/lint/rules/rules.test.ts +70 -0
  212. package/src/lint/rules/uid-syntax.ts +56 -0
  213. package/src/lsp/completions.test.ts +31 -0
  214. package/src/lsp/completions.ts +15 -0
  215. package/src/lsp/hover.test.ts +25 -0
  216. package/src/lsp/hover.ts +28 -0
  217. package/src/package-cli.ts +17 -0
  218. package/src/panels.ts +275 -0
  219. package/src/pin.ts +68 -0
  220. package/src/plugin.test.ts +50 -0
  221. package/src/plugin.ts +116 -0
  222. package/src/query.ts +160 -0
  223. package/src/schema/dashboard.gen.ts +1289 -0
  224. package/src/schema/gauge.gen.ts +64 -0
  225. package/src/schema/heatmap.gen.ts +321 -0
  226. package/src/schema/index.ts +17 -0
  227. package/src/schema/logs.gen.ts +34 -0
  228. package/src/schema/loki.gen.ts +77 -0
  229. package/src/schema/prometheus.gen.ts +181 -0
  230. package/src/schema/stat.gen.ts +86 -0
  231. package/src/schema/table.gen.ts +334 -0
  232. package/src/schema/tempo.gen.ts +146 -0
  233. package/src/schema/text.gen.ts +22 -0
  234. package/src/schema/timeseries.gen.ts +208 -0
  235. package/src/schema-validate.ts +143 -0
  236. package/src/schema.test.ts +76 -0
  237. package/src/serializer.test.ts +170 -0
  238. package/src/serializer.ts +37 -0
  239. package/src/skill-defs.ts +31 -0
  240. package/src/skills/chant-grafana-provisioning.md +42 -0
  241. package/src/skills/chant-grafana.md +93 -0
  242. package/src/spec/fetch-cli.ts +27 -0
  243. package/src/spec/schemas/dashboard.jsonschema.json +1901 -0
  244. package/src/spec/schemas/gauge.jsonschema.json +114 -0
  245. package/src/spec/schemas/heatmap.jsonschema.json +480 -0
  246. package/src/spec/schemas/logs.jsonschema.json +94 -0
  247. package/src/spec/schemas/loki.jsonschema.json +118 -0
  248. package/src/spec/schemas/prometheus.jsonschema.json +276 -0
  249. package/src/spec/schemas/stat.jsonschema.json +163 -0
  250. package/src/spec/schemas/table.jsonschema.json +751 -0
  251. package/src/spec/schemas/tempo.jsonschema.json +225 -0
  252. package/src/spec/schemas/text.jsonschema.json +72 -0
  253. package/src/spec/schemas/timeseries.jsonschema.json +471 -0
  254. package/src/spec/schemas.ts +56 -0
  255. package/src/util.ts +43 -0
  256. package/src/validate-cli.ts +7 -0
  257. package/src/validate-output.ts +380 -0
  258. package/src/validate.ts +108 -0
  259. package/src/variables.ts +161 -0
@@ -0,0 +1,471 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "definitions": {
4
+ "Options": {
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "legend",
9
+ "tooltip"
10
+ ],
11
+ "properties": {
12
+ "timezone": {
13
+ "type": "array",
14
+ "items": {
15
+ "$ref": "#/definitions/TimeZone"
16
+ }
17
+ },
18
+ "legend": {
19
+ "$ref": "#/definitions/VizLegendOptions",
20
+ "default": {
21
+ "calcs": [],
22
+ "displayMode": "list",
23
+ "placement": "bottom"
24
+ }
25
+ },
26
+ "tooltip": {
27
+ "$ref": "#/definitions/VizTooltipOptions"
28
+ },
29
+ "orientation": {
30
+ "$ref": "#/definitions/VizOrientation"
31
+ }
32
+ }
33
+ },
34
+ "FieldConfig": {
35
+ "$ref": "#/definitions/GraphFieldConfig"
36
+ },
37
+ "TimeZone": {
38
+ "type": "string",
39
+ "description": "A specific timezone from https://en.wikipedia.org/wiki/Tz_database"
40
+ },
41
+ "VizLegendOptions": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": [
45
+ "displayMode",
46
+ "placement",
47
+ "showLegend",
48
+ "calcs"
49
+ ],
50
+ "properties": {
51
+ "displayMode": {
52
+ "$ref": "#/definitions/LegendDisplayMode",
53
+ "default": "list"
54
+ },
55
+ "placement": {
56
+ "$ref": "#/definitions/LegendPlacement",
57
+ "default": "bottom"
58
+ },
59
+ "showLegend": {
60
+ "type": "boolean"
61
+ },
62
+ "asTable": {
63
+ "type": "boolean"
64
+ },
65
+ "isVisible": {
66
+ "type": "boolean"
67
+ },
68
+ "sortBy": {
69
+ "type": "string"
70
+ },
71
+ "sortDesc": {
72
+ "type": "boolean"
73
+ },
74
+ "width": {
75
+ "type": "number"
76
+ },
77
+ "calcs": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ },
82
+ "default": []
83
+ }
84
+ },
85
+ "description": "TODO docs"
86
+ },
87
+ "VizTooltipOptions": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": [
91
+ "mode",
92
+ "sort"
93
+ ],
94
+ "properties": {
95
+ "mode": {
96
+ "$ref": "#/definitions/TooltipDisplayMode"
97
+ },
98
+ "sort": {
99
+ "$ref": "#/definitions/SortOrder"
100
+ },
101
+ "maxWidth": {
102
+ "type": "number"
103
+ },
104
+ "maxHeight": {
105
+ "type": "number"
106
+ },
107
+ "hideZeros": {
108
+ "type": "boolean"
109
+ }
110
+ },
111
+ "description": "TODO docs"
112
+ },
113
+ "VizOrientation": {
114
+ "enum": [
115
+ "auto",
116
+ "vertical",
117
+ "horizontal"
118
+ ],
119
+ "type": "string",
120
+ "description": "TODO docs"
121
+ },
122
+ "GraphFieldConfig": {
123
+ "type": "object",
124
+ "additionalProperties": false,
125
+ "properties": {
126
+ "drawStyle": {
127
+ "$ref": "#/definitions/GraphDrawStyle"
128
+ },
129
+ "gradientMode": {
130
+ "$ref": "#/definitions/GraphGradientMode"
131
+ },
132
+ "thresholdsStyle": {
133
+ "$ref": "#/definitions/GraphThresholdsStyleConfig"
134
+ },
135
+ "transform": {
136
+ "$ref": "#/definitions/GraphTransform"
137
+ },
138
+ "lineColor": {
139
+ "type": "string"
140
+ },
141
+ "lineWidth": {
142
+ "type": "number"
143
+ },
144
+ "lineInterpolation": {
145
+ "$ref": "#/definitions/LineInterpolation"
146
+ },
147
+ "lineStyle": {
148
+ "$ref": "#/definitions/LineStyle"
149
+ },
150
+ "fillColor": {
151
+ "type": "string"
152
+ },
153
+ "fillOpacity": {
154
+ "type": "number"
155
+ },
156
+ "showPoints": {
157
+ "$ref": "#/definitions/VisibilityMode"
158
+ },
159
+ "pointSize": {
160
+ "type": "number"
161
+ },
162
+ "pointColor": {
163
+ "type": "string"
164
+ },
165
+ "axisPlacement": {
166
+ "$ref": "#/definitions/AxisPlacement"
167
+ },
168
+ "axisColorMode": {
169
+ "$ref": "#/definitions/AxisColorMode"
170
+ },
171
+ "axisLabel": {
172
+ "type": "string"
173
+ },
174
+ "axisWidth": {
175
+ "type": "number"
176
+ },
177
+ "axisSoftMin": {
178
+ "type": "number"
179
+ },
180
+ "axisSoftMax": {
181
+ "type": "number"
182
+ },
183
+ "axisGridShow": {
184
+ "type": "boolean"
185
+ },
186
+ "scaleDistribution": {
187
+ "$ref": "#/definitions/ScaleDistributionConfig"
188
+ },
189
+ "axisCenteredZero": {
190
+ "type": "boolean"
191
+ },
192
+ "barAlignment": {
193
+ "$ref": "#/definitions/BarAlignment"
194
+ },
195
+ "barWidthFactor": {
196
+ "type": "number"
197
+ },
198
+ "stacking": {
199
+ "$ref": "#/definitions/StackingConfig"
200
+ },
201
+ "hideFrom": {
202
+ "$ref": "#/definitions/HideSeriesConfig"
203
+ },
204
+ "insertNulls": {
205
+ "oneOf": [
206
+ {
207
+ "type": "boolean"
208
+ },
209
+ {
210
+ "type": "number"
211
+ }
212
+ ]
213
+ },
214
+ "spanNulls": {
215
+ "oneOf": [
216
+ {
217
+ "type": "boolean"
218
+ },
219
+ {
220
+ "type": "number"
221
+ }
222
+ ],
223
+ "description": "Indicate if null values should be treated as gaps or connected.\nWhen the value is a number, it represents the maximum delta in the\nX axis that should be considered connected. For timeseries, this is milliseconds"
224
+ },
225
+ "fillBelowTo": {
226
+ "type": "string"
227
+ },
228
+ "pointSymbol": {
229
+ "type": "string"
230
+ },
231
+ "axisBorderShow": {
232
+ "type": "boolean"
233
+ },
234
+ "barMaxWidth": {
235
+ "type": "number"
236
+ }
237
+ },
238
+ "description": "TODO docs"
239
+ },
240
+ "LegendDisplayMode": {
241
+ "enum": [
242
+ "list",
243
+ "table",
244
+ "hidden"
245
+ ],
246
+ "type": "string",
247
+ "description": "TODO docs\nNote: \"hidden\" needs to remain as an option for plugins compatibility"
248
+ },
249
+ "LegendPlacement": {
250
+ "enum": [
251
+ "bottom",
252
+ "right"
253
+ ],
254
+ "type": "string",
255
+ "description": "TODO docs"
256
+ },
257
+ "TooltipDisplayMode": {
258
+ "enum": [
259
+ "single",
260
+ "multi",
261
+ "none"
262
+ ],
263
+ "type": "string",
264
+ "description": "TODO docs"
265
+ },
266
+ "SortOrder": {
267
+ "enum": [
268
+ "asc",
269
+ "desc",
270
+ "none"
271
+ ],
272
+ "type": "string",
273
+ "description": "TODO docs"
274
+ },
275
+ "GraphDrawStyle": {
276
+ "enum": [
277
+ "line",
278
+ "bars",
279
+ "points"
280
+ ],
281
+ "type": "string",
282
+ "description": "TODO docs"
283
+ },
284
+ "GraphGradientMode": {
285
+ "enum": [
286
+ "none",
287
+ "opacity",
288
+ "hue",
289
+ "scheme"
290
+ ],
291
+ "type": "string",
292
+ "description": "TODO docs"
293
+ },
294
+ "GraphThresholdsStyleConfig": {
295
+ "type": "object",
296
+ "additionalProperties": false,
297
+ "required": [
298
+ "mode"
299
+ ],
300
+ "properties": {
301
+ "mode": {
302
+ "$ref": "#/definitions/GraphThresholdsStyleMode"
303
+ }
304
+ },
305
+ "description": "TODO docs"
306
+ },
307
+ "GraphTransform": {
308
+ "enum": [
309
+ "constant",
310
+ "negative-Y"
311
+ ],
312
+ "type": "string",
313
+ "description": "TODO docs"
314
+ },
315
+ "LineInterpolation": {
316
+ "enum": [
317
+ "linear",
318
+ "smooth",
319
+ "stepBefore",
320
+ "stepAfter"
321
+ ],
322
+ "type": "string",
323
+ "description": "TODO docs"
324
+ },
325
+ "LineStyle": {
326
+ "type": "object",
327
+ "additionalProperties": false,
328
+ "properties": {
329
+ "fill": {
330
+ "enum": [
331
+ "solid",
332
+ "dash",
333
+ "dot",
334
+ "square"
335
+ ],
336
+ "type": "string"
337
+ },
338
+ "dash": {
339
+ "type": "array",
340
+ "items": {
341
+ "type": "number"
342
+ }
343
+ }
344
+ },
345
+ "description": "TODO docs"
346
+ },
347
+ "VisibilityMode": {
348
+ "enum": [
349
+ "auto",
350
+ "never",
351
+ "always"
352
+ ],
353
+ "type": "string",
354
+ "description": "TODO docs"
355
+ },
356
+ "AxisPlacement": {
357
+ "enum": [
358
+ "auto",
359
+ "top",
360
+ "right",
361
+ "bottom",
362
+ "left",
363
+ "hidden"
364
+ ],
365
+ "type": "string",
366
+ "description": "TODO docs"
367
+ },
368
+ "AxisColorMode": {
369
+ "enum": [
370
+ "text",
371
+ "series"
372
+ ],
373
+ "type": "string",
374
+ "description": "TODO docs"
375
+ },
376
+ "ScaleDistributionConfig": {
377
+ "type": "object",
378
+ "additionalProperties": false,
379
+ "required": [
380
+ "type"
381
+ ],
382
+ "properties": {
383
+ "type": {
384
+ "$ref": "#/definitions/ScaleDistribution"
385
+ },
386
+ "log": {
387
+ "type": "number"
388
+ },
389
+ "linearThreshold": {
390
+ "type": "number"
391
+ }
392
+ },
393
+ "description": "TODO docs"
394
+ },
395
+ "BarAlignment": {
396
+ "enum": [
397
+ -1,
398
+ 0,
399
+ 1
400
+ ],
401
+ "type": "integer",
402
+ "description": "TODO docs"
403
+ },
404
+ "StackingConfig": {
405
+ "type": "object",
406
+ "additionalProperties": false,
407
+ "properties": {
408
+ "mode": {
409
+ "$ref": "#/definitions/StackingMode"
410
+ },
411
+ "group": {
412
+ "type": "string"
413
+ }
414
+ },
415
+ "description": "TODO docs"
416
+ },
417
+ "HideSeriesConfig": {
418
+ "type": "object",
419
+ "additionalProperties": false,
420
+ "required": [
421
+ "tooltip",
422
+ "legend",
423
+ "viz"
424
+ ],
425
+ "properties": {
426
+ "tooltip": {
427
+ "type": "boolean"
428
+ },
429
+ "legend": {
430
+ "type": "boolean"
431
+ },
432
+ "viz": {
433
+ "type": "boolean"
434
+ }
435
+ },
436
+ "description": "TODO docs"
437
+ },
438
+ "GraphThresholdsStyleMode": {
439
+ "enum": [
440
+ "off",
441
+ "line",
442
+ "dashed",
443
+ "area",
444
+ "line+area",
445
+ "dashed+area",
446
+ "series"
447
+ ],
448
+ "type": "string",
449
+ "description": "TODO docs"
450
+ },
451
+ "ScaleDistribution": {
452
+ "enum": [
453
+ "linear",
454
+ "log",
455
+ "ordinal",
456
+ "symlog"
457
+ ],
458
+ "type": "string",
459
+ "description": "TODO docs"
460
+ },
461
+ "StackingMode": {
462
+ "enum": [
463
+ "none",
464
+ "normal",
465
+ "percent"
466
+ ],
467
+ "type": "string",
468
+ "description": "TODO docs"
469
+ }
470
+ }
471
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Read the vendored Grafana schemas (`src/spec/schemas/*.jsonschema.json`) and check
3
+ * them against the digests in `GRAFANA_SCHEMA_PIN`.
4
+ */
5
+
6
+ import { createHash } from "crypto";
7
+ import { readFileSync } from "fs";
8
+ import { dirname, join } from "path";
9
+ import { fileURLToPath } from "url";
10
+ import { GRAFANA_SCHEMA_PIN, SCHEMA_NAMES, type SchemaName } from "../pin";
11
+
12
+ /**
13
+ * Where the vendored files live: beside this module, under `src/`, so they
14
+ * ship with the source the package runs from and GRAF107 can read them.
15
+ * A function, not a module-scope constant, so edge bundles that import the
16
+ * lexicon never evaluate a filesystem path at load.
17
+ */
18
+ export function schemasDir(): string {
19
+ return join(dirname(fileURLToPath(import.meta.url)), "schemas");
20
+ }
21
+
22
+ export function schemaPath(name: SchemaName): string {
23
+ return join(schemasDir(), `${name}.jsonschema.json`);
24
+ }
25
+
26
+ export function sha256(text: string | Buffer): string {
27
+ return createHash("sha256").update(text).digest("hex");
28
+ }
29
+
30
+ /** The raw bytes of one vendored schema. */
31
+ export function readSchemaText(name: SchemaName): string {
32
+ return readFileSync(schemaPath(name), "utf-8");
33
+ }
34
+
35
+ const parsed = new Map<SchemaName, Record<string, unknown>>();
36
+
37
+ /** One vendored schema, parsed (cached per process). */
38
+ export function loadSchema(name: SchemaName): Record<string, unknown> {
39
+ let schema = parsed.get(name);
40
+ if (!schema) {
41
+ schema = JSON.parse(readSchemaText(name)) as Record<string, unknown>;
42
+ parsed.set(name, schema);
43
+ }
44
+ return schema;
45
+ }
46
+
47
+ /** Vendored files whose digest does not match the pin, with what was found. */
48
+ export function digestMismatches(): Array<{ name: SchemaName; expected: string; actual: string }> {
49
+ const out: Array<{ name: SchemaName; expected: string; actual: string }> = [];
50
+ for (const name of SCHEMA_NAMES) {
51
+ const actual = sha256(readFileSync(schemaPath(name)));
52
+ const expected = GRAFANA_SCHEMA_PIN.files[name];
53
+ if (actual !== expected) out.push({ name, expected, actual });
54
+ }
55
+ return out;
56
+ }
package/src/util.ts ADDED
@@ -0,0 +1,43 @@
1
+ /** Small helpers shared by the entity modules and the builder. */
2
+
3
+ /** Every field optional, all the way down; arrays keep their element type partial too. */
4
+ export type DeepPartial<T> = T extends (infer U)[]
5
+ ? DeepPartial<U>[]
6
+ : T extends object
7
+ ? { [K in keyof T]?: DeepPartial<T[K]> }
8
+ : T;
9
+
10
+ /** Grafana's uid alphabet: letters, digits, `-` and `_`, at most 40 characters. */
11
+ export const UID_PATTERN = /^[A-Za-z0-9_-]{1,40}$/;
12
+
13
+ export function isValidUid(uid: string): boolean {
14
+ return UID_PATTERN.test(uid);
15
+ }
16
+
17
+ /**
18
+ * A uid from free text (an export name or a datasource name): camelCase and
19
+ * spaces become `-`, anything outside the uid alphabet is dropped, and the
20
+ * result is cut to 40 characters.
21
+ */
22
+ export function slugUid(text: string): string {
23
+ const slug = text
24
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
25
+ .replace(/[^A-Za-z0-9_-]+/g, "-")
26
+ .replace(/-+/g, "-")
27
+ .replace(/^-|-$/g, "")
28
+ .toLowerCase();
29
+ return slug.slice(0, 40).replace(/-$/, "") || "dashboard";
30
+ }
31
+
32
+ /** Copy `value` with every `undefined` property dropped, recursively; keeps key order. */
33
+ export function compact<T>(value: T): T {
34
+ if (Array.isArray(value)) return value.map((v) => compact(v)) as unknown as T;
35
+ if (value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
36
+ const out: Record<string, unknown> = {};
37
+ for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
38
+ if (v !== undefined) out[k] = compact(v);
39
+ }
40
+ return out as T;
41
+ }
42
+ return value;
43
+ }
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env tsx
2
+ import { printValidationResult } from "@intentius/chant/codegen/validate";
3
+ import { validate } from "./validate";
4
+
5
+ const result = await validate();
6
+ printValidationResult(result);
7
+ if (!result.success) process.exit(1);